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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  user-select: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- 遮罩层 ---------- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 20, 0.88);
  color: #fff;
  z-index: 100;
  text-align: center;
  backdrop-filter: blur(2px);
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  font-size: 56px;
  letter-spacing: 8px;
  margin-bottom: 16px;
  color: #ffd54a;
  text-shadow: 0 0 20px rgba(255, 213, 74, 0.6);
}

.overlay p {
  font-size: 18px;
  color: #ccc;
  margin-bottom: 24px;
}

.overlay button {
  margin-top: 24px;
  padding: 14px 48px;
  font-size: 20px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  background: #ffd54a;
  color: #222;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.overlay button:hover {
  background: #ffe082;
  transform: scale(1.05);
}

.controls {
  margin-top: 8px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  line-height: 1.8;
  font-size: 15px;
  color: #bbb;
}

.controls b {
  color: #ffd54a;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#hud .hidden {
  display: none;
}

/* 准星（四臂式，可扩散） */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  /* --spread 由 JS 更新：越大准星越扩散 */
  --spread: 6px;
  pointer-events: none;
}

#crosshair.hidden {
  display: none;
}

.ch-arm {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

/* 上下臂（竖线，长 10px） */
.ch-t {
  width: 2px;
  height: 10px;
  left: -1px;
  bottom: 0;
  transform: translateY(calc(-10px - var(--spread)));
}

.ch-b {
  width: 2px;
  height: 10px;
  left: -1px;
  top: 0;
  transform: translateY(calc(10px + var(--spread)));
}

/* 左右臂（横线，长 10px） */
.ch-l {
  width: 10px;
  height: 2px;
  top: -1px;
  right: 0;
  transform: translateX(calc(-10px - var(--spread)));
}

.ch-r {
  width: 10px;
  height: 2px;
  top: -1px;
  left: 0;
  transform: translateX(calc(10px + var(--spread)));
}

/* 命中标记（X 形，位于准星中心；命中敌人显示，爆头为红色） */
#hitmarker {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
#hitmarker.hidden {
  display: none;
}
.hm {
  position: absolute;
  background: #fff;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}
#hitmarker.headshot .hm {
  background: #ff5252;
}
.hm-tl, .hm-bl {
  width: 2px;
  height: 6px;
  left: -1px;
}
.hm-tr, .hm-br {
  width: 2px;
  height: 6px;
  right: -1px;
}
.hm-tl {
  top: 0;
  transform: translate(-3px, -8px) rotate(45deg);
}
.hm-tr {
  top: 0;
  transform: translate(3px, -8px) rotate(-45deg);
}
.hm-bl {
  bottom: 0;
  transform: translate(-3px, 8px) rotate(-45deg);
}
.hm-br {
  bottom: 0;
  transform: translate(3px, 8px) rotate(45deg);
}

/* 狙击镜瞄准圈 */
#scope {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60vmin;
  height: 60vmin;
  pointer-events: none;
}

#scope.hidden {
  display: none;
}

#scope-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.95);
  background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.92) 78%, transparent 100%);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.9);
}

.scope-line {
  position: absolute;
  background: rgba(0, 0, 0, 0.95);
}

.scope-h {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

.scope-v {
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
}

/* 镜内刻度线 */
.scope-tick {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
}

.st-tl, .st-tr {
  top: calc(50% - 4vmin);
  width: 2px;
  height: 8vmin;
}
.st-tl { left: calc(50% - 2px); }
.st-tr { left: calc(50% - 2px); }

.st-bl, .st-br {
  bottom: calc(50% - 4vmin);
  width: 2px;
  height: 8vmin;
}
.st-bl { left: calc(50% - 2px); }
.st-br { left: calc(50% - 2px); }

/* 底部信息栏 */
#bottomBar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 20px 32px;
}

/* 生命条 */
#healthBlock {
  width: 260px;
}

#healthLabel {
  font-size: 13px;
  color: #ccc;
  margin-bottom: 4px;
}

