:root {
  --orange: #FF8A3D;
  --orange-deep: #F05A22;
  --amber: #FFC24B;
  --cream: #FFF4E6;
  --ink: #090B10;
  --panel: rgba(11, 13, 18, .74);
  --line: rgba(255, 255, 255, .13);
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05070b;
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(80% 60% at 50% 0%, #24150e 0%, transparent 60%),
    #05070b;
}

.stage {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #0a0c12;
  isolation: isolate;
  touch-action: manipulation;
  box-shadow: 0 0 90px rgba(0, 0, 0, .8);
}

button { font-family: inherit; }

.stage.critical::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 26;
  pointer-events: none;
  background:
    radial-gradient(120% 94% at 50% 52%, transparent 38%, rgba(168, 8, 18, .18) 66%, rgba(156, 4, 14, .52) 100%);
  animation: criticalPulse 1.7s ease-in-out infinite;
}

/* ============ scene ============ */
.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  background: #111;
}
.scene.shake { animation: sceneShake .28s ease-out; }

.scene-bg {
  position: absolute;
  inset: -2%;
  background-image: url("images/gen/bridge.jpg");
  background-repeat: no-repeat;
  background-position: 50% 46%;
  background-size: cover;
  animation: sceneDrift 26s ease-in-out infinite alternate;
  transform-origin: 50% 52%;
  will-change: transform;
}

.scene-grade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 6, 10, .7) 0%, rgba(4, 6, 10, .2) 18%, rgba(4, 6, 10, 0) 38%, rgba(4, 6, 10, .08) 62%, rgba(4, 6, 10, .9) 100%),
    linear-gradient(90deg, rgba(4, 6, 10, .28), transparent 18%, transparent 82%, rgba(4, 6, 10, .28));
  pointer-events: none;
}
.scene-grade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px);
  opacity: .5;
  mix-blend-mode: overlay;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(125% 82% at 50% 46%, transparent 42%, rgba(2, 4, 8, .58) 100%);
  pointer-events: none;
}

.sun-haze {
  position: absolute;
  inset: 0;
  background: radial-gradient(52% 38% at 20% 22%, rgba(255, 138, 61, .22), transparent 70%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.embers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.embers span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #FFB463;
  box-shadow: 0 0 9px #FF8A3D;
  opacity: 0;
  animation: emberUp linear infinite;
}

/* ============ zombies ============ */
.zombie-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}
.zombie {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 120px;
  pointer-events: auto;
  cursor: crosshair;
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
  will-change: transform, width;
  touch-action: none;
}
.z-inner {
  position: relative;
  transform-origin: 50% 100%;
  transition: opacity .4s ease, transform .4s ease;
  animation: zIn .28s ease-out;
}
.zombie img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 0 5px rgba(255, 130, 60, .34)) drop-shadow(0 12px 10px rgba(0, 0, 0, .5));
  transition: filter .08s linear;
}
.zombie.runner img {
  transform: scaleX(-1);
  filter: hue-rotate(-14deg) saturate(1.12) brightness(1.05) drop-shadow(0 0 5px rgba(255, 170, 80, .45)) drop-shadow(0 10px 8px rgba(0, 0, 0, .46));
}
.zombie.brute img {
  filter: brightness(.84) saturate(.85) contrast(1.08) drop-shadow(0 0 4px rgba(255, 110, 50, .35)) drop-shadow(0 16px 12px rgba(0, 0, 0, .56));
}
.zombie.hit img {
  filter: brightness(2.3) saturate(.35) drop-shadow(0 0 14px rgba(255, 190, 110, .9));
}
.zombie.dead { pointer-events: none; }
.zombie.dead .z-inner {
  opacity: 0;
  transform: rotate(16deg) translateY(24px) scale(.95);
}
.z-hp {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 3px);
  width: 44px;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: rgba(7, 9, 12, .72);
  border: 1px solid rgba(0, 0, 0, .35);
  overflow: hidden;
  opacity: 0;
  transition: opacity .2s;
}
.zombie.hurt .z-hp { opacity: 1; }
.z-hp span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #FF4B36, #FFA13D);
  transition: width .12s linear;
}

