/* ============================================================ 基础 */
:root {
  --blue: #4fc3ff;
  --red: #ff5c4d;
  --amber: #ffb347;
  --ink: #05070a;
  --panel: rgba(10, 16, 22, 0.82);
  --line: rgba(110, 180, 220, 0.28);
  --font: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'SF Mono', 'Cascadia Mono', Consolas, monospace;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #04060a;
  color: #dfe9f2;
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
}

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

body.locked canvas#game { cursor: none; }

/* ============================================================ HUD 容器 */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  font-family: var(--font);
}
#hud.show { opacity: 1; }

/* ============================================================ 顶部比分 */
#topbar {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 18px;
  background: linear-gradient(180deg, rgba(6,10,16,0.85), rgba(6,10,16,0.35));
  border: 1px solid rgba(110,180,220,0.18);
  border-radius: 4px;
  backdrop-filter: blur(6px);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
#score {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
#score .blue { color: var(--blue); text-shadow: 0 0 12px rgba(79,195,255,0.6); }
#score .red { color: var(--red); text-shadow: 0 0 12px rgba(255,92,77,0.6); }
#score .sep { opacity: 0.4; font-size: 16px; }
#timer {
  font-family: var(--mono);
  font-size: 15px;
  color: #9fb6c8;
  letter-spacing: 1px;
  border-left: 1px solid rgba(110,180,220,0.2);
  padding-left: 16px;
}
#timer.low { color: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.45; } }

/* ============================================================ 小地图 */
#minimap-wrap {
  position: absolute;
  top: 16px; left: 16px;
  width: 176px; height: 176px;
  border: 1px solid rgba(110,180,220,0.25);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(4,8,12,0.6);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), inset 0 0 30px rgba(0,0,0,0.6);
}
#minimap {
  width: 100%; height: 100%;
  display: block;
  image-rendering: auto;
}
.mm-label {
  position: absolute;
  bottom: 4px; left: 8px;
  font-size: 9px;
  letter-spacing: 2.4px;
  color: rgba(140,200,230,0.55);
  font-family: var(--mono);
}

/* ============================================================ 击杀信息 */
#killfeed {
  position: absolute;
  top: 16px; right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: 320px;
}
.kf-item {
  font-size: 12px;
  font-family: var(--mono);
  padding: 4px 10px;
  background: rgba(6,10,16,0.75);
  border-left: 2px solid rgba(255,92,77,0.7);
  border-radius: 2px;
  color: #b8cad8;
  opacity: 0;
  transform: translateX(16px);
  transition: all 0.22s ease-out;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.kf-item.show { opacity: 1; transform: translateX(0); }
.kf-item .me { color: var(--blue); font-weight: 700; }
.kf-item .enemy { color: var(--red); }
.kf-item .kf-weapon { color: var(--amber); margin: 0 6px; }

/* ============================================================ 准星 */
#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  transition: opacity 0.12s;
}
#crosshair .ch {
  position: absolute;
  background: rgba(230, 245, 255, 0.92);
  box-shadow: 0 0 3px rgba(0,0,0,0.9), 0 0 6px rgba(140,220,255,0.35);
  left: 0; top: 0;
  transform-origin: 0 0;
}
.ch-t, .ch-b { width: 2px; height: 8px; margin-left: -1px; margin-top: -8px; }
.ch-r, .ch-l { width: 8px; height: 2px; margin-left: 0; margin-top: -1px; }
.ch-dot {
  position: absolute;
  width: 2px; height: 2px;
  background: rgba(230,245,255,0.85);
  margin-left: -1px; margin-top: -1px;
  border-radius: 50%;
}
#crosshair.ads .ch { background: rgba(120, 255, 180, 0.9); }

#hitmarker {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  opacity: 0;
}
#hitmarker span {
  position: absolute;
  width: 2px; height: 9px;
  background: #fff;
  box-shadow: 0 0 4px rgba(255,255,255,0.9);
  left: -1px; top: -4.5px;
  transform-origin: 50% 50%;
}
#hitmarker span:nth-child(1) { transform: rotate(45deg) translateY(-9px); }
#hitmarker span:nth-child(2) { transform: rotate(135deg) translateY(-9px); }
#hitmarker span:nth-child(3) { transform: rotate(225deg) translateY(-9px); }
#hitmarker span:nth-child(4) { transform: rotate(315deg) translateY(-9px); }
#hitmarker.head span { background: var(--amber); box-shadow: 0 0 8px var(--amber); }

