:root { --hud-h: 64px; }
:root {
  --bg: #0f1220;
  --panel: #171a2b;
  --text: #eaeef7;
  --accent: #7dd3fc;
}

html, body { height: 100dvh; overflow: hidden; width: 100vw; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(1200px 800px at 20% 10%, #1b2040 0%, var(--bg) 60%);
  color: var(--text);
  font: 500 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.hud {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 10px 14px;
  background: color-mix(in oklab, var(--panel), black 12%);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.title {
  font-weight: 700;
  font-size: clamp(14px, 4vw, 18px);
  letter-spacing: .4px;
}

.spacer { flex: 1; }

.btn {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: color-mix(in oklab, var(--panel), black 8%);
  color: var(--text);
  cursor: pointer;
  font-size: clamp(12px, 3.2vw, 14px);
}

.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn-accent { border-color: #7dd3fc66; box-shadow: 0 0 0 2px #7dd3fc22 inset; }

.leaderboard {
  width: min(100vw - 16px, 720px);
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--panel), black 16%);
  border: 1px solid rgba(255,255,255,.06);
}

.leaderboard .heading {
  grid-column: 1 / -1;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.5);
}
.modal[aria-hidden="false"] { display: flex; }
.modal-card {
  width: min(90vw, 420px);
  background: color-mix(in oklab, var(--panel), black 12%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.modal-header { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.modal-title { font-weight: 700; }
.modal-body { padding: 14px 16px; display: grid; gap: 8px; }
.modal-body input {
  background: color-mix(in oklab, var(--panel), black 8%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 10px;
}
.modal-actions { padding: 12px 16px; display: flex; justify-content: flex-end; gap: 10px; }

canvas#game {
  width: min(720px, calc(100vw - 16px), calc(100dvh - var(--hud-h) - 16px));
  height: auto;
  aspect-ratio: 1 / 1;
  background: color-mix(in oklab, var(--panel), black 20%);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  image-rendering: pixelated;
  touch-action: none;
}

@media (max-width: 640px) {
  body { gap: 6px; }
  .hud { gap: 8px; padding: 6px 8px; width: calc(100vw - 16px); }
  .leaderboard { display: none; }
  canvas#game {
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    width: auto;
    height: min(calc(100dvh - var(--hud-h) - 12px), 900px);
    aspect-ratio: 1 / 1;
    max-width: calc(100vw - 12px);
  }
}

/* HUD pop animations */
@keyframes popInOut {
  0% { transform: scale(1); }
  30% { transform: scale(1.2); }
  70% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

.hud .score.pop span,
.hud .combo.pop span {
  display: inline-block;
  animation: popInOut 260ms ease-out;
}



