:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #b0b0c0;
  --text-muted: #707080;
  --accent-primary: #00d4ff;
  --accent-gold: #FFD700;
  --danger: #ff4466;
  --success: #00ff88;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 600px;
  height: 600px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  position: absolute; top: 0; left: 0;
}
.screen.hidden { display: none; }

.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
}
.focusable:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 16px var(--focus-glow);
}
.hidden { display: none !important; }

/* === TITLE SCREEN === */
.title-content {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(180deg, #020010 0%, #0a0020 40%, #050015 100%);
  gap: 14px;
}
.title-gems {
  font-size: 40px;
  letter-spacing: 24px;
  background: linear-gradient(90deg, #E0115F, #FF6600, #FFD700, #50C878, #0F52BA, #6F2C91, #E8E8E8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.title-name {
  font-size: 48px; font-weight: 900;
  background: linear-gradient(180deg, #FFFFFF 0%, #aabbff 40%, #4444cc 70%, #220066 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 6px;
  filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.4));
}
.title-sub {
  font-size: 18px; color: var(--text-secondary);
  font-style: italic; text-shadow: 0 1px 3px #000;
}
.title-highscore {
  font-size: 16px; color: var(--accent-gold);
  font-weight: 700; min-height: 22px;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}
.title-btn {
  width: 200px; padding: 14px;
  background: var(--bg-tertiary); border-radius: 8px;
  color: var(--text-primary); font-size: 18px;
  font-weight: 700; text-align: center;
  text-shadow: 0 1px 2px #000;
  border: 2px solid transparent; cursor: pointer;
}
.title-btn:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 16px var(--focus-glow);
  background: var(--bg-card);
}
#mute-btn, #music-btn { font-size: 15px; padding: 10px; width: 180px; }
.title-controls {
  font-size: 14px; color: var(--text-muted);
  margin-top: 4px; text-shadow: 0 1px 2px #000;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* === GAME SCREEN === */
#game-screen { position: relative; width: 600px; height: 600px; }
#game-canvas { position: absolute; top: 0; left: 0; width: 600px; height: 600px; }

/* === HUD BARS === */
.hud-bar {
  position: absolute; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center;
  background: rgba(10, 10, 15, 0.92);
}
.hud-top {
  top: 0; height: 40px; padding: 4px 16px; gap: 12px;
}
.hud-bottom {
  bottom: 0; height: 32px; padding: 6px 16px; gap: 10px;
}

.hud-score, .hud-level {
  display: flex; align-items: center; gap: 6px;
}
.hud-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); letter-spacing: 1px;
  text-shadow: 0 1px 2px #000;
}
.hud-value {
  font-size: 20px; font-weight: 800;
  color: var(--text-primary);
  text-shadow: 0 1px 3px #000;
}
.hud-score .hud-value { color: var(--accent-gold); min-width: 80px; }
.hud-level .hud-value { color: var(--accent-primary); }

.hud-combo {
  flex: 1; text-align: right;
  font-size: 16px; font-weight: 800;
  color: var(--accent-gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* === PROGRESS BAR === */
.progress-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); letter-spacing: 1px;
  text-shadow: 0 1px 2px #000;
  flex-shrink: 0;
}
.progress-track {
  flex: 1; height: 10px;
  background: var(--bg-card);
  border-radius: 5px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), #00ff88);
  border-radius: 5px;
  transition: width 0.3s ease;
}

/* === PAUSE OVERLAY === */
.pause-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.75); z-index: 20;
  display: flex; align-items: center; justify-content: center;
}
.pause-content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--bg-card); padding: 32px 48px;
  border-radius: 12px; border: 1px solid #333;
}
.pause-content h2 {
  font-size: 30px; color: var(--text-primary);
  text-shadow: 0 1px 4px #000;
}
.pause-btn {
  width: 180px; padding: 14px;
  background: var(--bg-tertiary); border-radius: 8px;
  color: var(--text-primary); font-size: 17px;
  font-weight: 700; text-align: center;
  text-shadow: 0 1px 2px #000;
}
.pause-btn:focus { background: var(--bg-card); }
.pause-btn.danger { background: rgba(255,68,102,0.2); color: var(--danger); }
.pause-btn.danger:focus { background: rgba(255,68,102,0.35); }

/* === GAME OVER SCREEN === */
.result-content {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(180deg, #020010 0%, #0a0020 40%, #050015 100%);
  gap: 20px;
}
.result-title {
  font-size: 44px; font-weight: 900;
  color: var(--danger);
  text-shadow: 0 0 20px rgba(255, 68, 102, 0.5), 0 2px 4px #000;
}
.new-highscore {
  font-size: 22px; font-weight: 800;
  color: var(--accent-gold);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
  animation: pulse 1s ease-in-out infinite;
}
.result-stats { display: flex; gap: 20px; }
.result-stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg-card); padding: 12px 20px; border-radius: 8px;
}
.result-label {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.result-value {
  font-size: 24px; font-weight: 800;
  color: var(--accent-primary);
  text-shadow: 0 1px 3px #000;
}
.result-prompt {
  font-size: 18px; color: var(--text-secondary);
  animation: pulse 1.5s ease-in-out infinite;
  margin-top: 12px; font-weight: 600;
  text-shadow: 0 1px 3px #000;
}
