/* FastTrack web2app funnel - rose primary, teal accent.
   Mobile-first, centered column. Config-driven screens (see engine.js). */

:root {
  --rose: #FF9EB7;
  --rose-d: #E86F8E;
  --teal: #2BB7A3;
  --teal-l: #E9F8F5;
  --ink: #2C2C2C;
  --muted: #7A8290;
  --row: #F2F3F5;
  --row-sel: #ECF9F6;
  --line: #E6E8EC;
  --bg: #FFFFFF;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.funnel {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 20px 28px;
}

/* ---------- Header (back + brand + progress) ---------- */
.funnel-header { padding-top: 14px; }
.funnel-header:empty { display: none; }

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
}
.back {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: var(--muted); border-radius: 50%;
}
.back:hover { background: var(--row); }
.back svg { width: 22px; height: 22px; }
.brand-sm {
  font-weight: 800; font-size: 18px; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-d) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand-img { height: 24px; width: auto; display: block; }
.header-spacer { width: 32px; }

.progress { display: flex; gap: 6px; margin-top: 14px; }
.seg {
  flex: 1; height: 5px; border-radius: 3px;
  background: var(--line); overflow: hidden;
}
.seg-fill {
  display: block; height: 100%; width: 100%;
  background: var(--teal); border-radius: 3px;
  transform-origin: left center;
  transition: transform .45s cubic-bezier(.4,0,.2,1);
}

/* ---------- Screen body ---------- */
.funnel-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 26px;
  animation: fade .35s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.q-head { margin-bottom: 22px; }
.q-title {
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25;
}
.q-sub { color: var(--muted); margin-top: 8px; font-size: 15px; }

/* ---------- Option rows ---------- */
.opts { display: flex; flex-direction: column; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: var(--row); border: 2px solid transparent;
  border-radius: var(--radius); padding: 17px 18px;
  font: inherit; color: var(--ink); cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
}
.opt:active { transform: scale(.99); }
.opt .opt-label { flex: 1; font-weight: 600; font-size: 16px; }
.opt .opt-icon { color: var(--muted); display: inline-flex; }
.opt .opt-icon svg { width: 26px; height: 26px; }
.opt.selected { border-color: var(--teal); background: var(--row-sel); }
.opt.selected .opt-icon { color: var(--teal); }

/* multi-select check box */
.opt-multi .opt-check {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid #C7CCD3; flex: none; position: relative;
  transition: background .15s, border-color .15s;
}
.opt-multi.selected .opt-check { background: var(--teal); border-color: var(--teal); }
.opt-multi.selected .opt-check::after {
  content: ''; position: absolute; left: 6px; top: 2px;
  width: 6px; height: 11px; border: solid #fff;
  border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}

/* ---------- Footer / CTA ---------- */
.q-foot { margin-top: auto; padding-top: 22px; display: flex; flex-direction: column; gap: 6px; }
.cta {
  width: 100%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-d) 100%);
  color: #fff; font: inherit; font-weight: 700; font-size: 17px;
  padding: 17px; border-radius: 30px;
  box-shadow: 0 6px 18px rgba(232,111,142,.32);
  transition: transform .08s, box-shadow .15s, opacity .15s;
}
.cta:hover { box-shadow: 0 8px 22px rgba(232,111,142,.4); }
.cta:active { transform: scale(.98); }
.cta:disabled { opacity: .4; box-shadow: none; cursor: not-allowed; }
.link {
  background: none; border: none; cursor: pointer; font: inherit;
  color: var(--teal); font-weight: 600; padding: 12px; align-self: center;
}

/* ---------- Welcome ---------- */
.welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 16px;
}
.welcome .brand {
  font-weight: 800; font-size: 36px; letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-d) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.welcome-title { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; }
.welcome-sub { color: var(--muted); font-size: 16px; max-width: 340px; }
.welcome .cta { margin-top: 10px; max-width: 320px; }
.welcome-foot { color: var(--muted); font-size: 13px; }

