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

#laser-debug-hud {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.85); color: #0ff; font-family: 'Orbitron', monospace;
  font-size: 13px; padding: 8px 16px; border: 1px solid #0ff; border-radius: 4px;
  z-index: 100; pointer-events: none; white-space: pre; display: none;
  text-shadow: 0 0 4px #0ff;
}

#enemy-markers {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 9; overflow: hidden;
}
.enemy-ring {
  position: absolute;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.35))
         drop-shadow(0 0 14px rgba(0,207,255,0.1));
  animation: ringFlicker 1.8s steps(1) infinite, ringDistort 2.5s ease-in-out infinite;
}
.enemy-ring svg { width: 100%; height: 100%; overflow: visible; }
.enemy-ring line { opacity: 0.5; }
/* Red octagonal ghost — centered, flashing */
.enemy-ring::before {
  content: '';
  position: absolute; top: 10%; left: 10%; width: 80%; height: 80%;
  border: 1.5px solid rgba(255, 34, 85, 0.35);
  clip-path: polygon(82% 0%, 18% 0%, 0% 25%, 0% 75%, 18% 100%, 82% 100%, 100% 75%, 100% 25%);
  filter: blur(0.5px);
  animation: redGhostFlash 1s steps(1) infinite;
}
/* Cyan octagonal ghost — centered */
.enemy-ring::after {
  content: '';
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border: 1.5px solid rgba(0, 207, 255, 0.25);
  clip-path: polygon(82% 0%, 18% 0%, 0% 25%, 0% 75%, 18% 100%, 82% 100%, 100% 75%, 100% 25%);
  filter: blur(0.5px);
}
@keyframes ringFlicker {
  0%   { opacity: 0.8; }
  5%   { opacity: 0; }
  6%   { opacity: 0.7; }
  10%  { opacity: 0; }
  11%  { opacity: 0.9; }
  30%  { opacity: 1; }
  35%  { opacity: 0; }
  36%  { opacity: 0; }
  38%  { opacity: 0.6; }
  55%  { opacity: 1; }
  60%  { opacity: 0; }
  61%  { opacity: 0.8; }
  78%  { opacity: 1; }
  80%  { opacity: 0; }
  81%  { opacity: 0; }
  83%  { opacity: 0.9; }
  100% { opacity: 0.8; }
}
@keyframes redGhostFlash {
  0%   { opacity: 0; }
  8%   { opacity: 0.8; }
  16%  { opacity: 0; }
  50%  { opacity: 0; }
  58%  { opacity: 0.8; }
  66%  { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes ringDistort {
  0%, 100% { clip-path: none; }
  15% { clip-path: inset(0 0 0 0); }
  16% { clip-path: inset(30% 0 60% 0); }
  17% { clip-path: none; }
  48% { clip-path: none; }
  49% { clip-path: inset(60% 0 20% 0); }
  50% { clip-path: none; }
  82% { clip-path: none; }
  83% { clip-path: inset(10% 0 80% 0); }
  84% { clip-path: none; }
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050510;
  font-family: 'Orbitron', monospace, sans-serif;
}

/* ── LOADING SCREEN ── */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #050510;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  transition: opacity 0.6s ease-out;
}
#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}
#loading-logo {
  width: 220px;
  height: auto;
  filter: drop-shadow(0 0 20px #ff225588) drop-shadow(0 0 40px #00cfff44);
  animation: logoPulse 2s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 20px #ff225588) drop-shadow(0 0 40px #00cfff44); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 30px #ff2255aa) drop-shadow(0 0 60px #00cfff66); transform: scale(1.03); }
}
#loading-bar-container {
  width: 300px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 8px #ff225533;
}
#loading-bar {
  width: 0%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #ff2255, #00cfff, #ff2255);
  background-size: 200% 100%;
  box-shadow: 0 0 12px #ff225588, 0 0 24px #00cfff44;
  animation: barShimmer 1.5s linear infinite;
  transition: width 0.3s ease-out;
}
@keyframes barShimmer {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
#loading-text {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 14px;
  letter-spacing: 6px;
  color: #ff2255;
  text-shadow: 0 0 10px #ff225588, 2px 1px 0 #00cfff44;
  animation: loadTextFlicker 0.8s steps(3) infinite;
}
@keyframes loadTextFlicker {
  0%, 100% { opacity: 1; }
  33%      { opacity: 0.6; }
  66%      { opacity: 0.9; }
}

/* ── BG VIDEO ── */
#bg-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 0;
  opacity: 0.5;
}

#renderCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  outline: none;
  touch-action: none;
  z-index: 1;
}

/* ── PERMANENT SCANLINES ── */
#scanlines {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.12) 3px,
    rgba(0, 0, 0, 0.12) 4px
  );
  mix-blend-mode: multiply;
}
#scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}

