/* ============================================================
   Sensia quiz funnel — design system
   Structure & mechanics mirror app.flo.health; visual language
   is Sensia's own "Oxia" design system (Sensia Design System Main).
   Tokens sourced from the published Sensia DS readme:
     • primary action = deep teal-blue gradient #1E4C60 → #2E9BCD
     • signature onboarding bg = lime→sky #F6FFDC → #A8E0F9
     • ink #131313 on near-white #F4F5F6, white cards r16–20
     • pill buttons 52px, gradient fill, white rounded-font label
     • SF Pro Display / SF Pro Rounded; body 14/18; no emoji; sentence case
   ============================================================ */

:root {
  /* Brand — Sensia / Oxia */
  --brand: #1E4C60;                 /* deep teal-blue (borders, progress, accents) */
  --brand-2: #3E9DC6;               /* bright sky-blue (gradient end) */
  --cta-grad: linear-gradient(90deg, #1E4C60 0%, #3E9DC6 100%); /* left→right, per Figma button */
  --sig-grad: linear-gradient(180deg, #F6FFDC 0%, #A8E0F9 100%); /* onboarding / loaders */
  --lilac-grad: linear-gradient(180deg, #FFFFFF 0%, #ECE6FB 100%); /* insights / premium accents */
  --brand-tint: #E4F1F7;            /* selected option background (pale teal-blue) */
  --pollen: #F4A63B;               /* warm data accent (pollen scale mid) */

  /* Neutrals */
  --ink: #131313;                   /* headings & body */
  --ink-soft: #5B6570;              /* subtitles / secondary text */
  --line: #EBEBEB;                  /* tracks, hairlines */
  --page: #F4F5F6;                  /* content page background */
  --card: #FFFFFF;                  /* cards */
  --option: #FFFFFF;                /* option card (white on gray page) */

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", system-ui, sans-serif;
  /* Brand wordmark uses ABC Arizona Flare (flared serif). That font is a licensed
     trial in the Sensia repo — drop the real face into assets/ and add an @font-face
     named "Arizona Flare" for production; this stack is the graceful fallback. */
  --font-serif: "Arizona Flare", "Hoefler Text", "Cormorant Garamond", Georgia, "Times New Roman", serif;

  /* Metrics */
  --radius-card: 18px;
  --radius-pill: 999px;
  --page-pad: 20px;
  --max-w: 480px;

  /* Shadows (very soft, per DS) */
  --shadow-card: 0 2px 4px rgba(19,19,19,.08);
  --shadow-row: 0 4px 20px rgba(19,19,19,.05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
  font-size: 14px; line-height: 1.28;
  overscroll-behavior: none;
}

/* App shell — phone-frame centered on desktop, full-bleed on mobile */
#app {
  max-width: var(--max-w);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--page);
}
/* onboarding / emotional / loader screens sit on the signature gradient
   with soft blurred "orbs" (matches the Sensia auth/onboarding backdrop) */
#app.grad { background: var(--sig-grad); position: relative; overflow: hidden; }
#app.grad::before, #app.grad::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.55), rgba(255,255,255,0) 70%);
  filter: blur(6px);
}
#app.grad::before { width: 260px; height: 260px; top: 8%; left: -60px; }
#app.grad::after  { width: 320px; height: 320px; bottom: 6%; right: -80px; }
#app.grad > * { position: relative; z-index: 1; }

/* ---------- Header ---------- */
.hdr {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 14px var(--page-pad) 0;
  min-height: 48px;
}
.hdr__back, .hdr__skip {
  background: none; border: none; cursor: pointer;
  font-family: var(--font); color: var(--ink-soft);
  font-size: 15px; padding: 8px; margin: -8px;
}
.hdr__back { justify-self: start; font-size: 24px; line-height: 1; color: var(--ink); }
.hdr__skip { justify-self: end; }
.hdr__logo { justify-self: center; display: flex; align-items: center; color: var(--brand); }
.hdr__logo svg { height: 18px; width: auto; display: block; }

/* Full brand lockup — wordmark + tagline (intro / brand moments) */
.brand-lockup { text-align: center; color: var(--brand); }
.brand-lockup svg { width: 190px; height: auto; display: block; margin: 0 auto; }
.brand-lockup .tag { font-family: var(--font); color: var(--brand); opacity: .8; font-size: 15px; letter-spacing: .01em; margin-top: 14px; }
.hdr__back[hidden], .hdr__skip[hidden] { visibility: hidden; }

/* ---------- Progress ---------- */
.progress { height: 6px; background: var(--line); border-radius: var(--radius-pill); margin: 12px var(--page-pad) 0; overflow: hidden; }
.progress[hidden] { display: none; }
.progress__fill { height: 100%; background: var(--cta-grad); border-radius: var(--radius-pill); width: 0; transition: width .45s cubic-bezier(.2,.8,.2,1); }

/* ---------- Screen body ---------- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px var(--page-pad) 0;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

.q-title { font-family: var(--font); font-size: clamp(25px, 6.6vw, 30px); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; margin: 8px 0 0; }
.q-sub   { font-size: 15px; color: var(--ink-soft); margin: 10px 0 0; line-height: 1.4; }

/* ---------- Option list (single / multi) ---------- */
.options { display: flex; flex-direction: column; gap: 12px; margin: 26px 0 8px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--option); border: 1.5px solid transparent;
  border-radius: var(--radius-card); padding: 18px 20px;
  font-family: var(--font); font-size: 16px; color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: background .12s, border-color .12s, transform .06s;
}
.opt:active { transform: scale(.99); }
.opt__icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--page); }
.opt__icon svg { width: 24px; height: 24px; }
.opt__label { flex: 1; }
.opt__radio { width: 24px; height: 24px; border: 2px solid #C9D2CF; border-radius: 50%; flex: none; display: grid; place-items: center; }
.opt.is-selected { background: var(--brand-tint); border-color: var(--brand-2); box-shadow: none; }
.opt.is-selected .opt__radio { border-color: var(--brand); background: var(--brand); }
.opt.is-selected .opt__radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.opt.is-selected .opt__radio.check::after { content: "✓"; color: #fff; font-size: 13px; width:auto;height:auto;background:none; }

/* ---------- Visual cards grid (age / goals) ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0 8px; }
.card {
  position: relative; cursor: pointer; background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--radius-card);
  padding: 0; overflow: hidden; font-family: var(--font);
  display: flex; flex-direction: column; align-items: center;
  box-shadow: var(--shadow-card);
  transition: border-color .12s, background .12s, transform .06s;
}
.card:active { transform: scale(.99); }
.card.is-selected { border-color: var(--brand-2); background: var(--brand-tint); box-shadow: none; }
.card__art { width: 100%; aspect-ratio: 1.25/1; display: grid; place-items: center; padding-top: 10px; }
.card__art svg { width: 76%; height: 76%; }
.card__label { width: 100%; text-align: center; padding: 12px 8px 16px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card__check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border: 2px solid #C9D2CF; border-radius: 50%; background: rgba(255,255,255,.8); display: grid; place-items: center; color: transparent; }
.card.is-selected .card__check { border-color: var(--brand); background: var(--brand); color: #fff; font-size: 13px; }
.cards--single .card__check { display: none; }
.card--wide { grid-column: span 2; aspect-ratio: auto; }
.card--wide .card__art { display: none; }
.card--wide .card__label { padding: 18px 8px; }

/* Compact cards (goals) — single-column full-width rows: icon · label · check */
.cards--compact { grid-template-columns: 1fr; gap: 10px; }
.cards--compact .card { flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; }
.cards--compact .card__art { order: 0; width: 40px; height: 40px; aspect-ratio: 1; flex: none; padding: 0; border-radius: 50%; background: var(--brand-tint); }
.cards--compact .card__art svg { width: 22px; height: 22px; }
.cards--compact .card.is-selected .card__art { background: #fff; }
.cards--compact .card__label { order: 1; width: auto; flex: 1; text-align: left; padding: 0; font-size: 15px; line-height: 1.25; }
.cards--compact .card__check { order: 2; position: static; margin: 0; flex: none; }

/* Swatches (allergen colours — pollen scale world) */
.swatch__dot { width: 32px; height: 32px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }

/* ---------- Centered statement / loader / intro ---------- */
.center {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 24px var(--page-pad);
}
.center .q-title { text-align: center; }
.center__art { margin: 0 0 28px; }
.center__art svg { width: 132px; height: 132px; }
/* statement illustration in a soft disc */
.disc-art { width: 116px; height: 116px; border-radius: 50%; background: rgba(255,255,255,.55); display: grid; place-items: center; margin: 0 auto 30px; color: var(--brand); }
#app:not(.grad) .disc-art { background: var(--brand-tint); }
.disc-art svg { width: 54px; height: 54px; }
.center .q-sub { text-align: center; max-width: 340px; }

/* Loader progress (labelled) */
.loadbar { width: 100%; max-width: 360px; margin-top: 30px; }
.loadbar__row { display: flex; justify-content: space-between; font-family: var(--font-round); font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.loadbar__track { height: 8px; background: rgba(19,19,19,.06); border-radius: var(--radius-pill); overflow: hidden; }
.loadbar__fill { height: 100%; width: 0; background: var(--cta-grad); border-radius: var(--radius-pill); transition: width .3s linear; }

/* Splash thin progress line */
.splash-bar { width: 130px; height: 3px; background: rgba(30,76,96,.15); border-radius: var(--radius-pill); overflow: hidden; margin-top: 40px; }
.splash-bar__fill { height: 100%; width: 0; background: var(--brand); border-radius: var(--radius-pill); transition: width 1.9s ease; }

/* Spinner */
.spinner { width: 52px; height: 52px; border-radius: 50%; border: 5px solid rgba(30,76,96,.15); border-top-color: var(--brand-2); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Trust card — neutral (no named team), calm & medically-grounded */
.trust {
  width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 28px 24px; text-align: center; box-shadow: var(--shadow-card);
}
.trust__badge { width: 60px; height: 60px; border-radius: 50%; background: var(--brand-tint); display: grid; place-items: center; margin: 0 auto 16px; }
.trust__badge svg { width: 32px; height: 32px; color: var(--brand); }
.trust__label { font-size: 18px; font-weight: 700; color: var(--brand); line-height: 1.25; }
.trust__sub { color: var(--ink-soft); font-size: 14px; margin-top: 8px; line-height: 1.4; }

/* planready helpers */
.pr-badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 8px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-pill); font-size: 14px; font-weight: 600; color: var(--brand); box-shadow: var(--shadow-card); }
.pr-badge__ic { display: inline-grid; place-items: center; color: var(--brand); }
.pr-badge__ic svg { width: 18px; height: 18px; }
.pr-review { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-top: 12px; box-shadow: var(--shadow-card); }

/* ---------- Date picker ---------- */
.cal { margin: 22px 0 8px; background: var(--card); border-radius: var(--radius-card); padding: 8px 12px 12px; box-shadow: var(--shadow-card); }
.cal__month { text-align: center; font-family: var(--font-round); font-weight: 700; font-size: 18px; margin: 10px 0 12px; }
.cal__dow, .cal__grid { display: grid; grid-template-columns: repeat(7,1fr); }
.cal__dow span { text-align: center; color: var(--ink-soft); font-size: 12px; padding-bottom: 8px; }
.cal__cell { aspect-ratio: 1; display: grid; place-items: center; position: relative; }
.cal__cell button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-family: var(--font); font-size: 16px; cursor: pointer; color: var(--ink); }
.cal__cell button:disabled { border-color: transparent; color: #C4CCCA; cursor: default; }
.cal__cell button.is-selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.cal__cell .today { position: absolute; font-size: 9px; font-weight: 700; top: 2px; color: var(--ink-soft); }

/* ---------- Numeric / text input ---------- */
.units { display: inline-flex; background: rgba(19,19,19,.05); border-radius: var(--radius-pill); padding: 5px; margin: 22px auto 16px; }
.units button { border: none; background: none; padding: 10px 22px; border-radius: var(--radius-pill); font-family: var(--font-round); font-size: 15px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.units button.is-active { background: #fff; color: var(--ink); box-shadow: inset 0 1px 2px rgba(0,0,0,.05), 0 2px 3px rgba(0,0,0,.1); }
.field { position: relative; margin: 14px 0; }
.field input {
  width: 100%; border: 1.5px solid transparent; background: var(--card);
  border-radius: var(--radius-card); padding: 18px 60px 18px 20px;
  font-family: var(--font); font-size: 18px; color: var(--ink); outline: none; box-shadow: var(--shadow-card);
}
.field input:focus { border-color: var(--brand-2); }
.field .suffix { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-size: 16px; }

/* City autocomplete dropdown */
.ac-list { list-style: none; margin: 8px 0 0; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-row); max-height: 280px; overflow-y: auto; }
.ac-item { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; cursor: pointer; }
.ac-item:hover, .ac-item.is-active { background: var(--brand-tint); }
.ac-city { font-size: 16px; font-weight: 600; color: var(--ink); }
.ac-region { font-size: 13px; color: var(--ink-soft); }

/* OTP year */
.otp { display: flex; gap: 12px; justify-content: center; margin: 30px 0 8px; }
.otp input {
  width: 62px; height: 80px; text-align: center; font-size: 28px; font-weight: 700;
  border: 1.5px solid transparent; background: var(--card); border-radius: var(--radius-card);
  font-family: var(--font); color: var(--ink); outline: none; box-shadow: var(--shadow-card);
}
.otp input:focus { border-color: var(--brand-2); }

/* ---------- Sticky CTA ---------- */
.cta-wrap { position: sticky; bottom: 0; padding: 14px var(--page-pad) calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(244,245,246,0), var(--page) 30%); }
#app.grad .cta-wrap { background: linear-gradient(180deg, rgba(168,224,249,0), #A8E0F9 55%); }
.cta {
  width: 100%; min-height: 52px; border: none; cursor: pointer;
  background: var(--cta-grad); color: #fff; font-family: var(--font);
  font-size: 17px; font-weight: 500; padding: 15px; border-radius: var(--radius-pill);
  transition: opacity .12s, transform .06s;
}
.cta:active { transform: scale(.99); opacity: .92; }
.cta:disabled { opacity: .56; cursor: default; }
.cta--ghost { background: none; color: var(--ink); font-weight: 500; padding: 12px; min-height: 0; }
.cta--secondary { background: #fff; color: var(--brand); box-shadow: var(--shadow-card); }
.cta--flat { background: var(--brand); }              /* solid, no gradient (cookie / simple actions) */
.cta--outline { background: #fff; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }

/* ---------- Consent / cookie / privacy ---------- */
.sheet-overlay { position: fixed; inset: 0; background: rgba(19,19,19,.32); display: grid; place-items: end center; z-index: 40; }
.sheet {
  width: 100%; max-width: var(--max-w); background: #fff;
  border-radius: 22px 22px 0 0; padding: 22px var(--page-pad) calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.14);
}
.sheet h3 { margin: 0 0 8px; font-size: 18px; }
.sheet p { margin: 0 0 18px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.sheet a { color: var(--brand); font-weight: 700; text-decoration: none; }
.sheet__row { display: flex; gap: 10px; }
.sheet__row .cta { flex: 1; font-size: 15px; }

.consent-list { list-style: none; padding: 0; margin: 24px 0 8px; display: flex; flex-direction: column; gap: 18px; }
.consent-list li { display: flex; gap: 14px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--ink); }
.consent-list .box { width: 24px; height: 24px; flex: none; border: 2px solid #C9D2CF; border-radius: 8px; margin-top: 1px; display: grid; place-items: center; cursor: pointer; color: transparent; }
.consent-list .box.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.consent-list a { color: var(--brand); font-weight: 700; text-decoration: none; }
.consent-note { color: var(--ink-soft); font-size: 12px; margin-top: 18px; }

/* Plan-loader engagement modal */
.eng { position: fixed; inset: 0; background: rgba(19,19,19,.5); display: grid; place-items: center; z-index: 50; }
.eng__card { background: #fff; border-radius: 22px; padding: 28px 24px; width: min(88%, 380px); text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.eng__q { font-size: 20px; font-weight: 700; line-height: 1.25; margin: 0 0 22px; }
.eng__row { display: flex; gap: 12px; }
.eng__row .cta { flex: 1; }

/* Register */
.reg-alt { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.reg-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 52px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-pill); padding: 15px; font-family: var(--font-round); font-size: 16px; font-weight: 600; cursor: pointer; }
.reg-or { text-align: center; color: var(--ink-soft); margin: 22px 0; position: relative; }
.reg-or::before, .reg-or::after { content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--line); }
.reg-or::before { left: 0; } .reg-or::after { right: 0; }
.reg-login { text-align: center; margin-top: 20px; color: var(--ink); }
.reg-login a { color: var(--brand); font-weight: 700; text-decoration: underline; }
.reg-fine { text-align: center; color: var(--ink-soft); font-size: 13px; line-height: 1.5; margin-top: 16px; max-width: 340px; }

/* Utility */
[hidden] { display: none !important; }
