/* =========================================================
   RESET
========================================================= */

* {

    margin: 0;
    padding: 0;

    box-sizing: border-box;

}


/* =========================================================
   VARIABLES
========================================================= */

:root {

    --bg: #070910;

    --panel: #0c0f18;

    --panel-two: #111522;

    --panel-three: #161b29;

    --border: #202638;

    --text: #f4f7ff;

    --muted: #7e899f;

    --purple: #885cff;

    --purple-light: #a875ff;

    --blue: #6678ff;

    --cyan: #20d8ff;

    --green: #27e887;

    --red: #ff536b;

    --yellow: #f4c542;

}


/* =========================================================
   BODY
========================================================= */

body {

    min-height: 100vh;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:

        radial-gradient(
            circle at 10% 10%,
            rgba(102, 120, 255, 0.08),
            transparent 30%
        ),

        radial-gradient(
            circle at 90% 30%,
            rgba(136, 92, 255, 0.08),
            transparent 35%
        ),

        var(--bg);

    color: var(--text);

}


/* =========================================================
   APP
========================================================= */

.app {

    width: 100%;

    min-height: 100vh;

    padding: 20px;

}


/* =========================================================
   TOPBAR
========================================================= */

.topbar {

    height: 70px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom:
        1px solid var(--border);

    margin-bottom: 18px;

}


.brand {

    display: flex;

    align-items: center;

    gap: 11px;

}


.brand-logo {

    width: 42px;

    height: 42px;

    border-radius: 12px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 800;

    font-size: 20px;

    background:

        linear-gradient(
            135deg,
            var(--blue),
            var(--purple)
        );

    box-shadow:

        0 0 25px
        rgba(111, 92, 255, 0.25);

}


.brand-text h1 {

    font-size: 16px;

    letter-spacing: 2px;

}


.brand-text span {

    display: block;

    margin-top: 2px;

    font-size: 9px;

    letter-spacing: 3px;

    color: var(--muted);

}


.top-status {

    display: flex;

    align-items: center;

    gap: 8px;

    font-size: 11px;

    color: var(--muted);

}


.online-dot {

    width: 7px;

    height: 7px;

    border-radius: 50%;

    background: var(--green);

    box-shadow:

        0 0 12px
        var(--green);

}


/* =========================================================
   DASHBOARD
========================================================= */

.dashboard {

    display: grid;

    grid-template-columns:

        minmax(
            600px,
            1fr
        )

        360px;

    gap: 16px;

}


/* =========================================================
   STREAM PANEL
========================================================= */

.stream-panel {

    overflow: hidden;

    border-radius: 18px;

    border:
        1px solid var(--border);

    background: var(--panel);

}


.panel-header {

    height: 73px;

    padding:
        15px
        18px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom:
        1px solid var(--border);

}


.panel-small {

    display: block;

    margin-bottom: 4px;

    font-size: 9px;

    letter-spacing: 2px;

    color: var(--muted);

}


.panel-header h2 {

    font-size: 17px;

}


.stream-badge {

    padding:
        7px
        11px;

    border-radius: 8px;

    font-size: 10px;

    font-weight: 700;

    color: #ff8393;

    border:

        1px solid
        rgba(255, 83, 107, 0.25);

    background:

        rgba(255, 83, 107, 0.10);

}


/* =========================================================
   STAGE
========================================================= */

.stage {

    position: relative;

    height: 590px;

    overflow: hidden;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    background:

        linear-gradient(
            180deg,
            #0a0d16,
            #070910
        );

}


.stage-grid {

    position: absolute;

    inset: 0;

    opacity: 0.10;

    background-image:

        linear-gradient(
            rgba(255,255,255,0.04) 1px,
            transparent 1px
        ),

        linear-gradient(
            90deg,
            rgba(255,255,255,0.04) 1px,
            transparent 1px
        );

    background-size:
        45px
        45px;

}


.stage-light {

    position: absolute;

    width: 480px;

    height: 480px;

    border-radius: 50%;

    filter: blur(110px);

    opacity: 0.16;

}


.stage-light-one {

    top: -230px;

    left: -190px;

    background:
        var(--blue);

}


.stage-light-two {

    bottom: -260px;

    right: -180px;

    background:
        var(--purple);

}


/* =========================================================
   AVATAR CONTAINER
========================================================= */

.avatar-container {

    position: relative;

    z-index: 5;

    width: 350px;

    height: 400px;

    display: flex;

    justify-content: center;

    align-items: flex-end;

}


/* =========================================================
   AVATAR PNG
========================================================= */

.avatar-image {

    position: relative;

    z-index: 5;

    width: auto;

    height: 100%;

    max-width: 100%;

    object-fit: contain;

    object-position:
        center
        bottom;

    transform-origin:
        center
        bottom;

    filter:

        drop-shadow(
            0 20px 28px
            rgba(0,0,0,0.50)
        );

}


/* =========================================================
   IDLE
========================================================= */

