:root {
    /* Radios de órbitas relativas al viewport en VMIN (asegura que quepa en cualquier pantalla) */
    --orbit-mercury: 16vmin;
    --orbit-venus: 24vmin;
    --orbit-earth: 34vmin;
    --orbit-mars: 44vmin;
    --orbit-jupiter: 60vmin;
    --orbit-saturn: 74vmin;
    --orbit-uranus: 86vmin;
    --orbit-neptune: 96vmin;

    /* Tamaño base de rapidez */
    --speed-base: 20s;
}

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

body {
    /* Fondo premium: oscuro y con gradiente radial hacia negro */
    background: radial-gradient(circle at center, #1b2735 0%, #090a0f 100%);
    color: white;
    font-family: 'Orbitron', sans-serif;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Efecto de estrellas */
#stars {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: transparent url('https://www.transparenttextures.com/patterns/stardust.png') repeat top center;
    animation: stars-move 200s linear infinite;
    opacity: 0.6;
    z-index: 0;
}
@keyframes stars-move {
    from { background-position: 0 0; }
    to { background-position: -10000px 5000px; }
}

/* Cabecera / Diseño descriptivo */
.header {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 1000;
    pointer-events: none;
}
.header h1 {
    font-size: 3vmin;
    color: #ffcc00;
    text-shadow: 0 0 15px rgba(255, 204, 0, 0.7);
    margin-bottom: 5px;
    letter-spacing: 2px;
}
.header p {
    font-size: 1.5vmin;
    color: #b0c4de;
    letter-spacing: 1px;
}
.header .subtitle {
    margin-top: 5px;
    font-size: 1.2vmin;
    color: #8899a6;
    font-family: sans-serif;
}

/* Contenedor centralizado */
.solar-system {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vmin;
    height: 100vmin;
    z-index: 10;
}

/* Sol */
.sun {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8vmin;
    height: 8vmin;
    transform: translate(-50%, -50%);
    background: url(img/sol.png) center no-repeat;
    background-size: 130%; /* Ligeramente más grande que el contenedor para cortar cualquier borde negro interno */
    border-radius: 50%;
    box-shadow: 0 0 15px #ff8b17, 0 0 30px #ff8b17, 0 0 60px #ff8b17;
    cursor: pointer;
    z-index: 100;
    transition: 0.4s ease-in-out;
}
/* Efecto al pasar mouse por el sol -> luna (Easter Egg Original Mantenido) */
.sun:hover {
    background: url(img/luna.png) center no-repeat;
    background-size: 130%; /* Mismo tamaño para que coincida perfectamente */
    box-shadow: 0 0 15px #d8d8d8, 0 0 30px #d8d8d8, 0 0 60px #d8d8d8;
}

/* Estructura para todas las óbitas */
.orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform-origin: center;
    transform: translate(-50%, -50%);
    transition: border-color 0.3s;
}

/* Estructura para todos los planetas */
.planet {
    position: absolute;
    top: 0;
    left: 50%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    box-shadow: inset -2px -2px 5px rgba(0,0,0,0.5);
    /* El transform translate aquí sitúa exactamente el centro de la imagen en la línea de la órbita (top:0) */
    transform-origin: center;
}

/* Tooltips de estilo Glassmorphism */
.tooltip {
    position: absolute;
    top: -4vmin;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 0.5vmin 1.5vmin;
    border-radius: 6px;
    font-size: 1.5vmin;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    pointer-events: none;
    font-family: sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.planet:hover .tooltip, .sun:hover .tooltip {
    opacity: 1;
    visibility: visible;
    top: -5vmin;
}

/* Animaciones */
@keyframes planet-orbit {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes planet-counter-rotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(-360deg); }
}

/* --- Planetas --- */

/* Mercurio */
.mercury-orbit {
    width: var(--orbit-mercury); height: var(--orbit-mercury);
    animation: planet-orbit calc(var(--speed-base) * 0.24) linear infinite;
    z-index: 90;
}
.mercury {
    width: 2vmin; height: 2vmin;
    background-image: url(img/on1.jpg);
    animation: planet-counter-rotate calc(var(--speed-base) * 0.24) linear infinite;
}

/* Venus */
.venus-orbit {
    width: var(--orbit-venus); height: var(--orbit-venus);
    animation: planet-orbit calc(var(--speed-base) * 0.61) linear infinite;
    z-index: 80;
}
.venus {
    width: 3vmin; height: 3vmin;
    background-image: url(img/on2.png);
    animation: planet-counter-rotate calc(var(--speed-base) * 0.61) linear infinite;
}

