/* build-pong state — split-screen prompt-iteration narrative.
 *
 * Layout:
 *   .state.build-pong.is-active  → flex row, viewport-filling
 *     .build-pong-left           → 50% width, prompt history + input
 *     .build-pong-right          → 50% width, CRT bezel framing pong
 *
 * Right pane has a sub-element .build-pong-crt that owns the bezel
 * styling. Inside that, .pong-demo-mount is what the widget binds to
 * — the canvas auto-fills its parent. CRT scanlines + vignette live
 * on .build-pong-crt::before / ::after.
 *
 * Fullscreen choreography: state.js toggles a `.is-fullscreen` class
 * on the section. When set, the right pane expands to the full
 * viewport via transform / inset overrides, and the left pane fades
 * out. Reverting is just removing the class — both panes animate
 * back to their split-screen positions. */

.state.build-pong.is-active {
  display: flex;
  flex-direction: row;
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #06070b;
  overflow: hidden;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
}

/* ── LEFT pane: prompts ──────────────────────────────────────────── */

.build-pong-left {
  position: relative;
  flex: 0 0 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 56px 64px 32px;
  box-sizing: border-box;
  /* Slot-machine palette ported from lecture 01 so the two episodes
     visually rhyme. The teal/navy gradient sits underneath the
     animated wavefront canvas (.compile-bg-canvas) injected by
     compile-bg.js + the radial-glow ::after layer below. */
  background: linear-gradient(140deg, #06182f 0%, #0a3a3a 50%, #0d2d4a 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  /* When the right pane goes fullscreen, fade the left out. */
  transition: opacity 360ms ease, transform 480ms cubic-bezier(.4,.0,.2,1);
}
/* Wavefront canvas — injected by startCompileBg only while the slot
 * machine effect is running (state.js adds .is-spinning to the
 * left pane on lever-pull, removes it on land). Hidden otherwise so
 * the prompt panel reads as calm Claude-chat between stages. */
.build-pong-left .compile-bg-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 360ms ease;
}
.build-pong-left.is-spinning .compile-bg-canvas {
  opacity: 1;
}
/* Slow pulsing radial glows so the bg never feels static. Same
   keyframe surface as lecture-01's .state.slot-machine::after. */
.build-pong-left::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 22% 30%, rgba(56, 189, 248, 0.32), transparent 55%),
    radial-gradient(circle at 78% 72%, rgba(74, 222, 128, 0.28), transparent 55%);
  animation: build-pong-bg-glows 16s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes build-pong-bg-glows {
  from { opacity: 0.55; transform: scale(1);    }
  to   { opacity: 0.85; transform: scale(1.08); }
}
.build-pong-left > * { position: relative; z-index: 1; }

.state.build-pong.is-fullscreen .build-pong-left {
  /* Collapse the flex slot entirely — fading alone wasn't enough,
     `flex: 0 0 50%` still reserved half the viewport. */
  opacity: 0;
  flex-basis: 0;
  width: 0;
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right: 0;
  transform: translateX(-40px);
  pointer-events: none;
  /* Animate the layout-affecting properties so the right pane
     visually grows into the freed space rather than snapping. */
  transition:
    opacity   240ms ease,
    flex-basis 480ms cubic-bezier(.4,.0,.2,1),
    width      480ms cubic-bezier(.4,.0,.2,1),
    padding    480ms cubic-bezier(.4,.0,.2,1),
    transform  480ms cubic-bezier(.4,.0,.2,1);
}

/* Top spacer pseudo-flex item. Same flex weight as the prompts
 * column below, so the two split the available leftover space
 * equally — input card lands at the pane's vertical center. */
.build-pong-spacer-top {
  flex: 1 1 0;
  min-height: 0;
  display: block;
}

.build-pong-prompts {
  flex: 1 1 0;
  min-height: 0;
  /* No scrollbar. Older entries fade + shrink as they push further
     down the column; below a certain point they're invisible. The
     mask-image gradient produces a soft falloff against the panel
     bg. */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-right: 4px;
  color: rgba(243, 238, 255, 0.92);
  /* Mobile-video readable: prose body sized so the text is legible
     in YouTube's mobile viewport. The left pane renders at roughly
     half-width — text needs to be ~2× a typical desktop size to
     survive the downscale to a 6"-phone playback. */
  font-size: 36px;
  line-height: 1.45;
  -webkit-mask-image:
    linear-gradient(to bottom,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 55%,
      rgba(0, 0, 0, 0) 100%);
  mask-image:
    linear-gradient(to bottom,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 55%,
      rgba(0, 0, 0, 0) 100%);
}

/* Committed entries stay full-size — they just push each other DOWN
 * the column as new ones get prepended. Older ones eventually fall
 * past the mask-image fade-out at the bottom and disappear. The
 * mask handles the visual recession; we don't fake-shrink anything. */
.build-pong-prompt.stage-items.committed {
  transition: opacity 320ms ease;
}

.build-pong-prompt {
  position: relative;
  padding: 20px 26px;
  border-radius: 6px;
  /* Cards sit ABOVE the busy wavefront bg, so we need an opaque-ish
     fill instead of the very-low-alpha tints used before. */
  background: rgba(13, 27, 53, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-left: 2px solid rgba(232, 227, 216, 0.25);   /* neutral rule */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  white-space: pre-wrap;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 36px;
  line-height: 1.45;
  /* Fade + slide in via the is-revealed class. */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 400ms ease, transform 500ms cubic-bezier(.4,.0,.2,1);
}
.build-pong-prompt.is-revealed { opacity: 1; transform: translateY(0); }

/* Version stamp — flat, minimal-retro section header. No fill, no
 * shadow, no amber/yellow. Just a thin neutral rule on the left and
 * letter-spaced cream text. Reads as a quiet build-tag separator
 * between iteration steps. */
.build-pong-prompt.stage-version-bubble {
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(232, 227, 216, 0.92);
  background: transparent;
  border: 0;
  border-left: 2px solid rgba(232, 227, 216, 0.40);
  box-shadow: none;
  padding: 6px 0 6px 14px;
  margin: 4px 0 -4px 0;     /* tuck closer to the item list below */
}

/* Item list bubble — neutral container; each .stage-item row inside
 * carries the color code via its [data-tag] attribute. */
.build-pong-prompt.stage-items {
  border-left-color: rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 14px 14px 16px;
}
.stage-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.5;
}
.stage-item-tag {
  flex: 0 0 auto;
  display: inline-block;
  min-width: 58px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-align: center;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.80);
}
.stage-item-text {
  color: rgba(243, 238, 255, 0.92);
}
/* Category colors. Both the pill background + the text take a hue
 * tint so each item reads as a single visual unit. */
