:root {
  --bg: #07090c;
  --panel: #10161e;
  --panel-2: #161e29;
  --panel-3: #1c2633;
  --line: #273342;
  --line-2: #33435a;
  --text: #e7edf3;
  --muted: #8796a8;
  --dim: #5b6878;
  --red: #e0574a;
  --red-soft: rgba(224, 87, 74, 0.16);
  --blue: #4c93e6;
  --blue-soft: rgba(76, 147, 230, 0.16);
  --amber: #f2b33d;
  --green: #62d06c;
  --font: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", "Heiti TC", system-ui, sans-serif;
  --num: "Bahnschrift", "DIN Alternate", "Segoe UI", "Roboto Condensed", var(--font);
  --stencil: "Stencil", "Stencil Std", "Bahnschrift", "Arial Black", var(--font);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #10151c 0%, var(--bg) 70%);
}

/* 固定 1600 × 900 設計基準，由 main.js 等比例縮放 */
#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 900px;
  transform-origin: 0 0;
  background: var(--panel);
  box-shadow: 0 0 0 1px #1a222d, 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  user-select: none;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 0.4em;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text);
  font: 600 12px/1.5 var(--num);
  text-align: center;
}

button { font-family: var(--font); cursor: pointer; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------------- HUD ---------------- */

/* 訊息列位於戰場下方、生產區上方 */
#hud {
  position: absolute;
  left: 0;
  top: 600px;
  width: 1600px;
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 20px;
  background: linear-gradient(#151c26, #0e131a);
  border-top: 1px solid var(--line);
  z-index: 2;
}

.hud-side { display: flex; align-items: center; gap: 14px; }
.hud-right { justify-content: flex-end; }
.hud-block { display: flex; flex-direction: column; gap: 2px; }
.align-right { align-items: flex-end; text-align: right; }

.side-chip {
  width: 10px;
  height: 40px;
  border-radius: 2px;
}
.chip-red { background: var(--red); box-shadow: 0 0 12px rgba(224, 87, 74, 0.6); }
.chip-blue { background: var(--blue); box-shadow: 0 0 12px rgba(76, 147, 230, 0.6); }

.hud-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.enemy-block .hud-label { color: #ff9a8f; }
.funds-block .hud-label, .self-block .hud-label { color: #9cc6f5; }
.self-block .hud-label { font-size: 13px; }

.hud-divider { width: 1px; height: 40px; background: var(--line-2); }
.time-block .hud-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.2em; }

.hud-sub { font-size: 13px; color: var(--muted); }
.hud-sub b { color: var(--text); font-family: var(--num); font-weight: 600; }
.hud-sub.muted { color: var(--dim); }

.hud-center { display: flex; align-items: center; justify-content: center; gap: 14px; }
.hud-center .income { line-height: 1.35; }
.hud-time {
  font: 700 34px/1 var(--num);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.hud-funds {
  font: 700 34px/1 var(--num);
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.hud-funds small { font-size: 14px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.hud-funds.capped span { color: var(--amber); }

.hud-btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hud-btn:hover:not(:disabled) { background: #243142; }
.hud-btn:disabled { opacity: 0.4; cursor: default; }

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--text);
  display: inline-grid;
  place-items: center;
}
.icon-btn:hover { background: #243142; }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.help-btn { color: #ffd166; }
.icon-btn .cross { display: none; }
.icon-btn.muted .wave { display: none; }
.icon-btn.muted .cross { display: inline; }
.icon-btn.muted { color: var(--muted); }

/* ---------------- 戰場 ---------------- */

#field-wrap {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 600px;
  overflow: hidden;
  background: #222;
}

#field {
  display: block;
  width: 1600px;
  height: 600px;
}

#toasts {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(10, 14, 20, 0.88);
  border: 1px solid var(--line-2);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  animation: toast-in 0.14s ease-out;
  transition: opacity 0.25s;
}
.toast.ok { border-color: rgba(98, 208, 108, 0.6); }
.toast.warn { border-color: rgba(242, 179, 61, 0.7); color: #ffd98a; }
.toast.bad { border-color: rgba(224, 87, 74, 0.8); color: #ffb3aa; }
.toast.fade { opacity: 0; }

@keyframes toast-in {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------------- 生產控制台 ---------------- */

#panel {
  position: absolute;
  left: 0;
  top: 672px;
  width: 1600px;
  height: 228px;
  padding: 0 16px 14px;
  background: linear-gradient(#121a24, #0c1118);
  border-top: 1px solid var(--line);
}

.panel-head {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #9cc6f5;
}
.panel-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue);
  vertical-align: 1px;
}
.panel-hint { font-size: 13px; color: var(--muted); }
.panel-hint kbd { font-size: 11px; }
.panel-hint b { color: #9cc6f5; }

#cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  justify-content: center; /* 車種未全部解鎖時，剩下的卡片維持原寬度置中 */
  gap: 12px;
  height: 180px;
}
#cards .card[hidden] { display: none; }

/* 卡片：左側資訊，右側直排 1／2／3 車道生產按鈕 */
.card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 10px;
  padding: 8px 9px 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-2), #121923);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.card { cursor: pointer; }
.card.selected { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber), 0 0 16px rgba(242, 179, 61, 0.22); }
.card.selected::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 80px;
  top: -1px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--amber);
}
.card.flash { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), 0 0 18px rgba(76, 147, 230, 0.35); }
.card.deny { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }

.card-body {
  display: grid;
  grid-template-rows: 22px minmax(0, 1fr) 20px 24px;
  gap: 6px;
  min-width: 0;
}

