/* Visual layers and effects styling.
   Add new effect-related styles here to keep layering consistent. */
canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  filter: blur(0.2px);
}

/* Sentinel canvas layer for enemy sprites. */
#sentinels {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

/* Rabbit canvas layer for the roaming link sprite. */
#rabbit {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--overlay-opacity);
  background: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.35) 100%),
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.08) 3px
    );
  mix-blend-mode: screen;
}

.glitch-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(
      to bottom,
      rgba(255, 0, 0, 0.12) 0px,
      rgba(255, 0, 0, 0.12) 2px,
      transparent 3px,
      transparent 6px
    ),
    linear-gradient(120deg, rgba(255, 0, 0, 0.18), transparent 60%);
  mix-blend-mode: screen;
}

.bg-text {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Impact", "Haettenschweiler", "Arial Black", sans-serif;
  font-size: var(--bg-font-size, 200px);
  letter-spacing: clamp(0.04em, 0.5vw, 0.1em);
  white-space: nowrap;
  color: rgba(var(--green-rgb), 0.08);
  text-transform: lowercase;
  text-shadow: 0 0 30px rgba(var(--green-rgb), 0.12);
  pointer-events: none;
  z-index: 0;
}

.bg-text-inner {
  display: inline-flex;
  align-items: center;
}

.bg-cursor {
  margin-left: 0.2em;
  color: rgba(var(--green-rgb), 0.12);
  animation: cursor-blink 1.2s steps(1, end) infinite;
}

@keyframes cursor-blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

canvas {
  z-index: 1;
}

#sentinels {
  z-index: 2;
}

#rabbit {
  z-index: 3;
}

.overlay {
  z-index: 4;
}

.glitch-layer {
  z-index: 5;
}

.badge {
  z-index: 6;
}

body.glitch canvas {
  filter: sepia(1) saturate(5) hue-rotate(-35deg);
}

body.glitch .glitch-layer {
  opacity: var(--glitch-opacity);
  animation: glitch-flicker 0.4s steps(2, end) infinite;
}

body.shake {
  animation: screen-shake 0.4s linear;
}

@keyframes screen-shake {
  0% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-3px, 2px);
  }
  20% {
    transform: translate(4px, -3px);
  }
  30% {
    transform: translate(-4px, 3px);
  }
  40% {
    transform: translate(3px, -2px);
  }
  50% {
    transform: translate(-2px, 1px);
  }
  60% {
    transform: translate(3px, 2px);
  }
  70% {
    transform: translate(-3px, -2px);
  }
  80% {
    transform: translate(2px, 3px);
  }
  90% {
    transform: translate(-2px, -3px);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes glitch-flicker {
  0% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.2;
  }
  100% {
    opacity: 0.5;
  }
}

.badge {
  position: fixed;
  right: 16px;
  bottom: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: var(--green);
  text-shadow: 0 0 8px rgba(var(--green-rgb), 0.5);
  opacity: 0.7;
}
