/* General Styles */
body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background-color: #f0f0f0;
  position: relative;
  transition:
    background-color 0.5s ease,
    background 0.5s ease; /* Add transition for background changes */
}

.container {
  width: 60%;
  max-width: 500px;
  margin: auto auto 0;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  box-sizing: border-box;
  flex: 0 0 auto;
}

@media (max-width: 600px) {
  .container {
    width: 95%;
    padding: 10px;
    margin: 0 auto;
  }
}

h1 {
  color: #2f2bb2;
  font-size: 2em;
  margin-top: 0;
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  h1 {
    font-size: 1.5em;
  }
}

h2 {
  color: #2f2bb2;
  font-size: 1.2em;
  margin-top: 0;
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  h2 {
    font-size: 1em;
  }
}

p {
  line-height: 1.6;
  color: #555;
}

ul {
  margin: 10px 0;
  padding-left: 20px;
}
li {
  line-height: 1.6;
  color: #555;
}

.version {
  font-size: 0.7em;
  color: #a6a6a6;
}

button {
  padding: 15px 20px;
  margin: 5px;
  font-size: 14px;
  font-weight: bold;
  border: 1px solid #ccc;
  border-radius: 5px;
  cursor: pointer;
  background-color: #007bff;
  touch-action: manipulation;
}

@media (max-width: 600px) {
  button {
    padding: 12px 16px;
    font-size: 12px;
  }
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Navigation Buttons (Back to Home, Instructions) */
.back-button {
  position: absolute;
  top: 45px;
  left: 10px;
}

.back-button a {
  display: inline-block;
  padding: 8px 16px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: white;
  background-color: #007bff;
  border: none;
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 0.3s;
  touch-action: manipulation;
}

@media (max-width: 600px) {
  .back-button {
    top: 10px;
    left: 10px;
  }

  .back-button a {
    padding: 6px 12px;
    font-size: 12px;
  }
}

.back-button a:hover {
  background-color: #0056b3;
}

.race-selector {
  display: inline-block; /* Allows width/height and margin/padding to work */
  background-color: #007bff; /* Green background (adjust as needed) */
  border: none; /* Remove default button border */
  color: white; /* White text */
  padding: 20px 10px; /* Padding around the text */
  text-decoration: none; /* Remove underline from link */
  cursor: pointer; /* Change cursor to a hand on hover */
  border-radius: 5px; /* Rounded corners (optional) */
  font-size: 14px; /* Set font size */
  margin: 10px; /* Add margin around each button */
  width: 110px;
  touch-action: manipulation;
}

@media (max-width: 600px) {
  .race-selector {
    padding: 15px 8px;
    font-size: 12px;
    margin: 5px;
    width: 90px;
  }
}

.race-selector:hover {
  background-color: #0056b3;
}

.race-selector-multi {
  background-color: #5c00fc;
}

.race-selector-multi:hover {
  background-color: #4201b2;
}

/* Race Control UI Elements */
.settings {
  margin-bottom: 15px;
}

.settings label {
  font-size: 16px;
  margin-right: 8px;
  color: #333;
}

.settings select {
  padding: 5px 10px;
  font-size: 14px;
  border-radius: 5px;
  border: 1px solid #ccc;
  background-color: white;
  cursor: pointer;
  touch-action: manipulation;
}

@media (max-width: 600px) {
  .settings {
    margin-bottom: 10px;
  }

  .settings label {
    font-size: 14px;
    margin-right: 5px;
  }

  .settings select {
    font-size: 12px;
    padding: 3px 8px;
  }
}

.start {
  padding: 10px 20px;
  font-size: 20px;
  font-weight: bold;
  color: white;
  background-color: #28a745;
  border: none;
  border-radius: 5px;
  margin-left: 10px;
  touch-action: manipulation;
}

@media (max-width: 600px) {
  .start {
    padding: 8px 16px;
    font-size: 16px;
    margin-left: 5px;
  }
}

.start:hover {
  background-color: #218838;
}

.timer {
  font-size: 36px;
  font-weight: bold;
  margin: 15px 0;
  color: #333;
}

@media (max-width: 600px) {
  .timer {
    font-size: 28px;
    margin: 10px 0;
  }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
}

.controls button {
  padding: 15px 10px;
  font-size: 16px;
  font-weight: bold;
  color: white;
  border: none;
  border-radius: 5px;
  min-width: 100px;
  width: 100px;
  touch-action: manipulation;
}

@media (max-width: 600px) {
  .controls {
    gap: 5px;
    margin: 10px 0;
  }

  .controls button {
    padding: 10px 8px;
    font-size: 14px;
    min-width: 80px;
    width: 80px;
  }
}

/* Checkerboard pattern for race end */
.checkerboard {
  background:
    linear-gradient(
      45deg,
      black 25%,
      transparent 25%,
      transparent 75%,
      black 75%,
      black
    ),
    linear-gradient(45deg, black 25%, white 25%, white 75%, black 75%, black);
  background-size: 200px 200px; /* Size of the checkerboard squares */
  background-position:
    0 0,
    100px 100px; /* Offset for the second gradient to create checkerboard */
}

#yellowFlag {
  background-color: #f1c40f;
}

