/* Shared design for all lessons. Same tokens as the plan page (../ai-learning-plan.html), plus lesson components. */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --fg: #16202e;
  --muted: #5a6779;
  --line: #d9e0ea;
  --accent: #1f5fd1;
  --accent-soft: #e4edfc;
  --warm: #b4610b;
  --warm-soft: #fbefe1;
  --done: #2c7a4b;
  --done-soft: #e3f3e9;
  --bad: #c0392b;
  --bad-soft: #fbe6e3;
  --ai: #6a3fc8;
  --ai-soft: #efe9fb;
  /* chart series (validated categorical order: blue, orange, aqua, yellow) */
  --c1: #2a78d6;
  --c2: #eb6834;
  --c3: #1baf7a;
  --c4: #eda100;
  --grid: #e1e0d9;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1520; --surface: #172030; --surface-2: #1c2738; --fg: #e6ebf3; --muted: #9aa7ba; --line: #2a3648;
    --accent: #7fa8f5; --accent-soft: #1d2b45; --warm: #f0a95a; --warm-soft: #33261a; --done: #6cc792; --done-soft: #17301f;
    --bad: #f08a7e; --bad-soft: #3a1f1c; --ai: #b69cf5; --ai-soft: #2a2140;
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --grid: #2c3546;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1520; --surface: #172030; --surface-2: #1c2738; --fg: #e6ebf3; --muted: #9aa7ba; --line: #2a3648;
  --accent: #7fa8f5; --accent-soft: #1d2b45; --warm: #f0a95a; --warm-soft: #33261a; --done: #6cc792; --done-soft: #17301f;
  --bad: #f08a7e; --bad-soft: #3a1f1c; --ai: #b69cf5; --ai-soft: #2a2140;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --grid: #2c3546;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* No code ligatures: JetBrains Mono turns "<|" and "|>" into arrows, so "<|endoftext|>" looks wrong.
   !important because the `font` shorthand (used in many rules) resets ligatures. */