/* ── DAMAGE INTERFERENCE LINES ── */
#dmg-lines {
  position: fixed;
  inset: 0;
  z-index: 46;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 2px,
      rgba(255, 34, 85, 0.25) 2px,
      rgba(255, 34, 85, 0.25) 3px,
      transparent 3px,
      transparent 6px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 8px,
      rgba(0, 207, 255, 0.12) 8px,
      rgba(0, 207, 255, 0.12) 9px,
      transparent 9px,
      transparent 14px
    );
}
#dmg-lines {
  --sl-int: 1;
}
#dmg-lines.active {
  animation: dmgLines 0.5s ease-out forwards;
}
@keyframes dmgLines {
  0%   { opacity: calc(1.0 * var(--sl-int)); background-position: 0 0; }
  15%  { opacity: calc(0.6 * var(--sl-int)); background-position: 0 3px; }
  30%  { opacity: calc(0.9 * var(--sl-int)); background-position: 0 -2px; }
  50%  { opacity: calc(0.4 * var(--sl-int)); background-position: 0 5px; }
  70%  { opacity: calc(0.6 * var(--sl-int)); background-position: 0 -1px; }
  85%  { opacity: calc(0.2 * var(--sl-int)); background-position: 0 2px; }
  100% { opacity: 0; background-position: 0 0; }
}

/* ── HUD LIFE ── */
#hud-life {
  position: fixed;
  bottom: 60px;
  left: 80px;
  z-index: 30;
  font-size: 17.5px;
  letter-spacing: 3px;
  color: #ff2255;
  text-transform: uppercase;
  text-shadow: 0 0 8px #ff2255, 0 0 20px #ff225566;
  font-family: 'Orbitron', monospace, sans-serif;
  transition: opacity 0.1s;
}
#life-bar {
  color: #ff2255;
  text-shadow: 0 0 10px #ff2255;
}
#hud-life.hit {
  animation: lifeHit 0.3s ease-out;
}
@keyframes lifeHit {
  0%   { color: #fff; text-shadow: 0 0 20px #fff; }
  100% { color: #ff2255; text-shadow: 0 0 8px #ff2255; }
}

/* ── HUD AMMO ── */
#hud-ammo {
  position: fixed;
  bottom: 34px;
  left: 80px;
  z-index: 30;
  font-size: 17.5px;
  letter-spacing: 3px;
  color: #00cfff;
  text-transform: uppercase;
  text-shadow: 0 0 8px #00cfff, 0 0 20px #00cfff66;
  font-family: 'Orbitron', monospace, sans-serif;
}
#ammo-count {
  color: #00cfff;
  text-shadow: 0 0 10px #00cfff;
}
#hud-ammo.low {
  color: #ff2255;
  text-shadow: 0 0 8px #ff2255;
  animation: ammoLow 0.5s ease-in-out infinite;
}
#hud-ammo.low #ammo-count {
  color: #ff2255;
  text-shadow: 0 0 10px #ff2255;
}
@keyframes ammoLow {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
#hud-ammo.pickup {
  animation: ammoPickup 0.3s ease-out;
}
@keyframes ammoPickup {
  0%   { color: #fff; text-shadow: 0 0 20px #fff; }
  100% { color: #00cfff; text-shadow: 0 0 8px #00cfff; }
}

/* ── NET AMMO HUD ── */
#hud-net-ammo {
  position: fixed;
  bottom: 34px;
  left: 220px;
  z-index: 30;
  font-size: 17.5px;
  letter-spacing: 3px;
  color: #c0c8e0;
  text-transform: uppercase;
  text-shadow: 0 0 8px #c0c8e0, 0 0 20px rgba(192,200,224,0.4);
  font-family: 'Orbitron', monospace, sans-serif;
}
#net-ammo-count {
  color: #c0c8e0;
  text-shadow: 0 0 10px #c0c8e0;
}
#hud-net-ammo.low {
  color: #ff2255;
  text-shadow: 0 0 8px #ff2255;
  animation: ammoLow 0.5s ease-in-out infinite;
}
#hud-net-ammo.low #net-ammo-count {
  color: #ff2255;
  text-shadow: 0 0 10px #ff2255;
}
#hud-net-ammo.pickup {
  animation: netAmmoPickup 0.3s ease-out;
}
@keyframes netAmmoPickup {
  0%   { color: #fff; text-shadow: 0 0 20px #fff; }
  100% { color: #c0c8e0; text-shadow: 0 0 8px #c0c8e0; }
}

/* ── BOLT AMMO HUD ── */
#hud-bolt-ammo {
  position: fixed;
  bottom: 34px;
  left: 340px;
  z-index: 30;
  font-size: 17.5px;
  letter-spacing: 3px;
  color: #4da6ff;
  text-transform: uppercase;
  text-shadow: 0 0 8px #4da6ff, 0 0 20px rgba(77,166,255,0.4);
  font-family: 'Orbitron', monospace, sans-serif;
}
#bolt-ammo-count {
  color: #4da6ff;
  text-shadow: 0 0 10px #4da6ff;
}
#hud-bolt-ammo.low {
  color: #ff2255;
  text-shadow: 0 0 8px #ff2255;
  animation: ammoLow 0.5s ease-in-out infinite;
}
#hud-bolt-ammo.low #bolt-ammo-count {
  color: #ff2255;
  text-shadow: 0 0 10px #ff2255;
}

/* ── WEAPON HUD ── */
#hud-weapon {
  position: fixed;
  bottom: 8px;
  left: 80px;
  z-index: 30;
  font-size: 17.5px;
  letter-spacing: 3px;
  color: #00cfff;
  text-transform: uppercase;
  text-shadow: 0 0 8px #00cfff, 0 0 20px #00cfff66;
  font-family: 'Orbitron', monospace, sans-serif;
  transition: color 0.2s, text-shadow 0.2s;
}
#hud-weapon.net {
  color: #c0c8e0;
  text-shadow: 0 0 8px #c0c8e0, 0 0 20px rgba(192,200,224,0.4);
}

