* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #08111d;
  --panel: rgba(9, 18, 31, 0.86);
  --panel-2: rgba(15, 29, 47, 0.94);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f8fafc;
  --muted: #aab8c9;
  --lime: #b7f56a;
  --cyan: #53d5ff;
  --gold: #ffd166;
}
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(83, 213, 255, 0.16), transparent 28%),
    radial-gradient(circle at 84% 14%, rgba(255, 209, 102, 0.15), transparent 30%),
    linear-gradient(155deg, #08111d 0%, #12334a 46%, #18202f 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button {
  border: 0;
  cursor: pointer;
  color: #07111d;
  font-weight: 850;
  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.48; filter: grayscale(0.45); }
.wrap {
  width: min(1040px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 16px 0 22px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 8px 8px;
  background: var(--panel);
  backdrop-filter: blur(14px);
}
h1 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.25rem); letter-spacing: 0; }
p { margin: 0; }
.top p { margin-top: 4px; color: var(--muted); font-size: 0.95rem; }
#restartBtn {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), #fb923c);
}
.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.pill span { color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.pill strong { font-size: 1.18rem; color: #fff; white-space: nowrap; }
.stage-shell {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: #08111d;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}
#game-stage {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 72vh;
  min-height: 420px;
}
#game-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 0.5fr)) minmax(260px, 1fr);
  gap: 10px 12px;
  align-items: center;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 16px 16px;
  background: var(--panel);
}
#leftBtn, #rightBtn, #rewardBtn {
  min-height: 50px;
  border-radius: 12px;
  padding: 0 18px;
  font-size: 0.96rem;
}
#leftBtn, #rightBtn { background: linear-gradient(135deg, var(--cyan), #2dd4bf); }
#rewardBtn { background: linear-gradient(135deg, var(--gold), var(--lime)); }
#statusText {
  color: #e2e8f0;
  font-weight: 800;
  min-height: 24px;
}
#rewardNote {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}
@media (max-width: 760px) {
  .wrap { width: min(100vw - 16px, 620px); padding-top: 8px; }
  .top { align-items: flex-start; padding: 13px; }
  #restartBtn { min-height: 38px; padding: 0 13px; }
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pill { min-height: 46px; }
  #game-stage { min-height: 360px; max-height: 68vh; }
  .controls { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 12px; }
  #statusText, #rewardNote { grid-column: 1 / -1; }
}
