:root {
  --ui-scale: 1.4;
  --grin-size: 0.64em;
  --grin-letter: -0.02em;
  --grin-line: 1.02;
  --grin-shift-y: 6px;
}

/* ===== COMBAT HUD - HIDDEN BY DEFAULT ===== */
#vibesMeter,
#uploadMeter,
#momentumMeter,
#corruptionMeter,
#harmonicsMeter {
  display: none !important;
}

body.dev-mode #vibesMeter,
body.dev-mode #uploadMeter,
body.dev-mode #momentumMeter,
body.dev-mode #corruptionMeter,
body.dev-mode #harmonicsMeter {
  display: block !important;
}

/* ===== EXTERNAL LINKS BAR ===== */
#linkBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(180deg, 
    rgba(0, 0, 0, 0.9) 0%, 
    rgba(0, 0, 0, 0.7) 60%,
    transparent 100%);
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#linkBar .link-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: rgba(0, 20, 30, 0.85);
  border: 2px solid rgba(0, 255, 255, 0.4);
  border-radius: 5px;
  color: #00FFFF;
  font-family: 'Courier New', monospace;
  font-size: 21px;
  font-weight: bold;
  letter-spacing: 2.5px;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.2s ease;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.15), inset 0 0 20px rgba(0, 0, 0, 0.4);
}

#linkBar .link-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  border-color: rgba(0, 255, 255, 0.9);
  color: #FFFFFF;
  text-shadow: 0 0 15px rgba(0, 255, 255, 1), 0 0 30px rgba(255, 0, 255, 0.5);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.2), inset 0 0 20px rgba(0, 255, 255, 0.15);
  transform: translateY(-2px);
}

#linkBar .link-btn:active {
  transform: translateY(0);
  background: rgba(0, 255, 255, 0.3);
}

#linkBar .link-icon { font-size: 25px; opacity: 0.9; }
#linkBar .link-btn:hover .link-icon { opacity: 1; }
#linkBar .link-label { opacity: 1; }

#linkBar .link-btn.listen {
  border-color: rgba(255, 59, 209, 0.6);
  color: #ffb9ef;
  text-shadow: 0 0 10px rgba(255, 59, 209, 0.6);
  box-shadow: 0 0 12px rgba(255, 59, 209, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.4);
  animation: listenPulse 2s ease-in-out infinite;
  position: relative;
}

@keyframes listenPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 59, 209, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.4); border-color: rgba(255, 59, 209, 0.6); }
  50% { box-shadow: 0 0 25px rgba(255, 59, 209, 0.5), 0 0 40px rgba(255, 59, 209, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.4); border-color: rgba(255, 59, 209, 0.9); }
}

#linkBar .link-btn.listen::after {
  content: 'NEW';
  position: absolute;
  top: -10px;
  right: -10px;
  background: #ff3bd1;
  color: #000;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(255, 59, 209, 0.8);
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.9; }
}

#linkBar .link-btn.listen:hover {
  border-color: rgba(255, 59, 209, 1);
  color: #FFFFFF;
  text-shadow: 0 0 15px rgba(255, 59, 209, 1), 0 0 30px rgba(0, 255, 255, 0.4);
  box-shadow: 0 0 25px rgba(255, 59, 209, 0.6), 0 0 50px rgba(255, 59, 209, 0.3), inset 0 0 20px rgba(255, 59, 209, 0.15);
  animation: none;
}

#linkBar .link-btn.listen .link-icon { color: #ff3bd1; }

/* Discord button - NEW! */
#linkBar .link-btn.discord {
  border-color: rgba(88, 101, 242, 0.7);
  color: #b4bbff;
  text-shadow: 0 0 10px rgba(88, 101, 242, 0.6);
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.4);
  animation: discordPulse 2s ease-in-out infinite;
  position: relative;
}

@keyframes discordPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(88, 101, 242, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.4); border-color: rgba(88, 101, 242, 0.7); }
  50% { box-shadow: 0 0 25px rgba(88, 101, 242, 0.5), 0 0 40px rgba(88, 101, 242, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.4); border-color: rgba(88, 101, 242, 1); }
}

#linkBar .link-btn.discord::after {
  content: 'NEW';
  position: absolute;
  top: -10px;
  right: -10px;
  background: #5865F2;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(88, 101, 242, 0.8);
  animation: badgePulse 1.5s ease-in-out infinite;
}

#linkBar .link-btn.discord:hover {
  border-color: rgba(88, 101, 242, 1);
  color: #FFFFFF;
  text-shadow: 0 0 15px rgba(88, 101, 242, 1), 0 0 30px rgba(255, 229, 0, 0.3);
  box-shadow: 0 0 25px rgba(88, 101, 242, 0.6), 0 0 50px rgba(88, 101, 242, 0.3), inset 0 0 20px rgba(88, 101, 242, 0.15);
  animation: none;
}

#linkBar .link-btn.discord .link-icon { color: #5865F2; }

#linkBar .link-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  border-style: dashed;
}

body.booting #linkBar,
body:has(#startOverlay:not(.fadeOut)) #linkBar {
  opacity: 0;
  pointer-events: none;
}

body.is-mobile #linkBar { padding: 10px 12px; gap: 8px; }
body.is-mobile #linkBar .link-btn { padding: 10px 16px; font-size: 13px; gap: 6px; letter-spacing: 1.5px; }
body.is-mobile #linkBar .link-icon { font-size: 16px; }

/* ===== AUTH BUTTON IN LINKBAR ===== */
#linkBar button.link-btn {
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

#linkBar .link-btn.auth {
  border-color: rgba(255, 100, 100, 0.5);
  color: rgba(255, 100, 100, 0.8);
  text-shadow: 0 0 8px rgba(255, 100, 100, 0.4);
  gap: 8px;
}

#linkBar .link-btn.auth:hover {
  border-color: rgba(255, 100, 100, 0.9);
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 100, 100, 0.8);
  box-shadow: 0 0 20px rgba(255, 100, 100, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.4);
}

#linkBar .link-btn.auth.online {
  border-color: rgba(0, 255, 136, 0.6);
  color: rgba(0, 255, 136, 0.9);
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

#linkBar .link-btn.auth.online:hover {
  border-color: rgba(0, 255, 136, 1);
  color: #fff;
  text-shadow: 0 0 12px rgba(0, 255, 136, 0.9);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.4);
}

#linkBar .link-btn.auth .auth-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 100, 100, 0.8);
  box-shadow: 0 0 6px rgba(255, 100, 100, 0.6);
  transition: all 0.3s ease;
}

#linkBar .link-btn.auth .auth-indicator.online {
  background: rgba(0, 255, 136, 1);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.8);
  animation: authIndicatorPulse 2s ease-in-out infinite;
}

@keyframes authIndicatorPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(0, 255, 136, 0.6); }
  50% { opacity: 0.7; box-shadow: 0 0 12px rgba(0, 255, 136, 1); }
}

body.is-mobile #linkBar .link-btn.auth { padding: 10px 14px; }

/* ===== ROOT + STACK SETUP ===== */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: black;
  font-family: "Courier New", Courier, monospace;
  color: #00FFFF;
  overflow: hidden;
}

/* ===== LAYERS ===== */
#voidLayer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  background-image: url("../assets/Images/BG%201.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  transition: transform 0.3s ease-out;
}

#voidLayer::before {
  content: '';
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle at 50% 50%, rgba(255,0,180,0.06) 0%, rgba(100,0,150,0.04) 40%, transparent 70%);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 0;
  transform: translate(var(--mid-x, 0px), var(--mid-y, 0px));
  transition: transform 0.2s ease-out;
}