/* ── NET CROSSHAIR FEEDBACK ── */
#crosshair.net-fire::before, #crosshair.net-fire::after {
  background: #c0c8e0;
  box-shadow: 0 0 10px #c0c8e0, 0 0 25px rgba(192, 200, 224, 0.7), 0 0 50px rgba(192, 200, 224, 0.3);
  transform: scale(1.2);
}

/* ── POWER NET CROSSHAIR FEEDBACK ── */
#crosshair.power-net-fire::before, #crosshair.power-net-fire::after {
  background: #d580ff;
  box-shadow: 0 0 14px #b040ff, 0 0 35px rgba(176, 64, 255, 0.9),
              0 0 70px rgba(255, 34, 85, 0.4), 0 0 100px rgba(176, 64, 255, 0.3);
  transform: scale(1.5);
}
#crosshair.power-net-fire::before {
  width: 16px;
  left: -8px;
}
#crosshair.power-net-fire::after {
  height: 16px;
  top: -8px;
}

/* ── LOW AMMO SCREEN WARNING ── */
#low-ammo-warn {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 35;
  pointer-events: none;
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: #ff2255;
  text-shadow:
    0 0 12px #ff2255,
    0 0 40px #ff225588,
    3px 2px 0 #00cfff88,
    -2px -1px 0 #ff225588;
  opacity: 0;
  display: none;
  animation: lowAmmoWarn 0.6s ease-in-out infinite;
}
#low-ammo-warn.active {
  display: block;
}
@keyframes lowAmmoWarn {
  0%, 100% { opacity: 0.9; transform: translate(-50%, -50%) skewX(0deg); }
  15%      { opacity: 0.3; transform: translate(-48%, -50%) skewX(-2deg); }
  30%      { opacity: 1;   transform: translate(-50%, -50%) skewX(0deg); }
  50%      { opacity: 0.5; transform: translate(-52%, -50%) skewX(1.5deg); }
  70%      { opacity: 1;   transform: translate(-50%, -50%) skewX(0deg); }
  85%      { opacity: 0.2; transform: translate(-49%, -51%) skewX(-1deg); }
}

/* ── HEALTH CRITICAL SCREEN WARNING ── */
#health-critical-warn {
  position: fixed;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 35;
  pointer-events: none;
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: #ff2255;
  text-shadow:
    0 0 14px #ff2255,
    0 0 50px #ff225599,
    4px 3px 0 #ff880066,
    -3px -2px 0 #ff225566;
  opacity: 0;
  display: none;
  animation: healthCritWarn 0.5s ease-in-out infinite;
}
#health-critical-warn.active {
  display: block;
}
@keyframes healthCritWarn {
  0%, 100% { opacity: 0.95; transform: translate(-50%, -50%) skewX(0deg) scale(1); }
  12%      { opacity: 0.2;  transform: translate(-48%, -50%) skewX(-3deg) scale(1.02); }
  25%      { opacity: 1;    transform: translate(-50%, -50%) skewX(0deg) scale(1); }
  40%      { opacity: 0.4;  transform: translate(-53%, -50%) skewX(2deg) scale(0.98); }
  60%      { opacity: 1;    transform: translate(-50%, -50%) skewX(0deg) scale(1); }
  80%      { opacity: 0.15; transform: translate(-50%, -52%) skewX(-1.5deg) scale(1.01); }
}

/* ── SHIELD LOW WARNING ── */
#shield-low-warn {
  position: fixed;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 35;
  pointer-events: none;
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: #00bbff;
  text-shadow:
    0 0 14px #00bbff,
    0 0 50px #00bbff99,
    4px 3px 0 #0066ff66,
    -3px -2px 0 #00bbff66;
  opacity: 0;
  display: none;
  animation: shieldLowWarn 0.5s ease-in-out infinite;
}
#shield-low-warn.active {
  display: block;
}
@keyframes shieldLowWarn {
  0%, 100% { opacity: 0.95; transform: translate(-50%, -50%) skewX(0deg) scale(1); }
  12%      { opacity: 0.2;  transform: translate(-48%, -50%) skewX(-3deg) scale(1.02); }
  25%      { opacity: 1;    transform: translate(-50%, -50%) skewX(0deg) scale(1); }
  40%      { opacity: 0.4;  transform: translate(-53%, -50%) skewX(2deg) scale(0.98); }
  60%      { opacity: 1;    transform: translate(-50%, -50%) skewX(0deg) scale(1); }
  80%      { opacity: 0.15; transform: translate(-50%, -52%) skewX(-1.5deg) scale(1.01); }
}

