* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 22px 4vw 28px;
    overflow: hidden;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: #f5f7fb;
    background:
        radial-gradient(circle at 86% 8%, rgba(25, 83, 155, .34), transparent 28%),
        radial-gradient(circle at 8% 92%, rgba(13, 47, 96, .30), transparent 32%),
        linear-gradient(135deg, #000611 0%, #031a38 48%, #000814 100%);
}

/* =========================================================
   AURORA PSP — DISEÑO AZUL PROFUNDO + ORO
   Inspirado en la referencia visual azul marino y dorado.
   ========================================================= */

.chat-container {
    width: 100%;
    max-width: 1480px;
    height: calc(100vh - 50px);
    min-height: 620px;
    margin: 0 auto;
    padding: 22px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(180, 128, 45, .48);
    border-radius: 40px;
    background:
        linear-gradient(145deg,
            rgba(3, 25, 55, .96),
            rgba(1, 10, 25, .98));
    box-shadow:
        inset 0 0 80px rgba(17, 66, 128, .20),
        inset 0 1px 0 rgba(255, 211, 118, .08),
        0 28px 80px rgba(0, 0, 0, .55);
    backdrop-filter: blur(20px);
}

/* Halo azul profundo */
.chat-container::before {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    right: -250px;
    top: -300px;
    border-radius: 50%;
    background: rgba(15, 79, 157, .18);
    filter: blur(75px);
    pointer-events: none;
}

/* Línea dorada decorativa */
.chat-container::after {
    content: "";
    position: absolute;
    left: 9%;
    right: 9%;
    top: 188px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(184, 132, 48, .65),
        rgba(245, 194, 91, .90),
        rgba(184, 132, 48, .65),
        transparent
    );
    opacity: .55;
    pointer-events: none;
}

/* =========================
   ENCABEZADO
   ========================= */

.header {
    flex: 0 0 auto;
    min-height: 176px;
    padding: 2px 60px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    background: transparent;
}

.avatar-header {
    width: 94px;
    height: 94px;
    object-fit: contain;
    border-radius: 0;
    filter:
        drop-shadow(0 0 12px rgba(28, 105, 197, .45))
        drop-shadow(0 5px 14px rgba(0, 0, 0, .40));
}

.header-text {
    line-height: 1.25;
}

.header-text strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(25px, 2.15vw, 38px);
    font-weight: 700;
    letter-spacing: .22em;
    color: #f7f2e7;
    text-shadow:
        0 0 14px rgba(70, 128, 202, .35),
        0 2px 2px rgba(0, 0, 0, .55);
}

.header-text span {
    display: block;
    max-width: 1080px;
    margin-top: 9px;
    font-size: clamp(14px, 1.15vw, 19px);
    line-height: 1.45;
    color: #d8e3f0;
    opacity: .94;
}

/* =========================
   ÁREA DE CHAT
   ========================= */

#chat {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 3px solid rgba(46, 94, 151, .55);
    border-radius: 31px;
    background:
        linear-gradient(180deg,
            rgba(1, 20, 47, .91),
            rgba(0, 11, 28, .95));
    box-shadow:
        inset 0 0 50px rgba(13, 53, 106, .22),
        inset 0 1px 0 rgba(255, 211, 118, .06),
        0 0 30px rgba(0, 0, 0, .25);
    scrollbar-width: thin;
    scrollbar-color: rgba(177, 126, 43, .65) transparent;
}

#chat::-webkit-scrollbar {
    width: 7px;
}

#chat::-webkit-scrollbar-track {
    background: transparent;
}

#chat::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        rgba(210, 157, 61, .70),
        rgba(116, 79, 25, .70)
    );
    border-radius: 20px;
}

/* =========================
   MENSAJES
   ========================= */

.msg {
    margin: 8px 0;
    padding: 14px 19px;
    display: inline-block;
    width: fit-content;
    max-width: 82%;
    min-width: 120px;
    border-radius: 20px;
    word-wrap: break-word;
    word-break: normal;
    white-space: pre-wrap;
    font-size: 16px;
    line-height: 1.58;
}

.welcome {
    align-self: stretch;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 14px 22px 14px 72px;
    position: relative;
    border: 1px solid rgba(65, 116, 176, .30);
    border-radius: 29px;
    background:
        linear-gradient(90deg,
            rgba(10, 44, 87, .76),
            rgba(4, 27, 59, .56));
    color: #f4f7fb;
    font-size: 18px;
    box-shadow: inset 0 0 22px rgba(19, 75, 139, .10);
}

.welcome::before {
    content: "✦";
    position: absolute;
    left: -2px;
    top: 50%;
    width: 54px;
    height: 54px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    border: 1px solid rgba(218, 165, 70, .88);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            #28639b,
            #082b57 68%,
            #031a37);
    color: #f5d487;
    font-size: 23px;
    box-shadow:
        0 0 20px rgba(30, 105, 181, .30),
        0 0 16px rgba(202, 146, 48, .10);
}