#voidLayer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.01) 0px, transparent 1px, transparent 3px);
  pointer-events: none;
  z-index: 2;
  transform: translate(var(--front-x, 0px), var(--front-y, 0px));
  transition: transform 0.1s ease-out;
}

.ghost-echo {
  position: absolute;
  width: 200px;
  height: 200px;
  opacity: 0.4;
  animation: echoFade 2s ease-out forwards;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 1;
  filter: blur(1px);
}

.echo-glyph {
  position: absolute;
  color: #00ffff;
  font-family: "Courier New", monospace;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 0 8px #00ffff, 0 0 16px #ff00ff;
  opacity: 0.6;
}

@keyframes echoFade {
  0% { opacity: 0.4; filter: blur(1px); transform: scale(1); }
  100% { opacity: 0; filter: blur(8px); transform: scale(0.85); }
}

#crtShell {
  position: fixed;
  inset: 0;
  background-image: url("../assets/Icons/OS%20Terminal%20Base.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  z-index: 2;
  pointer-events: none;
  /* Depth: Soft ambient shadow behind the TV frame */
  filter: drop-shadow(4px 6px 20px rgba(0, 0, 0, 0.7))
          drop-shadow(0 0 40px rgba(0, 0, 0, 0.5));
}

/* CRT Screen inner glow falloff - disabled (caused visible box) */
/* CRT Screen inner glow falloff - disabled (caused visible box) */
#crtShell::after {
  display: none;
}

/* TV Bezel micro-texture - subtle noise overlay */
#crtShell::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  mix-blend-mode: overlay;
  pointer-events: none;
}

#ghostLayer {
  position: fixed;
  inset: 0;
  z-index: 15000;
  pointer-events: none;
}

.particle {
  position: fixed;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255,229,0,0.9) 0%, rgba(255,229,0,0.2) 60%, rgba(0,0,0,0) 70%);
  box-shadow: 
    0 0 8px rgba(255,229,0,0.8),
    0 0 20px rgba(255,229,0,0.3),
    0 0 40px rgba(255,0,180,0.1);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  /* Subtle bloom onto background */
  filter: blur(0.5px);
}

/* Glyph clusters bloom effect */
.particle-field .particle {
  text-shadow: 
    0 0 10px currentColor,
    0 0 20px currentColor,
    0 0 40px rgba(0, 255, 255, 0.2);
}

/* ========================= TERMINAL WINDOW ========================== */
/* [MODIFIED] - Responsive font scaling with clamp() for readability at all sizes */
#term::-webkit-scrollbar { width: 0; height: 0; }
#term {
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
  position: fixed;
  top: 50%;
  left: 48%;  /* Shifted left to fit CRT */
  transform: translate(-50%, -50%) rotate(0.9deg);
  background: transparent;
  padding: 0 15px;
  /* Further reduced to fit inside CRT */
  width: min(48vw, 60vh * 1.15);
  height: min(46vh, 52vw * 0.75);
  max-width: 820px;
  max-height: 560px;
  overflow: hidden;
  clip-path: inset(0);
  line-height: 1.4;
  font-size: clamp(13px, 1.8vw, 22px);
  text-align: left;
  text-shadow: 0 0 8px #00FFFF;
  box-sizing: border-box;
  z-index: 5;
}

/* Scrollable inner container */
#term .term-inner {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 1.5rem 0 6rem 0;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#term .term-inner::-webkit-scrollbar {
  display: none;
}

.line { 
  margin: .15em 0; 
  text-align: left;
  width: 100%;
  max-width: 100%;
  display: block;
  box-sizing: border-box;
  /* Text wrapping */
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-all;
  /* Clip any remaining overflow */
  overflow: hidden;
  /* Temporal hierarchy: lines fade slightly over time */
  animation: lineFadeSettle 0.3s ease-out forwards;
}

@keyframes lineFadeSettle {
  from { 
    opacity: 1;
    filter: brightness(1.2);
  }
  to { 
    opacity: 1;
    filter: brightness(1);
  }
}

/* Older lines fade (applied via JS after delay) */
.line.aged {
  opacity: 0.85;
  transition: opacity 2s ease;
}

.line.very-aged {
  opacity: 0.7;
  transition: opacity 2s ease;
}

/* System messages flicker/type-settle */
.line.system-line {
  animation: systemSettle 0.4s ease-out forwards;
}

@keyframes systemSettle {
  0% { 
    opacity: 0.7;
    transform: translateX(-2px);
  }
  20% { 
    opacity: 1;
    transform: translateX(1px);
  }
  40% { 
    opacity: 0.9;
    transform: translateX(0);
  }
  100% { 
    opacity: 1;
    transform: translateX(0);
  }
}

/* User handle pulse on appear */
.line .prompt-handle {
  animation: handlePulse 0.6s ease-out forwards;
}

@keyframes handlePulse {
  0% { 
    filter: brightness(1);
    text-shadow: 0 0 8px #00FFFF;
  }
  30% { 
    filter: brightness(1.4);
    text-shadow: 0 0 15px #00FFFF, 0 0 25px rgba(0, 255, 255, 0.5);
  }
  100% { 
    filter: brightness(1.1);
    text-shadow: 0 0 10px #00FFFF;
  }
}

.line input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #00FFFF !important;
  font-family: 'Courier New', monospace !important;
  font-size: inherit !important;
  text-align: left !important;
  caret-color: #00FFFF !important;
  /* Constrain width to prevent overflow */
  width: calc(100% - 120px) !important;  /* Account for prompt */
  max-width: calc(100% - 120px) !important;
  display: inline-block !important;
  vertical-align: baseline !important;
  pointer-events: auto !important;
  z-index: 10 !important;
  /* Force text to scroll within input instead of overflowing */
  overflow: hidden !important;
  text-overflow: clip !important;
}

.line input:focus { outline: none !important; background: transparent !important; }
.muted { opacity: .8; }

/* ========================= BUTTONS / CTA STRIP ========================== */
.btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(14px * var(--ui-scale));
  margin-top: calc(.8rem * var(--ui-scale));
}

.btn {
  display: inline-block;
  font-size: calc(1rem * var(--ui-scale));
  padding: calc(12px * var(--ui-scale)) calc(20px * var(--ui-scale));
  border-radius: calc(12px * var(--ui-scale));
  border: 1px solid #00ffff66;
  background: #001a1a80;
  color: #00ffff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .3px;
  text-shadow: 0 0 6px #00ffffaa;
  box-shadow: 0 0 18px rgba(0,255,255,0.15);
  transition: transform .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn.hot { border-color: #ff3bd1aa; color: #ffb9ef; box-shadow: 0 0 18px #ff3bd155; }
.btn.small { font-size: calc(.85rem * var(--ui-scale)); padding: calc(8px * var(--ui-scale)) calc(14px * var(--ui-scale)); }

/* ============================================================ PSYCH PROFILE BUTTONS ============================================================ */
.vertical-btns {
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--ui-scale));
  margin-top: calc(1rem * var(--ui-scale));
  align-items: center;
}

.psych-btn {
  display: block;
  width: 100%;
  max-width: 70%;
  text-align: left;
  white-space: normal;
  line-height: 1.35;
  border: 1px solid #00ffff66;
  background: #001a1a80;
  color: #00ffff;
  text-shadow: 0 0 6px #00ffffaa;
  padding: calc(12px * var(--ui-scale)) calc(20px * var(--ui-scale));
  border-radius: calc(12px * var(--ui-scale));
  font-size: calc(1rem * var(--ui-scale));
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease;
}

.psych-btn:hover { transform: translateY(-2px); }

