:root {
  --lime: #d7ff18;
  --ink: #090b0c;
  --panel: #141816;
  --line: rgba(255,255,255,.12);
  --muted: #9ba29b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: #f5f7ef;
  background: #090b0c;
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
}
.game-shell { min-height: 100vh; display: grid; grid-template-rows: 72px 1fr; }
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 72px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #101310;
}
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: 1.5px; font-size: 14px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--lime); color: #10120b; font-size: 21px; font-weight: 900;
  clip-path: polygon(18% 0,100% 0,82% 100%,0 100%);
}
.mission { color: var(--muted); font-size: 12px; letter-spacing: 2px; }
.mission b { color: var(--lime); font-size: 18px; margin-left: 8px; }
.shop-toggle {
  justify-self: end; height: 40px; min-width: 150px; border: 1px solid var(--line);
  background: #1a1e1a; color: #fff; font-weight: 800; cursor: pointer;
}
.coin, .shop-balance span { color: #ffd84d; margin: 0 5px; }
.battlefield { position: relative; width: 100%; min-height: calc(100vh - 72px); background: #20251f; }
#gameCanvas {
  display: block; width: 100%; height: 100%;
  min-height: calc(100vh - 72px); cursor: crosshair; image-rendering: auto;
}
.hud {
  position: absolute; left: 26px; right: 26px; top: 18px;
  display: flex; justify-content: space-between; pointer-events: none;
}
.health-box, .wave-box {
  min-width: 230px; padding: 10px 12px; background: rgba(8,10,9,.78);
  border-left: 3px solid var(--lime); backdrop-filter: blur(5px);
}
.health-box span, .wave-box span { display: block; color: var(--muted); font-size: 10px; letter-spacing: 2px; }
.health-box strong { display: block; margin-top: 5px; font-size: 11px; }
.health-track { height: 7px; margin-top: 7px; background: #30352f; }
.health-track i { display: block; width: 100%; height: 100%; background: var(--lime); transition: width .15s; }
.wave-box { text-align: right; border-left: 0; border-right: 3px solid #ff5d55; }
.wave-box strong { display: block; color: #fff; margin-top: 5px; font-size: 14px; }
.controls {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; gap: 18px; padding: 8px 12px; color: #bcc2b9;
  background: rgba(8,10,9,.72); font-size: 11px; pointer-events: none;
}
kbd { display: inline-grid; width: 20px; height: 20px; place-items: center; margin-right: 2px;
  border: 1px solid #777d73; background: #242824; color: #fff; }
.mouse-icon { display: inline-block; width: 12px; height: 16px; margin-right: 5px;
  border: 2px solid #aaa; border-radius: 7px; vertical-align: middle; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  opacity: 0; visibility: hidden; background: rgba(5,7,6,.78); backdrop-filter: blur(8px);
  transition: .2s;
}
.overlay.open { opacity: 1; visibility: visible; }
.panel { width: min(560px, calc(100% - 40px)); border: 1px solid var(--line); background: #111511; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.start-panel { padding: 42px; }
.start-panel h1 { margin: 0; font-size: 72px; line-height: .82; letter-spacing: -5px; transform: skew(-4deg); }
.start-panel h1 em { color: transparent; -webkit-text-stroke: 1px #fff; }
.start-panel p:not(.eyebrow) { max-width: 420px; color: var(--muted); line-height: 1.8; }
.eyebrow { color: var(--lime); font-size: 10px; letter-spacing: 3px; text-transform: uppercase; }
.primary {
  height: 48px; margin-top: 12px; border: 0; padding: 0 28px; background: var(--lime);
  color: #10120b; font-weight: 900; cursor: pointer; clip-path: polygon(7% 0,100% 0,93% 100%,0 100%);
}
.shop-panel { width: min(900px, calc(100% - 40px)); max-height: 90vh; overflow-y: auto; padding: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: start; }
.panel-head h2, .result-panel h2 { margin: 4px 0 0; font-size: 32px; }
.close-button { width: 38px; height: 38px; border: 1px solid var(--line); background: #242824; color: #fff; font-size: 22px; cursor: pointer; }
.shop-balance { display: flex; justify-content: space-between; margin: 18px 0 12px; padding: 12px; background: #1b211b; color: var(--muted); }
.shop-balance strong { color: #fff; }
.shop-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.refresh-button { min-height: 40px; padding: 0 16px; border: 1px solid var(--lime); background: transparent; color: var(--lime); font-weight: 800; cursor: pointer; white-space: nowrap; }
.refresh-button:disabled { border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.stock-heading { margin: 18px 0 9px; color: #d7ddd4; font-size: 13px; letter-spacing: 1px; }
.weapon-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.weapon-card { min-height: 165px; padding: 16px; border: 1px solid var(--line); background: #171b18; }
.weapon-card.owned { border-color: rgba(215,255,24,.5); }
.weapon-list.owned-list { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.owned-list .weapon-card { min-height: 150px; }
.rarity { color: #b7c0b4; font-size: 10px; letter-spacing: 1px; }
.rarity-稀有 { color: #ffad63; }
.rarity-史詩 { color: #d38bff; }
.weapon-card h3 { margin: 7px 0 5px; }
.weapon-card p { min-height: 42px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.weapon-card button { width: 100%; height: 38px; border: 0; background: #343a34; color: #fff; font-weight: 800; cursor: pointer; }
.weapon-card button.afford { background: var(--lime); color: #10120b; }
.weapon-card button:disabled { cursor: default; color: #d7dbd3; }
.empty-stock { grid-column: 1 / -1; color: var(--muted); }
.result-panel { width: min(440px, calc(100% - 40px)); padding: 36px; text-align: center; }
@media (max-width: 700px) {
  .topbar { grid-template-columns: 1fr auto; }
  .mission { display: none; }
  .brand strong { display: none; }
  .weapon-list { grid-template-columns: 1fr; }
  .shop-actions { align-items: stretch; flex-direction: column; }
  .weapon-list { grid-template-columns: 1fr; }
  .health-box { min-width: 160px; }
  .wave-box { min-width: 120px; }
  .controls { display: none; }
  .start-panel h1 { font-size: 54px; }
}
