/* Raahaao Code — design tokens + every component. Dark is the default theme; light is
   [data-theme="light"] or (when the learner has not chosen) the OS preference.
   Class names here are a contract with js/player.js — do not rename them. */

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #0e0c07;
  --raised: #17140c;
  --surface: #1f1b10;
  --surface-2: #282213;
  --border: #332c18;
  --border-strong: #4a4023;
  --text: #f3ecd8;
  --muted: #b3a888;
  --accent: #ffc61a;
  --accent-hover: #ffd54d;
  --accent-press: #e6ad00;
  --on-accent: #120f05;
  --link: #ffc61a;
  --fill: #ffc61a;          /* solid yellow surfaces (buttons, done stops) in every theme */
  --fill-hover: #ffd54d;
  --fill-press: #e6ad00;
  --ok: #5fd38a;
  --err: #ff6b5b;
  --info: #7cc4ff;
  --code-bg: #0a0905;
  --road: #ffc61a;
  --road-edge: #3b3009;
  --glow: rgba(255, 198, 26, 0.16);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --scrim: rgba(6, 5, 2, 0.72);
  --header-bg: rgba(14, 12, 7, 0.96);

  --syn-kw: #ffc61a; --syn-str: #9fe0a8; --syn-num: #ffb38a; --syn-com: #8f8466;
  --syn-def: #7cc4ff; --syn-tag: #ff9f6b; --syn-attr: #7cc4ff; --syn-builtin: #d7a6ff;
  --syn-op: #d9cfae; --syn-var: #e8dcb0; --syn-sel: rgba(255, 198, 26, 0.22);

  --radius: 12px;
  --radius-lg: 20px;
  --maxw: 1180px;
  --read: 760px;
  --wide: 1040px;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  /* 8px-based spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #faf6ea; --raised: #fffdf6; --surface: #f3ecd8; --surface-2: #ede3c6;
  --border: #e2d6b5; --border-strong: #cdbd90;
  --text: #1a1508; --muted: #6b5f45;
  --accent: #b88600; --accent-hover: #9a7000; --accent-press: #7a5800;
  --link: #8a6400; --on-accent: #120f05;
  --ok: #1d8a4b; --err: #c93a2b; --info: #1c6aa8;
  --code-bg: #fffaf0;
  --road: #f2b705; --road-edge: #d8a200;
  --glow: rgba(255, 198, 26, 0.3);
  --shadow: 0 10px 30px rgba(90, 70, 10, 0.16);
  --scrim: rgba(40, 30, 5, 0.5);
  --header-bg: rgba(250, 246, 234, 0.96);
  --syn-kw: #8a5a00; --syn-str: #1f7a3a; --syn-num: #b3501a; --syn-com: #8a7d5c;
  --syn-def: #1f6aa8; --syn-tag: #b3501a; --syn-attr: #1f6aa8; --syn-builtin: #7a3fb0;
  --syn-op: #5c4f32; --syn-var: #4a3f24; --syn-sel: rgba(184, 134, 0, 0.2);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf6ea; --raised: #fffdf6; --surface: #f3ecd8; --surface-2: #ede3c6;
    --border: #e2d6b5; --border-strong: #cdbd90;
    --text: #1a1508; --muted: #6b5f45;
    --accent: #b88600; --accent-hover: #9a7000; --accent-press: #7a5800;
    --link: #8a6400; --on-accent: #120f05;
    --ok: #1d8a4b; --err: #c93a2b; --info: #1c6aa8;
    --code-bg: #fffaf0;
    --road: #f2b705; --road-edge: #d8a200;
    --glow: rgba(255, 198, 26, 0.3);
    --shadow: 0 10px 30px rgba(90, 70, 10, 0.16);
    --scrim: rgba(40, 30, 5, 0.5);
    --header-bg: rgba(250, 246, 234, 0.96);
    --syn-kw: #8a5a00; --syn-str: #1f7a3a; --syn-num: #b3501a; --syn-com: #8a7d5c;
    --syn-def: #1f6aa8; --syn-tag: #b3501a; --syn-attr: #1f6aa8; --syn-builtin: #7a3fb0;
    --syn-op: #5c4f32; --syn-var: #4a3f24; --syn-sel: rgba(184, 134, 0, 0.2);
    color-scheme: light;
  }
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--s3); font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
p { margin: 0 0 var(--s4); }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
::selection { background: var(--fill); color: var(--on-accent); }
code, kbd, pre, samp { font-family: var(--mono); }
:not(pre) > code {
  font-size: 0.9em; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.1em 0.4em; overflow-wrap: anywhere;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s6) 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ------------------------------------------------------------------ layout */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s4); }
.page { padding: var(--s6) 0 var(--s8); min-height: 70vh; }
.read { max-width: var(--read); margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.spacer { flex: 1; }
@media (min-width: 700px) { .container { padding: 0 var(--s5); } }
@media (min-width: 1100px) { .container { padding: 0 var(--s6); } }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 50; background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: var(--s3); height: 60px;
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s4);
}
@media (min-width: 700px) { .topbar-inner { padding: 0 var(--s5); gap: var(--s4); } }
@media (min-width: 1100px) { .topbar-inner { padding: 0 var(--s6); } }
.brand {
  display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none;
  font-weight: 700; letter-spacing: -0.02em; font-size: 1.05rem; white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand-text span { color: var(--link); }
.nav { display: flex; gap: 2px; margin-left: var(--s3); }
.nav a {
  color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px;
  font-size: 0.95rem; font-weight: 500; transition: color 0.15s, background 0.15s;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.xp-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
  position: relative; overflow: hidden;
}
.xp-pill svg { width: 16px; height: 16px; color: var(--accent); }
.xp-pill .xp-rank { color: var(--muted); font-weight: 500; }
.xp-pill::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px;
  width: var(--rank-pct, 0%); background: var(--fill);
}
.xp-pill.bump { animation: bump 0.5s var(--ease); }
.streak {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; font-weight: 600;
  color: var(--muted); padding: 5px 8px; font-variant-numeric: tabular-nums;
}
.streak svg { width: 16px; height: 16px; }
.streak.on { color: #ff9a3c; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  background: transparent; border: 1px solid transparent; border-radius: 10px; color: var(--muted);
  transition: color 0.15s, background 0.15s, border-color 0.15s; padding: 0;
}
.icon-btn:hover { color: var(--text); background: var(--surface); border-color: var(--border); }
.icon-btn svg { width: 20px; height: 20px; }
@media (max-width: 699px) {
  .xp-pill .xp-rank, .brand-text small { display: none; }
  .nav a { padding: 6px 8px; font-size: 0.9rem; }
  .nav { margin-left: 0; }
}
@media (max-width: 540px) {
  .brand-text { display: none; }
  .streak { padding: 5px 2px; }
}
@media (max-width: 400px) { .nav a[data-nav="glossary"] { display: none; } }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 0.95rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; transition: background 0.15s, transform 0.12s, border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
}
.btn:hover { color: var(--text); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--fill); color: var(--on-accent); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 6px 18px -6px rgba(255, 198, 26, 0.55); }
.btn-primary:hover { background: var(--fill-hover); color: var(--on-accent); border-color: transparent; }
.btn-primary:active { background: var(--fill-press); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn-danger:hover { background: var(--err); color: #fff; border-color: var(--err); }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 0.85rem; border-radius: 9px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; box-shadow: none; }
.btn-lg { padding: 15px 28px; font-size: 1.05rem; border-radius: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 0.78rem; font-weight: 600;
  color: var(--muted); white-space: nowrap; line-height: 1.6;
}
.pill svg { width: 13px; height: 13px; }
.pill-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.pill-err { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); background: color-mix(in srgb, var(--err) 10%, transparent); }
.pill-muted { color: var(--muted); }
.kbd, kbd {
  display: inline-block; font-family: var(--mono); font-size: 0.78em; padding: 1px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; color: var(--text);
}
.spinner {
  display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -0.15em; flex: none;
}
.card {
  background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s5);
}
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: var(--pct, 0%); border-radius: inherit; background: var(--fill); }
.bar.thin { height: 5px; }

/* forms */
input[type="text"], input[type="search"], input:not([type]), textarea, select {
  width: 100%; background: var(--code-bg); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 10px 14px; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.7; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
label.field { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: var(--s2); }

/* ------------------------------------------------------------- home: hero */
.hero { position: relative; padding: var(--s8) 0 var(--s7); text-align: center; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: -80px 0 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55% 60% at 50% 0%, var(--glow), transparent 70%),
    radial-gradient(30% 30% at 85% 30%, rgba(255, 198, 26, 0.06), transparent 70%);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--raised); color: var(--muted);
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: var(--s5);
}
.eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--fill); box-shadow: 0 0 0 4px color-mix(in srgb, var(--fill) 25%, transparent); }
.hero h1 {
  font-size: clamp(2.6rem, 8.5vw, 5.6rem); letter-spacing: -0.045em; line-height: 1.02;
  max-width: 14ch; margin: 0 auto var(--s5); font-weight: 700;
}
.hero h1 em { font-style: normal; color: var(--link); position: relative; white-space: nowrap; }
.hero h1 em::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.08em; height: 4px;
  background: repeating-linear-gradient(90deg, var(--fill) 0 14px, transparent 14px 24px); border-radius: 2px;
}
.hero-sub { max-width: 40rem; margin: 0 auto var(--s6); color: var(--muted); font-size: clamp(1.05rem, 2.2vw, 1.3rem); line-height: 1.55; }
.hero-cta { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; margin-top: var(--s6); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px;
  background: var(--raised); border: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; font-weight: 500;
}
.chip-accent { color: var(--on-accent); background: var(--fill); border-color: transparent; font-weight: 700; }

