/* ═══════════════════════════════════════════════════════
   DEAD AIR · VHS / CRT Terminal Stylesheet v2.0
   Phosphor green on black · Scanlines · Glitch effects
   + Menu system · Timer · Corruption · Viral effects
═══════════════════════════════════════════════════════ */

/* ── FONTS & BASE ──────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

:root {
  --phosphor:     #00ff41;
  --phosphor-dim: #007a1f;
  --phosphor-glow:#00ff4155;
  --red-alert:    #ff2a2a;
  --amber:        #ffb000;
  --bg:           #000000;
  --bg-panel:     #010601;
  --border:       #0a2a0a;
  --normal-col:   #00cc33;
  --anomaly-col:  #ff3030;
  --dead-col:     #888888;
  --scan-alpha:   rgba(0,0,0,0.18);
  --font:         'Courier New', Courier, monospace;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--phosphor);
  font-family: var(--font);
  font-size: 13px;
  cursor: default;
  user-select: none;
}

/* ── CRT EFFECTS LAYER ─────────────────────────────── */
#scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--scan-alpha) 2px,
    var(--scan-alpha) 4px
  );
  pointer-events: none;
  z-index: 900;
}

#crt-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 901;
  opacity: 0.4;
}

/* CRT vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 50%,
    transparent 60%,
    rgba(0, 0, 0, 0.75) 100%
  );
  pointer-events: none;
  z-index: 902;
}

/* ── PHOSPHOR TEXT GLOW ─────────────────────────────── */
.glow {
  text-shadow:
    0 0 6px var(--phosphor),
    0 0 16px rgba(0,255,65,0.4);
}

/* ── ANIMATIONS ─────────────────────────────────────── */
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.blink-text  { animation: blink 1.1s step-end infinite; }
.blink-cursor{ animation: blink 0.7s step-end infinite; font-size:14px; }

@keyframes rec-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.1; }
}
.rec-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red-alert);
  box-shadow: 0 0 6px var(--red-alert);
  animation: rec-blink 1.4s ease-in-out infinite;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-1 { animation: fadeIn 0.8s ease forwards; }
.fade-2 { animation: fadeIn 0.8s ease 0.6s forwards; opacity: 0; }
.fade-3 { animation: fadeIn 0.8s ease 1.2s forwards; opacity: 0; }
.fade-4 { animation: fadeIn 0.8s ease 2.2s forwards; opacity: 0; }

/* Glitch effect */
@keyframes glitch-clip {
  0%,100% { clip-path: none; transform: none; filter: none; }
  92%  { clip-path: inset(5% 0 82% 0);  transform: translateX(-5px); filter: hue-rotate(90deg); }
  93%  { clip-path: inset(65% 0 10% 0); transform: translateX(5px);  filter: hue-rotate(-90deg); }
  94%  { clip-path: none; transform: translateX(-2px); filter: none; }
  95%  { clip-path: inset(30% 0 50% 0); transform: translateX(3px); }
  96%  { clip-path: none; transform: none; }
}
@keyframes glitch-color {
  0%,100% { text-shadow: 0 0 6px var(--phosphor), 0 0 16px rgba(0,255,65,0.4); }
  50% {
    text-shadow:
      3px 0 0 rgba(255,0,0,0.7),
      -3px 0 0 rgba(0,0,255,0.7),
      0 0 6px var(--phosphor);
  }
}

body.glitching #game-screen {
  animation: glitch-clip 0.5s steps(1) forwards;
}
body.glitching .phosphor-text {
  animation: glitch-color 0.3s steps(2) forwards;
}

