/* CS 2D Web 样式 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow: hidden; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #151a21; color: #e8edf4; user-select: none;
}
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: crosshair; }

.hidden { display: none !important; }

/* ---------- HUD ---------- */
.hud { position: fixed; z-index: 20; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.hud-tl { top: 12px; left: 12px; }
#radar {
  border: 1px solid rgba(255,255,255,.18); border-radius: 8px;
  background: rgba(8,12,18,.85); display: block;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.hud-money { margin-top: 6px; font-size: 17px; font-weight: 700; color: #9fe8a0; font-variant-numeric: tabular-nums; }

.hud-top {
  top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center;
  background: rgba(10,14,20,.78); border: 1px solid rgba(255,255,255,.12);
  padding: 6px 16px; border-radius: 10px; font-size: 14px; font-variant-numeric: tabular-nums;
}
.hud-top .score { font-size: 17px; font-weight: 800; }
.hud-top .time { font-weight: 800; color: #ffd76a; }
.hud-top .zone-t { font-weight: 700; color: #ff9d8a; font-size: 13.5px; }
.hud-top .alive { color: #9fb2cc; font-size: 12px; }
.ct { color: #6fb3ff; } .t { color: #ffb85c; }

#killfeed { top: 12px; right: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.kf-row {
  background: rgba(10,14,20,.72); border-radius: 6px; padding: 3px 9px;
  font-size: 12.5px; animation: kfin .18s ease;
}
.kf-w { color: #93a3bb; }
@keyframes kfin { from { transform: translateX(14px); opacity: 0; } }

/* 左下：武器槽位说明 */
#hud-slots {
  position: fixed; bottom: 16px; left: 16px; z-index: 22; pointer-events: none;
  display: flex; flex-direction: column; gap: 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,.85);
}
.slot-row {
  display: flex; align-items: center; gap: 8px;
  background: rgba(8,12,20,.6); border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px; padding: 4px 10px 4px 6px; font-size: 13px; min-width: 148px;
}
.slot-row .sk {
  width: 20px; height: 20px; border-radius: 5px; background: #2b3a52;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #cfe0ff; flex: none;
}
.slot-row .sn { color: #c3d0e2; flex: 1; }
.slot-row .sw { color: #e8edf4; font-weight: 700; }
.slot-row.active { border-color: rgba(120,180,255,.65); background: rgba(30,50,80,.72); }
.slot-row.empty .sw { color: #66748c; font-weight: 400; }

/* 底部中间：血量/护甲/体力条 */
#hud-vitals {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 22; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.85);
  display: flex; flex-direction: column; gap: 5px; align-items: center;
}
.vital-row { display: flex; align-items: center; gap: 8px; }
.vital-row.sub { gap: 10px; }
.vital-icon { font-size: 15px; line-height: 1; }
.vital-icon.sm { font-size: 12px; }
.vital-bar {
  position: relative; height: 14px; border-radius: 7px; overflow: hidden;
  background: rgba(8,12,20,.72); border: 1px solid rgba(255,255,255,.22);
  width: 300px;
}
.vital-bar > div { height: 100%; width: 100%; border-radius: 6px; transition: width .15s; }
#bar-hp { background: linear-gradient(90deg, #37c26a, #6fe08f); }
#hud-vitals.low #bar-hp { background: linear-gradient(90deg, #d64541, #f07b5f); }
#hud-vitals.mid #bar-hp { background: linear-gradient(90deg, #d3a422, #f2d24f); }
.vital-bar.armor { width: 132px; height: 10px; }
#bar-armor { background: linear-gradient(90deg, #3f7fd6, #7fb1f2); }
#armor-level { min-width: 42px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.vital-bar.stamina { width: 132px; height: 10px; }
#bar-stamina { background: linear-gradient(90deg, #d6a12c, #f5cf62); }
#hud-vitals .vital-bar.exhausted > div { background: linear-gradient(90deg, #8a6d2c, #b99b4a); }
.vital-pct {
  font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 52px; text-align: right;
}
.hud-br { bottom: 14px; right: 14px; text-align: right; }
.hud-br .wname { display: block; font-size: 14px; color: #c3d0e2; }
.hud-br .ammo { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-br .nade { display: block; font-size: 13px; color: #ffd76a; min-height: 16px; }

/* E 拾取提示（顶部，不遮挡视野；与横幅/轻提示纵向堆叠） */
#pickup-tip {
  position: fixed; top: 96px; left: 50%; transform: translateX(-50%);
  z-index: 56; pointer-events: none;
  background: rgba(12,18,28,.9); border: 1px solid rgba(160,210,255,.4);
  color: #dbe8f6; padding: 7px 16px; border-radius: 9px; font-size: 14.5px;
  opacity: 0; transition: opacity .12s; text-shadow: 0 1px 3px rgba(0,0,0,.8);
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
#pickup-tip.show { opacity: 1; }
#pickup-tip b {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  background: #2b5fd9; border-radius: 5px; font-size: 13px;
}

/* 轻提示（顶部，横幅与拾取提示下方） */
#toast {
  position: fixed; top: 142px; left: 50%; transform: translateX(-50%);
  z-index: 55; pointer-events: none;
  background: rgba(10,14,22,.88); border: 1px solid rgba(255,255,255,.16);
  color: #e8edf4; padding: 8px 18px; border-radius: 99px; font-size: 14px;
  opacity: 0; transition: opacity .18s; text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
#toast.show { opacity: 1; }

/* 阶段横幅（紧贴顶栏下方，不进画面中心） */
#banner {
  position: fixed; top: 56px; left: 50%; transform: translateX(-50%);
  z-index: 25; pointer-events: none; text-align: center;
  font-size: 18px; font-weight: 800; padding: 8px 22px; border-radius: 12px;
  background: rgba(8,12,18,.72); border: 1px solid rgba(255,255,255,.14);
  opacity: 0; transition: opacity .18s; text-shadow: 0 1px 4px rgba(0,0,0,.9);
}
#banner.show { opacity: 1; }
#banner.freeze { color: #9fd0ff; }
#banner.win { color: #9fe8a0; border-color: rgba(120,230,140,.4); }
#banner.lose { color: #ff8d7e; border-color: rgba(255,120,110,.4); }

/* ---------- 购买菜单 ---------- */
#buy-menu {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,10,16,.55); backdrop-filter: blur(3px);
}
.buy-panel {
  background: linear-gradient(180deg, #161d29, #10151f);
  border: 1px solid rgba(255,255,255,.14); border-radius: 14px;
  padding: 16px 18px; width: min(92vw, 460px);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.buy-head { font-weight: 800; font-size: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; }
.buy-head .buy-close { font-size: 12px; color: #8ba0bf; font-weight: 400; }
.buy-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.07); margin-bottom: 6px;
  background: rgba(255,255,255,.03); transition: background .12s;
}
.buy-item:hover { background: rgba(255,255,255,.1); }
.bi-key {
  width: 22px; height: 22px; border-radius: 5px; background: #2b3a52;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #cfe0ff;
}
.bi-name { flex: 1; font-size: 14.5px; }
.bi-price { color: #9fe8a0; font-weight: 700; font-variant-numeric: tabular-nums; }
#buy-tip { min-height: 18px; font-size: 13px; margin-top: 4px; }
#buy-tip.ok { color: #9fe8a0; } #buy-tip.err { color: #ff8d7e; }

/* ---------- 计分板 ---------- */
#scoreboard {
  position: fixed; inset: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.sb-panel {
  background: rgba(10,14,20,.9); border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 18px 22px; display: flex; gap: 26px;
}
.sb-team h3 { margin: 0 0 8px; font-size: 15px; }
.sb-team table, .end-table { border-collapse: collapse; font-size: 13px; }
.sb-team td, .sb-team th, .end-table td, .end-table th { padding: 4px 12px; text-align: left; }
.sb-team th, .end-table th { color: #8ba0bf; font-weight: 600; }
.sb-team tr.me td, .end-table tr.me td { color: #ffe08a; font-weight: 700; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4,8,14,.78); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dialog {
  background: linear-gradient(180deg, #141b27, #0e141e);
  border: 1px solid rgba(255,255,255,.13); border-radius: 16px;
  max-width: 620px; width: 100%; max-height: 90vh; overflow: auto;
  padding: 26px; text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.6);
  animation: dIn .25s cubic-bezier(.2,1.2,.4,1);
}
@keyframes dIn { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.dialog h1 { margin: 4px 0 10px; font-size: 26px; }
.dialog .lead { color: #c3d0e2; line-height: 1.8; font-size: 14.5px; }
.big-emoji { font-size: 50px; }
.opt-row { display: flex; gap: 10px; justify-content: center; align-items: center; margin: 18px 0; flex-wrap: wrap; }
.opt-row label { font-size: 13.5px; color: #9fb2cc; }
.opt-row select {
  background: #1a2332; color: #e8edf4; border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px; padding: 7px 10px; font-size: 14px;
}
.btn {
  background: #243246; color: #dbe6f8; border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; padding: 10px 20px; font-size: 15px; cursor: pointer;
}
.btn:hover { filter: brightness(1.2); }
.btn.primary { background: #2b5fd9; border-color: #4d7bf0; color: #fff; }
.btn.big { font-size: 17px; padding: 13px 36px; border-radius: 12px; }
.btn-row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.help-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px;
  margin-top: 20px; font-size: 13px; color: #9fb2cc; text-align: left;
}
.help-grid b { color: #e0e9f6; }
.end-table { margin: 12px auto; }

/* 主菜单按钮列 */
.menu-btns { display: flex; flex-direction: column; gap: 10px; margin: 18px auto; max-width: 380px; }
.menu-btns .btn { width: 100%; }

/* 等待房间 */
.room-players { margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.room-player {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px; padding: 9px 14px; font-size: 14.5px;
}
.room-player .rdy { color: #9fe8a0; font-size: 13px; }
.room-player .nrdy { color: #8ba0bf; font-size: 13px; }
.ping-ok { color: #8be29b; font-size: 11.5px; }
.ping-mid { color: #f2d24f; font-size: 11.5px; }
.ping-bad { color: #f28b7d; font-size: 11.5px; }
.room-empty { color: #8ba0bf; font-size: 13px; padding: 14px; }
#room-settings { margin: 8px 0; }
#room-settings .opt-row { margin: 6px 0; }
#btn-room-start:disabled { opacity: .55; cursor: default; }

/* 联机大厅 */
.lead.lobby-ok { color: #8be29b; }
.lead.lobby-warn { color: #f2b64f; }
.opt-row input {
  flex: 1; min-width: 120px; max-width: 260px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px; color: #e6edf8; padding: 8px 12px;
  font-family: inherit; font-size: 14px;
}
.opt-row input:focus { outline: none; border-color: rgba(77,123,240,.7); }
#lobby-rooms { min-height: 60px; max-height: 200px; overflow-y: auto; }
.lobby-code { color: #8ba0bf; font-size: 12px; }
