/* PrepPilot UI: a quiet desk. Neutral surfaces, ink for actions, one muted green for progress.
   Reading text is set in a serif (Newsreader); controls in a sans (Instrument Sans).
   The only "object" on screen is the index card; everything else is type, space and hairlines. */
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --desk: #eceeed;
  --paper: #fafbfa;
  --sunk: #e3e6e4;
  --ink: #1c2426;
  --ink-soft: #3b4649;
  --muted: #647074;
  --line: #d5dad8;
  --line-strong: #bcc4c1;
  --accent: #2f6b5c;
  --accent-soft: #dfeae5;
  --warn: #a14a43;
  --warn-soft: #f3e3e1;
  --rule: #dbb4b0;
  --btn: #1c2426;
  --btn-ink: #fafbfa;
  --code-bg: #f1f3f2;
  --shadow: 0 1px 2px rgba(28, 36, 38, .06), 0 8px 24px rgba(28, 36, 38, .06);
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tabs: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --desk: #151a1b;
    --paper: #1d2324;
    --sunk: #101415;
    --ink: #e4e9e7;
    --ink-soft: #c3cbc8;
    --muted: #8f9b9c;
    --line: #2c3435;
    --line-strong: #3d4748;
    --accent: #86bfae;
    --accent-soft: #223631;
    --warn: #d99088;
    --warn-soft: #3a2624;
    --rule: #5c3f3c;
    --btn: #e4e9e7;
    --btn-ink: #151a1b;
    --code-bg: #171c1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--desk); color: var(--ink);
  font: 15px/1.55 var(--sans);
  padding-bottom: calc(var(--tabs) + 28px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font: 500 2.05rem/1.14 var(--serif); letter-spacing: -.015em; }
