/* Vitality App — dark premium: glass, glow, motion */
:root {
  --bg: #05070A;
  --glass: rgba(255, 255, 255, 0.035);
  --glass2: rgba(255, 255, 255, 0.06);
  --border: rgba(130, 200, 220, 0.10);
  --border-strong: rgba(72, 202, 228, 0.28);
  --ink: #EDF6F9;
  --ink2: #9DB4BC;
  --muted: #5E737B;
  --accent: #00BCD4;
  --accent-bright: #48CAE4;
  --accent-deep: #0077B6;
  --accent-soft: rgba(0, 188, 212, 0.12);
  --glow: 0 0 24px rgba(0, 188, 212, 0.22);
  --danger: #E05B5B;
  --radius: 20px;
  --tabbar-h: 68px;
  --font-display: "Space Grotesk", "Avenir Next", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.65;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ---------- fondo ambiental ---------- */
#fx {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 45% at 50% -10%, rgba(0, 119, 182, 0.22), transparent 60%),
    radial-gradient(ellipse 70% 40% at 85% 110%, rgba(0, 188, 212, 0.10), transparent 60%),
    radial-gradient(ellipse 55% 35% at 8% 55%, rgba(0, 150, 199, 0.07), transparent 65%);
}

#app {
  position: relative; z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom));
}

.view { display: none; }
.view.active { display: block; }

/* revelado escalonado */
.view.active .card,
.view.active .score-hero,
.view.active .calstrip-wrap,
.view.active .minitiles,
.view.active .step,
.view.active .study,
.view.active .product-chips {
  animation: rise 0.55s cubic-bezier(0.22, 0.9, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .view.active .card, .view.active .score-hero, .view.active .calstrip-wrap,
  .view.active .minitiles, .view.active .step,
  .view.active .study, .view.active .product-chips { animation: none; }
}

/* ---------- cabecera ---------- */
.topbar { display: flex; align-items: center; gap: 15px; padding: 14px 0 22px; }
.brandmark {
  width: 48px; height: 48px; border-radius: 14px;
  box-shadow: 0 0 0 1px var(--border), var(--glow);
}
.eyebrow {
  margin: 0; font-size: 10.5px; font-weight: 600; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--accent-bright);
  font-family: var(--font-display);
  text-shadow: 0 0 18px rgba(72, 202, 228, 0.55);
}
h1 {
  margin: 3px 0 0; font-size: 27px; line-height: 1.12; letter-spacing: -0.015em;
  font-family: var(--font-display); font-weight: 700;
  background: linear-gradient(120deg, #FFFFFF 30%, #9AE3F2 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  text-wrap: balance;
}
.datesub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.datesub::first-letter { text-transform: uppercase; }
h2 {
  margin: 0 0 6px; font-size: 17px; letter-spacing: -0.01em;
  font-family: var(--font-display); font-weight: 600;
}

/* ---------- glass cards ---------- */
.card, .score-hero, .step, .study {
  position: relative;
  background: linear-gradient(165deg, var(--glass2), var(--glass) 55%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.42);
  overflow: hidden;
}
.card::before, .score-hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150, 225, 240, 0.35), transparent);
  pointer-events: none;
}
.card { padding: 20px; margin: 0 0 15px; }
.card p { margin: 6px 0; color: var(--ink2); font-size: 14.5px; }
.card p strong { color: var(--ink); }
.hint { font-size: 13px !important; color: var(--muted) !important; }
.glow-card { border-color: var(--border-strong); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.42), var(--glow); }

