* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Arial", sans-serif;
}

body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  color: #fff;
  animation: backgroundPulse 10s ease-in-out infinite alternate;
}

@keyframes backgroundPulse {
  0% { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }
  100% { background: linear-gradient(135deg, #16213e 0%, #0f3460 50%, #1a1a2e 100%); }
}

.game-container {
  width: 100%;
  max-width: 800px;
  background: linear-gradient(145deg, #16213e, #1a1a2e);
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(233, 69, 96, 0.3), 0 0 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  border: 2px solid rgba(233, 69, 96, 0.2);
}

.header {
  background: linear-gradient(90deg, #0f3460, #16213e, #0f3460);
  padding: 15px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(233, 69, 96, 0.1), transparent);
  animation: headerShine 3s ease-in-out infinite;
}

@keyframes headerShine {
  0% { left: -100%; }
  100% { left: 100%; }
}

.header h1 {
  margin-bottom: 10px;
  color: #e94560;
  text-shadow: 0 0 10px rgba(233, 69, 96, 0.5), 2px 2px 4px rgba(0, 0, 0, 0.5);
  font-size: 2.2em;
  animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  0% { text-shadow: 0 0 10px rgba(233, 69, 96, 0.5), 2px 2px 4px rgba(0, 0, 0, 0.5); }
  100% { text-shadow: 0 0 20px rgba(233, 69, 96, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.5); }
}

.stats {
  display: flex;
  justify-content: space-around;
  margin: 10px 0;
}

.stat {
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
  padding: 5px 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.stat:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.game-area {
  position: relative;
  width: 100%;
  height: 500px;
  background-color: #1a1a2e;
  overflow: hidden;
}

canvas {
  display: block;
}

.controls {
  display: flex;
  flex-direction: column;
  padding: 15px;
  background-color: #0f3460;
}

.towers {
  display: flex;
  justify-content: space-around;
  margin-bottom: 15px;
}

.tower-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.tower-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.tower-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(233, 69, 96, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(233, 69, 96, 0.3);
}

.tower-option:hover::before {
  transform: translateX(100%);
}

.tower-option.selected {
  background: rgba(233, 69, 96, 0.3);
  border-color: #e94560;
  box-shadow: 0 0 15px rgba(233, 69, 96, 0.5);
  animation: selectedPulse 1.5s ease-in-out infinite;
}

@keyframes selectedPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(233, 69, 96, 0.5); }
  50% { box-shadow: 0 0 25px rgba(233, 69, 96, 0.8); }
}

.tower {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  margin-bottom: 5px;
}

.basic-tower {
  background-color: #4caf50;
  border: 2px solid #2e7d32;
}

.sniper-tower {
  background-color: #2196f3;
  border: 2px solid #0d47a1;
}

.aoe-tower {
  background-color: #ff9800;
  border: 2px solid #e65100;
}

.tower-info {
  font-size: 12px;
  text-align: center;
}

.buttons {
  display: flex;
  justify-content: space-around;
}

button {
  background: linear-gradient(145deg, #e94560, #b23450);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover {
  background: linear-gradient(145deg, #ff4757, #e94560);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(233, 69, 96, 0.4);
}

button:hover::before {
  left: 100%;
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

button:disabled {
  background-color: #666;
  cursor: not-allowed;
}

#gameMessage {
  padding: 15px;
  text-align: center;
  font-size: 16px;
  color: #e94560;
  min-height: 40px;
  background: rgba(233, 69, 96, 0.1);
  border-radius: 8px;
  margin: 10px;
  border: 1px solid rgba(233, 69, 96, 0.3);
  text-shadow: 0 0 5px rgba(233, 69, 96, 0.5);
  animation: messageGlow 2s ease-in-out infinite alternate;
}

@keyframes messageGlow {
  0% { border-color: rgba(233, 69, 96, 0.3); }
  100% { border-color: rgba(233, 69, 96, 0.6); }
}

/* Game elements */
.enemy {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.projectile {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.tower-canvas {
  width: 40px;
  height: 40px;
  display: block;
  background: transparent;
  margin-bottom: 5px;
}

@media (max-width: 600px) {
  .game-area {
    height: 300px;
  }

  .stats {
    flex-wrap: wrap;
  }

  .stat {
    width: 50%;
    margin-bottom: 5px;
  }

  .towers {
    flex-wrap: wrap;
  }

  .tower-option {
    width: 30%;
    margin-bottom: 10px;
  }
}
