/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #05090c;
  --neon: #4dffb8;
  --neon-2: #00c9ff;
  --text: #e8f6f0;
  --muted: #6d8a7e;
  --panel: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
}

body {
  background:
    radial-gradient(1200px 800px at 50% -10%, rgba(77, 255, 184, 0.07), transparent 60%),
    radial-gradient(900px 700px at 90% 110%, rgba(0, 201, 255, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.stage {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 800;
  letter-spacing: 0.14em;
  background: linear-gradient(90deg, var(--neon), var(--neon-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(77, 255, 184, 0.35));
}

.scores { display: flex; gap: 10px; }

.score-box {
  min-width: 86px;
  text-align: center;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.score-box.best { border-color: rgba(255, 77, 109, 0.25); }

.score-box .label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.score-box .value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.score-box.best .value { color: #ff8fa3; }

@keyframes pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.score-box.pop { animation: pop 0.3s ease; }

/* ---------- Frame & canvas ---------- */
.frame {
  position: relative;
  width: 100%;
  max-width: 504px;
  margin: 0 auto;
  border-radius: 22px;
  padding: 10px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(77, 255, 184, 0.08),
    0 30px 80px rgba(0, 0, 0, 0.65),
    0 0 90px rgba(77, 255, 184, 0.05);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: #05090c;
  touch-action: none;
}

/* ---------- Overlay ---------- */
.overlay {
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  background: rgba(4, 8, 10, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s;
  cursor: pointer;
  z-index: 2;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.overlay h2 {
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 800;
  letter-spacing: 0.12em;
  background: linear-gradient(90deg, var(--neon), var(--neon-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 20px rgba(77, 255, 184, 0.4));
}

.overlay p {
  color: var(--muted);
  font-size: 14px;
  max-width: 30ch;
  line-height: 1.5;
}

.overlay button {
  margin-top: 6px;
  padding: 12px 34px;
  border-radius: 999px;
  border: 1px solid rgba(77, 255, 184, 0.5);
  background: rgba(77, 255, 184, 0.08);
  color: var(--neon);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.overlay button:hover {
  background: rgba(77, 255, 184, 0.18);
  box-shadow: 0 0 24px rgba(77, 255, 184, 0.35);
  transform: translateY(-1px);
}

.overlay button:active { transform: translateY(0) scale(0.97); }

/* ---------- Hint ---------- */
.hint {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.03em;
}