.user {
    align-self: flex-end;
    color: #fff;
    background:
        linear-gradient(135deg,
            rgba(16, 72, 138, .98),
            rgba(7, 38, 87, .98));
    border: 1px solid rgba(79, 136, 204, .45);
    border-bottom-right-radius: 6px;
    box-shadow: 0 7px 20px rgba(0, 0, 0, .16);
}

.bot {
    align-self: flex-start;
    color: #edf4fc;
    background:
        linear-gradient(135deg,
            rgba(8, 39, 77, .98),
            rgba(3, 25, 53, .98));
    border: 1px solid rgba(61, 105, 157, .36);
    border-bottom-left-radius: 6px;
    box-shadow: 0 7px 20px rgba(0, 0, 0, .13);
}

/* =========================
   BOTÓN COPIAR
   ========================= */

.msg button {
    border: 1px solid rgba(211, 157, 59, .62);
    border-radius: 10px;
    padding: 8px 13px;
    background:
        linear-gradient(135deg,
            rgba(84, 59, 22, .90),
            rgba(44, 32, 13, .95));
    color: #f7dc9a;
    font-size: 12px;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease;
}

.msg button:hover {
    transform: translateY(-1px);
    background:
        linear-gradient(135deg,
            rgba(120, 83, 28, .95),
            rgba(59, 41, 14, .98));
}

/* =========================
   BARRA DE ENTRADA
   ========================= */

.input-area {
    flex: 0 0 auto;
    min-height: 96px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    border: 1px solid rgba(183, 130, 45, .52);
    border-radius: 32px;
    background:
        linear-gradient(135deg,
            rgba(5, 39, 78, .98),
            rgba(2, 22, 48, .99));
    box-shadow:
        inset 0 0 30px rgba(17, 70, 132, .24),
        inset 0 1px 0 rgba(244, 193, 91, .10),
        0 0 25px rgba(0, 0, 0, .30);
}

input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 64px;
    padding: 0 21px;
    border: 1px solid rgba(55, 101, 157, .38);
    border-radius: 18px;
    outline: none;
    background:
        linear-gradient(180deg,
            rgba(1, 20, 45, .92),
            rgba(1, 14, 34, .96));
    color: #f5f8fc;
    font-size: 17px;
    box-shadow:
        inset 0 0 25px rgba(0, 25, 58, .35);
}

input::placeholder {
    color: #91a9c1;
    opacity: 1;
}

input:focus {
    border-color: rgba(205, 154, 57, .70);
    box-shadow:
        inset 0 0 25px rgba(0, 25, 58, .35),
        0 0 16px rgba(193, 138, 42, .10);
}

/* =========================
   BOTONES EXISTENTES
   ========================= */

button {
    border: 1px solid rgba(207, 155, 59, .66);
    background:
        radial-gradient(circle at 35% 30%,
            #174b82,
            #082a54 70%,
            #041b37);
    color: #f8f2e6;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition:
        transform .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}

.input-area > button {
    height: 64px;
    padding: 0 20px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 700;
    box-shadow:
        inset 0 0 18px rgba(38, 111, 181, .18),
        0 0 17px rgba(191, 137, 43, .10);
}

#voiceBtn {
    width: 64px;
    height: 64px;
    margin-right: 0;
    padding: 0;
    border-radius: 50%;
    font-size: 21px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    transform: translateY(-1px);
    background:
        radial-gradient(circle at 35% 30%,
            #1d609c,
            #0a3568 70%,
            #05203e);
    box-shadow:
        inset 0 0 20px rgba(53, 135, 211, .23),
        0 0 22px rgba(206, 155, 57, .16);
}

#voiceBtn.recording {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

/* =========================
   CELULAR
   ========================= */

@media (max-width: 700px) {
    body {
        padding: 8px;
        overflow: hidden;
    }

    .chat-container {
        height: calc(100dvh - 16px);
        min-height: 0;
        padding: 12px 10px;
        gap: 11px;
        border-radius: 25px;
    }

    .chat-container::after {
        top: 151px;
        left: 8%;
        right: 8%;
    }

    .header {
        min-height: 142px;
        padding: 0 8px;
        gap: 5px;
    }

    .avatar-header {
        width: 74px;
        height: 74px;
    }

    .header-text strong {
        font-size: 23px;
        letter-spacing: .15em;
    }

    .header-text span {
        margin-top: 6px;
        font-size: 12px;
        line-height: 1.35;
    }

    #chat {
        padding: 18px 13px;
        border-width: 3px;
        border-radius: 23px;
    }

    .msg {
        max-width: 91%;
        font-size: 15px;
        padding: 11px 14px;
    }

    .welcome {
        padding: 11px 11px 11px 57px;
        font-size: 15px;
    }

    .welcome::before {
        width: 45px;
        height: 45px;
        font-size: 19px;
    }

    .input-area {
        min-height: 72px;
        padding: 8px;
        gap: 7px;
        border-radius: 23px;
    }

    input {
        height: 54px;
        padding: 0 13px;
        border-radius: 15px;
        font-size: 16px;
    }

    .input-area > button {
        height: 54px;
        padding: 0 14px;
        border-radius: 15px;
        font-size: 12px;
    }

    #voiceBtn {
        width: 54px;
        height: 54px;
        font-size: 19px;
    }
}
