/* Apostrophe· web2app onboarding funnel.
   Paper/orange palette (matches the app + site). Mobile-first, centered column.
   Config-driven screens (see engine.js). Class names mirror the FastTrack engine. */

:root {
  --accent: #c8360a;      /* primary (CTA, selected) */
  --accent-d: #a82c08;
  --amber: #b8680a;
  --ink: #1a1209;
  --muted: #7a6a55;
  --paper: #f5f0e8;
  --paper2: #ede7d9;      /* rows */
  --paper3: #e3dccf;      /* lines */
  --row-sel: #f7e9dd;     /* selected row tint */
  --bg: #faf7f2;
  --success: #2a7a4b;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, 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(--paper2); }
.back svg { width: 22px; height: 22px; }
.brand-sm { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--accent); }
.header-spacer { width: 32px; }

.progress { display: flex; gap: 6px; margin-top: 14px; }
.seg { flex: 1; height: 5px; border-radius: 3px; background: var(--paper3); overflow: hidden; }
.seg-fill { display: block; height: 100%; width: 100%; background: var(--accent); 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-title.center { text-align: center; margin-bottom: 28px; }
.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(--paper2); 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(--accent); background: var(--row-sel); }
.opt.selected .opt-icon { color: var(--accent); }
.opt-multi .opt-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #c7b9a3; flex: none; position: relative; transition: background .15s, border-color .15s; }
.opt-multi.selected .opt-check { background: var(--accent); border-color: var(--accent); }
.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(--accent) 0%, var(--accent-d) 100%); color: #fff; font: inherit; font-weight: 700; font-size: 17px; padding: 17px; border-radius: 30px; box-shadow: 0 6px 18px rgba(200,54,10,.30); transition: transform .08s, box-shadow .15s, opacity .15s; }
.cta:hover { box-shadow: 0 8px 22px rgba(200,54,10,.38); }
.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(--accent); font-weight: 600; padding: 12px; align-self: center; }

/* ---------- 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(--accent) 0%, var(--accent-d) 100%); border-radius: 22px; padding: 36px 26px; color: #fff; }
.loader-media { width: 260px; max-width: 80%; aspect-ratio: 5 / 2; border-radius: 18px; overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(26,18,9,.14); }
.loader-media svg { width: 60%; height: 60%; }
.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: 12px; 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; }

/* ---------- Info screen (icon/illustration, no stock photo) ---------- */
.info { flex: 1; display: flex; }
.info-media { flex: 1; border-radius: 22px; position: relative; background: linear-gradient(160deg, var(--paper2) 0%, var(--row-sel) 100%); display: flex; flex-direction: column; justify-content: space-between; min-height: 420px; padding: 28px; }
.info-illus { flex: 1; display: flex; align-items: center; justify-content: center; }
.info-illus svg { width: 120px; height: 120px; color: var(--accent); }
.info-card { padding: 22px; background: rgba(255,255,255,.86); backdrop-filter: blur(6px); border-radius: 18px; }
.info-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.info-title .hl { color: var(--accent); }
.info-body { color: #55504a; margin: 10px 0 0; font-size: 15px; }
.info-img { width: 100%; aspect-ratio: 5 / 2; object-fit: cover; border-radius: 20px; background: var(--paper2); display: block; margin: 4px 0 22px; }
.loader-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Summary (profile recap + confidence gauge) ---------- */
.gauge { background: var(--paper2); border-radius: 18px; padding: 20px 18px; margin-bottom: 16px; }
.gauge-bar { position: relative; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #E8604A, #F0A23C 45%, #5FC97E); margin: 10px 0; }
.gauge-mark { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); 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(--paper3); 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.ok { background: var(--row-sel); color: #7a3a1e; }

/* ---------- Projection ---------- */
.proj-head { font-size: 19px; font-weight: 700; line-height: 1.35; text-align: center; margin-bottom: 16px; }
.proj-head .hl { color: var(--accent); }
.chart { background: var(--paper2); border-radius: 18px; padding: 18px 16px; margin-bottom: 16px; }
.chart svg { width: 100%; height: auto; display: block; }

/* ---------- Analyzing (filling bars + micro-question modal) ---------- */
.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(--paper3); overflow: hidden; }
.barfill { display: block; height: 100%; width: 100%; border-radius: 6px; background: var(--accent); 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,18,12,.45); padding: 24px; }
.modal.show { display: flex; }
.modal-card { background: var(--bg); 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 / account / optin / plan ready ---------- */
.text-field { margin: 6px 0 14px; }
.text-input { width: 100%; border: 2px solid var(--paper3); border-radius: 14px; background: var(--paper2); font: inherit; font-size: 17px; color: var(--ink); padding: 16px; }
.text-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.fineprint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.fineprint.center { text-align: center; }
.fineprint a { color: var(--accent); }
.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: #3a342c; line-height: 1.5; }
.features li::before { content: ''; position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; background: var(--row-sel); }
.features li::after { content: ''; position: absolute; left: 8px; top: 6px; width: 5px; height: 10px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.plan-illus { display: flex; justify-content: center; margin-top: 24px; }
.plan-illus svg { width: 140px; height: 140px; color: var(--accent); }

/* ---------- 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; text-align: center; }
.spinner-lg { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--paper3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
