#neo-floating-chat {
    --neo-chat-width: 380px;
    --neo-chat-accent: #ff2282;
    position: fixed;
    z-index: 99990;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-family: inherit;
    color: var(--text-color, #fff);
}

.neo-chat__tab {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    min-height: 140px;
    padding: 12px 6px;
    border: 0;
    border-radius: 14px 0 0 14px;
    background: var(--neo-chat-accent);
    color: #fff;
    box-shadow: 0 8px 26px rgba(255, 34, 130, .45);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: width .22s ease, background .22s ease, box-shadow .22s ease;
}

.neo-chat__tab:hover {
    width: 50px;
    background: #ff0f74;
    box-shadow: 0 10px 32px rgba(255, 34, 130, .6);
}

.neo-chat__tab-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.neo-chat__tab-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .5px;
    color: #fff;
}

.neo-chat__badge {
    display: none;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
    background: #fff;
    color: var(--neo-chat-accent);
    font-size: 10px;
    font-weight: 800;
}

.neo-chat__badge.is-visible {
    display: flex;
}

.neo-chat__panel {
    position: absolute;
    right: 56px;
    top: 50%;
    width: var(--neo-chat-width);
    height: min(600px, calc(100vh - 48px));
    height: min(600px, calc(100dvh - 48px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    background: var(--background-card, #111318);
    box-shadow: 0 20px 70px rgba(0,0,0,.42);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(24px) scale(.97);
    transform-origin: center right;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    box-sizing: border-box;
}

.neo-chat.is-open .neo-chat__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0) scale(1);
}

.neo-chat.is-open .neo-chat__tab {
    opacity: 0;
    pointer-events: none;
}

.neo-chat__header {
    min-height: 66px;
    padding: 14px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.07);
    background: rgba(255,255,255,.025);
}

.neo-chat__header strong {
    display: block;
    font-size: 16px;
    line-height: 1.2;
}

.neo-chat__header span {
    display: block;
    margin-top: 4px;
    opacity: .5;
    font-size: 11px;
}

.neo-chat__close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    color: inherit;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.neo-chat__messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 12px 8px;
    scroll-behavior: smooth;
}

.neo-chat__messages::-webkit-scrollbar {
    width: 5px;
}
.neo-chat__messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
    border-radius: 99px;
}

.neo-chat__message {
    display: flex;
    gap: 9px;
    padding: 8px 3px;
}

.neo-chat__avatar {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255,255,255,.08);
}

.neo-chat__avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.neo-chat__body {
    min-width: 0;
    max-width: calc(100% - 45px);
}

.neo-chat__meta {
    display: flex;
    align-items: baseline;
    gap: 7px;
    margin-bottom: 3px;
}

.neo-chat__meta a {
    color: inherit;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.neo-chat__meta time {
    opacity: .38;
    font-size: 9px;
}

.neo-chat__admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--neo-chat-accent, #ff2282);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .4px;
    line-height: 1.5;
}

.neo-chat__message--admin .neo-chat__avatar {
    box-shadow: 0 0 0 2px var(--neo-chat-accent, #ff2282);
}

.neo-chat__message--admin .neo-chat__meta a {
    color: var(--neo-chat-accent, #ff2282);
}

.neo-chat__message--admin .neo-chat__text {
    background: rgba(255, 34, 130, .08);
    border: 1px solid rgba(255, 34, 130, .25);
}

.neo-chat__text {
    display: inline-block;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 5px 12px 12px 12px;
    background: rgba(255,255,255,.06);
    color: inherit;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.neo-chat__status {
    margin-top: 3px;
    font-size: 9px;
    opacity: .5;
}

.neo-chat__status:empty {
    display: none;
}

.neo-chat__message--pending .neo-chat__text {
    opacity: .6;
}

.neo-chat__message--failed .neo-chat__text {
    background: rgba(255, 34, 130, .12);
    border: 1px solid rgba(255, 34, 130, .5);
}

.neo-chat__message--failed .neo-chat__status {
    color: var(--neo-chat-accent, #ff2282);
    opacity: 1;
}

.neo-chat__form {
    display: flex;
    gap: 8px;
    padding: 10px 12px 7px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.neo-chat__form input {
    min-width: 0;
    flex: 1;
    height: 42px;
    padding: 0 13px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 11px;
    outline: none;
    background: rgba(255,255,255,.045);
    color: inherit;
    font: inherit;
    font-size: 12px;
}

.neo-chat__form input:focus {
    border-color: rgba(255,255,255,.22);
}

.neo-chat__form button {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 11px;
    background: #fff;
    color: #111;
    cursor: pointer;
}

.neo-chat__form button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.neo-chat__hint {
    padding: 0 13px 11px;
    opacity: .35;
    font-size: 9px;
}

.neo-chat__login {
    margin: 0 12px 9px;
    padding: 10px 11px;
    border-radius: 10px;
    background: rgba(255,255,255,.055);
    font-size: 10px;
    line-height: 1.4;
}

.neo-chat__login a {
    display: inline-block;
    margin-top: 5px;
    color: inherit;
    font-weight: 700;
}

.neo-chat__empty,
.neo-chat__loading {
    padding: 70px 20px;
    text-align: center;
    opacity: .45;
    font-size: 12px;
    line-height: 1.6;
}

@media (max-width: 600px) {
    #neo-floating-chat {
        right: 0;
        /* Drop the transform here so the panel's position:fixed below
           anchors to the real viewport — a transformed ancestor would
           otherwise become its containing block and break that. */
        transform: none;
    }

    .neo-chat__tab {
        min-height: 108px;
        width: 40px;
    }

    .neo-chat__tab:hover {
        width: 40px;
    }

    .neo-chat__tab-title {
        font-size: 12px;
    }

    /* Sized from the *visual* viewport (kept in sync by JS via
       --neo-vv-top/--neo-vv-height) instead of vh/dvh, because many mobile
       browsers don't shrink dvh for the on-screen keyboard — that was
       cutting the input field off behind the keyboard and the site's own
       bottom tab bar. Falls back to dvh if JS/visualViewport isn't available. */
    .neo-chat__panel {
        position: fixed;
        left: 8px;
        right: max(8px, env(safe-area-inset-right));
        width: auto;
        max-width: none;
        top: calc(var(--neo-vv-top, 0px) + 8px);
        height: min(640px, calc(var(--neo-vv-height, 100dvh) - 16px));
        border-radius: 16px;
        transform: translateY(14px) scale(.98);
        transform-origin: bottom center;
    }

    .neo-chat.is-open .neo-chat__panel {
        transform: translateY(0) scale(1);
    }

    .neo-chat__header {
        min-height: 56px;
        padding: 12px 12px;
    }

    .neo-chat__messages {
        padding: 12px 10px 6px;
    }

    .neo-chat__form {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    }

    .neo-chat__hint {
        padding: 0 12px calc(8px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 340px) {
    .neo-chat__panel {
        left: 5px;
        right: max(5px, env(safe-area-inset-right));
    }
}

@media (prefers-reduced-motion: reduce) {
    .neo-chat__panel,
    .neo-chat__tab {
        transition: none;
    }
}