/* ── HEALTH CRITICAL DISTORTION LINES ── */
#crit-distortion {
  position: fixed;
  inset: 0;
  z-index: 42;
  pointer-events: none;
  display: none;
  overflow: hidden;
  mix-blend-mode: screen;
}
#crit-distortion.active {
  display: block;
}
#crit-distortion::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 10px,
      rgba(255, 34, 85, 0.015) 10px,
      rgba(255, 34, 85, 0.015) 11px,
      transparent 11px,
      transparent 28px,
      rgba(0, 207, 255, 0.01) 28px,
      rgba(0, 207, 255, 0.01) 29px
    );
  animation: critScanDrift 2.5s linear infinite;
}
#crit-distortion::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 20%,
    rgba(255, 255, 255, 0.7) 50%,
    rgba(255, 255, 255, 0.5) 80%,
    transparent 100%
  );
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.5), 0 0 40px rgba(255, 34, 85, 0.3);
  animation: critBarSweep 2.5s ease-in-out infinite;
}
@keyframes critScanDrift {
  0%   { transform: translateY(0); }
  100% { transform: translateY(29px); }
}
@keyframes critBarSweep {
  0%   { top: -4px;  opacity: 0; }
  10%  { opacity: 1; }
  50%  { top: 100%;  opacity: 0.8; }
  90%  { opacity: 1; }
  100% { top: -4px;  opacity: 0; }
}

/* ── HEALTH CRITICAL GLITCH ON CANVAS — 3 intensity levels ── */
/* Level 1 (low): subtle jitter + color shift, no clip-path */
#renderCanvas.crit-glitch-1 {
  animation: critGlitch1 0.3s steps(3) infinite;
}
@keyframes critGlitch1 {
  0%   { transform: translate(0, 0);                    filter: none; }
  20%  { transform: translate(-2px, 1px) skewX(0.3deg); filter: hue-rotate(40deg) saturate(1.4); }
  50%  { transform: translate(0, 0);                    filter: none; }
  70%  { transform: translate(3px, -1px);               filter: hue-rotate(-30deg); }
  100% { transform: translate(0, 0);                    filter: none; }
}
/* Level 2 (light VHS): small dropout bands + mild color shift */
#renderCanvas.crit-glitch-2 {
  animation: critGlitch2 0.25s steps(3) infinite;
}
@keyframes critGlitch2 {
  0%   { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
  20%  { clip-path: inset(0 0 0 0);       transform: translate(-3px, 1px) skewX(0.5deg); filter: hue-rotate(60deg) saturate(1.6); }
  40%  { clip-path: inset(42% 0 52% 0);   transform: translate(0, 0);                    filter: hue-rotate(80deg) saturate(1.3); }
  60%  { clip-path: inset(0 0 0 0);       transform: translate(3px, -1px);               filter: none; }
  80%  { clip-path: inset(78% 0 16% 0);   transform: translate(-2px, 1px);               filter: hue-rotate(-40deg) saturate(1.8); }
  100% { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
}
/* Level 3 (medium VHS): wider dropout bands + moderate color warp */
#renderCanvas.crit-glitch-3 {
  animation: critGlitch3 0.2s steps(3) infinite;
}
@keyframes critGlitch3 {
  0%   { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
  15%  { clip-path: inset(0 0 0 0);       transform: translate(-4px, 1px) skewX(0.7deg); filter: hue-rotate(90deg) saturate(2); }
  30%  { clip-path: inset(35% 0 58% 0);   transform: translate(0, 0);                    filter: hue-rotate(120deg) saturate(1.5); }
  50%  { clip-path: inset(0 0 0 0);       transform: translate(5px, -1px);               filter: none; }
  70%  { clip-path: inset(72% 0 18% 0);   transform: translate(-3px, 2px) skewX(-0.5deg);filter: hue-rotate(-60deg) saturate(2.5); }
  100% { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
}
/* Level 4 (heavy VHS): large dropout bands + strong color warp */
#renderCanvas.crit-glitch-4 {
  animation: critGlitch4 0.15s steps(2) infinite;
}
@keyframes critGlitch4 {
  0%   { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
  12%  { clip-path: inset(25% 0 60% 0);   transform: translate(-6px, 2px) skewX(1.2deg); filter: hue-rotate(90deg) saturate(3); }
  30%  { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
  45%  { clip-path: inset(65% 0 10% 0);   transform: translate(8px, -3px) skewX(-1deg);  filter: hue-rotate(-80deg) saturate(2); }
  60%  { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: saturate(4) brightness(1.3); }
  80%  { clip-path: inset(10% 0 78% 0);   transform: translate(-5px, 3px);               filter: hue-rotate(150deg); }
  100% { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
}
/* Level 5 (extreme): aggressive retro VHS — massive bands + heavy warp */
#renderCanvas.crit-glitch-5 {
  animation: critGlitch5 0.12s steps(2) infinite;
}
@keyframes critGlitch5 {
  0%   { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
  10%  { clip-path: inset(15% 0 55% 0);   transform: translate(-8px, 3px) skewX(2deg);   filter: hue-rotate(120deg) saturate(4) brightness(1.4); }
  25%  { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
  40%  { clip-path: inset(55% 0 5% 0);    transform: translate(10px, -4px) skewX(-1.5deg);filter: hue-rotate(-100deg) saturate(3); }
  55%  { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: saturate(5) brightness(1.5) contrast(1.3); }
  70%  { clip-path: inset(5% 0 70% 0);    transform: translate(-7px, 4px) skewX(1deg);   filter: hue-rotate(180deg) saturate(2); }
  85%  { clip-path: inset(70% 0 8% 0);    transform: translate(6px, -2px);               filter: hue-rotate(-60deg) brightness(0.7); }
  100% { clip-path: inset(0 0 0 0);       transform: translate(0, 0);                    filter: none; }
}
/* Legacy class name maps to level 3 (default) */
#renderCanvas.crit-glitch {
  animation: critGlitch3 0.2s steps(3) infinite;
}

/* ── VHS STATIC ── */
#vhs-static {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  background-size: 4px 4px;
}
#vhs-static::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.3) 2px,
    rgba(0, 0, 0, 0.3) 4px
  );
  pointer-events: none;
}
#vhs-static.active {
  animation-name: vhsFlash;
  animation-duration: 0.35s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}
@keyframes vhsFlash {
  0%   { opacity: 0.95; }
  15%  { opacity: 0.45; }
  30%  { opacity: 0.8; }
  50%  { opacity: 0.25; }
  70%  { opacity: 0.5; }
  100% { opacity: 0; }
}

/* ── DAMAGE VIGNETTE ── */
#dmg-vignette {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(255,34,85,0.8) 100%);
}
#dmg-vignette.active {
  animation: dmgVig 0.5s ease-out forwards;
}
@keyframes dmgVig {
  0%   { opacity: 1; }
  15%  { opacity: 0.65; }
  35%  { opacity: 0.85; }
  55%  { opacity: 0.4; }
  75%  { opacity: 0.2; }
  100% { opacity: 0; }
}

