:root {
  --bg-color: #050508;
  --sun-color: #ffcc33;
  --orbit-color: rgba(255, 255, 255, 0.1);
  --text-color: #e0e0e0;
}

body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family:
    "Poppins",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  color: var(--text-color);
}

/* Espacio estrellado */
#universe {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1a1a2e 0%, #050508 100%);
}

/* El Sol */
.sun {
  width: 80px;
  height: 80px;
  background: radial-gradient(
    circle at 35% 35%,
    #fffdf0 0%,
    #fff9c4 15%,
    #ffeb3b 30%,
    #ffc107 50%,
    #ff9800 70%,
    #ff6f00 85%,
    #e65100 100%
  );
  border-radius: 50%;
  box-shadow:
    0 0 30px rgba(255, 235, 59, 0.9),
    0 0 60px rgba(255, 193, 7, 0.7),
    0 0 90px rgba(255, 152, 0, 0.5),
    0 0 120px rgba(255, 111, 0, 0.3),
    inset -5px -5px 15px rgba(230, 81, 0, 0.4),
    inset 5px 5px 15px rgba(255, 255, 255, 0.3);
  z-index: 10;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
  animation: sunPulse 4s ease-in-out infinite;
}

.sun::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 40% 40%,
    rgba(255, 255, 255, 0.6),
    rgba(255, 255, 255, 0.3) 25%,
    transparent 50%
  );
  pointer-events: none;
}

.sun::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140%;
  height: 140%;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 235, 59, 0.3),
    rgba(255, 193, 7, 0.2) 40%,
    transparent 70%
  );
  animation: sunCorona 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sunPulse {
  0%,
  100% {
    box-shadow:
      0 0 30px rgba(255, 235, 59, 0.9),
      0 0 60px rgba(255, 193, 7, 0.7),
      0 0 90px rgba(255, 152, 0, 0.5),
      0 0 120px rgba(255, 111, 0, 0.3),
      inset -5px -5px 15px rgba(230, 81, 0, 0.4),
      inset 5px 5px 15px rgba(255, 255, 255, 0.3);
  }
  50% {
    box-shadow:
      0 0 40px rgba(255, 235, 59, 1),
      0 0 80px rgba(255, 193, 7, 0.8),
      0 0 120px rgba(255, 152, 0, 0.6),
      0 0 160px rgba(255, 111, 0, 0.4),
      inset -5px -5px 15px rgba(230, 81, 0, 0.5),
      inset 5px 5px 15px rgba(255, 255, 255, 0.4);
  }
}

@keyframes sunCorona {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.8;
  }
}

.sun:hover {
  transform: scale(1.15);
  box-shadow:
    0 0 50px rgba(255, 235, 59, 1),
    0 0 100px rgba(255, 193, 7, 0.9),
    0 0 150px rgba(255, 152, 0, 0.7),
    0 0 200px rgba(255, 111, 0, 0.5),
    inset -5px -5px 15px rgba(230, 81, 0, 0.5),
    inset 5px 5px 15px rgba(255, 255, 255, 0.4);
}

/* Órbitas */
.orbit {
  position: absolute;
  border: 1px solid var(--orbit-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: rotate linear infinite;
  pointer-events: none;
}

/* Planetas */
.planet {
  position: absolute;
  border-radius: 50%;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  z-index: 20;
  pointer-events: auto;
}

/* Área de clic expandida para todos los planetas */
.planet::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  z-index: -1;
}

.planet:hover {
  transform: translate(-50%, -50%) scale(1.5);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
  z-index: 30;
}

/* Definición de órbitas y planetas específicos */
/* Mercurio */
.orbit-1 {
  width: 180px;
  height: 180px;
  animation-duration: 12s;
  animation-delay: -3s;
}
.planet-1 {
  width: 12px;
  height: 12px;
  background: radial-gradient(circle at 30% 30%, #a89968, #7a6b4d, #5a4d3a);
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.5);
}

/* Venus */
.orbit-2 {
  width: 250px;
  height: 250px;
  animation-duration: 18s;
  animation-delay: -7s;
}
.planet-2 {
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 35% 35%, #ffe680, #ffc649, #e6a830);
  box-shadow:
    inset -2px -2px 5px rgba(0, 0, 0, 0.4),
    0 0 8px rgba(255, 198, 73, 0.6);
}

