/* ================= large lesson layout ================= */
.wide { width: 90vw; max-width: none; margin: 0 auto; }
.lesson-head.compact { padding: 18px 0 14px; display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.lesson-head.compact h1 { font-size: 26px; margin: 0; }
.lesson-head.compact p { font-size: 16px; }

.wide .player { --line-h: 38px; }
.wide .player .ln { font-size: 16.5px; }
.wide .player .pane-h { font-size: 14px; padding: 14px 18px; }
.wide .player .box { height: 46px; min-width: 70px; font-size: 18px; }
.wide .player .vname { font-size: 15px; min-height: 46px; }
.wide .player .console { font-size: 16px; }
.wide .player .say { font-size: 17px; min-height: 72px; padding: 12px 20px; }
.wide .player .pane { min-height: var(--pane-min, max(460px, calc(92vh - 320px))); }

.player.has-story .world { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 0.95fr); gap: 16px; }
.story .real { background: var(--surface); }
.scene { flex: 0 0 auto; width: 100%; height: auto; aspect-ratio: 3 / 2; }
.pane { display: flex; flex-direction: column; }
.pane-story { padding: 0; overflow: hidden; }
.story { position: relative; flex: 0 0 auto; display: flex; flex-direction: column; min-height: 0; }
.story-out { flex: 1; display: flex; flex-direction: column; padding-bottom: 14px; border-top: 1px solid var(--border); }
.story-out .console { flex: 1; min-height: 70px; }
.scene { width: 100%; height: auto; display: block; flex: 1; }
.real { margin: 0; padding: 8px 14px 10px; min-height: 48px; font-size: 13px; line-height: 1.5; color: var(--text); border-top: 1px dashed var(--border-strong); opacity: 0.4; transition: opacity 0.3s; }
.real.show { opacity: 1; }
.real .w { display: inline-block; }
.real::before { content: "In real life: "; font-weight: 700; color: var(--accent); }

/* voice + language controls */
.voice-btn .wave { opacity: 0.25; transition: opacity 0.2s; }
.voice-btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.voice-btn.on .wave { opacity: 1; }
.lang { height: 44px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 14px var(--font); padding: 0 10px; max-width: 200px; }
.lang:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.voice-note { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--muted); }

/* paywall + locks */
.paywall { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 28px; align-items: center; padding: 36px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); max-width: 900px; }
.paywall h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -0.01em; }
.paywall p { margin: 0 0 16px; color: var(--muted); }
.pay-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pay-actions .btn { text-decoration: none; }
.pay-actions .btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.pay-note { font-size: 14px; margin-top: 12px !important; }
.lock-art svg { width: 120px; height: 120px; }
.lk-body { fill: var(--accent); }
.lk-shackle { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; }
.lk-hole { fill: var(--surface); }
.card .pro { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--accent-bg); color: var(--accent); }
.card .free { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--ok-bg); color: var(--ok); }
.card.locked .state { color: var(--muted); }
@media (max-width: 600px) { .paywall { grid-template-columns: minmax(0, 1fr); padding: 24px; } .lock-art svg { width: 80px; height: 80px; } }