/* ── SCREEN SHAKE ── */
@keyframes screenShake {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(calc(-6px * var(--sk)), calc(3px * var(--sk))); }
  20%  { transform: translate(calc(4px * var(--sk)), calc(-5px * var(--sk))); }
  30%  { transform: translate(calc(-3px * var(--sk)), calc(5px * var(--sk))); }
  40%  { transform: translate(calc(5px * var(--sk)), calc(-2px * var(--sk))); }
  50%  { transform: translate(calc(-4px * var(--sk)), calc(-3px * var(--sk))); }
  60%  { transform: translate(calc(3px * var(--sk)), calc(4px * var(--sk))); }
  70%  { transform: translate(calc(-2px * var(--sk)), calc(-5px * var(--sk))); }
  80%  { transform: translate(calc(4px * var(--sk)), calc(2px * var(--sk))); }
  90%  { transform: translate(calc(-3px * var(--sk)), calc(3px * var(--sk))); }
  100% { transform: translate(0, 0); }
}
#renderCanvas.shake {
  animation: screenShake 0.38s ease-out;
}

/* ── CROSSHAIR ── */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
}
#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: #ff225599;
  box-shadow: 0 0 4px #ff2255, 0 0 8px #ff225566;
  transition: all 0.06s ease-out;
}
#crosshair::before {
  width: 18px;
  height: 2px;
  top: -1px;
  left: -9px;
}
#crosshair::after {
  width: 2px;
  height: 18px;
  top: -9px;
  left: -1px;
}
#crosshair.fire::before,
#crosshair.fire::after {
  background: #ff2255;
  box-shadow: 0 0 10px #ff2255, 0 0 25px rgba(255, 34, 85, 0.8), 0 0 50px rgba(255, 34, 85, 0.4);
}
#crosshair.fire::before {
  width: 14.4px;
  left: -7.2px;
}
#crosshair.fire::after {
  height: 14.4px;
  top: -7.2px;
}
/* Power shot crosshair — intense glow + cyan tint */
#crosshair.power::before,
#crosshair.power::after {
  background: #fff;
  box-shadow: 0 0 12px #00cfff, 0 0 30px rgba(0, 207, 255, 0.9), 0 0 60px rgba(255, 34, 85, 0.6), 0 0 90px rgba(0, 207, 255, 0.3);
}
#crosshair.power::before {
  width: 14.4px;
  left: -7.2px;
}
#crosshair.power::after {
  height: 14.4px;
  top: -7.2px;
}

/* ── BODY COLLISION DOTS (hidden) ── */
.body-dot {
  display: none;
}

/* ── COUNTDOWN TIMER ── */
#countdown {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 12px rgba(255,255,255,0.5), 0 0 30px rgba(255,34,85,0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
#countdown.active { opacity: 1; }
#countdown.urgent {
  color: #ff2255;
  text-shadow: 0 0 14px #ff2255, 0 0 40px #ff225588;
  animation: countdownPulse 0.5s ease-in-out infinite;
}
@keyframes countdownPulse {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50%      { opacity: 0.6; transform: translateX(-50%) scale(1.05); }
}

#zrotate-timer {
  position: fixed;
  top: 18px;
  left: 20px;
  z-index: 30;
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ff2255;
  text-shadow: 0 0 10px #ff2255, 0 0 25px #ff225588;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
#zrotate-timer.active { opacity: 1; }