/* ============ effects ============ */
.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}
.tracer {
  position: absolute;
  height: 2px;
  border-radius: 2px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(255, 190, 80, 0), rgba(255, 216, 130, .92) 38%, #FFF8D8);
  filter: drop-shadow(0 0 6px rgba(255, 190, 80, .9));
  animation: tracerFade .16s ease-out forwards;
}
.spark {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFF6C9 0%, #FFB03A 42%, rgba(255, 80, 30, 0) 72%);
  animation: sparkFly .52s ease-out forwards;
}
.blood {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #A8111D;
  box-shadow: 0 0 6px rgba(180, 20, 30, .72);
  animation: sparkFly .6s ease-out forwards;
}
.float-txt {
  position: absolute;
  font-size: 15px;
  font-weight: 900;
  color: #FFD27A;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .65);
  white-space: nowrap;
  animation: floatUp .8s ease-out forwards;
}
.float-txt.kill { color: #FF9A4D; font-size: 17px; }
.float-txt.dmg { color: #FF6B5B; font-size: 18px; }
.float-txt.hitpt { color: #FFE0B0; font-size: 13px; }
.ring {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 200, 120, .9);
  animation: ringOut .34s ease-out forwards;
}

.tap-reticle {
  position: absolute;
  z-index: 22;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  opacity: 0;
  pointer-events: none;
}
.tap-reticle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 196, 120, .95);
  box-shadow: 0 0 12px rgba(255, 140, 60, .6);
}
.tap-reticle::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 224, 170, .9), transparent 72%);
}
.tap-reticle.show { animation: reticlePop .32s ease-out; }

.muzzle {
  position: absolute;
  z-index: 18;
  left: 74%;
  top: 58%;
  width: 170px;
  height: 170px;
  margin: -85px 0 0 -85px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 251, 224, .98) 0%, rgba(255, 198, 92, .9) 16%, rgba(255, 120, 40, .48) 40%, transparent 70%);
  opacity: 0;
  transform: scale(.35);
  filter: blur(1px);
  pointer-events: none;
  mix-blend-mode: screen;
}
.muzzle.fire { animation: muzzleFlash .13s ease-out; }

.danger-flash {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: radial-gradient(circle at 50% 55%, transparent 30%, rgba(170, 8, 16, .62) 100%);
  opacity: 0;
  pointer-events: none;
}
.danger-flash.show { animation: dangerPulse .5s ease-out; }

/* ============ HUD ============ */
.hud {
  position: absolute;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(10px + var(--st)) 15px 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s ease, visibility .4s;
}
.hud.on { opacity: 1; visibility: visible; }
.hud::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -20px;
  right: -20px;
  top: -70px;
  height: 240px;
  background: linear-gradient(180deg, rgba(3, 5, 9, .95) 0%, rgba(3, 5, 9, .92) 60%, rgba(3, 5, 9, .7) 82%, transparent 100%);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  pointer-events: none;
}

.hud-top {
  display: flex;
  align-items: center;
  gap: 9px;
}
.glass-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(9, 11, 16, .62);
  color: #fff;
  display: grid;
  place-items: center;
  pointer-events: auto;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .12s ease, background .2s;
}
.glass-btn .mp-icon { width: 21px; height: 21px; }
.glass-btn:active { transform: scale(.92); background: rgba(255, 138, 61, .22); }

