:root {
  --hud: #f3efe4;
  --accent: #ff3b2f;
  --shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0d12;
  color: var(--hud);
  font-family: 'Russo One', Impact, 'Arial Black', system-ui, sans-serif;
  user-select: none;
}

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

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: var(--shadow); }

#vignette {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(170, 0, 0, 0.85) 100%);
}
#hud.dead #vignette { opacity: 1 !important; background: radial-gradient(ellipse at center, rgba(120, 0, 0, 0.35) 0%, rgba(90, 0, 0, 0.95) 100%); transition: opacity 0.4s; }

#crosshair { position: absolute; left: 50%; top: 50%; --gap: 8px; }
#crosshair i { position: absolute; background: var(--hud); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45); }
#crosshair .t, #crosshair .b { width: 2px; height: 9px; left: -1px; }
#crosshair .l, #crosshair .r { width: 9px; height: 2px; top: -1px; }
#crosshair .t { top: calc(-1 * var(--gap) - 9px); }
#crosshair .b { top: var(--gap); }
#crosshair .l { left: calc(-1 * var(--gap) - 9px); }
#crosshair .r { left: var(--gap); }
#crosshair .dot { width: 2px; height: 2px; left: -1px; top: -1px; }
#hud.dead #crosshair, #hud.dead #hitmarker { display: none; }

#hitmarker { position: absolute; left: 50%; top: 50%; opacity: 0; transition: opacity 0.12s; }
#hitmarker.show { opacity: 1; transition: none; }
#hitmarker i { position: absolute; width: 2px; height: 9px; left: -1px; top: -4px; background: #fff; box-shadow: 0 0 2px #000; }
#hitmarker i:nth-child(1) { transform: rotate(45deg) translateY(-13px); }
#hitmarker i:nth-child(2) { transform: rotate(135deg) translateY(-13px); }
#hitmarker i:nth-child(3) { transform: rotate(225deg) translateY(-13px); }
#hitmarker i:nth-child(4) { transform: rotate(315deg) translateY(-13px); }
#hitmarker.kill i { background: var(--accent); height: 12px; }

#top { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); text-align: center; }
#wave { font-size: 22px; letter-spacing: 3px; }
#remaining { font-size: 13px; opacity: 0.75; letter-spacing: 2px; margin-top: 2px; }

#scorebox { position: absolute; top: 16px; right: 22px; text-align: right; }
#score { font-size: 34px; }
#combo { font-size: 18px; color: #ffcc33; min-height: 22px; }

#popups {
  position: absolute; left: 50%; top: 50%; transform: translate(40px, -10px);
  display: flex; flex-direction: column; gap: 2px;
}
.popup { font-size: 16px; animation: pop 1s ease-out forwards; white-space: nowrap; }
.popup.big { font-size: 22px; color: var(--accent); }
.popup.gold { color: #ffcc33; }
@keyframes pop {
  0% { opacity: 0; transform: translateX(-8px) scale(1.3); }
  12% { opacity: 1; transform: translateX(0) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

#banner {
  position: absolute; top: 28%; width: 100%; text-align: center;
  font-size: clamp(32px, 6vw, 64px); letter-spacing: 6px; opacity: 0;
}
#banner.show { animation: banner 2.4s ease-out forwards; }
@keyframes banner {
  0% { opacity: 0; transform: scale(1.4); }
  10% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

#ammo { position: absolute; right: 26px; bottom: 22px; text-align: right; }
#weapon-name { font-size: 14px; letter-spacing: 2px; opacity: 0.8; }
#mag { font-size: 52px; line-height: 1; }
#mag.low { color: var(--accent); }
#mag-size { font-size: 22px; opacity: 0.6; margin-left: 4px; }
#reload-hint { font-size: 13px; color: var(--accent); letter-spacing: 2px; visibility: hidden; }
#reload-hint.show { visibility: visible; }

#stance { position: absolute; left: 26px; bottom: 22px; font-size: 14px; letter-spacing: 2px; opacity: 0.75; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 16px; text-align: center; cursor: pointer;
  background: radial-gradient(ellipse at center, rgba(10, 12, 18, 0.55), rgba(5, 6, 9, 0.92));
}
.overlay h1 { font-size: clamp(48px, 11vw, 120px); letter-spacing: 4px; line-height: 0.95; text-shadow: 0 6px 0 rgba(0, 0, 0, 0.6); }
.overlay h2 { font-size: clamp(36px, 8vw, 80px); letter-spacing: 4px; text-shadow: 0 5px 0 rgba(0, 0, 0, 0.6); }
.overlay h1 span, .overlay h2 span { color: var(--accent); }
.overlay .sub { font-size: 16px; opacity: 0.8; letter-spacing: 1px; }
.overlay .note { font-family: system-ui, sans-serif; font-size: 13px; opacity: 0.6; max-width: 460px; }
.overlay .best { font-size: 14px; color: #ffcc33; min-height: 18px; }

#play {
  font: inherit; font-size: 26px; letter-spacing: 4px; color: #fff; cursor: pointer;
  padding: 14px 54px; border: none; border-radius: 4px; background: var(--accent);
  box-shadow: 0 5px 0 #8a1510; transition: transform 0.08s;
}
#play:hover { transform: translateY(-2px); }
#play:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a1510; }

.controls {
  display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 6px 28px;
  font-family: system-ui, sans-serif; font-size: 14px; opacity: 0.85; text-align: left;
}
.controls b { font-family: 'Russo One', Impact, sans-serif; font-weight: normal; color: #ffcc33; margin-right: 6px; }

.stats { display: grid; grid-template-columns: auto auto; gap: 6px 26px; font-size: 18px; text-align: left; }
.stats span:nth-child(odd) { opacity: 0.7; }
.stats .rec { color: #ffcc33; grid-column: 1 / -1; text-align: center; }

@media (max-width: 520px) {
  .controls { grid-template-columns: 1fr; }
}
