/* Galaxsee
   Layout concept: an observatory notebook. Night-sky ground, each lesson a numbered
   plate on graph paper, and a size ruler (Planck length to the observable universe)
   that tracks where every lesson sits on the scale of things. */

@font-face { font-family: "Young Serif"; src: url("../fonts/young-serif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("../fonts/atkinson-next.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("../fonts/atkinson-next-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Mono"; src: url("../fonts/atkinson-mono.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }

/* Dark-first palette. Light values live under prefers-color-scheme: light and [data-theme="light"]. */
:root {
  --bg: #0a0f1f;
  --bg-2: #0e1530;
  --surface: #131b39;
  --surface-2: #1a2450;
  --ink: #ece8dc;
  --ink-2: #bcc0d6;
  --muted: #8a92b5;
  --line: #2a3466;
  --grid: #18214a;
  --accent: #f2b45a;
  --accent-ink: #1a1203;
  --quantum: #6fd3e6;
  --rose: #ef80a9;
  --violet: #ab9cff;
  --good: #7bd69c;
  --bad: #ff8d7d;
  --shadow: rgba(0, 0, 0, 0.45);

  --font-display: "Young Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Atkinson Hyperlegible Next", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --t-xs: 0.78rem;
  --t-sm: 0.9rem;
  --t-md: 1.06rem;
  --t-lg: 1.25rem;
  --t-xl: 1.6rem;
  --t-2xl: 2.15rem;
  --t-3xl: clamp(2.4rem, 5vw, 3.4rem);
  --t-hero: clamp(3rem, 9vw, 5.6rem);

  --radius: 10px;
  --gutter: clamp(16px, 3vw, 32px);
  --topbar-h: 56px;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1f8;
    --bg-2: #e3e8f4;
    --surface: #ffffff;
    --surface-2: #f2f4fb;
    --ink: #141a35;
    --ink-2: #3b4466;
    --muted: #5e6789;
    --line: #c8cfe3;
    --grid: #dfe4f1;
    --accent: #a85f05;
    --accent-ink: #ffffff;
    --quantum: #00788e;
    --rose: #c03869;
    --violet: #5a45d4;
    --good: #22834a;
    --bad: #c0402c;
    --shadow: rgba(20, 26, 53, 0.12);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eef1f8;
  --bg-2: #e3e8f4;
  --surface: #ffffff;
  --surface-2: #f2f4fb;
  --ink: #141a35;
  --ink-2: #3b4466;
  --muted: #5e6789;
  --line: #c8cfe3;
  --grid: #dfe4f1;
  --accent: #a85f05;
  --accent-ink: #ffffff;
  --quantum: #00788e;
  --rose: #c03869;
  --violet: #5a45d4;
  --good: #22834a;
  --bad: #c0402c;
  --shadow: rgba(20, 26, 53, 0.12);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-md);
  line-height: 1.6;
  min-height: 100vh;
}
img, svg, canvas { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.eyebrow, .label-mono {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.noscript { padding: 24px var(--gutter); }

/* Top bar */
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-size: 1.3rem; }
.wordmark svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.6; }
.wordmark svg circle { fill: var(--accent); stroke: none; }
.topnav { display: flex; align-items: center; gap: 12px; }
.topnav a { color: var(--ink-2); text-decoration: none; font-size: var(--t-sm); }
.topnav a:hover { color: var(--ink); }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: var(--ink-2); }
.icon-btn:hover { border-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: var(--t-sm);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn-quiet { background: transparent; }
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* ============ Home ============ */
.home { padding-inline: var(--gutter); padding-block: 0 96px; max-width: 1180px; margin: 0 auto; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 32px;
  align-items: center;
  padding-block: clamp(32px, 7vw, 88px) 40px;
}
.hero h1 { font-size: var(--t-hero); letter-spacing: -0.02em; }
.hero h1 .w { color: var(--accent); }
.hero .lede { font-size: var(--t-lg); color: var(--ink-2); max-width: 34ch; margin-top: 18px; line-height: 1.5; }
.hero .facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; }
.hero .facts span { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-figure { position: relative; aspect-ratio: 1 / 1; max-width: 100%; }
.hero-figure canvas { width: 100%; height: 100%; display: block; }
.hero-figure figcaption { position: absolute; left: 0; bottom: 0; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--muted); letter-spacing: 0.06em; }

.welcome {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  max-width: 820px;
}
.welcome .transcript { color: var(--ink-2); font-size: var(--t-md); }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-block: 72px 24px; }
.section-head h2 { font-size: var(--t-2xl); }

.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.how div { display: grid; gap: 6px; align-content: start; }
.how h3 { font-size: var(--t-lg); }
.how p { color: var(--ink-2); font-size: var(--t-sm); }
.how .label-mono { color: var(--accent); }

.scale-legend { display: grid; gap: 6px; max-width: 620px; width: 100%; }
.scale-legend .bar { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--quantum), var(--violet) 45%, var(--accent)); opacity: 0.85; }
.scale-legend .ticks { position: relative; height: 60px; font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); }
.scale-legend .ticks span:nth-child(even) { top: 28px; }
.scale-legend .ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; text-align: center; line-height: 1.25; }
.scale-legend .ticks span:first-child { transform: none; text-align: left; }
.scale-legend .ticks span:last-child { transform: translateX(-100%); text-align: right; }

