:root {
    --pink-light: #fff0f5;
    --pink-medium: #ffb6c1;
    --pink-deep: #ff69b4;
    --cream: #fffdfa;
    --text-color: #4a4a4a;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    overflow: hidden;
    background-color: var(--pink-light);
    height: 100vh;
    width: 100vw;
}

#final-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 240, 245, 0.9);
    z-index: 100;
    transition: opacity 1s ease;
}

.final-content {
    text-align: center;
    padding: 2rem;
    border-radius: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(255, 105, 180, 0.2);
}

h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 4rem;
    color: var(--pink-deep);
    margin-bottom: 1rem;
}

button {
    margin-top: 1.5rem;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-family: 'Inter', sans-serif;
    background: var(--pink-deep);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s ease, background 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
    
}

button:hover {
    transform: scale(1.05);
    background: #ff4fa7;
}

.hidden {
    display: none !important;
    opacity: 0;
}

.oculto {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

#main-container {
    position: relative;
    z-index: 2;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0 2rem 2rem;
    pointer-events: none;
}

#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--cream);
    padding: 3rem;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    border-radius: 30px;
    position: relative;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.glass {
    background: rgba(255, 253, 250, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 25px;
    background: none;
    box-shadow: none;
    color: var(--text-color);
    font-size: 2.5rem;
    padding: 0;
    margin: 0;
}

.close-modal:hover {
    background: none;
    color: var(--pink-deep);
    transform: scale(1.1);
}

.letter-content {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    line-height: 1.5;
    margin: 2rem 0;
    color: #555;
    text-align: left;
}

.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.media-gallery img,
.media-gallery video {
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.media-gallery img:hover {
    transform: scale(1.05);
}

.holding-hands-container {
    margin-top: 0.25rem;
    width: 200px;
    height: 100px;
    position: relative;
    pointer-events: auto;
}

/* Placeholder for hand holding animation */
.silhouette {
    width: 100%;
    height: 100%;
    background: url('https://img.icons8.com/ios-filled/100/ff69b4/holding-hands.png') no-repeat center;
    background-size: contain;
    animation: sway 3s ease-in-out infinite;
}

@keyframes sway {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

.heart {
    background-color: var(--pink-deep);
    display: inline-block;
    height: 50px;
    margin: 30px;
    position: relative;
    top: 0;
    transform: rotate(-45deg);
    width: 50px;
    animation: heartbeat 1.2s infinite;
}

.heart:before,
.heart:after {
    content: "";
    background-color: var(--pink-deep);
    border-radius: 50%;
    height: 50px;
    position: absolute;
    width: 50px;
}

.heart:before {
    top: -25px;
    left: 0;
}

.heart:after {
    left: 25px;
    top: 0;
}

@keyframes heartbeat {
    0% {
        transform: rotate(-45deg) scale(1);
    }

    14% {
        transform: rotate(-45deg) scale(1.1);
    }

    28% {
        transform: rotate(-45deg) scale(1);
    }

    42% {
        transform: rotate(-45deg) scale(1.1);
    }

    70% {
        transform: rotate(-45deg) scale(1);
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.5rem;
    }

    .envelope {
        width: 140px;
        height: 100px;
    }

    .envelope-flap {
        border-left: 70px solid transparent;
        border-right: 70px solid transparent;
        border-top: 55px solid var(--pink-medium);
    }

    .envelope-paper {
        width: 130px;
        height: 90px;
    }

    .letter-content {
        font-size: 1.4rem;
    }
}

/* --- CLASE MAESTRA DE EFICIENCIA --- */
/* --- ESTILO CORREGIDO PARA QUE NO SEA OSCURO --- */
.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Antes: background: rgba(0, 0, 0, 0.6); */
    /* Ahora: Un fondo blanco muy suave y difuminado */
     background: rgba(255, 255, 255, 0.062); 
    backdrop-filter: blur(15px); /* Esto hace que el fondo 3D se vea borroso pero iluminado */
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.contenedor-sobres {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.sobre {
    background: rgba(255, 255, 255, 0.849);
    padding: 30px 40px;
    border-radius: 10px;
    cursor: pointer;
    border-top: 30px solid #ffb6c1;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
    font-weight: bold;
    color: #e88c9a;
}

.sobre:hover {
    transform: translateY(-10px);
}

.carta-abierta {
    background: #fffcf9e1;
    padding: 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    position: relative;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid #f2d2d9;
}

.btn-x {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 20px;
    color: #ff69b4;
    cursor: pointer;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

.carta-fecha {
    color: #d66078;
    margin-bottom: 5px;
}

.carta-lugar {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 20px;
}

.carta-texto {
    font-size: 1.1em;
    line-height: 1.5;
    margin-bottom: 25px;
    color: #444;
}

.carta-mapa {
    display: inline-block;
    background: #ffe4e1;
    padding: 10px 20px;
    border-radius: 20px;
    color: #d66078;
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer
}

.carta-mapa:hover {
    background: #ffb6c1;
    color: white;
}

.btn-cerrar {
    background: #ffb6c1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

#petal-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    display: block;
}
    
/* --- ESTILOS PARA EL MODAL DEL MAPA --- */
#mapa-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7); /* Fondo oscuro semitransparente */
    backdrop-filter: blur(3px); /* Difumina el 3D del fondo */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Asegura que esté por encima del canvas de Three.js */
    opacity: 1;
    transition: opacity 0.3s ease;
}

#mapa-modal.oculto {
    opacity: 0;
    pointer-events: none; /* Evita clics fantasma cuando está invisible */
}

.mapa-contenedor {
    background-color: white;
    padding: 20px;
    border-radius: 15px;
    width: 80%;
    max-width: 700px;
    height: 65%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    flex-direction: column;
}

.mapa-contenedor h3 {
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
    color: #333;
    font-weight: bold;
}

.boton-cerrar {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
    transition: color 0.2s;
}

.boton-cerrar:hover {
    color: #ff6b6b;
}

#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

#lightbox.oculto {
    display: none; /* Sobrescribimos el display flex cuando está oculto */
}

#lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.btn-cerrar-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10000; /* Asegura que esté encima de la imagen */
    transition: transform 0.2s;
}

.btn-cerrar-lightbox:hover {
    transform: scale(1.2);
    color: #ff69b4; /* Un toque de color al pasar el mouse */
}