/* ---------- Loader (auto-advancing splash, step 0) ---------- */
.loader {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 22px;
  background: linear-gradient(160deg, var(--rose) 0%, var(--rose-d) 100%);
  border-radius: 22px; padding: 36px 26px; color: #fff;
}
.loader-media {
  width: 208px; height: 208px; border-radius: 22px;
  background: rgba(255,255,255,.16) center/cover no-repeat;
}
.loader-title { font-size: 22px; font-weight: 800; line-height: 1.3; max-width: 340px; }
.loader-status { display: flex; align-items: center; gap: 10px; font-weight: 600; opacity: .95; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-bar {
  width: 100%; max-width: 360px; height: 14px;
  background: rgba(255,255,255,.3); border-radius: 8px; overflow: hidden;
}
.loader-fill {
  display: block; height: 100%; width: 100%;
  background: #fff; border-radius: 8px;
  transform: scaleX(0); transform-origin: left center;
}
.loader-pct { font-weight: 700; margin-top: -10px; }

/* ---------- Info screen ---------- */
.info { flex: 1; display: flex; }
.info-media {
  flex: 1; border-radius: 22px; position: relative;
  background: linear-gradient(160deg, var(--teal-l) 0%, #FFF0F3 100%);
  background-size: cover; background-position: center;
  display: flex; align-items: flex-end; min-height: 420px;
}
.info-card {
  margin: 16px; padding: 22px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(6px);
  border-radius: 18px; width: 100%;
}
.info-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.info-title .hl { color: var(--teal); }
.info-body { color: #55606E; margin: 10px 0 18px; font-size: 15px; }

/* ---------- Input screen (number + unit toggle + live hint) ---------- */
.input-top { display: flex; justify-content: center; margin-bottom: 18px; }
.unit-toggle { display: inline-flex; background: var(--row); border-radius: 12px; padding: 4px; }
.unit-toggle .unit {
  border: none; background: none; font: inherit; font-weight: 700;
  color: var(--muted); padding: 8px 22px; border-radius: 9px; cursor: pointer;
}
.unit-toggle .unit.on { background: var(--teal); color: #fff; }
.num-row { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 18px 0 22px; }
.num-input {
  width: 130px; border: none; border-bottom: 2px solid var(--line);
  background: none; font: inherit; font-size: 44px; font-weight: 800;
  text-align: center; color: var(--ink); padding: 4px 0;
}
.num-input.sm { width: 82px; font-size: 36px; }
.num-input:focus { outline: none; border-bottom-color: var(--teal); }
.num-input::-webkit-outer-spin-button, .num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-unit { font-size: 20px; font-weight: 700; color: var(--muted); }
.hint { background: var(--row); border-radius: 14px; padding: 16px; font-size: 14px; color: #55606E; line-height: 1.6; }
.hint b { color: var(--ink); }

/* ---------- Summary (BMI recap) ---------- */
.gauge { background: var(--row); border-radius: 18px; padding: 20px 18px; margin-bottom: 16px; }
.gauge-bar {
  position: relative; height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, #EBD24A, #5FC97E 35%, #F0A23C 70%, #E8604A);
  margin: 10px 0 10px;
}
.gauge-mark {
  position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--teal); transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.gauge-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; }
.gauge-val { text-align: center; margin-top: 12px; font-size: 15px; }
.sum-rows { margin-bottom: 16px; }
.sum-row { display: flex; justify-content: space-between; padding: 13px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.sum-row span { color: var(--muted); }
.note { border-radius: 14px; padding: 16px; font-size: 14px; line-height: 1.6; }
.note b { display: block; margin-bottom: 2px; }
.note.warn { background: #FFF6E9; color: #7a5a2e; }
.note.ok { background: var(--teal-l); color: #1f6b5f; }

/* ---------- Chart (honest science curve) ---------- */
.chart {
  background: var(--row); border-radius: 18px;
  padding: 18px 16px; margin-bottom: 16px;
}
.chart svg { width: 100%; height: auto; display: block; }
.chart-cap {
  color: var(--muted); font-size: 14px; text-align: center;
  padding: 0 4px; margin-bottom: 8px;
}

/* ---------- Projection ---------- */
.proj-head {
  font-size: 19px; font-weight: 700; line-height: 1.35;
  text-align: center; margin-bottom: 16px;
}
.proj-head .hl { color: var(--teal); }

/* ---------- Analyzing (filling bars + chronotype modal) ---------- */
.q-title.center { text-align: center; margin-bottom: 28px; }
.bars { display: flex; flex-direction: column; gap: 22px; }
.barhead { display: flex; justify-content: space-between; font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.barpct { color: var(--muted); }
.bartrack { height: 9px; border-radius: 6px; background: var(--line); overflow: hidden; }
.barfill {
  display: block; height: 100%; width: 100%; border-radius: 6px;
  background: var(--teal); transform: scaleX(0); transform-origin: left center;
}
.modal {
  position: fixed; inset: 0; z-index: 20;
  display: none; align-items: center; justify-content: center;
  background: rgba(20,24,30,.45); padding: 24px;
}
.modal.show { display: flex; }
.modal-card {
  background: #fff; border-radius: 20px; padding: 24px 20px;
  width: 100%; max-width: 420px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal-q { font-size: 19px; font-weight: 800; margin-bottom: 18px; }
.modal-card .opt { margin-bottom: 12px; }
.modal-card .opt:last-child { margin-bottom: 0; }

/* ---------- Block E: text input / account / optin / plan ready ---------- */
.text-field { margin: 6px 0 14px; }
.text-input {
  width: 100%; border: 2px solid var(--line); border-radius: 14px;
  background: var(--row); font: inherit; font-size: 17px; color: var(--ink);
  padding: 16px;
}
.text-input:focus { outline: none; border-color: var(--teal); background: #fff; }
.fineprint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.fineprint.center { text-align: center; }
.fineprint a { color: var(--teal); }
.ac-error { color: #D2463C; font-size: 14px; min-height: 18px; margin: 2px 2px 6px; }

.optin { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 32px 0 18px; }
.optin .cta { max-width: 280px; }

.features { list-style: none; display: flex; flex-direction: column; gap: 16px; margin: 10px 0 0; }
.features li { position: relative; padding-left: 34px; font-size: 16px; color: #3a4250; line-height: 1.5; }
.features li::before {
  content: ''; position: absolute; left: 0; top: 1px;
  width: 22px; height: 22px; border-radius: 50%; background: var(--teal-l);
}
.features li::after {
  content: ''; position: absolute; left: 8px; top: 6px;
  width: 5px; height: 10px; border: solid var(--teal); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.plan-illus { display: flex; justify-content: center; margin-top: 30px; }
.plan-illus img { width: 200px; height: 200px; border-radius: 22px; background: #F5F2EC; }

/* ---------- Redirecting (checkout handoff) ---------- */
.redirecting {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  color: var(--muted); font-size: 16px;
}
.spinner-lg {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--teal);
  animation: spin .8s linear infinite;
}

/* ---------- Finish stub (slice review) ---------- */
.done { padding-top: 20px; }
.done h2 { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.done pre {
  background: var(--row); border-radius: 12px; padding: 16px;
  font-size: 13px; overflow: auto; color: #333; line-height: 1.6;
}
.done p { color: var(--muted); margin-top: 14px; font-size: 14px; }
