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

body {
  font-family: 'Arial', sans-serif;
  overflow: hidden;
  background: #0f0f1e;
}

.screen {
  display: none;
  width: 100vw;
  height: 100vh;
}

.screen.active {
  display: flex;
}

#waiting-screen {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

#waiting-screen.active {
  justify-content: center;
  align-items: center;
}

.back-btn-waiting {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  border-radius: 20px;
  font-size: 1em;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.back-btn-waiting:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.waiting-content {
  text-align: center;
  padding: 50px 60px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 900px;
  min-height: 600px;
}

.waiting-content h1 {
  font-size: 2.5em;
  margin-bottom: 30px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

#qr-container {
  margin: 20px 0;
  padding: 20px;
  background: white;
  border-radius: 15px;
  display: inline-block;
}

#qr-code {
  display: block;
  width: 200px;
  height: 200px;
}

.code-display {
  margin-top: 20px;
}

.code-display p {
  font-size: 1em;
  margin-bottom: 10px;
  opacity: 0.9;
}

.code {
  font-size: 2.5em;
  font-weight: bold;
  letter-spacing: 0.2em;
  padding: 15px 30px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  display: inline-block;
}

.selectors-container {
  display: flex;
  gap: 20px;
  margin-top: 25px;
  justify-content: center;
}

.song-selector {
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  flex: 1;
  max-width: 400px;
}

.song-selector label {
  display: block;
  font-size: 1em;
  margin-bottom: 8px;
  font-weight: bold;
}

.song-selector select {
  width: 100%;
  padding: 10px 15px;
  font-size: 0.95em;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  border-radius: 10px;
  cursor: pointer;
  outline: none;
}

.song-selector select option {
  background: #667eea;
  color: white;
}

#game-screen {
  position: relative;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#status-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  gap: 15px;
}

.status-left {
  display: flex;
  gap: 15px;
  align-items: center;
}

.status-right {
  display: flex;
  gap: 15px;
  align-items: center;
}

#connection-status {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 1em;
  backdrop-filter: blur(10px);
}

#lives-display {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 1.2em;
  backdrop-filter: blur(10px);
  min-width: 80px;
  text-align: center;
}

#song-name {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 1em;
  backdrop-filter: blur(10px);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#calibrate-btn {
  background: rgba(102, 126, 234, 0.9);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

#calibrate-btn:hover {
  background: rgba(102, 126, 234, 1);
  transform: translateY(-2px);
}

.back-btn-game {
  background: rgba(200, 0, 0, 0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 1em;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.back-btn-game:hover {
  background: rgba(200, 0, 0, 1);
  transform: translateY(-2px);
}

#gameover-screen {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
}

#gameover-screen.active {
  justify-content: center;
  align-items: center;
}

.gameover-content {
  text-align: center;
  padding: 60px 40px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 30px;
  backdrop-filter: blur(15px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-width: 600px;
}

.gameover-content h1 {
  font-size: 4em;
  margin-bottom: 40px;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
  animation: pulse 2s infinite;
}

.gameover-stats {
  margin-bottom: 40px;
  font-size: 1.3em;
}

.stat-line {
  margin: 15px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.stat-line span {
  font-weight: bold;
  color: #667eea;
  font-size: 1.2em;
}

.gameover-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-gameover {
  padding: 15px 35px;
  font-size: 1.1em;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  font-family: 'Arial', sans-serif;
}

#retry-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

#retry-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-home {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid white;
}

.btn-home:hover {
  background: white;
  color: #1a1a2e;
  transform: translateY(-3px);
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes countdownPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

@keyframes flash {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
  }
}
