:root {
  --track-color: #1c2526;
  --primary: #ff4500;
  --text: #ffffff;
  --hud-bg: rgba(0, 0, 0, 0.8);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Orbitron", sans-serif;
}

body {
  background: var(--track-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column; /* Change to column layout */
  align-items: center;
  padding-top: 1rem; /* Reduce top padding */
}

.game-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin-bottom: 50px; /* Add space for footer */
}

#gameCanvas {
  width: 100%;
  height: 800px;
  background: var(--track-color);
}

.hud {
  position: absolute;
  top: 0;
  width: 100%;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  background: var(--hud-bg);
  color: var(--text);
  font-size: 18px;
  z-index: 10;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: var(--text);
  text-align: center;
}

.overlay h1 {
  font-size: 48px;
  color: var(--primary);
  text-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
  margin-bottom: 2rem;
}

button {
  background: var(--primary);
  color: var(--text);
  border: none;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 69, 0, 0.5);
}

.controls {
  margin-top: 2rem;
  font-size: 1rem;
}

.hidden {
  display: none;
}

.level-transition {
  animation: fadeInOut 3s ease-in-out;
  background: rgba(0, 0, 0, 0.9);
}

.level-transition h2 {
  font-size: 64px;
  color: var(--primary);
  margin-bottom: 1rem;
  animation: scaleUp 0.5s ease-out;
}

.level-transition h3 {
  font-size: 32px;
  color: #fff;
  animation: slideIn 0.5s ease-out 0.5s both;
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0;
  }
  20%,
  80% {
    opacity: 1;
  }
}

@keyframes scaleUp {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.game-footer {
  position: fixed; /* Change from absolute to fixed */
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 0.5rem;
  text-align: center;
  background: var(--hud-bg);
  color: var(--text);
  font-size: 12px;
  z-index: 100; /* Ensure it stays on top */
}

.credit-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.2s;
}

.credit-link:hover {
  color: #ff6b3d;
  text-decoration: underline;
}

.mobile-controls {
  display: none;
  position: fixed;
  bottom: 60px;
  left: 0;
  width: 100%;
  padding: 20px;
  z-index: 20;
}

.control-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

.vertical-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 69, 0, 0.6);
  border: 2px solid var(--primary);
  color: var(--text);
  font-size: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.control-btn:active {
  background: var(--primary);
  transform: scale(0.95);
}

@media (max-width: 600px) {
  #gameCanvas {
    height: 600px;
  }

  .hud {
    font-size: 14px;
    padding: 0.5rem;
  }

  .overlay h1 {
    font-size: 32px;
  }

  .game-container {
    margin-bottom: 140px;
  }

  .game-footer {
    padding: 0.3rem;
    font-size: 10px;
  }

  .mobile-controls {
    display: block;
  }
}