#shield-power-bar {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 34, 85, 0.5);
  border-radius: 4px;
  z-index: 30;
  pointer-events: none;
  opacity: 1;
}
#shield-power-bar.cooldown { border-color: rgba(100, 100, 100, 0.4); }
#shield-power-fill {
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: #00ccaa;
  transition: width 0.05s linear;
  box-shadow: 0 0 10px #00ccaa88, inset 0 0 4px rgba(255,255,255,0.1);
}
#shield-power-ext {
  position: absolute;
  top: -1px;
  right: -1px;
  height: calc(100% + 2px);
  width: 0;
  border-radius: 0 4px 4px 0;
  background: rgba(255, 136, 0, 0.3);
  border: 1px solid rgba(255, 136, 0, 0.5);
  border-left: none;
  box-shadow: 0 0 8px #ff880088;
  box-sizing: border-box;
  transition: width 0.3s ease, opacity 0.2s;
}
#shield-power-label {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 28px;
  letter-spacing: 4px;
  color: #ff2255;
  text-shadow: 0 0 8px #ff2255, 0 0 20px #ff225566;
  text-transform: uppercase;
  white-space: nowrap;
}
#shield-power-label.low {
  animation: shieldLabelFlash 0.5s ease-in-out infinite;
}
@keyframes shieldLabelFlash {
  0%, 100% { opacity: 1; color: #ff2255; text-shadow: 0 0 8px #ff2255, 0 0 20px #ff225566; transform: translateX(-50%) scale(1); }
  25% { opacity: 0; }
  50% { opacity: 1; color: #ffffff; text-shadow: 0 0 20px #ff2255, 0 0 40px #ff2255, 0 0 60px #ff225588; transform: translateX(-50%) scale(1.08); }
  75% { opacity: 0.15; }
}

/* ── SHIELD BORDER GLOW ── */
#shield-border-glow {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 25;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  background:
    /* Corner glows — tighter */
    radial-gradient(ellipse at 0% 0%, rgba(0, 180, 255, 0.55) 0%, rgba(0, 140, 255, 0.15) 10%, transparent 22%),
    radial-gradient(ellipse at 100% 0%, rgba(0, 180, 255, 0.55) 0%, rgba(0, 140, 255, 0.15) 10%, transparent 22%),
    radial-gradient(ellipse at 0% 100%, rgba(0, 180, 255, 0.55) 0%, rgba(0, 140, 255, 0.15) 10%, transparent 22%),
    radial-gradient(ellipse at 100% 100%, rgba(0, 180, 255, 0.55) 0%, rgba(0, 140, 255, 0.15) 10%, transparent 22%);
  box-shadow:
    inset 0 0 45px rgba(0, 160, 255, 0.3),
    inset 0 0 15px rgba(0, 200, 255, 0.45),
    inset 0 0 80px rgba(0, 140, 255, 0.08);
}
#shield-border-glow.active {
  opacity: 1;
}

/* ── TUTORIAL OVERLAY ── */
#tutorial-overlay {
  position: fixed;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  pointer-events: none;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s;
}
#tutorial-overlay.active { opacity: 1; }
#tutorial-text {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 6px;
  color: #00cfff;
  text-shadow: 0 0 14px #00cfff, 0 0 40px #00cfff66;
  text-transform: uppercase;
  margin-bottom: 14px;
}
#tutorial-sub {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 20px;
  letter-spacing: 5px;
  color: #ffffffaa;
  text-transform: uppercase;
  margin-bottom: 16px;
}
#tutorial-skip {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 22px;
  letter-spacing: 5px;
  color: #00cfff;
  text-shadow: 0 0 8px #00cfff88;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.4s;
  margin-top: 8px;
}
#tutorial-skip.visible {
  animation: tutSkipPulse 1s ease-in-out infinite;
}
@keyframes tutSkipPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.3; }
}

/* ── LEVEL COMPLETE OVERLAY ── */
#level-complete {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 16, 0);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s, background 0.8s;
}
#level-complete.active {
  opacity: 1;
  background: rgba(5, 5, 16, 0.85);
}
#lc-text {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 68px;
  font-weight: 900;
  letter-spacing: 10px;
  color: #ff2255;
  text-shadow: 0 0 20px #ff2255, 0 0 60px #ff225588, 4px 3px 0 #00cfff66;
  transform: scale(0.5);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.18, 1.2, 0.4, 1), opacity 0.4s;
}
#level-complete.active #lc-text {
  transform: scale(1);
  opacity: 1;
}
#lc-sub {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 22px;
  letter-spacing: 6px;
  color: #00cfff;
  text-shadow: 0 0 12px #00cfff88;
  margin-top: 16px;
  opacity: 0;
  transition: opacity 0.5s 0.4s;
}
#level-complete.active #lc-sub { opacity: 1; }

/* ── CLICK PROMPT ── */
/* ── MODE SELECT ── */
#mode-select {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
}
#mode-select.hidden { display: none; }

/* ── DIFFICULTY SELECTOR ── */
#difficulty-select {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 220px));
  z-index: 24;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
#difficulty-select.visible { display: flex; }
#diff-label {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 16px;
  letter-spacing: 4px;
  color: #ffffff99;
  text-transform: uppercase;
}
#diff-name {
  color: #00cfff;
  text-shadow: 0 0 8px #00cfff88;
}
#diff-slider {
  width: 220px;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(to right, #00cfff, #ffcc00, #ff2255);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
#diff-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px #00cfff;
  cursor: pointer;
}
#diff-range {
  display: flex;
  justify-content: space-between;
  width: 220px;
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
  color: #ffffff44;
  text-transform: uppercase;
}

