/* ═══════════════════════════════════════════════════════════════
   MISSION CONTROL — HOUSTON
   CRT phosphor consoles, brushed steel, backlit push-buttons.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-room: #0b0e11;
  --bg-panel: #161a1f;
  --bg-panel-2: #1d232a;
  --bg-screen: #071009;
  --bg-screen-blue: #060d16;
  --bezel: #2a3138;
  --bezel-hi: #3d4750;
  --ink: #b8c4c9;
  --ink-dim: #6d7a80;
  --phosphor: #6fff9e;
  --phosphor-dim: #2f7f4f;
  --amber: #ffc45e;
  --amber-dim: #8a6a25;
  --cyan: #6fd8ff;
  --cyan-dim: #2a5d70;
  --red: #ff5347;
  --red-dim: #7c211b;
  --white-hot: #eaf6ee;
  --line: #232b32;
  --shadow: rgba(0, 0, 0, .55);
  --font-crt: "IBM Plex Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --font-label: "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg-room);
  color: var(--ink);
  font-family: var(--font-label);
  font-size: 14px;
  overflow: hidden;
  user-select: none;
}
.mono { font-family: var(--font-crt); }
button { font-family: inherit; cursor: pointer; }

/* ─── condition theming ─────────────────────────────────────── */
body[data-condition="nominal"]  { --cond: var(--phosphor); --cond-dim: var(--phosphor-dim); }
body[data-condition="caution"]  { --cond: var(--amber);    --cond-dim: var(--amber-dim); }
body[data-condition="warning"]  { --cond: #ff8f4d;         --cond-dim: #7c4a1b; }
body[data-condition="emergency"]{ --cond: var(--red);      --cond-dim: var(--red-dim); }

/* ═══ ROOM FRAME ═══ */
#room {
  height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(1200px 500px at 50% -10%, #141a20 0%, var(--bg-room) 60%),
    var(--bg-room);
}

/* ═══ TOP BAR ═══ */
#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 14px;
  background: linear-gradient(#242c33, #181e24 55%, #12171c);
  border-bottom: 1px solid #060809;
  box-shadow: 0 1px 0 #333d46 inset, 0 6px 18px var(--shadow);
  z-index: 30;
}
.tb-left, .tb-center, .tb-right { display: flex; align-items: center; gap: 14px; }
.tb-mission-name { font-weight: 700; letter-spacing: .14em; font-size: 13px; color: var(--white-hot); }
.tb-phase { font-size: 10px; letter-spacing: .18em; color: var(--ink-dim); margin-top: 2px; text-transform: uppercase; }

.patch-slot {
  width: 40px; height: 40px; border-radius: 50%;
  background: #0a1220; border: 1px solid var(--bezel-hi);
  box-shadow: 0 2px 6px var(--shadow), 0 1px 0 #3a444d inset;
  overflow: hidden; flex: 0 0 auto;
}
.patch-slot.big { width: 64px; height: 64px; }
.patch-slot svg { width: 100%; height: 100%; display: block; }

.clock-block { text-align: left; }
.clock-label { font-size: 8.5px; letter-spacing: .22em; color: var(--ink-dim); }
.clock-value { font-size: 15px; color: var(--phosphor); text-shadow: 0 0 8px rgba(111,255,158,.35); }
.clock-value.amber { color: var(--amber); text-shadow: 0 0 8px rgba(255,196,94,.35); }
.clock-value.cyan { color: var(--cyan); text-shadow: 0 0 8px rgba(111,216,255,.3); }

.condition-lamp {
  font-family: var(--font-crt); font-size: 12px; font-weight: 700; letter-spacing: .12em;
  padding: 3px 10px; border-radius: 3px;
  color: #05130a; background: var(--cond);
  box-shadow: 0 0 14px var(--cond), 0 1px 0 rgba(255,255,255,.25) inset;
}
.condition-lamp.nominal { animation: none; }
body[data-condition="warning"] .condition-lamp,
body[data-condition="emergency"] .condition-lamp { animation: lampBlink .9s steps(2, jump-none) infinite; }
@keyframes lampBlink { 50% { filter: brightness(.55); } }

.tb-btn {
  font-family: var(--font-crt); font-size: 11px; letter-spacing: .08em;
  color: var(--ink); background: linear-gradient(#313a42, #22282e);
  border: 1px solid #0b0e11; border-radius: 4px; padding: 7px 12px;
  box-shadow: 0 1px 0 #424c55 inset, 0 2px 5px var(--shadow);
}
.tb-btn:hover { color: var(--white-hot); filter: brightness(1.12); }
.tb-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #1a2025 inset; }
.tb-btn.on { color: #05130a; background: var(--phosphor); box-shadow: 0 0 12px rgba(111,255,158,.5); }

/* ═══ MASTER ALARM BANNER ═══ */
#alarm-banner {
  display: none; align-items: center; gap: 12px; justify-content: center;
  padding: 6px; font-family: var(--font-crt); font-weight: 700; letter-spacing: .2em;
  background: linear-gradient(#4a130e, #2a0b08);
  color: #ffb0a8; border-bottom: 1px solid #60150e;
  text-shadow: 0 0 10px rgba(255,83,71,.7);
  z-index: 29;
}
#alarm-banner.active { display: flex; }
.alarm-flash { color: var(--red); animation: lampBlink .5s steps(2, jump-none) infinite; }
.alarm-ack {
  font-family: var(--font-crt); font-size: 11px; font-weight: 700;
  background: var(--red); color: #1a0503; border: none; border-radius: 3px;
  padding: 4px 14px; box-shadow: 0 0 12px rgba(255,83,71,.6);
}

/* ═══ MAIN 3-COLUMN ═══ */
#main { flex: 1; display: grid; grid-template-columns: 320px 1fr 320px; min-height: 0; }

aside { display: flex; flex-direction: column; min-height: 0; background: #10141a; }
#leftcol { border-right: 1px solid #06090c; }
#rightcol { border-left: 1px solid #06090c; }

.col-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 9.5px; letter-spacing: .18em; color: var(--ink-dim);
  padding: 7px 10px; background: #161c22; border-bottom: 1px solid var(--line);
  text-transform: uppercase; flex: 0 0 auto;
}
.col-head-right { color: var(--cyan); }

/* comms transcript */
#comms {
  flex: 1; overflow-y: auto; padding: 8px 10px; font-family: var(--font-crt); font-size: 12px;
  background:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,.008) 2px 3px),
    var(--bg-screen-blue);
  scrollbar-width: thin; scrollbar-color: #2a3540 transparent;
}
.comm-line { margin: 0 0 7px; line-height: 1.45; animation: commIn .18s ease-out; }
@keyframes commIn { from { opacity: 0; transform: translateY(4px); } }
.comm-who { font-weight: 700; letter-spacing: .06em; }
.comm-line.who-CAPCOM .comm-who { color: var(--cyan); }
.comm-line.who-CDR .comm-who, .comm-line.who-LMP .comm-who, .comm-line.who-CMP .comm-who, .comm-line.who-CREW .comm-who { color: var(--phosphor); }
.comm-line.who-FLIGHT .comm-who { color: var(--amber); }
.comm-line.who-SYSTEM .comm-who { color: #d8a24a; }
.comm-line.who-FIDO .comm-who, .comm-line.who-GUIDO .comm-who, .comm-line.who-EECOM .comm-who,
.comm-line.who-TELMU .comm-who, .comm-line.who-SURGEON .comm-who, .comm-line.who-INCO .comm-who,
.comm-line.who-PAYLOAD .comm-who, .comm-line.who-CONTROL .comm-who, .comm-line.who-PAO .comm-who { color: #9aa7ff; }
.comm-met { color: #3d4a52; font-size: 10px; margin-right: 6px; }
.comm-text { color: #c7d3d8; }
.comm-line.who-SYSTEM .comm-text { color: #b9a68a; }

#readback-tray { flex: 0 0 auto; padding: 6px 10px; background: #141a20; border-top: 1px solid var(--line); display: none; }
#readback-tray.active { display: block; }
.readback-btn {
  width: 100%; font-family: var(--font-crt); font-size: 12px; text-align: left;
  background: linear-gradient(#2c3a2e, #1e2a20); color: var(--phosphor);
  border: 1px solid #2f5138; border-radius: 4px; padding: 8px 10px;
  animation: pulseBtn 1.4s ease-in-out infinite;
}
.readback-btn:hover { filter: brightness(1.2); }
@keyframes pulseBtn { 50% { box-shadow: 0 0 14px rgba(111,255,158,.45); } }

/* ═══ CENTER ═══ */
#centercol { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0d1116; }

#bigboard-wrap {
  position: relative; flex: 1; min-height: 0; margin: 10px 10px 6px;
  border: 6px solid var(--bezel); border-radius: 10px;
  box-shadow: 0 2px 0 var(--bezel-hi) inset, 0 14px 40px var(--shadow);
  overflow: hidden; background: var(--bg-screen-blue);
}
#bigboard { width: 100%; height: 100%; display: block; }
.board-overlay {
  position: absolute; left: 0; right: 0; display: flex; justify-content: space-between;
  padding: 6px 14px; font-size: 11px; letter-spacing: .14em; color: #87b7d8;
  text-shadow: 0 0 8px rgba(111,216,255,.5); pointer-events: none;
}
#board-overlay-top { top: 0; }
#board-overlay-bottom { bottom: 0; color: #5f93ae; }

/* condition border glow on big board */
body[data-condition="caution"]   #bigboard-wrap { box-shadow: 0 0 0 2px rgba(255,196,94,.35), 0 14px 40px var(--shadow); }
body[data-condition="warning"]   #bigboard-wrap { box-shadow: 0 0 0 2px rgba(255,143,77,.5), 0 14px 40px var(--shadow); }
body[data-condition="emergency"] #bigboard-wrap { animation: boardPulse 1s ease-in-out infinite; }
@keyframes boardPulse { 50% { box-shadow: 0 0 0 3px rgba(255,83,71,.75), 0 0 46px rgba(255,83,71,.35); } }

/* ═══ CONSOLE DECK ═══ */
#console-deck {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  padding: 8px 10px 12px; flex: 0 0 auto;
}
.deck-btn {
  position: relative; text-align: left; padding: 8px 9px 7px;
  background: linear-gradient(#232a31, #171d22 60%, #12171b);
  border: 1px solid #0a0d10; border-radius: 6px;
  box-shadow: 0 1px 0 #333d46 inset, 0 3px 8px var(--shadow);
  color: var(--ink); overflow: hidden; min-height: 58px;
}
.deck-btn:hover { filter: brightness(1.15); }
.deck-btn.active { outline: 2px solid var(--cyan-dim); background: linear-gradient(#27333c, #182126); }
.deck-name { font-family: var(--font-crt); font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--white-hot); }
.deck-role { font-size: 8.5px; letter-spacing: .06em; color: var(--ink-dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-read { font-family: var(--font-crt); font-size: 10px; color: var(--phosphor-dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-light {
  position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor);
}
.deck-light.off { background: #2a3138; box-shadow: none; }
.deck-light.caution { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.deck-light.warning, .deck-light.emergency { background: var(--red); box-shadow: 0 0 10px var(--red); animation: lampBlink .7s steps(2, jump-none) infinite; }
.deck-btn.attention { animation: deckAttn 1.2s ease-in-out infinite; }
@keyframes deckAttn { 50% { box-shadow: 0 0 0 2px var(--amber), 0 0 22px rgba(255,196,94,.4); } }
.deck-key {
  position: absolute; bottom: 5px; right: 7px; font-family: var(--font-crt); font-size: 9px; color: #4a565e;
  border: 1px solid #2a3138; border-radius: 3px; padding: 0 4px;
}

/* ═══ OBJECTIVES / ALERTS ═══ */
#objectives { flex: 1 1 40%; overflow-y: auto; padding: 8px 10px; background: #0d1218; scrollbar-width: thin; }
.obj {
  display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; margin-bottom: 5px;
  background: #131a21; border: 1px solid #1c242c; border-radius: 5px; font-size: 12px; line-height: 1.35;
}
.obj .obj-box { font-family: var(--font-crt); color: var(--ink-dim); flex: 0 0 auto; }
.obj.done { border-color: #24402e; }
.obj.done .obj-box { color: var(--phosphor); }
.obj.done .obj-text { color: #7d9c88; text-decoration: line-through; }
.obj.failed { border-color: #5a1c16; }
.obj.failed .obj-box { color: var(--red); }
.obj-hint { display: block; margin-top: 3px; font-size: 10.5px; color: var(--amber); font-family: var(--font-crt); }
.obj.locked { opacity: .38; }

#alerts { flex: 1 1 60%; overflow-y: auto; padding: 8px 10px; background: #0d1116; scrollbar-width: thin; font-family: var(--font-crt); font-size: 11.5px; }
.alert-item { padding: 5px 8px; margin-bottom: 4px; border-left: 3px solid #33404a; background: #12181f; color: #9fb0b7; line-height: 1.4; }
.alert-item .a-met { color: #44525b; margin-right: 6px; font-size: 10px; }
.alert-item.lvl-info { border-left-color: #3d5a80; }
.alert-item.lvl-caution { border-left-color: var(--amber); color: #e8cf9e; background: #1d1a12; }
.alert-item.lvl-warning { border-left-color: #ff8f4d; color: #ffc9a3; background: #20150e; }
.alert-item.lvl-emergency { border-left-color: var(--red); color: #ffb0a8; background: #22100d; }
.alert-item.resolved { opacity: .45; border-left-color: #2f5138 !important; }
.alert-item.clickable { cursor: pointer; }
.alert-item.clickable:hover { filter: brightness(1.25); }

/* ═══ CONSOLE PANEL DRAWER ═══ */
#panel-overlay {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(1060px, 94vw); max-height: 74vh; z-index: 40;
  display: flex; flex-direction: column;
}
#panel-overlay.hidden { display: none; }
#panel {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(#262e36, #1a2127 8%, #141a1f);
  border: 1px solid #05070a; border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 2px 0 #39434d inset, 0 -18px 60px rgba(0,0,0,.7);
  animation: panelUp .22s cubic-bezier(.2,.9,.3,1);
}
@keyframes panelUp { from { transform: translateY(30px); opacity: 0; } }
#panel-head {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  border-bottom: 1px solid #0a0d10; flex: 0 0 auto;
}
.panel-title { font-family: var(--font-crt); font-size: 17px; font-weight: 700; letter-spacing: .2em; color: var(--white-hot); }
.panel-sub { font-size: 10px; letter-spacing: .16em; color: var(--ink-dim); text-transform: uppercase; }
.panel-lights { display: flex; gap: 6px; margin-left: auto; margin-right: 12px; }
.p-light { width: 10px; height: 10px; border-radius: 50%; background: #232a31; border: 1px solid #0c0f12; }
.p-light.on-green { background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor); }
.p-light.on-amber { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.p-light.on-red { background: var(--red); box-shadow: 0 0 9px var(--red); animation: lampBlink .6s steps(2, jump-none) infinite; }
.panel-close {
  background: linear-gradient(#313a42, #20262c); color: var(--ink); border: 1px solid #0a0d10;
  border-radius: 5px; width: 30px; height: 30px; font-size: 14px;
  box-shadow: 0 1px 0 #424c55 inset;
}
.panel-close:hover { color: var(--red); }

#panel-body { overflow-y: auto; padding: 14px 16px 18px; scrollbar-width: thin; }

/* panel building blocks */
.p-grid { display: grid; gap: 12px; }
.p-sect {
  background: #10161b; border: 1px solid #1c242c; border-radius: 7px; padding: 10px 12px;
}
.p-sect-title {
  font-size: 9.5px; letter-spacing: .2em; color: var(--ink-dim); text-transform: uppercase;
  margin-bottom: 8px; border-bottom: 1px dashed #1e262d; padding-bottom: 5px;
  display: flex; justify-content: space-between;
}
.readout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 7px; }
.readout {
  background: var(--bg-screen); border: 1px solid #14201a; border-radius: 4px; padding: 6px 8px;
  box-shadow: 0 0 12px rgba(111,255,158,.05) inset;
}
.readout .r-label { font-size: 8.5px; letter-spacing: .14em; color: #4d6353; text-transform: uppercase; }
.readout .r-value { font-family: var(--font-crt); font-size: 15px; color: var(--phosphor); text-shadow: 0 0 7px rgba(111,255,158,.4); margin-top: 2px; }
.readout .r-value.amber { color: var(--amber); text-shadow: 0 0 7px rgba(255,196,94,.4); }
.readout .r-value.red { color: var(--red); text-shadow: 0 0 7px rgba(255,83,71,.45); }
.readout .r-value.cyan { color: var(--cyan); text-shadow: 0 0 7px rgba(111,216,255,.4); }
.readout .r-sub { font-size: 9px; color: #41564a; font-family: var(--font-crt); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pbtn {
  font-family: var(--font-crt); font-size: 11.5px; letter-spacing: .06em;
  padding: 9px 14px; border-radius: 5px; color: var(--ink);
  background: linear-gradient(#333d45, #232a30);
  border: 1px solid #0b0e11; box-shadow: 0 1px 0 #49545e inset, 0 3px 7px var(--shadow);
}
.pbtn:hover:not(:disabled) { filter: brightness(1.18); color: var(--white-hot); }
.pbtn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 #161c21 inset; }
.pbtn:disabled { opacity: .35; cursor: not-allowed; }
.pbtn.lit { color: #05130a; background: linear-gradient(#7bffa8, #4fce7c); box-shadow: 0 0 14px rgba(111,255,158,.5); font-weight: 700; }
.pbtn.lit-amber { color: #221503; background: linear-gradient(#ffd58e, #eda93f); box-shadow: 0 0 14px rgba(255,196,94,.5); font-weight: 700; }
.pbtn.lit-red { color: #2a0703; background: linear-gradient(#ff8478, #e04436); box-shadow: 0 0 14px rgba(255,83,71,.55); font-weight: 700; }
.pbtn.attn { animation: pulseBtn 1.3s ease-in-out infinite; }
.pbtn.wide { width: 100%; }

/* toggle switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dotted #1c242c; }
.switch-row:last-child { border-bottom: none; }
.switch-label { font-size: 11.5px; color: #a9b6bc; font-family: var(--font-crt); }
.switch-sub { font-size: 9px; color: #55636b; display: block; }
.tswitch {
  position: relative; width: 46px; height: 24px; border-radius: 4px; flex: 0 0 auto;
  background: linear-gradient(#1a2126, #10151a); border: 1px solid #0a0d10;
  box-shadow: 0 2px 4px var(--shadow) inset;
}
.tswitch::after {
  content: ""; position: absolute; top: 2px; left: 3px; width: 18px; height: 18px; border-radius: 3px;
  background: linear-gradient(#4c5860, #333c43); box-shadow: 0 1px 3px var(--shadow), 0 1px 0 #5d6a73 inset;
  transition: left .12s ease;
}
.tswitch.on { background: linear-gradient(#1d3527, #122019); }
.tswitch.on::after { left: 23px; background: linear-gradient(#8affb4, #55d186); box-shadow: 0 0 10px rgba(111,255,158,.55); }
.tswitch:disabled { opacity: .4; cursor: not-allowed; }
.tswitch.warn-on { background: linear-gradient(#3d2415, #241207); }
.tswitch.warn-on::after { background: linear-gradient(#ffce8a, #eda93f); box-shadow: 0 0 10px rgba(255,196,94,.6); }

/* slider */
.slider-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.slider-row label { font-family: var(--font-crt); font-size: 11px; color: #a9b6bc; min-width: 110px; }
.slider-row output { font-family: var(--font-crt); font-size: 12px; color: var(--phosphor); min-width: 52px; text-align: right; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--phosphor-dim), #1a2620); outline: none;
  border: 1px solid #0b0e10;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 22px; border-radius: 4px;
  background: linear-gradient(#4c5860, #2e363c); border: 1px solid #0b0e10;
  box-shadow: 0 1px 0 #5d6a73 inset, 0 2px 5px var(--shadow); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 22px; border-radius: 4px;
  background: linear-gradient(#4c5860, #2e363c); border: 1px solid #0b0e10; cursor: pointer;
}

/* strip chart */
.chart-box { background: #040c06; border: 1px solid #122018; border-radius: 5px; padding: 4px; }
.chart-box canvas { display: block; width: 100%; }
.chart-label { font-size: 9px; letter-spacing: .16em; color: #4d6353; text-transform: uppercase; padding: 2px 4px; display: flex; justify-content: space-between; }
.chart-label .cv { color: var(--phosphor); font-family: var(--font-crt); }

/* gauges */
.gauge { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gauge-dial {
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #0c1710 0%, #060d09 68%);
  border: 3px solid var(--bezel); box-shadow: 0 2px 0 var(--bezel-hi) inset, 0 3px 8px var(--shadow);
  position: relative;
}
.gauge-needle {
  position: absolute; left: 50%; bottom: 50%; width: 2.5px; height: 27px; margin-left: -1.25px;
  background: var(--amber); transform-origin: 50% 100%; border-radius: 2px;
  box-shadow: 0 0 6px rgba(255,196,94,.7); transition: transform .3s ease;
}
.gauge-face { position: absolute; inset: 0; }
.gauge-tick { position: absolute; left: 50%; bottom: 50%; width: 1.5px; height: 6px; background: #3d5a44; transform-origin: 50% calc(27px + 3px); margin-left: -.75px; }
.gauge-name { font-size: 8.5px; letter-spacing: .14em; color: #4d6353; font-family: var(--font-crt); }
.gauge-val { font-family: var(--font-crt); font-size: 11px; color: var(--phosphor); }

/* bar meters */
.meter-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-family: var(--font-crt); }
.meter-row label { font-size: 10px; color: #a9b6bc; min-width: 92px; }
.meter { flex: 1; height: 12px; background: #0a120d; border: 1px solid #122018; border-radius: 3px; overflow: hidden; position: relative; }
.meter-fill { height: 100%; background: linear-gradient(90deg, #2f7f4f, #6fff9e); box-shadow: 0 0 8px rgba(111,255,158,.35); transition: width .25s linear; }
.meter-fill.amber { background: linear-gradient(90deg, #8a6a25, #ffc45e); }
.meter-fill.red { background: linear-gradient(90deg, #7c211b, #ff5347); }
.meter-val { font-size: 10.5px; color: var(--phosphor); min-width: 48px; text-align: right; }

/* DSKY */
.dsky {
  background: #101812; border: 2px solid var(--bezel); border-radius: 8px; padding: 12px;
  font-family: var(--font-crt); box-shadow: 0 2px 0 var(--bezel-hi) inset, 0 4px 14px var(--shadow);
}
.dsky-display { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.dsky-field { background: #04140a; border-radius: 4px; padding: 5px 8px; border: 1px solid #10301c; }
.dsky-field .dl { font-size: 8px; color: #3d7a52; letter-spacing: .18em; }
.dsky-field .dv { font-size: 17px; color: #8affb4; text-shadow: 0 0 9px rgba(111,255,158,.55); letter-spacing: .1em; }
.dsky-lights { display: flex; gap: 5px; margin-bottom: 10px; flex-wrap: wrap; }
.dsky-lamp {
  font-size: 8px; letter-spacing: .1em; padding: 3px 6px; border-radius: 3px;
  background: #141a1f; color: #3a464e; border: 1px solid #0b0e10;
}
.dsky-lamp.on { background: var(--amber); color: #241503; box-shadow: 0 0 10px rgba(255,196,94,.6); }
.dsky-lamp.on.red { background: var(--red); color: #2a0703; box-shadow: 0 0 10px rgba(255,83,71,.6); }
.dsky-lamp.on.green { background: var(--phosphor); color: #05130a; box-shadow: 0 0 10px rgba(111,255,158,.5); }

/* crew cards */
.crew-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.crew-card { background: #10161b; border: 1px solid #1c242c; border-radius: 7px; padding: 10px; text-align: center; }
.crew-card.eva { border-color: #2a5d70; box-shadow: 0 0 16px rgba(111,216,255,.12); }
.crew-name { font-family: var(--font-crt); font-weight: 700; letter-spacing: .08em; color: var(--white-hot); font-size: 13px; }
.crew-role { font-size: 9px; letter-spacing: .18em; color: var(--ink-dim); margin: 2px 0 8px; }
.crew-stat { display: flex; justify-content: space-between; font-family: var(--font-crt); font-size: 11px; padding: 3px 0; border-top: 1px dotted #1c242c; }
.crew-stat .k { color: #55636b; } .crew-stat .v { color: var(--phosphor); }
.crew-status-chip { margin-top: 8px; font-family: var(--font-crt); font-size: 10px; letter-spacing: .1em; padding: 3px 8px; border-radius: 3px; background: #17351f; color: var(--phosphor); display: inline-block; }
.crew-status-chip.eva { background: #12303c; color: var(--cyan); }
.crew-status-chip.distress { background: #3d1410; color: var(--red); animation: lampBlink 1s steps(2, jump-none) infinite; }

/* FLIGHT console poll board */
.poll-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.poll-cell {
  background: #10161b; border: 1px solid #1c242c; border-radius: 6px; padding: 8px 10px;
  font-family: var(--font-crt);
}
.poll-cell .pc-name { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: #a9b6bc; }
.poll-cell .pc-verdict { font-size: 13px; font-weight: 700; margin-top: 4px; color: #4a565e; }
.poll-cell.go .pc-verdict { color: var(--phosphor); text-shadow: 0 0 8px rgba(111,255,158,.4); }
.poll-cell.go { border-color: #24402e; }
.poll-cell.nogo { border-color: #5a1c16; }
.poll-cell.nogo .pc-verdict { color: var(--red); }

.gate-card {
  margin-top: 12px; background: linear-gradient(#2a2413, #1c170c); border: 1px solid #5a4a1c;
  border-radius: 7px; padding: 12px 14px; animation: gateGlow 1.6s ease-in-out infinite;
}
@keyframes gateGlow { 50% { box-shadow: 0 0 24px rgba(255,196,94,.25); } }
.gate-title { font-family: var(--font-crt); font-weight: 700; letter-spacing: .14em; color: var(--amber); font-size: 13px; }
.gate-desc { font-size: 12px; color: #cbb98a; margin: 5px 0 10px; line-height: 1.45; }
.gate-timer { font-family: var(--font-crt); color: var(--red); font-size: 12px; letter-spacing: .1em; margin-top: 8px; }

/* checklists */
.check-item { display: flex; gap: 9px; align-items: flex-start; padding: 6px 8px; border-bottom: 1px dotted #1c242c; font-size: 12.5px; }
.check-item .cb { font-family: var(--font-crt); color: #4a565e; }
.check-item.done .cb { color: var(--phosphor); }
.check-item.done { color: #7d9c88; }
.check-item button { margin-left: auto; }

/* ═══ SCREENS ═══ */
.screen {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 10, .88); backdrop-filter: blur(3px);
  overflow-y: auto; padding: 30px 16px;
}
.screen.hidden { display: none; }

.menu-inner { width: min(880px, 94vw); }
.menu-brand { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.menu-patch { width: 72px; height: 72px; filter: drop-shadow(0 0 18px rgba(111,216,255,.25)); }
.menu-brand h1 { font-size: 30px; letter-spacing: .3em; color: var(--white-hot); font-weight: 800; text-shadow: 0 0 24px rgba(111,255,158,.2); }
.menu-sub { font-size: 10.5px; letter-spacing: .22em; color: var(--ink-dim); margin-top: 4px; }
.menu-status { font-size: 12px; color: var(--cyan); margin-bottom: 16px; letter-spacing: .06em; }

.mission-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.mcard {
  display: flex; gap: 12px; padding: 12px; text-align: left;
  background: linear-gradient(#1c232b, #141a20);
  border: 1px solid #262f38; border-radius: 9px; color: var(--ink);
  box-shadow: 0 3px 10px var(--shadow); transition: transform .12s ease, box-shadow .12s ease;
}
.mcard:hover:not(.locked) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.6), 0 0 0 1px var(--cyan-dim); }
.mcard.locked { opacity: .42; cursor: not-allowed; }
.mcard .patch-slot { width: 52px; height: 52px; }
.mcard-name { font-family: var(--font-crt); font-weight: 700; font-size: 13px; letter-spacing: .08em; color: var(--white-hot); }
.mcard-type { font-size: 9.5px; letter-spacing: .16em; color: var(--cyan-dim); text-transform: uppercase; margin: 2px 0 5px; }
.mcard-desc { font-size: 11px; color: #8b979d; line-height: 1.4; }
.mcard-status { font-family: var(--font-crt); font-size: 10px; margin-top: 6px; letter-spacing: .1em; }
.mcard-status.done { color: var(--phosphor); }
.mcard-status.ready { color: var(--amber); }
.mcard-status.locked { color: #5a4545; }

.menu-options { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; padding: 12px 4px; border-top: 1px solid #1c242c; }
.opt { display: flex; gap: 8px; align-items: baseline; font-size: 12px; cursor: pointer; }
.opt em { color: var(--ink-dim); font-style: normal; font-size: 10.5px; }
.opt input { accent-color: var(--phosphor); }
.menu-foot { font-size: 10px; color: #44525b; letter-spacing: .08em; margin-top: 14px; }

.mini-btn {
  font-family: var(--font-crt); font-size: 10px; letter-spacing: .1em;
  background: #20262c; color: var(--ink); border: 1px solid #0b0e11; border-radius: 4px; padding: 4px 9px;
}
.mini-btn:hover { color: var(--white-hot); filter: brightness(1.2); }
.mini-btn.danger { color: #ff9d94; border-color: #4a1712; }
.mini-btn.danger:hover { color: var(--red); }

.big-btn {
  font-family: var(--font-crt); font-size: 14px; font-weight: 700; letter-spacing: .14em;
  padding: 13px 26px; border-radius: 6px; color: #05130a;
  background: linear-gradient(#7bffa8, #45c474);
  border: 1px solid #1c5c33; box-shadow: 0 0 22px rgba(111,255,158,.3), 0 3px 10px var(--shadow);
}
.big-btn:hover:not(:disabled) { filter: brightness(1.1); }
.big-btn:disabled { opacity: .32; cursor: not-allowed; box-shadow: none; }
.big-btn.ghost { background: linear-gradient(#333d45, #232a30); color: var(--ink); border-color: #0b0e11; box-shadow: 0 3px 10px var(--shadow); }
.big-btn.attn { animation: pulseBtn 1.3s ease-in-out infinite; }

/* preflight */
.preflight-inner { width: min(920px, 95vw); background: #12171d; border: 1px solid #232b32; border-radius: 12px; padding: 22px 26px; box-shadow: 0 24px 80px rgba(0,0,0,.7); }
.pf-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.pf-head h2 { letter-spacing: .22em; color: var(--white-hot); font-size: 22px; }
.pf-brief { font-size: 13px; color: #9fb0b7; line-height: 1.55; margin-bottom: 16px; max-width: 70ch; }
.pf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pf-checklist, .pf-poll { background: #0d1218; border: 1px solid #1c242c; border-radius: 8px; padding-bottom: 12px; }
#pf-checklist, #pf-poll-list { padding: 8px 12px; }
#btn-launch { width: calc(100% - 24px); margin: 12px 12px 0; }
.pf-hint { font-size: 10px; color: #55636b; padding: 10px 14px 0; line-height: 1.5; }
.pf-check { display: flex; gap: 8px; padding: 6px 4px; font-family: var(--font-crt); font-size: 12px; border-bottom: 1px dotted #1c242c; align-items: center; }
.pf-check .st { margin-left: auto; color: #4a565e; letter-spacing: .1em; font-size: 10px; }
.pf-check.ok .st { color: var(--phosphor); }
.pf-check.bad .st { color: var(--red); }

/* debrief */
.debrief-inner { width: min(680px, 94vw); background: #12171d; border: 1px solid #232b32; border-radius: 12px; padding: 26px 30px; text-align: center; box-shadow: 0 24px 80px rgba(0,0,0,.7); }
.db-banner { font-size: 15px; letter-spacing: .3em; font-weight: 800; color: var(--phosphor); margin-bottom: 8px; }
.db-banner.failed { color: var(--red); animation: lampBlink 1.2s steps(2, jump-none) infinite; }
.db-grade { font-family: var(--font-crt); font-size: 84px; font-weight: 800; color: var(--amber); text-shadow: 0 0 34px rgba(255,196,94,.45); line-height: 1; margin: 8px 0; }
.db-summary { font-size: 13px; color: #9fb0b7; line-height: 1.55; margin-bottom: 16px; }
.db-table { width: 100%; font-size: 12px; border-collapse: collapse; margin-bottom: 14px; }
.db-table td { padding: 5px 8px; border-bottom: 1px dotted #1c242c; text-align: left; color: #9fb0b7; }
.db-table td:last-child { text-align: right; color: var(--phosphor); }
.db-table td.neg { color: #ff9d94; }
.db-table tr.total td { border-top: 1px solid #2c3841; border-bottom: none; font-weight: 700; color: var(--white-hot); font-size: 14px; }
.db-commendations { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.commend { font-family: var(--font-crt); font-size: 10.5px; letter-spacing: .1em; padding: 5px 12px; border-radius: 20px; background: linear-gradient(#3d3315, #26200c); color: var(--amber); border: 1px solid #5a4a1c; box-shadow: 0 0 14px rgba(255,196,94,.2); }
.db-rank { font-size: 12px; color: var(--cyan); margin-bottom: 16px; letter-spacing: .08em; }
.db-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* help */
.help-inner { width: min(720px, 94vw); background: #12171d; border: 1px solid #232b32; border-radius: 12px; padding: 24px 28px; }
.help-inner h2 { letter-spacing: .2em; color: var(--white-hot); font-size: 18px; margin-bottom: 16px; }
.help-cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 22px; margin-bottom: 18px; }
.help-inner h3 { font-size: 11px; letter-spacing: .2em; color: var(--ink-dim); margin-bottom: 10px; }
.help-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.help-table td { padding: 5px 6px; border-bottom: 1px dotted #1c242c; color: #9fb0b7; }
.help-table td:first-child { color: var(--amber); white-space: nowrap; }
.help-list { list-style: none; }
.help-list li { font-size: 12.5px; color: #9fb0b7; line-height: 1.5; padding: 5px 0 5px 16px; position: relative; border-bottom: 1px dotted #1c242c; }
.help-list li::before { content: "▸"; position: absolute; left: 0; color: var(--phosphor-dim); }
.help-list b { color: var(--white-hot); }

/* tutorial */
#tutorial-tip {
  position: fixed; z-index: 55; left: 50%; bottom: 108px; transform: translateX(-50%);
  width: min(560px, 92vw);
  background: linear-gradient(#1d2a1e, #131c14); border: 1px solid #2f5138; border-radius: 9px;
  padding: 12px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.65), 0 0 24px rgba(111,255,158,.15);
  display: flex; gap: 12px; align-items: center;
}
#tutorial-tip.hidden { display: none; }
#tut-text { font-size: 12.5px; line-height: 1.5; color: #cfe9d4; flex: 1; }
#tut-text b { color: var(--phosphor); }
#tut-text kbd { font-family: var(--font-crt); background: #0c1410; border: 1px solid #2f5138; border-radius: 3px; padding: 1px 5px; font-size: 11px; }

/* pulse highlight for cadet/tutorial targets */
@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(111,255,158,.9), 0 0 26px rgba(111,255,158,.5); }
  50% { box-shadow: 0 0 0 5px rgba(111,255,158,.25), 0 0 10px rgba(111,255,158,.2); }
}
.tut-target { animation: targetPulse 1.2s ease-in-out infinite !important; position: relative; z-index: 5; }

/* ═══ CRT ATMOSPHERE ═══ */
#crt-scanlines, #crt-vignette, #crt-flicker { position: fixed; inset: 0; pointer-events: none; }
#crt-scanlines {
  z-index: 90; opacity: .5; mix-blend-mode: overlay;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
}
#crt-vignette {
  z-index: 91;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0,0,0,.5) 100%);
}
#crt-flicker { z-index: 89; background: rgba(160, 220, 255, .02); animation: flick 7s steps(12) infinite; }
@keyframes flick {
  0%, 100% { opacity: .3; } 8% { opacity: .9; } 9% { opacity: .2; } 34% { opacity: .55; }
  52% { opacity: .85; } 53% { opacity: .25; } 77% { opacity: .6; }
}

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a3540; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1180px) {
  #main { grid-template-columns: 260px 1fr 260px; }
  #console-deck { grid-template-columns: repeat(4, 1fr); }
  .deck-btn { min-height: 50px; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  #room { height: auto; min-height: 100vh; }
  #main { grid-template-columns: 1fr; }
  #leftcol, #rightcol { max-height: 260px; border: none; border-top: 1px solid #06090c; }
  #bigboard-wrap { min-height: 320px; }
  #console-deck { grid-template-columns: repeat(4, 1fr); }
  .tb-center { flex-wrap: wrap; gap: 8px; }
  .pf-cols, .help-cols { grid-template-columns: 1fr; }
  .poll-board, .crew-cards { grid-template-columns: repeat(2, 1fr); }
}