/* ============================================================ 伤害数字 */
#damage-numbers {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.dmg-num {
  position: absolute;
  left: 0; top: 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 6px rgba(0,0,0,0.95), 0 1px 2px #000;
  will-change: transform, opacity;
  pointer-events: none;
}
.dmg-num.head { color: var(--amber); font-size: 19px; text-shadow: 0 0 10px rgba(255,179,71,0.9), 0 1px 3px #000; }

/* ============================================================ 击杀横幅 */
#kill-banner {
  position: absolute;
  top: 34%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 17px;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 14px rgba(255,80,60,0.9);
  opacity: 0;
  font-weight: 600;
}
#streak-banner {
  position: absolute;
  top: 24%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  letter-spacing: 8px;
  font-weight: 800;
  color: var(--amber);
  text-shadow: 0 0 22px rgba(255,150,40,0.9), 0 2px 6px #000;
  opacity: 0;
}

/* ============================================================ 受击方向 */
#hit-dirs {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
}
.hit-dir {
  position: absolute;
  left: -30px; top: -10px;
  width: 60px; height: 20px;
  display: none;
  background: radial-gradient(ellipse at center, rgba(255,60,40,0.9), rgba(255,60,40,0) 70%);
  clip-path: polygon(0 50%, 30% 0, 70% 0, 100% 50%, 70% 100%, 30% 100%);
}

/* ============================================================ 状态（左下） */
#status {
  position: absolute;
  left: 22px; bottom: 22px;
}
.vitals .row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.vitals .ico { font-size: 15px; width: 16px; text-align: center; }
.ico.hp { color: var(--red); text-shadow: 0 0 8px rgba(255,92,77,0.7); }
.ico.ap { color: var(--blue); text-shadow: 0 0 8px rgba(79,195,255,0.7); font-size: 11px; }
.bar {
  width: 190px; height: 10px;
  background: rgba(8,14,20,0.85);
  border: 1px solid rgba(110,180,220,0.22);
  position: relative;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
}
.bar.small { height: 5px; width: 150px; }
#health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4d3d, #ff8a5c);
  box-shadow: 0 0 12px rgba(255,80,60,0.7);
  transition: width 0.16s ease-out;
}
#health-fill.low { background: linear-gradient(90deg, #ff2222, #ff5533); animation: pulse 0.6s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
#armor-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f9fe0, #7fd6ff);
  box-shadow: 0 0 10px rgba(79,195,255,0.6);
  transition: width 0.2s;
}
#health-num {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  min-width: 42px;
  text-align: right;
  text-shadow: 0 1px 4px #000;
}
#hud.critical #health-num { color: var(--red); animation: pulse 0.5s infinite; }

/* ============================================================ 武器（右下） */
#weapon-panel {
  position: absolute;
  right: 24px; bottom: 22px;
  text-align: right;
}
#weapon-panel .wname {
  font-size: 12px;
  letter-spacing: 3px;
  color: rgba(150,200,230,0.7);
  margin-bottom: 2px;
}
#weapon-panel .ammo {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.9);
}
#weapon-panel .ammo .slash { font-size: 20px; opacity: 0.35; margin: 0 3px; }
#ammo-reserve { font-size: 20px; color: rgba(160,190,210,0.75); }
#ammo-mag.empty { color: var(--red); animation: blink 0.6s infinite; }
#ammo-mag.low { color: var(--amber); }
.slots {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 6px;
}
.slots .slot {
  width: 20px; height: 18px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  border: 1px solid rgba(110,180,220,0.22);
  color: rgba(140,180,210,0.5);
  border-radius: 2px;
}
.slots .slot.active {
  border-color: rgba(79,195,255,0.75);
  color: var(--blue);
  box-shadow: 0 0 8px rgba(79,195,255,0.35);
}
#reload-ring {
  position: absolute;
  right: 130px; bottom: 6px;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: none;
  background: conic-gradient(var(--amber) var(--p, 0%), rgba(255,255,255,0.08) 0);
  align-items: center;
  justify-content: center;
}
#reload-ring.active { display: flex; }
#reload-ring .ring-inner {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(6,10,16,0.92);
}
#reload-ring span {
  position: relative;
  font-size: 9px;
  color: var(--amber);
  letter-spacing: 1px;
}

