/* ============================================================
   style.css — 元素对决 · 深色像素风外壳
   颜色全部取自 js/core/data.js 的 PAL（此处以 CSS 变量复刻同一份色值）
   ============================================================ */

:root {
  --ink: #0a0d12;
  --night: #111722;
  --deep: #18202e;
  --stone: #232d3d;
  --stone-light: #33415a;
  --mist: #5d6f8c;
  --frost: #9fb2c9;
  --white: #e8eef6;
  --red: #ff5c5c;
  --red-dark: #7a2222;
  --orange: #ff9d5c;
  --gold: #ffd166;
  --green: #7ee787;
  --green-dark: #2f6b3d;
  --blue: #79c0ff;
  --blue-dark: #274a6b;
  --purple: #c9b8e8;
  --purple-dark: #4a3f63;
  --steel: #a9b6c4;
  --steel-dark: #48535f;

  --font: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  /* 刘海/圆角安全区：padding 用 env()，main.js 的 fitStage() 会读取这里的实际值来算可用区域 */
  box-sizing: border-box;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(120% 90% at 50% -10%, #18202e 0%, #0a0d12 62%);
}

#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 960px;
  transform-origin: 0 0;
  display: flex;
  flex-direction: column;
  background: var(--night);
  box-shadow: 0 0 0 2px var(--stone), 0 18px 60px #000000b0;
  will-change: transform;
}

/* ---------------- 顶部 HUD ---------------- */
.hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 6px;
  padding: 5px 6px 6px;
  background: linear-gradient(180deg, var(--deep) 0%, var(--night) 100%);
  border-bottom: 2px solid var(--stone-light);
  position: relative;
  z-index: 5;
}

.base-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.base-card.player { align-items: flex-end; text-align: right; }
.base-card.enemy { align-items: flex-start; text-align: left; }

.base-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
  width: 100%;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--frost);
}
.base-card.player .base-line { flex-direction: row-reverse; }

.base-name { flex: 0 0 auto; font-weight: 700; }
.base-hp-num { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--white); font-weight: 700; }

.bar {
  position: relative;
  width: 100%;
  height: 11px;
  background: var(--ink);
  border: 2px solid var(--stone);
  overflow: hidden;
}
.bar .fill {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transition: transform 120ms linear;
}
.base-card.player .bar .fill { transform-origin: 100% 50%; }
.base-card.enemy .bar .fill { transform-origin: 0 50%; }
.bar .fill::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: #ffffff26;
}
.bar .ghost {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  background: #ffffff40;
  transition: transform 420ms ease-out;
}
.base-card.player .bar .ghost { transform-origin: 100% 50%; }
.base-card.enemy .bar .ghost { transform-origin: 0 50%; }

.base-card.player .bar .fill { background: linear-gradient(180deg, #79c0ff, #274a6b); }
.base-card.enemy .bar .fill { background: linear-gradient(180deg, #ff5c5c, #7a2222); }

/* 基地危急：整个卡片呼吸闪烁 */
.base-card.critical .base-name { color: var(--red); }
.base-card.critical .bar { border-color: var(--red-dark); animation: criticalPulse 1s steps(2, end) infinite; }
@keyframes criticalPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 2px #ff5c5c55, 0 0 12px #ff5c5c80; }
}
.base-card.critical .base-hp-num { color: var(--red); }

/* 中央：回合 + 倒计时 */
.center-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 104px;
}
.round-line {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--mist);
}
.round-line b { color: var(--gold); font-size: 12px; }
.clock {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--white);
  text-shadow: 0 0 10px #79c0ff55;
}
.clock.warn { color: var(--gold); }
.clock.danger { color: var(--red); }
.clock-sub { font-size: 9px; color: var(--mist); letter-spacing: 0.5px; }