/* ============================================================ ALIGNMENT VISUAL STATES ============================================================ */
body[data-alignment="stabilizer"] #backgroundFlicker { opacity: 0.10 !important; }
body[data-alignment="stabilizer"] #crtOverlay { opacity: 0.10 !important; }
body[data-alignment="stabilizer"] #screenWarp { opacity: 0.12; filter: blur(0.8px) brightness(1.08); }

body[data-alignment="override"] { filter: contrast(1.15) brightness(1.05); }
body[data-alignment="override"] #backgroundFlicker { opacity: 0.35 !important; }
body[data-alignment="override"] #crtOverlay { opacity: 0.22 !important; }
body[data-alignment="override"] #screenWarp { animation-duration: 3s; filter: brightness(1.2) contrast(1.15); }

body[data-alignment="terminus"] #backgroundFlicker { background: radial-gradient(circle at center, rgba(255,200,0,0.18) 0%, transparent 70%); }
body[data-alignment="terminus"] #screenWarp { filter: blur(1.4px) brightness(1.1); opacity: 0.18; animation-duration: 6s; }
body[data-alignment="terminus"] #crtOverlay { opacity: 0.08 !important; }

/* ============================================================
   BOOT OVERLAY v2.1 - "Approaching the Void" + CRT Glass Stack
============================================================ */
#startOverlay {
  position: fixed;
  inset: 0;
  background: #000508;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  grid-template-columns: 1fr;
  z-index: 9999;
  transition: opacity 1.2s ease-out;
  overflow: hidden;
  animation: globalBreathing 10s ease-in-out infinite;
}

@keyframes globalBreathing {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.02); }
}

#startOverlay.fadeOut { opacity: 0; pointer-events: none; }

/* === CRT GLASS STACK === */

/* Layer 1: Deep atmospheric gradient - richer black with subtle violet undertone */
#startOverlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(255, 0, 255, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(120, 0, 180, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse 50% 50% at 80% 30%, rgba(0, 180, 255, 0.02) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%),
    linear-gradient(180deg, #020204 0%, #030308 30%, #04050a 60%, #030206 100%);
  pointer-events: none;
  z-index: 0;
}

/* Layer 2: Scanlines - subtle, not cyan-dominant */
#startOverlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.008) 0px, transparent 1px, transparent 2px);
  pointer-events: none;
  animation: bootScanlines 10s linear infinite;
  z-index: 1;
}

@keyframes bootScanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

/* Layer 3: Vignette - stronger for depth */
.vignette-layer {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 65% 55% at 50% 50%, transparent 0%, transparent 30%, rgba(0, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0.85) 100%);
  pointer-events: none;
  z-index: 2;
}

/* Layer 4: Phosphor dot mask - subtle, warm-neutral */
.phosphor-layer {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at center, rgba(255, 200, 255, 0.015) 0%, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  z-index: 3;
  opacity: 0.6;
}

/* Layer 5: Edge light bleeds - magenta dominant for warmth */
.edge-bleed-layer {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 25% 80% at 0% 50%, rgba(180, 0, 255, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse 25% 80% at 100% 50%, rgba(255, 0, 180, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse 80% 25% at 50% 0%, rgba(120, 0, 200, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse 80% 25% at 50% 100%, rgba(255, 0, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 4;
  animation: edgeBleedPulse 6s ease-in-out infinite;
}

@keyframes edgeBleedPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Layer 6: Noise texture - visible film grain */
.noise-layer {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 5;
  animation: noiseShift 0.15s steps(4) infinite;
  mix-blend-mode: overlay;
}

@keyframes noiseShift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2px, 1px); }
  66% { transform: translate(1px, -2px); }
  100% { transform: translate(0, 0); }
}

/* Layer 7: CRT barrel distortion - stronger edge falloff */
.barrel-layer {
  position: absolute;
  inset: -2%;
  background: radial-gradient(ellipse 100% 100% at 50% 50%, transparent 0%, transparent 60%, rgba(0, 0, 0, 0.25) 85%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
  z-index: 6;
  border-radius: 8% / 4%;
}

/* Particle field */
#startOverlay .particle-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 7;
}

#startOverlay .particle-field .particle {
  position: absolute;
  font-family: 'Courier New', monospace;
  color: rgba(255, 229, 0, 0.12);
  font-size: 14px;
  animation: particleDrift 20s linear infinite;
  text-shadow: 0 0 10px currentColor;
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  box-shadow: none;
  opacity: 1;
}

#startOverlay .particle-field .particle:nth-child(odd) { color: rgba(255, 0, 200, 0.1); }
#startOverlay .particle-field .particle:nth-child(3n) { color: rgba(0, 220, 255, 0.08); }

@keyframes particleDrift {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-20vh) rotate(180deg); opacity: 0; }
}

/* Edge lines - magenta glow */
#startOverlay .edge-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(255, 0, 180, 0.25), transparent);
  pointer-events: none;
  z-index: 8;
}

#startOverlay .edge-line.top { top: 50px; left: 10%; right: 10%; height: 1px; }
#startOverlay .edge-line.bottom { bottom: 80px; left: 10%; right: 10%; height: 1px; }

/* Corner data */
#startOverlay .corner-data {
  position: absolute;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: rgba(255, 0, 255, 0.25);
  letter-spacing: 0.1em;
  pointer-events: none;
  z-index: 10;
  line-height: 1.6;
  transition: color 0.3s ease;
}

#startOverlay .corner-data.top-left { top: 20px; left: 20px; }
#startOverlay .corner-data.top-right { top: 20px; right: 20px; text-align: right; }
#startOverlay .corner-data.bottom-left { bottom: 100px; left: 20px; }
#startOverlay .corner-data.bottom-right { bottom: 100px; right: 20px; text-align: right; }

/* === LOGO SECTION WITH PARALLAX === */
/* [MODIFIED] - Dramatic contained header with Crash color theme */
#bootLogo {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 50px 80px 40px;
  margin: 0 auto;
  max-width: 95vw;
  width: fit-content;
  min-width: 600px;
  transition: transform 0.15s ease-out;
  will-change: transform;
  /* Deep void background with magenta border */
  background: linear-gradient(145deg, rgba(8, 4, 18, 0.95) 0%, rgba(4, 6, 16, 0.98) 50%, rgba(6, 4, 14, 0.95) 100%);
  border: 2px solid rgba(255, 0, 200, 0.5);
  border-radius: 8px;
  box-shadow: 
    0 0 60px rgba(255, 0, 180, 0.2),
    0 0 120px rgba(255, 0, 180, 0.08),
    0 4px 30px rgba(0, 0, 0, 0.8),
    inset 0 0 80px rgba(0, 0, 0, 0.6),
    inset 0 0 150px rgba(255, 0, 180, 0.03);
}

/* Scan line animation across the header box */
#bootLogo::before {
  content: "";
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, transparent, rgba(255, 0, 255, 0.08), transparent);
  animation: bootLogoScan 5s linear infinite;
  pointer-events: none;
  clip-path: inset(0 0 0 0);
  z-index: -1;
}

@keyframes bootLogoScan {
  0% { top: -50%; }
  100% { top: 100%; }
}

#logoGlyphs {
  font-size: 1.2rem;
  color: rgba(255, 0, 255, 0.6);
  letter-spacing: 2em;
  margin-bottom: 20px;
  text-shadow: 0 0 30px rgba(255, 0, 255, 0.5);
  animation: glyphOrbit 8s ease-in-out infinite;
  transition: transform 0.1s ease-out;
  will-change: transform;
}

@keyframes glyphOrbit {
  0%, 100% { letter-spacing: 2em; opacity: 0.6; }
  50% { letter-spacing: 2.5em; opacity: 0.9; }
}

