/* RESET & BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #2f2f2f, #4f4f4f);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Single Glass Bar with Controls & Scoreboard in the Same Row */
#glass-bar {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 1200px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 8px 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

#control-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}
#control-buttons button {
  font-size: 1rem;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.5);
  color: #333;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
#control-buttons button:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.75);
}
#control-buttons input[type="range"] {
  width: 80px;
  cursor: pointer;
  background: #ccc;
  height: 5px;
  border-radius: 5px;
  outline: none;
}

/* Scoreboard in the same row, right-aligned */
#scoreboard-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}
#scoreboard-inline span {
  background: #1c1c1c;
  padding: 4px 8px;
  border-radius: 5px;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Particle Overlays & Parallax (optional) */
#particles-js, #vignette-overlay, #parallax-background {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
#particles-js { z-index: -4; }
#vignette-overlay {
  z-index: -3;
  background: radial-gradient(circle, rgba(0,0,0,0.1) 60%, rgba(0,0,0,0.6) 100%);
}
#parallax-background {
  z-index: -2;
  background: url('https://via.placeholder.com/1920x1080.webp?text=Spelling_Sprint') center/cover no-repeat;
  filter: blur(12px) brightness(0.6);
}

/* Main Game Container */
#game-container {
  width: 95%;
  max-width: 900px;
  margin: 90px auto 30px;
  padding: 20px;
  background: rgba(0,0,0,0.6);
  border-radius: 20px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.4);
  text-align: center;
}

/* Header */
#game-header {
  padding: 10px 15px;
  background: #4caf50;
  color: #fff;
  border-radius: 10px;
  margin-bottom: 10px;
}
#game-header h1 {
  margin: 0;
  font-size: 1.8rem;
}
#game-header p {
  margin: 4px 0 0;
  font-size: 1rem;
}

/* Car Dashboard Layout */
#car-dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin: 20px 0;
  background: #3a3a3a;
  padding: 20px;
  border-radius: 15px;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.5);
}

/* Odometer */
.odometer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.odometer-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: #84ff84;
  margin-bottom: 8px;
}
.odometer {
  background: #111;
  padding: 10px 20px;
  font-size: 2rem;
  font-family: "Courier New", monospace;
  color: #00ff00;
  border-radius: 8px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
  min-width: 80px;
  text-align: center;
}

/* Speedometer (Time Gauge) */
.speedometer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.speedometer-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: #ffd580;
  margin-bottom: 8px;
}
.speedometer {
  position: relative;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle at 50% 50%, #222 40%, #111 100%);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  overflow: hidden;
}
.speedometer-ticks {
  position: absolute;
  bottom: 4%;
  width: 100%;
  display: flex;
  justify-content: space-around;
  color: #fff;
  font-size: 0.6rem;
}
.speedometer-needle {
  position: absolute;
  width: 2px;
  height: 35px;
  background: red;
  left: 50%;
  bottom: 50%;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: 50% 100%;
  transition: transform 0.3s ease;
}
.speedometer-center {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  left: 50%;
  bottom: calc(50% - 4px);
  transform: translateX(-50%);
  box-shadow: inset 0 0 2px rgba(0,0,0,0.5);
}

/* Countdown Container */
.countdown-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.countdown-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: #ff8a8a;
  margin-bottom: 8px;
}
.countdown {
  font-family: "Digital", "Courier New", monospace;
  background: #000;
  color: #ff3030;
  font-size: 2rem;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
  min-width: 50px;
  text-align: center;
}

/* Game Word Input */
#game-area {
  margin: 20px 0;
}
#word-display {
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 12px;
  min-height: 40px;
}
#word-input {
  width: 80%;
  max-width: 400px;
  font-size: 1.2rem;
  padding: 8px 12px;
  border: 2px solid #4caf50;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
#word-input:focus {
  border-color: #388e3c;
  box-shadow: 0 0 5px #388e3c;
}

/* Time Left Info */
#game-info {
  font-size: 1rem;
  margin-bottom: 10px;
}

/* Extra Buttons */
#extra-buttons {
  margin-bottom: 10px;
}
#extra-buttons button {
  font-size: 1rem;
  padding: 8px 12px;
  background: #ff9800;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin: 0 5px;
  transition: background 0.3s, transform 0.3s;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
#extra-buttons button:hover {
  background: #f57c00;
  transform: scale(1.05);
}

/* Start & Play Again (Large) */
#game-footer button,
#play-again-button {
  font-size: 1.6rem;
  padding: 14px 28px;
  background: #5cb85c;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s, background 0.3s;
  box-shadow: 0 5px 8px rgba(0,0,0,0.3);
}
#game-footer button:hover,
#play-again-button:hover {
  background: #4cae4c;
  transform: scale(1.07);
}

/* End Screen Overlay */
#end-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 200;
}
#end-screen.visible {
  opacity: 1;
  pointer-events: all;
}
#end-screen h2 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}
#end-screen p {
  font-size: 1.4rem;
  margin-bottom: 20px;
}

/* Confetti */
#confetti-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 300;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #FFC107;
  border-radius: 50%;
  animation: confettiFall 5s linear infinite;
}
@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

/* Help Button */
#help-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 14px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  transition: transform 0.2s, background 0.2s;
  font-size: 1.2rem;
  color: #333;
  z-index: 1001;
}
#help-button:hover {
  transform: scale(1.1);
  background: rgba(255,255,255,0.9);
}

/* Responsive Tweaks */
@media (max-width: 768px) {
  #glass-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px;
  }
  #control-buttons {
    margin-bottom: 6px;
  }
  #scoreboard-inline {
    margin-top: 6px;
  }
  #game-header h1 {
    font-size: 1.5rem;
  }
}
@media (max-width: 480px) {
  #game-header h1 {
    font-size: 1.4rem;
  }
  #speedometer-needle {
    height: 30px;
  }
  #game-footer button,
  #play-again-button {
    font-size: 1.3rem;
    padding: 12px 20px;
  }
}