/* NEW: Heavy glitch — more intense, longer */
@keyframes heavy-glitch-clip {
  0%   { clip-path: none; transform: none; }
  5%   { clip-path: inset(8% 0 85% 0);  transform: translateX(-8px) skewX(-2deg); }
  10%  { clip-path: inset(50% 0 30% 0); transform: translateX(6px) skewX(1deg); }
  15%  { clip-path: inset(15% 0 70% 0); transform: translateX(-4px); }
  20%  { clip-path: none; transform: translateX(3px) skewX(-1deg); }
  25%  { clip-path: inset(60% 0 15% 0); transform: translateX(-7px); }
  30%  { clip-path: none; transform: skewX(2deg); }
  35%  { clip-path: inset(3% 0 90% 0);  transform: translateX(10px); }
  40%  { clip-path: none; transform: none; }
  45%  { clip-path: inset(70% 0 5% 0);  transform: translateX(-5px) skewX(-3deg); }
  50%  { clip-path: none; transform: translateX(2px); }
  55%  { clip-path: inset(20% 0 60% 0); transform: translateX(-8px); }
  60%  { clip-path: none; transform: none; }
  65%  { clip-path: inset(45% 0 40% 0); transform: translateX(6px) skewX(2deg); }
  70%  { clip-path: none; transform: translateX(-3px); }
  75%  { clip-path: inset(10% 0 75% 0); transform: translateX(4px); }
  80%  { clip-path: none; transform: skewX(-1deg); }
  85%  { clip-path: inset(80% 0 5% 0);  transform: translateX(-6px); }
  90%  { clip-path: none; transform: translateX(2px); }
  95%  { clip-path: inset(35% 0 55% 0); transform: translateX(-4px) skewX(1deg); }
  100% { clip-path: none; transform: none; }
}

body.heavy-glitch #game-screen {
  animation: heavy-glitch-clip 0.8s steps(1) infinite;
  filter: saturate(1.5) contrast(1.3);
}

/* Screen flicker */
@keyframes flicker {
  0%,100% { opacity: 1; }
  92%      { opacity: 0.94; }
  93%      { opacity: 0.98; }
  94%      { opacity: 0.92; }
  95%      { opacity: 1; }
}
body { animation: flicker 8s infinite; }

/* Signal bar pulse */
@keyframes signal-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

/* ══════════════════════════════════════════════════════
   INIT & BOOT OVERLAYS
══════════════════════════════════════════════════════ */
#init-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 800; /* above menu but below CRT effects */
  cursor: pointer;
}

#init-text {
  font-size: 14px;
  letter-spacing: 0.25em;
  color: var(--phosphor);
}

#boot-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

#boot-text {
  font-family: var(--font);
  font-size: 13px;
  color: var(--phosphor);
  text-shadow: 0 0 6px var(--phosphor);
  white-space: pre-line;
  letter-spacing: 0.08em;
  line-height: 2;
  max-width: 500px;
}

/* ══════════════════════════════════════════════════════
   MAIN MENU
══════════════════════════════════════════════════════ */
#menu-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 400;
  background: #000;
}

#menu-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.6; /* keep it somewhat dim so text is readable */
}

#menu-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 60px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.7); /* dark semi-transparent bg for readability */
  position: relative;
  z-index: 10;
}

#menu-title {
  font-size: 32px;
  letter-spacing: 0.5em;
  color: var(--phosphor);
  text-shadow:
    0 0 12px var(--phosphor),
    0 0 30px rgba(0,255,65,0.4),
    0 0 60px rgba(0,255,65,0.15);
  margin-bottom: 6px;
}

#menu-subtitle {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--phosphor-dim);
  margin-bottom: 20px;
}

.menu-divider {
  width: 280px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--phosphor-dim), transparent);
  margin: 8px 0;
}

.menu-btn {
  display: block;
  width: 220px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--phosphor-dim);
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0.25em;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.menu-btn:hover {
  border-color: var(--phosphor);
  color: var(--phosphor);
  background: rgba(0,255,65,0.04);
  text-shadow: 0 0 8px var(--phosphor);
  box-shadow: 0 0 12px var(--phosphor-glow);
  transform: translateX(4px);
}

