/* Three.js Asteroids Game Styles */
:root {
  --game-primary: #00b4ff;
  --game-secondary: #bad531;
  --game-accent: #ff2a6d;
  --game-dark: #05070f;
  --game-light: #f1f1f1;
  --neon-glow-blue: 0 0 10px rgba(0, 180, 255, 0.7), 0 0 20px rgba(0, 180, 255, 0.5), 0 0 30px rgba(0, 180, 255, 0.3);
  --neon-glow-green: 0 0 10px rgba(186, 213, 49, 0.7), 0 0 20px rgba(186, 213, 49, 0.5), 0 0 30px rgba(186, 213, 49, 0.3);
  --neon-glow-pink: 0 0 10px rgba(255, 42, 109, 0.7), 0 0 20px rgba(255, 42, 109, 0.5), 0 0 30px rgba(255, 42, 109, 0.3);
  --neon-glow-purple: 0 0 10px rgba(170, 0, 255, 0.7), 0 0 20px rgba(170, 0, 255, 0.5), 0 0 30px rgba(170, 0, 255, 0.3);
}

/* Game container styles */
.threejs-game-container {
  position: relative;
  width: 100%;
  height: 90vh;
  min-height: 600px;
  overflow: hidden;
  z-index: 1;
  background-color: var(--game-dark);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

/* UI Elements */
.game-ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  font-family: 'Rajdhani', sans-serif;
}

/* Game HUD */
.game-hud {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: row;
  gap: 15px;
  z-index: 3;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--game-light);
  text-shadow: var(--neon-glow-blue);
  font-size: 1.2rem;
  font-weight: 600;
}

.hud-value {
  background: rgba(0, 10, 30, 0.6);
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--game-primary);
  box-shadow: var(--neon-glow-blue);
  min-width: 60px;
  text-align: center;
}

/* Lives Display with Ship Icons */
.lives-display {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 3;
}

.ship-life {
  width: 30px;
  height: 25px;
  position: relative;
}

.ship-life svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(var(--neon-glow-blue));
}

/* Game content overlay */
.game-content-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
  padding: 20px;
  z-index: 3;
  pointer-events: all;
}

.game-title {
  font-size: 5.5rem; /* Increased from 5rem */
  font-weight: 700;
  margin-bottom: 1.5rem; /* Slightly increased margin */
  color: var(--game-light);
  text-shadow: var(--neon-glow-blue), 0 0 20px rgba(0, 136, 255, 0.5); /* Enhanced glow */
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 3px; /* Increased letter spacing */
  transform: scale(1.02); /* Slight scale effect */
  transition: all 0.3s ease;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.game-subtitle {
  font-size: 1.8rem; /* Increased from 1.6rem */
  font-weight: 500;
  margin-bottom: 3.5rem; /* Increased margin before buttons */
  color: var(--game-secondary);
  text-shadow: var(--neon-glow-green), 0 0 15px rgba(0, 255, 136, 0.5); /* Enhanced glow */
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 1.5px; /* Increased letter spacing */
  opacity: 0.95; /* Slightly more opaque */
  transition: all 0.3s ease;
  max-width: 80%;
  margin-left: auto;
  margin-right: auto;
}

.game-btn-container {
  display: flex;
  justify-content: center;
  gap: 25px; /* Increased from 20px */
  margin-bottom: 2rem;
  flex-wrap: wrap; /* Allows buttons to wrap on smaller screens */
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.game-btn {
  background: rgba(0, 180, 255, 0.2);
  color: var(--game-light);
  border: 2px solid var(--game-primary);
  border-radius: 4px;
  padding: 12px 30px; /* Increased padding */
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 1.2rem; /* Slightly larger */
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  box-shadow: var(--neon-glow-blue);
  cursor: pointer;
  pointer-events: all;
  min-width: 200px; /* Ensure buttons have a minimum width */
  text-align: center;
}

.game-btn:hover {
  background: rgba(0, 180, 255, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 0 15px rgba(0, 180, 255, 0.8), 0 0 30px rgba(0, 180, 255, 0.6);
  color: white;
}

.game-btn-secondary {
  background: rgba(186, 213, 49, 0.2);
  border: 2px solid var(--game-secondary);
  box-shadow: var(--neon-glow-green);
}

.game-btn-secondary:hover {
  background: rgba(186, 213, 49, 0.4);
  box-shadow: 0 0 15px rgba(186, 213, 49, 0.8), 0 0 30px rgba(186, 213, 49, 0.6);
}

/* Game instructions */
.game-instructions {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(5, 7, 15, 0.7);
  border: 1px solid var(--game-primary);
  border-radius: 4px;
  padding: 10px 15px;
  color: var(--game-light);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  z-index: 3;
  max-width: 300px;
  box-shadow: var(--neon-glow-blue);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.game-instructions h4 {
  color: var(--game-primary);
  font-size: 1.1rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.game-instructions ul {
  margin: 0;
  padding-left: 20px;
}

.game-instructions li {
  margin-bottom: 5px;
}

/* Hidden controls class when scrolling */
.controls-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

/* Level up notification */
.level-up-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(186, 213, 49, 0.2);
  color: var(--game-light);
  font-family: 'Rajdhani', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  padding: 2rem 4rem;
  border: 2px solid var(--game-secondary);
  border-radius: 10px;
  box-shadow: var(--neon-glow-green);
  z-index: 9999;
  animation: pulseNotification 2s ease-out forwards;
}

@keyframes pulseNotification {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* Score update animation */
.score-update {
  animation: scoreUpdate 0.5s ease-out;
}

@keyframes scoreUpdate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.5);
    color: var(--game-secondary);
  }
  100% {
    transform: scale(1);
  }
}

/* Game over overlay */
.game-over-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 15, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  text-align: center;
}

.game-over-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.game-over-title {
  font-size: 4.5rem; /* Increased size */
  color: var(--game-accent);
  text-shadow: var(--neon-glow-pink);
  margin-bottom: 1.5rem; /* Increased spacing */
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
}

.game-over-score {
  font-size: 2.2rem; /* Increased size */
  color: var(--game-light);
  margin-bottom: 2.5rem; /* Increased spacing */
  font-family: 'Rajdhani', sans-serif;
}

.restart-btn {
  background: rgba(255, 42, 109, 0.2);
  color: var(--game-light);
  border: 2px solid var(--game-accent);
  box-shadow: var(--neon-glow-pink);
  padding: 10px 25px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.restart-btn:hover {
  background: rgba(255, 42, 109, 0.4);
  transform: translateY(-3px);
}

/* Loading screen */
.loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--game-dark);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(0, 180, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--game-primary);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--game-light);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  text-shadow: var(--neon-glow-blue);
}