* { font-variant-ligatures: none !important; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; font-size: calc(100% * var(--scale, 1)); }
body {
  margin: 0;
  background: var(--bg); color: var(--fg);
  font: 1.125rem/1.6 var(--f-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: 80px;
}
.wrap { max-width: 860px; margin: 0 auto; }
:root[data-view="scroll"] main.wrap { max-width: var(--page-w, 1320px); }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.35rem, 4vw, 1.7rem); font-weight: 800; }
h3 { font-size: 1.12rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, .mono { font-family: var(--f-mono); font-size: 0.86em; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
pre { margin: 0; }
.eyebrow { font: 600 0.75rem/1.2 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar (built by course.js) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding: 8px max(16px, env(safe-area-inset-left, 0px));
}
.topbar .in { max-width: var(--page-w, 1320px); position: relative; margin: 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar .home {
  font: 700 0.9rem var(--f-display); color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px 5px 9px; min-height: 32px;
}
.topbar .home:hover { border-color: var(--accent); }
.topbar .home svg { color: var(--accent); }
.topbar .where {
  font: 600 0.75rem var(--f-mono); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid transparent; border-radius: 999px; padding: 5px 10px; cursor: pointer;
}
.topbar .where:hover, .topbar .where[aria-expanded="true"] { border-color: var(--line); color: var(--fg); background: var(--surface); }
.topbar .where .short { display: none; }
.lesson-menu {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 40; width: min(440px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
.lesson-menu ol { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 2px; }
.lesson-menu ol a { display: grid; grid-template-columns: 2em 1fr 1.2em; gap: 8px; padding: 7px 8px; border-radius: 6px; color: var(--fg); text-decoration: none; font-size: 0.95rem; line-height: 1.3; }
.lesson-menu ol a:hover { background: var(--surface-2); }
.lesson-menu ol a[aria-current] { background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; }
.lesson-menu .num { color: var(--muted); font: 0.8rem var(--f-mono); padding-top: 2px; }
.lesson-menu .tick { color: var(--done); font-weight: 700; }
.menu-foot { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding: 12px 0 2px; position: sticky; bottom: -14px; background: var(--surface); margin-bottom: -2px; }
.menu-foot .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.menu-foot .btn svg { color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .readbar { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--accent); width: 0; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { font: 600 0.78rem var(--f-mono); border: 0; background: none; color: var(--muted); padding: 5px 11px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { color: #0f1520; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { color: #0f1520; } }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; }

/* ---------- lesson head ---------- */
.lesson-head { padding-block: 40px 8px; display: grid; gap: 14px; }
.lesson-head .big-idea {
  font-size: 1.25rem; line-height: 1.45; max-width: 46ch;
  border-left: 4px solid var(--accent); padding-left: 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 600 0.75rem var(--f-mono); padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }

/* ---------- steps (one idea each) ---------- */
.step { margin-top: 44px; display: grid; gap: 14px; }
.step > header { display: flex; align-items: center; gap: 12px; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font: 800 1rem var(--f-display);
}
:root[data-theme="dark"] .step-num { color: #0f1520; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .step-num { color: #0f1520; } }
.step p { max-width: 62ch; }
.lead { font-size: 1.1rem; }

/* ---------- interactive demo box ---------- */
.demo {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 14px; min-width: 0;
}
.demo-title { font: 600 0.75rem var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.demo-title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.demo svg, .demo canvas { display: block; width: 100%; height: auto; max-width: 100%; touch-action: none; }
.hint { font-size: 0.92rem; color: var(--muted); }
.readout { font: 600 1rem var(--f-mono); font-variant-numeric: tabular-nums; }
.big-readout { font: 800 clamp(1.4rem, 5vw, 2rem) var(--f-mono); font-variant-numeric: tabular-nums; }
.row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* controls */
.btn {
  font: 600 0.95rem var(--f-body); border: 1px solid var(--line); background: var(--surface-2); color: var(--fg);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; min-height: 40px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0f1520; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0f1520; } }
.btn:disabled { opacity: 0.5; cursor: default; }
label.slider { display: grid; grid-template-columns: minmax(70px, auto) 1fr 4.5em; gap: 10px; align-items: center; font-size: 0.95rem; }
label.slider output { font: 600 0.95rem var(--f-mono); text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 28px; }
input[type="number"], input[type="text"], select, textarea {
  font: 1rem var(--f-body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
}
input[type="number"] { font-family: var(--f-mono); width: 5.5em; }
textarea { width: 100%; min-height: 120px; resize: vertical; line-height: 1.5; }

/* ---------- callouts ---------- */
.box { border-radius: 0 var(--radius) var(--radius) 0; padding: 12px 16px; border-left: 4px solid; display: grid; gap: 6px; }
.box > b:first-child, .box > .box-label { font: 700 0.75rem var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.box.tip { background: var(--accent-soft); border-color: var(--accent); }
.box.tip > b:first-child { color: var(--accent); }
.box.ai { background: var(--ai-soft); border-color: var(--ai); }
.box.ai > b:first-child { color: var(--ai); }
.box.warn { background: var(--warm-soft); border-color: var(--warm); }
.box.warn > b:first-child { color: var(--warm); }
.box.ok { background: var(--done-soft); border-color: var(--done); }
.box.ok > b:first-child { color: var(--done); }

.remember { margin-top: 48px; background: var(--surface); border: 2px solid var(--done); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 12px; }
.remember h2 { color: var(--done); font-size: 1.3rem; }
.remember ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }

/* big formula line */
.formula {
  font: 600 clamp(1rem, 3.6vw, 1.3rem)/1.5 var(--f-mono); text-align: center; padding: 14px; border-radius: 8px;
  background: var(--surface-2); overflow-x: auto; white-space: nowrap;
}

/* analogy card: picture + words side by side */
.analogy { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.analogy svg { width: 96px; height: 96px; }
@media (max-width: 480px) { .analogy { grid-template-columns: 64px 1fr; } .analogy svg { width: 64px; height: 64px; } }

/* ---------- "deep" (Full mode only) ---------- */
.deep { border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; background: var(--surface); }
.deep::before { content: "Engineer details"; font: 700 0.7rem var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--warm); }
:root[data-depth="simple"] .deep { display: none; }
pre.code {
  font: 0.86rem/1.55 var(--f-mono); background: var(--surface-2); border-radius: 8px; padding: 12px 14px; overflow-x: auto;
  white-space: pre; tab-size: 4;
}
pre.code .c { color: var(--muted); }

/* ---------- quiz ---------- */
.quiz { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.quiz .q { font-weight: 600; }
.quiz .q::before { content: "Quick check"; display: block; font: 700 0.7rem var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--done); margin-bottom: 4px; }
.quiz .opts { display: grid; gap: 8px; }
.quiz .opts button {
  text-align: left; font: 1rem var(--f-body); color: var(--fg); background: var(--surface-2);
  border: 2px solid transparent; border-radius: 8px; padding: 9px 12px; cursor: pointer;
}
.quiz .opts button:hover { border-color: var(--line); }
.quiz .opts button.right { border-color: var(--done); background: var(--done-soft); }
.quiz .opts button.right::after { content: "  ✓ Correct"; font-weight: 700; color: var(--done); }
.quiz .opts button.wrong { border-color: var(--bad); background: var(--bad-soft); }
.quiz .opts button.wrong::after { content: "  ✗ Try again"; font-weight: 700; color: var(--bad); }
.quiz .why { display: none; font-size: 0.98rem; border-top: 1px solid var(--line); padding-top: 10px; }
.quiz.solved .why { display: block; }

/* reveal */
details.reveal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
details.reveal summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.reveal[open] summary { margin-bottom: 8px; }

/* ---------- Python runner ---------- */
.py { display: grid; gap: 8px; }
.py textarea { font: 0.88rem/1.55 var(--f-mono); min-height: 140px; background: var(--surface-2); white-space: pre; overflow-x: auto; }
.py .out { font: 0.86rem/1.5 var(--f-mono); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 2.5em; white-space: pre-wrap; overflow-x: auto; }
.py .out.err { color: var(--bad); }

/* ---------- bottom lesson nav ---------- */
.lesson-nav { margin-top: 56px; display: grid; gap: 14px; }
.lesson-nav .done-row { display: flex; justify-content: center; }
.lesson-nav .pn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lesson-nav a.card {
  display: grid; gap: 2px; text-decoration: none; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.lesson-nav a.card:hover { border-color: var(--accent); }
.lesson-nav a.card small { color: var(--muted); font: 600 0.72rem var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.lesson-nav a.next { text-align: right; }
.lesson-nav .ph { visibility: hidden; }
.btn.done-btn[aria-pressed="true"] { background: var(--done); border-color: var(--done); color: #fff; }
:root[data-theme="dark"] .btn.done-btn[aria-pressed="true"] { color: #0f1520; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.done-btn[aria-pressed="true"] { color: #0f1520; } }

/* SVG helpers used by lessons */
.svg-text { fill: var(--fg); font-family: var(--f-mono); }
.svg-muted { fill: var(--muted); font-family: var(--f-mono); }
.svg-grid { stroke: var(--grid); }
.svg-axis { stroke: var(--muted); }
.drag { cursor: grab; }
.drag:active { cursor: grabbing; }

@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .demo { padding: 12px; }
  label.slider { grid-template-columns: 1fr 4em; }
  label.slider > span:first-child { grid-column: 1 / -1; }
  .topbar .where { padding: 5px 6px; }
  .topbar .where .long { display: none; }
  .topbar .where .short { display: inline; }
  .topbar .in { gap: 8px; }
}
@media (max-width: 420px) {
  .topbar .home { padding: 5px 9px; }
  .topbar .home span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}


/* =====================================================================
   Settings panel (top bar)
   ===================================================================== */
.settings {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(340px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18); display: grid; gap: 12px;
}
.set-row { display: grid; grid-template-columns: 6.5em 1fr; align-items: center; gap: 10px; }
.set-name { font: 600 0.8rem var(--f-mono); color: var(--muted); }
.set-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.row.tight { gap: 8px; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 0.9rem; }
.btn.big { min-height: 48px; padding: 10px 20px; font-size: 1.05rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }

/* read aloud */
.listen {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--accent);
  font: 600 0.8rem var(--f-mono); padding: 5px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.listen[aria-pressed="true"] { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.speaking { background: color-mix(in srgb, var(--c4) 28%, transparent) !important; border-radius: 4px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c4) 28%, transparent); transition: background .2s; }

/* confetti on "lesson done" */
.confetti { position: fixed; z-index: 60; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: conf 1s ease-out forwards; }
@keyframes conf { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

/* =====================================================================
   Chunks: text left, demo right on wide screens
   ===================================================================== */
.chunk { display: grid; gap: 16px; min-width: 0; }
.chunk.split { grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; }
.chunk .col { display: grid; gap: 16px; min-width: 0; align-content: start; }
.chunk.split .col-text { position: sticky; top: 0; }
.chunk.narrow { max-width: 860px; width: 100%; }
.demo svg.plane { max-width: 440px; margin-inline: auto; }

/* =====================================================================
   Scroll view: each part is a clear card
   ===================================================================== */
:root[data-view="scroll"] .step {
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent);
  border-radius: 14px; padding: 22px clamp(14px, 3vw, 28px) 26px; margin-top: 36px; gap: 18px;
}
:root[data-view="scroll"] .step > header { flex-wrap: wrap; }
:root[data-view="scroll"] .step .demo, :root[data-view="scroll"] .step .quiz, :root[data-view="scroll"] .step .deep,
:root[data-view="scroll"] .step details.reveal, :root[data-view="scroll"] .step .analogy { background: var(--bg); }
.part-of { font: 600 0.72rem var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-left: auto; }
.step > header .listen { margin-left: 4px; }
:root[data-view="scroll"] .chunk + .chunk { border-top: 1px dashed var(--line); padding-top: 18px; }

/* =====================================================================
   Slides view
   ===================================================================== */
:root[data-view="slides"] body { padding: 0; overflow: hidden; height: 100vh; height: 100dvh; }
:root[data-view="slides"] .topbar { margin: 0; }
.deck { position: fixed; left: 0; right: 0; top: var(--top-h, 49px); bottom: var(--ctl-h, 64px); overflow: clip; }
.deck-track { display: flex; height: 100%; transition: transform .45s cubic-bezier(.2,.7,.2,1); will-change: transform; }
.slide { flex: 0 0 100%; min-width: 0; height: 100%; }
.slide.measure { position: absolute; inset: 0; visibility: hidden; pointer-events: none; }
.slide-in {
  height: 100%; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column;
  padding: 16px max(16px, env(safe-area-inset-left, 0px)) 20px;
}
.slide-card {
  margin: auto; width: 100%; max-width: var(--page-w, 1320px); display: grid; gap: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: clamp(14px, 2.4vw, 28px); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 10px 30px rgba(20,30,50,.06);
}
.slide-card.narrow { max-width: 900px; }
.slide-card .demo, .slide-card .quiz, .slide-card .deep, .slide-card details.reveal, .slide-card .analogy { background: var(--bg); }
.slide-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.slide-head .step-num { width: 42px; height: 42px; font-size: 1.15rem; }
.slide-title { display: grid; gap: 4px; flex: 1; min-width: 0; }
.slide-title h2 { font-size: clamp(1.3rem, 3.2vw, 2rem); }
:root[data-view="slides"] .demo svg { max-height: calc(100dvh - 340px); }
:root[data-view="slides"] .demo svg.plane { max-height: min(420px, calc(100dvh - 400px)); }
.slide h1[tabindex="-1"]:focus, .slide h2[tabindex="-1"]:focus { outline: none; }

/* title slide */
.slide-card.title { max-width: min(1180px, var(--page-w, 1320px)); }
.title-slide { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .title-slide { grid-template-columns: 3fr 2fr; align-items: center; } }
.title-slide .lesson-head { padding: 8px 0; }
.title-slide .lesson-head .row { margin-top: 8px; }
.agenda-box { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: grid; gap: 10px; }
.agenda { margin: 0; padding-left: 1.6em; display: grid; gap: 8px; font-size: 1.05rem; }
.agenda li::marker { font: 700 0.9rem var(--f-mono); color: var(--accent); }

/* end slide */
.end-slide { display: grid; gap: 16px; }
.end-slide .remember, .end-slide .lesson-nav { margin-top: 0; }
.end-score { font: 600 0.95rem var(--f-mono); color: var(--muted); text-align: center; }
.end-score:empty { display: none; }

/* controls */
.deck-controls {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: var(--ctl-h, 64px);
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
  padding: 0 max(12px, env(safe-area-inset-left, 0px)) env(safe-area-inset-bottom, 0px);
}
.deck-controls .in { max-width: var(--page-w, 1320px); height: 100%; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.deck-controls .btn { min-width: 48px; }
.deck-controls .btn.primary { min-width: 120px; }
.deck-controls .btn.jump {
  min-width: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  background: transparent; color: var(--muted); font-size: 0.85rem; white-space: nowrap;
}
.deck-controls .btn.jump:hover { color: var(--fg); }
.deck-controls .btn.jump[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
.deck-controls .btn.jump.prev { margin-right: 4px; }
@media (max-width: 1100px) { .deck-controls .btn.jump .w { display: none; } }
.deck-controls .btn.jump.next { margin-left: 4px; }
.deck-controls .btn.primary svg { vertical-align: -2px; }
.deck-dots { flex: 1; display: flex; gap: 4px; align-items: center; min-width: 0; }
.deck-dots .dot { flex: 1; height: 8px; border-radius: 4px; border: 0; padding: 0; background: var(--line); cursor: pointer; max-width: 48px; }
.deck-dots .dot.edge { max-width: 16px; }
.deck-dots .dot.seen { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.deck-dots .dot.on { background: var(--accent); height: 12px; }
.deck-dots { justify-content: center; }
.deck-count { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.deck-toc {
  position: absolute; bottom: calc(100% + 8px); left: max(12px, env(safe-area-inset-left, 0px)); z-index: 30;
  width: min(420px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.2);
}
.deck-toc ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.deck-toc button { width: 100%; display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--fg); }
.deck-toc button:hover { background: var(--surface-2); text-decoration: none; }
.deck-toc small { color: var(--muted); font: 0.72rem var(--f-mono); }
@media (max-width: 600px) {
  .deck-controls .lbl { display: none; }
  .deck-controls .btn.primary { min-width: 64px; }
  .deck-count { display: none; }
  .slide-in { padding: 10px 8px 16px; }
  .slide-card { border-radius: 12px; padding: 14px 12px; gap: 16px; }
  .slide-head .step-num { width: 34px; height: 34px; }
  .slide-head { flex-wrap: wrap; }
  .slide-head .listen { margin-left: auto; }
}

/* carousel (one item at a time) */
.carousel-wrap { display: grid; gap: 12px; min-width: 0; }
.carousel-nav { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.carousel-mid { display: grid; gap: 6px; justify-items: center; }
.carousel-count { font-size: 0.85rem; color: var(--muted); }
.carousel-dots { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.carousel-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.carousel-dots i.ok { background: var(--done); }
.carousel-dots i.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.pulse { animation: pulse 0.8s ease-in-out 2; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.deck-more {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--ctl-h, 64px) + 10px); z-index: 26;
  font: 600 0.8rem var(--f-mono); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.15); cursor: pointer;
}
