/* ===== NEON MAZE - style.css ===== */

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

:root {
  --neon-cyan:    #00fff7;
  --neon-pink:    #ff00cc;
  --neon-yellow:  #f5ff00;
  --neon-green:   #39ff14;
  --bg-dark:      #0a0a1a;
  --bg-panel:     #0d0d2b;
  --wall-color:   #00fff7;
  --glow-cyan:    0 0 8px #00fff7, 0 0 20px #00fff780;
  --glow-pink:    0 0 8px #ff00cc, 0 0 20px #ff00cc80;
  --glow-yellow:  0 0 8px #f5ff00, 0 0 20px #f5ff0080;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  color: var(--neon-cyan);
  overflow: hidden;
  user-select: none;
}

/* ===== Game Container ===== */
#game-container {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
}

/* ===== Minimap Panel ===== */
#minimap-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}

.minimap-label {
  font-size: 8px;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 2px;
}

#minimap {
  display: block;
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 6px #00fff7, 0 0 14px #00fff740;
  image-rendering: pixelated;
}

#game {
  display: block;
  background: #000014;
  border: 2px solid var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  image-rendering: pixelated;
  max-width: 100vw;
  max-height: 60vh;
}

/* ===== HUD Overlay ===== */
#hud {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  pointer-events: none;
  font-size: 10px;
  text-shadow: var(--glow-cyan);
}

#hud-level  { color: var(--neon-yellow); text-shadow: var(--glow-yellow); }
#hud-score  { color: var(--neon-pink);   text-shadow: var(--glow-pink); }
#hud-coins  { color: var(--neon-green);  }
#hud-timer  { color: var(--neon-cyan);   text-shadow: var(--glow-cyan); }

/* ===== Touch Controls ===== */
#touch-controls {
  margin-top: 18px;
  width: 200px;
}

#touch-grid {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(3, 60px);
  gap: 4px;
  justify-content: center;
}

#touch-grid > div {
  /* spacer cells */
}

#touch-grid button {
  width: 60px;
  height: 60px;
  background: transparent;
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  color: var(--neon-cyan);
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--glow-cyan);
  transition: background 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#touch-grid button:active,
#touch-grid button.pressed {
  background: rgba(0, 255, 247, 0.18);
  box-shadow: 0 0 18px #00fff7, 0 0 40px #00fff780;
}

/* ===== Modal / Overlay Screens ===== */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 20, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 24px;
}

#overlay h1 {
  font-size: clamp(18px, 4vw, 32px);
  color: var(--neon-pink);
  text-shadow: var(--glow-pink);
  text-align: center;
  line-height: 1.6;
  letter-spacing: 2px;
}

#overlay h2 {
  font-size: clamp(12px, 2.5vw, 18px);
  color: var(--neon-yellow);
  text-shadow: var(--glow-yellow);
  text-align: center;
}

#overlay p {
  font-size: clamp(8px, 1.5vw, 11px);
  color: var(--neon-cyan);
  text-align: center;
  line-height: 2;
  opacity: 0.85;
}

#overlay .stat-row {
  display: flex;
  gap: 32px;
  font-size: 10px;
  color: var(--neon-green);
}

.neon-btn {
  padding: 14px 32px;
  background: transparent;
  border: 2px solid var(--neon-pink);
  border-radius: 6px;
  color: var(--neon-pink);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  cursor: pointer;
  box-shadow: var(--glow-pink);
  letter-spacing: 1px;
  transition: background 0.15s, box-shadow 0.15s;
}

.neon-btn:hover,
.neon-btn:focus {
  background: rgba(255, 0, 204, 0.15);
  box-shadow: 0 0 20px #ff00cc, 0 0 50px #ff00cc80;
  outline: none;
}

.neon-btn:active {
  background: rgba(255, 0, 204, 0.3);
}

/* ===== Level-clear flash ===== */
@keyframes flash-clear {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.flash { animation: flash-clear 0.4s ease 3; }

/* ===== Scanline effect ===== */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 4px
  );
  pointer-events: none;
  z-index: 200;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  #game {
    width: 95vw;
    height: 95vw;
    max-height: 55vh;
  }

  #touch-controls {
    margin-top: 12px;
  }

  #touch-grid {
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(3, 52px);
  }

  #touch-grid button {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }
}

@media (min-width: 641px) {
  /* Hide touch controls on desktop unless explicitly shown */
  #touch-controls {
    display: none;
  }
}