/* course catalog */
.cards.collapsed .extra { display: none; }
.course .more { margin-top: 14px; }
.card.soon { border-style: dashed; }
.card.soon .state { color: var(--faint); }
.card .hot { display: inline-block; vertical-align: middle; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--bad-bg); color: var(--bad); margin-left: 4px; }
.course-h .rank { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.pass { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 30px; padding: 16px 20px; border-radius: var(--radius); background: var(--accent-bg); border: 1px solid var(--accent-border); color: var(--text); }
.pass-price { font-weight: 700; color: var(--accent); }
.pass-price s { color: var(--muted); font-weight: 400; margin-right: 6px; }

/* home page */
.hero.hero-top { grid-template-columns: minmax(0, 1fr); padding: 36px 0 22px; }
.hero-top .hero-copy { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px 40px; align-items: end; }
.hero-top .hero-copy h1 { margin: 0; }
.hero-top .hero-copy p { margin: 0; max-width: 46ch; }
.hero-top .hero-copy .btn { justify-self: start; }
.hero-demo .player .pane { min-height: 0; }
.hero-demo .controls .scrub, .hero-demo .controls .speed { display: block; }
@media (max-width: 860px) { .hero-top .hero-copy { grid-template-columns: minmax(0, 1fr); } }

/* ================= scene palette: "Ahazoo Clay" (research/01-animation-style.md) ================= */
.story, .sp-stage { /* scene colours: the coding player's real-life panel and the scene player share them */
  --c-coral-hi: #FFB4A2; --c-coral-base: #FF7A59; --c-coral-lo: #D9573A;
  --c-sun-hi: #FFE48A; --c-sun-base: #FFC93C; --c-sun-lo: #E0A512;
  --c-mint-hi: #A8F0D1; --c-mint-base: #3DD9A0; --c-mint-lo: #1FAF7C;
  --c-sky-hi: #A9D8FF; --c-sky-base: #4DA8FF; --c-sky-lo: #2A7FD6;
  --c-grape-hi: #D3B8FF; --c-grape-base: #9B6BFF; --c-grape-lo: #7444DB;
  --c-pink-hi: #FFD1E3; --c-pink-base: #FF8FB8; --c-pink-lo: #E0608F;
  --c-wood-hi: #F2C48D; --c-wood-base: #C98B4F; --c-wood-lo: #92592A;
  --c-skin-hi: #FFE0C7; --c-skin-base: #F0B98D; --c-skin-lo: #C98A5E;
  --c-steel-hi: #DDE3EE; --c-steel-base: #9AA6BA; --c-steel-lo: #5F6B80;
  --c-paper-hi: #FFFFFF; --c-paper-base: #FBF8F0; --c-paper-lo: #E6DFCC;
  --c-leaf-hi: #C9F29B; --c-leaf-base: #7FCB4A; --c-leaf-lo: #4C9A26;
  --c-ink: #2B2D42;
  --shadow: rgba(43, 45, 66, 0.2);
  --sky-top: #BFE4FF; --sky-bot: #F2FAFF;
  --ground-top: #CDEBB6; --ground-bot: #A9D58F;
  --hill-far: #D7EEF2; --hill-near: #BFE3B0;
  --wall: #FCEBD7; --floor: #E7C397; --road: #6E7586;
  --sky: var(--sky-top);
}
:root[data-theme="dark"] .story, :root[data-theme="dark"] .sp-stage {
    --c-coral-hi: #FF9F88; --c-coral-base: #F26B4B; --c-coral-lo: #B8462C;
    --c-sun-hi: #FFD966; --c-sun-base: #F2B92B; --c-sun-lo: #B98A0E;
    --c-mint-hi: #7EE6BD; --c-mint-base: #2FC48D; --c-mint-lo: #178A61;
    --c-sky-hi: #8CC8FF; --c-sky-base: #3F95EE; --c-sky-lo: #2266B0;
    --c-grape-hi: #C2A3FF; --c-grape-base: #8A5CF0; --c-grape-lo: #5E36B5;
    --c-pink-hi: #FFB8D2; --c-pink-base: #F2789F; --c-pink-lo: #B84A72;
    --c-wood-hi: #DDAA70; --c-wood-base: #A9713D; --c-wood-lo: #6E4120;
    --c-skin-hi: #F5CDA8; --c-skin-base: #D9A273; --c-skin-lo: #A8724A;
    --c-steel-hi: #B8C1D2; --c-steel-base: #7B879C; --c-steel-lo: #4A5468;
    --c-paper-hi: #F7F4EC; --c-paper-base: #E9E4D6; --c-paper-lo: #C9C0A8;
    --c-leaf-hi: #A9DC79; --c-leaf-base: #63AE34; --c-leaf-lo: #3B7A1B;
    --c-ink: #F1F2F8;
    --shadow: rgba(0, 0, 0, 0.45);
    --sky-top: #141A2E; --sky-bot: #26304F;
    --ground-top: #26382E; --ground-bot: #1A261F;
    --hill-far: #1F2A44; --hill-near: #233A30;
    --wall: #2C2638; --floor: #3E3126; --road: #3A3F4C;
  }
.story, .sp-stage { background: var(--sky-top); }
.story[data-bg="indoor"] { background: var(--wall); }

/* gradient stops */
.st-coral-hi { stop-color: var(--c-coral-hi); } .st-coral-base { stop-color: var(--c-coral-base); } .st-coral-lo { stop-color: var(--c-coral-lo); }
.st-sun-hi { stop-color: var(--c-sun-hi); } .st-sun-base { stop-color: var(--c-sun-base); } .st-sun-lo { stop-color: var(--c-sun-lo); }
.st-mint-hi { stop-color: var(--c-mint-hi); } .st-mint-base { stop-color: var(--c-mint-base); } .st-mint-lo { stop-color: var(--c-mint-lo); }
.st-sky-hi { stop-color: var(--c-sky-hi); } .st-sky-base { stop-color: var(--c-sky-base); } .st-sky-lo { stop-color: var(--c-sky-lo); }
.st-grape-hi { stop-color: var(--c-grape-hi); } .st-grape-base { stop-color: var(--c-grape-base); } .st-grape-lo { stop-color: var(--c-grape-lo); }
.st-pink-hi { stop-color: var(--c-pink-hi); } .st-pink-base { stop-color: var(--c-pink-base); } .st-pink-lo { stop-color: var(--c-pink-lo); }
.st-wood-hi { stop-color: var(--c-wood-hi); } .st-wood-base { stop-color: var(--c-wood-base); } .st-wood-lo { stop-color: var(--c-wood-lo); }
.st-skin-hi { stop-color: var(--c-skin-hi); } .st-skin-base { stop-color: var(--c-skin-base); } .st-skin-lo { stop-color: var(--c-skin-lo); }
.st-steel-hi { stop-color: var(--c-steel-hi); } .st-steel-base { stop-color: var(--c-steel-base); } .st-steel-lo { stop-color: var(--c-steel-lo); }
.st-paper-hi { stop-color: var(--c-paper-hi); } .st-paper-base { stop-color: var(--c-paper-base); } .st-paper-lo { stop-color: var(--c-paper-lo); }
.st-leaf-hi { stop-color: var(--c-leaf-hi); } .st-leaf-base { stop-color: var(--c-leaf-base); } .st-leaf-lo { stop-color: var(--c-leaf-lo); }
.st-shadow { stop-color: var(--shadow); } .st-shadow-0 { stop-color: var(--shadow); stop-opacity: 0; }
.st-skybg-top { stop-color: var(--sky-top); } .st-skybg-bot { stop-color: var(--sky-bot); }
.st-ground-top { stop-color: var(--ground-top); } .st-ground-bot { stop-color: var(--ground-bot); }

/* fills: gradient body + 2.5px self-colour outline */
.f-coral { fill: url(#g-coral); stroke: var(--c-coral-lo); }
.f-sun { fill: url(#g-sun); stroke: var(--c-sun-lo); }
.f-mint { fill: url(#g-mint); stroke: var(--c-mint-lo); }
.f-sky { fill: url(#g-sky); stroke: var(--c-sky-lo); }
.f-grape { fill: url(#g-grape); stroke: var(--c-grape-lo); }
.f-pink { fill: url(#g-pink); stroke: var(--c-pink-lo); }
.f-wood { fill: url(#g-wood); stroke: var(--c-wood-lo); }
.f-skin { fill: url(#g-skin); stroke: var(--c-skin-lo); }
.f-steel { fill: url(#g-steel); stroke: var(--c-steel-lo); }
.f-paper { fill: url(#g-paper); stroke: var(--c-paper-lo); }
.f-leaf { fill: url(#g-leaf); stroke: var(--c-leaf-lo); }
[class*="f-"] { stroke-width: 2.5; stroke-linejoin: round; }
.s-hl { fill: #ffffff; stroke: none; pointer-events: none; }
.s-shadow { fill: url(#g-shadow); stroke: none; }
.s-bevel-hi { fill: rgba(255, 255, 255, 0.45); stroke: none; }
.s-bevel-lo { fill: rgba(0, 0, 0, 0.13); stroke: none; }

/* backdrops */
.s-hill-far { fill: var(--hill-far); }
.s-hill-near { fill: var(--hill-near); }
.s-cloud ellipse, .s-cloud circle { fill: #ffffff; opacity: 0.92; }
:root[data-theme="dark"] .s-cloud ellipse, :root[data-theme="dark"] .s-cloud circle { fill: #34406A; }
.s-road { fill: var(--road); }
.s-kerb { fill: rgba(255, 255, 255, 0.35); }
.s-stripe { fill: #F4F4F4; opacity: 0.9; }
.s-wall { fill: var(--wall); }
.s-floor { fill: var(--floor); }
.s-skirting { fill: var(--c-wood-lo); }
.s-winpane { fill: var(--sky-top); }
.s-winedge { fill: none; stroke: var(--c-wood-base); stroke-width: 7; }
.s-winframe line { stroke: var(--c-wood-base); stroke-width: 5; }
.s-sleeper { fill: var(--c-wood-lo); }
.s-rail { fill: var(--c-steel-base); }
.s-platform { fill: var(--c-steel-hi); }
.s-platform-edge { fill: var(--c-sun-base); }

/* houses, vehicles */
.s-win { fill: #5E6C84; stroke: #45506A; stroke-width: 2.5; transition: fill 0.35s; }
.s-win.on { fill: #FFE07A; stroke: var(--c-sun-lo); }
.s-win-bar { stroke: rgba(0, 0, 0, 0.2); stroke-width: 2; }
.s-knob { fill: var(--c-sun-base); }
.s-plate rect { fill: #ffffff; stroke: var(--c-ink); stroke-width: 1.5; transition: fill 0.3s, stroke 0.3s; }
:root[data-theme="dark"] .s-plate rect { stroke: #2B2D42; }
.s-plate-t { font: 700 12px var(--mono); fill: #2B2D42; }
.s-plate.hot rect { fill: #FFF3B0; stroke: var(--c-coral-lo); stroke-width: 3; }
.s-tag rect { fill: var(--c-grape-base); stroke: var(--c-grape-lo); stroke-width: 2.5; }
.s-tag-t { font: 700 15px var(--mono); fill: #fff; }
.s-truck-t { font: 800 12px var(--font); fill: #fff; letter-spacing: 0.08em; }
.s-wheel { fill: #2B2D42; stroke: #4A4E66; stroke-width: 3; }
.s-hub { fill: var(--c-steel-hi); }
.s-coach-w { fill: #E3EEFF; stroke: var(--c-sky-lo); stroke-width: 2.5; }
.s-coach-stripe { fill: var(--c-sun-base); }
.s-coupler { fill: #2B2D42; }
.s-pax circle { stroke-width: 2; }
.s-badge circle { fill: #ffffff; stroke: var(--c-sky-lo); stroke-width: 3; }
.s-badge-t { font: 800 17px var(--mono); fill: var(--c-sky-lo); }

/* bean people */
.s-limb { stroke-width: 10; stroke-linecap: round; fill: none; }
.s-leg .s-limb { stroke: #3A3F58; }
:root[data-theme="dark"] .s-leg .s-limb { stroke: #59607E; }
.s-arm .s-limb { stroke: var(--c-grape-lo); }
.s-arm .s-limb.f-mint { stroke: var(--c-mint-lo); } .s-arm .s-limb.f-coral { stroke: var(--c-coral-lo); }
.s-arm .s-limb.f-sky { stroke: var(--c-sky-lo); } .s-arm .s-limb.f-sun { stroke: var(--c-sun-lo); } .s-arm .s-limb.f-pink { stroke: var(--c-pink-lo); }
.s-foot { fill: #2B2D42; }
.s-hair { fill: #2B2D42; }
.s-eye { fill: #2B2D42; }
.s-catch { fill: #ffffff; }
.s-blush { fill: var(--c-coral-base); opacity: 0.35; }
.s-mouth { fill: none; stroke: #2B2D42; stroke-width: 2.4; stroke-linecap: round; }
.s-mouth-o { fill: #7A2E2E; }
.s-brim { stroke-width: 2; }
.s-name rect { fill: #2B2D42; }
.s-name-t { font: 700 12px var(--mono); fill: #fff; }
:root[data-theme="dark"] .s-name rect { fill: #4A4E6E; }
.s-think circle { fill: #ffffff; stroke: #2B2D42; stroke-width: 2; }
.s-think .s-think-dot { fill: #2B2D42; stroke: none; }

/* objects */
.s-box-t { font: 800 17px var(--mono); fill: #fff; paint-order: stroke; stroke: var(--c-wood-lo); stroke-width: 3; }
.s-note-f { fill: var(--c-paper-lo); }
.s-note-t { font: 700 15px var(--mono); fill: #2B2D42; }
.s-arrow path { fill: none; stroke: var(--c-coral-base); stroke-width: 4; stroke-linecap: round; }
.s-arrow polygon { fill: var(--c-coral-base); }
.s-sight { stroke: var(--c-coral-base); stroke-width: 3; stroke-dasharray: 6 7; stroke-linecap: round; }
.s-glass { fill: rgba(255, 255, 255, 0.22); stroke: #8AA0B8; stroke-width: 3; }
.s-glass-rim { fill: rgba(255, 255, 255, 0.3); stroke: #8AA0B8; stroke-width: 2; }
.s-shine { stroke: rgba(255, 255, 255, 0.75); stroke-width: 5; stroke-linecap: round; }
.s-liq, .s-liq.orange, .s-stream, .s-stream.orange { fill: #FF922B; }
.s-liq.grape, .s-stream.grape { fill: #9C36B5; }
.s-cup-t { font: 800 24px var(--mono); fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, 0.35); stroke-width: 3; }
.s-cup-l { font: 700 18px var(--mono); fill: var(--text); }
.s-cup-a { font: 12px var(--mono); fill: var(--muted); }
.s-coin-in { fill: none; stroke: var(--c-sun-lo); stroke-width: 2; }
.s-coin-t { font: 800 17px var(--mono); fill: #8A4B00; }
.s-coin.hot > circle:first-child { stroke: var(--c-grape-base); stroke-width: 5; }
.s-pig-slot { fill: #5C1F44; }
.s-pig-t { font: 800 28px var(--mono); fill: #8C1D4A; }
.s-icing { fill: none; stroke: #ffffff; stroke-width: 6; stroke-linecap: round; }
.s-topper-t { font: 800 26px var(--mono); fill: #fff; }
.s-paper-l { stroke: #E1DCCB; stroke-width: 3; }
.s-paper-t { font: 800 34px var(--mono); fill: #2B2D42; }
.s-paper-s { font: 11px var(--mono); fill: #868E96; }
.s-stamp rect { fill: rgba(255, 255, 255, 0.65); stroke-width: 4; }
.s-stamp-t { font: 900 22px var(--font); letter-spacing: 0.08em; }
.s-stamp.ok rect { stroke: #2B8A3E; } .s-stamp.ok .s-stamp-t { fill: #2B8A3E; }
.s-stamp.bad rect { stroke: #C92A2A; } .s-stamp.bad .s-stamp-t { fill: #C92A2A; }
.s-sign rect { fill: #ffffff; stroke: var(--c-grape-base); stroke-width: 3; transition: fill 0.3s, stroke 0.3s; }
.s-sign-t { font: 800 20px var(--mono); fill: #2B2D42; }
.s-sign.ok rect { fill: #D3F9D8; stroke: #2B8A3E; }
.s-sign.bad rect { fill: #FFE3E3; stroke: #C92A2A; }

/* speech, banners */
.s-bubble rect { fill: #ffffff; stroke: #2B2D42; stroke-width: 2.5; }
.s-bubble polygon { fill: #ffffff; }
.s-bubble-t { font: 700 15px var(--mono); fill: #2B2D42; }
.s-banner rect { fill: #2B2D42; }
.s-banner-t { font: 700 15px var(--font); fill: #fff; }
:root[data-theme="dark"] .s-banner rect { fill: var(--c-grape-lo); }
.s-t { font: 14px var(--font); fill: var(--text); }

/* ================= responsive ================= */
@media (max-width: 1200px) {
  .player.has-story .world { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "story story" "code mem"; }
  .player.has-story .pane-story { grid-area: story; }
  .player.has-story .pane-code { grid-area: code; }
  .player.has-story .pane-mem { grid-area: mem; }
  .wide .player .pane { min-height: 0; }
  .wide { width: auto; padding: 0 20px; }
}
@media (max-width: 860px) {
  .player.has-story .world { grid-template-columns: minmax(0, 1fr); grid-template-areas: "story" "code" "mem"; }
  .wide .player .ln { font-size: 14px; }
  .wide .player { --line-h: 32px; }
}
@media (max-width: 520px) {
  .wide { padding: 0 12px; }
}

/* long code lines scroll instead of being cut off */
.player .code { overflow-x: auto; overflow-y: hidden; }

/* ================= C extras: input, structs, 2D arrays, heap ================= */
.oline.in { color: var(--accent); }
.oline.in::before { content: "input: "; color: var(--faint); font-size: 0.85em; }
.sbox { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.fld { display: flex; align-items: center; gap: 8px; }
.fname { font: 12px var(--mono); color: var(--muted); min-width: 40px; }
.wide .player .fbox, .fbox { height: 34px; min-width: 60px; font-size: 15px; }
.fld.chg .fbox:not(.is-ptr) { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.list.matrix { display: flex; flex-direction: column; gap: 6px; padding-bottom: 4px; }
.mrow { display: flex; gap: 6px; align-items: center; }
.ridx { font: 10px var(--mono); color: var(--faint); width: 10px; }
.frame.heap { border-style: dashed; border-color: var(--accent); background: var(--accent-bg); }
.frame.heap .frame-h { color: var(--accent); }
.frame.global { border-color: var(--warn-border, var(--border-strong)); }
.frame.file { border-style: dotted; }

/* ================= code fit + panel views ================= */
.player { --code-fs: 15px; }
.wide .player { --code-fs: 16.5px; }
.player .code .ln { font-size: var(--code-fs) !important; }
.player .code { scrollbar-width: thin; }

.views { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 11px; overflow: hidden; height: 44px; }
.chip { border: 0; background: var(--surface); color: var(--muted); font: 600 14px var(--font); padding: 0 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip + .chip { border-left: 1px solid var(--border-strong); }
.chip::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 2px solid currentColor; box-sizing: border-box; }
.chip.on { background: var(--accent-bg); color: var(--accent); }
.chip.on::before { background: currentColor; box-shadow: inset 0 0 0 2px var(--accent-bg); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Code is always shown. Real life and/or Memory can be hidden. */
.player.has-story.no-story .pane-story { display: none; }
.player.has-story.no-mem .pane-mem { display: none; }
.player.has-story.no-story .world { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: none; }
.player.has-story.no-mem .world { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); grid-template-areas: none; }
.player.has-story.no-story.no-mem .world { grid-template-columns: minmax(0, 1fr); }
.player.has-story.no-story .pane, .player.has-story.no-mem .pane { grid-area: auto; }
.pane-code .story-out { margin-top: auto; }
@media (max-width: 860px) {
  .player.has-story.no-story .world, .player.has-story.no-mem .world { grid-template-columns: minmax(0, 1fr); }
  .wide .player { --code-fs: 14px; }
}

/* code zoom buttons */
.zoom { display: inline-flex; margin-left: auto; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.zoom button { border: 0; background: var(--surface); color: var(--text); font: 600 13px var(--font); min-width: 30px; height: 28px; padding: 0 8px; cursor: pointer; }
.zoom button + button { border-left: 1px solid var(--border-strong); }
.zoom button:hover { background: var(--surface-2); }
.zoom button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.zoom [data-z="0"] { min-width: 52px; font-variant-numeric: tabular-nums; }
.pane-code .zoom + .pill { margin-left: 8px; }

/* arrays stay on one row; long ones scroll sideways and use narrower boxes */
.row { min-width: 0; }
.vbody { flex: 1 1 auto; max-width: 100%; }
.list { max-width: 100%; overflow-x: auto; overflow-y: visible; scrollbar-width: thin; padding-top: 12px; margin-top: -12px; padding-right: 22px; padding-left: 10px; } /* room for a marker that springs past the first or last cell */
.list.dense .cell { width: 44px; font-size: 14px; }
.is-c .list.dense .cell { width: 50px; }
.list.dense .caddr { font-size: 8.5px; }
.oline.in.has-prompt { color: var(--text); }
.oline.in.has-prompt::before { content: none; }
.oline .typed { color: var(--accent); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 4px; }

/* long type names (vector<int>, struct Node*) wrap instead of being cut */
.vname { width: auto; min-width: 58px; max-width: 96px; }
.vname small { overflow-wrap: anywhere; line-height: 1.2; }

/* long arrays: name above, cells use the full panel width */
.row:has(.list.dense) { flex-direction: column; gap: 2px; }
.row:has(.list.dense) .vname { flex-direction: row; align-items: baseline; gap: 8px; min-height: 0; max-width: none; }
.row:has(.list.dense) .vbody { width: 100%; }
.list.dense .cell, .is-c .list.dense .cell { width: 40px; }
.list.dense .cells { gap: 4px; }
.s-liq.water, .s-stream.water { fill: #5BB7F0; fill-opacity: 0.85; }

/* full screen: the player alone fills the screen */
.player.is-full, .player:fullscreen { background: var(--bg); padding: 16px; overflow: auto; box-sizing: border-box; }
.player.is-full .pane { min-height: var(--pane-min, 60vh); }
.full-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wide .player .scene { max-height: var(--scene-max, none); }
.player.pseudo-full { position: fixed; inset: 0; z-index: 1000; margin: 0; }
html.player-full, html.player-full body { overflow: hidden; }

/* panels side by side (or full screen): the real-life scene gets all the spare height,
   the output is a compact box that scrolls to its newest line */
.player.fit-h .pane-story { display: flex; flex-direction: column; }
.player.fit-h .story { flex: 1 1 0; display: flex; flex-direction: column; min-height: 0; }
.player.fit-h .story .scene { flex: 1 1 0; aspect-ratio: auto; height: auto; min-height: 200px; max-height: none; }
.player.fit-h .story-out { flex: 0 0 auto; padding-bottom: 10px; }
.player.fit-h .story-out .pane-h { padding-top: 8px; padding-bottom: 6px; }
.player.fit-h .story-out .console { flex: none; height: 92px; min-height: 0; overflow-y: auto; }

/* ================= scene player (maths, science, physics) ================= */
.sp { display: flex; flex-direction: column; gap: 12px; }
.sp-frame { width: 100%; display: flex; justify-content: center; }
.sp-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); container-type: inline-size; }
.sp-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sp-layer { position: absolute; inset: 0; pointer-events: none; }
.sp-card { position: absolute; padding: 0.7cqw 1.4cqw; border-radius: 1.2cqw; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 2px solid var(--accent-border); box-shadow: 0 10px 30px -14px rgba(40, 30, 120, 0.45); font: 700 clamp(12px, 1.7cqw, 44px) var(--mono); color: var(--text); white-space: nowrap; text-align: center; }
.sp-card.title { font: 800 clamp(16px, 3.4cqw, 90px) var(--font); border: 0; background: color-mix(in srgb, var(--surface) 85%, transparent); }
.sp-card.mini { font-size: clamp(11px, 1.4cqw, 36px); border-color: var(--border-strong); }
.sp-card.formula { font-size: clamp(13px, 2.1cqw, 56px); border-color: var(--accent); }
.sp-card .k { color: var(--accent); }
.sp-card .slot { display: inline-block; min-width: 2.2ch; padding: 0 0.3ch; border-bottom: 2px dashed var(--accent); color: var(--accent); }
.sp-card .slot.filled { border-bottom-color: transparent; background: var(--accent-bg); border-radius: 0.4ch; }
.sp-card .big { color: var(--ok); }
.sp-bars { display: grid; gap: 0.6cqw; width: 40cqw; text-align: left; font: 600 clamp(11px, 1.3cqw, 34px) var(--font); }
.sp-bar { display: grid; grid-template-columns: 7em 1fr 4.5em; align-items: center; gap: 0.8cqw; }
.sp-bar i { display: block; height: 1.3cqw; min-height: 8px; border-radius: 99px; background: var(--accent); width: 0; }
.sp-tok { position: absolute; padding: 0.4cqw 1cqw; border-radius: 0.9cqw; background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); font: 800 clamp(12px, 1.6cqw, 42px) var(--mono); box-shadow: 0 6px 18px rgba(16, 133, 90, 0.25); white-space: nowrap; z-index: 5; }
.sp-ask { position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); width: min(92%, 62cqw); padding: 1.4cqw 1.8cqw; border-radius: 1.4cqw; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 18px 40px -18px rgba(40, 30, 120, 0.55); z-index: 6; display: flex; flex-direction: column; gap: 1cqw; }
.sp-q { margin: 0; font: 700 clamp(14px, 1.8cqw, 46px) var(--font); color: var(--text); }
.sp-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9em), 1fr)); gap: 0.8cqw; }
.sp-opt { font: 700 clamp(13px, 1.6cqw, 42px) var(--font); padding: 0.9cqw 1cqw; border-radius: 1cqw; border: 2px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; }
.sp-opt:hover:not(:disabled) { border-color: var(--accent); }
.sp-opt.right { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.sp-opt.wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.sp-explain { margin: 0; font: 500 clamp(13px, 1.5cqw, 40px) var(--font); }
.sp-explain.ok { color: var(--ok); } .sp-explain.bad { color: var(--bad); }
.sp-continue { align-self: flex-end; font-size: clamp(13px, 1.4cqw, 36px); }
.sp-range-row { display: flex; align-items: center; gap: 1.4cqw; }
.sp-range-row input { flex: 1; accent-color: var(--accent); height: 2cqw; min-height: 18px; }
.sp-val { font: 800 clamp(14px, 1.9cqw, 48px) var(--mono); color: var(--accent); min-width: 5ch; text-align: right; }
.sp-say { margin: 0; padding: 12px 20px; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 14px 14px 0; font-size: clamp(15px, 1.1vw, 30px); line-height: 1.5; min-height: 3em; }
.sp-say code { background: var(--accent-bg); color: var(--accent); padding: 1px 6px; border-radius: 6px; font-family: var(--mono); }
.sp-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sp-dots { flex: 1; display: flex; gap: 6px; align-items: center; min-width: 160px; }
.sp-dot { flex: 1; height: 8px; border-radius: 99px; border: 0; background: var(--border-strong); cursor: pointer; padding: 0; }
.sp-dot.done { background: var(--accent-border); }
.sp-dot.on { background: var(--accent); }
.sp-dot.q, .sp-dot.s { height: 14px; flex: 0 0 14px; border-radius: 50%; }
.sp-dot.q.done, .sp-dot.s.done { background: var(--ok); }
.sp-controls .full-btn svg, .sp-controls .btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sp-controls .play svg { fill: currentColor; stroke: none; }
.sp.is-full { background: var(--bg); padding: 16px; box-sizing: border-box; overflow: auto; }
.sp.pseudo-full { position: fixed; inset: 0; z-index: 1000; margin: 0; }
/* a slider sits up in the sky so the scene it changes stays in view */
.sp-ask.sp-play { top: 3%; bottom: auto; width: min(92%, 44cqw); }
.sp { container-type: inline-size; }
.sp-ask.below { position: static; transform: none; width: auto; left: auto; bottom: auto; top: auto; padding: 14px 16px; border-radius: 14px; gap: 10px; }
.sp-ask.below .sp-q { font-size: 16px; } .sp-ask.below .sp-opt { font-size: 15px; padding: 10px; border-radius: 10px; }
.sp-ask.below .sp-explain { font-size: 14px; } .sp-ask.below .sp-continue { font-size: 15px; }
.sp-ask.below .sp-opts { gap: 8px; } .sp-ask.below .sp-range-row input { height: 24px; } .sp-ask.below .sp-val { font-size: 18px; }
/* calm stage: small labels in the world, a compact slider under the formula */
.sp-tag { fill: rgba(255, 255, 255, 0.92); stroke: rgba(30, 34, 60, 0.18); stroke-width: 1; }
.sp-tag-t { font: 700 11px var(--font); fill: #2b2f45; letter-spacing: 0.02em; }
.sp-tag.sp-tag-hot { fill: var(--c-sun-hi); stroke: var(--c-sun-lo); }
.sp-ask.sp-play { top: 25%; width: min(92%, 46cqw); padding: 1cqw 1.4cqw; gap: 0.6cqw; }
.sp-play .sp-q { font-size: clamp(12px, 1.35cqw, 36px); font-weight: 600; color: var(--muted); }
.sp-play .sp-range-row .sp-continue { margin-left: 0.6cqw; }
.sp-play.below .sp-range-row { flex-wrap: wrap; }
/* questions float in the sky too, so the scene they ask about stays visible */
.sp-ask:not(.sp-play):not(.below) { top: 6%; bottom: auto; }
/* "do it yourself" shots: draggable things glow and the cursor shows a hand */
.sp-drag { cursor: grab; touch-action: none; filter: drop-shadow(0 0 6px rgba(124, 92, 255, 0.85)); }
.sp-drag.grabbing { cursor: grabbing; filter: drop-shadow(0 8px 10px rgba(40, 30, 120, 0.45)); }
.sp-ask.sp-do { top: 4%; bottom: auto; width: min(92%, 52cqw); }
.sp-do-row { display: flex; gap: 0.8cqw; justify-content: flex-end; }
.sp-do-row .btn { font-size: clamp(13px, 1.3cqw, 34px); }
.sp-hint { color: var(--muted); }
.sp-card .bad { color: var(--bad); }
.sp-ask.at-bottom:not(.below) { top: auto; bottom: 3%; }
/* phones: the panel sits under the stage at full width, with roomy buttons */
.sp-ask.sp-do.below, .sp-ask.sp-play.below { width: auto; }
.sp-ask.below .sp-do-row { gap: 10px; }
.sp-ask.below .sp-do-row .btn { font-size: 15px; white-space: nowrap; }
.sp-ask.below .sp-hint { font-size: 14px; }

/* ---------- SQL lessons: tables and queries on the stage ---------- */
.sp-card.tbl { padding: 0.5cqw; border-radius: 1.2cqw; }
table.sq { border-collapse: separate; border-spacing: 0; font: 600 clamp(12px, 2.05cqw, 46px) var(--font); color: #2b2f45; background: #fff; border-radius: 0.9cqw; overflow: hidden; }
table.sq th { background: var(--c-grape-base); color: #fff; padding: 0.55cqw 1.3cqw; text-align: left; font-weight: 800; transition: background 0.35s, color 0.35s, opacity 0.35s; }
table.sq td { padding: 0.5cqw 1.3cqw; border-top: 1px solid #eef0f6; transition: background 0.35s, opacity 0.35s, color 0.35s; white-space: nowrap; }
table.sq tbody tr:nth-child(even) td { background: #f8f9fd; }
table.sq tr.hit td { background: #d3f9e3 !important; color: #0b6b3a; }
table.sq tr.miss td { opacity: 0.22; }
table.sq tr.new td { background: #fff3c4 !important; }
table.sq td.on { background: #fff3c4 !important; }
table.sq th.on { background: #f5b400; color: #2b1d00; }
table.sq .dim { opacity: 0.2; }
table.sq td.bad { background: #ffe1e1 !important; color: #b42318; }
table.sq tr.g1 td { box-shadow: inset 0.35cqw 0 0 var(--c-sky-base); }
table.sq tr.g2 td { box-shadow: inset 0.35cqw 0 0 var(--c-coral-base); }
table.sq tr.g3 td { box-shadow: inset 0.35cqw 0 0 var(--c-mint-base); }
.sq-cap { font-size: clamp(10px, 1.4cqw, 32px); font-weight: 800; color: var(--muted); margin: 0 0 0.3cqw 0.3cqw; letter-spacing: 0.04em; text-transform: uppercase; }
.sq-q { font-family: var(--mono); font-size: clamp(11px, 1.55cqw, 38px); white-space: normal; max-width: 90cqw; text-align: center; line-height: 1.5; color: #2b2f45; }
.sq-q .kw { color: var(--accent); font-weight: 800; }
.sq-q .cl { border-radius: 0.4cqw; padding: 0.1cqw 0.3cqw; transition: background 0.3s, box-shadow 0.3s; }
.sq-q .cl.on { background: #fff3c4; box-shadow: 0 0 0 2px var(--c-sun-base); }
.sq-q .str { color: #c2410c; }
.sq-res { display: flex; flex-direction: column; gap: 0.35cqw; min-width: 9cqw; }
.sq-res .row { font: 700 clamp(12px, 1.9cqw, 44px) var(--font); background: #d3f9e3; color: #0b6b3a; border-radius: 0.6cqw; padding: 0.3cqw 0.8cqw; }
.sq-big { font: 800 clamp(16px, 3cqw, 70px) var(--mono); color: var(--accent); }
table.sq td.ix { color: #9aa3b5; font-weight: 700; background: #f3f4f8 !important; }

/* ---------- OS lessons: layers, chips, states ---------- */
.os-layer { min-width: 50cqw; text-align: center; }
.os-layer .sq-cap { text-align: center; }
.os-chips { display: flex; gap: 1cqw; justify-content: center; flex-wrap: wrap; }
.os-chip { display: inline-block; font: 800 clamp(11px, 1.7cqw, 40px) var(--font); padding: 0.5cqw 1.2cqw; border-radius: 99px; background: #eef0fb; color: #2b2f45; transition: background 0.3s, color 0.3s, transform 0.3s; }
.os-chip.app { background: color-mix(in srgb, var(--c-sky-base) 25%, #fff); }
.os-chip.hw { background: color-mix(in srgb, var(--c-steel-base) 25%, #fff); }
.os-chip.on { background: var(--c-sun-base); color: #3d2a00; transform: scale(1.08); }
.os-chip.bad { background: #ffe1e1; color: #b42318; }
.os-mgr { font: 800 clamp(13px, 2.2cqw, 52px) var(--font); color: var(--accent); }
.os-state { font: 800 clamp(11px, 1.7cqw, 40px) var(--font); color: #2b2f45; padding: 0.4cqw 1.2cqw; transition: background 0.3s, color 0.3s; }
.sp-card.os-state.on { background: var(--c-sun-base); }
.sp-card.os-proc { background: var(--c-grape-base); color: #fff; font: 800 clamp(11px, 1.6cqw, 38px) var(--mono); padding: 0.3cqw 1cqw; border-radius: 99px; }
.sp-card.os-proc.child { background: var(--c-coral-base); }
.os-pcb { font: 600 clamp(10px, 1.4cqw, 32px) var(--mono); text-align: left; line-height: 1.6; }
.os-pcb b { color: var(--accent); }
.os-out { font: 700 clamp(11px, 1.6cqw, 38px) var(--mono); background: #12162a; color: #7cffb2; text-align: left; min-width: 10cqw; }
.sc-item-t { font: 800 12.5px var(--font); fill: #2b2f45; text-anchor: middle; }
