body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  background-color: #0a0a2a;
  background-image: url("images/space-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 100vh;
  overflow: hidden;
}

.background-image {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: url("images/space-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.game-container {
  text-align: center;
  position: relative;
  z-index: 1;
  margin: 20px;
  width: 680px;
  height: 680px;
  margin: 0 auto;
}

canvas {
  border: 2.5px solid #4a4a8a;
  background-color: rgba(0, 0, 20, 0.7);
  box-shadow: 0 0 34px #4a4a8a;
  border-radius: 13px;
}

.scores-container {
  position: absolute;
  top: -51px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: 100%;
}

.current-score {
  color: #7f7fff;
  font-size: 34px;
  font-family: "Press Start 2P", "Orbitron", sans-serif;
  text-shadow: 0 0 21px #4a4a8a;
  letter-spacing: 3.4px;
  margin-top: 17px;
}

.high-score {
  color: #ffd700;
  font-size: 34px;
  font-family: "Press Start 2P", "Orbitron", sans-serif;
  text-shadow: 0 0 21px #4a4a8a;
  letter-spacing: 3.4px;
}

@keyframes collect-animation {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(2);
    opacity: 0.5;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

@keyframes highScoreAnim {
  0% {
    transform: scale(1);
    color: #ffd700;
    text-shadow: 0 0 21px #4a4a8a;
  }
  50% {
    transform: scale(1.2);
    color: #fff;
    text-shadow: 0 0 30px #ffd700;
  }
  100% {
    transform: scale(1);
    color: #ffd700;
    text-shadow: 0 0 21px #4a4a8a;
  }
}

.high-score.animate {
  animation: highScoreAnim 0.6s ease-in-out 2;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInFromLeft {
  0% {
    opacity: 0;
    transform: translateX(-100px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  0% {
    opacity: 0;
    transform: translateX(100px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseText {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.rocket-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  cursor: default;
}

/* Changer le curseur quand il est sur la fusée */
.rocket-canvas:hover {
  cursor: pointer;
}

.sound-prompt {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.sound-button {
  background: #4a4a8a;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  font-family: "Righteous", sans-serif;
  cursor: pointer;
  transition: background 0.3s;
}

.sound-button:hover {
  background: #6a6aaa;
}

@keyframes resetHighScore {
  0% {
    transform: scale(1);
    color: #ffd700;
    text-shadow: 0 0 21px #4a4a8a;
  }
  25% {
    transform: scale(1.5);
    color: #ff0000;
    text-shadow: 0 0 30px #ff0000;
  }
  50% {
    transform: scale(1.2);
    color: #ff4444;
    text-shadow: 0 0 25px #ff0000;
  }
  100% {
    transform: scale(1);
    color: #ffd700;
    text-shadow: 0 0 21px #4a4a8a;
  }
}

.reset-animation {
  animation: resetHighScore 1s ease-in-out;
}

.touch-controls {
  display: none; /* Caché par défaut, sera affiché sur les appareils tactiles */
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.touch-button {
  width: 60px;
  height: 60px;
  margin: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: white;
  font-size: 24px;
  cursor: pointer;
}

.horizontal-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 5px 0;
}

/* Afficher les contrôles tactiles uniquement sur les appareils tactiles */
@media (hover: none) and (pointer: coarse) {
  .touch-controls {
    display: block;
  }
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.start-game-button {
    animation: pulse 2s infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    font-size: 24px;
    font-family: 'Righteous', sans-serif;
    background-color: #4a4a8a;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s, transform 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.start-game-button:hover {
    background-color: #6a6aaa;
    transform: translate(-50%, -50%) scale(1.05);
}

.start-game-button:active {
    background-color: #3a3a6a;
    transform: translate(-50%, -50%) scale(0.95);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(26, 26, 26, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    color: white;
    font-family: 'Orbitron', sans-serif;
    border: 2px solid #3498db;
    min-width: 300px;
}

.modal-content h2 {
    color: #3498db;
    margin-bottom: 20px;
}

#usernameInput {
    width: 80%;
    padding: 12px;
    margin: 15px 0;
    background: rgba(51, 51, 51, 0.8);
    border: 1px solid #3498db;
    color: white;
    border-radius: 5px;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
}

#submitUsername {
    padding: 12px 25px;
    background: #3498db;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    transition: background 0.3s ease;
}

#submitUsername:hover {
    background: #2980b9;
}