#healthBarOuter {
  height: 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

#healthBar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e53935, #4caf50);
  transition: width 0.2s;
}

/* 信息区 */
#infoBlock {
  text-align: right;
  line-height: 1.6;
}

#ammo {
  font-size: 34px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

#weaponName {
  font-size: 16px;
  font-weight: bold;
  color: #ffd54a;
  margin-bottom: 2px;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

#waveInfo {
  font-size: 16px;
  color: #ffd54a;
}

#kills {
  font-size: 16px;
  color: #fff;
}

#enemyInfo {
  font-size: 14px;
  color: #ff8a80;
}

/* 武器切换栏 */
#weaponBar {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.45);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.weapon-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #aaa;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.weapon-slot .ws-key {
  font-weight: bold;
  color: #888;
  font-size: 15px;
}

.weapon-slot.active {
  background: #ffd54a;
  color: #222;
  border-color: #ffd54a;
}

.weapon-slot.active .ws-key {
  color: #222;
}

/* 下一波倒计时提示 */
#nextWaveHint {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
  font-weight: bold;
  color: #ffd54a;
  text-shadow: 0 0 10px rgba(255, 213, 74, 0.8);
  animation: nextWavePulse 1s ease-in-out infinite;
  pointer-events: none;
}

#nextWaveHint.hidden {
  display: none;
}

@keyframes nextWavePulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 受击红屏 */
#damageOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(255, 0, 0, 0.6) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}

/* 换弹提示 */
#reloadHint {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  color: #ffd54a;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 20px;
  border-radius: 4px;
}

/* 补给点方向箭头（屏幕边缘，指向最近补给点） */
#supplyArrow {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 4;
}
#supplyArrow::before {
  content: "";
  position: absolute;
  left: -8px;
  top: -8px;
  border: 8px solid transparent;
  border-left-color: #ffd54a;
  filter: drop-shadow(0 0 4px rgba(255, 213, 74, 0.9));
}
#supplyArrow.hidden {
  display: none;
}

/* 补给解锁进度条 */
#supplyProgressWrap {
  position: absolute;
  top: 68%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 4;
}
#supplyProgressWrap.hidden {
  display: none;
}
#supplyProgressText {
  font-size: 16px;
  color: #ffd54a;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
  margin-bottom: 4px;
}
#supplyProgressBarOuter {
  width: 200px;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto;
}
#supplyProgressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd54a, #ff9800);
  transition: width 0.05s linear;
}

/* 靠近补给点提示 */
#supplyHint {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  color: #ffd54a;
  background: rgba(0, 0, 0, 0.55);
  padding: 6px 16px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 4;
}
#supplyHint.hidden {
  display: none;
}

/* 任务提示（迷宫目标） */
#objectiveHint {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  color: #81c784;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 20px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 4;
  border: 1px solid rgba(129, 199, 132, 0.4);
}
#objectiveHint.hidden {
  display: none;
}

/* 游戏结束得分 */
#finalScore {
  font-size: 22px;
  color: #fff;
  margin-top: 8px;
}

/* 击杀飘字 */
#killFeed {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 5;
}

.kill-popup {
  font-size: 26px;
  font-weight: bold;
  color: #ffd54a;
  text-shadow: 0 0 10px rgba(255, 213, 74, 0.8);
  margin-bottom: 8px;
  animation: killFloat 1.2s ease-out forwards;
  opacity: 0;
}

@keyframes killFloat {
  0% { opacity: 0; transform: translateY(10px) scale(0.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.1); }
  30% { transform: translateY(-5px) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(1); }
}

.ammo-popup {
  font-size: 24px;
  font-weight: bold;
  color: #81c784;
  text-shadow: 0 0 10px rgba(129, 199, 132, 0.8);
  margin-bottom: 8px;
  animation: killFloat 1.2s ease-out forwards;
  opacity: 0;
}

