/* terminal.css — CRT green-on-black aesthetic for the WarGames-inspired terminal. */

:root {
  --bg: #020a02;
  --fg: #33ff66;
  --fg-dim: #1f9c40;
  --fg-bright: #b6ffcc;
  --amber: #ffcc33;
  --warn: #ff9d3c; /* warm amber-orange for cautions — softer than pure red */
  --red: #ff4444;
  --echo: #7fe0c0; /* cool phosphor green for "echo" lines (was blue) */
  --font: "Cascadia Code", "Consolas", "SFMono-Regular", ui-monospace, monospace;
  /* Status-bar control sizing — one source of truth so every button box matches (the chess
     glyph no longer sits 1–2px taller). Scales responsively at the breakpoints below. */
  --btn-h: 28px;
  --btn-font: 0.75rem;
}

/* Responsive control sizing: small phones ↓, large boards (Surface Hub) ↑. */
@media (max-width: 600px) {
  :root { --btn-h: 26px; --btn-font: 0.7rem; }
}
@media (min-width: 1600px) {
  :root { --btn-h: 34px; --btn-font: 0.9rem; }
}
@media (min-width: 2400px) {
  :root { --btn-h: 44px; --btn-font: 1.1rem; }
}

* {
  box-sizing: border-box;
}

/* The hidden attribute must win over component display rules (flex/block). */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  overflow: hidden;
}

/* The room/desk behind the monitor (barely visible — the bezel now reaches the edges). */
body {
  background: #050403;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Beige, WORN 1983 CRT monitor bezel that fills the viewport to the edges. */
.monitor {
  position: relative;
  width: 100vw;
  height: 100vh;
  padding: 3vh 3vw 5.5vh;
  border-radius: 0;
  overflow: hidden;
  background-color: #cabf9f;
  background-image:
    radial-gradient(60% 45% at 78% 88%, rgba(70, 52, 18, 0.22), transparent 62%),
    radial-gradient(45% 35% at 12% 90%, rgba(60, 45, 15, 0.18), transparent 62%),
    radial-gradient(55% 45% at 92% 10%, rgba(255, 250, 225, 0.14), transparent 60%),
    radial-gradient(40% 30% at 6% 12%, rgba(40, 30, 10, 0.16), transparent 60%),
    repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.035) 0 2px, transparent 2px 8px),
    linear-gradient(160deg, #e7ddc3 0%, #cabf9f 46%, #ada079 100%);
  box-shadow:
    inset 0 3px 5px rgba(255, 255, 255, 0.35),
    inset 0 -10px 26px rgba(0, 0, 0, 0.4),
    inset 10px 0 34px rgba(0, 0, 0, 0.28),
    inset -10px 0 34px rgba(0, 0, 0, 0.28);
}

/* Grime / dust / scuff overlay for a used, aged look. */
.monitor::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

.monitor-chin {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.6vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 2;
}

.monitor-brand {
  color: #5f5540;
  font-size: 0.72rem;
  letter-spacing: 3px;
  font-weight: bold;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  opacity: 0.85;
}

.monitor-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 8px 2px rgba(51, 255, 102, 0.8);
  animation: ledpulse 4s ease-in-out infinite;
}

@keyframes ledpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.crt {
  position: relative;
  height: 100%;
  width: 100%;
  border-radius: 10px;
  background: radial-gradient(ellipse at center, #041204 0%, #010601 100%);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1;
  /* Curved-glass vignette + inner shadow so it reads as a tube screen. */
  box-shadow:
    inset 0 0 60px 10px rgba(0, 0, 0, 0.9),
    inset 0 0 140px 30px rgba(0, 20, 0, 0.5);
}

/* Slow CRT "refresh roll" — a soft band that drifts down the screen. Always on, all modes. */
.crt::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 48;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(51, 255, 102, 0.05) 46%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(51, 255, 102, 0.05) 54%,
    transparent 100%
  );
  background-size: 100% 220%;
  animation: crtroll 22s linear infinite;
}

@keyframes crtroll {
  0% { background-position: 0 -120%; }
  100% { background-position: 0 120%; }
}

/* Brief glitch/tear (RGB skew) — pulsed occasionally in berserk mode. */
.crt.glitch {
  animation: crtglitch 0.28s steps(2) 1;
}

@keyframes crtglitch {
  0% { transform: translate(0, 0) skewX(0); filter: none; }
  25% { transform: translate(-3px, 1px) skewX(3deg); filter: hue-rotate(45deg) saturate(1.6); }
  50% { transform: translate(3px, -2px) skewX(-4deg); filter: hue-rotate(-35deg); }
  75% { transform: translate(-1px, 1px) skewX(1deg); filter: saturate(1.3); }
  100% { transform: none; filter: none; }
}

/* Scanline + flicker overlays for CRT feel */
.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0.28) 4px
  );
  z-index: 50;
  mix-blend-mode: multiply;
}

.flicker {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: rgba(51, 255, 102, 0.02);
  z-index: 49;
  animation: flicker 3s infinite;
}

@keyframes flicker {
  0%,
  95%,
  100% {
    opacity: 0.5;
  }
  96% {
    opacity: 0.2;
  }
  98% {
    opacity: 0.7;
  }
}

/* Honor reduced-motion: pause the always-on CRT effects. This is both an accessibility win
   and makes UI automation deterministic (Playwright's stability check relies on rAF, which
   never settles while decorative animations run every frame). */
@media (prefers-reduced-motion: reduce) {
  .crt::after,
  .flicker,
  .monitor-led,
  .scanlines {
    animation: none !important;
  }
}