/* === TITLE WITH CHROMATIC ABERRATION === */
/* [MODIFIED] - Sunshine yellow like Crash's eyes */
#logoTitle {
  font-family: 'Courier New', monospace;
  font-size: clamp(2rem, 8vw, 5rem);
  font-weight: 100;
  letter-spacing: 0.35em;
  color: #FFE500;
  margin: 0;
  position: relative;
  text-shadow: 0 0 2px #FFE500, 0 0 20px #FFE500, 0 0 60px rgba(255, 229, 0, 0.5), 0 0 100px rgba(255, 229, 0, 0.3);
  animation: titleReveal 3s ease-out forwards, titleBreath 6s ease-in-out 3s infinite;
  transition: transform 0.15s ease-out;
  will-change: transform;
}

/* Chromatic aberration layers - magenta/cyan split */
#logoTitle::before,
#logoTitle::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  opacity: 0.8;
}

#logoTitle::before {
  color: transparent;
  text-shadow: -2px 0 0 rgba(255, 0, 255, 0.5), -4px 0 10px rgba(255, 0, 255, 0.3);
  animation: chromaticShiftRed 4s ease-in-out infinite;
}

#logoTitle::after {
  color: transparent;
  text-shadow: 2px 0 0 rgba(0, 255, 255, 0.4), 4px 0 10px rgba(0, 255, 255, 0.2);
  animation: chromaticShiftBlue 4s ease-in-out infinite;
}

@keyframes chromaticShiftRed {
  0%, 100% { transform: translateX(0); opacity: 0.5; }
  25% { transform: translateX(-1px); opacity: 0.7; }
  75% { transform: translateX(1px); opacity: 0.3; }
}

@keyframes chromaticShiftBlue {
  0%, 100% { transform: translateX(0); opacity: 0.5; }
  25% { transform: translateX(1px); opacity: 0.3; }
  75% { transform: translateX(-1px); opacity: 0.7; }
}

@keyframes titleReveal {
  0% { letter-spacing: 1em; opacity: 0; filter: blur(10px); }
  100% { letter-spacing: 0.35em; opacity: 1; filter: blur(0); }
}

@keyframes titleBreath {
  0%, 100% { text-shadow: 0 0 2px #FFE500, 0 0 20px #FFE500, 0 0 60px rgba(255, 229, 0, 0.5), 0 0 100px rgba(255, 229, 0, 0.3); }
  50% { text-shadow: 0 0 5px #FFE500, 0 0 30px #FFE500, 0 0 80px rgba(255, 229, 0, 0.6), 0 0 150px rgba(255, 0, 255, 0.2); }
}

#logoTitle .os-suffix {
  color: #ff00ff;
  text-shadow: 0 0 2px #ff00ff, 0 0 20px #ff00ff, 0 0 50px rgba(255, 0, 255, 0.6);
  animation: suffixGlitch 4s ease-in-out infinite;
}

@keyframes suffixGlitch {
  0%, 95%, 100% { opacity: 1; transform: translateX(0); }
  96% { opacity: 0.8; transform: translateX(-2px); }
  97% { opacity: 1; transform: translateX(2px); }
  98% { opacity: 0.9; transform: translateX(-1px); }
}

/* [MODIFIED] - Magenta themed designation text */
#logoVersion {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: rgba(255, 0, 255, 0.7);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 0, 255, 0.3);
  text-shadow: 0 0 15px rgba(255, 0, 255, 0.4);
  animation: versionFadeIn 2s ease-out 1s forwards;
  opacity: 0;
}

@keyframes versionFadeIn { to { opacity: 1; } }

/* === BOOT ACTION === */
#bootAction {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 25px;
  padding: 20px;
}

/* Orbital rings */
#bootAction::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border: 1px solid rgba(255, 229, 0, 0.15);
  border-radius: 50%;
  animation: orbitalSpin 20s linear infinite;
  pointer-events: none;
}

#bootAction::after {
  content: '';
  position: absolute;
  width: 160px;
  height: 160px;
  border: 1px dashed rgba(255, 0, 255, 0.12);
  border-radius: 50%;
  animation: orbitalSpin 15s linear infinite reverse;
  pointer-events: none;
}

@keyframes orbitalSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#startBtn {
  width: 90px;
  height: 90px;
  cursor: pointer;
  filter: drop-shadow(0 0 10px #FFE500) drop-shadow(0 0 25px rgba(255, 229, 0, 0.4)) drop-shadow(0 0 50px rgba(255, 0, 255, 0.2));
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: buttonMagnet 4s ease-in-out infinite;
  position: relative;
  z-index: 5;
}

@keyframes buttonMagnet {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px #FFE500) drop-shadow(0 0 25px rgba(255, 229, 0, 0.4)) drop-shadow(0 0 50px rgba(255, 0, 255, 0.15)); }
  50% { transform: scale(1.03); filter: drop-shadow(0 0 15px #FFE500) drop-shadow(0 0 40px rgba(255, 229, 0, 0.5)) drop-shadow(0 0 80px rgba(255, 0, 255, 0.25)); }
}

#startBtn:hover {
  transform: scale(1.2);
  filter: drop-shadow(0 0 20px #FFE500) drop-shadow(0 0 50px #FFE500) drop-shadow(0 0 100px #ff00ff);
  animation: none;
}

#startBtn:active { transform: scale(1.1); }

/* Click ripple effect */
.click-ripple {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid #FFE500;
  pointer-events: none;
  animation: rippleExpand 0.6s ease-out forwards;
  z-index: 4;
}

@keyframes rippleExpand {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* ========== SIGNAL PULSE - Initialize moment ========== */
/* Brief darkening + cyan pulse through all elements */
.signal-pulse-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  background: radial-gradient(
    ellipse 120% 120% at 50% 50%,
    transparent 0%,
    rgba(0, 0, 0, 0.4) 100%
  );
  opacity: 0;
  animation: signalDarken 0.8s ease-out forwards;
}

@keyframes signalDarken {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

/* Pulse wave that runs through cyan elements */
.signal-pulse-wave {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  border: 3px solid #FFE500;
  box-shadow: 
    0 0 20px #FFE500,
    0 0 40px #FFE500,
    0 0 60px rgba(255, 229, 0, 0.5),
    inset 0 0 20px rgba(255, 0, 255, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 100001;
  animation: signalWaveExpand 0.6s ease-out forwards;
}

@keyframes signalWaveExpand {
  0% { 
    width: 10px;
    height: 10px;
    opacity: 1;
    border-width: 3px;
  }
  100% { 
    width: 200vmax;
    height: 200vmax;
    opacity: 0;
    border-width: 1px;
  }
}

/* Body class to trigger pulse on all cyan elements */
body.signal-pulsing *[style*="color: rgb(0, 255, 255)"],
body.signal-pulsing *[style*="#00FFFF"],
body.signal-pulsing *[style*="#00ffff"],
body.signal-pulsing .link-btn,
body.signal-pulsing #logoGlyphs,
body.signal-pulsing #logoTitle,
body.signal-pulsing #bootPrompt {
  animation: elementPulse 0.5s ease-out forwards !important;
}

@keyframes elementPulse {
  0% { 
    filter: brightness(1);
  }
  40% { 
    filter: brightness(2) saturate(1.5);
    text-shadow: 0 0 30px #FFE500, 0 0 60px #FF00FF !important;
  }
  100% { 
    filter: brightness(1);
  }
}

#bootPrompt {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: rgba(255, 229, 0, 0.6);
  letter-spacing: 0.35em;
  text-shadow: 0 0 15px rgba(255, 229, 0, 0.3);
  animation: promptPulse 3s ease-in-out infinite;
}

@keyframes promptPulse {
  0%, 100% { opacity: 0.5; letter-spacing: 0.35em; }
  50% { opacity: 0.9; letter-spacing: 0.4em; }
}

/* Warning */
/* [MODIFIED] - Bible-style data panel container */
#photosensitivityWarning {
  position: relative;
  z-index: 10;
  text-align: center;
  max-width: 550px;
  padding: 25px 35px;
  margin: 0 auto;
  /* Data panel styling */
  background: rgba(10, 10, 20, 0.6);
  border: 1px solid rgba(255, 200, 0, 0.25);
  border-left: 3px solid rgba(255, 200, 0, 0.5);
  border-radius: 4px;
  box-shadow: 
    0 0 30px rgba(255, 200, 0, 0.08),
    inset 0 0 40px rgba(0, 0, 0, 0.5);
  animation: warningFadeIn 2s ease-out 2s forwards;
  opacity: 0;
}

/* Warning tension: subtle scanline distortion */
#photosensitivityWarning::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(255, 200, 0, 0.02) 2px,
    rgba(255, 200, 0, 0.02) 4px
  );
  animation: warningScanlines 4s linear infinite;
  pointer-events: none;
  opacity: 0.5;
  border-radius: 4px;
}

