:root {
    --primario: #ff4d6d;
    --secundario: #ff70a6;
    --texto: #5f3042;
}

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

body {
    /* Cambiamos a 100dvh para que descuente las barras de navegación del móvil */
    height: 100dvh; 
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ffd6e8 0%, #fff5fa 100%);
    overflow: hidden;
}

.corazon-bg {
    position: absolute;
    color: var(--secundario);
    animation: flotar linear infinite;
    opacity: 0.4;
    z-index: 1;
    pointer-events: none;
}

@keyframes flotar {
    from { transform: translateY(110vh) rotate(0deg); }
    to { transform: translateY(-120vh) rotate(360deg); }
}

.card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 480px;
    /* Forzamos a que la tarjeta use el alto disponible */
    height: 100%;
    max-height: 90vh; 
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(214, 51, 132, 0.15);
    display: flex;
    flex-direction: column;
}

.emoji-animado { text-align: center; font-size: 40px; flex-shrink: 0; margin-bottom: 5px; }
.hablando { animation: latir 0.6s infinite; display: inline-block; }
@keyframes latir { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }

h1 { text-align: center; color: var(--primario); font-size: 1.2rem; margin-bottom: 10px; flex-shrink: 0; }

.mensaje {
    color: var(--texto);
    line-height: 1.5;
    font-size: 0.9rem;
    overflow-y: auto; /* Permite scroll solo aquí adentro */
    flex-grow: 1;    /* Esta sección se estira o encoge según el alto del móvil */
    min-height: 0;   /* Truco vital para que el flex-item sepa que puede achicarse */
    margin-bottom: 15px;
    padding-right: 10px;
}

.mensaje p { margin-bottom: 10px; }

.btn-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.btn {
    border: none;
    background: var(--primario);
    color: white;
    padding: 10px 18px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 77, 109, 0.3);
    font-size: 0.85rem;
}

.btn-galeria { background: #ff85a1; }

.contador {
    background: #ffe6f0;
    border-radius: 20px;
    padding: 10px;
    flex-shrink: 0; /* Impide que el contador se aplaste o desaparezca */
}

.contador h2 { font-size: 0.8rem; text-align: center; margin-bottom: 5px; color: var(--primario); }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.box { background: white; border-radius: 10px; padding: 5px; text-align: center; }
.box span { display: block; font-size: 0.9rem; font-weight: 800; color: var(--primario); }
.box label { font-size: 0.5rem; color: #888; text-transform: uppercase; }

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

/* Ajuste para que la imagen y el video no rompan el modal en móviles pequeños */
.modal-img { 
    width: 100%; 
    max-height: 65vh; 
    object-fit: contain; 
    display: block; 
    background: #000; 
}

.relato-overlay {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px;
    font-size: 0.85rem;
    text-align: center;
    backdrop-filter: blur(5px);
}

.modal-nav {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    align-items: center;
    background: white;
}

.nav-btn { background: none; border: none; font-size: 1.5rem; color: var(--primario); cursor: pointer; }

/* Texto sobre la multimedia */
.relato-overlay {
    position: absolute;
    bottom: 60px; /* Arriba de los botones de navegación */
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6); /* Fondo oscuro semitransparente */
    color: white;
    padding: 15px;
    font-size: 0.9rem;
    text-align: center;
    font-family: 'Segoe UI', sans-serif;
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255,255,255,0.2);
}

/* Ajuste para que el video no se corte */
.modal-img {
    width: 100%;
    max-height: 70vh; /* Para que no ocupe toda la pantalla y deje ver el texto */
    object-fit: contain; 
    background: #000;
}