/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  cursor: default;
}

/* Screens */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.screen.active {
  display: flex;
}

/* Animated Star Background */
.stars {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 60% 70%, white, transparent),
    radial-gradient(1px 1px at 50% 50%, white, transparent),
    radial-gradient(1px 1px at 80% 10%, white, transparent),
    radial-gradient(2px 2px at 90% 60%, white, transparent),
    radial-gradient(1px 1px at 33% 80%, white, transparent),
    radial-gradient(2px 2px at 10% 90%, white, transparent);
  background-size: 200% 200%;
  background-position: 0% 0%;
  animation: starsMove 60s linear infinite;
  opacity: 0.6;
}

@keyframes starsMove {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

/* Menu Background Glow */
.menu-bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.3), transparent 70%);
  filter: blur(100px);
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

/* Menu Container */
.menu-container, .modal-container, .gameover-container {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 700px;
  max-height: 90vh;
  padding: 30px;
  background: linear-gradient(135deg, rgba(20, 15, 35, 0.95), rgba(40, 25, 60, 0.95));
  border-radius: 30px;
  border: 3px solid;
  border-image: linear-gradient(45deg, #ec4899, #8b5cf6, #3b82f6) 1;
  box-shadow: 
    0 0 60px rgba(236, 72, 153, 0.5),
    0 0 120px rgba(139, 92, 246, 0.3),
    inset 0 0 60px rgba(236, 72, 153, 0.1);
  pointer-events: auto;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-container {
  max-height: 85vh;
}

/* Title Styles */
.title-container {
  position: relative;
  margin-bottom: 50px;
}

.title-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(ellipse, rgba(236, 72, 153, 0.6), transparent 70%);
  filter: blur(40px);
  animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.game-title {
  position: relative;
  font-family: 'Orbitron', sans-serif;
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 8px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.title-word {
  background: linear-gradient(45deg, #ff00ff, #00ffff, #ff00ff);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientFlow 3s ease infinite;
  text-shadow: 0 0 80px rgba(236, 72, 153, 0.8);
  filter: drop-shadow(0 0 20px rgba(236, 72, 153, 1));
}

.title-separator {
  font-size: 3rem;
  color: #ec4899;
  filter: drop-shadow(0 0 20px #ec4899);
}

@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.subtitle {
  font-size: 1.5rem;
  letter-spacing: 6px;
  color: #c4b5fd;
  font-weight: 700;
  margin-top: 10px;
}

.title-underline {
  width: 200px;
  height: 4px;
  background: linear-gradient(90deg, transparent, #ec4899, transparent);
  margin: 20px auto 0;
  animation: underlinePulse 2s ease-in-out infinite;
}

@keyframes underlinePulse {
  0%, 100% { opacity: 0.5; width: 200px; }
  50% { opacity: 1; width: 300px; }
}

/* Buttons */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 40px 0;
}

.menu-btn {
  position: relative;
  padding: 20px 50px;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 3px;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  pointer-events: auto;
  z-index: 100;
}

.primary-btn {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: white;
  box-shadow: 
    0 10px 40px rgba(236, 72, 153, 0.5),
    0 0 60px rgba(139, 92, 246, 0.3);
}

.primary-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 
    0 20px 60px rgba(236, 72, 153, 0.7),
    0 0 100px rgba(139, 92, 246, 0.5);
}

.secondary-btn {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
  color: white;
  border: 2px solid rgba(139, 92, 246, 0.5);
  box-shadow: 0 5px 20px rgba(59, 130, 246, 0.3);
}

.secondary-btn:hover {
  transform: translateY(-3px);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.5), rgba(139, 92, 246, 0.5));
  box-shadow: 0 10px 40px rgba(59, 130, 246, 0.5);
}

.btn-shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: rotate(45deg);
  animation: btnShine 3s linear infinite;
}

@keyframes btnShine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.btn-icon {
  font-size: 1.5rem;
}

.btn-text {
  position: relative;
  z-index: 2;
}

.large {
  padding: 25px 60px;
  font-size: 1.5rem;
}

/* Best Score Display */
.best-score-display {
  margin-top: 30px;
  padding: 15px 30px;
  background: rgba(251, 191, 36, 0.1);
  border: 2px solid rgba(251, 191, 36, 0.3);
  border-radius: 10px;
  display: inline-block;
}

.best-label {
  font-size: 1.1rem;
  color: #fbbf24;
  font-weight: 700;
  margin-right: 10px;
}

.best-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 0 20px #fbbf24;
}

