/* ===== 基础重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05060a;
  color: #e6f1ff;
  font-family: 'Orbitron', 'Rajdhani', 'Segoe UI', sans-serif;
  font-weight: 500;
  cursor: default;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* ===== 字体加载（科幻风格） ===== */
@import url('https://miaoda.feishu.cn/fonts/css2?family=Orbitron:wght@500;700;900&family=Rajdhani:wght@400;500;600;700&display=swap');

/* ===== HUD 基础样式 ===== */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.hud-panel {
  position: absolute;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(0, 20, 40, 0.55), rgba(0, 10, 25, 0.35));
  border: 1px solid rgba(0, 200, 255, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  clip-path: polygon(
    0 0,
    calc(100% - 14px) 0,
    100% 14px,
    100% 100%,
    14px 100%,
    0 calc(100% - 14px)
  );
  box-shadow: 0 0 20px rgba(0, 180, 255, 0.15), inset 0 0 15px rgba(0, 150, 255, 0.08);
}

.hud-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(0, 220, 255, 0.75);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.hud-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: #9dd8ff;
  letter-spacing: 1px;
}

/* ===== 准星 ===== */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 20;
}

.ch-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 2px;
  background: #00eaff;
  border-radius: 50%;
  box-shadow: 0 0 4px #00eaff, 0 0 8px rgba(0, 234, 255, 0.5);
}

.ch-line {
  position: absolute;
  background: #00eaff;
  box-shadow: 0 0 4px #00eaff;
}

.ch-top, .ch-bottom {
  width: 1px;
  height: 6px;
  left: 50%;
  transform: translateX(-50%);
}
.ch-top { top: 0; }
.ch-bottom { bottom: 0; }

.ch-left, .ch-right {
  width: 6px;
  height: 1px;
  top: 50%;
  transform: translateY(-50%);
}
.ch-left { left: 0; }
.ch-right { right: 0; }

#crosshair.hit .ch-line,
#crosshair.hit .ch-dot {
  background: #ff3b3b;
  box-shadow: 0 0 6px #ff3b3b;
  transition: background 0.08s, box-shadow 0.08s;
}

/* ===== 左下 HP 条 ===== */
.hud-bottom-left {
  bottom: 28px;
  left: 28px;
  min-width: 220px;
}

.hp-bar-outer {
  width: 100%;
  height: 8px;
  background: rgba(0, 40, 60, 0.6);
  border: 1px solid rgba(0, 180, 255, 0.4);
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
}

.hp-bar-inner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00ffaa, #00eaff);
  box-shadow: 0 0 8px rgba(0, 234, 255, 0.6);
  transition: width 0.25s ease, background 0.3s;
}

.hp-bar-inner.low {
  background: linear-gradient(90deg, #ff4444, #ff8800);
  box-shadow: 0 0 8px rgba(255, 60, 60, 0.7);
}

/* ===== 右下 弹药 ===== */
.hud-bottom-right {
  bottom: 28px;
  right: 28px;
  text-align: right;
  min-width: 180px;
}

.ammo-main {
  font-family: 'Orbitron', sans-serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  color: #00eaff;
  text-shadow: 0 0 10px rgba(0, 234, 255, 0.6);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.ammo-main .ammo-sep {
  color: rgba(0, 180, 255, 0.4);
  margin: 0 4px;
  font-size: 24px;
}

.ammo-label {
  margin-bottom: 0;
  margin-top: 2px;
}

.reload-indicator {
  position: absolute;
  top: -28px;
  right: 18px;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: #ffcc00;
  letter-spacing: 3px;
  text-shadow: 0 0 6px rgba(255, 200, 0, 0.6);
  animation: reloadPulse 0.8s ease-in-out infinite;
}

@keyframes reloadPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes ammoFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.ammo-main .reload-flash {
  animation: ammoFlash 0.4s ease-in-out infinite;
  color: #ffcc00 !important;
  text-shadow: 0 0 12px rgba(255, 200, 0, 0.8) !important;
}

/* ===== 顶部 得分 ===== */
.hud-top-center {
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  min-width: 200px;
}

.score-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(0, 234, 255, 0.8);
  letter-spacing: 3px;
}

/* ===== 右上 波次+击杀 ===== */
.hud-top-right {
  top: 24px;
  right: 28px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.wave-block, .kills-block {
  text-align: right;
}

.wave-value, .kills-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffcc00;
  text-shadow: 0 0 8px rgba(255, 200, 0, 0.6);
  letter-spacing: 2px;
}

.kills-value {
  color: #ff5577;
  text-shadow: 0 0 8px rgba(255, 80, 120, 0.6);
}

/* ===== 受伤红屏 ===== */
.damage-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 30, 30, 0.5) 100%);
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 5;
}

.damage-overlay.flash {
  opacity: 1;
}

