/* Fondo exclusivo de Chat: opción B, centrada y sin módulos superpuestos. */
.chat-page {
    /* El formulario está posicionado dentro del portal y no aporta altura al
       contenedor. Reservamos el espacio real que necesita para que no quede
       recortado en portátiles o ventanas con poca altura. */
    min-height: max(calc(100vh - 178px), 650px);
    position: relative;
    overflow: hidden;
    background: #05071d url("../img/fondo-chat-portal-b.png") center center / cover fixed no-repeat;
    background-position: center 75px;
}

/* Los rótulos quedan centrados sobre la punta superior del Stargate. */
.chat-presentacion {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 50%;
    width: min(25vw, 360px);
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    pointer-events: none;
}

.chat-logo-principal {
    display: block;
    width: 100%;
    height: auto;
}

.chat-bienvenida {
    display: block;
    width: 76%;
    height: auto;
    margin-top: 4px;
}

/* Maqueta vacía que ocupará el interior del portal. */
.chat-formulario {
    position: absolute;
    z-index: 2;
    /* Separado del eslogan y centrado en el interior iluminado del portal. */
    top: 275px;
    left: 50%;
    width: min(28vw, 410px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
    box-sizing: border-box;
    padding: 18px;
    border: 1px solid rgba(136, 196, 255, .45);
    border-radius: 25px;
    background: rgba(6, 13, 47, .72);
    box-shadow: 0 12px 42px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .10);
    backdrop-filter: blur(10px);
    transform: translateX(-50%);
}

.campo-chat {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #f2f7ff;
    font-weight: 700;
    font-size: 13px;
}

.campo-chat small {
    color: #bfd6ff;
    font-weight: 400;
}

.campo-chat input,
.campo-chat select {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    border: 1px solid rgba(151, 205, 255, .38);
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, .07);
    color: #fff;
    padding: 0 14px;
    font: inherit;
}

.campo-chat input::placeholder {
    color: #a7badb;
}

.registro-chat,
.verificacion-chat {
    box-sizing: border-box;
    border: 1px solid rgba(151, 205, 255, .28);
    border-radius: 12px;
    color: #eaf3ff;
}

.registro-chat {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 8px;
    padding: 7px 10px 9px;
}

.registro-chat legend {
    padding: 0 5px;
    font-size: 12px;
    font-weight: 700;
}

.registro-chat label,
.verificacion-chat {
    font-size: 11px;
}

.verificacion-chat {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 10px;
    cursor: pointer;
}

.boton-entrar-chat {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    border: 0;
    border-radius: 12px;
    color: #fff;
    font: 800 15px/1 Arial, sans-serif;
    letter-spacing: .7px;
    text-transform: uppercase;
    background: linear-gradient(90deg, rgba(199, 55, 255, .96), rgba(21, 153, 255, .96));
    box-shadow: 0 0 20px rgba(91, 139, 255, .35);
    cursor: pointer;
}

.chat-estado {
    min-height: 16px;
    margin: -4px 0 0;
    color: #ffd0f4;
    font-size: 11px;
    text-align: center;
}

.chat-cliente-irc {
    display: none;
}

.chat-irc-persistente {
    position: fixed;
    z-index: 20;
    top: 178px;
    right: 3%;
    bottom: 0;
    left: 3%;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid rgba(125, 192, 255, .45);
    border-radius: 22px 22px 0 0;
    background: #090f30;
    box-shadow: 0 0 35px rgba(93, 76, 255, .32);
}

.chat-cerrar {
    position: fixed;
    z-index: 2;
    top: 7px;
    left: max(18px, 3vw);
    height: 30px;
    padding: 0 14px;
    border: 1px solid rgba(177, 215, 255, .52);
    border-radius: 16px;
    color: #fff;
    background: rgba(13, 20, 58, .84);
    font: 700 13px/28px Arial, sans-serif;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(86, 182, 255, .25);
}

.chat-cerrar:hover,
.chat-cerrar:focus-visible {
    border-color: #ff75dc;
    background: #74266f;
    outline: none;
}

.chat-irc-persistente iframe {
    position: absolute;
    top: 44px;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 44px);
    border: 0;
}