.hp-block.low { animation: lowHp 1s ease-in-out infinite; }
.hp-block {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(8, 10, 14, .74);
  border: 1px solid rgba(255, 255, 255, .19);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: 11px 0 0 11px;
  background: linear-gradient(90deg, #8E0C19 0%, #D91E2A 44%, #FF5B3A 100%);
  transition: width .35s cubic-bezier(.2, .8, .2, 1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24);
}
.hp-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), transparent 48%, rgba(0, 0, 0, .12));
}
.hp-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding: 0 9px;
}
.hp-icon {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #D41525;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .28);
  flex: none;
}
.hp-icon .mp-icon { width: 15px; height: 15px; }
.hp-num {
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .38);
  font-variant-numeric: tabular-nums;
}
.hp-num b { font-size: 17px; }
.hp-num em { font-style: normal; font-size: 11px; font-weight: 600; opacity: .72; }
.hp-tag {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: .2em;
  font-weight: 700;
  color: rgba(255, 255, 255, .62);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.hp-shine {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  pointer-events: none;
}

.score-pill {
  flex: none;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px 0 6px;
  border-radius: 13px;
  background: rgba(9, 11, 16, .68);
  border: 1px solid rgba(255, 170, 90, .3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.score-ico {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #FFA45C;
  background: linear-gradient(145deg, rgba(255, 138, 61, .28), rgba(255, 138, 61, .05));
  border: 1px solid rgba(255, 138, 61, .3);
}
.score-ico .mp-icon { width: 17px; height: 17px; }
.score-txt { display: flex; flex-direction: column; line-height: 1.02; }
.score-txt em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .5);
}
.score-txt b {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.hud-mid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
  margin-top: 9px;
}
.wave-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 10px 7px 7px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(12, 14, 20, .84), rgba(12, 14, 20, .58));
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .26), inset 0 1px 0 rgba(255, 255, 255, .09);
}
.wave-ico {
  flex: none;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #FFB067;
  background: rgba(255, 138, 61, .15);
  border: 1px solid rgba(255, 138, 61, .3);
}
.wave-ico .mp-icon { width: 19px; height: 19px; }
.wave-txt { display: flex; flex-direction: column; gap: 3px; line-height: 1; min-width: 0; }
.wave-txt > b {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .05em;
  color: #fff;
  white-space: nowrap;
}
.wave-txt > b span { color: var(--amber); }
.wave-txt > b i { font-style: normal; font-weight: 600; color: rgba(255, 255, 255, .45); }
.wave-left {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: rgba(255, 255, 255, .58);
  white-space: nowrap;
}
.wave-left .mp-icon { width: 11px; height: 11px; opacity: .85; }
.wave-left b { color: #FFC48C; font-size: 10px; font-weight: 800; }
.wave-dots { display: flex; align-items: center; gap: 3px; margin-left: 3px; padding-bottom: 1px; }
.wave-dots i {
  display: block;
  width: 8px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .18);
  transition: background .25s, box-shadow .25s;
}
.wave-dots i.on { background: var(--orange); box-shadow: 0 0 6px rgba(255, 138, 61, .75); }

.ammo-card {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 92px;
  padding: 6px 9px 6px 6px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(12, 14, 20, .86), rgba(12, 14, 20, .6));
  border: 1px solid rgba(255, 180, 100, .28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .26), inset 0 1px 0 rgba(255, 255, 255, .09);
}
.ammo-ico {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #FFB067;
  background: rgba(255, 138, 61, .16);
  border: 1px solid rgba(255, 138, 61, .32);
}
.ammo-ico .mp-icon { width: 18px; height: 18px; }
.ammo-txt { display: flex; flex-direction: column; line-height: 1; }
.ammo-txt > div { display: flex; align-items: baseline; gap: 1px; }
.ammo-txt b { font-size: 18px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.ammo-txt em { font-style: normal; font-size: 10px; color: rgba(255, 255, 255, .48); }
.ammo-txt > span {
  margin-top: 4px;
  font-size: 8px;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .48);
}
.ammo-card.reloading { border-color: rgba(255, 196, 100, .6); }
.ammo-card.reloading .ammo-ico { animation: softPulse 1s ease-in-out infinite; }

/* ============ controls ============ */
.controls {
  position: absolute;
  z-index: 35;
  left: 0;
  right: 0;
  bottom: calc(18px + var(--sb));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s ease, visibility .4s;
}
.controls.on { opacity: 1; visibility: visible; }
.dock-mid {
  position: absolute;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  white-space: nowrap;
}
.dock-mid b {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .34em;
  text-indent: .34em;
  color: rgba(255, 190, 140, .48);
}
.dock-mid span {
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 170, 110, .38));
}
.dock-mid span:last-child { transform: scaleX(-1); }
.controls::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -20px;
  right: -20px;
  bottom: -18px;
  height: 146px;
  background: linear-gradient(180deg, rgba(5, 7, 11, 0) 0%, rgba(5, 7, 11, .8) 18%, rgba(5, 7, 11, .96) 42%, #05070b 100%);
  pointer-events: none;
}
.controls::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 22px;
  right: 22px;
  bottom: 126px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 150, 80, .28), transparent);
  pointer-events: none;
}

.reload-btn {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(8, 10, 15, .58);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  pointer-events: auto;
  cursor: pointer;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform .12s ease, background .2s;
}
.reload-btn .mp-icon { width: 22px; height: 22px; color: #FFD0A8; }
.reload-btn .ctrl-label {
  font-size: 8px;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .68);
  font-weight: 700;
}
.reload-btn:active { transform: scale(.93); background: rgba(255, 138, 61, .18); }
.reload-btn.reloading .mp-icon { animation: spin .9s linear infinite; }
.reload-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(var(--orange) calc(var(--p, 0) * 1%), rgba(255, 255, 255, .12) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  pointer-events: none;
}