.journey { display: grid; gap: 40px; }
.part {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.part-head { display: grid; gap: 8px; align-content: start; }
.part-head h3 { font-size: var(--t-xl); }
.part-head .q { color: var(--ink-2); font-style: italic; }
.lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lesson-row a {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) 150px 4.5rem;
  gap: 16px;
  align-items: center;
  padding: 14px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
}
.lesson-row a:hover { background: var(--surface); }
.lesson-row .num { font-family: var(--font-mono); color: var(--muted); font-size: var(--t-sm); }
.lesson-row .t { font-weight: 600; }
.lesson-row .s { display: block; color: var(--ink-2); font-size: var(--t-sm); font-weight: 400; margin-top: 2px; }
.lesson-row .dur { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--muted); text-align: right; }
.lesson-row.done .num { color: var(--good); }
.lesson-row.next a { background: var(--surface); outline: 1px solid var(--accent); }

.mini-scale { position: relative; height: 4px; border-radius: 2px; background: var(--line); }
.mini-scale i { position: absolute; top: -2px; height: 8px; border-radius: 4px; background: var(--accent); min-width: 6px; }
.mini-scale.beyond i { background: linear-gradient(90deg, var(--accent), transparent); }

.reading { columns: 2 280px; column-gap: 32px; padding: 0; margin: 0; list-style: none; }
.reading li { break-inside: avoid; padding-block: 8px; border-bottom: 1px solid var(--line); }
.reading cite { font-style: normal; font-weight: 600; }
.reading span { color: var(--ink-2); font-size: var(--t-sm); display: block; }

.footer-note { margin-top: 64px; color: var(--muted); font-size: var(--t-sm); max-width: 70ch; }

/* ============ Lesson ============ */
.lesson { padding-inline: var(--gutter); padding-block: 20px 120px; max-width: 1440px; margin: 0 auto; }
.lesson-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  gap: 12px 32px;
  align-items: end;
  padding-bottom: 18px;
}
.lesson-head h1 { font-size: var(--t-3xl); margin-top: 6px; }
.lesson-head .summary { color: var(--ink-2); max-width: 62ch; margin-top: 8px; }
.ruler { display: grid; gap: 6px; }
.ruler .track { position: relative; height: 22px; }
.ruler .track::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 2px; background: var(--line); }
.ruler .tick { position: absolute; top: 6px; width: 1px; height: 10px; background: var(--muted); }
.ruler .band { position: absolute; top: 7px; height: 8px; border-radius: 4px; background: var(--accent); min-width: 8px; }
.ruler .band.beyond { background: linear-gradient(90deg, var(--accent), transparent); }
.ruler .ends { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); }
.ruler .what { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-2); }

