/* ═══════════════════════════════════════════════════════════════
   RHYTHM BEAT RUNNER — ULTRA PREMIUM NEON 3D STYLE
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;600;700&display=swap');

:root {
  --neon-cyan:   #00f5ff;
  --neon-pink:   #ff00ff;
  --neon-yellow: #ffff00;
  --neon-orange: #ff6600;
  --neon-green:  #00ff88;
  --neon-purple: #bf00ff;
  --neon-red:    #ff0055;
  --bg-dark:     #040008;
  --bg-mid:      #080018;
  --panel:       rgba(0,0,0,0.85);
  --glass:       rgba(255,255,255,0.04);
  --glow-cyan:   0 0 20px #00f5ff, 0 0 40px #00f5ff44, 0 0 80px #00f5ff22;
  --glow-pink:   0 0 20px #ff00ff, 0 0 40px #ff00ff44, 0 0 80px #ff00ff22;
  --glow-yellow: 0 0 20px #ffff00, 0 0 40px #ffff0044;
}

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg-dark);
  font-family: 'Orbitron', monospace;
  color: #fff;
  touch-action: none;
  user-select: none;
}

/* ─── CANVAS ─── */
#gameCanvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  image-rendering: crisp-edges;
}

/* ─── OVERLAY SCREENS ─── */
.screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1a0030 0%, #040008 70%);
  overflow: hidden;
}
.hidden { display: none !important; }

/* Animated neon grid background */
.screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,245,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,255,0.06) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 4s linear infinite;
  pointer-events: none;
}
@keyframes gridMove {
  0%   { background-position: 0 0; }
  100% { background-position: 50px 50px; }
}

/* Parallax orbs behind screen */
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); pointer-events: none; animation: orbFloat ease-in-out infinite;
}
.orb1 { width: 400px; height: 400px; background: rgba(0,245,255,0.12); top: -10%; left: -10%; animation-duration: 8s; }
.orb2 { width: 350px; height: 350px; background: rgba(255,0,255,0.10); top: 30%; right: -8%; animation-duration: 11s; animation-delay: -4s; }
.orb3 { width: 300px; height: 300px; background: rgba(191,0,255,0.09); bottom: -10%; left: 20%; animation-duration: 9s; animation-delay: -2s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-30px) scale(1.05); }
}

