:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(18, 24, 45, 0.88);
  --panel-strong: rgba(28, 35, 62, 0.96);
  --line: rgba(203, 213, 225, 0.18);
  --text: #f8fafc;
  --muted: #aebbd0;
  --accent: #a78bfa;
  --accent-2: #22d3ee;
  --warn: #fb7185;
  --good: #4ade80;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.15), transparent 32%),
    linear-gradient(225deg, rgba(245, 158, 11, 0.1), transparent 30%),
    linear-gradient(180deg, #0b1020, #111827 58%, #0a1020 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

button { appearance: none; }

.shell {
  width: min(1260px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 30px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(25, 31, 56, 0.96), rgba(13, 20, 38, 0.9));
  box-shadow: 0 20px 70px rgba(8, 15, 30, 0.34);
}

.eyebrow {
  margin: 0 0 8px;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 800;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.75rem);
  line-height: 1;
  letter-spacing: 0;
}

.summary {
  margin-top: 10px;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions,
.spell-list,
.upgrade-list { display: grid; gap: 8px; }
.hero-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }

button {
  min-height: 40px;
  border: 1px solid rgba(167, 139, 250, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(38, 46, 78, 0.96), rgba(18, 27, 48, 0.96));
  color: var(--text);
  font: inherit;
  font-weight: 800;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

button:hover { transform: translateY(-1px); border-color: rgba(34, 211, 238, 0.45); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.hud {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stat,
.panel,
.tips > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.stat {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.stat span,
.panel-note,
.tips p { color: var(--muted); }

.battle-wrap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.75fr);
  gap: 12px;
}

.stage-shell {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(180deg, #101e35, #0b1525);
  box-shadow: 0 20px 64px rgba(2, 10, 22, 0.42);
}

#game-stage,
#game-stage canvas { width: 100%; height: 100%; display: block; }

.sidepanel { display: grid; gap: 10px; }
.panel { padding: 14px; }
.panel h2 { margin-bottom: 10px; font-size: 1rem; }

.spell-list button,
.upgrade-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
}

.spell-list span,
.upgrade-list span { color: #d8b4fe; font-size: 0.85rem; white-space: nowrap; }
#message { min-height: 66px; line-height: 1.55; }

.tips {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tips > div { padding: 14px; }
.tips h2 { margin-bottom: 8px; font-size: 1rem; }
.tips p { line-height: 1.6; }

@media (max-width: 980px) {
  .hero,
  .battle-wrap,
  .tips { grid-template-columns: 1fr; display: grid; }
  .hero { align-items: stretch; }
  .hero-actions,
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 14px, 1260px); padding-top: 10px; }
  .hero-actions,
  .hud,
  .tips { grid-template-columns: 1fr; }
  button { padding: 12px; }
}
