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

html, body {
  height: 100%;
  overflow: hidden;
  background: #060a08;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#camera { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
#sky-fallback {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(180deg, #24313f 0%, #46586b 45%, #8a8272 85%, #4c4438 100%);
}
#sky-fallback[hidden] { display: none; }
#gl { position: fixed; inset: 0; z-index: 1; }
#radar { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.radar-arrow {
  position: absolute; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; filter: drop-shadow(0 0 6px rgba(0,0,0,.6));
  transition: opacity .2s;
}

/* ---------- Combat feedback ---------- */
#damage-vignette {
  position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,20,10,.55) 100%);
}
#damage-vignette.flash { animation: dmg .6s ease-out; }
@keyframes dmg { 0% { opacity: 1 } 100% { opacity: 0 } }

#muzzle-flash {
  position: fixed; left: 50%; bottom: 0; z-index: 3; pointer-events: none;
  width: 200px; height: 260px; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 100%, rgba(255,220,140,.9) 0%, rgba(255,160,60,.35) 40%, transparent 70%);
  opacity: 0;
}
#muzzle-flash.fire { animation: muzzle .09s ease-out; }
@keyframes muzzle { 0% { opacity: 1 } 100% { opacity: 0 } }

#hitmarker {
  position: fixed; left: 50%; top: 50%; z-index: 5; pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  font-size: 30px; font-weight: 900; color: #fff;
  text-shadow: 0 0 8px rgba(255,80,40,.9);
  opacity: 0;
}
#hitmarker.hit { animation: hitm .25s ease-out; }
#hitmarker.kill { animation: hitm .35s ease-out; color: #ff4a2a; font-size: 38px; }
@keyframes hitm { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1.4) } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.8) } }

#crosshair {
  position: fixed; left: 50%; top: 50%; z-index: 5; pointer-events: none;
  width: 44px; height: 44px; transform: translate(-50%, -50%);
}
#crosshair[hidden] { display: none; }
#crosshair span { position: absolute; background: rgba(255,255,255,.85); box-shadow: 0 0 4px rgba(0,0,0,.7); }
#crosshair span:nth-child(1) { left: 50%; top: 0;    width: 2px; height: 12px; transform: translateX(-50%); }
#crosshair span:nth-child(2) { left: 50%; bottom: 0; width: 2px; height: 12px; transform: translateX(-50%); }
#crosshair span:nth-child(3) { top: 50%; left: 0;    height: 2px; width: 12px; transform: translateY(-50%); }
#crosshair span:nth-child(4) { top: 50%; right: 0;   height: 2px; width: 12px; transform: translateY(-50%); }
#crosshair.reloading span { background: #ffb02a; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 12px; right: 12px;
  display: flex; gap: 8px; z-index: 6; align-items: center;
}
#hud[hidden] { display: none; }
.hud-pill {
  background: rgba(6, 10, 8, 0.72);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(120, 255, 170, .18);
  border-radius: 999px; padding: 8px 14px;
  font-size: 14px; font-weight: 700; letter-spacing: .04em;
  display: flex; align-items: center; gap: 6px; color: #eafff2;
}
#enemies-pill { margin-left: auto; }

#bottom-hud {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  left: 16px; right: 16px; z-index: 6;
  display: flex; align-items: center; gap: 14px;
}
#bottom-hud[hidden] { display: none; }

#hp-wrap {
  flex: 1; height: 18px; border-radius: 999px; position: relative;
  background: rgba(6,10,8,.7); border: 1px solid rgba(120,255,170,.25); overflow: hidden;
}
#hp-bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #35d67a, #9fe07a);
  border-radius: 999px; transition: width .25s ease;
}
#hp-bar.low { background: linear-gradient(90deg, #ff4a2a, #ff8a5c); }
#hp-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8);
}

#ammo-wrap {
  font-family: inherit; color: #eafff2;
  background: rgba(6,10,8,.72); border: 1px solid rgba(120,255,170,.25);
  border-radius: 14px; padding: 8px 16px;
  font-size: 22px; font-weight: 800; cursor: pointer;
  display: flex; align-items: baseline; gap: 2px;
}
.ammo-cap { font-size: 12px; font-weight: 600; color: rgba(234,255,242,.55); }
#ammo-wrap.reloading { color: #ffb02a; }