/* ---------- Status bar ---------- */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  flex-wrap: wrap; /* on narrow screens the controls wrap to a second row instead of being
                      clipped by the CRT's overflow:hidden (keeps every button reachable) */
  padding: 8px 16px;
  border-bottom: 1px solid var(--fg-dim);
  z-index: 40;
  text-shadow: 0 0 6px rgba(51, 255, 102, 0.5);
}

.defcon {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 2px;
  font-weight: bold;
}

.defcon-value {
  font-size: 1.4rem;
  min-width: 1.2em;
  text-align: center;
}

.defcon-ladder {
  display: flex;
  gap: 4px;
}

.defcon-ladder .rung {
  width: 14px;
  height: 14px;
  border: 1px solid var(--fg-dim);
}

.defcon-ladder .rung.on {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.status-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-badge {
  font-size: 0.75rem;
  color: var(--fg-dim);
  letter-spacing: 1px;
}

/* ---------- Buttons ---------- */
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--btn-h);
  box-sizing: border-box;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg-dim);
  padding: 0 10px;
  font-family: var(--font);
  font-size: var(--btn-font);
  line-height: 1;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

/* Icon-only status button (e.g. the chess piece): no box, just the phosphor glyph rendered
   like a board piece, so it sits tight against the adjacent boxed buttons. */
.ghost-btn.icon-only {
  border-color: transparent;
  background: transparent;
  padding: 0 2px;
  font-size: calc(var(--btn-font) + 0.6rem);
  color: var(--fg-bright);
  text-shadow: 0 0 6px rgba(51, 255, 102, 0.7);
  font-variant-emoji: text; /* force the monochrome glyph, matching the chess board pieces */
}
.ghost-btn.icon-only:hover {
  background: transparent;
  color: #fff;
  text-shadow: 0 0 12px rgba(51, 255, 102, 0.95);
}

.ghost-btn:hover {
  background: var(--fg-dim);
  color: #000;
}

/* CONNECT / COPY LINK share the terminal's outlined-box treatment (matches the bedroom
   ghost-btn controls): transparent fill, 1px phosphor border, invert on hover. */
.primary-btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg-dim);
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 1rem;
  letter-spacing: 3px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 12px;
  width: 100%;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.primary-btn:hover {
  background: var(--fg-dim);
  color: #000;
  box-shadow: 0 0 16px rgba(51, 255, 102, 0.4);
}

/* ---------- Menu overlay ---------- */
.menu-overlay,
.telemetry-overlay,
.wiki-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 6, 1, 0.92);
  z-index: 60;
  padding: 20px;
  overflow: auto;
}

.menu-panel {
  border: 1px solid var(--fg-dim);
  padding: 24px 28px;
  max-width: 640px;
  width: 100%;
  background: rgba(2, 12, 2, 0.9);
  box-shadow: 0 0 30px rgba(51, 255, 102, 0.15);
}

.menu-title {
  color: var(--fg-bright);
  text-shadow: 0 0 10px rgba(51, 255, 102, 0.7);
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: 4px;
  font-weight: bold;
  text-align: center;
  border: 1px solid var(--fg-dim);
  padding: 14px 10px;
  margin: 0 0 6px;
}

.menu-sub {
  color: var(--fg-dim);
  font-size: 0.85rem;
  line-height: 1.5;
}

.field {
  display: block;
  margin: 14px 0 4px;
}

.field-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.field-hint {
  font-size: 0.72rem;
  color: var(--fg-dim);
  line-height: 1.4;
  margin: 4px 0 0;
}

/* Launch-control intro: menu toggle + the in-scene SKIP button. */
.intro-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--fg-dim);
  cursor: pointer;
}
.intro-toggle input {
  accent-color: var(--fg);
  width: 15px;
  height: 15px;
}
.intro-skip {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 45;
}

/* ---------- Launch-key board (WITNESS cold open) ---------- */
/* Two key stations (Commander + Deputy) either side of a LAUNCH ENABLE bridge. Each key
   sits ARMED in its lock and rotates 90° when turned. Pure phosphor-green, matching the
   terminal — the only red is the alarm state, exactly like the DEFCON ladder. */
