/* /studio: the class build tool, dressed as part of jasonlau.academy (site.css, home.css, home-motion.css):
   paper and ink, Bricolage display type, Silkscreen pixel labels, retro window chrome, CRT panels and the
   rotating palette from /assets/theme.js. Palette colours decorate; functional colours (status, errors,
   path states) never depend on them. Self contained: no site.css or play.css, so class names never collide.
   The page CSP allows no inline styles, so every position and variant here is a class. */

:root {
  color-scheme: light;
  /* Palette fallback (violet and lime). /assets/theme.js sets one of four sets per visit. */
  --hero: #5800FF; --on-hero: #FFFFFF; --mark: #C6FF3D; --on-mark: #16130E;
  --b2: #5800FF; --on-b2: #FFFFFF; --btn: #5800FF; --on-btn: #FFFFFF; --accent: #5800FF;
  --ink: #16130E; --paper: #FFFAF0; --cream: #FFF8EA; --white: #FFFFFF; --muted: #574F42; --rule: #BEB5A6;
  /* The dark panels: terminal, code editor, build covers. */
  --crt: #0F0D0A; --crt-2: #191610; --crt-line: #2F2A21; --crt-text: #F3EEE3; --crt-muted: #A8A192;
  --ok-dark: #7EE2A8; --warn-dark: #FFB86B; --danger: #A62A12; --danger-bg: #FFE9E3; --caution: #FFD23F;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --pixel: "Silkscreen", ui-monospace, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --pop: cubic-bezier(.22, 1.55, .36, 1);
  --t-fill: 450ms; --t-lift: 220ms; --t-press: 90ms;
  --bar-h: 64px;
  --gutter: max(clamp(16px, 4vw, 54px), env(safe-area-inset-left, 0px)); /* the page side margin */
  --overlap: 56px; /* phones: how far the sign in card rises into the band */
}

/* Anything the scripts hide must really hide, whatever display a class sets (.btn, .google-block, selects). */
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-padding-top: calc(var(--bar-h) + 12px); }
body {
  min-height: 100vh; background-color: var(--paper); color: var(--ink); font: 400 1rem/1.55 var(--body);
  /* Engineering paper: a faint ink dot grid. */
  background-image: radial-gradient(circle at 1px 1px, rgb(22 19 14 / .14) 1px, transparent 1.5px);
  background-size: 24px 24px;
}
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1.02; letter-spacing: -.03em; text-wrap: balance; }
p { margin: 0; }
::selection { background: var(--mark); color: var(--on-mark); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -80px; z-index: 60; padding: 10px 16px; border-radius: 6px; background: var(--ink); color: var(--cream); font-weight: 700; text-decoration: none; }
.skip:focus { top: 10px; }

/* ---------- top bar: the academy header, with Studio in the wordmark slot ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--bar-h); background: var(--paper); border-bottom: 1px solid var(--ink); }
.topbar-in { display: flex; align-items: center; gap: 16px; height: 100%; max-width: 1760px; margin-inline: auto; padding-inline: max(clamp(16px, 3vw, 40px), env(safe-area-inset-left, 0px)); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; flex-shrink: 0; text-decoration: none; }
.brand-mark { display: block; width: 40px; height: 40px; flex: none; }
.wordmark { display: grid; gap: 4px; font: 800 1.2rem/1 var(--display); letter-spacing: -.035em; white-space: nowrap; }
.wordmark-sub { color: #5800FF; font: 700 .6rem/1 var(--body); letter-spacing: .24em; text-transform: uppercase; }
.who { min-width: 0; max-width: 34ch; padding: 7px 12px 7px 10px; overflow: hidden; border: 1px solid var(--ink); border-radius: 999px; background: var(--white); font: 400 .8rem/1 var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.who::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px; background: var(--hero); vertical-align: 1px; }
.who b { font-weight: 700; }
.topnav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px; font-weight: 700; font-size: .95rem; text-decoration: none; }
.topnav a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }

/* ---------- shared pieces ---------- */
.kicker { display: inline-block; padding: 8px 11px 7px; border-radius: 4px; background: var(--ink); color: var(--mark); font: 400 .72rem/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
.eyebrow { color: var(--accent); font: 700 .74rem/1.35 var(--body); letter-spacing: .12em; text-transform: uppercase; }
.hint { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.note { color: var(--muted); font-size: .92rem; }
.error { margin: 6px 0 0; color: var(--danger); font-weight: 700; font-size: .92rem; }
.error:not(:empty)::before { content: "! "; }
.error:empty { margin: 0; }

/* A saturated band in the visit's palette, with the homepage hero's scanlines and vignette. */
.band { position: relative; isolation: isolate; overflow: hidden; background: var(--hero); color: var(--on-hero); border-bottom: 2px solid var(--ink); }
.band::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / .07) 0 1px, transparent 1px 3px), radial-gradient(120% 90% at 50% 45%, transparent 55%, rgb(0 0 0 / .24) 100%); }
.band :focus-visible { outline-color: var(--on-hero); }

/* Retro window chrome from the homepage (.m-win): ink frame, hard shadow, a pixel title bar. */
.win { position: relative; overflow: hidden; background: var(--white); color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 7px 7px 0 var(--ink); }
.win-bar { position: relative; display: flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 44px; background: var(--b2); color: var(--on-b2); border-bottom: 2px solid var(--ink); font: 400 .68rem/1 var(--pixel); letter-spacing: .06em; }
.win-bar::before, .win-dots { width: 8px; height: 8px; background: currentColor; box-shadow: 12px 0 0 currentColor; opacity: .55; }
.win-bar::before { content: ""; position: absolute; left: 12px; top: 50%; margin-top: -4px; }
.win-bar::after { content: "[*]"; position: absolute; right: 12px; }
.win-body { padding: clamp(18px, 2.4vw, 26px); }

