/* Foldwise test app. Two paths share one layout: data-arm="parent" (warm, rounded, bigger type)
   and data-arm="adult" (quieter, tighter, no child styling). Paper colours come from models.js. */

:root {
  --bg: #f4efe4;
  --surface: #fffdf8;
  --stage: #ffffff;
  --ink: #1d1a16;
  --muted: #6a6257;
  --hair: rgba(29, 26, 22, .12);
  --accent: #e4572e;
  --accent-ink: #ffffff;
  --accent-soft: #fde7df;
  --ok: #217a4b;
  --err: #b3261e;
  --line: #2a2622;          /* fold line on the diagram */
  --arrow: #e4572e;         /* fold arrow */
  --arrow-halo: #ffffff;
  --radius: 20px;
  --radius-sm: 14px;
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 6px 18px rgba(40, 30, 10, .07);
  color-scheme: light;
}
[data-arm="adult"] {
  --accent: #1f4e79;
  --accent-soft: #e2ebf4;
  --arrow: #d2452a;
  --radius: 12px;
  --radius-sm: 9px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17150f; --surface: #221f18; --stage: #2a2620; --ink: #f3eee4; --muted: #b3aa9b;
    --hair: rgba(243, 238, 228, .14); --accent-soft: #3a2a22; --line: #f3eee4; --arrow-halo: #2a2620;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25); color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-arm="adult"] { --accent: #8db8e0; --accent-ink: #10202f; --accent-soft: #1f2c38; }
  :root:not([data-theme="light"]) { --ok: #6fd39b; }
}
:root[data-theme="dark"] {
  --bg: #17150f; --surface: #221f18; --stage: #2a2620; --ink: #f3eee4; --muted: #b3aa9b;
  --hair: rgba(243, 238, 228, .14); --accent-soft: #3a2a22; --line: #f3eee4; --arrow-halo: #2a2620; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
[data-arm="parent"] body { font-size: 18px; }
main:focus { outline: none; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; border: 1.5px solid var(--hair);
  background: var(--surface); font-weight: 650; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn[disabled] { opacity: .4; cursor: default; transform: none; }
.btn:focus-visible, .icon-btn:focus-visible, .pill:focus-visible, .seg:focus-visible, .model:focus-visible, .choice:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  display: inline-grid; place-items: center; font-size: 24px; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--hair); }
.link-btn { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: var(--accent); font-weight: 600; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.top a.small { font-size: 15px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 10px 0; }

/* hero */
.hero { padding: 18px 0 28px; display: grid; gap: 22px; align-items: center; }
.hero h1 { font-size: clamp(32px, 7.5vw, 52px); font-weight: 800; }
.hero p { margin-top: 12px; font-size: 1.08em; color: var(--muted); max-width: 34em; }
.hero .cta { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero .reassure { font-size: 14px; color: var(--muted); }
.hero-art { display: flex; justify-content: center; gap: 4%; }
.hero-art svg { width: 30%; max-width: 150px; height: auto; filter: drop-shadow(0 6px 10px rgba(40, 30, 10, .12)); }
.hero-art svg:nth-child(2) { transform: translateY(-10px) rotate(-4deg); }
.hero-art svg:nth-child(3) { transform: rotate(5deg); }
@media (min-width: 760px) { .hero { grid-template-columns: 1.15fr 1fr; padding: 32px 0 44px; } .hero-art { order: 2; } }

/* sections */
.section { padding: 26px 0; }
.section > h2 { font-size: 26px; font-weight: 800; }
.section > .lead { color: var(--muted); margin-top: 6px; }

/* model cards: the learning path */
.models { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .models { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .models { grid-template-columns: 1fr 1fr 1fr; } }
.model {
  position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center;
  padding: 12px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  text-decoration: none; box-shadow: var(--shadow); transition: transform .15s ease;
}
.model:hover { transform: translateY(-2px); }
.model .thumb { width: 96px; height: 96px; border-radius: var(--radius-sm); background: var(--stage); display: grid; place-items: center; }
.model .thumb svg { width: 84%; height: 84%; }
.model h3 { font-size: 19px; font-weight: 750; }
.model .meta { font-size: 14.5px; color: var(--muted); margin-top: 2px; }
.model .tag { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); }
.model .num {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 800; display: grid; place-items: center;
}
.model .done { margin-left: 10px; font-size: 13px; font-weight: 700; color: var(--ok); }
.model.soon { grid-template-columns: 1fr auto; box-shadow: none; background: transparent; border-style: dashed; }
.model.soon:hover { transform: none; }
.model.soon .btn { min-height: 42px; padding: 0 16px; font-size: 15px; }

/* join + founding */
.panel { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel h2 { font-size: 24px; font-weight: 800; }
.panel > p { margin-top: 8px; color: var(--muted); }
.two { display: grid; gap: 14px; }
@media (min-width: 760px) { .two { grid-template-columns: 1.2fr 1fr; } }
.founding { background: var(--ink); color: var(--bg); border: 0; }
.founding > p, .founding li { color: color-mix(in srgb, var(--bg) 80%, transparent); }
.founding ul { margin: 12px 0 18px; padding-left: 20px; }
.founding .btn { background: var(--bg); color: var(--ink); border: 0; }
.price { font-size: 40px; font-weight: 800; margin-top: 6px; }
.price small { font-size: 16px; font-weight: 600; opacity: .8; }

.email-form { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 520px) { .email-form { grid-template-columns: 1fr auto; } .email-form .form-msg, .email-form .fine { grid-column: 1 / -1; } }
.email-form input[type=email] {
  min-height: 52px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--hair); background: var(--bg); width: 100%;
}
.email-form input[type=email]:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.email-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-msg { min-height: 1.3em; font-size: 15px; font-weight: 600; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }
.fine { font-size: 13.5px; color: var(--muted); }

.foot { padding: 30px 0 48px; border-top: 1px solid var(--hair); margin-top: 24px; display: grid; gap: 10px; font-size: 15px; color: var(--muted); }

/* chooser */
.chooser { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.chooser-in { width: 100%; max-width: 520px; text-align: center; }
.chooser h1 { font-size: clamp(30px, 8vw, 42px); font-weight: 800; margin: 18px 0 22px; }
.choice {
  width: 100%; display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: center; text-align: left;
  padding: 14px; margin-bottom: 12px; border-radius: 20px; border: 1.5px solid var(--hair); background: var(--surface);
  cursor: pointer; box-shadow: var(--shadow);
}
.choice svg { width: 88px; height: 88px; }
.choice b { display: block; font-size: 21px; }
.choice span { color: var(--muted); font-size: 15.5px; }

/* player */
.player { min-height: 100dvh; display: flex; flex-direction: column; max-width: 620px; margin: 0 auto; padding: 0 16px; }
.pbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 8px 0 4px; }
.ptitle { text-align: center; }
.ptitle b { display: block; font-size: 17px; }
.ptitle span { font-size: 14px; color: var(--muted); }
.progress { display: flex; gap: 4px; padding: 6px 0 10px; }
.seg { flex: 1; height: 8px; border-radius: 4px; border: 0; padding: 0; background: var(--hair); cursor: pointer; position: relative; }
.seg::after { content: ""; position: absolute; inset: -10px 0; } /* bigger tap target */
.seg.done { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.seg.now { background: var(--accent); }

.stage {
  position: relative; background: var(--stage); border-radius: var(--radius); box-shadow: var(--shadow);
  aspect-ratio: 1 / 1; width: 100%; max-height: 52dvh; margin: 0 auto; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.stage svg.diagram { width: 100%; height: 100%; display: block; }
.stage .paper { filter: drop-shadow(0 1.2px 1.4px rgba(40, 30, 10, .18)); }
.stage-ctrls { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding-top: 10px; }
.pill {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--hair);
  background: color-mix(in srgb, var(--surface) 92%, transparent); font-size: 14.5px; font-weight: 650; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; backdrop-filter: blur(6px);
}
.pill[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }
.pill svg { width: 16px; height: 16px; }
.paused-badge { margin-right: auto; font-size: 14px; font-weight: 650; color: var(--muted); }

.instr { padding: 8px 2px 10px; flex: 1; }
.instr .term { font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 4px; }
.instr .text { font-size: 22px; font-weight: 700; line-height: 1.3; }
[data-arm="parent"] .instr .text { font-size: 24px; }
.instr .help { margin-top: 10px; font-size: 16px; color: var(--muted); padding-left: 12px; border-left: 3px solid var(--accent-soft); }
.needs { margin: 14px 0 0; padding: 14px 16px; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--hair); }
.needs h3 { font-size: 15px; margin-bottom: 6px; }
.needs ul { margin: 0; padding-left: 20px; }
.needs li { margin: 2px 0; }
.legend { display: grid; gap: 6px; margin-top: 12px; font-size: 15px; color: var(--muted); }
.legend div { display: flex; align-items: center; gap: 10px; }
.legend svg { width: 44px; height: 10px; flex: none; }

.pnav {
  position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 2fr; gap: 10px;
  padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 22%);
}
.pnav .btn { min-height: 58px; font-size: 18px; }

/* finish */
.finish { max-width: 620px; margin: 0 auto; padding: 8px 16px 40px; text-align: center; }
.finish .big { width: min(70vw, 280px); aspect-ratio: 1; margin: 6px auto 0; background: var(--stage); border-radius: 50%; display: grid; place-items: center; box-shadow: var(--shadow); }
.finish .big svg { width: 78%; height: 78%; }
.finish h1 { font-size: clamp(28px, 7vw, 38px); font-weight: 800; margin-top: 20px; }
.finish .tip { margin-top: 10px; color: var(--muted); }
.rate { margin: 22px 0 6px; }
.rate p { font-weight: 700; }
.rate .opts { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.rate .opts .btn { min-height: 46px; }
.rate .opts .btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.finish .next { display: grid; gap: 10px; margin: 20px 0 26px; }
.finish .panel { text-align: left; margin-top: 14px; }

/* confetti squares on finish */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 12px; animation: drop 1.8s ease-in forwards; }
@keyframes drop { to { transform: translateY(105vh) rotate(540deg); opacity: .2; } }

/* dialog sheet */
dialog#sheet { border: 0; padding: 0; border-radius: 22px; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog#sheet::backdrop { background: rgba(20, 16, 10, .45); }
.sheet-body { padding: 24px 22px 22px; position: relative; }
.sheet-body h2 { font-size: 24px; font-weight: 800; padding-right: 40px; }
.sheet-text { margin-top: 10px; color: var(--muted); }
.sheet-close { position: absolute; top: 12px; right: 12px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 650; z-index: 20; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .confetti { display: none; }
}