.continue-card {
  display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5); margin: 0 auto var(--s5);
  max-width: 760px; border-radius: var(--radius-lg); border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, var(--surface), var(--raised)); text-decoration: none; color: var(--text);
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.continue-card:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.continue-card .cc-icon {
  flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--fill); color: var(--on-accent);
  display: grid; place-items: center;
}
.continue-card .cc-icon svg { width: 24px; height: 24px; }
.continue-card .cc-body { flex: 1; min-width: 0; }
.continue-card small { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.continue-card strong { display: block; font-size: 1.1rem; overflow-wrap: anywhere; }
.continue-card .cc-arrow { color: var(--link); flex: none; }
.continue-card .cc-arrow svg { width: 22px; height: 22px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); margin-bottom: var(--s8); }
.stat { background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4) var(--s5); min-width: 0; }
.stat .stat-label { color: var(--muted); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.stat .stat-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; font-variant-numeric: tabular-nums; margin: 2px 0 var(--s2); }
.stat .stat-value small { font-size: 0.95rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat .stat-sub { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 899px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .stat { padding: var(--s3) var(--s4); } .stat .stat-value { font-size: 1.5rem; } }

.section-head { text-align: center; margin: 0 auto var(--s7); max-width: 40rem; }
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.035em; }
.section-head p { color: var(--muted); font-size: 1.05rem; margin: 0; }

/* ----------------------------------------------- THE ROAD MAP (signature) */
.roadmap { position: relative; max-width: 1000px; margin: 0 auto var(--s9); }
.road-svg { display: block; width: 100%; overflow: visible; }
.road-svg .road-edge { stroke: var(--road-edge); }
.road-svg .road-bed { stroke: url(#roadGrad); }
.road-svg .road-dash { stroke: var(--bg); }
.road-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.road-svg .road-dash { stroke-linecap: butt; }
.stops { position: absolute; inset: 0; }
.stop {
  position: absolute; left: calc(var(--x) * 1%); top: var(--y); transform: translate(-50%, -50%);
  display: block; width: 64px; height: 64px; color: var(--text); text-decoration: none; border-radius: 50%;
  --ring-pct: 0;
}
.stop:hover { color: var(--text); }
.stop:focus-visible { outline-offset: 6px; border-radius: 50%; }
.stop-node {
  position: relative; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 3px solid var(--border-strong); font-weight: 700; font-size: 1.35rem;
  letter-spacing: -0.02em; transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.2s, border-color 0.2s;
  box-shadow: 0 0 0 6px var(--bg);
}
.stop-node svg.ico { width: 26px; height: 26px; }
.stop:hover .stop-node, .stop:focus-visible .stop-node { transform: scale(1.1); }
.stop-ring { position: absolute; inset: -9px; width: calc(100% + 18px); height: calc(100% + 18px); transform: rotate(-90deg); pointer-events: none; }
.stop-ring circle { fill: none; stroke-width: 4; }
.stop-ring .trk { stroke: var(--border); }
.stop-ring .val { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 226.2; stroke-dashoffset: calc(226.2 - 226.2 * var(--ring-pct)); transition: stroke-dashoffset 0.8s var(--ease); }
.stop.open .stop-node { border-color: var(--accent); color: var(--link); background: var(--raised); }
.stop.done .stop-node { background: var(--fill); border-color: var(--fill); color: var(--on-accent); }
.stop.current .stop-node { background: var(--raised); border-color: var(--accent); color: var(--link); animation: pulse 2.2s ease-out infinite; }
.stop.locked .stop-node { background: var(--bg); border-color: var(--border-strong); color: var(--muted); border-style: dashed; opacity: 0.85; }
.stop.locked { opacity: 0.8; }
.stop-label {
  position: absolute; top: 50%; transform: translateY(-50%); width: max-content;
  max-width: clamp(104px, calc(24vw - 64px), 210px); transition: transform 0.25s var(--ease);
}
.stop.side-r .stop-label { left: calc(100% + 22px); text-align: left; }
.stop.side-l .stop-label { right: calc(100% + 22px); text-align: right; }
.stop-title { display: block; font-weight: 700; font-size: 1.02rem; letter-spacing: -0.015em; line-height: 1.2; }
.stop-meta { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stop-label .bar { margin-top: 8px; }
.stop.side-l .stop-label .bar { margin-left: auto; }
.stop-label .bar { width: 100%; min-width: 80px; }
.stop:hover .stop-title, .stop:focus-visible .stop-title { color: var(--link); }
.stop.locked .stop-title { color: var(--muted); }
.stop-blurb { display: none; }
.road-start, .road-end {
  position: absolute; left: 24%; transform: translateX(-50%); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
}
.road-start { top: 6px; }

@media (max-width: 699px) {
  .roadmap { margin-bottom: var(--s8); }
  .road-svg, .road-start { display: none; }
  .stops { position: relative; inset: auto; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s2) 0; }
  .stops::before, .stops::after { content: ""; position: absolute; top: 0; bottom: 0; z-index: 0; }
  .stops::before { left: 15px; width: 18px; background: var(--road); border-radius: 9px; box-shadow: 0 0 0 3px var(--road-edge); }
  .stops::after { left: 23px; width: 2px; background: repeating-linear-gradient(180deg, var(--bg) 0 9px, transparent 9px 18px); }
  .stop {
    position: relative; left: auto; top: auto; transform: none; width: auto; height: auto; z-index: 1;
    display: grid; grid-template-columns: 48px 1fr; gap: var(--s4); align-items: center;
  }
  .stop-node { width: 48px; height: 48px; font-size: 1.15rem; border-width: 3px; box-shadow: 0 0 0 5px var(--bg); }
  .stop-node svg.ico { width: 22px; height: 22px; }
  .stop-ring { display: none; }
  .stop:hover .stop-node { transform: none; }
  .stop-label, .stop.side-l .stop-label, .stop.side-r .stop-label {
    position: static; transform: none; width: auto; max-width: none; text-align: left;
    background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s3) var(--s4);
  }
  .stop.current .stop-label { border-color: var(--accent); }
  .stop.done .stop-label { border-color: color-mix(in srgb, var(--fill) 45%, var(--border)); }
  .stop.side-l .stop-label .bar { margin-left: 0; }
  .stop-blurb { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 4px; line-height: 1.45; }
}

/* what you'll build */
.build-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s3); margin-bottom: var(--s8); }
.build-item { background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4) var(--s5); display: flex; gap: var(--s3); align-items: flex-start; transition: border-color 0.2s, transform 0.2s var(--ease); }
.build-item:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.build-item .bi-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--surface); color: var(--link); display: grid; place-items: center; }
.build-item .bi-ico svg { width: 20px; height: 20px; }
.build-item strong { display: block; line-height: 1.3; letter-spacing: -0.01em; }
.build-item small { color: var(--muted); font-size: 0.8rem; }

.site-foot { border-top: 1px solid var(--border); padding: var(--s6) 0 var(--s7); color: var(--muted); font-size: 0.88rem; }
.site-foot .container { display: flex; gap: var(--s4); justify-content: space-between; flex-wrap: wrap; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); }