.launch-keys {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 5vw, 48px);
  margin: 18px auto;
  padding: 16px 14px;
  max-width: 520px;
  border: 1px solid var(--fg-dim);
  background: rgba(2, 14, 4, 0.5);
  box-shadow: inset 0 0 24px rgba(51, 255, 102, 0.08);
}
.lk-station {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.lk-title {
  font-size: 0.66rem;
  letter-spacing: 2px;
  color: var(--fg-dim);
  white-space: nowrap;
}
.lk-lock {
  width: clamp(64px, 18vw, 100px);
}
.lk-key-svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 4px rgba(51, 255, 102, 0.35));
}
.lk-face {
  fill: rgba(51, 255, 102, 0.04);
  stroke: var(--fg-dim);
  stroke-width: 3;
}
.lk-slot {
  stroke: var(--fg-dim);
  stroke-width: 5;
  stroke-linecap: round;
}
.lk-key {
  transform-box: view-box;
  transform-origin: 50px 50px;
  transform: rotate(0deg);
  transition: transform 0.9s cubic-bezier(0.5, 1.55, 0.4, 1);
}
.lk-key-head {
  fill: none;
  stroke: var(--fg);
  stroke-width: 5;
}
.lk-key-shaft,
.lk-key-tooth {
  fill: var(--fg);
}
.lk-station[data-state="turned"] .lk-key {
  transform: rotate(90deg);
}
.lk-station[data-state="turned"] .lk-key-head {
  stroke: var(--fg-bright);
}
.lk-station[data-state="turned"] .lk-key-shaft,
.lk-station[data-state="turned"] .lk-key-tooth {
  fill: var(--fg-bright);
}
.lk-light {
  font-size: 0.6rem;
  letter-spacing: 2px;
  padding: 2px 8px;
  border: 1px solid var(--warn);
  color: var(--warn);
  animation: lkArmed 1.4s ease-in-out infinite;
}
.lk-station[data-state="turned"] .lk-light {
  border-color: var(--fg);
  color: var(--fg);
  box-shadow: 0 0 10px rgba(51, 255, 102, 0.5);
  animation: none;
}
.lk-station[data-state="refused"] .lk-light,
.lk-station[data-state="noaction"] .lk-light {
  border-color: var(--red);
  color: var(--red);
  animation: none;
}
@keyframes lkArmed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.lk-bridge {
  align-self: center;
  min-width: 56px;
  text-align: center;
  border-top: 1px dashed var(--fg-dim);
  padding-top: 6px;
}
.lk-bridge-label {
  font-size: 0.54rem;
  letter-spacing: 2px;
  color: var(--fg-dim);
}
.launch-keys.enabled .lk-bridge {
  border-top-color: var(--red);
}
.launch-keys.enabled .lk-bridge-label {
  color: var(--red);
  text-shadow: 0 0 10px rgba(255, 68, 68, 0.6);
}
@media (prefers-reduced-motion: reduce) {
  .lk-key { transition: none; }
  .lk-light { animation: none; }
}

/* ---------- In-game wiki: Field Briefings ---------- */
/* The status-bar indicator only appears when the feature is on (main.js sets [hidden]). */
.wiki-indicator {
  color: var(--echo);
  border-color: var(--echo);
}
.wiki-indicator:hover {
  background: var(--echo);
  color: #000;
}
/* Inline term markers inside terminal lines — a faint dotted underline + a small ⓘ. Subtle
   by design so they never pull focus from the story. Only rendered while wiki is on. */
.wiki-term {
  border-bottom: 1px dotted var(--echo);
  cursor: help;
  color: inherit;
}
.wiki-term::after {
  content: " \9432"; /* ⓘ */
  font-size: 0.8em;
  color: var(--echo);
  opacity: 0.8;
}
.wiki-term:hover {
  background: rgba(127, 224, 192, 0.14);
}

.wiki-panel {
  border: 1px solid var(--fg-dim);
  background: rgba(2, 12, 2, 0.94);
  box-shadow: 0 0 30px rgba(51, 255, 102, 0.15);
  padding: 20px 24px;
  max-width: 720px;
  width: 100%;
  max-height: 88%;
  display: flex;
  flex-direction: column;
}
.wiki-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--fg-dim);
  padding-bottom: 10px;
  margin-bottom: 8px;
}
.wiki-title {
  color: var(--fg-bright);
  text-shadow: 0 0 10px rgba(51, 255, 102, 0.6);
  letter-spacing: 4px;
  font-weight: bold;
}
.wiki-sub {
  color: var(--fg-dim);
  font-size: 0.78rem;
  line-height: 1.5;
  margin: 0 0 12px;
}
.wiki-body {
  overflow: auto;
  padding-right: 6px;
}
.wiki-cat-head {
  color: var(--echo);
  letter-spacing: 3px;
  font-size: 0.72rem;
  margin: 14px 0 6px;
  border-bottom: 1px dashed var(--fg-dim);
  padding-bottom: 4px;
}
.wiki-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-left: 2px solid var(--fg-dim);
  color: var(--fg);
  font-family: var(--font);
  padding: 8px 10px;
  margin: 4px 0;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.wiki-item:hover {
  background: rgba(51, 255, 102, 0.08);
  border-left-color: var(--fg);
}
.wiki-item-term {
  display: block;
  color: var(--fg-bright);
  letter-spacing: 1px;
  font-weight: bold;
}
.wiki-item-hook {
  display: block;
  color: var(--fg-dim);
  font-size: 0.78rem;
  line-height: 1.4;
  margin-top: 2px;
}
.wiki-back {
  margin-bottom: 10px;
}
.wiki-entry-term {
  color: var(--fg-bright);
  text-shadow: 0 0 10px rgba(51, 255, 102, 0.5);
  letter-spacing: 2px;
  margin: 0 0 4px;
  font-size: 1.3rem;
}
.wiki-entry-hook {
  color: var(--echo);
  font-style: italic;
  margin: 0 0 14px;
}
.wiki-field {
  margin: 0 0 14px;
}
.wiki-field-label {
  display: block;
  color: var(--amber);
  letter-spacing: 2px;
  font-size: 0.68rem;
  margin-bottom: 4px;
}
.wiki-field p {
  margin: 0;
  line-height: 1.6;
  color: var(--fg);
}
.wiki-links {
  margin: 0;
  padding-left: 18px;
}
.wiki-links li {
  margin: 4px 0;
}
.wiki-links a {
  color: var(--echo);
  text-decoration: underline;
}
.wiki-links a:hover {
  color: var(--fg-bright);
}

}

select:focus,
input:focus {
  outline: none;
  border-color: var(--fg);
  box-shadow: 0 0 8px rgba(51, 255, 102, 0.4);
}

.llm-fields {
  border-left: 2px solid var(--fg-dim);
  padding-left: 14px;
  margin-top: 8px;
}