.avatar-image.idle {

    animation:

        avatarIdle
        3.2s
        ease-in-out
        infinite;

}


@keyframes avatarIdle {

    0% {

        transform:
            translateY(0)
            scale(1);

    }


    50% {

        transform:
            translateY(-5px)
            scale(1.006);

    }


    100% {

        transform:
            translateY(0)
            scale(1);

    }

}


/* =========================================================
   TALKING
========================================================= */

.avatar-image.talking {

    animation:

        avatarTalking
        0.24s
        ease-in-out
        infinite
        alternate;

}


@keyframes avatarTalking {

    from {

        transform:
            translateY(0)
            scale(1);

    }


    to {

        transform:
            translateY(-5px)
            scale(1.012);

    }

}


/* =========================================================
   GLOW
========================================================= */

.avatar-glow {

    position: absolute;

    z-index: 1;

    bottom: 25px;

    width: 270px;

    height: 270px;

    border-radius: 50%;

    background:

        radial-gradient(
            circle,
            rgba(139, 92, 255, 0.26),
            rgba(102, 120, 255, 0.12) 45%,
            transparent 72%
        );

    filter:
        blur(14px);

    transition:
        0.25s;

}


.avatar-container.speaking
.avatar-glow {

    animation:

        glowTalking
        0.7s
        ease-in-out
        infinite
        alternate;

}


@keyframes glowTalking {

    from {

        opacity: 0.45;

        transform:
            scale(1);

    }


    to {

        opacity: 1;

        transform:
            scale(1.18);

    }

}


/* =========================================================
   SPEAKING RING
========================================================= */

.speaking-ring {

    position: absolute;

    z-index: 2;

    bottom: 65px;

    width: 250px;

    height: 250px;

    border-radius: 50%;

    border:

        2px solid
        rgba(132, 94, 255, 0);

    opacity: 0;

}


.avatar-container.speaking
.speaking-ring {

    opacity: 1;

    border-color:

        rgba(
            132,
            94,
            255,
            0.45
        );

    box-shadow:

        0 0 30px
        rgba(132,94,255,0.20),

        0 0 80px
        rgba(132,94,255,0.12);

    animation:

        voiceRing
        0.85s
        ease-out
        infinite;

}


@keyframes voiceRing {

    from {

        transform:
            scale(0.92);

        opacity: 0.8;

    }


    to {

        transform:
            scale(1.25);

        opacity: 0;

    }

}


/* =========================================================
   PLACEHOLDER
========================================================= */

.avatar-placeholder {

    position: absolute;

    z-index: 4;

    width: 210px;

    height: 210px;

    border-radius: 50%;

    display: none;

    align-items: center;

    justify-content: center;

    font-size: 75px;

    font-weight: 800;

    background:

        linear-gradient(
            135deg,
            #22283c,
            #171b29
        );

    border:
        2px solid #363d58;

}


/* =========================================================
   PERSONAJE INFO
========================================================= */

.character-info {

    position: relative;

    z-index: 7;

    margin-top: 8px;

    text-align: center;

}


.character-info h3 {

    margin-bottom: 5px;

    font-size: 24px;

}


.ai-status {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 7px;

    font-size: 11px;

    color: var(--muted);

}


.status-dot {

    width: 7px;

    height: 7px;

    border-radius: 50%;

    background: var(--green);

}


/* =========================================================
   SPEECH BOX
========================================================= */

.speech-box {

    position: absolute;

    z-index: 20;

    left: 22px;

    right: 22px;

    bottom: 20px;

    padding:
        14px
        17px;

    border-radius: 12px;

    border:

        1px solid
        rgba(136,92,255,0.30);

    background:

        rgba(9,12,20,0.94);

    backdrop-filter:
        blur(12px);

}


.speech-label {

    font-size: 9px;

    font-weight: 700;

    letter-spacing: 2px;

    color: var(--purple-light);

}


.speech-box p {

    margin-top: 6px;

    font-size: 13px;

    line-height: 1.45;

}


.hidden {

    display: none;

}


/* =========================================================
   CONTROLES
========================================================= */

.stream-controls {

    display: flex;

    gap: 10px;

    padding: 13px;

    border-top:
        1px solid var(--border);

}


.control-button {

    height: 42px;

    flex: 1;

    cursor: pointer;

    border-radius: 9px;

    border:
        1px solid var(--border);

    background:
        var(--panel-two);

    color:
        var(--text);

    font-weight: 650;

    transition:
        0.2s;

}


.control-button:hover {

    transform:
        translateY(-1px);

    background:
        var(--panel-three);

}


.control-button.primary {

    border: none;

    background:

        linear-gradient(
            135deg,
            var(--blue),
            var(--purple)
        );

}


.control-button.danger {

    color:
        #ff7183;

}


/* =========================================================
   SIDE PANEL
========================================================= */

.side-panel {

    display: flex;

    flex-direction: column;

    gap: 14px;

}


