:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #111827;
  --panel: #18202f;
  --panel-2: #202b3d;
  --line: #4b5a72;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #22c55e;
  --gold: #fbbf24;
  --danger: #fb7185;
  --blue: #60a5fa;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 0%, #263449 0%, var(--bg) 42%, #0b1020 100%); color: var(--text); }
.shell { width: min(1420px, 100%); min-height: 100vh; margin: 0 auto; padding: 14px; display: grid; grid-template-rows: auto auto minmax(360px, 1fr) auto auto; gap: 10px; }
.topbar, .controls, .skillbar, .status-grid article, .team-panel, .reward-panel { background: rgba(24,32,47,.94); border: 1px solid rgba(203,213,225,.18); border-radius: 8px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 48px; height: 48px; flex: 0 0 auto; }
h1, h2, p { margin: 0; letter-spacing: 0; }
h1 { font-size: 24px; line-height: 1.15; }
h2 { font-size: 15px; margin-bottom: 8px; color: #e5e7eb; }
.brand p, .scorebar, .status-grid p, #log { color: var(--muted); }
.scorebar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.scorebar span { min-height: 32px; display: inline-grid; place-items: center; padding: 4px 10px; background: #0f172a; border: 1px solid rgba(203,213,225,.18); border-radius: 999px; white-space: nowrap; }
button { min-height: 44px; border: 0; border-radius: 8px; padding: 0 14px; background: #e5e7eb; color: #111827; font-weight: 800; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
button[aria-pressed="true"], button.active { background: var(--accent); }
.controls, .skillbar { display: grid; grid-template-columns: repeat(7, minmax(112px, 1fr)); gap: 8px; padding: 8px; }
.skillbar { grid-template-columns: repeat(5, minmax(120px, 1fr)); }
.battle-wrap { display: grid; grid-template-columns: minmax(180px, 240px) 1fr minmax(180px, 260px); gap: 10px; min-height: 0; }
.team-panel, .reward-panel { padding: 10px; overflow: auto; }
.card-list, .reward-grid { display: grid; gap: 8px; }
.cat-card, .reward-card { min-height: 54px; background: var(--panel-2); border: 1px solid rgba(203,213,225,.18); border-radius: 8px; padding: 8px; }
.cat-card strong, .reward-card strong { display: block; color: #fff; }
.cat-card small, .reward-card small { color: var(--muted); }
.arena { position: relative; min-height: 420px; overflow: hidden; background: linear-gradient(180deg, rgba(15,23,42,.7), rgba(17,24,39,.95)), url("./assets/enemy_wave.svg"); background-size: cover; border: 1px solid rgba(203,213,225,.18); border-radius: 8px; }
.lane { position: absolute; left: 0; right: 0; height: 1px; background: rgba(248,250,252,.18); }
.l1 { top: 28%; } .l2 { top: 50%; } .l3 { top: 72%; }
.boss-warning { position: absolute; top: 10px; left: 10px; right: 10px; min-height: 36px; display: grid; place-items: center; border-radius: 8px; background: rgba(251,191,36,.14); border: 1px solid rgba(251,191,36,.5); color: #fde68a; font-weight: 800; z-index: 2; }
.units { position: absolute; inset: 0; }
.unit { position: absolute; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); font-weight: 900; box-shadow: 0 10px 22px rgba(0,0,0,.25); transition: transform .08s linear, opacity .12s linear; }
.cat { background: #facc15; color: #111827; }
.enemy { background: #fb7185; color: #111827; }
.boss { width: 58px; height: 58px; background: #c084fc; }
.hit { filter: brightness(1.35); }
.status-grid { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 10px; min-height: 110px; }
.status-grid article { padding: 10px; }
#log { min-height: 80px; max-height: 120px; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.35; }
@media (max-width: 900px) {
  .shell { grid-template-rows: auto auto auto auto auto; padding: 10px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .scorebar { justify-content: flex-start; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skillbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .battle-wrap { grid-template-columns: 1fr; }
  .team-panel, .reward-panel { max-height: none; }
  .arena { min-height: 400px; }
  .status-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .shell { padding: 8px; gap: 8px; }
  h1 { font-size: 21px; }
  .brand img { width: 42px; height: 42px; }
  .controls, .skillbar { grid-template-columns: 1fr 1fr; }
  button { padding: 0 10px; font-size: 13px; }
  .arena { min-height: 380px; }
}
