body {
    margin: 0;
    /* Cambiamos height por min-height para permitir scroll si el texto es largo */
    min-height: 100vh; 
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #ffe4ec, #ffd6e0);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Evitamos el scroll horizontal por las animaciones */
    overflow-x: hidden; 
    padding: 20px;
    box-sizing: border-box;
}

.contenedor {
    background: white;
    padding: 30px 20px; /* Padding ajustado para móviles */
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    /* Ancho flexible: 95% del ancho del celu, pero máximo 450px en PC */
    width: 95%;
    max-width: 450px; 
    position: relative;
    z-index: 2;
    /* Para que el texto largo no rompa el diseño */
    max-height: 90vh;
    overflow-y: auto;
}

h2 {
    font-size: 1.4rem; /* Tamaño de fuente adaptable */
    line-height: 1.2;
}

h3 {
    font-size: 1rem;
    font-weight: normal;
    line-height: 1.5;
    color: #444;
}

.zona-botones {
    position: relative;
    /* Aumentamos un poco la altura para que el botón tenga donde moverse */
    height: 120px; 
    margin-top: 20px;
    width: 100%;
}

.botones {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap; /* Por si los botones son muy anchos */
}

button {
    padding: 12px 25px;
    border: none;
    border-radius: 50px; /* Bordes más redondeados y modernos */
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    /* Evita que el zoom del iPhone se active al tocar botones */
    touch-action: manipulation; 
}

#si {
    background-color: #4CAF50;
    color: white;
}

#no {
    background-color: #f44336;
    color: white;
}

/* PANTALLA 2: Ajuste de visibilidad total */
.pantalla2 {
    position: fixed; /* Cambiado a fixed para asegurar que cubra todo el viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* Cubre el alto inicial */
    min-height: -webkit-fill-available; /* Ajuste para navegadores móviles */
    background: linear-gradient(135deg, #ffe4ec, #ffd6e0);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    z-index: 100; /* Aseguramos que esté por encima de todo */
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto; /* Permite scroll si el mensaje no entra */
}

.pantalla2.mostrar {
    animation: fadeIn 1s forwards;
    pointer-events: auto;
}

/* MENSAJE FINAL: Responsive y Centrado */
.mensaje-final {
    background: white;
    padding: 40px 20px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    
    /* Ancho dinámico */
    width: 100%;
    max-width: 350px; 
    
    /* Centrado interno */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    
    /* Texto */
    font-size: 1.5rem;
    color: black;
    font-weight: bold;
    text-align: center;
    line-height: 1.4;
    word-wrap: break-word; /* Evita que palabras largas rompan el diseño */
    margin: auto; /* Ayuda al centrado en contenedores con scroll */
}

/* Ajuste para pantallas muy bajitas o con teclado abierto */
@media (max-height: 400px) {
    .pantalla2 {
        align-items: flex-start; /* Evita que el mensaje se corte arriba */
    }
    .mensaje-final {
        margin-top: 20px;
        margin-bottom: 20px;
        padding: 20px;
        font-size: 1.2rem;
    }
}

@keyframes zoom {
    to { transform: scale(1.2); opacity: 0; }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.animar {
    animation: zoom 0.6s forwards;
}

/* Guirnaldas / serpentinas */
.confeti {
    position: absolute;
    width: 6px;
    height: 12px;
    border-radius: 2px;
    bottom: 20px;
    left: 50%;
    transform-origin: bottom center;
    animation: serpentina linear forwards;
}

@keyframes serpentina {
    0% { transform: translateX(0) translateY(0) rotate(0deg); opacity: 1; }
    50% { transform: translateX(var(--dx)) translateY(var(--dy)) rotate(360deg); opacity: 1; }
    70% { transform: translateX(calc(var(--dx) + var(--mx)/2)) translateY(calc(var(--dy) + var(--my)/2)) rotate(540deg); }
    100% { transform: translateX(calc(var(--dx) + var(--mx))) translateY(calc(var(--dy) + var(--my))) rotate(720deg); opacity: 0; }
}

/* Globos realistas */
.globo {
    position: absolute;
    top: -50px;
    border-radius: 50% 50% 50% 50%;
    animation: caerGlobo linear forwards;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    box-shadow: inset -2px -2px 6px rgba(0,0,0,0.2);
}

.nudo {
    width: 4px;
    height: 8px;
    background: #333;
    border-radius: 2px;
    margin-bottom: -4px;
}

@keyframes caerGlobo {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(180deg); opacity: 0; }
}

.fuego {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    animation: estallido 1s ease-out forwards;
}

@keyframes estallido {
    0% { transform: translate(0, 0) scale(1.5); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0.5); opacity: 0; }
}