.status-card,
.chat-card {

    border-radius: 17px;

    border:
        1px solid var(--border);

    background:
        var(--panel);

}


/* =========================================================
   STATUS
========================================================= */

.status-card {

    padding:
        17px;

}


.section-title {

    margin-bottom: 13px;

    font-size: 9px;

    letter-spacing: 2px;

    color: var(--muted);

}


.status-row {

    display: flex;

    align-items: center;

    justify-content: space-between;

    min-height: 42px;

    border-bottom:

        1px solid
        rgba(255,255,255,0.04);

    font-size: 12px;

}


.status-row:last-child {

    border-bottom:
        none;

}


.status-green {

    color: var(--green);

    font-size: 11px;

}


.status-gray {

    color: #7a849b;

    font-size: 11px;

}


.status-red {

    color: var(--red);

    font-size: 11px;

}


/* =========================================================
   CHAT
========================================================= */

.chat-card {

    min-height: 493px;

    display: flex;

    flex-direction: column;

    overflow: hidden;

}


.chat-header {

    height: 70px;

    padding:
        14px
        16px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom:
        1px solid var(--border);

}


.chat-header h2 {

    font-size: 16px;

}


.clear-button {

    width: 34px;

    height: 34px;

    cursor: pointer;

    border-radius: 8px;

    border:
        1px solid var(--border);

    color:
        var(--muted);

    background:
        var(--panel-two);

}


.messages {

    height: 350px;

    padding: 14px;

    overflow-y: auto;

}


.system-message {

    padding: 10px;

    text-align: center;

    font-size: 10px;

    color:
        var(--muted);

}


.message {

    margin-bottom: 12px;

}


.message-name {

    margin-bottom: 4px;

    font-size: 10px;

    font-weight: 700;

}


.message.user
.message-name {

    color:
        var(--cyan);

}


.message.ai
.message-name {

    color:
        var(--purple-light);

}


.message-text {

    padding:
        10px
        11px;

    border-radius: 9px;

    background:
        var(--panel-three);

    color:
        #e0e5ef;

    line-height:
        1.45;

    font-size:
        12px;

}


.message.ai
.message-text {

    border-left:

        2px solid
        var(--purple);

}


/* =========================================================
   CHAT INPUT
========================================================= */

.chat-input-area {

    margin-top: auto;

    display: flex;

    gap: 8px;

    padding: 12px;

    border-top:
        1px solid var(--border);

}


.chat-input-area input {

    min-width: 0;

    flex: 1;

    height: 42px;

    padding:
        0
        12px;

    border-radius: 9px;

    outline: none;

    border:
        1px solid var(--border);

    background:
        #10141f;

    color:
        white;

}


.chat-input-area input:focus {

    border-color:
        var(--purple);

}


.chat-input-area input:disabled {

    opacity:
        0.5;

}


.chat-input-area button {

    width: 43px;

    border: none;

    border-radius: 9px;

    cursor: pointer;

    color: white;

    font-size: 17px;

    background:

        linear-gradient(
            135deg,
            var(--blue),
            var(--purple)
        );

}


.chat-input-area button:disabled {

    opacity:
        0.45;

    cursor:
        not-allowed;

}


/* =========================================================
   CONSOLE
========================================================= */

.console-panel {

    margin-top: 16px;

    overflow: hidden;

    border-radius: 15px;

    border:
        1px solid var(--border);

    background:
        #070a10;

}


.console-header {

    height: 42px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding:
        0
        14px;

    font-size: 9px;

    letter-spacing: 2px;

    color:
        var(--muted);

    border-bottom:
        1px solid var(--border);

}


.console-status {

    color:
        var(--green);

}


.console {

    height: 100px;

    overflow-y: auto;

    padding:
        11px
        13px;

    font-family:
        Consolas,
        monospace;

    font-size:
        10px;

}


.log {

    margin-bottom:
        6px;

    color:
        #a7b0c4;

}


.log-time {

    margin-right:
        9px;

    color:
        #536078;

}


.log-system {

    margin-right:
        9px;

    color:
        var(--blue);

}


/* =========================================================
   SCROLL
========================================================= */

::-webkit-scrollbar {

    width:
        7px;

}


::-webkit-scrollbar-track {

    background:
        transparent;

}


::-webkit-scrollbar-thumb {

    border-radius:
        10px;

    background:
        #343b4e;

}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (
    max-width: 1000px
) {

    .dashboard {

        grid-template-columns:
            1fr;

    }


    .side-panel {

        display:
            grid;

        grid-template-columns:
            1fr 1fr;

    }

}


@media (
    max-width: 700px
) {

    .app {

        padding:
            10px;

    }


    .stage {

        height:
            520px;

    }


    .avatar-container {

        width:
            280px;

        height:
            340px;

    }


    .side-panel {

        display:
            flex;

    }


    .stream-controls {

        flex-direction:
            column;

    }


    .top-status {

        display:
            none;

    }

}