#yellowFlag:hover {
  background-color: #dab10e;
}

#redFlag {
  background-color: #e74c3c;
}

#redFlag:hover {
  background-color: #c0392b;
}

#restart {
  background-color: #6c757d;
}

#restart:hover {
  background-color: #5a6268;
}

/* Voice Selector */
.voice-selector {
  margin: 20px auto;
  text-align: center;
  font-family: Arial, sans-serif;
}

.voice-selector label {
  font-size: 18px;
  margin-right: 10px;
  color: #333;
}

.voice-selector select {
  padding: 5px 10px;
  font-size: 16px;
  border-radius: 5px;
  border: 1px solid #ccc;
  background-color: white;
  cursor: pointer;
}

/* Flag Count Display */
#flagCountDisplay {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 10px;
  max-width: 300px;
  margin: 20px auto;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

#flagCountDisplay h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #333;
}

#flagCountDisplay p {
  margin: 5px 0;
  font-size: 16px;
  color: #555;
}

/* Audio Unlock Modal */
#audioUnlockModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#audioUnlockModal div {
  background: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  max-width: 80%;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

#audioUnlockModal h2 {
  margin: 0 0 15px 0;
  font-family: Arial, sans-serif;
  color: #333;
}

#audioUnlockModal p {
  margin: 0 0 20px 0;
  font-family: Arial, sans-serif;
  color: #555;
}

#unlockAudioButton {
  padding: 10px 20px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background-color: #007bff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#unlockAudioButton:hover {
  background-color: #0056b3;
}

/* Firefox Recommendation Message */
#firefoxRecommendation {
  display: none;
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 10px;
  margin: 10px 0;
  text-align: center;
  border-radius: 5px;
  font-family: Arial, sans-serif;
  max-width: 90%;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

#firefoxRecommendation p {
  margin: 0;
}

#dismissRecommendation {
  margin-top: 5px;
  padding: 5px 10px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

#dismissRecommendation:hover {
  background-color: #0056b3;
}