.stage-item[data-tag="BASE"]  .stage-item-tag { background: rgba(229,231,235,0.18); color: #e5e7eb; }
.stage-item[data-tag="SFX"]   .stage-item-tag { background: rgba(125,211,252,0.22); color: #7dd3fc; }
.stage-item[data-tag="FEEL"]  .stage-item-tag { background: rgba(251,191,36, 0.22); color: #fbbf24; }
.stage-item[data-tag="GFX"]   .stage-item-tag { background: rgba(74, 222,128,0.22); color: #4ade80; }
.stage-item[data-tag="MUSIC"] .stage-item-tag { background: rgba(192,132,252,0.22); color: #c084fc; }

/* The typing-in-progress caret on the most recently added prompt. */
.build-pong-prompt.is-typing::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  color: rgba(255, 200, 130, 0.85);
  animation: build-pong-caret-blink 0.95s steps(2) infinite;
}

@keyframes build-pong-caret-blink {
  0%, 50%  { opacity: 1; }
  51%,100% { opacity: 0; }
}

/* Live input CARD — text types into its content area. The card has
 * a thin header bar, a scrollable content area for the typed lines,
 * and a BUILDING overlay that covers the content while the lever-
 * spin runs. On LAND the content moves to a fresh committed bubble
 * at the top of the log below; the input clears for the next stage. */
.build-pong-input {
  flex: 0 0 auto;
  position: relative;
  margin: 0 0 20px 0;
  padding: 0;
  border-radius: 6px;
  background: rgba(13, 27, 53, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  /* Default-size: compact when empty (just header + a caret line).
     The content area grows for the version stamp + optional file
     attachments + prose. Capped at 56vh so the prompts log below
     keeps room. With attachments + prose this is the natural
     ceiling; content rarely hits it. */
  min-height: 180px;
  max-height: 56vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: max-height 520ms cubic-bezier(.4, .0, .2, 1),
              min-height 520ms cubic-bezier(.4, .0, .2, 1),
              margin     520ms cubic-bezier(.4, .0, .2, 1),
              padding    520ms cubic-bezier(.4, .0, .2, 1),
              opacity    420ms ease;
}
/* Final stage shipped — the slotware terminal closes up shop.
 * Card collapses to zero height, the prompts log expands into the
 * freed space, and the blinking caret stops (because the empty
 * content area is no longer visible). */
.build-pong-input.is-shipped {
  min-height: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  border: 0;
}

/* ── Wrap-up: cards leaf into a PADDLES folder ────────────────────
 * After the final stage ships, every .committed card transitions to
 * a small scale and translates toward the folder center, then fades.
 * The folder fades in mid-converge, then its top flap rotates down
 * to close. */
.build-pong-prompt.committed.is-leafing {
  transition: transform 700ms cubic-bezier(.4, .0, .2, 1),
              opacity   500ms ease 300ms !important;
}
.build-pong-folder {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 280px;
  height: 200px;
  /* Spring-in scale on .is-visible. perspective on this element so
     rotateX on the child flap renders as actual 3D rotation. */
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  z-index: 10;
  pointer-events: none;
  perspective: 1100px;
  transform-style: preserve-3d;
  transition: opacity 420ms ease,
              top       620ms cubic-bezier(.4, 0, .2, 1),
              left      620ms cubic-bezier(.4, 0, .2, 1),
              transform 520ms cubic-bezier(.34, 1.56, .64, 1);
}
.build-pong-folder.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
/* After the flap closes, the folder slides + shrinks into the
 * top-left of the left pane as the final "filed away" beat. */
.build-pong-folder.is-tucked {
  top: 80px;
  left: 110px;
  transform: translate(-50%, -50%) scale(0.42);
}
/* Folder body — warm manila plastic, chunky outline, drop shadow.
 * Label sits in the LOWER half of the body so it's never covered
 * by the flap when the lid closes. */
.build-pong-folder-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #d4b070 0%, #b3914a 100%);
  border: 3px solid #4a3008;
  border-radius: 6px 6px 4px 4px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.65),
              inset 0 -3px 0 rgba(0, 0, 0, 0.18);
  z-index: 1;
}
/* Tab on the top-left of the folder back */
.build-pong-folder-back::before {
  content: "";
  position: absolute;
  top: -22px;
  left: 22px;
  width: 110px;
  height: 24px;
  background: inherit;
  border: 3px solid #4a3008;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}
.build-pong-folder-label {
  position: absolute;
  /* Dead-centered on the folder body so the title is the obvious
     focal point regardless of flap state. z-index above the flap +
     leafing cards so nothing obscures the PADDLES title. */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #3a2306;
  /* Typewriter-press feel: classic Courier with a slight ink-bleed
     text-shadow. Reads as "stamped onto a manila folder" rather than
     "tech-poster headline". */
  font-family: "Courier New", "Courier", "American Typewriter", ui-monospace, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow:
    0 0 1px rgba(58, 35, 6, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.30);
  z-index: 6;
}
/* Top flap — hinged at the TOP edge of the body. Default (open)
 * state: flap rotated FORWARD toward camera (peeled-back lid the
 * viewer is reading the contents of). When .is-closed lands, it
 * rotates back upright then continues to lay flat across the
 * body's top half from the front, sealing the folder. */
.build-pong-folder-flap {
  position: absolute;
  top: 0;
  left: 0; right: 0;
  height: 50%;            /* covers top half when closed */
  background: linear-gradient(180deg, #e3c283 0%, #c79f5a 100%);
  border: 3px solid #4a3008;
  border-bottom: none;
  border-radius: 6px 6px 2px 2px;
  /* Hinge at the BOTTOM edge of the flap = midpoint of the folder
     body. Open state rotates the flap UP and TOWARD the camera
     (positive X rotation around bottom hinge = top moves toward
     viewer). +110° tips it past horizontal so the flap is leaning
     toward the viewer like an opened scrapbook lid. */
  transform-origin: bottom center;
  transform: rotateX(110deg);
  transition: transform 760ms cubic-bezier(.5, 0, .5, 1);
  z-index: 4;
  box-shadow: 0 -10px 18px rgba(0, 0, 0, 0.30),
              inset 0 2px 0 rgba(255, 255, 255, 0.18);
  backface-visibility: visible;
}
.build-pong-folder.is-closed .build-pong-folder-flap {
  /* CLOSED: flap unrotates back to upright (rotateX 0), flush on
     top of body's top half. */
  transform: rotateX(0deg);
}

/* BUILT stamp on the folder — same paper-stamp style as committed
 * cards but bigger. Sits in the lower-right of the body so it stays
 * visible whether the flap is open or closed. Fades + scales in
 * after the folder appears so it doesn't compete with the leafing. */
.build-pong-folder-stamp {
  position: absolute;
  bottom: 22px;
  right: 24px;
  padding: 6px 16px;
  border: 3px solid #4ade80;
  border-radius: 6px;
  color: #4ade80;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.55);
  box-shadow: inset 0 0 0 6px rgba(212, 176, 112, 1.0),
              inset 0 0 0 9px #4ade80,
              0 0 18px rgba(74, 222, 128, 0.30);
  transform: rotate(-8deg) scale(1.8);
  opacity: 0;
  transition: opacity 320ms ease,
              transform 380ms cubic-bezier(.34, 1.56, .64, 1);
  z-index: 5;
  pointer-events: none;
}
.build-pong-folder.is-closed .build-pong-folder-stamp {
  opacity: 1;
  transform: rotate(-8deg) scale(1.0);
}

/* ── Thanks for Watching! ───────────────────────────────────────
 * Shows on the left pane after the cinematic completes AND the
 * host exits fullscreen. Hidden by default; .is-visible reveals.
 * Big letter-spaced cream-on-warm typography to match the lecture
 * style. Two lines stacked. */
.build-pong-thanks {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  color: rgba(251, 220, 130, 0.98);
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.40),
               0 0 6px  rgba(255, 240, 200, 0.35);
  text-align: center;
  letter-spacing: 0.10em;
  opacity: 0;
  pointer-events: none;
  z-index: 12;
  transition: opacity 600ms ease,
              transform 720ms cubic-bezier(.34, 1.56, .64, 1);
}
.build-pong-thanks.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.build-pong-thanks-line-1 {
  font-size: 48px;
  font-weight: 500;
  font-style: italic;
  color: rgba(232, 227, 216, 0.85);
  letter-spacing: 0.18em;
}
.build-pong-thanks-line-2 {
  font-size: 84px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(251, 220, 130, 1.0);
  text-shadow:
    0 0 32px rgba(251, 191, 36, 0.55),
    0 0 12px rgba(255, 255, 245, 0.30);
}
/* Window-chrome title bar — distinct from the prose below it.
 * Darker gradient band + 90s-Mac traffic-light buttons + monospace
 * prompt glyph + brand label. Bottom rule is a brighter accent so
 * the bar visually separates from the content area. */
.build-pong-input-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(180deg,
    rgba(28, 38, 60, 0.95) 0%,
    rgba(14, 22, 40, 0.95) 100%);
  border-bottom: 2px solid rgba(125, 211, 252, 0.35);
  color: rgba(232, 227, 216, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
.build-pong-input-window-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.build-pong-input-window-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 0 6px rgba(0, 0, 0, 0.30);
}
.build-pong-input-window-btn[data-tone="close"] {
  background: radial-gradient(circle at 35% 35%, #ff8b80, #ff5f56 70%);
}
.build-pong-input-window-btn[data-tone="min"] {
  background: radial-gradient(circle at 35% 35%, #ffd35c, #ffbd2e 70%);
}
.build-pong-input-window-btn[data-tone="zoom"] {
  background: radial-gradient(circle at 35% 35%, #5ce471, #27c93f 70%);
}
.build-pong-input-glyph {
  color: rgba(125, 211, 252, 0.95);
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 0 10px rgba(125, 211, 252, 0.45);
}
/* HUGE brand label — the marquee of the left pane. Big, beautiful,
 * letter-spaced retro typography. Mobile-readable from across a
 * room. */
.build-pong-input-label {
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243, 238, 255, 0.96);
  text-shadow: 0 0 8px rgba(232, 227, 216, 0.18);
}

.build-pong-input-content {
  flex: 1 1 auto;
  /* No visible scrollbar. The max-height on the card sized to hold
     all expected content (stamp + 4 file tiles + prose) without
     overflow; if anything spills, it clips cleanly rather than
     showing a scrollbar that fights the retro look. */
  overflow: hidden;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: rgba(243, 238, 255, 0.92);
  /* Mobile-video readable. Prose body is the biggest reading surface
     — sized so the prompt is legible on a mobile YouTube viewport
     after the half-pane downscale. */
  font-size: 38px;
  line-height: 1.40;
}
/* Empty input — blinking cursor stands in for the caret. */
.build-pong-input-content.is-empty::before {
  content: "▍";
  display: inline-block;
  color: rgba(232, 227, 216, 0.55);
  font-size: 44px;
  animation: build-pong-caret-blink 0.95s steps(2) infinite;
}
/* PRE-BOOT — the cursor is hidden until the host fires the boot
 * beat with the first N press. */
.state.build-pong:not(.is-booted) .build-pong-input-content.is-empty::before {
  visibility: hidden;
}

/* ── Attachment row (90s file icons) ──────────────────────────────
 * For AUDIO + MUSIC stages: real asset files "plop" into the
 * prompt with a squishy spring overshoot before the prose types
 * in. Shows the audience that the prompt didn't just describe
 * files — it ATTACHED them. */
.stage-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 4px 0 6px 0;
  margin-bottom: 2px;
}
/* One attachment group = stacked icon pile + side label. */
.stage-attachment-group {
  display: flex;
  align-items: center;
  gap: 20px;
}
/* The stack — icons positioned absolutely with per-index offsets +
 * slight rotations so they read as papers tossed on a desk. Width
 * accounts for the visible "spread" of the stack. */
.stage-file-stack {
  position: relative;
  width: calc(108px + (var(--stack-n, 1) - 1) * 18px);
  height: 108px;
}
.stage-file {
  position: absolute;
  top: 0;
  left: calc(var(--stack-idx, 0) * 18px);
  transform-origin: center;
  /* Drop-in start state: offscreen above, rotated, large + faded */
  opacity: 0;
  transform: translateY(-280px) scale(2.0) rotate(-22deg);
  /* Spring overshoot — settles past 1.0 then back. */
  transition: transform 640ms cubic-bezier(.34, 1.56, .64, 1),
              opacity   320ms ease;
}
.stage-file.is-dropped {
  opacity: 1;
  /* Settle into stack with a subtle per-card rotation so the pile
     looks hand-tossed rather than CAD-aligned. */
  transform: translateY(0) scale(1)
             rotate(calc(var(--stack-idx, 0) * 2.5deg - 3deg));
}
.stage-file-icon {
  width: 108px;
  height: 108px;
  image-rendering: pixelated;     /* keep the chunky retro look crisp */
  image-rendering: crisp-edges;
  display: block;
  filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.55));
}
.stage-attachment-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
}
.stage-attachment-label-main {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243, 238, 255, 0.94);
}
.stage-attachment-label-count {
  font-size: 13px;
  letter-spacing: 0.10em;
  color: rgba(243, 238, 255, 0.55);
}

/* Prose paragraph — the condensed feature description. Wraps
 * naturally; .hl-phrase children get the marker-highlighter
 * treatment. */
.stage-prose {
  display: block;
  margin: 4px 0 0 0;
  word-spacing: 0.02em;
}
.stage-prose .hl-phrase {
  /* Default state: subtle background so the phrase reads as a
     "contestable span" even before the marker lands — same baseline
     as lecture-01's .sd-def-text [data-phrase]. */
  padding: 0 5px;
  border-radius: 4px;
  transition: background 600ms ease,
              color      600ms ease,
              box-shadow 600ms ease;
}
.stage-prose .hl-phrase.is-highlighted {
  background: rgba(218, 158, 84, 0.28);
  color: #ffe6b9;
  box-shadow: inset 0 -3px 0 rgba(218, 158, 84, 0.75);
}
/* Secondary highlight — cyan/teal, more subdued. No marker sweep,
 * just colored text. Used alongside .hl-phrase to vary the visual
 * rhythm so the prose feels playful instead of monotone. */
.stage-prose .hl-teal,
.build-pong-error-text .hl-teal {
  color: #7dd3fc;
  text-shadow: 0 0 8px rgba(125, 211, 252, 0.30);
  font-weight: 700;
}
/* Italic playful emphasis — slight color shift toward warm cream.
 * Inherits font-style italic so the body type goes from regular to
 * slanted, which reads as personality without screaming. */
.stage-prose .hl-italic,
.build-pong-error-text .hl-italic {
  font-style: italic;
  color: #fde68a;
}

/* BUILDING overlay — covers the input content while the lever-spin
 * runs. Pulsing ASCII bars + steady letter-spaced label, all in
 * neutral cream/cyan. Tells the audience the prompt is compiling. */
.build-pong-input-building {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: rgba(8, 16, 32, 0.94);
  border-radius: 6px;
  z-index: 6;
  pointer-events: none;
}
.build-pong-input.is-building .build-pong-input-building {
  display: flex;
}

/* Retro LED-row spinner — 6 chunky squares, only one lit at a time,
 * cycling left → right. Reads as 70s-mainframe progress lamps.
 * Each LED has its own animation-delay offset. */
.build-pong-spinner {
  display: flex;
  gap: 10px;
}
.build-pong-spinner > span {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(125, 211, 252, 0.22);
  background: rgba(125, 211, 252, 0.08);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.45),
    inset 0 0 8px rgba(0, 0, 0, 0.55);
  animation: build-pong-led-cycle 0.96s steps(1, end) infinite;
}
.build-pong-spinner > span:nth-child(1) { animation-delay: 0.00s; }
.build-pong-spinner > span:nth-child(2) { animation-delay: 0.16s; }
.build-pong-spinner > span:nth-child(3) { animation-delay: 0.32s; }
.build-pong-spinner > span:nth-child(4) { animation-delay: 0.48s; }
.build-pong-spinner > span:nth-child(5) { animation-delay: 0.64s; }
.build-pong-spinner > span:nth-child(6) { animation-delay: 0.80s; }
@keyframes build-pong-led-cycle {
  0%   {
    background: rgba(125, 211, 252, 0.95);
    border-color: rgba(180, 240, 255, 1.0);
    box-shadow:
      0 0 18px rgba(125, 211, 252, 0.85),
      0 0 32px rgba(125, 211, 252, 0.40),
      inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  }
  16%, 100% {
    background: rgba(125, 211, 252, 0.08);
    border-color: rgba(125, 211, 252, 0.22);
    box-shadow:
      inset 0 0 0 2px rgba(0, 0, 0, 0.45),
      inset 0 0 8px rgba(0, 0, 0, 0.55);
  }
}

