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

body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: white;
}

#game-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  background: rgba(0,0,0,0.3);
  padding: 10px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.screen {
  background: rgba(255,255,255,0.1);
  border-radius: 15px;
  padding: 40px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

.hidden {
  display: none !important;
}

/* Join Screen */
#join-screen h1 {
  text-align: center;
  font-size: 3em;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#join-screen p {
  text-align: center;
  font-size: 1.2em;
  margin-bottom: 30px;
}

.join-form {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 30px;
}

#player-name {
  padding: 15px;
  font-size: 1.1em;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  color: #333;
  min-width: 200px;
}

#join-btn, #start-game-btn {
  padding: 15px 30px;
  font-size: 1.1em;
  border: none;
  border-radius: 8px;
  background: #ff6b6b;
  color: white;
  cursor: pointer;
  transition: background 0.3s;
}

#join-btn:hover, #start-game-btn:hover {
  background: #ff5252;
}

.game-info {
  background: rgba(0,0,0,0.2);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
}

.game-info p {
  margin: 5px 0;
  font-size: 1em;
}

/* Game Screen */
#game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 15px;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
}

#game-status {
  font-size: 1.3em;
  font-weight: bold;
}

#timer {
  font-size: 1.2em;
  font-family: monospace;
}

/* Race Track */
#race-track {
  position: relative;
  background: #2d5a27;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 30px;
  min-height: 400px;
  overflow: hidden;
}

#finish-line {
  position: absolute;
  right: 20px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: repeating-linear-gradient(
    to bottom,
    #fff 0px,
    #fff 10px,
    #000 10px,
    #000 20px
  );
}

#horses-container {
  position: relative;
  height: 100%;
}

.horse {
  position: absolute;
  left: 20px;
  width: 40px;
  height: 30px;
  background: #8B4513;
  border-radius: 15px;
  transition: left 0.1s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.horse::before {
  content: '🐎';
}

.horse-name {
  position: absolute;
  left: 50px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

/* Controls */
#controls {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
}

#player-status {
  font-size: 1.2em;
  margin-bottom: 10px;
}

#spacebar-hint {
  font-size: 1.5em;
  font-weight: bold;
  color: #ffeb3b;
  animation: pulse 1.5s infinite;
}

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

/* Leaderboard */
#leaderboard {
  background: rgba(0,0,0,0.2);
  padding: 20px;
  border-radius: 10px;
}

#leaderboard h3 {
  margin-bottom: 15px;
  text-align: center;
}

#player-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.player-item {
  background: rgba(255,255,255,0.1);
  padding: 10px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-item.current-player {
  background: rgba(255,235,59,0.3);
  border: 2px solid #ffeb3b;
}

.player-item.winner {
  background: rgba(76,175,80,0.3);
  border: 2px solid #4caf50;
}

.player-state {
  font-size: 0.8em;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0,0,0,0.3);
}

.player-state.playing {
  background: rgba(76,175,80,0.5);
}

.player-state.viewing {
  background: rgba(33,150,243,0.5);
}

.player-state.queued {
  background: rgba(255,152,0,0.5);
}

/* Responsive */
@media (max-width: 768px) {
  #game-container {
    padding: 10px;
  }
  
  .screen {
    padding: 20px;
  }
  
  #join-screen h1 {
    font-size: 2em;
  }
  
  .join-form {
    flex-direction: column;
    align-items: center;
  }
  
  #game-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  #race-track {
    min-height: 300px;
  }
}