.menu-btn:active {
  transform: translateX(2px);
  background: rgba(0,255,65,0.08);
}

#menu-footer {
  margin-top: 20px;
  font-size: 8px;
  letter-spacing: 0.2em;
  color: #0a2a0a;
}

#exit-message {
  position: absolute;
  bottom: -30px;
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--anomaly-col);
  text-shadow: 0 0 8px var(--anomaly-col);
  animation: fadeIn 0.4s ease;
}

/* ══════════════════════════════════════════════════════
   SETTINGS PANEL
══════════════════════════════════════════════════════ */
#settings-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 410;
}

#settings-box {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 320px;
  padding: 30px 40px;
  border: 1px solid var(--border);
  background: rgba(0,255,65,0.008);
}

#settings-box .settings-title {
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--phosphor);
  text-shadow: 0 0 8px var(--phosphor);
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--phosphor-dim);
  min-width: 80px;
}

.settings-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.settings-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--phosphor-dim);
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.12s;
}

.settings-btn:hover {
  border-color: var(--phosphor);
  color: var(--phosphor);
  background: rgba(0,255,65,0.04);
}

.settings-btn.active {
  border-color: var(--phosphor);
  color: var(--phosphor);
  background: rgba(0,255,65,0.08);
  text-shadow: 0 0 6px var(--phosphor);
}

/* Volume slider — styled to match CRT aesthetic */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 6px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor);
  cursor: pointer;
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor);
  cursor: pointer;
  border: none;
}

/* ══════════════════════════════════════════════════════
   DONATE POPUP
══════════════════════════════════════════════════════ */
#donate-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 420;
}

#donate-popup-box {
  border: 1px solid var(--phosphor-dim);
  padding: 30px 40px;
  background: var(--bg);
  text-align: center;
  max-width: 360px;
}

#donate-popup-msg {
  font-size: 12px;
  letter-spacing: 0.12em;
  line-height: 2;
  color: var(--phosphor);
  text-shadow: 0 0 6px var(--phosphor);
  white-space: pre-line;
  margin-bottom: 20px;
}

#donate-popup-close {
  background: transparent;
  border: 1px solid var(--phosphor-dim);
  color: var(--phosphor-dim);
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.15em;
  padding: 6px 20px;
  cursor: pointer;
  transition: all 0.12s;
}
#donate-popup-close:hover {
  border-color: var(--phosphor);
  color: var(--phosphor);
}

/* ══════════════════════════════════════════════════════
   INTRO SCREEN
══════════════════════════════════════════════════════ */
#intro-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: var(--bg);
}

#intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  text-align: center;
}

.intro-line {
  font-size: 15px;
  letter-spacing: 0.22em;
  color: var(--phosphor);
  text-shadow: 0 0 8px var(--phosphor), 0 0 20px rgba(0,255,65,0.3);
}
.intro-line.dim   { color: var(--phosphor-dim); font-size: 12px; letter-spacing:0.15em; }
.intro-line.small { font-size: 11px; letter-spacing: 0.12em; color: var(--phosphor-dim); }
.intro-line.instructions {
  font-size: 11px;
  letter-spacing: 0.08em;
  line-height: 1.9;
  color: var(--phosphor-dim);
  border: 1px solid var(--border);
  padding: 12px 20px;
  margin-top: 6px;
}

.intro-divider {
  width: 300px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--phosphor-dim), transparent);
  margin: 4px 0;
}

.c-normal  { color: var(--normal-col);  }
.c-anomaly { color: var(--anomaly-col); }
.c-dead    { color: var(--dead-col);    }

#intro-footer {
  position: absolute;
  bottom: 20px;
  font-size: 9px;
  letter-spacing: 0.25em;
  color: #0a2a0a;
  transition: color 0.8s;
}

/* ══════════════════════════════════════════════════════
   VHS HEADER
══════════════════════════════════════════════════════ */
#vhs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: #000;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.18em;
  flex-shrink: 0;
  color: var(--phosphor-dim);
}

