:root {
  --bg: #0d0f1a;
  --panel: rgba(20, 24, 44, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --text: #e8ecf8;
  --dim: #8b93b8;
  --accent: #ffb347;
  --accent-2: #4cc9f0;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#app { position: fixed; inset: 0; }

#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* HUD */
#hud {
  position: absolute; top: 14px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 12px;
  pointer-events: none; z-index: 5;
}
.hud-item {
  display: flex; flex-direction: column; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 18px;
  min-width: 92px;
  backdrop-filter: blur(8px);
}
.hud-label {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim);
}
.hud-value {
  font-size: 20px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hud-best .hud-value { color: var(--accent); }

/* Overlay */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(10,12,26,0.55) 0%, rgba(8,9,18,0.88) 100%);
  transition: opacity 0.35s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.overlay-card {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 42px 48px;
  max-width: 420px;
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
}
.overlay-card h1 {
  font-size: 44px; letter-spacing: 0.02em;
  background: linear-gradient(120deg, #ffd166, #ff7b6b 55%, #4cc9f0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 10px;
}
.overlay-sub { color: var(--dim); font-size: 15px; margin-bottom: 26px; line-height: 1.5; }
.overlay-hint { margin-top: 22px; font-size: 12px; color: var(--dim); letter-spacing: 0.03em; }
.btn-primary {
  font-family: inherit; font-size: 18px; font-weight: 700;
  color: #16181f; background: linear-gradient(135deg, #ffd166, #ffb347);
  border: none; border-radius: 12px;
  padding: 14px 44px; cursor: pointer;
  box-shadow: 0 6px 24px rgba(255,179,71,0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(255,179,71,0.45); }
.btn-primary:active { transform: translateY(0); }

.mute-btn {
  position: absolute; bottom: 18px; right: 18px; z-index: 6;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text); font-size: 20px; cursor: pointer;
  transition: transform 0.12s ease;
}
.mute-btn:hover { transform: scale(1.08); }
.mute-btn.muted { color: var(--dim); text-decoration: line-through; }

.overlay.hidden ~ .mute-btn { opacity: 0.85; }

@media (max-width: 640px) {
  .overlay-card { padding: 30px 26px; margin: 0 20px; }
  .overlay-card h1 { font-size: 34px; }
  .hud-item { min-width: 70px; padding: 6px 10px; }
  .hud-value { font-size: 16px; }
  #hud { gap: 8px; top: 10px; }
}