@keyframes warningScanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

@keyframes warningFadeIn { to { opacity: 1; } }

.warning-header {
  color: rgba(255, 200, 0, 0.8);
  font-family: 'Courier New', monospace;
  font-weight: normal;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  margin: 0 0 12px 0;
  text-shadow: 0 0 15px rgba(255, 200, 0, 0.4);
  /* Chromatic aberration on warning text */
  animation: warningChromatic 3s ease-in-out infinite;
}

@keyframes warningChromatic {
  0%, 100% {
    text-shadow: 
      0 0 15px rgba(255, 200, 0, 0.4),
      -1px 0 rgba(255, 0, 0, 0.15),
      1px 0 rgba(0, 255, 255, 0.15);
  }
  50% {
    text-shadow: 
      0 0 20px rgba(255, 200, 0, 0.5),
      -2px 0 rgba(255, 0, 0, 0.2),
      2px 0 rgba(0, 255, 255, 0.2);
  }
}

/* Warning icon pulse */
.warning-header::first-letter {
  animation: warningIconPulse 2s ease-in-out infinite;
  display: inline-block;
}

@keyframes warningIconPulse {
  0%, 100% { 
    opacity: 0.6; 
    transform: scale(1);
    filter: brightness(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.1);
    filter: brightness(1.3);
  }
}

.warning-body {
  color: rgba(0, 255, 255, 0.55);
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  line-height: 1.8;
  margin: 0;
  letter-spacing: 0.05em;
}

/* Footer */
#bootFooter {
  position: absolute;
  bottom: 25px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  color: rgba(255, 229, 0, 0.3);
  letter-spacing: 0.25em;
  z-index: 10;
}

#bootFooter span { animation: dataFlicker 5s ease-in-out infinite; }
#bootFooter span:nth-child(1) { animation-delay: 0s; }
#bootFooter span:nth-child(2) { animation-delay: 0.5s; }
#bootFooter span:nth-child(3) { animation-delay: 1s; }

@keyframes dataFlicker {
  0%, 90%, 100% { opacity: 0.3; }
  92% { opacity: 0.7; }
  94% { opacity: 0.2; }
  96% { opacity: 0.6; }
}

#bootFooter .separator { color: rgba(255, 0, 255, 0.2); }

/* Boot flicker */
#startOverlay.booting { animation: bootFlicker 0.3s ease-out; }

@keyframes bootFlicker {
  0% { filter: brightness(1); }
  20% { filter: brightness(2) saturate(1.5); }
  40% { filter: brightness(0.8); }
  60% { filter: brightness(1.5); }
  80% { filter: brightness(0.9); }
  100% { filter: brightness(1); }
}

.screen-flash {
  position: absolute;
  inset: 0;
  background: rgba(0, 255, 255, 0.3);
  pointer-events: none;
  z-index: 100;
  animation: flashFade 0.4s ease-out forwards;
}

@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Mobile */
@media (max-width: 768px) {
  #bootLogo { padding: 40px 20px 0; }
  #logoGlyphs { letter-spacing: 1em; font-size: 1rem; }
  #logoTitle { letter-spacing: 0.2em; }
  #logoVersion { font-size: 0.65rem; letter-spacing: 0.2em; }
  #bootAction::before, #bootAction::after { display: none; }
  #startBtn { width: 80px; height: 80px; }
  #photosensitivityWarning { padding: 15px 20px; max-width: 90%; }
  .warning-header, .warning-body { font-size: 0.65rem; }
  #bootFooter { font-size: 0.55rem; gap: 15px; }
  #startOverlay .corner-data { display: none; }
  .phosphor-layer { display: none; }
}

@media (max-height: 600px) {
  #bootLogo { padding-top: 20px; }
  #logoGlyphs { margin-bottom: 10px; }
  #logoTitle { font-size: clamp(1.5rem, 6vw, 3rem); }
  #logoVersion { margin-top: 10px; }
  #photosensitivityWarning { padding: 10px 20px; }
  #bootAction { gap: 15px; }
}

/* Large screens - scale up for better readability */
@media (min-width: 1600px) {
  :root {
    --ui-scale: 1.5;
  }
  
  #linkBar .link-btn {
    padding: 18px 36px;
    font-size: 23px;
    letter-spacing: 3px;
  }
  
  #linkBar .link-icon {
    font-size: 28px;
  }
  
  #term {
    max-width: 900px;
    max-height: 600px;
  }
  
  #countdown {
    font-size: 3.2em;
  }
  
  #clock {
    font-size: 1.3rem;
  }
  
  #controlsRow button {
    font-size: 1.1rem;
    padding: 10px 16px;
  }
  
  .control-label {
    font-size: 0.75rem;
  }
}

/* Very large screens (4K+) */
@media (min-width: 2400px) {
  :root {
    --ui-scale: 1.7;
  }
  
  #linkBar .link-btn {
    padding: 20px 42px;
    font-size: 26px;
  }
  
  #linkBar .link-icon {
    font-size: 32px;
  }
  
  #term {
    max-width: 1100px;
    max-height: 700px;
  }
  
  #countdown {
    font-size: 4em;
  }
  
  #clock {
    font-size: 1.5rem;
  }
  
  #controlsRow button {
    font-size: 1.25rem;
    padding: 12px 20px;
  }
  
  .control-label {
    font-size: 0.85rem;
  }
}

/* ========================= BACKGROUND FLICKER GLOW ========================== */
#backgroundFlicker {
  position: fixed;
  inset: 0;
  z-index: 3;
  background: radial-gradient(circle at center, #00ffff22 0%, transparent 80%);
  animation: flicker 4s infinite;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: blur(8px);
}

@keyframes flicker {
  0%,100% { opacity:.2 }
  10% { opacity:.4 }
  20% { opacity:.1 }
  30% { opacity:.5 }
  40% { opacity:.15 }
  50% { opacity:.3 }
  60% { opacity:.05 }
  70% { opacity:.35 }
  80% { opacity:.25 }
  90% { opacity:.45 }
}

/* ========================= ASCII ART ========================== */
.ascii-art {
  font-family: monospace;
  font-size: 0.7em;
  white-space: pre;
  margin: 1rem 0;
  color: #00FFFF;
  text-shadow: 0 0 8px #00FFFF;
  animation: scrollUp 1.5s ease-out;
}