/* ---------------------------------------------------------- level / project */
.crumbs { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: 0.88rem; color: var(--muted); margin-bottom: var(--s4); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: 0.5; }
.level-hero {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: var(--s6); align-items: center;
  padding: var(--s6) var(--s5); margin-bottom: var(--s6); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, var(--raised), var(--bg));
}
.level-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(50% 90% at 100% 0%, var(--glow), transparent 70%); }
.level-num {
  font-size: clamp(4rem, 12vw, 8rem); font-weight: 700; letter-spacing: -0.06em; line-height: 0.9;
  color: transparent; -webkit-text-stroke: 2px var(--accent); display: block; margin-bottom: var(--s2);
}
.level-hero h1 { margin-bottom: var(--s2); }
.level-hero p { color: var(--muted); font-size: 1.1rem; max-width: 36rem; margin: 0 0 var(--s4); }
.level-hero .bar { max-width: 360px; }
.level-hero .lh-prog { color: var(--muted); font-size: 0.85rem; margin-top: var(--s2); font-variant-numeric: tabular-nums; }
.badge-preview { text-align: center; width: 140px; }
.badge-disc {
  width: 96px; height: 96px; margin: 0 auto var(--s2); border-radius: 50%; display: grid; place-items: center;
  background: var(--fill); color: var(--on-accent); box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px var(--fill), 0 14px 30px -10px rgba(255, 198, 26, 0.6);
}
.badge-disc svg { width: 44px; height: 44px; }
.badge-preview.locked .badge-disc { background: var(--surface); color: var(--muted); box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px var(--border-strong); }
.badge-preview small { color: var(--muted); font-size: 0.75rem; display: block; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.badge-preview strong { display: block; font-size: 0.95rem; }
@media (max-width: 699px) {
  .level-hero { grid-template-columns: 1fr; padding: var(--s5) var(--s4); }
  .badge-preview { display: flex; align-items: center; gap: var(--s3); width: auto; text-align: left; }
  .badge-disc { width: 64px; height: 64px; margin: 0; }
  .badge-disc svg { width: 30px; height: 30px; }
}

.lock-panel { border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: var(--s6) var(--s5); margin-bottom: var(--s6); background: var(--raised); }
.lock-panel .lp-head { display: flex; gap: var(--s4); align-items: flex-start; margin-bottom: var(--s4); }
.lock-panel .lp-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.lock-panel .lp-ico svg { width: 24px; height: 24px; }
.lock-panel h3 { margin-bottom: 4px; }
.lock-panel p { color: var(--muted); margin: 0; }
.testout { margin-top: var(--s5); display: grid; gap: var(--s4); }
.testout .tq { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4) var(--s5); background: var(--surface); margin: 0; min-width: 0; }
.testout legend { padding: 0 var(--s2); font-weight: 600; }
.testout .tq-q { font-weight: 600; margin-bottom: var(--s3); }
.testout .tq-q p:last-child { margin: 0; }
.testout-result { padding: var(--s4); border-radius: var(--radius); border: 1px solid var(--border-strong); font-weight: 600; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin: var(--s7) 0 var(--s4); }
.section-title h2 { font-size: 1.4rem; margin: 0; }
.section-title span { color: var(--muted); font-size: 0.88rem; }
.lesson-list { display: grid; gap: var(--s2); }
.lesson-row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: var(--s4); align-items: center;
  padding: var(--s3) var(--s4); background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease);
}
.lesson-row:hover { color: var(--text); border-color: var(--accent); background: var(--surface); transform: translateX(3px); }
.lesson-row .row-num {
  width: 36px; height: 36px; border-radius: 10px; background: var(--surface); display: grid; place-items: center;
  font-weight: 700; font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.lesson-row.done .row-num { background: var(--fill); color: var(--on-accent); }
.lesson-row .row-num svg { width: 18px; height: 18px; }
.lesson-row .row-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lesson-row .row-title small { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.lesson-row .row-meta { display: flex; gap: var(--s2); align-items: center; color: var(--muted); font-size: 0.82rem; flex-wrap: wrap; justify-content: flex-end; }
.lesson-list.is-locked .lesson-row { opacity: 0.55; }
@media (max-width: 520px) { .lesson-row { grid-template-columns: 36px 1fr; } .lesson-row .row-meta { grid-column: 2; justify-content: flex-start; } }
.empty-state { text-align: center; padding: var(--s7) var(--s5); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--muted); background: var(--raised); }
.empty-state .es-ico { width: 48px; height: 48px; margin: 0 auto var(--s3); color: var(--accent); }
.empty-state h3 { color: var(--text); }
.project-card { display: flex; gap: var(--s5); align-items: center; padding: var(--s5); border-radius: var(--radius-lg); border: 1px solid var(--border-strong); background: linear-gradient(135deg, var(--surface), var(--raised)); flex-wrap: wrap; }
.project-card .pc-body { flex: 1; min-width: 220px; }
.project-card h3 { margin-bottom: 4px; }
.project-card p { color: var(--muted); margin: 0; }
.level-nav { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s7); flex-wrap: wrap; }
.proj-step { margin: var(--s5) 0; }
.proj-step-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.proj-step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; flex: none; }
.proj-step.done .proj-step-num { background: var(--fill); color: var(--on-accent); border-color: transparent; }
.proj-step-num svg { width: 16px; height: 16px; }
.proj-progress { position: sticky; top: 68px; z-index: 5; margin: 0 0 var(--s5); padding: var(--s3) var(--s4); background: var(--header-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: var(--radius); display: flex; gap: var(--s4); align-items: center; }
.proj-progress .bar { flex: 1; }
.proj-progress span { font-size: 0.85rem; color: var(--muted); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.proj-done { text-align: center; padding: var(--s7) var(--s5); border-radius: var(--radius-lg); border: 1px solid var(--accent); background: linear-gradient(180deg, var(--surface), var(--raised)); margin: var(--s6) 0; }

/* ------------------------------------------------------------- glossary */
.gloss-tools { position: sticky; top: 60px; z-index: 5; background: var(--bg); padding: var(--s3) 0; margin-bottom: var(--s5); }
.az { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--s3); }
.az a, .az span {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
  text-decoration: none; color: var(--muted); border: 1px solid var(--border);
}
.az a { color: var(--text); background: var(--raised); }
.az a:hover { border-color: var(--accent); color: var(--link); }
.az span { opacity: 0.35; }
.gloss-group h2 { font-size: 1.6rem; color: var(--link); border-bottom: 1px solid var(--border); padding-bottom: var(--s2); margin: var(--s6) 0 var(--s3); }
.gloss-term { padding: var(--s3) 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.gloss-term dt { font-weight: 700; font-size: 1.05rem; }
.gloss-term dd { margin: 4px 0 0; color: var(--muted); }
.gloss-term dd a { font-size: 0.85rem; white-space: nowrap; }
.gloss-term dd .def { color: var(--text); display: block; margin-bottom: 2px; }
.gloss-count { color: var(--muted); font-size: 0.88rem; margin: var(--s2) 0 0; }

/* ----------------------------------------------------------- certificate */
.cert-tools { display: flex; gap: var(--s3); align-items: end; flex-wrap: wrap; justify-content: center; margin-bottom: var(--s5); }
.cert-tools .grow { flex: 1; min-width: 220px; max-width: 360px; }
.cert {
  position: relative; max-width: 1000px; margin: 0 auto; padding: clamp(24px, 5vw, 56px); text-align: center;
  background: linear-gradient(160deg, var(--raised), var(--bg)); border: 2px solid var(--accent); border-radius: 8px;
  outline: 1px solid var(--border-strong); outline-offset: -14px; isolation: isolate; overflow: hidden;
}
.cert::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 50% at 50% 0%, var(--glow), transparent 70%); }
.cert .cert-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; margin-bottom: var(--s5); }
.cert .cert-brand svg { width: 36px; height: 36px; }
.cert small.k { display: block; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-size: 0.75rem; font-weight: 600; }
.cert h1 { font-size: clamp(1.8rem, 5vw, 3.2rem); letter-spacing: -0.035em; margin: var(--s2) 0 var(--s5); }
.cert .cert-name { font-size: clamp(1.8rem, 6vw, 3.4rem); font-weight: 700; color: var(--link); border-bottom: 2px dashed var(--border-strong); display: inline-block; min-width: 12ch; max-width: 100%; padding: 0 var(--s4) 4px; line-height: 1.2; overflow-wrap: anywhere; }
.cert-verify .cert-id { display: flex; gap: var(--s4); align-items: center; justify-content: center; margin-top: var(--s4); text-align: left; }
.cert-verify .cert-id p { margin: 0; }
.cert-qr { image-rendering: pixelated; background: #fff; padding: 4px; border-radius: 4px; }
.cert-official { margin-top: var(--s5, 24px); }
.cert p { color: var(--muted); max-width: 40rem; margin: var(--s4) auto; }
.cert-badges { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; margin: var(--s5) 0; }
.cert-badges .chip { background: var(--surface); }
.cert-badges .chip svg { width: 14px; height: 14px; color: var(--link); }
.cert-foot { display: flex; justify-content: space-around; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--border); }
.cert-foot div { min-width: 120px; }
.cert-foot b { display: block; font-size: 1.3rem; }
.cert-foot span { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.todo-list { display: grid; gap: var(--s2); margin: var(--s5) 0; text-align: left; }
.todo-list .t { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius); }
.todo-list .t svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.todo-list .t.ok svg { color: var(--ok); }

/* ----------------------------------------------------------- lesson layout */
.lesson-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s7); max-width: 1340px; margin: 0 auto; align-items: start; }
.lesson-layout > :not(.rail) { min-width: 0; }
.lesson-layout .read { max-width: none; margin: 0; }
.lesson-layout .blk, .lesson-layout .lesson-head, .lesson-layout .callout, .lesson-layout .lesson-foot { max-width: var(--read); }
.lesson-layout .blk.wide, .lesson-layout .blk-tryit, .lesson-layout .blk-challenge, .lesson-layout .blk-compare { max-width: var(--wide); }
.rail { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; font-size: 0.9rem; }
.rail ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.rail a { display: block; padding: 6px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; transition: color 0.15s, border-color 0.15s; line-height: 1.35; }
.rail a:hover { color: var(--text); }
.rail a.active { color: var(--link); border-left-color: var(--accent); font-weight: 600; }
.rail h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 var(--s2); }
@media (max-width: 959px) {
  .lesson-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .rail { position: static; max-height: none; border-bottom: 1px solid var(--border); padding-bottom: var(--s3); }
  .rail ul { display: flex; gap: var(--s2); overflow-x: auto; border: 0; padding-bottom: var(--s2); -webkit-overflow-scrolling: touch; }
  .rail a { border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; white-space: nowrap; margin: 0; }
  .rail a.active { border-color: var(--accent); }
  .rail h4 { display: none; }
}
.lesson-head { margin-bottom: var(--s6); }
.lesson-head h1 { margin-bottom: var(--s3); letter-spacing: -0.035em; }
.lesson-head .meta { display: flex; gap: var(--s4); flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; margin-bottom: var(--s4); }
.lesson-head .meta span { display: inline-flex; align-items: center; gap: 6px; }
.lesson-head .meta svg { width: 16px; height: 16px; color: var(--accent); }
.lesson-head .goals { background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: 0; list-style: none; }
.lesson-head .goals li { position: relative; padding-left: 26px; margin: 4px 0; }
.lesson-head .goals li::before { content: ""; position: absolute; left: 0; top: 0.3em; width: 16px; height: 16px; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/contain no-repeat; }

