/* CRT Screen Overlay & Retro Tube Effect */
#crt-overlay,
#crt-overlay::before,
#crt-overlay::after,
.crt-beam {
  pointer-events: none !important;
}

#crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: none;
  overflow: hidden;
}

body.crt-active #crt-overlay {
  display: block;
}

/* CRT Scanlines (Thin & Crisp for 100% Text Readability) */
#crt-overlay::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.06) 50%
  );
  background-size: 100% 3px;
  z-index: 2;
  pointer-events: none !important;
}

/* CRT Screen Flicker (Subtle Retro Glow) */
#crt-overlay::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: rgba(18, 16, 16, 0.02);
  opacity: 0;
  z-index: 2;
  pointer-events: none !important;
  animation: crtFlicker 0.3s infinite;
}

@keyframes crtFlicker {
  0% { opacity: 0.03; }
  50% { opacity: 0.06; }
  100% { opacity: 0.03; }
}

/* CRT Vignette for Dark Theme only */
body.crt-active:not([data-theme="gameboy"]) {
  box-shadow: inset 0 0 80px rgba(0,0,0,0.6);
}

body.crt-active:not([data-theme="gameboy"]) h1, 
body.crt-active:not([data-theme="gameboy"]) h2, 
body.crt-active:not([data-theme="gameboy"]) h3,
body.crt-active:not([data-theme="gameboy"]) .pixel-text {
  text-shadow: 1px 0 2px rgba(255,0,0,0.4), -1px 0 2px rgba(0,255,255,0.4);
}

/* CRT Scanline Beam animation */
.crt-beam {
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 20%;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 243, 255, 0.04) 50%, transparent 100%);
  animation: scanlineSweep 8s linear infinite;
  pointer-events: none !important;
  z-index: 3;
}

@keyframes scanlineSweep {
  0% { top: -20%; }
  100% { top: 120%; }
}
