:root {
    --noche: #0A1128;
    --azul-profundo: #12234E;
    --azul-medio: #1C3F80;
    --estrella: #E0EFFF;
    --brillo: #FFFFFF;
    --chat-entrada: #2A3F69;
    --chat-salida: #4A6FA5;
}

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

body {
    background-color: var(--noche);
    color: var(--estrella);
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 90px; /* Espacio reservado para el pie */
}

/* Estrellas de fondo */
.estrellas-fondo {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    border-radius: 50%;
    background-color: var(--estrella);
    animation: parpadeo 3s infinite ease-in-out;
    will-change: transform, opacity;
}

.estrellaFuerte {
    animation: brilloExtremo 3s ease-in-out forwards;
}

@keyframes parpadeo {
    0%, 100% { opacity: 0.3; transform: scale(0.7); }
    50% { opacity: 1; transform: scale(1); }
}

@keyframes brilloExtremo {
    0%, 100% { 
        opacity: 1; transform: scale(1);
        box-shadow: 0 0 20px var(--brillo), 0 0 40px var(--estrella), 0 0 70px #b3d1ff, 0 0 110px #80b3ff, 0 0 160px #4d94ff;
    }
    50% { 
        opacity: 1; transform: scale(5);
        box-shadow: 0 0 60px var(--brillo), 0 0 120px var(--estrella), 0 0 200px #b3d1ff, 0 0 300px #80b3ff, 0 0 420px #4d94ff, 0 0 550px rgba(100,180,255,0.6);
    }
}

/* Contenedor principal centrado */
.contenedor-principal {
    min-height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 2rem 1.5rem;
}

.seccion {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.seccion-centrada {
    width: 100%;
    justify-content: center;
}

/* Títulos y textos */
.titulo-principal {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 800;
    text-align: center;
    margin-bottom: 2.5rem;
    text-shadow: 0 0 15px rgba(224,239,255,0.6);
}

.texto-moralejas {
    max-width: 800px;
    width: 100%;
    text-align: center;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    line-height: 1.7;
}

.texto-moralejas p {
    margin-bottom: 1.5rem;
}

/* Chat */
.ventana-chat {
    width: 100%;
    max-width: 650px;
    background: rgba(18, 35, 78, 0.75);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid rgba(224,239,255,0.2);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.caja-mensajes {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

.mensaje {
    max-width: 85%;
    border-radius: 18px;
    padding: 1rem 1.4rem;
    font-size: 1.1rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.mensaje-entrada {
    background: var(--chat-entrada);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.mensaje-salida {
    background: var(--chat-salida);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.doble-check {
    font-size: 0.75rem;
    margin-left: 0.5rem;
    color: #A8D1FF;
}

.entrada-chat {
    display: flex;
    gap: 0.8rem;
}

.campo-texto {
    flex: 1;
    background: var(--noche);
    border: 1px solid var(--azul-medio);
    border-radius: 9999px;
    padding: 1rem 1.6rem;
    color: var(--estrella);
    font-size: 1.1rem;
    outline: none;
    transition: border 0.2s;
}

.campo-texto:focus {
    border-color: var(--estrella);
    box-shadow: 0 0 0 1px rgba(224,239,255,0.3);
}

.boton-enviar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--azul-medio);
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.boton-enviar:hover {
    background: rgba(28,63,128,0.9);
}

/* Mensaje final más grande en PC */
.mensaje-final {
    max-width: 900px;
    width: 100%;
    margin-top: 2.5rem;
    padding: 0 1.5rem;
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 3vw, 2rem);
    line-height: 1.9;
    font-style: italic;
    text-shadow: 0 0 30px rgba(255,255,255,1), 0 0 60px rgba(224,239,255,0.9), 0 0 100px rgba(168,200,255,0.7);
    cursor: pointer;
}

/* Efectos de escritura */
.typing {
    border-right: 2px solid var(--estrella);
    white-space: pre-wrap;
    overflow: hidden;
    animation: escribir 0.04s steps(1) forwards, parpadeoCursor 0.8s infinite;
}

@keyframes escribir { from { width: 0; } to { width: 100%; } }
@keyframes parpadeoCursor { 0%,100% { border-color: transparent; } 50% { border-color: var(--estrella); } }

.fade-in { animation: fadeIn 1.5s ease forwards; }
.fade-out { animation: fadeOut 1.5s ease forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

.opacity-0 { opacity: 0; }
.hidden { display: none; }
.italic { font-style: italic; }

/* Menú */
.menu-contenedor {
    position: fixed;
    top: 1.2rem;
    right: 1.2rem;
    z-index: 9999;
}

.menu-boton {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(18,35,78,0.85);
    border: 1px solid rgba(224,239,255,0.4);
    color: var(--estrella);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(224,239,255,0.2);
}

.menu-boton:hover {
    background: rgba(28,63,128,0.95);
    box-shadow: 0 0 20px rgba(224,239,255,0.5);
}

.menu-opciones {
    position: absolute;
    top: 55px;
    right: 0;
    width: 160px;
    background: rgba(10,17,40,0.97);
    border: 1px solid rgba(224,239,255,0.25);
    border-radius: 12px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.menu-opciones.mostrar {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-opcion {
    padding: 0.9rem 1.2rem;
    color: var(--estrella);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-opcion:hover {
    background: rgba(28,63,128,0.7);
}

/* Pie de página FIJO en la parte inferior */
.pie-pagina {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    width: 100%;
    height: 90px;
    padding: 1rem;
    text-align: center;
    background: rgba(10,17,40,0.9);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(224,239,255,0.15);
    font-size: 0.9rem;
    color: rgba(224,239,255,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.redes {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    font-size: 1.3rem;
}

.redes a {
    color: rgba(224,239,255,0.7);
    transition: color 0.2s;
}

.redes a:hover {
    color: var(--estrella);
}

/* Ajustes para móvil */
@media (max-width: 767px) {
    body {
        padding-bottom: 85px;
    }
    .contenedor-principal {
        min-height: calc(100vh - 85px);
        padding: 1.5rem 1rem;
    }
    .pie-pagina {
        height: 85px;
    }
    .ventana-chat {
        max-width: 550px;
        padding: 1.5rem;
    }
    .caja-mensajes {
        max-height: 320px;
        font-size: 1rem;
    }
    .mensaje {
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
    }
    .campo-texto {
        padding: 0.9rem 1.4rem;
        font-size: 1rem;
    }
    .boton-enviar {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
    .mensaje-final {
        font-size: 1.3rem;
        line-height: 1.7;
    }
}
