:root {
  --bg-0: #0b0e16;
  --bg-1: #10141f;
  --ring: #232a3b;
  --accent: #ffd23f;
  --accent-2: #ff5d73;
  --good: #46e6a0;
  --text: #e8ecf5;
  --muted: #7c879c;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  /* dark base so no white strip shows when the mobile URL bar shifts */
  background: var(--bg-0);
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 50% -10%, #1b2335 0%, var(--bg-1) 45%, var(--bg-0) 100%);
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- HUD ---------- */
.hud {
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: space-around;
  padding: 22px 16px 6px;
  z-index: 3;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--muted);
  font-weight: 700;
}

.hud-value {
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

#score { color: var(--accent); }
#best  { color: var(--good); }

/* ---------- Stage / Canvas ---------- */
.stage {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  width: min(92vw, 78vh, 560px);
  height: min(92vw, 78vh, 560px);
  touch-action: manipulation;
  cursor: pointer;
}

/* ---------- Overlay ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 11, 18, 0.72);
  backdrop-filter: blur(6px);
  transition: opacity 0.25s ease;
  z-index: 4;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.panel {
  text-align: center;
  padding: 30px 34px;
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.title {
  font-size: clamp(34px, 9vw, 58px);
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 0.92;
  background: linear-gradient(180deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 40px rgba(255, 210, 63, 0.25);
}

.title span {
  display: block;
  font-size: 0.42em;
  letter-spacing: 10px;
  color: var(--accent-2);
  -webkit-text-fill-color: var(--accent-2);
  margin: 4px 0;
}

.subtitle {
  margin: 16px 0 24px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  max-width: 320px;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 18px;
  color: #1a1205;
  padding: 14px 46px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe27a, var(--accent));
  box-shadow: 0 10px 30px rgba(255, 210, 63, 0.35), inset 0 -3px 0 rgba(0,0,0,0.15);
  transition: transform 0.08s ease, box-shadow 0.2s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(0.98); }

.hint {
  margin-top: 22px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

/* ---------- Mute ---------- */
.mute {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  z-index: 5;
  transition: background 0.2s ease, transform 0.08s ease;
}
.mute:hover { background: rgba(255,255,255,0.1); }
.mute:active { transform: scale(0.92); }

.shake { animation: shake 0.32s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}