/* 资源与热量行 */
.res-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}
.res {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.res-icon {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px #00000060;
}
.res.build .res-icon { background: #f0a868; }
.res.energy .res-icon { background: #8fd0ff; }
.res-num {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}
.res.build .res-num { color: #f0a868; }
.res.energy .res-num { color: #8fd0ff; }
.res-bar { flex: 1 1 auto; height: 6px; background: var(--ink); border: 1px solid var(--stone); position: relative; overflow: hidden; }
.res-bar > i { position: absolute; inset: 0; transform-origin: 0 50%; }
.res.build .res-bar > i { background: #f0a868; }
.res.energy .res-bar > i { background: #8fd0ff; }

.heat {
  display: flex;
  align-items: center;
  gap: 5px;
}
.heat-label { font-size: 9px; color: var(--mist); flex: 0 0 auto; letter-spacing: 0.5px; }
.heat-bar {
  flex: 1 1 auto; height: 6px;
  background:
    linear-gradient(90deg, transparent calc(60% - 1px), #ffffff26 calc(60% - 1px), #ffffff26 60%, transparent 60%),
    linear-gradient(90deg, transparent calc(85% - 1px), #ff5c5c55 calc(85% - 1px), #ff5c5c55 85%, transparent 85%),
    var(--ink);
  border: 1px solid var(--stone); position: relative; overflow: hidden;
}
.heat-bar > i {
  position: absolute; inset: 0; transform-origin: 0 50%;
  background: var(--heat-c, #7ee787);
  transition: background-color 200ms linear;
}
/* 热量接近危险：整体发暖 + 轻微脉动 */
.heat.warm .heat-bar { border-color: #ff9d5c; }
.heat.warm .heat-bar > i { animation: heatPulse 1.15s ease-in-out infinite; }
.heat.warm .heat-val { color: #ff9d5c; font-weight: 700; }
/* 热量进入红区：边框红闪 + 数值闪烁 */
.heat.crit .heat-bar { border-color: #ff5c5c; box-shadow: 0 0 0 1px #ff5c5c88, 0 0 10px #ff5c5c55; }
.heat.crit .heat-bar > i { animation: heatFlash 0.42s steps(2, end) infinite; }
.heat.crit .heat-val { color: #ff5c5c; font-weight: 700; animation: heatFlash 0.42s steps(2, end) infinite; }

/* 平衡点刻度：玩家能看出"离平衡还差多远" */
.heat-bar > .heat-tick {
  position: absolute;
  top: -1px; bottom: -1px;
  width: 2px;
  margin-left: -1px;
  background: var(--frost);
  opacity: 0.85;
  box-shadow: 0 0 3px var(--ink);
  pointer-events: none;
}

/* 静音开关：喇叭图标用内联 SVG，靠 CSS 切状态 */
.mute-btn {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  padding: 0;
  background: var(--deep);
  color: var(--frost);
  border: 1px solid var(--stone);
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear;
}
.mute-btn:hover { color: var(--white); border-color: var(--mist); }
.mute-btn .mute-x { opacity: 0; }
.mute-btn.muted { color: var(--red-dark); border-color: var(--stone-light); }
.mute-btn.muted .wave1,
.mute-btn.muted .wave2 { opacity: 0; }
.mute-btn.muted .mute-x { opacity: 1; }

@keyframes heatPulse {
  0%, 100% { opacity: 0.82; }
  50%      { opacity: 1; }
}
@keyframes heatFlash {
  0%   { opacity: 1; }
  100% { opacity: 0.45; }
}
.heat-val { font-size: 10px; font-variant-numeric: tabular-nums; color: var(--frost); min-width: 30px; text-align: right; }

/* ---------------- 战场 ---------------- */
.field {
  position: relative;
  flex: 0 0 auto;
  line-height: 0;
}
#game {
  display: block;
  width: 960px;
  height: 540px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  background: var(--ink);
}

.ticker {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  line-height: 1.25;
  font-size: 10px;
  color: var(--frost);
  text-shadow: 0 1px 0 #000, 0 0 6px #000;
}
.ticker .line {
  align-self: flex-start;
  max-width: 100%;
  padding: 1px 5px;
  background: #0a0d12a8;
  border-left: 2px solid var(--mist);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transition: opacity 420ms ease;
}
.ticker .line.sys { border-left-color: var(--gold); color: var(--gold); }
.ticker .line.enemy { border-left-color: var(--red); color: #ffb3b3; }
.ticker .line.player { border-left-color: var(--green); color: #c8f5cf; }
.ticker .line.fade { opacity: 0; }

/* ---------------- 底部指挥台 ---------------- */
.deck {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  background: linear-gradient(0deg, var(--deep) 0%, var(--night) 100%);
  border-top: 2px solid var(--stone-light);
  position: relative;
  z-index: 5;
}
.deck-row { display: grid; gap: 5px; }
/* ★ v6：兵种从 5 个增加到 8 个（铁/锌/盐酸/碱/硝酸/氯/石英/金）。
   横屏 880 宽下 8 列每列约 105px，足够放"名称 + 价格"；
   工具行保持 6 列（上道/下道/换算/战报/暂停/倍速）。 */
.deck-row.troops {
  grid-template-columns: repeat(7, 1fr);
}
.deck-row.utils { grid-template-columns: repeat(6, 1fr); }

.btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 5px 3px;
  min-height: 44px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(180deg, var(--stone) 0%, var(--deep) 100%);
  border: 2px solid var(--stone-light);
  box-shadow: inset 0 2px 0 #ffffff14, 0 2px 0 #00000080;
  cursor: pointer;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 0 #ffffff0a, 0 1px 0 #00000080; }
.btn .k { font-size: 8px; color: var(--mist); font-weight: 400; letter-spacing: 0.5px; }
.btn .v { font-size: 10px; font-variant-numeric: tabular-nums; color: var(--gold); }
.btn[disabled], .btn.off {
  color: var(--mist);
  background: linear-gradient(180deg, var(--deep) 0%, #111722 100%);
  border-color: var(--stone);
  cursor: not-allowed;
  filter: saturate(0.3);
}
.btn[disabled] .v { color: var(--mist); }
.btn .swatch {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sw, var(--mist));
}
.btn.troop { align-items: flex-start; padding-left: 8px; }
.btn.troop .nm { font-size: 11px; }
.btn.flash { animation: btnflash 260ms ease-out; }
@keyframes btnflash {
  0% { background: var(--gold); color: var(--ink); }
  100% { background: linear-gradient(180deg, var(--stone) 0%, var(--deep) 100%); }
}
.btn.util { min-height: 34px; font-size: 11px; flex-direction: row; gap: 5px; }
.btn.util .badge {
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
}
.btn.util.on { border-color: var(--gold); color: var(--gold); box-shadow: inset 0 2px 0 #ffffff14, 0 0 10px #ffd16655; }
.btn.lane { flex-direction: row; gap: 4px; }
.btn.lane.on { border-color: var(--blue); color: var(--blue); box-shadow: inset 0 2px 0 #ffffff14, 0 0 10px #79c0ff55; }

/* ---------------- 遮罩层 / 面板 ---------------- */
.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}
.backdrop {
  position: absolute;
  inset: 0;
  background: #0a0d1299;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}
.backdrop.show { opacity: 1; pointer-events: auto; }
/* 抽屉从顶部弹出时（玩家正在挑塔、要看下半屏的射程预览），遮罩压淡一点 */
.backdrop.show.light { background: #0a0d1255; }

.sheet {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 62%;
  max-width: 62%;
  display: flex;
  flex-direction: column;
  background: var(--night);
  border-right: 3px solid var(--stone-light);
  box-shadow: 14px 0 40px #000000a0;
  transform: translateX(-102%);
  transition: transform 180ms cubic-bezier(.22,.8,.3,1);
  pointer-events: auto;
  overflow: hidden;
}
.sheet.show { transform: translateX(0); }

/* 横屏：抽屉统一从左侧滑出（.sheet.side），右侧完整留给战场 */
.sheet.side {
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  max-height: 100%;
  border-right: 3px solid var(--stone-light);
  border-bottom: none;
  box-shadow: 14px 0 40px #000000a0;
  transform: translateX(-102%);
}
.sheet.side.show { transform: translateX(0); }

.sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 8px;
  background: linear-gradient(180deg, var(--deep), var(--night));
  border-bottom: 2px solid var(--stone);
}
.sheet-title { font-size: 14px; font-weight: 700; letter-spacing: 1px; flex: 1 1 auto; }
.sheet-sub { font-size: 10px; color: var(--mist); }
.sheet-close {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  font-size: 16px;
  line-height: 1;
  color: var(--frost);
  background: var(--stone);
  border: 2px solid var(--stone-light);
  cursor: pointer;
  font-family: var(--font);
}
.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  touch-action: pan-y;
}

/* 卡片 */
.card {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  background: linear-gradient(180deg, var(--stone) 0%, var(--deep) 100%);
  border: 2px solid var(--stone-light);
  border-left-width: 5px;
  border-left-color: var(--accent, var(--mist));
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--white);
}
.card:active { background: var(--stone-light); }
.card[disabled], .card.off { opacity: 0.45; filter: grayscale(0.7); cursor: not-allowed; }
.card .icon { width: 40px; height: 40px; }
.card .nm { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.card .attr {
  font-size: 9px;
  padding: 1px 4px;
  border: 1px solid currentColor;
  color: var(--accent, var(--mist));
}
.card .stats { font-size: 10px; color: var(--frost); margin-top: 2px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.card .stats.alt { color: var(--mist); margin-top: 0; }
.card .desc { font-size: 10px; color: var(--mist); margin-top: 2px; line-height: 1.35; }
.card .price {
  min-width: 62px;
  max-width: 76px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  text-align: right;
  white-space: nowrap;
}
.card .price small { display: block; font-size: 8px; color: var(--mist); font-weight: 400; }
.card .price.no { color: var(--red); }
.card .heat-tag {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.card .heat-tag b { font-weight: 700; }
.card .heat-tag i { font-style: normal; opacity: 0.72; }
.card .nm .lock {
  font-size: 8px;
  font-weight: 600;
  padding: 1px 4px;
  color: var(--gold);
  background: var(--ink);
  border: 1px solid var(--stone-light);
  letter-spacing: 0;
}
.card .tag {
  position: absolute;
  right: 6px; top: 5px;
  font-size: 8px;
  color: var(--gold);
}

/* 大按钮（升级/拆除） */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.big-btn {
  padding: 11px 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid #fff3;
  box-shadow: 0 3px 0 #00000060;
  cursor: pointer;
}
.big-btn small { display: block; font-size: 9px; font-weight: 400; opacity: 0.75; margin-top: 2px; }
.big-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #00000060; }
.big-btn.danger { background: var(--red); color: #fff; }
.big-btn.ghost { background: var(--stone); color: var(--white); border-color: var(--stone-light); }
.big-btn[disabled] { background: var(--stone); color: var(--mist); cursor: not-allowed; box-shadow: none; }

/* 塔详情块 */
.tower-info {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--deep);
  border: 2px solid var(--stone-light);
  border-left: 5px solid var(--accent, var(--mist));
}
.tower-info .icon { width: 52px; height: 52px; flex: 0 0 auto; }
.tower-info .kv { font-size: 11px; color: var(--frost); line-height: 1.6; font-variant-numeric: tabular-nums; }
.tower-info .kv b { color: var(--white); }
.lvl-pips { display: flex; gap: 3px; margin-top: 3px; }
.lvl-pips i { width: 14px; height: 5px; background: var(--stone-light); }
.lvl-pips i.on { background: var(--gold); }

/* 结束 / 开始覆盖层 */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px;
  background: #0a0d12f2;
  pointer-events: auto;
  text-align: center;
}
.screen[hidden] { display: none; }
.screen h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 6px;
  color: var(--white);
  text-shadow: 0 0 18px #79c0ff66, 4px 4px 0 #00000080;
}
.screen h2 { margin: 0; font-size: 26px; letter-spacing: 4px; }
.screen h2.win { color: var(--gold); text-shadow: 0 0 22px #ffd16680; }
.screen h2.lose { color: var(--red); text-shadow: 0 0 22px #ff5c5c80; }
.screen h2.draw { color: var(--blue); }
.screen .tagline { font-size: 11px; color: var(--mist); letter-spacing: 2px; }
.screen .sub { font-size: 12px; color: var(--frost); line-height: 1.6; max-width: 460px; }

/* 开始界面：四格玩法速览 */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 460px;
}
.rule {
  padding: 9px 10px;
  text-align: left;
  background: var(--deep);
  border: 2px solid var(--stone-light);
}
.rule-t { font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: 2px; margin-bottom: 4px; }
.rule-b { font-size: 10px; color: var(--mist); line-height: 1.5; }

.help-btn {
  padding: 7px 20px;
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--frost);
  background: transparent;
  border: 2px solid var(--stone-light);
  cursor: pointer;
}
.help-btn:hover { border-color: var(--gold); color: var(--gold); }

/* 游戏说明覆盖层 */
.help-body {
  width: 100%;
  max-width: 500px;
  max-height: 56vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.help-sec { padding: 8px 12px; background: var(--deep); border-left: 3px solid var(--stone-light); }
.help-t { font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: 2px; margin-bottom: 3px; }
.help-b { font-size: 11px; color: var(--frost); line-height: 1.55; }
.help-b b { color: var(--gold); font-weight: 700; }
.help-b code {
  display: inline-block;
  margin: 2px 0;
  padding: 1px 5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px;
  color: var(--white);
  background: #0d131c;
  border: 1px solid var(--stone);
}

.diff-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 420px; }
.diff-btn {
  padding: 10px 6px;
  font-family: var(--font);
  color: var(--white);
  background: var(--stone);
  border: 2px solid var(--stone-light);
  cursor: pointer;
  text-align: center;
}
.diff-btn .dn { font-size: 15px; font-weight: 700; letter-spacing: 2px; }
.diff-btn .dd { font-size: 9px; color: var(--mist); margin-top: 4px; line-height: 1.35; }
.diff-btn.on { border-color: var(--gold); background: var(--deep); box-shadow: 0 0 14px #ffd16655; }
.diff-btn.on .dn { color: var(--gold); }

.play-btn {
  padding: 14px 44px;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold), var(--orange));
  border: 3px solid #fff4;
  box-shadow: 0 4px 0 #00000080, 0 0 26px #ffd16655;
  cursor: pointer;
}
.play-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #00000080; }

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  width: 100%;
  max-width: 400px;
  padding: 12px;
  background: var(--deep);
  border: 2px solid var(--stone-light);
  font-size: 12px;
}
.result-stats .econ-head {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--stone-light);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--mist);
  text-align: center;
}
.result-stats .k { color: var(--mist); text-align: right; }
.result-stats .v { color: var(--white); font-weight: 700; font-variant-numeric: tabular-nums; text-align: left; }

/* 战报列表 */
.log-list { display: flex; flex-direction: column; gap: 3px; font-size: 11px; line-height: 1.4; }
.log-list .row { display: flex; gap: 6px; padding: 3px 6px; background: var(--deep); border-left: 3px solid var(--mist); }
.log-list .row .tt { color: var(--mist); font-variant-numeric: tabular-nums; flex: 0 0 42px; }
.log-list .row.player { border-left-color: var(--green); }
.log-list .row.enemy { border-left-color: var(--red); }
.log-list .row.system { border-left-color: var(--gold); color: var(--gold); }

/* 小屏提示 */
@media (max-width: 400px) {
  .btn .v { font-size: 9px; }
}

/* ---------------- 404 ---------------- */
.nf {
  text-align: center;
  padding: 8vh 24px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--frost);
}
.nf-code {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--orange);
  text-shadow: 0 0 24px #ff9d5c55;
}
.nf-title { font-size: 18px; font-weight: 700; color: var(--white); margin: 8px 0 4px; }
.nf-text { margin: 10px 0 22px; color: var(--mist); }
.nf-back {
  display: inline-block;
  padding: 12px 30px;
  font-family: inherit;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold), var(--orange));
  border: 3px solid #fff4;
  text-decoration: none;
}
.nf-back:active { transform: translateY(1px); }

/* ============================================================
   熔毁阶段（S.suddenDeath）
   ============================================================ */
/* 阶段文字变红 + 轻微闪烁 */
.hud.meltdown .round-line b { color: var(--red); animation: meltBlink 0.9s steps(2, end) infinite; }
.hud.meltdown .round-line { color: var(--red-dark); }
.hud.meltdown .clock { color: var(--red); text-shadow: 0 0 12px var(--red-dark); }
.hud.meltdown .clock-sub { color: var(--orange); }
.hud.meltdown { box-shadow: inset 0 -2px 0 var(--red-dark); }

@keyframes meltBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ============================================================
   横屏锁：竖持设备时提示旋转
   ============================================================ */
#rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--ink);
  color: var(--white);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}
#rotate-hint .rh-icon {
  display: inline-block;
  font-size: 48px;
  margin-bottom: 16px;
  animation: rhSpin 1.6s ease-in-out infinite;
}
#rotate-hint .rh-t { font-size: 16px; letter-spacing: 2px; }
#rotate-hint .rh-s { font-size: 12px; color: var(--mist); margin-top: 8px; line-height: 1.6; }

@keyframes rhSpin {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

/* 竖持（高度大于宽度）时：显示旋转提示，遮住游戏 */
@media (orientation: portrait) and (max-width: 900px) {
  #rotate-hint { display: flex; }
  #app { visibility: hidden; }
}

/* 熔毁期间：落后一方的血条边框红色脉动（3Hz） */
.base-card.draining .bar {
  border-color: var(--red);
  animation: drainPulse 0.333s steps(2, end) infinite;
}
.base-card.draining .base-name,
.base-card.draining .base-hp-num { color: var(--red); }
@keyframes drainPulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 2px var(--red), 0 0 10px var(--red-dark); }
}

/* 兵种价格变化时闪一下 */
.btn .v.bump { animation: priceBump 0.4s ease-out; }
@keyframes priceBump {
  0% { transform: scale(1.5); filter: brightness(1.9); }
  100% { transform: scale(1); filter: brightness(1); }
}
.btn .v { display: inline-block; transform-origin: 50% 50%; }