/* ============================================================ 死亡 / 复活 */
#death-msg {
  position: absolute;
  top: 60%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 15px;
  color: rgba(220,230,240,0.8);
  background: rgba(6,10,16,0.55);
  padding: 8px 20px;
  border-radius: 3px;
  display: none;
  white-space: nowrap;
}
#death-msg .killer { color: var(--red); font-weight: 700; }
#death-msg .weap { color: rgba(160,190,210,0.7); font-family: var(--mono); font-size: 12px; }
#death-msg .hs { color: var(--amber); font-size: 12px; }

#respawn {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(60,0,0,0.10), rgba(10,0,0,0.45));
}
#respawn .label { font-size: 12px; letter-spacing: 4px; color: rgba(255,150,140,0.7); }
#respawn .count {
  font-family: var(--mono);
  font-size: 56px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 26px rgba(255,70,50,0.7);
}
#respawn .hint { font-size: 11px; color: rgba(180,200,215,0.45); margin-top: 8px; letter-spacing: 1px; }

/* ============================================================ 计分板 */
#scoreboard {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: 520px;
  background: rgba(6,10,16,0.94);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px 22px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.16s;
  backdrop-filter: blur(10px);
}
#scoreboard.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#scoreboard h2 {
  font-size: 13px;
  letter-spacing: 4px;
  color: rgba(150,200,230,0.7);
  margin-bottom: 12px;
  font-weight: 500;
}
.sb-head, .sb-row {
  display: grid;
  grid-template-columns: 1fr 60px 60px 70px;
  gap: 6px;
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: 12px;
}
.sb-head { color: rgba(130,170,200,0.5); font-size: 10px; letter-spacing: 1px; border-bottom: 1px solid rgba(110,180,220,0.15); }
.sb-row { border-radius: 2px; }
.sb-row.blue { background: rgba(79,195,255,0.06); }
.sb-row.red { background: rgba(255,92,77,0.05); }
.sb-row.me { background: rgba(79,195,255,0.14); box-shadow: inset 2px 0 0 var(--blue); }
.sb-row span:nth-child(n+2) { text-align: right; }
.sb-name { color: #cfe0ee; }
.sb-row.me .sb-name { color: var(--blue); font-weight: 700; }
.sb-name em { font-style: normal; font-size: 9px; opacity: 0.6; }

/* ============================================================ Toast */
#toasts {
  position: absolute;
  bottom: 130px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 5px;
}
.toast {
  font-size: 12px;
  padding: 6px 16px;
  background: rgba(6,10,16,0.8);
  border: 1px solid rgba(110,180,220,0.2);
  border-radius: 2px;
  color: #b8cad8;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.24s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.kill { border-color: rgba(255,92,77,0.5); color: #ffb0a5; }
.toast.info { border-color: rgba(79,195,255,0.4); color: #a5d8ff; }

#prompt {
  position: absolute;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 2px;
  color: rgba(160,190,210,0.45);
  opacity: 0;
  transition: opacity 0.3s;
}
body:not(.locked) #hud.show #prompt { opacity: 1; }

/* ============================================================ 暂停 */
#pause, #match-end {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3,6,10,0.72);
  backdrop-filter: blur(8px);
  z-index: 40;
}
#pause.show, #match-end.show { display: flex; }

.panel {
  width: 420px;
  padding: 32px;
  background: linear-gradient(160deg, rgba(12,20,28,0.98), rgba(6,10,16,0.98));
  border: 1px solid var(--line);
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 20px 80px rgba(0,0,0,0.7);
}
.panel h2 {
  font-size: 20px;
  letter-spacing: 6px;
  font-weight: 600;
  margin-bottom: 10px;
}
.panel p { font-size: 13px; color: rgba(160,190,210,0.6); margin-bottom: 24px; }

button {
  font-family: var(--font);
  font-size: 13px;
  padding: 10px 20px;
  background: rgba(255,255,255,0.04);
  color: #cfe0ee;
  border: 1px solid rgba(110,180,220,0.25);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.14s;
  letter-spacing: 1px;
}
button:hover {
  background: rgba(79,195,255,0.12);
  border-color: rgba(79,195,255,0.6);
  color: #fff;
}
button.primary {
  background: linear-gradient(180deg, rgba(79,195,255,0.28), rgba(79,195,255,0.12));
  border-color: rgba(79,195,255,0.65);
  color: #eaf7ff;
  box-shadow: 0 0 22px rgba(79,195,255,0.2);
}
button.primary:hover { box-shadow: 0 0 34px rgba(79,195,255,0.4); }
#pause .panel button { display: block; width: 100%; margin-top: 10px; }