#mode-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  letter-spacing: 6px;
  color: #00d2ff;
  text-shadow: 0 0 10px #00d2ff, 0 0 24px #00d2ff44;
  margin-bottom: 6px;
}
.mode-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  letter-spacing: 4px;
  padding: 10px 32px;
  background: transparent;
  border: 1px solid #ff225566;
  color: #ff225599;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s;
  min-width: 220px;
}
.mode-btn:hover {
  border-color: #ff2255;
  color: #ff2255;
  text-shadow: 0 0 8px #ff2255;
}
.mode-btn.selected {
  border-color: #00d2ff;
  color: #00d2ff;
  background: rgba(0, 210, 255, 0.08);
  text-shadow: 0 0 8px #00d2ff;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
}

#click-prompt {
  position: fixed;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-size: 32px;
  letter-spacing: 8px;
  color: #ff2255;
  text-transform: uppercase;
  text-shadow: 0 0 14px #ff2255, 0 0 32px #ff225566;
  animation: promptPulse 1.5s ease-in-out infinite;
  pointer-events: none;
}
#click-prompt.hidden { display: none; }

@keyframes promptPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ── PAUSE OVERLAY ── */
#pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 5, 16, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  animation: pauseFadeIn 0.5s ease-out forwards;
}
#pause-overlay.hidden {
  display: none;
}
#pause-overlay.fade-out {
  animation: pauseFadeOut 1s ease-in forwards;
  pointer-events: none;
}
@keyframes pauseFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes pauseFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#pause-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transform: scale(0.8);
  animation: pauseContentIn 0.5s ease-out forwards;
}
@keyframes pauseContentIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
#pause-logo {
  width: 180px;
  height: auto;
  filter: drop-shadow(0 0 20px #ff225588) drop-shadow(0 0 40px #00cfff44);
  animation: logoPulse 2s ease-in-out infinite;
}
#pause-label {
  font-size: 14px;
  letter-spacing: 8px;
  color: #ff2255;
  text-transform: uppercase;
  text-shadow: 0 0 14px #ff2255, 0 0 32px #ff225566;
  animation: promptPulse 1.5s ease-in-out infinite;
}

/* ── AUDIO CONTROLS ── */
#audio-controls {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(5, 5, 16, 0.75);
  border: 1px solid #ff225544;
  border-radius: 4px;
  padding: 6px 10px;
}
#mute-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
#volume-slider {
  width: 80px;
  accent-color: #ff2255;
}

/* ── KNOB PANEL ── */
#knob-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(5, 5, 16, 0.75);
  border: 1px solid #ff225544;
  border-radius: 4px;
  padding: 10px 14px;
}
#knob-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 3px;
  color: #ff2255;
  text-transform: uppercase;
}
#knob-panel input[type="range"] {
  width: 120px;
  accent-color: #ff2255;
}
#knob-panel span {
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* ── SFX DROPDOWN ── */
#sfx-dropdown {
  border-top: 1px solid #ff225533;
  padding-top: 6px;
  margin-top: 2px;
}
#sfx-dropdown-toggle {
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 3px;
  color: #ff2255;
  text-transform: uppercase;
  user-select: none;
}
#sfx-dropdown-toggle:hover {
  color: #ff4477;
}
#sfx-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}

/* ── VIS DROPDOWN ── */
#vis-dropdown {
  border-top: 1px solid #ff225533;
  padding-top: 6px;
  margin-top: 2px;
}
#vis-dropdown-toggle {
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 3px;
  color: #ff2255;
  text-transform: uppercase;
  user-select: none;
}
#vis-dropdown-toggle:hover {
  color: #ff4477;
}
#vis-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}

/* ── OBS PASS/FAIL HUD ── */
#obs-result {
  position: fixed;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Orbitron', monospace;
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 12px;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  transition: none;
}
#obs-result.hidden { display: none; }
#obs-result.pass {
  color: #00ff88;
  text-shadow: 0 0 20px #00ff8866, 0 0 60px #00ff8833;
  animation: obsResultFade 1.5s ease-out forwards;
}
#obs-result.fail {
  color: #ff2244;
  text-shadow: 0 0 20px #ff224466, 0 0 60px #ff224433;
  animation: obsResultFade 1.5s ease-out forwards;
}
@keyframes obsResultFade {
  0% { opacity: 1; transform: translateX(-50%) scale(1.2); }
  30% { opacity: 1; transform: translateX(-50%) scale(1.0); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.9); }
}

/* ── OBS DROPDOWN ── */
#obs-dropdown {
  border-top: 1px solid #ff225533;
  padding-top: 6px;
  margin-top: 2px;
}
#obs-dropdown-toggle {
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 3px;
  color: #ff2255;
  text-transform: uppercase;
  user-select: none;
}
#obs-dropdown-toggle:hover {
  color: #ff4477;
}
#obs-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}

#shld-dropdown {
  border-top: 1px solid #ff225533;
  padding-top: 6px;
  margin-top: 2px;
}
#shld-dropdown-toggle {
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 3px;
  color: #ff2255;
  text-transform: uppercase;
  user-select: none;
}
#shld-dropdown-toggle:hover {
  color: #ff4477;
}
#shld-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}