/* ---------- Terminal ---------- */
/* A single serial scroll flow: text fills from the TOP; the cursor sits right after the
   last line (no bottom gap). Older content scrolls off the top as new lines append. */
.terminal {
  flex: 1;
  display: block;
  padding: 20px 24px;
  overflow-y: auto;
  z-index: 30;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
}

.terminal::-webkit-scrollbar {
  width: 8px;
}
.terminal::-webkit-scrollbar-thumb {
  background: var(--fg-dim);
}

.output {
  white-space: pre-wrap;
  line-height: 1.5;
  text-shadow: 0 0 4px rgba(51, 255, 102, 0.4);
}

.line {
  margin: 0 0 2px;
}

/* Machine responses read as an ALL-CAPS terminal, even long verbose berserk output.
   Visual only (text-transform) — the underlying text used for speech is untouched. */
.line.system,
.line.alert,
.line.ending,
.line.critical,
.line.echo {
  text-transform: uppercase;
}

.line.system {
  color: var(--fg-bright);
  text-shadow: 0 0 8px rgba(51, 255, 102, 0.6);
}

.line.narrator {
  color: var(--fg-dim);
  font-style: italic;
}

.line.user {
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255, 204, 51, 0.4);
}

.line.alert {
  color: var(--warn);
  text-shadow: 0 0 8px rgba(255, 157, 60, 0.5);
}

/* Critical red — reserved for the dramatic "ACCESS OVERRIDE" login beat. */
.line.critical {
  color: var(--red);
  text-shadow: 0 0 8px rgba(255, 68, 68, 0.6);
}

.line.ending {
  color: var(--fg-bright);
  font-weight: bold;
  letter-spacing: 1px;
}

/* Eerie "Rhodes echo" lines — a cool phosphor-green hue (reduced blue) that still reads as
   a signal bleeding through, without leaning on blue. */
.line.echo {
  color: var(--echo);
  text-shadow: 0 0 8px rgba(127, 224, 192, 0.5);
  font-style: italic;
  letter-spacing: 1px;
}

/* AI-generated response marker: a single character in the gutter so a builder can instantly
   tell model output from authored/scripted output. The glyph comes from data-ai-marker
   (configurable via SETTINGS.ui.aiMarkerChar). Hidden globally when .hide-ai-marker is set. */
.line.ai::before {
  content: attr(data-ai-marker);
  color: var(--fg-bright);
  opacity: 0.85;
  margin-right: 0.6ch;
  text-shadow: 0 0 6px rgba(51, 255, 102, 0.5);
}

.crt.hide-ai-marker .line.ai::before {
  content: none;
  margin-right: 0;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  background: var(--fg);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- Input + choices ---------- */
.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--fg-dim);
  margin-top: 8px;
}

/* Mode tag INSIDE the command box (e.g. "LIVE AI"), shown only in AI modes. */
.input-mode {
  font-size: 0.62rem;
  letter-spacing: 2px;
  font-weight: bold;
  color: #041004;
  background: var(--amber);
  padding: 2px 8px;
  border-radius: 2px;
  white-space: nowrap;
  box-shadow: 0 0 8px rgba(255, 204, 51, 0.4);
}

.prompt-caret {
  color: var(--fg-bright);
}

.text-input {
  border: none;
  background: transparent;
  flex: 1;
  padding: 4px 0;
  color: var(--amber);
}

.text-input:focus {
  outline: none;
  box-shadow: none;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
}

.choice-btn {
  text-align: left;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg-dim);
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.12s;
}

.choice-btn:hover,
.choice-btn:focus {
  background: var(--fg-dim);
  color: #000;
  outline: none;
}

.choice-btn .num {
  color: var(--amber);
  margin-right: 8px;
}

.choice-btn:hover .num {
  color: #000;
}

/* Suggestion chips (Live-AI guardrails) */
.suggest-hint {
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: var(--fg-dim);
  margin-bottom: 2px;
}

.choice-btn.suggest {
  border-style: dashed;
  opacity: 0.9;
}

.choice-btn.suggest:hover {
  opacity: 1;
}

.text-input::placeholder {
  color: var(--fg-dim);
  opacity: 0.7;
}

/* ---------- Telemetry panel ---------- */
.telemetry-panel {
  border: 1px solid var(--fg-dim);
  background: rgba(2, 12, 2, 0.95);
  max-width: 560px;
  width: 100%;
  padding: 18px;
}

.telemetry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--fg-dim);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.telemetry-body {
  white-space: pre-wrap;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--fg);
  max-height: 50vh;
  overflow-y: auto;
}

.telemetry-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- AI Admin Console (right-docked, pinnable) ---------- */
.admin-console {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 370px;
  max-width: 92vw;
  z-index: 55;
  display: flex;
  flex-direction: column;
  background: rgba(1, 8, 1, 0.975);
  border-left: 1px solid var(--fg-dim);
  box-shadow: -10px 0 34px rgba(0, 0, 0, 0.55);
  font-size: 0.78rem;
}

/* When pinned, reserve space so the panel doesn't cover the conversation/input. */
.crt.console-pinned .statusbar {
  padding-right: 386px;
}
.crt.console-pinned .terminal {
  padding-right: 394px;
}

.ac-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--fg-dim);
  letter-spacing: 2px;
}

.ac-title {
  color: var(--fg-bright);
  font-weight: bold;
  text-shadow: 0 0 8px rgba(51, 255, 102, 0.5);
}

.ac-head-actions {
  display: flex;
  gap: 6px;
}

