body {
  font-family: 'Orbitron', 'Courier New', monospace;
  overflow: hidden;
  touch-action: none;
  background-color: #0a0a0f;
  color: #ffffff;
}

canvas {
  background: transparent;
  display: block;
  touch-action: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

#backgroundCanvas {
  background-color: #0a0a0f;
  z-index: 0;
}

.hud-item {
  background: linear-gradient(
    145deg,
    rgba(20, 20, 30, 0.9),
    rgba(30, 30, 45, 0.8)
  );
  border: 1px solid rgba(64, 156, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  color: #e8f4fd;
  text-shadow: 0 0 8px rgba(64, 156, 255, 0.3);
  font-family: 'Fredoka One', cursive;
  font-size: 0.9em;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  cursor: default;
}

.hud-item:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 40px rgba(64, 156, 255, 0.4);
  border-color: rgba(64, 156, 255, 0.8);
}

.modal {
  background: rgba(10, 10, 15, 0.95);
  border: 2px solid #409cff;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 40px rgba(64, 156, 255, 0.3);
  max-width: 500px;
  width: 90%;
  padding: 2.5rem;
  animation: modalAppear 0.6s ease-out;
}

.progress-bar-outer {
  width: 120px;
  height: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid #e0e0ff;
  border-radius: 10px;
  padding: 2px;
  transition: all 0.3s ease;
}

.progress-bar-outer:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(64, 156, 255, 0.5);
}

.progress-bar-inner {
  height: 100%;
  border-radius: 8px;
  transition: width 0.3s ease-out;
}

#healthBarInner {
  background: linear-gradient(90deg, #2ecc71, #28b463);
}

#boostBarInner {
  background: linear-gradient(90deg, #3498db, #2980b9);
}

#fuelBarInner {
  background: linear-gradient(90deg, #f1c40f, #f39c12);
}

/* Mobile Controls Styling */
.mobile-controls {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 20px;
  pointer-events: auto;
}

.mobile-controls-left {
  display: flex;
  gap: 20px;
}

.mobile-controls-right {
  display: flex;
  justify-content: flex-end;
}

.mobile-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.mobile-btn-backward {
  background: linear-gradient(145deg, #e74c3c, #c0392b);
  color: white;
}

.mobile-btn-backward:active {
  background: linear-gradient(145deg, #c0392b, #a93226);
}

.mobile-btn-forward {
  background: linear-gradient(145deg, #2ecc71, #28b463);
  color: white;
}

.mobile-btn-forward:active {
  background: linear-gradient(145deg, #28b463, #229954);
}

.mobile-btn-fire {
  background: linear-gradient(145deg, #f39c12, #e67e22);
  color: white;
}

.mobile-btn-fire:active {
  background: linear-gradient(145deg, #e67e22, #d35400);
}

/* Responsive Design */
@media (max-width: 768px) {
  .hud-item {
    padding: 8px 12px;
    font-size: 14px;
  }
  
  .progress-bar-outer {
    width: 80px;
    height: 16px;
  }
  
  #hud {
    flex-direction: row;
    gap: 0.5rem;
    align-items: stretch;
  }
  
  #hud > div:first-child {
    order: 2;
    justify-content: flex-end;
    flex-direction: column;
  }
  
  #hud > div:nth-child(2) {
    order: 1;
    justify-content: flex-start;
    flex-direction: column;
  }
  
  #modalTitle {
    font-size: 3rem;
  }
  
  #modalText {
    font-size: 16px;
  }
  
  #startButton {
    padding: 12px 24px;
    font-size: 18px;
  }
  
  .mobile-btn {
    width: 60px;
    height: 60px;
  }
  
  .mobile-controls {
    bottom: 15px;
    padding: 0 15px;
  }
  
  .mobile-controls-left {
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .hud-item {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .progress-bar-outer {
    width: 70px;
    height: 14px;
  }
  
  #hud {
    padding: 0.5rem;
    flex-direction: row;
    gap: 0.5rem;
  }
  
  #hud > div:first-child {
    order: 2;
    justify-content: flex-end;
    flex-direction: column;
    gap: 0.25rem;
  }
  
  #hud > div:nth-child(2) {
    order: 1;
    justify-content: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }
  
  #modalTitle {
    font-size: 2.5rem;
  }
  
  #modalText {
    font-size: 14px;
  }
  
  #startButton {
    padding: 10px 20px;
    font-size: 16px;
  }
  
  .mobile-btn {
    width: 55px;
    height: 55px;
  }
  
  .mobile-controls {
    bottom: 10px;
    padding: 0 10px;
  }
  
  .mobile-controls-left {
    gap: 12px;
  }
}