/* ---------- buttons: the site's fill from the left, lift and squash (transform only) ---------- */
.btn {
  --fill: var(--mark); --fill-text: var(--on-mark);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border: 2px solid var(--ink); border-radius: 6px;
  background: var(--white); color: var(--ink); box-shadow: 3px 3px 0 var(--ink);
  font: 700 1rem/1.15 var(--body); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform var(--t-lift) var(--ease-out), color var(--t-fill) var(--ease-out);
}
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fill); transform: scaleX(0); transform-origin: right center; transition: transform var(--t-fill) var(--ease-out); }
.btn:focus-visible { color: var(--fill-text); }
.btn:focus-visible::before { transform: scaleX(1); transform-origin: left center; }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover { color: var(--fill-text); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
  .btn:not(:disabled):hover::before { transform: scaleX(1); transform-origin: left center; }
}
.btn:not(:disabled):active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); transition-duration: var(--t-press); }
.btn.primary { background: var(--btn); color: var(--on-btn); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: .92rem; }
.btn.wide { width: 100%; }
.btn.quiet { --fill: transparent; background: transparent; color: inherit; border-color: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: .22em; text-decoration-thickness: 1px; }
.btn.quiet:hover, .btn.quiet:focus-visible { color: inherit; box-shadow: none; text-decoration-thickness: 3px; }
.btn.quiet:active { box-shadow: none; }
.btn .ico, .btn .plus { font-weight: 400; line-height: 1; }
.btn .plus { font: 400 1.3rem/1 var(--display); }
.btn:disabled { cursor: progress; opacity: .7; }
/* Busy: a light sweep runs across a disabled button until the answer comes back (as on the site). */
.btn:disabled::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .5) 50%, transparent 70%); transform: translateX(-100%); animation: sweep 1.1s var(--ease-out) infinite; }
@keyframes sweep { to { transform: translateX(100%); } }

/* ---------- forms ---------- */
.fields { display: grid; gap: 6px; }
.fields h2, .google-block h2 { margin-bottom: 8px; font-size: 1.75rem; font-weight: 800; letter-spacing: -.045em; }
.fields label:not(.check) { margin-top: 10px; font-weight: 700; font-size: .95rem; }
.fields input:not([type="checkbox"]), .save-row input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); color: var(--ink);
  font: 400 1.05rem/1.2 var(--mono);
}
.fields input::placeholder, .save-row input::placeholder { color: #6F6656; opacity: 1; }
.fields input:hover, .save-row input:hover { background: var(--white); }
.fields input:focus-visible, .save-row input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; background: var(--white); }
.code-input { text-transform: uppercase; letter-spacing: .24em; }
.pin-input:not(:placeholder-shown) { letter-spacing: .5em; }
.fields .btn { margin-top: 16px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; font-size: .95rem; cursor: pointer; }
.check input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.fields .check { margin-top: 8px; }
.pin-confirm { display: grid; gap: 6px; }

/* ---------- sign in ----------
   One grid: the band is a background row as tall as the copy; the card starts in that row and hangs
   below it at any height (PIN form open or not), because the second row is the flexible one. */
.join {
  --card-w: clamp(330px, 34vw, 440px); --top: clamp(40px, 6vw, 80px);
  display: grid; grid-template-columns: minmax(var(--gutter), 1fr) minmax(0, 1132px) minmax(var(--gutter), 1fr); grid-template-rows: auto 1fr;
}
.join-band { grid-column: 1 / -1; grid-row: 1; }
.st { position: absolute; z-index: -2; width: var(--s, 84px); height: auto; image-rendering: pixelated; rotate: var(--r, 0deg); filter: drop-shadow(0 8px 0 rgb(0 0 0 / .2)); animation: st-in 700ms var(--pop) var(--d, 0ms) both; }
@keyframes st-in { from { opacity: 0; transform: translateY(20px) scale(.55); } }
.st-make { --s: 92px; --r: -12deg; --d: 150ms; left: 2.5%; top: 16%; }
.st-laptop { --s: 84px; --r: 8deg; --d: 260ms; left: 4%; bottom: 12%; }
.st-fix { --s: 84px; --r: 11deg; --d: 200ms; right: 2%; top: 12%; }
.st-ship { --s: 96px; --r: -7deg; --d: 320ms; right: 3%; bottom: 18%; }
.st-spark { --s: 52px; --d: 420ms; left: 47%; top: 8%; }

.join-copy { position: relative; z-index: 1; grid-column: 2; grid-row: 1; justify-self: start; display: grid; justify-items: start; align-content: start; gap: 22px; width: min(100%, calc(100% - var(--card-w) - 56px)); padding-block: var(--top) calc(var(--top) + 8px); color: var(--on-hero); }
.join-copy h1 { position: relative; font-size: clamp(4.4rem, 1rem + 10vw, 9.4rem); line-height: .86; letter-spacing: -.065em; text-shadow: .045em .045em 0 var(--mark); }
/* The arrow cursor from the homepage art lands on the word once it has risen in. */
.join-copy h1::after { content: ""; position: absolute; right: -.4em; bottom: -.08em; width: .44em; aspect-ratio: 1; background: url("/assets/art/cursor.svg") center / contain no-repeat; image-rendering: pixelated; animation: st-in 600ms var(--pop) 750ms both; }
.rise { display: block; overflow: hidden; padding: 0 .08em .12em; margin: 0 -.08em -.12em; }
.rise > span { display: inline-block; animation: rise 900ms var(--ease-out) both; }
@keyframes rise { from { transform: translateY(104%); } }
.lede { max-width: 31em; font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem); line-height: 1.5; }