/* Tierra */
.orbit-3 {
  width: 320px;
  height: 320px;
  animation-duration: 24s;
  animation-delay: -15s;
}
.planet-3 {
  width: 18px;
  height: 18px;
  background:
    radial-gradient(
      ellipse at 20% 25%,
      #3a7322 0%,
      #3a7322 10%,
      transparent 10%
    ),
    radial-gradient(
      ellipse at 65% 20%,
      #4a8c2a 0%,
      #4a8c2a 15%,
      transparent 15%
    ),
    radial-gradient(
      ellipse at 40% 50%,
      #2d5c1a 0%,
      #2d5c1a 12%,
      transparent 12%
    ),
    radial-gradient(ellipse at 75% 55%, #3d7322 0%, #3d7322 8%, transparent 8%),
    radial-gradient(
      ellipse at 15% 70%,
      #2f5c1a 0%,
      #2f5c1a 11%,
      transparent 11%
    ),
    radial-gradient(ellipse at 50% 75%, #4a8c2a 0%, #4a8c2a 9%, transparent 9%),
    radial-gradient(ellipse at 85% 80%, #3a7322 0%, #3a7322 7%, transparent 7%),
    radial-gradient(circle at 40% 30%, #6bb6ff, #4a90e2, #2e5f8f, #1a3d5f);
  box-shadow:
    inset -3px -3px 6px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(74, 144, 226, 0.5);
}

/* Marte */
.orbit-4 {
  width: 390px;
  height: 390px;
  animation-duration: 32s;
  animation-delay: -20s;
}
.planet-4 {
  width: 14px;
  height: 14px;
  background: radial-gradient(
    circle at 35% 35%,
    #ff9b7a,
    #e27b58,
    #c85a35,
    #a03d20
  );
  box-shadow: inset -2px -2px 5px rgba(0, 0, 0, 0.5);
}

/* Júpiter */
.orbit-5 {
  width: 500px;
  height: 500px;
  animation-duration: 50s;
  animation-delay: -35s;
}
.planet-5 {
  width: 35px;
  height: 35px;
  background: linear-gradient(
    to bottom,
    #d4a574 0%,
    #c88b3a 25%,
    #e6b886 35%,
    #c88b3a 50%,
    #b87333 65%,
    #d4a574 75%,
    #c88b3a 100%
  );
  box-shadow:
    inset -5px -5px 12px rgba(0, 0, 0, 0.6),
    0 0 15px rgba(200, 139, 58, 0.4);
}

/* Saturno */
.orbit-6 {
  width: 620px;
  height: 620px;
  animation-duration: 65s;
  animation-delay: -42s;
}
.planet-6 {
  width: 32px;
  height: 32px;
  background: linear-gradient(
    to bottom,
    #ffe4b3 0%,
    #fad5a5 30%,
    #f0c789 50%,
    #e6b876 70%,
    #fad5a5 100%
  );
  box-shadow:
    inset -4px -4px 10px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(250, 213, 165, 0.5);
}

.planet-6::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 55px;
  height: 18px;
  border: 2.5px solid rgba(230, 184, 118, 0.8);
  border-radius: 50%;
  box-shadow:
    inset 0 0 4px rgba(255, 228, 179, 0.7),
    0 0 6px rgba(230, 184, 118, 0.5);
  background: linear-gradient(
    to bottom,
    rgba(255, 228, 179, 0.2) 0%,
    rgba(250, 213, 165, 0.3) 50%,
    rgba(240, 199, 137, 0.2) 100%
  );
  pointer-events: none;
}

/* Urano */
.orbit-7 {
  width: 730px;
  height: 730px;
  animation-duration: 80s;
  animation-delay: -55s;
}
.planet-7 {
  width: 22px;
  height: 22px;
  background: radial-gradient(
    circle at 40% 40%,
    #8fefff,
    #4fd0e0,
    #2eb8cc,
    #1a8a9b
  );
  box-shadow:
    inset -3px -3px 8px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(79, 208, 224, 0.6);
}

/* Neptuno */
.orbit-8 {
  width: 840px;
  height: 840px;
  animation-duration: 100s;
  animation-delay: -68s;
}
.planet-8 {
  width: 20px;
  height: 20px;
  background: radial-gradient(
    circle at 35% 35%,
    #5a8cff,
    #4169e1,
    #2b4fa8,
    #1a3570
  );
  box-shadow:
    inset -3px -3px 8px rgba(0, 0, 0, 0.5),
    0 0 12px rgba(65, 105, 225, 0.6);
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Modal Elegante */
.modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  position: relative;
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
  padding: 45px 40px;
  border-radius: 16px;
  max-width: 480px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: scale(0.92) translateY(-20px);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

/* Botón X de cerrar */
.close-x {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 2rem;
  line-height: 1;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  padding: 0;
}

.close-x:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  transform: rotate(90deg);
}

.close-x:active {
  transform: rotate(90deg) scale(0.95);
}

/* Header del modal */
.modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 25px;
}

.modal-icon {
  font-size: 2.5rem;
  animation: floatSpin 4s ease-in-out infinite;
  display: inline-block;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 400;
  font-family: "Playfair Display", Georgia, serif;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  letter-spacing: 0.5px;
}

@keyframes floatSpin {
  0% {
    transform: translateY(0px) rotate(0deg) scale(1);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
  }
  25% {
    transform: translateY(-10px) rotate(-8deg) scale(1.08);
    filter: drop-shadow(0 0 12px rgba(255, 255, 150, 0.5));
  }
  50% {
    transform: translateY(-5px) rotate(0deg) scale(1.05);
    filter: drop-shadow(0 0 15px rgba(255, 200, 255, 0.6));
  }
  75% {
    transform: translateY(-10px) rotate(8deg) scale(1.08);
    filter: drop-shadow(0 0 12px rgba(150, 255, 255, 0.5));
  }
  100% {
    transform: translateY(0px) rotate(0deg) scale(1);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
  }
}

.modal-content p {
  font-size: 1.25rem;
  line-height: 1.8;
  margin-bottom: 25px;
  margin-top: 0;
  font-weight: 300;
  font-family: "Playfair Display", Georgia, serif;
  color: #f0f0f0;
  letter-spacing: 0.3px;
  font-style: italic;
  position: relative;
}

.modal-content p::before,
.modal-content p::after {
  content: '"';
  font-size: 1.8rem;
  opacity: 0.2;
  color: rgba(255, 255, 255, 0.4);
  font-family: Georgia, serif;
}

.modal-content p::before {
  margin-right: 4px;
}

.modal-content p::after {
  margin-left: 4px;
}

/* Imagen del modal */
.modal-image {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 12px;
  margin: 0 auto 20px;
  display: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  object-fit: cover;
}

/* Responsive Design */
@media (max-width: 768px) {
  /* Detener el contenedor principal */
  #universe {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
    padding: 40px 20px;
  }

  /* Sol en la parte superior */
  .sun {
    position: relative;
    margin: 0 0 40px 0;
    display: block;
    flex-shrink: 0;
  }

  .sun:hover {
    transform: scale(1.1);
  }

  /* Ocultar órbitas */
  .orbit {
    position: relative;
    width: auto !important;
    height: auto !important;
    border: none;
    animation: none;
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    flex-shrink: 0;
  }

  /* Planetas en columna alineados con el sol */
  .planet {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    animation: none;
    margin: 0;
    display: block;
  }

  .planet::before {
    width: 50px;
    height: 50px;
  }

  .planet:hover {
    transform: scale(1.3);
  }

  /* Ajustar tamaños de planetas para móvil */
  .planet-1,
  .planet-2,
  .planet-4 {
    width: 18px !important;
    height: 18px !important;
  }

  .planet-3 {
    width: 24px !important;
    height: 24px !important;
  }

  .planet-5 {
    width: 45px !important;
    height: 45px !important;
  }

  .planet-6 {
    width: 40px !important;
    height: 40px !important;
  }

  .planet-7,
  .planet-8 {
    width: 28px !important;
    height: 28px !important;
  }

  /* Ajustar modal para móvil */
  .modal-content {
    max-width: 90%;
    padding: 35px 25px;
    margin: 20px;
  }

  .modal-content p {
    font-size: 1.1rem;
    line-height: 1.7;
  }

  .modal-title {
    font-size: 1.2rem;
  }

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

  .modal-image {
    max-width: 100%;
    margin-bottom: 15px;
  }
}

@media (max-width: 480px) {
  #universe {
    padding: 30px 15px;
  }

  .sun {
    width: 60px;
    height: 60px;
    margin-bottom: 30px;
  }

  .modal-content {
    padding: 30px 20px;
  }

  .modal-content p {
    font-size: 1rem;
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .close-x {
    width: 30px;
    height: 30px;
    font-size: 1.5rem;
  }
}
