* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body { font-family: "Segoe UI", "Microsoft YaHei", sans-serif; color: #e8ecf4; }
canvas.game {
  display: block; width: 100vw; height: 100vh;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.hidden { display: none !important; }

/* ============ 主菜单 ============ */
.screen {
  position: fixed; inset: 0; z-index: 50;
  background: radial-gradient(ellipse at 30% 10%, #1c2b4d 0%, #0b1020 55%, #06080f 100%);
  display: flex; align-items: center; justify-content: center;
}
.menu-box { text-align: center; width: 420px; padding: 40px; }
.menu-box h1 {
  font-size: 46px; letter-spacing: 10px; font-weight: 900;
  font-family: "Consolas", "Courier New", "Microsoft YaHei", monospace;
  color: #ffd75e;
  text-shadow: 0 0 0 #000, 4px 4px 0 #7a3b2e, 8px 8px 0 rgba(0,0,0,.55);
}
.menu-box .sub { color: #8b96ad; margin: 12px 0 34px; letter-spacing: 2px; font-size: 13px; }
.menu-box input {
  display: block; width: 100%; margin: 12px 0; padding: 13px 16px; font-size: 15px;
  background: #0d1322; border: 3px solid #2e3a5c; border-radius: 0;
  box-shadow: inset 3px 3px 0 rgba(0,0,0,.5);
  color: #fff; outline: none; text-align: center;
}
.menu-box input:focus { border-color: #ffd75e; }
.menu-box button {
  width: 100%; margin-top: 14px; padding: 14px; font-size: 17px; font-weight: 900;
  letter-spacing: 6px; border: 3px solid #10101c; border-radius: 0; cursor: pointer;
  background: #3fae5a; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,.45);
  box-shadow: inset -4px -4px 0 rgba(0,0,0,.28), inset 4px 4px 0 rgba(255,255,255,.22), 0 5px 0 #10101c;
  transition: transform .08s, box-shadow .08s;
}
.menu-box button:hover { background: #4cc268; }
.menu-box button:active { transform: translateY(4px); box-shadow: inset -4px -4px 0 rgba(0,0,0,.28), inset 4px 4px 0 rgba(255,255,255,.22), 0 1px 0 #10101c; }
#menuMsg { color: #ff7b7b; margin-top: 12px; font-size: 13px; min-height: 18px; }
.help { margin-top: 26px; font-size: 12px; color: #6d788e; line-height: 2; }
.help b { color: #93a0b8; }
.back { display: inline-block; margin-top: 18px; color: #5d6880; font-size: 12px; text-decoration: none; }
.back:hover { color: #4db2ff; }

/* ============ HUD 通用 ============ */
#hud > div, #hud > canvas { position: fixed; z-index: 10; }

/* 准星 */
#crosshair { left: 50%; top: 50%; transform: translate(-50%, -50%); width: 0; height: 0; }
.ch { position: absolute; background: #5dff8f; box-shadow: 0 0 3px #000; }
.ch-t { width: 2px; height: 9px; left: -1px; top: calc(-11px - var(--sp, 4px)); }
.ch-b { width: 2px; height: 9px; left: -1px; top: calc(2px + var(--sp, 4px)); }
.ch-l { width: 9px; height: 2px; top: -1px; left: calc(-11px - var(--sp, 4px)); }
.ch-r { width: 9px; height: 2px; top: -1px; left: calc(2px + var(--sp, 4px)); }
.ch-dot { position: absolute; width: 2px; height: 2px; left: -1px; top: -1px; background: #5dff8f; }
#hitmarker {
  left: 50%; top: 50%; transform: translate(-50%, -50%) scale(1);
  font-size: 30px; color: #fff; opacity: 0; font-weight: 900; pointer-events: none;
  text-shadow: 0 0 6px #f00;
}
#hitmarker.show { animation: hitpop .18s ease-out; }
#hitmarker.kill { color: #ff4d4d; font-size: 38px; }
@keyframes hitpop { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1.4); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(0.9); } }

/* 血量 */
#hpBox { left: 24px; bottom: 24px; display: flex; align-items: center; gap: 12px; }
#hpBar { width: 220px; height: 16px; background: rgba(0,0,0,.6); border: 3px solid #10101c; border-radius: 0; overflow: hidden; }
#hpFill { height: 100%; width: 100%; background: linear-gradient(90deg, #37d67a, #7dff9e); transition: width .15s; }
#hpFill.low { background: linear-gradient(90deg, #d33, #ff7b5e); }
#hpText { font-size: 26px; font-weight: 800; text-shadow: 0 0 6px #000; }

/* 武器状态 */
#statBox { right: 24px; bottom: 24px; text-align: right; text-shadow: 0 0 6px #000; }
#moneyText { font-size: 22px; font-weight: 800; color: #ffd75e; }
#weaponName { font-size: 14px; color: #aab6cc; margin-top: 4px; letter-spacing: 2px; }
#ammoText { font-size: 30px; font-weight: 800; }
#ammoText .ammo-sep { color: #667; margin: 0 4px; font-size: 20px; }
#reserveText { font-size: 18px; color: #93a0b8; }
#nadeText { font-size: 15px; margin-top: 2px; }

/* 击杀播报 */
#killfeed { right: 16px; top: 16px; text-align: right; font-size: 13px; }
#killfeed .kf {
  background: rgba(8,10,20,.78); border-radius: 0; padding: 4px 10px; margin-bottom: 5px;
  border: 2px solid #10101c; border-right: 4px solid #ffd75e;
  animation: kfin .2s ease-out;
}
#killfeed .kf .head { color: #ffb84d; }
@keyframes kfin { from { transform: translateX(30px); opacity: 0; } }

/* 聊天 */
#chatbox { left: 16px; top: 180px; font-size: 13px; max-width: 360px; pointer-events: none; }
#chatbox .msg { background: rgba(0,0,0,.4); border-radius: 4px; padding: 3px 9px; margin-bottom: 4px; word-break: break-all; }
#chatbox .msg.sys { color: #8fa3c7; font-style: italic; }
#chatInput {
  position: fixed; left: 16px; top: 150px; z-index: 11; width: 300px;
  padding: 7px 12px; font-size: 13px; display: none;
  background: rgba(0,0,0,.7); border: 1px solid #4db2ff; border-radius: 4px; color: #fff; outline: none;
}

/* 金钱飘字 */
#moneyFlash {
  right: 24px; bottom: 130px; font-size: 20px; font-weight: 800; color: #7dff9e;
  opacity: 0; text-shadow: 0 0 8px #000;
}
#moneyFlash.show { animation: moneyup 1.2s ease-out; }
@keyframes moneyup { 0% { opacity: 1; transform: translateY(10px); } 100% { opacity: 0; transform: translateY(-30px); } }

/* 受击 */
#vignette {
  inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,0,0,.55) 100%);
  transition: opacity .1s;
}
#dmgdir {
  left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  pointer-events: none; opacity: 0;
}
#dmgdir::before {
  content: ''; position: absolute; left: 50%; top: -8px; transform: translateX(-50%);
  border: 12px solid transparent; border-bottom: 20px solid rgba(255,40,40,.9);
  filter: drop-shadow(0 0 6px #f00);
}

/* 小地图 */
#minimap {
  right: 16px; top: 100px; border-radius: 0; border: 3px solid #10101c;
  background: rgba(5,10,20,.85); image-rendering: pixelated;
}

/* 提示 */
#toast {
  left: 50%; top: 18%; transform: translateX(-50%); font-size: 16px; font-weight: 600;
  color: #ffd75e; text-shadow: 0 0 8px #000; opacity: 0; transition: opacity .2s; pointer-events: none;
}
#protTag {
  left: 50%; bottom: 18%; transform: translateX(-50%); font-size: 14px; color: #7fc4ff;
  text-shadow: 0 0 8px #000; display: none;
}