.join-card { z-index: 2; grid-column: 2; grid-row: 1 / 3; justify-self: end; align-self: start; width: var(--card-w); margin: calc(var(--top) + 44px) 0 72px; animation: card-in 700ms var(--ease-out) 120ms both; }
@keyframes card-in { from { opacity: 0; transform: translateY(28px); } }
.google-block { display: grid; gap: 12px; }
.btn.google-btn { --fill: var(--mark); --fill-text: var(--on-mark); width: 100%; min-height: 58px; background: var(--ink); color: var(--cream); font-size: 1.05rem; }
.g-logo { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 6px; background: var(--white); }
.g-logo svg { display: block; }
/* The PIN form folds under Google like the homepage FAQ: a plus that turns, an answer that slides in. */
.pin-signin { margin-top: 18px; border-top: 1px dashed var(--ink); }
.pin-signin > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding-top: 4px; font-weight: 700; cursor: pointer; list-style: none; border-radius: 4px; }
.pin-signin > summary::-webkit-details-marker { display: none; }
.pin-signin > summary::after { content: "+"; flex: none; font: 400 1.7rem/1 var(--display); transition: transform var(--t-lift) var(--ease-out); }
.pin-signin[open] > summary::after { transform: rotate(45deg); }
.pin-signin[open] > form { animation: slide-in 320ms var(--ease-out); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } }
.pin-signin.only { margin-top: 0; border-top: 0; }
.pin-signin.only > summary { display: none; }
/* With Google on, the summary already says what the form is; one "Sign in" heading is enough. */
.google-block:not([hidden]) + .pin-signin form > h2 { display: none; }
.continue { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--ink); }
.continue h2 { margin-bottom: 10px; font-size: 1.2rem; font-weight: 800; }
.continue-list { margin: 0 0 10px; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.continue-list li { border-bottom: 1px solid var(--rule); }
.continue-list a { position: relative; isolation: isolate; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 6px; font: 700 .98rem/1.2 var(--mono); text-decoration: none; overflow-wrap: anywhere; }
.continue-list a::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--mark); transform: scaleX(0); transform-origin: right center; transition: transform var(--t-fill) var(--ease-out); }
.continue-list a:hover::before, .continue-list a:focus-visible::before { transform: scaleX(1); transform-origin: left center; }
.continue-list small { flex: none; font: 400 .66rem/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
.continue-list small::after { content: " \2192"; font-family: var(--body); }
.continue .btn.quiet { padding-inline: 6px; }

.house { grid-column: 2; grid-row: 2; justify-self: start; align-content: start; display: grid; gap: 16px; width: min(100%, calc(100% - var(--card-w) - 56px)); padding-block: 44px 88px; }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; margin: 0; padding: 0; list-style: none; counter-reset: rule; }
.rules li { display: grid; grid-template-columns: 2.4rem 1fr; gap: 10px; padding: 14px 0 18px; border-top: 1px solid var(--ink); counter-increment: rule; }
.rules li::before { content: counter(rule, decimal-leading-zero); color: var(--accent); font: 400 .8rem/1.9 var(--pixel); }

/* ---------- page header band: student home and join a class ---------- */
.page-head-in { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 22px 32px; padding-block: clamp(30px, 4.4vw, 56px); }
.page-id { display: grid; justify-items: start; gap: 14px; min-width: 0; }
.page-id h1 { max-width: 100%; font-size: clamp(2.7rem, 1.4rem + 5.2vw, 5.8rem); line-height: .9; letter-spacing: -.055em; text-shadow: .045em .045em 0 var(--mark); overflow-wrap: anywhere; }
.page-id .hint { color: var(--on-hero); font-size: .95rem; }
#home-name:empty { min-height: .9em; }
/* A nickname is one word: a long one splits into two even lines (with text-wrap: balance), never one stray letter. */
#home-name { word-break: break-all; }
/* The name rises in when it arrives from the server (the element stops being :empty). */
#home-name:not(:empty), #class-title { animation: name-in 700ms var(--ease-out) both; }
@keyframes name-in { from { opacity: 0; transform: translateY(22px); } }
.home-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.home-actions .btn.quiet { padding-inline: 4px; }
.page-head .btn.primary { --fill: var(--mark); --fill-text: var(--on-mark); background: var(--ink); color: var(--cream); box-shadow: 4px 4px 0 var(--mark); }
@media (hover: hover) and (pointer: fine) { .page-head .btn.primary:hover { box-shadow: 6px 6px 0 var(--mark); } }
.page-head .btn.primary:active { box-shadow: 1px 1px 0 var(--mark); }
.class-switch {
  min-height: 40px; max-width: 100%; padding: 0 36px 0 12px; border: 2px solid var(--ink); border-radius: 6px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M0 0h12L6 8z' fill='%2316130E'/%3E%3C/svg%3E") no-repeat right 12px center / 10px;
  color: var(--ink); font: 700 .86rem/1 var(--mono); appearance: none;
}

/* ---------- student home ---------- */
.home-body { display: grid; gap: clamp(52px, 7vw, 88px); padding-block: clamp(36px, 5vw, 64px) 96px; }
.block-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 16px; margin-bottom: 26px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.block-head .eyebrow { grid-column: 1 / -1; font: 400 .72rem/1 var(--pixel); letter-spacing: .08em; }
.block-title { font-size: clamp(2.3rem, 1.6rem + 2.4vw, 3.5rem); line-height: .95; letter-spacing: -.05em; }

/* Builds: a portfolio of cards. Each card sits on a fixed ink shadow and lifts off it (transform only). */
.builds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 272px), 1fr)); gap: 28px 26px; margin: 0; padding: 0 7px 7px 0; list-style: none; }
.build { position: relative; display: flex; min-width: 0; animation: card-in 600ms var(--ease-out) both; }
.build:nth-child(2) { animation-delay: 60ms; } .build:nth-child(3) { animation-delay: 120ms; } .build:nth-child(4) { animation-delay: 180ms; } .build:nth-child(n+5) { animation-delay: 240ms; }
.build::before { content: ""; position: absolute; inset: 0; border-radius: 10px; background: var(--ink); transform: translate(7px, 7px); }
.build-card { position: relative; display: flex; flex: 1; flex-direction: column; min-width: 0; overflow: hidden; background: var(--white); border: 2px solid var(--ink); border-radius: 10px; transition: transform var(--t-lift) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .build:hover .build-card { transform: translate(-3px, -3px); } }
.build:focus-within .build-card { transform: translate(-3px, -3px); }
.build-cover { position: relative; isolation: isolate; height: 132px; overflow: hidden; background-color: var(--crt); border-bottom: 2px solid var(--ink); }
.build-cover::after { content: ""; position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(0deg, rgb(0 0 0 / .34) 0 1px, transparent 1px 3px); }
.build-glyph { position: absolute; z-index: 2; left: 16px; bottom: -.16em; color: var(--mark); font: 800 7rem/1 var(--display); letter-spacing: -.06em; text-shadow: .04em .04em 0 var(--ink); }
.cover-0 { background-image: linear-gradient(180deg, transparent 0 28%, color-mix(in srgb, var(--hero) 22%, var(--crt)) 28% 46%, color-mix(in srgb, var(--hero) 42%, var(--crt)) 46% 64%, color-mix(in srgb, var(--hero) 68%, var(--crt)) 64% 82%, var(--hero) 82%); }
.cover-1 { background-color: color-mix(in srgb, var(--hero) 30%, var(--crt)); background-image: linear-gradient(transparent 94%, color-mix(in srgb, var(--hero) 70%, transparent) 94%), linear-gradient(90deg, transparent 94%, color-mix(in srgb, var(--hero) 70%, transparent) 94%); background-size: 22px 22px; }
.cover-2 { background-image: repeating-linear-gradient(-45deg, var(--hero) 0 12px, transparent 12px 30px); }
.cover-3 { background-image: repeating-radial-gradient(circle at 88% 120%, var(--hero) 0 9px, transparent 9px 24px); }
.cover-4 { background-color: color-mix(in srgb, var(--hero) 18%, var(--crt)); background-image: radial-gradient(circle, var(--hero) 2.6px, transparent 3.2px); background-size: 15px 15px; }
.cover-5 { background-image: linear-gradient(112deg, transparent 0 52%, var(--hero) 52% 70%, color-mix(in srgb, var(--hero) 50%, var(--crt)) 70%); }
.cover-1 .build-glyph, .cover-4 .build-glyph { left: auto; right: 16px; }
.build-info { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 16px 18px 18px; }
.build-title { font-size: 1.4rem; font-weight: 800; line-height: 1.1; letter-spacing: -.04em; overflow-wrap: anywhere; }
.build-meta { color: var(--muted); font: 400 .78rem/1.45 var(--mono); }
.build-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 12px; }
.build.note { display: block; grid-column: 1 / -1; min-height: 96px; padding: 24px 24px 24px 100px; border: 2px dashed var(--ink); border-radius: 10px; color: var(--muted); font-weight: 500;
  background: var(--white) url("/assets/art/laptop-prompt.svg") 24px center / 56px no-repeat; image-rendering: pixelated; animation: none; }