#rec-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--red-alert);
  font-size: 10px;
  letter-spacing: 0.1em;
}

#vhs-time { color: var(--phosphor); font-size: 11px; }

/* ══════════════════════════════════════════════════════
   GAME LAYOUT
══════════════════════════════════════════════════════ */
#game-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#game-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

.panel-title {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--phosphor-dim);
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

/* ── LEFT: LOG PANEL ─────────────────────────────────── */
#log-panel {
  width: 210px;
  min-width: 210px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#log-entries {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.log-entry {
  font-size: 10px;
  letter-spacing: 0.05em;
  border-left: 2px solid var(--phosphor-dim);
  padding: 5px 7px;
  background: rgba(0,255,65,0.02);
  animation: fadeIn 0.3s ease;
}
.log-entry.log-normal  { border-color: var(--normal-col); }
.log-entry.log-anomaly { border-color: var(--anomaly-col); }
.log-entry.log-nodead  { border-color: var(--dead-col); }

/* Phantom entries (corruption level 3) */
.log-entry.phantom-entry {
  border-color: var(--anomaly-col);
  background: rgba(255,48,48,0.04);
  animation: fadeIn 0.5s ease, blink 2s step-end infinite;
}

.log-entry .le-from   { color: var(--phosphor); font-size: 9px; letter-spacing: 0.12em; }
.log-entry .le-class  { font-size: 9px; }
.log-entry .le-normal  { color: var(--normal-col); }
.log-entry .le-anomaly { color: var(--anomaly-col); }
.log-entry .le-dead    { color: var(--dead-col); }
.log-entry .le-time    { color: var(--phosphor-dim); font-size: 8px; }

/* ── CENTER PANEL ───────────────────────────────────── */
#center-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 20px;
  overflow: hidden;
  gap: 12px;
}

/* Waveform */
#waveform-container {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  flex-shrink: 0;
}
#waveform-label, #waveform-label-r {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--phosphor-dim);
  min-width: 40px;
}
#waveform-canvas {
  flex: 1;
  height: 48px;
  display: block;
}

/* Transmission box */
#transmission-box {
  flex: 1;
  border: 1px solid var(--border);
  background: rgba(0,255,65,0.012);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

#tx-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--phosphor-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#tx-from    { color: var(--phosphor); font-size: 11px; transition: color 0.3s; }
#tx-coords  { font-size: 9px; letter-spacing: 0.12em; margin-top: 2px; }

#tx-body {
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 1.85;
  color: var(--phosphor);
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}
#tx-body.anomaly-text { color: #ccff88; }
#tx-body.self-text    { color: #e0e0e0; text-shadow: 0 0 6px rgba(255,255,255,0.3); }

#tx-cursor { color: var(--phosphor); margin-left: 1px; }
#tx-cursor.hidden { display: none; }

.static-text {
  font-size: 13px;
  color: var(--phosphor-dim);
  letter-spacing: 0.04em;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════
   CLASSIFY PANEL + TIMER
══════════════════════════════════════════════════════ */
#classify-panel {
  flex-shrink: 0;
  border: 1px solid var(--border);
  padding: 12px 16px;
  background: rgba(0,255,65,0.015);
  animation: fadeIn 0.4s ease;
  transition: border-color 0.3s, box-shadow 0.3s;
}

/* Timer urgency effects */
#classify-panel.timer-urgent {
  border-color: var(--amber);
  box-shadow: 0 0 8px rgba(255,176,0,0.15);
}
#classify-panel.timer-critical {
  border-color: var(--red-alert);
  box-shadow: 0 0 12px rgba(255,42,42,0.2);
  animation: fadeIn 0.4s ease, blink 1s step-end infinite;
}

.classify-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--phosphor-dim);
  margin-bottom: 10px;
}