.build-pong-building-text {
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: rgba(232, 227, 216, 0.95);
  animation: build-pong-building-text-pulse 1.4s ease-in-out infinite alternate;
}
@keyframes build-pong-building-text-pulse {
  from { opacity: 0.70; letter-spacing: 0.5em; }
  to   { opacity: 1.00; letter-spacing: 0.6em; }
}

/* Big diagonal "BUILT" stamp dropped onto each committed bubble
 * once its build completes. Reads like a paper stamp — green ink,
 * thick double-rule border, slight rotation, scale-bounce on land. */
.build-pong-done-stamp {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 18px;
  border: 3px solid #4ade80;
  border-radius: 6px;
  color: #4ade80;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.50);
  box-shadow: inset 0 0 0 6px rgba(13, 27, 53, 0.78),
              inset 0 0 0 9px #4ade80,
              0 0 22px rgba(74, 222, 128, 0.25);
  transform: rotate(-8deg) scale(2.2);
  opacity: 0;
  transition: opacity 280ms ease,
              transform 380ms cubic-bezier(.34, 1.56, .64, 1);
  pointer-events: none;
  z-index: 5;
}
.build-pong-done-stamp.is-stamped {
  opacity: 0.95;
  transform: rotate(-8deg) scale(1.0);
}
/* Red ✕ ERROR variant for the failed-attempt bubble. Same shape /
 * size as the green BUILT stamp; just swaps the palette to red. */