/* ===== 覆盖层界面（开始 / 暂停 / 结束） ===== */
.overlay-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(5, 10, 20, 0.85) 0%, rgba(0, 0, 10, 0.95) 100%);
  z-index: 100;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.menu-content {
  text-align: center;
  padding: 48px 56px;
  background: linear-gradient(135deg, rgba(0, 30, 60, 0.4), rgba(0, 10, 30, 0.6));
  border: 1px solid rgba(0, 200, 255, 0.4);
  clip-path: polygon(
    0 0,
    calc(100% - 24px) 0,
    100% 24px,
    100% 100%,
    24px 100%,
    0 calc(100% - 24px)
  );
  box-shadow: 0 0 40px rgba(0, 180, 255, 0.2), inset 0 0 40px rgba(0, 100, 200, 0.1);
  max-width: 520px;
  width: 90%;
}

.logo-block {
  position: relative;
  margin-bottom: 32px;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 120px;
  background: radial-gradient(ellipse, rgba(0, 200, 255, 0.35) 0%, transparent 70%);
  filter: blur(20px);
  z-index: 0;
}

.game-title {
  position: relative;
  font-family: 'Orbitron', sans-serif;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 6px;
  color: #00eaff;
  text-shadow:
    0 0 10px #00eaff,
    0 0 20px rgba(0, 234, 255, 0.6),
    0 0 40px rgba(0, 180, 255, 0.4);
  z-index: 1;
}

.game-subtitle {
  position: relative;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  letter-spacing: 8px;
  color: rgba(150, 220, 255, 0.7);
  margin-top: 6px;
  z-index: 1;
}

.menu-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #00eaff;
  text-shadow: 0 0 12px rgba(0, 234, 255, 0.6);
  margin-bottom: 28px;
}

.gameover-title {
  color: #ff3355;
  text-shadow: 0 0 12px rgba(255, 50, 80, 0.6);
}

.controls-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 32px;
  margin: 28px 0 32px;
  text-align: left;
  padding: 18px 24px;
  background: rgba(0, 20, 40, 0.5);
  border: 1px solid rgba(0, 180, 255, 0.2);
}

.ctrl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  color: #9dd8ff;
  letter-spacing: 1px;
}

.ctrl-row .key {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #00eaff;
  background: rgba(0, 100, 200, 0.2);
  border: 1px solid rgba(0, 180, 255, 0.4);
  padding: 2px 8px;
  letter-spacing: 1px;
  min-width: 56px;
  text-align: center;
}

/* ===== 按钮 ===== */
.neon-btn {
  display: inline-block;
  padding: 14px 40px;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #00eaff;
  background: linear-gradient(135deg, rgba(0, 100, 180, 0.2), rgba(0, 50, 120, 0.3));
  border: 1px solid #00eaff;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px rgba(0, 234, 255, 0.3), inset 0 0 15px rgba(0, 234, 255, 0.08);
  position: relative;
  overflow: hidden;
  margin: 6px;
}

.neon-btn:hover {
  background: linear-gradient(135deg, rgba(0, 150, 220, 0.35), rgba(0, 80, 160, 0.45));
  box-shadow: 0 0 25px rgba(0, 234, 255, 0.6), inset 0 0 20px rgba(0, 234, 255, 0.15);
  transform: translateY(-1px);
}

.neon-btn:active {
  transform: translateY(0);
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.4);
}

.neon-btn.secondary {
  color: #9dd8ff;
  border-color: rgba(100, 180, 220, 0.5);
  background: linear-gradient(135deg, rgba(40, 70, 100, 0.2), rgba(20, 40, 70, 0.3));
  box-shadow: 0 0 10px rgba(100, 180, 220, 0.15);
}

.neon-btn.secondary:hover {
  color: #00eaff;
  border-color: #00eaff;
  box-shadow: 0 0 20px rgba(0, 234, 255, 0.4);
}

.hint-text {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(150, 200, 230, 0.5);
  letter-spacing: 2px;
}

/* ===== 结算统计 ===== */
.stats-block {
  margin: 24px 0 28px;
  padding: 18px 24px;
  background: rgba(0, 20, 40, 0.5);
  border: 1px solid rgba(0, 180, 255, 0.2);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0, 180, 255, 0.15);
  font-family: 'Rajdhani', sans-serif;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row.highlight {
  padding-top: 12px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 200, 0, 0.3);
  border-bottom: none;
}

.stat-label {
  font-size: 14px;
  color: #7fb8d8;
  letter-spacing: 2px;
}

.stat-row.highlight .stat-label {
  color: #ffcc00;
}

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #00eaff;
  letter-spacing: 2px;
}

.stat-row.highlight .stat-value {
  color: #ffcc00;
  text-shadow: 0 0 8px rgba(255, 200, 0, 0.5);
}

/* ===== 波次公告 ===== */
.wave-announce {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 30;
  animation: waveIn 2s ease-out forwards;
}

.wave-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #ffcc00;
  text-shadow: 0 0 20px rgba(255, 200, 0, 0.7);
}

.wave-label span {
  font-size: 56px;
  color: #ffffff;
  text-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
}

.wave-desc {
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  letter-spacing: 6px;
  color: rgba(255, 200, 100, 0.8);
  margin-top: 8px;
}

@keyframes waveIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .game-title { font-size: 32px; letter-spacing: 3px; }
  .menu-content { padding: 32px 24px; }
  .controls-info { grid-template-columns: 1fr; gap: 8px; }
  .hud-bottom-left, .hud-bottom-right { bottom: 16px; left: 12px; right: 12px; }
  .hud-bottom-right { right: 12px; }
}