/* Reutilización de estilos de botones */
#si, #si0 { background-color: #4CAF50; color: white; }
#no, #no0 { background-color: #f44336; color: white; }

/* Clase para animar la entrada de la pantalla 1 */
.fade-in {
    animation: fadeIn 0.8s forwards;
}


.btn-spoiler {
    background-color: #ff4d6d; /* Un color vibrante */
    color: white;
    padding: 15px 35px;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 77, 109, 0.4);
    transition: all 0.3s ease;
    margin-top: 20px;
    display: inline-block;
}

.btn-spoiler:hover {
    background-color: #ff758f;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 77, 109, 0.6);
}

.btn-spoiler:active {
    transform: translateY(1px);
}


.pantalla3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffd6e0, #ffe4ec);
    display: none; /* Se activa con JS */
    justify-content: center;
    align-items: center;
    z-index: 300; /* Un número alto para que nada lo tape */
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    overflow-y: auto;
}

.pantalla3.mostrar {
    display: flex;
    animation: fadeIn 1s forwards;
}

/* Ajuste para que el mensaje dentro de la pantalla 3 se vea bien */
.pantalla3 .mensaje-final {
    color: #d81b60; /* Cambié el color a uno más suave pero legible */
}


/* test */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    /* Cambiamos height por min-height para permitir scroll si el texto es largo */
    min-height: 100vh; 
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #ffe4ec, #ffd6e0);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Evitamos el scroll horizontal por las animaciones */
    overflow-x: hidden; 
    padding: 20px;
    box-sizing: border-box;
}

.ground {
    width: 100vmin;
    aspect-ratio: 1.5;
    overflow: visible;
    position: relative;
    transform-origin: center center;
    transform: scale(2);
    animation: shrink 1.5s ease-in forwards 4s;
}

.flower-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    &:first-child {
        top: 50%;
        left: 50%;
    }

    &:nth-child(2) {
        top: 45%;
        left: 30%;
        width: 8%;
    }
    &:nth-child(3) {
        top: 45%;
        left: 70%;
        width: 8%;
    }
    &:nth-child(4) {
        top: 85%;
        left: 95%;
        width: 20%;
    }
    &:nth-child(5) {
        top: 130%;
        left: 30%;
        width: 30%;
    }
    &:nth-child(6) {
        top: 60%;
        left: 10%;
        width: 12%;
    }
    &:nth-child(7) {
        top: 20%;
        left: 15%;
        width: 6%;
    }

    &:nth-child(8) {
        top: 15%;
        left: 35%;
        width: 5%;
    }

    &:nth-child(9) {
        top: 26%;
        left: 85%;
        width: 7%;
    }

    &:nth-child(10) {
        top: 22%;
        left: 60%;
        width: 6.5%;
    }
}

.flower-container {
    width: 10%;
    aspect-ratio: 16;
    container-type: inline-size;
    filter: drop-shadow(0 0 25cqi #ffd85faa);
    justify-items: center;
    align-content: center;
    transform-origin: bottom center;
}

.flower-top {
    width: 50cqi;
    aspect-ratio: 1.5;
    position: relative;
    z-index: 1;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, 50%);
}

