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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
  color: white;
}

.game-container {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 30px;
  max-width: 1000px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.5s ease-out;
  backdrop-filter: blur(10px);
}

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

.game-header {
  text-align: center;
  margin-bottom: 30px;
}

.game-title {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #00d4ff 0%, #ff00ff 50%, #ffff00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  animation: pulse 2s infinite;
}

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

.title-emoji {
  display: inline-block;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.game-controls {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

.difficulty-selector,
.mode-selector {
  display: flex;
  align-items: center;
  gap: 15px;
}

.difficulty-selector label,
.mode-selector label {
  font-weight: bold;
  color: #00d4ff;
}

.difficulty-buttons,
.mode-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.difficulty-btn,
.mode-btn {
  padding: 8px 16px;
  border: 2px solid #00d4ff;
  background: rgba(0, 212, 255, 0.1);
  color: #00d4ff;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.difficulty-btn:hover,
.mode-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.2);
}

.difficulty-btn.active,
.mode-btn.active {
  background: #00d4ff;
  color: #0f0f23;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.stats-bar {
  display: flex;
  justify-content: space-around;
  padding: 15px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(255, 0, 255, 0.2) 100%);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 15px;
  margin-bottom: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.stat-label {
  font-size: 0.9rem;
  color: #ccc;
}

.stat-value {
  font-weight: bold;
  font-size: 1.1rem;
  color: #00d4ff;
}

.power-ups-bar {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.power-up {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 15px;
  background: linear-gradient(135deg, rgba(255, 165, 0, 0.2) 0%, rgba(255, 69, 0, 0.2) 100%);
  border: 1px solid rgba(255, 165, 0, 0.5);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-width: 80px;
}

.power-up:hover:not(.disabled) {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 25px rgba(255, 165, 0, 0.4);
}

.power-up.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.power-up.active {
  background: linear-gradient(135deg, rgba(255, 0, 255, 0.3) 0%, rgba(255, 20, 147, 0.3) 100%);
  border-color: #ff00ff;
  animation: powerUpActive 1s infinite;
}

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

.power-icon {
  font-size: 2rem;
}

.power-name {
  font-size: 0.8rem;
  font-weight: bold;
  color: white;
}

.power-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff0080;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

.game-board {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
}

#game-canvas {
  border: 2px solid #00d4ff;
  border-radius: 10px;
  background: linear-gradient(180deg, #000814 0%, #001d3d 50%, #003566 100%);
  box-shadow: 
    0 0 20px rgba(0, 212, 255, 0.3),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.game-controls-bottom {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.control-btn {
  padding: 12px 25px;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.control-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.controls-help {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 15px;
  margin-bottom: 20px;
  text-align: center;
}

.controls-help h3 {
  color: #00d4ff;
  margin-bottom: 10px;
}

.controls-help p {
  color: #ccc;
  margin: 5px 0;
  font-size: 0.9rem;
}

.controls-help strong {
  color: #ffff00;
}

.achievements-bar {
  background: linear-gradient(135deg, rgba(0, 255, 127, 0.1) 0%, rgba(0, 255, 255, 0.1) 100%);
  border: 1px solid rgba(0, 255, 127, 0.3);
  padding: 15px;
  border-radius: 15px;
}

.achievements-bar h3 {
  color: #00ff7f;
  margin-bottom: 10px;
}

.achievements-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 40px;
}

.achievement-item {
  background: rgba(0, 255, 127, 0.2);
  border: 1px solid #00ff7f;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: achievementSlide 0.5s ease;
  box-shadow: 0 3px 10px rgba(0, 255, 127, 0.3);
}

@keyframes achievementSlide {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.achievement-icon {
  font-size: 1.2rem;
}

.achievement-text {
  font-size: 0.9rem;
  color: white;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
  border: 1px solid rgba(0, 212, 255, 0.3);
  padding: 30px;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  animation: modalPop 0.3s ease;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

@keyframes modalPop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 2rem;
  cursor: pointer;
  color: #999;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: #00d4ff;
}

.modal-title {
  color: #00d4ff;
  margin-bottom: 20px;
  font-size: 2rem;
}

.modal-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.final-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.final-stat-label {
  color: #ccc;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.final-stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #00d4ff;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.modal-btn {
  padding: 12px 25px;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
}

.boss-info {
  margin-bottom: 20px;
}

.boss-avatar {
  font-size: 4rem;
  margin-bottom: 10px;
}

.boss-health-bar {
  width: 100%;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 10px;
}

.boss-health {
  height: 100%;
  background: linear-gradient(90deg, #ff0000 0%, #ff4500 50%, #ffff00 100%);
  width: 100%;
  transition: width 0.3s ease;
}

.leaderboard-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 8px 16px;
  border: 2px solid #00d4ff;
  background: rgba(0, 212, 255, 0.1);
  color: #00d4ff;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: #00d4ff;
  color: #0f0f23;
}

.leaderboard-list {
  text-align: left;
  max-height: 300px;
  overflow-y: auto;
}

.leaderboard-list li {
  padding: 10px;
  margin-bottom: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  color: white;
}

.leaderboard-list li:nth-child(1) {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 193, 7, 0.3) 100%);
  border-color: #ffd700;
}

.leaderboard-list li:nth-child(2) {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.3) 0%, rgba(169, 169, 169, 0.3) 100%);
  border-color: #c0c0c0;
}

.leaderboard-list li:nth-child(3) {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.3) 0%, rgba(184, 115, 51, 0.3) 100%);
  border-color: #cd7f32;
}

.shop-currency {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 1.2rem;
}

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

.currency-value {
  color: #ffff00;
  font-weight: bold;
}

.shop-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.shop-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
}

.shop-item:hover {
  border-color: #00d4ff;
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
}

.item-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.item-info h4 {
  color: #00d4ff;
  margin-bottom: 5px;
}

.item-info p {
  color: #ccc;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.item-cost {
  color: #ffff00;
  font-weight: bold;
}

.buy-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
  color: white;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.buy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 255, 0, 0.3);
}

.buy-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

#particles-canvas,
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

@media (max-width: 768px) {
  .game-title {
    font-size: 1.8rem;
  }
  
  .game-controls {
    flex-direction: column;
    gap: 15px;
  }
  
  .stats-bar {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .power-ups-bar {
    flex-wrap: wrap;
  }
  
  #game-canvas {
    max-width: 100%;
    height: auto;
  }
  
  .game-controls-bottom {
    flex-wrap: wrap;
  }
  
  .modal-stats {
    flex-direction: column;
    gap: 10px;
  }
  
  .shop-items {
    grid-template-columns: 1fr;
  }
}