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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #121212;
  color: #fff;
  background-image: radial-gradient(circle at center, #222222 0%, #121212 100%);
  overflow-x: hidden;
}

#game-mode-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 10px;
  border-radius: 10px;
  backdrop-filter: blur(5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

#game-mode-selector button {
  margin: 0 10px;
  padding: 10px 20px;
  background-color: #333;
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s;
}

#game-mode-selector button:hover {
  background-color: #555;
}

#multiplayer-label {
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  color: #4CAF50;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  border-radius: 12px;
  background-color: #2c2c2c;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: transparent;
  border-radius: 12px;
  transition: 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .slider::before {
  transform: translateX(26px);
  background-color: #4CAF50;
}

#game-container {
  position: relative;
  margin: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  border-radius: 5px;
  overflow: hidden;
}

#game-board {
  border: 2px solid #333;
  background-color: #000;
  background-image: 
    linear-gradient(to right, rgba(50, 50, 50, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(50, 50, 50, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

#stats {
  position: absolute;
  top: -40px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-size: 1.2em;
  font-weight: bold;
  padding: 5px 10px;
  background-color: rgba(0,0,0,0.3);
  border-radius: 10px;
  backdrop-filter: blur(5px);
}

#game-over {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3em;
  color: #ff4444;
  text-shadow: 0 0 10px rgba(255,0,0,0.7);
  background-color: rgba(0,0,0,0.7);
  padding: 20px 40px;
  border-radius: 10px;
  display: none;
  animation: pulse 1.5s infinite;
}

#speed-instructions {
  text-align: center;
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 15px;
  margin-bottom: 15px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  backdrop-filter: blur(5px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 100%;
  z-index: 10;
}

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

#leaderboard {
  position: fixed;
  top: 80px;
  right: 20px;
  margin-top: 0;
  background-color: rgba(0,0,0,0.3);
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  backdrop-filter: blur(5px);
  max-width: 250px;
  width: auto;
  z-index: 100;
}

#leaderboard h3 {
  text-align: center;
  margin-bottom: 5px;
  color: #4CAF50;
  font-size: 1.2em;
}

#leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

#leaderboard-table th, #leaderboard-table td {
  border: 1px solid rgba(51, 51, 51, 0.5);
  padding: 5px 8px;
  text-align: left;
}