body,
html {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: "Arial", sans-serif;
}

#game-container {
  width: 100vw;
  height: 100vh;
}

#score {
  position: absolute;
  top: 20px;
  left: 20px;
  color: white;
  font-size: 28px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
  background-color: rgba(0, 0, 0, 0.5);
  padding: 10px 15px;
  border-radius: 10px;
}

.score-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffcc00;
  font-size: 48px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  animation: fadeUp 2s forwards;
  pointer-events: none;
}

@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -70%);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -100%);
  }
}

#controls-info {
  position: absolute;
  bottom: 20px;
  right: 20px;
  color: white;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  border-radius: 8px;
  text-align: right;
  font-size: 14px;
  max-width: 150px;
}

html,
body {
  overflow: hidden;
  height: 100%;
}

#speed-display {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 15px 25px;
  border-radius: 10px;
  font-family: "Arial", sans-serif;
  text-align: center;
  border: 2px solid #00ff00;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.speed-value {
  font-size: 48px;
  font-weight: bold;
  line-height: 1;
}

.speed-unit {
  font-size: 16px;
  opacity: 0.8;
}

#drift-score-display {
  position: absolute;
  top: 80px;
  right: 30px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 15px 25px;
  border-radius: 10px;
  font-family: "Arial", sans-serif;
  text-align: center;
  border: 2px solid #ff3300;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

#drift-score-display.drifting {
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(255, 51, 0, 0.7);
}

.score-value {
  font-size: 40px;
  font-weight: bold;
  color: #ff3300;
}

.score-label {
  font-size: 18px;
  opacity: 0.9;
}

.track-notification {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#track-info {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  font-family: "Arial", sans-serif;
  display: none;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.track-id {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 5px;
  color: #ffcc00;
}

.track-time,
.track-points {
  font-size: 16px;
  margin-bottom: 3px;
}

.track-points {
  color: #00ff00;
}

#leaderboard {
  position: fixed;
  top: 20px;
  left: 20px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px;
  border-radius: 8px;
  font-family: "Arial", sans-serif;
  width: 250px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

#leaderboard.collapsed {
  transform: translateX(-230px);
}

#leaderboard h2 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 20px;
  color: #ffcc00;
  text-align: center;
}

.track-record {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.track-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
  color: #00ccff;
}

.track-stats {
  font-size: 14px;
  line-height: 1.4;
}

#toggle-leaderboard {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}

#toggle-leaderboard:hover {
  background-color: #555;
}

.billboard-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px 30px;
  border-radius: 10px;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.5);
  max-width: 80%;
}

.billboard-notification.visible {
  opacity: 1;
}

.billboard-notification .sponsor {
  color: #ffcc00;
  font-size: 24px;
  margin-top: 10px;
}

#mobile-controls {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

#joystick-container {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 150px;
  height: 150px;
  pointer-events: auto;
}

#drift-button {
  position: fixed;
  bottom: 40px;
  left: 40px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}

#drift-button span {
  color: white;
  font-weight: bold;
  font-size: 18px;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

#drift-button.active {
  background-color: rgba(255, 100, 100, 0.7);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(255, 100, 100, 0.7);
  border-color: rgba(255, 255, 255, 0.8);
}

#handbrake-button,
#accelerator-button {
  display: none;
}

@media (max-width: 767px) {
  .speed-value {
    font-size: 32px;
  }
  .speed-unit {
    font-size: 12px;
  }
  #drift-score-display {
    padding: 8px 15px;
    right: 15px;
  }
  .score-value {
    font-size: 28px;
  }
  .score-label {
    font-size: 14px;
  }
  #controls-info {
    font-size: 12px;
    padding: 5px 8px;
    bottom: 10px;
    right: 10px;
    max-width: 120px;
  }
  #speed-display {
    bottom: 200px;
    padding: 10px 15px;
    transform: translateX(-50%) scale(0.8);
  }

  #controls-info {
    display: none;
  }

  #score {
    font-size: 20px;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
  }

  #drift-score-display {
    top: 60px;
    right: 10px;
    padding: 5px 10px;
  }

  #joystick-container {
    width: 120px;
    height: 120px;
  }

  #drift-button {
    width: 70px;
    height: 70px;
  }
}

@media (max-width: 360px) {
  #speed-display {
    transform: translateX(-50%) scale(0.7);
    bottom: 180px;
  }

  #joystick-container {
    width: 100px;
    height: 100px;
    bottom: 30px;
    right: 30px;
  }

  #drift-button {
    width: 60px;
    height: 60px;
    bottom: 30px;
    left: 30px;
  }
}

#orientation-message {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  font-size: 24px;
  text-align: center;
  padding: 20px;
}

#orientation-message img {
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
  animation: rotate 2s infinite ease-in-out;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(-90deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

.nipple .back {
  background: rgba(0, 0, 0, 0.4) !important;
  border: 2px solid rgba(255, 255, 255, 0.5) !important;
}

.nipple .front {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 2px solid rgba(255, 255, 255, 0.8) !important;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.track-selection-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.track-selection-content {
  background: rgba(30, 30, 30, 0.95);
  padding: 30px;
  border-radius: 15px;
  max-width: 80%;
  max-height: 80vh;
  overflow-y: auto;
  border: 2px solid #444;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.track-selection-content h2 {
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  font-size: 24px;
}

.track-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.track-button {
  background: rgba(60, 60, 60, 0.8);
  border: none;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: all 0.2s ease;
  border: 1px solid #555;
}

.track-button:hover {
  background: rgba(80, 80, 80, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.track-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 5px;
  color: #00ccff;
}

.track-details {
  font-size: 14px;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .track-selection-content {
    padding: 20px;
    width: 90%;
  }

  .track-list {
    grid-template-columns: 1fr;
  }

  .track-button {
    padding: 12px 15px;
  }

  .track-name {
    font-size: 16px;
  }

  .track-details {
    font-size: 12px;
  }
}

.track-select-button {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  border: 2px solid #00ccff;
  z-index: 100;
}

.track-select-button:hover {
  background: rgba(0, 204, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(0, 204, 255, 0.5);
}

@media (max-width: 768px) {
  .track-select-button {
    top: 10px;
    right: 10px;
    padding: 8px 15px;
    font-size: 14px;
  }
}