#classify-buttons {
  display: flex;
  gap: 10px;
}

.btn-classify {
  flex: 1;
  background: transparent;
  border: 1px solid var(--phosphor-dim);
  color: var(--phosphor-dim);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.16em;
  padding: 9px 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-classify:hover {
  border-color: var(--phosphor);
  color: var(--phosphor);
  background: rgba(0,255,65,0.06);
  text-shadow: 0 0 8px var(--phosphor);
  box-shadow: 0 0 10px var(--phosphor-glow);
}
#btn-anomaly:hover {
  border-color: var(--anomaly-col);
  color: var(--anomaly-col);
  background: rgba(255,48,48,0.08);
  text-shadow: 0 0 8px var(--anomaly-col);
  box-shadow: 0 0 10px rgba(255,48,48,0.3);
}
#btn-nodead:hover {
  border-color: var(--dead-col);
  color: var(--dead-col);
  background: rgba(136,136,136,0.08);
  text-shadow: none;
}

/* ── TIMER BAR ──────────────────────────────────────── */
#timer-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

#timer-label {
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--phosphor-dim);
  min-width: 40px;
}

#timer-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  overflow: hidden;
}

#timer-bar-fill {
  height: 100%;
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor);
  transition: width 1s linear, background 0.5s, box-shadow 0.5s;
  width: 100%;
}

#timer-text {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--phosphor-dim);
  min-width: 24px;
  text-align: right;
}

/* ── RIGHT: STATUS PANEL ────────────────────────────── */
#status-panel {
  width: 185px;
  min-width: 185px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  padding: 14px 12px;
  overflow-y: auto;
  font-size: 11px;
}

.station-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--phosphor-dim);
  border-bottom: 1px solid rgba(0,255,65,0.05);
}
.station-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--phosphor-dim);
  flex-shrink: 0;
  animation: signal-pulse 2s ease-in-out infinite;
}
.station-item.active   .station-dot { background: var(--phosphor); box-shadow: 0 0 5px var(--phosphor); }
.station-item.anomalous .station-dot{ background: var(--anomaly-col); box-shadow: 0 0 5px var(--anomaly-col); animation: rec-blink 0.8s infinite; }
.station-item.dead     .station-dot { background: #333; animation: none; }
.station-name { flex: 1; }
.station-status { font-size: 8px; color: var(--phosphor-dim); }

/* Signal meter */
#signal-meter {
  height: 6px;
  background: var(--border);
  margin: 6px 0 3px;
  overflow: hidden;
}
#signal-bar-fill {
  height: 100%;
  background: var(--phosphor);
  box-shadow: 0 0 8px var(--phosphor);
  transition: width 1s ease;
  width: 92%;
}
#signal-pct { font-size: 9px; color: var(--phosphor-dim); text-align: right; }

#shift-progress, #anomaly-count {
  font-size: 10px;
  letter-spacing: 0.06em;
  margin-top: 6px;
}
#shift-progress span:first-child,
#anomaly-count span:first-child {
  font-size: 14px;
  color: var(--phosphor);
}
.dim { color: var(--phosphor-dim); }

/* ── STATUS BAR ─────────────────────────────────────── */
#status-bar {
  display: flex;
  justify-content: space-between;
  padding: 5px 16px;
  border-top: 1px solid var(--border);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--phosphor-dim);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   ENDING SCREEN
══════════════════════════════════════════════════════ */
#ending-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#ending-box {
  max-width: 580px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 1.2s ease forwards;
}

#ending-report-label {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--phosphor-dim);
}

#ending-title {
  font-size: 22px;
  letter-spacing: 0.2em;
  color: var(--phosphor);
  text-shadow: 0 0 12px var(--phosphor), 0 0 30px rgba(0,255,65,0.3);
}

