* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #090e1a;
  --panel: rgba(13, 20, 36, 0.84);
  --panel-2: rgba(19, 31, 54, 0.90);
  --line: rgba(255, 255, 255, 0.13);
  --text: #f8fafc;
  --muted: #aab7ca;
  --accent: #fbbf24;
  --accent-2: #38bdf8;
}
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(251, 191, 36, 0.20), transparent 28%),
    radial-gradient(circle at 86% 8%, rgba(56, 189, 248, 0.22), transparent 32%),
    linear-gradient(145deg, #090e1a 0%, #17243f 50%, #2b1746 100%);
}
button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
  transition: transform 140ms ease, opacity 140ms ease, filter 140ms ease;
}
button:active { transform: translateY(1px) scale(0.99); }
button:disabled { cursor: not-allowed; opacity: 0.46; filter: grayscale(0.35); }
.wrap {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 22px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px 20px 12px 12px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.24);
}
h1 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.35rem); letter-spacing: 0; }
p { margin: 0; }
.top p { margin-top: 4px; color: var(--muted); font-size: 0.95rem; }
#restartBtn, #rewardBtn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  color: #15110a;
  background: linear-gradient(135deg, #fbbf24, #fb7185);
  box-shadow: 0 12px 30px rgba(251, 191, 36, 0.18);
}
.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.hud-card {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hud-card span { color: var(--muted); font-size: 0.82rem; font-weight: 800; }
.hud-card strong { color: #fff; font-size: 1.3rem; }
.stage-shell {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px;
  background: #09111f;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
}
#game-stage {
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 420px;
}
#game-stage canvas { display: block; width: 100%; height: 100%; }
.controls {
  display: grid;
  grid-template-columns: minmax(210px, 0.65fr) 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px 12px 20px 20px;
  background: var(--panel);
}
#rewardBtn { background: linear-gradient(135deg, #38bdf8, #a78bfa); color: #07111f; }
.status { color: #e6edf7; font-weight: 800; min-height: 24px; line-height: 1.45; }
@media (max-width: 720px) {
  .wrap { width: min(100vw - 16px, 680px); padding-top: 8px; }
  .top { align-items: flex-start; padding: 13px; }
  #restartBtn { min-height: 38px; padding: 0 13px; }
  .hud { grid-template-columns: 1fr; }
  .hud-card { min-height: 48px; }
  #game-stage { min-height: 360px; aspect-ratio: 3 / 4; }
  .controls { grid-template-columns: 1fr; }
}