.ac-pin-on {
  background: var(--fg-dim);
  color: #000;
}

.ac-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
}

.ac-body::-webkit-scrollbar {
  width: 8px;
}
.ac-body::-webkit-scrollbar-thumb {
  background: var(--fg-dim);
}

.ac-section {
  margin-bottom: 16px;
  border: 1px solid rgba(31, 156, 64, 0.4);
  padding: 8px 10px;
}

.ac-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 2px;
  color: var(--fg-dim);
  font-size: 0.68rem;
  margin-bottom: 6px;
}

.ac-turnmeta,
.ac-turncount {
  color: var(--amber);
  letter-spacing: 1px;
}

.ac-sublabel {
  font-size: 0.62rem;
  letter-spacing: 1px;
  color: var(--fg-dim);
  margin: 8px 0 2px;
}

.ac-pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #010601;
  border: 1px solid rgba(31, 156, 64, 0.35);
  color: var(--fg);
  padding: 8px;
  margin: 0;
  max-height: 26vh;
  overflow-y: auto;
  font-size: 0.72rem;
  line-height: 1.45;
}

.ac-pre.bad {
  border-color: var(--warn);
  color: var(--warn);
}

/* Turn log */
.ac-turnlog {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 24vh;
  overflow-y: auto;
}

.ac-turn {
  display: grid;
  grid-template-columns: 2.2ch 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 4px 6px;
  border: 1px solid rgba(31, 156, 64, 0.28);
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  text-align: left;
  font-family: var(--font);
  font-size: 0.72rem;
}

.ac-turn:hover {
  background: rgba(31, 156, 64, 0.18);
}

.ac-turn .ac-turn-n {
  color: var(--fg-dim);
}

.ac-turn .ac-turn-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-turn .ac-turn-d {
  color: var(--amber);
  letter-spacing: 0.5px;
}

.ac-turn.flag {
  border-color: var(--warn);
}
.ac-turn.flag .ac-turn-d {
  color: var(--warn);
}

/* Config fields */
.ac-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
  color: var(--fg);
}

.ac-field.col {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.ac-field span {
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: var(--fg-dim);
}

.ac-field em {
  color: var(--amber);
  font-style: normal;
}

.ac-field input[type="range"] {
  width: 100%;
  accent-color: var(--fg);
}

.ac-field input[type="checkbox"] {
  accent-color: var(--fg);
  width: 16px;
  height: 16px;
}

.ac-field input[type="number"],
.ac-field input[type="text"] {
  width: 100%;
}

.ac-note {
  font-size: 0.64rem;
  color: var(--fg-dim);
  line-height: 1.4;
  margin: 6px 0 0;
}

.ac-telemetry-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Chess panel (right-docked, optional) ---------- */
.chess-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  /* Responsive: comfortable on phones (near full width) up to Surface Hub-class displays. */
  width: clamp(320px, 34vw, 760px);
  max-width: 96vw;
  z-index: 56;
  display: flex;
  flex-direction: column;
  background: rgba(1, 8, 1, 0.975);
  border-left: 1px solid var(--fg-dim);
  box-shadow: -10px 0 34px rgba(0, 0, 0, 0.55);
  /* The panel is its own size container: every child below sizes off the PANEL width (cqw),
     not the viewport, so the board and text scale with the panel however it is docked. */
  container-type: inline-size;
  container-name: chesspanel;
  font-size: 0.95rem; /* base; children scale with cqw off this container */
  padding-bottom: 10px;
  overflow-y: auto;
}

.cp-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 12px;
  border-bottom: 1px solid var(--fg-dim);
  letter-spacing: 2px;
}
.cp-title {
  color: var(--fg-bright);
  font-weight: bold;
  text-shadow: 0 0 8px rgba(51, 255, 102, 0.5);
}
.cp-actions {
  display: flex;
  gap: 6px;
}
.cp-status {
  padding: 8px 12px;
  color: var(--amber);
  letter-spacing: 1px;
  min-height: 1.4em;
  font-size: clamp(0.7rem, 3.4cqw, 1.05rem);
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(255, 204, 51, 0.4); /* match the terminal's amber phosphor glow */
}

.cp-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  /* Scale with the PANEL width (container query units), never the viewport, so the board is
     a large legible square proportional to whatever width the chess panel is docked at. */
  width: min(92cqw, 96%);
  aspect-ratio: 1;
  margin: 6px auto;
  border: 1px solid var(--fg-dim);
  background: #010601;
  position: relative;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.8);
}
/* Scanlines across the board so it reads as a phosphor console render, not a modern app. */
.cp-board::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.33) 3px 4px);
  mix-blend-mode: multiply;
}
.cp-sq {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1rem, 9cqw, 4.5rem);
  line-height: 1;
  border: 1px solid rgba(31, 156, 64, 0.22);
  cursor: pointer;
  padding: 0;
  color: var(--fg);
  background: transparent;
  transition: background 0.1s;
  font-variant-emoji: text;
}
.cp-sq.light { background: rgba(51, 255, 102, 0.09); }
.cp-sq.dark { background: transparent; }
.cp-sq.white-piece { color: var(--fg-bright); text-shadow: 0 0 6px rgba(51, 255, 102, 0.7); }
.cp-sq.black-piece { color: var(--fg-dim); text-shadow: 0 0 5px rgba(51, 255, 102, 0.35); }
.cp-sq.sel { outline: 1px solid var(--amber); outline-offset: -1px; }
.cp-sq.target::after {
  content: '';
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: rgba(51, 255, 102, 0.5);
}
.cp-sq.capture { box-shadow: inset 0 0 0 2px rgba(51, 255, 102, 0.55); }
.cp-sq.last { background: rgba(51, 255, 102, 0.18); }
.cp-sq.check { box-shadow: inset 0 0 0 2px var(--warn); }