/* ============================================================ 结算 */
#match-end .panel { width: 460px; }
#match-end .result {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 12px;
  margin-bottom: 4px;
}
#match-end .result.win { color: var(--blue); text-shadow: 0 0 40px rgba(79,195,255,0.6); }
#match-end .result.lose { color: var(--red); text-shadow: 0 0 40px rgba(255,92,77,0.6); }
#match-end .result.draw { color: #aab; }
#match-end .final-score {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 22px;
}
#match-end .final-score .blue { color: var(--blue); }
#match-end .final-score .red { color: var(--red); }
#match-end .stats {
  display: flex;
  justify-content: center;
  gap: 34px;
  margin-bottom: 26px;
}
#match-end .stats div { display: flex; flex-direction: column; gap: 4px; }
#match-end .stats span { font-size: 10px; letter-spacing: 2px; color: rgba(150,180,205,0.5); }
#match-end .stats b { font-family: var(--mono); font-size: 22px; }
#match-end .row-btns { display: flex; gap: 10px; justify-content: center; }

/* ============================================================ 主菜单 */
#menu {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(20,60,90,0.55), transparent 60%),
    linear-gradient(180deg, rgba(4,8,14,0.92), rgba(3,6,10,0.98));
  overflow-y: auto;
}
#menu.show { display: flex; }
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(79,195,255,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,195,255,0.055) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 40%, black 10%, transparent 72%);
  pointer-events: none;
  animation: gridmove 22s linear infinite;
}
@keyframes gridmove { to { background-position: 48px 48px; } }

.menu-inner {
  position: relative;
  width: min(1080px, 94vw);
  padding: 34px 8px;
}
#menu header { text-align: center; margin-bottom: 26px; }
#menu h1 {
  font-size: clamp(38px, 6.5vw, 76px);
  font-weight: 900;
  letter-spacing: 8px;
  line-height: 1;
  color: #eaf6ff;
  text-shadow: 0 0 40px rgba(79,195,255,0.45), 0 0 90px rgba(79,195,255,0.2);
}
#menu h1 span {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--blue);
  text-shadow: 0 0 30px rgba(79,195,255,0.6);
}
#menu .tagline {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 5px;
  color: rgba(140,190,220,0.55);
  font-family: var(--mono);
}

#menu .mode-note {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 2.2px;
  color: rgba(140, 190, 220, 0.42);
  font-family: var(--mono);
  text-align: center;
}

#menu .mode-note::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: #2fe0ff;
  box-shadow: 0 0 8px rgba(47, 224, 255, 0.9);
  vertical-align: 1px;
}

.cols {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 18px;
  margin-bottom: 26px;
}
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

.col {
  background: rgba(8,14,20,0.72);
  border: 1px solid rgba(110,180,220,0.16);
  border-radius: 4px;
  padding: 16px 18px;
  backdrop-filter: blur(6px);
}
.col h3 {
  font-size: 10px;
  letter-spacing: 4px;
  color: rgba(140,190,220,0.6);
  font-weight: 500;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.row-btns button { flex: 1; min-width: 66px; padding: 9px 6px; font-size: 12px; }
.row-btns button.active {
  background: linear-gradient(180deg, rgba(79,195,255,0.26), rgba(79,195,255,0.1));
  border-color: rgba(79,195,255,0.7);
  color: #eaf7ff;
  box-shadow: 0 0 18px rgba(79,195,255,0.22);
}
.row-btns.small button { padding: 6px 4px; font-size: 11px; }

.guns { display: flex; flex-direction: column; gap: 7px; }
.gun-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  text-align: left;
  padding: 8px 12px;
  gap: 1px 8px;
}
.gun-btn .gname { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 1.5px; }
.gun-btn .gcls {
  font-size: 9px;
  color: rgba(150,190,215,0.55);
  letter-spacing: 1px;
  align-self: center;
  grid-row: 1;
  grid-column: 2;
}
.gun-btn .gstat { font-size: 10px; color: rgba(150,180,200,0.5); font-family: var(--mono); }
.gun-btn.active {
  background: linear-gradient(90deg, rgba(79,195,255,0.2), rgba(79,195,255,0.04));
  border-color: rgba(79,195,255,0.6);
}
.gun-btn.active .gname { color: var(--blue); }
.gun-btn.active .gstat { color: rgba(160,215,245,0.75); }

