body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background-color: #050a18;
  font-family: 'Rajdhani', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  overflow: hidden;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(0, 60, 120, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(120, 0, 120, 0.2) 0%, transparent 40%);
  z-index: -1;
  animation: backgroundPulse 15s infinite alternate;
}

@keyframes backgroundPulse {
  0% { opacity: 0.5; }
  50% { opacity: 0.8; }
  100% { opacity: 0.5; }
}

h1 {
  margin-bottom: 15px;
  font-size: 3rem;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #00f0ff, #0080ff, #d100ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 
    0 0 10px rgba(0, 240, 255, 0.7),
    0 0 20px rgba(0, 128, 255, 0.5);
  animation: titleGlow 3s infinite alternate;
}

@keyframes titleGlow {
  from {
    text-shadow: 
      0 0 10px rgba(0, 240, 255, 0.7),
      0 0 20px rgba(0, 128, 255, 0.5);
  }
  to {
    text-shadow: 
      0 0 15px rgba(0, 240, 255, 0.9),
      0 0 30px rgba(0, 128, 255, 0.7),
      0 0 45px rgba(209, 0, 255, 0.5);
  }
}

.grid-lines {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-size: 50px 50px;
  background-image:
    linear-gradient(to right, rgba(30, 60, 100, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30, 60, 100, 0.1) 1px, transparent 1px);
  z-index: -1;
  transform: perspective(500px) rotateX(60deg);
  transform-origin: center top;
  opacity: 0.3;
  animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
  from { background-position: 0 0; }
  to { background-position: 0 50px; }
}

.game-container {
  position: relative;
  margin: 20px 0;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.game-container::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 2px solid rgba(0, 200, 255, 0.3);
  border-radius: 10px;
  box-shadow: 
    0 0 15px rgba(0, 200, 255, 0.5),
    0 0 30px rgba(0, 200, 255, 0.2);
  z-index: -1;
  animation: borderPulse 4s infinite alternate;
}

@keyframes borderPulse {
  0% { border-color: rgba(0, 200, 255, 0.3); box-shadow: 0 0 15px rgba(0, 200, 255, 0.5), 0 0 30px rgba(0, 200, 255, 0.2); }
  50% { border-color: rgba(209, 0, 255, 0.3); box-shadow: 0 0 15px rgba(209, 0, 255, 0.5), 0 0 30px rgba(209, 0, 255, 0.2); }
  100% { border-color: rgba(0, 200, 255, 0.3); box-shadow: 0 0 15px rgba(0, 200, 255, 0.5), 0 0 30px rgba(0, 200, 255, 0.2); }
}

canvas {
  border: 2px solid rgba(0, 200, 255, 0.7);
  background-color: rgba(5, 10, 25, 0.9);
  border-radius: 8px;
  box-shadow: 
    0 0 20px rgba(0, 200, 255, 0.5),
    0 0 40px rgba(0, 200, 255, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-container:hover canvas {
  box-shadow: 
    0 0 25px rgba(0, 200, 255, 0.6),
    0 0 50px rgba(0, 200, 255, 0.3);
}

.controls {
  margin-top: 25px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.8), rgba(0, 100, 200, 0.8));
  color: white;
  font-family: 'Rajdhani', sans-serif;
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.2),
    0 0 10px rgba(0, 200, 255, 0.3);
  position: relative;
  overflow: hidden;
}

button::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0)
  );
  transform: rotate(30deg);
  opacity: 0;
  transition: opacity 0.3s ease;
}

button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 6px 12px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(0, 200, 255, 0.5);
  background: linear-gradient(135deg, rgba(0, 220, 255, 0.9), rgba(0, 120, 220, 0.9));
}

button:hover::after {
  opacity: 1;
  animation: buttonGlare 1s ease;
}

@keyframes buttonGlare {
  from { transform: translateX(-100%) rotate(30deg); }
  to { transform: translateX(100%) rotate(30deg); }
}

button:active {
  transform: translateY(1px);
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 0 8px rgba(0, 200, 255, 0.3);
}

#score {
  font-size: 1.8rem;
  margin-top: 20px;
  font-weight: bold;
  font-family: 'Orbitron', sans-serif;
  color: #00f0ff;
  text-shadow: 
    0 0 10px rgba(0, 240, 255, 0.7),
    0 0 20px rgba(0, 128, 255, 0.5);
  letter-spacing: 1px;
  animation: scorePulse 2s infinite alternate;
}

@keyframes scorePulse {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

#gameOverModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(5, 10, 25, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(5px);
}

#gameOverModal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: linear-gradient(135deg, rgba(10, 20, 40, 0.9), rgba(5, 10, 25, 0.9));
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  border: 2px solid rgba(0, 200, 255, 0.3);
  box-shadow: 
    0 0 30px rgba(0, 200, 255, 0.5),
    0 0 60px rgba(0, 200, 255, 0.2);
  transform: scale(0.8) translateY(30px);
  transition: transform 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

#gameOverModal.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-content h2 {
  color: #ff2d55;
  margin-top: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  text-shadow: 
    0 0 10px rgba(255, 45, 85, 0.7),
    0 0 20px rgba(255, 45, 85, 0.5);
  letter-spacing: 2px;
}

.modal-content p {
  font-size: 1.5rem;
  margin: 20px 0;
  color: #00f0ff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}

.modal-content button {
  margin-top: 25px;
  padding: 15px 30px;
  font-size: 1.2rem;
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.8), rgba(200, 0, 100, 0.8));
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.2),
    0 0 15px rgba(255, 45, 85, 0.4);
}

.modal-content button:hover {
  background: linear-gradient(135deg, rgba(255, 65, 105, 0.9), rgba(220, 20, 120, 0.9));
  box-shadow: 
    0 6px 12px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(255, 45, 85, 0.6);
}

.particles {
  position: absolute;
  pointer-events: none;
  z-index: 10;
}

.stats {
  display: flex;
  gap: 30px;
  margin-top: 15px;
  font-family: 'Rajdhani', sans-serif;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: #00f0ff;
  text-shadow: 0 0 5px rgba(0, 240, 255, 0.5);
}

.power-up {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 1) 0%, rgba(255, 140, 0, 1) 100%);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  animation: powerUpPulse 1.5s infinite alternate;
  z-index: 5;
}

@keyframes powerUpPulse {
  from { transform: scale(0.9); box-shadow: 0 0 15px rgba(255, 215, 0, 0.8); }
  to { transform: scale(1.1); box-shadow: 0 0 25px rgba(255, 215, 0, 1); }
}

.obstacle {
  position: absolute;
  background: linear-gradient(135deg, rgba(220, 20, 60, 0.8), rgba(139, 0, 0, 0.8));
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(220, 20, 60, 0.6);
  z-index: 5;
}
