@import url('https://cdn.jsdelivr.net/npm/@fontsource/inter@5.0.0/index.css');

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  overflow: hidden;
  background: #000;
  font-family: 'Inter', sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas { display: block; }

#hud {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 50;
}

#crosshair {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 100;
}

#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.9);
}

#crosshair::before { width: 2px; height: 20px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
#crosshair::after { width: 20px; height: 2px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
#crosshair .dot {
  width: 4px; height: 4px; background: #ff4444; border-radius: 50%;
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}

#score {
  position: fixed; top: 10px; right: 15px;
  color: #fff; font-size: 18px; font-weight: 700;
  text-shadow: 0 0 10px rgba(255,0,0,0.5);
  z-index: 51; pointer-events: none;
}
#score span { color: #ff4444; font-size: 24px; }

#health-bar {
  position: fixed; bottom: 10px; left: 10px; z-index: 51; pointer-events: none;
}
#health-bar .label {
  color: #fff; font-size: 11px; margin-bottom: 3px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
}
#health-bar .bar-bg {
  width: 150px; height: 8px; background: rgba(255,255,255,0.1);
  border-radius: 4px; overflow: hidden; border: 1px solid rgba(255,255,255,0.2);
}
#health-bar .bar-fill {
  height: 100%; background: linear-gradient(90deg, #ff4444, #ff6666);
  border-radius: 4px; transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(255,68,68,0.5);
}

#ammo {
  position: fixed; bottom: 10px; right: 15px;
  color: #fff; font-size: 14px; font-weight: 700; z-index: 51; pointer-events: none;
}
#ammo span { color: #ffaa00; font-size: 22px; }

#wave-info {
  position: fixed; top: 45%; left: 50%; transform: translate(-50%, -50%);
  color: #ff4444; font-size: 28px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 4px;
  z-index: 52; opacity: 0; transition: opacity 0.5s;
  text-shadow: 0 0 20px rgba(255,0,0,0.5);
  pointer-events: none;
}

#damage-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 40; opacity: 0; transition: opacity 0.1s;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,0,0,0.5) 100%);
}

#muzzle-flash {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; pointer-events: none; z-index: 90; opacity: 0;
}
#muzzle-flash::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 30px; background: radial-gradient(circle, #fff 0%, #ffaa00 30%, transparent 70%);
  border-radius: 50%;
}

.hit-marker {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 16px; height: 16px; pointer-events: none; z-index: 95; opacity: 0;
  transition: opacity 0.08s;
}
.hit-marker::before, .hit-marker::after {
  content: ''; position: absolute; background: #fff;
}
.hit-marker::before {
  width: 10px; height: 2px; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
}
.hit-marker::after {
  width: 10px; height: 2px; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
}

#minimap {
  position: fixed; top: 10px; left: 10px;
  width: 100px; height: 100px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%; background: rgba(0,0,0,0.5);
  z-index: 51; overflow: hidden; pointer-events: none;
}
#minimap canvas { border-radius: 50%; }

#start-screen, #gameover-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 200; pointer-events: all;
}

#start-screen h1 {
  font-size: 40px; color: #ff4444; text-transform: uppercase;
  letter-spacing: 6px; margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(255,0,0,0.5);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

#start-screen .subtitle { color: #aaa; font-size: 14px; margin-bottom: 25px; letter-spacing: 2px; }
#start-screen .controls {
  color: #666; font-size: 12px; margin-bottom: 20px; text-align: center; line-height: 2;
}

.btn {
  pointer-events: all; cursor: pointer;
  background: linear-gradient(135deg, #ff4444, #cc0000);
  color: #fff; border: none; padding: 12px 40px;
  font-size: 16px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 3px; border-radius: 6px; transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}
.btn:active { transform: scale(0.95); }

#gameover-screen h2 {
  font-size: 36px; color: #ff4444; text-transform: uppercase;
  letter-spacing: 4px; margin-bottom: 15px;
}
#gameover-screen .final-score { color: #fff; font-size: 18px; margin-bottom: 20px; }
#gameover-screen .final-score span { color: #ffaa00; font-size: 28px; font-weight: 700; }

/* Mobile Controls */
#joystick-zone {
  position: fixed; bottom: 20px; left: 20px;
  width: 130px; height: 130px; z-index: 150;
  pointer-events: all;
}

#joystick-base {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 110px; height: 110px;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50%;
}

#joystick-thumb {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 45px; height: 45px;
  background: rgba(255,255,255,0.25);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  transition: none;
}

#look-zone {
  position: fixed; top: 0; right: 0;
  width: 45%; height: 65%;
  z-index: 140; pointer-events: all;
}

#fire-btn {
  position: fixed; bottom: 30px; right: 25px;
  width: 70px; height: 70px;
  background: rgba(255,50,50,0.3);
  border: 3px solid rgba(255,80,80,0.5);
  border-radius: 50%; z-index: 155;
  pointer-events: all; display: flex;
  align-items: center; justify-content: center;
}
#fire-btn::after {
  content: ''; width: 25px; height: 25px;
  background: rgba(255,80,80,0.6);
  border-radius: 50%;
}
#fire-btn:active {
  background: rgba(255,50,50,0.5);
  border-color: rgba(255,120,120,0.7);
}

#reload-btn {
  position: fixed; bottom: 110px; right: 35px;
  width: 50px; height: 50px;
  background: rgba(255,170,0,0.2);
  border: 2px solid rgba(255,170,0,0.4);
  border-radius: 12px; z-index: 155;
  pointer-events: all; display: flex;
  align-items: center; justify-content: center;
  color: #ffaa00; font-size: 10px; font-weight: 700;
  letter-spacing: 1px;
}
#reload-btn:active {
  background: rgba(255,170,0,0.4);
}

#sprint-btn {
  position: fixed; bottom: 110px; right: 100px;
  width: 50px; height: 50px;
  background: rgba(0,150,255,0.2);
  border: 2px solid rgba(0,150,255,0.4);
  border-radius: 12px; z-index: 155;
  pointer-events: all; display: flex;
  align-items: center; justify-content: center;
  color: #44aaff; font-size: 9px; font-weight: 700;
  letter-spacing: 1px;
}
#sprint-btn:active, #sprint-btn.active {
  background: rgba(0,150,255,0.4);
}

@media (min-width: 768px) {
  #start-screen h1 { font-size: 64px; letter-spacing: 8px; }
  #start-screen .subtitle { font-size: 18px; }
  #wave-info { font-size: 36px; }
  #health-bar .bar-bg { width: 250px; height: 12px; }
  #health-bar .label { font-size: 14px; }
  #score { font-size: 24px; }
  #score span { font-size: 32px; }
  #ammo { font-size: 18px; }
  #ammo span { font-size: 28px; }
  #minimap { width: 150px; height: 150px; }
}