h2 { font: 500 1.55rem/1.2 var(--serif); letter-spacing: -.01em; }
h3 { font: 600 1rem/1.35 var(--sans); }
p { margin: 0; }
a { color: inherit; }
b, strong { font-weight: 600; }
button { font-family: inherit; color: inherit; }
svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.wrap { max-width: 640px; margin: 0 auto; padding: 10px max(20px, env(safe-area-inset-left)) 0; }
.top { max-width: 640px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 20px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.brand { background: none; border: 0; padding: 0; cursor: pointer; display: flex; align-items: center; gap: 8px; font: 600 15px var(--sans); letter-spacing: -.005em; color: var(--ink); }
.brand svg { width: 18px; height: 18px; color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 30px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { font-size: 13px; color: var(--muted); }
.lede { font: 400 1.1rem/1.5 var(--serif); color: var(--ink-soft); max-width: 34em; }
.view { animation: fade .18s ease both; }
@keyframes fade { from { opacity: 0; } }
section > h2 + p, .head p { margin-top: 6px; }

/* A plain surface for forms and settings. */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
.note { background: var(--sunk); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; color: var(--ink-soft); }
.note.warn { background: var(--warn-soft); }

/* The index card: paper with a ruled header line, sitting on a small stack. */
.card {
  position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 0 22px 22px; min-width: 0;
  box-shadow: var(--shadow);
}
.card.stacked { margin-bottom: 12px; }
.card.stacked::before, .card.stacked::after {
  content: ""; position: absolute; left: 8px; right: 8px; height: 10px; bottom: -6px; z-index: -1;
  background: var(--paper); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px;
}
.card.stacked::after { left: 16px; right: 16px; bottom: -11px; z-index: -2; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 0 11px; margin-bottom: 18px; border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--muted); }
.card h2 { font-size: 1.7rem; }
.card .body { font: 400 1.08rem/1.6 var(--serif); color: var(--ink-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
  border-radius: 10px; padding: 10px 16px; font: 600 14.5px var(--sans); min-height: 44px;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--ink-soft); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.btn.primary:hover { opacity: .9; }
.btn.quiet { background: none; border-color: transparent; color: var(--ink-soft); padding-inline: 10px; }
.btn.quiet:hover { background: var(--sunk); }
.btn.miss { color: var(--warn); border-color: var(--line-strong); flex: 1; }
.btn.got { color: var(--accent); border-color: var(--line-strong); flex: 1; }
.btn.danger { color: var(--warn); }
.btn.block { width: 100%; }
.btn.lg { min-height: 50px; font-size: 15.5px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; text-align: left; }
.link:hover { text-decoration-color: currentColor; }
.link.quiet { color: var(--muted); }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--paper); display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .1s, background .15s; }
.iconbtn:active { transform: scale(.94); }
.iconbtn.primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.iconbtn.plain { border-color: transparent; background: none; }
.iconbtn.on { background: var(--warn); color: var(--paper); border-color: var(--warn); }
.iconbtn:disabled { opacity: .4; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--sunk); color: var(--ink-soft); white-space: nowrap; }
.tag.pro { background: var(--ink); color: var(--desk); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft); border-radius: 8px; padding: 7px 12px; font-size: 14px; cursor: pointer; text-align: left; transition: background .12s, border-color .12s, color .12s; }
.chip:hover { border-color: var(--line-strong); }
.chip.on { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.chip.strong { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.weak { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.strong::after { content: " (strong)"; font-size: 12px; }
.chip.weak::after { content: " (weak)"; font-size: 12px; }

/* ---------- forms ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
input, select, textarea { font: 16px var(--sans); padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--paper); color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=file] { padding: 9px; font-size: 14px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font: 500 1.3rem/1.25 var(--serif); margin-bottom: 12px; }
.step { display: grid; grid-template-columns: 22px 1fr; gap: 12px; }
.step > .n { font: 500 1.3rem/1.25 var(--serif); color: var(--muted); }
.step + .step { padding-top: 26px; border-top: 1px solid var(--line); }
.rolefam { display: flex; flex-direction: column; gap: 8px; }
.switch { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line-strong); border: 0; padding: 0; position: relative; cursor: pointer; transition: background .15s; flex: none; box-shadow: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
#genForm input, #codeForm input { flex: 1; width: auto; min-width: 150px; }
details summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; font: 400 20px var(--sans); color: var(--muted); line-height: 1; }
details[open] summary::after { content: "–"; }

/* ---------- rows: lists without boxes ---------- */
.rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.rowi { display: flex; align-items: center; gap: 14px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 2px; cursor: pointer; width: 100%; min-width: 0; }
.rowi.static { cursor: default; }
.rowi:not(.static):hover .t { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.rowi .when { flex: none; width: 62px; font-size: 13px; color: var(--muted); }
.rowi .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rowi .t { font-weight: 600; font-size: 15px; }
.rowi .d { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.rowi .pct { flex: none; width: 74px; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rowi .pct .bar { width: 100%; }
.rowi.now .when { color: var(--accent); font-weight: 600; }
.rowi.past { opacity: .5; }
.rowi > svg.ic { color: var(--muted); width: 16px; height: 16px; }
.bar { height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s ease; }
.bar.low i { background: var(--warn); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sec-head h3 { font: 500 1.3rem/1.25 var(--serif); }

/* ---------- home ---------- */
.greet h1 { margin-top: 2px; }
/* What you know, as a map of tiles instead of one percentage. */
.knowmap { display: flex; flex-direction: column; gap: 10px; }
.knowmap .nums { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.knowmap .nums b { color: var(--ink); }
.knowmap .nums span:last-child { white-space: nowrap; }
.knowmap .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.knowmap .tile { text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.knowmap .tile .t { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.knowmap .tile .m { font-size: 12px; color: var(--muted); }
.knowmap .tile.strong { background: var(--accent-soft); border-color: var(--accent-soft); }
.knowmap .tile.weak .m { color: var(--warn); }
.knowmap .tile.unseen .t { color: var(--muted); font-weight: 400; }
.knowmap .tile.unseen .bar i { background: var(--line-strong); }

/* ---------- learn / deck ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); background: none; border: 0; padding: 6px 0; cursor: pointer; font-size: 14px; }
.back svg { width: 16px; height: 16px; }
.segs { display: flex; gap: 3px; }
.segs i { flex: 1; height: 3px; border-radius: 99px; background: var(--line); }
.segs i.on { background: var(--accent); }
.lesson .part + .part { margin-top: 20px; }
.lesson .part > .label { margin-bottom: 4px; }
.say { border-left: 2px solid var(--accent); padding: 2px 0 2px 16px; }

/* ---------- concept diagrams ---------- */
/* Inline SVG, drawn in the same ink and muted green as the rest of the page.
   Motion is slow and explains the flow; every animation ends fully drawn. */
.diagram { margin: 4px 0 0; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px 14px 12px; }
.diagram .label { margin-bottom: 6px; }
.diagram figcaption { margin-top: 8px; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }
.dg { display: block; width: 100%; height: auto; }
.dg text { font-family: var(--sans); }
.dg-box rect { fill: var(--paper); stroke: var(--line-strong); stroke-width: 1; }
.dg-cluster rect { fill: none; stroke-dasharray: 3 4; }
.dg-heap { fill: var(--sunk); }
.dg-t { font-size: 13px; font-weight: 600; fill: var(--ink); }
.dg-s { font-size: 11px; fill: var(--muted); }
.dg-n { font-size: 11px; font-weight: 600; fill: var(--paper); }
.dg-step circle { fill: var(--accent); }
.dg-line { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.dg-march { stroke-dasharray: 4 4; animation: dg-march 3s linear infinite; }
.dg-sweep { fill: var(--accent); opacity: .18; animation: dg-sweep 6s ease-in-out infinite; }
.dg-draw { stroke-dasharray: 100; stroke-dashoffset: 100; animation: dg-draw 1s ease forwards; }
.dg-step, .dg-pop { animation: dg-in .5s ease both; }
.dg-pop { transform-box: fill-box; transform-origin: center; }
@keyframes dg-draw { to { stroke-dashoffset: 0; } }
@keyframes dg-in { from { opacity: 0; transform: translateY(4px) scale(.97); } }
@keyframes dg-march { to { stroke-dashoffset: -16; } }
@keyframes dg-sweep { 0%, 100% { transform: translateX(0); opacity: 0; } 15%, 85% { opacity: .18; } 50% { transform: translateX(164px); } }
/* The travelling dot: rides the main path on a loop so the eye follows the flow. */
.dg-dot { fill: var(--accent); offset-rotate: 0deg; animation: dg-travel 4s linear infinite; }
@keyframes dg-travel { from { offset-distance: 0%; } to { offset-distance: 100%; } }
/* Stage focus: the active stage stands out, the rest dims hard. */
.dg-box, .dg-line, .dg-step { transition: opacity .3s ease; }
.dg-dim { opacity: .12; }
/* Not-yet-built story pieces: a faint outline of the picture to come. */
.dg-ghost { opacity: .13; }
.dg-ghost rect { stroke-dasharray: 2 3; }
/* The VS divider in a before/after split, and the muted side. */
.dg-vs { font-size: 15px; font-weight: 700; fill: var(--muted); animation: dg-vs 2.4s ease-in-out infinite; }
@keyframes dg-vs { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.dg-note { font-size: 11px; font-style: italic; fill: var(--muted); }
.dg-bad rect { stroke-dasharray: 2 2; }
/* The compact story strip inside a lesson card. */
.diagram.compact { padding: 12px 12px 10px; }
.diagram.compact figcaption { margin-top: 6px; }
/* The scene header above the story strip: where you are in the story. */
.scene { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 6px 0 0; }
.scene .label { font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--ink); }
.scene .muted { white-space: nowrap; }
.dg-active rect { stroke: var(--accent); stroke-width: 2; animation: dg-pulse 2.4s ease-in-out infinite; }
@keyframes dg-pulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: .4; } }
/* Growing bars. */
.dg-track { fill: var(--sunk); }
.dg-grow { fill: var(--accent); transform-box: fill-box; transform-origin: left center; transform: scaleX(0); animation: dg-grow .8s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes dg-grow { to { transform: scaleX(1); } }
/* The step-through player under each diagram. */
.dg-controls { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.dg-stage { flex: 1; text-align: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* The knowledge map lives: tiles fade in one after another, bars grow in,
   tiles that moved up flash once. */
.knowmap .tile { animation: tile-in .5s ease both; }
@keyframes tile-in { from { opacity: 0; transform: translateY(6px); } }
.knowmap .tile .bar { height: 6px; }
.knowmap .bar i, .rowi .bar i { animation: bar-grow 1s ease both; }
@keyframes bar-grow { from { width: 0; } }
.knowmap .tile.tile-fresh { animation: tile-in .5s ease both, tile-fresh 1.4s ease both; }
@keyframes tile-fresh { 0% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
/* View changes fade in softly. */
.view { animation: fade .2s ease both; }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
pre { margin: 6px 0 0; background: var(--code-bg); border: 1px solid var(--line); color: var(--ink); font: 13px/1.6 var(--mono); padding: 13px 15px; border-radius: 8px; overflow-x: auto; white-space: pre; }
pre code { background: none; border: 0; padding: 0; }
.flash { min-height: 320px; display: flex; flex-direction: column; }
.flash .q { font: 500 1.5rem/1.28 var(--serif); letter-spacing: -.008em; }
.flash .ans { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line-strong); font: 400 1.08rem/1.6 var(--serif); color: var(--ink-soft); animation: turn .3s cubic-bezier(.2, .7, .2, 1) both; transform-origin: top; }
@keyframes turn { from { opacity: 0; transform: perspective(700px) rotateX(-14deg) translateY(-4px); } }
.flash .foot { margin-top: auto; padding-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.flash.out-l { animation: outl .17s ease-in both; }
.flash.out-r { animation: outr .17s ease-in both; }
@keyframes outl { to { opacity: 0; transform: translateX(-28px) rotate(-1.5deg); } }
@keyframes outr { to { opacity: 0; transform: translateX(28px) rotate(1.5deg); } }
.level { font-size: 13px; color: var(--muted); }
/* The grading verdict: a ring draws itself, then a check or a cross, on the card. */
.flash .verdict { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: color-mix(in srgb, var(--paper) 78%, transparent); border-radius: 10px; animation: fade .18s ease both; }
.flash .verdict svg { width: 104px; height: 104px; }
.flash .verdict .v-ring, .flash .verdict .v-mark { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.flash .verdict.miss .v-ring, .flash .verdict.miss .v-mark { stroke: var(--muted); }
.flash .verdict span { font-weight: 600; font-size: 15px; }
/* The results ring: sweeps to the score. */
.score-ring { position: relative; width: 132px; height: 132px; margin: 0 auto; }
.score-ring svg { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 8; }
.ring-prog { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; stroke-dasharray: 100; animation: ring-sweep 1s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes ring-sweep { from { stroke-dashoffset: 100; } }
.score-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.score-num .n { font: 500 2.2rem/1 var(--serif); font-variant-numeric: tabular-nums; }

/* ---------- stats ---------- */
/* The rings row: three small rings, same ink as the results ring. */
.rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.score-ring.small { width: 96px; height: 96px; }
.score-ring.small .score-num .n { font-size: 1.3rem; }
.score-ring.small .score-num .muted { font-size: 11px; line-height: 1.2; padding: 0 6px; }
.stat-ring { text-align: center; }
/* Practice streak: one dot per day, last 14 days. */
.streak-dots { display: flex; gap: 6px; margin: 12px 0 4px; }
.streak-dots span { width: 12px; height: 12px; border-radius: 99px; border: 1px solid var(--line-strong); }
.streak-dots span.on { background: var(--accent); border-color: var(--accent); }
/* 14-day trend: bars grow up from the baseline. */
.trend { display: flex; align-items: flex-end; gap: 5px; height: 84px; margin-top: 10px; }
.trend .tb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.trend .tb i { display: block; width: 100%; max-width: 22px; background: var(--accent); border-radius: 3px 3px 0 0; transform-origin: bottom; animation: bar-grow-v .8s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes bar-grow-v { from { transform: scaleY(0); } }
.trend .tb em { font-style: normal; font-size: 10.5px; color: var(--muted); }
@media (max-width: 760px) { .kbd-hint { display: none; } }
.score { font: 500 3.2rem/1 var(--serif); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.score small { font-size: 1.4rem; color: var(--muted); }

/* ---------- coach ---------- */
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; gap: 8px; font-variant-numeric: tabular-nums; }
.meter-top b { color: var(--ink); white-space: nowrap; }
.mode { display: flex; align-items: center; gap: 14px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 2px; cursor: pointer; width: 100%; }
.mode:disabled { opacity: .5; }
.mode .ico { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--paper); display: grid; place-items: center; flex: none; }
.mode .main { flex: 1; min-width: 0; }
.mode b { display: block; font-size: 15px; }
.mode span.d { font-size: 13.5px; color: var(--muted); }
.mode > svg.ic { color: var(--muted); width: 16px; height: 16px; }

.stage { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 18px; }
.pulse { --c: var(--accent); position: relative; width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex: none; margin: 0 6px; }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--c); opacity: 0; }
.pulse.status-you::after, .pulse.status-ai::after { animation: ripple 1.6s ease-out infinite; }
.pulse.status-thinking, .pulse.status-connecting { --c: var(--muted); animation: blink 1.2s ease-in-out infinite; }
.pulse.muted { --c: var(--line-strong); }
@keyframes ripple { from { transform: scale(1); opacity: .45; } to { transform: scale(3.2); opacity: 0; } }
.stage .status { font-weight: 600; }
.stage .timer { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage .timer.low { color: var(--warn); }
.stage .ctl { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.stage .ctl .btn { min-height: 38px; padding: 6px 12px; font-size: 13.5px; }

.msgs { display: flex; flex-direction: column; gap: 18px; min-height: 26vh; }
.msg { overflow-wrap: anywhere; line-height: 1.6; font-size: 15.5px; max-width: 100%; }
.msg.user { align-self: flex-end; background: var(--sunk); padding: 9px 14px; border-radius: 14px 14px 4px 14px; max-width: 86%; }
.msg.assistant { align-self: stretch; }
.msg.sys { align-self: center; color: var(--muted); font-size: 13px; text-align: center; }
.dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.composer {
  position: sticky; bottom: calc(var(--tabs) + 10px + env(safe-area-inset-bottom)); z-index: 4;
  display: flex; align-items: flex-end; gap: 6px; padding: 6px;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow);
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea { border: 0; background: none; box-shadow: none !important; padding: 10px 6px 10px 10px; resize: none; min-height: 42px; max-height: 140px; line-height: 1.4; }
.composer .iconbtn { width: 42px; height: 42px; border-radius: 10px; }

/* ---------- account / plans ---------- */
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font: 500 1.15rem var(--serif); }
#gbtn { min-height: 44px; display: flex; color-scheme: light; }
.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ticks li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.45; }
.ticks li svg { color: var(--accent); width: 17px; height: 17px; margin-top: 2px; }
.price { font: 500 2.6rem/1 var(--serif); letter-spacing: -.02em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.price span { font: 400 15px var(--sans); color: var(--muted); letter-spacing: 0; }
.faq details { border-top: 1px solid var(--line); padding: 14px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq p { color: var(--muted); margin-top: 8px; }
.legal { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr); max-width: 640px; margin: 0 auto;
  height: calc(var(--tabs) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--desk) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabs button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: 500 11.5px var(--sans); color: var(--muted); cursor: pointer; transition: color .15s; }
.tabs button svg { width: 21px; height: 21px; }
.tabs button[aria-current=true] { color: var(--ink); font-weight: 600; }
.tabs button[aria-current=true] svg { stroke-width: 2; }
@media (min-width: 760px) {
  body { padding-bottom: 60px; }
  .tabs { top: 0; bottom: auto; left: auto; right: max(20px, calc(50% - 320px)); margin: 0; height: 52px; padding: 0; border: 0; background: none; backdrop-filter: none; display: flex; gap: 22px; margin-top: 8px; }
  .tabs button { flex-direction: row; font-size: 14px; }
  .tabs button svg { display: none; }
  .top { justify-content: flex-start; }
  #topRight { margin-left: 16px; }
  .composer { bottom: 16px; }
}

/* ---------- toast + sheet ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 420px; background: var(--ink); color: var(--desk); border-radius: 10px; padding: 11px 15px; font-size: 14px; box-shadow: var(--shadow); animation: drop .22s ease both; display: flex; gap: 10px; align-items: flex-start; }
.toast svg { width: 17px; height: 17px; margin-top: 2px; }
.toast.out { opacity: 0; transition: opacity .25s; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
#sheet { position: fixed; inset: 0; z-index: 40; background: rgba(15, 20, 21, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease both; }
#sheet > div { width: min(500px, 100%); background: var(--paper); border-radius: 16px 16px 0 0; padding: 26px 22px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: up .24s cubic-bezier(.2, .8, .2, 1) both; }
@media (min-width: 600px) { #sheet { align-items: center; } #sheet > div { border-radius: 16px; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

@media (max-width: 380px) { .meters { grid-template-columns: 1fr; } h1 { font-size: 1.8rem; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Live coach: the one inverted object in the app ---------- */
.card.live-hero { background: var(--ink); color: var(--desk); border-color: var(--ink); }
.card.live-hero.stacked::before, .card.live-hero.stacked::after { background: var(--ink-soft); border-color: var(--ink-soft); }
.card.live-hero .card-head { color: color-mix(in srgb, var(--desk) 65%, transparent); border-bottom-color: color-mix(in srgb, var(--desk) 22%, transparent); }
.card.live-hero h2 { color: var(--desk); }
.card.live-hero p, .card.live-hero .ticks li { color: color-mix(in srgb, var(--desk) 82%, transparent); }
.card.live-hero .ticks li svg { color: var(--desk); }
.card.live-hero .price span { color: color-mix(in srgb, var(--desk) 65%, transparent); }
.live-points { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.live-points li { font-size: 12.5px; padding: 3px 9px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--desk) 28%, transparent); color: color-mix(in srgb, var(--desk) 85%, transparent); }
.btn.invert { background: var(--desk); color: var(--ink); border-color: var(--desk); }
.btn.invert:hover { opacity: .92; }
.btn.invert-quiet { color: color-mix(in srgb, var(--desk) 75%, transparent); }
.btn.invert-quiet:hover { background: color-mix(in srgb, var(--desk) 10%, transparent); }
.chat .card.live-hero { margin-bottom: 18px; }

/* ---------- pricing ---------- */
.tiers { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .tiers { grid-template-columns: 1fr 1fr 1.15fr; align-items: stretch; } }
.tier { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.tier .btn { margin-top: auto; }
.tier .price { font-size: 2.2rem; }
.tier-name { font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tier-flag { font-size: 12px; font-weight: 500; opacity: .7; }
.tier.card.live-hero { padding: 18px; box-shadow: var(--shadow); }
.tier.live-hero .price { color: var(--desk); }
.compare { border-top: 1px solid var(--line); font-size: 13.5px; }
.crow { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 8px; padding: 10px 2px; border-bottom: 1px solid var(--line); align-items: center; }
.crow > span:not(:first-child) { text-align: center; color: var(--ink-soft); }
.crow.chead { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.crow.chead > span:last-child { color: var(--ink); }
.crow .yes svg { color: var(--accent); width: 16px; height: 16px; vertical-align: -3px; }
.crow .no { color: var(--line-strong); }
@media (max-width: 400px) { .crow { grid-template-columns: 1.3fr .8fr .9fr 1fr; font-size: 12.5px; } }
.use-opt { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; padding: 12px; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; }
.use-opt:has(input:checked) { border-color: var(--ink); background: var(--sunk); }
.use-opt input { width: auto; margin-top: 3px; accent-color: var(--ink); }
.use-opt > span { display: flex; flex-direction: column; gap: 2px; }

/* ---------- Free vs Pro ---------- */
.teaser { position: relative; border-radius: 10px; overflow: hidden; min-height: 180px; }
.teaser-blur { filter: blur(2.5px); opacity: .85; pointer-events: none; user-select: none; }
.teaser-over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 18px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--desk) 88%, transparent), color-mix(in srgb, var(--desk) 25%, transparent)); }
.teaser-over b { display: inline-flex; gap: 6px; align-items: center; }
.teaser-over b svg { width: 16px; height: 16px; }
.peek { position: relative; max-height: 190px; overflow: hidden; }
.peek h2 { margin-bottom: 10px; }
.peek::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px; background: linear-gradient(to bottom, transparent, var(--desk)); }
.rowi.dim .t { color: var(--muted); filter: blur(2.5px); }
.rowi.dim > svg.ic { color: var(--muted); }
.lockmark { display: inline-flex; vertical-align: -2px; margin-left: 6px; color: var(--muted); }
.lockmark svg { width: 14px; height: 14px; }
.rowi.is-locked .d { opacity: .7; }
.tile .lockmark { margin-left: 4px; }
.unlock-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.unlock-strip > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; }

.fresh-points { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* lesson flow: the line that pulls you to the next card */
.hook { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; cursor: pointer; font: 400 1rem/1.45 var(--serif); color: var(--ink); }
.hook .label { flex: none; font: 600 12px var(--sans); color: var(--accent); }
.hook > span:nth-child(2) { flex: 1; }
.hook svg { color: var(--muted); }
.hook.static { cursor: default; }
.hook:not(.static):hover { border-color: var(--line-strong); border-left-color: var(--accent); }
.analogy { margin: 6px 0 10px; font: 400 .98rem/1.5 var(--serif); color: var(--ink-soft); }
.analogy b { font-weight: 600; color: var(--ink); }

/* role picker */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; gap: 3px; align-self: flex-start; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 7px 12px; font: 600 13.5px var(--sans); color: var(--muted); cursor: pointer; }
.seg button[aria-selected=true] { background: var(--btn); color: var(--btn-ink); }
.chips.picked .chip { display: inline-flex; align-items: center; gap: 6px; }
.chips.picked .chip svg { width: 13px; height: 13px; }
.allroles summary { font-size: 14px; }

/* ---------- landing animation: 12s loop, three scenes ---------- */
.hero-anim { margin: 4px auto 0; max-width: 420px; }
.hero-anim svg { width: 100%; height: auto; display: block; }
.ha-phone { fill: var(--paper); stroke: var(--line-strong); stroke-width: 1.5; }
.ha-notch { fill: var(--line); }
.ha-lbl { font: 600 9px var(--sans); fill: var(--muted); }
.ha-card { fill: var(--desk); stroke: var(--line); }
.ha-q { font: 500 11.5px var(--serif); fill: var(--ink); }
.ha-a { font: 400 9.5px var(--sans); fill: var(--ink-soft); }
.ha-rule { stroke: var(--line-strong); stroke-dasharray: 3 3; }
.ha-btn { fill: var(--paper); stroke: var(--line-strong); }
.ha-bt { font: 600 9px var(--sans); fill: var(--ink); text-anchor: middle; }
.ha-node rect { fill: var(--desk); stroke: var(--ink-soft); }
.ha-node text { font: 600 9.5px var(--sans); fill: var(--ink); text-anchor: middle; }
.ha-arrow { stroke: var(--muted); stroke-width: 1.4; }
.ha-dot { fill: var(--accent); }
.ha-wave { fill: var(--accent); transform-box: fill-box; transform-origin: center; }
.ha-pt circle { fill: var(--accent); }
.ha-s1, .ha-s2, .ha-s3 { opacity: 0; animation: ha-scene 12s infinite; }
.ha-s2 { animation-delay: 4s; } .ha-s3 { animation-delay: 8s; }
@keyframes ha-scene { 0% { opacity: 0; } 4%, 30% { opacity: 1; } 34%, 100% { opacity: 0; } }
.ha-ans { opacity: 0; animation: ha-ans 12s infinite; }
@keyframes ha-ans { 0%, 12% { opacity: 0; } 16%, 30% { opacity: 1; } 34%, 100% { opacity: 0; } }
.ha-got2 { animation: ha-tap 12s infinite; }
@keyframes ha-tap { 0%, 22% { fill: var(--paper); } 24%, 30% { fill: var(--accent-soft); stroke: var(--accent); } 34%, 100% { fill: var(--paper); } }
.ha-node, .ha-arrow { opacity: 0; animation: ha-build 12s infinite; animation-delay: calc(4s + var(--i) * .45s); }
@keyframes ha-build { 0% { opacity: 0; transform: translateY(4px); } 4%, 26% { opacity: 1; transform: none; } 30%, 100% { opacity: 0; } }
.ha-dot { opacity: 0; animation: ha-dot 12s infinite 4s; }
@keyframes ha-dot { 0%, 14% { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } 27% { opacity: 1; transform: translateY(126px); } 29%, 100% { opacity: 0; transform: translateY(126px); } }
.ha-wave { animation: ha-wave .9s ease-in-out infinite; animation-delay: calc(var(--i) * -.13s); }
@keyframes ha-wave { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
.ha-pt { opacity: 0; animation: ha-build 12s infinite; animation-delay: calc(9.2s + var(--i) * .6s); }
.ha-caption { position: relative; height: 22px; text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.ha-caption span { position: absolute; inset: 0; opacity: 0; animation: ha-scene 12s infinite; }
.ha-caption .c2 { animation-delay: 4s; } .ha-caption .c3 { animation-delay: 8s; }
@media (prefers-reduced-motion: reduce) {
  .ha-s1, .ha-ans, .ha-caption .c1 { opacity: 1 !important; animation: none !important; }
  .ha-s2, .ha-s3, .ha-caption .c2, .ha-caption .c3 { display: none; }
}

/* ---------- landing: an app page, not an article ---------- */
.landing { display: flex; flex-direction: column; gap: 44px; }
.l-hero { display: grid; gap: 18px; padding-top: 6px; }
@media (min-width: 760px) { .wrap:has(.landing) { max-width: 980px; } .l-hero { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 36px; padding-top: 30px; } }
.l-pitch { margin-bottom: 20px; padding: 14px 16px; border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--accent-soft); color: var(--ink-soft); font-size: .9rem; line-height: 1.5; }
.l-pitch strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: .95rem; }
.l-pitch-motion { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: .75rem; font-weight: 600; }
.l-pitch-video, .l-pitch-cards { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--paper); }
.l-pitch-motion .ic { width: 15px; height: 15px; }
.l-pitch-video { overflow: hidden; opacity: .6; }
.l-pitch-progress { position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--muted); transform: scaleX(.2); transform-origin: left; }
.l-pitch-arrow { display: inline-flex; color: var(--accent); }
.l-pitch-cards { border-color: var(--accent); color: var(--accent); box-shadow: 3px 3px 0 var(--paper), 4px 4px 0 var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .l-pitch { animation: pitch-enter .6s ease-out both; }
  .l-pitch-video { animation: pitch-video 3.6s ease-in-out both; }
  .l-pitch-progress { animation: pitch-progress 3.6s ease-out both; }
  .l-pitch-arrow { animation: pitch-arrow 3.6s ease-in-out both; }
  .l-pitch-cards { animation: pitch-cards 3.6s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes pitch-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pitch-video { 0%, 30% { opacity: 1; } 55%, 100% { opacity: .6; } }
@keyframes pitch-progress { 0% { transform: scaleX(0); } 35%, 100% { transform: scaleX(.2); } }
@keyframes pitch-arrow { 0%, 25% { opacity: 0; transform: translateX(-6px); } 45%, 100% { opacity: 1; transform: none; } }
@keyframes pitch-cards { 0%, 30% { opacity: 0; transform: translateY(8px) rotate(-6deg); } 55% { opacity: 1; transform: translateY(-3px) rotate(2deg); } 70%, 100% { opacity: 1; transform: none; } }
.l-title { font: 650 clamp(1.75rem, 6vw, 2.6rem)/1.12 var(--sans); letter-spacing: -.025em; }
.l-sub { font-size: 1.06rem; line-height: 1.55; color: var(--ink-soft); margin-top: 14px; max-width: 34em; }
.l-cta { margin: 22px 0 8px; }
.l-h2 { font: 650 1.25rem/1.25 var(--sans); letter-spacing: -.01em; margin-bottom: 14px; }
.l-try { max-width: 640px; }
.l-lanes { margin-bottom: 16px; }
.l-card .q { font: 600 1.3rem/1.3 var(--sans); letter-spacing: -.01em; }
.l-card .ans { font: 400 1rem/1.6 var(--sans); }
.l-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .l-grid { grid-template-columns: 1fr 1fr; } }
.l-tile { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.l-tile svg { width: 22px; height: 22px; color: var(--accent); margin-bottom: 4px; }
.l-tile b { font-size: 15px; }
.l-tile span { font-size: 14px; color: var(--muted); line-height: 1.45; }
.l-end { text-align: center; padding: 26px 0 10px; border-top: 1px solid var(--line); }
.l-end p { margin: -4px auto 18px; max-width: 30em; }
.landing .hero-anim { margin: 0 auto; width: 100%; }
@media (min-width: 760px) { body:has(.landing) .top { max-width: 980px; } }
.l-card.flash { min-height: 0; }
.l-card .foot { padding-top: 18px; }
.field-tile { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.field-tile:hover { border-color: var(--line-strong); }