/* 狙击镜 */
#scope { inset: 0; pointer-events: none; }
#scope::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at center, transparent 26%, rgba(0,0,0,.97) 27.5%);
}
.scope-h { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0,0,0,.8); }
.scope-v { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: rgba(0,0,0,.8); }

/* 购买菜单 */
#buymenu {
  left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(8,12,22,.94); border: 3px solid #10101c;
  box-shadow: 0 6px 0 rgba(0,0,0,.5);
  border-radius: 0; padding: 14px 18px; min-width: 640px;
}
.buy-title { font-size: 15px; font-weight: 700; letter-spacing: 2px; margin-bottom: 10px; }
.buy-title #buyMoney { color: #ffd75e; margin-left: 12px; }
.buy-tip { float: right; font-size: 11px; color: #77839c; font-weight: 400; }
#buyItems { display: flex; gap: 8px; }
.buy-item {
  flex: 1; border: 2px solid #2e3a5c; border-radius: 0;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.06);
  padding: 9px 10px; font-size: 12px; background: rgba(255,255,255,.04);
}
.buy-item .k {
  display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center;
  background: #2b7fff; border-radius: 4px; font-weight: 700; font-size: 11px; margin-bottom: 6px;
}
.buy-item .nm { font-weight: 700; font-size: 13px; }
.buy-item .pr { color: #ffd75e; margin-top: 3px; }
.buy-item .st { color: #77839c; font-size: 10px; margin-top: 3px; }
.buy-item.owned { border-color: #37d67a; }
.buy-item.owned .pr { color: #37d67a; }
.buy-item.cant { opacity: .45; }

/* 计分板 */
#scoreboard {
  left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(8,12,22,.95); border: 3px solid #10101c;
  box-shadow: 0 6px 0 rgba(0,0,0,.5);
  border-radius: 0; padding: 20px 26px; min-width: 520px;
}
.sb-title { font-size: 17px; font-weight: 700; letter-spacing: 3px; margin-bottom: 12px; }
.sb-title span { color: #77839c; font-size: 12px; margin-left: 10px; letter-spacing: 1px; }
#scoreboard table { width: 100%; border-collapse: collapse; font-size: 14px; }
#scoreboard th { text-align: left; color: #77839c; font-size: 12px; padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,.15); }
#scoreboard td { padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
#scoreboard tr.me td { background: rgba(77,178,255,.1); }
#scoreboard .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
#scoreboard .bot-tag { font-size: 10px; color: #0b1020; background: #f1c40f; border-radius: 3px; padding: 1px 5px; margin-left: 6px; }
#scoreboard .dead-row { opacity: .45; }

/* 死亡 */
#dead {
  inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(60,0,0,.35), rgba(10,0,0,.78)); z-index: 20;
}
#deadBy { font-size: 26px; font-weight: 700; text-shadow: 0 0 12px #f00; margin-bottom: 26px; }
#respawnBtn {
  padding: 13px 44px; font-size: 16px; font-weight: 700; letter-spacing: 4px;
  background: linear-gradient(90deg, #2b7fff, #37d67a); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
}
#respawnBtn:disabled { background: #333; cursor: not-allowed; color: #777; }

/* 暂停菜单 */
#pause { inset: 0; background: rgba(4,6,12,.82); z-index: 30; display: flex; align-items: center; justify-content: center; }
.pause-box { width: 460px; text-align: center; background: #0e1526; border: 3px solid #10101c; box-shadow: 0 6px 0 rgba(0,0,0,.5); border-radius: 0; padding: 30px 34px; }
.pause-box h2 { letter-spacing: 8px; margin-bottom: 20px; }
.pbtn {
  display: block; width: 100%; margin: 10px 0; padding: 12px; font-size: 15px; font-weight: 900;
  letter-spacing: 3px; border: 3px solid #10101c; border-radius: 0; cursor: pointer;
  background: #2b7fff; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,.4);
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.25), inset 3px 3px 0 rgba(255,255,255,.2);
}
.pbtn:active { transform: translateY(2px); }
.pbtn.gray { background: #4a5468; }
.pbtn.small { display: inline-block; width: auto; padding: 7px 16px; font-size: 13px; margin: 0 4px; }
#hostSection { margin: 16px 0; padding: 14px; border: 1px solid rgba(241,196,15,.4); border-radius: 10px; background: rgba(241,196,15,.05); }
.host-title { color: #ffd75e; font-weight: 700; letter-spacing: 2px; margin-bottom: 10px; }
.host-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
#playerList { text-align: left; font-size: 13px; max-height: 160px; overflow-y: auto; }
#playerList .pl-row { display: flex; align-items: center; padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.07); }
#playerList .pl-row .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; }
#playerList .pl-row .nm { flex: 1; }
#playerList .kick { background: #c0392b; border: none; color: #fff; border-radius: 4px; padding: 3px 10px; font-size: 11px; cursor: pointer; }
.pause-help { margin: 16px 0; font-size: 11px; color: #6d788e; line-height: 1.9; }

/* 锁定提示 */
#lockTip {
  left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 15;
  font-size: 26px; font-weight: 800; letter-spacing: 10px; color: #fff;
  text-shadow: 0 0 20px #4db2ff; animation: pulse 1.4s infinite; pointer-events: none;
}
@keyframes pulse { 0%,100% { opacity: .95; } 50% { opacity: .4; } }

/* ===== 像素风补充 ===== */
.screen {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 30% 10%, #16204a 0%, #0b1020 55%, #06080f 100%);
}
#respawnBtn {
  border-radius: 0; border: 3px solid #10101c; font-weight: 900;
  background: #3fae5a; text-shadow: 2px 2px 0 rgba(0,0,0,.45);
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.25), inset 3px 3px 0 rgba(255,255,255,.2), 0 4px 0 #10101c;
}
#respawnBtn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset -3px -3px 0 rgba(0,0,0,.25), inset 3px 3px 0 rgba(255,255,255,.2); }
#respawnBtn:disabled { background: #39415a; color: #77809a; }
#chatInput { border-radius: 0; border: 2px solid #ffd75e; }
.buy-item .k { border-radius: 0; }
#statBox, #hpText, #moneyText, #ammoText, #weaponName { font-family: "Consolas", "Courier New", "Microsoft YaHei", monospace; }
#moneyText { text-shadow: 2px 2px 0 #000; }
#ammoText { text-shadow: 2px 2px 0 #000; }
#toast { font-family: "Consolas", monospace; font-weight: 700; }
#scoreboard th, #scoreboard td { font-family: "Consolas", "Microsoft YaHei", monospace; }
#lockTip { font-family: "Consolas", "Microsoft YaHei", monospace; color: #ffd75e; text-shadow: 3px 3px 0 #000; }
.host-row .pbtn.small { margin: 0 4px; }
