:root {
  --primary-color: #4CAF50;
  --secondary-color: #2196F3;
  --accent-color: #FF9800;
  --background-color: #E8F5E9;
  --player-car-color: #2196F3;
  --obstacle-car-color: #F44336;
  --powerup-color: #FFEB3B;
  --text-color: #333;
  --road-color: #424242;
}

body {
  font-family: 'Comic Neue', 'Bubblegum Sans', cursive;
  background-color: var(--background-color);
  background-image: 
    linear-gradient(rgba(76, 175, 80, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76, 175, 80, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
}

.game-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background-color: var(--background-color);
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.score, .lives, .level {
  font-size: 1.3rem;
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  background-color: white;
}

.score {
  color: var(--primary-color);
}

.lives {
  color: var(--obstacle-car-color);
}

.level {
  color: var(--secondary-color);
}

.game-board {
  width: 100%;
  height: 600px;
  background-color: var(--road-color);
  border-radius: 15px;
  position: relative;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Remove or comment out these CSS rules */
/* 
#road-container {
  width: 100%;
  height: 100%;
  position: absolute;
  animation: moveRoad 1.5s linear infinite;
  will-change: transform;
}

@keyframes moveRoad {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(80px);
  }
}

.road-line {
  width: 10px;
  height: 60px;
  background-color: #FFEB3B;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3px;
  box-shadow: 0 0 5px rgba(255, 235, 59, 0.3);
}
*/

.car {
  width: 50px;
  height: 80px;
  position: absolute;
  border-radius: 12px;
  z-index: 10;
  background-size: cover;
  background-position: center;
  transition: transform 0.2s ease-out;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  background-repeat: no-repeat;
}

.player-car {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  background-color: var(--player-car-color);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 80"><rect x="10" y="10" width="30" height="60" rx="8" fill="%232196F3"/><rect x="5" y="25" width="40" height="30" rx="3" fill="%231976D2"/><rect x="15" y="15" width="20" height="10" rx="2" fill="%23BBDEFB"/><rect x="15" y="55" width="20" height="10" rx="2" fill="%23BBDEFB"/><rect x="15" y="30" width="20" height="20" rx="2" fill="%23BBDEFB"/><circle cx="13" cy="20" r="3" fill="%23FFC107"/><circle cx="37" cy="20" r="3" fill="%23FFC107"/><circle cx="13" cy="60" r="3" fill="%23FF5722"/><circle cx="37" cy="60" r="3" fill="%23FF5722"/><rect x="10" y="5" width="30" height="5" rx="2" fill="%230D47A1"/><rect x="10" y="70" width="30" height="5" rx="2" fill="%230D47A1"/></svg>');
  will-change: transform;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
  transform-origin: center bottom;
}

.obstacle-car {
  background-color: var(--obstacle-car-color);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 80"><rect x="10" y="10" width="30" height="60" rx="8" fill="%23F44336"/><rect x="5" y="25" width="40" height="30" rx="3" fill="%23D32F2F"/><rect x="15" y="15" width="20" height="10" rx="2" fill="%23FFCDD2"/><rect x="15" y="55" width="20" height="10" rx="2" fill="%23FFCDD2"/><rect x="15" y="30" width="20" height="20" rx="2" fill="%23FFCDD2"/><circle cx="13" cy="20" r="3" fill="%23FFC107"/><circle cx="37" cy="20" r="3" fill="%23FFC107"/><circle cx="13" cy="60" r="3" fill="%23FF5722"/><circle cx="37" cy="60" r="3" fill="%23FF5722"/><rect x="10" y="5" width="30" height="5" rx="2" fill="%23B71C1C"/><rect x="10" y="70" width="30" height="5" rx="2" fill="%23B71C1C"/></svg>');
  box-shadow: 0 0 20px rgba(244, 67, 54, 0.6);
}

.powerup {
  width: 30px;
  height: 30px;
  position: absolute;
  background-color: var(--powerup-color);
  border-radius: 50%;
  z-index: 5;
  animation: pulse 1s infinite alternate;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><circle cx="15" cy="15" r="12" fill="%23FFEB3B"/><polygon points="15,5 18,12 25,12 20,17 22,25 15,20 8,25 10,17 5,12 12,12" fill="%23FFC107"/></svg>');
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 10px #FFEB3B;
  }
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
  gap: 10px;
}

.control-row {
  display: flex;
  gap: 10px;
}

.control-button {
  width: 60px;
  height: 60px;
  font-size: 24px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.control-button:active {
  transform: scale(0.95);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.game-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
}

#start-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#start-button:hover {
  background-color: #388E3C;
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.sound-btn {
  background-color: var(--secondary-color);
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
}

.sound-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.instructions {
  background-color: var(--background-color);
  padding: 15px;
  border-radius: 15px;
  margin-top: 20px;
}

.instructions h3 {
  color: var(--primary-color);
  margin-top: 0;
}

.instructions p {
  margin: 8px 0;
}

.explosion {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, #FF9800, #F44336);
  animation: explode 0.5s ease-out forwards;
  z-index: 20;
  transform: translate(-50%, -50%);
}

@keyframes explode {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.8;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.level-complete, .game-over {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 100;
}

.level-complete.show, .game-over.show {
  opacity: 1;
  pointer-events: all;
}

.level-complete-text, .game-over-text {
  color: white;
  font-size: 3rem;
  margin-bottom: 15px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.final-score {
  color: var(--accent-color);
  font-size: 2rem;
  margin-bottom: 30px;
}

.score-breakdown {
  background-color: rgba(255,255,255,0.9);
  padding: 15px 25px;
  border-radius: 15px;
  margin: 20px 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  min-width: 300px;
}

.confetti {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  mix-blend-mode: screen;
  will-change: transform, opacity;
}

.shield {
  position: absolute;
  width: 60px;
  height: 90px;
  border-radius: 20px;
  border: 5px solid #2196F3;
  box-shadow: 0 0 15px #2196F3;
  z-index: 5;
  animation: shield-pulse 1.5s infinite;
  opacity: 0.7;
  pointer-events: none;
}

@keyframes shield-pulse {
  0%, 100% {
    box-shadow: 0 0 15px #2196F3;
  }
  50% {
    box-shadow: 0 0 25px #64B5F6;
  }
}

/* Update the car turning styles for more realistic turning */
.player-car.turn-left {
  transform: translateX(-50%) rotate(-12deg) !important;
  animation: car-shadow-left 0.4s forwards, gradual-tilt-left 0.4s forwards;
}

.player-car.turn-right {
  transform: translateX(-50%) rotate(12deg) !important;
  animation: car-shadow-right 0.4s forwards, gradual-tilt-right 0.4s forwards;
}

/* New more gradual turning animations */
@keyframes gradual-tilt-left {
  0% { transform: translateX(-50%) rotate(0deg); }
  20% { transform: translateX(-50%) rotate(-4deg); }
  40% { transform: translateX(-50%) rotate(-8deg); }
  70% { transform: translateX(-50%) rotate(-14deg); }
  100% { transform: translateX(-50%) rotate(-12deg); }
}

@keyframes gradual-tilt-right {
  0% { transform: translateX(-50%) rotate(0deg); }
  20% { transform: translateX(-50%) rotate(4deg); }
  40% { transform: translateX(-50%) rotate(8deg); }
  70% { transform: translateX(-50%) rotate(14deg); }
  100% { transform: translateX(-50%) rotate(12deg); }
}

/* Add realistic wheel rotation to the car */
.player-car::before,
.player-car::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 16px;
  background-color: #333;
  border-radius: 4px;
  bottom: 8px;
  transition: transform 0.3s ease;
}

.player-car::before {
  left: 8px;
}

.player-car::after {
  right: 8px;
}

.player-car.turn-left::before,
.player-car.turn-left::after {
  transform: rotate(-20deg);
}

.player-car.turn-right::before,
.player-car.turn-right::after {
  transform: rotate(20deg);
}

/* Additional progressive turning classes for more granular control */
.player-car.turn-left-slight {
  transform: translateX(-50%) rotate(-5deg) !important;
  animation: car-shadow-left-slight 0.3s forwards;
}

.player-car.turn-right-slight {
  transform: translateX(-50%) rotate(5deg) !important;
  animation: car-shadow-right-slight 0.3s forwards;
}

@keyframes car-shadow-left-slight {
  0% { box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); }
  100% { box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.4); }
}

@keyframes car-shadow-right-slight {
  0% { box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); }
  100% { box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.4); }
}