.build.note::before { display: none; }
.build.note.is-loading { position: relative; overflow: hidden; }
.build.note.is-loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--hero) 14%, transparent) 50%, transparent 70%); transform: translateX(-100%); animation: sweep 1.3s var(--ease-out) infinite; }

/* Path: a progress meter, the next step, then the levels on a rail from Trial to Capstone. */
.path-count { grid-column: 2; padding-bottom: .35em; color: var(--muted); font: 700 .85rem/1 var(--mono); }
.path-meter { display: flex; grid-column: 1 / -1; gap: 3px; height: 12px; margin-top: 4px; }
.path-meter:empty { display: none; }
.seg { flex: 1; border: 1.5px solid var(--ink); border-radius: 2px; background: var(--white); transform-origin: left center; animation: seg-in 500ms var(--ease-out) both; }
.seg.earned { background: var(--hero); }
.seg.rematch { background: repeating-linear-gradient(-45deg, var(--ink) 0 2px, var(--caution) 2px 5px); }
.seg.locked { border-style: dotted; background: transparent; }
@keyframes seg-in { from { transform: scaleX(0); } }
.next-up { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 18px; margin-bottom: 30px; padding: 18px 22px; border: 2px solid var(--ink); border-radius: 10px; background: var(--ink); color: var(--cream); box-shadow: 6px 6px 0 var(--hero); }
.next-label { grid-row: span 2; padding: 9px 10px 8px; border-radius: 4px; background: var(--mark); color: var(--on-mark); font: 400 .72rem/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
#next-title { font: 800 clamp(1.2rem, 1rem + 1vw, 1.65rem)/1.1 var(--display); letter-spacing: -.035em; }
.next-why { color: #DAD3C4; font-size: .95rem; }

.path { display: grid; margin-bottom: 18px; }
.level { position: relative; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 14px 24px; padding: 20px 0; animation: card-in 600ms var(--ease-out) both; }
/* The rail: a connector from each level badge down to the next, solid once the level is done. */
.level:not(:last-child)::after { content: ""; position: absolute; left: 27px; top: 70px; bottom: -16px; border-left: 2px dashed var(--ink); }
.level.is-done:not(:last-child)::after { border-left-style: solid; }
.level:nth-child(2) { animation-delay: 80ms; } .level:nth-child(3) { animation-delay: 160ms; } .level:nth-child(4) { animation-delay: 240ms; }
.level-name { display: flex; align-items: center; align-self: start; gap: 12px; font-size: inherit; }
.level-num { position: relative; z-index: 1; display: grid; place-items: center; width: 56px; height: 42px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink); font: 400 1rem/1 var(--pixel); letter-spacing: 0; }
.level.is-done .level-num { background: var(--hero); color: var(--on-hero); }
.level.is-open .level-num { background: var(--mark); color: var(--on-mark); }
.level.is-locked .level-num { border-style: dotted; box-shadow: none; color: var(--muted); }
.level-label { font: 800 1.4rem/1 var(--display); letter-spacing: -.04em; }
.track-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr)); gap: 20px 16px; }
.track-name { margin: 0 0 8px; color: var(--accent); font: 700 .72rem/1.35 var(--body); letter-spacing: .1em; text-transform: uppercase; }
.nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.track .nodes { grid-template-columns: minmax(0, 1fr); }
.node { position: relative; display: grid; align-content: start; gap: 4px; min-height: 66px; padding: 10px 12px 11px; border: 2px solid var(--ink); border-radius: 8px; background: var(--white); }
.node-state { font: 400 .66rem/1.25 var(--pixel); letter-spacing: .06em; text-transform: uppercase; }
.node-title { font-size: .95rem; font-weight: 700; line-height: 1.3; }
.node-soon { color: var(--muted); font: 400 .74rem/1.3 var(--mono); }
.node.earned { background: var(--hero); color: var(--on-hero); box-shadow: 3px 3px 0 var(--ink); }
.node.earned .node-state::before { content: "\2713  "; font-family: var(--body); }
.node.open .node-state { color: var(--accent); }
/* Rematch due: caution tape across the top, so it reads as unfinished business, not a failure. */
.node.rematch { padding-top: 17px; border-style: dashed; }
.node.rematch::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px; border-radius: 5px 5px 0 0; background: repeating-linear-gradient(-45deg, var(--ink) 0 6px, var(--caution) 6px 12px); }
.node.rematch .node-state { justify-self: start; padding: 2px 5px 1px; border-radius: 3px; background: var(--caution); color: var(--ink); }
.node.locked { background: transparent; border-style: dotted; border-color: #857C6B; color: var(--muted); }
.path-note { max-width: 46em; }

/* ---------- join a class ---------- */
.class-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 32px 36px; align-items: start; padding-block: clamp(36px, 5vw, 60px) 96px; }
.class-win { animation: card-in 600ms var(--ease-out) both; }
.class-win + .class-win { animation-delay: 90ms; }
.win-alt { background: var(--cream); box-shadow: 4px 4px 0 var(--ink); }