/* Ship life animations */
@keyframes shipLost {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(0); opacity: 0; }
}

.ship-life.losing {
  animation: shipLost 0.8s forwards;
}

@keyframes shipWarning {
  0% { filter: drop-shadow(0 0 5px rgba(255, 42, 109, 0.7)); }
  50% { filter: drop-shadow(0 0 15px rgba(255, 42, 109, 0.9)); }
  100% { filter: drop-shadow(0 0 5px rgba(255, 42, 109, 0.7)); }
}

.ship-life.last-life {
  animation: shipWarning 1.5s infinite;
}

/* Bot mode indicator */
.bot-mode-indicator {
  position: absolute;
  top: 65px;
  left: 20px;
  background: rgba(75, 0, 130, 0.4);
  color: #e0c0ff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid #aa00ff;
  box-shadow: var(--neon-glow-purple);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.bot-mode-indicator.active {
  opacity: 1;
  transform: translateY(0);
}

.bot-mode-indicator .bot-icon {
  font-size: 1.1rem;
  animation: botPulse 2s infinite;
}

@keyframes botPulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .threejs-game-container {
    height: 80vh;
  }
  
  .game-title {
    font-size: 3.5rem; /* Adjusted for medium screens */
    max-width: 95%;
  }
  
  .game-subtitle {
    font-size: 1.2rem;
    max-width: 90%;
    margin-bottom: 2.5rem;
  }
  
  .game-btn {
    font-size: 1rem;
    padding: 10px 20px;
    min-width: 180px;
  }
  
  .game-instructions {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .threejs-game-container {
    height: 70vh;
  }
  
  .game-title {
    font-size: 2.5rem; /* Smaller for mobile */
  }
  
  .game-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }
  
  .game-btn-container {
    flex-direction: column;
    gap: 15px;
  }
  
  .game-btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    min-width: 160px;
  }
  
  .game-instructions {
    bottom: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
  }
}

/* Ensure proper aspect ratio for wider screens */
@media (min-aspect-ratio: 16/9) {
  .threejs-game-container {
    height: 90vh;
  }
}

/* Ensure proper aspect ratio for taller screens */
@media (max-aspect-ratio: 9/16) {
  .threejs-game-container {
    height: 60vh;
  }
}
