/* =========================================
   STYLES GLOBAUX & RESET
   ========================================= */
html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  font-family: system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

canvas { display: block; }

/* =========================================
   INTERFACE EN JEU (HUD)
   ========================================= */
.ui-container {
  position: fixed; top: 15px; left: 15px; color: #fff;
  pointer-events: none; z-index: 10;
}

#score-display {
  font-size: clamp(20px, 4vw, 28px); font-weight: bold;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8); transition: color 0.2s;
}

#timer-display {
  margin-top: 5px; font-size: clamp(16px, 3vw, 20px);
  color: #ffaa00; font-weight: bold; letter-spacing: 2px;
}

#chrono-display {
  margin-top: 5px; font-size: clamp(14px, 2.8vw, 18px);
  color: #ffffff; font-weight: bold; letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

#missile-display {
  margin-top: 5px; font-size: clamp(14px, 2.8vw, 18px);
  color: #ffcc44; font-weight: bold; letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255, 170, 50, 0.7);
}

#ammo-display {
  margin-top: 5px; font-size: clamp(14px, 2.8vw, 18px);
  color: #66ccff; font-weight: bold; letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(80, 180, 255, 0.7);
}

#hits-display {
  margin-top: 5px; font-size: clamp(14px, 2.8vw, 18px);
  color: #88ff88; font-weight: bold; letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(120, 255, 120, 0.7);
}

/* Flash rouge plein écran quand le joueur est touché par un kamikaze */
#damage-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 20; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,0,0,0) 40%, rgba(200,0,0,0.55) 100%);
}

/* Flash blanc/orange plein écran lors de l'explosion d'un missile : couvre TOUT l'écran */
#explosion-flash {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 21; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,255,240,1) 0%, rgba(255,180,60,0.95) 45%, rgba(255,90,20,0.7) 100%);
}

/* Bouton missile dédié pour mobile */
#missile-btn {
  position: fixed; bottom: 30px; right: 20px; width: 64px; height: 64px;
  border-radius: 50%; background: rgba(255, 100, 20, 0.35);
  border: 2px solid rgba(255, 170, 60, 0.8); color: #fff; font-size: 26px;
  z-index: 15; display: none; align-items: center; justify-content: center;
  touch-action: manipulation;
}
@media (hover: none) and (pointer: coarse) {
  #missile-btn.mobile-only { display: flex; }
}

.instructions {
  margin-top: 10px; font-size: clamp(11px, 2.5vw, 14px); color: #ccc;
  line-height: 1.5; background: rgba(0, 0, 0, 0.6); padding: 10px;
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.2);
}

.enemy-text { color: #ff4444; font-weight: bold; }
.civilian-text { color: #44ffaa; font-weight: bold; }

.mobile-only { display: none; }
@media (hover: none) and (pointer: coarse) {
  .desktop-only { display: none; }
  .mobile-only { display: block; }
}

/* =========================================
   VISEUR CENTRAL
   ========================================= */
.crosshair {
  position: fixed; top: 50%; left: 50%; width: 24px; height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.4); border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none; z-index: 10;
}
.crosshair::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 4px; height: 4px; background: white; border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* =========================================
   MENUS (MODALS)
   ========================================= */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85); display: flex; flex-direction: column;
  justify-content: center; align-items: center; z-index: 100; color: white;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none !important; }

.modal-content {
  background: rgba(15, 15, 25, 0.95); padding: clamp(20px, 5vw, 40px);
  border: 2px solid #00aaff; border-radius: 12px; text-align: center;
  width: 90%; max-width: 450px; box-sizing: border-box;
  box-shadow: 0 0 20px rgba(0, 170, 255, 0.3); max-height: 95vh;
  display: flex; flex-direction: column;
}
.modal-content h1 {
  margin-top: 0; color: #00aaff; text-transform: uppercase;
  letter-spacing: 2px; text-shadow: 0 0 10px rgba(0,170,255,0.5);
  font-size: clamp(24px, 5vw, 32px);
}

.pause-content { background: transparent; border: none; box-shadow: none; }
.form-group { margin: 15px 0; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; color: #ccc; font-weight: bold; font-size: 14px;}
.form-group input {
  width: 100%; padding: 12px; box-sizing: border-box; background: #000;
  border: 1px solid #00aaff; color: #fff; border-radius: 4px; font-size: 16px;
}
.form-group input:focus { outline: none; box-shadow: 0 0 8px #00aaff; }

.action-btn {
  background: #00aaff; color: #000; font-weight: bold; padding: 15px;
  border: none; border-radius: 4px; cursor: pointer; text-transform: uppercase;
  font-size: 16px; transition: all 0.2s; width: 100%; letter-spacing: 1px;
}
.action-btn:active { transform: scale(0.98); }

.table-wrapper { overflow-y: auto; max-height: 30vh; margin-top: 10px; }
.leaderboard-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.leaderboard-table th, .leaderboard-table td { padding: 8px; border-bottom: 1px solid #333; text-align: left; }
.leaderboard-table th { color: #00aaff; border-bottom: 2px solid #00aaff; position: sticky; top: 0; background: #111; }
