/* ============================================================
   GLOBAL RESTRICTIONS & RESET
============================================================ */
* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  touch-action: none;
  background: #0d2b0e;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

canvas { display: block; }

/* ============================================================
   OVERLAY LAYER
============================================================ */
#overlay {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ============================================================
   HUD
============================================================ */
#hud {
  position: absolute; top: 0; left: 0;
  width: 100%; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none; z-index: 20;
}

.stats-box {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.18);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.12);
  color: #fff;
  min-width: 120px;
}

#score-display {
  font-size: 26px; font-weight: 900;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  letter-spacing: -0.5px;
}

#high-score-display {
  font-size: 13px; font-weight: 700;
  color: #ffd700; margin-top: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

#right-hud {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: auto;
}

/* Combo meter */
#combo-wrap {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.18);
  min-width: 120px; text-align: right;
}

#combo-label {
  font-size: 12px; font-weight: 800;
  color: #ff6b6b; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 4px;
}

#combo-val {
  font-size: 22px; font-weight: 900;
  color: #fff; transition: transform 0.08s;
  text-shadow: 0 0 12px rgba(255,100,100,0.7);
}

#combo-bar-bg {
  width: 100%; height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px; margin-top: 5px; overflow: hidden;
}

#combo-bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff6b6b, #ffd700);
  border-radius: 4px;
  transition: width 0.1s linear, background 0.3s;
}

/* Powerup HUD */
#powerup-hud {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  padding: 6px 10px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.18);
  font-size: 12px; font-weight: 700;
  color: #7fffb2; display: none;
  align-items: center; gap: 6px;
  text-shadow: 0 0 8px rgba(127,255,178,0.6);
}

#powerup-hud.active { display: flex; }

/* Pause button */
#btn-pause {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255,255,255,0.18);
  color: #fff; font-size: 18px;
  width: 44px; height: 44px;
  border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}

#btn-pause:active { transform: scale(0.9); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }

/* ============================================================
   SCREEN OVERLAYS (Start / Countdown / Pause / Game Over)
============================================================ */
.screen {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  z-index: 50; opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.screen.visible { opacity: 1; pointer-events: auto; }

/* Start Screen */
#start-screen {
  background: radial-gradient(ellipse at 50% 80%, rgba(10,40,12,0.97) 0%, rgba(5,20,6,0.99) 100%);
}

.game-logo {
  font-size: clamp(42px, 10vw, 72px);
  font-weight: 900; letter-spacing: -1px;
  color: #7fff4f;
  text-shadow: 0 0 30px rgba(127,255,79,0.5), 0 4px 0 #1a4a0f, 3px 3px 0 rgba(0,0,0,0.4);
  margin: 0 0 6px; text-align: center;
  animation: logoPulse 2.5s ease-in-out infinite;
}

@keyframes logoPulse {
  0%,100% { text-shadow: 0 0 30px rgba(127,255,79,0.5), 0 4px 0 #1a4a0f; }
  50% { text-shadow: 0 0 60px rgba(127,255,79,0.8), 0 4px 0 #1a4a0f; }
}

.game-subtitle {
  font-size: 16px; color: rgba(255,255,255,0.5);
  font-weight: 600; margin: 0 0 36px; letter-spacing: 2px;
  text-transform: uppercase;
}

.start-instructions {
  font-size: 15px; color: rgba(255,255,255,0.65);
  font-weight: 600; margin: 0 0 36px;
  text-align: center; line-height: 1.7;
  padding: 0 20px;
}

.start-instructions span { color: #ffd700; }

/* Stats on start screen */
.start-stats {
  display: flex; gap: 20px; margin-bottom: 36px;
}

.stat-pill {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px; padding: 10px 16px;
  text-align: center;
}

.stat-pill .sp-val {
  font-size: 22px; font-weight: 900; color: #7fff4f;
}

.stat-pill .sp-lbl {
  font-size: 10px; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 1px; margin-top: 2px;
}

/* Buttons */
.btn-primary {
  padding: 16px 52px;
  font-size: 22px; font-weight: 900;
  background: linear-gradient(135deg, #7fff4f, #4caf50);
  color: #0d2b0e;
  border: 3px solid rgba(0,0,0,0.3);
  border-radius: 14px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.4), 0 0 30px rgba(127,255,79,0.3);
  cursor: pointer; letter-spacing: 1px;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-primary:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.4);
}

.btn-secondary {
  padding: 12px 32px;
  font-size: 16px; font-weight: 800;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  cursor: pointer; margin-top: 12px;
  transition: transform 0.1s, background 0.1s;
}

.btn-secondary:active { transform: scale(0.95); background: rgba(255,255,255,0.18); }

/* Sound toggle */
#sound-toggle {
  position: absolute; bottom: 72px; right: 20px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.18);
  color: #fff; font-size: 20px;
  width: 44px; height: 44px;
  border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 30; pointer-events: auto;
  transition: transform 0.1s;
}