.fire-btn {
  position: relative;
  width: 106px;
  height: 106px;
  border-radius: 50%;
  border: 2px solid rgba(255, 222, 184, .55);
  background: radial-gradient(circle at 35% 26%, #FFB66C 0%, #FF8A3D 38%, #EF5720 100%);
  color: #2A1204;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  margin-bottom: 2px;
  box-shadow:
    0 14px 32px rgba(240, 90, 30, .38),
    inset 0 2px 2px rgba(255, 255, 255, .5),
    inset 0 -9px 18px rgba(120, 30, 0, .32);
  transition: transform .1s ease, box-shadow .2s;
  touch-action: none;
}
.fire-btn::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .26);
  pointer-events: none;
}
.fire-btn:active {
  transform: scale(.93);
  box-shadow:
    0 7px 16px rgba(240, 90, 30, .34),
    inset 0 2px 2px rgba(255, 255, 255, .4),
    inset 0 -6px 14px rgba(120, 30, 0, .3);
}
.fire-glow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 150, 70, .42), transparent 66%);
  filter: blur(7px);
  animation: pulseGlow 2.4s ease-in-out infinite;
  pointer-events: none;
}
.fire-ico { position: relative; display: grid; place-items: center; width: 34px; height: 34px; }
.fire-ico .mp-icon { width: 30px; height: 30px; }
.fire-btn strong {
  position: relative;
  margin-top: 1px;
  font-size: 12px;
  letter-spacing: .16em;
  font-weight: 900;
  color: #2A1204;
}
.fire-ammo {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(24, 11, 4, .74);
  border: 1px solid rgba(255, 220, 180, .35);
  color: #FFD9AE;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.reload-progress {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(rgba(255, 255, 255, .95) calc(var(--p, 0) * 1%), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.fire-btn.reloading .reload-progress { opacity: 1; }
.fire-btn.firing {
  transform: scale(.95);
  box-shadow:
    0 8px 22px rgba(240, 90, 30, .46),
    inset 0 2px 2px rgba(255, 255, 255, .45),
    inset 0 -7px 16px rgba(120, 30, 0, .32);
}
.fire-btn.firing .fire-glow { opacity: 1; transform: scale(1.08); }

/* ============ wave banner & hint ============ */
.wave-banner {
  position: absolute;
  z-index: 45;
  left: 50%;
  top: 31%;
  width: min(84%, 330px);
  transform: translate(-50%, -50%) scale(.88);
  padding: 12px 18px 11px;
  text-align: center;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(6, 8, 12, 0), rgba(6, 8, 12, .84) 16%, rgba(6, 8, 12, .84) 84%, rgba(6, 8, 12, 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .35s cubic-bezier(.2, .9, .2, 1);
}
.wave-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.wave-banner::before,
.wave-banner::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 60%;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(255, 138, 61, .75), transparent);
}
.wave-banner::before { top: 0; }
.wave-banner::after { bottom: 0; }
.banner-kicker {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .42em;
  color: #FF9B58;
  text-indent: .42em;
}
.banner-kicker b { font-size: 10px; }
.wave-banner strong {
  display: block;
  margin: 2px 0 3px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .06em;
  color: #fff;
  text-shadow: 0 4px 16px rgba(0, 0, 0, .55);
}
.banner-sub {
  font-size: 10px;
  letter-spacing: .05em;
  color: rgba(255, 255, 255, .55);
}

