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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1b26;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  display: block;
  touch-action: none;           /* let JS own touch gestures */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border-radius: 6px;
}

.hidden { display: none !important; }

/* ---- HUD ---- */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  pointer-events: none;         /* clicks fall through to canvas... */
}

#score-box {
  font-size: 30px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  background: rgba(15, 40, 60, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  padding: 4px 18px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#score-box .unit { font-size: 16px; margin-left: 3px; opacity: 0.85; }

#acorn-box {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 19px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  background: rgba(15, 40, 60, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  padding: 7px 16px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#mute-btn {
  pointer-events: auto;         /* ...except the mute button */
  background: rgba(15, 40, 60, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  width: 42px; height: 42px;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.12s ease, background 0.12s ease;
}
#mute-btn:hover { background: rgba(15, 40, 60, 0.55); }
#mute-btn:active { transform: scale(0.92); }

/* ---- Overlays (start / game over) ---- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 30, 45, 0.35);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.panel {
  text-align: center;
  color: #fff;
  padding: 26px 24px 22px;
  width: min(88%, 330px);
  background: linear-gradient(180deg, rgba(22, 52, 74, 0.82), rgba(12, 32, 48, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.panel h1 {
  font-size: 46px;
  letter-spacing: 1px;
  text-shadow: 0 3px 0 #5c3a1a, 0 7px 16px rgba(0, 0, 0, 0.45);
  color: #ffcf6b;
}

.panel .tag { font-size: 20px; margin: 10px 0 18px; }
.panel .how { font-size: 15px; line-height: 1.5; opacity: 0.92; margin-bottom: 22px; }
.panel .controls { font-size: 13px; opacity: 0.75; margin-top: 16px; }

.score-line { font-size: 22px; margin: 6px 0; }

.new-best {
  font-size: 22px;
  font-weight: bold;
  color: #ffcf6b;
  margin: 4px 0 8px;
  animation: pulse 0.9s ease-in-out infinite;
}

/* ---- Leaderboard ---- */
.board { margin: 16px 0 6px; }
.board h2 {
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 0.5px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.scores {
  list-style: none;
  text-align: left;
  max-width: 240px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  padding: 6px 10px;
}
.scores li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  padding: 3px 4px;
  border-radius: 6px;
}
.scores li .rank { width: 18px; opacity: 0.7; font-weight: bold; }
.scores li .pts { flex: 1; font-weight: bold; }
.scores li .date { opacity: 0.6; font-size: 12px; }
.scores li.me { background: rgba(255, 207, 107, 0.28); }
.scores li.me .pts { color: #ffe39a; }
.scores li.empty { justify-content: center; opacity: 0.7; font-size: 13px; }

.cta {
  display: inline-block;
  margin-top: 6px;
  padding: 12px 24px;
  background: linear-gradient(180deg, #ffdd8e, #ffc75a);
  color: #3a2410;
  font-weight: bold;
  font-size: 16px;
  border-radius: 30px;
  box-shadow: 0 4px 0 #c99a3a, 0 8px 18px rgba(0, 0, 0, 0.3);
  transition: filter 0.12s ease;
}
.overlay:hover .cta { filter: brightness(1.06); }

.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