.build-pong-done-stamp.is-error-stamp {
  border-color: #f87171;
  color: #f87171;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.55);
  box-shadow: inset 0 0 0 6px rgba(53, 13, 13, 0.78),
              inset 0 0 0 9px #f87171,
              0 0 22px rgba(248, 113, 113, 0.30);
}
/* Failed bubble tint: subtly redder background + reduced opacity so
 * the eye finds it in the log as "this one was wrong". */
.build-pong-prompt.is-failed {
  background: rgba(64, 16, 16, 0.18);
  border-color: rgba(255, 90, 80, 0.18);
}
.build-pong-prompt.is-failed .stage-prose,
.build-pong-prompt.is-failed .stage-version-row {
  color: rgba(255, 210, 205, 0.78);
}
.build-pong-prompt.committed { position: relative; }

/* Version stamp row inside the input card or a committed bubble.
 * Big mobile-readable cream letter-spaced text on a thin bottom rule. */
.stage-version-row {
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(243, 238, 255, 0.96);
  padding: 4px 0 10px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(232, 227, 216, 0.16);
}

/* Committed history bubble opacity + transform are driven by the
 * nth-of-type rules at the top of this file (the older-shrinks-and-
 * fades pattern); no flat override here. */

/* ── RIGHT pane: CRT-framed pong demo ────────────────────────────── */

.build-pong-right {
  position: relative;
  flex: 0 0 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  box-sizing: border-box;
  /* Pink/magenta companion to the left pane's teal/navy. The
     pink-tinted wavefront canvas + radial glow ::after sit
     UNDERNEATH the CRT bezel. */
  background: linear-gradient(140deg, #2a0a26 0%, #3a0f33 50%, #20062a 100%);
  overflow: hidden;
  transition: flex-basis 480ms cubic-bezier(.4,.0,.2,1),
              padding     480ms cubic-bezier(.4,.0,.2,1);
}
/* Pink wavefront canvas — injected by state.js's startCompileBg
 * during the spin phase. Pinned behind the CRT bezel (which has
 * z-index 1). */
.build-pong-right .compile-bg-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 360ms ease;
}
.build-pong-right.is-spinning .compile-bg-canvas {
  opacity: 1;
}
/* Companion radial glow on the right pane, in pink/magenta to mirror
 * the left pane's cyan/green. Same slow pulse. */
.build-pong-right::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 78% 30%, rgba(236, 72, 153, 0.30), transparent 55%),
    radial-gradient(circle at 22% 72%, rgba(199, 90, 209, 0.26), transparent 55%);
  animation: build-pong-bg-glows 16s ease-in-out infinite alternate;
  pointer-events: none;
}
.build-pong-right > * { position: relative; z-index: 1; }

.state.build-pong.is-fullscreen .build-pong-right {
  /* Grow into the slot the left pane just vacated. flex-grow:1
     handles the actual expansion; flex-basis stays at 50% so the
     transition starts from there and the right pane animates outward
     instead of jumping. */
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: 50%;
  width: 100%;
  padding: 0;
}

/* The CRT itself — chunky retro consumer-TV bezel. Slight warm
 * brown plastic tint, faux vent striations on the top edge, brand
 * stamp + power LED below the screen. Sits inside the right pane;
 * canvas fills the inner glass area. Transitions size + radius when
 * the pane goes fullscreen. */