#ending-title.end-good    { color: var(--phosphor); }
#ending-title.end-bad     { color: var(--anomaly-col); text-shadow: 0 0 12px var(--anomaly-col); }
#ending-title.end-neutral { color: var(--amber); text-shadow: 0 0 12px var(--amber); }
#ending-title.end-special {
  color: #ffffff;
  text-shadow: 0 0 12px #fff, 0 0 30px rgba(255,255,255,0.3);
  animation: glitch-color 3s infinite;
}

/* NEW: Signal Lost ending style */
#ending-title.end-signal {
  color: var(--anomaly-col);
  text-shadow: 0 0 12px var(--anomaly-col), 0 0 30px rgba(255,42,42,0.4);
  animation: heavy-glitch-clip 4s steps(1) infinite;
}

#ending-divider {
  color: var(--phosphor-dim);
  font-size: 10px;
  letter-spacing: 0.1em;
}

#ending-text {
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 2;
  color: var(--phosphor-dim);
  white-space: pre-line;
}

#ending-stats {
  font-size: 10px;
  letter-spacing: 0.1em;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  color: #0a3a0a;
}

/* ══════════════════════════════════════════════════════
   OVERLAYS (hidden message, blackout, RGB split, crash)
══════════════════════════════════════════════════════ */

/* Hidden subliminal message */
#hidden-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  letter-spacing: 0.4em;
  color: var(--anomaly-col);
  text-shadow: 0 0 20px var(--anomaly-col), 0 0 40px rgba(255,42,42,0.5);
  z-index: 950;
  pointer-events: none;
  transition: opacity 0.2s;
  font-family: var(--font);
}

/* Full screen blackout */
#blackout-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 960;
  pointer-events: none;
}

/* Screamer Overlay */
#screamer-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: #000;
}
#screamer-canvas {
  width: 100%;
  height: 100%;
}

/* Entity Canvas (behind transmission) */
#entity-canvas {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 300px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
}

/* RGB split overlay */
#rgb-split-overlay {
  position: fixed;
  inset: 0;
  z-index: 955;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    linear-gradient(90deg, rgba(255,0,0,0.06) 33%, transparent 33%, transparent 66%, rgba(0,0,255,0.06) 66%);
  animation: rgb-shift 0.15s steps(2) infinite;
}

/* Tutorial Overlay */
#tutorial-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 990;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cinematic Overlay */
#cinematic-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 995;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#cinematic-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#cinematic-text {
  position: absolute;
  bottom: 20%;
  width: 80%;
  text-align: center;
  font-size: 24px;
  line-height: 1.5;
  letter-spacing: 0.1em;
  color: var(--anomaly-col);
  text-shadow: 0 0 10px var(--anomaly-col);
  z-index: 10;
  font-weight: bold;
}

/* ══════════════════════════════════════════════════════
   VIDEO SCREAMER & PROGRESSIVE GLITCH
══════════════════════════════════════════════════════ */
#video-screamer-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999; /* Absolute top */
  display: flex;
  align-items: center;
  justify-content: center;
}

#video-screamer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* The glitching effect scales dynamically based on the JS injecting --corruption-idx */
:root {
  --corruption-idx: 0; 
}

/* Apply to main layout */
.corrupt-jitter {
  /* Using calc() to multiply the jitter/blur effect by the error count */
  animation: jitter-prog 0.1s infinite;
  filter: blur(calc(var(--corruption-idx) * 0.4px));
}

@keyframes jitter-prog {
  0% { transform: translate(calc(var(--corruption-idx) * 0.5px), calc(var(--corruption-idx) * -0.5px)); }
  50% { transform: translate(calc(var(--corruption-idx) * -1px), calc(var(--corruption-idx) * 1px)); }
  100% { transform: translate(calc(var(--corruption-idx) * 1px), calc(var(--corruption-idx) * -0.2px)); }
}

@keyframes rgb-shift {
  0%   { transform: translateX(-2px); }
  50%  { transform: translateX(2px); }
  100% { transform: translateX(-2px); }
}