#sound-toggle:active { transform: scale(0.9); }

/* Countdown */
#countdown-screen { background: transparent; }

#countdown-num {
  font-size: clamp(100px, 30vw, 180px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 60px rgba(127,255,79,0.8), 0 6px 0 rgba(0,0,0,0.5);
  animation: countAnim 0.9s ease-out forwards;
}

@keyframes countAnim {
  0% { transform: scale(1.5); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.6); opacity: 0; }
}

/* Pause screen */
#pause-screen { background: rgba(0,0,0,0.75); backdrop-filter: blur(6px); }
.pause-title {
  font-size: 48px; font-weight: 900; color: #fff;
  margin-bottom: 32px; letter-spacing: 2px;
}

/* Game Over */
#gameover-screen { background: rgba(0,0,0,0.85); backdrop-filter: blur(6px); }

.go-title {
  font-size: clamp(36px, 10vw, 60px);
  font-weight: 900; color: #ff6b6b;
  margin: 0 0 8px;
  text-shadow: 0 0 30px rgba(255,107,107,0.5);
  animation: goShake 0.5s ease-out;
}

@keyframes goShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.go-score {
  font-size: clamp(44px, 12vw, 80px);
  font-weight: 900; color: #fff;
  text-shadow: 0 0 20px rgba(255,255,255,0.3);
  margin: 0 0 4px;
}

.go-best {
  font-size: 16px; color: #ffd700;
  font-weight: 700; margin-bottom: 28px;
}

.go-stats {
  display: flex; gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
  justify-content: center;
}

.go-stat {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 10px; padding: 10px 16px; text-align: center;
}

.go-stat .gs-val { font-size: 20px; font-weight: 900; color: #7fff4f; }
.go-stat .gs-lbl { font-size: 10px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 1px; }

/* Achievements */
.achievement-toast {
  position: absolute; top: 80px; left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a0a00; font-size: 14px; font-weight: 800;
  padding: 10px 20px; border-radius: 50px;
  box-shadow: 0 4px 20px rgba(255,200,0,0.5);
  z-index: 60; white-space: nowrap;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.achievement-toast.show { transform: translateX(-50%) translateY(0); }

/* Home Button — exact as original */
.btn-home {
  position: absolute;
  bottom: 20px; right: 20px;
  padding: 12px 24px;
  background: #fff; color: #333;
  font-size: 16px; font-weight: bold;
  border: 3px solid #333; border-radius: 8px;
  box-shadow: 0 4px 0 #333; cursor: pointer;
  pointer-events: auto; z-index: 20;
  transition: transform 0.1s;
}

.btn-home:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #333;
}

/* Level badge */
#level-badge {
  position: absolute; top: 14px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255,255,255,0.18);
  color: #ffd700; font-size: 12px;
  font-weight: 800; padding: 5px 14px;
  border-radius: 20px; letter-spacing: 1px;
  pointer-events: none; z-index: 20;
  text-transform: uppercase;
  transition: transform 0.3s, color 0.3s;
}
