:root {
  --bg: #08091f;
  --panel: rgba(18, 24, 58, 0.78);
  --panel-strong: #151b44;
  --text: #f7f4ff;
  --muted: #b8b8d8;
  --accent: #72f7d1;
  --accent-2: #ff71ce;
  --warn: #ffd166;
  --danger: #ff5f7e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 113, 206, 0.30), transparent 30%),
    radial-gradient(circle at 85% 4%, rgba(114, 247, 209, 0.26), transparent 26%),
    radial-gradient(circle at 50% 95%, rgba(119, 86, 255, 0.28), transparent 36%),
    linear-gradient(145deg, #090a22 0%, #111438 54%, #08091f 100%);
  display: grid;
  place-items: center;
  padding: 16px;
}

.game-shell {
  width: min(100%, 1080px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  padding: clamp(14px, 2.3vw, 26px);
  background: linear-gradient(180deg, rgba(22, 28, 70, 0.86), rgba(10, 12, 36, 0.84));
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.hero { text-align: center; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
  text-shadow: 0 0 24px rgba(255, 113, 206, 0.35);
}
.subtitle { margin: 10px auto 18px; max-width: 680px; color: var(--muted); }

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stat {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(8, 10, 31, 0.62);
}
.stat span { display: block; color: var(--muted); font-size: 0.78rem; }
.stat strong { display: block; margin-top: 2px; font-size: clamp(1.3rem, 4vw, 2rem); }
.timer strong { color: var(--warn); }

.instructions {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 18px;
  color: #e9e6ff;
  background: rgba(114, 247, 209, 0.10);
  border: 1px solid rgba(114, 247, 209, 0.18);
}

.stage-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: #07081c;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 36px rgba(114, 247, 209, 0.08);
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
  cursor: crosshair;
}
#toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 9px 14px;
  border-radius: 999px;
  color: #091022;
  font-weight: 900;
  background: linear-gradient(90deg, var(--accent), #a8ff78);
  box-shadow: 0 12px 36px rgba(114, 247, 209, 0.25);
  pointer-events: none;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}
button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  color: #071021;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px rgba(255, 113, 206, 0.22);
  cursor: pointer;
}
button:active { transform: translateY(1px) scale(0.99); }
#status { margin: 0; color: var(--muted); text-align: right; }

@media (max-width: 720px) {
  body { padding: 8px; }
  .game-shell { border-radius: 20px; }
  .hud { grid-template-columns: repeat(2, 1fr); }
  .instructions { font-size: 0.92rem; }
  .actions { align-items: stretch; flex-direction: column; }
  #status { text-align: center; }
  #toast { width: max-content; max-width: calc(100% - 24px); bottom: 8px; font-size: 0.88rem; }
}