/* Car smoke effects classes */
.car-smoke {
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(200,200,200,0.4) 60%, rgba(150,150,150,0) 100%);
  z-index: 4;
  opacity: 0.7;
  pointer-events: none;
}

/* Improved tire marks effect */
.tire-marks {
  position: absolute;
  width: 8px;
  height: 40px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2));
  border-radius: 4px;
  z-index: 4;
  opacity: 0.8;
  animation: fade-marks 1.5s forwards;
}

@keyframes fade-marks {
  0% { opacity: 0.8; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1.3); }
}

@media (max-width: 768px) {
  .game-info {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  
  .control-button {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
  
  .game-board {
    height: 350px;
  }
}

/* Add wheels to the car */
.wheel {
  position: absolute;
  width: 8px;
  height: 16px;
  background-color: #333;
  border-radius: 4px;
  transition: transform 0.2s ease;
}

.wheel-front-left {
  left: 8px;
  top: 15px;
}

.wheel-front-right {
  right: 8px;
  top: 15px;
}

.wheel-back-left {
  left: 8px;
  bottom: 8px;
}

.wheel-back-right {
  right: 8px;
  bottom: 8px;
}

/* Add a flash animation for collision feedback */
@keyframes flash-red {
  0%, 100% { background-color: var(--player-car-color); }
  50% { background-color: #FF0000; }
}

/* Make the collision zone more visible during development */
.debug-collision-zone .player-car::after, 
.debug-collision-zone .obstacle-car::after {
  content: '';
  position: absolute;
  width: 80%;
  height: 80%;
  border: 2px dashed red;
  top: 10%;
  left: 10%;
  z-index: 50;
  pointer-events: none;
} 