/* blocks */
.blk { margin: 0 0 var(--s5); min-width: 0; }
.blk-text h2, .prose h2 { font-size: 1.6rem; margin: var(--s7) 0 var(--s3); scroll-margin-top: 84px; }
.prose h3 { font-size: 1.25rem; margin: var(--s5) 0 var(--s2); }
.prose h4 { margin: var(--s4) 0 var(--s2); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose li { overflow-wrap: break-word; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 var(--s4); }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin: var(--s4) 0; padding: var(--s2) var(--s4); border: 1px solid var(--border); color: var(--muted); background: var(--raised); border-radius: var(--radius); font-style: italic; }
.prose blockquote p:last-child { margin: 0; }
.prose mark { background: color-mix(in srgb, var(--fill) 35%, transparent); color: inherit; padding: 0 3px; border-radius: 4px; }
.prose a { color: var(--link); }
.prose table { width: 100%; border-collapse: collapse; margin: var(--s4) 0; font-size: 0.92rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 12px; border: 1px solid var(--border); }
.prose th { background: var(--surface); font-weight: 600; }
.prose pre.md-code, pre.md-code {
  margin: var(--s4) 0; padding: var(--s4); background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; font-size: 0.88rem; line-height: 1.6; tab-size: 2; color: var(--text);
}
.prose hr { margin: var(--s6) 0; }

/* code blocks */
.blk-code { border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); overflow: hidden; }
.code-head { display: flex; align-items: center; gap: var(--s3); padding: 6px 8px 6px var(--s4); background: var(--raised); border-bottom: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); min-height: 40px; }
.code-head .title { flex: 1; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-head .lang { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 6px; }
.code-head .btn, .code-head button { flex: none; }
.blk-code pre, pre.cm-s-academy {
  margin: 0; padding: var(--s4); overflow-x: auto; font-family: var(--mono); font-size: 0.88rem; line-height: 1.65;
  tab-size: 2; background: var(--code-bg); color: var(--text);
}
.blk-code .note { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; background: var(--raised); }
.blk-code .note p:last-child { margin: 0; }

/* editors */
.blk-tryit, .blk-challenge { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--raised); overflow: hidden; }
.blk-tryit > .code-head, .blk-challenge > .code-head { border-radius: 0; }
.blk-challenge { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.blk-challenge::before, .blk-tryit::before {
  display: block; padding: 8px var(--s4); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--surface); color: var(--muted); border-bottom: 1px solid var(--border);
}
.blk-tryit::before { content: "Try it"; }
.blk-challenge::before { content: "Challenge"; color: var(--link); background: color-mix(in srgb, var(--fill) 10%, var(--surface)); }
.blk-tryit > .title, .blk-challenge > .title { display: block; padding: var(--s3) var(--s4) 0; font-weight: 600; }
.editor-wrap { position: relative; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--code-bg); min-width: 0; }
.blk-tryit > .editor-wrap:first-child, .blk-challenge > .editor-wrap:first-child { border-top: 0; }
.ed-fallback {
  display: block; width: 100%; min-height: 120px; resize: vertical; border: 0; border-radius: 0; background: var(--code-bg); color: var(--text);
  font-family: var(--mono); font-size: 0.88rem; line-height: 1.6; padding: var(--s4); tab-size: 2; white-space: pre; overflow: auto;
}
.ed-fallback:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: none; }
.tabs { display: flex; gap: 2px; padding: 6px 8px 0; background: var(--raised); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  appearance: none; background: transparent; border: 1px solid transparent; border-bottom: 0; color: var(--muted);
  padding: 6px 14px; border-radius: 8px 8px 0 0; font-size: 0.85rem; font-weight: 600; font-family: var(--mono);
  transition: color 0.15s, background 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--code-bg); color: var(--link); border-color: var(--border); position: relative; top: 1px; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; padding: var(--s3) var(--s4); background: var(--raised); }
.toolbar .spacer { flex: 1; }
.stdin { display: block; padding: var(--s3) var(--s4); border-top: 1px solid var(--border); background: var(--raised); }
.stdin label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.stdin textarea { min-height: 60px; font-family: var(--mono); font-size: 0.88rem; resize: vertical; }

/* output */
.out { border-top: 1px solid var(--border); background: var(--code-bg); min-width: 0; }
.out-head { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s3); border-bottom: 1px solid var(--border); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); background: var(--raised); }
.out-head .tab { font-family: var(--font); text-transform: none; letter-spacing: 0; }
.out-body { padding: var(--s3) var(--s4); font-family: var(--mono); font-size: 0.86rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; min-height: 48px; }
.out-err { color: var(--err); }
.out-ok { color: var(--ok); }
.out-muted { color: var(--muted); font-family: var(--font); font-style: italic; }
.sql-table { border-collapse: collapse; font-family: var(--mono); font-size: 0.82rem; margin: var(--s2) 0; min-width: 100%; }
.sql-table th, .sql-table td { padding: 6px 12px; border: 1px solid var(--border); text-align: left; white-space: nowrap; }
.sql-table th { background: var(--surface); color: var(--link); font-weight: 600; position: sticky; top: 0; }
.sql-table tr:nth-child(even) td { background: color-mix(in srgb, var(--surface) 45%, transparent); }
.sql-table td.null { color: var(--muted); font-style: italic; }
.preview-frame { display: block; width: 100%; height: 280px; border: 0; background: #fff; color-scheme: light; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted);
}
.status-pill svg { width: 14px; height: 14px; }
.status-pill.pass, .status-pill.ok, .status-pill.passed { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.status-pill.fail, .status-pill.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 50%, transparent); background: color-mix(in srgb, var(--err) 12%, transparent); }
.status-pill.skipped { color: var(--muted); }
.prompt { padding: var(--s4) var(--s4) var(--s2); }
.prompt p:last-child { margin-bottom: var(--s2); }
.hint, .solution { margin: 0; padding: var(--s3) var(--s4); border-top: 1px solid var(--border); font-size: 0.92rem; }
.hint { background: color-mix(in srgb, var(--info) 8%, var(--raised)); border: 1px solid color-mix(in srgb, var(--info) 35%, var(--border)); }
.solution { background: var(--code-bg); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); }
.hint > :last-child, .solution > :last-child { margin-bottom: 0; }
.solution pre { margin: var(--s2) 0 0; }

/* quiz */
.blk-quiz { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--raised); padding: var(--s5); }
.blk-quiz fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.blk-quiz legend { font-weight: 600; padding: 0; margin-bottom: var(--s3); float: left; width: 100%; }
.blk-quiz legend + * { clear: both; }
.quiz-opts { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.opt, label.opt {
  display: flex; align-items: flex-start; gap: var(--s3); padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; transition: border-color 0.15s, background 0.15s; line-height: 1.45;
}
label.opt:hover { border-color: var(--accent); }
.opt input[type="radio"] { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 2px 0 0; border: 2px solid var(--border-strong); border-radius: 50%; background: transparent; display: grid; place-content: center; cursor: pointer; }
.opt input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fill); transform: scale(0); transition: transform 0.12s; }
.opt input[type="radio"]:checked { border-color: var(--accent); }
.opt input[type="radio"]:checked::before { transform: scale(1); }
.opt input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--fill) 8%, var(--surface)); }
.opt p { margin: 0; }
.opt.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.opt.wrong { border-color: var(--err); background: color-mix(in srgb, var(--err) 12%, var(--surface)); }
.feedback { margin-top: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); }
.feedback.ok, .feedback.correct { border-color: var(--ok); }
.feedback.err, .feedback.wrong { border-color: var(--err); }
.feedback > :last-child { margin-bottom: 0; }

/* case study badge */
.blk-case { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--surface), var(--raised)); padding: var(--s5); padding-top: var(--s6); margin-top: var(--s6); }
.case-badge {
  position: absolute; top: -14px; left: var(--s5); display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px;
  background: var(--fill); color: var(--on-accent); border-radius: 8px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--on-accent); transform: rotate(-1.5deg);
}
.case-badge::before { content: ""; width: 10px; height: 10px; background: var(--on-accent); transform: rotate(45deg); flex: none; }
.case-project { font-weight: 700; margin-bottom: var(--s2); font-size: 1.05rem; }
.blk-case pre { margin-top: var(--s3); border: 1px solid var(--border); border-radius: var(--radius); }