/* ── FX PREVIEW DROPDOWN ── */
#fx-dropdown {
  border-top: 1px solid #ff225533;
  padding-top: 6px;
  margin-top: 2px;
}
#fx-dropdown-toggle {
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 3px;
  color: #ff2255;
  text-transform: uppercase;
  user-select: none;
}
#fx-dropdown-toggle:hover {
  color: #ff4477;
}
#fx-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}
#fx-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fx-btn {
  background: rgba(255, 34, 85, 0.15);
  border: 1px solid #ff225566;
  color: #ff6688;
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 2px;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s;
}
.fx-btn:hover {
  background: rgba(255, 34, 85, 0.35);
  border-color: #ff2255;
}
.fx-btn.active {
  background: rgba(255, 34, 85, 0.5);
  border-color: #ff2255;
  color: #fff;
}

/* ── FX PREVIEW: CHROMATIC ABERRATION ── */
#renderCanvas.fx-chromatic {
  filter: url(#fx-chromatic-filter);
}
/* ── FX PREVIEW: INVERT ── */
#renderCanvas.fx-invert {
  filter: invert(var(--fx-int, 0.8));
}
/* ── FX PREVIEW: BLOOM ── */
#renderCanvas.fx-bloom {
  filter: brightness(calc(1 + var(--fx-int, 0.8) * 1.5)) contrast(calc(1 + var(--fx-int, 0.8) * 0.5)) saturate(calc(1 + var(--fx-int, 0.8) * 2));
}

/* ── ITEM DEBUG PANEL ── */
#itemdebug-panel {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 16px;
  z-index: 100;
  background: rgba(5, 5, 16, 0.85);
  border: 1px solid #00d2ff88;
  border-radius: 4px;
  padding: 12px 16px;
  pointer-events: none;
  font-family: 'Orbitron', monospace;
}
#itemdebug-panel .dbg-title {
  font-size: 12px;
  letter-spacing: 5px;
  color: #00d2ff;
  text-shadow: 0 0 8px #00d2ff;
  margin-bottom: 10px;
  text-align: center;
  border-bottom: 1px solid #00d2ff44;
  padding-bottom: 6px;
}
.dbg-section {
  margin-bottom: 8px;
}
.dbg-subtitle {
  font-size: 9px;
  letter-spacing: 3px;
  color: #00d2ff88;
  margin-bottom: 4px;
}
.dbg-keys {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dbg-keys span {
  font-size: 9px;
  letter-spacing: 2px;
  color: #ff2255;
  padding: 3px 8px;
  border: 1px solid #ff225544;
  border-radius: 3px;
  text-align: center;
  text-shadow: 0 0 6px #ff2255;
}
.dbg-keys.remove span {
  color: #ff8800;
  border-color: #ff880044;
  text-shadow: 0 0 6px #ff8800;
}
.dbg-keys.controls span {
  color: #00d2ff;
  border-color: #00d2ff44;
  text-shadow: 0 0 6px #00d2ff;
}
#val-dbg-dist {
  color: #ff2255;
  font-weight: 700;
}

/* ── ATOM DEATH — VHS TRANSMISSION GLITCH ── */
#atom-glitch {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
}
#atom-glitch.active {
  opacity: 1;
}
/* Tracking bars — thick black horizontal bands that scroll down */
#atom-glitch .ag-bar {
  position: absolute;
  left: -5%;
  width: 110%;
  background: black;
  pointer-events: none;
  opacity: 0;
}
/* Canvas transmission distortion class */
#renderCanvas.atom-xmit {
  animation: atomXmit 0.7s ease-out forwards;
}
@keyframes atomXmit {
  0%   { filter: hue-rotate(0deg) brightness(1.8) saturate(2.5) contrast(1.3); }
  8%   { filter: hue-rotate(90deg) brightness(0.3) saturate(4.0) contrast(2.0); }
  15%  { filter: hue-rotate(-60deg) brightness(2.5) saturate(1.0) contrast(0.6); }
  22%  { filter: hue-rotate(180deg) brightness(0.1) saturate(3.0) contrast(2.5); }
  30%  { filter: hue-rotate(45deg) brightness(1.5) saturate(2.0) contrast(1.5); }
  38%  { filter: hue-rotate(-120deg) brightness(0.5) saturate(3.5) contrast(1.8); }
  48%  { filter: hue-rotate(30deg) brightness(1.2) saturate(1.5) contrast(1.2); }
  60%  { filter: hue-rotate(-15deg) brightness(0.8) saturate(1.3) contrast(1.1); }
  75%  { filter: hue-rotate(5deg) brightness(1.05) saturate(1.1) contrast(1.0); }
  100% { filter: hue-rotate(0deg) brightness(1.0) saturate(1.0) contrast(1.0); }
}
/* Chromatic aberration via box-shadows on the overlay */
#atom-glitch.active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0, 255, 120, 0.08) 3px,
    rgba(0, 255, 120, 0.08) 4px
  );
  animation: agScanRoll 0.5s linear;
}
@keyframes agScanRoll {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}
/* Signal noise overlay */
#atom-glitch.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 1px,
    rgba(255, 255, 255, 0.04) 1px,
    rgba(255, 255, 255, 0.04) 2px
  );
  animation: agNoise 0.08s steps(4) 8;
}
@keyframes agNoise {
  0%   { opacity: 1; transform: translateY(0); }
  25%  { opacity: 0.7; transform: translateY(-2px); }
  50%  { opacity: 1; transform: translateY(1px); }
  75%  { opacity: 0.5; transform: translateY(-1px); }
  100% { opacity: 1; transform: translateY(0); }
}
