/* CRT look: phosphor green on near-black, scanlines, slight bloom. One self-hosted monospace webfont (JetBrains Mono, OFL-1.1, web/fonts/), system monospace only as a fallback. */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }
:root { --fg: #33ff33; --dim: #22b022; --bg: #050805; --warn: #ffb000; --hot: #ff6a3d; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, "DejaVu Sans Mono", "Courier New", monospace;
  font-size: 16px; line-height: 1.35; }
body { min-height: 100%; background: radial-gradient(ellipse at center, #0a140a 0%, var(--bg) 70%); }
.top { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; padding: .5rem 1rem 0; }
.intro { flex: 1 1 24rem; min-width: 0; }
.subtitle { margin: .1rem 0; }
.pitch { margin: .25rem 0; max-width: 60rem; }
.install { margin: .25rem 0; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; }
.install code { color: var(--fg); border: 1px solid var(--dim); padding: .1rem .5rem; overflow-wrap: anywhere; }
.built-with { margin: .25rem 0; }
.built-with a { color: var(--fg); }
h1, h2 { margin: 0 0 .5rem; font-size: 1rem; letter-spacing: .2em; text-transform: uppercase; text-shadow: 0 0 6px rgba(51, 255, 51, .6); }
h1 { margin: 0; font-size: 1.25rem; }
button { font: inherit; color: var(--fg); background: transparent; border: 1px solid var(--dim); padding: .25rem .75rem; cursor: pointer; }
button:hover, button[aria-pressed="true"] { background: var(--fg); color: #000; }
:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--fg); color: #000; padding: .5rem; z-index: 10; }
.skip:focus { left: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.crt { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; padding: 1rem;
  box-shadow: inset 0 0 120px rgba(0, 0, 0, .85); border-radius: 1.5rem; }
.left { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.pane { border: 1px solid var(--dim); padding: .75rem 1rem; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.transcript { height: 40vh; min-height: 12rem; overflow-y: auto; }
.event-log { flex: 1; overflow-y: auto; min-height: 0; margin: 0; padding-left: 0; list-style: none; }
.line { white-space: pre-wrap; text-shadow: 0 0 4px rgba(51, 255, 51, .5); }
.line.echo { color: var(--dim); }
.input-row { display: flex; gap: .5rem; margin-top: .5rem; }
.input-row input { flex: 1; background: transparent; border: 0; border-bottom: 1px solid var(--dim);
  color: var(--fg); font: inherit; outline: none; caret-color: var(--fg); }
.input-row input:focus-visible { border-bottom-color: var(--warn); }
.event-log li { margin-bottom: .25rem; }
.event-log li.rejected { color: var(--warn); }
.muted { color: var(--dim); margin: 0; }

/* The plate: 80 columns of engraved ASCII. */
.plate { margin: 0; overflow-x: auto; font: inherit; font-size: 13px; line-height: 1.15; white-space: pre;
  text-shadow: 0 0 5px rgba(51, 255, 51, .45); }
.plate-summary { margin: .5rem 0 0; color: var(--dim); }
.plate [data-state="Healthy"] { color: var(--dim); text-shadow: none; }
.plate [data-state="Rotting"] { color: #c8e63c; }
.plate [data-state="Possessed"] { color: var(--hot); text-shadow: 0 0 6px rgba(255, 106, 61, .6); display: inline-block;
  animation: glitch 4s steps(1, end) infinite; }
.plate [data-state="Healed"] { color: var(--fg); }
.plate .just-healed { animation: healed 1.6s ease-out 1; }
@keyframes glitch {
  0%, 92%, 100% { transform: none; text-shadow: 0 0 6px rgba(255, 106, 61, .6); }
  93% { transform: translateX(1px); text-shadow: -2px 0 rgba(0, 255, 255, .6), 2px 0 rgba(255, 0, 80, .6); }
  95% { transform: translateX(-1px); }
  97% { transform: none; text-shadow: 2px 0 rgba(0, 255, 255, .6), -2px 0 rgba(255, 0, 80, .6); }
}
.plate .convulsing { display: inline-block; animation: convulse .5s linear 3; color: #ff4d4d; }
.line.reject { color: #ff6a3d; }
.sim-label { color: var(--hot); font-weight: bold; }
@keyframes convulse {
  0%, 100% { transform: none; }
  20% { transform: translate(2px, -1px) skewX(6deg); }
  40% { transform: translate(-2px, 1px) skewX(-6deg); }
  60% { transform: translate(2px, 1px); }
  80% { transform: translate(-1px, -1px); }
}
@keyframes healed {
  0% { color: #fff; text-shadow: 0 0 14px #fff; }
  100% { color: var(--fg); text-shadow: 0 0 5px rgba(51, 255, 51, .45); }
}

/* Scanlines and phosphor flicker-free vignette: CSS only, ignore the pointer. */
body::after { content: ""; position: fixed; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, .22) 3px); }

@media (max-width: 700px) { .crt { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* High-contrast / screen-reader mode: plain text, no effects. */
body.hc { background: #000; color: #fff; }
body.hc::after { display: none; }
body.hc .crt { box-shadow: none; border-radius: 0; background: #000; }
body.hc * { text-shadow: none !important; animation: none !important; }
body.hc .pane { border-color: #fff; }
body.hc h1, body.hc h2 { letter-spacing: normal; }
body.hc .plate [data-state], body.hc .line.echo, body.hc .muted, body.hc .plate-summary { color: #fff; }
body.hc .event-log li.rejected { color: #ffd54a; }
body.hc button, body.hc .manual-link { color: #fff; border-color: #fff; }
body.hc button[aria-pressed="true"] { background: #fff; color: #000; }

.subtitle { margin: .15rem 0 0; color: var(--dim); }
.side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.payload { margin: 0; max-height: 14rem; overflow: auto; white-space: pre-wrap; font: inherit; font-size: 13px; }
.gallery-list { list-style: none; margin: 0; padding: 0; max-height: 14rem; overflow-y: auto; }
.gallery-list a, #demo-link { color: var(--fg); }
.gallery-list a { display: inline-block; min-height: 24px; line-height: 24px; }
#lookup { width: 100%; background: transparent; border: 1px solid var(--dim); color: var(--fg); font: inherit; padding: .25rem; margin: .25rem 0; }
button:disabled { opacity: .5; cursor: default; }
/* 3D bench (web/theatre.js). The DOM panes stay in the page for screen readers and keyboard focus,
   visually replaced by the canvas. The plain 2D page is unchanged when this class is absent. */
body.theatre { overflow: hidden; background: #050403; }
body.theatre::after { display: none; }
body.theatre #theatre-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
body.theatre .top > :not(.intro), body.theatre .intro > :not(h1), body.theatre .crt { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#theatre-plain { position: fixed; right: var(--bar-edge); bottom: var(--bar-edge); box-sizing: border-box; max-width: var(--bar-right); z-index: 5; color: var(--fg); background: #000; border: 1px solid var(--dim); padding: .25rem .75rem; }
#theatre-manual { position: fixed; left: 13rem; top: .5rem; z-index: 6; color: var(--fg); background: #000; border: 1px solid var(--dim); padding: .25rem .75rem; min-height: 24px; }
.manual-link { color: var(--fg); border: 1px solid var(--dim); padding: .25rem .75rem; min-height: 24px; display: inline-block; }
.views { display: flex; flex-wrap: wrap; gap: .5rem; flex: 1 1 100%; }
.manual-link:focus-visible, #theatre-manual:focus-visible, #theatre-plain:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }

/* Bench drawer (web/theatre/drawer.js): the A3 actions inside the 3D theatre. */
#bench-drawer { position: fixed; left: var(--bar-edge); bottom: var(--bar-drawer-bottom); z-index: 5; max-width: min(24rem, calc(100vw - 2rem)); color: var(--fg); background: #000; border: 1px solid var(--dim); padding: .25rem .75rem; box-sizing: border-box;
  /* The whole drawer (toggle, border, body) stays below the top bar (manual link); the body scrolls inside. */
  display: flex; flex-direction: column; max-height: calc(100vh - var(--bar-drawer-bottom) - 4rem); max-height: calc(100dvh - var(--bar-drawer-bottom) - 4rem); }
#bench-drawer-body { padding: .5rem 0; box-sizing: border-box; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#bench-drawer h2 { margin: 0 0 .25rem; font-size: 1rem; }
#bench-drawer input { width: 100%; box-sizing: border-box; background: transparent; border: 1px solid var(--dim); color: var(--fg); font: inherit; padding: .25rem; margin: .25rem 0; }
#bench-drawer a { color: var(--fg); }
/* The raid (web/raid.js). On the 2D page it is a labelled region; on the 3D bench the wall board shows the
   same text and only the buttons stay on screen. */
.raid { margin: 0 1rem 1rem; }
.raid-readout p { margin: .15rem 0; }
.raid-actions { display: flex; gap: .75rem; margin: .5rem 0; flex-wrap: wrap; }
.raid-actions button { font: inherit; color: var(--fg); background: #000; border: 1px solid var(--dim); padding: .35rem .75rem; cursor: pointer; }
.raid-actions button:disabled { opacity: .5; cursor: default; }
body.theatre #raid { position: fixed; left: var(--bar-edge); bottom: var(--bar-edge); box-sizing: border-box; max-width: var(--bar-left); z-index: 5; margin: 0; padding: .5rem; background: rgba(0,0,0,.7); }
body.theatre #raid > h2, body.theatre #raid > p, body.theatre .raid-readout { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Simulated CI controls (web/heal.js). In 3D the buttons float bottom right; the label is drawn on the wall plate. */
body.theatre #sim { position: fixed; right: var(--bar-edge); bottom: calc(var(--bar-edge) + 2.5rem); box-sizing: border-box; max-width: var(--bar-right); z-index: 5; margin: 0; padding: .5rem; background: rgba(0,0,0,.7); }
body.theatre #sim > h2, body.theatre #sim > p { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sim { margin: 0 1rem 1rem; }

/* Sound toggle (web/theatre/sound.js): visible in the 2D page and over the 3D bench. */
.sound-toggle { position: fixed; top: .5rem; right: .5rem; z-index: 6; font: inherit; color: var(--fg); background: #000; border: 1px solid var(--dim); padding: .25rem .75rem; cursor: pointer; }
.sound-toggle[aria-pressed="true"] { border-color: var(--fg); }
.sound-toggle:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
body:not(.theatre) .sound-toggle { position: static; display: block; margin: .5rem 1rem 0 auto; }

/* Title card (web/theatre/stage.js): 3D path only, 3 seconds, any key or click skips it. */
#title-card { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2rem;
  background: #000; color: var(--fg); font-size: clamp(1.4rem, 4vw, 3rem); letter-spacing: .08em; text-shadow: 0 0 12px rgba(51, 255, 51, .6);
  animation: card-out .6s ease-in 2.4s forwards; cursor: pointer; }
@keyframes card-out { to { opacity: 0; } }

/* Recording mode (web/theatre.js): hides the chrome, keeps the CRT and the plate. Escape or the hidden button reverses it. */
.record-toggle { position: fixed; top: .5rem; left: .5rem; z-index: 6; font: inherit; font-size: .75rem; color: var(--dim); background: #000; border: 1px solid var(--dim); padding: .1rem .5rem; cursor: pointer; opacity: .6; }
.record-toggle:focus-visible { opacity: 1; outline: 2px solid var(--fg); outline-offset: 2px; }
body.record .top, body.record .events, body.record #theatre-plain, body.record #theatre-manual, body.record #bench-drawer, body.record #raid, body.record #sim, body.record #gallery { display: none; }
body.record .sound-toggle, body.record .record-toggle:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Game feel (web/raid.js, G1). Every animated piece has a plain text twin in the readout, so prefers-reduced-motion
   and high-contrast mode lose the motion and keep the information. */
.raid-hud p { margin: .25rem 0; }
.raid-big { font-size: 1.4rem; font-weight: bold; }
.raid-pop { color: var(--warn); font-size: 1rem; }
.raid-heart { color: var(--hot); display: inline-block; }
.raid-health { display: inline-block; vertical-align: middle; width: 12rem; height: .9rem; border: 1px solid var(--dim); }
.raid-health-fill { display: block; height: 100%; width: var(--pct, 100%); background: var(--fg); }
.raid-chip { color: var(--warn); }
.raid-boss { border: 1px solid var(--hot); color: var(--hot); padding: .25rem .5rem; font-weight: bold; }
.raid-trophies { list-style: none; margin: 0; padding: 0; }
.raid-trophies li[data-earned="false"] { color: var(--dim); }
.raid-trophies li[data-earned="true"] { color: var(--warn); }
body.theatre .raid-hud { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .raid-heart { animation: beat var(--beat, 1.2s) ease-in-out infinite; }
  .raid-pop { animation: pop-up .9s ease-out 1; }
  body.fx-pop .raid-chip { animation: chip-pop .5s ease-out 1; }
  body.fx-shake .crt { animation: shake .5s linear 1; }
  body.fx-flash::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 30; background: #fff; animation: flash .9s ease-out 1; }
  .raid-health-fill { transition: width .6s ease; }
}
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.35); } 30% { transform: scale(1); } 45% { transform: scale(1.2); } }
@keyframes pop-up { from { opacity: 0; transform: translateY(.5rem); } 30% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes chip-pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, -2px); } 80% { transform: translate(3px, 2px); } }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
body.hc .raid-heart, body.hc .raid-pop, body.hc .raid-chip, body.hc .crt, body.hc::before { animation: none !important; }
body.hc .raid-boss { border-color: #fff; color: #fff; }
body.hc .raid-health-fill { background: #fff; }

/* Getting started and pressure (web/onboarding.js, web/raid.js, G3). Text first: nothing here pulses or moves. */
.daily-banner { margin: .25rem 1rem; color: var(--warn); }
.tutorial-command { font-weight: bold; }
.tutorial-hint { color: var(--warn); min-height: 1.2em; }
.raid-pressure { display: inline-block; vertical-align: middle; width: 12rem; height: .9rem; border: 1px solid var(--dim); }
.raid-pressure-fill { display: block; height: 100%; width: var(--pct, 0%); background: var(--hot); }
body.hc .raid-pressure-fill { background: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .raid-pressure-fill { transition: width .6s ease; }
}

/* Above the fold (web/index.html). The toolbar holds the two page toggles in one row on the 2D page, so neither
   covers the title. On the 3D bench the toolbar vanishes from layout and each toggle keeps its fixed corner. */
.toolbar { display: flex; justify-content: flex-end; gap: .5rem; padding: .35rem 1rem 0; }
body.theatre .toolbar { display: contents; }
body:not(.theatre) .record-toggle { position: static; opacity: 1; font-size: 1rem; padding: .25rem .75rem; }
body:not(.theatre) .sound-toggle { margin: 0; display: inline-block; }

/* SEAL badge (web/app.js). Shown while the page is sealed, on the 2D page and over the 3D bench. */
.seal-badge { margin: .25rem 1rem; padding: .35rem .75rem; border: 2px solid var(--hot); color: var(--hot); font-weight: bold; }
.seal-badge[hidden] { display: none; }
body.theatre .seal-badge { position: fixed; top: .5rem; left: 50%; transform: translateX(-50%); z-index: 7; margin: 0; background: #000; }
body.hc .seal-badge { border-color: #fff; color: #fff; }
.drawer-pitch { margin: .25rem 0; }
.drawer-install code { display: block; margin: .25rem 0; overflow-wrap: anywhere; }

/* Prompt in reach (2D page): the game pane comes before the plate, the transcript is capped and the tutorial strip is compact,
   so the command box is inside the first viewport once the tutorial is closed. DOM order is unchanged for screen readers. */
body:not(.theatre) .game { order: -1; }
body:not(.theatre) .transcript { height: min(40vh, 14rem); min-height: 8rem; }
.tutorial { margin: .25rem 1rem; padding: .35rem .75rem; display: grid; grid-template-columns: 1fr auto; column-gap: 1rem; align-items: center; }
.tutorial h2 { grid-column: 1 / -1; margin: 0; }
.tutorial p { margin: 0; }
.tutorial .tutorial-hint { min-height: 0; }
.tutorial .raid-actions { grid-column: 2; grid-row: 2 / span 3; margin: 0; flex-direction: column; gap: .25rem; }
.tutorial[hidden] { display: none; }
@media (max-width: 700px) {
  body:not(.theatre) .transcript { height: 9rem; min-height: 6rem; }
  .tutorial { grid-template-columns: 1fr; }
  .tutorial .raid-actions { grid-column: 1; grid-row: auto; flex-direction: row; }
}
.try-chip { white-space: nowrap; color: var(--warn); border-color: var(--warn); }
.try-chip[hidden] { display: none; }
.input-row { align-items: baseline; flex-wrap: wrap; }
.input-row input { min-width: 8rem; }

/* Bottom bar of the 3D bench: one layout with three slots, sized by the variables below so no slot depends on the
   width of its neighbour's content.
     left   = #raid (bottom row) with #bench-drawer above it
     centre = #theatre-caption (the pitch), fills the space between the side slots
     right  = #sim above #theatre-plain
   Every piece stays position:fixed (the visual QA check reads computed positions), but all offsets come from these
   variables. Under 1100px there is no room for a centre slot, so the caption becomes a full-width row above the
   side slots and the drawer moves up one row. */
body.theatre {
  --bar-edge: 1rem; --bar-gap: 1rem;
  --bar-left: 32rem; --bar-right: 24rem;
  --bar-row: 7rem;
  --bar-drawer-bottom: calc(var(--bar-edge) + var(--bar-row) + .25rem);
}
@media (max-width: 1100px) { body.theatre { --bar-drawer-bottom: calc(var(--bar-edge) + var(--bar-row) + 3.75rem); } }
/* The pitch: wraps inside the centre slot, then truncates after 3 lines. The full sentence is the title tooltip. */
.theatre-caption { display: none; }
body.theatre .theatre-caption { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; box-sizing: border-box; position: fixed; z-index: 4; bottom: var(--bar-edge);
  left: calc(var(--bar-edge) + var(--bar-left) + var(--bar-gap)); right: calc(var(--bar-edge) + var(--bar-right) + var(--bar-gap));
  margin: 0; padding: .15rem .5rem; font-size: .8rem; line-height: 1.25; color: var(--fg); background: rgba(0, 0, 0, .65); border: 1px solid var(--dim); }
body.record .theatre-caption { display: none; }
@media (max-width: 1100px) { body.theatre .theatre-caption { -webkit-line-clamp: 2; line-clamp: 2; bottom: calc(var(--bar-edge) + var(--bar-row) + .25rem); left: var(--bar-edge); right: var(--bar-edge); } }

/* Visual QA 1 (issue #56). The side stats get their own row so they never share a line with the health bar. */
.raid-readout #raid-nights { display: block; clear: both; margin: .5rem 0; }
.raid-hud p:has(> .raid-health) { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.raid-hud #raid-vitals { display: block; margin: .25rem 0 .5rem; }
.game .muted { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin-bottom: .5rem; }
.view-3d-row { margin: .5rem 1rem 0; }
.view-3d-row:has(#view-3d[hidden]) { display: none; }
.view-3d { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: .25rem .75rem; color: var(--fg); border: 1px solid var(--fg); }

/* Small screens (below 900px): the 2D page is one column in the order plate, game, raid, sim, then the rest.
   Nothing is fixed or absolute over a control, every control is at least 44px, and the page never scrolls sideways. */
@media (max-width: 899px) {
  html, body { overflow-x: hidden; }
  body:not(.theatre) { display: flex; flex-direction: column; }
  body:not(.theatre) > * { order: 0; min-width: 0; max-width: 100%; }
  body:not(.theatre) .crt, body:not(.theatre) .left, body:not(.theatre) .side { display: contents; }
  body:not(.theatre) .crt { box-shadow: none; }
  /* R2: the first screen is the title, the problem line, Scan your repo, Play and the paste form. The plate and the game
     follow. The what/proof lines, the 3-step strip, Watch it run, the Bench and the header links sit below the game. */
  body:not(.theatre) .top, body:not(.theatre) .hero, body:not(.theatre) .hero-actions { display: contents; }
  body:not(.theatre) .top > *, body:not(.theatre) .hero > *, body:not(.theatre) .hero-actions > * { min-width: 0; max-width: 100%; }
  body:not(.theatre) .intro { order: 0; flex: none; margin: 0 1rem; }
  body:not(.theatre) .intro .pitch { font-size: .85rem; margin: .25rem 0; }
  body:not(.theatre) .intro .subtitle { margin: .1rem 0; }
  body:not(.theatre) #hero-problem { order: 1; margin: .25rem 1rem 0; }
  body:not(.theatre) #hero-scan { order: 2; margin: .35rem 1rem 0; flex: none; }
  body:not(.theatre) #hero-play { order: 3; margin: .35rem 1rem 0; flex: none; }
  body:not(.theatre) .paste { order: 4; }
  body:not(.theatre) .plate-pane { order: 5; margin: .5rem 1rem 0; }
  body:not(.theatre) .game { order: 6; margin: 1rem 1rem 0; }
  body:not(.theatre) #judge-replay, body:not(.theatre) #daily-banner, body:not(.theatre) #tutorial { order: 7; }
  body:not(.theatre) #judge-replay { margin: .5rem 1rem 0; }
  body:not(.theatre) #raid { order: 7; margin: 1rem; }
  body:not(.theatre) #sim { order: 8; margin: 0 1rem 1rem; }
  body:not(.theatre) .side > .pane { order: 9; margin: 0 1rem 1rem; }
  body:not(.theatre) #proof { order: 10; margin: 0 1rem 1rem; }
  body:not(.theatre) #hero-what, body:not(.theatre) #hero-proof, body:not(.theatre) #hero-steps { order: 11; margin: .25rem 1rem; }
  body:not(.theatre) #hero-watch { order: 12; margin: .35rem 1rem 0; flex: none; }
  body:not(.theatre) .bench { order: 13; }
  body:not(.theatre) .manual-link { order: 14; margin: .35rem 1rem 0; }
  body:not(.theatre) .views { order: 14; margin: .35rem 1rem 0; flex: none; }
  body:not(.theatre) #hc-toggle { order: 15; margin: .35rem 1rem; }
  body.record:not(.theatre) .top { display: none; }
  body.judge-running:not(.theatre) .intro { padding-top: 2.75rem; }
  /* The workflow line is desktop only on small screens it would push the game down. */
  body:not(.theatre) .workflow-line { display: none; }
  /* The hero already carries the proof line on small screens; the header copy would push the game down. */
  body:not(.theatre) #proof-line { display: none; }
  body:not(.theatre)::after { display: none; }
  body:not(.theatre) .plate { overflow-x: auto; max-width: 100%; }
  body:not(.theatre) .transcript { height: 10rem; }
  button, .raid-actions button, .manual-link, .view-3d, .gallery-list a, .skip:focus, input, .pane a, .built-with a { min-height: 44px; min-width: 44px; }
  .pane a, .built-with a, .gallery-list a { display: inline-flex; align-items: center; }
  .gallery-list a { line-height: 1.2; }
  #lookup, .input-row input { min-height: 44px; }
  .install code { display: block; }
  .raid-health, .raid-pressure { width: min(12rem, 100%); }
  .toolbar { flex-wrap: wrap; }
}

/* First 60 seconds (web/live-exhume.js, issue #78). The first screen is the plate, the CRT, the pitch and one primary
   button. The Bench holds everything else: closed it takes no room and is out of the accessibility tree. */
.paste { margin: .5rem 1rem; }
.primary { font-size: 1.1rem; font-weight: bold; padding: .5rem 1.25rem; min-height: 44px; border: 2px solid var(--fg); background: var(--fg); color: #000; }
.primary:hover { background: #000; color: var(--fg); }
.paste-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.paste-form[hidden] { display: none; }
.paste-form label { font-size: 1.15rem; font-weight: bold; }
.paste-form .paste-hint { flex: 1 1 100%; margin: 0; }
.paste-funnel { font-size: 1.15rem; font-weight: bold; margin: .5rem 0; }
.paste-share-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.paste-share-row button { min-height: 44px; }
.paste-share-row code { overflow-wrap: anywhere; }
.paste-form label { flex: 1 1 100%; }
.paste-form input { flex: 1 1 20rem; min-height: 44px; background: transparent; border: 1px solid var(--dim); color: var(--fg); font: inherit; padding: .25rem; }
.paste-form button { min-height: 44px; }
.paste .muted { margin: .25rem 0; }
.paste-result[hidden] { display: none; }
.paste-result { border: 1px solid var(--dim); padding: .5rem 1rem; margin: .5rem 0; }
.paste-result h2, .paste-result h3 { margin: .75rem 0 .25rem; }
.paste-result .plate { overflow-x: auto; max-width: 100%; }
.paste-limbs, .paste-owners { margin: .25rem 0; padding-left: 1.5rem; overflow-wrap: anywhere; }
.paste-sla { display: inline-block; border: 1px solid var(--dim); padding: 0 .4rem; margin-left: .25rem; white-space: nowrap; }
.paste-export-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.paste-export-row button { min-height: 44px; }
.paste-export-label { overflow-wrap: anywhere; }
.paste-payload { border-left: 2px solid var(--dim); padding-left: .75rem; margin: .5rem 0; }
.paste-payload-title { font-weight: bold; margin: .1rem 0; }
.paste-payload-label { color: var(--warn); margin: .1rem 0; overflow-wrap: anywhere; }
.paste-payload .payload { max-height: 12rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.paste-play { display: inline-flex; align-items: center; min-height: 44px; padding: .25rem .75rem; color: var(--fg); border: 1px solid var(--fg); }
.paste-cmd { display: block; overflow-wrap: anywhere; border: 1px solid var(--dim); padding: .25rem .5rem; margin: .25rem 0; }
.bench { margin: 0 1rem; }
.bench-toggle { min-height: 44px; }
.bench-note { margin: .5rem 0; }
.bench-body { padding: .25rem 0 .5rem; }
body:not(.theatre) .bench:not(.open) .bench-body { display: none; }
body:not(.theatre) .bench-body .toolbar { justify-content: flex-start; padding: 0; margin: .5rem 0; }
body:not(.theatre) .bench-body .pane { margin: .5rem 0; }
body:not(.theatre) .bench-body .view-3d-row { margin: .5rem 0; }
/* 3D bench: the existing drawer opens the Bench content; closed, nothing of it is on screen. */
body.theatre .bench { margin: 0; }
body.theatre .bench-toggle, body.theatre .bench-note { display: none; }
body.theatre .bench-body { display: none; }
body.theatre.drawer-open .bench-body, body.theatre.record .bench-body { display: contents; }
body.theatre.drawer-open .bench-extra { display: none; }
body.record .bench-toggle, body.record #gallery, body.record .bench-extra, body.record .bench-note, body.record .paste { display: none; }
body.theatre .paste { position: fixed; top: .5rem; left: 50%; transform: translateX(-50%); z-index: 6; margin: 0; width: 24rem; max-width: calc(100vw - 2rem); background: rgba(0, 0, 0, .85); padding: .25rem; }
body.theatre .paste .muted { font-size: .8rem; }
body.theatre .paste-form { margin: .25rem 0 0; }
body.theatre #paste-status:empty { display: none; }
/* The 3D bench and the judge demo keep the scan form to one compact row; the label stays for screen readers. */
body.theatre .paste-form { flex-wrap: nowrap; }
body.theatre .paste-form input { flex: 1 1 auto; min-width: 0; }
body.theatre .paste-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.theatre .paste-hint, body.judge-running .paste-hint { display: none; }
body.theatre .paste-form .primary { font-size: 1rem; padding: .25rem .75rem; white-space: nowrap; }
body.theatre .judge-counter:not(.judge-counter-inline) { top: 5rem; }
body.theatre .seal-badge { top: 4.5rem; }
body.hc .primary { background: #fff; color: #000; border-color: #fff; }
@media (max-width: 899px) {
  .paste-form input { flex-basis: 100%; }
}
body.theatre #gallery { display: none; }

/* Judge mode (web/judge-mode.js, .kiro/specs/judge-mode): the 45-second self-running demo. */
.judge-stage { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.judge-title { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2rem; background: #000; color: var(--fg); font-size: clamp(1.4rem, 4vw, 2.6rem); font-weight: bold; text-shadow: 0 0 12px var(--fg); }
.judge-title[hidden] { display: none; }
.judge-caption { position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); width: min(46rem, calc(100vw - 2rem)); margin: 0; padding: .5rem .9rem; box-sizing: border-box; text-align: center; background: #000; color: var(--fg); border: 1px solid var(--fg); }
.judge-counter { position: absolute; left: 50%; top: 4rem; transform: translateX(-50%); margin: 0; padding: .3rem .9rem; background: #000; color: var(--warn); border: 1px solid var(--warn); font-weight: bold; font-family: "JetBrains Mono", ui-monospace, "DejaVu Sans Mono", system-ui, sans-serif; }
.judge-counter[hidden] { display: none; }
.judge-counter.judge-counter-inline { position: static; transform: none; display: block; text-align: center; margin: 0 0 .5rem; }
/* While the demo runs the pitch strip sits behind the caption bar and the getting-started card would compete with it: hide both until it ends or is skipped. */
body.judge-running #theatre-caption, body.judge-running #tutorial { display: none !important; }
/* The fixed Skip button would sit on the title and subtitle of the 2D page, so the header makes room for it while the demo runs. */
body.judge-running:not(.theatre) .top { padding-top: 2.75rem; }
.judge-skip { position: fixed; top: .5rem; right: .5rem; z-index: 50; font: inherit; font-size: .9rem; padding: .3rem .8rem; background: #000; color: var(--fg); border: 1px solid var(--fg); cursor: pointer; }
.judge-skip[hidden] { display: none; }
.judge-skip:focus-visible, .judge-replay:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.judge-replay { color: var(--fg); font-size: .85rem; margin-left: .75rem; }
.judge-line { color: var(--warn); }
body.record .judge-skip, body.record .judge-replay { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .plate.judge-draw { animation: judge-draw 5s steps(var(--judge-lines, 20), end) both; }
  .judge-slide { animation: judge-slide 1s ease-out both; }
}
@keyframes judge-draw { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes judge-slide { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Share card panel (D3) */
.card-panel { margin: .5rem 0; }
.card-toggle { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; }
.card-toggle input { width: 24px; height: 24px; }
.card-canvas { display: block; width: 100%; max-width: 600px; height: auto; aspect-ratio: 1200 / 627; border: 1px solid var(--dim); margin: .5rem 0; }
.card-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin: .5rem 0; }
.card-actions button { font: inherit; color: var(--fg); background: #000; border: 1px solid var(--dim); padding: .35rem .75rem; cursor: pointer; min-height: 44px; }
.card-text { overflow-wrap: anywhere; }
.raid-share[hidden] { display: none; }

/* Import drop zone (inside the Bench drawer) */
.import { margin: .5rem 0; }
.import h2 { margin: .5rem 0 .25rem; }
.import-privacy { margin: .25rem 0; }
.import-drop { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; min-height: 44px; padding: .5rem; border: 2px dashed var(--dim); }
.import-drop.over { border-style: solid; border-color: var(--fg); }
.import-drop label { flex: 1 1 100%; }
.import-drop input[type="file"] { flex: 1 1 14rem; min-height: 44px; color: var(--fg); font: inherit; max-width: 100%; }
.import-drop:focus-within, .import select:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.import select { min-height: 44px; background: transparent; color: var(--fg); border: 1px solid var(--dim); font: inherit; }
@media (prefers-reduced-motion: no-preference) { .import-drop { transition: border-color .15s; } }
.paste-chip { min-height: 44px; background: transparent; border: 1px solid var(--dim); color: var(--fg); font: inherit; padding: 0 .75rem; cursor: pointer; }
.paste-source { font-weight: bold; margin: .25rem 0; }

.proof-line { margin: .25rem 0 0; }
.workflow-line { margin: 0; flex: 1 1 100%; font-size: .9rem; }
.workflow-line a { color: var(--fg); text-decoration: underline; }
.rehearsal { margin: 0 0 .5rem; }
.proof { margin: 1rem; }
.proof-list { margin: .5rem 0; padding-left: 1.5rem; overflow-wrap: anywhere; }
.proof-list li { margin: .35rem 0; }
.proof a, .proof-line a, .rehearsal a { color: var(--fg); text-decoration: underline; }
.pane.proof a, .pane.proof-line a { display: inline; min-height: 0; min-width: 0; padding: .6rem 0; }
/* Hero (issue #120): the problem, what CRYPT does, proof and three next actions, compact so the game stays above the fold. */
.hero { margin: .25rem 1rem 0; padding: .4rem .75rem; border: 1px solid var(--dim); }
.hero-line { margin: .15rem 0; max-width: 70rem; }
.hero-line a { color: var(--fg); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 .3rem; }
.hero-cta { font: inherit; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .25rem .9rem; color: var(--fg); background: transparent; border: 1px solid var(--fg); text-decoration: none; cursor: pointer; }
.hero-cta:hover { background: var(--fg); color: #000; }
.hero-steps { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; list-style: none; margin: .25rem 0 0; padding: 0; color: var(--dim); }
.hero-steps li + li::before { content: ">"; margin-right: .5rem; }
body.record .hero, body.judge-running .hero, body.theatre.drawer-open .hero { display: none; }
/* On the 3D bench the hero is a fixed panel above the caption, between the Bench drawer and the Plain page link. */
body.theatre .hero { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); z-index: 5; margin: 0; width: min(52rem, calc(100vw - 24rem)); background: rgba(0, 0, 0, .88); font-size: .85rem; }
body.theatre .hero-cta { min-height: 32px; padding: .1rem .75rem; }
body.theatre .hero-actions { margin: .3rem 0 .2rem; }
/* Short windows (1280x720 after judge mode): keep the problem line and the buttons, so the hero leaves the bench terminal in view. */
@media (min-width: 1101px) and (max-height: 760px) { body.theatre .hero #hero-what, body.theatre .hero #hero-proof, body.theatre .hero .hero-steps { display: none; } }
body.hc .hero-cta { border-color: #fff; }
@media (max-width: 899px) {
  .hero { padding: .3rem .5rem; font-size: .9rem; }
  .hero-actions { gap: .35rem; }
  .hero-cta { flex: 1 1 100%; min-height: 44px; }
  .hero-steps { gap: .1rem .75rem; font-size: .8rem; }
  .hero-steps li + li::before { margin-right: .25rem; }
}
/* On the 3D bench the page title stays visible at the top left, clear of the manual link and the Paste button. */
body.theatre .top { position: fixed; left: 1rem; top: .5rem; z-index: 6; width: auto; padding: 0; display: block; }
body.theatre .intro { flex: none; }
body.theatre .top h1 { margin: 0; padding: .25rem .5rem; background: rgba(0, 0, 0, .85); }
body.theatre.drawer-open .top { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }

/* Scan input under the hero: keep it compact on phones so the game input stays within reach (issue #123). */
@media (max-width: 899px) {
  .paste { margin: .25rem .5rem; }
  .paste-form { gap: .25rem; margin: .25rem 0; }
  .paste-form label { font-size: 1rem; }
  .paste-form .paste-hint { font-size: .8rem; }
  .paste-form input { flex: 1 1 10rem; min-width: 0; }
}
.paste-exorcised { margin: .5rem 0; }
.paste-exorcised summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.paste-exorcised-list { overflow-wrap: anywhere; }
.paste-exorcised a { display: inline-block; min-height: 44px; line-height: 44px; }
.paste-exorcised a { color: inherit; text-decoration: underline; }
