/* === CRAZY SNAKE - Game Boy Aesthetic === */

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

body {
  background: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
}

#game-container {
  position: relative;
  background: #0f380f;
  border: 6px solid #306230;
  border-radius: 14px;
  outline: 3px solid #0f380f;
  outline-offset: 3px;
  box-shadow:
    0 0 0 4px #0f380f,
    0 0 0 7px #306230,
    0 0 0 10px #9bbc0f,
    0 0 50px rgba(155, 188, 15, 0.25),
    0 0 120px rgba(155, 188, 15, 0.10),
    0 8px 32px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(0, 0, 0, 0.3);
  padding: 4px;
  animation: crtFlicker 0.06s infinite;
  max-width: calc(100vw - 20px);
}

/* "CRAZY SNAKE" label above the screen */
#game-container::before {
  content: 'CRAZY SNAKE';
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #9bbc0f;
  letter-spacing: 3px;
  text-shadow:
    0 0 6px rgba(155, 188, 15, 0.6),
    0 0 12px rgba(155, 188, 15, 0.3);
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
}

/* CRT Scanline + Curvature Overlay */
#game-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.08) 2px,
      rgba(0, 0, 0, 0.08) 4px
    ),
    radial-gradient(
      ellipse at center,
      transparent 60%,
      rgba(0, 0, 0, 0.18) 100%
    );
  pointer-events: none;
  z-index: 10;
  border-radius: 8px;
}

/* Subtle green glow behind container */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 110vw;
  height: 110vh;
  background: radial-gradient(
    circle,
    rgba(155, 188, 15, 0.08) 0%,
    rgba(155, 188, 15, 0.03) 40%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* CRT flicker animation */
@keyframes crtFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.97; }
}

#game-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  color: #9bbc0f;
  font-size: 10px;
  line-height: 1;
  background: #0f380f;
  border-bottom: 2px solid #306230;
  z-index: 5;
  position: relative;
}

#hud span {
  text-shadow: 1px 1px 0 #306230;
}

#effects-bar {
  display: flex;
  gap: 4px;
  padding: 4px 10px;
  min-height: 20px;
  color: #9bbc0f;
  font-size: 8px;
  background: #0f380f;
  border-top: 2px solid #306230;
  z-index: 5;
  position: relative;
}

.effect-indicator {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #9bbc0f;
  border-radius: 10px;
  font-size: 7px;
  letter-spacing: 0.5px;
  line-height: 1.4;
  background: rgba(155, 188, 15, 0.08);
  text-shadow: 0 0 4px rgba(155, 188, 15, 0.4);
  animation: effectPulse 0.5s infinite alternate;
}

@keyframes effectPulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* Chaos mode banner flash */
@keyframes chaosBanner {
  0%, 100% { color: #9bbc0f; }
  25% { color: #ff6b6b; }
  50% { color: #ffd93d; }
  75% { color: #6bcb77; }
}

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

.shake {
  animation: screenShake 0.15s ease-in-out;
}

/* Game Over red border flash */
@keyframes gameOverFlash {
  0% { border-color: #306230; }
  15% { border-color: #cc2222; }
  30% { border-color: #306230; }
  45% { border-color: #cc2222; }
  60% { border-color: #306230; }
  75% { border-color: #992222; }
  100% { border-color: #306230; }
}

.gameover {
  animation: gameOverFlash 0.8s ease-in-out;
}

/* Grid size dynamically computed by JS to fill viewport */