/* Viaje visual mientras el IRC prepara el canal. */
.chat-viaje-galaxia {
    position: absolute;
    z-index: 5;
    inset: 44px 0 0;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #eef7ff;
    background: radial-gradient(circle at 50% 50%, rgba(84, 172, 219, .28), transparent 19%), radial-gradient(circle at 50% 50%, #152955 0, #080e29 48%, #030617 100%);
    opacity: 1;
    transition: opacity .65s ease, transform .65s ease;
}

.chat-viaje-galaxia[hidden] { display: none; }
.chat-viaje-galaxia--saliendo { opacity: 0; transform: scale(1.08); pointer-events: none; }

.chat-viaje-estrellas,
.chat-viaje-estrellas::before,
.chat-viaje-estrellas::after {
    position: absolute;
    inset: -55%;
    content: '';
    background-image: radial-gradient(circle, rgba(211, 231, 255, .90) 0 1px, transparent 1.6px), radial-gradient(circle, rgba(114, 179, 222, .72) 0 1px, transparent 1.5px);
    background-position: 0 0, 23px 37px;
    background-size: 61px 61px, 83px 83px;
    transform-origin: center;
    animation: chat-estrellas-viaje 4.8s linear infinite;
}

.chat-viaje-estrellas::before { opacity: .48; animation-duration: 7s; }
.chat-viaje-estrellas::after { opacity: .30; animation-duration: 10s; }

.chat-viaje-portal {
    position: relative;
    width: min(42vw, 390px);
    aspect-ratio: 1;
    border: 5px solid rgba(123, 175, 203, .75);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(209, 239, 247, .95) 0 3%, rgba(70, 158, 204, .75) 8%, rgba(31, 79, 141, .38) 38%, rgba(4, 10, 31, .92) 70%);
    box-shadow: 0 0 28px rgba(91, 183, 226, .62), inset 0 0 34px rgba(179, 229, 242, .38);
    animation: chat-portal-pulso 2.2s ease-in-out infinite;
}

.chat-viaje-portal i {
    position: absolute;
    inset: 8%;
    border: 1px dashed rgba(177, 220, 238, .52);
    border-radius: 50%;
    animation: chat-anillo-giro 5s linear infinite;
}

.chat-viaje-portal i:nth-child(2) { inset: 17%; animation-direction: reverse; animation-duration: 3.8s; }
.chat-viaje-portal i:nth-child(3) { inset: 29%; animation-duration: 2.7s; }

.chat-viaje-texto {
    position: absolute;
    z-index: 2;
    display: grid;
    gap: 7px;
    padding: 17px 28px;
    border: 1px solid rgba(160, 207, 231, .35);
    border-radius: 16px;
    text-align: center;
    background: rgba(5, 12, 36, .76);
    box-shadow: 0 10px 32px rgba(0, 0, 0, .38);
    backdrop-filter: blur(7px);
}

.chat-viaje-texto strong { font-size: clamp(20px, 2.4vw, 31px); letter-spacing: .6px; }
.chat-viaje-texto span { color: #b9d5e9; font-size: 14px; }
.chat-viaje-texto small { color: #7fc3e6; font-size: 13px; font-weight: 800; }

@keyframes chat-estrellas-viaje {
    from { transform: scale(.36) rotate(0deg); opacity: .18; }
    to { transform: scale(1.28) rotate(10deg); opacity: .86; }
}

@keyframes chat-portal-pulso {
    0%, 100% { transform: scale(.96); filter: brightness(.88); }
    50% { transform: scale(1.04); filter: brightness(1.13); }
}

@keyframes chat-anillo-giro { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (max-width: 760px) {
    .chat-page {
        min-height: max(calc(100vh - 240px), 650px);
        background-attachment: scroll;
        background-position: center 60px;
    }

    .chat-presentacion {
        top: 4px;
        width: 54vw;
    }

    .chat-bienvenida {
        width: 84%;
    }

    .chat-formulario {
        top: 205px;
        width: min(76vw, 390px);
        min-height: 0;
        padding: 15px;
        gap: 8px;
    }

    .registro-chat {
        grid-template-columns: 1fr;
    }

    .chat-irc-persistente {
        top: 168px;
        right: 2%;
        left: 2%;
    }

    .chat-viaje-portal { width: min(72vw, 330px); }
    .chat-viaje-texto { width: min(74vw, 330px); box-sizing: border-box; padding: 14px 18px; }
}
