:root {
    --bg-space: #02040a;
    --planet-dark: #6e6e66;
    --planet-light: #a4a49c;
    --rose-red: #d52d58;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-space);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Estrellas */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0a1128 0%, #000 100%);
    z-index: 1;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle var(--duration) infinite ease-in-out;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.1;
    }

    50% {
        opacity: 0.7;
    }
}

.universe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Alineado a la base */
    z-index: 10;
}

.planet {
    position: absolute;
    bottom: 0;
    width: 400px;
    height: 200px;
    background: radial-gradient(circle at center top, var(--planet-light) 0%, var(--planet-dark) 70%);
    border-radius: 200px 200px 0 0;
    box-shadow: 0 -5px 40px rgba(0, 0, 0, 0.6), inset 0 5px 20px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    z-index: 5;
}

.patch {
    position: absolute;
    background: #5a5a54;
    border-radius: 50%;
    filter: blur(8px);
    mix-blend-mode: multiply;
}

/* LA ROSA (Lógica del Snippet del Usuario) */
.rose-container {
    position: absolute;
    bottom: 50px;
    /* Bajado para que el tallo se clave en la luna */
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translateX(-50%) scale(0.6);
    z-index: 20;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

.petals>div {
    position: absolute;
    background: var(--rose-red);
    width: 85px;
    height: 120px;
    top: 50px;
    /* Subimos la flor relativa al tallo */
    transition: all 0.5s ease-out;
}

.petals>div:nth-child(1) {
    border-radius: 15px;
    box-shadow: 0px 0px 60px rgba(245, 148, 184, 1);
    left: 268px;
}

.petals>div:nth-child(n+2) {
    transform-origin: bottom;
}

.petals>div:nth-child(2) {
    z-index: 5;
    background: #ab1a3f;
    top: 68px;
    height: 130px;
    box-shadow: 0px 0px 60px rgba(245, 148, 184, .5);
    animation: bloom2 3s ease-in-out forwards, glowing 2.5s ease-in-out infinite;
    left: 230px;
    border-radius: 0px 50px 0px 50px;
    transform-origin: bottom right;
}

.petals>div:nth-child(3) {
    z-index: 4;
    background: #ab1a3f;
    top: 68px;
    height: 130px;
    box-shadow: 0px 0px 60px rgba(245, 148, 184, .5);
    animation: bloom3 3s ease-in-out forwards, glowing 2.5s ease-in-out infinite;
    left: 300px;
    border-radius: 50px 0px 50px 0px;
    transform-origin: bottom left;
}

.petals>div:nth-child(4) {
    z-index: 3;
    background: #b81b43;
    top: 63px;
    height: 135px;
    box-shadow: 0px 0px 60px rgba(245, 148, 184, .5);
    animation: bloom4 3s ease-in-out forwards, glowing 2.5s ease-in-out infinite;
    left: 230px;
    border-radius: 0px 50px 0px 50px;
    transform-origin: bottom right;
}

.petals>div:nth-child(5) {
    z-index: 2;
    background: #b81b43;
    top: 63px;
    height: 135px;
    box-shadow: 0px 0px 60px rgba(245, 148, 184, .5);
    animation: bloom5 3s ease-in-out forwards, glowing 2.5s ease-in-out infinite;
    left: 300px;
    border-radius: 50px 0px 50px 0px;
    transform-origin: bottom left;
}

.petals>div:nth-child(6) {
    z-index: 1;
    background: #c9204b;
    top: 50px;
    height: 130px;
    box-shadow: 0px 0px 60px rgba(245, 148, 184, .3);
    animation: bloom6 3s ease-in-out forwards, glowing 2.5s ease-in-out infinite;
    left: 230px;
    border-radius: 0px 50px 0px 50px;
    transform-origin: bottom right;
}

.petals>div:nth-child(7) {
    z-index: 0;
    background: #c9204b;
    top: 50px;
    height: 130px;
    box-shadow: 0px 0px 60px rgba(245, 148, 184, .3);
    animation: bloom7 3s ease-in-out forwards, glowing 2.5s ease-in-out infinite;
    left: 300px;
    border-radius: 50px 0px 50px 0px;
    transform-origin: bottom left;
}

.leaves>div:nth-child(1) {
    position: absolute;
    width: 15px;
    height: 450px;
    /* Tallo más largo */
    background: #054c05;
    top: 150px;
    /* Comienza en la flor */
    left: 292.5px;
    border-radius: 0 0 100px 100px;
}

.leaves>div:nth-child(2) {
    position: absolute;
    width: 60px;
    height: 100px;
    border-radius: 10px 80px 40px 80px;
    background: #054c05;
    transform-origin: bottom;
    transform: rotate(-30deg);
    top: 254px;
    left: 247px;
    box-shadow: inset 10px 10px #066406;
}

.leaves>div:nth-child(3) {
    position: absolute;
    width: 60px;
    height: 100px;
    border-radius: 80px 1px 80px 40px;
    background: #054c05;
    transform-origin: bottom;
    transform: rotate(30deg);
    top: 202px;
    left: 293px;
    box-shadow: inset -10px 10px #066406;
}

.thorns>div {
    position: absolute;
    width: 0;
    height: 0;
}

.thorns>div:nth-child(odd) {
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 15px solid #054c05;
    left: 307.5px;
}

.thorns>div:nth-child(even) {
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 15px solid #054c05;
    left: 277.5px;
}

.thorns>div:nth-child(1) {
    top: 307px;
}

.thorns>div:nth-child(2) {
    top: 232px;
}

.thorns>div:nth-child(3) {
    top: 367px;
}

/* CÚPULA DE CRISTAL */
.glass-dome {
    position: absolute;
    width: 320px;
    height: 450px;
    bottom: -100vh;
    /* Empieza fuera de la pantalla */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 160px 160px 20px 20px;
    z-index: 30;
    box-shadow:
        inset 0 20px 30px rgba(255, 255, 255, 0.1),
        inset 10px 0 20px rgba(255, 255, 255, 0.05),
        0 10px 30px rgba(0, 0, 0, 0.5);
    animation: dropDome 4s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards 2s;
}

.glass-handle {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    z-index: 35;
    box-shadow: inset 0 5px 10px rgba(255, 255, 255, 0.3);
}

.glass-handle::before {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50% 50% 10px 10px;
    backdrop-filter: blur(2px);
}

.glass-shine {
    position: absolute;
    top: 50px;
    left: 40px;
    width: 60px;
    height: 150px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
    border-radius: 50px;
    transform: rotate(15deg);
    filter: blur(5px);
}

@keyframes dropDome {
    0% {
        bottom: 100vh;
    }

    100% {
        bottom: 120px;
        /* Queda apoyada sobre la luna */
    }
}

@keyframes bloom2 {
    100% {
        transform: rotate(-50deg);
    }
}

@keyframes bloom3 {
    100% {
        transform: rotate(50deg);
    }
}

@keyframes bloom4 {
    100% {
        transform: rotate(-25deg);
    }
}

@keyframes bloom5 {
    100% {
        transform: rotate(25deg);
    }
}

@keyframes bloom6 {
    100% {
        transform: rotate(-10deg);
    }
}

@keyframes bloom7 {
    100% {
        transform: rotate(10deg);
    }
}

@keyframes glowing {
    50% {
        background: #d7365f;
        box-shadow: 0px 0px 60px rgba(245, 148, 184, 1);
    }
}

/* EL POEMA */
.poem {
    position: absolute;
    top: 50%;
    left: 20px;
    /* Aligned to the left for desktop */
    transform: translateY(-50%);
    width: 40%;
    /* Narrower to stay on the left */
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Align content to the left */
    gap: 15px;
    z-index: 40;
    pointer-events: none;
    padding: 20px;
}

.line {
    font-family: 'Times New Roman', serif;
    color: rgba(255, 255, 255, 0.85);
    text-align: left;
    /* Align text to the left */
    font-size: 1.1rem;
    font-style: italic;
    margin: 3px 0;
    opacity: 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    width: 100%;
}

.line:nth-child(1) {
    font-size: 1.8rem;
    font-weight: bold;
    font-style: normal;
    animation: fadeUp 3s forwards 4s;
    margin-bottom: 10px;
}

.line:nth-child(2) {
    animation: fadeUp 2.5s forwards 6s;
}

.line:nth-child(3) {
    animation: fadeUp 2.5s forwards 8s;
}

.line:nth-child(4) {
    animation: fadeUp 2.5s forwards 10s;
}

.line:nth-child(5) {
    animation: fadeUp 2.5s forwards 12s;
}

/* El margen vacío es child 6 */
.line:nth-child(7) {
    animation: fadeUp 2.5s forwards 14s;
}

.line:nth-child(8) {
    animation: fadeUp 2.5s forwards 16s;
}

.line:nth-child(9) {
    animation: fadeUp 2.5s forwards 18s;
}

.line:nth-child(10) {
    animation: fadeUp 2.5s forwards 20s;
}

.line:nth-child(11) {
    animation: fadeUp 2.5s forwards 22s;
}

/* El margen vacío es child 12 */
.line:nth-child(13) {
    animation: fadeUp 2.5s forwards 24s;
}

.line:nth-child(14) {
    animation: fadeUp 2.5s forwards 26s;
}

.line:nth-child(15) {
    animation: fadeUp 2.5s forwards 28s;
}

.line:nth-child(16) {
    animation: fadeUp 3s forwards 31s;
    font-style: normal;
}

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* MEDIAS QUERIES PARA RESPONSIVE */
@media (max-width: 768px) {
    .poem {
        top: 20px;
        left: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        align-items: center;
        padding: 10px;
        gap: 8px;
    }

    .line {
        text-align: center;
        font-size: 0.85rem;
        text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
        /* Mejor lectura sobre estrellas */
    }

    .line:nth-child(1) {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }

    /* Ajustar la rosa en móvil para que no choque tanto */
    .rose-container {
        transform: translateX(-50%) scale(0.45);
        bottom: 20px;
    }

    .glass-dome {
        width: 260px;
        height: 380px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .poem {
        width: 35%;
        left: 30px;
    }
}