.hint-pill {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: calc(24px + var(--sb) + 112px);
  transform: translateX(-50%) translateY(6px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(8, 10, 14, .58);
  border: 1px solid rgba(255, 170, 100, .22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 244, 232, .84);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.hint-pill.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hint-pill .mp-icon { width: 14px; height: 14px; color: #FFA45C; }

/* ============ overlays ============ */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: calc(24px + var(--st)) 20px calc(22px + var(--sb));
  transition: opacity .35s ease, visibility .35s;
}
.overlay.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.start-overlay {
  justify-content: space-between;
  background:
    linear-gradient(180deg, rgba(3, 5, 9, .82) 0%, rgba(3, 5, 9, .42) 25%, rgba(3, 5, 9, 0) 46%, rgba(3, 5, 9, .26) 64%, rgba(3, 5, 9, .8) 82%, rgba(3, 5, 9, .96) 100%);
}
.start-top { padding-top: 4px; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 138, 61, .32);
  background: rgba(22, 13, 8, .42);
  color: #FFBE8B;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 9px var(--orange);
  animation: blink 1.6s ease-in-out infinite;
}
.game-title {
  margin: 14px 0 0;
  font-family: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(42px, 13.4vw, 62px);
  line-height: .94;
  font-weight: 900;
  letter-spacing: .01em;
  color: #FFF7ED;
  text-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}
.game-title span {
  display: inline-block;
  color: transparent;
  background: linear-gradient(180deg, #FFE0B6 0%, #FFA05A 38%, #FF5B22 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 5px 12px rgba(255, 90, 30, .32));
}
.tagline {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.65;
  letter-spacing: .02em;
  color: rgba(255, 244, 232, .78);
  text-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.stat-row { display: flex; gap: 8px; margin-top: 18px; max-width: 330px; }
.stat {
  flex: 1;
  padding: 9px 6px 8px;
  border-radius: 14px;
  text-align: center;
  background: linear-gradient(160deg, rgba(16, 18, 24, .65), rgba(16, 18, 24, .34));
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.stat b {
  display: block;
  font-size: 19px;
  line-height: 1;
  font-weight: 900;
  color: #FFB067;
  font-variant-numeric: tabular-nums;
}
.stat span {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .48);
}
.start-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.start-btn {
  width: 100%;
  max-width: 360px;
  height: 58px;
  border: 1px solid rgba(255, 224, 190, .42);
  border-radius: 18px;
  background: linear-gradient(135deg, #FFB064 0%, #FF8A3D 46%, #F0561F 100%);
  color: #2A1204;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(240, 90, 30, .34), inset 0 2px 2px rgba(255, 255, 255, .45), inset 0 -6px 14px rgba(130, 35, 0, .26);
  transition: transform .12s ease, box-shadow .2s;
}
.start-btn .mp-icon { width: 23px; height: 23px; }
.start-btn:active {
  transform: scale(.97);
  box-shadow: 0 8px 20px rgba(240, 90, 30, .3), inset 0 2px 2px rgba(255, 255, 255, .4);
}
.start-tip {
  margin: 0;
  font-size: 10.5px;
  color: rgba(255, 244, 232, .58);
  letter-spacing: .02em;
  text-align: center;
}
.start-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8px;
  letter-spacing: .36em;
  color: rgba(255, 172, 120, .48);
  font-weight: 700;
  text-indent: .36em;
}
.start-brand .mp-icon { width: 12px; height: 12px; }

.dark-overlay {
  background: rgba(3, 5, 9, .66);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.dark-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }
.sheet {
  width: 100%;
  max-width: 332px;
  padding: 26px 22px 20px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(160deg, rgba(32, 27, 25, .96), rgba(12, 13, 18, .97));
  border: 1px solid rgba(255, 160, 90, .22);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 255, 255, .08);
  transform: translateY(12px) scale(.97);
  transition: transform .28s cubic-bezier(.2, .9, .2, 1);
}
.dark-overlay.show .sheet { transform: none; }
.sheet-tag {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 9px;
  letter-spacing: .32em;
  font-weight: 800;
  color: #FFA45C;
  text-indent: .32em;
}
.sheet h2 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .02em;
  color: #fff;
}
.sheet-desc {
  margin: 0 0 18px;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(255, 244, 232, .62);
}
.sheet-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.sheet-stats.three { grid-template-columns: 1fr 1fr 1fr; }
.sheet-stats > div {
  padding: 10px 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .08);
}
.sheet-stats b {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: #FFB067;
  font-variant-numeric: tabular-nums;
}
.sheet-stats span {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .45);
}
.primary-btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #FFA45C, #FF6B2C);
  color: #2A1204;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(255, 110, 50, .28);
  transition: transform .12s ease;
}
.primary-btn .mp-icon { width: 20px; height: 20px; }
.primary-btn:active { transform: scale(.97); }
.ghost-btn {
  width: 100%;
  height: 42px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 13px;
  background: transparent;
  color: rgba(255, 255, 255, .64);
  font-size: 12px;
  letter-spacing: .08em;
  cursor: pointer;
}
.ghost-btn:active { background: rgba(255, 255, 255, .06); }
.end-ico {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #FF9A55;
  background: rgba(255, 138, 61, .12);
  border: 1px solid rgba(255, 138, 61, .3);
  box-shadow: 0 0 24px rgba(255, 110, 40, .16);
}
.end-ico .mp-icon { width: 30px; height: 30px; }
.end-sheet.win .end-ico {
  color: #8FE3A8;
  background: rgba(80, 200, 120, .1);
  border-color: rgba(120, 230, 160, .3);
  box-shadow: 0 0 24px rgba(90, 220, 140, .16);
}
.end-sheet.win .sheet-stats b { color: #9FE6B4; }

/* ============ keyframes ============ */
@keyframes sceneDrift {
  from { transform: scale(1.02) translate3d(-.4%, -.25%, 0); }
  to { transform: scale(1.065) translate3d(.45%, .3%, 0); }
}
@keyframes emberUp {
  0% { transform: translate3d(0, 0, 0) scale(.6); opacity: 0; }
  12% { opacity: .75; }
  70% { opacity: .5; }
  100% { transform: translate3d(26px, -48vh, 0) scale(1.1); opacity: 0; }
}
@keyframes tracerFade {
  from { opacity: 1; transform: rotate(var(--rot)) scaleX(1); }
  to { opacity: 0; transform: rotate(var(--rot)) scaleX(.96); }
}
@keyframes sparkFly {
  0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  100% { opacity: 0; transform: translate3d(var(--dx), var(--dy), 0) scale(.15); }
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 4px) scale(.8); }
  18% { opacity: 1; transform: translate(-50%, -4px) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -44px) scale(.96); }
}
@keyframes ringOut {
  0% { opacity: .95; transform: scale(.35); }
  100% { opacity: 0; transform: scale(1.55); }
}
@keyframes reticlePop {
  0% { opacity: 0; transform: scale(1.5); }
  22% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.82); }
}
@keyframes muzzleFlash {
  0% { opacity: 0; transform: scale(.35) rotate(-8deg); }
  25% { opacity: 1; transform: scale(1.05) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.32) rotate(5deg); }
}
@keyframes dangerPulse {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes criticalPulse {
  0%, 100% { opacity: .38; }
  50% { opacity: .92; }
}
@keyframes sceneShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-4px, 2px, 0); }
  40% { transform: translate3d(4px, -2px, 0); }
  60% { transform: translate3d(-3px, -2px, 0); }
  80% { transform: translate3d(2px, 2px, 0); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
@keyframes pulseGlow {
  0%, 100% { opacity: .65; transform: scale(.98); }
  50% { opacity: 1; transform: scale(1.04); }
}
@keyframes zIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes lowHp {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .14); }
  50% { box-shadow: 0 0 0 1px rgba(255, 90, 60, .55), 0 0 18px rgba(255, 40, 30, .5), inset 0 1px 0 rgba(255, 255, 255, .14); }
}
@keyframes softPulse {
  0%, 100% { opacity: .7; }
  50% { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ responsive ============ */
@media (max-width: 380px) {
  .hud { padding-left: 12px; padding-right: 12px; }
  .hp-tag { display: none; }
  .score-pill { padding-right: 8px; }
  .score-txt em { display: none; }
  .score-txt b { font-size: 15px; }
  .wave-card { padding-right: 8px; gap: 6px; }
  .wave-dots { display: none; }
  .fire-btn { width: 98px; height: 98px; }
  .controls { padding: 0 16px; }
  .game-title { font-size: clamp(38px, 13.6vw, 52px); }
}

@media (max-height: 720px) {
  .hud::before { top: -60px; height: 200px; }
  .start-top .stat-row { display: none; }
  .game-title { font-size: clamp(36px, 11.5vw, 50px); }
  .tagline { margin-top: 8px; font-size: 12px; }
  .start-btn { height: 52px; }
  .fire-btn { width: 92px; height: 92px; }
  .hint-pill { bottom: calc(20px + var(--sb) + 100px); }
}

@media (max-height: 620px) {
  .start-bottom .start-tip, .start-bottom .start-brand { display: none; }
  .stat-row { display: none; }
  .game-title { font-size: 34px; }
  .sheet { padding: 18px; }
  .sheet h2 { font-size: 22px; }
  .sheet-desc { margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-bg, .fire-glow, .live-dot, .embers span { animation: none !important; }
  .stage.critical::after { animation: none !important; opacity: .5; }
}

/* 低弹量提示 */
.ammo-card.low-ammo {
  border-color: rgba(255, 90, 70, .58);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .26), 0 0 16px rgba(255, 60, 40, .18), inset 0 1px 0 rgba(255, 255, 255, .09);
}
.ammo-card.low-ammo .ammo-txt b { color: #FF7A66; animation: softPulse 0.9s ease-in-out infinite; }
.ammo-card.low-ammo .ammo-txt > span { color: rgba(255, 122, 102, .8); }