/* Modal Styles */
.modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(45deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  letter-spacing: 3px;
}

/* Instructions */
.instructions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
  text-align: left;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(139, 92, 246, 0.1);
  border-left: 4px solid #8b5cf6;
  border-radius: 8px;
  font-size: 1rem;
}

.instruction-icon {
  font-size: 1.5rem;
}

/* Target Guide */
.targets-title {
  font-size: 1.3rem;
  color: #ec4899;
  margin: 20px 0 15px;
  font-weight: 700;
}

/* Custom Scrollbar for modals */
.modal-container::-webkit-scrollbar {
  width: 8px;
}

.modal-container::-webkit-scrollbar-track {
  background: rgba(20, 15, 35, 0.5);
  border-radius: 4px;
}

.modal-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-radius: 4px;
}

.modal-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
}

.target-guide {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.target-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(20, 15, 35, 0.8);
  border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.target-preview {
  font-size: 2rem;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
}

.target-preview.red { color: #ef4444; text-shadow: 0 0 20px #ef4444; }
.target-preview.yellow { color: #fbbf24; text-shadow: 0 0 20px #fbbf24; }
.target-preview.purple { color: #a855f7; text-shadow: 0 0 20px #a855f7; }
.target-preview.green { color: #22c55e; text-shadow: 0 0 20px #22c55e; }
.target-preview.blue { color: #3b82f6; text-shadow: 0 0 20px #3b82f6; }

.target-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.9rem;
}

.target-details strong {
  font-size: 1.1rem;
  color: #fff;
}

.target-details span {
  color: #c4b5fd;
}

/* Settings */
.settings-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin: 15px 0;
  background: rgba(20, 15, 35, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.setting-label {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-icon {
  font-size: 1.5rem;
}

.toggle-btn {
  position: relative;
  width: 80px;
  height: 40px;
  background: rgba(239, 68, 68, 0.3);
  border: 2px solid rgba(239, 68, 68, 0.5);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: auto;
}

.toggle-btn.active {
  background: rgba(34, 197, 94, 0.3);
  border-color: rgba(34, 197, 94, 0.5);
}

.toggle-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  background: #ef4444;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.toggle-btn.active .toggle-slider {
  left: 44px;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

.toggle-text {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  font-size: 0.8rem;
  font-weight: 700;
  color: #ef4444;
}

.toggle-btn.active .toggle-text {
  left: 10px;
  right: auto;
  color: #22c55e;
}

/* Game Canvas */
#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, #1a0b2e 0%, #0a0014 100%);
  cursor: none; /* Hide cursor only in game */
}

/* HUD */
.hud {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  padding: 20px 40px;
}

.lives-container, .score-container, .wave-container {
  background: linear-gradient(135deg, rgba(20, 15, 35, 0.9), rgba(40, 25, 60, 0.9));
  padding: 15px 30px;
  border-radius: 15px;
  border: 2px solid rgba(236, 72, 153, 0.5);
  box-shadow: 0 0 30px rgba(236, 72, 153, 0.3);
  backdrop-filter: blur(10px);
}

.hud-label {
  display: block;
  font-size: 0.9rem;
  color: #c4b5fd;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 5px;
}

.lives-display {
  display: flex;
  gap: 10px;
  font-size: 1.5rem;
}

.life-heart {
  transition: all 0.3s ease;
  filter: drop-shadow(0 0 10px #ef4444);
}

.life-heart:not(.active) {
  opacity: 0.2;
  filter: grayscale(1);
}

.score-value, .wave-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(45deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(236, 72, 153, 0.8);
}

/* Combo Display */
.combo-container {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
}

.combo-display {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border: 3px solid rgba(251, 191, 36, 0.6);
  border-radius: 15px;
  padding: 15px 40px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 0 40px rgba(251, 191, 36, 0.5);
  animation: comboAppear 0.3s ease;
}

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

.combo-display.hidden {
  display: none;
}

.combo-label {
  font-size: 1.2rem;
  color: #fbbf24;
  font-weight: 700;
}

.combo-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 0 20px #fbbf24;
}

.combo-multiplier {
  font-size: 1.5rem;
  color: #fcd34d;
  font-weight: 700;
}

/* Power-up Indicators */
.powerup-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
}

.powerup-indicator {
  background: rgba(20, 15, 35, 0.9);
  border: 2px solid rgba(236, 72, 153, 0.5);
  border-radius: 12px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}

.powerup-indicator.hidden {
  display: none;
}

.powerup-icon {
  font-size: 2rem;
  animation: powerupPulse 1s ease-in-out infinite;
}

@keyframes powerupPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.powerup-timer-bar {
  width: 100px;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.powerup-timer-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ec4899, #8b5cf6);
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.8);
}

/* Countdown Overlay */
.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 200;
  pointer-events: none;
}

.countdown-overlay.hidden {
  display: none;
}

.countdown-number {
  font-family: 'Orbitron', sans-serif;
  font-size: 15rem;
  font-weight: 900;
  background: linear-gradient(45deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: countdownPulse 1s ease-in-out;
  text-shadow: 0 0 100px rgba(236, 72, 153, 1);
  filter: drop-shadow(0 0 50px rgba(236, 72, 153, 1));
}

@keyframes countdownPulse {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Game Over Screen */
.gameover-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 5rem;
  font-weight: 900;
  background: linear-gradient(45deg, #ef4444, #dc2626);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 40px;
  letter-spacing: 8px;
  animation: gameOverShake 0.5s ease-in-out;
}

@keyframes gameOverShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.stats-display {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 40px 0;
}

.stat-item {
  background: rgba(20, 15, 35, 0.8);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.stat-label {
  display: block;
  font-size: 1rem;
  color: #c4b5fd;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(45deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-value.best {
  background: linear-gradient(45deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px #fbbf24;
}

.gameover-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-title {
    font-size: 3rem;
  }
  
  .menu-btn {
    font-size: 1.1rem;
    padding: 15px 35px;
  }
  
  .target-guide {
    grid-template-columns: 1fr;
  }
  
  .stats-display {
    grid-template-columns: 1fr;
  }
  
  .hud-top {
    flex-direction: column;
    gap: 10px;
  }
}

/* Leaderboard Styles */
.leaderboard-list {
  margin: 30px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-entry {
  display: grid;
  grid-template-columns: 50px 1fr 100px;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  background: linear-gradient(135deg, rgba(30, 20, 50, 0.8), rgba(40, 30, 60, 0.8));
  border-radius: 12px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  transition: all 0.3s ease;
}

.leaderboard-entry:hover {
  transform: translateX(5px);
  border-color: #8b5cf6;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.leaderboard-entry.top1 {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
}

.leaderboard-entry.top2 {
  border-color: #d1d5db;
  background: linear-gradient(135deg, rgba(209, 213, 219, 0.2), rgba(156, 163, 175, 0.2));
}

.leaderboard-entry.top3 {
  border-color: #cd7f32;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(180, 100, 40, 0.2));
}

.leaderboard-rank {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  color: #8b5cf6;
}

.leaderboard-entry.top1 .leaderboard-rank {
  color: #fbbf24;
  text-shadow: 0 0 20px #fbbf24;
}

.leaderboard-entry.top2 .leaderboard-rank {
  color: #d1d5db;
  text-shadow: 0 0 20px #d1d5db;
}

.leaderboard-entry.top3 .leaderboard-rank {
  color: #cd7f32;
  text-shadow: 0 0 20px #cd7f32;
}

.leaderboard-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  text-align: right;
  background: linear-gradient(45deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.leaderboard-empty {
  text-align: center;
  padding: 40px;
  color: #c4b5fd;
  font-size: 1.2rem;
}

/* Name Input Container */
.name-input-container {
  margin: 30px 0;
  padding: 25px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border: 2px solid rgba(251, 191, 36, 0.5);
  border-radius: 15px;
  display: none;
}

.name-input-container.show {
  display: block;
  animation: slideIn 0.5s ease;
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.name-label {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 15px;
  text-align: center;
}

.name-input {
  width: 100%;
  padding: 15px;
  font-size: 1.2rem;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  text-align: center;
  background: rgba(20, 15, 35, 0.9);
  border: 2px solid rgba(251, 191, 36, 0.5);
  border-radius: 10px;
  color: white;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.name-input:focus {
  outline: none;
  border-color: #fbbf24;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.name-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}