.cp-input-row {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
}
/* Match the shared button treatment: transparent, dim border, same font + fixed height.
   Uses #cp-move so it outranks the global input[type="text"] rule. */
#cp-move.cp-move {
  flex: 1;
  height: var(--btn-h);
  box-sizing: border-box;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg-dim);
  font-family: var(--font);
  font-size: var(--btn-font);
  letter-spacing: 1px;
  padding: 0 10px;
}
#cp-move.cp-move:focus {
  outline: none;
  border-color: var(--fg);
  box-shadow: 0 0 8px rgba(51, 255, 102, 0.4);
}
#cp-move.cp-move::placeholder {
  color: var(--fg-dim);
  letter-spacing: 1px;
}
.cp-log {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-content: flex-start;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
}
.cp-log-entry { font-size: clamp(0.6rem, 2.6cqw, 0.85rem); color: var(--fg-dim); }
.cp-log-entry.w { color: var(--fg); }
.cp-say {
  width: 100%;
  font-style: italic;
  color: var(--echo);
  font-size: clamp(0.6rem, 2.6cqw, 0.85rem);
  margin: 2px 0;
}
.cp-announce {
  width: 100%;
  color: var(--fg-dim);
  font-size: clamp(0.58rem, 2.5cqw, 0.82rem);
  margin: 2px 0;
}
.cp-say.long {
  color: var(--amber);
  line-height: 1.4;
}
/* Voice-input mic: no box — just the phosphor mic glyph, sized to the input-row height so it
   sits large next to the text field and MOVE button. Listening state recolors + pulses the
   glyph (there is no box to fill). */
#cp-mic,
#cp-mic:hover {
  border: none;
  background: transparent;
  padding: 0 4px;
  height: var(--btn-h);
  color: var(--fg);
}
#cp-mic:hover {
  color: var(--fg-bright);
}
#cp-mic.on {
  background: transparent;
  border: none;
  color: var(--warn);
}
.mic-ico {
  flex: none;
  width: calc(var(--btn-h) - 4px);
  height: calc(var(--btn-h) - 4px);
  vertical-align: middle;
}
#cp-mic.on .mic-ico {
  animation: micpulse 1s ease-in-out infinite;
}
@keyframes micpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (max-width: 600px) {
  html,
  body {
    font-size: 14px;
  }
  .menu-title {
    font-size: 1.1rem;
    letter-spacing: 2px;
  }
  .admin-console {
    width: 100vw;
    max-width: 100vw;
  }
  .chess-panel {
    width: 100vw;
    max-width: 100vw;
  }
  .crt.console-pinned .statusbar,
  .crt.console-pinned .terminal {
    padding-right: 16px;
  }
}

/* =====================================================================================
   NORAD big board — a swappable, full-screen war-room scene (see DESIGN-IDEA-NORAD-SCENE.md).
   Deliberately a DIFFERENT visual register from the green CRT terminal: cold blue-white /
   steel, amber warnings, red on launch, dominated by one wall-sized 14-segment readout.
   ===================================================================================== */

/* Authentic 14-segment "starburst" display look. DSEG is SIL Open Font License 1.1 (free
   for any use); loaded from a CDN with a monospace fallback so the scene still works
   offline (it just falls back to a blocky monospace). Recreates the film's style — it is
   NOT the film's proprietary font. See §4.1 of the NORAD design doc. */
@font-face {
  font-family: "DSEG14 Classic";
  src: url("https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG14-Classic/DSEG14Classic-Bold.woff2") format("woff2");
  font-weight: bold;
  font-display: swap;
}

.norad-scene {
  position: absolute;
  inset: 0;
  z-index: 60; /* above terminal + chess, below nothing else in the CRT */
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  /* Same phosphor-on-near-black register as the terminal (unified app style), laid out as a
     big board. The wall-sized 14-segment readout stays the distinctive element. */
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(51, 255, 102, 0.10), transparent 60%),
    radial-gradient(ellipse at center, #041204 0%, #010601 100%);
  color: var(--fg);
  font-family: var(--font);
  overflow: hidden;
  --norad-accent: var(--fg-bright); /* phosphor-green readout, matching the board/terminal */
  --norad-dim: #143a1f;             /* unlit segment ghost (dim green) */
  --norad-amber: var(--amber);
  --norad-red: var(--red);
}

/* Faint reference grid + scanlines so it reads as a projected big board, not an app. */
.norad-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(51, 255, 102, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 255, 102, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.6;
}
.norad-scene::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.22) 3px 4px);
  mix-blend-mode: multiply;
}

.norad-frame {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 3vh, 32px) clamp(16px, 4vw, 56px);
}

.norad-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--fg-dim);
  padding-bottom: 10px;
}
.norad-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.norad-org {
  font-size: clamp(1rem, 2.4vw, 1.8rem);
  font-weight: bold;
  letter-spacing: 6px;
  color: var(--fg-bright);
  text-shadow: 0 0 12px rgba(51, 255, 102, 0.6);
}
.norad-subtitle {
  font-size: clamp(0.7rem, 1.4vw, 0.95rem);
  letter-spacing: 4px;
  color: var(--amber);
}
.norad-head-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
/* NORAD DEFCON reuses the bedroom .defcon markup so the two boards read identically:
   same green value, same 5-rung red ladder. Keep it phosphor-green even inside the
   amber board so it matches the terminal exactly. */