.field {
  display: block;
  margin-bottom: 12px;
  font-size: 11px;
  color: rgba(160,195,220,0.7);
}
.field > span { display: block; margin-bottom: 6px; letter-spacing: 1px; }
.field b { color: var(--blue); font-family: var(--mono); }
.field.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.field.checkbox input { accent-color: var(--blue); }
input[type=range] {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(110,180,220,0.22);
  border-radius: 2px;
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 10px rgba(79,195,255,0.7);
  cursor: pointer;
}
.hint { font-size: 10px; color: rgba(140,175,200,0.42); margin-top: 10px; line-height: 1.6; }

.actions { text-align: center; margin-bottom: 22px; }
button.big {
  font-size: 15px;
  padding: 14px 64px;
  letter-spacing: 6px;
  font-weight: 600;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  font-size: 10px;
  color: rgba(140,175,200,0.5);
  font-family: var(--mono);
}
.keys kbd {
  display: inline-block;
  padding: 2px 6px;
  margin-right: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(110,180,220,0.22);
  border-radius: 2px;
  font-size: 9px;
  color: rgba(180,215,240,0.8);
}

/* ============================================================ 加载屏 */
#loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #04060a;
  transition: opacity 0.6s;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading .logo {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #eaf6ff;
  text-shadow: 0 0 30px rgba(79,195,255,0.5);
}
#loading .logo span { color: transparent; -webkit-text-stroke: 1px var(--blue); }
#loading .bar {
  width: 220px; height: 2px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
#loading .fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  animation: load 1.1s infinite;
}
@keyframes load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}
#loading .msg { font-size: 11px; letter-spacing: 3px; color: rgba(140,175,200,0.45); font-family: var(--mono); }

/* ============================================================
   真实化 HUD 覆写（现代军事 FPS 风格）
   ============================================================ */
:root {
  --steel-0: #0b0f13;
  --steel-1: #131a20;
  --steel-2: #1c252c;
  --line-soft: rgba(190, 210, 220, 0.14);
  --line-hard: rgba(210, 225, 232, 0.30);
  --txt: #e7eef3;
  --txt-dim: #93a5b1;
  --hp: #d8e3e8;
  --hp-low: #d8563f;
  --ar: #6fb2d8;
  --accent: #7fd4ff;
}

/* ---------- 顶部比分 / 计时 ---------- */
#topbar {
  top: 12px;
  gap: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  backdrop-filter: none;
  clip-path: none;
  display: flex;
  align-items: stretch;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.7));
}
#topbar .team-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 12px;
  background: linear-gradient(180deg, rgba(16, 23, 29, 0.93), rgba(9, 13, 17, 0.88));
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid rgba(0, 0, 0, 0.6);
}
#topbar .team-cell.blue { border-left: 3px solid #4a9fd5; border-right: 1px solid var(--line-soft); clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); padding-right: 22px; }
#topbar .team-cell.red  { border-right: 3px solid #d05a4a; border-left: 1px solid var(--line-soft); clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%); padding-left: 22px; }
#topbar .team-cell b {
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--txt);
  letter-spacing: 0.5px;
}
#topbar .team-cell.blue b { color: #7cc4e8; }
#topbar .team-cell.red  b { color: #e08a7c; }
#topbar .tc-tag {
  font-size: 9px;
  letter-spacing: 2.6px;
  color: var(--txt-dim);
  font-weight: 600;
}
#topbar .mid-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 5px 18px;
  background: linear-gradient(180deg, rgba(20, 28, 35, 0.96), rgba(11, 15, 19, 0.92));
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid rgba(0, 0, 0, 0.6);
}
#timer {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--txt);
  border: none;
  padding: 0;
  font-variant-numeric: tabular-nums;
}
#timer.low { color: #ff7a63; }
#topbar .round-hint {
  font-size: 8.5px;
  letter-spacing: 1.6px;
  color: rgba(147, 165, 177, 0.6);
  margin-top: 1px;
  white-space: nowrap;
}