/* Visual Notifications for Audio Fallback */
@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  10% {
    opacity: 1;
    transform: translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.visual-notification {
  background-color: #fff;
  border: 2px solid #007bff;
  border-radius: 5px;
  padding: 10px 20px;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  margin: 10px auto;
  text-align: center;
  max-width: 300px;
  animation: fadeInOut 3s forwards;
}

#visualNotificationContainer {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

/* Footer */
.footer {
  width: 100%;
  text-align: center;
  margin-top: auto;
  font-size: 12px;
  color: #666;
  padding: 10px 0;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .footer {
    font-size: 10px;
    padding: 5px 0;
  }
}

.footer a {
  color: #007bff;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Countdown Display */
.countdown-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 150px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  z-index: 1001;
  animation: countdownPulse 1s ease-out;
  pointer-events: none;
}

@media (max-width: 600px) {
  .countdown-display {
    font-size: 80px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  }
}

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

/* Special styling for "GO!" */
.countdown-display.go {
  color: #2ecc71;
  font-size: 180px;
}

@media (max-width: 600px) {
  .countdown-display.go {
    font-size: 100px;
  }
}
/* Practice Mode Section Styling */
.practice-mode-section {
  margin: 15px 0;
  text-align: center;
}

.practice-checkbox-label {
  display: inline-flex;
  align-items: center;
  font-size: 18px;
  color: #333;
  cursor: pointer;
  user-select: none;
}

.practice-checkbox-label input[type="checkbox"] {
  margin-right: 8px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Practice Mode Indicator - update positioning */
.practice-mode-indicator {
  background-color: #9b59b6;
  color: white;
  padding: 5px 15px;
  border-radius: 5px;
  font-weight: bold;
  margin: 10px auto;
  display: inline-block;
  text-align: center;
}

/* Ensure the timer has proper spacing */
.timer {
  font-size: 48px;
  font-weight: bold;
  margin: 10px 0 20px 0; /* Adjusted margins */
  color: #333;
}
/* WebSocket Connection Status Bar */
.connection-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #ddd;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.status-indicator {
  font-size: 12px;
  transition: color 0.3s;
}

.client-count {
  font-size: 14px;
  color: #666;
}

/* Adjust container for connection bar */
body.has-connection-bar .container {
  margin-top: 60px;
}

/* Mode section on home page */
.mode-section {
  margin: 30px 0;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f9f9f9;
}

.mode-section h2 {
  margin-top: 0;
  color: #333;
}

/* Director and Spectator buttons */
.button.director {
  background-color: #9b59b6;
}

.button.director:hover {
  background-color: #8e44ad;
}

.button.spectator {
  background-color: #3498db;
}

.button.spectator:hover {
  background-color: #2980b9;
}

/* Connected clients display */
.connected-clients {
  margin-top: 20px;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 5px;
}

.connected-clients h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.client-item {
  padding: 5px 10px;
  margin: 5px 0;
  background: white;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.director-badge, .spectator-badge {
  font-size: 16px;
}

/* Spectator specific styles */
.spectator-container {
  max-width: 600px;
}

.timer.spectator {
  font-size: 72px;
  margin: 30px 0;
}

.flag-indicators {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 20px 0;
}

.flag-indicator {
  padding: 15px 30px;
  border-radius: 5px;
  font-weight: bold;
  color: white;
  opacity: 0.3;
  transition: opacity 0.3s;
}

.flag-indicator.active {
  opacity: 1;
  animation: pulse 1s infinite;
}

.yellow-indicator {
  background-color: #f1c40f;
}

.red-indicator {
  background-color: #e74c3c;
}

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

.audio-controls {
  margin-top: 20px;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 5px;
}

.race-info {
  font-size: 18px;
  margin: 20px 0;
  padding: 10px;
  background: #f0f0f0;
  border-radius: 5px;
}

/* Authentication Modal Styles */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.auth-modal-content {
  background: white;
  padding: 40px;
  border-radius: 10px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.auth-modal-content h2 {
  margin: 20px 0 10px 0;
  color: #333;
}

.auth-modal-content p {
  color: #666;
  margin-bottom: 30px;
}

#passwordForm {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#passwordInput {
  padding: 15px;
  font-size: 16px;
  border: 2px solid #ddd;
  border-radius: 5px;
  transition: border-color 0.3s;
}

#passwordInput:focus {
  outline: none;
  border-color: #007bff;
}

#passwordInput.shake {
  animation: shake 0.5s;
  border-color: #e74c3c;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

.auth-button {
  padding: 15px 30px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background-color: #007bff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.auth-button:hover {
  background-color: #0056b3;
}

.auth-error {
  color: #e74c3c;
  font-size: 14px;
  margin-top: -10px;
  padding: 10px;
  background: #fee;
  border-radius: 5px;
}

.auth-footer {
  margin-top: 20px;
}

.auth-footer a {
  color: #666;
  text-decoration: none;
  font-size: 14px;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Update connection status for authentication state */
.connection-bar .authenticated {
  color: #2ecc71;
}

.connection-bar .unauthenticated {
  color: #f39c12;
}