#banner {
  position: fixed; left: 50%; top: 34%; z-index: 7;
  transform: translateX(-50%);
  font-size: 34px; font-weight: 900; letter-spacing: .12em;
  color: #eafff2; text-shadow: 0 0 24px rgba(80,255,150,.6), 0 2px 8px rgba(0,0,0,.8);
  animation: banner-pop 1.8s ease-out forwards;
  white-space: nowrap; pointer-events: none;
}
#banner[hidden] { display: none; }
@keyframes banner-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(.7) }
  15% { opacity: 1; transform: translateX(-50%) scale(1.08) }
  25% { transform: translateX(-50%) scale(1) }
  80% { opacity: 1 }
  100% { opacity: 0 }
}

#toast {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 64px); left: 50%;
  transform: translateX(-50%); z-index: 7;
  background: rgba(6,10,8,.85); border: 1px solid rgba(120,255,170,.2);
  padding: 10px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
#toast[hidden] { display: none; }

.score-float {
  position: fixed; z-index: 6; pointer-events: none;
  font-size: 18px; font-weight: 900; color: #ffd76a;
  text-shadow: 0 0 10px rgba(255,180,60,.7), 0 1px 3px rgba(0,0,0,.9);
  animation: score-float .9s ease-out forwards;
}
@keyframes score-float {
  0% { opacity: 1; transform: translateY(0) }
  100% { opacity: 0; transform: translateY(-52px) }
}

/* ---------- Start screen ---------- */
#start-screen {
  position: fixed; inset: 0; z-index: 10;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(40, 160, 90, .22), transparent 60%),
    linear-gradient(180deg, #060a08 0%, #0d1a12 60%, #060a08 100%);
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
}
#start-screen[hidden] { display: none; }

.start-emblem { font-size: 72px; filter: drop-shadow(0 0 26px rgba(80, 255, 150, .5)); }
#start-screen h1 {
  font-size: 44px; letter-spacing: .18em; margin: 10px 0 10px;
  background: linear-gradient(90deg, #9fe07a, #35d67a, #eafff2);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tagline { color: rgba(234,255,242,.72); font-size: 15px; line-height: 1.5; margin-bottom: 20px; }
.briefing {
  list-style: none; text-align: left; margin: 0 auto 26px;
  max-width: 300px; font-size: 13.5px; line-height: 2; color: rgba(234,255,242,.82);
}
#start-btn {
  font-family: inherit; font-size: 18px; font-weight: 800; letter-spacing: .1em;
  color: #06110a; background: linear-gradient(135deg, #9fe07a, #35d67a);
  border: none; border-radius: 999px; padding: 16px 52px; cursor: pointer;
  box-shadow: 0 6px 30px rgba(60, 220, 130, .4);
}
#start-btn:active { transform: scale(.96); }
.fineprint { margin-top: 16px; font-size: 12px; color: rgba(234,255,242,.35); }

/* ---------- Game over ---------- */
#gameover {
  position: fixed; inset: 0; z-index: 9;
  background: rgba(8, 4, 4, .8);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
#gameover[hidden] { display: none; }
.card-inner {
  width: min(340px, 88vw);
  background: linear-gradient(180deg, #1c1210, #0d0806);
  border: 1px solid rgba(255, 90, 60, .3);
  border-radius: 24px; padding: 34px 24px 28px; text-align: center;
  animation: card-pop .45s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes card-pop { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }
#gameover h2 {
  font-size: 40px; letter-spacing: .2em; margin-bottom: 14px;
  color: #ff5a3a; text-shadow: 0 0 24px rgba(255,60,30,.5);
}
#go-stats { font-size: 15px; line-height: 2; color: rgba(255,240,235,.85); margin-bottom: 24px; }
#go-stats b { color: #ffd76a; }
#retry-btn {
  font-family: inherit; font-size: 16px; font-weight: 800; letter-spacing: .08em;
  color: #0a0e1a; background: #fff; border: none; border-radius: 999px;
  padding: 13px 40px; cursor: pointer;
}
