:root {
  /* Layout: phone-first single column (max 680px). Each step leads with a measured drawing or a live chart;
     the Back / Continue controls dock at the thumb. The contents page is a ruled index, left-aligned. */
  --paper: #E8ECF1;      /* drafting film */
  --sheet: #FAFBFC;      /* lesson surface */
  --ink: #14213A;        /* Prussian blue-black */
  --ink-2: #55617A;      /* secondary text, dimension lines */
  --rule: #C3CCD9;       /* borders and rules */
  --blue: #2148C0;       /* drafting blue: actions and annotations */
  --blue-soft: #DCE5FA;
  --up: #0C8A66;
  --down: #C93F2E;
  --mark: #FFD84A;       /* highlighter: the candle or answer you picked */
  --mark-a: rgba(255, 216, 74, 0.55);
  --grid: rgba(20, 33, 58, 0.055);
  --good-bg: #DCF1E7;
  --bad-bg: #F9E2DD;
  --note-bg: #EDF1F7;
  --on-blue: #FFFFFF;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --font-label: "Barlow Semi Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B182C; --sheet: #10223D; --ink: #E7EEFB; --ink-2: #9EB0CD; --rule: #2A4063;
    --blue: #8FB6FF; --blue-soft: #1A3360; --up: #3CC79A; --down: #FF7B67;
    --mark: #FFD84A; --mark-a: rgba(255, 216, 74, 0.30); --grid: rgba(190, 215, 255, 0.06);
    --good-bg: #123A33; --bad-bg: #48241F; --note-bg: #16294A; --on-blue: #0B182C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0B182C; --sheet: #10223D; --ink: #E7EEFB; --ink-2: #9EB0CD; --rule: #2A4063;
  --blue: #8FB6FF; --blue-soft: #1A3360; --up: #3CC79A; --down: #FF7B67;
  --mark: #FFD84A; --mark-a: rgba(255, 216, 74, 0.30); --grid: rgba(190, 215, 255, 0.06);
  --good-bg: #123A33; --bad-bg: #48241F; --note-bg: #16294A; --on-blue: #0B182C;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.08; text-wrap: balance; letter-spacing: 0.005em; }
b, strong { font-weight: 600; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

.page { max-width: 680px; margin: 0 auto; padding: 0 16px 48px; display: flex; flex-direction: column; gap: 28px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 6px; border: 1.5px solid var(--blue);
  background: var(--blue); color: var(--on-blue); font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.textlink { background: none; border: 0; padding: 6px 0; color: var(--blue); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Home ---------- */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; }
.wordmark { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: 0.01em; }
.wordmark svg { width: 22px; height: 22px; }
.masthead .saved { font-family: var(--font-label); font-size: 14px; color: var(--ink-2); }

.hero { display: flex; flex-direction: column; gap: 18px; }
.hero h1 { font-size: 46px; font-weight: 700; line-height: 0.98; max-width: 14ch; }
.hero .lede { font-size: 19px; max-width: 46ch; color: var(--ink); }
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.ruler { display: flex; flex-direction: column; gap: 8px; padding-top: 44px; }
.ruler .track { position: relative; }
.ruler .ticks { display: flex; align-items: flex-start; gap: 0; height: 30px; border-top: 1.5px solid var(--ink); }
.ruler .here { position: absolute; bottom: 100%; transform: translateX(-50%); margin-bottom: -3px; padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; border-radius: 6px; }
.ruler .tick { flex: 1; height: 12px; border-left: 1.5px solid var(--ink); position: relative; }
.ruler .tick.first { height: 26px; }
.ruler .tick.done::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 9px; background: var(--blue); }
.ruler .tick.skip::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 9px; background: repeating-linear-gradient(135deg, var(--blue) 0 2px, transparent 2px 5px); }
.ruler .tick.done::after, .ruler .tick.skip::after { transform-origin: 0 50%; animation: tick-fill 0.35s ease-out both; animation-delay: calc(var(--i, 0) * 45ms + 200ms); }
@keyframes tick-fill { from { transform: scaleX(0); } }
.ruler .ticks > .end { width: 0; height: 26px; border-left: 1.5px solid var(--ink); }
.ruler .legend { display: flex; font-family: var(--font-label); font-size: 13.5px; color: var(--ink-2); }
.ruler .legend span { padding-right: 6px; }
.ruler .sum { font-family: var(--font-label); font-size: 15px; color: var(--ink-2); }
.ruler .sum b { color: var(--ink); }

.course { display: flex; flex-direction: column; gap: 0; }
.course-head { display: grid; grid-template-columns: 44px 1fr; align-items: baseline; padding-bottom: 10px; border-bottom: 1.5px solid var(--ink); }
.course-head .no { font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1; }
.course-head h2 { font-size: 30px; }
.course-head p { grid-column: 2; color: var(--ink-2); font-size: 16px; }
.toc-row {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: start; gap: 0 4px; width: 100%;
  padding: 13px 0; background: none; border: 0; border-bottom: 1px solid var(--rule); text-align: left; cursor: pointer;
}
.toc-row:hover .ttl { text-decoration: underline; text-underline-offset: 3px; }
.toc-row .no { font-family: var(--font-label); font-weight: 600; font-size: 16px; color: var(--ink-2); padding-top: 1px; font-variant-numeric: tabular-nums; }
.toc-row .ttl { font-weight: 600; font-size: 18px; line-height: 1.25; }
.toc-row .does { grid-column: 2; font-size: 15px; color: var(--ink-2); line-height: 1.35; margin-top: 2px; }
.toc-row .state { grid-row: 1 / span 2; grid-column: 3; align-self: center; font-family: var(--font-label); font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; padding-left: 10px; white-space: nowrap; }
.toc-row .state svg { width: 20px; height: 20px; }
.toc-row.next .no { color: var(--blue); }
.toc-row.next .state { color: var(--blue); font-weight: 600; }

.later { display: flex; flex-direction: column; gap: 8px; }
.later h2 { font-size: 24px; }
.later p { color: var(--ink-2); font-size: 16px; max-width: 60ch; }
.later ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.later li { font-family: var(--font-label); font-size: 14.5px; padding: 3px 10px; border: 1px dashed var(--rule); border-radius: 3px; color: var(--ink-2); }

.foot { font-size: 13.5px; color: var(--ink-2); line-height: 1.45; border-top: 1px solid var(--rule); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Lesson chrome ---------- */
.lesson-top { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: 10px 0 10px; display: flex; flex-direction: column; gap: 9px; border-bottom: 1px solid var(--rule); }
.lesson-top .line { display: flex; align-items: baseline; gap: 12px; }
.lesson-top .back { background: none; border: 0; padding: 4px 0; color: var(--blue); font-weight: 500; cursor: pointer; font-size: 15px; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }
.lesson-top .back svg { width: 16px; height: 16px; }
.lesson-top .name { font-family: var(--font-label); font-size: 15px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-top .name b { color: var(--ink); }
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0; padding: 0; list-style: none; }
.stepper li { font-family: var(--font-label); font-size: 12.5px; color: var(--ink-2); border-top: 3px solid var(--rule); padding-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper li.done { border-top-color: var(--blue); }
.stepper li.on { border-top-color: var(--ink); color: var(--ink); font-weight: 600; }

.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; padding: 22px 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.sheet h1 { font-size: 31px; }
.sheet h2 { font-size: 23px; margin-top: 6px; }
.sheet p { max-width: 62ch; }
.sheet .sub { color: var(--ink-2); }
.page.lesson { gap: 14px; padding-bottom: 0; }

.dock { position: sticky; bottom: 0; z-index: 5; background: var(--paper); border-top: 1px solid var(--rule); padding: 10px 0 14px; display: flex; gap: 10px; justify-content: space-between; margin-top: 4px; }
.dock .btn { flex: 0 0 auto; }
.dock .btn.go { flex: 1; max-width: 340px; margin-left: auto; }
.legal { font-size: 13px; color: var(--ink-2); padding-bottom: 20px; }

/* ---------- Plates (diagrams) ---------- */
figure.plate-box { margin: 2px 0; display: flex; flex-direction: column; gap: 8px; }
.plate-frame {
  border: 1px solid var(--rule); border-radius: 2px; padding: 10px 8px; overflow-x: auto;
  background-color: var(--sheet);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 16px 16px; background-position: -1px -1px;
}
svg.plate { display: block; width: 100%; max-width: 540px; height: auto; margin: 0 auto; font-family: var(--font-label); }
figure.plate-box figcaption { font-size: 15px; color: var(--ink-2); line-height: 1.4; max-width: 60ch; }
.hero .plate-frame { padding: 6px; }

svg.plate text { fill: var(--ink); font-size: 12.5px; font-weight: 500; }
svg.plate .t-m { fill: var(--ink-2); }
svg.plate .t-b { font-weight: 600; }
svg.plate .t-s { font-size: 11px; }
svg.plate .t-h { font-size: 14.5px; font-weight: 600; }
svg.plate .t-big { font-family: var(--font-display); font-size: 25px; font-weight: 700; }
svg.plate .t-xl { font-family: var(--font-display); font-size: 36px; font-weight: 700; letter-spacing: 0.01em; }
svg.plate .t-up { fill: var(--up); }
svg.plate .t-dn { fill: var(--down); }
svg.plate .t-bl { fill: var(--blue); }
svg.plate .t-on { fill: var(--on-blue); }
svg.plate .s-ink { stroke: var(--ink); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg.plate .s-thin { stroke: var(--ink-2); stroke-width: 1; fill: none; }
svg.plate .s-rule { stroke: var(--rule); stroke-width: 1; fill: none; }
svg.plate .s-blue { stroke: var(--blue); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg.plate .s-up { stroke: var(--up); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg.plate .s-dn { stroke: var(--down); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg.plate .dash { stroke-dasharray: 5 4; }
svg.plate .dot3 { stroke-dasharray: 1.5 3.5; }
svg.plate .w2 { stroke-width: 2.2; }
svg.plate .f-ink { fill: var(--ink); }
svg.plate .f-mute { fill: var(--ink-2); }
svg.plate .f-blue { fill: var(--blue); }
svg.plate .f-soft { fill: var(--blue-soft); }
svg.plate .f-up { fill: var(--up); }
svg.plate .f-dn { fill: var(--down); }
svg.plate .f-mark { fill: var(--mark-a); }
svg.plate .f-sheet { fill: var(--sheet); }
svg.plate .f-good { fill: var(--good-bg); }
svg.plate .f-bad { fill: var(--bad-bg); }
svg.plate .f-note { fill: var(--note-bg); }
svg.plate .f-hatch-dn { fill: url(#hatch-dn); }
svg.plate .f-hatch-up { fill: url(#hatch-up); }
svg.plate .f-hatch-ink { fill: url(#hatch-ink); }
svg.plate .f-hatch-blue { fill: url(#hatch-blue); }
.pat-dn { stroke: var(--down); stroke-width: 1.2; }
.pat-up { stroke: var(--up); stroke-width: 1.2; }
.pat-ink { stroke: var(--ink-2); stroke-width: 1; }
.pat-blue { stroke: var(--blue); stroke-width: 1.2; }

/* ---------- Tables ---------- */
.spec-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 2px; }
table.spec { border-collapse: collapse; width: 100%; font-size: 15.5px; line-height: 1.35; }
table.spec th, table.spec td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--rule); }
table.spec tr:last-child td, table.spec tr:last-child th { border-bottom: 0; }
table.spec thead th { font-family: var(--font-label); font-weight: 600; font-size: 14.5px; color: var(--ink-2); border-bottom: 1.5px solid var(--ink); }
table.spec tbody th { font-weight: 600; white-space: nowrap; }
.callout { border-left: 3px solid var(--blue); background: var(--note-bg); padding: 12px 14px; border-radius: 0 3px 3px 0; font-size: 16.5px; }
.callout.result { border-left-color: var(--ink); }

/* ---------- Charts ---------- */
.chart { position: relative; border: 1px solid var(--rule); border-radius: 2px; background: var(--sheet); overflow: hidden; }
.chart canvas { display: block; width: 100%; height: 300px; cursor: crosshair; touch-action: manipulation; }
.chart.drag canvas { touch-action: none; cursor: ns-resize; }
.chart .tag { position: absolute; left: 10px; top: 7px; right: 64px; font-family: var(--font-label); font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.chart-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chart-tools .read { flex: 1; min-width: 160px; font-family: var(--font-label); font-size: 15px; color: var(--ink-2); }
.chart-tools .read b { color: var(--ink); }
.nudge { display: inline-flex; gap: 6px; }
.nudge button { width: 46px; height: 42px; border-radius: 6px; border: 1.5px solid var(--rule); background: var(--sheet); cursor: pointer; display: grid; place-items: center; }
.nudge button svg { width: 18px; height: 18px; }
.seg { display: inline-flex; border: 1.5px solid var(--rule); border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--sheet); padding: 9px 14px; min-height: 42px; cursor: pointer; font-family: var(--font-label); font-weight: 500; font-size: 15.5px; border-right: 1.5px solid var(--rule); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }
.ohlc { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--rule); border-radius: 2px; }
.ohlc div { padding: 8px 10px; border-right: 1px solid var(--rule); display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 500; }
.ohlc div:last-child { border-right: 0; }
.ohlc span { font-family: var(--font-label); font-size: 13px; color: var(--ink-2); font-weight: 500; }
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 16px; font-family: var(--font-label); font-size: 14px; color: var(--ink-2); }
.legend-row i { display: inline-block; width: 14px; height: 10px; margin-right: 6px; border: 1px solid var(--rule); vertical-align: -1px; }

/* ---------- Questions ---------- */
.q { display: flex; flex-direction: column; gap: 14px; }
.q-count { font-family: var(--font-label); font-size: 15px; color: var(--ink-2); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: grid; grid-template-columns: 30px 1fr; gap: 4px; align-items: start; text-align: left;
  padding: 12px 14px 12px 10px; border-radius: 6px; border: 1.5px solid var(--rule); background: var(--sheet); cursor: pointer; line-height: 1.35;
}
.choice .k { font-family: var(--font-label); font-weight: 600; color: var(--ink-2); text-align: center; }
.choice:hover:not(:disabled) { border-color: var(--ink); }
.choice.picked { background: var(--mark-a); border-color: var(--ink); }
.choice.right { border-color: var(--up); background: var(--good-bg); }
.choice.wrong { border-color: var(--down); background: var(--bad-bg); }
.choice:disabled { cursor: default; }
.num-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.num-row input {
  font: inherit; font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; width: 132px; min-height: 48px; padding: 8px 12px;
  border-radius: 6px; border: 1.5px solid var(--ink-2); background: var(--sheet); color: var(--ink);
}
.num-row .unit { font-family: var(--font-label); color: var(--ink-2); font-size: 16px; margin-right: 4px; }
.num-row .sign { width: 48px; min-height: 48px; border-radius: 6px; border: 1.5px solid var(--rule); background: var(--sheet); cursor: pointer; font-size: 20px; font-weight: 600; }
.fb { scroll-margin: 110px 0 100px; display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 12px 14px; border-radius: 3px; font-size: 16.5px; line-height: 1.42; }
.fb svg { width: 22px; height: 22px; margin-top: 1px; }
.fb.good, .fb.bad { grid-template-columns: 36px 1fr; gap: 12px; }
.fb svg.guide { width: 36px; height: 47px; margin-top: -2px; }
.fb:not([hidden]) { animation: fb-in 0.2s ease-out both; }
@keyframes fb-in { from { opacity: 0; transform: translateY(5px); } }
.fb.good { background: var(--good-bg); }
.fb.bad { background: var(--bad-bg); }
.fb.note { background: var(--note-bg); }
.fb .work { display: block; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- Calculators ---------- */
.calc { display: flex; flex-direction: column; gap: 16px; border: 1px solid var(--rule); border-radius: 2px; padding: 16px 14px; }
.calc .ctl { display: flex; flex-direction: column; gap: 6px; }
.calc .ctl label, .calc .ctl .lab { font-family: var(--font-label); font-size: 15.5px; font-weight: 500; display: flex; justify-content: space-between; gap: 12px; }
.calc .ctl output { font-weight: 600; font-variant-numeric: tabular-nums; }
.calc input[type="range"] { width: 100%; accent-color: var(--blue); height: 28px; margin: 0; }
.calc .out { border-top: 1.5px solid var(--ink); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.calc .out .big { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.calc .out .why { font-size: 15.5px; color: var(--ink-2); line-height: 1.4; }
.calc .out svg.plate { margin: 4px 0 0; max-width: none; }

/* ---------- Trade buttons, logs ---------- */
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sides button { min-height: 52px; border-radius: 6px; border: 1.5px solid; font-weight: 600; cursor: pointer; background: var(--sheet); }
.sides .long { border-color: var(--up); color: var(--up); }
.sides .short { border-color: var(--down); color: var(--down); }
.sides button[aria-pressed="true"].long { background: var(--up); color: var(--sheet); }
.sides button[aria-pressed="true"].short { background: var(--down); color: var(--sheet); }
.sides button:disabled { opacity: 0.45; cursor: default; }
.sides button[aria-pressed="true"]:disabled { opacity: 1; }
.log { border: 1px solid var(--rule); border-radius: 2px; }
.log-row { display: grid; grid-template-columns: 26px 1fr 1fr 84px; gap: 6px; align-items: center; width: 100%; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--rule); background: none; text-align: left; font-variant-numeric: tabular-nums; font-size: 16px; }
.log-row:last-child { border-bottom: 0; }
.log-row.head { font-family: var(--font-label); font-size: 13.5px; color: var(--ink-2); border-bottom: 1.5px solid var(--ink); }
button.log-row { cursor: pointer; }
button.log-row:hover { background: var(--note-bg); }
.log-row .r { font-weight: 600; text-align: right; }
.log-row .r.todo { font-family: var(--font-label); font-weight: 500; font-size: 14px; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.log-row .pos { color: var(--up); } .log-row .neg { color: var(--down); }

/* ---------- Recap ---------- */
.score { display: flex; align-items: flex-end; gap: 12px; }
.score .of { padding-bottom: 4px; }
.score .n { font-family: var(--font-display); font-weight: 700; font-size: 64px; line-height: 0.9; font-variant-numeric: tabular-nums; }
.score .of { font-family: var(--font-label); font-size: 17px; color: var(--ink-2); }
ul.points { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
ul.points li { display: grid; grid-template-columns: 26px 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--rule); line-height: 1.4; }
ul.points li:first-child { border-top: 1.5px solid var(--ink); }
ul.points li svg { width: 20px; height: 20px; margin-top: 2px; }
.result-table { border-top: 1.5px solid var(--ink); }
.result-table .rrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.result-table .rrow span { color: var(--ink-2); font-size: 15.5px; }
.result-table .rrow b { font-variant-numeric: tabular-nums; }

/* ---------- Wick, the guide ---------- */
.guide { display: block; overflow: visible; flex: 0 0 auto; transform-origin: 50% 100%; }
.guide .g-wick { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.guide .g-body { fill: var(--blue); }
.guide .g-body.g-up { fill: var(--up); }
.guide .g-body.g-down { fill: var(--down); }
.guide .g-face { fill: var(--sheet); }
.guide .g-mouth { stroke: var(--sheet); stroke-width: 2.2; fill: none; stroke-linecap: round; }
.guide .g-mouth.open { fill: var(--sheet); stroke: none; }
.guide .g-brow { stroke: var(--sheet); stroke-width: 2; stroke-linecap: round; fill: none; }
.guide .g-arm { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.guide .g-spark { stroke: var(--up); stroke-width: 2.2; stroke-linecap: round; fill: none; }
.guide .g-eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: g-blink 5.4s infinite; }
.guide .g-sparks { transform-box: fill-box; transform-origin: 50% 70%; animation: g-spark 0.45s 0.28s ease-out both; }
.guide.in { animation: g-pop 0.32s ease-out both; }
.guide-good.in, .guide-cheer.in { animation: g-hop 0.52s ease-out both; }
.guide-bad.in { animation: g-sag 0.42s ease-out both; }
@keyframes g-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
@keyframes g-pop { 0% { transform: translateY(5px) scale(0.84); opacity: 0; } 60% { transform: translateY(-2px) scale(1.04); opacity: 1; } 100% { transform: none; } }
@keyframes g-hop { 0% { transform: translateY(6px) scale(0.86); opacity: 0; } 45% { transform: translateY(-8px) scale(1.02, 1.07); opacity: 1; } 75% { transform: translateY(0) scale(1.05, 0.94); } 100% { transform: none; } }
@keyframes g-sag { 0% { transform: rotate(-10deg) translateY(2px); opacity: 0; } 55% { transform: rotate(4deg); opacity: 1; } 100% { transform: none; } }
@keyframes g-spark { 0% { opacity: 0; transform: scale(0.2); } 100% { opacity: 1; transform: none; } }
.says { display: flex; align-items: flex-end; gap: 12px; }
.says .bubble { border: 1.5px solid var(--rule); background: var(--sheet); border-radius: 14px 14px 14px 3px; padding: 10px 14px; font-size: 16.5px; line-height: 1.4; max-width: 46ch; margin-bottom: 6px; }
.rally { margin-left: auto; width: 112px; height: 62px; align-self: flex-end; margin-bottom: 4px; }
.rally .rw-up { stroke: var(--up); stroke-width: 1.4; } .rally .rw-dn { stroke: var(--down); stroke-width: 1.4; }
.rally .rb-up { fill: var(--up); } .rally .rb-dn { fill: var(--down); }
.rally .rc { transform-box: fill-box; transform-origin: 50% 100%; animation: rc-grow 0.3s ease-out both; animation-delay: calc(var(--i, 0) * 80ms + 400ms); }
@keyframes rc-grow { from { transform: scaleY(0); opacity: 0; } }

/* ---------- Small motion that answers an action ---------- */
.btn:active:not(:disabled) { transform: translateY(1px); }
.choice { transition: border-color 0.15s, background-color 0.15s; }
.choice:active:not(:disabled) { transform: scale(0.99); }
.stepper li { transition: border-color 0.3s, color 0.3s; }
.sheet.enter { animation: sheet-in 0.2s ease-out; }
@keyframes sheet-in { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  ul.points li svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: tick-draw 0.35s ease-out forwards; animation-delay: calc(var(--i, 0) * 110ms + 300ms); }
}
@keyframes tick-draw { to { stroke-dashoffset: 0; } }

@media (min-width: 620px) {
  .hero h1 { font-size: 58px; }
  .sheet { padding: 28px 28px 30px; }
  .sheet h1 { font-size: 36px; }
  .chart canvas { height: 340px; }
}
@media (max-width: 560px) {
  /* tables stack: each row becomes a short labelled block */
  table.spec thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.spec, table.spec tbody, table.spec tr, table.spec th, table.spec td { display: block; }
  table.spec tr { padding: 10px 12px; border-bottom: 1px solid var(--rule); }
  table.spec tr:last-child { border-bottom: 0; }
  table.spec tbody th, table.spec td { padding: 0; border: 0; white-space: normal; }
  table.spec tbody th { font-size: 17px; margin-bottom: 3px; }
  table.spec td { display: grid; grid-template-columns: 124px 1fr; gap: 8px; padding: 2px 0; }
  table.spec td::before { content: attr(data-label); font-family: var(--font-label); font-size: 14px; color: var(--ink-2); padding-top: 1px; }
}
@media (max-width: 380px) {
  body { font-size: 16.5px; }
  .hero h1 { font-size: 41px; }
  .sheet { padding: 20px 16px 22px; }
  .toc-row .state .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Free account sign-in ---------- */
.signin { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; max-width: 460px; }
.signin .si-lab { font-family: var(--font-label); font-weight: 600; font-size: 15.5px; }
.signin input[type="email"] { font: inherit; font-size: 17px; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: 6px; background: var(--sheet); color: var(--ink); min-height: 48px; }
.signin input[type="email"]:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.signin .si-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink-2); }
.signin .si-consent input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; }
.signin .btn { align-self: flex-start; }
.signin .si-msg { font-size: 15.5px; padding: 12px 14px; border-radius: 6px; }
.signin .si-msg.ok { background: var(--good-bg); }
.signin .si-msg.err { background: var(--bad-bg); }
.masthead .acct { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.masthead .acct .textlink { font: inherit; }
