/* ===== CSS Variables ===== */
:root {
  --nametune-maroon: #8B2252;
  --nametune-maroon-light: #C2185B;
  --nametune-maroon-dark: #5D1538;
  --white: #FFFFFF;
  --black: #000000;
  --gray: #666666;
  --gray-light: #CCCCCC;
  --gray-dark: #333333;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;

  --font-logo: 'Michroma', sans-serif;
  --font-sans: 'Open Sans', sans-serif;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #2d1f3d 100%);
  color: var(--white);
}

/* ===== Audio Enable Overlay ===== */
.audio-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.audio-overlay.hidden {
  display: none;
}

.audio-prompt {
  text-align: center;
  padding: 3rem;
}

.audio-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 2rem;
  color: var(--nametune-maroon-light);
}

.audio-icon svg {
  width: 100%;
  height: 100%;
}

.audio-prompt h2 {
  font-family: var(--font-logo);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.audio-prompt p {
  color: var(--gray);
  margin-bottom: 2rem;
}

.btn {
  padding: 1rem 3rem;
  border: none;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--nametune-maroon-light) 0%, var(--nametune-maroon) 100%);
  color: var(--white);
}

.btn-primary:hover {
  transform: scale(1.05);
}

/* ===== Hidden YouTube Player ===== */
#youtube-player-container {
  position: fixed;
  top: -1000px;
  left: -1000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ===== Screens ===== */
.screen {
  display: none;
  height: 100vh;
  padding: 3rem;
}

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