.flower-circle {
    width: 30cqi;
    aspect-ratio: 1.5;
    border-radius: 50%;
    background-color: #ffe4a0;
    box-shadow: inset 0px -3cqi 3cqi #aa7a0266;
    position: absolute;
    scale: 0;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 100% 100% 100% 100%/90% 90% 90% 90%;
    filter: drop-shadow(0 0 15cqi #ffd85f);
    transform-origin: top left;
}

.flower-petal {
    width: 80%;
    aspect-ratio: 1;
    background-color: #ffe4a0;
    background-image: linear-gradient(135deg, #ff6236 20%, #ffd85f 80%);
    position: absolute;
    opacity: 0;
}

.flower-petal__1 {
    bottom: 42%;
    right: 65%;
    border-radius: 0px 100% 5% 100%/0px 100% 5% 100%;
    transform: rotate(-10deg) scale(0.82);
}

.flower-petal__2 {
    bottom: 42%;
    left: 65%;
    border-radius: 0px 100% 5% 100%/0px 100% 5% 100%;
    transform: rotate(100deg) scale(0.82);
}

.flower-petal__3 {
    bottom: 40%;
    left: 10%;
    border-radius: 0px 100% 50% 100%/0px 100% 50% 100%;
    transform: rotate(45deg) scale(0.8);
}

.flower-petal__4 {
    top: -10%;
    left: 80%;
    border-radius: 0px 100% 0% 100%/0px 100% 0% 100%;
    transform: rotate(135deg) scale(0.9);
}

.flower-petal__5 {
    top: -10%;
    right: 70%;
    border-radius: 0px 100% 0% 100%/0px 100% 0% 100%;
    transform: rotate(315deg) scale(0.9);
}

.flower-petal__6 {
    top: 50%;
    right: 65%;
    border-radius: 0px 100% 10% 100%/0px 100% 5% 100%;
    transform: rotate(270deg) scale(1.1);
}

.flower-petal__7 {
    top: 50%;
    left: 65%;
    border-radius: 0px 100% 10% 100%/0px 100% 5% 100%;
    transform: rotate(180deg) scale(1.1);
}

.flower-petal__8 {
    top: 50%;
    left: 10%;
    border-radius: 0px 100% 50% 100%/0px 100% 30% 100%;
    transform: rotate(225deg) scale(1);
}

.flower-light {
    width: 3cqi;
    aspect-ratio: 1;
    position: absolute;
    border-radius: 50%;
    opacity: 0;

    &:nth-child(odd) {
        background-color: #ffe4a0;
        filter: blur(2cqi) drop-shadow(0 0 5cqi #ffd85f);
    }

    &:nth-child(even) {
        background-color: #ff6236;
        filter: blur(2cqi) drop-shadow(0 0 5cqi #ff6236);
    }
}

.flower-light__1 {
    top: 10%;
    left: 20%;
    scale: 0.8;
}
.flower-light__2 {
    top: 20%;
    left: 80%;
    scale: 1.2;
}
.flower-light__3 {
    top: 30%;
    left: 50%;
    scale: 1.5;
}
.flower-light__4 {
    top: 40%;
    left: 10%;
}
.flower-light__5 {
    top: 50%;
    left: 90%;
    scale: 2;
}
.flower-light__6 {
    top: 60%;
    left: 30%;
}
.flower-light__7 {
    top: 70%;
    left: 40%;
    scale: 0.5;
}
.flower-light__8 {
    top: 60%;
    left: 60%;
}

.flower-bottom {
    width: 6%;
    aspect-ratio: 0.02;
    left: 47%;
    top: 50%;
}

.flower-stem {
    width: 100%;
    height: 100%;
    transform: scaleY(0);
    background-image: linear-gradient(to left, rgba(0, 0, 0, 0.2), transparent, rgba(87, 42, 25, 0.2)),
                         linear-gradient(to top, transparent 10%, #da580099, #da580099);
    border-radius: 50px 50px 0 0;
    transform-origin: bottom center;
}

.flower-leaf {
    width: 40%;
    aspect-ratio: 2.5;
    position: absolute;
    scale: 0;
    opacity: 0;

    &:nth-child(even) {
        right: 55%;
        background-image: linear-gradient(120deg, #d86100aa 0%, #da580000 90%);
        border-radius: 0% 100% 0% 100%/0% 100% 0% 100%;
        transform-origin: bottom right;
    }

    &:nth-child(odd) {
        left: 55%;
        background-image: linear-gradient(300deg, #d86100aa 0%, #da580000 90%);
        border-radius: 100% 0% 100% 0%/100% 0% 100% 0%;
        transform-origin: bottom left;
    }
}

.flower-leaf__2 {
    top: 25%;
    transform: rotate(-15deg) scale(1);
}

.flower-leaf__1 {
    top: 31%;
    transform: rotate(15deg) scale(1);
}

.flower-leaf__4 {
    top: 37%;
    transform: rotate(-15deg) scale(1.2);
}

.flower-leaf__3 {
    top: 43%;
    transform: rotate(15deg) scale(1.2);
}

.flower-leaf__6 {
    top: 50%;
    transform: rotate(-15deg) scale(1.5);
}

.flower-leaf__5 {
    top: 56%;
    transform: rotate(15deg) scale(1.5);
}


.flower-grass {
    position: absolute;
    bottom: -20cqi;
    width: 80cqi;
    height: 120cqi;
    opacity: 0;
    scale: 0;
    mask-image: linear-gradient(to top, transparent 15%, #fff 50%);

    &:nth-child(odd) {
        right: 55%;
        border-top-right-radius: 100%;
        border-right: 5cqi solid #d86100aa;
        transform-origin: bottom right;
    }

    &:nth-child(even) {
        left: 55%;
        border-top-left-radius: 100%;
        border-left: 5cqi solid #d86100aa;
        transform-origin: bottom left;
    }
}

.flower-grass__3 {
    left: 70% !important;
    width: 75cqi;
    height: 100cqi;;
}

.flower-grass__4 {
    right: 70% !important;
    width: 75cqi;
    height: 90cqi;
}


.animate {
    &.flower-container {
        animation: flower-rotate 12s linear infinite;
    }

    .flower-circle {
        animation: grass-grow 0.25s ease-in forwards 3s;
    }

     .flower-petal {
        animation: petal-grow 0.5s ease-in forwards,
                    flower-rotate 3s linear infinite;
    }

   .flower-petal__3 {
        animation-delay: 3.2s;
    }
    .flower-petal__2 {
        animation-delay: 3.3s;
    }
    .flower-petal__4 {
        animation-delay: 3.4s;
    }
    .flower-petal__7 {
        animation-delay: 3.5s;
    }
    .flower-petal__8 {
        animation-delay: 3.6s;
    }
    .flower-petal__6 {
        animation-delay: 3.7s;
    }
    .flower-petal__5 {
        animation-delay: 3.8s;
    }
    .flower-petal__1 {
        animation-delay: 3.9s;
    }

    .flower-stem {
        animation: stem-grow 3s ease-in forwards;
    }
    
    .flower-grass {
        animation:  grass-grow 1s ease-in forwards 1.5s,
        flower-rotate 6s linear infinite;
    }
    
    .flower-leaf {
        animation: grass-grow 0.75s ease-in forwards, 
                    flower-rotate 6s linear infinite;
    }
    
    .flower-leaf__2 {
        animation-delay: 2s;
    }
    
    .flower-leaf__1 {
        animation-delay: 1.9s;
    }
    
    .flower-leaf__4 {
        animation-delay: 1.8s;
    }
    
    .flower-leaf__3 {
        animation-delay: 1.65s;
    }
    
    .flower-leaf__6 {
        animation-delay: 1.5s;
    }
    
    .flower-leaf__5 {
        animation-delay: 1.25s;
    }

    .flower-light {
        animation: light-float 5s ease-in-out infinite;
    }

    .flower-light__1 {
        animation-delay: 4.7s;
    }
    .flower-light__2 {
        animation-delay: 5.2s;
    }
    .flower-light__3 {
        animation-delay: 5.7s;
    }
    .flower-light__4 {
        animation-delay: 6.2s;
    }
    .flower-light__5 {
        animation-delay: 6.7s;
    }
    .flower-light__6 {
        animation-delay: 7.2s;
    }
    .flower-light__7 {
        animation-delay: 7.7s;
    }
    .flower-light__8 {
        animation-delay: 8.2s;
    }
}

@keyframes petal-grow {
    0% {
        scale: 0;
        opacity: 0.8;
    }
    50% {
        scale: 1;
        opacity: 0.8;
    }
    75% {
        scale: 1.1;
        opacity: 0.8;
    }
    90% {
        scale: 0.9;
        opacity: 0.8;
    }
    100% {
        scale: 1;
        opacity: 0.8;
    }
}


@keyframes grass-grow {
    100% {
        opacity: 1;
        scale: 1;
    }
}


@keyframes stem-grow {
    0% {
        border-radius: 10%;
    }

    100% {
        transform: scaleY(1);
    }
}

@keyframes flower-rotate {
    0%,100% {
        rotate: 0deg;
    }
    25% {
        rotate: 5deg;
    }
    75% {
        rotate: -5deg;
    }
}

@keyframes shrink {
    100% {
        transform: scale(1);
    }
}

@keyframes light-float {
    0% {
        opacity: 0;
        transform: translate(0, 0);
    }
    25% {
        opacity: 1;
        transform: translate(20cqi, -25cqi);
    }
    50% {
        opacity: 1;
        transform: translate(0, -50cqi);
    }
    75% {
        opacity: 1;
        transform: translate(-20cqi, -75cqi);
    }
    100% {
        opacity: 0;
        transform: translate(0, -100cqi);
    }
}