/* Tierra */
.earth-orbit {
    width: var(--orbit-earth); height: var(--orbit-earth);
    animation: planet-orbit calc(var(--speed-base) * 1.0) linear infinite;
    z-index: 70;
}
.earth {
    width: 3.5vmin; height: 3.5vmin;
    background-image: url(img/on3.png);
    animation: planet-counter-rotate calc(var(--speed-base) * 1.0) linear infinite;
}

/* Marte */
.mars-orbit {
    width: var(--orbit-mars); height: var(--orbit-mars);
    animation: planet-orbit calc(var(--speed-base) * 1.88) linear infinite;
    z-index: 60;
}
.mars {
    width: 2.5vmin; height: 2.5vmin;
    background-image: url(img/on4.png);
    animation: planet-counter-rotate calc(var(--speed-base) * 1.88) linear infinite;
}

/* Júpiter */
.jupiter-orbit {
    width: var(--orbit-jupiter); height: var(--orbit-jupiter);
    animation: planet-orbit calc(var(--speed-base) * 4.0) linear infinite; 
    /* Reducido proporcionalmente para no tardar años */
    z-index: 50;
}
.jupiter {
    width: 6.5vmin; height: 6.5vmin;
    background-image: url(img/on5.png);
    animation: planet-counter-rotate calc(var(--speed-base) * 4.0) linear infinite;
}

/* Saturno */
.saturn-orbit {
    width: var(--orbit-saturn); height: var(--orbit-saturn);
    animation: planet-orbit calc(var(--speed-base) * 6.0) linear infinite;
    z-index: 40;
}
.saturn {
    width: 9.5vmin; height: 3.5vmin; /* Proporciones alargadas para abarcar los anillos */
    background-image: url(img/on6.png);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 0; /* Quitar borde circular para que no corte partes de la imagen asimétrica */
    box-shadow: none; /* Evitar sombras redondas sobre una imagen que tiene anillos que sobresalen */
    animation: planet-counter-rotate calc(var(--speed-base) * 6.0) linear infinite;
}

/* Urano */
.uranus-orbit {
    width: var(--orbit-uranus); height: var(--orbit-uranus);
    animation: planet-orbit calc(var(--speed-base) * 8.5) linear infinite;
    z-index: 30;
}
.uranus {
    width: 4vmin; height: 4vmin;
    background-image: url(img/on7.png);
    animation: planet-counter-rotate calc(var(--speed-base) * 8.5) linear infinite;
}

/* Neptuno */
.neptune-orbit {
    width: var(--orbit-neptune); height: var(--orbit-neptune);
    animation: planet-orbit calc(var(--speed-base) * 11.0) linear infinite;
    z-index: 20;
}
.neptune {
    width: 4vmin; height: 4vmin;
    background-image: url(img/on8.png);
    animation: planet-counter-rotate calc(var(--speed-base) * 11.0) linear infinite;
}

/* Interactividad y UX: Brillo en la órbita al hacer hover y detener animación */
.solar-system:hover .orbit {
    animation-play-state: paused;
}
.solar-system:hover .planet {
    animation-play-state: paused;
}
.orbit:hover {
    border-color: rgba(255, 255, 255, 0.4);
}
.planet:hover {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    z-index: 1000;
}

/* Media Query para pantallas pequeñas o modo retrato muy estrecho */
@media (max-width: 600px) {
    .header h1 {
        font-size: 5vmin;
    }
    .header p {
        font-size: 2.5vmin;
    }
    .header .subtitle {
        font-size: 2vmin;
    }
}

/* --- Modal y Base de Datos Científica --- */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: rgba(20, 25, 40, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    color: #e0e0e0;
}

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

.close-btn {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 28px;
    color: #ff5555;
    cursor: pointer;
    transition: 0.2s;
}

.close-btn:hover {
    color: #ff0000;
    transform: scale(1.1);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 0; /* Quitamos el radio para que imágenes de ancho irregular como la de Saturno no se "pochen" en las esquinas */
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2)); /* Usar drop-shadow en lugar de box-shadow se adapta a la figura de la imagen PNG */
}

.modal-header h2 {
    font-size: 28px;
    color: #ffcc00;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
    margin: 0;
}

.modal-body p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 20px;
    font-family: sans-serif;
}

.planet-stats {
    list-style: none;
    padding: 0;
    font-family: sans-serif;
}

.planet-stats li {
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.planet-stats li strong {
    color: #ffcc00;
}