/* Fake crash screen */
#crash-overlay {
  position: fixed;
  inset: 0;
  background: #000008;
  z-index: 970;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 40px;
}

#crash-text {
  font-family: var(--font);
  font-size: 13px;
  color: var(--anomaly-col);
  text-shadow: 0 0 6px var(--anomaly-col);
  white-space: pre-line;
  letter-spacing: 0.06em;
  line-height: 2;
}

/* ══════════════════════════════════════════════════════
   CORRUPTION EFFECTS (CSS classes set by corruption.js)
══════════════════════════════════════════════════════ */

/* Level 1: Mild — subtle red tint in scanlines */
body.corrupt-1 #scanlines {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(20,0,0,0.15) 2px,
    rgba(20,0,0,0.15) 4px
  );
}

/* Level 2: Medium — increased noise, flickering border */
body.corrupt-2 #crt-noise {
  opacity: 0.55;
}
body.corrupt-2 #transmission-box {
  border-color: rgba(255,42,42,0.15);
}

/* Level 3: Severe — heavy visual degradation */
body.corrupt-3 {
  animation: flicker 2s infinite, heavy-corrupt-pulse 4s infinite;
}
body.corrupt-3 #scanlines {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(40,0,0,0.22) 2px,
    rgba(40,0,0,0.22) 4px
  );
}
body.corrupt-3 #crt-noise {
  opacity: 0.7;
}
body.corrupt-3 #transmission-box {
  border-color: rgba(255,42,42,0.25);
  box-shadow: inset 0 0 20px rgba(255,0,0,0.03);
}
body.corrupt-3 #tx-body {
  text-shadow: 2px 0 0 rgba(255,0,0,0.15), -2px 0 0 rgba(0,0,255,0.15);
}

@keyframes heavy-corrupt-pulse {
  0%, 100% { filter: none; }
  50%      { filter: brightness(0.95) contrast(1.1); }
  85%      { filter: hue-rotate(5deg); }
}

/* ── UTILITY ─────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── LIFE SYSTEM ─────────────────────────────────── */
#life-counter {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  font-size: 18px;
}
.life-icon {
  color: var(--phosphor);
  text-shadow: 0 0 8px var(--phosphor-glow);
  transition: all 0.3s ease;
}
.life-lost {
  color: #112211 !important;
  text-shadow: none !important;
  transform: scale(0.8);
}
#life-status {
  font-size: 10px;
  letter-spacing: 0.2em;
  margin-top: 5px;
}

/* ── RADIO CONTROLS ───────────────────────────────── */
#radio-controls {
  margin-top: 15px;
  padding: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 20, 0, 0.2);
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.ctrl-label {
  font-size: 10px;
  color: var(--phosphor-dim);
}
#radio-controls input[type="range"] {
  appearance: none;
  background: #051505;
  height: 4px;
  border: 1px solid var(--phosphor-dim);
  width: 100%;
}
#radio-controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--phosphor);
  border: 1px solid #ffffff;
  cursor: pointer;
}

/* ── LORE INTRO ──────────────────────────────────── */
#lore-intro-screen {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 850;
}
#lore-intro-content {
  max-width: 500px;
  padding: 40px;
  border: 1px solid var(--phosphor-dim);
}
.lore-title {
  font-size: 18px;
  color: var(--phosphor);
  margin-bottom: 25px;
  letter-spacing: 0.3em;
}
.lore-body {
  font-size: 13px;
  line-height: 1.8;
  color: var(--phosphor-dim);
}

/* ── REALITY BREAK ────────────────────────────────── */
.reality-break {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.corridor-view {
  width: 400px;
  height: 400px;
  position: relative;
  overflow: hidden;
  border: 4px double var(--phosphor-dim);
  background: #000;
}
.corridor-door {
  position: absolute;
  width: 40px;
  height: 80px;
  background: #050505;
  border: 1px solid #111;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
}

