@font-face { font-family: "Limelight"; src: url(fonts/Limelight.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Manrope"; src: url(fonts/Manrope.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(fonts/GeistMono.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --scarlet: #a3162b; --fold-dark: #6e0f1f; --fold-light: #c42a3c; --hem: #8c1222;
  --black: #141216; --desk: #1f1c22; --panel: #2a262d; --edge: #3b3640;
  --ink: #e9e4dc; --ink2: #b8b2a7; --rule: #5e5862;
  --standby: #e5342b; --go: #2fbf5b; --amber: #f2b632;
  --display: "Limelight", "Didot", serif;
  --body: "Manrope", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
* { box-sizing: border-box; }
html { background: var(--black); color: var(--ink); }
body { margin: 0; font: 400 17px/1.6 var(--body); }
a { color: var(--ink); text-decoration-color: var(--standby); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: #fff; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
code { font: 500 0.92em var(--mono); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--amber); color: var(--black); padding: 6px 10px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- proscenium ---------- */
.proscenium { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 4vw, 48px); background: var(--black); border-bottom: 6px solid var(--desk); }
.marquee { display: flex; align-items: center; gap: 12px; text-decoration: none; font: 400 30px/1 var(--display); letter-spacing: .04em; }
.marquee img { display: block; }
.proscenium nav { display: flex; gap: clamp(12px, 2.4vw, 28px); font-weight: 600; font-size: 15px; }
.proscenium nav a { text-decoration: none; color: var(--ink2); }
.proscenium nav a:hover { color: var(--ink); }

/* ---------- stage + curtain ---------- */
.stage { position: relative; min-height: min(78vh, 760px); overflow: hidden; background: var(--black); }
.curtain { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 2; }
.behind { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; padding: 24px; }
.term { width: min(860px, 94%); background: var(--desk); border: 2px solid var(--edge); border-radius: 6px; box-shadow: 0 0 0 10px var(--black); }
.term-bar { display: flex; justify-content: space-between; padding: 8px 14px; border-bottom: 2px solid var(--edge); font: 600 13px var(--mono); color: var(--ink2); }
.term-esc { opacity: 0; color: var(--black); background: var(--amber); padding: 0 8px; border-radius: 3px; transition: opacity .15s; }
.term-esc.on { opacity: 1; }
.term pre { margin: 0; padding: 18px 20px 22px; font: 400 clamp(11px, 1.45vw, 15px)/1.55 var(--mono); white-space: pre-wrap; color: var(--ink); min-height: 15em; }
.term pre .hl { color: var(--amber); }
.term pre .dim { color: var(--rule); }
.term pre .sel { color: var(--go); }

.apron { position: relative; z-index: 3; max-width: 880px; margin: 0 auto; padding: clamp(40px, 9vh, 96px) clamp(18px, 4vw, 40px) 120px; text-align: left; transition: opacity .5s; }
.stage.up .apron { opacity: 0; pointer-events: none; }
.kicker { margin: 0 0 14px; font: 600 13px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #f3d9d3; }
h1 { margin: 0; font: 400 clamp(38px, 6.6vw, 82px)/1.02 var(--display); letter-spacing: .01em; color: var(--ink); text-wrap: balance; }
h1 em { font-style: normal; color: var(--black); background: var(--ink); padding: 0 .18em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.lede { max-width: 640px; margin: 26px 0 26px; font-size: clamp(17px, 1.9vw, 20px); color: #f6ece6; }
.lede b { color: #fff; font-weight: 800; white-space: nowrap; }
.cmd { display: inline-flex; align-items: stretch; background: var(--black); border: 2px solid var(--black); border-radius: 4px; max-width: 100%; }
.cmd code { padding: 12px 16px; font-size: clamp(14px, 1.7vw, 17px); color: var(--ink); overflow-x: auto; white-space: nowrap; }
.cmd code::before { content: "$ "; color: var(--rule); }
.copy { font: 700 13px var(--body); letter-spacing: .08em; text-transform: uppercase; background: var(--panel); color: var(--ink); border: 0; border-left: 2px solid var(--edge); padding: 0 16px; cursor: pointer; }
.copy:hover { background: var(--edge); }
.copy.done { background: var(--go); color: var(--black); }
.caption { margin: 22px 0 0; font: 500 14px var(--mono); color: #f3d9d3; min-height: 1.6em; }

/* ---------- desk ---------- */
.desk { display: flex; flex-direction: column; position: relative; z-index: 4; background: var(--desk); border-top: 8px solid var(--black); padding: 0 clamp(14px, 4vw, 48px) 26px; }
.desk-controls { order: 2; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 1080px; margin: 0 auto; padding: 18px 0 8px; }
.switch { display: inline-flex; background: var(--black); border-radius: 4px; padding: 4px; gap: 4px; }
.switch button { font: 700 14px var(--body); color: var(--ink2); background: transparent; border: 0; border-radius: 3px; padding: 7px 14px; cursor: pointer; text-align: left; line-height: 1.2; }
.switch button small { display: block; font: 400 11px var(--mono); color: var(--rule); }
.switch button[aria-checked="true"] { background: var(--panel); color: var(--ink); box-shadow: inset 0 -3px 0 var(--amber); }
.standby { display: inline-flex; align-items: center; gap: 12px; font: 800 15px var(--body); letter-spacing: .14em; color: var(--ink); background: var(--black); border: 2px solid var(--edge); border-radius: 4px; padding: 8px 18px 8px 12px; cursor: pointer; text-align: left; line-height: 1.15; }
.standby small { display: block; font: 400 11px var(--mono); letter-spacing: 0; color: var(--rule); }
.standby:hover { border-color: var(--standby); }
.standby:disabled { cursor: progress; opacity: .7; }
.lamp-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--standby); box-shadow: inset 0 0 0 4px #7d1a16; flex: none; }

.boxes { width: 100%; padding-top: 34px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 2.4vw, 32px); max-width: 1180px; margin: 0 auto; }
.cue { position: relative; display: flex; flex-direction: column; align-items: center; }
.wire { position: absolute; left: 50%; bottom: 100%; width: 10px; margin-left: -5px; height: 84px; background: var(--black); border-left: 2px solid #0b0a0c; }
.packet { position: absolute; left: -4px; width: 14px; height: 14px; bottom: 0; border-radius: 2px; background: var(--amber); opacity: 0; }
.panel { position: relative; width: min(190px, 100%); background: var(--panel); border: 3px solid var(--black); outline: 2px solid var(--edge); outline-offset: -7px; border-radius: 8px; padding: 18px 10px 12px; display: grid; justify-items: center; gap: 10px; margin-top: -2px; }
.panel::before, .panel::after { content: ""; position: absolute; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--rule); }
.panel::before { left: 10px; } .panel::after { right: 10px; }
.lamp { width: clamp(38px, 6vw, 58px); aspect-ratio: 1; border-radius: 50%; border: 6px solid var(--black); background: #3a1513; position: relative; }
.lamp.green { background: #11281a; }
.lamp.on.red { background: var(--standby); }
.lamp.on.green { background: var(--go); }
.lamp::after { content: ""; position: absolute; left: 22%; top: 18%; width: 26%; height: 18%; border-radius: 50%; background: var(--ink); opacity: .14; transform: rotate(-35deg); }
.lamp.on::after { opacity: .55; }
.plate { margin: 4px 0 0; background: var(--black); color: var(--ink); font: 800 clamp(11px, 1.5vw, 14px)/1.25 var(--body); letter-spacing: .12em; padding: 6px 10px; border-radius: 2px; text-align: center; box-shadow: inset 0 0 0 1px var(--edge); }
.plate span { display: block; color: var(--ink2); font-weight: 600; letter-spacing: .16em; }
.ver { margin: 0; font: 400 11px var(--mono); color: var(--ink2); text-align: center; }
.answer { margin: 12px 0 0; min-height: 3.2em; font: 600 clamp(12px, 1.6vw, 15px)/1.35 var(--mono); text-align: center; color: var(--ink); }
.answer .k { display: inline-block; padding: 1px 8px; border-radius: 2px; background: var(--standby); color: var(--black); }
.answer .k.ok { background: var(--go); }
.answer .k.warn { background: var(--amber); color: var(--black); }
.answer .k.no { background: var(--edge); color: var(--ink); }
.answer small { display: block; font-weight: 400; color: var(--ink2); }
.desk-note { order: 3; width: 100%; max-width: 1080px; margin: 18px auto 0; font-size: 13px; color: var(--ink2); }

/* ---------- sections ---------- */
main { position: relative; max-width: 880px; margin: 0 auto; padding: 40px clamp(18px, 4vw, 40px) 40px clamp(56px, 8vw, 96px); }
.spine { position: absolute; left: clamp(22px, 3.4vw, 42px); top: 0; bottom: 0; width: 8px; background: var(--panel); border-left: 2px solid var(--black); }
.cue-sec { position: relative; padding: 48px 0 30px; }
.qno { position: absolute; left: calc(-1 * clamp(56px, 8vw, 96px) + clamp(22px, 3.4vw, 42px) - 17px); top: 50px; margin: 0; width: 42px; height: 42px; display: grid; place-items: center; background: var(--standby); color: var(--black); font: 700 14px/1 var(--mono); letter-spacing: -.02em; border-radius: 50%; border: 4px solid var(--black); }
h2 { margin: 0 0 14px; font: 400 clamp(28px, 4vw, 42px)/1.1 var(--display); letter-spacing: .01em; }
.cue-sec p { max-width: 68ch; }
.small { font-size: 15px; color: var(--ink2); }
.cmd.wide { margin: 8px 0 18px; border-color: var(--edge); }
.tty, .code { background: #0d0c0e; border: 2px solid var(--panel); border-radius: 4px; padding: 16px 18px; overflow-x: auto; font: 400 13px/1.55 var(--mono); color: var(--ink); }
.tty .b { font-weight: 600; } .tty .d, .code .d { color: var(--rule); } .tty .r { color: #ff6b5e; } .tty .y { color: var(--amber); }
.ruler { margin: 22px 0 0; }
.ruler svg { width: 100%; height: auto; display: block; background: var(--desk); border-radius: 4px; }
.ruler figcaption { font-size: 14px; color: var(--ink2); margin-top: 10px; }
.sheet { margin: 18px 0; border: 2px solid var(--panel); border-radius: 4px; overflow: hidden; font-size: 15px; }
.sheet [role=row] { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.6fr; border-top: 1px solid var(--panel); }
.sheet [role=row]:first-child { border-top: 0; }
.sheet span { padding: 10px 12px; }
.sheet .hd { background: var(--panel); font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); }
.sheet b { font-family: var(--mono); font-weight: 600; }
.sheet .r { color: #ff6b5e; } .sheet .y { color: var(--amber); }
.rules { padding-left: 1.2em; } .rules li { margin: 0 0 10px; } .rules li::marker { font-family: var(--display); color: var(--standby); }
.how { list-style: none; padding: 0; } .how li { padding: 12px 0 12px 18px; border-left: 4px solid var(--standby); margin: 0 0 12px; background: var(--desk); padding-right: 16px; }
.foot { border-top: 8px solid var(--desk); padding: 26px clamp(18px, 4vw, 48px) 40px; font-size: 14px; color: var(--ink2); text-align: center; }
.foot p { margin: 4px 0; }

@media (max-width: 700px) {
  .proscenium nav a:nth-child(3) { display: none; }
  .marquee { font-size: 24px; } .marquee img { width: 36px; height: 36px; }
  .sheet [role=row] { grid-template-columns: 1fr 1fr 1fr; }
  .sheet [role=row] span:last-child { grid-column: 1 / -1; padding-top: 0; color: var(--ink2); font-size: 13px; }
  .sheet .hd span:last-child { display: none; }
  .desk-controls { justify-content: center; }
  .apron { padding-bottom: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (max-width: 640px) {
  .ruler { overflow-x: auto; }
  .ruler svg { min-width: 640px; }
}
@media (max-width: 600px) { .boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; } .cue:nth-child(n+3) .wire { display: none; } }