#norad-defcon {
  align-items: center;
  color: var(--fg);
}
#norad-defcon .defcon-label {
  font-size: 0.7rem;
  color: var(--fg-dim);
}
/* The shared ghost button already carries the app style; no cold override needed. */
.norad-close {
  align-self: center;
}

.norad-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vh, 34px);
  text-align: center;
}

.norad-status-line {
  letter-spacing: 4px;
  font-size: clamp(0.65rem, 1.3vw, 0.9rem);
  color: var(--fg-dim);
  text-transform: uppercase;
}
.norad-status-bottom {
  color: var(--norad-amber);
  min-height: 1.2em;
}

/* Narration routed from the bedroom script (NORAD-POV lines). Hidden unless populated; when
   the board is only narrating (not cracking), it becomes the centerpiece. */
.norad-narration {
  display: none;
  flex-direction: column;
  gap: 8px;
  max-width: 88%;
  color: var(--fg-bright);
  font-size: clamp(0.95rem, 2.2vw, 1.7rem);
  line-height: 1.5;
  letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(51, 255, 102, 0.35);
}
.norad-scene.narrating .norad-narration {
  display: flex;
}
/* While purely narrating, de-emphasize the crack UI so the words carry the moment. */
.norad-scene.narrating .norad-readout,
.norad-scene.narrating .norad-meta,
.norad-scene.narrating .norad-status-bottom {
  opacity: 0.12;
}
.norad-narration-line {
  animation: noradNarrIn 0.5s ease-out 1;
}
@keyframes noradNarrIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* The wall-sized launch-code readout. */
.norad-readout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.4vw, 18px);
  padding: clamp(10px, 2.4vh, 26px) clamp(10px, 2vw, 30px);
  border: 1px solid var(--fg-dim);
  border-radius: 6px;
  background: rgba(2, 12, 2, 0.7);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7), 0 0 24px rgba(51, 255, 102, 0.08);
  max-width: 96%;
}
.norad-group {
  display: flex;
  gap: clamp(2px, 0.6vw, 8px);
}
.norad-gap {
  width: clamp(10px, 2vw, 34px);
}
.norad-cell {
  position: relative;
  font-family: "DSEG14 Classic", "Cascadia Code", "Consolas", ui-monospace, monospace;
  font-weight: bold;
  font-size: clamp(2rem, 8vw, 6.5rem);
  line-height: 1;
  width: clamp(1.1ch, 8vw, 1.25ch);
  text-align: center;
  color: var(--norad-accent);
  /* Rolling (unsolved) cells glow softly and flicker via animation. */
  text-shadow: 0 0 10px rgba(51, 255, 102, 0.55), 0 0 26px rgba(51, 255, 102, 0.25);
  transition: color 0.15s ease, text-shadow 0.15s ease;
}
/* Ghost "unlit segments" behind each cell so unsolved cells read as a real segment display.
   The filled-in shape (all segments lit) is ~ the block char; we fake it with a dim glyph. */
.norad-cell::before {
  content: "~";
  position: absolute;
  inset: 0;
  color: var(--norad-dim);
  opacity: 0.5;
  z-index: -1;
  font-family: inherit;
}
.norad-cell.rolling {
  animation: noradRoll 0.09s steps(1) infinite;
  color: #cfffe0;
}
.norad-cell.locked {
  color: #eaffee;
  text-shadow: 0 0 14px rgba(51, 255, 102, 0.9), 0 0 34px rgba(51, 255, 102, 0.45);
}
.norad-cell.flash {
  animation: noradLock 0.35s ease-out 1;
}
@keyframes noradRoll {
  0% { opacity: 0.82; }
  50% { opacity: 1; }
  100% { opacity: 0.9; }
}
@keyframes noradLock {
  0% { color: #ffffff; text-shadow: 0 0 40px rgba(255, 255, 255, 0.95); transform: scale(1.12); }
  100% { color: #eaffee; transform: scale(1); }
}

.norad-meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(16px, 4vw, 60px);
  width: min(92%, 900px);
}
.norad-meta-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.norad-meta-right {
  align-items: flex-end;
}
.norad-meta-label {
  font-size: 0.62rem;
  letter-spacing: 3px;
  color: var(--fg-dim);
}
.norad-meta-value {
  font-size: clamp(0.9rem, 1.8vw, 1.2rem);
  color: var(--fg-bright);
}
.norad-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.norad-clock-label {
  font-size: 0.62rem;
  letter-spacing: 3px;
  color: var(--norad-amber);
}
.norad-clock-value {
  font-family: "DSEG14 Classic", "Cascadia Code", "Consolas", ui-monospace, monospace;
  font-weight: bold;
  font-size: clamp(1.6rem, 4vw, 3rem);
  color: var(--norad-amber);
  text-shadow: 0 0 14px rgba(255, 191, 60, 0.5);
  letter-spacing: 2px;
}
/* As the clock nears zero, the scene tips into red alarm. The DEFCON block is intentionally
   excluded — it mirrors the bedroom, signalling threat via its red ladder + red number. */
.norad-scene.alarm .norad-clock-value {
  color: var(--norad-red);
  text-shadow: 0 0 16px rgba(255, 77, 77, 0.6);
  animation: noradAlarm 0.9s ease-in-out infinite;
}
.norad-scene.alarm .norad-status-bottom {
  color: var(--norad-red);
}
@keyframes noradAlarm {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Completed launch state. */
.norad-scene.complete .norad-status-bottom {
  color: var(--norad-red);
  font-weight: bold;
  letter-spacing: 6px;
}
.norad-scene.complete .norad-cell {
  color: var(--norad-red);
  text-shadow: 0 0 16px rgba(255, 77, 77, 0.7);
}
.norad-scene.complete .norad-cell::before { color: rgba(255, 77, 77, 0.25); }

/* Aborted state. */
.norad-scene.aborted .norad-status-bottom {
  color: #6ad38a;
  font-weight: bold;
  letter-spacing: 6px;
}
.norad-scene.aborted .norad-cell {
  color: #4f6b5a;
  text-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .norad-cell.rolling { animation: none; opacity: 0.85; }
  .norad-cell.flash { animation: none; }
  .norad-scene.alarm .norad-clock-value { animation: none; }
  .norad-scene::after { display: none; }
}

@media (max-width: 600px) {
  .norad-readout { gap: 3px; padding: 8px 6px; }
  .norad-meta { grid-template-columns: 1fr; gap: 10px; }
  .norad-meta-right { align-items: center; }
}

/* ---------- Room badge + viewer modes (#1, #3a) ---------- */
#room-badge {
  color: var(--amber);
  border-color: var(--amber);
  letter-spacing: 2px;
}
/* Muted audio button reads as de-emphasized. */
.ghost-btn.muted {
  color: var(--fg-dim);
  border-color: var(--fg-dim);
  opacity: 0.7;
}
#room-badge:hover {
  background: var(--amber);
  color: #000;
}
/* Endpoint unreachable — the ROOM can't be joined until /sync is reachable (telemetry cue). */
#room-badge.offline {
  color: var(--warn);
  border-color: var(--warn);
}
#room-badge.offline:hover {
  background: var(--warn);
  color: #000;
}