/* ---------- tira de calendario ---------- */
.calstrip-wrap { margin: 0 -18px 15px; padding: 0 18px; overflow-x: auto; scrollbar-width: none; }
.calstrip-wrap::-webkit-scrollbar { display: none; }
.calstrip { display: flex; gap: 8px; width: max-content; padding: 2px; }
.calday {
  appearance: none; border: 1px solid var(--border); cursor: pointer;
  background: var(--glass2);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 46px; padding: 9px 6px 7px; border-radius: 15px;
  font-family: var(--font-display); color: var(--ink2);
  transition: transform 0.15s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.calday:active { transform: scale(0.93); }
.calday .dw { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.calday .dn { font-size: 16px; font-weight: 700; }
.calday .dot-ind { width: 5px; height: 5px; border-radius: 50%; background: transparent; margin-top: 1px; }
.calday.has-data .dot-ind { background: var(--accent-bright); box-shadow: 0 0 7px rgba(72, 202, 228, 0.8); }
.calday.sel {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent) 60%, var(--accent-deep));
  border-color: transparent; box-shadow: 0 5px 22px rgba(0, 188, 212, 0.45);
}
.calday.sel .dw, .calday.sel .dn { color: #03242B; }
.calday.sel.has-data .dot-ind { background: #03242B; box-shadow: none; }

/* ---------- score hero ---------- */
.score-hero {
  padding: 26px 22px 22px; margin: 0 0 15px; text-align: center;
  border-color: var(--border-strong);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5), var(--glow);
}
.score-ring-wrap { position: relative; width: 186px; height: 186px; margin: 0 auto; }
.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 10; }
.score-fill {
  fill: none; stroke: url(#scoreGrad); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 490.1; stroke-dashoffset: 490.1;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 0.9, 0.3, 1);
  filter: drop-shadow(0 0 9px rgba(72, 202, 228, 0.55));
}
.score-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-num {
  font-family: var(--font-display); font-size: 52px; font-weight: 700; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 26px rgba(72, 202, 228, 0.45);
}
.score-state {
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  font-family: var(--font-display); color: var(--accent-bright); margin-top: 6px;
}
.insight { margin: 16px auto 0; font-size: 14.5px; color: var(--ink2); max-width: 40ch; }

/* ---------- mini tiles ---------- */
.minitiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 15px; }
.minitile {
  background: linear-gradient(165deg, var(--glass2), var(--glass) 55%);
  border: 1px solid var(--border); border-radius: 17px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  padding: 13px 8px; text-align: center;
}
.mini-value {
  display: block; font-family: var(--font-display); font-size: 23px; font-weight: 700;
  color: var(--accent-bright); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(72, 202, 228, 0.45);
}
.mini-label { font-size: 11px; color: var(--ink2); }

/* ---------- contribuyentes ---------- */
.contrib { display: flex; align-items: center; gap: 13px; padding: 10px 0; }
.contrib .c-name { width: 84px; flex-shrink: 0; font-size: 13.5px; color: var(--ink2); }
.contrib .c-bar { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.contrib .c-bar > i {
  display: block; height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-bright));
  box-shadow: 0 0 10px rgba(72, 202, 228, 0.5);
  transition: width 0.8s cubic-bezier(0.22, 0.9, 0.3, 1);
}
.contrib .c-val {
  width: 64px; flex-shrink: 0; text-align: right;
  font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--ink);
}
.contrib .c-val.na { color: var(--muted); font-weight: 500; }

/* ---------- charts ---------- */
.cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.range-lbl { font-size: 11.5px; color: var(--muted); font-family: var(--font-display); letter-spacing: 0.04em; }
.grouplbl {
  margin: 18px 0 2px !important; font-size: 11.5px !important; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted) !important;
  font-family: var(--font-display);
}
.chartbox { margin-top: 10px; }
.chartbox svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12.5px; color: var(--ink2); }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.chart-empty { font-size: 13px; color: var(--muted); padding: 22px 0 12px; text-align: center; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.chip {
  appearance: none; font: inherit; font-size: 14px; font-weight: 600;
  font-family: var(--font-display);
  color: var(--ink2);
  background: var(--glass2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 11px 19px; min-height: 46px; cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform 0.15s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.chip:active { transform: scale(0.94); }
.chip:focus-visible, .scale button:focus-visible, .tab:focus-visible, .btn:focus-visible, .linkrow:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.chip.active, .chip[aria-selected="true"] {
  color: #03242B;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent) 60%, var(--accent-deep));
  border-color: transparent;
  box-shadow: 0 4px 22px rgba(0, 188, 212, 0.45);
}
.product-chips { margin: 0 0 18px; }

/* ---------- escalas 1-5 ---------- */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin-top: 12px; }
.scale button {
  appearance: none; font-family: var(--font-display); font-size: 17px; font-weight: 700;
  color: var(--ink2); background: var(--glass2);
  border: 1px solid var(--border); border-radius: 14px;
  min-height: 50px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.scale button:active { transform: scale(0.92); }
.scale button.active {
  color: #03242B;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(72, 202, 228, 0.5);
  transform: scale(1.06);
}

/* ---------- gráfico semanal ---------- */
.week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px;
  align-items: end; height: 118px; margin-top: 16px;
}
.week .day { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; height: 100%; }
.week .bar {
  width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent-deep));
  min-height: 3px; height: 3%;
  transition: height 0.7s cubic-bezier(0.22, 0.9, 0.3, 1);
}
.week .bar.empty { background: rgba(255, 255, 255, 0.06); }
.week .day.today .bar:not(.empty) { box-shadow: 0 0 16px rgba(72, 202, 228, 0.55); }
.week .lbl { font-size: 10.5px; color: var(--muted); font-family: var(--font-display); }
.week .day.today .lbl { color: var(--accent-bright); font-weight: 700; text-shadow: 0 0 12px rgba(72, 202, 228, 0.6); }

