/* Neon Maze — retro arcade styling (Phase 9). */

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

:root {
  --neon: #4a5cff;
  --amber: #ffcc00;
  --pixel: 'Press Start 2P', 'Courier New', monospace;
}

html, body {
  height: 100%;
  background: #05060f;
  color: #fff;
  font-family: var(--pixel);
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  /* Block the browser's own scroll/zoom gestures so swipes drive the game. */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  /* Subtle background glow behind the cabinet. */
  background:
    radial-gradient(circle at 50% 35%, #12163a 0%, #05060f 70%);
}

#game {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px;
}

#hud {
  display: flex;
  gap: 16px;
  width: 448px;
  max-width: 100%;
  justify-content: space-between;
  align-items: flex-end;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 0 6px rgba(120, 140, 255, 0.7);
}

.hud-label {
  color: var(--amber);
  font-size: 8px;
  text-shadow: 0 0 6px rgba(255, 180, 0, 0.7);
}

#lives {
  display: flex;
  gap: 4px;
  min-height: 12px;
  align-items: center;
}

.life {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffe100;
  display: inline-block;
  box-shadow: 0 0 6px #ffd000;
  /* A little wedge cut so it reads as Pac-Man, not just a dot. */
  clip-path: polygon(100% 25%, 45% 50%, 100% 75%, 82% 100%, 0 100%, 0 0, 82% 0);
}

#mute {
  background: none;
  border: 1px solid #2b2f5c;
  border-radius: 4px;
  cursor: pointer;
  line-height: 0;
  padding: 3px;
  color: var(--amber);
}

#mute svg {
  display: block;
  width: 16px;
  height: 16px;
  filter: drop-shadow(0 0 3px rgba(255, 205, 0, 0.6));
}

#mute:hover {
  border-color: var(--amber);
}

/* Screen container holds the canvas + the CRT overlay stacked on top. */
#screen {
  position: relative;
  line-height: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 0 2px #1a1e44,
    0 0 24px rgba(74, 92, 255, 0.55),
    0 0 60px rgba(74, 92, 255, 0.25);
}

#canvas {
  display: block;
  background: #05060f;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

/* CRT: horizontal scanlines + a soft vignette. Non-interactive. */
#crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.28) 3px,
      rgba(0, 0, 0, 0.28) 3px
    ),
    radial-gradient(
      ellipse at center,
      rgba(0, 0, 0, 0) 55%,
      rgba(0, 0, 0, 0.55) 100%
    );
  mix-blend-mode: multiply;
}

#fps {
  font-size: 8px;
  color: #3a3f66;
}

/* On-screen D-pad: a 3x3 grid, shown on touch devices / small screens. */
#dpad {
  display: none;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(3, 60px);
  gap: 6px;
  touch-action: none;
}

.dbtn {
  color: #cfe0ff;
  background: rgba(30, 40, 90, 0.55);
  border: 1px solid #2b3570;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.dbtn svg {
  display: block;
  width: 30px;
  height: 30px;
}

.dbtn:active {
  background: rgba(74, 92, 255, 0.6);
  border-color: var(--amber);
}

.dbtn.up { grid-area: 1 / 2; }
.dbtn.left { grid-area: 2 / 1; }
.dbtn.right { grid-area: 2 / 3; }
.dbtn.down { grid-area: 3 / 2; }

/* Reveal the D-pad on touch/coarse-pointer devices or narrow screens. */
@media (pointer: coarse), (max-width: 640px) {
  #dpad { display: grid; }
  #fps { display: none; }
}