/* callouts */
.callout { border: 1px solid var(--border); border-radius: var(--radius); background: var(--raised); padding: var(--s3) var(--s4); margin: 0 0 var(--s5); }
.callout-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; }
.callout-title svg { width: 16px; height: 16px; }
.callout > :last-child { margin-bottom: 0; }
.callout-tip { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, var(--raised)); }
.callout-tip .callout-title { color: var(--link); }
.callout-gotcha { border-color: color-mix(in srgb, var(--err) 45%, var(--border)); background: color-mix(in srgb, var(--err) 6%, var(--raised)); }
.callout-gotcha .callout-title { color: var(--err); }
.callout-note { border-color: color-mix(in srgb, var(--info) 40%, var(--border)); background: color-mix(in srgb, var(--info) 6%, var(--raised)); }
.callout-note .callout-title { color: var(--info); }

/* terminal */
.blk-term { border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); overflow: hidden; font-family: var(--mono); font-size: 0.88rem; }
.blk-term .code-head { font-family: var(--font); }
.term-line { display: flex; gap: var(--s3); padding: 8px var(--s4); align-items: flex-start; }
.term-prompt { color: var(--link); font-weight: 600; user-select: none; flex: none; }
.term-line code { background: none; border: 0; padding: 0; font-size: inherit; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.term-out { padding: 4px var(--s4) var(--s3) var(--s4); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-family: var(--mono); }
.blk-term .note { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); font-family: var(--font); color: var(--muted); font-size: 0.9rem; background: var(--raised); }

.blk-figure { margin: var(--s6) 0; text-align: center; }
.blk-figure svg { max-width: 100%; height: auto; }
.blk-figure figcaption, .blk-figure .caption { color: var(--muted); font-size: 0.88rem; margin-top: var(--s2); }
.blk-recap { border: 1px solid var(--accent); border-radius: var(--radius-lg); padding: var(--s5); background: linear-gradient(135deg, color-mix(in srgb, var(--fill) 8%, var(--raised)), var(--raised)); }
.blk-recap h3, .blk-recap h4 { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--link); margin-bottom: var(--s3); }
.blk-recap ul { margin: 0; padding-left: 1.2em; }
.blk-recap li { margin: 6px 0; }
.blk-recap li::marker { color: var(--accent); }
.blk-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s3); }
.blk-compare > * { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); overflow: hidden; }
.blk-compare pre { margin: 0; }
.blk-term-def { margin: 0; }

.lesson-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--border); }
.lesson-foot .spacer { flex: 1; }
.wide { max-width: var(--wide); }

/* ---------------------------------------------- player.js markup (B's classes) */
.lesson-layout { padding: var(--s6) 0 var(--s8); }
.lesson-main { grid-column: 2; grid-row: 1; }
.rail { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 2px; }
.rail-title { margin: 0 0 var(--s2); padding: 0 12px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.rail a { border: 0; margin: 0; padding: 7px 12px; border-radius: 8px; transition: color 0.15s, background 0.15s; }
.rail a:hover { background: var(--surface); }
.rail a.active { background: color-mix(in srgb, var(--fill) 14%, transparent); color: var(--link); font-weight: 600; }
@media (max-width: 959px) {
  .lesson-main, .rail { grid-column: 1; grid-row: auto; }
  .rail { flex-direction: row; overflow-x: auto; gap: var(--s2); padding-bottom: var(--s3); border-bottom: 1px solid var(--border); }
  .rail-title { display: none; }
  .rail a { border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; white-space: nowrap; flex: none; }
  .rail a.active { border-color: var(--accent); }
}
.lesson-head .meta span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--muted); margin-right: var(--s4); vertical-align: middle; }
.lesson-head .meta { gap: 0 var(--s4); }
.goals-title { margin: 0 0 var(--s2); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--link); }
.lesson-head .goals ul { list-style: none; margin: 0; padding: 0; }
.lesson-head .goals li :is(p) { margin: 0; }

.btn-ico { display: inline-flex; align-items: center; flex: none; }
.btn-ico svg, .btn .btn-ico svg { width: 16px; height: 16px; }
.btn-label { min-width: 0; }
.callout-title .btn-ico svg { width: 16px; height: 16px; }

