/* Cascadia: Midnight 2000 (0.1.2) — a Cold-War command centre with an early-80s dystopian grit (DESIGN.md §11; owner
   11-09: "the UI is so small and hard to read", "that kind of look and feel"). Readability first: 18 px body (16 px on
   phones), 20 px message traffic, 22 px briefing, 16 px+ keys, 28 px+ LEDs, nothing under 13 px; near-white text on black.
   Under 1280 px wide (or 700 px tall) the wall becomes the map + one screen at a time (tabs), not smaller text.
   Fonts are bundled files (OFL): Share Tech Mono (text), DSEG7 Classic (LEDs), Bebas Neue (titles and stencils). */
@font-face { font-family: "Share Tech Mono"; src: url("fonts/share-tech-mono.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "DSEG7"; src: url("fonts/dseg7-classic-bold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Bebas Neue"; src: url("fonts/bebas-neue.woff2") format("woff2"); font-display: swap; }
:root {
  --bg: #050608; --cyan: #3fd0ff; --blue: #2a7fff; --green: #39ff88; --red: #ff3b30; --amber: #ffb000; --orange: #ff5a1f;
  --text: #e8f0ff; --soft: #b9c8dc; --mute: #9fb0c6; --rust: #7a4b2a; --metal: #4a4540;
  --font: "Share Tech Mono", "Lucida Console", Consolas, monospace; --led: "DSEG7", "Share Tech Mono", monospace;
  --title: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
/* deep black everywhere (owner 11-09): no washes, gradients or haze behind the vectors; glow only on lines */
html, body { margin: 0; color: var(--text); font: 18px/1.35 var(--font); background: #000; }
[hidden] { display: none !important; }
h1, h2 { margin: 0; font-weight: normal; }
button { font: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.screen { min-height: 100vh; }
.title-type { font-family: var(--title); color: var(--orange); letter-spacing: 0.06em; text-shadow: 0 0 10px rgba(255,90,31,0.55), 0 2px 0 #2a0a00; }
.stencil { font-family: var(--title); font-size: 18px; letter-spacing: 0.22em; color: var(--amber); border: 2px dashed rgba(255,176,0,0.7); padding: 0 8px; display: inline-block; opacity: 0.9; }
.stencil.red { color: var(--red); border-color: rgba(255,59,48,0.75); }
.stencil.small { font-size: 16px; }
/* nothing moves on its own: no page grain, no looping flicker (one-off effects live in fx.js); FX LOW / reduced motion stops blinks too */
html.fx-low *, html.fx-low *::before, html.fx-low *::after { animation: none !important; transition: none !important; }

/* ---- keys ---- */
.key { color: var(--text); background: linear-gradient(#2b2f36, #15181d); border: 2px solid #5b554e; border-bottom-color: #0b0c0e; border-radius: 3px; padding: 10px 16px; min-height: 46px;
  font-size: 17px; letter-spacing: 0.08em; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 3px 0 #000; }
.key:hover:not(:disabled), .key:focus-visible { border-color: var(--amber); outline: none; box-shadow: 0 0 10px rgba(255,176,0,0.45), inset 0 1px 0 rgba(255,255,255,0.12); }
.key:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.key:disabled { opacity: 0.4; cursor: not-allowed; }
.key.big { font-size: 22px; font-family: var(--title); letter-spacing: 0.14em; }
.key.go { color: #041208; background: linear-gradient(#63ffa5, #20b862); border-color: #9dffc6; font-family: var(--title); font-size: 22px; letter-spacing: 0.12em; }
.key.small { min-height: 40px; padding: 2px 12px; font-size: 18px; }
.keys { display: flex; flex-wrap: wrap; gap: 10px; }
.keys .key { flex: 1 1 160px; }

/* ---- bezelled monitors: gunmetal and rust ---- */
.bezel { position: relative; background: #000; border: 4px solid; border-image: linear-gradient(135deg, #6f675e, #34302b 35%, #7a4b2a 55%, #3d3833 75%, #5d564e) 1; overflow: hidden;
  box-shadow: inset 0 0 22px rgba(63,208,255,0.16), 0 0 0 1px #0b0a09, 0 6px 14px rgba(0,0,0,0.85); }
.bezel::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px); } /* static, faint */
.tag { position: absolute; right: 8px; top: 4px; font-family: var(--title); font-size: 16px; color: var(--orange); letter-spacing: 0.12em; z-index: 4; pointer-events: none; opacity: 0.9; }
.led { font-family: var(--led); color: var(--red); text-shadow: 0 0 7px rgba(255,59,48,0.75); position: relative; font-style: normal; font-weight: bold; font-size: 28px; line-height: 1; white-space: nowrap; }
.led[data-ghost]::before { content: attr(data-ghost); position: absolute; left: 0; top: 0; color: rgba(255,59,48,0.1); text-shadow: none; }

/* ---- start: the key art ---- */
#start { position: relative; display: flex; align-items: flex-end; justify-content: flex-end; padding: calc(16px + var(--safe-t)) 24px calc(24px + var(--safe-b)); background: #000; }
/* the key art whole (its title never cropped), letterboxed in pure black, shadows darkened to match */
#startArt { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; object-position: left top; filter: brightness(0.85) contrast(1.15); }
.start-panel { position: relative; width: min(560px, 100%); display: flex; flex-direction: column; gap: 12px; background: rgba(6,7,9,0.88); border: 3px solid; border-image: linear-gradient(135deg, #6f675e, #3d3833 40%, #7a4b2a 60%, #4a423b) 1; padding: 20px; box-shadow: 0 0 40px rgba(0,0,0,0.9); }
.kicker { color: var(--amber); font-size: 15px; letter-spacing: 0.15em; }
.pitch { color: var(--text); margin: 0; }
.diffs { display: grid; gap: 8px; }
.diffs .key { text-align: left; }
.diffs b { color: var(--amber); display: block; font-weight: normal; font-family: var(--title); font-size: 22px; letter-spacing: 0.1em; }
.diffs span { color: var(--soft); font-size: 15px; letter-spacing: 0; }
.tierline { color: var(--soft); font-size: 15px; border-left: 3px solid var(--rust); padding-left: 10px; margin: 0; }
html[data-gs-tier="guest"] .member-only, html[data-gs-tier="member"] .guest-only { display: none; }
.foot { color: var(--mute); font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vols { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.vol { font: inherit; font-size: 14px; color: var(--cyan); background: #0d1117; border: 2px solid #3a4250; border-radius: 3px; padding: 4px 10px; min-height: 40px; }

/* ---- briefing ---- */
#brief { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: #000; }
.brief-screen { width: min(1100px, 100%); min-height: min(560px, 72vh); display: flex; }
#briefMap { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.5; }
.brief-body { position: relative; z-index: 2; padding: 26px 30px 34px; width: 100%; }
.brief-head { color: var(--amber); font-size: 16px; letter-spacing: 0.12em; border-bottom: 2px solid rgba(255,176,0,0.4); padding-bottom: 8px; }
.brief-screen h2 { font-size: 40px; margin: 12px 0 10px; }
.brief-text p { margin: 0 0 12px; color: #f2f7ff; font-size: 22px; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.5; text-shadow: 0 0 6px rgba(63,208,255,0.35), 0 1px 3px #000, 0 0 2px #000; }
.brief-text p.final { color: var(--green); }
.brief-text h3 { font-family: var(--title); color: var(--orange); font-size: 26px; font-weight: normal; margin: 10px 0 4px; letter-spacing: 0.08em; }
.caret { display: inline-block; width: 0.6em; background: var(--cyan); animation: blink 0.8s steps(2) infinite; }
.brief-keys { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; width: min(1100px, 100%); justify-content: flex-end; }
.toggle { color: var(--soft); font-size: 16px; display: inline-flex; gap: 8px; align-items: center; margin-right: auto; min-height: 46px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; }

/* ---- the room (desktop, ≥ 1280 x 700) ---- */
#game { height: 100vh; min-height: 700px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; padding: 6px 12px 10px; }
#top { display: flex; align-items: center; gap: 16px; }
.room-title { font-size: 34px; line-height: 1; white-space: nowrap; }
.room-title span { font-size: 20px; color: var(--amber); margin-left: 6px; }
#top .stencil { white-space: nowrap; }
.clocks { display: flex; gap: 16px; margin-left: auto; align-items: flex-end; }
.ck { display: flex; flex-direction: column; gap: 2px; }
.ck i { white-space: nowrap; font-style: normal; font-size: 13px; color: var(--mute); letter-spacing: 0.12em; }
.lamp-defcon { display: none; }
/* every screen is a monitor of a fixed shape (4:3, the map 16:9); app.js fits --h1 (top row) and --h2 (bottom row,
   10/9 of it, so both rows are the same width) to the space, and the wall sits centred in black */
#wallBox { min-height: 0; display: flex; align-items: center; justify-content: center; }
#wall { display: flex; flex-direction: column; align-items: center; gap: 8px; --h1: 200px; --h2: 222px; }
.wrow { display: flex; gap: 8px; }
#s2, #s3 { width: calc(var(--h1) * 4 / 3); height: var(--h1); } #s1 { width: calc(var(--h1) * 16 / 9); height: var(--h1); }
#s5, #s4, #s6 { width: calc(var(--h2) * 4 / 3); height: var(--h2); }
.bezel > canvas { display: block; width: 100%; height: 100%; }
#s5, #s6 { display: flex; flex-direction: column; }
.scr-head { font-size: 15px; color: var(--text); padding: 5px 150px 2px 10px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#s2 > #zoneMap { flex: 1 1 0; min-height: 0; height: auto; width: 100%; }
.sysgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px 8px; padding: 2px 8px 6px; font-size: 14px; }
.sysrow { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 4px; align-items: center; color: var(--soft); }
.sysrow .b { grid-column: 1 / -1; grid-row: 2; }
.sysrow .b { height: 8px; background: #0d1420; position: relative; border: 1px solid #263248; }
.sysrow .b i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); }
.sysrow .b u { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--cyan); }
.sysrow.mid .b i { background: var(--amber); } .sysrow.low .b i { background: var(--red); }
.sysrow .n { color: var(--text); text-align: right; grid-row: 1; grid-column: 2; }
.sysrow .w { color: var(--red); }
.zoomkeys { position: absolute; right: 8px; bottom: 8px; z-index: 5; display: flex; gap: 6px; }
.zoomkeys .key { min-height: 40px; min-width: 44px; padding: 0 10px; font-size: 22px; opacity: 0.85; }

/* status strip: resource lamps + LEDs, DEFCON lamps */
.status { display: flex; gap: 16px; align-items: center; background: linear-gradient(#1a1c20, #0c0d10); border: 2px solid #3d3833; padding: 4px 12px; }
.res { display: flex; gap: 10px 12px; flex: 1 1 auto; min-width: 0; justify-content: space-between; }
.rs { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; }
.rs i { font-style: normal; font-size: 13px; color: var(--soft); letter-spacing: 0.1em; grid-column: 1; }
.rs .lamps { display: flex; gap: 2px; grid-column: 1; grid-row: 2; }
.rs .lamps b { width: 5px; height: 12px; border-radius: 1px; background: #1b2230; box-shadow: inset 0 0 2px #000; }
.rs .lamps b.on { background: var(--green); box-shadow: 0 0 5px var(--green); }
.rs.mid .lamps b.on { background: var(--amber); box-shadow: 0 0 5px var(--amber); }
.rs.low .lamps b.on { background: var(--red); box-shadow: 0 0 5px var(--red); }
.rs .led { grid-column: 2; grid-row: 1 / span 2; }
.defcon-panel { display: flex; align-items: center; gap: 10px; border-left: 2px solid #3d3833; padding-left: 14px; }
.defcon-panel i { font-style: normal; font-family: var(--title); font-size: 18px; color: var(--orange); letter-spacing: 0.12em; }
.def-lamps { display: flex; gap: 6px; }
.def-lamps b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: normal; color: #3a4558; background: #12171f; border: 2px solid #2a3344; font-size: 18px; }
.def-lamps b.on { color: #000; }
.def-lamps b.on.d5 { background: var(--blue); box-shadow: 0 0 14px var(--blue); }
.def-lamps b.on.d4 { background: var(--green); box-shadow: 0 0 14px var(--green); }
.def-lamps b.on.d3 { background: #ffe14a; box-shadow: 0 0 14px #ffe14a; }
.def-lamps b.on.d2 { background: var(--red); box-shadow: 0 0 16px var(--red); }
.def-lamps b.on.d1 { background: #fff; box-shadow: 0 0 20px #fff; animation: blink 0.7s steps(2) infinite; }

/* message traffic: a printer feed */
.traffic { flex: 1 1 auto; overflow-y: auto; scrollbar-gutter: stable; padding: 30px 10px 10px; font-size: 20px; }
.msg { position: relative; border-top: 2px dashed #3a4250; padding: 6px 8px 8px; cursor: pointer; color: var(--text); }
.msg:first-child { border-top: none; }
.msg .hd { color: var(--amber); font-size: 15px; letter-spacing: 0.04em; }
.msg .hd .pr { color: var(--text); font-family: var(--title); font-size: 19px; letter-spacing: 0.1em; }
.msg.p-FLASH .hd .pr { color: var(--red); } .msg.p-IMMEDIATE .hd .pr { color: var(--orange); }
.msg .bd { text-transform: uppercase; margin-top: 2px; min-height: 1.3em; }
.msg .ft { color: var(--soft); font-size: 15px; margin-top: 2px; }
.msg.sel { background: #e8f0ff; color: #05070a; }
.msg.sel .hd, .msg.sel .hd .pr, .msg.sel .ft { color: #05070a; }
.msg.trace { cursor: default; }
.msg .stamp { position: absolute; right: 10px; top: 10px; color: var(--red); border: 3px solid var(--red); padding: 0 6px; font-family: var(--title); font-size: 24px; transform: rotate(-7deg); opacity: 0.9; letter-spacing: 0.12em; }
.msg.old { opacity: 0.7; cursor: default; }
.msg.old .bd { font-size: 17px; }
.feed-sep { color: var(--soft); font-size: 14px; letter-spacing: 0.2em; margin: 8px 0 2px; }

/* hotline + cable */
#s6 { padding: 30px 8px 6px; gap: 8px; overflow-y: auto; font-size: 17px; }
.hot, .cab { border: 2px solid #5a2a2a; padding: 8px 10px; background: #160909; color: #ffe3e0; cursor: pointer; }
.cab { border-color: #2f4a66; background: #08121e; color: var(--text); cursor: default; }
.hot .h, .cab .h { display: flex; align-items: center; gap: 8px; font-family: var(--title); font-size: 20px; letter-spacing: 0.1em; color: var(--red); }
.cab .h { color: var(--cyan); }
.lampdot { width: 14px; height: 14px; border-radius: 50%; background: #3a1010; display: inline-block; flex: 0 0 auto; }
.lampdot.on { background: var(--red); box-shadow: 0 0 9px var(--red); animation: blink 0.8s steps(2) infinite; }
.lampdot.ok { background: var(--green); box-shadow: 0 0 7px var(--green); }
.cab .lampdot.on { background: var(--cyan); box-shadow: 0 0 9px var(--cyan); }
.hot .t, .cab .t { text-transform: uppercase; margin: 4px 0; min-height: 1.3em; }
.hot .s, .cab .s { color: var(--soft); font-size: 15px; }
.cab .ans { display: grid; gap: 6px; margin-top: 6px; }
.cab .ans .key { min-height: 44px; padding: 6px 10px; font-size: 16px; text-align: left; letter-spacing: 0.02em; }

/* ---- the consoles: three station keys, one key bank, the readout and EXECUTE, COMMIT ---- */
#tabs { display: none; }
#consoles { display: grid; grid-template-columns: 190px minmax(0, 1fr) 250px 160px; gap: 10px; background: linear-gradient(#141619, #08090b); border-top: 3px solid #3d3833; padding-top: 8px; box-shadow: 0 -10px 18px rgba(0,0,0,0.7); }
.stations { display: grid; grid-template-rows: repeat(3, 1fr); gap: 6px; }
.stn { font: inherit; text-align: left; background: #031007; color: #b8ffd6; border: 2px solid #23502f; border-radius: 3px; padding: 4px 10px; min-height: 46px; display: flex; flex-direction: column; justify-content: center; }
.stn b { font-family: var(--title); font-weight: normal; font-size: 20px; letter-spacing: 0.1em; color: var(--green); line-height: 1.05; }
.stn span { font-size: 13px; color: #8fdcab; letter-spacing: 0.06em; }
.stn.on { border-color: var(--green); box-shadow: 0 0 12px rgba(57,255,136,0.5), inset 0 0 12px rgba(57,255,136,0.2); }
.stn.used b { color: #7aa088; } .stn.used span { color: var(--amber); }
.bank { display: flex; flex-direction: column; gap: 6px; background: #020805; border: 2px solid #3d3833; padding: 6px; }
.akeys { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.ak { font: inherit; background: #0b1a10; color: #c6ffdc; border: 2px solid #2b5c38; border-radius: 3px; padding: 2px 1px; min-height: 54px; line-height: 1.1; box-shadow: inset 0 0 8px rgba(57,255,136,0.15); overflow: hidden; }
.ak b { display: block; font-size: 16px; font-weight: normal; color: var(--green); letter-spacing: 0; line-height: 1.02; overflow-wrap: anywhere; }
.ak small { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #9de6b8; }
.ak.on { background: var(--green); color: #02130a; box-shadow: 0 0 12px var(--green); }
.ak.on b, .ak.on small { color: #02130a; }
.ak:disabled { opacity: 0.28; cursor: not-allowed; box-shadow: none; }
.skeys { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.sk { font: inherit; font-size: 15px; background: #07120b; color: #b8ffd6; border: 2px solid #23502f; border-radius: 3px; min-height: 40px; padding: 0; overflow: hidden; }
.sk.on { background: var(--green); color: #02130a; }
.sk:disabled { opacity: 0.25; cursor: default; }
.readbox { display: flex; flex-direction: column; gap: 8px; background: #020805; border: 2px solid #3d3833; padding: 8px; }
.rd { flex: 1 1 auto; font-size: 16px; color: var(--green); text-transform: uppercase; line-height: 1.3; overflow: hidden; text-shadow: 0 0 6px rgba(57,255,136,0.4); }
.rd .err { color: var(--amber); }
.exec { font-family: var(--title); font-size: 24px; letter-spacing: 0.16em; color: #fff; background: linear-gradient(#d9342b, #8f1711); border: 3px solid var(--amber); border-radius: 3px; padding: 4px 10px; min-height: 52px;
  box-shadow: 0 0 0 3px #2a1a00, 0 0 12px rgba(255,59,48,0.5); }
.exec:disabled { background: #2a1513; border-color: #5a4a20; color: #9a7a75; box-shadow: none; cursor: not-allowed; }
.commit-box { display: flex; flex-direction: column; gap: 4px; }
.commit-note { font-size: 13px; color: var(--soft); min-height: 18px; letter-spacing: 0.06em; }
.commit { flex: 1 1 auto; font: inherit; color: #fff; cursor: pointer; border: 4px solid var(--amber); background: repeating-linear-gradient(45deg, #3a2800 0 12px, #000 12px 24px); position: relative; min-height: 110px; }
.commit .cover { display: block; background: linear-gradient(#a61b14, #5c0d09); margin: 8px; padding: 12px 4px; box-shadow: 0 5px 0 #2a0503; font-family: var(--title); font-size: 28px; letter-spacing: 0.14em; line-height: 1; }
.commit .cover small { font-family: var(--font); font-size: 13px; color: #ffd0cc; letter-spacing: 0.1em; }
.commit .armed { display: none; }
.commit.open { background: #3a0402; }
.commit.open .cover { display: none; }
.commit.open .armed { display: block; padding: 18px 6px; font-family: var(--title); font-size: 24px; letter-spacing: 0.1em; background: radial-gradient(#ff3b30, #8f1711); margin: 8px; border-radius: 50%/35%; box-shadow: 0 0 24px #ff3b30; animation: pulse 0.9s ease-in-out infinite; }
#dock { display: none; }

/* midnight: dim, banner, alert */
#game.dim #wall, #game.dim #consoles { filter: brightness(0.3); transition: filter 0.3s; }
#wall, #consoles { transition: filter 0.6s; }
.rollover { position: fixed; left: 0; right: 0; top: 34%; z-index: 60; text-align: center; background: rgba(20,0,0,0.88); border-top: 3px solid var(--red); border-bottom: 3px solid var(--red); padding: 12px 12px 16px; pointer-events: none; }
.ro-title { font-size: clamp(48px, 9vw, 110px); line-height: 0.95; color: var(--red); text-shadow: 0 0 22px rgba(255,59,48,0.8); }
.ro-title .led { font-size: clamp(32px, 6vw, 70px); vertical-align: middle; margin-left: 12px; }
.ro-text { font-size: clamp(18px, 2.4vw, 30px); color: #ffe0dc; letter-spacing: 0.12em; min-height: 1.3em; }
.alert { position: fixed; left: 0; right: 0; top: 0; z-index: 61; background: var(--red); color: #fff; text-align: center; font-family: var(--title); letter-spacing: 0.25em; padding: calc(4px + var(--safe-t)) 8px 4px; font-size: 26px;
  animation: flash 0.5s steps(2) 8; pointer-events: none; }
@keyframes blink { 50% { opacity: 0.2; } }
@keyframes flash { 50% { opacity: 0.25; } }
@keyframes pulse { 50% { box-shadow: 0 0 8px #ff3b30; } }

/* coach marks */
.coach { position: fixed; z-index: 75; max-width: 320px; background: #1d1400; border: 3px solid var(--amber); color: #ffe7b0; padding: 10px 12px; font-size: 17px; box-shadow: 0 0 20px rgba(255,176,0,0.5); cursor: pointer; text-transform: uppercase; }
.coach small { display: block; color: var(--amber); font-size: 13px; margin-top: 6px; }
.coach-target { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ending */
#end { padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); display: flex; justify-content: center; }
.end-screen { max-width: 860px; width: 100%; padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.end-screen .kicker { font-size: 16px; }
#endTitle { font-size: clamp(52px, 10vw, 96px); line-height: 0.95; color: var(--red); text-shadow: 0 0 18px rgba(255,59,48,0.7), 0 3px 0 #2a0000; }
#endLines p { margin: 0 0 6px; color: var(--text); font-size: 20px; } #endLines .flav { color: var(--amber); }
.ebar { display: grid; grid-template-columns: 250px 1fr 44px; gap: 10px; align-items: center; font-size: 16px; color: var(--soft); }
.ebar .b { height: 12px; background: #0d1420; position: relative; } .ebar .b i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.ebar span:last-child { color: var(--text); text-align: right; }
.led-total { font-family: var(--title); font-size: 30px; letter-spacing: 0.1em; color: var(--orange); }
.led-total .led { font-size: 44px; margin-left: 10px; }
#endPost { color: var(--soft); font-size: 16px; }
.end-screen h2 { font-size: 30px; }
#endTimeline { margin: 0; padding-left: 26px; color: var(--text); font-size: 17px; }
#endTimeline li { margin-bottom: 5px; } #endTimeline b { color: var(--amber); font-weight: normal; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,0.78); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal .box { max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 18px; color: var(--text); }
.modal h2 { font-family: var(--title); color: var(--orange); font-size: 30px; letter-spacing: 0.08em; margin-bottom: 8px; }
.modal .box p { margin: 0 0 8px; }
.modal table { width: 100%; border-collapse: collapse; font-size: 16px; } .modal td, .modal th { padding: 5px; border-bottom: 1px solid #3a4250; text-align: left; }
.modal .keys { margin-top: 12px; }
.hint { color: var(--soft); font-size: 16px; }
.lk { display: inline-block; width: 14px; height: 14px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.traffic, #s6, .modal .box { scrollbar-width: thin; scrollbar-color: #4a4540 #020306; }
.traffic::-webkit-scrollbar, #s6::-webkit-scrollbar { width: 8px; }
.traffic::-webkit-scrollbar-thumb, #s6::-webkit-scrollbar-thumb { background: #4a4540; }
.traffic::-webkit-scrollbar-track, #s6::-webkit-scrollbar-track { background: #020306; }

/* bigger windows: room to breathe */
@media (min-width: 1700px) and (min-height: 950px) {
  html, body { font-size: 19px; }
  .led { font-size: 32px; } .traffic { font-size: 21px; }
  #consoles { grid-template-columns: 240px minmax(0, 1fr) 340px 200px; }
  .ak { min-height: 60px; } .ak b { font-size: 18px; } .sk { min-height: 46px; font-size: 16px; }
}
@media (max-width: 1499px) { .room-title span, #roomDiff, #sector { display: none; } .clocks { gap: 12px; } }

/* ---- narrow windows and phones: the map + one screen at a time ---- */
@media (max-width: 1279px), (max-height: 699px) {
  html, body { font-size: 16px; }
  #game { height: auto; min-height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: calc(4px + var(--safe-t)) 8px calc(84px + var(--safe-b)); }
  #wallBox, #wall, .wrow { display: contents; }
  #s1, #s2, #s3, #s4, #s5, #s6 { width: auto; height: auto; }
  #top { order: 0; position: sticky; top: 0; z-index: 20; background: #07080a; padding: 4px 0; gap: 10px; flex-wrap: nowrap; }
  .room-title { font-size: 28px; } #top .stencil { display: none; }
  .clocks { gap: 10px; }
  .ck.minor { display: none; }
  .lamp-defcon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; color: #000; background: var(--blue); box-shadow: 0 0 10px var(--blue); font-size: 18px; }
  .lamp-defcon.d4 { background: var(--green); box-shadow: 0 0 10px var(--green); } .lamp-defcon.d3 { background: #ffe14a; box-shadow: 0 0 10px #ffe14a; }
  .lamp-defcon.d2 { background: var(--red); box-shadow: 0 0 10px var(--red); } .lamp-defcon.d1 { background: #fff; animation: blink 0.7s steps(2) infinite; }
  #s1 { order: 1; aspect-ratio: 2.1; flex: 0 0 auto; }
  #status { order: 2; padding: 4px 6px; }
  .defcon-panel { display: none; }
  .res { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; width: 100%; }
  .rs { display: flex; flex-direction: column; align-items: center; }
  .rs .lamps { display: none; }
  .rs i { letter-spacing: 0; }
  #tabs { order: 3; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; position: sticky; top: calc(48px + var(--safe-t)); z-index: 19; background: #07080a; padding: 2px 0; }
  #tabs button { font-family: var(--title); font-size: 20px; letter-spacing: 0.08em; color: var(--amber); background: #15181d; border: 2px solid #4a4540; border-radius: 3px; min-height: 48px; padding: 0; }
  #tabs button.on { background: var(--amber); color: #120c00; }
  #s2, #s3, #s4, #s5, #s6 { order: 4; display: none; }
  #game[data-tab="globe"] #s2, #game[data-tab="board"] #s3, #game[data-tab="net"] #s4 { display: block; }
  #game[data-tab="traffic"] #s6, #game[data-tab="traffic"] #s5 { display: flex; }
  #s6 { order: 4; overflow: visible; } #s5 { order: 5; }
  #s2 { aspect-ratio: 4 / 3; } #s4 { aspect-ratio: 1; }
  .hud-win { left: 8px !important; right: 8px; top: auto !important; bottom: calc(76px + var(--safe-b)); width: auto !important; max-height: 60vh; }
  #s3 #board { height: 520px; }
  .sysgrid { font-size: 15px; grid-template-columns: 1fr 1fr; }
  .sysrow { grid-template-columns: 34px 1fr 40px; grid-template-rows: auto; } .sysrow .b { grid-column: 2; grid-row: 1; } .sysrow .n { grid-column: 3; }
  .scr-head { padding: 30px 10px 2px; white-space: normal; }
  .traffic { overflow: visible; font-size: 19px; }
  #consoles { order: 6; display: none; grid-template-columns: 1fr; border-top: none; box-shadow: none; background: none; }
  #game[data-tab="console"] #consoles { display: grid; }
  .stations { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto; }
  .stn { min-height: 56px; padding: 4px 6px; } .stn b { font-size: 18px; }
  .akeys { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ak { min-height: 56px; } .ak b { font-size: 16px; }
  .skeys { grid-template-columns: repeat(5, minmax(0, 1fr)); } .sk { min-height: 46px; font-size: 16px; }
  .readbox, .commit-box { display: none; }
  #dock { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 8px; align-items: center; background: #07080a; border-top: 3px solid #3d3833; padding: 6px 8px calc(6px + var(--safe-b)); }
  .dock-read { flex: 1 1 auto; min-width: 0; font-size: 14px; color: var(--green); text-transform: uppercase; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.25; }
  #dock .exec { min-height: 52px; font-size: 20px; padding: 2px 10px; }
  .commit-mini { color: #fff; background: linear-gradient(#a61b14, #5c0d09); border-color: var(--amber); padding: 4px 10px; font-family: var(--title); font-size: 20px; min-height: 52px; }
  .commit-mini.open { background: radial-gradient(#ff3b30, #8f1711); animation: pulse 0.9s ease-in-out infinite; }
  .ebar { grid-template-columns: 140px 1fr 36px; font-size: 15px; }
  #start { justify-content: center; background-position: 30% top; background-size: auto 46vh; background-color: #000; padding-top: 40vh; }
  .brief-text p { font-size: 19px; }
  .brief-screen h2 { font-size: 32px; }
  .brief-body { padding: 20px 16px 26px; }
}
@media (max-width: 420px) { .room-title { display: none; } .clocks { margin-left: 0; } }

/* pop-up HUD windows (the zone panel; owner's retro-sci-fi HUD still): outlined, notched, the border draws in first */
.hud-win { position: fixed; z-index: 50; width: 420px; max-height: 70vh; overflow: auto; background: rgba(0,0,0,0.94); border: 2px solid var(--orange);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); box-shadow: 0 0 18px rgba(255,90,31,0.35); }
.hud-win.drawing { animation: hudIn 0.35s steps(6) both; }
@keyframes hudIn { from { clip-path: polygon(0 0, 14px 0, 14px 2px, 0 2px); } to { clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); } }
.hud-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 2px solid var(--orange); background: rgba(255,90,31,0.12); }
.hud-title { font-family: var(--title); font-size: 24px; letter-spacing: 0.1em; color: var(--orange); text-decoration: underline; text-underline-offset: 4px; }
.hud-x { font: inherit; font-size: 18px; color: var(--amber); background: #000; border: 2px solid var(--amber); min-width: 40px; min-height: 40px; }
.hud-body { padding: 10px 12px 12px; font-size: 16px; }
.hud-body .meta { color: var(--soft); font-size: 15px; margin-bottom: 8px; }
.hud-list { list-style: none; margin: 0 0 8px; padding: 0; }
.hud-list li { display: grid; grid-template-columns: 3.4em 1fr 7em 3.2em; gap: 6px; align-items: center; padding: 2px 0; color: var(--text); }
.hud-list li .n { color: var(--amber); } .hud-list li .v { text-align: right; } .hud-list li.mid .v { color: var(--amber); } .hud-list li.low .v { color: var(--red); }
.hud-list .bar { height: 8px; background: #1b1206; border-bottom: 1px solid var(--red); position: relative; }
.hud-list .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--amber); } .hud-list .bar u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--cyan); }
.hud-body .probs { color: #ffd0c8; font-size: 15px; margin: 4px 0; }
.map-credit { position: absolute; left: 8px; bottom: 6px; z-index: 5; font-size: 13px; color: #9fb0c6; background: rgba(0,0,0,0.7); padding: 1px 6px; }
@media (min-width: 2200px) and (min-height: 1250px) { html, body { font-size: 21px; } .led { font-size: 36px; } .traffic { font-size: 23px; } }

/* city names in text are links */
a.city { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
a.city:hover { color: var(--cyan); }
.choose { display: grid; gap: 6px; }
.choose .key { text-align: left; min-height: 44px; } .choose .key small { display: block; font-size: 13px; color: var(--soft); letter-spacing: 0; }

/* the dossier (§6b) */
.hud-win.dossier { width: 560px; max-height: 82vh; }
.hud-body h4 { font-family: var(--title); font-weight: normal; color: var(--amber); font-size: 20px; letter-spacing: 0.1em; margin: 10px 0 4px; }
.hud-body p { margin: 0 0 5px; color: var(--text); font-size: 16px; }
.hud-body p.dim { color: var(--soft); } .hud-body p.go { color: var(--green); font-size: 16px; margin-top: 8px; }
.dos-msg { text-transform: uppercase; color: #fff; font-size: 17px; border-left: 3px solid var(--orange); padding-left: 8px; }
.dos-stamp { color: var(--red); border: 2px solid var(--red); padding: 0 4px; font-family: var(--title); letter-spacing: 0.1em; }
.dos-acts { display: grid; gap: 4px; }
.dos-act { font: inherit; text-align: left; background: #031007; color: #c6ffdc; border: 2px solid #2b5c38; border-radius: 3px; padding: 5px 8px; min-height: 44px; display: grid; grid-template-columns: auto 1fr; gap: 0 10px; }
.dos-act b { font-weight: normal; color: var(--green); } .dos-act .c { color: var(--amber); font-size: 14px; text-align: right; }
.dos-act .e { grid-column: 1 / -1; font-size: 15px; } .dos-act .w { grid-column: 1 / -1; font-size: 13px; color: var(--amber); }
.dos-act.on { border-color: var(--green); box-shadow: 0 0 10px rgba(57,255,136,0.5); }
.dos-act.dud { opacity: 0.45; } .dos-act:disabled { cursor: not-allowed; }
.dos-act:hover:not(:disabled) { border-color: var(--green); }

/* one-off effects (fx.js) */
.fx-stamp { position: fixed; z-index: 90; transform: translate(-50%, -100%) rotate(-3deg); font-family: var(--title); font-size: 30px; letter-spacing: 0.14em; padding: 4px 14px; border: 4px solid; background: rgba(0,0,0,0.85); pointer-events: none; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.fx-stamp.green { color: var(--green); border-color: var(--green); box-shadow: 0 0 16px rgba(57,255,136,0.5); }
.fx-stamp.red { color: var(--red); border-color: var(--red); box-shadow: 0 0 16px rgba(255,59,48,0.5); }
.fx-stamp.blink3 { animation: stampBlink 0.3s steps(2) 3; }
@keyframes stampBlink { 50% { opacity: 0.15; } }
.crt-on { animation: crtOn 0.65s ease-out both; }
@keyframes crtOn { 0% { clip-path: inset(50% 50% 50% 50%); filter: brightness(3); } 30% { clip-path: inset(49.5% 0 49.5% 0); filter: brightness(3); } 100% { clip-path: inset(0 0 0 0); filter: none; } }
.crt-off { animation: crtOff 0.6s ease-in both; }
@keyframes crtOff { 0% { clip-path: inset(0 0 0 0); } 60% { clip-path: inset(49.5% 0 49.5% 0); filter: brightness(3); } 100% { clip-path: inset(50% 50% 50% 50%); } }
.interfere { animation: interfere 0.36s steps(3) 1; }
@keyframes interfere { 0% { transform: translateY(0); filter: none; } 33% { transform: translate(3px, -4px) skewX(-2deg); filter: drop-shadow(3px 0 rgba(255,0,0,0.7)) drop-shadow(-3px 0 rgba(0,200,255,0.7)); } 66% { transform: translate(-2px, 3px); } 100% { transform: none; filter: none; } }
.fx-flash { position: fixed; inset: 0; z-index: 85; pointer-events: none; box-shadow: inset 0 0 0 0 rgba(255,59,48,0); }
.fx-flash.on { animation: redBorder 0.7s ease-in-out 2; }
@keyframes redBorder { 50% { box-shadow: inset 0 0 0 10px rgba(255,59,48,0.85), inset 0 0 60px rgba(255,59,48,0.45); } }

/* OPTIONS: volume sliders, 10% steps */
.opts { display: grid; gap: 8px; margin: 6px 0 10px; }
.vslide { display: grid; grid-template-columns: 9em 1fr 3.5em; gap: 10px; align-items: center; color: var(--text); font-size: 16px; min-height: 44px; }
.vslide input { width: 100%; accent-color: var(--amber); height: 28px; }
.vslide b { color: var(--amber); font-weight: normal; text-align: right; }

/* the challenge level on the start screen */
.levels { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.levels > span { font-family: var(--title); color: var(--amber); font-size: 20px; letter-spacing: 0.12em; }
.levels .keys { flex: 1 1 auto; } .levels .key { flex: 1 1 90px; }

/* beat-synced lamps (html.beat while the song plays): a short flash on each beat instead of a timed blink */
html.beat .lampdot.on, html.beat .def-lamps b.on.d1, html.beat .lamp-defcon.d1, html.beat .caret { animation: none; opacity: calc(0.35 + 0.65 * var(--beat)); }
html.beat .rs.low .lamps b.on { opacity: calc(0.55 + 0.45 * var(--beat)); }
html.beat .commit.open .armed { animation: none; box-shadow: 0 0 calc(8px + 20px * var(--beat)) #ff3b30; }

/* Screen 1 enlarged over the wall */
#s1.max { position: fixed; z-index: 45; }
@media (max-width: 1279px), (max-height: 699px) { #s1.max { inset: 0; width: auto !important; height: auto !important; aspect-ratio: auto; z-index: 70; } }

/* §6c: resource reasons, undo, COMMIT warnings, hotkey badges */
.rs { cursor: pointer; }
.rs.warn0 .led { animation: blink 0.9s steps(2) infinite; }
.stn { position: relative; }
.stn-undo { position: absolute; right: 6px; top: 6px; font: inherit; font-size: 13px; color: var(--amber); background: #000; border: 2px solid var(--amber); padding: 2px 6px; min-height: 30px; }
.commit-note.warn { color: var(--red); }
.ak, .stn { position: relative; }
.hk { position: absolute; left: 3px; top: 1px; font-style: normal; font-size: 13px; color: #6fbf8a; }
.ak.on .hk { color: #02130a; }

/* windows and sliders fit a phone: everything inside may shrink and long words wrap */
.hud-win *, .modal .box * { min-width: 0; }
.hud-body, .modal .box { overflow-wrap: anywhere; }
@media (max-width: 1279px), (max-height: 699px) {
  .hud-win, .hud-win.dossier { width: auto !important; max-width: none; }
  .vslide { grid-template-columns: 6.5em 1fr 3em; gap: 6px; }
}
@media (max-width: 480px) { #btnLog { display: none; } } /* on a phone LOG lives in the ☰ menu (the strip must fit 390 px) */