@media (max-width: 360px) {
  .hud-item {
    padding: 4px 8px;
    font-size: 11px;
  }
  
  .progress-bar-outer {
    width: 70px;
    height: 12px;
  }
  
  #hud {
    flex-direction: row;
    gap: 0.25rem;
  }
  
  #hud > div:first-child {
    order: 2;
    justify-content: flex-end;
    flex-direction: column;
  }
  
  #hud > div:nth-child(2) {
    order: 1;
    justify-content: flex-start;
    flex-direction: column;
  }
  
  .mobile-btn {
    width: 50px;
    height: 50px;
  }
  
  .mobile-controls {
    bottom: 8px;
    padding: 0 8px;
  }
  
  .mobile-controls-left {
    gap: 10px;
  }
}

/* Landscape orientation adjustments for mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .mobile-controls {
    bottom: 10px;
  }
  
  .mobile-btn {
    width: 50px;
    height: 50px;
  }
  
  .hud-item {
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* Hide mobile controls on desktop */
@media (min-width: 769px) {
  .mobile-controls {
    display: none !important;
  }
}

/* Ensure game works on all screen sizes */
@media (max-width: 320px) {
  .hud-item {
    font-size: 10px;
    padding: 3px 6px;
  }
  
  .progress-bar-outer {
    width: 60px;
    height: 10px;
  }
  
  #hud {
    flex-direction: row;
    gap: 0.2rem;
  }
  
  #hud > div:first-child {
    order: 2;
    justify-content: flex-end;
    flex-direction: column;
  }
  
  #hud > div:nth-child(2) {
    order: 1;
    justify-content: flex-start;
    flex-direction: column;
  }
  
  .mobile-btn {
    width: 45px;
    height: 45px;
  }
}

/* FadeDrive Title Styling - SUPER CREATIVE & PLAYFUL! */
.fadedrive-title {
  font-family: 'Righteous', cursive;
  font-size: 4rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 25%, #45b7d1 50%, #96ceb4 75%, #feca57 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: 0.05em;
  position: relative;
  line-height: 1.1;
  word-wrap: break-word;
  max-width: 100%;
  text-align: center;
  animation: titleFloat 4s ease-in-out infinite;
  transform-style: preserve-3d;
}

/* .fadedrive-title::before {
  content: 'FADE';
  position: absolute;
  top: -8px;
  left: -8px;
  background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  z-index: -1;
  opacity: 0.7;
  filter: blur(3px);
  animation: titleShadow 3s ease-in-out infinite alternate;
} */

/* .fadedrive-title::after {
  content: 'DRIVE';
  position: absolute;
  top: 8px;
  right: -8px;
  background: linear-gradient(135deg, #45b7d1, #feca57);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  z-index: -1;
  opacity: 0.7;
  filter: blur(3px);
  animation: titleShadow 3s ease-in-out infinite alternate-reverse;
} */

/* Amazing floating animation */
@keyframes titleFloat {
  0%, 100% {
    transform: translateY(0px) rotateX(0deg);
  }
  25% {
    transform: translateY(-5px) rotateX(2deg);
  }
  50% {
    transform: translateY(-8px) rotateX(0deg);
  }
  75% {
    transform: translateY(-3px) rotateX(-2deg);
  }
}

/* Creative shadow animation */
@keyframes titleShadow {
  0% {
    opacity: 0.7;
    transform: translateX(0px) translateY(0px);
  }
  100% {
    opacity: 0.9;
    transform: translateX(5px) translateY(5px);
  }
}

/* Modal appearance animation */
@keyframes modalAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) rotateY(-10deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

/* Add some fun to the modal text */
#modalText {
  font-family: 'Concert One', cursive;
  font-size: 1.1em;
  line-height: 1.6;
  color: #e8f4fd;
}

/* Make the start button more playful */
#startButton {
  font-family: 'Fredoka One', cursive;
  letter-spacing: 1px;
  text-transform: uppercase;
  animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(64, 156, 255, 0.4);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(64, 156, 255, 0.6);
  }
}



/* Add a fun background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(78, 205, 196, 0.1) 0%, transparent 50%);
  z-index: -1;
  animation: backgroundFloat 20s ease-in-out infinite;
}

@keyframes backgroundFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-20px) rotate(1deg);
  }
  66% {
    transform: translateY(10px) rotate(-1deg);
  }
}

/* HUD Layout Improvements */
#hud {
  gap: 1rem;
}

#hud > div:first-child {
  flex-shrink: 0;
}

#hud > div:nth-child(2) {
  flex-shrink: 0;
  justify-content: flex-end;
}