.code-title { flex: 1; min-width: 0; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-lang { flex: none; font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 6px; color: var(--muted); }
.code-note { margin: 0; padding: var(--s3) var(--s4); border-top: 1px solid var(--border); background: var(--raised); color: var(--muted); font-size: 0.9rem; font-family: var(--font); }

.blk-tryit::before { border-bottom: 0; }
.blk-challenge::before { content: none; display: none; }
.blk-tryit .code-head { border-bottom: 0; }
.challenge-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px var(--s4); background: color-mix(in srgb, var(--fill) 10%, var(--surface)); border-bottom: 1px solid var(--border); }
.challenge-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--link); }
.ed-area { min-width: 0; background: var(--code-bg); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ed-area .editor-wrap { border: 0; }
.ed-pane { min-width: 0; }
.blk-tryit .toolbar, .blk-challenge .toolbar { border-top: 0; }
.stdin-label { display: block; font-size: 0.72rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.1em; }

.out-title { color: var(--muted); }
.out-head .out-label { margin-left: auto; font-family: var(--mono); font-size: 0.7rem; font-weight: 500; font-style: normal; text-transform: none; letter-spacing: 0; }
.out-head .tabs { padding: 0; background: none; border: 0; overflow: visible; }
.out-head .tab { top: 0; padding: 4px 12px; border-radius: 8px; font-family: var(--font); font-size: 0.8rem; }
.out-head .tab.active { background: var(--surface-2); border-color: var(--border-strong); }
.out-body { padding: 0; max-height: none; overflow: visible; white-space: normal; min-height: 0; }
.out-pane { padding: var(--s3) var(--s4); max-height: 360px; overflow: auto; min-height: 48px; font-family: var(--mono); font-size: 0.86rem; line-height: 1.6; }
.out-pane:has(> .out-preview) { padding: 0; max-height: none; }
.out-pane pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; }
.out-pre { color: var(--text); }
pre.out-err { margin: 6px 0 0; padding: 8px 12px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); background: color-mix(in srgb, var(--err) 7%, transparent); }
.out-preview { background: #fff; }
.out-preview .preview-frame { height: 280px; }
.table-wrap { overflow-x: auto; margin: var(--s2) 0; border: 1px solid var(--border); border-radius: 8px; }
.table-wrap .sql-table { margin: 0; }
td.out-muted { font-family: var(--mono); font-size: 0.8rem; }

.blk-challenge > .feedback, .blk-challenge > .hint, .blk-challenge > .solution { margin: 0; border-radius: 0; border-width: 1px 0 0; }
.feedback .pill { vertical-align: middle; }
.fb-msg { margin-left: 4px; }
.why { margin-top: var(--s2); }
.solution .code-head { background: transparent; border: 0; padding: 0 0 var(--s2); min-height: 0; }
.solution pre { margin: 0 0 var(--s2); border: 1px solid var(--border); border-radius: 8px; }
.quiz-q { margin-bottom: var(--s3); font-weight: 600; }
.quiz-q > :last-child { margin-bottom: 0; }
.opt-text { min-width: 0; }
.opt-text p { margin: 0; }
.blk-quiz .toolbar { padding: 0; background: none; border: 0; }
.blk-quiz .feedback { margin-top: var(--s3); }

.blk-case { position: static; padding: var(--s5); margin-top: var(--s5); }
.case-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.case-badge { position: static; transform: none; box-shadow: none; }
.case-project { margin: 0; }
.blk-case .blk-code { margin: var(--s4) 0 0; }

.term-lines { padding: var(--s2) 0; }
.term-line { padding: 3px var(--s4); }
.term-cmd { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.term-out { margin: 0; padding: 0 var(--s4) var(--s3); }
.blk-term .code-note { font-family: var(--font); }
figure.blk-figure { margin: var(--s6) 0; }
.fig-art { overflow-x: auto; }
.cmp-col pre { overflow-x: auto; margin: 0; }

.lesson-foot { justify-content: space-between; }
.foot-status { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.foot-note { margin: 0; font-size: 0.88rem; }
.foot-nav { display: flex; gap: var(--s2); flex-wrap: wrap; margin-left: auto; }
.foot-nav .btn { min-width: 0; text-align: left; }

.lesson-panel { margin: var(--s8) auto; text-align: center; padding: var(--s7) var(--s5); }
.lesson-panel h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.lesson-panel p { color: var(--muted); }
.panel-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto var(--s4); border-radius: 16px; background: var(--surface); color: var(--link); }
.panel-icon svg { width: 28px; height: 28px; }

/* expected-output panel + compile hint inside run:false blocks */
.out-body > .out-pre { padding: var(--s3) var(--s4); margin: 0; }
.lesson-layout .blk-tryit > .callout, .lesson-layout .blk-challenge > .callout { margin: var(--s4); max-width: none; }
/* web preview reads as a small browser window */
.out-pane:has(> .out-preview) { padding: var(--s3); }
.out-preview { border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: #fff; }
.out-preview::before {
  content: ""; display: block; height: 30px; border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 16px 50%, #ff5f57 0 4px, transparent 5px),
    radial-gradient(circle at 32px 50%, #febc2e 0 4px, transparent 5px),
    radial-gradient(circle at 48px 50%, #28c840 0 4px, transparent 5px),
    var(--surface-2);
}
.out-preview .preview-frame { display: block; }

/* ---------------------------------------------------------------- toasts */
.toast-wrap { position: fixed; z-index: 200; right: var(--s4); bottom: var(--s4); display: flex; flex-direction: column; gap: var(--s2); align-items: flex-end; pointer-events: none; max-width: calc(100vw - 32px); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: var(--radius); font-weight: 600; font-size: 0.92rem;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: toast-in 0.35s var(--ease); max-width: 100%;
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.out { animation: toast-out 0.25s ease forwards; }
.toast-xp { background: var(--fill); color: var(--on-accent); border-color: transparent; }
.toast-ok { border-color: var(--ok); } .toast-ok svg { color: var(--ok); }
.toast-err { border-color: var(--err); } .toast-err svg { color: var(--err); }
.toast-info svg { color: var(--info); }

/* ----------------------------------------------------------------- modal */
.modal-back { position: fixed; inset: 0; z-index: 150; background: var(--scrim); display: grid; place-items: center; padding: var(--s4); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade-in 0.2s ease; overflow-y: auto; }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--s5); animation: modal-in 0.3s var(--ease);
}
.modal h2 { font-size: 1.35rem; margin-bottom: var(--s3); }
.modal-body > :last-child { margin-bottom: 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: flex-end; margin-top: var(--s5); }
.modal .set-row { padding: var(--s3) 0; border-top: 1px solid var(--border); }
.modal .set-row:first-child { border-top: 0; padding-top: 0; }
.modal .set-row h3 { font-size: 0.95rem; margin-bottom: 4px; }
.modal .set-row p { color: var(--muted); font-size: 0.88rem; margin-bottom: var(--s2); }
.badge-modal { text-align: center; }
.badge-modal .badge-disc { width: 120px; height: 120px; margin-bottom: var(--s4); animation: badge-pop 0.7s var(--ease); }
.badge-modal .badge-disc svg { width: 56px; height: 56px; }
.badge-modal .k { color: var(--link); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.badge-modal h2 { font-size: 2rem; margin: var(--s2) 0; }
.badge-modal p { color: var(--muted); }
.badge-modal .modal-actions { justify-content: center; }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti { position: absolute; top: -12px; width: 10px; height: 10px; background: var(--fill); animation: confetti-fall 1.2s cubic-bezier(0.2, 0.6, 0.4, 1) forwards; will-change: transform, opacity; }

/* ----------------------------------------------------------- CodeMirror */
.CodeMirror { height: auto; font-family: var(--mono); font-size: 0.88rem; line-height: 1.65; background: var(--code-bg); color: var(--text); }
.cm-s-academy.CodeMirror { background: var(--code-bg); color: var(--text); }
.cm-s-academy .CodeMirror-scroll { max-width: 100%; }
.cm-s-academy .CodeMirror-lines { padding: var(--s3) 0; }
.cm-s-academy .CodeMirror-gutters { background: var(--code-bg); border-right: 1px solid var(--border); }
.cm-s-academy .CodeMirror-linenumber { color: var(--muted); opacity: 0.6; padding: 0 10px 0 8px; }
.cm-s-academy .CodeMirror-cursor { border-left: 2px solid var(--accent); }
.cm-s-academy .CodeMirror-selected, .cm-s-academy.CodeMirror-focused .CodeMirror-selected { background: var(--syn-sel); }
.cm-s-academy .CodeMirror-activeline-background { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.cm-s-academy .CodeMirror-matchingbracket { color: var(--accent) !important; background: var(--syn-sel); outline: 1px solid var(--accent); }
.cm-s-academy .CodeMirror-nonmatchingbracket { color: var(--err) !important; }
.cm-s-academy .cm-keyword, pre.cm-s-academy .cm-keyword { color: var(--syn-kw); font-weight: 600; }
.cm-s-academy .cm-atom, .cm-s-academy .cm-number, .cm-s-academy .cm-bool { color: var(--syn-num); }
.cm-s-academy .cm-string, .cm-s-academy .cm-string-2 { color: var(--syn-str); }
.cm-s-academy .cm-comment { color: var(--syn-com); font-style: italic; }
.cm-s-academy .cm-def, .cm-s-academy .cm-variable-3, .cm-s-academy .cm-type { color: var(--syn-def); }
.cm-s-academy .cm-variable { color: var(--text); }
.cm-s-academy .cm-variable-2 { color: var(--syn-var); }
.cm-s-academy .cm-property { color: var(--syn-def); }
.cm-s-academy .cm-operator { color: var(--syn-op); }
.cm-s-academy .cm-punctuation, .cm-s-academy .cm-bracket { color: var(--syn-op); }
.cm-s-academy .cm-tag { color: var(--syn-tag); }
.cm-s-academy .cm-attribute, .cm-s-academy .cm-qualifier { color: var(--syn-attr); }
.cm-s-academy .cm-builtin { color: var(--syn-builtin); }
.cm-s-academy .cm-meta { color: var(--syn-com); }
.cm-s-academy .cm-header { color: var(--syn-kw); font-weight: 700; }
.cm-s-academy .cm-link { color: var(--info); text-decoration: underline; }
.cm-s-academy .cm-error { color: var(--err); }
.cm-s-academy .CodeMirror-placeholder { color: var(--muted); }
.CodeMirror-scroll, .CodeMirror-hscrollbar { scrollbar-color: var(--border-strong) transparent; }

/* ------------------------------------------------------------ animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 6px var(--bg), 0 0 0 6px rgba(255, 198, 26, 0.55); }
  70% { box-shadow: 0 0 0 6px var(--bg), 0 0 0 20px rgba(255, 198, 26, 0); }
  100% { box-shadow: 0 0 0 6px var(--bg), 0 0 0 20px rgba(255, 198, 26, 0); }
}
@keyframes bump { 40% { transform: scale(1.07); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
@keyframes badge-pop { 0% { transform: scale(0.3) rotate(-25deg); opacity: 0; } 60% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: none; } }
@keyframes confetti-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
  100% { transform: translate3d(var(--dx, 0), 105vh, 0) rotate(var(--rot, 540deg)); opacity: 0.9; }
}
.fade-up { animation: fade-up 0.6s var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }

/* ----------------------------------------------------------------- print */
@page { size: A4 landscape; margin: 12mm; }
@media print {
  :root, :root[data-theme] {
    --bg: #fff; --raised: #fff; --surface: #f7f1de; --text: #1a1508; --muted: #5c5238; --border: #d9cba2; --border-strong: #b88600;
    --link: #8a6400; --accent: #b88600; --glow: transparent;
  }
  html, body { background: #fff !important; color: #1a1508 !important; }
  .topbar, .site-foot, .cert-tools, .toast-wrap, .no-print { display: none !important; }
  .page { padding: 0; min-height: 0; }
  .container { max-width: none; padding: 0; }
  .cert { border: 3px double #b88600; outline: none; break-inside: avoid; page-break-inside: avoid; max-width: none; margin: 0; padding: 14mm; background: #fff; }
  .cert::before { display: none; }
  .cert .cert-name { border-bottom-color: #b88600; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .confetti-layer { display: none; }
}

/* hosted (Raahaao Courses site) */
.lesson-list.is-locked .lesson-row.is-free { opacity: 1; }
.hosted-lock { max-width: 760px; margin-left: auto; margin-right: auto; }
.hosted-lock .row { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* ---- v2 towers ---- */
.sky-hero{text-align:center;padding-block:48px 8px}.sky-hero .lead{max-width:640px;margin-inline:auto}
.skyline{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:20px;align-items:end;padding-block:24px 64px}
.tw-card{display:flex;flex-direction:column;gap:6px;padding:16px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--raised);color:var(--text);text-decoration:none;transition:transform .15s,border-color .15s}
.tw-card:hover{transform:translateY(-3px);border-color:var(--accent)}.tw-card h2{font-size:1.15rem;margin:0}.tw-meta{font-size:.85rem;color:var(--muted)}
.tw-art{display:flex;justify-content:center}.tw-svg{width:120px;height:auto}.tw-svg.tw-big{width:100%;max-width:260px}
.tw-ground{fill:var(--surface)}
.tw-layout{display:grid;grid-template-columns:280px 1fr;gap:40px;align-items:start}.tw-side{position:sticky;top:88px;display:flex;justify-content:center}
.tw-main{display:flex;flex-direction:column;gap:20px;min-width:0}.tw-projects{display:grid;gap:12px}.tw-proj.is-locked,.tw-floor-card.is-locked{opacity:.6}
.tw-floor-card{padding:20px}.tw-floor-head{display:flex;gap:14px;align-items:center;margin-bottom:10px}.tw-floor-head h3{margin:0}
.tw-floor-no{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:var(--surface-2);color:var(--accent);font-weight:700}.is-done .tw-floor-no{background:var(--accent);color:var(--on-accent)}
.tw-lessons{list-style:none;margin:0;padding:0;display:grid;gap:4px}.tw-lessons a{display:grid;grid-template-columns:22px 1fr auto auto;gap:10px;align-items:center;padding:10px 12px;border-radius:10px;color:var(--text);text-decoration:none}
.tw-lessons a:hover{background:var(--surface)}.tw-tick{color:var(--accent);font-weight:700}
.skip-form fieldset{margin:0 0 14px;border:1px solid var(--border);border-radius:var(--radius);padding:12px}
@media (max-width:760px){.tw-layout{grid-template-columns:1fr}.tw-side{position:static}.tw-svg.tw-big{max-width:180px}}
/* ---- tower picture v2 ---- */
.tw-svg{width:150px;height:auto;display:block}.tw-svg.tw-big{width:100%;max-width:320px}
.tw-star{fill:var(--muted);opacity:.5}.tw-ground{fill:var(--surface)}.tw-svg .tw-side{fill:#000;opacity:.35}
.tw-wall{fill:var(--surface-2);stroke:var(--border);stroke-width:1}.tw-ledge{fill:var(--border)}
.tw-window{fill:#0b0904;stroke:var(--border);stroke-width:1}.tw-no{font:700 13px var(--font-mono,monospace);fill:var(--muted)}
.tw-fl.done .tw-wall{fill:#2b230f;stroke:var(--accent)}.tw-fl.done .tw-window{fill:url(#twlit);stroke:none}.tw-fl.done .tw-no{fill:var(--accent)}
.tw-fl.current .tw-wall{stroke:var(--accent);stroke-width:2}.tw-fl.current .tw-window{fill:#3a2e10}.tw-fl.current .tw-no{fill:var(--accent)}
.tw-fl.locked .tw-wall{fill:var(--raised)}.tw-fl.locked .tw-window{fill:#070604}
.tw-here line{stroke:var(--accent);stroke-width:2}.tw-here text{font:700 12px var(--font-sans,sans-serif);fill:var(--accent)}
.tw-door{fill:#0b0904;stroke:var(--accent);stroke-width:1.5}.tw-parapet{fill:var(--border)}.tw-post{stroke:var(--border);stroke-width:3}
.tw-board{fill:var(--raised);stroke:var(--border);stroke-width:1.5}.tw-board.done{fill:var(--accent);stroke:var(--accent)}
.tw-board-t{font:700 9px var(--font-sans,sans-serif);fill:var(--muted)}.tw-board-t.done{fill:var(--on-accent)}
.tw-antenna{stroke:var(--border);stroke-width:2}.tw-beacon{fill:var(--border)}.tw-beacon.on{fill:var(--accent);animation:tw-blink 1.6s infinite}
@keyframes tw-blink{50%{opacity:.25}}@media (prefers-reduced-motion:reduce){.tw-beacon.on{animation:none}}
.tw-card{align-items:center;text-align:center}

/* ---- v2 projects ---- */
.proj-page{display:flex;flex-direction:column;gap:16px}.proj-tabs{position:sticky;top:64px;z-index:5;background:var(--bg)}
.proj-pane{display:flex;flex-direction:column;gap:14px}.proj-reqs li{margin-bottom:6px}.proj-editors .CodeMirror{min-height:420px}
.proj-stdin{width:100%;font-family:var(--font-mono,monospace);background:var(--code-bg);color:var(--text);border:1px solid var(--border);border-radius:var(--radius);padding:10px}
.proj-out{min-height:120px}.proj-out iframe{width:100%;min-height:420px;border:0;background:#fff;border-radius:var(--radius)}
.report-head{display:flex;gap:20px;align-items:center;margin-block:12px}
.score-ring{--pct:0;width:96px;height:96px;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:1.3rem;background:radial-gradient(closest-side,var(--bg) 78%,transparent 80%),conic-gradient(var(--err) calc(var(--pct)*1%),var(--border) 0)}
.score-ring.ok{background:radial-gradient(closest-side,var(--bg) 78%,transparent 80%),conic-gradient(var(--accent) calc(var(--pct)*1%),var(--border) 0)}
.report-list{list-style:none;padding:0;margin:0;display:grid;gap:8px}.report-list li{display:flex;gap:12px;padding:12px 14px;border:1px solid var(--border);border-radius:var(--radius);background:var(--raised)}
.report-list li.ok .rl-mark{color:var(--ok)}.report-list li.bad .rl-mark{color:var(--err)}.rl-mark{font-weight:700;font-size:1.1rem;line-height:1.4}.report-list p{margin:4px 0 0}
.proj-pane > .btn,.proj-pane .toolbar .btn{align-self:flex-start}
.cert-name{font-size:2rem;font-weight:700;color:var(--accent);margin:8px 0}.cert-kicker{text-transform:uppercase;letter-spacing:.12em;font-size:.8rem;color:var(--muted)}
.cert-name-in{padding:10px;border-radius:var(--radius);border:1px solid var(--border);background:var(--raised);color:var(--text)}@media print{.no-print{display:none!important}}
/* tower picture: brighter, readable palette */
.tw-wall{fill:#3a311b;stroke:#5c4b22;stroke-width:1.5}.tw-ledge{fill:#5c4b22}.tw-svg .tw-side{fill:#000;opacity:.45}
.tw-window{fill:#17120a;stroke:#5c4b22}.tw-no{fill:#c9b98f;font-size:14px}.tw-star{fill:#e9dfc4;opacity:.7}
.tw-fl.open .tw-window,.tw-fl.current .tw-window{fill:#7a5f15;stroke:#a8841f}
.tw-fl.current .tw-wall{fill:#4a3d1c;stroke:var(--accent);stroke-width:2.5}
.tw-fl.locked .tw-wall{fill:#2a2412;stroke:#3d3319}.tw-fl.locked .tw-window{fill:#0d0b06;stroke:#3d3319}.tw-fl.locked .tw-no{fill:#7d7257}
.tw-fl.done .tw-wall{fill:#4d3f12}.tw-board{fill:#2a2412;stroke:#7d6a2c}.tw-board-t{fill:#d8c99f}.tw-door{fill:#17120a}
.tw-here text{font-size:13px}.tw-side-wrap{overflow:visible}
.tw-continue{align-self:flex-start;font-size:1.05rem;padding:14px 22px}.tw-svg.tw-big{max-width:340px}

/* ===================================================================== motion v3
   One orchestrated build-up per tower, page-to-page morphs, and moments that answer
   the learner (lesson complete, report card). Everything is off under reduced motion. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; }
::view-transition-group(*) { animation-duration: .55s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }

/* tower builds itself: floors rise in order, lit windows flick on, billboards drop, beacon glows */
.tw-svg .tw-fl { transform-box: fill-box; transform-origin: 50% 100%; animation: tw-rise .55s cubic-bezier(.16,1,.3,1) backwards; animation-delay: calc(var(--i, 0) * 90ms + 80ms); }
.tw-svg .tw-fl.done .tw-window { animation: tw-light .5s steps(3, end) backwards; animation-delay: calc(var(--i, 0) * 90ms + 420ms + var(--w, 0) * 70ms); }
.tw-svg .tw-board, .tw-svg .tw-board-t, .tw-svg .tw-post { transform-box: fill-box; transform-origin: 50% 100%; animation: tw-drop .5s cubic-bezier(.16,1,.3,1) backwards; animation-delay: 620ms; }
.tw-svg .tw-here { animation: tw-here 1.8s ease-in-out infinite; animation-delay: 900ms; }
.tw-svg .tw-beacon { animation: tw-glow 2.4s ease-in-out infinite; }
.tw-svg .tw-star { animation: tw-twinkle 3s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 1s); }
.tw-svg .tw-star:nth-of-type(3n) { animation-delay: 1.1s; } .tw-svg .tw-star:nth-of-type(3n+1) { animation-delay: 2.2s; }
@keyframes tw-rise { from { opacity: 0; transform: translateY(26px) scaleY(.6); } }
@keyframes tw-light { from { fill: #0b0904; } 50% { fill: #fff6c8; } }
@keyframes tw-drop { from { opacity: 0; transform: translateY(-18px); } }
@keyframes tw-here { 50% { transform: translateX(4px); } }
@keyframes tw-glow { 50% { filter: drop-shadow(0 0 6px var(--accent)); } }
@keyframes tw-twinkle { 50% { opacity: .15; } }
.vt-arrive .tw-svg .tw-fl, .vt-arrive .tw-svg .tw-board, .vt-arrive .tw-svg .tw-board-t, .vt-arrive .tw-svg .tw-post, .vt-arrive .tw-svg .tw-window { animation: none; }

/* skyline: towers lean in on hover, as if you are about to walk in */
.tw-card { transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s; }
.tw-card:hover, .tw-card:focus-visible { transform: translateY(-6px); box-shadow: 0 18px 40px -18px rgba(255, 200, 40, .35); }
.tw-card:hover .tw-fl:not(.locked) .tw-window { fill: #ffe27a; transition: fill .25s; }
.tw-card:hover .tw-fl:not(.locked) .tw-window:nth-child(odd) { transition-delay: .08s; }

/* progress bars fill smoothly (transform, so no layout work) */
.bar > i { transform-origin: left; animation: bar-fill .9s cubic-bezier(.2,.8,.2,1) backwards .15s; }
@keyframes bar-fill { from { transform: scaleX(0); } }

/* report card: requirements tick in one after another */
.report-list li { animation: fade-up .4s ease backwards; }
.report-list li:nth-child(2) { animation-delay: .08s; } .report-list li:nth-child(3) { animation-delay: .16s; } .report-list li:nth-child(4) { animation-delay: .24s; }
.report-list li:nth-child(5) { animation-delay: .32s; } .report-list li:nth-child(6) { animation-delay: .40s; } .report-list li:nth-child(7) { animation-delay: .48s; }
.report-list li:nth-child(8) { animation-delay: .56s; } .report-list li:nth-child(n+9) { animation-delay: .64s; }
.report-list li.ok .rl-mark { display: inline-block; animation: badge-pop .45s cubic-bezier(.16,1,.3,1) backwards; animation-delay: inherit; }

/* lesson complete: the tower, the glowing floor, the floor's lessons filling up */
.climb { position: fixed; inset: auto 0 32px 0; margin: 0 auto; width: min(440px, calc(100% - 32px)); z-index: 90; display: flex; gap: 18px; align-items: center;
  padding: 16px 20px; border-radius: 18px; background: var(--surface-2, #1c170b); border: 1px solid var(--accent); box-shadow: 0 24px 60px -20px rgba(0,0,0,.7), 0 0 0 6px rgba(255, 200, 40, .08);
  opacity: 0; transform: translateY(30px) scale(.96); transition: opacity .35s, transform .45s cubic-bezier(.16,1,.3,1); cursor: pointer; }
.climb.in { opacity: 1; transform: none; } .climb.out { opacity: 0; transform: translateY(16px) scale(.98); }
.climb-art { width: 92px; flex: none; } .climb-art .tw-svg { width: 92px; }
.climb-txt { display: grid; gap: 6px; min-width: 0; flex: 1; } .climb-txt b { font-size: 1.15rem; color: var(--accent); } .climb-txt span { color: var(--muted); font-size: .92rem; }
.climb-bar { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.climb-bar i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 1s cubic-bezier(.2,.8,.2,1) .35s; }
.tw-fl.just .tw-wall { animation: tw-just 1.2s ease-in-out 3; } .tw-fl.just .tw-window { fill: #ffe27a; }
@keyframes tw-just { 50% { fill: #6b5413; stroke: #fff2b0; } }
.climb.floor-done { border-width: 2px; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .tw-svg *, .bar > i, .report-list li, .report-list .rl-mark, .tw-fl.just .tw-wall { animation: none !important; }
  .tw-card, .climb, .climb-bar i { transition: none !important; }
}

/* skyline fixes: the hero is not a full page, and all six towers stand in one row on desktop */
.page.sky-hero{min-height:0}
.skyline{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}

/* ===================================================================== home v3: the city
   One night street with every tower on it. The towers drop their own sky and ground here,
   so they stand together under one sky. */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: end; padding-block: 44px 28px; }
.home-hero h1 { margin: 0 0 10px; font-size: clamp(2rem, 4.2vw, 3.2rem); line-height: 1.05; letter-spacing: -.02em; }
.home-hero .lead { margin: 0 0 20px; max-width: 52ch; }
.home-go { font-size: 1.02rem; padding: 13px 20px; max-width: 100%; white-space: normal; text-align: left; }
.home-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0; background: var(--border); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.home-stats > div { background: var(--raised); padding: 12px 14px; }
.home-stats > div:nth-child(4) { grid-column: span 1; } .home-stats > div:nth-child(5) { grid-column: span 2; }
.home-stats dt { font-size: .8rem; color: var(--muted); } .home-stats dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 700; color: var(--text); }

.city { position: relative; overflow: hidden; margin-top: 8px; padding-top: 70px;
  background: radial-gradient(1200px 380px at 50% 105%, rgba(255, 196, 40, .14), transparent 70%), linear-gradient(180deg, #0a0805 0%, #1a1408 70%, #241b0a 100%);
  border-block: 1px solid var(--border); }
.city::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image: radial-gradient(1.2px 1.2px at 12% 18%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 27% 34%, #f3e6c0 50%, transparent 51%), radial-gradient(1.4px 1.4px at 44% 12%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 61% 28%, #f3e6c0 50%, transparent 51%), radial-gradient(1.2px 1.2px at 79% 16%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 91% 38%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 6% 44%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 53% 46%, #f3e6c0 50%, transparent 51%); }
.city-moon { position: absolute; top: 26px; right: 9%; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4cf, #e9cf7c 60%, #b8963a); box-shadow: 0 0 60px 12px rgba(255, 220, 120, .18); }
.city-street { position: relative; display: flex; justify-content: center; align-items: flex-end; gap: clamp(6px, 2.4vw, 34px); padding-bottom: 0; }
.city-street::after { content: ''; position: absolute; left: -50vw; right: -50vw; bottom: 0; height: 64px; background: linear-gradient(180deg, #2a2110, #171207); border-top: 2px solid #4a3b18; z-index: 0; }
.city-tw { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 12px; color: var(--text); text-decoration: none; border-radius: 12px;
  transition: transform .4s cubic-bezier(.16,1,.3,1); }
.city-tw .tw-svg > rect:first-of-type, .city-tw .tw-ground, .city-tw .tw-star { display: none; }
.city-tw .tw-svg { width: var(--w, 132px); margin-bottom: -34px; overflow: visible; }
.city-tw:nth-child(6n+1) { --w: 122px; } .city-tw:nth-child(6n+2) { --w: 142px; } .city-tw:nth-child(6n+3) { --w: 160px; }
.city-tw:nth-child(6n+4) { --w: 134px; } .city-tw:nth-child(6n+5) { --w: 150px; } .city-tw:nth-child(6n+6) { --w: 126px; }
.city-name { margin-top: 0; font-weight: 700; font-size: 1.02rem; position: relative; } .city-meta { font-size: .8rem; color: var(--muted); }
.city-tw:hover, .city-tw:focus-visible { transform: translateY(-8px); }
.city-tw:hover .tw-fl:not(.locked) .tw-window, .city-tw:focus-visible .tw-fl:not(.locked) .tw-window { fill: #ffe27a; transition: fill .25s; }
.city-tw.is-started .city-name { color: var(--accent); }
.city-tw.is-complete .tw-svg { filter: drop-shadow(0 0 18px rgba(255, 210, 60, .45)); }
.city-tw .tw-svg .tw-fl { animation-delay: calc(var(--k, 0) * 110ms + var(--i, 0) * 80ms + 60ms); }
.city-tw .tw-svg .tw-board, .city-tw .tw-svg .tw-board-t, .city-tw .tw-svg .tw-post { animation-delay: calc(var(--k, 0) * 110ms + 560ms); }

.home-below { padding-block: 40px 56px; }
.home-below h2 { margin: 0 0 16px; }
.climb-list { display: grid; gap: 10px; }
.climb-row { display: grid; grid-template-columns: 150px minmax(120px, 1fr) minmax(0, 1.6fr); gap: 18px; align-items: center; padding: 14px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--raised); color: var(--text); text-decoration: none; transition: border-color .2s, background .2s; }
.climb-row:hover, .climb-row:focus-visible { border-color: var(--accent); background: var(--surface-2); }
.how-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; counter-reset: st; border-top: 2px solid var(--accent); }
.how-steps li { counter-increment: st; padding: 18px 20px 0 0; }
.how-steps li strong::before { content: counter(st) '  '; color: var(--accent); }
.how-steps p { margin: 6px 0 0; }

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; align-items: start; }
  .city-street { justify-content: flex-start; overflow-x: auto; padding-inline: 8px; scroll-snap-type: x mandatory; }
  .city-tw { scroll-snap-align: center; flex: none; }
  .climb-row { grid-template-columns: 1fr; gap: 8px; }
  .how-steps { grid-template-columns: 1fr 1fr; row-gap: 8px; }
}
@media (max-width: 520px) { .how-steps { grid-template-columns: 1fr; } .home-stats { grid-template-columns: repeat(2, 1fr); } .home-stats > div:nth-child(5) { grid-column: span 2; } }
@media (prefers-reduced-motion: reduce) { .city-tw { transition: none; } }
/* city alignment: tower base sits on the street line, labels live on the street */
.city-tw { padding-bottom: 0; gap: 0; }
.city-tw .tw-svg { margin-bottom: calc(var(--w, 132px) * -0.108); }
.city-label { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 64px; gap: 1px; }
@media (max-width: 520px) { .home-stats { grid-template-columns: repeat(3, 1fr); } .home-stats > div { padding: 9px 10px; } .home-stats dt { font-size: .72rem; } .home-stats dd { font-size: 1.08rem; } .home-stats > div:nth-child(5) { grid-column: span 2; } .home-hero { padding-block: 28px 20px; gap: 18px; } }
/* city: quiet the small print, the "You" marker only on towers you have started */
.city-tw .tw-no, .city-tw:not(.is-started):not(.is-complete) .tw-here { display: none; }
/* phone top bar: one line; the way back to the site stays */
.topbar .nav a { white-space: nowrap; }
@media (max-width: 600px) { .topbar .nav a[data-nav="glossary"], .topbar .nav a[data-nav="dash"] { display: none; } .topbar .nav a { padding-left: 8px; padding-right: 8px; } .topbar .nav { gap: 2px; } }
/* practice + playground links hide on phones */
@media (max-width: 600px) { .topbar .nav a[data-nav="practice"], .topbar .nav a[data-nav="playground"] { display: none; } }

.out-img { max-width: 100%; background: #fff; border-radius: 8px; margin: 8px 0; }
