@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap');

:root {
  --color-primary: #0a0b1f;
  --color-accent: #2ecc71;
  --color-accent-dark: #27ae60;
  --color-planet: #3949ab;
  --color-crater: #303f9f;
}

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

body {
  background-color: var(--color-primary);
  color: white;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.container {
  text-align: center;
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  position: relative;
  z-index: 2;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  color: white;
}

.error-code .digit {
  position: relative;
  z-index: 2;
}

.error-code .digit.middle {
  color: var(--color-accent);
  animation: pulsate 2s infinite ease-in-out;
}

.error-message {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.sub-message {
  font-size: 1.2rem;
  font-weight: 400;
  margin-bottom: 2rem;
  color: #aad8ff;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.button {
  display: inline-block;
  padding: 12px 28px;
  background-color: var(--color-accent);
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-weight: 700;
  margin-top: 2rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(46, 204, 113, 0.4);
}

.button:hover {
  background-color: var(--color-accent-dark);
  transform: translateY(-3px);
  box-shadow: 0 0 30px rgba(46, 204, 113, 0.6);
}

.scene {
  position: relative;
  height: 300px;
  margin-bottom: 2rem;
}

.stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.star {
  position: absolute;
  background-color: white;
  border-radius: 50%;
  animation: twinkle 3s infinite;
}

.planet {
  width: 220px;
  height: 220px;
  background-color: var(--color-planet);
  border-radius: 50%;
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  z-index: 2;
}

.planet::after {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 50%;
  box-shadow: inset -30px -30px 60px rgba(0, 0, 0, 0.5);
}

/* Reusable crater class */
[class^="crater-"] {
  background-color: var(--color-crater);
  border-radius: 50%;
  position: absolute;
}

.crater-1 {
  width: 30px;
  height: 30px;
  top: 40px;
  left: 50px;
}

.crater-2 {
  width: 20px;
  height: 20px;
  top: 80px;
  left: 30px;
}

.crater-3 {
  width: 25px;
  height: 25px;
  top: 60px;
  right: 40px;
}

.crater-4 {
  width: 15px;
  height: 15px;
  top: 100px;
  right: 70px;
}

.crater-5 {
  width: 18px;
  height: 18px;
  top: 130px;
  left: 80px;
}

.crater-6 {
  width: 22px;
  height: 22px;
  top: 150px;
  right: 60px;
}

.crater-7 {
  width: 12px;
  height: 12px;
  top: 170px;
  left: 40px;
}

.crater-8 {
  width: 28px;
  height: 28px;
  top: 110px;
  left: 110px;
}

.ufo {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  animation: hover 4s infinite ease-in-out;
}

.ufo-body {
  width: 120px;
  height: 40px;
  background-color: #3498db;
  border-radius: 60px;
  position: relative;
  box-shadow: 0 0 30px rgba(52, 152, 219, 0.7);
}

.ufo-dome {
  width: 70px;
  height: 35px;
  background-color: #85c1e9;
  border-radius: 35px 35px 0 0;
  position: absolute;
  top: -35px;
  left: 25px;
  overflow: hidden;
}

.ufo-dome::after {
  content: '';
  width: 100%;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.3);
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 35px 35px 0 0;
}

.ufo-light {
  width: 80px;
  height: 200px;
  background: linear-gradient(to bottom, rgba(46, 204, 113, 0.8), rgba(46, 204, 113, 0));
  position: absolute;
  top: 40px;
  left: 20px;
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
  animation: pulse 2s infinite alternate;
}

.ufo-ring {
  width: 140px;
  height: 10px;
  background-color: #2980b9;
  border-radius: 5px;
  position: absolute;
  bottom: -5px;
  left: -10px;
}

/* Reusable window class */
.ufo-window {
  width: 10px;
  height: 10px;
  background-color: #f1c40f;
  border-radius: 50%;
  position: absolute;
  top: 15px;
}

.ufo-window.left {
  left: 30px;
}

.ufo-window.middle {
  left: 55px;
}

.ufo-window.right {
  left: 80px;
}

.number-container {
  position: absolute;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  animation: float 3s infinite alternate ease-in-out;
}

.number {
  font-size: 3rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 0 10px rgba(46, 204, 113, 0.7);
  opacity: 0.9;
}

@keyframes pulsate {
  0% { text-shadow: 0 0 10px rgba(46, 204, 113, 0.7); }
  50% { text-shadow: 0 0 20px rgba(46, 204, 113, 1); }
  100% { text-shadow: 0 0 10px rgba(46, 204, 113, 0.7); }
}

@keyframes twinkle {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

@keyframes hover {
  0% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-15px); }
  100% { transform: translateX(-50%) translateY(0); }
}

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

@keyframes pulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  .error-code {
    font-size: 6rem;
  }

  .error-message {
    font-size: 1.5rem;
  }

  .scene {
    height: 250px;
  }

  .ufo {
    transform: translateX(-50%) scale(0.8);
  }

  .planet {
    width: 180px;
    height: 180px;
  }
}