:root {
  --bg: #05060a;
  --neon-blue: #22f2ff;
  --neon-pink: #ff2bd6;
  --neon-green: #67ff7f;
  --neon-yellow: #ffe047;
  --neon-red: #ff4d4d;
  --hud-bg: rgba(10, 14, 26, 0.85);
}

html, body {
  height: 100%; margin: 0; background: #000; overflow: hidden;
  font-family: "Segoe UI", system-ui, monospace; color: #fff;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}

#game { position: fixed; inset: 0; }
canvas { display: block; width: 100%; height: 100%; }

/* HUD */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  padding: 10px 20px;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 16px; letter-spacing: 1px;
  text-shadow: 0 0 8px var(--neon-blue);
  pointer-events: none; z-index: 10;
}
.hud-center { opacity: 0.7; font-size: 12px; letter-spacing: 3px; }

/* Radar */
#radar-container {
  position: fixed; bottom: 20px; left: 0; right: 0;
  display: flex; justify-content: center; pointer-events: none; z-index: 10;
}
#radar {
  width: 70%; max-width: 1000px; height: 90px;
  border: 2px solid rgba(34, 242, 255, 0.35);
  background: linear-gradient(to top, rgba(0, 20, 40, 0.8), rgba(0, 30, 60, 0.6));
  border-radius: 6px; position: relative;
}
.blip {
  position: absolute; bottom: 2px; width: 3px;
  border-radius: 1px; will-change: left, height;
}

/* Overlay & Menu */
#overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: grid; place-items: center; z-index: 20;
  backdrop-filter: blur(4px);
}
.panel {
  background: var(--hud-bg); border: 1px solid var(--neon-blue);
  padding: 30px; border-radius: 12px; max-width: 600px; width: 90%;
  text-align: center; box-shadow: 0 0 40px rgba(34,242,255,0.15);
}
.title {
  font-size: 32px; font-weight: 900; margin-bottom: 5px;
  color: var(--neon-blue); text-shadow: 0 0 15px var(--neon-blue);
}
.subtitle { color: #8899cc; margin-bottom: 25px; font-size: 14px; }

.controls-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  text-align: left; margin-bottom: 25px; font-size: 14px; color: #ccd;
}
.controls-grid h3 { border-bottom: 1px solid #334; padding-bottom: 5px; margin-bottom: 10px; color: var(--neon-pink); }
.controls-grid ul { padding-left: 20px; line-height: 1.6; margin: 0; }
.gamepad-note { color: #b7c4ff; font-size: 13px; margin: -10px 0 20px; letter-spacing: 0.5px; }

.speed-control { margin: 20px 0; display: flex; justify-content: center; align-items: center; gap: 15px; }

button {
  background: transparent; color: var(--neon-green);
  border: 2px solid var(--neon-green); padding: 12px 30px;
  font-size: 18px; font-weight: bold; cursor: pointer;
  text-transform: uppercase; letter-spacing: 2px;
  transition: 0.2s;
}
button:hover { background: var(--neon-green); color: #000; box-shadow: 0 0 20px var(--neon-green); }

/* Scanlines */
.crt::before {
  content: " "; display: block; position: absolute; inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px; z-index: 5; pointer-events: none; opacity: 0.3;
}

/* Mobile Controls */
#mobileControls {
  position: fixed; inset: auto 14px 18px 14px;
  display: none; justify-content: space-between; align-items: flex-end; gap: 12px;
  z-index: 30; pointer-events: none;
}
#mobileControls.show { display: flex; }
.touch-stick {
  position: relative; width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 0 12px rgba(0,0,0,0.6);
  pointer-events: auto; touch-action: none;
}
.touch-stick .thumb {
  position: absolute; left: 50%; top: 50%;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(34, 242, 255, 0.6);
  border: 2px solid rgba(34, 242, 255, 0.9);
  transform: translate(-50%, -50%);
  transition: background 0.15s;
}
.touch-buttons { display: flex; flex-direction: column; gap: 12px; pointer-events: auto; }
.touch-btn {
  min-width: 86px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.25); background: rgba(0,0,0,0.35);
  color: #e8f0ff; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase;
  box-shadow: 0 0 12px rgba(0,0,0,0.6);
  touch-action: manipulation;
}
.touch-btn.primary { border-color: var(--neon-green); color: var(--neon-green); }
.touch-btn:active { transform: translateY(1px); background: rgba(255,255,255,0.14); }
@media (hover: none) and (pointer: coarse) { #mobileControls { display: flex; } }

.compat-card {
  position: fixed; left: 12px; top: 12px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.5); color: #e8f0ff;
  font-size: 12px; letter-spacing: 0.4px; z-index: 25; max-width: 260px;
  box-shadow: 0 0 14px rgba(0,0,0,0.5);
}