.lesson-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: start;
}
.stage { position: sticky; top: calc(var(--topbar-h) + 12px + env(safe-area-inset-top, 0px)); min-width: 0; }
.plate {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg-2);
  overflow: hidden;
}
.plate-cap {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.plate-cap .fig { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.plate-cap .hint { font-size: var(--t-xs); color: var(--muted); text-align: right; }
.sim-host { position: relative; min-width: 0; }
.sim-canvas-wrap { position: relative; width: 100%; }
.sim-canvas-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.sim-overlay { position: absolute; pointer-events: none; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-2); }

/* Controls under each model */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: flex-end;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.ctl { display: grid; gap: 4px; min-width: 0; }
.ctl-slider { flex: 1 1 200px; }
.ctl label, .ctl .ctl-label { display: flex; justify-content: space-between; gap: 10px; font-size: var(--t-xs); color: var(--ink-2); font-weight: 600; letter-spacing: 0.02em; }
.ctl output { font-family: var(--font-mono); color: var(--accent); font-weight: 400; font-variant-numeric: tabular-nums; }
.ctl.flash { animation: ctlflash 1.6s ease-out 2; border-radius: 6px; }
@keyframes ctlflash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--line) var(--fill, 50%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent); box-shadow: 0 1px 4px var(--shadow); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; background: var(--surface); }
.seg button {
  border: 0; background: transparent; border-radius: 999px;
  padding: 6px 12px; min-height: 32px;
  font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); min-height: 32px; }
.switch input { appearance: none; -webkit-appearance: none; width: 40px; height: 22px; border-radius: 11px; background: var(--line); position: relative; cursor: pointer; margin: 0; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); background: var(--accent-ink); }

.ctl-btn { min-height: 34px; padding: 6px 14px; font-size: var(--t-xs); }
.readouts { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg-2); font-size: var(--t-sm); }
.readout { display: grid; gap: 0; }
.readout .k { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.readout .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); font-size: var(--t-md); }
.readout .v.accent { color: var(--accent); }
.readout .v.good { color: var(--good); }
.readout .v.bad { color: var(--bad); }
.note-strip { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg-2); font-size: var(--t-sm); color: var(--ink-2); }
.note-strip strong { color: var(--ink); }

/* Data tables inside models */
.sim-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.sim-table th, .sim-table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); }
.sim-table th:first-child, .sim-table td:first-child { text-align: left; }
.sim-table th { color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: 0.06em; }
.sim-table tr.on td { color: var(--accent); }
.sim-table tr.dim td { color: var(--muted); }
.table-wrap { overflow-x: auto; padding: 6px 14px 10px; border-top: 1px solid var(--line); background: var(--bg-2); }

