:root {
  --bg: #050806;
  --panel: #07130b;
  --green: #41ff72;
  --green-soft: #9cffb5;
  --amber: #ffd166;
  --red: #ff5c5c;
  --muted: #1fde45;
  --border: #1a6f31;
  --shadow: rgba(65, 255, 114, 0.22);
  --font-terminal: "Courier New", Courier, monospace;

  /* The frame around every screen: one phosphor green on black, like a 1984
     monitor. Only the console and the device zone take the room's era colours. */
  --hud-bg:     #020403;   /* page background base */
  --hud-panel:  #060a07;   /* the frame surface */
  --hud-border: #14522a;   /* lines and outlines */
  --hud-fg:     #9cffb5;   /* text */
  --hud-dim:    #4f9a66;   /* secondary text */
  --hud-accent: #41ff72;   /* lit phosphor */
  --hud-dot:    rgba(65, 255, 114, 0.06);  /* dot-grid */
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 42%, #06100a 0%, #030604 55%, #010201 100%);
  background-attachment: fixed;
  color: var(--hud-fg);
  font-family: var(--font-terminal);
}

button,
input,
textarea {
  font-family: inherit;
}

/* Buttons: thin outlines drawn on the screen */
button {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--green-soft);
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.1s ease;
}

button:hover { background: rgba(65, 255, 114, 0.1); }
button:active { background: rgba(65, 255, 114, 0.18); }
button:focus-visible { outline: 1px solid var(--hud-accent); outline-offset: 1px; }

