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

body {
  background: linear-gradient(135deg, #0f0f23, #1a1a2e, #16213e);
  font-family: "Arial", sans-serif;
  color: white;
  overflow: hidden;
  animation: backgroundPulse 4s ease-in-out infinite alternate;
}

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

.game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#gameCanvas {
  border: 2px solid #444;
  background: radial-gradient(circle at center, #2a2a4a, #1a1a3a);
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0, 100, 255, 0.3), inset 0 0 50px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.3s ease;
}

#gameCanvas:hover {
  box-shadow: 0 0 40px rgba(0, 150, 255, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.stats {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.health-bar {
  position: relative;
  width: 200px;
  height: 20px;
  background: #333;
  border: 2px solid #666;
  border-radius: 10px;
  overflow: hidden;
}

.health-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #ff6666);
  transition: width 0.3s ease;
  width: 100%;
}

.health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.score,
.level,
.time {
  background: rgba(0, 0, 0, 0.7);
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: bold;
  font-size: 14px;
}

.upgrade-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #666;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  pointer-events: auto;
  min-width: 400px;
}

.upgrade-menu h2 {
  margin-bottom: 20px;
  color: #ffdd44;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.upgrade-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.upgrade-option {
  background: linear-gradient(135deg, #444, #666);
  border: 2px solid #888;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upgrade-option:hover {
  background: linear-gradient(135deg, #555, #777);
  border-color: #aaa;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.upgrade-option h3 {
  color: #ffdd44;
  margin-bottom: 5px;
}

.upgrade-option p {
  font-size: 14px;
  color: #ccc;
}

.game-over {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #666;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  pointer-events: auto;
}

.game-over h2 {
  color: #ff4444;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.game-over button {
  background: linear-gradient(135deg, #4caf50, #45a049);
  border: none;
  color: white;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.3s ease;
}

.game-over button:hover {
  background: linear-gradient(135deg, #45a049, #4caf50);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Main Menu Styles */
.main-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 50, 0.9));
  border: 3px solid #666;
  border-radius: 15px;
  padding: 40px;
  text-align: center;
  pointer-events: auto;
  min-width: 400px;
  box-shadow: 0 0 50px rgba(0, 100, 255, 0.3);
  animation: menuGlow 2s ease-in-out infinite alternate;
}

@keyframes menuGlow {
  0% { box-shadow: 0 0 30px rgba(0, 100, 255, 0.3); }
  100% { box-shadow: 0 0 50px rgba(0, 150, 255, 0.5); }
}

.main-menu h1 {
  font-size: 3em;
  margin-bottom: 30px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  animation: titleShimmer 3s ease-in-out infinite;
}

@keyframes titleShimmer {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(180deg); }
}

/* Pause Menu Styles */
.pause-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #666;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  pointer-events: auto;
  min-width: 300px;
  backdrop-filter: blur(10px);
}

.pause-menu h2 {
  color: #ffdd44;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Menu Buttons */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.menu-buttons button {
  background: linear-gradient(135deg, #4caf50, #45a049);
  border: none;
  color: white;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.menu-buttons 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;
}

.menu-buttons button:hover::before {
  left: 100%;
}

.menu-buttons button:hover {
  background: linear-gradient(135deg, #45a049, #4caf50);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Particle Effects */
.particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  animation: particleFloat 2s ease-out forwards;
}

@keyframes particleFloat {
  0% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(360deg);
  }
}

/* Enhanced Health Bar */
.health-bar {
  position: relative;
  width: 200px;
  height: 20px;
  background: #333;
  border: 2px solid #666;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.health-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #ff6666, #ff8888);
  transition: width 0.3s ease;
  width: 100%;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
  animation: healthPulse 1s ease-in-out infinite alternate;
}

@keyframes healthPulse {
  0% { box-shadow: 0 0 5px rgba(255, 68, 68, 0.3); }
  100% { box-shadow: 0 0 15px rgba(255, 68, 68, 0.7); }
}

/* XP Bar */
.xp-bar {
  position: relative;
  width: 200px;
  height: 16px;
  background: #333;
  border: 2px solid #666;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff00, #44ff44, #88ff88);
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  animation: xpPulse 1s ease-in-out infinite alternate;
}

@keyframes xpPulse {
  0% { box-shadow: 0 0 5px rgba(0, 255, 0, 0.3); }
  100% { box-shadow: 0 0 15px rgba(0, 255, 0, 0.7); }
}

.xp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  color: white;
}

.controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #ccc;
  font-size: 14px;
}

.controls p {
  margin: 5px 0;
}

.hidden {
  display: none;
}

/* Screen shake animation */
@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2px, -1px); }
  20% { transform: translate(2px, 1px); }
  30% { transform: translate(-1px, 2px); }
  40% { transform: translate(1px, -2px); }
  50% { transform: translate(-2px, 1px); }
  60% { transform: translate(2px, -1px); }
  70% { transform: translate(-1px, -2px); }
  80% { transform: translate(1px, 2px); }
  90% { transform: translate(-2px, -1px); }
}

.screen-shake {
  animation: screenShake 0.5s ease-in-out;
}

/* Responsive design */
@media (max-width: 1300px) {
  #gameCanvas {
    width: 95vw;
    height: 70vh;
  }
}

@media (max-width: 800px) {
  .upgrade-menu {
    min-width: 300px;
    padding: 20px;
  }

  .stats {
    top: 10px;
    left: 10px;
  }

  .health-bar {
    width: 150px;
    height: 18px;
  }

  .controls {
    bottom: 10px;
    font-size: 12px;
  }
}
