/* ============================================================
   SIGNAL LOST — shared styles (stage, overlays, keypad, tokens)
   ============================================================ */

:root {
  --steel-900: #0b0f14;
  --steel-800: #131a22;
  --steel-700: #1c2530;
  --steel-600: #2a3644;
  --steel-500: #3b4a5c;
  --steel-300: #7b8ea3;

  --glow-cyan: #4be3ff;
  --glow-cyan-dim: #1b7d92;
  --glow-amber: #ffb347;
  --glow-amber-dim: #8a5a1d;
  --glow-green: #59ff9c;
  --glow-red: #ff5e5e;

  --paper: #e8ddc0;
  --paper-ink: #2b2418;

  --font-display: "Chakra Petch", "Avenir Next Condensed", sans-serif;
  --font-mono: "Share Tech Mono", "SF Mono", Menlo, monospace;

  --stage-w: 1280;
  --stage-h: 720;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: #05070a;
  overflow: hidden;
  font-family: var(--font-display);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- stage scaling ---------- */

.viewport {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage {
  position: relative;
  flex: none; /* flexbox must never shrink the fixed logical stage */
  width: 1280px;
  height: 720px;
  transform-origin: center center;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.9);
}

.room { position: absolute; inset: 0; }

/* subtle CRT scanlines over everything */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.14) 0px,
    rgba(0, 0, 0, 0.14) 1px,
    transparent 1px,
    transparent 4px
  );
  z-index: 90;
}

.rotate-prompt {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #05070a;
  color: #dfe8f2;
  text-align: center;
  padding-top: 40vh;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
}
@media (orientation: portrait) and (max-width: 700px) {
  .rotate-prompt { display: block; }
}

/* ---------- generic hardware bits ---------- */

.rivet {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5c6c80, #1a222c 70%);
  box-shadow: inset 0 -1px 2px rgba(0,0,0,.8), 0 1px 1px rgba(255,255,255,.08);
}

.plate-label {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.22em;
  font-size: 11px;
  color: var(--steel-300);
  text-transform: uppercase;
}

.device { position: absolute; }

/* ---------- intro / completed overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 9, 0.92);
  transition: opacity 0.5s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

.briefing {
  width: 640px;
  max-width: 88%;
  border: 1px solid var(--glow-cyan-dim);
  background:
    linear-gradient(rgba(75, 227, 255, 0.04), rgba(75, 227, 255, 0.01)),
    var(--steel-800);
  padding: 42px 48px 36px;
  position: relative;
  box-shadow: 0 0 40px rgba(75, 227, 255, 0.12);
}
.briefing::before {
  content: "";
  position: absolute;
  top: 10px; left: 10px; right: 10px; bottom: 10px;
  border: 1px dashed rgba(123, 142, 163, 0.35);
  pointer-events: none;
}
.briefing .transmission {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--glow-cyan);
  letter-spacing: 0.3em;
  margin-bottom: 14px;
}
.briefing h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #eef4fa;
  margin-bottom: 4px;
}
.briefing h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.34em;
  color: var(--glow-amber);
  margin-bottom: 20px;
  text-transform: uppercase;
}
.briefing p {
  font-size: 15px;
  line-height: 1.65;
  color: #b9c7d6;
  margin-bottom: 12px;
}
.briefing .warn {
  font-family: var(--font-mono);
  color: var(--glow-red);
  font-size: 13px;
  letter-spacing: 0.12em;
  margin: 18px 0 24px;
}
.start-btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3em;
  padding: 14px 44px 14px 52px;
  color: #06131a;
  background: var(--glow-cyan);
  border: none;
  cursor: pointer;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 30px rgba(75, 227, 255, 0.5); }
.start-btn:active { transform: translateY(1px); }

.completed .briefing { border-color: var(--glow-green); box-shadow: 0 0 60px rgba(89, 255, 156, 0.18); }
.completed .escaped-title {
  font-size: 52px;
  letter-spacing: 0.06em;
  color: var(--glow-green);
  text-shadow: 0 0 24px rgba(89, 255, 156, 0.6);
  margin-bottom: 14px;
}

/* ---------- shared: letter keypad ---------- */

.keypad {
  background: linear-gradient(180deg, var(--steel-600), var(--steel-700));
  border: 2px solid #0a0e13;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 24px rgba(0,0,0,.55);
  padding: 14px 16px 16px;
}
.keypad .plate-label { display: block; text-align: center; margin-bottom: 8px; }
.keypad .readout {
  font-family: var(--font-mono);
  text-align: center;
  font-size: 22px;
  letter-spacing: 0.42em;
  padding: 5px 0 3px 8px;
  margin-bottom: 12px;
  color: var(--glow-green);
  background: #050c08;
  border-radius: 4px;
  border: 1px solid #000;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.9);
  min-height: 34px;
  text-shadow: 0 0 8px rgba(89,255,156,.7);
}
.keypad .keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.keypad .key {
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: #dfe8f2;
  background: radial-gradient(circle at 35% 30%, #46586e, #16202b 75%);
  box-shadow: 0 4px 0 #05080c, inset 0 1px 1px rgba(255,255,255,.18);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.keypad .key:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #05080c, inset 0 1px 1px rgba(255,255,255,.1);
}

/* ---------- mute button ---------- */
.mute-btn {
  position: absolute;
  right: 12px; top: 10px;
  z-index: 95;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--steel-300);
  background: rgba(10, 14, 19, 0.7);
  border: 1px solid var(--steel-500);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
}
.mute-btn:hover { color: #dfe8f2; }
