@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;600;700&display=swap');

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

body {
  background: #070714;
  overflow: hidden;
  font-family: 'Rajdhani', sans-serif;
}

svg {
  display: block;
  width: 100vw;
  height: 100vh;
  user-select: none;
}

/* HUD */
#hud {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 14px 20px;
  color: white;
  min-width: 160px;
  pointer-events: none;
}
#hud-level {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
#hud-score {
  font-size: 38px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 12px;
}
#hud-score span {
  font-size: 16px;
  color: rgba(255,255,255,0.35);
  font-weight: 400;
}
#hud-ammo {
  display: flex;
  gap: 8px;
}
.ammo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #88ce02;
  box-shadow: 0 0 6px #88ce02;
  transition: all 0.3s;
  display: inline-block;
}
.ammo-dot.spent {
  background: rgba(255,255,255,0.1);
  box-shadow: none;
}

/* Endgame overlay */
#endgame {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 20, 0.92);
  backdrop-filter: blur(12px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  text-align: center;
  color: white;
}
#endgame-stars {
  font-size: 52px;
  letter-spacing: 10px;
  margin-bottom: 20px;
}
#endgame-title {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 10px;
  opacity: 0;
}
#endgame-message {
  font-size: 20px;
  color: rgba(255,255,255,0.6);
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 18px;
  opacity: 0;
  text-wrap: balance;
}
#endgame-score {
  font-size: 32px;
  font-weight: 700;
  color: #ffcc00;
  letter-spacing: 2px;
  margin-bottom: 32px;
  opacity: 0;
}
#endgame button {
  padding: 14px 40px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #88ce02, #5a8a00);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 0 24px rgba(136, 206, 2, 0.4);
  opacity: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
#endgame button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 36px rgba(136, 206, 2, 0.6);
}

#hud-progress-wrap {
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
#hud-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #88ce02, #c8ff30);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(136,206,2,0.7);
  transition: width 0.35s cubic-bezier(0.4,0,0.2,1);
}
#hud-progress-label {
  font-size: 12px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 2px;
  margin-top: 5px;
  text-align: right;
}

/* Level transition panel (gameover intermédiaire) */
#gameover rect { fill: rgba(10,10,30,0.95); }
#gameover text { font-family: 'Rajdhani', sans-serif; }

/* Messages de résultat */
#message-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 8;
}
#message-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 100px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  opacity: 0;
}
#message-text.bullseye {
  color: #F4531C;
  text-shadow: 0 0 40px rgba(244,83,28,0.9), 0 0 80px rgba(244,83,28,0.4);
}
#message-text.hit {
  color: #ffcc00;
  text-shadow: 0 0 30px rgba(255,204,0,0.8);
}
#message-text.miss {
  color: #777;
  text-shadow: none;
}

/* Intro de niveau */
#level-intro {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,5,20,0.75);
  backdrop-filter: blur(6px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9;
  pointer-events: all;
}
#level-intro-number {
  font-size: 86px;
  font-weight: 700;
  color: white;
  letter-spacing: 14px;
  text-transform: uppercase;
}
#level-intro-sub {
  font-size: 22px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 5px;
  margin-top: 10px;
}

/* Portrait : écran de rotation */
#rotate-warning {
  display: none;
  position: fixed;
  inset: 0;
  background: #070714;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: white;
  text-align: center;
  gap: 20px;
  pointer-events: all;
}
#rotate-icon {
  font-size: 80px;
  line-height: 1;
  animation: spin-hint 2.4s ease-in-out infinite;
  display: inline-block;
}
@keyframes spin-hint {
  0%, 30%  { transform: rotate(0deg); }
  65%, 85% { transform: rotate(90deg); }
  100%     { transform: rotate(0deg); }
}
#rotate-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
}
#rotate-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
}

@media (orientation: portrait) {
  #rotate-warning { display: flex; }
}

/* Paysage mobile (hauteur < 500px) */
@media (max-height: 500px) and (orientation: landscape) {
  #hud {
    top: 8px;
    left: 8px;
    padding: 8px 14px;
    min-width: 110px;
    border-radius: 10px;
  }
  #hud-level  { font-size: 10px; margin-bottom: 2px; letter-spacing: 1px; }
  #hud-score  { font-size: 24px; margin-bottom: 7px; }
  #hud-score span { font-size: 11px; }
  .ammo-dot   { width: 7px; height: 7px; }
  #hud-progress-wrap  { margin-top: 7px; }
  #hud-progress-label { font-size: 10px; margin-top: 3px; }

  #message-text       { font-size: 56px; letter-spacing: 3px; }

  #level-intro-number { font-size: 48px; letter-spacing: 6px; }
  #level-intro-sub    { font-size: 14px; letter-spacing: 3px; }

  #endgame-stars   { font-size: 34px; letter-spacing: 6px; margin-bottom: 12px; }
  #endgame-title   { font-size: 28px; }
  #endgame-message { font-size: 14px; max-width: 88vw; margin-bottom: 10px; }
  #endgame-score   { font-size: 20px; margin-bottom: 20px; }
  #endgame button  { padding: 10px 26px; font-size: 14px; }
}