@keyframes scrollUp {
  from { transform: translateY(80px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========================= CLOCK + COUNTDOWN + MUSIC VIZ ========================== */
#countdown {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  text-align: center;
  font-size: 2.6em;
  font-weight: 900;
  color: #00FFFF;
  letter-spacing: 0.08em;
  text-shadow: 0 0 6px #00FFFF, 0 0 14px #00FFFF, 0 0 24px #00FFFF;
  z-index: 10;
  pointer-events: none;
}

#clock {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #00ffffcc;
  font-size: 1.1rem;
  text-shadow: 0 0 6px #00ffff88;
  font-family: "Courier New", monospace;
  z-index: 10;
}

#viz {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 100px;
  z-index: 9;
  opacity: 0.85;
  filter: drop-shadow(0 0 6px #00ffff55);
  pointer-events: none;
}

/* ========================= CRT OVERLAY SCANLINES ========================== */
#crtOverlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0,255,255,0.08) 0, rgba(0,255,255,0.08) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: overlay;
  opacity: .15;
  animation: flick 0.15s infinite;
  z-index: 8;
}

@keyframes flick {
  0%,100% { opacity:.1 }
  50% { opacity:.18 }
}

/* ========================= CRASH GRIN TAKEOVER MODE ========================== */
#grinOverlay {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: none;
  pointer-events: none;
}

#grinStage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(0.9deg);
  width: min(72vw, 85vh * 1.33);
  height: min(54vh, 64vw * 0.75);
  max-width: 1100px;
  max-height: 650px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16vh;
  box-sizing: border-box;
  background: transparent;
  text-align: center;
  color: #00FFFF;
  text-shadow: 0 0 8px #00FFFF;
  font-family: "Courier New", Courier, monospace;
}

#grinBox {
  margin-top: 0;
  margin-bottom: 1.5vh;
  max-width: 70%;
  overflow: hidden;
  white-space: pre;
  position: relative;
  animation: grinSlideUp 1.5s ease-out both;
  filter: drop-shadow(0 0 4px #00FFFF);
}

@keyframes grinSlideUp {
  from { transform: translateY(80px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

#grinAscii {
  font-family: monospace;
  line-height: var(--grin-line);
  letter-spacing: var(--grin-letter);
  color: #00FFFF;
  text-shadow: 0 0 6px #00FFFF;
  margin: 0;
  white-space: pre;
  font-size: calc(13px * var(--ui-scale));
}

#grinMsg {
  margin-top: 1.5vh;
  margin-bottom: 4vh;
  font-size: calc(1rem * var(--ui-scale));
  color: #00ffffcc;
  text-shadow: 0 0 6px #00ffff88;
  font-family: "Courier New", monospace;
  font-weight: 400;
  text-align: center;
}

.grin-wrap {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 82%;
  max-width: 82%;
  margin-top: 2rem;
  margin-bottom: 2rem;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  pointer-events: none;
}

.ascii-art.grin {
  font-size: calc(var(--grin-size) * 0.7);
  line-height: var(--grin-line);
  letter-spacing: var(--grin-letter);
  display: inline-block;
  white-space: pre;
  text-shadow: 0 0 8px #00FFFF;
}

/* === CRT warp / breathing pulse === */
#screenWarp {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  mix-blend-mode: screen;
  animation: warpPulse 4.5s ease-in-out infinite;
  filter: blur(1px) brightness(1.05);
  opacity: 0.15;
  background: radial-gradient(circle at 50% 45%, rgba(0,255,255,0.15) 0%, rgba(0,0,0,0) 60%);
}

@keyframes warpPulse {
  0% { transform: scale(1) translateY(0); opacity:0.12; filter: blur(1px) brightness(1.05); }
  50% { transform: scale(1.01) translateY(-0.4%); opacity:0.18; filter: blur(1.2px) brightness(1.15); }
  100% { transform: scale(1) translateY(0); opacity:0.12; filter: blur(1px) brightness(1.05); }
}

/* === Signal loss flash === */
#signalLoss {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0,255,255,0.6) 0px, rgba(0,255,255,0.0) 1px, rgba(0,0,0,0) 2px, rgba(0,0,0,0) 3px);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
  filter: blur(1px) brightness(1.3) contrast(1.6);
  transition: opacity 60ms linear;
}

#signalLoss.glitching {
  opacity: 1;
  animation: lossJitter 120ms steps(2,end);
}

@keyframes lossJitter {
  0% { transform: translateY(-2px) skewX(-2deg); }
  50% { transform: translateY(3px) skewX(2deg); }
  100% { transform: translateY(0) skewX(0deg); }
}

/* === Cursor ghost tracer === */
.cursorGhost {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(0,255,255,0.9) 0%, rgba(0,255,255,0.1) 70%, transparent 80%);
  box-shadow: 0 0 8px rgba(0,255,255,0.8);
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 10000;
  opacity: 0.7;
  transition: opacity .2s ease;
  left: 0;
  top: 0;
}

/* ===== BLEED TEXT SUBLIMINALS ===== */
#bleedText {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: #ff0036;
  text-shadow: 0 0 20px #ff0036, 0 0 40px #ff0036;
  opacity: 0;
  pointer-events: none;
  z-index: 9998;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-align: center;
  white-space: nowrap;
  font-family: "Courier New", monospace;
  mix-blend-mode: screen;
}

/* ===== GHOST CSS MODULE v2 ===== */
#glitchGhost {
  position: absolute;
  width: 200px;
  height: 200px;
  transform-origin: center center;
  pointer-events: auto;
  cursor: crosshair;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 12px rgba(255,229,0,0.4)) drop-shadow(0 0 24px rgba(255,0,255,0.15));
  animation: ghostBreath 4s ease-in-out infinite;
  z-index: 1;
  background: transparent;
}

.glyph {
  position: absolute;
  font-family: "Courier New", monospace;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: pre;
  color: #ffe500;
  text-shadow: 0 0 3px rgba(255, 229, 0, 0.4), 0 0 6px rgba(255, 229, 0, 0.2);
  opacity: 0.85;
  will-change: transform, opacity;
  pointer-events: none;
  user-select: none;
  /* Base animation - gentle float */
  animation: glyphFloat 4s ease-in-out infinite;
}

/* Staggered delays for organic movement */
.glyph:nth-child(2n) { animation-delay: -0.5s; }
.glyph:nth-child(3n) { animation-delay: -1.2s; }
.glyph:nth-child(4n) { animation-delay: -2.1s; }
.glyph:nth-child(5n) { animation-delay: -0.8s; }
.glyph:nth-child(6n) { animation-delay: -1.7s; }
.glyph:nth-child(7n) { animation-delay: -2.5s; }

/* Different animation types for variety (still using same properties) */
.glyph:nth-child(4n+1) {
  animation-name: glyphDrift;
  animation-duration: 5s;
}

.glyph:nth-child(6n+2) {
  animation-name: glyphPulse;
  animation-duration: 3.5s;
}

.glyph:nth-child(11n) {
  animation-name: glyphFlicker;
  animation-duration: 4s;
}

/* Gentle vertical float */
@keyframes glyphFloat {
  0%, 100% { 
    transform: translateY(0) rotate(0deg); 
    opacity: 0.85;
  }
  50% { 
    transform: translateY(-3px) rotate(1deg); 
    opacity: 0.9;
  }
}

/* Horizontal drift for some glyphs */
@keyframes glyphDrift {
  0%, 100% { 
    transform: translate(0, 0) scale(1); 
    opacity: 0.8;
  }
  33% { 
    transform: translate(2px, -2px) scale(1.05); 
    opacity: 0.9;
  }
  66% { 
    transform: translate(-1px, 1px) scale(0.98); 
    opacity: 0.85;
  }
}

/* Scale pulse for depth */
@keyframes glyphPulse {
  0%, 100% { 
    transform: scale(1); 
    opacity: 0.85;
  }
  50% { 
    transform: scale(1.15); 
    opacity: 1;
  }
}

