/* Stream live chat — mobile-first RTL presentation */
.stream-view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin: 0.35rem 0.25rem 0.75rem;
    padding: 4px;
    border: 1px solid rgba(154, 169, 190, 0.18);
    border-radius: 18px;
    background: var(--surface-1, #eef1f6);
    box-shadow: 5px 5px 12px rgba(163, 177, 198, 0.28), -5px -5px 12px rgba(255, 255, 255, 0.86);
}

.stream-view-tabs__button {
    min-height: 48px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #273144;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.stream-view-tabs__button[aria-selected="true"] {
    color: #fff;
    background: linear-gradient(135deg, #df2063, #eb0f70);
    box-shadow: 0 7px 16px rgba(223, 32, 99, 0.24);
}

.stream-view-tabs__button:focus-visible {
    outline: 3px solid rgba(223, 32, 99, 0.24);
    outline-offset: 2px;
}

.stream-chat.card {
    overflow: hidden;
    border: 1px solid rgba(154, 169, 190, 0.16) !important;
    border-radius: 22px;
    background: #eef1f6;
    box-shadow: 7px 7px 18px rgba(155, 169, 189, 0.32), -7px -7px 18px rgba(255, 255, 255, 0.86) !important;
}

.stream-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 0.7rem 0.9rem;
    color: #fff;
    background: linear-gradient(135deg, #c72a7e, #e71068);
}

.stream-chat__title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.stream-chat__presence {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #67e09a;
    box-shadow: 0 0 0 4px rgba(103, 224, 154, 0.18);
}

.stream-chat__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 36px;
    gap: 0.3rem;
    padding-inline: 0.65rem;
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    text-decoration: none;
    font-size: 0.72rem;
}

.stream-chat__clear:hover,
.stream-chat__clear:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.24);
}

.stream-chat__pinned {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
    margin: 0.75rem 0.75rem 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(223, 32, 99, 0.11);
    border-radius: 16px;
    color: #2d3545;
    background: #fff7fa;
    box-shadow: 3px 3px 9px rgba(167, 177, 194, 0.2), -3px -3px 9px rgba(255, 255, 255, 0.84);
}

.stream-chat__pinned[hidden] {
    display: none;
}

.stream-chat__pin-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    background: #df2063;
    font-size: 1rem;
}

.stream-chat__pinned-copy {
    min-width: 0;
    line-height: 1.65;
}

.stream-chat__pinned-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.1rem;
    color: #697386;
    font-size: 0.72rem;
}

.stream-chat__pinned-meta strong {
    color: #273144;
    font-size: 0.76rem;
}

.stream-chat__pinned-text {
    display: block;
    overflow-wrap: anywhere;
    font-size: 0.84rem;
}

.stream-chat__body {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 420px;
    padding: 0 !important;
    background: linear-gradient(180deg, #eef1f6 0%, #f4f6fa 100%) !important;
}

.stream-chat__loading,
.stream-chat__empty {
    position: absolute;
    inset-inline: 1rem;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
    color: #7b8495;
    text-align: center;
    font-size: 0.86rem;
}

.stream-chat__empty[hidden],
.stream-chat__loading[hidden] {
    display: none;
}

#messages.stream-chat__messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 0;
    height: 430px;
    margin: 0 !important;
    padding: 0.85rem 0.75rem 1rem;
    overflow: hidden auto;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(223, 32, 99, 0.35) transparent;
}

#messages.stream-chat__messages > li {
    flex-shrink: 0;
    margin: 0 0 0.8rem;
}

.stream-chat__message {
    display: flex;
    flex-direction: row;
    gap: 0.55rem;
    align-items: end;
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    justify-content: flex-start;
    direction: rtl;
}

.stream-chat__message--mine {
    align-self: stretch;
}

.stream-chat__avatar-link {
    flex: 0 0 42px;
    align-self: end;
}

.stream-chat__message--mine .stream-chat__avatar-link {
    order: 0;
}

.stream-chat__avatar {
    display: block;
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.78);
    border-radius: 50%;
    object-fit: cover;
    background: #dce2ec;
    box-shadow: 3px 4px 9px rgba(157, 170, 189, 0.32);
}

.stream-chat__message-content {
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 50px);
    text-align: right;
}

.stream-chat__message--mine .stream-chat__message-content {
    text-align: right;
}

.stream-chat__message-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0.35rem 0.25rem;
    color: #737d8f;
    font-size: 0.7rem;
    line-height: 1.25;
}

.stream-chat__message--mine .stream-chat__message-meta {
    justify-content: flex-start;
}