/* ---------- 罗盘 ---------- */
#compass {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  width: 460px;
  height: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  opacity: 0.92;
}
#compass .cmp-clip {
  position: relative;
  width: 100%;
  height: 20px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  background: linear-gradient(180deg, rgba(10, 14, 18, 0.45), rgba(10, 14, 18, 0.12));
  border-top: 1px solid rgba(190, 210, 220, 0.13);
  border-bottom: 1px solid rgba(190, 210, 220, 0.13);
}
#compass .cmp-strip { position: absolute; top: 0; left: 0; height: 100%; will-change: transform; }
#compass .cmp-strip i {
  position: absolute;
  bottom: 0;
  width: 1px;
  background: rgba(200, 218, 228, 0.42);
  font-style: normal;
}
#compass .cmp-strip i.min { height: 5px; opacity: 0.55; }
#compass .cmp-strip i.mid { height: 9px; opacity: 0.8; }
#compass .cmp-strip i.maj { height: 13px; background: rgba(230, 242, 248, 0.85); }
#compass .cmp-strip i.maj b {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(231, 238, 243, 0.92);
  font-family: var(--mono);
}
#compass .cmp-center {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0; height: 0;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--accent);
  filter: drop-shadow(0 0 4px rgba(127, 212, 255, 0.75));
}
#compass .cmp-deg {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(180, 200, 212, 0.7);
  font-variant-numeric: tabular-nums;
}

/* ---------- 小地图 ---------- */
#minimap-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  background: rgba(5, 8, 11, 0.72);
}
#minimap-wrap::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(190, 215, 230, 0.05), transparent 40%);
  pointer-events: none;
}
.mm-label {
  background: rgba(6, 10, 13, 0.75);
  padding: 2px 8px 2px 6px;
  border-top: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  color: rgba(180, 205, 220, 0.72);
  letter-spacing: 3px;
}

/* ---------- 左下生命 / 护甲 ---------- */
#status {
  bottom: 22px;
  left: 26px;
  padding: 0;
  background: none;
}
#status .vitals { display: flex; flex-direction: column; gap: 6px; }
#status .vrow {
  display: grid;
  grid-template-columns: 26px 44px 190px;
  align-items: center;
  gap: 8px;
}
#status .vlabel {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 1.6px;
  color: rgba(160, 180, 195, 0.7);
  font-weight: 600;
}
#status #health-num, #status #armor-num {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1;
  color: var(--hp);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}
#status #armor-num { font-size: 15px; color: #9cc8e2; }
#status .vtrack {
  position: relative;
  height: 11px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.45));
  border: 1px solid rgba(190, 210, 220, 0.16);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}
#status .vtrack { height: 13px; }
#status .vrow.ar-row .vtrack { height: 8px; }
#status #health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #f2f7fa, #c3d2da 55%, #93a9b5);
  transition: width 0.18s ease-out;
  box-shadow: 0 0 8px rgba(220, 235, 245, 0.28);
}
#status.critical #health-fill { animation: hpPulse 0.9s infinite; }
@keyframes hpPulse { 50% { filter: brightness(1.45); } }
#status #health-fill.low { background: linear-gradient(180deg, #ff8b73, #d8563f 60%, #8f2c1d); }
#status #armor-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #a9d8f2, #5b9dc4 60%, #3a6f92);
  transition: width 0.18s ease-out;
}
#status .vseg {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(90deg, transparent 0 18px, rgba(0, 0, 0, 0.55) 18px 20px);
  pointer-events: none;
}

/* ---------- 右下武器 ---------- */
#weapon-panel {
  right: 26px;
  bottom: 22px;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: end;
  gap: 4px 16px;
  padding: 0;
  background: none;
  border: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}