/* SPLIT: dock the NORAD board beside the terminal; the status bar stays on top, opaque. */
.crt.view-split .terminal {
  align-self: flex-start;
  width: 50%;
}
.crt.view-split .norad-scene {
  left: 50%;
  border-left: 2px solid var(--fg-dim);
}
.crt.view-split .statusbar {
  position: relative;
  z-index: 61;
  background: #041004;
}

/* MULTI: emphasize the room code so a producer can read it out for others to join. */
.crt.view-multi #room-badge {
  font-size: calc(var(--btn-font) + 0.2rem);
  font-weight: bold;
  box-shadow: 0 0 10px rgba(255, 204, 51, 0.4);
}

@media (max-width: 700px) {
  /* Stacking beats side-by-side on small screens. */
  .crt.view-split .terminal { width: 100%; align-self: stretch; height: 45%; }
  .crt.view-split .norad-scene { left: 0; top: 55%; border-left: none; border-top: 2px solid var(--fg-dim); }
}

/* ---------- Device pairing overlay (multi-device EASY sync) ---------- */
.pair-overlay {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Solid scrim (no backdrop-filter): blurring the continuously-animating CRT behind it kept
     the composited layer perpetually repainting, which made UI automation never see the
     panel's buttons as "stable". A near-opaque scrim gives the same focus without that. */
  background: rgba(1, 8, 3, 0.94);
  padding: 20px;
}
.pair-panel {
  width: min(560px, 94%);
  border: 1px solid var(--fg-dim);
  background: rgba(2, 12, 4, 0.98);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(0, 0, 0, 0.4);
  padding: 22px 24px;
  color: var(--fg);
}
.pair-title {
  margin: 0 0 8px;
  color: var(--fg-bright);
  letter-spacing: 3px;
  font-size: 1.1rem;
  text-shadow: 0 0 8px rgba(51, 255, 102, 0.5);
}
.pair-sub {
  margin: 0 0 16px;
  color: var(--fg-dim);
  line-height: 1.5;
  font-size: 0.85rem;
}
.pair-field {
  display: block;
  margin-bottom: 12px;
}
.pair-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 2px;
  color: var(--fg-dim);
  margin-bottom: 4px;
}
.pair-url {
  width: 100%;
  background: #010601;
  color: var(--amber);
  border: 1px solid var(--fg-dim);
  font-family: var(--font);
  font-size: 0.78rem;
  padding: 8px 10px;
  letter-spacing: 0.5px;
}
.pair-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 1px;
  margin-bottom: 18px;
}
.pair-meta strong {
  color: var(--fg-bright);
}
/* Fixed-width so the ticking countdown never reflows the panel (keeps buttons steady). */
#pair-countdown {
  display: inline-block;
  min-width: 4ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pair-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.pair-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  cursor: pointer;
}
.pair-toggle input {
  accent-color: var(--fg);
  width: 15px;
  height: 15px;
}
.pair-live-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px dashed var(--fg-dim);
}
.pair-live-status {
  font-size: 0.72rem;
  color: var(--amber);
  letter-spacing: 1px;
}

/* Second-screen join field on the start menu (join by short ROOM code). */
.join-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--fg-dim);
  flex-wrap: wrap;
}
.join-label {
  font-size: 0.68rem;
  letter-spacing: 2px;
  color: var(--fg-dim);
}
.join-input {
  flex: 1;
  min-width: 160px;
  background: #010601;
  color: var(--fg);
  border: 1px solid var(--fg-dim);
  font-family: var(--font);
  font-size: 0.8rem;
  letter-spacing: 1px;
  padding: 8px 10px;
  text-transform: uppercase;
}
.join-scene {
  flex: 0 0 auto;
  min-width: 0;
  text-transform: none;
}
