body {
  margin: 0;
  overflow: hidden;
  font-family: Arial, sans-serif;
  background: #111;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  z-index: 1000;
}

.nav-bar.nav-hidden {
  display: none;
}

.button {
  background: #6b00b3;
  color: #fff;
  padding: 10px 20px;
  margin: 5px;
  border-radius: 8px;
  font-size: 16px;
  text-decoration: none;
  transition: background-color 0.3s;
}

.button:hover {
  background: #ff6f00;
}

#start-screen, #game-over-screen {
  position: fixed;
  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.8);
  z-index: 500;
}

#start-screen h1, #game-over-screen h1 {
  font-size: 48px;
  margin-bottom: 20px;
}

#name-input {
  padding: 10px;
  font-size: 16px;
  margin-bottom: 20px;
  width: 200px;
  border-radius: 5px;
  border: 1px solid #6b00b3;
}

#start-button, #restart-button {
  padding: 10px 20px;
  font-size: 18px;
  background: #6b00b3;
  border: none;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
}

#start-button:hover, #restart-button:hover {
  background: #ff6f00;
}

#game-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-canvas {
  display: block;
  border: 2px solid #fff;
  background: #222;
  z-index: 100;
  width: 100%;
  height: 100%;
  touch-action: none; /* Prevent default touch behaviors */
}

#leaderboard {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  padding: 10px;
  border-radius: 5px;
  z-index: 110;
}

#leaderboard h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

#leaderboard p {
  margin: 5px 0;
  font-size: 14px;
}

.leaderboard-rank-1 { color: #00FFFF; }
.leaderboard-rank-2 { color: #FF00FF; }
.leaderboard-rank-3 { color: #FFFF00; }
.leaderboard-rank-4 { color: #00FF00; }
.leaderboard-rank-5 { color: #FFAA00; }

#loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}

#loading-container p {
  margin: 0 0 10px;
  font-size: 18px;
}

#loading-progress {
  width: 200px;
  height: 20px;
  background: #222;
  border: 2px solid #6b00b3;
  border-radius: 5px;
}

#loading-progress::-webkit-progress-bar {
  background: #222;
  border-radius: 5px;
}

#loading-progress::-webkit-progress-value {
  background: #6b00b3;
  border-radius: 5px;
  transition: width 0.3s ease;
}

#loading-progress::-moz-progress-bar {
  background: #6b00b3;
  border-radius: 5px;
}

@media (max-width: 768px) {
  .button {
    padding: 8px 16px;
    font-size: 14px;
  }
  .nav-bar {
    padding: 8px 0;
    gap: 8px;
  }
  #start-screen h1, #game-over-screen h1 {
    font-size: 36px;
  }
  #name-input {
    width: 180px;
    font-size: 14px;
  }
  #start-button, #restart-button {
    padding: 8px 16px;
    font-size: 16px;
  }
  #leaderboard h2 {
    font-size: 16px;
  }
  #leaderboard p {
    font-size: 12px;
  }
  #loading-container p {
    font-size: 16px;
  }
  #loading-progress {
    width: 180px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  #loading-container p {
    font-size: 14px;
  }
  #loading-progress {
    width: 160px;
    height: 16px;
  }
}