.build-pong-crt {
  position: relative;
  width: 100%;
  max-width: 920px;
  aspect-ratio: 4 / 3;
  border-radius: 36px / 28px;
  /* Warm dark plastic, slight gradient from top (catching room
     light) to bottom (in shadow). The repeating-linear-gradient
     overlay adds faint vent / striation lines so the plastic reads
     as molded rather than painted. */
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.012) 0 1px,
      rgba(0, 0, 0, 0.04) 1px 3px
    ),
    linear-gradient(180deg, #2b2622 0%, #1a1614 55%, #0e0a09 100%);
  /* Layered shadows: a tight inner cast (CRT recess), a wider
     warm halo (room light bouncing off the plastic), then the
     drop shadow grounding it. */
  /* Layered halo: tight inner highlight + deep inset shadow for the
     molded-plastic feel, then a thin chrome bezel ring, then the
     drop shadow grounding the unit on the surface. The two trailing
     outer shadows are the SOFT WHITE PHOSPHOR HALO — that "CRT in a
     dark room" glow leaking off the curved glass. Wide + low-alpha
     so it feels like ambient light, not a UI border. */
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 200, 0.10),
    inset 0 -2px 8px rgba(0, 0, 0, 0.60),
    0 0 0 6px #14100e,
    0 0 0 7px rgba(255, 200, 130, 0.06),
    0 32px 64px rgba(0, 0, 0, 0.70),
    0 0 60px rgba(236, 72, 153, 0.10),
    0 0 90px rgba(255, 255, 245, 0.16),
    0 0 180px rgba(220, 230, 255, 0.10);
  overflow: hidden;
  padding-bottom: 36px;     /* room for the brand stamp + LED */
  box-sizing: border-box;
  transition: max-width 480ms cubic-bezier(.4,.0,.2,1),
              border-radius 480ms cubic-bezier(.4,.0,.2,1),
              padding-bottom 480ms cubic-bezier(.4,.0,.2,1);
}
/* Power LED — small amber dot bottom-right of the bezel. Pulses
 * subtly so the audience reads it as "this CRT is on, alive". */
.build-pong-crt-led {
  position: absolute;
  bottom: 14px;
  right: 28px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe18a, #b07020 70%, #503010 100%);
  box-shadow:
    0 0 4px rgba(255, 200, 80, 0.55),
    0 0 12px rgba(255, 160, 40, 0.35);
  z-index: 5;
  animation: build-pong-led-flicker 3.2s ease-in-out infinite;
  transition: opacity 360ms ease,
              background 360ms ease,
              box-shadow 360ms ease;
}
/* PRE-BOOT — LED is dim/dark. No animation. */
.state.build-pong:not(.is-booted) .build-pong-crt-led {
  background: #1a0f08;
  box-shadow: none;
  animation: none;
  opacity: 0.45;
}
@keyframes build-pong-led-flicker {
  0%, 100% { opacity: 0.85; }
  47%      { opacity: 1.00; }
  62%      { opacity: 0.78; }
}
.build-pong-crt-brand {
  position: absolute;
  bottom: 10px;
  left: 0; right: 0;
  text-align: center;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.5em;
  color: rgba(200, 165, 130, 0.45);
  text-shadow: 0 1px 0 rgba(0,0,0,0.7), 0 -1px 0 rgba(255,220,180,0.04);
  z-index: 5;
  pointer-events: none;
  user-select: none;
}
.state.build-pong.is-fullscreen .build-pong-crt {
  padding-bottom: 0;
}
.state.build-pong.is-fullscreen .build-pong-crt-led,
.state.build-pong.is-fullscreen .build-pong-crt-brand {
  display: none;     /* lose the bezel chrome in fullscreen */
}
.state.build-pong.is-fullscreen .build-pong-crt {
  max-width: 100vw;
  border-radius: 0;
  aspect-ratio: auto;
  height: 100vh;
}

/* Inner mount — the canvas binds to this. Sits inside the chunky
 * retro bezel; the bezel has a padding-bottom (room for LED + brand
 * stamp), so the mount's bottom inset is wider than its top. */
.pong-demo-mount {
  position: absolute;
  top: 22px;
  left: 22px;
  right: 22px;
  bottom: 50px;   /* clears the LED + brand strip */
  background:
    /* Slightly green-tinted phosphor gray under the canvas so even
       transient render gaps don't look black. The canvas paints over
       this every frame when the widget is running. */
    radial-gradient(120% 90% at 50% 35%, #424946 0%, #2d3231 100%);
  border-radius: 18px / 12px;
  overflow: hidden;
  filter: contrast(1.06) saturate(1.08) brightness(1.02);
}
.state.build-pong.is-fullscreen .pong-demo-mount {
  inset: 0;
  border-radius: 0;
}

.pong-demo-mount canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #08090d;
  transition: filter 240ms ease;
}
/* Broken-mode "inverted-screen": flip colors on the canvas only.
 * The bezel chrome (vignette + scanlines pseudo-elements on
 * .build-pong-crt) stays normal so the CRT frame still reads
 * correctly while the game itself looks dramatically wrong. Game
 * physics + render are 100% untouched — this is a pure visual gag. */
.build-pong-crt.is-broken-inverted .pong-demo-mount canvas {
  filter: invert(1) hue-rotate(180deg);
}
/* Broken-mode "blurry-screen": canvas goes soft-focus. Tiny visual
 * bug — game plays fine underneath but the audience clearly reads
 * "this is wrong, fix it." Pure CSS filter, no render path touched. */
.build-pong-crt.is-broken-blurry .pong-demo-mount canvas {
  filter: blur(3.5px) saturate(0.85);
}
/* Broken-mode "tilted-screen": canvas rotates and scales down so
 * the rotation doesn't punch outside the bezel cutout. Reads as a
 * miscalibrated CRT yoke. */
.build-pong-crt.is-broken-tilted .pong-demo-mount canvas {
  transform: rotate(-3deg) scale(0.94);
  transform-origin: center;
}

/* CRT overlays — vignette + scanlines + flicker. Applied to
 * .build-pong-crt rather than the mount so the bezel stays clean.
 * Pseudo-element insets match the chunkier .pong-demo-mount offsets
 * (the bezel has more chrome at the bottom for the LED + brand). */
.build-pong-crt::before,
.build-pong-crt::after {
  content: "";
  position: absolute;
  top: 22px;
  left: 22px;
  right: 22px;
  bottom: 50px;
  border-radius: 18px / 12px;
  pointer-events: none;
  z-index: 3;
}
.state.build-pong.is-fullscreen .build-pong-crt::before,
.state.build-pong.is-fullscreen .build-pong-crt::after {
  inset: 0;
  border-radius: 0;
}

.build-pong-crt::before {
  background:
    radial-gradient(
      120% 95% at 50% 50%,
      rgba(0,0,0,0)    62%,
      rgba(0,0,0,0.40) 88%,
      rgba(0,0,0,0.85) 100%
    ),
    radial-gradient(
      60% 50% at 50% 45%,
      rgba(255, 200, 130, 0.06) 0%,
      rgba(255, 200, 130, 0.00) 70%
    );
  mix-blend-mode: multiply;
}