/* Occasional flicker (rare, not constant) */
@keyframes glyphFlicker {
  0%, 89%, 100% { opacity: 0.85; transform: translateY(0); }
  90% { opacity: 0.3; transform: translateY(0); }
  92% { opacity: 1; transform: translateY(-1px); }
  94% { opacity: 0.5; transform: translateY(1px); }
  96% { opacity: 0.85; transform: translateY(0); }
}

/* Stare state - agitated */
#glitchGhost.stare {
  animation: none;
  filter: drop-shadow(0 0 8px rgba(255, 100, 50, 0.4)) drop-shadow(0 0 16px rgba(255, 100, 50, 0.2));
  transition: filter 0.2s ease;
}

#glitchGhost.stare .glyph {
  color: #ff9944 !important;
  text-shadow: 0 0 4px rgba(255, 153, 68, 0.6), 0 0 8px rgba(255, 153, 68, 0.3);
  animation: glyphJitter 0.15s steps(2) infinite;
}

@keyframes glyphJitter {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-2px, 1px); }
}

/* Speaking state - attentive */
#glitchGhost.speak {
  animation: none;
  filter: drop-shadow(0 0 8px rgba(255, 229, 0, 0.5)) drop-shadow(0 0 16px rgba(255, 229, 0, 0.25));
  transition: filter 0.4s ease;
}

#glitchGhost.speak .glyph {
  color: #fff066 !important;
  text-shadow: 0 0 4px rgba(255, 240, 102, 0.5), 0 0 8px rgba(255, 240, 102, 0.25);
  animation: glyphAttention 0.8s ease-in-out infinite;
}

@keyframes glyphAttention {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Pet state - warm and happy */
#glitchGhost.pet {
  animation: ghostBreath 3s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 229, 0, 0.6)) drop-shadow(0 0 20px rgba(255, 229, 0, 0.3));
  transition: filter 0.3s ease;
}

#glitchGhost.pet .glyph {
  color: #fff566 !important;
  text-shadow: 0 0 5px rgba(255, 245, 102, 0.6), 0 0 10px rgba(255, 245, 102, 0.3);
  animation: glyphHappy 1.5s ease-in-out infinite;
}

@keyframes glyphHappy {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-2px) rotate(-3deg); }
  75% { transform: translateY(-2px) rotate(3deg); }
}

@keyframes ghostBreath {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255, 229, 0, 0.4)) drop-shadow(0 0 16px rgba(255, 229, 0, 0.2)); }
  50% { filter: drop-shadow(0 0 12px rgba(255, 229, 0, 0.55)) drop-shadow(0 0 24px rgba(255, 229, 0, 0.3)); }
}

/* Glitch burst - brief flash */
#glitchGhost.glitching {
  filter: drop-shadow(0 0 12px rgba(255, 229, 0, 0.8)) !important;
}

#glitchGhost.glitching .glyph {
  opacity: 1 !important;
}

#glitchGhost.contemplating { 
  animation: contemplationPulse 5s ease-in-out infinite; 
}

@keyframes contemplationPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 229, 0, 0.4)) drop-shadow(0 0 12px rgba(255, 229, 0, 0.2)); }
  50% { filter: drop-shadow(0 0 10px rgba(255, 229, 0, 0.5)) drop-shadow(0 0 20px rgba(255, 229, 0, 0.25)); }
}

#glitchGhost.contemplating .glyph { 
  animation: glyphFloat 5s ease-in-out infinite; 
}

/* Admin watching state - subtle awareness */
#glitchGhost.admin-aware {
  animation: ghostAdminAware 6s ease-in-out infinite;
}

@keyframes ghostAdminAware {
  0%, 100% { 
    filter: drop-shadow(0 0 8px rgba(255, 229, 0, 0.4)) drop-shadow(0 0 16px rgba(255, 0, 255, 0.15));
  }
  25% {
    filter: drop-shadow(0 0 10px rgba(255, 229, 0, 0.5)) drop-shadow(0 0 20px rgba(255, 0, 255, 0.25));
  }
  50% { 
    filter: drop-shadow(0 0 12px rgba(255, 0, 255, 0.4)) drop-shadow(0 0 24px rgba(255, 0, 255, 0.3));
  }
  75% {
    filter: drop-shadow(0 0 10px rgba(255, 229, 0, 0.5)) drop-shadow(0 0 20px rgba(255, 0, 255, 0.25));
  }
}

#glitchGhost.admin-aware .glyph {
  animation: glyphAdminAware 4s ease-in-out infinite;
}

@keyframes glyphAdminAware {
  0%, 100% { 
    transform: translateY(0); 
    opacity: 0.85;
  }
  20% { 
    transform: translateY(-1px); 
    opacity: 0.9;
  }
  40% { 
    transform: translateY(0); 
    opacity: 0.85;
  }
  /* Brief pause - "noticing" */
  50%, 60% { 
    transform: translateY(0) scale(1.02); 
    opacity: 0.95;
  }
  80% { 
    transform: translateY(-2px); 
    opacity: 0.88;
  }
}

/* Admin stare - rare direct look at user */
#glitchGhost.admin-stare {
  animation: none !important;
  filter: drop-shadow(0 0 15px rgba(255, 0, 255, 0.6)) drop-shadow(0 0 30px rgba(255, 0, 255, 0.4)) !important;
  transition: filter 0.3s ease;
}

#glitchGhost.admin-stare .glyph {
  color: #ff66ff !important;
  text-shadow: 0 0 6px rgba(255, 102, 255, 0.8), 0 0 12px rgba(255, 0, 255, 0.5);
  animation: glyphAdminStare 0.2s steps(2) infinite !important;
}

@keyframes glyphAdminStare {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-1px, 1px) scale(1.05); }
}

/* Admin stare intense - remote triggered by haunt panel */
#glitchGhost.admin-stare-intense {
  filter: drop-shadow(0 0 25px rgba(255, 0, 255, 0.9)) drop-shadow(0 0 50px rgba(255, 0, 255, 0.6)) !important;
}

#glitchGhost.admin-stare-intense .glyph {
  color: #ff00ff !important;
  text-shadow: 0 0 10px rgba(255, 0, 255, 1), 0 0 20px rgba(255, 0, 255, 0.8), 0 0 40px rgba(255, 0, 255, 0.4);
  animation: glyphAdminStareIntense 0.1s steps(3) infinite !important;
}

@keyframes glyphAdminStareIntense {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-2px, 1px) scale(1.08); }
  66% { transform: translate(2px, -1px) scale(1.04); }
  100% { transform: translate(0, 0) scale(1); }
}

/* ============================================================ PSYCH PROFILE CHOICE BUTTONS (Legacy) ============================================================ */
.psych-choices {
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--ui-scale));
  margin-top: calc(2.5rem * var(--ui-scale));
  padding-bottom: calc(1rem * var(--ui-scale));
  align-items: center;
}

.psych-choice {
  display: block;
  width: 100%;
  max-width: 70%;
  text-align: left;
  white-space: normal;
  line-height: 1.35;
  border: 1px solid #00ffff66;
  background: #001a1a80;
  color: #00ffff;
  text-shadow: 0 0 6px #00ffffaa;
  padding: calc(12px * var(--ui-scale)) calc(20px * var(--ui-scale));
  border-radius: calc(12px * var(--ui-scale));
  font-size: calc(1rem * var(--ui-scale));
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}

.psych-choice:hover {
  transform: translateY(-2px);
  border-color: #00ffffaa;
  box-shadow: 0 0 20px rgba(0,255,255,0.2);
}

/* ========================= MUSIC BUTTONS ========================== */
#musicButtons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

