/* ===== 钢铁雷霆 主样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0e12; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: #e8eaed;
  user-select: none;
}
#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }
.overlay { position: fixed; inset: 0; z-index: 50; }

/* ---------- 加载界面 ---------- */
#loading-screen {
  background: radial-gradient(ellipse at 50% 40%, #1c2733 0%, #0b0e12 75%);
  display: flex; align-items: center; justify-content: center;
}
.load-box { text-align: center; width: min(560px, 86vw); }
.logo-text {
  font-size: 64px; letter-spacing: 0.18em; font-weight: 900;
  background: linear-gradient(180deg, #ffe9b0, #e8a33d 55%, #9c5f16);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 24px rgba(232, 163, 61, 0.25);
}
.logo-text.small { font-size: 34px; }
.logo-en { font-size: 16px; color: #8a94a3; letter-spacing: 0.4em; -webkit-text-fill-color: #8a94a3; }
.logo-sub { letter-spacing: 0.55em; color: #8a94a3; margin: 6px 0 34px; font-size: 15px; }
.load-bar-wrap {
  height: 14px; border: 1px solid #3d4a5c; border-radius: 7px; overflow: hidden;
  background: #141a22;
}
#load-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #b97d24, #ffce6b);
  transition: width 0.15s ease;
}
#load-status { margin-top: 12px; color: #aab4c2; font-size: 13px; }
.load-tip { margin-top: 40px; color: #5d6875; font-size: 12px; }

/* ---------- 机库 ---------- */
#hangar-screen { pointer-events: none; }
#hangar-screen > * { pointer-events: auto; }
.hangar-top {
  position: absolute; top: 0; left: 0; right: 0; padding: 18px 28px;
  display: flex; align-items: baseline; gap: 24px;
  background: linear-gradient(180deg, rgba(8,10,14,0.85), transparent);
}
.hangar-mode { color: #c9a25e; font-size: 14px; letter-spacing: 0.15em; }
.hangar-left {
  position: absolute; left: 0; top: 86px; bottom: 96px; width: 300px; padding: 14px;
  background: linear-gradient(90deg, rgba(8,10,14,0.82), rgba(8,10,14,0.35) 85%, transparent);
  overflow-y: auto;
}
.hangar-right {
  position: absolute; right: 0; top: 86px; width: 340px; padding: 14px;
  background: linear-gradient(-90deg, rgba(8,10,14,0.82), rgba(8,10,14,0.35) 85%, transparent);
}
.panel-title { font-size: 13px; color: #8a94a3; letter-spacing: 0.25em; margin-bottom: 10px; }
.tank-card {
  border: 1px solid #333e4d; border-radius: 6px; padding: 10px 12px; margin-bottom: 10px;
  background: rgba(20, 26, 34, 0.85); cursor: pointer; transition: all 0.15s;
}
.tank-card:hover { border-color: #c9a25e; background: rgba(38, 46, 58, 0.9); }
.tank-card.selected { border-color: #ffce6b; background: rgba(60, 50, 28, 0.85); box-shadow: 0 0 12px rgba(255, 206, 107, 0.2); }
.tank-card .t-name { font-size: 16px; font-weight: 700; }
.tank-card .t-sub { font-size: 12px; color: #8a94a3; margin-top: 2px; display: flex; justify-content: space-between; }
.tank-card .t-br { color: #c9a25e; }
#tank-stats { font-size: 13px; }
#tank-stats h2 { font-size: 20px; margin-bottom: 4px; color: #ffe9b0; }
#tank-stats .nation { color: #8a94a3; margin-bottom: 12px; font-size: 12px; letter-spacing: 0.2em; }
.stat-row { display: flex; align-items: center; margin: 7px 0; gap: 8px; }
.stat-row .lbl { width: 74px; color: #aab4c2; }
.stat-row .bar { flex: 1; height: 7px; background: #1d242e; border-radius: 4px; overflow: hidden; }
.stat-row .bar > div { height: 100%; background: linear-gradient(90deg, #7d9c48, #b5d36c); }
.stat-row .val { width: 84px; text-align: right; color: #dfe5ec; }
.shell-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 12px; }
.shell-table th, .shell-table td { border-top: 1px solid #2a3441; padding: 5px 4px; text-align: left; color: #cdd5df; }
.shell-table th { color: #8a94a3; font-weight: normal; }
.hangar-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; height: 84px; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: linear-gradient(0deg, rgba(8,10,14,0.9), transparent);
}
.hangar-opts { display: flex; gap: 22px; color: #aab4c2; font-size: 13px; align-items: center; }
.hangar-opts input[type="range"] { vertical-align: middle; }

/* ---------- 按钮 ---------- */
.btn {
  font-family: inherit; font-size: 16px; padding: 12px 30px; border-radius: 4px;
  border: 1px solid transparent; cursor: pointer; letter-spacing: 0.1em; transition: all 0.15s;
}
.btn.primary {
  background: linear-gradient(180deg, #ffd77e, #d9982f); color: #241a05; font-weight: 800;
  box-shadow: 0 2px 14px rgba(217, 152, 47, 0.35);
}
.btn.primary:hover { filter: brightness(1.12); }
.btn.secondary { background: #232c38; color: #cdd5df; border-color: #3d4a5c; }
.btn.secondary:hover { background: #2e3947; }
.btn.danger { background: #5c2020; color: #f2c9c9; border-color: #7c3030; }
.btn.danger:hover { background: #712828; }
.btn.wide { display: block; width: 100%; margin: 10px 0; }

/* ---------- 弹窗 ---------- */
#controls-modal, #pause-menu { background: rgba(5, 8, 12, 0.72); display: flex; align-items: center; justify-content: center; z-index: 80; }
.modal-box {
  width: min(430px, 90vw); background: #141a22; border: 1px solid #3d4a5c; border-radius: 8px;
  padding: 26px 30px; text-align: center;
}
.modal-box h2 { margin-bottom: 18px; color: #ffe9b0; letter-spacing: 0.2em; }
.keys-table { width: 100%; margin-bottom: 18px; border-collapse: collapse; font-size: 14px; }
.keys-table td { padding: 6px 8px; border-bottom: 1px solid #222b36; text-align: left; }
.keys-table td:first-child { color: #ffce6b; width: 40%; font-weight: 700; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 40; pointer-events: none; font-size: 14px; }
#hud-top {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
}
.score-bar {
  width: 220px; height: 18px; background: rgba(10, 14, 19, 0.65); border-radius: 3px;
  position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,0.12);
}
.score-bar .fill { position: absolute; inset: 0; transform-origin: left; }
.score-bar.a .fill { background: linear-gradient(90deg, #2c6f4a, #45a06c); }
.score-bar.b .fill { background: linear-gradient(270deg, #7c2d2d, #b04545); transform-origin: right; }
.score-bar .num { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 18px; color: #fff; text-shadow: 0 1px 2px #000; }
.score-bar.a { transform: scaleX(-1); } .score-bar.a .num { transform: scaleX(-1); }
#match-timer { font-size: 17px; font-weight: 700; color: #f2f5f8; text-shadow: 0 1px 3px #000; min-width: 64px; text-align: center; }
#cap-banner {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%);
  padding: 4px 18px; background: rgba(10,14,19,0.6); border-radius: 3px; font-size: 13px; color: #ffce6b;
}

#kill-feed { position: absolute; top: 76px; right: 16px; text-align: right; }
.feed-item {
  background: rgba(10, 14, 19, 0.6); margin-bottom: 4px; padding: 3px 10px; border-radius: 3px;
  font-size: 12.5px; color: #dfe5ec; animation: feedIn 0.25s ease;
}
.feed-item .k { color: #8fd18f; } .feed-item .v { color: #e88f8f; } .feed-item .w { color: #ffce6b; padding: 0 6px; }
.feed-item.me { border: 1px solid rgba(255, 206, 107, 0.5); }
@keyframes feedIn { from { transform: translateX(30px); opacity: 0; } }

#crosshair-cam {
  position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px;
  background: rgba(255,255,255,0.9); border-radius: 50%; box-shadow: 0 0 3px #000;
}
#crosshair-gun { position: absolute; width: 84px; height: 84px; margin: -42px; left: 50%; top: 50%; }
#crosshair-gun svg { width: 100%; height: 100%; overflow: visible; }
#crosshair-gun svg circle, #crosshair-gun svg line { stroke: #7fe07f; filter: drop-shadow(0 0 1.5px rgba(0,0,0,0.9)); }
#crosshair-gun.pen-no svg circle, #crosshair-gun.pen-no svg line { stroke: #e05050; }
#crosshair-gun.pen-maybe svg circle, #crosshair-gun.pen-maybe svg line { stroke: #ffce6b; }
#crosshair-gun.blocked svg circle, #crosshair-gun.blocked svg line { stroke: #9aa4b1; opacity: 0.7; }
#reload-arc { stroke: #ffce6b !important; transition: stroke-dashoffset 0.1s linear; }
#reload-arc-bg { stroke: #fff !important; }
#reload-text {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px;
  font-size: 12px; color: #ffce6b; text-shadow: 0 1px 2px #000; white-space: nowrap;
}

#hit-marker {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px;
  opacity: 0; pointer-events: none;
}
#hit-marker::before, #hit-marker::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 3px; margin: -1.5px 0 0 -15px;
  background: #fff; box-shadow: 0 0 4px #000;
}
#hit-marker::before { transform: rotate(45deg); } #hit-marker::after { transform: rotate(-45deg); }
#hit-marker.show { animation: hitPop 0.4s ease; }
#hit-marker.kill::before, #hit-marker.kill::after { background: #ff5b5b; }
@keyframes hitPop { 0% { opacity: 1; transform: scale(1.4);} 100% { opacity: 0; transform: scale(0.9);} }

#hit-result {
  position: absolute; left: 50%; top: calc(50% + 58px); transform: translateX(-50%);
  font-size: 13px; color: #ffe9b0; text-shadow: 0 1px 3px #000; opacity: 0; transition: opacity 0.2s;
}
#hit-result.show { opacity: 1; }

#damage-dir { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.dmg-arc {
  position: absolute; left: -60px; top: -60px; width: 120px; height: 120px; border-radius: 50%;
  border: 4px solid transparent; border-top-color: rgba(255, 60, 60, 0.9);
  animation: dmgFade 1.1s ease forwards;
}
@keyframes dmgFade { from { opacity: 1; } to { opacity: 0; } }

/* 狙击镜 */
#sniper-overlay { position: absolute; inset: 0; }
.scope-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 36%, rgba(0,0,0,0.55) 46%, rgba(0,0,0,0.97) 60%);
}
.scope-marks { position: absolute; inset: 0; width: 100%; height: 100%; }
.scope-marks line { stroke: rgba(20, 24, 20, 0.85); stroke-width: 2.5; }
#mil-marks line { stroke-width: 1.4; }
#zoom-label { position: absolute; right: 24%; top: 24%; color: #cfe3cf; font-size: 15px; text-shadow: 0 1px 2px #000; }

/* HUD 左下 */
#hud-bottom-left { position: absolute; left: 18px; bottom: 16px; }
#vehicle-name { font-size: 13px; color: #cdd5df; text-shadow: 0 1px 2px #000; margin-bottom: 5px; }
#tank-status {
  display: flex; align-items: center; gap: 10px;
  background: rgba(10, 14, 19, 0.55); padding: 8px 12px; border-radius: 5px;
}
#tank-icon { width: 46px; height: 30px; color: #dfe5ec; filter: drop-shadow(0 1px 2px #000); }
#hp-bar { width: 130px; height: 9px; background: #26140f; border-radius: 5px; overflow: hidden; }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #4f9e4f, #8fd18f); transition: width 0.2s; }
#modules { display: flex; gap: 7px; font-size: 17px; }
#modules span { opacity: 0.9; filter: grayscale(1) drop-shadow(0 1px 1px #000); }
#modules span.dmg { color: #ff9a3d; filter: none; animation: blink 1s infinite; }
#modules span.dead { color: #ff4040; filter: none; }
#mod-fire { color: #ff6a00; filter: none !important; animation: blink 0.5s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
#repair-hint { margin-top: 6px; font-size: 12px; color: #ffce6b; text-shadow: 0 1px 2px #000; }
#speed-label { margin-top: 6px; font-size: 13px; color: #9fb2c8; text-shadow: 0 1px 2px #000; }

/* HUD 右下：弹种 */
#hud-bottom-right { position: absolute; right: 250px; bottom: 16px; }
.shell-item {
  display: flex; align-items: center; gap: 9px; margin-top: 6px;
  background: rgba(10, 14, 19, 0.55); padding: 6px 12px; border-radius: 5px;
  border: 1px solid transparent; color: #cdd5df; font-size: 13px;
}
.shell-item.active { border-color: #ffce6b; color: #ffe9b0; }
.shell-item .key { background: #2a3441; border-radius: 3px; padding: 1px 7px; font-size: 12px; }
.shell-item .cnt { margin-left: auto; color: #9fb2c8; }
.shell-item.next { border-color: rgba(255,206,107,0.35); border-style: dashed; }

/* 小地图 */
#minimap-wrap {
  position: absolute; right: 14px; bottom: 14px; width: 220px; height: 220px;
  border: 1px solid rgba(255,255,255,0.18); border-radius: 4px; overflow: hidden;
  background: #10151c;
  transition: width 0.15s, height 0.15s;
}
#minimap-wrap.big {
  width: min(72vh, 560px); height: min(72vh, 560px);
  right: 50%; bottom: 50%; transform: translate(50%, 50%);
  border-color: rgba(255,255,255,0.4);
}
#minimap { width: 100%; height: 100%; image-rendering: auto; }

#score-toast { position: absolute; left: 50%; bottom: 190px; transform: translateX(-50%); text-align: center; }
.toast-item { font-size: 14px; color: #b5d36c; text-shadow: 0 1px 3px #000; animation: toastUp 1.6s ease forwards; }
@keyframes toastUp { 0% { opacity: 0; transform: translateY(10px);} 15% { opacity: 1; transform: none;} 80% { opacity: 1;} 100% { opacity: 0; transform: translateY(-14px);} }

#center-msg {
  position: absolute; left: 50%; top: 34%; transform: translateX(-50%);
  font-size: 26px; font-weight: 800; letter-spacing: 0.2em; color: #ffe9b0; text-shadow: 0 2px 8px #000;
  opacity: 0; transition: opacity 0.3s; text-align: center;
}
#center-msg.show { opacity: 1; }
#center-msg .sub { display: block; font-size: 14px; font-weight: 400; color: #cdd5df; letter-spacing: 0.1em; margin-top: 8px; }

/* 世界标记 */
#marker-layer { position: absolute; inset: 0; overflow: hidden; }
.wmark { position: absolute; transform: translate(-50%, -100%); text-align: center; font-size: 11px; white-space: nowrap; }
.wmark .tri { width: 0; height: 0; border: 6px solid transparent; margin: 0 auto; }
.wmark.enemy { color: #ff8080; } .wmark.enemy .tri { border-top-color: #ff5b5b; }
.wmark.ally { color: #8fd18f; } .wmark.ally .tri { border-top-color: #57c957; }
.wmark.cap { color: #ffe9b0; font-size: 14px; font-weight: 800; }
.wmark .dist { color: #cfd6df; font-size: 10px; }

/* 计分板 */
#scoreboard {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; gap: 20px; background: rgba(8, 11, 16, 0.88); border: 1px solid #3d4a5c;
  border-radius: 8px; padding: 20px 26px; min-width: 620px;
}
.sb-col { flex: 1; }
.sb-col h3 { font-size: 15px; letter-spacing: 0.2em; margin-bottom: 10px; }
#sb-a h3 { color: #8fd18f; } #sb-b h3 { color: #e88f8f; }
.sb-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 6px; border-top: 1px solid #1d2734; color: #cdd5df; }
.sb-row.me { background: rgba(255, 206, 107, 0.12); }
.sb-row.dead { opacity: 0.45; text-decoration: line-through; }

/* 阵亡/重生 */
#respawn-screen {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(8, 11, 16, 0.92); border: 1px solid #5c2020; border-radius: 8px;
  padding: 30px 42px; text-align: center; pointer-events: auto;
}
#respawn-screen h2 { color: #ff8080; letter-spacing: 0.2em; margin-bottom: 12px; }
#respawn-info { color: #aab4c2; font-size: 13px; margin-bottom: 20px; line-height: 1.8; }

/* 结算 */
#result-screen { background: rgba(5, 8, 12, 0.82); display: flex; align-items: center; justify-content: center; }
.result-box {
  text-align: center; background: #12181f; border: 1px solid #3d4a5c; border-radius: 10px;
  padding: 40px 60px; min-width: 460px;
}
#result-title { font-size: 46px; letter-spacing: 0.3em; margin-bottom: 6px; }
#result-title.win { color: #ffd77e; text-shadow: 0 0 30px rgba(255, 215, 126, 0.4); }
#result-title.lose { color: #93a1b1; }
#result-sub { color: #8a94a3; margin-bottom: 24px; }
#result-stats { margin: 0 auto 26px; border-collapse: collapse; min-width: 340px; }
#result-stats td { padding: 7px 14px; border-bottom: 1px solid #222b36; font-size: 14px; text-align: left; }
#result-stats td:last-child { text-align: right; color: #ffe9b0; }

/* HUD 内可点元素 */
#respawn-screen .btn, #hud .btn { pointer-events: auto; }