.build-pong-crt::after {
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0.00) 0,
      rgba(0,0,0,0.00) 2px,
      rgba(0,0,0,0.18) 3px,
      rgba(0,0,0,0.00) 4px
    ),
    repeating-linear-gradient(
      to right,
      rgba(255, 90, 90, 0.012) 0,
      rgba(255, 90, 90, 0.012) 1px,
      rgba(110, 255, 130, 0.012) 1px,
      rgba(110, 255, 130, 0.012) 2px,
      rgba(110, 130, 255, 0.012) 2px,
      rgba(110, 130, 255, 0.012) 3px
    );
  mix-blend-mode: overlay;
  animation: build-pong-crt-flicker 6.4s steps(60) infinite;
}
@keyframes build-pong-crt-flicker {
  0%, 100% { opacity: 0.92; }
  47%      { opacity: 1.00; }
  52%      { opacity: 0.86; }
  74%      { opacity: 0.96; }
}

/* Power-on flash — state.js toggles .is-flashing briefly when a new
 * juice layer "compiles" so the right pane visibly reacts. */
.build-pong-crt.is-flashing::before {
  background: rgba(255, 200, 130, 0.18);
  mix-blend-mode: screen;
  transition: background 80ms ease;
}

/* ── Demo-mute overlay ──────────────────────────────────────────────
 * Big red CRT-style speaker-with-X icon, centered on the monitor.
 * Hidden by default; shown when the host presses "0" to silence
 * the demo audio (build sounds keep playing). Phosphor-red color
 * + soft glow so it reads as part of the CRT signal. */
.build-pong-mute-icon {
  position: absolute;
  inset: 0;
  z-index: 7;     /* above mosaic + scanlines */
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
  /* CRT-red phosphor color. The SVG strokes use currentColor so the
     speaker outline + diagonal bar inherit this tint. */
  color: #ff3a3a;
  filter: drop-shadow(0 0 18px rgba(255, 50, 50, 0.55))
          drop-shadow(0 0 4px  rgba(255, 80, 80, 0.85));
}
.build-pong-crt.is-muted .build-pong-mute-icon {
  display: flex;
  animation: build-pong-mute-pulse 1.6s ease-in-out infinite alternate;
}
.build-pong-mute-icon svg {
  width: 38%;
  max-width: 240px;
  height: auto;
}
.build-pong-mute-label {
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: #ff5a5a;
  text-shadow:
    0 0 8px  rgba(255, 60, 60, 0.85),
    0 0 22px rgba(255, 80, 80, 0.55);
}
@keyframes build-pong-mute-pulse {
  from { opacity: 0.80; }
  to   { opacity: 1.00; }
}

/* ── CRT mosaic glitch overlay ──────────────────────────────────────
 *
 * Built by state.js inside .pong-demo-mount when the lever is pulled.
 * Sits ABOVE the canvas (the canvas has no explicit z-index, mosaic
 * grid z-index: 4 sits over both the canvas and the .build-pong-crt
 * ::before/::after CRT overlays).
 *
 * Tile reveal-in is column-wave (cover the canvas, hiding the swap
 * from old juice → new juice). During spin, each tile randomly picks
 * one of four glitch kinds at ~95ms cadence — reads as CRT signal
 * corruption / a slot reel mid-spin. Reveal-out wipes column-wave
 * showing the freshly-juiced pong underneath. */
/* Mosaic of NEW-state snapshot tiles. Each tile has its own slice
 * of the new pong canvas (via background-image + background-position
 * in state.js's buildMosaic). Tiles fade IN column-wave, replacing
 * the OLD pixels still painted on the canvas underneath, until the
 * new image is fully assembled. The widget is paused while this
 * happens so the audience doesn't see the new game playing before
 * the assembly completes.
 *
 * No flicker, no glitch kinds — this is the calm lecture-01
 * mosaicSwap pattern, applied to a live canvas via snapshots. */
.crt-mosaic-grid {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  pointer-events: none;
}
.crt-mosaic-tile {
  background-repeat: no-repeat;
  position: relative;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 220ms ease,
              transform 360ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
/* Per-tile WHITE PHOSPHOR FLASH overlay. Each tile lands as a bright
 * white square first, then the white fades out revealing its slice
 * of the new game snapshot. Gives a clear "arrival" beat for every
 * tile regardless of whether the underlying snapshot pixels differ
 * from the old state (important: SFX-stage and FEEL-stage compiles
 * have minimal visible delta, but the flash sells the assembly).  */
.crt-mosaic-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(255, 252, 240, 0.95) 0%,
    rgba(255, 245, 220, 0.82) 60%,
    rgba(255, 240, 210, 0.65) 100%);
  opacity: 0;            /* invisible while tile is "off" */
  pointer-events: none;
}
.crt-mosaic-tile.is-in {
  opacity: 1;
  transform: scale(1);
}
/* When tile lands: flash to full white, then fade out over a beat
 * so the image slice underneath reveals itself. The cascade of
 * transitions (tile opacity + ::before flash + ::before fadeout)
 * produces a phosphor-strike effect. */
.crt-mosaic-tile.is-in::before {
  animation: build-pong-tile-flash 520ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes build-pong-tile-flash {
  0%   { opacity: 0; }
  18%  { opacity: 1; }     /* tile is hot-white right after arrival */
  100% { opacity: 0; }     /* fades out revealing the snapshot slice */
}

/* ── Mosaic glitch-stall ─────────────────────────────────────────
 * When a build "fails" mid-reveal, the tiles that have already
 * landed start glitching: rapid opacity flicker, occasional hue/
 * scale jumps. Toggled via the .is-glitching modifier on the grid. */
.crt-mosaic-grid.is-glitching .crt-mosaic-tile.is-in {
  animation: build-pong-tile-glitch 280ms steps(6) infinite;
}
@keyframes build-pong-tile-glitch {
  0%   { opacity: 1.00; transform: translate(0, 0) scale(1); filter: none; }
  20%  { opacity: 0.20; transform: translate(-4px, 2px) scale(1.02); filter: hue-rotate(70deg) saturate(2); }
  45%  { opacity: 0.95; transform: translate(3px, -1px) scale(0.99); filter: invert(0.4); }
  70%  { opacity: 0.45; transform: translate(0, 3px) scale(1.01); filter: hue-rotate(-40deg); }
  100% { opacity: 0.85; transform: translate(0, 0) scale(1); filter: none; }
}

/* ── Input box ERROR variant ─────────────────────────────────────
 * When a build fails, the input card transforms in place: red
 * border, glyph swaps to ✕, label becomes BUILD FAILED, content
 * area fills with the caveman error description. No new card
 * inserted — same surface, different mode. JS sets .is-error on
 * .build-pong-input and writes the error text into the content area. */
.build-pong-input.is-error {
  border-color: rgba(255, 70, 60, 0.85);
  box-shadow:
    inset 0 0 0 1px rgba(255, 70, 60, 0.45),
    0 0 0 1px rgba(255, 70, 60, 0.45),
    0 0 28px rgba(255, 70, 60, 0.18);
  animation: build-pong-input-error-shake 360ms cubic-bezier(0.36, 0, 0.66, 1) 1;
}
@keyframes build-pong-input-error-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(2px); }
}
.build-pong-input.is-error .build-pong-input-header {
  border-bottom-color: rgba(255, 70, 60, 0.35);
}
.build-pong-input.is-error .build-pong-input-glyph {
  color: rgba(255, 90, 80, 0.95);
}
.build-pong-input.is-error .build-pong-input-label {
  color: rgba(255, 120, 105, 0.98);
  text-shadow: 0 0 10px rgba(255, 70, 60, 0.35);
}
.build-pong-input.is-error .build-pong-input-content {
  color: rgba(255, 200, 195, 0.96);
  /* Cancel the empty-state caret so the error text reads cleanly. */
}
.build-pong-input.is-error .build-pong-input-content.is-empty::before {
  content: "";
  animation: none;
}
/* Error text inside content area: caveman-style description. */
.build-pong-error-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
}
.build-pong-error-tag {
  font-size: 20px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 110, 100, 0.85);
  font-weight: 700;
}
.build-pong-error-text {
  font-size: 38px;
  line-height: 1.30;
  color: rgba(255, 220, 215, 0.96);
}