/* ===== Title ===== */
.title {
  font-family: var(--font-logo);
  font-size: 4rem;
  background: linear-gradient(135deg, var(--nametune-maroon-light) 0%, var(--nametune-maroon) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 2rem;
}

/* ===== Waiting Screen ===== */
.waiting-content {
  text-align: center;
}

.room-code-display {
  margin-bottom: 3rem;
}

.room-label {
  display: block;
  font-size: 1rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.room-code {
  display: block;
  font-family: var(--font-logo);
  font-size: 5rem;
  color: var(--nametune-maroon-light);
  letter-spacing: 8px;
}

.player-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.player-card {
  background: rgba(0, 0, 0, 0.3);
  padding: 1.5rem 2rem;
  border-radius: 12px;
  min-width: 150px;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.player-card.connected {
  border-color: var(--success);
  background: rgba(40, 167, 69, 0.1);
}

.player-card .name {
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.player-card .status {
  font-size: 0.875rem;
  color: var(--gray);
}

.player-card.connected .status {
  color: var(--success);
}

.waiting-text {
  color: var(--gray);
  font-size: 1.25rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ===== Playing Screen ===== */
.playing-content {
  width: 100%;
  max-width: 1200px;
  text-align: center;
}

.song-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
}

.song-counter {
  font-size: 1.5rem;
  color: var(--gray-light);
}

.mode-badge {
  background: var(--nametune-maroon);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.visualizer-container {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  padding: 4rem;
  margin-bottom: 3rem;
}

.now-playing {
  margin-bottom: 2rem;
}

.now-playing-text {
  font-family: var(--font-logo);
  font-size: 2rem;
  color: var(--nametune-maroon-light);
  animation: glow 2s infinite;
}

@keyframes glow {
  0%, 100% { text-shadow: 0 0 10px rgba(194, 24, 91, 0.3); }
  50% { text-shadow: 0 0 30px rgba(194, 24, 91, 0.8); }
}

.visualizer {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  height: 150px;
}

.visualizer .bar {
  width: 20px;
  background: linear-gradient(to top, var(--nametune-maroon-dark), var(--nametune-maroon-light));
  border-radius: 4px;
  animation: none;
  height: 20px;
}

.visualizer.playing .bar {
  animation: visualize 0.5s ease-in-out infinite alternate;
}

.visualizer .bar:nth-child(1) { animation-delay: 0s; }
.visualizer .bar:nth-child(2) { animation-delay: 0.1s; }
.visualizer .bar:nth-child(3) { animation-delay: 0.2s; }
.visualizer .bar:nth-child(4) { animation-delay: 0.15s; }
.visualizer .bar:nth-child(5) { animation-delay: 0.25s; }
.visualizer .bar:nth-child(6) { animation-delay: 0.05s; }
.visualizer .bar:nth-child(7) { animation-delay: 0.3s; }
.visualizer .bar:nth-child(8) { animation-delay: 0.1s; }
.visualizer .bar:nth-child(9) { animation-delay: 0.2s; }
.visualizer .bar:nth-child(10) { animation-delay: 0.15s; }
.visualizer .bar:nth-child(11) { animation-delay: 0.25s; }
.visualizer .bar:nth-child(12) { animation-delay: 0.05s; }

@keyframes visualize {
  from { height: 20px; }
  to { height: 150px; }
}

/* ===== Scoreboard ===== */
.scoreboard {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.score-card {
  background: rgba(0, 0, 0, 0.2);
  padding: 1.5rem 2rem;
  border-radius: 12px;
  min-width: 150px;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.score-card.active {
  border-color: var(--nametune-maroon-light);
  background: rgba(139, 34, 82, 0.2);
}

.score-card.buzzed {
  border-color: var(--warning);
  background: rgba(255, 193, 7, 0.2);
  animation: pulse-border 1s infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 193, 7, 0.3); }
  50% { box-shadow: 0 0 25px rgba(255, 193, 7, 0.6); }
}

.score-card .player-name {
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.score-card .player-score {
  font-family: var(--font-logo);
  font-size: 2rem;
  color: var(--nametune-maroon-light);
}

/* ===== Buzzed Screen ===== */
.buzzed-content {
  text-align: center;
}

.buzzed-player {
  font-family: var(--font-logo);
  font-size: 5rem;
  background: linear-gradient(135deg, var(--nametune-maroon-light) 0%, var(--nametune-maroon) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  animation: pop 0.3s ease;
}

@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.buzzed-label {
  font-size: 2rem;
  color: var(--gray-light);
  margin-bottom: 3rem;
}

/* ===== Bidding Screen ===== */
.bidding-content {
  text-align: center;
  width: 100%;
  max-width: 1000px;
}

.bidding-title {
  font-family: var(--font-logo);
  font-size: 2.5rem;
  color: var(--nametune-maroon-light);
  margin-bottom: 3rem;
}

.bid-display {
  background: rgba(0, 0, 0, 0.3);
  padding: 3rem;
  border-radius: 20px;
  margin-bottom: 2rem;
}

.current-bidder {
  font-family: var(--font-logo);
  font-size: 3rem;
  color: var(--white);
  margin-bottom: 1rem;
}

.bid-amount {
  color: var(--gray-light);
  font-size: 1.5rem;
}

.bid-seconds {
  font-family: var(--font-logo);
  font-size: 4rem;
  color: var(--nametune-maroon-light);
  margin: 0 0.5rem;
}

.turn-indicator {
  color: var(--gray);
  font-size: 1.25rem;
  margin-bottom: 3rem;
}

.turn-name {
  font-weight: 600;
  color: var(--white);
}

/* ===== Challenge Screen ===== */
.challenge-content {
  text-align: center;
}

.challenge-banner {
  font-family: var(--font-logo);
  font-size: 3rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--nametune-maroon-light) 0%, var(--nametune-maroon) 100%);
  padding: 1.5rem 4rem;
  border-radius: 16px;
  margin-bottom: 3rem;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.challenge-info {
  font-size: 2rem;
  margin-bottom: 3rem;
}

.challenged-name {
  font-family: var(--font-logo);
  font-size: 3rem;
  color: var(--nametune-maroon-light);
}

.challenge-timer {
  font-family: var(--font-logo);
  font-size: 6rem;
  color: var(--white);
  display: block;
  margin: 1rem 0;
  animation: countdown 1s ease infinite;
}

@keyframes countdown {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.challenge-text {
  color: var(--gray-light);
}

#challenge-visualizer {
  margin-top: 2rem;
}

/* ===== Reveal Screen ===== */
.reveal-content {
  text-align: center;
  width: 100%;
  max-width: 1000px;
}

.reveal-label {
  font-size: 1.5rem;
  color: var(--gray);
  margin-bottom: 1rem;
}

.song-title {
  font-family: var(--font-logo);
  font-size: 3rem;
  color: var(--white);
  margin-bottom: 0.5rem;
  animation: reveal 0.5s ease;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.song-artist {
  font-size: 2rem;
  color: var(--nametune-maroon-light);
  margin-bottom: 3rem;
  animation: reveal 0.5s ease 0.2s both;
}

/* ===== Winner Screen ===== */
.winner-content {
  text-align: center;
  z-index: 10;
}

.winner-title {
  font-family: var(--font-logo);
  font-size: 3rem;
  color: var(--white);
  margin-bottom: 1rem;
}

.winner-name {
  font-family: var(--font-logo);
  font-size: 5rem;
  background: linear-gradient(135deg, var(--nametune-maroon-light) 0%, var(--nametune-maroon) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.winner-score {
  font-size: 2rem;
  color: var(--gray-light);
  margin-bottom: 3rem;
}

.final-standings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 2rem;
  border-radius: 16px;
  min-width: 400px;
}

.standings-row {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  border-radius: 8px;
}

.standings-row.winner {
  background: rgba(139, 34, 82, 0.3);
}

.standings-row .name {
  font-weight: 600;
}

.standings-row .score {
  font-family: var(--font-logo);
  color: var(--nametune-maroon-light);
}

/* ===== Confetti ===== */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  animation: fall 3s linear forwards;
}

@keyframes fall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* ===== Hidden Utility ===== */
.hidden {
  display: none !important;
}