#weapon-panel .wmeta { grid-column: 1; text-align: right; padding-bottom: 6px; }
#weapon-panel .wname {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3.2px;
  color: var(--txt);
  line-height: 1.1;
}
#weapon-panel .wmode {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.8px;
  color: rgba(150, 172, 188, 0.75);
  margin-top: 3px;
}
#weapon-panel .ammo {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  gap: 7px;
  line-height: 1;
}
#weapon-panel #ammo-mag {
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--txt);
  letter-spacing: -1px;
}
#weapon-panel #ammo-mag.low { color: #ffab6b; }
#weapon-panel #ammo-mag.empty { color: #ff6f57; animation: blink 0.7s infinite; }
#weapon-panel .slash { font-size: 20px; color: rgba(150, 172, 188, 0.45); }
#weapon-panel #ammo-reserve {
  font-family: var(--mono);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  color: rgba(180, 200, 214, 0.88);
}
#weapon-panel .slots {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
#weapon-panel .slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 10px;
  letter-spacing: 1.4px;
  color: rgba(150, 172, 188, 0.6);
  background: rgba(12, 17, 22, 0.6);
  border: 1px solid rgba(190, 210, 220, 0.12);
}
#weapon-panel .slot kbd {
  font-family: var(--mono);
  font-size: 9px;
  padding: 0 4px;
  background: rgba(190, 210, 220, 0.13);
  border-radius: 2px;
  color: rgba(220, 235, 245, 0.8);
}
#weapon-panel .slot.active {
  color: var(--txt);
  border-color: rgba(127, 212, 255, 0.55);
  background: rgba(30, 50, 62, 0.7);
  box-shadow: inset 0 1px 0 rgba(127, 212, 255, 0.22);
}

/* ---------- 击杀信息流 ---------- */
.kf-item {
  background: linear-gradient(90deg, rgba(10, 14, 18, 0.05), rgba(10, 14, 18, 0.82) 22%);
  border-right: 2px solid rgba(190, 210, 220, 0.28);
  padding: 4px 10px 4px 14px;
  font-size: 12px;
  letter-spacing: 0.4px;
}
.kf-item.me { border-right-color: var(--accent); }
.kf-item .kf-w { color: rgba(150, 172, 188, 0.85); }

/* ---------- 准星 ---------- */
#crosshair .ch { background: rgba(232, 244, 250, 0.88); box-shadow: 0 0 2px rgba(0, 0, 0, 0.9); }
#crosshair .ch-dot { background: rgba(232, 244, 250, 0.7); box-shadow: 0 0 2px rgba(0, 0, 0, 0.9); }

/* ---------- 主菜单真实化 ---------- */
#menu { background: radial-gradient(ellipse at 50% 0%, #101820 0%, #05080b 62%, #020406 100%); }
#menu .bg-grid { opacity: 0.18; }
#menu h1 {
  letter-spacing: 7px;
  font-weight: 300;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.9);
}
#menu h1 span { color: var(--accent); font-weight: 700; letter-spacing: 9px; }
#menu .tagline { letter-spacing: 3.6px; color: rgba(150, 172, 188, 0.75); }
#menu section.col {
  background: linear-gradient(180deg, rgba(16, 22, 28, 0.86), rgba(8, 11, 15, 0.9));
  border: 1px solid var(--line-soft);
  border-top-color: rgba(210, 225, 232, 0.2);
}
#menu section.col h3 {
  letter-spacing: 3.4px;
  color: rgba(180, 205, 220, 0.9);
  font-weight: 600;
  font-size: 11px;
}
#menu .gun-btn, #menu .diff-btn, #menu .quality-btn {
  background: linear-gradient(180deg, rgba(26, 34, 42, 0.9), rgba(14, 19, 24, 0.9));
  border: 1px solid rgba(190, 210, 220, 0.14);
  letter-spacing: 0.6px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
#menu .gun-btn:hover, #menu .diff-btn:hover, #menu .quality-btn:hover {
  border-color: rgba(127, 212, 255, 0.5);
  background: linear-gradient(180deg, rgba(34, 46, 56, 0.95), rgba(18, 25, 31, 0.95));
}
#menu .gun-btn.active, #menu .diff-btn.active, #menu .quality-btn.active {
  border-color: rgba(127, 212, 255, 0.75);
  background: linear-gradient(180deg, rgba(38, 62, 78, 0.95), rgba(16, 28, 36, 0.95));
  box-shadow: inset 0 1px 0 rgba(127, 212, 255, 0.25);
}
#menu .btn-start, #menu .primary {
  letter-spacing: 4px;
  font-weight: 600;
  text-transform: uppercase;
}
#menu .keys kbd {
  background: rgba(190, 210, 220, 0.1);
  border: 1px solid rgba(190, 210, 220, 0.2);
  border-bottom-color: rgba(0, 0, 0, 0.6);
}

/* 修正：隐藏旧比分节点（避免与团队分栏重复） */
#score[hidden] { display: none !important; }
#weapon-panel .slot { white-space: nowrap; }
#weapon-panel .slots { flex-wrap: nowrap; }
#weapon-panel .slot kbd { margin-left: 2px; }
#topbar { z-index: 3; }
#compass { z-index: 2; }