#musicButtons button {
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.4);
  border-radius: 3px;
  color: #00ffff;
  font-size: 1rem;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-shadow: 0 0 6px #00ffff;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

#musicButtons button:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
  transform: translateY(-1px);
}

#musicButtons button:active {
  transform: translateY(0px);
  box-shadow: 0 0 6px rgba(0, 255, 255, 0.3);
}

/* ========================= GHOST MENU ========================== */
.ghost-menu {
  position: fixed;
  background: rgba(0, 20, 30, 0.95);
  border: 2px solid rgba(0, 255, 255, 0.6);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 15001;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), inset 0 0 30px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.2s ease;
  pointer-events: auto;
}

.ghost-menu.show { opacity: 1; transform: scale(1); }

.ghost-menu-btn {
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.4);
  border-radius: 4px;
  color: #00ffff;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 0 0 6px #00ffff;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
  white-space: nowrap;
}

.ghost-menu-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
  transform: translateX(2px);
}

.ghost-menu-btn:active {
  transform: translateX(0px);
  box-shadow: 0 0 6px rgba(0, 255, 255, 0.3);
}

/* ========================= UNIFIED CONTROL PANEL ========================== */
#controlPanel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: rgba(0, 20, 30, 0.92);
  border: 1px solid rgba(0, 255, 255, 0.5);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: "Courier New", monospace;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  z-index: 12;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#trackScroll {
  font-size: 0.72rem;
  color: #00ffff;
  text-shadow: 0 0 8px #00ffff;
  overflow: hidden;
  white-space: nowrap;
  padding: 3px 0;
  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
  line-height: 1.2;
}

#trackScroll::before {
  content: '';
  display: inline-block;
  animation: scrollTrack 20s linear infinite;
}

@keyframes scrollTrack {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

#controlsRow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

#controlsRow button {
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.4);
  border-radius: 4px;
  color: #00ffff;
  font-size: 1rem;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 0 0 6px #00ffff;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
  flex-shrink: 0;
}

#controlsRow button:hover {
  background: rgba(0, 255, 255, 0.25);
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.5);
  transform: translateY(-1px);
}

#controlsRow button:active { transform: translateY(0px); }

.control-label {
  font-size: 0.65rem;
  color: #00ffffaa;
  text-shadow: 0 0 6px #00ffff88;
  min-width: 30px;
  flex-shrink: 0;
}

#volumeValue, #trustValue {
  font-size: 0.65rem;
  color: #00ffffaa;
  text-shadow: 0 0 6px #00ffff88;
  min-width: 24px;
  text-align: right;
  flex-shrink: 0;
}

#volumeSlider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  width: 100%;
  height: 12px;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 0 6px #00ffff55);
  writing-mode: horizontal-tb;
  direction: ltr;
  min-width: 60px;
}

#volumeSlider::-webkit-slider-runnable-track {
  width: 100%;
  height: 12px;
  background: linear-gradient(to right, rgba(0,255,255,0.2), rgba(0,255,255,0.7));
  border-radius: 6px;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 10px rgba(0,255,255,0.4);
  border: 1px solid rgba(0,255,255,0.3);
}

#volumeSlider::-moz-range-track {
  width: 100%;
  height: 12px;
  background: linear-gradient(to right, rgba(0,255,255,0.2), rgba(0,255,255,0.7));
  border-radius: 6px;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 10px rgba(0,255,255,0.4);
  border: 1px solid rgba(0,255,255,0.3);
}

#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, rgba(0,255,255,1) 0%, rgba(0,255,255,0.4) 60%, transparent 75%);
  border-radius: 50%;
  border: 2px solid rgba(0,255,255,0.9);
  box-shadow: 0 0 8px #00ffff, 0 0 16px rgba(0,255,255,0.6);
  cursor: grab;
  margin-top: -5px;
}

#volumeSlider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, rgba(0,255,255,1) 0%, rgba(0,255,255,0.4) 60%, transparent 75%);
  border-radius: 50%;
  border: 2px solid rgba(0,255,255,0.9);
  box-shadow: 0 0 8px #00ffff, 0 0 16px rgba(0,255,255,0.6);
  cursor: grab;
}

#trustMeter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(0, 255, 255, 0.2);
}

#trustBarBg {
  flex: 1;
  height: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
}

#trustBar {
  height: 100%;
  background: linear-gradient(90deg, rgba(0, 255, 100, 0.8), rgba(0, 255, 255, 0.8));
  border-radius: 5px;
  box-shadow: inset 0 0 8px rgba(0, 255, 255, 0.6), 0 0 12px rgba(0, 255, 255, 0.4);
  transition: width 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

/* Achievement Popup */
.achievement-popup {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 20, 30, 0.95);
  border: 2px solid rgba(0, 255, 255, 0.6);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 20000;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.4s ease;
  font-family: "Courier New", monospace;
}

.achievement-popup.show { opacity: 1; transform: translateX(0); }
.achievement-icon { font-size: 2rem; text-shadow: 0 0 10px #00ffff; }
.achievement-content { display: flex; flex-direction: column; gap: 4px; }
.achievement-title { font-size: 0.7rem; color: #00ffffaa; letter-spacing: 0.1em; }
.achievement-name { font-size: 1rem; color: #00ffff; font-weight: bold; text-shadow: 0 0 8px #00ffff; }
.achievement-desc { font-size: 0.75rem; color: #00ffffcc; }

@media (max-width: 768px) {
  #controlPanel { right: 10px; bottom: 10px; min-width: 240px; padding: 10px 12px; }
  #controlsRow button { padding: 6px 10px; font-size: 0.9rem; }
}

/* ============================================================
   REDUCED MOTION - Accessibility
   Respects user preference for reduced animations
============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Keep essential state changes visible */
  .achievement-popup,
  #psychOverlay,
  #attuneOverlay {
    transition-duration: 0.2s !important;
  }
  
  /* Disable parallax drift */
  #voidLayer {
    transform: none !important;
  }
  
  /* Disable scanlines */
  #crtOverlay {
    animation: none !important;
    opacity: 0.1 !important;
  }
  
  /* Disable warning animations */
  .warning-header {
    animation: none !important;
  }
  
  #photosensitivityWarning::before {
    animation: none !important;
  }
}

/* ============================================================
   LINE AGING SYSTEM v1.6 - Extended Classes
   Temporal hierarchy for terminal output
============================================================ */

/* System lines also respect aging */
.line.system-line.aged {
  opacity: 0.75;
}

.line.system-line.very-aged {
  opacity: 0.6;
}

/* Hover temporarily restores visibility for reading */
.line.aged:hover,
.line.very-aged:hover {
  opacity: 1;
  transition: opacity 0.15s ease;
}

/* Dev mode indicator - subtle border glow when syscore active */
body.dev-mode #term {
  box-shadow: inset 0 0 30px rgba(255, 0, 255, 0.08);
}

body.dev-mode .prompt-handle {
  color: #ff00ff !important;
  text-shadow: 0 0 8px #ff00ff !important;
}

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

.loading {
  opacity: 0.5;
  pointer-events: none;
}

.fading {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pulse {
  animation: utilPulse 1s ease-in-out infinite;
}

@keyframes utilPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================================
   NETWORK STATUS
============================================================ */
body.offline {
  position: relative;
}

body.offline::after {
  content: '// SIGNAL LOST';
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 0, 0, 0.9);
  color: #fff;
  padding: 6px 16px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  z-index: 999999;
  animation: offlinePulse 1.5s ease-in-out infinite;
}

@keyframes offlinePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

body.offline #glitchGhost {
  filter: grayscale(0.8) brightness(0.6);
}

body.offline .terminal {
  opacity: 0.7;
}