/* ---------- the build studio ---------- */
.studio { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.28fr); grid-template-rows: minmax(0, 1fr) auto; gap: 18px 22px; height: calc(100dvh - var(--bar-h)); max-width: 1760px; margin: 0 auto; padding: 18px clamp(16px, 2vw, 30px) 16px; }

/* Terminal: the homepage's dark game.lab window, grown into a working tool. */
.term { display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--crt); color: var(--crt-text); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 6px 6px 0 var(--ink); }
.term-head { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 10px 6px 14px; background: var(--b2); color: var(--on-b2); border-bottom: 2px solid var(--ink); }
.win-dots { flex: none; margin-right: 12px; }
.term-title { font: 400 .8rem/1 var(--pixel); letter-spacing: .08em; }
.status { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; margin-left: auto; padding: 0 11px 0 9px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); font: 700 .78rem/1 var(--mono); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8A8170; }
.status.live::before { background: #1E9E5A; }
.status.busy { background: var(--mark); color: var(--on-mark); }
.status.busy::before { background: var(--ink); animation: blink 900ms steps(2, jump-none) infinite; }
.status.down { background: var(--danger-bg); color: var(--danger); }
.status.down::before { background: var(--danger); }
@keyframes blink { 50% { opacity: .15; } }
/* While the agent works, a light runs along the bottom of the title bar. */
.term-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; background: linear-gradient(90deg, transparent, var(--mark) 50%, transparent); opacity: 0; transform: translateX(-100%); }
.term-head:has(.status.busy)::after { opacity: 1; animation: sweep 1.2s var(--ease-out) infinite; }