/* 武器面板排版修正：弹药与槽位明确分行 */
#weapon-panel {
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  row-gap: 10px;
  align-items: end;
}
#weapon-panel .wmeta { grid-column: 1; grid-row: 1; align-self: end; }
#weapon-panel .ammo { grid-column: 2; grid-row: 1; }
#weapon-panel .slots {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-content: flex-end;
  margin-top: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(190, 210, 220, 0.12);
}
#weapon-panel .slot { padding: 3px 8px; }

/* 底部留白修正 */
#weapon-panel { bottom: 14px; right: 20px; }
#status { bottom: 16px; left: 22px; }
#weapon-panel .slots { padding-top: 6px; }
#weapon-panel .slot { font-size: 9.5px; letter-spacing: 1px; padding: 2px 7px; }


/* ---------------------------------------------------- 暂停提示 / 调试 / 错误 */
#prompt.show { opacity: 1 !important; }
body.paused #prompt { opacity: 0 !important; }
#prompt { transition: opacity .25s; }

#pause { cursor: pointer; }
#pause .panel { pointer-events: auto; }
#pause .panel h2 { letter-spacing: .04em; }

#dbgline {
  position: fixed; left: 10px; bottom: 10px; z-index: 90;
  font: 12px/1.5 ui-monospace, Consolas, monospace;
  color: #9fe8c0; background: rgba(6,10,14,.78);
  border: 1px solid rgba(120,255,190,.28);
  border-radius: 6px; padding: 5px 9px;
  white-space: pre; opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
#dbgline.show { opacity: 1; }

#errbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 200;
  background: linear-gradient(90deg, #7a1f1f, #a12c2c);
  color: #ffe9e9;
  font: 13px/1.5 ui-monospace, Consolas, monospace;
  padding: 7px 14px; opacity: 0; pointer-events: none;
  transform: translateY(-100%); transition: opacity .2s, transform .2s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#errbar.show { opacity: 1; transform: none; }

/* ---------------------------------------------------- 击杀信息流（队伍色） */
#killfeed .kf-item { border-left: 2px solid transparent; padding-left: 7px; }
#killfeed .kf-item.kf-mine  { border-left-color: #ffd166; background: rgba(255,209,102,.09); }
#killfeed .kf-item.kf-blue  { border-left-color: #4ea8ff; }
#killfeed .kf-item.kf-red   { border-left-color: #ff5b4a; }
#killfeed .kf-gun {
  font-size: 9.5px; letter-spacing: .1em; opacity: .5; margin-left: 6px;
  text-transform: uppercase;
}

/* ---------------------------------------------------- 队友报点 */
#callouts {
  position: absolute; left: 50%; bottom: 27%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 4px;
  align-items: center; pointer-events: none;
}
.callout {
  font: 11.5px/1.5 ui-monospace, Consolas, monospace;
  letter-spacing: .05em;
  color: #cfe6ff;
  background: rgba(8, 18, 28, .62);
  border: 1px solid rgba(90, 170, 255, .28);
  border-radius: 3px;
  padding: 3px 10px;
  animation: calloutIn .18s ease-out;
}
.callout b { color: #7cc4ff; font-weight: 600; letter-spacing: .08em; }
.callout span { color: #ffd166; }
@keyframes calloutIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------- 计分板分队 */
#scoreboard { display: none; }
#scoreboard.show { display: block; }
.sb-team { margin-bottom: 14px; }
.sb-team-h {
  font: 600 12px/1.6 ui-monospace, Consolas, monospace;
  letter-spacing: .16em; text-transform: uppercase;
  padding: 4px 8px; margin-bottom: 2px;
  border-left: 3px solid currentColor;
}
.sb-team.blue .sb-team-h { color: #4ea8ff; background: rgba(78,168,255,.08); }
.sb-team.red  .sb-team-h { color: #ff5b4a; background: rgba(255,91,74,.08); }
.sb-team-h b { float: right; font-size: 13px; }
.sb-row.blue .sb-name { color: #9fd0ff; }
.sb-row.red  .sb-name { color: #ffb0a6; }
.sb-row.me { background: rgba(255,209,102,.10); }

/* 报点不要压到计分板上 */
#scoreboard.show ~ #callouts,
body.sb-open #callouts { opacity: 0; }
#callouts { transition: opacity .15s; }