/* Guide panel (the teacher) */
.guide {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
.player { display: flex; align-items: center; gap: 14px; }
.play-btn {
  position: relative;
  flex: none;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  display: grid; place-items: center;
}
.play-btn svg.icon { width: 22px; height: 22px; fill: currentColor; }
.play-btn svg.ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; }
.play-btn svg.ring circle { fill: none; stroke: var(--accent); stroke-width: 2.5; opacity: 0.9; }
.play-btn svg.ring circle.bg { stroke: var(--line); }
.player-meta { display: grid; gap: 2px; min-width: 0; flex: 1; }
.player-meta .who { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.player-meta .sub { font-size: var(--t-xs); color: var(--muted); }
.voicebars { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.voicebars i { width: 3px; height: 4px; background: var(--accent); border-radius: 1px; }
.speaking .voicebars i { animation: bars 0.9s ease-in-out infinite; }
.speaking .voicebars i:nth-child(2) { animation-delay: 0.15s; }
.speaking .voicebars i:nth-child(3) { animation-delay: 0.3s; }
.speaking .voicebars i:nth-child(4) { animation-delay: 0.45s; }
@keyframes bars { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.player-opts { display: flex; align-items: center; gap: 8px; }
.rate-btn { min-height: 32px; padding: 4px 10px; font-family: var(--font-mono); font-size: var(--t-xs); border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--ink-2); }

.stepper { display: flex; gap: 4px; }
.stepper button {
  flex: 1;
  height: 28px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.stepper button::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: var(--line); }
.stepper button.seen::before { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.stepper button[aria-current="step"]::before { background: var(--accent); height: 6px; top: 11px; }
.stepper button.quiz::before { background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 7px); }
.stepper button.quiz[aria-current="step"]::before { background: var(--quantum); }

.step-title { font-family: var(--font-display); font-size: var(--t-xl); }
.step-count { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.narration { display: grid; gap: 0; font-size: 1.12rem; line-height: 1.65; color: var(--ink-2); max-width: 62ch; }
.narration p { margin: 0 0 0.7em; }
.narration .s, .transcript .s { transition: color 0.2s, background 0.2s; border-radius: 3px; cursor: pointer; }
.narration .s.now, .transcript .s.now { color: var(--ink); background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent); }
.narration .s.done { color: var(--ink); }

.task {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px dashed color-mix(in srgb, var(--accent) 60%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  font-size: var(--t-sm);
}
.task .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; }
.task .mark svg { width: 14px; height: 14px; fill: none; stroke: var(--accent-ink); stroke-width: 3; opacity: 0; }
.task.done { border-style: solid; border-color: color-mix(in srgb, var(--good) 60%, var(--line)); background: color-mix(in srgb, var(--good) 9%, transparent); }
.task.done .mark { background: var(--good); border-color: var(--good); }
.task.done .mark svg { opacity: 1; }
.task .lbl { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); display: block; }
.task.done .lbl { color: var(--good); }

.guide-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Quiz */
.quiz { display: grid; gap: 22px; }
.q { display: grid; gap: 10px; }
.q-prompt { font-weight: 600; font-size: var(--t-md); }
.q-opts { display: grid; gap: 8px; }
.q-opt {
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  cursor: pointer;
  font-size: var(--t-sm);
  display: flex; gap: 10px; align-items: center;
}
.q-opt:hover:not(:disabled) { border-color: var(--accent); }
.q-opt:disabled { cursor: default; }
.q-opt .key { font-family: var(--font-mono); color: var(--muted); font-size: var(--t-xs); }
.q-opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--bg-2)); }
.q-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--bg-2)); }
.q-explain { font-size: var(--t-sm); color: var(--ink-2); padding-left: 12px; border-left: 2px solid var(--line); }
.q-explain strong { color: var(--ink); }
.bridge { display: grid; gap: 12px; padding: 16px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.bridge p { color: var(--ink-2); }

/* Mobile mini player */
.miniplayer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 25;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.miniplayer .play-btn { width: 44px; height: 44px; }
.miniplayer .play-btn svg.icon { width: 18px; height: 18px; }
.miniplayer .mp-title { flex: 1; min-width: 0; font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miniplayer .mp-title small { display: block; font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

/* Sorter (finale) */
.sorter { padding: 14px; display: grid; gap: 14px; }
.sort-bins { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sort-bin { border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 64px; background: var(--surface); display: grid; gap: 6px; align-content: start; }
.sort-bin h4 { margin: 0; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 400; }
.sort-bin .chip { font-size: 0.74rem; padding: 4px 8px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); line-height: 1.3; }
.sort-bin .chip.right { border-color: var(--good); }
.sort-bin .chip.wrong { border-color: var(--bad); }
.sort-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--surface); display: grid; gap: 12px; }
.sort-card .claim { font-family: var(--font-display); font-size: var(--t-lg); line-height: 1.3; }
.sort-card .choices { display: flex; flex-wrap: wrap; gap: 8px; }
.sort-card .verdict { font-size: var(--t-sm); color: var(--ink-2); }
.sort-card .verdict strong { color: var(--ink); }
.sort-progress { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--muted); }

@media (max-width: 1080px) {
  .lesson-grid { grid-template-columns: minmax(0, 1fr); }
  .stage { position: static; }
  .lesson-head { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-figure { max-width: 380px; justify-self: center; width: 100%; }
  .part { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .how { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .lesson-row a { grid-template-columns: 2rem minmax(0, 1fr) 3.6rem; }
  .lesson-row .mini-scale { display: none; }
  .sort-bins { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .miniplayer { display: flex; }
  .welcome { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .plate-cap .hint { display: none; }
  .controls { gap: 12px; }
  .ctl-slider { flex-basis: 100%; }
  .topnav-map { display: none; }
  .narration { font-size: 1.04rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