/* Mini-map — circular compass HUD showing current room and exits */
.mini-map { width: 128px; height: 128px; flex-shrink: 0; }
/* Mini-map — longitudinal exits readout */
.side-card--map { padding-top: 2px; }
.mini-map { width: 100%; height: auto; min-height: 128px; font-family: var(--font-terminal); font-size: 0.74rem; }
.mm-head {
  display: flex; align-items: center; gap: 7px;
  color: var(--hud-accent); font-weight: 700; letter-spacing: 0.08em;
  margin-bottom: 7px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(127, 255, 176, 0.14);
  text-shadow: 0 0 7px rgba(127, 176, 196, 0.3);
}
.mm-here-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hud-accent); box-shadow: 0 0 6px var(--hud-accent); }
.mm-tag { margin-left: auto; color: var(--hud-dim); font-weight: 400; font-size: 0.66rem; letter-spacing: 0; }
.mm-exits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mm-exit { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 8px; padding: 2px 5px; border-radius: 4px; }
.mm-exit:hover { background: rgba(127, 255, 176, 0.05); }
.mm-dir { color: var(--hud-dim); }
.mm-dir i { font-style: normal; font-size: 0.62rem; margin-left: 3px; opacity: 0.75; }
.mm-dest { color: var(--hud-fg); letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-stat { color: var(--hud-dim); }
.mm-tier-legacy .mm-dest { color: #d9a441; }
.mm-tier-active .mm-dest { color: #6fe59a; }
.mm-tier-bonus  .mm-dest { color: #5cd6ff; }
.mm-locked .mm-dest { color: #ff8a8a; opacity: 0.7; }
.mm-locked .mm-stat { color: #ff5c5c; }
.mm-empty { color: var(--hud-dim); opacity: 0.6; list-style: none; }

/* Audio toggle — dimmed when muted */
#audioToggleBtn.audio-muted {
  color: var(--hud-dim);
  border-color: var(--hud-border);
}

.app-shell {
  position: relative;
  width: min(1320px, 95vw);
  height: calc(100vh - 36px);
  margin: 18px auto;
  padding: 20px;
  border-radius: 6px;
  background: #050906;
  box-shadow:
    inset 0 0 0 1px #123a1e,
    0 30px 70px rgba(0, 0, 0, 0.7);
}

/* The frame's column: the top bar above, the workspace below. */
.crt-panel {
  position: relative;
  height: 100%;
  border: none;
  padding: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--hud-border);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

/* Title: lit phosphor */
.brand {
  display: inline-block;
  padding: 6px 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 3.2vw, 2rem);
  letter-spacing: 0.18em;
  color: var(--green);
  text-shadow: 0 0 14px rgba(65, 255, 114, 0.4);
}

.top-bar p {
  color: var(--hud-dim);
  margin-bottom: 0;
}

.status-pill {
  white-space: nowrap;
  border: 1px solid var(--hud-border);
  color: var(--hud-accent);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(127, 176, 196, 0.07);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Difficulty — analog 3-position selector (F · M · D) with the active notch lit */
.diff-pill {
  position: relative;
  display: inline-flex;
  gap: 14px;
  align-items: flex-start;
  padding: 6px 14px 13px;
  border-radius: 6px;
  color: var(--hud-dim);
  border-color: var(--hud-border);
  background: transparent;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}
/* the groove running under the three labels */
.diff-pill::before {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 7px;
  height: 1px;
  background: var(--hud-border);
}
.diff-opt {
  position: relative;
  padding-bottom: 9px;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
/* each option's notch on the groove */
.diff-opt::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 0;
  width: 7px; height: 7px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #0c0f14;
  box-shadow: inset 0 0 0 1px var(--hud-dim);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
/* the active level lights up its label and turns its notch into a glowing needle */
.diff-pill[data-level="easy"]   { --diff-color: #41ff72; }
.diff-pill[data-level="medium"] { --diff-color: #ffd166; }
.diff-pill[data-level="hard"]   { --diff-color: #ff5c5c; }
.diff-pill[data-level="easy"]   .diff-opt[data-lvl="easy"],
.diff-pill[data-level="medium"] .diff-opt[data-lvl="medium"],
.diff-pill[data-level="hard"]   .diff-opt[data-lvl="hard"] {
  color: var(--diff-color);
  text-shadow: 0 0 6px var(--diff-color);
}
.diff-pill[data-level="easy"]   .diff-opt[data-lvl="easy"]::after,
.diff-pill[data-level="medium"] .diff-opt[data-lvl="medium"]::after,
.diff-pill[data-level="hard"]   .diff-opt[data-lvl="hard"]::after {
  background: var(--diff-color);
  box-shadow: 0 0 8px var(--diff-color);
}

/* Mission status — recessed LED readout (matches the timer) */
#missionStatus {
  color: #54ff8a;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 7px 12px;
  background-color: #050806;
  background-image: radial-gradient(rgba(0,0,0,0.5) 34%, transparent 37%);
  background-size: 2.5px 2.5px;
  box-shadow: inset 0 2px 7px rgba(0,0,0,.9), inset 0 0 2px rgba(84,255,138,.35), 0 1px 0 rgba(255,255,255,.05);
  letter-spacing: 0.12em;
  text-shadow: 0 0 7px currentColor, 0 0 2px currentColor;
}

/* Timer — recessed seven-segment LED readout */
.timer-pill {
  color: #54ff8a;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 7px 12px;
  background-color: #050806;
  background-image: radial-gradient(rgba(0,0,0,0.5) 34%, transparent 37%);
  background-size: 2.5px 2.5px;
  box-shadow: inset 0 2px 7px rgba(0,0,0,.9), inset 0 0 2px rgba(84,255,138,.35), 0 1px 0 rgba(255,255,255,.05);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.28em;
  padding-right: 6px;              /* letter-spacing adds a trailing gap */
  text-shadow: 0 0 7px currentColor, 0 0 2px currentColor;
}
.timer-pill.timer-warn           { color: #ffd166; box-shadow: inset 0 2px 7px rgba(0,0,0,.9), inset 0 0 2px rgba(255,209,102,.35), 0 1px 0 rgba(255,255,255,.05); }
.timer-pill.timer-critical       { color: #ff5c5c; box-shadow: inset 0 2px 7px rgba(0,0,0,.9), inset 0 0 2px rgba(255,92,92,.35), 0 1px 0 rgba(255,255,255,.05); animation: timer-blink 1s step-end infinite; }
@keyframes timer-blink           { 0%,100%{opacity:1} 50%{opacity:0.45} }

.workspace {
  position: relative;
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  transition: grid-template-columns 0.25s ease;
  padding: 16px;
  overflow: hidden;
  border-radius: 4px;
  /* the screen itself: black phosphor glass, lit from the middle */
  background: radial-gradient(ellipse at 50% 44%, #0b1710 0%, #070d09 62%, #04070a 100%);
  box-shadow: inset 0 0 0 1px #0f2e19, inset 0 0 60px rgba(0, 0, 0, 0.6);
}

/* scanlines + a soft edge vignette over the screen */
.workspace::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  border-radius: inherit;
  background:
    repeating-linear-gradient(to bottom,
      rgba(0, 0, 0, 0) 0 2px,
      rgba(0, 0, 0, 0.16) 2px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(0, 0, 0, 0.4) 100%);
}

/* The mission/log panel is part of the screen itself — no card, no border. */
.side-panel {
  border: none;
  background: transparent;
  border-right: 1px solid rgba(127, 255, 176, 0.1);
  min-width: 0;
  overflow: hidden;
}

/* Collapsed: the mission panel's column folds to 0 (kept in the grid, clipped by
   overflow) so the terminal takes the full tube. Using display:none would drop it
   from the grid and shove the terminal into the 0-width first column. */
.workspace.side-collapsed { grid-template-columns: 0 1fr; gap: 0; }
.workspace.side-collapsed > .side-panel { opacity: 0; pointer-events: none; }

.terminal-panel,
.editor-panel {
  border: 1px solid rgba(127, 255, 176, 0.14);
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

.terminal-panel:is(.room-basic,.room-basement,.room-lift,.room-temporary,.room-fortran,.room-asm6502,.room-java,.room-python,.room-r,.room-go,.room-nodejs,.room-git,.room-docker,.room-rest,.room-sql,.room-prolog,.room-haskell,.room-rust,.room-kotlin,.room-solidity,.room-lab,.room-logo,.room-core,.room-blackroom,.room-zig,.room-aws,.room-mongodb,.room-kubernetes,.room-graphql) {
  border-color: var(--room-border);
  background: var(--room-panel);
  color: var(--room-fg);
  box-shadow: 0 0 18px var(--room-glow), inset 0 0 28px rgba(0, 0, 0, 0.18);
}

:is(.terminal-panel, .screen-device).room-basic     { --room-panel:#00008b; --room-bg:#0000a8; --room-fg:#fff35a; --room-soft:#ffffff; --room-accent:#00ffff; --room-border:#006bff; --room-glow:rgba(255,243,90,.18); }
:is(.terminal-panel, .screen-device).room-basement  { --room-panel:#151006; --room-bg:#090604; --room-fg:#ffd166; --room-soft:#ffe0a0; --room-accent:#41ff72; --room-border:#8a5a16; --room-glow:rgba(255,209,102,.18); }
:is(.terminal-panel, .screen-device).room-lift      { --room-panel:#07110e; --room-bg:#030705; --room-fg:#41ff72; --room-soft:#9cffb5; --room-accent:#fff35a; --room-border:#1a6f31; --room-glow:rgba(65,255,114,.16); }
:is(.terminal-panel, .screen-device).room-temporary { --room-panel:#151006; --room-bg:#080706; --room-fg:#ffd166; --room-soft:#fff3bf; --room-accent:#41ff72; --room-border:#9b6f1a; --room-glow:rgba(255,209,102,.18); }
:is(.terminal-panel, .screen-device).room-fortran   { --room-panel:#151006; --room-bg:#090603; --room-fg:#ffbf3f; --room-soft:#ffe0a0; --room-accent:#ffffff; --room-border:#8a5a16; --room-glow:rgba(255,191,63,.18); }
:is(.terminal-panel, .screen-device).room-asm6502   { --room-panel:#070808; --room-bg:#010202; --room-fg:#b8ffcb; --room-soft:#ffffff; --room-accent:#ff5c5c; --room-border:#5c7f63; --room-glow:rgba(184,255,203,.16); }
:is(.terminal-panel, .screen-device).room-java      { --room-panel:#17110c; --room-bg:#090806; --room-fg:#ffb15c; --room-soft:#ffd8ad; --room-accent:#7fd8ff; --room-border:#b85f1d; --room-glow:rgba(255,128,48,.18); }
:is(.terminal-panel, .screen-device).room-python    { --room-panel:#07132a; --room-bg:#030917; --room-fg:#ffe873; --room-soft:#7fb5ff; --room-accent:#ffffff; --room-border:#2b5fba; --room-glow:rgba(255,232,115,.16); }
:is(.terminal-panel, .screen-device).room-r         { --room-panel:#071427; --room-bg:#020815; --room-fg:#9ecbff; --room-soft:#ffffff; --room-accent:#d8e6ff; --room-border:#4477aa; --room-glow:rgba(158,203,255,.18); }
:is(.terminal-panel, .screen-device).room-go        { --room-panel:#061c22; --room-bg:#021014; --room-fg:#69d7e8; --room-soft:#b8f7ff; --room-accent:#ffffff; --room-border:#00add8; --room-glow:rgba(0,173,216,.18); }
:is(.terminal-panel, .screen-device).room-nodejs    { --room-panel:#071406; --room-bg:#020802; --room-fg:#8cc84b; --room-soft:#d4ff9d; --room-accent:#ffffff; --room-border:#5fae2e; --room-glow:rgba(140,200,75,.18); }
:is(.terminal-panel, .screen-device).room-git       { --room-panel:#10140a; --room-bg:#080d05; --room-fg:#d7ff7d; --room-soft:#f2ffd8; --room-accent:#fff35a; --room-border:#7aa31b; --room-glow:rgba(215,255,125,.14); }
:is(.terminal-panel, .screen-device).room-docker    { --room-panel:#07131e; --room-bg:#03101b; --room-fg:#80d8ff; --room-soft:#d8f3ff; --room-accent:#4ecdc4; --room-border:#1b82a3; --room-glow:rgba(128,216,255,.16); }
:is(.terminal-panel, .screen-device).room-rest      { --room-panel:#0d1020; --room-bg:#060817; --room-fg:#c6a7ff; --room-soft:#eee5ff; --room-accent:#ff8bd1; --room-border:#7d5cff; --room-glow:rgba(198,167,255,.16); }
:is(.terminal-panel, .screen-device).room-sql       { --room-panel:#061719; --room-bg:#020b0c; --room-fg:#7dffd9; --room-soft:#d8fff6; --room-accent:#ffffff; --room-border:#1ba38b; --room-glow:rgba(125,255,217,.16); }
:is(.terminal-panel, .screen-device).room-prolog    { --room-panel:#111022; --room-bg:#060611; --room-fg:#d8c7ff; --room-soft:#ffffff; --room-accent:#fff35a; --room-border:#7e65d9; --room-glow:rgba(216,199,255,.18); }
:is(.terminal-panel, .screen-device).room-haskell   { --room-panel:#1b1028; --room-bg:#080512; --room-fg:#c9b7ff; --room-soft:#ffffff; --room-accent:#8fffe0; --room-border:#8f6bd9; --room-glow:rgba(143,107,217,.20); }
:is(.terminal-panel, .screen-device).room-rust      { --room-panel:#1a0e06; --room-bg:#090503; --room-fg:#e88b3a; --room-soft:#ffc48c; --room-accent:#ffffff; --room-border:#9b4a19; --room-glow:rgba(232,139,58,.18); }
:is(.terminal-panel, .screen-device).room-kotlin    { --room-panel:#160820; --room-bg:#09030f; --room-fg:#d77dff; --room-soft:#85e8ff; --room-accent:#ffffff; --room-border:#7f42d9; --room-glow:rgba(215,125,255,.18); }
:is(.terminal-panel, .screen-device).room-solidity  { --room-panel:#071126; --room-bg:#020713; --room-fg:#8ec7ff; --room-soft:#e0f0ff; --room-accent:#00ffe1; --room-border:#3c6dd9; --room-glow:rgba(142,199,255,.18); }
:is(.terminal-panel, .screen-device).room-zig       { --room-panel:#1c1304; --room-bg:#0b0701; --room-fg:#f7a41d; --room-soft:#ffd98a; --room-accent:#fff35a; --room-border:#a8740f; --room-glow:rgba(247,164,29,.18); }
:is(.terminal-panel, .screen-device).room-aws       { --room-panel:#16100a; --room-bg:#0a0703; --room-fg:#ff9900; --room-soft:#ffd9a3; --room-accent:#ffffff; --room-border:#cf7a16; --room-glow:rgba(255,153,0,.16); }
:is(.terminal-panel, .screen-device).room-mongodb   { --room-panel:#0a160c; --room-bg:#040b06; --room-fg:#4db33d; --room-soft:#b8f0a8; --room-accent:#a0ec7a; --room-border:#3a7a2e; --room-glow:rgba(77,179,61,.16); }
:is(.terminal-panel, .screen-device).room-kubernetes{ --room-panel:#0a1020; --room-bg:#040814; --room-fg:#5a9bff; --room-soft:#cfe0ff; --room-accent:#8fb8ff; --room-border:#2b5bb5; --room-glow:rgba(90,155,255,.18); }
:is(.terminal-panel, .screen-device).room-graphql   { --room-panel:#1a0a18; --room-bg:#0c0410; --room-fg:#e535ab; --room-soft:#ffbde8; --room-accent:#ff7fd4; --room-border:#a01f78; --room-glow:rgba(229,53,171,.18); }
:is(.terminal-panel, .screen-device).room-lab       { --room-panel:#0a0d0a; --room-bg:#030503; --room-fg:#c8ffd0; --room-soft:#ffffff; --room-accent:#a8ffbf; --room-border:#6f8f73; --room-glow:rgba(200,255,208,.14); }
:is(.terminal-panel, .screen-device).room-logo      { --room-panel:#061822; --room-bg:#020a12; --room-fg:#41ff72; --room-soft:#fff35a; --room-accent:#00d7ff; --room-border:#1ba6d9; --room-glow:rgba(0,215,255,.18); }
:is(.terminal-panel, .screen-device).room-core      { --room-panel:#160404; --room-bg:#050101; --room-fg:#ff5c5c; --room-soft:#ffd7d7; --room-accent:#ffffff; --room-border:#b21f1f; --room-glow:rgba(255,92,92,.22); }
:is(.terminal-panel, .screen-device).room-blackroom { --room-panel:#050505; --room-bg:#000000; --room-fg:#d7d7d7; --room-soft:#ffffff; --room-accent:#9b9bff; --room-border:#333333; --room-glow:rgba(255,255,255,.12); }
:is(.terminal-panel, .screen-device).room-redis     { --room-panel:#170808; --room-bg:#080202; --room-fg:#ff6b6b; --room-soft:#ffd6d6; --room-accent:#ffffff; --room-border:#b32626; --room-glow:rgba(255,78,78,.18); }

.terminal-panel.room-redis {
  border-color: var(--room-border);
  background: var(--room-panel);
  color: var(--room-fg);
  box-shadow: 0 0 18px var(--room-glow), inset 0 0 28px rgba(0, 0, 0, 0.18);
}

.terminal-panel.room-redis :is(.terminal-output,.terminal-input-row) {
  background: var(--room-bg);
}

.terminal-panel.room-redis .terminal-output {
  color: var(--room-fg);
  text-shadow: none;
  scrollbar-color: var(--room-fg) var(--room-panel);
}

.terminal-panel.room-redis .terminal-input-row {
  border-top-color: var(--room-border);
}

.terminal-panel.room-redis :is(.line-command,.prompt) {
  color: var(--room-soft);
}

.terminal-panel.room-redis .line-system {
  color: var(--room-fg);
}

.terminal-panel.room-redis .line-success {
  color: var(--room-accent);
}

.terminal-panel.room-redis #terminalInput {
  color: var(--room-fg);
  caret-color: var(--room-fg);
}

.terminal-panel:is(.room-basic,.room-basement,.room-lift,.room-temporary,.room-fortran,.room-asm6502,.room-java,.room-python,.room-r,.room-go,.room-nodejs,.room-git,.room-docker,.room-rest,.room-sql,.room-prolog,.room-haskell,.room-rust,.room-kotlin,.room-solidity,.room-lab,.room-logo,.room-core,.room-blackroom,.room-zig,.room-aws,.room-mongodb,.room-kubernetes,.room-graphql) :is(.terminal-output,.terminal-input-row) {
  background: var(--room-bg);
}

.terminal-panel:is(.room-basic,.room-basement,.room-lift,.room-temporary,.room-fortran,.room-asm6502,.room-java,.room-python,.room-r,.room-go,.room-nodejs,.room-git,.room-docker,.room-rest,.room-sql,.room-prolog,.room-haskell,.room-rust,.room-kotlin,.room-solidity,.room-lab,.room-logo,.room-core,.room-blackroom,.room-zig,.room-aws,.room-mongodb,.room-kubernetes,.room-graphql) .terminal-output {
  color: var(--room-fg);
  text-shadow: none;
  scrollbar-color: var(--room-fg) var(--room-panel);
}

.terminal-panel:is(.room-basic,.room-basement,.room-lift,.room-temporary,.room-fortran,.room-asm6502,.room-java,.room-python,.room-r,.room-go,.room-nodejs,.room-git,.room-docker,.room-rest,.room-sql,.room-prolog,.room-haskell,.room-rust,.room-kotlin,.room-solidity,.room-lab,.room-logo,.room-core,.room-blackroom,.room-zig,.room-aws,.room-mongodb,.room-kubernetes,.room-graphql) .terminal-input-row {
  border-top-color: var(--room-border);
}

.terminal-panel:is(.room-basic,.room-basement,.room-lift,.room-temporary,.room-fortran,.room-asm6502,.room-java,.room-python,.room-r,.room-go,.room-nodejs,.room-git,.room-docker,.room-rest,.room-sql,.room-prolog,.room-haskell,.room-rust,.room-kotlin,.room-solidity,.room-lab,.room-logo,.room-core,.room-blackroom,.room-zig,.room-aws,.room-mongodb,.room-kubernetes,.room-graphql) :is(.line-command,.prompt) {
  color: var(--room-soft);
}

.terminal-panel:is(.room-basic,.room-basement,.room-lift,.room-temporary,.room-fortran,.room-asm6502,.room-java,.room-python,.room-r,.room-go,.room-nodejs,.room-git,.room-docker,.room-rest,.room-sql,.room-prolog,.room-haskell,.room-rust,.room-kotlin,.room-solidity,.room-lab,.room-logo,.room-core,.room-blackroom,.room-zig,.room-aws,.room-mongodb,.room-kubernetes,.room-graphql) .line-system {
  color: var(--room-fg);
}

.terminal-panel:is(.room-basic,.room-basement,.room-lift,.room-temporary,.room-fortran,.room-asm6502,.room-java,.room-python,.room-r,.room-go,.room-nodejs,.room-git,.room-docker,.room-rest,.room-sql,.room-prolog,.room-haskell,.room-rust,.room-kotlin,.room-solidity,.room-lab,.room-logo,.room-core,.room-blackroom,.room-zig,.room-aws,.room-mongodb,.room-kubernetes,.room-graphql) .line-success {
  color: var(--room-accent);
}

.terminal-panel:is(.room-basic,.room-basement,.room-lift,.room-temporary,.room-fortran,.room-asm6502,.room-java,.room-python,.room-r,.room-go,.room-nodejs,.room-git,.room-docker,.room-rest,.room-sql,.room-prolog,.room-haskell,.room-rust,.room-kotlin,.room-solidity,.room-lab,.room-logo,.room-core,.room-blackroom,.room-zig,.room-aws,.room-mongodb,.room-kubernetes,.room-graphql) #terminalInput {
  color: var(--room-fg);
  caret-color: var(--room-fg);
}

.side-panel {
  min-height: 0;
  overflow: hidden;
}

.side-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 14px;
  scrollbar-color: var(--hud-border) transparent;
  color: var(--hud-fg);
}

.side-card {
  border-bottom: 1px dashed var(--hud-border);
  margin-bottom: 14px;
  padding-bottom: 14px;
  line-height: 1.45;
}

.side-card:last-child {
  border-bottom: 0;
}

.side-card h2,
.side-card h3 {
  color: var(--hud-accent);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.side-card h2 { font-size: 0.95rem; }

/* Room name tinted by its stack layer (app · datos · infra) */
#roomCardName[data-layer="ARIA"] { color: #6fe59a; text-shadow: 0 0 9px rgba(111, 229, 154, 0.4); }
#roomCardName[data-layer="ZERO"] { color: #5cd6ff; text-shadow: 0 0 9px rgba(92, 214, 255, 0.4); }
#roomCardName[data-layer="84"]   { color: #ffd166; text-shadow: 0 0 9px rgba(255, 209, 102, 0.4); }
.room-card .room-layer {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: middle;
  padding: 2px 7px;
  margin-left: 6px;
  border-radius: 999px;
  color: currentColor;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 14%, transparent);
  text-shadow: none;
}

/* Contextual room-help card (bucket A sectors) */
.room-card .room-step {
  margin: 4px 0 10px;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--hud-accent);
  background: rgba(127, 176, 196, 0.08);
  border-left: 3px solid var(--hud-accent);
  font-size: 0.78rem;
  line-height: 1.35;
}
.room-card .room-teaches { margin: 2px 0 10px; opacity: 0.9; }
.room-card .room-teaches::before { content: "🎯 "; opacity: 0.95; }
.room-card .room-ico {
  display: inline-block;
  width: 1.1em;
  margin-right: 5px;
  font-size: 0.82rem;
  filter: grayscale(0.15);
  vertical-align: -1px;
}
.room-card .room-sub { margin-bottom: 9px; }
.room-card .room-sub-h {
  display: block;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hud-dim);
  margin-bottom: 3px;
}
.room-card .room-tools {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.room-card .room-tools li {
  font-size: 0.72rem;
  color: var(--hud-fg);
  padding: 2px 8px;
  border: 1px solid var(--hud-border);
  border-radius: 4px;
  background: transparent;
}
.room-card .room-exam, .room-card .room-hint { margin: 0; opacity: 0.85; }
[hidden] { display: none !important; }

/* phosphor bloom on the HUD chrome so it reads as light emitted by the tube */

.side-card code {
  color: var(--amber);
}

.command-list,
#inventoryList {
  padding-left: 20px;
}

.map-view {
  border: 1px solid rgba(65, 255, 114, 0.3);
  border-radius: 8px;
  padding: 10px;
  color: var(--green-soft);
  background: rgba(65, 255, 114, 0.04);
  overflow-x: auto;
}

.quest-log {
  padding-left: 22px;
  color: var(--green-soft);
}

.quest-log li {
  margin-bottom: 8px;
}

.main-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
}

.terminal-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.terminal-visual-display {
  flex: 0 0 min(44vh, 360px);
  min-height: 210px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--room-border, var(--border));
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), transparent 12%),
    var(--room-bg, rgba(65, 255, 114, 0.04));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.terminal-room-visual {
  flex: 1 1 auto;
  min-height: 0;
}

.terminal-room-visual > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.terminal-map-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 18px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(127, 176, 196, 0.08), transparent 55%),
    rgba(6, 8, 11, 0.93);
  backdrop-filter: blur(3px);
}

.terminal-map-overlay.hidden {
  display: none;
}

.terminal-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.terminal-map-floor {
  color: var(--hud-accent);
  font: 700 15px/1.2 "Courier New", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(127, 176, 196, 0.35);
}

.terminal-map-close {
  width: 38px;
  height: 38px;
  font: 700 18px/1 "Courier New", monospace;
}
.terminal-map-close:focus-visible { outline: 1px solid var(--hud-accent); }

.terminal-map-canvas {
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px solid var(--hud-border);
  border-radius: 10px;
  background:
    linear-gradient(rgba(127, 176, 196, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 176, 196, 0.04) 1px, transparent 1px),
    #0b0e13;
  background-size: 28px 28px;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.6);
}


.terminal-visual-display.visual-empty::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  min-height: 186px;
  border: 1px dashed color-mix(in srgb, var(--room-fg, var(--green)) 32%, transparent);
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 24px 24px;
}

.terminal-panel.room-basic.basic-emulator .terminal-visual-display {
  flex: 1 1 auto;
  min-height: 0;
  border-bottom: 0;
}

.terminal-panel.room-basic.basic-emulator .terminal-output {
  display: none;
}

.terminal-panel.room-basic.basic-emulator .terminal-input-row {
  border-top-color: #fff35a;
  background: #000080;
}

.terminal-panel.room-logo.logo-emulator .terminal-visual-display {
  flex: 1 1 auto;
  min-height: 0;
  border-bottom: 0;
}

.terminal-panel.room-logo.logo-emulator .terminal-output {
  display: none;
}

.terminal-panel.room-logo.logo-emulator .terminal-input-row {
  border-top-color: #00d7ff;
  background: #020a12;
}

.terminal-panel.room-lift .terminal-visual-display {
  flex: 0 0 min(50vh, 400px);
  min-height: 260px;
}

.terminal-panel.room-basement .terminal-visual-display {
  flex: 0 0 min(44vh, 360px);
  min-height: 230px;
}

.terminal-panel.room-redis.redis-emulator .terminal-visual-display {
  flex: 1 1 auto;
  min-height: 0;
  border-bottom: 0;
}

.terminal-panel.room-redis.redis-emulator .terminal-output {
  display: none;
}

.terminal-panel.room-redis.redis-emulator .terminal-input-row {
  border-top-color: #ff4d5a;
  background: #110406;
}

.terminal-panel.room-sql.sql-emulator .terminal-visual-display {
  flex: 1 1 auto;
  min-height: 0;
  border-bottom: 0;
}

.terminal-panel.room-sql.sql-emulator .terminal-output {
  display: none;
}

.terminal-panel.room-sql.sql-emulator .terminal-input-row {
  border-top-color: #1ba38b;
  background: #020b0c;
}

.terminal-panel.room-asm6502.asm6502-emulator .terminal-visual-display,
.terminal-panel.room-r.r-emulator .terminal-visual-display,
.terminal-panel.room-core.core-emulator .terminal-visual-display {
  flex: 1 1 auto;
  min-height: 0;
  border-bottom: 0;
}

.terminal-panel.room-asm6502.asm6502-emulator .terminal-output,
.terminal-panel.room-r.r-emulator .terminal-output,
.terminal-panel.room-core.core-emulator .terminal-output {
  display: none;
}

.terminal-panel.room-asm6502.asm6502-emulator .terminal-input-row {
  border-top-color: #fff35a;
  background: #080806;
}

.terminal-panel.room-r.r-emulator .terminal-input-row {
  border-top-color: #7aa7ff;
  background: #050b16;
}

.terminal-panel.room-core.core-emulator .terminal-input-row {
  border-top-color: #ff355e;
  background: #130006;
}

.terminal-output {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.45;
  scrollbar-color: var(--green) rgba(65, 255, 114, 0.08);
}

.terminal-line {
  margin-bottom: 4px;
}

.line-command {
  color: var(--green-soft);
}

.line-error {
  color: var(--red);
}

.line-success {
  color: var(--amber);
}

.line-system {
  color: var(--muted);
}

.terminal-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  background: rgba(65, 255, 114, 0.04);
}

.prompt {
  white-space: nowrap;
  color: var(--green-soft);
}

#terminalInput {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--green);
  font-size: 1rem;
  caret-color: var(--green);
}

.terminal-panel.mode-explore .terminal-input-row {
  background: rgba(255, 190, 80, 0.08);
  border-top-color: rgba(255, 190, 80, 0.45);
}

.terminal-panel.mode-explore :is(.prompt, #terminalInput) {
  color: #ffbf5a;
  caret-color: #ffbf5a;
}

.editor-panel {
  overflow: hidden;
  border-color: var(--green);
  box-shadow:
    0 0 14px rgba(65, 255, 114, 0.12),
    inset 0 0 22px rgba(65, 255, 114, 0.04);
}

.editor-panel.editor-focus {
  animation: editor-focus-pulse 520ms ease-out;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  background: rgba(65, 255, 114, 0.06);
}

.editor-header strong {
  color: var(--amber);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes editor-focus-pulse {
  0% {
    box-shadow:
      0 0 0 rgba(255, 209, 102, 0),
      inset 0 0 22px rgba(65, 255, 114, 0.04);
  }
  45% {
    box-shadow:
      0 0 26px rgba(255, 209, 102, 0.34),
      inset 0 0 22px rgba(65, 255, 114, 0.04);
  }
  100% {
    box-shadow:
      0 0 14px rgba(65, 255, 114, 0.12),
      inset 0 0 22px rgba(65, 255, 114, 0.04);
  }
}

#codeEditor {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: none;
  outline: none;
  padding: 14px;
  background: #020502;
  color: var(--green-soft);
  font-size: 0.96rem;
  line-height: 1.45;
}

.hidden {
  display: none;
}

/* ── Login overlay ──────────────────────────────────────────────────────── */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-overlay.hidden { display: none; }

.login-box {
  width: min(680px, 100%);
  padding: 32px 36px;
  font-family: var(--font-terminal);
}

.login-banner {
  font-size: clamp(0.7rem, 1.6vw, 0.88rem);
  color: var(--green);
  margin: 0 0 4px;
  line-height: 1.5;
  white-space: pre;
}

.login-lastlogin {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 28px;
}

.login-terminal {
  font-size: clamp(0.88rem, 2vw, 1rem);
  line-height: 1.9;
  color: var(--green);
}

.login-line { display: flex; align-items: baseline; gap: 0; }
.login-prompt { color: var(--green-soft); white-space: nowrap; }
.login-response { color: var(--red); margin-left: 0; }
.login-success  { color: var(--amber); }

#loginInput {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* blinking cursor on the active login line */
.login-cursor::after {
  content: '█';
  animation: lcblink .8s step-end infinite;
  color: var(--green);
}
@keyframes lcblink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ── Intro screen ───────────────────────────────────────────────────────── */

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(65,255,114,0.06) 0%, transparent 60%),
    #000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 32px;
}

.intro-overlay.hidden { display: none; }

.intro-box {
  width: min(920px, 100%);
  display: flex;
  flex-direction: column;
  gap: 28px;
  font-family: var(--font-terminal);
}

/* Logo — imagen centrada arriba */
.intro-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.intro-logo-img {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
}

.intro-subtitle {
  font-size: clamp(0.85rem, 2vw, 1.1rem);
  color: var(--green-soft);
  letter-spacing: 0.35em;
  margin: 6px 0 0;
  opacity: 0.8;
}

/* Descripción + créditos — full width */
.intro-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.intro-desc {
  font-size: clamp(0.82rem, 1.8vw, 0.95rem);
  color: var(--green-soft);
  line-height: 1.75;
  margin: 0;
}

.intro-desc em {
  color: var(--red);
  font-style: normal;
}

.intro-credits {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.credits-line {
  font-size: 0.80rem;
  color: var(--green-soft);
  display: flex;
  gap: 12px;
  line-height: 1.6;
}

.credits-sep {
  display: block;
  color: var(--green-soft);
  opacity: 0.55;
  font-size: 0.74rem;
}

.credits-key {
  min-width: 130px;
  opacity: 0.75;
}

.credits-val {
  color: var(--green);
  opacity: 1;
}

/* Setup section */
.intro-setup {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-top: 1px solid #1a3a1a;
  padding-top: 22px;
}

.intro-alias-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.intro-alias-label {
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
  color: var(--green-soft);
  white-space: nowrap;
}

.intro-alias-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid #2a5a2a;
  color: var(--green);
  font-family: var(--font-terminal);
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
  outline: none;
  padding: 3px 8px;
  width: min(200px, 100%);
  caret-color: var(--green);
  transition: border-color 0.2s;
}

.intro-alias-input:focus {
  border-bottom-color: var(--green);
}

.intro-alias-input::placeholder {
  color: var(--muted);
  opacity: 0.45;
  font-size: 0.88em;
}

.intro-alias-hint {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.45;
}

.intro-diff-label {
  font-size: 0.84rem;
  color: var(--green-soft);
  margin: 0;
  opacity: 1;
}

.intro-diff-opts {
  /* reuse .diff-options grid but override any margin/padding from diff-box */
  margin: 0 !important;
}

/* ── Difficulty selection overlay ───────────────────────────────────────── */

.diff-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background:
    radial-gradient(circle at center, rgba(65,255,114,0.07), transparent 60%),
    linear-gradient(180deg, #020302, #040a05);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.diff-overlay.hidden {
  display: none;
}

.diff-box {
  width: min(860px, 100%);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 32px 36px;
  background: linear-gradient(180deg, rgba(7,19,11,0.98), rgba(2,6,3,0.99));
  box-shadow: 0 0 40px var(--shadow), inset 0 0 60px rgba(65,255,114,0.04);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.diff-logo {
  font-size: clamp(0.28rem, 1vw, 0.54rem);
  line-height: 1.15;
  color: var(--green);
  text-shadow: 0 0 8px var(--shadow);
  margin: 0 0 6px;
  overflow: hidden;
}

.diff-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  letter-spacing: 0.25em;
  color: var(--green);
  text-shadow: 0 0 14px var(--shadow);
  margin: 0 0 14px;
  text-align: center;
}

.diff-intro {
  color: var(--green-soft);
  line-height: 1.6;
  text-align: center;
  margin: 0;
  font-size: 0.95rem;
}

.diff-intro span {
  color: var(--amber);
}

.diff-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.diff-btn {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(65,255,114,0.04);
  color: var(--green);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.diff-btn:hover {
  background: rgba(65,255,114,0.10);
  border-color: var(--green);
  box-shadow: 0 0 16px rgba(65,255,114,0.15);
}

.diff-btn[data-level="easy"]:hover    { border-color: var(--green); }
.diff-btn[data-level="medium"]:hover  { border-color: var(--amber); }
.diff-btn[data-level="hard"]:hover    { border-color: var(--red); }

.diff-label {
  font-size: 1.15rem;
  font-weight: bold;
  letter-spacing: 0.1em;
}

.diff-btn[data-level="easy"]   .diff-label { color: var(--green); }
.diff-btn[data-level="medium"] .diff-label { color: var(--amber); }
.diff-btn[data-level="hard"]   .diff-label { color: var(--red); }

.diff-desc {
  font-size: 0.87rem;
  color: var(--green-soft);
  line-height: 1.55;
}

.diff-tag {
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px dashed rgba(65,255,114,0.2);
  padding-top: 8px;
  margin-top: 2px;
}

/* ── CodeMirror overrides (dracula theme) ───────────────────────────────── */

.CodeMirror {
  height: auto;
  min-height: 260px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.96rem;
  line-height: 1.5;
  border: none;
}

.CodeMirror-scroll { min-height: 260px; }

/* ── PIN Pad ──────────────────────────────────────────────────────────────── */

.pin-pad-card {
  position: relative;
  border-color: var(--amber);
  background: #0d100a;
  text-align: center;
}

.pin-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 1px solid #7a5c00;
  border-radius: 4px;
  background: #070d07;
  color: var(--amber);
  font: 700 0.75rem/1 var(--font-terminal);
  cursor: pointer;
}

.pin-close:hover,
.pin-close:focus-visible {
  border-color: var(--amber);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.3);
  outline: none;
}

.pin-pad-title {
  color: var(--amber);
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  margin: 0 0 4px;
}

.pin-host-label {
  color: var(--muted);
  font-size: 0.68rem;
  margin-bottom: 12px;
}

.pin-display {
  font-size: 1.7rem;
  letter-spacing: 0.1em;
  color: var(--amber);
  background: #070d07;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 16px;
  margin: 0 auto 10px;
  display: inline-block;
  min-width: 140px;
  font-family: var(--font-terminal);
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.7);
}

.pin-hint {
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.pin-btn {
  background: #0a130a;
  border: 1px solid var(--border);
  color: var(--green);
  font-family: var(--font-terminal);
  font-size: 1rem;
  padding: 8px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
}

.pin-btn:hover {
  background: #142914;
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(65, 255, 114, 0.25);
}

.pin-btn:active {
  background: #1e3d1e;
  transform: scale(0.96);
}

.pin-enter {
  color: var(--amber);
  border-color: #7a5c00;
}
.pin-enter:hover {
  border-color: var(--amber);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.3);
}

.pin-back {
  color: var(--red);
  border-color: #6a1a1a;
}
.pin-back:hover {
  border-color: var(--red);
  box-shadow: 0 0 8px rgba(255, 92, 92, 0.25);
}

.pin-status {
  font-size: 0.75rem;
  min-height: 1.2em;
  font-family: var(--font-terminal);
  letter-spacing: 0.08em;
}

.pin-status-ok     { color: var(--green); text-shadow: 0 0 8px rgba(65,255,114,0.6); }
.pin-status-denied { color: var(--red);   text-shadow: 0 0 8px rgba(255,92,92,0.6); }

@keyframes pin-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-8px); }
  40%     { transform: translateX(7px); }
  60%     { transform: translateX(-5px); }
  80%     { transform: translateX(4px); }
}

.pin-shake { animation: pin-shake 0.45s ease; }

@media (max-width: 940px) {
  .app-shell {
    height: auto;
    min-height: calc(100vh - 32px);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .side-panel {
    max-height: 340px;
  }

  .terminal-panel {
    min-height: 460px;
  }

  .terminal-visual-display {
    flex-basis: 260px;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .mini-map {
    width: 100%;
    height: auto;
  }

  .status-pill {
    white-space: normal;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100vw, 100%);
    margin: 0;
  }

  .crt-panel {
    border-radius: 0;
    padding: 12px;
  }

  .top-actions {
    gap: 8px;
  }

  .terminal-input-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .prompt {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* ── Blackout overlay ─────────────────────────────────────────────────────── */
#blackoutOverlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
}

#blackoutOverlay.blackout-active {
  animation: blackout-seq var(--blackout-dur, 5s) ease forwards;
}

@keyframes blackout-seq {
  /* fade to black */
  0%   { opacity: 0; }
  6%   { opacity: 1; }
  /* hold dark */
  70%  { opacity: 1; }
  /* first flicker */
  72%  { opacity: 0.1; }
  74%  { opacity: 1; }
  /* second flicker */
  78%  { opacity: 0.05; }
  81%  { opacity: 1; }
  /* third flicker — longer */
  85%  { opacity: 0.15; }
  90%  { opacity: 1; }
  /* fade back in fully */
  100% { opacity: 0; }
}

/* ── CRT power-off effect ─────────────────────────────────────────────────── */
/*
   Secuencia clásica de tubo catódico:
   1. Flash de fósforo verde (descarga residual)
   2. Colapso vertical rápido → línea horizontal brillante
   3. Línea se contrae horizontalmente → punto
   4. Punto se desvanece
*/
#blackoutOverlay.crt-off {
  background: #00cc00;   /* fósforo P31 — verde puro, sin azul */
  transform-origin: center center;
  animation: crt-off 1.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes crt-off {
  /* reposo — overlay transparente sobre la pantalla */
  0%   { opacity: 0;   transform: scaleY(1)      scaleX(1);    filter: brightness(1)   blur(0px);  }
  /* flash de fósforo */
  10%  { opacity: 0.9; transform: scaleY(1)      scaleX(1);    filter: brightness(4.5) blur(0px);  }
  /* colapso vertical instantáneo → línea */
  21%  { opacity: 1;   transform: scaleY(0.012)  scaleX(1);    filter: brightness(6)   blur(1px);  }
  /* línea brillante se mantiene */
  58%  { opacity: 1;   transform: scaleY(0.012)  scaleX(1);    filter: brightness(3.5) blur(2px);  }
  /* contracción horizontal → punto */
  80%  { opacity: 1;   transform: scaleY(0.01)   scaleX(0.07); filter: brightness(2.5) blur(3px);  }
  /* punto se desvanece */
  94%  { opacity: 0.7; transform: scaleY(0.008)  scaleX(0.02); filter: brightness(1.5) blur(6px);  }
  100% { opacity: 0;   transform: scaleY(0)      scaleX(0);    filter: brightness(0)   blur(10px); }
}

/* Core-signal progress bar in the side panel: 3 layer segments (ARIA/ZERO/84)
   that light up green as each signal is earned. */
/* Core-signal readout, mounted in the header */
.hud-signals {
  display: flex;
  align-items: center;
  gap: 7px;
}
.hud-signals-h {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--hud-accent);
  text-shadow: 0 0 6px rgba(127, 176, 196, 0.5);
}
.signal-count {
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--hud-accent);
}
.signal-bar {
  display: flex;
  gap: 4px;
}
.signal-seg {
  text-align: center;
  width: 18px;
  padding: 3px 0;
  font-family: 'Courier New', monospace;
  font-size: 0.64rem;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--hud-dim);
  border: 1px solid #000;
  border-radius: 3px;
  background: #050806;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
  transition: color .4s ease, box-shadow .4s ease, background .4s ease, border-color .4s ease;
}
.signal-seg.got {
  color: #fff35a;
  border-color: #41ff72;
  background: #0d2a15;
  box-shadow: 0 0 9px rgba(65, 255, 114, 0.55), inset 0 0 6px rgba(65, 255, 114, 0.3);
}

/* Signal acquired: a brief green power-surge glow on the terminal panel. */
.terminal-panel.signal-flash {
  animation: signalFlash 0.9s ease-out;
}
@keyframes signalFlash {
  0%   { box-shadow: inset 0 0 0 0 rgba(65, 255, 114, 0);    }
  15%  { box-shadow: inset 0 0 120px 10px rgba(65, 255, 114, 0.55); }
  100% { box-shadow: inset 0 0 0 0 rgba(65, 255, 114, 0);    }
}

/* ── Run card (shareable end-of-run summary) ─────────────────────────────── */
.run-card-overlay {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: grid;
  /* safe: si la tarjeta no cabe, se alinea arriba en vez de recortarse por encima */
  place-items: safe center;
  overflow-y: auto;
  padding: 18px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(127, 176, 196, 0.08), transparent 55%),
    rgba(6, 8, 11, 0.93);
  backdrop-filter: blur(3px);
}

.run-card-overlay.hidden {
  display: none;
}

.run-card-box {
  display: grid;
  gap: 12px;
  width: min(100%, 920px);
}

.run-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.run-card-title {
  color: var(--hud-accent);
  font: 700 15px/1.2 "Courier New", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(127, 176, 196, 0.35);
}

.run-card-close {
  width: 38px;
  height: 38px;
  padding: 0;
}

.run-card-canvas {
  display: block;
  /* La imagen cede altura para que el texto y los botones queden a la vista:
     en pantallas bajas (portátiles) el texto con la URL empujaba "Copiar texto"
     fuera de la ventana. 300px ≈ barra, texto, botones y márgenes. */
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: max(200px, calc(100dvh - 300px));
  justify-self: center;
  border: 1px solid var(--hud-border);
  border-radius: 14px;
  box-shadow: 0 0 34px rgba(65, 255, 114, 0.16), 0 10px 30px rgba(0, 0, 0, 0.6);
}

.run-card-text {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--hud-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--hud-fg);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;      /* one tap selects the whole block where copying is blocked */
}

.run-card-text:empty {
  display: none;
}

.run-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.run-card-actions [hidden] {
  display: none;
}

.run-card-status {
  color: var(--hud-dim);
  font-size: 0.85rem;
}

/* ── Quick bar: touch shortcuts above the prompt ─────────────────────────── */
.quick-bar {
  display: none;
  gap: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  border-top: 1px solid var(--room-border, var(--border));
  background: rgba(0, 0, 0, 0.35);
  scrollbar-width: none;
}

.quick-bar::-webkit-scrollbar { display: none; }

.quick-bar button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.quick-bar .quick-more { color: var(--amber); }
.quick-bar .quick-clear { color: var(--red); }

/* the action bar belongs to every screen size (screen engine, phase 2) */
.quick-bar:not([hidden]) { display: flex; }
@media (min-width: 721px) and (pointer: fine) {
  .quick-bar { gap: 6px; padding: 6px 10px; }
  .quick-bar button { min-height: 0; padding: 3px 10px; font-size: 0.8rem; }
}

/* ── Phone layout: the whole game in one screen, terminal first ──────────── */
@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    height: var(--app-h, 100dvh);
    min-height: 0;
    margin: 0;
    padding: 8px 8px 10px;
    border-radius: 0;
  }

  .crt-panel { padding: 0; }

  .top-bar {
    flex-direction: row;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  .brand { display: none; }

  .top-actions { gap: 6px; }

  .top-actions button,
  .top-actions .status-pill { padding: 6px 8px; }

  .workspace,
  .workspace.side-collapsed {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 8px;
  }

  /* the mission panel opens over the terminal instead of pushing it down */
  .side-panel {
    position: absolute;
    inset: 0;
    z-index: 40;
    max-height: none;
    border-right: none;
    background: #070d09;
  }

  .workspace.side-collapsed > .side-panel { display: none; }

  .main-panel { gap: 8px; }

  .terminal-panel { min-height: 0; }

  .terminal-visual-display {
    flex-basis: 30vh;
    min-height: 150px;
  }

  .terminal-output {
    padding: 10px;
    font-size: 0.86rem;
  }

  .terminal-input-row {
    flex-direction: row;
    align-items: center;
    padding: 10px;
  }

  .prompt {
    max-width: 46%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* 16px keeps iOS from zooming the page when the prompt takes focus */
  #terminalInput { font-size: 16px; }

  /* the exits list takes the panel width (an older rule pins it to 112px) */
  .mini-map { width: 100%; height: auto; }

  .diff-options { grid-template-columns: 1fr; }

  .login-box { padding: 16px 8px; }

  .login-banner { white-space: pre-wrap; }
}

/* ── Daily challenge button (intro) ──────────────────────────────────────── */
.daily-btn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--amber);
  border-radius: 12px;
  background: rgba(255, 209, 102, 0.06);
  box-shadow: none;
  color: var(--green-soft);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, box-shadow 0.15s;
}

.daily-btn:hover {
  background: rgba(255, 209, 102, 0.12);
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.18);
}

.daily-label {
  color: var(--amber);
  font-size: 1.15rem;
  font-weight: bold;
  letter-spacing: 0.1em;
}

.daily-desc { font-size: 0.9rem; line-height: 1.5; }
.daily-desc strong { color: var(--amber); }
.daily-status { color: var(--muted); font-size: 0.8rem; }

/* ── Screen engine (specs/013) ───────────────────────────────────────────────
   The game is a composed screen: a body zone redrawn per room (.screen-body),
   the status column on the right (the old side panel), and the terminal as a
   console of fixed height below. Rooms with their own machine paint it in the
   device zone, which shares the stage with the body. */
.workspace {
  grid-template-columns: minmax(0, 1fr) 330px;
}
.workspace > .main-panel { grid-column: 1; grid-row: 1; }
.workspace > .side-panel {
  grid-column: 2;
  grid-row: 1;
  border-right: none;
  border-left: 1px solid var(--hud-border);
}
.workspace.side-collapsed { grid-template-columns: minmax(0, 1fr) 0; gap: 0; }

/* Named areas keep every zone on its row when another one is hidden. The
   console's height is the player's: --console-h is set by dragging the split
   (ui/ScreenSplit.js), and never leaves the screen less than 180px. */
.main-panel {
  grid-template-areas: "stage" "split" "console" "editor";
  grid-template-columns: minmax(0, 1fr);   /* wide content scrolls inside its zone, never widens the column */
  grid-template-rows:
    minmax(0, 1fr)
    auto
    minmax(120px, min(var(--console-h, clamp(200px, 44vh, 560px)), calc(100% - 180px)))
    auto;
  gap: 0;
}
.main-panel > .screen-stage { grid-area: stage; }
.main-panel > .screen-split { grid-area: split; }
.main-panel > .terminal-panel { grid-area: console; }
.main-panel > .editor-panel { grid-area: editor; margin-top: 12px; }

/* the split: a grip to drag and a button to fold the screen */
.screen-split {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 14px;
  margin: 2px 0;
  cursor: row-resize;
  touch-action: none;
  outline: none;
}
.screen-split-grip {
  width: 56px;
  height: 3px;
  border-radius: 2px;
  background: var(--hud-border);
}
.screen-split:hover .screen-split-grip,
.screen-split:focus-visible .screen-split-grip,
.screen-split.is-dragging .screen-split-grip { background: var(--hud-accent); box-shadow: 0 0 6px var(--hud-accent); }
.screen-split-toggle {
  position: absolute;
  right: 0;
  padding: 0 8px;
  border: none;
  background: transparent;
  color: var(--hud-dim);
  font: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.screen-split-toggle:hover,
.screen-split-toggle:focus-visible { color: var(--hud-accent); }

/* the screen folded: only its heading line stays, a tap on it unfolds it */
.main-panel[data-stage="min"] {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
.main-panel[data-stage="min"] > .screen-stage { max-height: 2.6rem; overflow: hidden; cursor: pointer; }
.main-panel[data-stage="min"] .screen-body { overflow: hidden; padding-top: 8px; padding-bottom: 8px; }
.main-panel[data-stage="min"] .screen-device { display: none; }
.main-panel[data-stage="min"] .screen-split { cursor: default; }

/* the editor open: the console and the editor share the column, the stage steps aside */
.main-panel:has(> .editor-panel:not(.hidden)) {
  grid-template-rows: 0 0 minmax(0, 1fr) auto;
}
.main-panel:has(> .editor-panel:not(.hidden)) > :is(.screen-stage, .screen-split) { display: none; }

/* the stage: the body zone and, beside it or instead of it, the device zone */
.screen-stage { min-height: 0; min-width: 0; display: flex; gap: 12px; }
.screen-stage > .screen-body { flex: 1 1 0; min-width: 0; }
.screen-stage > .screen-device {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid var(--room-border, var(--hud-border));
  border-radius: 4px;
}
.main-panel[data-screen="device"] .screen-body { display: none; }      /* the machine takes the stage */
.main-panel[data-screen="floor"] .screen-device { flex: 1.25 1 0; }    /* lift drawing + the floor's rooms */
.main-panel[data-screen="floor"] .screen-body { order: 2; }            /* drawing left, rooms right */

/* keyboard on a machine: the console shrinks to the strip that says so + the prompt */
.main-panel[data-emulator] { grid-template-rows: minmax(0, 1fr) 12px auto auto; }
.main-panel[data-emulator] > .screen-split { display: none; }   /* the machine is the screen: nothing to fold */
.console-link {
  padding: 5px 14px;
  border-bottom: 1px solid var(--room-border, var(--hud-border));
  color: var(--room-accent, var(--amber));
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.console-link[hidden] { display: none; }

.screen-body {
  min-height: 0;
  overflow: auto;
  padding: 14px 18px;
  border: 1px solid var(--hud-border);
  border-radius: 4px;
  color: var(--hud-fg);
  scrollbar-color: var(--hud-border) transparent;
}
.terminal-panel,
.editor-panel { border-radius: 4px; }

.scr-h {
  margin: 0 0 12px;
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  color: var(--hud-dim);
}
.scr-h span { color: var(--hud-accent); }
.scr-note { margin: 12px 0 0; color: var(--hud-dim); font-size: 0.86rem; }
.scr-note b { color: var(--amber); font-weight: 400; }
/* a description runs to the panel's edge (ui/screen/dom.js prose): no 78ch
   measure, which cut every line half way across the wide panel */
.scr-text p { margin: 0; line-height: 1.55; white-space: normal; }
.scr-text p.scr-pre { white-space: pre-wrap; }      /* laid out on purpose: lists, commands, columns */
.scr-text p.scr-gap { line-height: 0.7; }

/* the building: a row per floor, a brick per room */
.scr-tiers { display: grid; gap: 2px; }
.scr-tier {
  display: grid;
  grid-template-columns: 3.2ch 25ch minmax(0, 1fr) 9ch;
  gap: 14px;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid transparent;
}
.scr-tier.is-here {
  border-color: var(--hud-accent);
  background: rgba(65, 255, 114, 0.07);
}
.scr-tier-id { color: var(--hud-accent); font-weight: 700; }
.scr-tier-era {
  color: var(--hud-dim);
  font-size: 0.8rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.scr-tier-n { color: var(--hud-dim); font-size: 0.86rem; text-align: right; white-space: nowrap; }
/* bricks centred on one axis: each floor as wide as its rooms — the building's real silhouette (spec 006) */
.scr-bricks { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.scr-brick {
  display: block;
  width: 20px;
  height: 12px;
  border: 1px solid var(--hud-border);
}
.scr-brick.is-on {
  background: var(--hud-accent);
  border-color: var(--hud-accent);
  box-shadow: 0 0 8px rgba(65, 255, 114, 0.5);
}

@media (max-width: 940px) {
  .workspace,
  .workspace.side-collapsed { grid-template-columns: minmax(0, 1fr); }   /* a wide piece scrolls inside, it never widens the column */
  .workspace > .side-panel { grid-column: 1; grid-row: 2; border-left: none; }
}

/* a floor: the rooms of the lift's floor, the cabin door to each one */
.scr-rooms { display: grid; gap: 1px; }
.scr-room {
  display: grid;
  grid-template-columns: 22ch minmax(0, 1fr) 13ch;
  gap: 10px;
  padding: 1px 8px;
  border-left: 2px solid var(--hud-border);
}
.scr-room-door { color: var(--hud-accent); white-space: nowrap; }
.scr-room-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-room-state { color: var(--hud-dim); font-size: 0.8rem; white-space: nowrap; }
.scr-room.is-online { border-left-color: var(--hud-accent); }
.scr-room.is-online .scr-room-state { color: var(--hud-accent); }
.scr-room.is-locked .scr-room-state { color: var(--red); }
.scr-room.is-here { background: rgba(65, 255, 114, 0.07); }
.scr-room.is-here .scr-room-name { color: var(--hud-accent); }

/* the map overlay shows the same screens as the mainframe and the lifts */
.map-screen {
  width: min(100%, 980px);
  max-height: 100%;
  overflow: auto;
  padding: 14px 18px;
  border: 1px solid var(--hud-border);
  border-radius: 4px;
  background: var(--hud-panel);
  color: var(--hud-fg);
}

/* a sector: its files and what the last run of each one said */
.scr-files { display: grid; gap: 2px; margin-bottom: 12px; }
.scr-file {
  display: grid;
  grid-template-columns: 2ch minmax(12ch, 24ch) 13ch minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-left: 2px solid var(--hud-border);
}
.scr-file-n { color: var(--hud-dim); }
.scr-file-name { color: var(--hud-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-file-state { color: var(--hud-dim); font-size: 0.8rem; letter-spacing: 0.08em; white-space: nowrap; }
.scr-file-last { color: var(--hud-dim); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-file.is-broken { border-left-color: var(--red); }
.scr-file.is-broken .scr-file-state,
.scr-file.is-broken .scr-file-last { color: var(--red); }
.scr-file.is-fixed { border-left-color: var(--hud-accent); }
.scr-file.is-fixed .scr-file-state { color: var(--hud-accent); text-shadow: 0 0 6px var(--hud-accent); }
.scr-gate { margin: 0 0 12px; color: var(--amber); }
.scr-file-last.is-brief { font-style: italic; }   /* what the exercise is about, before the first run */
.scr-text--after { color: var(--hud-dim); }

@media (max-width: 720px) {
  .workspace > .side-panel { grid-row: 1; }
  .scr-file { grid-template-columns: minmax(0, 1fr) 12ch; gap: 8px; padding: 3px 6px; }
  /* phones: the stage stacks and sizes by content (flex-basis 0 would collapse it) */
  .screen-stage { flex-direction: column; max-height: 42vh; }
  .screen-stage > .screen-body { flex: 0 1 auto; }
  .screen-stage > .screen-device { flex: 0 0 auto; height: 34vh; }
  .main-panel[data-emulator] .screen-stage > .screen-device { flex: 1 1 auto; height: auto; }
  .main-panel[data-screen="floor"] .screen-device { display: none; }   /* phones: the floor's rooms, not the drawing */
  .main-panel[data-emulator] .screen-stage { max-height: none; }
  .main-panel[data-emulator] .screen-device { padding: 6px; }
  .scr-room { grid-template-columns: 16ch minmax(0, 1fr); gap: 6px; font-size: 0.86rem; }
  .map-screen { padding: 8px 10px; }
  .scr-room-state { display: none; }
  .console-link { font-size: 0.7rem; padding: 4px 10px; }
  .scr-file-n, .scr-file-last { display: none; }   /* opens over the screen, as before */
  .main-panel { grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 0; }
  .screen-split { cursor: default; margin: 0; }          /* phones: fold, no drag */
  .screen-split-grip { display: none; }
  .screen-split-toggle { position: static; margin-left: auto; padding: 2px 6px; }
  .screen-body { padding: 8px 10px; }
  .scr-tier { grid-template-columns: 2.6ch minmax(0, 1fr) 7ch; gap: 8px; padding: 3px 6px; }
  .scr-tier-era { display: none; }
  .scr-bricks { gap: 3px; }
  .scr-brick { width: 9px; height: 9px; }   /* the widest floor (13 rooms) fits in one row */
  .scr-note { font-size: 0.78rem; margin-top: 6px; }
}

/* ── Fósforo doble (2026-11-13) ────────────────────────────────────────────────
   Two tubes: everything around the console glows amber, like a 1980s amber
   monitor, and the console is the only green. The chrome re-points the base
   tokens it uses (--green, --border…) to amber, so every rule written with
   tokens flips at once; the console and the editor keep the green ones from
   :root. Rooms with their own machine keep their era colours (--room-*). */
:root {
  --amb:        #ffb000;   /* lit amber */
  --amb-soft:   #ffd27a;   /* fixed, highlights */
  --amb-fg:     #ecdcbc;   /* text: warm white */
  --amb-dim:    #9a8058;   /* secondary text */
  --amb-border: #4a3716;   /* lines and boxes */
  --amb-err:    #ff6a3d;   /* broken, locked */
  --amb-glow:   rgba(255, 176, 0, 0.5);
  --amb-wash:   rgba(255, 176, 0, 0.07);

  --hud-bg:     #080604;
  --hud-panel:  #0b0805;
  --hud-border: var(--amb-border);
  --hud-fg:     var(--amb-fg);
  --hud-dim:    var(--amb-dim);
  --hud-accent: var(--amb);
  --hud-dot:    rgba(255, 176, 0, 0.05);
}
.top-bar, .side-panel, .screen-stage, .screen-split, .terminal-map-overlay {
  --green: var(--amb);
  --green-soft: var(--amb-soft);
  --muted: #c98a00;
  --border: var(--amb-border);
  --shadow: rgba(255, 176, 0, 0.22);
  --amber: #fff1d0;        /* the highlight inside amber is warm white */
  --red: var(--amb-err);
}
/* the console tube stays green */
.terminal-panel, .editor-panel {
  --hud-border: #14522a;
  --hud-fg: #9cffb5;
  --hud-dim: #4f9a66;
  --hud-accent: #41ff72;
  --hud-dot: rgba(65, 255, 114, 0.06);
}

body { background: radial-gradient(ellipse at 50% 42%, #0f0b06 0%, #070504 55%, #020101 100%); }
.app-shell { background: #090705; box-shadow: inset 0 0 0 1px #2c2010, 0 30px 70px rgba(0, 0, 0, 0.7); }
.workspace {
  background: radial-gradient(ellipse at 50% 44%, #120d06 0%, #0b0805 62%, #060403 100%);
  box-shadow: inset 0 0 0 1px #2c2010, inset 0 0 60px rgba(0, 0, 0, 0.6);
}
:is(.top-bar, .side-panel, .screen-split) button:hover { background: var(--amb-wash); }
:is(.top-bar, .side-panel, .screen-split) button:active { background: rgba(255, 176, 0, 0.14); }
.side-panel { border-right: none; }
.mm-head { border-bottom-color: var(--amb-border); text-shadow: none; }
.mm-exit:hover { background: var(--amb-wash); }

/* the header is a status line: title │ mission │ signals │ clock │ [keys] */
.top-bar { padding-bottom: 10px; margin-bottom: 12px; border-bottom-color: var(--amb-border); }
.top-bar h1 {
  font-size: clamp(0.9rem, 1.6vw, 1.1rem);
  letter-spacing: 0.24em;
  color: var(--amb);
  text-shadow: 0 0 10px rgba(255, 176, 0, 0.35);
  white-space: nowrap;
}
.top-actions { gap: 0; flex-wrap: wrap; justify-content: flex-end; }
.top-actions > * { margin-left: 12px; }
.top-actions > :is(.status-pill, .hud-signals) {
  padding: 2px 0 2px 12px;
  border: none;
  border-left: 1px solid var(--amb-border);
  border-radius: 0;
  background: none;
  box-shadow: none;
}
#missionStatus, .timer-pill { color: var(--amb); text-shadow: 0 0 6px var(--amb-glow); background: none; }
#missionStatus {               /* the id rule above draws an LED well: undo it */
  padding: 2px 0 2px 12px;
  border: none;
  border-left: 1px solid var(--amb-border);
  border-radius: 0;
  box-shadow: none;
}
.timer-pill.timer-warn     { color: #fff1d0; box-shadow: none; }
.timer-pill.timer-critical { color: var(--amb-err); box-shadow: none; }
.diff-pill { padding-bottom: 11px; }
.diff-pill::before { left: 12px; right: 0; }
/* keys as bracketed labels, not boxes */
.top-actions > button {
  order: 9;
  padding: 2px 4px;
  border: none;
  color: var(--amb-dim);
  font-size: 0.78rem;
}
.top-actions > button::before { content: "["; color: var(--amb-border); }
.top-actions > button::after  { content: "]"; color: var(--amb-border); }
.top-actions > button:hover { color: var(--amb); background: none; }
#audioToggleBtn.audio-muted { color: #5e4d33; }
.signal-seg { background: #0b0805; color: var(--amb-dim); }
.signal-seg.got {
  color: #1a1004;
  border-color: var(--amb);
  background: var(--amb);
  box-shadow: 0 0 9px var(--amb-glow);
}
.hud-signals-h { text-shadow: 0 0 6px var(--amb-glow); }

/* every box in the chrome: a thin amber outline with its title set in the line */
.side-scroll { padding: 4px 2px 4px 0; }
.side-card {
  border: 1px solid var(--amb-border);
  border-radius: 0;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.side-card:last-child { border-bottom: 1px solid var(--amb-border); }
.side-card h2, .side-card h3, .scr-h { color: var(--amb); }
.side-card h2::before, .side-card h3::before, .scr-h::before { content: "┤ "; color: var(--amb-border); }
.side-card h2::after,  .side-card h3::after,  .scr-h::after  { content: " ├"; color: var(--amb-border); }
.side-card h2 { font-size: 0.82rem; }
.scr-h { letter-spacing: 0.16em; }
.scr-h span { color: var(--amb-soft); }
.screen-body { border-color: var(--amb-border); border-radius: 0; color: var(--amb-fg); }
.terminal-panel, .editor-panel { border-radius: 0; }

/* the screens' states in amber: lit = here / online, warm white = fixed, red-orange = broken */
.scr-tier.is-here, .scr-room.is-here { background: var(--amb-wash); }
.scr-brick.is-on { box-shadow: 0 0 8px var(--amb-glow); }
.scr-file.is-fixed .scr-file-state { color: var(--amb-soft); text-shadow: 0 0 6px var(--amb-glow); }
.scr-file.is-fixed { border-left-color: var(--amb-soft); }
.scr-file.is-broken { border-left-color: var(--amb-err); }
.scr-file.is-broken :is(.scr-file-state, .scr-file-last) { color: var(--amb-err); }
.screen-split-grip { background: var(--amb-border); }

@media (max-width: 720px) {
  .top-bar h1 { font-size: 0.8rem; letter-spacing: 0.16em; }
  .top-actions > * { margin-left: 8px; }
  .top-actions > :is(.status-pill, .hud-signals) { padding-left: 8px; }
}
/* exits: one amber; only a locked door stands out */
:is(.mm-tier-legacy, .mm-tier-active, .mm-tier-bonus) .mm-dest { color: var(--amb-fg); }
.mm-locked .mm-dest { color: var(--amb-err); }
.mm-locked .mm-stat { color: var(--amb-err); }
/* the console is the green tube in every room; era colours stay with the
   machines (keyboard on BASIC, LOGO, SQL…) and with the core and the Black Room */
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) {
  --room-panel: #06100a; --room-bg: #030805; --room-fg: #41ff72; --room-soft: #9cffb5;
  --room-accent: #fff35a; --room-border: #1a6f31; --room-glow: rgba(65, 255, 114, 0.14);
}
/* the lift is part of the building, not an era machine: it glows amber too */
.screen-device.room-lift {
  --room-panel: #0b0805; --room-bg: #080604; --room-fg: #ffb000; --room-soft: #ffd27a;
  --room-accent: #fff1d0; --room-border: #4a3716; --room-glow: rgba(255, 176, 0, 0.16);
}
/* the room card speaks the same text-mode language: no emoji, square corners */
.room-card .room-ico { display: none; }
.room-card .room-teaches::before { content: "» "; color: var(--amb); }
.room-card .room-sub-h::before { content: "─ "; color: var(--amb-border); }
.room-card .room-step { border-radius: 0; background: var(--amb-wash); color: var(--amb-soft); border-left-color: var(--amb); }
.room-card .room-tools li { border-radius: 0; }

/* ── Pieces (specs/014): a drawing of the current file beside the table ── */
/* side by side when both fit; the piece drops under the table when they don't */
.scr-split {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-start;
}
.scr-split > .scr-files { flex: 1 1 36ch; min-width: 0; }
.scr-split > .piece { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.piece {
  padding: 8px 12px 10px;
  border: 1px solid var(--hud-border);
  min-width: 0;
}
.piece .scr-h { margin-bottom: 8px; }
.piece-mark { margin: 4px 0 0; color: var(--red); font-size: 0.8rem; }
.piece-unreadable { margin: 4px 0 0; color: var(--hud-dim); font-size: 0.78rem; font-style: italic; }

/* the abacus: three rods lying in a wooden frame */
.abacus {
  display: grid;
  gap: 2px;
  padding: 3px 0;
  border-top: 3px solid #8a5a2b;      /* the wood */
  border-bottom: 3px solid #8a5a2b;
  font-family: var(--font-terminal);
}
.abacus-rod {
  display: grid;
  grid-template-columns: 2ch auto minmax(4ch, auto) minmax(3.5ch, auto);
  align-items: center;
  gap: 6px;
}
.abacus-name { color: var(--hud-dim); font-size: 0.74rem; text-align: center; }
.abacus-wire {
  display: flex;
  padding: 0 3px;
  border-left: 3px solid #8a5a2b;
  border-right: 3px solid #8a5a2b;
  letter-spacing: 0.08em;
}
.abacus-cell { color: var(--hud-dim); opacity: 0.6; }
.abacus-cell.is-bead { opacity: 1; }
.abacus-cell.is-bead { color: var(--hud-accent); text-shadow: 0 0 6px var(--hud-accent); }
.abacus-spill { color: var(--red); text-shadow: 0 0 6px var(--red); font-size: 0.8rem; white-space: nowrap; }
.abacus-n { color: var(--hud-fg); font-weight: 700; text-align: right; }
.abacus-rod.is-overflow .abacus-n,
.abacus-rod.is-negative .abacus-n { color: var(--red); }
.abacus-rod.is-negative .abacus-cell { color: var(--red); opacity: 0.6; }
.abacus-rod.is-unknown .abacus-n { color: var(--hud-dim); }
.abacus-total { margin: 6px 0 0; color: var(--hud-dim); font-size: 0.84rem; }
.abacus-total b { color: var(--hud-accent); font-weight: 700; }

@media (max-width: 720px) {
  .scr-split > .piece { flex-basis: 100%; }
}

/* the loom: the cloth woven so far, one pass per card, and a ruler under it */
.loom-cloth { display: grid; gap: 0; font-family: var(--font-terminal); }
.loom-pass {
  display: grid;
  grid-template-columns: 2.5ch auto;
  justify-content: start;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  line-height: 1;
}
.loom-edge { color: var(--hud-dim); text-align: right; font-size: 0.7rem; }
.loom-threads { display: flex; gap: 1px; padding: 1px 4px; border-left: 2px solid #8a5a2b; border-right: 2px solid #8a5a2b; }
/* one square per thread: lifted = lit, down = the dark warp showing through */
.loom-up, .loom-down { width: 0.62rem; height: 0.62rem; font-size: 0; }
.loom-up { background: var(--hud-accent); box-shadow: 0 0 5px var(--amb-glow, var(--hud-accent)); }
.loom-down { background: rgba(255, 176, 0, 0.1); }
.loom-cut { color: var(--hud-dim); }
.loom-more { margin: 2px 0 0 3.5ch; color: var(--hud-dim); font-size: 0.74rem; }
.loom-ruler { margin: 6px 0 0; color: var(--hud-dim); font-size: 0.8rem; }
.loom-marks { color: var(--hud-accent); letter-spacing: 0.06em; word-break: break-all; }

/* the Turing machine (specs/015): its rule table, and the tape the server ran */
.tm-table { border-collapse: collapse; font-size: 0.78rem; margin-bottom: 6px; }
.tm-table th, .tm-table td { padding: 2px 8px; border: 1px solid var(--hud-border); text-align: left; white-space: nowrap; }
.tm-table th { color: var(--hud-dim); font-weight: 400; }
.tm-table tr > th:first-child { color: var(--hud-accent); }
.tm-rule .tm-write { color: var(--hud-fg); font-weight: 700; }
.tm-rule .tm-move { color: var(--hud-accent); }
.tm-rule .tm-next { color: var(--hud-dim); }
.tm-rule.is-neutral { opacity: 0.5; }
.tm-hole { color: var(--red); font-style: italic; background: rgba(255, 106, 61, 0.08); }
.tm-finals { margin: 2px 0 0; color: var(--hud-dim); font-size: 0.8rem; }
.tm-finals b { color: var(--hud-accent); }
.tm-hint { margin: 8px 0 0; color: var(--hud-dim); font-size: 0.78rem; font-style: italic; }
.tm-tape { margin-top: 8px; font-family: var(--font-terminal); }
.tm-input { margin: 0 0 3px; color: var(--hud-dim); font-size: 0.76rem; }
.tm-input b { color: var(--hud-fg); }
.tm-step { display: flex; gap: 8px; align-items: center; font-size: 0.76rem; line-height: 1.15; }
.tm-cells { display: flex; border-left: 1px solid var(--hud-border); border-right: 1px solid var(--hud-border); }
.tm-cell { width: 1.2ch; text-align: center; color: var(--hud-fg); }
.tm-cell.is-blank { color: var(--hud-border); }
.tm-cell.is-head { color: #1a1004; background: var(--hud-accent); box-shadow: 0 0 6px var(--hud-accent); }
.tm-state { color: var(--hud-dim); font-size: 0.7rem; }
.tm-more { margin: 0; color: var(--hud-dim); line-height: 1; padding-left: 7ch; }
.tm-end { margin: 4px 0 0; font-size: 0.8rem; color: var(--hud-accent); }
.tm-end:is(.is-loop, .is-stuck, .is-unreadable) { color: var(--red); }

/* the table of Note G (specs/016): cards, one column per variable, the values the engine wrote */
.ng-scroll { max-width: 100%; overflow-x: auto; }
.ng-table { border-collapse: collapse; font-size: 0.74rem; font-family: var(--font-terminal); }
.ng-table th, .ng-table td { padding: 1px 6px; border: 1px solid var(--hud-border); white-space: nowrap; text-align: left; }
.ng-table th { color: var(--hud-dim); font-weight: 400; }
.ng-n { color: var(--hud-accent); text-align: right; }
.ng-card { color: var(--hud-fg); }
.ng-v { min-width: 3ch; text-align: right; }
.ng-v.is-set { color: var(--hud-accent); font-weight: 700; }
.ng-jump { color: var(--hud-dim); font-style: italic; }
.ng-jump.is-taken { color: var(--hud-accent); }
.ng-more { text-align: center; color: var(--hud-dim); }
.ng-end { margin: 6px 0 0; font-size: 0.8rem; color: var(--hud-accent); }
.ng-end:is(.is-loop, .is-error, .is-unreadable) { color: var(--red); }
.ng-deck { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.ng-deck-name { width: 12ch; color: var(--hud-dim); font-size: 0.72rem; letter-spacing: 0.08em; }
.ng-deck-cards { display: flex; flex-wrap: wrap; gap: 4px; }
.ng-deck-card { padding: 3px 7px; border: 1px solid var(--hud-border); color: var(--hud-fg); font-size: 0.8rem; }
.ng-deck-card.is-wrong { border-color: var(--red); color: var(--red); background: rgba(255, 106, 61, 0.08); }

/* The Black Room is colder than the core: no phosphor colour at all. Its screen
   and split go grey; the console keeps the room's own grey palette. */
.main-panel:has(> .screen-stage > .screen-body[data-room="/blackroom"]) > :is(.screen-stage, .screen-split) {
  --amb: #d7d7d7; --amb-soft: #ffffff; --amb-fg: #bdbdbd; --amb-dim: #7a7a7a; --amb-border: #333333;
  --amb-glow: rgba(255, 255, 255, 0.25); --amb-wash: rgba(255, 255, 255, 0.05); --amb-err: #ff8a8a;
  --hud-border: var(--amb-border); --hud-fg: var(--amb-fg); --hud-dim: var(--amb-dim); --hud-accent: var(--amb);
  --green: var(--amb); --green-soft: var(--amb-soft); --border: var(--amb-border); --amber: #ffffff; --red: var(--amb-err);
}

/* ── Relieve metálico (specs/018, dirección B: latón cepillado) ──────────────
   The game as a physical console: a brushed-brass plate for the header,
   metal frames with the screens sunk into them, and keys that stand out and
   sink when pressed. Only gradients, borders and shadows: no images. */
:root {
  --brass-hi:   rgba(255, 225, 160, 0.42);   /* light catching the top edge */
  --brass-top:  #5a4520;
  --brass-bot:  #2a1f0e;
  --brass-edge: #6e5226;
  --frame-top:  #3a2d17;
  --frame-bot:  #15100a;
  --frame-edge: #5e4520;
  --brushed: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px);
  --key-drop: 0 2px 0 #0a0704, 0 3px 5px rgba(0, 0, 0, 0.6);
}

/* the header: a brushed-brass plate with a screw in each end */
.top-bar {
  position: relative;
  padding: 9px 30px;
  border: 1px solid var(--brass-edge);
  border-radius: 6px;
  background: var(--brushed), linear-gradient(var(--frame-top), #1a130a 55%, #120d07);
  box-shadow: inset 0 1px 0 var(--brass-hi), inset 0 -2px 0 rgba(0, 0, 0, 0.6), 0 3px 6px rgba(0, 0, 0, 0.7);
}
.top-bar::before, .top-bar::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 9px; height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #a8875a, #3a2a12 70%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 220, 150, 0.15);
}
.top-bar::before { left: 11px; }
.top-bar::after  { right: 11px; }
.top-bar h1 { text-shadow: 0 1px 0 #000, 0 0 10px rgba(255, 176, 0, 0.3); }

/* mission and clock read through small sunk windows */
#missionStatus, .timer-pill {
  padding: 3px 9px;
  border: none;
  border-radius: 3px;
  background: #050302;
  box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255, 220, 150, 0.12);
}
.top-actions > :is(.status-pill, .hud-signals) { border-left: none; padding-left: 4px; }

/* keys: brass in the chrome, greenish metal in the console */
:is(.top-actions > button, .editor-header button, .pin-btn, .quick-bar button) {
  border: 1px solid var(--brass-edge);
  border-radius: 5px;
  background: linear-gradient(var(--brass-top), var(--brass-bot));
  color: #ffe7b0;
  text-shadow: 0 -1px 0 #000;
  box-shadow: inset 0 1px 0 var(--brass-hi), var(--key-drop);
  transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.1s ease;
}
:is(.top-actions > button, .editor-header button, .pin-btn, .quick-bar button):hover {
  filter: brightness(1.15);
  background: linear-gradient(var(--brass-top), var(--brass-bot));
}
:is(.top-actions > button, .editor-header button, .pin-btn, .quick-bar button):active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
  background: linear-gradient(var(--brass-bot), var(--brass-top));
}
:is(.top-actions > button, .editor-header button, .pin-btn, .quick-bar button):focus-visible {
  outline: 1px solid var(--amb);
  outline-offset: 2px;
}
.top-actions > button { padding: 4px 11px; color: #ffe7b0; }
.top-actions > button::before, .top-actions > button::after { content: none; }   /* real keys: no brackets */
.top-actions > button:hover { color: #fff3d6; }
#audioToggleBtn.audio-muted { color: #9a8058; }

.quick-bar button, .editor-header button {
  --brass-top: #3e4a32; --brass-bot: #1a2414; --brass-edge: #4d6b3a; --brass-hi: rgba(200, 255, 200, 0.35);
  color: #c8ffd0;
}
.quick-bar .quick-more { color: #fff3a0; }
.quick-bar .quick-clear { color: #ffb0a0; }
.quick-bar { background: linear-gradient(#0d150e, #070b07); border-top-color: #1f3a24; }
.editor-header { background: linear-gradient(#142016, #0a120b); }
/* on a machine with the keyboard on (BASIC, SQL, LOGO…), the core and the Black
   Room, the keys are made of that machine's metal: tinted from its era colours */
.terminal-panel:is([class*="-emulator"], .room-core, .room-blackroom) .quick-bar button {
  --brass-top:  color-mix(in srgb, var(--room-border) 55%, #2a2a26);
  --brass-bot:  color-mix(in srgb, var(--room-border) 22%, #0a0a09);
  --brass-edge: color-mix(in srgb, var(--room-border) 80%, #3a3a3a);
  --brass-hi:   color-mix(in srgb, var(--room-fg) 40%, transparent);
  color: color-mix(in srgb, var(--room-fg) 70%, #ffffff);
}
.terminal-panel:is([class*="-emulator"], .room-core, .room-blackroom) .quick-bar {
  background: linear-gradient(color-mix(in srgb, var(--room-panel), #ffffff 4%), var(--room-bg));
  border-top-color: var(--room-border);
}

/* panels: a metal frame with the screen sunk inside it */
:is(.screen-body, .side-card, .terminal-panel, .editor-panel, .screen-stage > .screen-device) {
  border: 5px solid transparent;
  border-radius: 7px;
  box-shadow: 0 0 0 1px var(--frame-edge), inset 0 2px 7px rgba(0, 0, 0, 0.85), 0 3px 6px rgba(0, 0, 0, 0.6);
}
.screen-body {
  background: linear-gradient(#0a0704, #0a0704) padding-box, linear-gradient(var(--frame-top), var(--frame-bot)) border-box;
}
.side-card {
  background: linear-gradient(#0b0805, #0b0805) padding-box, linear-gradient(var(--frame-top), var(--frame-bot)) border-box;
}
.screen-stage > .screen-device {
  background: linear-gradient(var(--room-bg, #080604), var(--room-bg, #080604)) padding-box, linear-gradient(var(--frame-top), var(--frame-bot)) border-box;
}
.terminal-panel, .editor-panel {
  --frame-top: #24301f; --frame-bot: #0c120c; --frame-edge: #2f4a2a;
  background: linear-gradient(var(--room-panel, #030a05), var(--room-panel, #030a05)) padding-box, linear-gradient(var(--frame-top), var(--frame-bot)) border-box;
}
/* the core and the Black Room keep their own metal */
.terminal-panel:is(.room-core) { --frame-top: #3a1414; --frame-bot: #140505; --frame-edge: #6a2020; }
.terminal-panel:is(.room-blackroom) { --frame-top: #2a2a2a; --frame-bot: #0e0e0e; --frame-edge: #444444; }
.main-panel:has(> .screen-stage > .screen-body[data-room="/blackroom"]) .screen-body {
  --frame-top: #2a2a2a; --frame-bot: #0e0e0e; --frame-edge: #444444;
}

@media (prefers-reduced-motion: reduce) {
  :is(.top-actions > button, .editor-header button, .pin-btn, .quick-bar button) { transition: none; }
  :is(.top-actions > button, .editor-header button, .pin-btn, .quick-bar button):active { transform: none; }
}

@media (max-width: 720px) {
  .top-bar { padding: 6px 22px; }
  .top-bar::before { left: 7px; } .top-bar::after { right: 7px; }
  :is(.screen-body, .side-card, .terminal-panel, .editor-panel, .screen-stage > .screen-device) { border-width: 3px; }
}

/* the background: solid metal. The chassis (.app-shell) is a dark brushed
   plate with a bevelled edge; the bay behind the panels (.workspace) is the
   same metal, sunk one step and darker, so the framed screens stand on it. */
:root {
  --plate-top: #3b2f1b;
  --plate-mid: #251d11;
  --plate-bot: #15100a;
  --brushed-h: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px);
}
body { background: radial-gradient(ellipse at 50% 40%, #0c0905 0%, #050403 60%, #020101 100%); }
.app-shell {
  background: var(--brushed), linear-gradient(var(--plate-top), var(--plate-mid) 45%, var(--plate-bot));
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 150, 0.16),
    inset 0 0 0 1px #3a2c16,
    inset 0 -2px 0 rgba(0, 0, 0, 0.6),
    0 30px 70px rgba(0, 0, 0, 0.75);
}
.workspace {
  background: var(--brushed-h), linear-gradient(#1b150c, #140f09 50%, #0f0b07);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1px #050302,
    0 1px 0 rgba(255, 220, 150, 0.08);
}
@media (max-width: 720px) {
  .app-shell { box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.12), inset 0 0 0 1px #3a2c16; }
}

/* ── Transbordador (specs/017): matriz de destinos y viaje ─────────────────── */
.tp-scroll { overflow-x: auto; max-width: 100%; }
.tp-matrix { border-collapse: collapse; width: 100%; min-width: 640px; table-layout: fixed; font-size: 11px; }
.tp-matrix th { color: var(--amb-dim); font-weight: normal; padding: 2px 0; }
.tp-matrix .tp-corner, .tp-matrix .tp-row { width: 26px; }
.tp-matrix .tp-row { color: var(--amb); font-weight: bold; text-align: center; }
.tp-cell { border: 1px solid var(--amb-border); padding: 2px 3px; height: 34px; vertical-align: top; overflow: hidden; }
.tp-cell.is-empty { border-style: dotted; opacity: .35; }
.tp-cell .tp-code { display: block; color: var(--amb-dim); font-size: 9px; letter-spacing: .05em; }
.tp-cell .tp-name { display: block; color: var(--amb-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-cell.is-online .tp-name { color: var(--amb); }
.tp-cell.is-locked { border-color: var(--amb-err); }
.tp-cell.is-locked .tp-name { color: var(--amb-err); }
.tp-cell.is-locked .tp-name::before { content: '▣ '; }
.tp-cell.is-here { background: var(--amb-wash); box-shadow: inset 0 0 0 1px var(--amb); }
.tp-cell.is-here .tp-name::after { content: ' ◂'; color: var(--amb); }

/* El viaje: la pantalla de destino se materializa entre interferencias. */
@keyframes tq-beam {
  0%   { opacity: 0; filter: brightness(3) blur(6px); clip-path: inset(48% 0 48% 0); }
  35%  { opacity: .6; filter: brightness(2) blur(3px); clip-path: inset(20% 0 20% 0); }
  70%  { opacity: .9; filter: brightness(1.3) blur(1px); clip-path: inset(0 0 0 0); }
  100% { opacity: 1; filter: none; clip-path: inset(0 0 0 0); }
}
#screenFrame.is-beaming .screen-body { animation: tq-beam .85s ease-out; }
@media (prefers-reduced-motion: reduce) {
  #screenFrame.is-beaming .screen-body { animation: none; }
}

/* ── Tarjeta de partida: el modal con la misma paleta (ámbar sobre latón) ──── */
.run-card-overlay {
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 176, 0, 0.06), transparent 55%), rgba(5, 4, 3, 0.94);
}
.run-card-title { color: var(--amb); text-shadow: 0 0 8px var(--amb-glow); }
.run-card-canvas {
  border: 1px solid #3a2c16;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(255, 176, 0, 0.12), 0 10px 30px rgba(0, 0, 0, 0.7);
}
.run-card-text { border-color: var(--amb-border); color: var(--amb-fg); background: #0b0805; }
.run-card-status { color: var(--amb-dim); }

/* ── Floor tint: each floor washes the panels with its own colour (the hue the
   building map already gives it). Dark on purpose: the phosphor text keeps its
   contrast and the scanlines still read. The editor, the machines with the
   keyboard on, the core and the Black Room keep their own colours. ── */
.app-shell { --floor-hue: #1f7a4a; }
.app-shell:has(#screenFrame[data-floor="5"])  { --floor-hue: #b0409a; }
.app-shell:has(#screenFrame[data-floor="4"])  { --floor-hue: #188f5e; }
.app-shell:has(#screenFrame[data-floor="3"])  { --floor-hue: #7d5cff; }
.app-shell:has(#screenFrame[data-floor="2"])  { --floor-hue: #a32a2a; }
.app-shell:has(#screenFrame[data-floor="1"])  { --floor-hue: #1b82a3; }
.app-shell:has(#screenFrame[data-floor="0"])  { --floor-hue: #6e7d1a; }
.app-shell:has(#screenFrame[data-floor="b"])  { --floor-hue: #a86a12; }
.app-shell:has(#screenFrame[data-floor="b2"]) { --floor-hue: #8a7350; }
.workspace {
  --floor-wash: linear-gradient(155deg,
    color-mix(in srgb, var(--floor-hue) 54%, #060508),
    color-mix(in srgb, var(--floor-hue) 18%, #030303) 85%);
  --floor-wash-soft: linear-gradient(170deg,
    color-mix(in srgb, var(--floor-hue) 38%, #040506),
    color-mix(in srgb, var(--floor-hue) 12%, #020303) 82%);
}
:is(.screen-body, .side-card) {
  background: var(--floor-wash) padding-box, linear-gradient(var(--frame-top), var(--frame-bot)) border-box;
}
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) {
  background: var(--floor-wash-soft) padding-box, linear-gradient(var(--frame-top), var(--frame-bot)) border-box;
}
/* the console's own strips follow the floor too: the output and the input row
   let the wash through, the quick-verb bar and its keys take the floor's metal */
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) .terminal-output { background: transparent; }
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) .terminal-input-row {
  background: color-mix(in srgb, var(--floor-hue) 16%, transparent);
  border-top-color: color-mix(in srgb, var(--floor-hue) 60%, #101010);
}
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) .quick-bar {
  background: linear-gradient(color-mix(in srgb, var(--floor-hue) 32%, #0a0a0a), color-mix(in srgb, var(--floor-hue) 15%, #050505));
  border-top-color: color-mix(in srgb, var(--floor-hue) 60%, #101010);
}
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) .quick-bar button {
  --brass-top:  color-mix(in srgb, var(--floor-hue) 55%, #2a2a26);
  --brass-bot:  color-mix(in srgb, var(--floor-hue) 22%, #0a0a09);
  --brass-edge: color-mix(in srgb, var(--floor-hue) 80%, #3a3a3a);
  --brass-hi:   color-mix(in srgb, var(--floor-hue) 45%, rgba(255, 255, 255, 0.35));
}
/* the lettering on the keys: the floor's colour, lightened to stay legible
   (the "more" and "clear" keys keep their yellow and red) */
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) .quick-bar button:not(.quick-more):not(.quick-clear) {
  color: color-mix(in srgb, var(--floor-hue) 42%, #ffffff);
}
/* the header plate and the side column are made of the floor's metal too:
   plate, card frames, keys and screws. The amber lettering stays. */
.top-bar, .side-panel {
  --frame-top:  color-mix(in srgb, var(--floor-hue) 45%, #2a2622);
  --frame-bot:  color-mix(in srgb, var(--floor-hue) 16%, #0c0b0a);
  --frame-edge: color-mix(in srgb, var(--floor-hue) 62%, #3a3a3a);
  --brass-top:  color-mix(in srgb, var(--floor-hue) 55%, #2a2a26);
  --brass-bot:  color-mix(in srgb, var(--floor-hue) 22%, #0a0a09);
  --brass-edge: color-mix(in srgb, var(--floor-hue) 75%, #3a3a3a);
  --brass-hi:   color-mix(in srgb, var(--floor-hue) 45%, rgba(255, 255, 255, 0.35));
}
.top-bar {
  background: var(--brushed), linear-gradient(var(--frame-top),
    color-mix(in srgb, var(--floor-hue) 22%, #121110) 55%,
    color-mix(in srgb, var(--floor-hue) 12%, #0b0a0a));
}
.top-bar::before, .top-bar::after {
  background: radial-gradient(circle at 35% 35%,
    color-mix(in srgb, var(--floor-hue) 50%, #cfcfcf),
    color-mix(in srgb, var(--floor-hue) 40%, #1c1c1c) 70%);
}

/* ── Mezclador: música y efectos por separado (specs/023) ─────────────────── */
.top-bar { position: relative; }
.audio-mixer {
  position: absolute;
  top: calc(100% + 6px);
  right: 16px;
  z-index: 3000;
  display: grid;
  gap: 10px;
  min-width: 240px;
  padding: 12px 14px;
  border: 1px solid var(--amb-border);
  background: #0b0805;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7), inset 0 0 0 1px #050302;
  color: var(--amb-fg);
  font-size: 0.8rem;
}
.audio-mixer[hidden] { display: none; }
.mix-row { display: grid; grid-template-columns: 5.5em 1fr 2.6em; align-items: center; gap: 10px; }
.mix-row span { color: var(--amb-dim); letter-spacing: 0.06em; text-transform: uppercase; }
.mix-row output { text-align: right; color: var(--amb-soft); font-variant-numeric: tabular-nums; }
.mix-row input[type="range"] { width: 100%; accent-color: var(--amb); min-height: 28px; }
#muteAllBtn { justify-self: start; color: var(--amb-dim); background: none; border: 1px solid var(--amb-border); padding: 6px 10px; }
#muteAllBtn[aria-pressed="true"] { color: var(--amb); border-color: var(--amb); }
@media (max-width: 720px) {
  .audio-mixer { right: 8px; left: 8px; min-width: 0; }
}
/* and the console's frame is the same floor metal */
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) {
  --frame-top:  color-mix(in srgb, var(--floor-hue) 45%, #2a2622);
  --frame-bot:  color-mix(in srgb, var(--floor-hue) 16%, #0c0b0a);
  --frame-edge: color-mix(in srgb, var(--floor-hue) 62%, #3a3a3a);
}
/* secondary text is lifted a step on the washed panels, so it keeps its
   contrast in the lit corner of the brightest floors (violet, magenta) */
:is(.screen-body, .side-card) {
  --amb-dim: #c9b596;
  --hud-dim: #c9b596;
}
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) { --hud-dim: #7cc794; }
/* the same for error and locked text: a lighter red, so it holds on the
   sepia and blue floors as well */
:is(.screen-body, .side-card) { --amb-err: #ff9b78; --red: #ff9b78; }
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) { --red: #ff7070; }
/* the editor: its frame, header strip and keys are the floor's metal as well;
   the code area stays dark and neutral so the source reads the same everywhere */
.editor-panel {
  --frame-top:  color-mix(in srgb, var(--floor-hue) 45%, #2a2622);
  --frame-bot:  color-mix(in srgb, var(--floor-hue) 16%, #0c0b0a);
  --frame-edge: color-mix(in srgb, var(--floor-hue) 62%, #3a3a3a);
}
.editor-panel .editor-header {
  background: linear-gradient(color-mix(in srgb, var(--floor-hue) 32%, #0a0a0a), color-mix(in srgb, var(--floor-hue) 15%, #050505));
}
.editor-panel .editor-header button {
  --brass-top:  color-mix(in srgb, var(--floor-hue) 55%, #2a2a26);
  --brass-bot:  color-mix(in srgb, var(--floor-hue) 22%, #0a0a09);
  --brass-edge: color-mix(in srgb, var(--floor-hue) 80%, #3a3a3a);
  --brass-hi:   color-mix(in srgb, var(--floor-hue) 45%, rgba(255, 255, 255, 0.35));
  color: color-mix(in srgb, var(--floor-hue) 42%, #ffffff);
}
/* the Black Room has no colour of its own floor: everything around its
   monochrome console goes grey with it */
.app-shell:has(#screenBody[data-room="/blackroom"]) { --floor-hue: #565656; }
/* a machine's screen keeps its own colours inside, but its frame belongs to
   the building: the floor's metal, like every other panel */
.screen-stage > .screen-device {
  --frame-top:  color-mix(in srgb, var(--floor-hue) 45%, #2a2622);
  --frame-bot:  color-mix(in srgb, var(--floor-hue) 16%, #0c0b0a);
  --frame-edge: color-mix(in srgb, var(--floor-hue) 62%, #3a3a3a);
}

/* editor header: the three keys always sit in one row; the file name gives
   way (ellipsis) instead of pushing them into a column on a phone */
.editor-header > strong { flex: 1 1 auto; min-width: 0; }
.editor-header > div { display: flex; flex: 0 0 auto; gap: 6px; }
@media (max-width: 720px) {
  .editor-header { gap: 8px; padding: 8px; }
  .editor-header button { min-height: 36px; padding: 5px 8px; font-size: 0.78rem; }
  /* cut the name from the left, so the file itself stays in view */
  .editor-header > strong { direction: rtl; text-align: left; }
}

/* ── Drawer layout (the default on desktop; ?layout=classic turns it off — ui/DrawerLayout.js)
   The side column stops taking a quarter of the screen: it becomes a drawer
   that slides over the console, and a one-line strip on top of the console
   keeps the room, its exits and the current step in sight. Desktop only. ── */
.status-line { display: none; }
@media (min-width: 721px) {
  .layout-drawer .workspace,
  .layout-drawer .workspace.side-collapsed { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .layout-drawer .workspace > .side-panel {
    position: absolute;
    top: 16px; right: 16px; bottom: 16px;
    width: 348px;
    z-index: 40;                     /* over the panels, under the scanlines */
    padding: 10px 8px 10px 12px;
    border: 1px solid color-mix(in srgb, var(--floor-hue) 62%, #3a3a3a);
    border-radius: 8px;
    background: color-mix(in srgb, color-mix(in srgb, var(--floor-hue) 14%, #050505) 94%, transparent);
    box-shadow: -22px 0 44px rgba(0, 0, 0, 0.72), 0 8px 24px rgba(0, 0, 0, 0.6);
    opacity: 1;
    pointer-events: auto;
    transform: none;
    transition: transform 0.22s ease, opacity 0.22s ease, visibility 0s;
  }
  .layout-drawer .workspace.side-collapsed > .side-panel {
    transform: translateX(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: transform 0.22s ease, opacity 0.22s ease, visibility 0s 0.22s;
  }

  .layout-drawer .status-line {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
    min-width: 0;
    padding: 5px 12px;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-bottom: 1px solid color-mix(in srgb, var(--floor-hue) 55%, #101010);
    background: color-mix(in srgb, var(--floor-hue) 20%, transparent);
  }
  .status-line .sl-room { flex: 0 0 auto; color: var(--amb); font-weight: 700; letter-spacing: 0.12em; }
  .status-line .sl-room::before { content: "◉ "; }
  .status-line .sl-exits { display: flex; flex: 0 1 auto; gap: 4px; min-width: 0; overflow: hidden; }
  .status-line :is(.sl-exit, .sl-more) {
    flex: 0 0 auto;
    padding: 1px 7px;
    border: 1px solid color-mix(in srgb, var(--floor-hue) 60%, #2a2a2a);
    border-radius: 3px;
    background: transparent;
    color: var(--amb-fg, #ecdcbc);
    font-size: inherit;
    line-height: 1.5;
  }
  .status-line :is(.sl-exit, .sl-more):hover { background: color-mix(in srgb, var(--floor-hue) 35%, transparent); }
  .status-line .sl-exits { align-items: center; gap: 6px; }
  .status-line .sl-exit-h { color: #c9b596; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; }
  .status-line .sl-step { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #c9b596; }
  .status-line .sl-more { color: var(--amb); }
  .terminal-panel[class*="-emulator"] .status-line .sl-exit { opacity: 0.45; pointer-events: none; }
  @media (prefers-reduced-motion: reduce) {
    .layout-drawer .workspace > .side-panel { transition: none; }
  }
}

/* three heights for the screen (drawer layout): tira · media · completa */
.stage-modes { display: none; }
@media (min-width: 721px) {
  .layout-drawer .screen-split-toggle { display: none; }      /* the three stops replace it */
  .layout-drawer .stage-modes { display: flex; position: absolute; right: 0; top: 50%; transform: translateY(-50%); gap: 2px; }
  .layout-drawer .stage-modes button {
    width: 22px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--hud-dim);
    font-size: 0.7rem;
    line-height: 1.3;
    cursor: pointer;
  }
  .layout-drawer .stage-modes button:hover { color: var(--hud-accent); }
  .layout-drawer .stage-modes button[aria-pressed="true"] {
    color: var(--amb);
    border-color: color-mix(in srgb, var(--floor-hue) 60%, #2a2a2a);
    background: color-mix(in srgb, var(--floor-hue) 22%, transparent);
  }
  .layout-drawer .screen-split { min-height: 18px; }

  /* completa: the screen takes the height, the console keeps its strip, its
     last lines and the prompt (not while the editor is open: it owns the column) */
  .layout-drawer .main-panel[data-stage="max"]:not(:has(> .editor-panel:not(.hidden))) {
    grid-template-rows: minmax(0, 1fr) auto auto auto;
  }
  .layout-drawer .main-panel[data-stage="max"]:not(:has(> .editor-panel:not(.hidden))) .terminal-output {
    flex: 0 0 auto;
    max-height: 4.6rem;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .layout-drawer .main-panel[data-stage="max"] .screen-split { cursor: default; }
}

/* ── Header, lighter ──────────────────────────────────────────────────────────
   The F·M·D selector is gone: the level never changes during a game, so the
   MISIÓN window carries it — a lit edge in the level's colour and its letter.
   (#diffPill stays in the page, hidden: it still holds data-level.) */
#diffPill { display: none !important; }
.top-actions:has(#diffPill[data-level="easy"])   #missionStatus { --diff-color: #41ff72; --diff-letter: "F"; }
.top-actions:has(#diffPill[data-level="medium"]) #missionStatus { --diff-color: #ffd166; --diff-letter: "M"; }
.top-actions:has(#diffPill[data-level="hard"])   #missionStatus { --diff-color: #ff7070; --diff-letter: "D"; }
.top-actions:has(#diffPill[data-level]) #missionStatus {
  box-shadow: inset 0 1px 3px #000, 0 0 0 1px var(--diff-color), 0 0 7px color-mix(in srgb, var(--diff-color) 55%, transparent);
}
.top-actions:has(#diffPill[data-level]) #missionStatus::after {
  content: " · " var(--diff-letter);
  color: var(--diff-color);
  text-shadow: 0 0 6px var(--diff-color);
}

/* the three signals: a ring of three arcs instead of the letters A·Z·8.
   Each arc keeps its place and its layer's colour (app · datos · infra). */
.hud-signals-h { display: none; }               /* the ring is the icon now */
.signal-bar { display: flex; align-items: center; }
.signal-ring { width: 22px; height: 22px; transform: rotate(-90deg); overflow: visible; }
.signal-ring .signal-seg {
  fill: none;
  stroke: #6a5d4c;
  stroke-width: 4;
  background: none;
  box-shadow: none;
  transition: stroke 0.3s ease;
}
.signal-ring .signal-seg.got[data-layer="ARIA"] { stroke: #41ff72; filter: drop-shadow(0 0 2px #41ff72); }
.signal-ring .signal-seg.got[data-layer="ZERO"] { stroke: #5cd6ff; filter: drop-shadow(0 0 2px #5cd6ff); }
.signal-ring .signal-seg.got[data-layer="84"]   { stroke: #ffb000; filter: drop-shadow(0 0 2px #ffb000); }

/* minimap: the direction letters (N, S, NE…) were 10px and faded. Bold, a size
   up and in the lit amber, so the exit reads before its arrow does */
.mm-exit { grid-template-columns: 48px 1fr auto; }
.mm-dir { color: var(--amb-dim, var(--hud-dim)); white-space: nowrap; }
.mm-dir i {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-left: 4px;
  opacity: 1;
  color: var(--amb, var(--hud-accent));
}
.mm-locked .mm-dir i { color: var(--amb-err, #ff9b78); }
/* the arrow itself was a hairline glyph in the dim colour: a size up, in the lit
   amber, and thickened with a stroke (the font has no bold arrows) */
.mm-exit { grid-template-columns: 54px 1fr auto; }
.mm-dir { display: inline-flex; align-items: center; }
.mm-arrow {
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 700;
  color: var(--amb, var(--hud-accent));
  -webkit-text-stroke: 0.7px currentColor;
}
.mm-locked .mm-arrow { color: var(--amb-err, #ff9b78); }

/* ── The lift as the building with its floor opened (drawer layout) ───────────
   One panel instead of two: the lift's own drawing steps aside, the other
   floors are keys and this floor's rooms are cards. (ui/screen/screens/lift.js) */
@media (min-width: 721px) {
  .layout-drawer .main-panel[data-screen="floor"] .screen-device { display: none; }
  .layout-drawer .main-panel[data-screen="floor"] .screen-body { order: 0; }
}
.scr-lift button.scr-tier {
  width: 100%;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  transition: none;
}
.scr-lift button.scr-tier:hover,
.scr-lift button.scr-tier:focus-visible {
  border-color: color-mix(in srgb, var(--floor-hue) 70%, #3a3a3a);
  background: color-mix(in srgb, var(--floor-hue) 22%, transparent);
  outline: none;
}
.scr-lift .scr-tier-n { color: var(--hud-dim); }
.scr-lift .scr-tier.is-here .scr-tier-n { color: var(--amb); }
.scr-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border: 1px solid var(--hud-accent);
  border-top: none;
  background: color-mix(in srgb, var(--floor-hue) 12%, transparent);
}
.scr-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name state" "way way";
  column-gap: 8px;
  row-gap: 0;
  align-items: baseline;
  min-width: 0;
  padding: 4px 9px 5px;
  border: 1px solid color-mix(in srgb, var(--floor-hue) 55%, #2a2a2a);
  border-left-width: 3px;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  font: inherit;
  text-align: left;
  box-shadow: none;
}
button.scr-card { cursor: pointer; }
button.scr-card:hover,
button.scr-card:focus-visible { background: color-mix(in srgb, var(--floor-hue) 30%, transparent); outline: none; }
.scr-card-way { color: var(--amb); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr-card:not(.is-door) .scr-card-way { color: var(--hud-dim); font-weight: 400; }
.scr-card-name { grid-area: name; }
.scr-card-state { grid-area: state; }
.scr-card-way { grid-area: way; }
.scr-card-name { font-size: 1rem; font-weight: 700; letter-spacing: 0.05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-card-state { color: var(--hud-dim); font-size: 0.76rem; }
.scr-card.is-online { border-left-color: var(--amb-soft); }
.scr-card.is-online .scr-card-state { color: var(--amb-soft); }
.scr-card.is-locked { border-left-color: var(--amb-err); }
.scr-card.is-locked :is(.scr-card-state, .scr-card-name) { color: var(--amb-err); }

/* the keys on the console's strip (salida, guía) are raised like the quick-verb
   keys below: the floor's metal, a drop under them, and they sink when pressed */
@media (min-width: 721px) {
  .status-line :is(.sl-exit, .sl-more) {
    --brass-top:  color-mix(in srgb, var(--floor-hue) 55%, #2a2a26);
    --brass-bot:  color-mix(in srgb, var(--floor-hue) 22%, #0a0a09);
    --brass-edge: color-mix(in srgb, var(--floor-hue) 80%, #3a3a3a);
    --brass-hi:   color-mix(in srgb, var(--floor-hue) 45%, rgba(255, 255, 255, 0.35));
    padding: 2px 9px;
    border: 1px solid var(--brass-edge);
    border-radius: 5px;
    background: linear-gradient(var(--brass-top), var(--brass-bot));
    color: color-mix(in srgb, var(--floor-hue) 42%, #ffffff);
    text-shadow: 0 -1px 0 #000;
    box-shadow: inset 0 1px 0 var(--brass-hi), var(--key-drop);
    transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.1s ease;
  }
  .status-line :is(.sl-exit, .sl-more):hover {
    filter: brightness(1.15);
    background: linear-gradient(var(--brass-top), var(--brass-bot));
  }
  .status-line :is(.sl-exit, .sl-more):active {
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
    background: linear-gradient(var(--brass-bot), var(--brass-top));
  }
  .status-line :is(.sl-exit, .sl-more):focus-visible { outline: 1px solid var(--amb); outline-offset: 2px; }
  .layout-drawer .status-line { padding-top: 5px; padding-bottom: 8px; }   /* room for the drop */
  @media (prefers-reduced-motion: reduce) {
    .status-line :is(.sl-exit, .sl-more) { transition: none; }
    .status-line :is(.sl-exit, .sl-more):active { transform: none; }
  }
}

/* the guide drawer's own close key: a red X in its top-left corner, the edge
   that faces the screen and the console (drawer layout) */
.drawer-close { display: none; }
@media (min-width: 721px) {
  .layout-drawer .drawer-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid #8a2424;
    border-radius: 5px;
    background: linear-gradient(#b23030, #6e1818);
    color: #ffe9e4;
    font: 700 0.78rem/1 var(--font-terminal);
    text-shadow: 0 -1px 0 #000;
    box-shadow: inset 0 1px 0 rgba(255, 190, 180, 0.4), var(--key-drop);
    cursor: pointer;
    transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.1s ease;
  }
  .layout-drawer .drawer-close:hover { filter: brightness(1.2); background: linear-gradient(#b23030, #6e1818); }
  .layout-drawer .drawer-close:active { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8); }
  .layout-drawer .drawer-close:focus-visible { outline: 1px solid var(--amb); outline-offset: 2px; }
  /* the cards start under it */
  .layout-drawer .workspace > .side-panel { padding-top: 38px; }
}

/* the map's close key: the same red key as the guide drawer's */
.terminal-map-close {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #8a2424;
  border-radius: 5px;
  background: linear-gradient(#b23030, #6e1818);
  color: #ffe9e4;
  font: 700 0.78rem/1 var(--font-terminal);
  text-shadow: 0 -1px 0 #000;
  box-shadow: inset 0 1px 0 rgba(255, 190, 180, 0.4), var(--key-drop);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.1s ease;
}
.terminal-map-close:hover { filter: brightness(1.2); background: linear-gradient(#b23030, #6e1818); }
.terminal-map-close:active { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8); }
.terminal-map-close:focus-visible { outline: 1px solid var(--amb); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  :is(.terminal-map-close, .drawer-close) { transition: none; }
  :is(.terminal-map-close, .drawer-close):active { transform: none; }
}
@media (max-width: 720px) {
  .terminal-map-close { width: 36px; height: 36px; font-size: 1rem; }   /* a finger needs more than 24px */
}
/* …and in the same corner: top-left, before the floor's name */
.terminal-map-toolbar { justify-content: flex-start; }
.terminal-map-close { order: -1; flex: 0 0 auto; }

/* the way out is the one key on the strip that takes you somewhere: lit amber,
   bold and a size up, so it stands out from the room's name and the "guía" key */
@media (min-width: 721px) {
  .status-line .sl-exit {
    --brass-top: #ffc233;
    --brass-bot: #b87400;
    --brass-edge: #ffd978;
    --brass-hi: rgba(255, 244, 200, 0.75);
    padding: 2px 12px;
    color: #1c1203;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-shadow: 0 1px 0 rgba(255, 236, 170, 0.55);
    box-shadow: inset 0 1px 0 var(--brass-hi), var(--key-drop), 0 0 9px rgba(255, 176, 0, 0.45);
  }
  .status-line .sl-exit:active { box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6); }
}

/* room state as an icon (floor screen, map and the lift's cards): green check =
   online, grey ring = still to activate, red lock = shut */
.scr-room { grid-template-columns: 22ch minmax(0, 1fr) 3ch; }
:is(.scr-room-state, .scr-card-state) { font-size: 0.95rem; line-height: 1; text-align: center; color: #6f695e; }
:is(.scr-room, .scr-card).is-online :is(.scr-room-state, .scr-card-state) { color: #41ff72; text-shadow: 0 0 6px rgba(65, 255, 114, 0.55); }
:is(.scr-room, .scr-card).is-locked :is(.scr-room-state, .scr-card-state) { color: #ff7070; }
@media (max-width: 720px) {
  /* an icon fits where the words did not: the phone shows the state too */
  .scr-room { grid-template-columns: 16ch minmax(0, 1fr) 2.5ch; }
  .scr-room-state { display: block; }
}

/* ── The three signals are layers: say so ─────────────────────────────────────
   Beside the ring, the three layer names in the colour of their third (lit when
   the signal is won). The layer of the room the player is in is marked on the
   ring and on its name, and the console's strip shows it next to the room. */
.signal-bar { gap: 7px; }
.signal-names { display: flex; gap: 6px; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; }
.signal-name { color: #a89c88; padding: 1px 3px; border-radius: 2px; border: 1px solid transparent; }
.signal-name.got[data-layer="ARIA"] { color: #41ff72; text-shadow: 0 0 6px rgba(65, 255, 114, 0.6); }
.signal-name.got[data-layer="ZERO"] { color: #5cd6ff; text-shadow: 0 0 6px rgba(92, 214, 255, 0.6); }
.signal-name.got[data-layer="84"]   { color: #ffb000; text-shadow: 0 0 6px rgba(255, 176, 0, 0.6); }
.signal-name.is-room { border-color: currentColor; }
.signal-name.is-room:not(.got)[data-layer="ARIA"] { color: #2f9c50; }
.signal-name.is-room:not(.got)[data-layer="ZERO"] { color: #3f93b0; }
.signal-name.is-room:not(.got)[data-layer="84"]   { color: #b07c12; }
.signal-ring .signal-seg.is-room:not(.got)[data-layer="ARIA"] { stroke: #2f9c50; }
.signal-ring .signal-seg.is-room:not(.got)[data-layer="ZERO"] { stroke: #3f93b0; }
.signal-ring .signal-seg.is-room:not(.got)[data-layer="84"]   { stroke: #b07c12; }
.signal-ring .signal-seg.is-room { stroke-width: 5.5; }
@media (max-width: 720px) {
  .signal-names { display: none; }        /* no room in the phone's header: the ring and the count stay */
}
@media (min-width: 721px) {
  .status-line .sl-layer {
    flex: 0 0 auto;
    padding: 1px 6px;
    border: 1px solid currentColor;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
  }
  .status-line .sl-layer[data-layer="ARIA"] { color: #41ff72; }
  .status-line .sl-layer[data-layer="ZERO"] { color: #5cd6ff; }
  .status-line .sl-layer[data-layer="84"]   { color: #ffb000; }
  .status-line .sl-layer:not(.is-won) { opacity: 0.85; }
}

/* ── The console's ink follows the floor ──────────────────────────────────────
   Green phosphor everywhere wore thin, most of all on the modern floors: it is
   the mainframe's colour, and floor 0's (1985-2000). Every other floor writes
   in a light tint of its own colour — bright enough to keep the contrast of the
   green on the washed console. Errors stay red and successes amber on all of
   them; the machines with the keyboard on, the core and the Black Room keep
   their own inks. */
.app-shell { --floor-ink: #41ff72; --floor-ink-soft: #9cffb5; --floor-ink-dim: #1fde45; }
.app-shell:has(#screenFrame[data-floor="5"])  { --floor-ink: #ffb3ea; --floor-ink-soft: #ffd9f4; --floor-ink-dim: #e58fd0; }
.app-shell:has(#screenFrame[data-floor="4"])  { --floor-ink: #7cf0c0; --floor-ink-soft: #c2ffe6; --floor-ink-dim: #4fd3a0; }
.app-shell:has(#screenFrame[data-floor="3"])  { --floor-ink: #c4b3ff; --floor-ink-soft: #e3daff; --floor-ink-dim: #a08df0; }
.app-shell:has(#screenFrame[data-floor="2"])  { --floor-ink: #f2d3c8; --floor-ink-soft: #fff0ea; --floor-ink-dim: #d9a99a; }
.app-shell:has(#screenFrame[data-floor="1"])  { --floor-ink: #8fdcf5; --floor-ink-soft: #cdf2ff; --floor-ink-dim: #5fc0e0; }
.app-shell:has(#screenFrame[data-floor="b"])  { --floor-ink: #ffc861; --floor-ink-soft: #ffe3a8; --floor-ink-dim: #e0a030; }
.app-shell:has(#screenFrame[data-floor="b2"]) { --floor-ink: #ead9b8; --floor-ink-soft: #fff3d9; --floor-ink-dim: #c9b38a; }
.terminal-panel:not([class*="-emulator"]):not(.room-core):not(.room-blackroom) {
  --room-fg: var(--floor-ink);
  --room-soft: var(--floor-ink-soft);
  --room-glow: color-mix(in srgb, var(--floor-ink) 14%, transparent);
  --green: var(--floor-ink);
  --green-soft: var(--floor-ink-soft);
  --muted: var(--floor-ink-dim);
  --hud-fg: var(--floor-ink-soft);
  --hud-accent: var(--floor-ink);
  --hud-dim: var(--floor-ink-dim);
  --border: color-mix(in srgb, var(--floor-hue) 60%, #1a1a1a);
  --hud-border: color-mix(in srgb, var(--floor-hue) 55%, #141414);
}

/* ── Console lines coloured by parts (ui/colorize.js), like `ls --color` ───────
   Fixed hues, the ones a shell uses, so they mean the same on every floor: a
   directory is blue and a script green whatever the floor's ink is. All light
   enough for the washed console. Errors, ARIA and successes keep their line colour. */
.terminal-output {
  --tk-blue: #7db4ff; --tk-green: #5dff8f; --tk-yellow: #ffd866; --tk-cyan: #6fe3ff;
  --tk-orange: #ffb86b; --tk-violet: #c9b0ff; --tk-white: #ffffff; --tk-red: #ff7070;
}
.tk-dir   { color: var(--tk-blue); font-weight: 700; }
.tk-exec  { color: var(--tk-green); font-weight: 700; }
.tk-conf  { color: var(--tk-yellow); }
.tk-doc   { color: var(--tk-white); font-weight: 700; }
.tk-log   { opacity: 0.6; }
.tk-src   { color: inherit; }
.tk-path  { color: var(--tk-cyan); }
.tk-file  { color: var(--tk-yellow); }
.tk-str   { color: var(--tk-orange); }
.tk-flag  { color: var(--tk-violet); }
.tk-arg   { color: var(--tk-orange); font-style: italic; }
.tk-host  { color: var(--tk-green); }
.tk-err   { color: var(--tk-red); font-weight: 700; }
.tk-warn  { color: var(--tk-yellow); font-weight: 700; }
.tk-hint  { color: var(--tk-cyan); font-weight: 700; }
.tk-ok    { color: var(--tk-green); font-weight: 700; }
.tk-comment { opacity: 0.72; font-style: italic; }
.tk-user  { color: var(--tk-green); font-weight: 700; }
.tk-cwd   { color: var(--tk-blue); font-weight: 700; }
.tk-cmd   { color: var(--tk-white); font-weight: 700; }
/* inside an error line the tokens stay red: only its label stands out */
.line-error :is(.tk-hint, .tk-warn) { text-decoration: none; }

/* the idle nudge points at the next step instead of printing a hint in the
   console: the strip's step and the guide's key glow for a moment, and leave
   nothing behind (ui/DrawerLayout.js) */
@keyframes tq-nudge {
  0%, 100% { text-shadow: none; filter: none; }
  20%, 60% { text-shadow: 0 0 9px var(--amb); filter: brightness(1.5); }
  40%, 80% { text-shadow: 0 0 2px var(--amb); filter: brightness(1.1); }
}
.status-line.is-nudging .sl-step { animation: tq-nudge 4s ease-in-out; color: var(--amb-soft); }
.status-line.is-nudging .sl-more { animation: tq-nudge 4s ease-in-out; }
@media (prefers-reduced-motion: reduce) {
  .status-line.is-nudging :is(.sl-step, .sl-more) { animation: none; outline: 1px solid var(--amb); outline-offset: 2px; }
}
/* a standing tip under the mission objective (the guide, in MAIN) */
.side-tip { margin: 8px 0 0; font-size: 0.78rem; color: var(--amb-dim, #c9b596); }
.side-tip code { color: var(--amb-soft); }

/* a blank line in the console had no height at all, so the paragraphs of a
   README came out glued together: half a line of air, not a whole one, so the
   blank lines printed around every move do not eat the scrollback */
.terminal-output .terminal-line:empty { height: 0.6em; }

/* ── Corridor screen (floor 0's two wings): its doors as cards ────────────────
   The lift's cards hang under their floor's row, so they have no top edge; here
   they stand alone. The way back to the lift is told apart from the rooms. */
.main-panel[data-screen="corridor"] .scr-cards {
  border-top: 1px solid var(--hud-accent);
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));   /* seven doors in one row on a desktop */
  margin-top: 8px;
}
.main-panel[data-screen="corridor"] .scr-card { padding: 8px 11px 9px; }
.scr-card.is-lift { border-style: dashed; border-left-style: solid; border-left-color: var(--amb); }
.scr-card.is-lift .scr-card-name { color: var(--amb); }

/* ── Floor plan (`map`): the floor from above ─────────────────────────────────
   Cells on a grid, doors as lines. Colour says three things and no more: the
   stripe is the room's layer, the icon its state, the lit box where you are. */
.map-screen[data-screen="plan"] { width: min(100%, 1280px); }
.pl-stage { overflow: auto; padding: 6px 0 2px; text-align: center; }
.pl-svg { max-width: 100%; height: auto; font-family: var(--font-terminal, "Courier New", monospace); }
.pl-link { stroke: #8a7a52; stroke-width: 2; stroke-linecap: round; }
.pl-link.is-extra { stroke-dasharray: 5 5; opacity: 0.7; }
.pl-box { fill: #14110b; stroke: #6f6344; stroke-width: 1.5; }
.pl-corridor .pl-box { fill: #1d1a12; stroke: #8a7a52; stroke-dasharray: none; }
.pl-lift .pl-box { fill: #1c1608; stroke: #ffb000; stroke-width: 2; }
.pl-shaft { fill: none; stroke: #ffb000; stroke-width: 1; opacity: 0.55; }
.pl-name { fill: #f1e6c8; font-size: 16px; font-weight: 700; letter-spacing: 0.06em; }
.pl-corridor .pl-name { fill: #cdbb8c; font-size: 12px; letter-spacing: 0.22em; }
.pl-lift .pl-name { fill: #ffd27a; }
.pl-sub { fill: #a89a74; font-size: 10.5px; letter-spacing: 0.12em; }
.pl-state { fill: #8d866f; font-size: 14px; }
.pl-layer { fill: #6f6344; }
.pl-cell[data-layer="ARIA"] .pl-layer { fill: #41ff72; }
.pl-cell[data-layer="ZERO"] .pl-layer { fill: #5cd6ff; }
.pl-cell[data-layer="84"] .pl-layer { fill: #ffb000; }
.pl-cell.is-online .pl-box { stroke: #41ff72; fill: #0f1c12; }
.pl-cell.is-online .pl-state { fill: #41ff72; }
.pl-cell.is-locked .pl-box { stroke: #b85050; stroke-dasharray: 5 4; }
.pl-cell.is-locked :is(.pl-name, .pl-state) { fill: #ff8a8a; }
.pl-cell.is-here .pl-box { fill: #3a2a0c; stroke: #ffd27a; stroke-width: 2.5; }
.pl-cell.is-here :is(.pl-name, .pl-sub) { fill: #fff1d0; }
.pl-cell.is-here .pl-box { animation: pl-here 1.6s ease-in-out infinite; }
@keyframes pl-here { 50% { stroke-opacity: 0.35; } }
.pl-cell.is-door { cursor: pointer; }
.pl-cell.is-door .pl-box { stroke: #ffb000; }
.pl-cell.is-door:is(:hover, :focus-visible) .pl-box { fill: #2a2110; }
.pl-cell:focus-visible { outline: none; }
.pl-cell.is-door:focus-visible .pl-box { stroke-width: 3; }
.pl-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center; margin: 8px 0 2px; font-size: 0.72rem; color: #a89a74; letter-spacing: 0.06em; }
.pl-key i { display: inline-block; width: 5px; height: 12px; margin-right: 6px; vertical-align: -2px; border-radius: 2px; background: #6f6344; }
.pl-key.is-app i { background: #41ff72; }
.pl-key.is-data i { background: #5cd6ff; }
.pl-key.is-infra i { background: #ffb000; }
.pl-key:not(.is-app, .is-data, .is-infra) i { display: none; }
@media (prefers-reduced-motion: reduce) { .pl-cell.is-here .pl-box { animation: none; } }

/* ── Credits roll ─────────────────────────────────────────────────────────────
   A Spanish 8-bit game signing its work: black screen, capitals, the bright
   colours of a home micro — cyan for the trade, yellow for the name. */
.credits-overlay {
  position: fixed;
  inset: 0;
  z-index: 3300;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #000;
  color: #fff;
  font-family: var(--font-terminal);
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
}
.credits-overlay.hidden { display: none; }
.credits-stage { position: relative; overflow: hidden; }
.credits-roll {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  padding: 0 16px;
  animation: credits-roll 46s linear forwards;
}
/* from below the screen to the last lines resting in its middle */
@keyframes credits-roll { to { transform: translateY(calc(-100% - 38vh)); } }
.credits-presents { margin: 0 0 14px; color: #00d7d7; font-size: 0.95rem; letter-spacing: 0.3em; }
.credits-title {
  margin: 0 0 9vh;
  color: #ffff00;
  font-size: clamp(1.7rem, 5.2vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-shadow: 4px 4px 0 #d70000;
}
.credits-row { margin: 0 0 6.5vh; }
.credits-trade { margin: 0 0 8px; color: #00d7d7; font-size: clamp(0.8rem, 1.5vw, 1.05rem); letter-spacing: 0.32em; }
.credits-name { margin: 0; text-transform: none; color: #ffff00; font-size: clamp(1.15rem, 2.9vw, 2rem); font-weight: 700; letter-spacing: 0.12em; }
.credits-row.is-machine .credits-name { color: #00ff00; }
.credits-row.is-thanks .credits-name { color: #fff; }
.credits-made { margin: 10vh 0 12px; color: #ff00ff; font-size: clamp(0.95rem, 2vw, 1.3rem); font-weight: 700; letter-spacing: 0.4em; }
.credits-copy { margin: 0 0 9vh; text-transform: none; color: #c0c0c0; font-size: clamp(0.68rem, 1.2vw, 0.88rem); letter-spacing: 0.12em; }
.credits-end { margin: 0; color: #ffff00; font-size: clamp(1.4rem, 3.4vw, 2.4rem); font-weight: 700; letter-spacing: 0.5em; }
.credits-skip { margin: 0; padding: 10px 0 14px; color: #6f6f6f; font-size: 0.72rem; letter-spacing: 0.3em; }
.credits-overlay.is-done .credits-skip { color: #fff; animation: credits-blink 1s steps(1) infinite; }
@keyframes credits-blink { 50% { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  /* no roll: the whole list, to be read at its own pace */
  .credits-stage { overflow: auto; }
  .credits-roll { position: static; padding: 8vh 16px; animation: none; }
  .credits-overlay.is-done .credits-skip { animation: none; }
}

/* the intro's own credits block links to the full roll */
.credits-link {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--amb, #ffb000);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.credits-link:hover, .credits-link:focus-visible { color: #fff1d0; text-decoration: underline; outline: none; }

/* ── Ranking (specs/024, specs/025) ──────────────────────────────────────── */
.intro-ranking-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin-top: 14px;
}
.intro-ranking-row[hidden] { display: none; }
.intro-declare {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  cursor: pointer;
  font-size: 0.85rem;
}
.intro-declare input { width: 18px; height: 18px; accent-color: var(--hud-accent); }
.intro-declare-hint { opacity: 0.75; }

.ranking-overlay {
  position: fixed;
  inset: 0;
  z-index: 3300;
  display: grid;
  place-items: safe center;
  overflow-y: auto;
  padding: 18px;
  background: rgba(6, 8, 11, 0.95);
}
.ranking-overlay.hidden { display: none; }
.ranking-box {
  display: grid;
  gap: 12px;
  width: min(100%, 720px);
  padding: 18px;
  border: 1px solid var(--hud-border);
  border-radius: 10px;
  background: #080b0f;
  color: var(--hud-fg);
  font-family: "Courier New", monospace;
}
.ranking-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ranking-title { margin: 0; color: var(--hud-accent); font-size: 1.05rem; letter-spacing: 0.2em; }
.ranking-close { width: 38px; height: 38px; padding: 0; }
.ranking-notice { margin: 0; color: var(--hud-accent); font-size: 0.9rem; }
.ranking-notice:empty { display: none; }
.ranking-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.ranking-tab { min-height: 36px; padding: 6px 14px; letter-spacing: 0.08em; }
.ranking-tab[aria-pressed="true"] {
  border-color: var(--hud-accent);
  color: #06080b;
  background: var(--hud-accent);
}
.ranking-board { min-height: 96px; overflow-x: auto; }
.ranking-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ranking-caption { padding-bottom: 6px; text-align: left; opacity: 0.8; font-size: 0.8rem; letter-spacing: 0.12em; }
.ranking-table th,
.ranking-table td { padding: 6px 8px; border-bottom: 1px solid var(--hud-border); text-align: left; }
.ranking-table th { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; }
.ranking-pos { width: 3ch; }
.ranking-time,
.ranking-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ranking-alias { overflow-wrap: anywhere; }
.ranking-subtitle { margin: 6px 0 4px; color: var(--hud-accent); font-size: 0.82rem; letter-spacing: 0.16em; }
.ranking-dim { margin: 0; opacity: 0.8; font-size: 0.85rem; line-height: 1.45; }
.ranking-warn { margin: 0; color: #ffb454; font-size: 0.9rem; line-height: 1.45; }
.ranking-rule-list { margin: 0 0 8px; padding-left: 1.4em; font-size: 0.85rem; line-height: 1.5; }
.ranking-rule-list li:first-child { font-weight: 700; }
.ranking-mine { margin: 0 0 6px; padding: 0; list-style: none; font-size: 0.85rem; line-height: 1.6; }
.ranking-mine li.is-unverified,
.ranking-mine li.is-review { opacity: 0.75; }
.ranking-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.ranking-btn { min-height: 36px; padding: 6px 14px; }
.ranking-btn.is-danger { border-color: #c96a6a; color: #ffb0b0; }

.ranking-privacy { justify-self: start; color: var(--hud-accent); font-size: 0.8rem; }

.intro-declare-rule {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  opacity: 0.85;
}

/* ── ARIA's trial (specs/026) ────────────────────────────────────────────── */
.trial-overlay {
  position: fixed;
  inset: 0;
  z-index: 3250;
  display: grid;
  place-items: safe center;
  overflow-y: auto;
  padding: 18px;
  background: rgba(4, 5, 7, 0.97);
}
.trial-overlay.hidden { display: none; }
.trial-box {
  display: grid;
  gap: 16px;
  justify-items: center;
  width: min(100%, 560px);
  padding: 22px 18px;
  border: 1px solid #a33;
  border-radius: 10px;
  background: #0b0606;
  color: #ffd9d9;
  font-family: "Courier New", monospace;
  text-align: center;
}
.trial-title { margin: 0; color: #ff5a5a; font-size: 0.95rem; letter-spacing: 0.16em; }
.trial-say { margin: 0; min-height: 3em; font-size: 0.98rem; line-height: 1.5; }
.trial-stage {
  display: grid;
  place-items: center;
  width: 160px;
  height: 160px;
  border: 1px solid #5a1f1f;
  border-radius: 8px;
  color: #ff6b6b;
  font-size: 96px;
  line-height: 1;
}
.trial-stage.is-new { animation: trial-blink 0.12s linear; }
@keyframes trial-blink { from { opacity: 0.2; } to { opacity: 1; } }
.trial-pad {
  width: 100%;
  min-height: 96px;
  border: 2px solid #ff5a5a;
  border-radius: 10px;
  background: #1a0a0a;
  color: #ffd9d9;
  font: 700 1.3rem/1 "Courier New", monospace;
  letter-spacing: 0.3em;
  touch-action: manipulation;
}
.trial-pad[hidden], .trial-options[hidden] { display: none; }
.trial-pad.is-down { background: #ff5a5a; color: #0b0606; }
.trial-options { display: grid; gap: 14px; justify-items: center; }
.trial-sound { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 0.85rem; cursor: pointer; }
.trial-sound input { width: 18px; height: 18px; accent-color: #ff5a5a; }
.trial-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.trial-btn { min-height: 40px; padding: 8px 22px; letter-spacing: 0.12em; }
.trial-btn.is-quiet { border-color: #5a3a3a; color: #d7b6b6; letter-spacing: 0.04em; }
@media (prefers-reduced-motion: reduce) {
  .trial-stage.is-new { animation: none; }
}
.trial-target { margin: 0 0.15em; color: #ff6b6b; font-size: 1.7em; line-height: 1; vertical-align: -0.12em; }