/* ─── SPLASH / TITLE SCREEN ─── */
.game-logo {
  position: relative; text-align: center; margin-bottom: 20px;
}
.game-logo-icon {
  font-size: clamp(60px, 16vw, 120px); line-height: 1;
  filter: drop-shadow(0 0 30px #ff00ff) drop-shadow(0 0 60px #00f5ff);
  animation: logoPulse 1.5s ease-in-out infinite;
}
@keyframes logoPulse {
  0%,100% { filter: drop-shadow(0 0 20px #ff00ff) drop-shadow(0 0 40px #00f5ff); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 50px #ff00ff) drop-shadow(0 0 80px #00f5ff) drop-shadow(0 0 120px #ffff0066); transform: scale(1.06); }
}
.game-title {
  font-size: clamp(28px, 7vw, 72px); font-weight: 900; letter-spacing: 4px; line-height: 1;
  background: linear-gradient(135deg, #00f5ff 0%, #ff00ff 50%, #ffff00 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 0 20px rgba(0,245,255,0.5));
  animation: titleShimmer 3s linear infinite;
  background-size: 200% auto;
}
@keyframes titleShimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}
.game-subtitle {
  font-family: 'Rajdhani', sans-serif; font-size: clamp(14px, 3.5vw, 20px);
  letter-spacing: 8px; color: rgba(0,245,255,0.7); margin-top: 6px; text-transform: uppercase;
}
.game-tagline {
  font-family: 'Rajdhani', sans-serif; font-size: clamp(12px, 2.5vw, 16px);
  color: rgba(255,255,255,0.4); letter-spacing: 4px; margin-top: 4px;
}

/* ─── BUTTONS ─── */
.btn-primary {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(0,245,255,0.15), rgba(255,0,255,0.15));
  border: 2px solid transparent;
  border-image: linear-gradient(135deg, #00f5ff, #ff00ff, #ffff00) 1;
  color: #fff; font-family: 'Orbitron', monospace;
  font-size: clamp(13px, 3.5vw, 18px); font-weight: 700; letter-spacing: 4px;
  padding: clamp(14px, 3.5vw, 20px) clamp(36px, 10vw, 64px);
  cursor: pointer;
  clip-path: polygon(12px 0%, 100% 0%, calc(100% - 12px) 100%, 0% 100%);
  transition: all 0.2s; text-transform: uppercase;
  box-shadow: 0 0 30px rgba(0,245,255,0.3), inset 0 0 20px rgba(0,245,255,0.05);
  animation: btnPulse 2s ease-in-out infinite;
}
@keyframes btnPulse {
  0%,100% { box-shadow: 0 0 20px rgba(0,245,255,0.3), inset 0 0 20px rgba(0,245,255,0.05); }
  50%      { box-shadow: 0 0 50px rgba(0,245,255,0.6), 0 0 100px rgba(255,0,255,0.3), inset 0 0 30px rgba(0,245,255,0.08); }
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: translateX(-100%); animation: shimmer 2.5s ease infinite;
}
@keyframes shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }
.btn-primary:hover, .btn-primary:active { transform: scale(1.05); filter: brightness(1.3); }

.btn-secondary {
  background: transparent; border: 1px solid rgba(0,245,255,0.3);
  color: rgba(0,245,255,0.7); font-family: 'Rajdhani', sans-serif;
  font-size: clamp(12px, 3vw, 16px); letter-spacing: 4px;
  padding: 10px 28px; cursor: pointer; border-radius: 4px;
  transition: all 0.2s; text-transform: uppercase;
}
.btn-secondary:hover { border-color: #00f5ff; color: #00f5ff; background: rgba(0,245,255,0.08); }

/* ─── LEVEL SELECT ─── */
.level-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(70px, 15vw, 100px), 1fr));
  gap: 10px; max-height: 55vh; overflow-y: auto; width: 100%; max-width: 640px;
  padding: 8px; scrollbar-width: thin; scrollbar-color: #00f5ff33 transparent;
}
.level-grid::-webkit-scrollbar { width: 4px; }
.level-grid::-webkit-scrollbar-thumb { background: rgba(0,245,255,0.3); border-radius: 2px; }
.level-btn {
  aspect-ratio: 1; background: rgba(0,0,0,0.6);
  border: 1px solid; border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: 'Orbitron', monospace; font-size: clamp(10px, 2.5vw, 14px); font-weight: 700;
  transition: all 0.2s; position: relative; overflow: hidden;
}
.level-btn.locked { border-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.2); cursor: not-allowed; }
.level-btn.unlocked { border-color: rgba(0,245,255,0.4); color: #00f5ff; box-shadow: 0 0 10px rgba(0,245,255,0.2); }
.level-btn.completed { border-color: rgba(0,255,136,0.6); color: #00ff88; box-shadow: 0 0 14px rgba(0,255,136,0.3); }
.level-btn.unlocked:hover { transform: scale(1.08); border-color: #00f5ff; box-shadow: 0 0 20px rgba(0,245,255,0.5); }
.level-stars { font-size: clamp(8px, 2vw, 12px); color: #ffff00; }

/* ─── IN-GAME HUD ─── */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: clamp(8px, 2vw, 14px) clamp(12px, 3vw, 22px);
  background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
  pointer-events: none;
}
#hud.hidden { display: none; }
.hud-block { display: flex; flex-direction: column; gap: 2px; }
.hud-label { font-family: 'Rajdhani', sans-serif; font-size: clamp(8px, 1.8vw, 11px); letter-spacing: 3px; color: rgba(255,255,255,0.4); text-transform: uppercase; }
.hud-value { font-family: 'Orbitron', monospace; font-size: clamp(16px, 4vw, 26px); font-weight: 700; color: #00f5ff; text-shadow: var(--glow-cyan); line-height: 1; }
.hud-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.level-badge {
  background: rgba(0,0,0,0.6); border: 1px solid rgba(0,245,255,0.3);
  padding: 4px 18px; clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
  font-size: clamp(10px, 2.5vw, 14px); letter-spacing: 3px; color: #00f5ff;
}
/* Progress bar */
.progress-wrap { width: clamp(120px, 30vw, 220px); }
.progress-bg { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #00f5ff, #ff00ff, #ffff00); border-radius: 3px; transition: width 0.1s; box-shadow: 0 0 10px #00f5ff; }
.progress-pct { font-family: 'Rajdhani', sans-serif; font-size: 10px; color: rgba(255,255,255,0.4); text-align: center; margin-top: 2px; letter-spacing: 2px; }

/* Beat indicator */
.beat-dots { display: flex; gap: 5px; align-items: center; }
.beat-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.2); transition: all 0.05s; }
.beat-dot.active { background: #00f5ff; box-shadow: 0 0 10px #00f5ff; transform: scale(1.5); }

/* Combo */
.combo-display {
  font-family: 'Orbitron', monospace; font-size: clamp(12px, 3vw, 18px); font-weight: 900;
  color: #ffff00; text-shadow: var(--glow-yellow);
  transition: all 0.1s; transform-origin: center;
}
.combo-display.pop { animation: comboPop 0.2s ease; }
@keyframes comboPop { 0%{transform:scale(1.5)} 100%{transform:scale(1)} }

/* Accuracy */
.accuracy-badge { font-family: 'Rajdhani', sans-serif; font-size: clamp(10px, 2.5vw, 14px); letter-spacing: 2px; }
.acc-perfect { color: #00ff88; text-shadow: 0 0 10px #00ff88; }
.acc-good    { color: #00f5ff; text-shadow: 0 0 10px #00f5ff; }
.acc-ok      { color: #ffff00; }
.acc-miss    { color: #ff0055; }

/* Sound toggle */
#soundBtn {
  position: fixed; top: clamp(10px, 2vw, 16px); right: clamp(10px, 2vw, 16px);
  z-index: 200; background: rgba(0,0,0,0.6); border: 1px solid rgba(0,245,255,0.3);
  color: #00f5ff; font-size: clamp(16px, 4vw, 22px);
  width: clamp(36px, 8vw, 46px); height: clamp(36px, 8vw, 46px);
  border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; pointer-events: all;
}
#soundBtn:hover { border-color: #00f5ff; box-shadow: 0 0 14px rgba(0,245,255,0.4); }

/* Pause button */
#pauseBtn {
  position: fixed; top: clamp(10px, 2vw, 16px); left: clamp(10px, 2vw, 16px);
  z-index: 200; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7); font-size: clamp(14px, 3.5vw, 18px);
  width: clamp(36px, 8vw, 46px); height: clamp(36px, 8vw, 46px);
  border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; pointer-events: all;
}
#pauseBtn:hover { border-color: rgba(255,255,255,0.5); }
#pauseBtn.hidden, #soundBtn.hidden { display: none; }

/* Mobile tap zones */
#tapZone {
  position: fixed; inset: 0; z-index: 40;
  display: none;
}
#tapZone.active { display: block; }

/* ─── PAUSE MENU ─── */
.pause-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}
.pause-title { font-size: clamp(32px, 8vw, 60px); font-weight: 900; color: #ff00ff; text-shadow: var(--glow-pink); letter-spacing: 6px; }
.pause-stats { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.pause-stat { background: rgba(255,255,255,0.05); border: 1px solid rgba(0,245,255,0.2); padding: 12px 20px; text-align: center; border-radius: 6px; }
.ps-val { font-size: clamp(20px, 5vw, 32px); font-weight: 700; color: #00f5ff; }
.ps-lbl { font-family: 'Rajdhani', sans-serif; font-size: 11px; color: rgba(255,255,255,0.4); letter-spacing: 3px; margin-top: 3px; }
.pause-btns { display: flex; flex-direction: column; gap: 12px; width: min(300px, 80vw); }

/* ─── RESULT SCREEN ─── */
.result-icon { font-size: clamp(60px, 16vw, 100px); line-height: 1; margin-bottom: 8px; }
.result-title { font-size: clamp(28px, 7vw, 56px); font-weight: 900; letter-spacing: 6px; margin-bottom: 12px; }
.result-title.win  { color: #00ff88; text-shadow: 0 0 40px #00ff8866; }
.result-title.lose { color: #ff0055; text-shadow: 0 0 40px #ff005566; }
.result-stats { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.result-stat { background: rgba(255,255,255,0.05); border: 1px solid rgba(0,245,255,0.2); padding: 14px 22px; text-align: center; border-radius: 8px; min-width: 100px; }
.stars-row { display: flex; gap: 8px; font-size: clamp(24px, 6vw, 40px); margin: 8px 0; }
.star-filled { color: #ffff00; filter: drop-shadow(0 0 8px #ffff00); }
.star-empty  { color: rgba(255,255,255,0.2); }
.result-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* ─── GUIDE SCREEN ─── */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; width: 100%; max-width: 600px; margin: 16px 0; }
.guide-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(0,245,255,0.2); border-radius: 10px; padding: 16px; text-align: center; transition: all 0.2s; }
.guide-card:hover { border-color: rgba(0,245,255,0.5); background: rgba(0,245,255,0.06); }
.guide-card-icon { font-size: clamp(28px, 7vw, 40px); margin-bottom: 8px; }
.guide-card-title { font-size: clamp(12px, 3vw, 15px); font-weight: 700; color: #00f5ff; letter-spacing: 2px; margin-bottom: 4px; }
.guide-card-desc { font-family: 'Rajdhani', sans-serif; font-size: clamp(11px, 2.5vw, 14px); color: rgba(255,255,255,0.5); line-height: 1.5; }

/* ─── SCREEN HEADERS ─── */
.screen-title {
  font-size: clamp(22px, 6vw, 44px); font-weight: 900; letter-spacing: 5px; text-align: center;
  background: linear-gradient(135deg, #00f5ff, #ff00ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 6px;
}
.screen-sub { font-family: 'Rajdhani', sans-serif; font-size: clamp(11px, 2.5vw, 15px); letter-spacing: 5px; color: rgba(255,255,255,0.4); text-align: center; margin-bottom: 20px; }

/* ─── VISUAL FX OVERLAYS ─── */
#beatFlash {
  position: fixed; inset: 0; pointer-events: none; z-index: 30;
  background: transparent; transition: background 0.05s;
}
#beatFlash.flash { background: rgba(0,245,255,0.06); }

#deathExplosion {
  position: fixed; inset: 0; pointer-events: none; z-index: 30;
  opacity: 0; background: radial-gradient(circle at var(--ex, 50%) var(--ey, 50%), #ff005566 0%, transparent 60%);
  transition: opacity 0.1s;
}
#deathExplosion.boom { opacity: 1; }

/* ─── FLOATING SCORE POPUP ─── */
.score-popup {
  position: fixed; pointer-events: none; z-index: 60;
  font-family: 'Orbitron', monospace; font-weight: 700;
  animation: scoreFloat 0.9s ease-out forwards;
  text-shadow: 0 0 20px currentColor;
}
@keyframes scoreFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1.2); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}

/* ─── CHECKPOINT BANNER ─── */
.checkpoint-banner {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0);
  z-index: 70; text-align: center;
  background: rgba(0,0,0,0.9); border: 2px solid #00ff88;
  padding: clamp(16px, 4vw, 28px) clamp(28px, 8vw, 56px);
  clip-path: polygon(16px 0%, 100% 0%, calc(100% - 16px) 100%, 0% 100%);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 0 40px rgba(0,255,136,0.4);
}
.checkpoint-banner.show { transform: translate(-50%, -50%) scale(1); }
.cp-icon { font-size: clamp(30px, 8vw, 50px); }
.cp-title { font-size: clamp(18px, 5vw, 32px); font-weight: 900; color: #00ff88; letter-spacing: 4px; }
.cp-sub { font-family: 'Rajdhani', sans-serif; font-size: clamp(12px, 3vw, 16px); color: rgba(255,255,255,0.5); letter-spacing: 3px; margin-top: 4px; }

/* ─── TRACK SELECTION ─── */
.track-list { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 480px; max-height: 45vh; overflow-y: auto; }
.track-item {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(0,245,255,0.2);
  border-radius: 8px; padding: 14px 18px; cursor: pointer; display: flex; align-items: center; gap: 14px;
  transition: all 0.2s;
}
.track-item:hover, .track-item.active { border-color: #00f5ff; background: rgba(0,245,255,0.08); box-shadow: 0 0 20px rgba(0,245,255,0.2); }
.track-icon { font-size: clamp(24px, 6vw, 34px); }
.track-info { flex: 1; }
.track-name { font-size: clamp(13px, 3vw, 17px); font-weight: 700; color: #fff; letter-spacing: 2px; }
.track-bpm  { font-family: 'Rajdhani', sans-serif; font-size: clamp(11px, 2.5vw, 14px); color: rgba(0,245,255,0.6); letter-spacing: 2px; margin-top: 2px; }
.track-check { color: #00ff88; font-size: 18px; }

/* ─── BEAT VISUALIZER (bottom bar) ─── */
#beatVisualizer {
  position: fixed; bottom: 0; left: 0; right: 0; height: clamp(40px, 8vw, 60px);
  display: flex; align-items: flex-end; gap: 2px; padding: 0 4px;
  pointer-events: none; z-index: 55;
}
.beat-bar { flex: 1; background: linear-gradient(0deg, #00f5ff, #ff00ff); border-radius: 2px 2px 0 0; transition: height 0.05s; min-height: 2px; opacity: 0.6; }

/* ─── MOBILE JUMP BUTTON ─── */
#mobileJump {
  position: fixed; bottom: clamp(20px, 6vw, 40px); right: clamp(16px, 5vw, 30px);
  z-index: 60;
  width: clamp(64px, 16vw, 88px); height: clamp(64px, 16vw, 88px);
  border-radius: 50%; border: 2px solid rgba(0,245,255,0.6);
  background: radial-gradient(circle, rgba(0,245,255,0.2) 0%, rgba(0,245,255,0.05) 100%);
  display: none; align-items: center; justify-content: center;
  font-size: clamp(22px, 6vw, 32px); cursor: pointer;
  box-shadow: 0 0 20px rgba(0,245,255,0.3), inset 0 0 20px rgba(0,245,255,0.05);
  animation: jumpBtnPulse 2s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
@keyframes jumpBtnPulse {
  0%,100% { box-shadow: 0 0 20px rgba(0,245,255,0.3); }
  50%      { box-shadow: 0 0 40px rgba(0,245,255,0.6), 0 0 70px rgba(255,0,255,0.2); }
}
#mobileJump.active { display: flex; }
#mobileJump:active { transform: scale(0.9); background: radial-gradient(circle, rgba(0,245,255,0.4) 0%, rgba(0,245,255,0.1) 100%); }

/* ─── TOAST NOTIFICATIONS ─── */
.toast {
  position: fixed; top: clamp(60px, 12vw, 85px); left: 50%; transform: translateX(-50%) translateY(-10px);
  background: rgba(0,0,0,0.85); border: 1px solid rgba(0,245,255,0.4);
  color: #00f5ff; font-family: 'Rajdhani', sans-serif;
  font-size: clamp(12px, 3vw, 16px); letter-spacing: 3px;
  padding: 10px 24px; border-radius: 4px; z-index: 300;
  opacity: 0; transition: all 0.3s; pointer-events: none;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── MISC ─── */
.divider { width: clamp(140px, 40vw, 220px); height: 1px; background: linear-gradient(90deg, transparent, #00f5ff, #ff00ff, transparent); margin: 10px 0; }
.neon-text-cyan   { color: #00f5ff; text-shadow: var(--glow-cyan); }
.neon-text-pink   { color: #ff00ff; text-shadow: var(--glow-pink); }
.neon-text-yellow { color: #ffff00; text-shadow: var(--glow-yellow); }
.neon-text-green  { color: #00ff88; text-shadow: 0 0 20px #00ff88; }

/* Screen-specific layouts */
#splashScreen .sp-inner,
#guideScreen .sp-inner,
#levelSelectScreen .sp-inner,
#trackSelectScreen .sp-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  padding: clamp(20px, 5vw, 40px) clamp(16px, 4vw, 32px);
  width: 100%; max-height: 100vh; overflow-y: auto;
}

@media (max-width: 650px) {
  #hud { padding: 12px 10px; align-items: center; }
  .hud-block { display: none; } /* Hide level and best combo block for clean mobile view */
  .hud-center { margin-top: 0; }
  .hud-value { font-size: 28px !important; }
  
  .game-title { font-size: min(12vw, 42px); }
  .game-subtitle { letter-spacing: 4px; font-size: 13px; }
  
  .pause-title, .result-title { font-size: min(12vw, 40px); }
  .pause-overlay { gap: 15px; padding: 15px; overflow-y: auto; justify-content: flex-start; max-height: 100vh; }
  .pause-stats, .result-stats { gap: 8px; margin: 5px 0; display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; max-width: 320px; }
  .pause-stat, .result-stat { padding: 8px; margin: 0; min-width: 0; flex: none; }
  .ps-val { font-size: 22px; }
  
  /* Stack buttons nicely to emulate a native premium app */
  .pause-btns, .result-btns { width: 100%; max-width: 280px; gap: 10px; display: flex; flex-direction: column; align-items: stretch; }
  .btn-primary, .btn-secondary { padding: 14px 20px; font-size: 15px; width: 100%; }
  
  .level-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); padding: 4px; }
  .level-btn { aspect-ratio: 1; min-height: 75px; }

  .guide-grid { grid-template-columns: 1fr; gap: 8px; max-height: 50vh; overflow-y: auto; padding: 0 4px; }
  .guide-card { padding: 14px; display: flex; text-align: left; align-items: center; gap: 12px; }
  .guide-card-icon { margin-bottom: 0; font-size: 32px; }
  
  .sp-inner { padding: 15px 10px; }
}

@media (max-width: 380px) {
  .game-title { font-size: 28px; }
  .result-title { font-size: 28px; }
  .pause-stats, .result-stats { grid-template-columns: 1fr; }
  .track-name { font-size: 14px; }
}

@media (max-height: 500px) {
  /* Mobile Landscape Fixes */
  .game-logo { display: none; } /* Hide big logo to fit menu buttons */
  .pause-overlay, .screen .sp-inner { justify-content: flex-start; padding-top: 20px; }
  .pause-stats, .result-stats { margin: 2px 0; }
  .result-icon { display: none; }
  .level-grid { max-height: 60vh; }
  .guide-grid { grid-template-columns: repeat(2, 1fr); }
  .guide-card { flex-direction: column; text-align: center; }
}