.term-log { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 24px; font: 400 .9rem/1.65 var(--mono); scroll-behavior: smooth; scrollbar-color: #4A4337 var(--crt); }
.term-log:focus-visible { outline: 3px solid var(--mark); outline-offset: -5px; }
.line { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.line.t-you { margin-top: 22px; padding: 8px 12px; border-left: 3px solid var(--mark); border-radius: 0 6px 6px 0; background: rgb(255 255 255 / .06); color: #FFFFFF; font-weight: 700; }
.line.t-you:first-child { margin-top: 0; }
.line.t-you::before { content: "> "; color: var(--mark); }
.line.t-step { padding-left: 15px; color: var(--crt-muted); }
.line.t-step::before { content: "\00B7  "; }
.line.t-reply { margin-top: 10px; padding: 2px 0 2px 15px; border-left: 2px solid rgb(255 255 255 / .18); color: #EFE9DC; font: 400 1rem/1.6 var(--body); }
.line.t-reply::before { content: "agent"; display: block; margin-bottom: 4px; color: var(--mark); font: 400 .64rem/1.4 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
.line.t-reply.formatted { white-space: normal; }
.line.t-reply.formatted > * { margin: 0 0 8px; }
.line.t-reply.formatted > :last-child { margin-bottom: 0; }
.line.t-reply.formatted ul, .line.t-reply.formatted ol { padding-left: 1.3em; }
.line.t-reply.formatted li + li { margin-top: 3px; }
.line.t-reply.formatted li::marker { color: var(--mark); }
.line.t-reply.formatted strong { color: #FFFFFF; }
.line.t-reply.formatted code { padding: 1px 5px; border-radius: 4px; background: rgb(255 255 255 / .1); font: 400 .88em/1 var(--mono); }
.line.t-changed { padding-left: 15px; color: var(--ok-dark); }
.line.t-changed::before { content: "\2713  "; }
.line.t-notice { margin-top: 10px; color: var(--warn-dark); }
.line.t-notice::before { content: "! "; font-weight: 700; }
.line.t-welcome { max-width: 34em; padding-top: 8px; color: var(--crt-muted); font: 400 1rem/1.6 var(--body); }
.line.t-welcome::before { content: ""; display: block; width: 64px; height: 64px; margin-bottom: 14px; background: url("/assets/art/laptop-prompt.svg") center / contain no-repeat; image-rendering: pixelated; }
.line.t-welcome b { color: var(--mark); font-weight: 700; }

.term-input { display: flex; align-items: flex-end; gap: 10px; padding: 12px 14px; border-top: 2px solid var(--crt-line); background: var(--crt-2); }
.term-input .caret { color: var(--mark); font: 700 1.1rem/46px var(--mono); }
/* The prompt box grows with what is typed (where the browser can), up to a third of the screen. */
.term-input textarea { field-sizing: content; flex: 1; min-width: 0; min-height: 70px; max-height: 30vh; padding: 11px 12px; resize: none; border: 2px solid #3E382D; border-radius: 6px; background: var(--crt); color: var(--crt-text); font: 400 .95rem/1.45 var(--mono); caret-color: var(--mark); }
.term-input textarea::placeholder { color: #8F8778; opacity: 1; }
.term-input textarea:hover { border-color: #5C5446; }
.term-input textarea:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; border-color: var(--mark); }
.term .btn { box-shadow: none; }
.term-input .btn { min-height: 46px; }
.term .btn:focus-visible { outline-color: var(--mark); }
@media (hover: hover) and (pointer: fine) { .term .btn:hover { box-shadow: none; } }
.term .btn:active { box-shadow: none; }
.term .btn.primary { --fill: var(--cream); --fill-text: var(--ink); background: var(--mark); color: var(--on-mark); border-color: var(--mark); }
.term .btn.stop { --fill: rgb(255 122 102 / .18); --fill-text: #FFB4A8; background: transparent; color: #FFB4A8; border-color: #FF7A66; }
.term .btn.stop:focus-visible { outline-color: #FF7A66; }
.term-hint { padding: 0 14px 12px; background: var(--crt-2); color: var(--crt-muted); font: 400 .74rem/1.5 var(--mono); }

/* Your app: a white window whose tabs are folder tabs on the title bar. */
.side { container-type: inline-size; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; background: var(--white); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 6px 6px 0 var(--ink); }
.tabs { display: flex; align-items: flex-end; gap: 4px; padding: 8px 10px 0; background: var(--b2); border-bottom: 2px solid var(--ink); }
.tab { position: relative; min-height: 38px; margin-bottom: -2px; padding: 0 16px; white-space: nowrap; border: 2px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0; background: transparent; color: var(--on-b2); font: 700 .92rem/1 var(--body); cursor: pointer; }
.tab:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.tab[aria-selected="true"] { background: var(--white); color: var(--ink); border-color: var(--ink); text-decoration: none; }
.tab:focus-visible { outline: 3px solid var(--ink); outline-offset: -7px; }
.tab:not([aria-selected="true"]):focus-visible { outline-color: var(--on-b2); }
.tabpanel { display: flex; flex: 1; flex-direction: column; gap: 12px; min-height: 0; padding: 14px; overflow: auto; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .btn { box-shadow: 2px 2px 0 var(--ink); }
.toolbar-fill { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 96px; min-height: 40px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--muted); font: 400 .64rem/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.toolbar-fill::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #8A8170; }
.studio:has(.status.live) .toolbar-fill::before { background: #1E9E5A; }
.studio:has(.status.busy) .toolbar-fill::before { background: var(--hero); animation: blink 900ms steps(2, jump-none) infinite; }
/* The address pill is decoration: it steps aside before the real buttons would wrap. */
@container (max-width: 640px) { .toolbar-fill { display: none; } }
.preview-frame { flex: 1; min-height: 320px; overflow: hidden; border: 2px solid var(--ink); border-radius: 8px; background: var(--white); }
.preview-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--white); }

.file-list { display: flex; flex-wrap: wrap; gap: 8px; }
.file-list button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 6px; background: var(--white); box-shadow: 2px 2px 0 var(--ink); font: 700 .86rem/1 var(--mono); cursor: pointer; transition: transform var(--t-lift) var(--ease-out); }
.file-list button::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 2px; background: #8A8170; }
.file-list button[data-ext="html"]::before { background: #E8572A; }
.file-list button[data-ext="css"]::before { background: #2D7FF9; }
.file-list button[data-ext="js"]::before { background: #E9B400; }
.file-list button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
@media (hover: hover) and (pointer: fine) { .file-list button:hover { transform: translateY(-2px); } }
.file-list button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.editor { display: flex; flex: 1; flex-direction: column; gap: 10px; min-height: 0; }
.editor textarea.code { flex: 1; width: 100%; min-height: 280px; padding: 14px 16px; resize: vertical; border: 2px solid var(--ink); border-radius: 8px; background: var(--crt); color: var(--crt-text); font: 400 .86rem/1.6 var(--mono); tab-size: 2; white-space: pre; overflow: auto; caret-color: var(--mark); }
.editor textarea.code:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.save-row { flex-wrap: nowrap; }
.save-row input { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; font: 500 1rem/1.2 var(--body); }
.save-row .btn { flex: none; }
.saves { position: relative; display: grid; gap: 10px; margin: 0; padding: 0 0 0 24px; list-style: none; }
.saves:empty { display: none; }
.saves::before { content: ""; position: absolute; left: 7px; top: 12px; bottom: 12px; border-left: 2px dashed var(--ink); }
.saves li { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border: 2px solid var(--ink); border-radius: 8px; background: var(--white); }
.saves li::before { content: ""; position: absolute; left: -24px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 2px solid var(--ink); border-radius: 3px; background: var(--hero); }
.saves li span { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.saves li small { display: block; margin-top: 2px; color: var(--muted); font: 400 .74rem/1.4 var(--mono); }
.saves .btn { box-shadow: 2px 2px 0 var(--ink); }

/* The project link: a dark strip like the homepage's jump dock. */
.linkbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 8px 8px 18px; border: 2px solid var(--ink); border-radius: 10px; background: var(--ink); color: var(--cream); }
.linkbar-label { color: #DAD3C4; font-size: .88rem; font-weight: 500; }
.linkbar code { flex: 1; min-width: 0; color: var(--cream); font: 400 .82rem/1.4 var(--mono); overflow-wrap: anywhere; }
.linkbar .btn { --fill: var(--cream); --fill-text: var(--ink); background: var(--mark); color: var(--on-mark); border-color: var(--mark); box-shadow: none; }
.linkbar .btn:focus-visible { outline-color: var(--mark); }
@media (hover: hover) and (pointer: fine) { .linkbar .btn:hover { box-shadow: none; } }

/* ---------- lessons: cards on the student home ----------
   Same family as the build cards: a white card lifting off a fixed ink shadow, with a tinted top strip. */
.lessons-hint { max-width: 46em; margin: -10px 0 22px; }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 26px 24px; margin: 0; padding: 0 7px 7px 0; list-style: none; }
.lesson-card { position: relative; display: flex; min-width: 0; animation: card-in 600ms var(--ease-out) both; }
.lesson-card:nth-child(2) { animation-delay: 50ms; } .lesson-card:nth-child(3) { animation-delay: 100ms; } .lesson-card:nth-child(4) { animation-delay: 150ms; } .lesson-card:nth-child(n+5) { animation-delay: 200ms; }
.lesson-card::before { content: ""; position: absolute; inset: 0; border-radius: 10px; background: var(--ink); transform: translate(7px, 7px); }
.lesson-card-in { position: relative; display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; overflow: hidden; padding: 0 18px 18px; background: var(--white); border: 2px solid var(--ink); border-radius: 10px; transition: transform var(--t-lift) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .lesson-card:hover .lesson-card-in { transform: translate(-3px, -3px); } }
.lesson-card:focus-within .lesson-card-in { transform: translate(-3px, -3px); }
.lesson-card-top { display: flex; align-items: center; gap: 10px; margin: 0 -18px 6px; padding: 12px 14px 12px 12px; background: color-mix(in srgb, var(--hero) 15%, var(--paper)); border-bottom: 2px solid var(--ink); }
.lesson-emoji { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border: 2px solid var(--ink); border-radius: 8px; background: var(--white); box-shadow: 3px 3px 0 var(--ink); font-size: 1.6rem; line-height: 1; }
.lesson-interest { padding: 5px 7px 4px; border-radius: 4px; background: var(--ink); color: var(--mark); font: 400 .64rem/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
.lesson-time { margin-left: auto; color: var(--muted); font: 400 .74rem/1.3 var(--mono); text-align: right; }
.lesson-card-title { font-size: 1.35rem; font-weight: 800; line-height: 1.1; letter-spacing: -.04em; }
.lesson-concept { position: relative; padding-left: 20px; font: 700 .84rem/1.35 var(--mono); }
.lesson-concept::before { content: ""; position: absolute; left: 2px; top: .36em; width: 9px; height: 9px; border: 2px solid var(--ink); background: var(--mark); transform: rotate(45deg); }
.lesson-goal { flex: 1; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.lesson-card .build-actions { padding-top: 8px; }

/* ---------- lessons: the step panel at the top of the terminal ----------
   Part of the dark window: a slightly lighter sheet, pixel step chips, the prompt in a dashed box. */
/* The sheet and the log below both scroll; a rule bright enough to see keeps their clipped lines apart. */
.lesson { display: flex; flex: 0 1 auto; flex-direction: column; min-height: 0; max-height: 48%; background: #17140F; border-bottom: 2px solid #5C5446; color: var(--crt-text); font-family: var(--body); }
.lesson-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--crt-line); }
.lesson-name { min-width: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.lesson-where { flex: none; padding: 5px 7px 4px; border-radius: 4px; background: var(--mark); color: var(--on-mark); font: 400 .62rem/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
.lesson-head .btn { margin-left: auto; }
.lesson-body { min-height: 0; padding: 12px 14px 22px; overflow-y: auto; scroll-padding-block: 12px 40px; scrollbar-color: #4A4337 #17140F; }
/* Where a scroll box cuts its text, the cut edge fades out (edges.js sets the attributes), so no line reads
   as sliced in half against the log. scroll-padding keeps a focused field clear of the fade. */
.lesson-body[data-more-below] { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }
.term-log[data-more-above]:not(:focus-visible) { -webkit-mask-image: linear-gradient(to top, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to top, #000 calc(100% - 32px), transparent); }
.lesson-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lesson-dot { min-width: 34px; height: 34px; padding: 0 6px; border: 2px solid #4A4337; border-radius: 6px; background: var(--crt); color: var(--crt-muted); font: 400 .78rem/1 var(--pixel); cursor: pointer; }
.lesson-dot:hover { border-color: var(--crt-muted); color: var(--crt-text); }
.lesson-dot.done { border-color: var(--ok-dark); color: var(--ok-dark); }
.lesson-dot.now { border-color: var(--mark); background: var(--mark); color: var(--on-mark); }
.lesson-dot:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
.lesson-step-title { margin-bottom: 4px; font-size: 1.3rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
.lesson-label { margin: 14px 0 5px; color: var(--mark); font: 400 .64rem/1.2 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
.lesson-learn, .lesson-hand { color: #EFE9DC; font-size: .95rem; line-height: 1.55; }
.lesson-prompt { margin-bottom: 10px; padding: 10px 12px; border: 2px dashed #5C5446; border-radius: 8px; background: var(--crt); color: var(--crt-text); font: 400 .86rem/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.lesson-blank { margin-bottom: 10px; color: var(--warn-dark); font-size: .88rem; font-weight: 700; }
.lesson-checks { margin: 0; padding-left: 1.4em; color: #EFE9DC; font-size: .93rem; line-height: 1.5; }
.lesson-checks li::marker { content: "\2610  "; color: var(--ok-dark); }
.lesson-checks li + li { margin-top: 3px; }
.lesson-hand { padding: 10px 12px; border-left: 4px solid var(--caution); border-radius: 0 8px 8px 0; background: rgb(255 210 63 / .09); }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
/* Buttons on the dark sheet: quiet outlines, and the mark colour for the one to press. */
.lesson .btn { --fill: var(--mark); --fill-text: var(--on-mark); background: transparent; color: var(--crt-text); border-color: #5C5446; box-shadow: none; }
.lesson .btn.primary { --fill: var(--cream); --fill-text: var(--ink); background: var(--mark); color: var(--on-mark); border-color: var(--mark); }
.lesson .btn:focus-visible { outline-color: var(--mark); }
@media (hover: hover) and (pointer: fine) { .lesson .btn:not(:disabled):hover { box-shadow: none; } }
.lesson .btn:not(:disabled):active { box-shadow: none; }
.lesson .btn:disabled { opacity: .45; }
.lesson .btn:disabled::after { display: none; }
/* In a lesson build the sheet already shows the whole prompt: the box stays compact so the log keeps room. */
.term:has(.lesson:not([hidden])) .term-input textarea { max-height: 132px; }
.term:has(.lesson:not([hidden])) .line.t-welcome::before { display: none; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 50; max-width: min(92vw, 480px); padding: 12px 18px; border: 2px solid var(--ink); border-radius: 8px; background: var(--ink); color: var(--cream); box-shadow: 5px 5px 0 var(--hero); font-weight: 700; opacity: 0; transform: translate(-50%, 16px); transition: opacity 200ms ease, transform var(--t-lift) var(--ease-out); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { visibility: hidden; }
body:has(#studio-view:not([hidden])) .toast { bottom: 92px; }

/* ---------- smaller screens ---------- */
/* Stickers live in the side gutters; where the gutters are too narrow, only the top corner ones stay. */
@media (max-width: 1359px) {
  .st-make, .st-laptop, .st-ship { display: none; }
  .st-fix { --s: 64px; right: calc(var(--gutter) + 12px); top: 14px; }
  .st-spark { left: auto; right: calc(var(--gutter) + 120px); top: 26px; }
}
@media (max-width: 980px) {
  .level { grid-template-columns: minmax(0, 1fr); }
  .level:not(:last-child)::after { display: none; }
}
@media (max-width: 900px) {
  .join { grid-template-rows: auto auto auto; }
  .join-copy { justify-self: stretch; width: auto; padding-bottom: calc(var(--overlap) + 30px); }
  .join-card { grid-row: 2; justify-self: start; width: 100%; max-width: 560px; margin: calc(-1 * var(--overlap)) 0 0; }
  .house { grid-row: 3; width: auto; max-width: 560px; padding-top: 44px; }
  .st-fix { --s: 56px; top: 16px; right: -8px; }
  .st-spark { display: none; }

  .studio { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; height: auto; padding: 14px 16px 22px; gap: 20px; }
  .term { height: 64vh; min-height: 400px; }
  /* In a lesson the page scrolls, not the sheet: every step reads in full, then the log and the prompt box. */
  .term:has(.lesson:not([hidden])) { height: auto; min-height: 0; }
  .lesson { max-height: none; }
  .lesson-body { overflow: visible; }
  .term:has(.lesson:not([hidden])) .term-log { flex: none; height: 56vh; min-height: 260px; }
  .preview-frame { min-height: 70vh; }
  body:has(#studio-view:not([hidden])) .toast { bottom: 20px; }
}
@media (max-width: 720px) {
  /* Seven lessons would push Builds far down a phone: they become a row to swipe through. */
  .lessons { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: min(84%, 320px); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter) 12px; scroll-padding-inline: var(--gutter); }
  .lesson-card { scroll-snap-align: start; }
  .who { max-width: 16ch; padding-inline: 8px; }
  .rules { grid-template-columns: minmax(0, 1fr); }
  .page-head-in { align-items: flex-start; }
  .next-up { grid-template-columns: minmax(0, 1fr); }
  .next-label { grid-row: auto; justify-self: start; }
}
@media (max-width: 480px) {
  .wordmark { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topnav a { padding: 0 8px; font-size: .9rem; }
  .topnav a { white-space: nowrap; }
  .topnav .nav-start { display: none; } /* phones: /start is one tap away from the home page; four links do not fit */
  .who { min-width: 4.5rem; max-width: 7.5rem; font-size: 0; } /* only the nickname: the "building as" words don't fit */
  /* The pill's own ellipsis would be drawn at that zero size, so a long nickname ends in its own. */
  .who b { display: inline-block; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; vertical-align: top; font-size: .8rem; }
  .topbar-in { gap: 8px; }
  .term-hint { display: none; }
  .save-row { flex-wrap: wrap; }
  .save-row input { flex-basis: 100%; }
  .linkbar { padding: 12px; }
  .linkbar code { flex-basis: 100%; order: 2; }
  .linkbar .btn { order: 3; }
  .build.note { padding-left: 24px; padding-top: 96px; background-position: 24px 24px; }
  .tab { padding: 0 11px; font-size: .88rem; }
}
@media (max-width: 360px) {
  /* At 320px (also 400% zoom) the bar must still fit inside the page margins: the pill gives way most. */
  .topbar-in { gap: 6px; }
  .brand-mark { width: 34px; height: 34px; }
  .topnav { gap: 0; }
  .topnav a { padding: 0 4px; font-size: .84rem; }
  .who { min-width: 3.75rem; }
  .home-actions .btn { padding-inline: 12px; }
}

/* ---------- lesson gates: predict, tick, hand edit, think, explain ----------
   On the dark lesson sheet. The gate box uses the mark colour; the think box is a quieter violet note. */
.lesson-gate { margin-top: 12px; padding: 10px 12px; border: 2px solid var(--mark); border-radius: 8px; background: rgb(198 255 61 / .06); }
.lesson-gate .lesson-label { display: block; margin-top: 0; }
.lesson-gate textarea, #lesson-explain { width: 100%; min-height: 56px; margin-top: 6px; padding: 8px 10px; border: 2px solid #4A4337; border-radius: 8px; background: var(--crt); color: var(--crt-text); font: 400 .92rem/1.45 var(--body); resize: vertical; }
.lesson-gate textarea:focus-visible, #lesson-explain:focus-visible { border-color: var(--mark); outline: 3px solid var(--mark); outline-offset: 2px; }
.lesson-gate .hint { margin-top: 4px; color: var(--crt-muted); }
.lesson-checks { padding-left: 0; list-style: none; }
.lesson-checks li::marker { content: none; }
.lesson-check { display: flex; align-items: flex-start; gap: 10px; padding: 4px 0; cursor: pointer; }
.lesson-check input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--ok-dark); }
.lesson-check input:checked + span { color: var(--ok-dark); }
/* The page-wide ink ring vanishes on the dark sheet: the boxes get the mark colour like the rest of it. */
.lesson-check input:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
.lesson-hand-state { margin: 6px 0 0; color: var(--warn-dark); font: 700 .8rem/1.3 var(--mono); }
.lesson-hand-state.ok { color: var(--ok-dark); }
.lesson-hand-state.ok::before { content: "\2713  "; }
.lesson-think { margin-top: 12px; padding: 10px 12px; border-left: 4px solid #B48CFF; border-radius: 0 8px 8px 0; background: rgb(180 140 255 / .09); }
.lesson-think .lesson-label { margin-top: 0; color: #C9B1FF; }
.lesson-todo { margin: 12px 0 0; color: var(--crt-muted); font-size: .88rem; }
.lesson-todo:empty { display: none; }
.lesson-dot:disabled { opacity: .4; cursor: not-allowed; }
#lesson-done { margin-top: 10px; }
/* Course lessons (Hold the Gate) carry a sprite in the card's top strip. */
.lesson-card.course .lesson-course, .lesson-card.course .lesson-card-title, .lesson-card.course .lesson-concept { margin-right: 70px; }
.lesson-card.course .lesson-interest { white-space: nowrap; }
.lesson-course { color: var(--muted); font: 700 .74rem/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.lesson-art { position: absolute; top: 80px; right: 16px; z-index: 1; width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(3px 3px 0 var(--ink)); pointer-events: none; }
.build.in-lesson .build-card { outline: 3px solid var(--mark); outline-offset: -2px; }
.build-lesson { margin: 0; color: var(--muted); font: 700 .78rem/1.3 var(--mono); }

/* ---------- reduced motion: a complete, still page; colour changes stay, movement goes ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .term-log { scroll-behavior: auto; }
  .btn:hover, .btn:active, .build:hover .build-card, .build:focus-within .build-card, .lesson-card:hover .lesson-card-in, .lesson-card:focus-within .lesson-card-in, .file-list button:hover { transform: none !important; }
  .btn::before, .continue-list a::before { transform: none !important; opacity: 0; }
  .btn:hover::before, .btn:focus-visible::before, .continue-list a:hover::before, .continue-list a:focus-visible::before { opacity: 1; }
  .btn:disabled::after, .build.note.is-loading::after, .term-head::after { display: none; }
}
