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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0d0014;
  font-family: sans-serif;
  overflow: hidden;
  position: relative;
}

/* ── CANVAS ── */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── DEPTH FOG ── */
#fog {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse 72% 62% at 50% 50%, transparent 28%, rgba(4,0,10,0.58) 100%);
  animation: fog-breathe 4.5s ease-in-out infinite;
}

@keyframes fog-breathe {
  0%, 100% { opacity: 0.8; }
  50%       { opacity: 0.42; }
}

/* ── POWER FLICKER ── */
#flicker {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: #000;
  opacity: 0;
}

/* ── SCANLINES ── */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.08) 3px,
    rgba(0,0,0,0.08) 4px
  );
  opacity: 0;
  transition: opacity 0.4s;
}
body.show-scanlines .scanlines {
  opacity: 1;
}

/* ── STAGE ── */
.pulse-stage {
  position: relative;
  z-index: 10;
  text-align: center;
  user-select: none;
}

.pulse-word {
  display: inline-flex;
  gap: 0;
  position: relative;
}

/* ── CHROMATIC ABERRATION GHOSTS ── */
.pulse-word::before,
.pulse-word::after {
  content: 'PULSE';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  font-family: 'Bitcount Single', monospace;
  font-size: clamp(50px, 10vw, 100px);
  font-weight: 300;
  letter-spacing: 0.08em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s;
  white-space: nowrap;
}
.pulse-word::before {
  color: rgba(210, 80, 255, 0.5);
  transform: translateX(-5px) translateY(-1px);
}
.pulse-word::after {
  color: rgba(110, 0, 220, 0.45);
  transform: translateX(5px) translateY(1px);
}
.pulse-word.chroma::before,
.pulse-word.chroma::after {
  opacity: 1;
}

/* ── LETTERS ── */
.pulse-letter {
  font-family: 'Bitcount Single', monospace;
  font-size: clamp(50px, 10vw, 100px);
  font-weight: 300;
  color: #fff;
  display: inline-block;
  line-height: 1;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateY(20px) scale(0.92);
  transition: opacity 0.7s ease, transform 0.7s ease;
  text-shadow:
    0 0 8px  var(--g1),
    0 0 20px var(--g1),
    0 0 45px var(--g2),
    0 0 90px var(--g3);
  animation: glow-pulse 4.5s ease-in-out infinite;
}

.pulse-letter.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* cursor proximity boost */
.pulse-letter.lit {
  animation: none !important;
  text-shadow:
    0 0 10px var(--g0),
    0 0 26px var(--g1),
    0 0 55px var(--g1),
    0 0 100px var(--g2),
    0 0 170px var(--g3) !important;
}

/* ── ANIMATIONS ── */
@keyframes glow-pulse {
  0% {
    opacity: 0.06;
    text-shadow: 0 0 4px var(--g2), 0 0 12px var(--g3);
  }
  38% {
    opacity: 1;
    text-shadow:
      0 0 14px var(--g0),
      0 0 32px var(--g1),
      0 0 70px var(--g2),
      0 0 130px var(--g3),
      0 0 200px var(--g3);
  }
  62% {
    opacity: 1;
    text-shadow:
      0 0 14px var(--g0),
      0 0 32px var(--g1),
      0 0 70px var(--g2),
      0 0 130px var(--g3),
      0 0 200px var(--g3);
  }
  100% {
    opacity: 0.06;
    text-shadow: 0 0 4px var(--g2), 0 0 12px var(--g3);
  }
}

@keyframes letter-glitch {
  0%   { filter: blur(0px);  transform: translateX(0px);  opacity: 1;    }
  8%   { filter: blur(6px);  transform: translateX(3px);  opacity: 0.28; }
  15%  { filter: blur(3px);  transform: translateX(-2px); opacity: 0.65; }
  22%  { filter: blur(0px);  transform: translateX(0px);  opacity: 1;    }
  100% { filter: blur(0px);  transform: translateX(0px);  opacity: 1;    }
}