/* ── CRT big red X overlay ───────────────────────────────────────
 * Two CSS-drawn diagonal bars with red glow, centered on the CRT.
 * Toggled via .build-pong-crt.is-error. Sits above the mosaic
 * (z-index 6) so it dominates the screen during the glitch+reboot
 * window. */
.build-pong-crt-error-x {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  pointer-events: none;
}
.build-pong-crt.is-error .build-pong-crt-error-x {
  display: block;
  animation: build-pong-error-x-in 220ms cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
.build-pong-crt-error-x::before,
.build-pong-crt-error-x::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 12%;
  right: 12%;
  height: 10%;
  background: linear-gradient(180deg,
    rgba(255, 60, 50, 0.20) 0%,
    rgba(255, 80, 70, 0.96) 30%,
    rgba(255, 30, 25, 1.00) 50%,
    rgba(255, 80, 70, 0.96) 70%,
    rgba(255, 60, 50, 0.20) 100%);
  border-radius: 6px;
  box-shadow:
    0 0 20px rgba(255, 50, 40, 0.65),
    0 0 60px rgba(255, 40, 30, 0.45),
    0 0 120px rgba(255, 30, 20, 0.28);
  transform-origin: center;
}
.build-pong-crt-error-x::before { transform: translateY(-50%) rotate( 38deg); }
.build-pong-crt-error-x::after  { transform: translateY(-50%) rotate(-38deg); }
@keyframes build-pong-error-x-in {
  0%   { opacity: 0; transform: scale(1.6); }
  60%  { opacity: 1; transform: scale(0.94); }
  100% { opacity: 1; transform: scale(1); }
}

/* ── CRT reboot sequence ─────────────────────────────────────────
 * Three sequential phases driven by JS class toggles:
 *   .is-rebooting-black   — solid black (~300ms)
 *   .is-rebooting-static  — white-noise overlay (~400ms)
 *   .is-rebooting-sweep   — single scanline sweeps top→bottom (~300ms)
 * Together they read as a quick power-cycle. LED dims during the
 * black + static phases and returns to normal on sweep. */
.build-pong-crt-reboot {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  pointer-events: none;
  background: #000;
  overflow: hidden;
}
.build-pong-crt.is-rebooting-black .build-pong-crt-reboot,
.build-pong-crt.is-rebooting-static .build-pong-crt-reboot,
.build-pong-crt.is-rebooting-sweep .build-pong-crt-reboot {
  display: block;
}
.build-pong-crt.is-rebooting-static .build-pong-crt-reboot {
  /* SVG fractal noise tiled for cheap white-noise. */
  background-color: #050505;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.85 0 0 0 0 0.85 0 0 0 0 0.85 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.78'/></svg>");
  background-size: 320px 320px;
  animation: build-pong-static-noise 80ms steps(4) infinite;
}
@keyframes build-pong-static-noise {
  0%   { background-position: 0 0; }
  25%  { background-position: 120px 30px; }
  50%  { background-position: 40px 90px; }
  75%  { background-position: 200px 160px; }
  100% { background-position: 0 0; }
}
.build-pong-crt.is-rebooting-sweep .build-pong-crt-reboot::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 8%;
  background: linear-gradient(180deg,
    rgba(180, 240, 255, 0) 0%,
    rgba(220, 250, 255, 0.85) 50%,
    rgba(180, 240, 255, 0) 100%);
  box-shadow:
    0 0 40px rgba(180, 240, 255, 0.55),
    0 0 80px rgba(140, 220, 255, 0.30);
  animation: build-pong-scanline-sweep 280ms ease-out forwards;
}
@keyframes build-pong-scanline-sweep {
  0%   { top: -10%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 110%; opacity: 0; }
}
/* LED dims while CRT is in the dark phases of reboot. */
.build-pong-crt.is-rebooting-black .build-pong-crt-led,
.build-pong-crt.is-rebooting-static .build-pong-crt-led {
  opacity: 0.35;
  box-shadow: none;
}

/* ── Welcome / README notification ───────────────────────────────
 * The first thing a viewer sees: window-chrome card centered over
 * the state, listing the two key bindings the demo needs.
 * Dismisses on first interaction (handled in state.js). */
