@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #080d12;
  --surface: #0d151c;
  --surface-raised: #121e25;
  --line: rgba(177, 204, 207, .15);
  --text: #e5eeec;
  --muted: #87999a;
  --faint: #53666a;
  --lime: #d2f36a;
  --blue: #69d7ee;
  --red: #ff786d;
  --amber: #f2c478;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; background: var(--bg); }
body { min-height: 100svh; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .38; filter: saturate(.45); }
.hidden { display: none !important; }

/* Lobby */
.lobby-screen {
  position: relative; isolation: isolate; display: flex; flex-direction: column;
  min-height: 100svh; overflow: hidden; padding: 32px clamp(22px, 7vw, 112px) 18px;
  background: radial-gradient(ellipse at 76% 47%, rgba(32, 76, 83, .24), transparent 43%),
    linear-gradient(123deg, #090f14 0%, #101b20 58%, #0a1115 100%);
}
.lobby-grid { position: absolute; z-index: -1; inset: 0; opacity: .17; pointer-events: none;
  background-image: linear-gradient(rgba(185, 218, 214, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(185, 218, 214, .08) 1px, transparent 1px); background-size: 48px 48px;
  mask-image: linear-gradient(90deg, transparent, #000 55%, transparent); }
.lobby-orbit { position: absolute; z-index: -1; top: 21%; right: 13%; width: min(34vw, 390px); aspect-ratio: 1; border: 1px solid rgba(105, 215, 238, .1); border-radius: 50%; box-shadow: 0 0 0 36px rgba(105,215,238,.018), 0 0 0 74px rgba(105,215,238,.014); }
.lobby-orbit::before, .lobby-orbit::after { content: ""; position: absolute; background: rgba(105, 215, 238, .13); }
.lobby-orbit::before { width: 1px; height: 118%; left: 50%; top: -9%; }
.lobby-orbit::after { width: 118%; height: 1px; top: 50%; left: -9%; }
.lobby-orbit span { position: absolute; width: 9px; height: 9px; top: 24%; right: 18%; border-radius: 50%; background: var(--blue); box-shadow: 0 0 18px var(--blue); }
.lobby-orbit i { position: absolute; top: 50%; left: 50%; width: 27%; height: 27%; border: 1px solid rgba(105,215,238,.2); border-radius: 50%; transform: translate(-50%,-50%); }
.lobby-brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { color: var(--lime); font: 800 34px/1 "Barlow Condensed", Impact, sans-serif; letter-spacing: -5px; }
.brand-mark span { color: #597076; }
.brand-name { font: 700 18px/1 "Barlow Condensed", sans-serif; letter-spacing: .18em; }
.brand-subtitle { margin-top: 5px; color: var(--muted); font: 700 8px ui-monospace, monospace; letter-spacing: .2em; }
.build-tag { margin-left: 18px; padding-left: 16px; border-left: 1px solid var(--line); color: var(--muted); font: 700 9px ui-monospace, monospace; letter-spacing: .12em; }
.build-tag i, .connection-stamp i { display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(210,243,106,.08); }
.lobby-content { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(350px, 430px); gap: clamp(45px, 11vw, 155px); align-items: center; width: min(1120px, 100%); flex: 1; margin: 0 auto; }
.eyebrow, .panel-kicker { color: #94a8a5; font: 700 9px ui-monospace, monospace; letter-spacing: .15em; }
.eyebrow { display: flex; align-items: center; gap: 9px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(210,243,106,.09); }
.lobby-copy h1 { margin: 25px 0 18px; font: 700 clamp(66px, 8vw, 100px)/.85 "Barlow Condensed", Impact, sans-serif; letter-spacing: -.045em; }
.lobby-copy h1 em { color: var(--lime); font-style: normal; }
.lobby-copy > p { max-width: 390px; margin: 0; color: #a7b5b4; font-size: 13px; line-height: 1.8; }
.lobby-briefing { max-width: 465px; margin-top: 39px; border-top: 1px solid var(--line); }
.lobby-briefing > div { display: flex; gap: 16px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.lobby-briefing span { flex: 0 0 114px; color: var(--blue); font: 700 8px ui-monospace, monospace; letter-spacing: .09em; }
.lobby-briefing b { color: #b2c0bd; font-size: 10px; font-weight: 500; }
.connect-panel { position: relative; padding: 29px 29px 22px; border: 1px solid rgba(153,190,190,.23); background: linear-gradient(145deg, rgba(19,31,36,.96), rgba(12,21,26,.96)); box-shadow: 0 26px 70px rgba(0,0,0,.35); }
.connect-panel::before { position: absolute; top: -1px; left: -1px; width: 47px; height: 47px; border-top: 2px solid var(--lime); border-left: 2px solid var(--lime); content: ""; }
.connect-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.connect-panel h2 { margin: 10px 0 24px; font: 600 26px "Barlow Condensed", sans-serif; }
.connection-stamp { color: var(--lime); font: 700 8px ui-monospace, monospace; letter-spacing: .1em; }
.connection-stamp i { width: 5px; height: 5px; }
.field-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.text-field, .code-field { width: 100%; padding: 11px 0; border: 0; border-bottom: 1px solid #43575a; outline: 0; color: var(--text); background: transparent; }
.text-field:focus, .code-field:focus { border-color: var(--lime); }
.create-actions { display: grid; gap: 9px; margin-top: 19px; }
.primary-button { display: flex; min-height: 49px; width: 100%; align-items: center; gap: 12px; margin-top: 0; padding: 13px 14px; border: 0; background: var(--lime); color: #111a14; font-weight: 800; text-align: left; transition: transform .18s, box-shadow .18s, background .18s; }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(210,243,106,.17); }
.button-index { color: #667a35; font: 700 9px ui-monospace, monospace; }
.button-arrow { margin-left: auto; font-size: 18px; }
.ai-button { display: flex; min-height: 46px; align-items: center; gap: 11px; padding: 9px 14px; border: 1px solid rgba(210,243,106,.25); background: rgba(6,13,16,.55); text-align: left; transition: border-color .18s, background .18s; }
.ai-button:hover:not(:disabled) { border-color: rgba(210,243,106,.72); background: rgba(32,46,37,.75); }
.ai-spark { color: var(--lime); font-size: 18px; }
.ai-button b, .ai-button small { display: block; }
.ai-button b { font-size: 11px; }
.ai-button small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.ai-button .button-arrow { margin-left: auto; color: var(--lime); }
.join-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; color: var(--muted); font-size: 9px; }
.join-divider span { height: 1px; flex: 1; background: var(--line); }
.join-divider b { font-weight: 500; }
.join-control { display: flex; align-items: stretch; gap: 10px; }
.code-field { min-width: 0; font: 700 14px ui-monospace, monospace; letter-spacing: .25em; text-transform: uppercase; }
.join-button { flex: 0 0 91px; border: 1px solid rgba(105,215,238,.45); background: rgba(105,215,238,.08); color: var(--blue); font-size: 11px; font-weight: 700; transition: background .16s; }
.join-button:hover:not(:disabled) { background: rgba(105,215,238,.16); }
.join-button span { margin-left: 8px; }
.lan-note { margin: 14px 0 0; color: #829391; font-size: 9px; line-height: 1.6; }
.lan-note span { color: var(--blue); }

/* War Room Monitor */
.lobby-room-monitor { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.monitor-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: #8fa5a7; font: 700 9px ui-monospace, monospace; letter-spacing: .1em; }
.refresh-rooms-btn { padding: 3px 8px; border: 1px solid var(--line); background: transparent; color: var(--blue); font: 700 8.5px ui-monospace, monospace; cursor: pointer; }
.refresh-rooms-btn:hover { border-color: var(--blue); }
.room-list { display: flex; flex-direction: column; gap: 5px; max-height: 130px; overflow-y: auto; }
.room-card { display: flex; align-items: center; justify-content: space-between; padding: 6px 9px; border: 1px solid rgba(133,164,156,.18); background: rgba(6,14,18,.55); }
.room-card-info { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.room-card-code { color: var(--lime); font: 700 12px ui-monospace, monospace; letter-spacing: .12em; }
.room-card-status { color: #95a7a9; font-size: 8.5px; }
.room-card-status.playing { color: var(--amber); }
.room-card-players { overflow: hidden; color: #b1c4c1; font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.room-card-actions { display: flex; gap: 5px; flex-shrink: 0; }
.room-card-btn { padding: 3px 9px; border: 1px solid rgba(105,215,238,.3); background: rgba(105,215,238,.08); color: var(--blue); font: 700 9px ui-monospace, monospace; cursor: pointer; }
.room-card-btn:hover { background: rgba(105,215,238,.2); }
.room-empty { color: #72888b; font-size: 9.5px; text-align: center; padding: 10px 0; }

.connection-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); color: #7b9090; font: 700 8.5px ui-monospace, monospace; letter-spacing: .06em; }
.lobby-footer { display: flex; justify-content: space-between; gap: 12px; color: #718689; font: 700 8.5px ui-monospace, monospace; letter-spacing: .08em; }
#careerRecord { color: #c5f96b; }

/* 开局倒计时遮罩 */
.countdown-overlay h2 { font: 900 clamp(64px, 14vw, 110px)/1 ui-monospace, monospace; color: var(--lime); text-shadow: 0 0 36px rgba(210,243,106,.5); margin: 8px 0 4px; animation: countdownPop .95s ease-out infinite; }
.countdown-overlay p { color: #9fb4af; font: 700 12px ui-monospace, monospace; letter-spacing: .18em; }
@keyframes countdownPop { 0% { transform: scale(1.35); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.96); opacity: .85; } }

/* 战况统计面板 */
.stats-panel { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 80; width: min(560px, calc(100vw - 24px)); background: rgba(7,14,12,.97); border: 1px solid var(--line); padding: 14px 16px 10px; box-shadow: 0 18px 48px rgba(0,0,0,.55); }
.stats-head { display: flex; align-items: center; justify-content: space-between; font: 800 12px ui-monospace, monospace; letter-spacing: .1em; color: var(--lime); margin-bottom: 10px; }
.stats-head small { color: #5c6f6b; margin-left: 6px; font-weight: 700; }
.stats-table { display: grid; grid-template-columns: 1.5fr 1fr 1fr; font: 700 11px ui-monospace, monospace; }
.stats-table > span { padding: 6px 8px; border-bottom: 1px solid rgba(160,190,180,.08); text-align: right; color: #d7e4df; }
.stats-table > span.stat-label { text-align: left; color: #8fa3a0; }
.stats-table > span.stat-blue { color: var(--blue); }
.stats-table > span.stat-red { color: var(--red); }
.stats-table > span.stat-head { font-weight: 800; color: #eaf3ef; border-bottom-color: rgba(160,190,180,.22); }
.stats-note { margin-top: 8px; font: 600 9px ui-monospace, monospace; color: #4e615d; text-align: center; }
/* Stats Win Rate Box (战况面板实时胜率推演) */
.stats-win-rate-box {
  margin: 10px 0 12px;
  padding: 8px 10px;
  background: rgba(14, 25, 30, 0.85);
  border: 1px solid rgba(126, 174, 177, 0.25);
  border-radius: 2px;
}
.stats-win-rate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 700 10.5px ui-monospace, monospace;
  color: #a4bebc;
  margin-bottom: 6px;
}
.stats-win-rate-header b {
  color: var(--lime);
}
.stats-win-rate-bar {
  display: flex;
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.stats-win-rate-fill {
  height: 100%;
  transition: width 0.35s ease;
}
.stats-win-rate-fill-blue {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}
.stats-win-rate-fill-red {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}
.stats-win-rate-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font: 600 9px ui-monospace, monospace;
  color: #7b9494;
}
.stats-win-rate-factors span i {
  font-style: normal;
  color: #d1deda;
  font-weight: 700;
  margin-left: 2px;
}
@media (max-width: 960px) { .stats-panel { top: 44px; padding: 10px 12px 8px; } }

/* Match shell and score rail */
.game-screen {
  position: relative;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px clamp(12px, 1.8vw, 28px) 5px;
  background: radial-gradient(ellipse at 50% 22%, #14282c 0%, #0b1419 48%, #080d12 100%);
  box-sizing: border-box;
}
@media (max-height: 680px) and (min-width: 961px) {
  .game-screen {
    height: auto;
    min-height: 100vh;
    max-height: none;
    overflow-y: auto;
  }
}
.match-header {
  width: min(1400px, 100%);
  margin: 0 auto;
  display: flex;
  height: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 700 11px ui-monospace, monospace;
  letter-spacing: .1em;
  flex-shrink: 0;
}
.match-brand { display: flex; align-items: center; gap: 8px; color: var(--text); font: 700 16px "Barlow Condensed", sans-serif; letter-spacing: .12em; }
.match-brand .brand-mark { font-size: 26px; }
.match-brand small { display: block; margin-top: 1px; color: var(--faint); font: 700 8px ui-monospace, monospace; letter-spacing: .14em; }
.match-signal { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.match-signal i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px currentColor; }
.match-signal[data-mode="online"] i { background: var(--lime); }
.match-signal[data-mode="offline"] i { background: var(--red); }
.match-signal[data-mode="ended"] i { background: var(--faint); }
.match-signal span { color: #64787b; font-size: 10px; }
.match-signal b { color: #c0d0cb; font-weight: 600; font-size: 11.5px; }
.match-signal .net-ping { color: #64787b; font-weight: 500; font-size: 10px; font-variant-numeric: tabular-nums; transition: color .2s ease; }
.match-signal .net-ping[data-level="ok"] { color: var(--lime); }
.match-signal .net-ping[data-level="warn"] { color: var(--amber); }
.match-signal .net-ping[data-level="bad"] { color: var(--red); }
.room-control { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.room-control > span { color: var(--faint); font-size: 10px; }
.room-control > b { color: var(--lime); letter-spacing: .18em; font-size: 13px; }
.icon-button { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); background: rgba(255,255,255,.025); color: #a6b7b4; font-size: 13.5px; transition: border-color .16s, color .16s, background .16s; border-radius: 2px; }
.icon-button:hover { border-color: var(--blue); color: var(--blue); }
.icon-button.active { border-color: var(--lime); color: var(--lime); background: rgba(210,243,106,.12); }
.icon-button.muted { color: #586a6d; border-color: #38494b; }
.leave-button:hover { border-color: var(--red); color: var(--red); }
.surrender-button:hover { border-color: #ffd17e; color: #ffd17e; }
.surrender-button.confirm { border-color: #ff4d4d; color: #ff4d4d; animation: emergencyBlink .8s ease-in-out infinite; }

/* 局内手动全屏悬浮按钮 */
.fullscreen-fab { position: absolute; right: 10px; bottom: 10px; z-index: 7; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(210,243,106,.4); background: rgba(8,16,14,.7); color: var(--lime); font-size: 15px; cursor: pointer; backdrop-filter: blur(6px); transition: border-color .16s, transform .16s, background .16s; }
.fullscreen-fab:hover { border-color: var(--lime); background: rgba(210,243,106,.12); transform: translateY(-1px); }
.fullscreen-fab.is-fullscreen { border-color: rgba(255,120,108,.5); color: #ff9589; }
@media (max-width: 960px) { .fullscreen-fab { width: 30px; height: 30px; font-size: 13px; right: 8px; bottom: 8px; } }

/* Spectator Bar */
.spectator-bar { display: flex; align-items: center; justify-content: space-between; width: min(1400px, 100%); margin: 0 auto 3px; padding: 4px 10px; border: 1px solid rgba(105,215,238,.3); background: rgba(14,35,44,.88); backdrop-filter: blur(8px); flex-shrink: 0; }
.spectator-badge { color: var(--blue); font: 700 9px ui-monospace, monospace; letter-spacing: .12em; }
.perspective-toggle { display: flex; align-items: center; gap: 6px; font-size: 9px; color: #829597; }
.spec-btn { padding: 3px 8px; border: 1px solid var(--line); background: transparent; color: #91a5a1; font: 700 8.5px ui-monospace, monospace; }
.spec-btn.active { border-color: var(--blue); background: rgba(105,215,238,.12); color: var(--blue); }
.spec-leave-btn { padding: 3px 9px; border: 1px solid rgba(255,120,109,.3); background: rgba(255,120,109,.08); color: var(--red); font: 700 8.5px ui-monospace, monospace; }
.spec-leave-btn:hover { background: rgba(255,120,109,.2); }

.scoreboard { display: grid; grid-template-columns: minmax(0,1fr) 124px minmax(0,1fr); align-items: center; gap: clamp(12px, 3vw, 40px); width: min(1400px, 100%); margin: 2px auto 3px; height: 38px; min-height: 38px; flex-shrink: 0; }
.team-score { display: flex; min-width: 0; align-items: center; gap: 10px; }
.team-score.team-red { text-align: right; }
.team-emblem { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid var(--blue); color: var(--blue); background: rgba(105,215,238,.08); font: 800 16px "Barlow Condensed", sans-serif; transform: skew(-6deg); }
.team-red .team-emblem { border-color: var(--red); color: var(--red); background: rgba(255,120,109,.08); }
.score-details { min-width: 0; flex: 1; }
.score-name { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #769093; font: 700 9px ui-monospace, monospace; letter-spacing: .08em; }
.score-name b { overflow: hidden; color: var(--text); font: 600 13px Inter, sans-serif; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
.base-health { height: 5px; margin-top: 3px; overflow: hidden; background: rgba(255,255,255,.08); border-radius: 1px; }
.base-health i { display: block; width: 100%; height: 100%; background: var(--blue); transition: width .25s; }
.team-red .base-health i { margin-left: auto; background: var(--red); }
.score-meta { display: flex; align-items: baseline; justify-content: space-between; margin-top: 2px; color: #839496; font-size: 10.5px; }
.score-meta > b { color: var(--blue); font: 700 12px ui-monospace, monospace; }
.team-red .score-meta > b { color: var(--red); }
.score-meta small { color: #6b8285; font-size: 8.5px; }
.score-meta strong { color: var(--text); }
.match-clock { display: flex; flex-direction: column; align-items: center; padding: 0 6px; text-align: center; }
.clock-label { color: #61777b; font: 700 7px ui-monospace, monospace; letter-spacing: .1em; }
.match-clock > strong { margin: 0; color: #f0f5e9; font: 700 24px/.95 "Barlow Condensed", sans-serif; font-variant-numeric: tabular-nums; }
.match-clock > div { color: #809294; font-size: 9.5px; }
.match-clock > div b { color: var(--lime); font-family: ui-monospace, monospace; }
.supply-dot { display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%; background: var(--lime); }
.scoreboard.local-red .team-blue { grid-column: 3; grid-row: 1; flex-direction: row-reverse; text-align: right; }
.scoreboard.local-red .match-clock { grid-column: 2; grid-row: 1; }
.scoreboard.local-red .team-red { grid-column: 1; grid-row: 1; flex-direction: row-reverse; text-align: left; }
.scoreboard.local-red .team-blue .score-name,
.scoreboard.local-red .team-red .score-name,
.scoreboard.local-red .team-blue .score-meta,
.scoreboard.local-red .team-red .score-meta { flex-direction: row-reverse; }
.team-score.is-local .score-name > span { color: var(--lime); }
.team-score:not(.is-local) .score-name > span { color: #607678; }
.scoreboard.local-red .team-red .base-health i { margin-left: 0; }
.scoreboard.local-red .team-blue .base-health i { margin-left: auto; }

/* Real-Time Battlefield Win Rate Bar (实时推演胜率栏) */
.win-rate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1400px, 100%);
  height: 22px;
  min-height: 22px;
  margin: 0 auto 3px;
  padding: 2px 10px;
  border: 1px solid rgba(126, 174, 177, 0.22);
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(8, 20, 28, 0.85) 0%, rgba(14, 28, 36, 0.92) 50%, rgba(28, 12, 16, 0.85) 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  flex-shrink: 0;
  transition: all 0.3s ease;
}
.win-rate-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
  font-family: ui-monospace, monospace;
}
.win-rate-left {
  justify-content: flex-start;
}
.win-rate-right {
  justify-content: flex-end;
  text-align: right;
}
.win-rate-team {
  font-size: 8.5px;
  font-weight: 700;
  color: #7b9496;
  letter-spacing: .06em;
}
.win-rate-val {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: #e2ede8;
}
.win-rate-val.win-val-blue { color: var(--blue); }
.win-rate-val.win-val-red { color: var(--red); }
.win-rate-val.win-val-lime { color: var(--lime); }
.win-rate-meter {
  flex: 1;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5px;
}
.win-rate-track {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}
.win-rate-fill {
  height: 100%;
  transition: width 0.35s cubic-bezier(0.2, 0, 0.2, 1);
}
.win-rate-fill-blue {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}
.win-rate-fill-red {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
  box-shadow: 0 0 6px rgba(251, 113, 133, 0.4);
}
.win-rate-center-mark {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}
.win-rate-title {
  font: 700 7.5px ui-monospace, monospace;
  color: #8da4a6;
  letter-spacing: .08em;
  white-space: nowrap;
}
.win-rate-title b {
  color: var(--lime);
  margin-left: 3px;
}

/* Main battlefield */
.battlefield-wrap {
  position: relative;
  width: min(1400px, 100%);
  flex: 1 1 auto;
  min-height: 200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  --canvas-top: 50px;
  --hit-freq: 0;
}
.battlefield-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 16px;
  min-height: 16px;
  padding: 0 4px 2px;
  color: #81989a;
  font: 700 9.5px ui-monospace, monospace;
  letter-spacing: .12em;
  flex-shrink: 0;
}
.battlefield-heading i { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.battlefield-heading b { margin: 0 5px; color: #50686b; }

/* Real-time Tactical Status Bar (实时战术状态栏) */
.tactical-advisor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 32px;
  min-height: 32px;
  margin: 0 0 2px 0;
  padding: 2px 12px;
  border: 1px solid rgba(105, 215, 238, 0.28);
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(8, 18, 24, 0.95) 0%, rgba(13, 27, 36, 0.98) 50%, rgba(8, 18, 24, 0.95) 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}
.tactical-advisor-bar.priority-critical {
  border-color: rgba(255, 71, 87, 0.75);
  background: linear-gradient(90deg, rgba(38, 10, 16, 0.96) 0%, rgba(28, 8, 12, 0.98) 50%, rgba(38, 10, 16, 0.96) 100%);
  box-shadow: 0 0 16px rgba(255, 30, 42, 0.4), inset 0 1px 0 rgba(255, 120, 120, 0.15);
}
.tactical-advisor-bar.priority-high {
  border-color: rgba(255, 177, 66, 0.65);
  background: linear-gradient(90deg, rgba(32, 22, 10, 0.95) 0%, rgba(22, 17, 10, 0.98) 50%, rgba(32, 22, 10, 0.95) 100%);
  box-shadow: 0 0 14px rgba(255, 177, 66, 0.25), inset 0 1px 0 rgba(255, 200, 100, 0.12);
}
.tactical-advisor-bar.priority-normal {
  border-color: rgba(105, 215, 238, 0.28);
}

.advisor-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.advisor-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 7px var(--lime);
  animation: advisorRadarPulse 1.8s ease-in-out infinite;
}
.priority-critical .advisor-pulse {
  background: #ff4757;
  box-shadow: 0 0 10px #ff4757;
  animation: advisorCriticalPulse 0.8s ease-in-out infinite;
}
.priority-high .advisor-pulse {
  background: #ffb142;
  box-shadow: 0 0 8px #ffb142;
}

@keyframes advisorRadarPulse {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.25); }
}
@keyframes advisorCriticalPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.85); box-shadow: 0 0 5px #ff4757; }
  50% { opacity: 1; transform: scale(1.35); box-shadow: 0 0 14px #ff3838; }
}

.advisor-badge {
  color: #81989a;
  font: 700 9px ui-monospace, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.priority-critical .advisor-badge { color: #ff8585; }
.priority-high .advisor-badge { color: #fed330; }

.advisor-content {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.advisor-text {
  color: #eaf1e9;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}
.priority-critical .advisor-text { color: #ff6b81; }
.priority-high .advisor-text { color: #ffeaa7; }

.advisor-reason {
  color: #8ea5a5;
  font: 500 11px ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.95;
}
.priority-critical .advisor-reason { color: #f5b5aa; }
.priority-high .advisor-reason { color: #e5cb9e; }

.advisor-action {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 3px 10px;
  border: 1px solid rgba(210, 243, 106, 0.35);
  border-radius: 2px;
  background: rgba(210, 243, 106, 0.08);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.advisor-action:hover {
  background: rgba(210, 243, 106, 0.2);
  border-color: rgba(210, 243, 106, 0.75);
  box-shadow: 0 0 8px rgba(210, 243, 106, 0.3);
  transform: translateY(-1px);
}
.advisor-action:active {
  transform: translateY(1px);
}
.priority-critical .advisor-action {
  border-color: rgba(255, 71, 87, 0.6);
  background: rgba(255, 71, 87, 0.15);
}
.priority-critical .advisor-action:hover {
  border-color: rgba(255, 71, 87, 0.9);
  background: rgba(255, 71, 87, 0.28);
  box-shadow: 0 0 10px rgba(255, 71, 87, 0.45);
}
.priority-high .advisor-action {
  border-color: rgba(255, 177, 66, 0.6);
  background: rgba(255, 177, 66, 0.15);
}
.priority-high .advisor-action:hover {
  border-color: rgba(255, 177, 66, 0.9);
  background: rgba(255, 177, 66, 0.28);
  box-shadow: 0 0 10px rgba(255, 177, 66, 0.4);
}

.advisor-action-label {
  color: #9cb5ab;
  font: 700 8px ui-monospace, monospace;
  letter-spacing: 0.08em;
}
.advisor-action b {
  color: var(--lime);
  font: 700 11.5px ui-monospace, monospace;
  letter-spacing: 0.04em;
}
.priority-critical .advisor-action b { color: #ff7675; }
.priority-high .advisor-action b { color: #fdcb6e; }

.battlefield-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 180px;
  flex: 1 1 auto;
  border: 1px solid rgba(126,174,177,.2);
  border-color: rgba(calc(126 + 129 * var(--danger-ratio, 0)), calc(174 - 120 * var(--danger-ratio, 0)), calc(177 - 125 * var(--danger-ratio, 0)), calc(0.2 + 0.65 * var(--danger-ratio, 0)));
  background: #0b1419;
  touch-action: none;
  transition: border-color .2s ease-out;
  filter: saturate(calc(1 - var(--danger-ratio, 0) * 0.45 + var(--danger-flash, 0) * 0.2))
          contrast(calc(1 + var(--danger-ratio, 0) * 0.42 + var(--danger-flash, 0) * 0.3))
          brightness(calc(1 - var(--danger-ratio, 0) * 0.18 + var(--danger-flash, 0) * 0.12))
          sepia(calc(var(--danger-ratio, 0) * 0.35 + var(--danger-flash, 0) * 0.25))
          hue-rotate(calc(var(--danger-ratio, 0) * -26deg - var(--danger-flash, 0) * 18deg));
}

.damage-vignette {
  position: absolute;
  top: var(--canvas-top, 45px);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  pointer-events: none;
  opacity: calc(var(--danger-ratio, 0) * 0.96 + var(--danger-flash, 0) * 0.85);
  background:
    radial-gradient(ellipse at 50% 50%, transparent calc(76% - 44% * var(--danger-ratio, 0)), rgba(255, 30, 42, calc(0.38 * var(--danger-ratio, 0) + var(--danger-flash, 0) * 0.35)) calc(88% - 22% * var(--danger-ratio, 0)), rgba(185, 0, 15, calc(0.92 * var(--danger-ratio, 0) + var(--danger-flash, 0) * 0.5)) 100%),
    linear-gradient(to right, rgba(220, 10, 25, calc(0.65 * var(--danger-ratio, 0) + var(--danger-flash, 0) * 0.4)) 0%, transparent calc(4% + 18% * var(--danger-ratio, 0)), transparent calc(96% - 18% * var(--danger-ratio, 0)), rgba(220, 10, 25, calc(0.65 * var(--danger-ratio, 0) + var(--danger-flash, 0) * 0.4)) 100%),
    linear-gradient(to bottom, rgba(220, 10, 25, calc(0.55 * var(--danger-ratio, 0) + var(--danger-flash, 0) * 0.35)) 0%, transparent calc(4% + 16% * var(--danger-ratio, 0)), transparent calc(96% - 16% * var(--danger-ratio, 0)), rgba(220, 10, 25, calc(0.55 * var(--danger-ratio, 0) + var(--danger-flash, 0) * 0.35)) 100%);
  box-shadow: inset 0 0 calc(20px + 65px * var(--danger-ratio, 0)) rgba(255, 15, 30, calc(0.85 * var(--danger-ratio, 0) + var(--danger-flash, 0) * 0.6)),
              inset 0 0 calc(6px + 22px * var(--danger-ratio, 0)) rgba(255, 200, 200, calc(0.25 * var(--danger-ratio, 0)));
  transition: opacity .15s ease-out;
}
.damage-erosion-overlay {
  position: absolute;
  top: var(--canvas-top, 45px);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
  opacity: calc(var(--danger-ratio, 0) * 0.95 + var(--danger-flash, 0) * 0.85);
  transition: opacity .15s ease-out;
}
.erosion-bracket {
  position: absolute;
  width: calc(18px + 24px * var(--danger-ratio, 0));
  height: calc(18px + 24px * var(--danger-ratio, 0));
  border: calc(1.5px + 1.5px * var(--danger-ratio, 0)) solid rgba(255, 60, 70, calc(0.5 + 0.5 * var(--danger-ratio, 0)));
  filter: drop-shadow(0 0 6px rgba(255, 20, 30, 0.8));
}
.bracket-tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.bracket-tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.bracket-bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.bracket-br { bottom: 8px; right: 8px; border-left: none; border-top: none; }
.erosion-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(255, 10, 20, calc(0.12 * var(--danger-ratio, 0))) 3px 4px);
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* Base Health < 30% Critical Erosion & Vignette Flickering + Jitter Keyframes */
@keyframes criticalVignetteFlicker {
  0% {
    opacity: calc(var(--danger-ratio, 0.7) * 0.92 + var(--danger-flash, 0) * 0.85);
    transform: translate(0, 0) scale(1);
    filter: brightness(1) contrast(1.1);
  }
  12% {
    opacity: calc(var(--danger-ratio, 0.7) * 0.70 + var(--hit-freq, 0) * 0.25);
    transform: translate(calc(-2px - var(--hit-freq, 0) * 3.5px), calc(1.5px + var(--hit-freq, 0) * 2px)) scale(1.006);
    filter: brightness(1.3) contrast(1.4);
  }
  25% {
    opacity: calc(var(--danger-ratio, 0.7) * 1.08 + var(--danger-flash, 0) * 0.85);
    transform: translate(calc(2.5px + var(--hit-freq, 0) * 4px), calc(-2px - var(--hit-freq, 0) * 2.5px)) scale(0.996);
    filter: brightness(1.5) contrast(1.6);
  }
  38% {
    opacity: calc(var(--danger-ratio, 0.7) * 0.62);
    transform: translate(calc(-1.5px - var(--hit-freq, 0) * 2.5px), calc(-1.8px - var(--hit-freq, 0) * 2.5px)) scale(1.004);
    filter: brightness(1.1) contrast(1.2);
  }
  50% {
    opacity: calc(var(--danger-ratio, 0.7) * 1.15 + var(--hit-freq, 0) * 0.3);
    transform: translate(calc(3px + var(--hit-freq, 0) * 4.5px), calc(2px + var(--hit-freq, 0) * 3px)) scale(1.01);
    filter: brightness(1.65) contrast(1.7);
  }
  65% {
    opacity: calc(var(--danger-ratio, 0.7) * 0.75);
    transform: translate(calc(-2.5px - var(--hit-freq, 0) * 4px), calc(0.8px + var(--hit-freq, 0) * 1.5px)) scale(0.998);
    filter: brightness(1.2) contrast(1.3);
  }
  78% {
    opacity: calc(var(--danger-ratio, 0.7) * 1.08 + var(--danger-flash, 0) * 0.85);
    transform: translate(calc(2px + var(--hit-freq, 0) * 3px), calc(-1.8px - var(--hit-freq, 0) * 2px)) scale(1.005);
    filter: brightness(1.45) contrast(1.55);
  }
  90% {
    opacity: calc(var(--danger-ratio, 0.7) * 0.85);
    transform: translate(calc(-1px - var(--hit-freq, 0) * 2px), calc(1.2px + var(--hit-freq, 0) * 2px)) scale(1.002);
    filter: brightness(1.25) contrast(1.35);
  }
  100% {
    opacity: calc(var(--danger-ratio, 0.7) * 0.92 + var(--danger-flash, 0) * 0.85);
    transform: translate(0, 0) scale(1);
    filter: brightness(1) contrast(1.1);
  }
}

@keyframes criticalErosionJitter {
  0% {
    opacity: calc(var(--danger-ratio, 0.7) * 0.9 + var(--danger-flash, 0) * 0.8);
    transform: translate(0, 0) skewX(0deg);
  }
  14% {
    opacity: 1;
    transform: translate(calc(-3px - var(--hit-freq, 0) * 4px), calc(2px + var(--hit-freq, 0) * 3px)) skewX(-0.6deg);
  }
  28% {
    opacity: 0.55;
    transform: translate(calc(3.5px + var(--hit-freq, 0) * 4.5px), calc(-2.5px - var(--hit-freq, 0) * 3px)) skewX(0.8deg);
  }
  42% {
    opacity: 1;
    transform: translate(calc(-2px - var(--hit-freq, 0) * 3px), calc(-2px - var(--hit-freq, 0) * 2.5px)) skewX(-0.5deg);
  }
  57% {
    opacity: 0.50;
    transform: translate(calc(3px + var(--hit-freq, 0) * 4px), calc(2.2px + var(--hit-freq, 0) * 3px)) skewX(0.7deg);
  }
  72% {
    opacity: 1;
    transform: translate(calc(-3.5px - var(--hit-freq, 0) * 4.5px), calc(1.8px + var(--hit-freq, 0) * 2px)) skewX(-0.7deg);
  }
  86% {
    opacity: 0.62;
    transform: translate(calc(2px + var(--hit-freq, 0) * 2.5px), calc(-2px - var(--hit-freq, 0) * 2.5px)) skewX(0.4deg);
  }
  100% {
    opacity: calc(var(--danger-ratio, 0.7) * 0.9 + var(--danger-flash, 0) * 0.8);
    transform: translate(0, 0) skewX(0deg);
  }
}

@keyframes criticalBracketPulse {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(255, 20, 30, 0.8));
    border-color: rgba(255, 60, 70, 0.85);
  }
  50% {
    filter: drop-shadow(0 0 calc(14px + var(--hit-freq, 0) * 16px) rgba(255, 0, 10, 1)) drop-shadow(0 0 5px #fff);
    border-color: rgba(255, 230, 230, 0.98);
  }
}

.battlefield-wrap.is-critical canvas {
  border-color: rgba(255, 80, 80, 0.85);
}
.battlefield-wrap.is-critical .damage-vignette {
  animation: dangerHeartbeat 1.05s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* When Base Health is below 30% (<30%), apply rapid flicker and jitter scaled to hit frequency */
.battlefield-wrap.is-critical-30 .damage-vignette {
  animation: criticalVignetteFlicker calc(0.9s - var(--hit-freq, 0) * 0.68s) cubic-bezier(0.25, 1, 0.5, 1) infinite !important;
  box-shadow: inset 0 0 calc(40px + 80px * var(--danger-ratio, 0.7)) rgba(255, 10, 20, calc(0.92 + var(--hit-freq, 0) * 0.08)),
              inset 0 0 calc(12px + var(--hit-freq, 0) * 24px) rgba(255, 240, 240, calc(0.3 + var(--hit-freq, 0) * 0.45));
}
.battlefield-wrap.is-critical-30 .damage-erosion-overlay {
  animation: criticalErosionJitter calc(0.68s - var(--hit-freq, 0) * 0.52s) steps(2, start) infinite !important;
}
.battlefield-wrap.is-critical-30 .erosion-bracket {
  animation: criticalBracketPulse calc(0.8s - var(--hit-freq, 0) * 0.6s) ease-in-out infinite !important;
}

/* Hyper-speed flicker and jitter when actively under fire while below 30% */
.battlefield-wrap.is-critical-30.is-under-fire .damage-vignette {
  animation-duration: 0.18s !important;
}
.battlefield-wrap.is-critical-30.is-under-fire .damage-erosion-overlay {
  animation-duration: 0.12s !important;
}

.base-health-alert {
  position: absolute;
  top: calc(var(--canvas-top, 59px) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border: 1px solid rgba(255, 60, 70, 0.85);
  border-radius: 3px;
  background: rgba(28, 4, 8, 0.92);
  box-shadow: 0 0 20px rgba(255, 20, 30, 0.65), inset 0 0 10px rgba(255, 20, 30, 0.3);
  color: #fff;
  font: 700 9px ui-monospace, monospace;
  letter-spacing: 0.08em;
  pointer-events: none;
  animation: alertPulse 1.05s ease-in-out infinite;
}
.alert-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 8px #ff3b30;
  animation: pulseDot 0.6s infinite alternate;
}
.alert-tag {
  color: #ff5252;
  font-weight: 900;
  border-right: 1px solid rgba(255, 82, 82, 0.4);
  padding-right: 8px;
}
.alert-message {
  color: #ffd2d2;
}
.base-health-alert b {
  color: #ff4757;
  font-size: 11px;
}
@keyframes alertPulse {
  0%, 100% { transform: translateX(-50%) scale(1); box-shadow: 0 0 15px rgba(255, 20, 30, 0.5); }
  50% { transform: translateX(-50%) scale(1.03); box-shadow: 0 0 26px rgba(255, 0, 20, 0.85); }
}
@keyframes pulseDot {
  from { opacity: 0.4; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.3); }
}
@keyframes dangerHeartbeat {
  0%, 100% {
    filter: brightness(1);
    box-shadow: inset 0 0 calc(25px + 45px * var(--danger-ratio, 0)) rgba(255, 10, 20, 0.7);
  }
  50% {
    filter: brightness(1.4);
    box-shadow: inset 0 0 calc(40px + 75px * var(--danger-ratio, 0)) rgba(255, 0, 0, 0.98);
  }
}
.battlefield-hud { position: absolute; z-index: 3; top: calc(var(--canvas-top, 50px) + 6px); display: flex; flex-direction: column; gap: 4px; max-width: 32%; pointer-events: none; }
.hud-left { left: 14px; align-items: flex-start; }
.hud-right { right: 14px; align-items: flex-end; text-align: right; }
.hud-label { color: #8ea5a7; font: 700 8.5px ui-monospace, monospace; letter-spacing: .1em; }
.battlefield-hud strong { color: #d6e5df; font-size: 11px; font-weight: 700; }
.battlefield-hud small { color: #9bb0af; font-size: 9px; }
.battlefield-hud small b { color: var(--lime); font-family: ui-monospace, monospace; }

/* Weather Banner */
.weather-banner {
  position: absolute;
  top: calc(var(--canvas-top, 50px) + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid rgba(105, 215, 238, 0.45);
  border-radius: 3px;
  background: rgba(8, 20, 28, 0.94);
  box-shadow: 0 0 14px rgba(105, 215, 238, 0.25);
  pointer-events: none;
}
.weather-icon { font-size: 13px; }
.weather-text { display: flex; align-items: baseline; gap: 6px; }
.weather-text b { color: #edf4e9; font: 700 10.5px ui-monospace, monospace; }
.weather-text span { color: #92c5c7; font-size: 9px; }
.weather-banner small { color: #38bdf8; font: 700 8.5px ui-monospace, monospace; }

.battle-overlay { position: absolute; inset: var(--canvas-top, 45px) 1px 1px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(5,11,15,.76); text-align: center; backdrop-filter: blur(6px); }
.waiting-overlay h2 { margin: 10px 0 4px; color: #edf4e9; font: 600 29px "Barlow Condensed", sans-serif; }
.waiting-overlay p { margin: 0; color: #94a7a4; font-size: 11px; }
.waiting-radar { position: relative; width: 62px; height: 62px; margin-bottom: 10px; overflow: hidden; border: 1px solid rgba(105,215,238,.45); border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 11px, rgba(105,215,238,.13) 12px 13px); }
.waiting-radar::before { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 70%, rgba(105,215,238,.3)); content: ""; animation: radar 3s linear infinite; }
.waiting-radar i { position: absolute; z-index: 1; top: 50%; left: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); transform: translate(-50%,-50%); }
.waiting-radar b { position: absolute; z-index: 1; top: 25%; left: 68%; width: 3px; height: 3px; border-radius: 50%; background: var(--blue); }
.waiting-share { display: flex; align-items: center; gap: 12px; margin-top: 18px; color: #87999a; font-size: 9px; }
.waiting-share button { padding: 8px 11px; border: 1px solid rgba(105,215,238,.3); background: rgba(105,215,238,.08); color: var(--blue); font-size: 9px; }
.result-overlay { z-index: 30; padding: 20px; background: rgba(5,10,14,.86); pointer-events: auto; }
.result-mark { color: var(--lime); font: 800 39px/1 "Barlow Condensed", sans-serif; }
.result-mark span { color: var(--faint); }
.result-overlay h2 { margin: 8px 0 2px; color: var(--lime); font: 700 46px/.95 "Barlow Condensed", sans-serif; letter-spacing: .04em; }
.result-overlay h2[data-result="loss"] { color: var(--red); }
.result-overlay h2[data-result="draw"] { color: var(--amber); }
.result-overlay p { max-width: min(440px, 85vw); margin: 6px 0 0; color: #a0afad; font-size: 11px; }
.result-stats { display: flex; gap: clamp(18px, 5vw, 46px); margin: 18px 0 14px; }
.result-stats > div { display: grid; gap: 4px; }
.result-stats b { color: #eaf1e9; font: 700 17px ui-monospace, monospace; }
.result-stats span { color: #7e9292; font-size: 8px; }
.result-actions { display: flex; gap: 10px; width: min(360px, 86vw); margin-top: 3px; }
.result-button { flex: 1; min-height: 47px; justify-content: flex-start; }
.return-lobby-button { flex: 1; min-height: 47px; justify-content: center; border: 1px solid rgba(133,164,156,.3); background: rgba(255,255,255,.04); color: #c5d7d1; font-weight: 700; }
.return-lobby-button:hover { border-color: var(--lime); color: var(--lime); }
.rematch-status { margin-top: 10px; color: #8e9f9d; font-size: 9px; }
.portrait-notice { display: none; }

/* Command dock */
.command-dock {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(1400px, 100%);
  margin: 3px auto 0;
  padding: 5px 8px 4px;
  border: 1px solid rgba(126,174,177,.28);
  background: rgba(11,20,25,.96);
  box-shadow: 0 10px 28px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
  border-radius: 4px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.command-primary-deck {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.resources {
  display: flex;
  flex: 0 0 88px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4px 6px;
  border: 1px solid rgba(210,243,106,.22);
  background: rgba(18,32,36,.55);
  border-radius: 3px;
  gap: 1px;
  text-align: center;
  box-sizing: border-box;
}
.resource-symbol { color: var(--lime); font-size: 16px; line-height: 1; }
.resources small { color: #829ea0; font: 700 8px ui-monospace, monospace; letter-spacing: .08em; }
.resources b { color: var(--lime); font: 700 24px/1 "Barlow Condensed", sans-serif; font-variant-numeric: tabular-nums; }
.resource-unit { color: #9eb5af; font: 700 8.5px ui-monospace, monospace; }
.dock-divider { width: 1px; background: var(--line); flex-shrink: 0; align-self: stretch; }
.orders { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-between; }
.orders-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; color: #9bb1b3; font: 700 9px ui-monospace, monospace; letter-spacing: .1em; }
.orders-title-group { display: flex; align-items: center; min-width: 0; }
.orders-controls { display: flex; align-items: center; gap: 6px; }
.dock-hotkey-hint { color: #87a5a3; font: 700 8.5px ui-monospace, monospace; letter-spacing: .04em; margin-left: 6px; }

/* 自动补兵开关 */
.auto-deploy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid rgba(126, 174, 177, 0.32);
  background: rgba(14, 25, 30, 0.85);
  color: #8fa8a7;
  font: 700 8.5px ui-monospace, monospace;
  border-radius: 2px;
  cursor: pointer;
  transition: all .16s ease;
  user-select: none;
  line-height: 1;
}
.auto-deploy-toggle:hover {
  border-color: rgba(210, 243, 106, 0.4);
  color: #fff;
}
.auto-deploy-toggle.active {
  border-color: rgba(210, 243, 106, 0.65);
  background: rgba(210, 243, 106, 0.12);
  color: var(--lime);
  box-shadow: 0 0 10px rgba(210, 243, 106, 0.25);
}
.auto-deploy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
  transition: all .2s ease;
}
.auto-deploy-toggle.active .auto-deploy-dot {
  background: var(--lime);
  box-shadow: 0 0 6px var(--lime);
  animation: autoPulseDot 1.4s infinite ease-in-out;
}
.auto-deploy-state {
  font-weight: 800;
  font-size: 8px;
  color: inherit;
}

.qty-label { color: #8ba5a7; font: 700 8.5px ui-monospace, monospace; align-self: center; margin-right: 3px; }
.quantity-control { display: flex; gap: 4px; align-items: center; }
.quantity-control button { padding: 2px 7px; border: 1px solid var(--line); background: transparent; color: #a4bab6; font: 700 8.5px ui-monospace, monospace; border-radius: 2px; cursor: pointer; transition: all .14s ease; }
.quantity-control button:hover { border-color: rgba(210,243,106,.4); color: #fff; }
.quantity-control button.selected { border-color: rgba(210,243,106,.48); color: var(--lime); background: rgba(210,243,106,.08); }

.unit-list {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px 4px;
  overflow: visible;
  padding-bottom: 0;
}
.unit-option {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  position: relative;
}
.unit-card {
  display: flex;
  min-width: 0;
  height: 33px;
  width: 100%;
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  border: 1px solid rgba(133,164,156,.25);
  background: #142128;
  border-radius: 2px;
  text-align: left;
  transition: border-color .16s, background .16s, transform .16s, box-shadow .16s;
  cursor: pointer;
  box-sizing: border-box;
}
.unit-card:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--lime); background: #1b2b2d; box-shadow: 0 0 8px rgba(210,243,106,.22); }
.unit-glyph { display: grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; border: 1px solid currentColor; font: 800 10px ui-monospace, monospace; border-radius: 2px; }
.scout-glyph { color: #9eeac4; background: rgba(158,234,196,.08); }
.guard-glyph { color: #ffd17e; background: rgba(255,209,126,.08); }
.runner-glyph { color: #ff9589; background: rgba(255,149,137,.08); }
.rocket-glyph { color: #f7b05b; background: rgba(247,176,91,.08); }
.medic-glyph { color: #5eead4; background: rgba(94,234,212,.08); }
.sniper-glyph { color: #c084fc; background: rgba(192,132,252,.08); }
.drone-glyph { color: #38bdf8; background: rgba(56,189,248,.08); }
.titan-glyph { color: #fb7185; background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.45); }
.jammer-glyph { color: #c084fc; background: rgba(192,132,252,.08); border-color: rgba(192,132,252,.45); }
.gunship-glyph { color: #38bdf8; background: rgba(56,189,248,.12); border-color: rgba(56,189,248,.55); font-size: 11px; }
.chrono-glyph { color: #67e8f9; background: rgba(103,232,249,.1); border-color: rgba(103,232,249,.5); text-shadow: 0 0 8px rgba(103,232,249,.6); }
.yuri-glyph { color: #e879f9; background: rgba(232,121,249,.1); border-color: rgba(232,121,249,.5); text-shadow: 0 0 8px rgba(232,121,249,.6); }
.infiltrator-glyph { color: #9ba3b8; background: rgba(155,163,184,.1); border-color: rgba(155,163,184,.5); }
.hero-glyph { color: #ffd700; background: rgba(255,215,0,.12); border-color: rgba(255,215,0,.55); text-shadow: 0 0 8px rgba(255,215,0,.7); }

/* Underdog Combat Balance Indicator & Badge */
.underdog-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 215, 0, 0.45);
  background: rgba(18, 24, 19, 0.90);
  border-radius: 4px;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.22);
  z-index: 10;
  backdrop-filter: blur(4px);
  pointer-events: none;
  animation: pulse-underdog 2.4s ease-in-out infinite alternate;
}
@keyframes pulse-underdog {
  0% { border-color: rgba(255, 215, 0, 0.4); box-shadow: 0 0 8px rgba(255, 215, 0, 0.15); }
  100% { border-color: rgba(255, 215, 0, 0.85); box-shadow: 0 0 20px rgba(255, 215, 0, 0.4); }
}
.underdog-badge .underdog-icon { color: #ffd700; font-size: 13px; }
.underdog-badge .underdog-title { color: #ffd700; font: 800 9.5px ui-monospace, monospace; letter-spacing: 0.05em; }
.underdog-badge .underdog-desc { color: #d2f36a; font: 600 8.5px ui-monospace, monospace; padding-left: 5px; border-left: 1px solid rgba(255, 215, 0, 0.3); }

.unit-price b.underdog-price-discount {
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}
.unit-copy { min-width: 0; flex: 1; overflow: hidden; }
.unit-copy b { display: flex; align-items: baseline; justify-content: space-between; overflow: hidden; color: #e1ede7; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.unit-copy small { display: block; overflow: hidden; margin-top: 1px; color: #9bb0b3; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.unit-copy .unit-level {
  display: inline-block;
  margin-left: 3px;
  padding: 0 3px;
  border: 1px solid rgba(210, 243, 106, 0.5);
  border-radius: 2px;
  background: rgba(210, 243, 106, 0.15);
  color: var(--lime);
  font: 800 7.5px ui-monospace, monospace;
  vertical-align: middle;
}
.unit-price { display: flex; align-items: center; gap: 3px; color: var(--lime); text-align: right; flex-shrink: 0; }
.unit-price b { font: 700 12.5px "Barlow Condensed", sans-serif; }
.unit-price small { display: none; }
.unit-price kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 2px;
  border: 1px solid rgba(210, 243, 106, 0.45);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--lime);
  font: 800 8.5px ui-monospace, monospace;
}
.unit-upgrade {
  position: relative;
  height: 16px;
  min-height: 16px;
  overflow: hidden;
  padding: 0 3px;
  border: 1px solid rgba(133, 164, 156, 0.28);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(16, 26, 30, 0.9) 0%, rgba(8, 14, 18, 0.95) 100%);
  color: #b5c7bf;
  font: 700 8px ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
}
.unit-upgrade:not(:disabled) {
  border-color: rgba(210, 243, 106, 0.38);
  background: linear-gradient(180deg, rgba(24, 40, 42, 0.95) 0%, rgba(12, 22, 25, 0.95) 100%);
  color: #e5f4d0;
}
.unit-upgrade:hover:not(:disabled) {
  border-color: var(--lime);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(210, 243, 106, 0.3);
}
.unit-upgrade:active:not(:disabled) {
  transform: scale(0.96);
  filter: brightness(1.2);
}
@keyframes cardUpgradePop {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
  35% { transform: scale(1.05); border-color: #ffd700; box-shadow: 0 0 20px rgba(255, 215, 0, 0.7); }
  70% { transform: scale(0.98); border-color: #ffd700; }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
}
@keyframes levelBadgeFlash {
  0% { transform: scale(1); }
  35% { transform: scale(1.4); background: #ffd700; color: #081014; box-shadow: 0 0 10px #ffd700; }
  100% { transform: scale(1); }
}
@keyframes towerUpgradePop {
  0% { transform: scale(1); border-color: rgba(105, 215, 238, 0.28); }
  35% { transform: scale(1.04); border-color: #ffd700; background: rgba(255, 215, 0, 0.16); box-shadow: 0 0 16px rgba(255, 215, 0, 0.6); }
  100% { transform: scale(1); border-color: rgba(105, 215, 238, 0.28); }
}
@keyframes floatLevelUp {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, -10px) scale(1.18); }
  70% { opacity: 1; transform: translate(-50%, -18px) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -28px) scale(0.85); }
}
.unit-option.just-upgraded .unit-card {
  animation: cardUpgradePop 0.85s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.unit-option.just-upgraded .unit-level {
  animation: levelBadgeFlash 0.85s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tower-order.just-upgraded {
  animation: towerUpgradePop 0.85s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.level-up-float {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 25;
  padding: 1px 6px;
  border: 1px solid rgba(255, 215, 0, 0.95);
  border-radius: 3px;
  background: linear-gradient(180deg, #ffd700 0%, #e6a100 100%);
  color: #0b1419;
  font: 900 8px ui-monospace, monospace;
  letter-spacing: 0.05em;
  white-space: nowrap;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.85);
  animation: floatLevelUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hp-hit-flash {
  animation: hpDamagePulse 0.35s ease-out;
}
@keyframes hpDamagePulse {
  0% { filter: brightness(2.4) drop-shadow(0 0 10px #ff4b4b); }
  100% { filter: brightness(1) drop-shadow(0 0 0 transparent); }
}

/* Tactical Stance / Doctrine Selector */
.stance-container { display: flex; flex: 0 0 162px; flex-direction: column; gap: 3px; justify-content: center; }
.tactics-tabs { display: flex; gap: 3px; }
.tactics-tab { flex: 1; padding: 2px 5px; border: 1px solid rgba(177,204,207,.18); background: rgba(255,255,255,.03); color: #728b8e; font: 700 8.5px ui-monospace, monospace; letter-spacing: .06em; cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.tactics-tab:hover { color: #b1cac4; border-color: rgba(177,204,207,.4); }
.tactics-tab.active { color: var(--lime); border-color: rgba(210,243,106,.45); background: rgba(210,243,106,.08); }
.stance-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.stance-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 3px; padding: 3px 6px;
  border: 1px solid rgba(133, 164, 156, 0.28); background: rgba(18, 30, 36, 0.85);
  border-radius: 2px; color: #a9bfb7; font: 700 8.5px ui-monospace, monospace;
  cursor: pointer; transition: all 0.16s ease;
}
.stance-btn:hover { border-color: rgba(210, 243, 106, 0.45); color: #fff; background: rgba(26, 44, 48, 0.9); }
.stance-btn.active {
  border-color: var(--lime); background: rgba(210, 243, 106, 0.14); color: var(--lime);
  box-shadow: 0 0 10px rgba(210, 243, 106, 0.3);
}
.stance-icon { font-size: 10px; }
.stance-name { font-size: 8.5px; font-weight: 700; }



/* 自动补兵派发时的卡片脉冲光效 */
@keyframes autoDispatchPulse {
  0% { transform: scale(1); filter: brightness(1.35); border-color: var(--lime); box-shadow: 0 0 10px rgba(210, 243, 106, 0.6); }
  50% { transform: scale(0.97); }
  100% { transform: scale(1); filter: brightness(1); }
}
.unit-card.auto-dispatched {
  animation: autoDispatchPulse 0.5s ease;
}

/* Killstreak & Combat Event Banner */
.killstreak-banner {
  position: absolute; top: 38px; left: 50%; transform: translateX(-50%);
  z-index: 28; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 20px; border: 1px solid rgba(255, 215, 0, 0.85); border-radius: 3px;
  background: linear-gradient(180deg, rgba(20, 16, 8, 0.95) 0%, rgba(10, 8, 4, 0.98) 100%);
  box-shadow: 0 0 26px rgba(255, 215, 0, 0.65), inset 0 0 12px rgba(255, 215, 0, 0.2);
  pointer-events: none; animation: killstreakSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.ks-badge { color: #ffd700; font: 800 8px ui-monospace, monospace; letter-spacing: 0.16em; text-transform: uppercase; }
.killstreak-banner h3 { margin: 0; color: #fff; font: 900 18px "Barlow Condensed", sans-serif; letter-spacing: 0.08em; text-shadow: 0 0 14px #ffd700; }
.killstreak-banner p { margin: 0; color: #fde047; font: 600 9.5px ui-monospace, monospace; }
@keyframes killstreakSlide {
  0% { opacity: 0; transform: translate(-50%, -16px) scale(0.85); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* Result Stats Grid Extension */
.result-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(440px, 100%); margin: 16px auto;
}
.result-stats > div {
  padding: 8px 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); text-align: center;
}
.result-stats b { display: block; font: 700 17px "Barlow Condensed", sans-serif; color: var(--lime); }
.result-stats span { display: block; margin-top: 3px; color: var(--muted); font: 700 7px ui-monospace, monospace; }
.result-stats b.mvp-highlight { color: #ffd700; text-shadow: 0 0 12px rgba(255, 215, 0, 0.7); }

.tower-orders { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 4px; flex: 0 0 148px; min-width: 132px; }
.tower-orders > .tower-orders-label { grid-column: 1 / -1; margin-bottom: 0; }
.ability-orders { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px 3px; flex: 1 1 310px; min-width: 276px; }
.ability-orders > .tower-orders-label { grid-column: 1 / -1; margin-bottom: 0; }
.item-orders { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px 3px; flex: 1 1 320px; min-width: 288px; }
.item-orders > .tower-orders-label { grid-column: 1 / -1; margin-bottom: 0; }
.item-orders > .item-upgrade-row { grid-column: 1 / -1; margin-top: 1px; display: flex; gap: 3px; }
.item-orders > .mine-status { display: none; }
.building-orders { display: flex; flex-direction: column; gap: 2px; flex: 0 0 168px; min-width: 150px; }
.building-row { display: flex; flex-direction: row; gap: 3px; }
.tower-orders-label { margin-bottom: 1px; color: #829a9c; font: 700 8px ui-monospace, monospace; letter-spacing: .08em; }
.tower-order, .ability-order, .item-order { display: flex; min-width: 0; height: 28px; min-height: 28px; align-items: center; gap: 3px; padding: 2px 4px; border: 1px solid rgba(105, 215, 238, 0.28); background: rgba(105, 215, 238, 0.05); text-align: left; transition: all .16s ease-out; border-radius: 2px; box-sizing: border-box; overflow: hidden; }
.tower-order:not(:disabled) { border-color: rgba(105, 215, 238, 0.32); background: rgba(105, 215, 238, 0.06); }
.tower-order:hover:not(:disabled), .ability-order:hover:not(:disabled), .item-order:hover:not(:disabled) { border-color: rgba(210,243,106,.45); background: rgba(210,243,106,.08); transform: translateY(-1px); box-shadow: 0 0 8px rgba(210,243,106,.2); }
.tower-mini, .ability-glyph, .item-glyph { display: grid; width: 17px; height: 17px; flex: 0 0 17px; place-items: center; border: 1px solid rgba(105,215,238,.38); color: var(--blue); font-size: 9px; border-radius: 2px; flex-shrink: 0; }
.ability-glyph { border-color: rgba(210,243,106,.25); color: var(--lime); }
.repair-glyph { border-color: rgba(94,234,212,.4); color: #5eead4; }
.mine-glyph { border-color: rgba(247,176,91,.4); color: #f7b05b; }
.barrier-glyph { border-color: rgba(56,189,248,.45); color: #38bdf8; background: rgba(56,189,248,.08); }
.focus-glyph { border-color: rgba(255,209,126,.45); color: #ffd17e; background: rgba(255,209,126,.08); }
.sentry-glyph { border-color: rgba(255,120,108,.45); color: #ff9589; background: rgba(255,120,108,.08); }

/* 防御道具强化按钮 */
.item-upgrade-row { display: flex; gap: 3px; }
.item-upgrade { flex: 1; min-width: 0; height: 16px; min-height: 16px; padding: 0 3px; border: 1px solid rgba(210,243,106,.3); background: rgba(210,243,106,.06); color: var(--lime); font: 700 7.5px ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: border-color .16s, background .16s, opacity .16s; border-radius: 2px; display: flex; align-items: center; justify-content: center; }
.item-upgrade:hover:not(:disabled) { border-color: var(--lime); background: rgba(210,243,106,.14); }
.item-upgrade:active:not(:disabled) { background: rgba(210,243,106,.22); }
.item-upgrade:disabled { opacity: .4; cursor: not-allowed; }
@media (max-width: 960px) { .item-upgrade { font-size: 7px; padding: 2px; } }

/* 基地建筑升级按钮 */
.building-order { flex: 1; min-width: 0; height: 28px; min-height: 28px; padding: 2px 3px; border: 1px solid rgba(105,215,238,.35); background: rgba(105,215,238,.06); color: var(--blue); font: 700 7.5px ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: border-color .16s, background .16s, opacity .16s; border-radius: 2px; display: flex; align-items: center; justify-content: center; }
.building-order:hover:not(:disabled) { border-color: var(--blue); background: rgba(105,215,238,.14); }
.building-order:disabled { opacity: .4; cursor: not-allowed; }
@media (max-width: 960px) { .building-order { font-size: 7px; padding: 3px 2px; } }

/* 英雄终极技按钮 */
.hero-ult-btn { border-color: rgba(255,215,0,.5); background: linear-gradient(135deg, rgba(40,32,10,.92), rgba(52,40,12,.92)); }
.hero-ult-btn .pulse-icon { border-color: #ffd700; color: #ffd700; }
.hero-ult-btn .pulse-text small { color: #ffd700; }
.hero-ult-btn.is-ready { border-color: #ffd700; box-shadow: 0 0 14px rgba(255,215,0,.4); }
.hero-ult-btn:not(:disabled):hover { box-shadow: 0 0 16px rgba(255,215,0,.5); }

/* 单位指令栏（战场底部） */
.unit-order-bar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid rgba(210,243,106,.4); background: rgba(8,16,14,.85); backdrop-filter: blur(6px); }
.unit-order-bar.hidden { display: none; }
.order-bar-label { color: var(--lime); font: 700 9px ui-monospace, monospace; letter-spacing: .1em; }
.order-bar-label b { color: #fff; }
.order-btn { padding: 3px 8px; border: 1px solid rgba(177,204,207,.25); background: rgba(255,255,255,.04); color: #cfe3de; font: 700 9.5px ui-monospace, monospace; cursor: pointer; transition: border-color .15s, color .15s; }
.order-btn:hover { border-color: var(--lime); color: var(--lime); }
.order-focus:hover { border-color: #ff9589; color: #ff9589; }
.order-hold:hover { border-color: #67e8f9; color: #67e8f9; }
.order-retreat:hover { border-color: #ffd17e; color: #ffd17e; }
@media (max-width: 960px) { .unit-order-bar { bottom: 8px; padding: 4px 6px; gap: 3px; } .order-btn { padding: 4px 5px; font-size: 8.5px; } .tactics-tab { padding: 2px 4px; font-size: 6px; letter-spacing: .03em; } .tactics-tabs { gap: 3px; } }
.mine-status { margin-top: 1px; color: #829395; font: 700 7px ui-monospace, monospace; text-align: center; }
.tower-order > span:nth-child(2), .ability-order > span:nth-child(2), .item-order > span:nth-child(2) { min-width: 0; flex: 1 1 auto; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.tower-order b, .ability-order b, .item-order b { display: block; overflow: hidden; color: #d6e2de; font-size: 8px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.tower-order small, .ability-order small, .item-order small { display: block; margin-top: 1px; color: #9bb0b2; font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tower-order i, .tower-order em, .ability-order em, .item-order em { color: var(--lime); font-style: normal; }
.tower-order > strong { color: var(--lime); font-size: 9.5px; min-width: 8px; text-align: center; flex-shrink: 0; }
.ability-order > strong, .item-order > strong { display: none; }
.ability-order.is-ready, .item-order.is-ready { border-color: rgba(210,243,106,.22); }
.mobile-tactics-toggle { display: none; }

/* 快捷键指示徽标 */
.cmd-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 12px;
  height: 12px;
  padding: 0 2px;
  border: 1px solid rgba(133, 164, 156, 0.4);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  color: #dcece7;
  font: 800 7.5px ui-monospace, monospace;
  margin-left: auto;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: border-color .16s, color .16s;
}
.mini-kbd {
  display: inline-block;
  margin-left: 2px;
  padding: 0 3px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.4);
  color: #ddede8;
  font: 800 8px ui-monospace, monospace;
}
.tab-kbd {
  display: inline-block;
  margin-left: 2px;
  color: #8ea6a7;
  font: 700 7.5px ui-monospace, monospace;
}
.ability-order:hover:not(:disabled) .cmd-kbd,
.item-order:hover:not(:disabled) .cmd-kbd {
  border-color: var(--lime);
  color: var(--lime);
}

.utility-drawer {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding-top: 4px;
  border-top: 1px solid rgba(126, 174, 177, 0.16);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.battle-feed {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(1400px, 100%);
  margin: 2px auto 0;
  padding: 2px 6px;
  border-top: 1px solid var(--line);
  min-height: 24px;
  max-height: 26px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.feed-heading { display: flex; align-items: center; gap: 5px; color: #879ea1; font: 700 8.5px ui-monospace, monospace; letter-spacing: .1em; flex-shrink: 0; }
.feed-heading i { display: none; }
.feed-heading b { color: #a4b7b6; font-size: 8px; }
.radio-bar { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.radio-label { display: none; }
.radio-ping-btn { padding: 2px 7px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: #b7c8c6; font: 700 8.5px ui-monospace, monospace; border-radius: 2px; cursor: pointer; transition: all .14s ease; }
.radio-ping-btn:hover { border-color: var(--lime); color: var(--lime); background: rgba(210,243,106,.08); }
.feed-list { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; min-width: 0; overflow: hidden; margin-top: 0; color: #afbfbc; font-size: 9.5px; white-space: nowrap; }
.feed-item { display: flex; min-width: 0; align-items: center; gap: 5px; }
.feed-item i { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: #829496; }
.feed-item.blue i { background: var(--blue); }
.feed-item.red i { background: var(--red); }
.feed-item.kill i { background: var(--amber); }
.feed-empty { color: #607477; }
.toast { position: fixed; z-index: 60; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; max-width: min(90vw, 460px); padding: 10px 15px; transform: translate(-50%, 14px); border: 1px solid rgba(210,243,106,.32); background: rgba(12,22,23,.96); color: var(--lime); font-size: 10px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.game-screen.is-ended .command-dock { opacity: 0; pointer-events: none; }
@keyframes radar { to { transform: rotate(360deg); } }

/* Field Manual Modal */
.manual-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 9, 12, 0.85);
  backdrop-filter: blur(8px);
  padding: 20px;
}
.manual-box {
  width: min(880px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(105, 215, 238, 0.45);
  border-radius: 4px;
  background: linear-gradient(160deg, #0e1a20 0%, #091116 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(105, 215, 238, 0.15);
  overflow: hidden;
}
.manual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 32, 40, 0.6);
}
.manual-header h3 {
  margin: 0;
  color: var(--lime);
  font: 700 17px "Barlow Condensed", sans-serif;
  letter-spacing: 0.1em;
}
.close-manual-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s ease;
}
.close-manual-btn:hover {
  border-color: var(--red);
  color: var(--red);
}
.manual-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #c7d8d5;
}
.manual-section h4 {
  margin: 0 0 8px;
  color: var(--blue);
  font: 700 12px ui-monospace, monospace;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(105, 215, 238, 0.25);
  padding-bottom: 4px;
}
.manual-units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px 12px;
}
.manual-units-grid > div {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2px;
}
.manual-units-grid b {
  display: block;
  font-size: 11.5px;
  margin-bottom: 3px;
}
.manual-units-grid p {
  margin: 0;
  font-size: 10px;
  color: #9cb1af;
  line-height: 1.45;
}

/* Mobile: full-screen landscape command view */
@media (max-width: 960px) and (orientation: landscape) {
  html, body { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
  .game-screen { position: fixed; inset: 0; display: flex; width: 100%; height: 100dvh; min-height: 0; flex-direction: column; padding: max(4px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
  .match-header { height: 27px; min-height: 27px; }
  .match-brand { gap: 6px; font-size: 11px; }
  .match-brand .brand-mark { font-size: 19px; }
  .match-brand small { display: none; }
  .match-signal { gap: 5px; font-size: 7px; }
  .match-signal span { display: none; }
  .match-signal .net-ping { display: none; }
  .room-control { gap: 5px; font-size: 7px; }
  .room-control .icon-button { width: 21px; height: 21px; font-size: 11px; }
  .fullscreen-button { display: none; }
  .scoreboard { flex: 0 0 44px; width: min(760px, 88vw); grid-template-columns: minmax(0,1fr) 76px minmax(0,1fr); gap: 8px; margin: 2px auto 3px; }
  .win-rate-bar { width: min(760px, 88vw); height: 18px; min-height: 18px; padding: 1px 6px; gap: 6px; margin: 0 auto 2px; }
  .win-rate-side { min-width: 62px; gap: 3px; }
  .win-rate-team { font-size: 6.5px; }
  .win-rate-val { font-size: 9.5px; }
  .win-rate-title { font-size: 5.5px; }
  .win-rate-track { height: 4px; }
  .team-score { gap: 6px; }
  .team-emblem { width: 27px; height: 27px; flex-basis: 27px; font-size: 12px; }
  .score-name { gap: 4px; font-size: 6px; }
  .score-name b { font-size: 8px; }
  .base-health { height: 3px; margin-top: 4px; }
  .score-meta { margin-top: 2px; font-size: 6px; }
  .score-meta > b { font-size: 8px; }
  .score-meta small { font-size: 5px; }
  .match-clock { padding: 0; }
  .clock-label { font-size: 5px; }
  .match-clock > strong { font-size: 19px; }
  .match-clock > div { font-size: 6px; }
  .battlefield-wrap { display: flex; width: 100%; min-height: 0; flex: 1 1 auto; flex-direction: column; margin: 0; }
  .battlefield-heading { position: absolute; z-index: 3; top: 4px; right: 8px; left: 8px; padding: 0; font-size: 5px; opacity: .72; pointer-events: none; }
  .tactical-advisor-bar { min-height: 25px; padding: 2px 6px; gap: 6px; margin: 0 0 2px; }
  .advisor-badge { display: none; }
  .advisor-text { font-size: 8px; }
  .advisor-reason { font-size: 6.5px; }
  .advisor-action { padding: 2px 5px; gap: 3px; }
  .advisor-action-label { display: none; }
  .advisor-action b { font-size: 7px; }
  .battlefield-wrap canvas { height: auto; min-height: 0; flex: 1 1 auto; border-color: rgba(126,174,177,.18); }
  .damage-vignette, .damage-erosion-overlay { top: 0; }
  .battlefield-hud { top: 28px; gap: 2px; }
  .hud-left { left: 7px; }
  .hud-right { right: 7px; }
  .hud-label { font-size: 5px; }
  .battlefield-hud strong { font-size: 7px; }
  .battlefield-hud small { font-size: 6px; }
  .battle-overlay { inset: 0; }
  .waiting-radar { width: 44px; height: 44px; margin-bottom: 5px; }
  .waiting-overlay h2 { margin: 5px 0 2px; font-size: 21px; }
  .waiting-overlay p { font-size: 8px; }
  .waiting-share { gap: 8px; margin-top: 9px; font-size: 7px; }
  .waiting-share button { padding: 6px 8px; font-size: 7px; }
  .result-overlay { z-index: 40; padding: 10px 8px max(10px, env(safe-area-inset-bottom)); }
  .result-mark { font-size: clamp(20px, 6vh, 34px); }
  .result-overlay h2 { margin-top: 5px; font-size: clamp(26px, 7vh, 41px); }
  .result-overlay p { margin-top: 4px; font-size: clamp(8px, 2vh, 10px); }
  .result-stats { gap: 20px; margin: 8px 0; }
  .result-stats b { font-size: 14px; }
  .result-stats span { font-size: 7px; }
  .result-actions { width: min(330px, 72vw); }
  .result-button { min-height: 41px; font-size: 11px; }
  .return-lobby-button { min-height: 41px; font-size: 11px; }
  .rematch-status { margin-top: 6px; font-size: 8px; }
  .command-primary-deck { display: contents; }
  .cmd-kbd, .mini-kbd, .tab-kbd, .dock-hotkey-hint, .qty-label { display: none; }
  .command-dock { position: absolute; z-index: 10; bottom: max(5px, env(safe-area-inset-bottom)); left: 50%; display: flex; flex-direction: row; width: min(600px, 76vw); gap: 5px; margin: 0; padding: 4px 6px; transform: translateX(-50%); border: 1px solid rgba(126,174,177,.32); background: rgba(8,16,20,.94); box-shadow: 0 6px 22px rgba(0,0,0,.38); backdrop-filter: blur(12px); }
  .resources { flex: 0 0 38px; gap: 2px; }
  .resource-symbol { font-size: 12px; }
  .resources small { font-size: 5px; }
  .resources b { font-size: 15px; }
  .resource-unit { font-size: 5px; }
  .command-dock > .dock-divider, .command-primary-deck > .dock-divider { display: none; }
  .orders { flex: 1; }
  .orders-heading { margin-bottom: 2px; font-size: 5px; }
  .orders-controls { display: flex; align-items: center; gap: 3px; }
  .auto-deploy-toggle { padding: 1px 4px; font-size: 6px; gap: 2px; }
  .auto-deploy-dot { width: 4px; height: 4px; }
  .auto-deploy-state { font-size: 6px; }
  .quantity-control { gap: 2px; }
  .quantity-control button { padding: 1px 4px; font-size: 6px; }
  .unit-list { display: flex; overflow-x: auto; scrollbar-width: none; gap: 3px; }
  .unit-option { flex: 1 0 75px; max-width: 95px; gap: 2px; }
  .unit-card { min-height: 30px; padding: 3px 4px; gap: 3px; }
  .unit-glyph { width: 18px; height: 18px; flex-basis: 18px; font-size: 8px; }
  .unit-copy b { font-size: 7px; }
  .unit-copy small { display: none; }
  .unit-copy .unit-level { font-size: 5px; }
  .unit-price b { font-size: 10px; }
  .unit-price small, .unit-price kbd { display: none; }
  .unit-upgrade { min-height: 16px; padding: 1px 2px; font-size: 5px; }
  .battle-feed, .portrait-notice { display: none; }
  .toast { bottom: 72px; padding: 7px 10px; font-size: 8px; }
  .utility-drawer {
    position: absolute;
    z-index: 25;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: row;
    align-items: stretch;
    width: min(660px, 96vw);
    max-height: min(68vh, 240px);
    overflow-x: auto;
    overflow-y: auto;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(126, 174, 177, 0.38);
    background: rgba(8, 16, 22, 0.98);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(14px);
    border-radius: 4px;
    box-sizing: border-box;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .game-screen.utility-open .utility-drawer { display: flex !important; }
  .mobile-tactics-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    width: 30px;
    height: 26px;
    flex: 0 0 30px;
    gap: 1px;
    padding: 1px 2px;
    border: 1px solid rgba(210, 243, 106, 0.38);
    background: linear-gradient(180deg, rgba(210, 243, 106, 0.12), rgba(12, 24, 20, 0.88));
    color: var(--lime);
    font: 700 6.5px ui-monospace, monospace;
    border-radius: 2px;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.18s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-tactics-toggle:active {
    transform: scale(0.96);
    background: rgba(210, 243, 106, 0.22);
  }
  .game-screen.utility-open .mobile-tactics-toggle {
    border-color: var(--lime);
    background: rgba(210, 243, 106, 0.24);
    box-shadow: 0 0 6px rgba(210, 243, 106, 0.35);
  }
  .mobile-tactics-toggle .tactics-toggle-label, .mobile-tactics-toggle span:first-child {
    font-size: 6.5px;
    line-height: 1;
    letter-spacing: 0;
  }
  .mobile-tactics-toggle .tactics-toggle-arrow, .mobile-tactics-toggle span:last-child {
    font-size: 8px;
    line-height: 1;
    color: var(--lime);
  }
  /* 四组必须同时重置 flex-basis 与 min-width，否则基础规则(.tower-orders 等)的
     flex-basis(148/310/320/168px) 与 min-width(140/285/295/155px) 会压过这里的 width，
     把技能/装备按钮撑到 310px 宽并横向溢出成多屏 */
  .tower-orders { display: flex !important; flex-direction: column !important; flex: 0 1 auto !important; min-width: 0 !important; width: 104px; gap: 3px !important; }
  .ability-orders { display: flex !important; flex-direction: column !important; flex: 0 1 auto !important; min-width: 0 !important; width: 152px; gap: 3px !important; }
  .item-orders { display: flex !important; flex-direction: column !important; flex: 0 1 auto !important; min-width: 0 !important; width: 158px; gap: 3px !important; }
  .building-orders { display: flex !important; flex-direction: column !important; flex: 0 1 auto !important; min-width: 0 !important; width: 136px; gap: 3px !important; }
  .tower-order, .ability-order, .item-order, .building-order {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: 100% !important;
    height: 26px !important;
    min-height: 26px !important;
    padding: 2px 4px !important;
    gap: 3px !important;
    box-sizing: border-box !important;
  }
  .item-upgrade { height: 14px !important; min-height: 14px !important; font-size: 6.5px !important; }
  .tower-order b, .ability-order b, .item-order b { font-size: 7.5px !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
  .tower-order small, .ability-order small, .item-order small { font-size: 6.5px !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
  .tower-mini, .ability-glyph, .item-glyph { width: 17px !important; height: 17px !important; flex-basis: 17px !important; flex-shrink: 0 !important; font-size: 8.5px !important; }
  .tower-orders-label { font-size: 7px !important; margin-bottom: 2px !important; color: #829a9c !important; }
  .item-upgrade-row { display: flex !important; flex-direction: column !important; gap: 2px !important; width: 100% !important; margin-top: 2px !important; }
  .building-row { display: flex !important; flex-direction: column !important; gap: 2px !important; width: 100% !important; }
  .utility-drawer > .dock-divider { display: block !important; width: 1px !important; background: rgba(126, 174, 177, 0.22) !important; align-self: stretch !important; flex-shrink: 0 !important; }
  .game-screen.is-ended .command-dock { display: none; }
  .game-screen.is-ended .utility-drawer { display: none !important; }
  .game-screen.is-ended .mobile-tactics-toggle { display: none; }
}
@media (max-width: 560px) and (orientation: landscape) {
  .scoreboard { width: 94vw; grid-template-columns: minmax(0,1fr) 64px minmax(0,1fr); gap: 5px; }
  .score-meta > span { display: none; }
  .command-dock { width: min(580px, 86vw); gap: 4px; padding: 4px; }
  .resources { flex-basis: 34px; }
  .mobile-tactics-toggle { min-width: 25px; width: 27px; height: 24px; flex: 0 0 27px; font-size: 6px; padding: 1px 1px; }
  .mobile-tactics-toggle .tactics-toggle-label, .mobile-tactics-toggle span:first-child { font-size: 6px; }
  .mobile-tactics-toggle .tactics-toggle-arrow, .mobile-tactics-toggle span:last-child { font-size: 7px; }
  .unit-card { padding: 2px; }
  .unit-glyph { width: 16px; height: 16px; flex-basis: 16px; }
  .unit-copy b { font-size: 6px; }
  .unit-price b { font-size: 9px; }
  .unit-upgrade { font-size: 4px; }
  .utility-drawer { width: 94vw; gap: 4px; padding: 6px; }
  .tower-orders { width: 88px; }
  .ability-orders { width: 120px; }
  .item-orders { width: 126px; }
  .building-orders { width: 112px; }
}
@media (max-width: 960px) and (orientation: portrait) {
  .game-screen:not(.hidden) .portrait-notice { position: fixed; z-index: 50; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; background: #080d12; color: var(--text); text-align: center; }
  .portrait-notice div { color: var(--lime); font-size: 38px; }
  .portrait-notice b { font: 600 23px "Barlow Condensed", sans-serif; }
  .portrait-notice span { color: var(--muted); font-size: 9px; }
  .lobby-screen { min-height: 100dvh; }
}
@media (max-width: 620px) and (orientation: portrait) {
  .lobby-screen { padding: 24px 20px 14px; }
  .lobby-content { display: block; padding-top: clamp(28px, 9vh, 78px); }
  .lobby-copy h1 { margin: 17px 0 10px; font-size: 67px; }
  .lobby-copy > p, .lobby-briefing, .build-tag { display: none; }
  .connect-panel { margin-top: 29px; padding: 24px 20px 19px; }
  .connect-panel h2 { margin-bottom: 17px; }
  .lobby-footer { flex-wrap: wrap; font-size: 6px; }
  .lobby-footer span:nth-child(2) { display: none; }
  .connection-foot { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
