.statechat {
    position: absolute;
    left: 12px;
    bottom: 84px; /* lo subo para no chocar con botones abajo */
    width: min(360px, calc(100vw - 24px));
    max-height: 42vh;
    z-index: 2;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0,0,0,.22);
    backdrop-filter: blur(8px);
    color: #fff;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
    transition: background .15s ease, box-shadow .15s ease;
}

    .statechat.active {
        background: rgba(10,10,10,.88);
        box-shadow: 0 14px 30px rgba(0,0,0,.35);
    }

.statechat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
    font-size: 14px;
}

.statechat__msgs {
    padding: 8px 12px;
    overflow: auto;
    max-height: 28vh;
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
    font-size: 13px;
    line-height: 1.25;
}

.statechat__inputRow {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,.12);
}

#stateChatInput {
    flex: 1;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.14);
    color: #fff;
    border-radius: 12px;
    padding: 10px 10px;
    outline: none;
}

#stateChatSend {
    width: 44px;
    border-radius: 12px;
    border: 0;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 16px;
}

.statechat__toggle {
    background: transparent;
    border: 0;
    color: #fff;
    opacity: .85;
}

.statechat__notice {
    padding: 8px 12px 12px;
    font-size: 12px;
    opacity: .9;
}

.statechat.collapsed .statechat__msgs,
.statechat.collapsed .statechat__inputRow,
.statechat.collapsed .statechat__notice {
    display: none;
}

@keyframes chatPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(254,109,4,0.70), 0 0 0 0 rgba(0,0,0,0.18);
    }

    60% {
        box-shadow: 0 0 0 12px rgba(254,109,4,0.00), 0 0 0 2px rgba(0,0,0,0.12);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(254,109,4,0.00), 0 0 0 0 rgba(0,0,0,0.00);
    }
}

.statechat.pulse {
    animation: chatPulse 1.35s infinite;
}

@media(max-width:1024px) {
    .statechat {
        bottom: 60px;
    }
}

@media (max-width: 450px) {
    .statechat {
        width: calc(100% - 90px);
    }
}
