:root {
  --primary: #00B894;
  --secondary: #55EFC4;
  --accent: #E17055;
  --bg: #0A1A14;
  --surface: rgba(10, 26, 20, 0.8);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --border-radius: 12px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  overflow: hidden;
  user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none; /* Let clicks pass through to canvas if needed, but screens will override */
}

/* HUD */
#hud {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.hud-item {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 20px;
  border-radius: var(--border-radius);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-center {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

#score-value, #multiplier-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

#combo-display {
  text-align: center;
  animation: pulse 0.1s ease-out;
}

#combo-value {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  color: var(--secondary);
  text-shadow: 0 0 20px rgba(85, 239, 196, 0.5);
}

/* Screens */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(10, 26, 20, 0.9);
  backdrop-filter: blur(20px);
  opacity: 1;
  transition: opacity var(--transition);
  pointer-events: auto;
}

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

h1.title {
  font-size: 5rem;
  font-weight: 900;
  margin-bottom: 2rem;
  background: linear-gradient(45deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(0, 184, 148, 0.3);
}

h2 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.menu-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 300px;
}

.btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #000;
  box-shadow: 0 0 20px rgba(0, 184, 148, 0.4);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.controls-hint {
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Results Grid */
.results-container {
  background: rgba(255, 255, 255, 0.05);
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 500px;
  margin-bottom: 2rem;
  display: flex;
  gap: 2rem;
  align-items: center;
}

.grade-display {
  font-size: 8rem;
  font-weight: 900;
  color: var(--secondary);
  text-shadow: 0 0 30px var(--secondary);
}

.stats-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row span:last-child {
  font-weight: 700;
}

.stat-row.perfect { color: #00CEC9; }
.stat-row.great { color: #00B894; }
.stat-row.good { color: #FAB1A0; }
.stat-row.miss { color: #FF7675; }

/* Song List */
.scroll-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 600px;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 2rem;
  padding-right: 10px;
}

.song-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid transparent;
}

.song-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
  border-color: var(--primary);
}

.song-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.song-artist {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.song-bpm {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 5px 10px;
  border-radius: 4px;
  color: var(--secondary);
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.hidden {
    display: none !important;
}