.stream-chat__author {
    max-width: 12rem;
    overflow: hidden;
    color: #283143;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-chat__bubble {
    display: inline-block;
    max-width: 100%;
    padding: 0.62rem 0.78rem;
    border: 1px solid rgba(154, 169, 190, 0.13);
    border-radius: 16px 16px 5px 16px;
    color: #2e3748;
    background: #fff;
    box-shadow: 4px 5px 12px rgba(160, 172, 191, 0.24), -3px -3px 9px rgba(255, 255, 255, 0.8);
    font-size: 0.87rem;
    line-height: 1.75;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.stream-chat__message--mine .stream-chat__bubble {
    border-color: rgba(223, 32, 99, 0.09);
    border-radius: 16px 16px 16px 5px;
    color: #761339;
    background: #ffe9f1;
}

.stream-chat__message--host .stream-chat__bubble {
    border-color: rgba(223, 32, 99, 0.16);
}

.stream-chat__new-messages {
    position: absolute;
    inset-inline-start: 50%;
    bottom: 76px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 38px;
    padding: 0.45rem 0.9rem;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #df2063;
    box-shadow: 0 7px 18px rgba(223, 32, 99, 0.28);
    font: inherit;
    font-size: 0.8rem;
    transform: translateX(50%);
}

.stream-chat__new-messages[hidden] {
    display: none;
}

.stream-chat__login {
    margin: 0 0.75rem 0.75rem;
    border-radius: 14px;
    color: #fff !important;
    background: #df2063;
}

.stream-chat__composer {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 0.55rem;
    align-items: end;
    margin: 0 0.65rem 0.65rem;
    padding: 0.42rem;
    border: 1px solid rgba(154, 169, 190, 0.16);
    border-radius: 20px;
    background: rgba(248, 250, 253, 0.97);
    box-shadow: 5px 6px 14px rgba(157, 171, 191, 0.28), -4px -4px 12px rgba(255, 255, 255, 0.9);
}

.stream-chat__input {
    width: 100%;
    min-height: 42px;
    max-height: 104px;
    padding: 0.55rem 0.7rem;
    resize: none;
    overflow-y: auto;
    border: 0;
    outline: 0;
    color: #253044;
    background: transparent;
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.55;
}

.stream-chat__input::placeholder {
    color: #9aa3b3;
}

.stream-chat__send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #df2063, #ef0c70);
    box-shadow: 0 6px 13px rgba(223, 32, 99, 0.26);
    font-size: 1.05rem;
}

.stream-chat__send:disabled {
    color: #aeb6c3;
    background: #e5e9f0;
    box-shadow: none;
    cursor: not-allowed;
}

.stream-chat__composer-status {
    grid-column: 1 / -1;
    min-height: 0;
    padding-inline: 0.65rem;
    color: #b3264f;
    font-size: 0.72rem;
}

.stream-chat__composer-status:empty {
    display: none;
}

.stream-view-panel[hidden] {
    display: none !important;
}

@media (max-width: 767.98px) {
    .vo2-stream-page__chat-panel {
        padding-inline: 0.25rem !important;
        padding-bottom: 96px !important;
        margin-top: 0 !important;
    }

    .stream-chat.card {
        border: 0 !important;
        border-radius: 0;
        background: transparent;
        box-shadow: none !important;
    }

    .stream-chat__header {
        display: none;
    }

    .stream-chat__body {
        height: clamp(150px, 19dvh, 200px);
        min-height: 150px;
        overflow: hidden;
    }

    #messages.stream-chat__messages {
        flex: 1 1 0;
        height: auto !important;
        min-height: 0;
        padding-bottom: 0.75rem;
        scroll-padding-bottom: 0.75rem;
    }

    .stream-chat__composer {
        position: fixed;
        inset-inline: 18px;
        bottom: 82px;
        z-index: 1025;
        width: auto;
        max-width: 720px;
        margin: 0 auto;
    }

    .stream-chat__new-messages {
        position: fixed;
        bottom: 154px;
        z-index: 1026;
    }
}

@media (min-width: 768px) {
    .stream-view-tabs-wrap {
        display: none !important;
    }

    .stream-chat.card {
        height: 100%;
        min-height: 440px;
    }

    .stream-chat__body {
        height: calc(100% - 54px);
        min-height: 380px;
    }

    #messages.stream-chat__messages {
        height: 100%;
        max-height: 560px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stream-view-tabs__button,
    #messages.stream-chat__messages {
        transition: none;
        scroll-behavior: auto;
    }
}