.build-pong-start-notif {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 320ms ease,
              transform 320ms cubic-bezier(.34, 1.56, .64, 1);
}
.build-pong-start-notif.is-dismissed {
  opacity: 0;
  transform: scale(0.94);
  pointer-events: none;
}
.build-pong-start-notif-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 18, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.build-pong-start-notif-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 540px);
  background: rgba(13, 27, 53, 0.94);
  border: 1px solid rgba(125, 211, 252, 0.30);
  border-radius: 8px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(125, 211, 252, 0.12);
  overflow: hidden;
  animation: build-pong-start-notif-in 480ms cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes build-pong-start-notif-in {
  0%   { opacity: 0; transform: translateY(18px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
/* Title bar — reuses the input header treatment (traffic lights +
 * prompt glyph + cyan accent border) so the visual language is
 * already familiar by the time the user reaches the SLOTWARE input. */
.build-pong-start-notif-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(180deg,
    rgba(28, 38, 60, 0.95) 0%,
    rgba(14, 22, 40, 0.95) 100%);
  border-bottom: 2px solid rgba(125, 211, 252, 0.35);
  color: rgba(232, 227, 216, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
.build-pong-start-notif-title {
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(243, 238, 255, 0.96);
}
.build-pong-start-notif-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 36px 32px 22px;
  color: rgba(243, 238, 255, 0.94);
}
.build-pong-start-notif-line {
  display: flex;
  align-items: center;
  gap: 22px;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 28px;
  font-weight: 600;
}
/* Chunky retro key cap. Slight inset shadow on the bottom for the
 * "physical key" depth read. */
.build-pong-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  height: 56px;
  padding: 0 16px;
  border-radius: 8px;
  background: linear-gradient(180deg,
    rgba(232, 227, 216, 0.94) 0%,
    rgba(206, 200, 184, 0.94) 100%);
  border: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 4px 0 rgba(0, 0, 0, 0.35),
    0 6px 16px rgba(0, 0, 0, 0.30);
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #18223a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
.build-pong-start-notif-hint {
  padding: 0 32px 22px;
  font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.70);
  text-align: center;
  animation: build-pong-start-notif-hint-pulse 1.6s ease-in-out infinite alternate;
}
@keyframes build-pong-start-notif-hint-pulse {
  from { opacity: 0.50; }
  to   { opacity: 1.00; }
}

/* ────────────────────────────────────────────────────────────────
 * MOBILE LAYOUT
 *
 * Everything below this banner is gated on `(max-width: 768px)`.
 * Desktop styles are completely untouched. The mobile layout:
 *   1. Stacks the two panes vertically (top = prompts, bottom = CRT)
 *   2. Surfaces tap-to-play affordance on the CRT pane
 *   3. Adds a floating NEXT button on the prompts pane (advance)
 *   4. Adds a corner ✕ exit button (only while fullscreen)
 *   5. Reduces font sizes to fit a narrow viewport
 *
 * Mobile-only DOM elements (.build-pong-mobile-*) default to
 * `display: none` at desktop widths so they never bleed into the
 * desktop layout.
 * ──────────────────────────────────────────────────────────────── */

/* Mobile-only DOM is invisible on desktop. */
.build-pong-mobile-advance,
.build-pong-mobile-exit,
.build-pong-mobile-play-hint {
  display: none;
}

@media (max-width: 768px) {
  /* Stack the panes vertically. Each takes half the viewport height. */
  .state.build-pong.is-active {
    flex-direction: column;
  }
  .build-pong-left {
    flex: 0 0 50%;
    width: 100%;
    height: 50%;
    padding: 14px 16px 12px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .build-pong-right {
    flex: 0 0 50%;
    width: 100%;
    height: 50%;
    padding: 12px;
    /* CRT is now tappable to enter play mode. */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  /* In mobile-fullscreen the bottom pane fills the viewport same as
     desktop fullscreen — the existing .is-fullscreen rules already
     handle the layout collapse. */

  /* ── Scale typography for narrow viewports ────────────────────── */
  .build-pong-input-content { font-size: 22px; line-height: 1.35; }
  .build-pong-input-label { font-size: 18px; letter-spacing: 0.12em; }
  .build-pong-input-glyph { font-size: 18px; }
  .stage-version-row { font-size: 18px; padding: 2px 0 6px; margin-bottom: 6px; }
  .build-pong-prompts { font-size: 20px; line-height: 1.30; gap: 10px; }
  .build-pong-prompt { font-size: 20px; padding: 12px 14px; }
  .build-pong-error-text { font-size: 22px; }
  .build-pong-error-tag { font-size: 14px; }
  .build-pong-input-content.is-empty::before { font-size: 26px; }
  .build-pong-input-header { padding: 8px 14px; gap: 10px; }
  .build-pong-input-window-btn { width: 11px; height: 11px; }
  .build-pong-input-window-buttons { gap: 6px; }
  .build-pong-spinner > span { width: 16px; height: 16px; }
  .build-pong-spinner { gap: 7px; }
  .build-pong-building-text { font-size: 16px; letter-spacing: 0.35em; }

  /* README notif scales down. */
  .build-pong-start-notif-card { width: min(94vw, 420px); }
  .build-pong-start-notif-title { font-size: 18px; }
  .build-pong-start-notif-line { font-size: 22px; gap: 16px; }
  .build-pong-key {
    min-width: 62px;
    height: 44px;
    font-size: 18px;
    padding: 0 12px;
  }
  .build-pong-start-notif-body { padding: 24px 22px 16px; gap: 16px; }
  .build-pong-start-notif-hint { padding: 0 22px 18px; font-size: 12px; }

  /* Folder + thanks scale down too so they don't dwarf the pane. */
  .build-pong-folder { width: 200px; height: 144px; }
  .build-pong-folder-label { font-size: 20px; }
  .build-pong-thanks-line-1, .build-pong-thanks-line-2 { font-size: 36px; }
  .build-pong-thanks-line-2 { font-size: 60px; }

  /* ── Tap-to-play hint over the CRT ────────────────────────────── */
  .build-pong-mobile-play-hint {
    display: block;
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 7;
    padding: 8px 16px;
    background: rgba(8, 16, 32, 0.78);
    border: 1px solid rgba(125, 211, 252, 0.45);
    border-radius: 4px;
    font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: rgba(125, 211, 252, 0.95);
    text-shadow: 0 0 8px rgba(125, 211, 252, 0.45);
    pointer-events: none;
    animation: build-pong-start-notif-hint-pulse 1.6s ease-in-out infinite alternate;
  }
  /* Hide the play hint once we're in fullscreen play mode. */
  .state.build-pong.is-fullscreen .build-pong-mobile-play-hint {
    display: none;
  }

  /* ── Floating NEXT button on the prompts pane ─────────────────── */
  .build-pong-mobile-advance {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 8;
    padding: 12px 18px;
    background: linear-gradient(180deg,
      rgba(28, 38, 60, 0.96) 0%,
      rgba(14, 22, 40, 0.96) 100%);
    border: 1px solid rgba(125, 211, 252, 0.55);
    border-radius: 6px;
    box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.45),
      0 0 18px rgba(125, 211, 252, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: rgba(232, 244, 255, 0.96);
    font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.16em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 140ms ease, box-shadow 140ms ease;
  }
  .build-pong-mobile-advance:active {
    transform: scale(0.96);
    box-shadow:
      0 1px 4px rgba(0, 0, 0, 0.45),
      0 0 10px rgba(125, 211, 252, 0.10),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  .build-pong-mobile-advance-icon {
    color: rgba(125, 211, 252, 1.0);
    text-shadow: 0 0 8px rgba(125, 211, 252, 0.55);
    font-size: 14px;
  }
  /* NEXT is hidden during fullscreen (prompts pane is collapsed). */
  .state.build-pong.is-fullscreen .build-pong-mobile-advance {
    display: none;
  }

  /* ── Corner ✕ exit button (fullscreen only) ───────────────────── */
  .state.build-pong.is-fullscreen .build-pong-mobile-exit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 20;
    width: 44px;
    height: 44px;
    background: rgba(8, 16, 32, 0.82);
    border: 1px solid rgba(255, 90, 80, 0.55);
    border-radius: 50%;
    color: rgba(255, 200, 195, 0.95);
    font-family: "Iosevka", "JetBrains Mono", ui-monospace, monospace;
    font-weight: 800;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
      0 4px 14px rgba(0, 0, 0, 0.55),
      0 0 12px rgba(255, 90, 80, 0.20);
    transition: transform 140ms ease;
  }
  .state.build-pong.is-fullscreen .build-pong-mobile-exit:active {
    transform: scale(0.93);
  }
}