/* ---------- guía ---------- */
.product { display: none; }
.product.active { display: block; }
.feature-card { border-color: var(--border-strong); }
.feature-tag {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; font-family: var(--font-display);
  color: var(--accent-bright); background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 4px 12px; margin-bottom: 10px;
}
details.step { margin: 0 0 11px; }
details.step summary {
  list-style: none; cursor: pointer; padding: 15px 18px;
  font-weight: 600; font-size: 15px; min-height: 48px;
  font-family: var(--font-display);
  display: flex; align-items: center; gap: 12px;
}
details.step summary::-webkit-details-marker { display: none; }
.stepnum {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--accent-bright);
  background: var(--accent-soft); border: 1px solid var(--border-strong);
  text-shadow: 0 0 10px rgba(72, 202, 228, 0.5);
}
.chev { margin-left: auto; width: 9px; height: 9px; flex-shrink: 0;
  border-right: 2px solid var(--accent-bright); border-bottom: 2px solid var(--accent-bright);
  transform: rotate(45deg); transition: transform 0.3s ease;
}
details.step[open] .chev { transform: rotate(-135deg); }
details.step p { margin: 0; padding: 2px 18px 17px 58px; color: var(--ink2); font-size: 14.5px; }

/* ---------- ciencia ---------- */
.study { padding: 18px 20px; margin: 0 0 13px; }
.study .tag {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; font-family: var(--font-display);
  color: var(--accent-bright); background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 3px 11px; margin-bottom: 10px;
}
.study h3 { margin: 0 0 5px; font-size: 15px; line-height: 1.4; font-family: var(--font-display); font-weight: 600; }
.study .ref { font-size: 12.5px; color: var(--muted); margin: 0 0 9px; }
.study p.finding { margin: 0 0 12px; font-size: 14px; color: var(--ink2); }
.study a {
  color: var(--accent-bright); font-size: 13.5px; font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center; min-height: 28px;
}
.study a:hover { text-shadow: 0 0 14px rgba(72, 202, 228, 0.7); }

/* ---------- historia ---------- */
.story-card { border-color: var(--border-strong); }
.story-quote {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic; font-size: 21px !important; line-height: 1.45;
  color: var(--ink) !important; margin: 2px 0 12px !important;
}

/* ---------- botones y enlaces ---------- */
.btn {
  display: inline-block; appearance: none; border: none; cursor: pointer;
  font: inherit; font-family: var(--font-display); font-weight: 700; font-size: 15px;
  text-decoration: none;
  color: #03242B;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent) 60%, var(--accent-deep));
  border-radius: 999px; padding: 14px 28px; min-height: 50px; margin-top: 10px;
  box-shadow: 0 6px 26px rgba(0, 188, 212, 0.4);
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}
.btn:active { transform: scale(0.96); }
.btn.danger { background: transparent; border: 1px solid rgba(224, 91, 91, 0.5); color: var(--danger); box-shadow: none; }
.btn.ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--accent-bright); box-shadow: none; margin-right: 10px; }
.contact-card { text-align: center; margin-top: 22px; }
.linkrow {
  display: flex; align-items: center; gap: 13px;
  color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500;
  padding: 13px 2px; min-height: 52px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: opacity 0.2s ease;
}
.linkrow:active { opacity: 0.6; }
.linkrow:last-of-type { border-bottom: none; }
.linkico {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); border: 1px solid var(--border);
}
.linkico svg { width: 18px; height: 18px; fill: none; stroke: var(--accent-bright); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.arrow { margin-left: auto; color: var(--muted); font-size: 21px; }

.disclaimer { font-size: 12px; color: var(--muted); margin: 24px 6px 8px; line-height: 1.55; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px); z-index: 40;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: #03242B; font-weight: 700; font-size: 14px; font-family: var(--font-display);
  padding: 11px 22px; border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 188, 212, 0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 0.9, 0.3, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tab bar flotante ---------- */
.tabbar {
  position: fixed; z-index: 30;
  left: 14px; right: 14px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 532px; margin: 0 auto;
  display: flex; justify-content: space-around;
  background: rgba(10, 14, 18, 0.72);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 7px 8px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
}
.tab {
  appearance: none; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: var(--font-display); font-size: 10.5px; font-weight: 600; color: var(--muted);
  padding: 7px 15px; min-width: 66px; min-height: 52px; border-radius: 18px;
  transition: color 0.25s ease, background 0.25s ease, transform 0.15s ease;
}
.tab:active { transform: scale(0.93); }
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active {
  color: var(--accent-bright);
  background: var(--accent-soft);
  text-shadow: 0 0 14px rgba(72, 202, 228, 0.6);
}
.tab.active svg { filter: drop-shadow(0 0 6px rgba(72, 202, 228, 0.6)); }