.card-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-name { font-size: 16px; font-weight: 800; letter-spacing: 0.03em; white-space: nowrap; }
.card-cost {
  margin-left: auto;
  font: 700 17px/1 var(--num);
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.card-cost::before { content: "＄"; font-size: 12px; margin-right: 1px; opacity: 0.8; }
.card.poor .card-cost { color: #c46a5f; }
.card-role {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #9cc6f5;
  font-size: 11px;
  font-weight: 700;
}

.card-mid { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: center; min-height: 0; }
.card-icon { width: 84px; height: 46px; display: block; } /* 高度含自走砲高過車身框的砲管 */
.card-stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 8px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.card-stats b { color: var(--text); font-family: var(--num); font-weight: 600; }

.card-progress { position: relative; }
.card-progress .bar {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: #0a0f15;
  border: 1px solid var(--line);
  overflow: hidden;
}
.card-progress .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2c6bb8, #5aa2f0);
}
.card-progress.ready .bar i { background: linear-gradient(90deg, #a57012, #f2b33d); }
.card-progress .status {
  position: relative;
  display: block;
  padding: 0 7px;
  font-size: 11.5px;
  line-height: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.card-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.queue { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.card[data-block="full"] .queue::after { content: "已滿"; color: var(--amber); font-weight: 700; }
.card[data-block="poor"] .queue::after { content: "軍費不足"; color: #ff8f84; font-weight: 700; }
.pips { display: inline-flex; gap: 3px; }
.pips i {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #0a0f15;
  border: 1px solid var(--line-2);
  color: #fff;
  font: normal 700 11px/14px var(--num);
  text-align: center;
}
.pips i.on { background: #5f5a53; border-color: #8a8378; color: #efe8d4; font-family: var(--stencil); font-weight: 900; }

.btn-cancel {
  margin-left: auto;
  height: 24px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
}
.btn-cancel:hover:not(.off) { color: var(--text); border-color: #52657e; }
.btn-cancel.off { opacity: 0.35; cursor: not-allowed; }

.lane-btns {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 5px;
}
.btn-lane.closed { visibility: hidden; } /* 本局未開放的車道：保留位置，其他按鈕仍對齊戰場車道 */
/* 車道按鈕＝迷你出場閘門：黃黑警示門楣＋橫條紋捲門＋模板噴漆字母 */
.btn-lane {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 0 2px;
  font: 900 23px/1 var(--stencil);
  border-radius: 4px;
  border: 2px solid #4a4640;
  background: repeating-linear-gradient(180deg, #716c64 0 3px, #56524b 3px 4px);
  color: #ece4cf;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: box-shadow 0.12s, filter 0.12s;
}
.btn-lane::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: repeating-linear-gradient(135deg, #e0b23a 0 4px, #1d1b18 4px 8px);
}
.btn-lane::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #c99a2e;
}
.gate-letter { position: relative; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.no-stencil-font .gate-letter::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 6%;
  bottom: 6%;
  width: 2px;
  transform: translateX(-50%);
  background: #625d56;
}
.btn-lane:hover:not(.off) {
  filter: brightness(1.15);
  color: #fff6d8;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(255, 210, 110, 0.6), 0 0 12px rgba(255, 196, 80, 0.4);
}
.btn-lane:hover:not(.off) .gate-letter { text-shadow: 0 0 8px rgba(255, 214, 120, 0.9); }
.btn-lane:active:not(.off) { transform: translateY(1px); }
.btn-lane.hit { box-shadow: 0 0 0 2px #fff4d2, 0 0 14px rgba(255, 214, 120, 0.85); }
.btn-lane.off {
  filter: grayscale(0.7) brightness(0.5);
  cursor: not-allowed;
}

/* ---------------- 覆蓋畫面 ---------------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 9, 0.66);
}
.overlay.hidden { display: none; }

.overlay-menu {
  background:
    /* 戰場以下（訊息列與生產區）加深，避免底層介面文字透出 */
    linear-gradient(180deg, transparent 0%, transparent 60%, rgba(5, 7, 10, 0.94) 67%, rgba(5, 7, 10, 0.97) 100%),
    radial-gradient(ellipse at 50% 42%, rgba(12, 16, 22, 0.55) 0%, rgba(5, 7, 10, 0.9) 70%),
    linear-gradient(90deg, rgba(224, 87, 74, 0.12), transparent 30%, transparent 70%, rgba(76, 147, 230, 0.12));
}

.menu-box { text-align: center; }

.title {
  position: relative;
  margin: 0;
  font-size: 112px;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1.05;
  padding-left: 0.14em;
  color: #f4f7fa;
  text-shadow: -3px 0 0 rgba(224, 87, 74, 0.75), 3px 0 0 rgba(76, 147, 230, 0.75), 0 8px 40px rgba(0, 0, 0, 0.8);
}

/* 蒙太奇標題：以畫布呈現，文字保留給螢幕閱讀器 */
.logo-canvas { display: none; }
.title.montage { padding-left: 0; line-height: 0; }
.title.montage .title-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.title.montage .logo-canvas { display: block; width: 860px; height: 210px; margin: -26px auto -14px; }

/* 副標：悲壯的一句話，在標題開場剪接後緩緩浮現 */
.subtitle {
  margin-top: 12px;
  font: 500 26px/1.4 var(--font);
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  color: #dccbb0;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85), 0 0 24px rgba(220, 140, 80, 0.18);
  animation: subtitle-in 1.8s ease-out 1.3s both;
}
@keyframes subtitle-in {
  from { opacity: 0; letter-spacing: 0.55em; filter: blur(4px); }
  to { opacity: 1; letter-spacing: 0.3em; filter: blur(0); }
}
@media (prefers-reduced-motion: reduce) {
  .subtitle { animation: none; }
}

.menu-box .primary-btn.big { margin-top: 56px; }

/* 封面出品單位 */
.menu-credit {
  margin: 30px 0 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.5em;
  padding-left: 0.5em;
  color: #f2a24a;
  text-shadow: 0 0 18px rgba(242, 140, 40, 0.35);
}
.menu-credit .credit-green {
  color: #6cc24a;
  text-shadow: 0 0 18px rgba(108, 194, 74, 0.4);
}
.menu-credit::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 14px;
  border-radius: 50%;
  background: #f28c28;
  box-shadow: 0 0 10px #f28c28;
  vertical-align: 2px;
}

/* 開戰倒數（戰場區內） */
.countdown {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(5, 8, 12, 0.5) 0%, rgba(5, 8, 12, 0.78) 75%);
  pointer-events: none;
  transition: opacity 0.6s ease-out;
}
.countdown.hidden { display: none; }
.countdown.fade { opacity: 0; }
.countdown-num {
  font: 900 190px/1 var(--num);
  color: #fff;
  text-shadow: -5px 0 0 rgba(224, 87, 74, 0.75), 5px 0 0 rgba(76, 147, 230, 0.75), 0 10px 40px rgba(0, 0, 0, 0.8);
}
.countdown-num.pop { animation: count-pop 1s ease-out both; }
/* 倒數上方的戰區名稱（第 N 戰區・地名） */
.countdown-zone {
  margin-bottom: 6px;
  padding: 4px 18px;
  border-top: 2px solid var(--hazard, #e0b23a);
  border-bottom: 2px solid var(--hazard, #e0b23a);
  color: #ffd98a;
  font: 900 30px/1.3 var(--font);
  letter-spacing: 0.3em;
  padding-left: calc(18px + 0.3em);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}
.countdown-num.go {
  font-family: var(--font);
  font-size: 128px;
  letter-spacing: 0.2em;
  padding-left: 0.2em;
  color: #ffd166;
  animation: go-pop 0.9s ease-out both;
}
@keyframes count-pop {
  0% { transform: scale(1.8); opacity: 0; }
  15% { transform: scale(1); opacity: 1; }
  80% { transform: scale(0.96); opacity: 1; }
  100% { transform: scale(0.85); opacity: 0.15; }
}
@keyframes go-pop {
  0% { transform: scale(2.2); opacity: 0; }
  20% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.04); opacity: 1; }
}
.countdown-text {
  margin: 28px 0 0;
  padding: 10px 26px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(10, 14, 20, 0.65);
  color: #e7edf3;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}
@media (prefers-reduced-motion: reduce) {
  .countdown-num.pop, .countdown-num.go { animation: none; }
}

.menu-audio {
  position: absolute;
  right: 28px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.music-btn {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(16, 22, 30, 0.85);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.music-btn:hover { background: #243142; }
.music-btn.off { color: var(--muted); }
.music-hint { font-size: 14px; color: #9cc6f5; animation: music-hint 1.6s ease-in-out infinite; }
.music-hint.hidden { display: none; }
@keyframes music-hint {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.primary-btn, .secondary-btn {
  min-width: 200px;
  height: 52px;
  padding: 0 28px;
  border-radius: 8px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.primary-btn {
  border: 1px solid #f7c867;
  background: linear-gradient(#f5bd4a, #d9951b);
  color: #1b1405;
  box-shadow: 0 6px 24px rgba(242, 179, 61, 0.25);
}
.primary-btn:hover { background: linear-gradient(#ffcb5e, #e7a32a); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn.big { min-width: 300px; height: 66px; font-size: 26px; }
.secondary-btn {
  border: 1px solid var(--line-2);
  background: var(--panel-3);
  color: var(--text);
}
.secondary-btn:hover { background: #243142; }

.dialog {
  min-width: 460px;
  padding: 36px 44px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(16, 22, 30, 0.96);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  text-align: center;
}
.dialog-title { margin: 0; font-size: 44px; font-weight: 900; letter-spacing: 0.2em; padding-left: 0.2em; }
.dialog-sub { margin: 10px 0 28px; font-size: 18px; color: var(--muted); }
.btn-col { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.btn-col button { width: 260px; }
.btn-row { display: flex; gap: 14px; justify-content: center; }

.dialog.result { min-width: 560px; }
.result-title { margin: 0; font-size: 76px; font-weight: 900; letter-spacing: 0.12em; padding-left: 0.12em; line-height: 1.1; }
.result.win .result-title { color: #ffd166; text-shadow: 0 0 30px rgba(255, 209, 102, 0.45); }
.result.lose .result-title { color: #ff7b6e; text-shadow: 0 0 30px rgba(224, 87, 74, 0.45); }
.result.draw .result-title { color: #d5dde6; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 30px;
}
.result-stats div {
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.result-stats dt { font-size: 14px; color: var(--muted); }
.result-stats dd { margin: 6px 0 0; font: 700 30px/1 var(--num); font-variant-numeric: tabular-nums; }

/* ---------------- 車種說明（全圖示，蓋版） ---------------- */

.overlay-help {
  z-index: 30;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 22px 40px 28px;
  background: radial-gradient(ellipse at 50% 0%, #182231 0%, #0b1017 60%);
}
.help-head { position: relative; height: 96px; display: flex; justify-content: center; }
.help-tabs { display: flex; gap: 16px; }
.help-tab {
  width: 208px;
  height: 90px;
  padding: 0;
  border: 2px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.help-tab[hidden] { display: none; } /* 未解鎖的車種不顯示 */
.help-tab canvas { width: 172px; height: 70px; display: block; }
.help-tab:hover { border-color: #52657e; }
.help-tab[aria-selected="true"] {
  border-color: var(--amber);
  background: #1e2938;
  box-shadow: 0 0 0 2px rgba(242, 179, 61, 0.3), 0 0 26px rgba(242, 179, 61, 0.22);
  transform: translateY(-2px);
}
.help-close {
  position: absolute;
  right: 0;
  top: 13px;
  width: 64px;
  height: 64px;
  padding: 16px;
  border: 2px solid var(--line-2);
  border-radius: 50%;
  background: var(--panel-3);
  color: var(--text);
}
.help-close:hover { background: #243142; border-color: #52657e; }
.help-close svg { width: 100%; height: 100%; display: block; }

.help-body { flex: 1; display: grid; grid-template-columns: 620px 1fr; gap: 44px; margin-top: 24px; }
.help-left { display: flex; flex-direction: column; gap: 20px; }
.help-hero, .help-ability { display: block; width: 620px; border-radius: 14px; border: 1px solid var(--line); }
.help-hero { height: 250px; }
.help-ability { height: 330px; }

.help-right { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.help-stats { display: flex; flex-direction: column; gap: 12px; }
.stat-row { display: flex; align-items: center; gap: 20px; height: 56px; }
.stat-icon { flex: none; width: 50px; height: 50px; display: grid; place-items: center; }
.stat-icon svg { width: 44px; height: 44px; display: block; }
.meter { display: flex; gap: 7px; }
.meter i { width: 50px; height: 22px; border-radius: 5px; background: #1a2230; border: 1px solid #222d3c; }
.meter i.on { background: var(--c); border-color: transparent; box-shadow: 0 0 10px color-mix(in srgb, var(--c) 55%, transparent); }
.help-range { width: 640px; height: 70px; display: block; }
.range-row { height: 74px; }
.match-row { display: flex; align-items: center; gap: 20px; height: 84px; }
.match-chips { display: flex; gap: 14px; }
.match-chip {
  width: 140px;
  height: 76px;
  border: 2px solid;
  border-radius: 14px;
  display: grid;
  place-items: center;
}
.match-chip canvas { width: 120px; height: 56px; display: block; }
.match-row.strong .match-chip { border-color: #62d06c; background: rgba(98, 208, 108, 0.1); }
.match-row.weak .match-chip { border-color: #ef5a4c; background: rgba(239, 90, 76, 0.1); }

/* ---------------- 自動對打（展示模式） ---------------- */

.demo-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 30px 12px;
  border: 1px solid rgba(242, 179, 61, 0.5);
  border-radius: 14px;
  background: rgba(8, 12, 18, 0.74);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
.demo-banner.hidden { display: none; }
.demo-title { font-size: 24px; font-weight: 800; letter-spacing: 0.18em; color: var(--amber); }
.demo-banner.win-L .demo-title { color: #ff8f84; }
.demo-banner.win-R .demo-title { color: #8cc4ff; }

/* ================= 戰場風格：訊息列與生產控制台（軍用控制台外觀） ================= */
/* 只改外觀：沿用原本的版面與尺寸（訊息列 72 px、生產區 228 px） */

:root {
  --steel-hi: rgba(255, 255, 240, 0.12);
  --khaki: #d4c79c;
  --khaki-dim: #9a9c86;
  --hazard: #e0b23a;
  --led-amber: #ffb43a;
  --led-green: #79c25a;
  --rivet: radial-gradient(circle, #8a8e7a 0 1.4px, #2a2c24 1.9px, transparent 2.6px);
}

kbd {
  border: 1px solid #15170f;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: linear-gradient(#4a5042, #2c3027);
  color: #ece6d2;
  box-shadow: inset 0 1px 0 var(--steel-hi);
}

/* ---------- 訊息列：鋼板＋鉚釘＋凹陷顯示器 ---------- */

#hud {
  background:
    var(--rivet) 4px 4px / 12px 12px no-repeat,
    var(--rivet) calc(100% - 4px) 4px / 12px 12px no-repeat,
    var(--rivet) 4px calc(100% - 4px) / 12px 12px no-repeat,
    var(--rivet) calc(100% - 4px) calc(100% - 4px) / 12px 12px no-repeat,
    repeating-linear-gradient(0deg, rgba(255, 255, 240, 0.018) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #2c3128 0%, #1b1f18 58%, #121510 100%);
  border-top: 2px solid #5a6150;
  box-shadow: inset 0 1px 0 var(--steel-hi), inset 0 -1px 0 rgba(0, 0, 0, 0.7);
}

/* 凹陷式數位顯示器：對戰時間、軍費 */
.time-block,
.funds-block .hud-block {
  padding: 5px 12px 6px;
  border: 1px solid #000;
  border-radius: 4px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 200, 120, 0.035) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #060805, #0e120b);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.85), 0 1px 0 var(--steel-hi);
}
.time-block .hud-label { color: rgba(255, 180, 58, 0.75); }
.hud-time { color: var(--led-amber); text-shadow: 0 0 10px rgba(255, 170, 40, 0.55); }
.hud-funds span { color: #ffe9a8; text-shadow: 0 0 10px rgba(255, 214, 120, 0.45); }
.hud-funds small { color: #8d8a73; }
.hud-funds.capped span { color: var(--led-amber); }

/* 小型英文模板標籤 */
.time-block .hud-label::before,
.enemy-block .hud-label::before,
.funds-block .hud-label::before,
.self-block .hud-label::before {
  display: inline-block;
  margin-right: 7px;
  font: 900 9px/1 var(--stencil);
  letter-spacing: 0.18em;
  vertical-align: 2px;
  opacity: 0.6;
}
.time-block .hud-label::before { content: "MISSION"; }
.enemy-block .hud-label::before { content: "HOSTILE"; }
.funds-block .hud-label::before { content: "FUNDS"; }
.self-block .hud-label::before { content: "FRIENDLY"; }

/* 陣營指示燈（LED） */
.side-chip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #23261e;
  box-shadow: 0 0 0 1px #4c5243;
}
.chip-red { background: radial-gradient(circle at 35% 35%, #ffc2b8, #e0574a 45%, #7c1d15); box-shadow: 0 0 0 1px #4c5243, 0 0 12px rgba(224, 87, 74, 0.85); }
.chip-blue { background: radial-gradient(circle at 35% 35%, #c8e2ff, #4c93e6 45%, #173d73); box-shadow: 0 0 0 1px #4c5243, 0 0 12px rgba(76, 147, 230, 0.85); }

.hud-divider {
  width: 2px;
  height: 42px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.7) 0 1px, rgba(255, 255, 240, 0.1) 1px 2px);
}
.hud-sub { color: var(--khaki-dim); }
.hud-sub b { color: #ece6d2; }
.hud-sub.muted { color: #7d7f6c; }

/* 金屬按鈕 */
.hud-btn,
.icon-btn {
  border: 1px solid #14160f;
  border-radius: 4px;
  background: linear-gradient(180deg, #4a5041, #2a2e25);
  color: #ece6d2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 240, 0.18), inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.6);
}
.hud-btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled) { background: linear-gradient(180deg, #59604d, #343a2e); }
.hud-btn:active:not(:disabled),
.icon-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6); }
.help-btn { color: var(--led-amber); }
.icon-btn.muted { color: #8d8a73; }

/* ---------- 生產控制台：防滑鋼板＋警示膠帶 ---------- */

#panel {
  border-top: 0;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 240, 0.022) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.14) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, #24291f 0%, #171a14 100%);
}
#panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: repeating-linear-gradient(135deg, var(--hazard) 0 10px, #161512 10px 20px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
.panel-head { padding-top: 6px; }
.panel-title { color: var(--khaki); letter-spacing: 0.16em; font-weight: 900; }
.panel-title::before {
  width: 9px;
  height: 9px;
  background: radial-gradient(circle at 35% 35%, #d7ffc8, var(--led-green) 50%, #2c5a1f);
  box-shadow: 0 0 8px var(--led-green);
  animation: led-pulse 2.4s ease-in-out infinite;
}
.panel-title::after {
  content: "PRODUCTION CONTROL";
  margin-left: 10px;
  font: 900 10px/1 var(--stencil);
  letter-spacing: 0.24em;
  color: rgba(212, 199, 156, 0.5);
}
.panel-hint { color: var(--khaki-dim); }
.panel-hint b { color: var(--khaki); }
@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .panel-title::before { animation: none; }
}

/* ---------- 生產卡片：裝甲資料板 ---------- */

.card {
  border: 1px solid #0d0f0a;
  border-radius: 5px;
  background:
    var(--rivet) 1px 1px / 12px 12px no-repeat,
    var(--rivet) 1px calc(100% - 1px) / 12px 12px no-repeat,
    linear-gradient(180deg, #363c30 0%, #272b22 45%, #1d2019 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 240, 0.14), inset 0 0 0 1px rgba(255, 255, 240, 0.04), 0 2px 6px rgba(0, 0, 0, 0.55);
}
.card:hover { border-color: #5a604c; }
.card.selected {
  border-color: var(--led-amber);
  box-shadow: 0 0 0 1px var(--led-amber), 0 0 18px rgba(255, 180, 58, 0.3), inset 0 1px 0 rgba(255, 255, 240, 0.14);
}
.card.selected::before {
  height: 4px;
  border-radius: 0;
  background: repeating-linear-gradient(135deg, var(--hazard) 0 6px, #161512 6px 12px);
}
/* 選取中：四角琥珀色瞄準框 */
.card.selected::after {
  content: "";
  position: absolute;
  inset: -5px;
  pointer-events: none;
  --c: var(--led-amber);
  background:
    linear-gradient(var(--c), var(--c)) left top / 12px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 2px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 12px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 2px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 12px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 2px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 12px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 2px 12px no-repeat;
}
.card.flash { border-color: var(--led-green); box-shadow: 0 0 0 1px var(--led-green), 0 0 18px rgba(121, 194, 90, 0.4); }
.card.deny { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 0 14px rgba(224, 87, 74, 0.35); }

.card-name { color: #efe9d6; font-weight: 900; letter-spacing: 0.08em; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6); }
/* 價格：壓印標籤 */
.card-cost {
  padding: 2px 6px 2px 5px;
  border: 1px solid #5c5236;
  border-radius: 2px;
  background: #11130e;
  color: var(--led-amber);
  font-size: 15px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
  text-shadow: 0 0 6px rgba(255, 170, 40, 0.35);
}
.card.poor .card-cost { color: #d0786c; border-color: #5a2f29; text-shadow: none; }
/* 定位：軍用標籤 */
.card-role {
  border: 1px solid rgba(212, 199, 156, 0.3);
  border-radius: 2px;
  background: rgba(89, 96, 63, 0.55);
  color: #ddd3ad;
  letter-spacing: 0.06em;
}

/* 車輛圖示：戰術顯示窗 */
.card-icon {
  border-radius: 3px;
  background:
    linear-gradient(rgba(130, 210, 120, 0.08) 1px, transparent 1px) 0 0 / 100% 8px,
    linear-gradient(90deg, rgba(130, 210, 120, 0.08) 1px, transparent 1px) 0 0 / 8px 100%,
    radial-gradient(ellipse at 50% 60%, #1c2618, #0a0e09 78%);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 240, 0.08);
}
.card-stats { color: var(--khaki-dim); }
.card-stats b { color: #ece6d2; }

/* 生產進度：分段式裝填量表 */
.card-progress .bar {
  border: 1px solid #000;
  border-radius: 2px;
  background: #0b0d09;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 240, 0.06);
}
.card-progress .bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(0, 0, 0, 0.5) 9px 10px);
  pointer-events: none;
}
.card-progress .bar i { background: linear-gradient(90deg, #3c6e2e, var(--led-green)); box-shadow: 0 0 8px rgba(121, 194, 90, 0.45); }
.card-progress.ready .bar i { background: linear-gradient(90deg, #a57012, var(--led-amber)); box-shadow: 0 0 8px rgba(255, 180, 58, 0.45); }
.card-progress .status { color: #eae4cf; }

.queue { color: var(--khaki-dim); }
.pips i { background: #0b0d09; border-color: #3b3f33; }

.btn-cancel {
  border: 1px solid #14160f;
  border-radius: 3px;
  background: linear-gradient(#3e4337, #262a22);
  color: #cfc9b5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 240, 0.12);
}
.btn-cancel:hover:not(.off) { color: #fff; border-color: #14160f; background: linear-gradient(#4a5042, #2c3027); }

/* ================= 戰場風格：主畫面與對話框（與控制台同一套軍用外觀） ================= */

/* 主畫面：掃描線、四角戰術框、頂端作戰代號 */
.overlay-menu {
  background:
    repeating-linear-gradient(0deg, rgba(255, 230, 180, 0.025) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, transparent 0%, transparent 60%, rgba(10, 12, 8, 0.94) 67%, rgba(10, 12, 8, 0.97) 100%),
    radial-gradient(ellipse at 50% 42%, rgba(18, 20, 14, 0.5) 0%, rgba(8, 10, 6, 0.9) 70%),
    linear-gradient(90deg, rgba(224, 87, 74, 0.12), transparent 30%, transparent 70%, rgba(76, 147, 230, 0.12));
}
.overlay-menu::before {
  content: "";
  position: absolute;
  inset: 22px;
  pointer-events: none;
  --c: rgba(212, 199, 156, 0.5);
  background:
    linear-gradient(var(--c), var(--c)) left top / 34px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 2px 34px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 34px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 2px 34px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 34px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 2px 34px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 34px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 2px 34px no-repeat;
}
.overlay-menu::after {
  content: "OPERATION · ZERO DAY STRIKE";
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  text-align: center;
  font: 900 13px/1 var(--stencil);
  letter-spacing: 0.5em;
  color: rgba(212, 199, 156, 0.5);
  pointer-events: none;
}

/* 主要按鈕：警示斜紋框的琥珀色發射鈕 */
.primary-btn {
  border: 3px solid transparent;
  border-radius: 4px;
  background:
    linear-gradient(180deg, #f2b33d, #c98516) padding-box,
    repeating-linear-gradient(135deg, var(--hazard) 0 8px, #161512 8px 16px) border-box;
  color: #1b1405;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.45);
  box-shadow: 0 0 0 1px #0d0f0a, 0 6px 24px rgba(242, 179, 61, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.primary-btn:hover {
  background:
    linear-gradient(180deg, #ffc65a, #db9622) padding-box,
    repeating-linear-gradient(135deg, var(--hazard) 0 8px, #161512 8px 16px) border-box;
  box-shadow: 0 0 0 1px #0d0f0a, 0 0 28px rgba(255, 190, 70, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.menu-box .primary-btn.big::before {
  content: "DEPLOY";
  display: block;
  margin-bottom: 3px;
  font: 900 11px/1 var(--stencil);
  letter-spacing: 0.45em;
  padding-left: 0.45em;
  color: rgba(27, 20, 5, 0.65);
  text-shadow: none;
}

/* 次要按鈕：金屬按鈕 */
.secondary-btn {
  border: 1px solid #14160f;
  border-radius: 4px;
  background: linear-gradient(180deg, #4a5041, #2a2e25);
  color: #ece6d2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 240, 0.18), inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.6);
}
.secondary-btn:hover { background: linear-gradient(180deg, #59604d, #343a2e); }
.secondary-btn:active { transform: translateY(1px); }

/* 背景音樂開關：金屬按鈕＋指示燈 */
.music-btn {
  position: relative;
  padding-left: 30px;
  border: 1px solid #14160f;
  border-radius: 4px;
  background: linear-gradient(180deg, #3f4537, #262a22);
  color: #ece6d2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 240, 0.14), 0 1px 2px rgba(0, 0, 0, 0.6);
}
.music-btn::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d7ffc8, var(--led-green) 50%, #2c5a1f);
  box-shadow: 0 0 8px var(--led-green);
}
.music-btn.off::before { background: #4a2a25; box-shadow: none; }
.music-btn:hover { background: linear-gradient(180deg, #4a5041, #2e3229); }
.music-btn.off { color: #8d8a73; }
.music-hint { color: var(--khaki); }

/* 對話框（暫停、結算）：鋼板＋鉚釘＋警示膠帶 */
.dialog {
  position: relative;
  overflow: hidden;
  border: 1px solid #0d0f0a;
  border-radius: 6px;
  background:
    var(--rivet) 6px 12px / 12px 12px no-repeat,
    var(--rivet) calc(100% - 6px) 12px / 12px 12px no-repeat,
    var(--rivet) 6px calc(100% - 6px) / 12px 12px no-repeat,
    var(--rivet) calc(100% - 6px) calc(100% - 6px) / 12px 12px no-repeat,
    repeating-linear-gradient(45deg, rgba(255, 255, 240, 0.022) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, #30352a, #1c2019);
  box-shadow: inset 0 1px 0 rgba(255, 255, 240, 0.14), 0 30px 80px rgba(0, 0, 0, 0.65);
}
.dialog::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 7px;
  background: repeating-linear-gradient(135deg, var(--hazard) 0 10px, #161512 10px 20px);
}
.dialog-title { color: #efe9d6; }
.dialog-sub { color: var(--khaki-dim); }
.result-stats div {
  border: 1px solid #000;
  border-radius: 4px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 200, 120, 0.035) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #060805, #0e120b);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 240, 0.08);
}
.result-stats dt { color: rgba(255, 180, 58, 0.75); }
.result-stats dd { color: var(--led-amber); text-shadow: 0 0 10px rgba(255, 170, 40, 0.5); }

/* ================= 戰績與 AI 等級 ================= */

.ai-level {
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid rgba(255, 154, 143, 0.45);
  border-radius: 2px;
  font: 800 12px/16px var(--num);
  letter-spacing: 0.04em;
  color: #ffb4aa;
  background: rgba(124, 29, 21, 0.35);
  vertical-align: 1px;
}
.wins-block .hud-label { color: #ffd98a; font-size: 13px; }
.wins-block .hud-label::before {
  content: "VICTORIES";
  display: inline-block;
  margin-right: 7px;
  font: 900 9px/1 var(--stencil);
  letter-spacing: 0.18em;
  vertical-align: 2px;
  opacity: 0.6;
}
.hud-wins {
  font: 700 28px/1 var(--num);
  color: #ffd166;
  text-shadow: 0 0 10px rgba(255, 200, 90, 0.4);
  font-variant-numeric: tabular-nums;
}
.hud-wins::before { content: "★"; margin-right: 4px; font-size: 18px; vertical-align: 3px; }
.hud-wins small { margin-left: 3px; font-size: 13px; color: #8d8a73; font-weight: 500; }

.menu-record-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}
.menu-record {
  margin: 0;
  padding: 7px 18px;
  border: 1px solid rgba(212, 199, 156, 0.35);
  border-radius: 3px;
  background: rgba(18, 20, 14, 0.72);
  color: var(--khaki);
  font: 700 16px/1.4 var(--font);
  letter-spacing: 0.16em;
}
.menu-record b { color: var(--led-amber); font-family: var(--num); letter-spacing: 0.04em; }

.dialog.result { min-width: 640px; }
.result-stats { grid-template-columns: repeat(4, 1fr); }
.result-unlock {
  margin: -14px 0 22px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--led-green);
  text-shadow: 0 0 12px rgba(121, 194, 90, 0.5);
}
.result-unlock.hidden { display: none; }
.result-level {
  margin: -18px 0 24px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--led-amber);
}

/* 重設戰績：小型金屬按鈕；確認狀態閃紅 */
.reset-btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid #14160f;
  border-radius: 3px;
  background: linear-gradient(180deg, #3f4537, #262a22);
  color: #cfc9b5;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 240, 0.14), 0 1px 2px rgba(0, 0, 0, 0.6);
}
.reset-btn:hover:not(:disabled) { background: linear-gradient(180deg, #4a5041, #2e3229); color: #fff; }
.reset-btn:disabled { opacity: 0.4; cursor: default; }
.reset-btn.confirm {
  border-color: #8a2a22;
  background: linear-gradient(180deg, #7c2a22, #4d1a15);
  color: #ffd9d3;
  box-shadow: 0 0 12px rgba(224, 87, 74, 0.5);
  animation: reset-blink 0.8s ease-in-out infinite;
}
.reset-btn.done { opacity: 0.8; color: var(--led-green); }
@keyframes reset-blink {
  50% { box-shadow: 0 0 2px rgba(224, 87, 74, 0.2); }
}
@media (prefers-reduced-motion: reduce) {
  .reset-btn.confirm { animation: none; }
}

/* 主畫面「開始戰鬥」加大 */
.menu-box .primary-btn.big {
  min-width: 400px;
  height: 88px;
  font-size: 34px;
  letter-spacing: 0.16em;
  border-width: 4px;
}
.menu-box .primary-btn.big::before { font-size: 13px; margin-bottom: 4px; }

/* 主要按鈕：警示斜紋外框與琥珀色按鈕面之間留一圈深色內框（按鈕面內縮，像嵌在框裡的發射鈕） */
.primary-btn {
  padding: 4px;
  background:
    linear-gradient(180deg, #f2b33d, #c98516) content-box,
    linear-gradient(180deg, #3a3e33, #23261e) padding-box,
    repeating-linear-gradient(135deg, var(--hazard) 0 8px, #161512 8px 16px) border-box;
  box-shadow: 0 0 0 1px #0d0f0a, 0 6px 24px rgba(242, 179, 61, 0.25);
}
.primary-btn:hover {
  background:
    linear-gradient(180deg, #ffc65a, #db9622) content-box,
    linear-gradient(180deg, #3a3e33, #23261e) padding-box,
    repeating-linear-gradient(135deg, var(--hazard) 0 8px, #161512 8px 16px) border-box;
  box-shadow: 0 0 0 1px #0d0f0a, 0 0 28px rgba(255, 190, 70, 0.45);
}
.menu-box .primary-btn.big { padding: 8px; min-width: 440px; height: 108px; }

/* 戰場觀摩：開始戰鬥下方的金屬按鈕 */
.spectate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 240px;
  height: 46px;
  margin: 16px auto 0;
  font-size: 17px;
  letter-spacing: 0.2em;
}
.spectate-btn svg { flex: none; color: var(--khaki); }
.spectate-btn:hover svg { color: var(--led-amber); }

/* ================= 零日勳章：主畫面勳章列、擊敗 Lv.10 的授勳畫面 ================= */

.menu-medals {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  margin-top: 14px;
}
.medal-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 560px; }
.medal-list.small .medal-icon { width: 26px; height: 37px; }
.medal-list.tiny .medal-icon { width: 19px; height: 27px; }
/* 授勳畫面統計框內的小勳章 */
.medal-list.mini { gap: 2px; max-width: none; margin-top: -4px; }
.medal-list.mini .medal-icon { width: 15px; height: 21px; filter: none; }
.medal-list.mini.small .medal-icon { width: 11px; height: 16px; }
.medal-list.mini.tiny .medal-icon { width: 8px; height: 12px; }
.medal-icon { width: 34px; height: 48px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)); }
.medal-icon.locked { filter: grayscale(1) brightness(0.6); opacity: 0.45; }
.medal-icon.fresh { animation: medal-drop 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) 0.2s both, medal-glow 1.4s ease-in-out 1.1s 3; }
.medal-text { color: var(--khaki-dim); font: 700 14px/1.4 var(--font); letter-spacing: 0.12em; }
.menu-medals.has-medals .medal-text { color: #ffd98a; font-size: 16px; }
.medal-text b {
  color: #ffd166;
  font: 800 22px/1 var(--num);
  letter-spacing: 0.02em;
  text-shadow: 0 0 10px rgba(255, 200, 90, 0.5);
}
@keyframes medal-drop {
  from { transform: translateY(-70px) scale(1.9); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes medal-glow {
  50% { filter: drop-shadow(0 0 12px rgba(255, 214, 110, 0.95)); }
}

/* 授勳畫面：金色光芒緩慢旋轉、彩帶飄落，勳章由上方落下並閃過反光 */
.overlay-medal {
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(130, 88, 18, 0.6), rgba(10, 9, 6, 0.94) 60%),
    rgba(4, 6, 9, 0.8);
}
.medal-rays {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 1600px;
  height: 1600px;
  margin: -800px 0 0 -800px;
  background: repeating-conic-gradient(from 0deg, rgba(255, 206, 96, 0.17) 0deg 5deg, transparent 5deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0 10%, transparent 52%);
  mask: radial-gradient(circle, #000 0 10%, transparent 52%);
  animation: medal-rays-spin 60s linear infinite;
}
@keyframes medal-rays-spin { to { transform: rotate(360deg); } }
.medal-confetti { position: absolute; inset: 0; pointer-events: none; }
.medal-confetti i {
  position: absolute;
  top: -24px;
  width: 9px;
  height: 15px;
  border-radius: 1px;
  background: var(--c);
  opacity: 0.9;
  animation: confetti-fall var(--t) linear var(--d) infinite;
}
@keyframes confetti-fall {
  from { transform: translate(0, 0) rotate3d(1, 0.4, 0.2, 0deg) scale(var(--s)); }
  to { transform: translate(var(--x), 960px) rotate3d(1, 0.4, 0.2, 900deg) scale(var(--s)); }
}
.medal-award { position: relative; text-align: center; }
.medal-kicker {
  margin: 0 0 8px;
  font: 900 22px/1 var(--stencil);
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  color: var(--hazard);
  text-shadow: 0 2px 0 #000;
  animation: medal-fade 0.6s ease-out 0.1s both;
}
.medal-art { display: flex; justify-content: center; height: 252px; }
.medal-big {
  width: 180px;
  height: 252px;
  transform-origin: 50% 0;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 30px rgba(255, 200, 80, 0.5));
  animation: medal-award-in 1s cubic-bezier(0.18, 1.35, 0.4, 1) 0.25s both;
}
@keyframes medal-award-in {
  from { transform: translateY(-300px) rotate(-14deg) scale(1.3); opacity: 0; }
  60% { opacity: 1; }
  to { transform: none; opacity: 1; }
}
.medal-big .medal-shine { animation: medal-shine 3.2s ease-in-out 1.3s infinite; }
@keyframes medal-shine {
  0% { transform: translateX(0); }
  45%, 100% { transform: translateX(150px); }
}
.medal-title {
  margin: 12px 0 0;
  font-size: 64px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
  color: #ffd166;
  text-shadow: 0 0 34px rgba(255, 209, 102, 0.55), 0 3px 0 #5a3a08;
  animation: medal-fade 0.6s ease-out 0.9s both;
}
.medal-sub {
  margin: 12px 0 0;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: #efe9d6;
  animation: medal-fade 0.6s ease-out 1.1s both;
}
.medal-sub b { color: #ffd166; font: 800 26px/1 var(--num); }
.medal-note {
  margin: 6px 0 22px;
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--khaki-dim);
  animation: medal-fade 0.6s ease-out 1.2s both;
}
.result-stats.medal-stats {
  width: 640px;
  margin: 0 auto 26px;
  grid-template-columns: repeat(4, 1fr);
  animation: medal-fade 0.6s ease-out 1.35s both;
}
.medal-award .btn-row { animation: medal-fade 0.6s ease-out 1.5s both; }
@keyframes medal-fade {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .medal-rays, .medal-big, .medal-big .medal-shine, .medal-icon.fresh,
  .medal-kicker, .medal-title, .medal-sub, .medal-note, .medal-stats, .medal-award .btn-row { animation: none; }
  .medal-confetti { display: none; }
}
