#chatViewBtn {
    position: relative;
    min-width: 0;
    white-space: nowrap;
}

#chatUnreadBadge {
    position: absolute;
    top: -5px;
    right: -3px;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    border-radius: 12px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    line-height: 19px;
    text-align: center;
    box-sizing: border-box;
}

#chatUnreadBadge[hidden] {
    display: none !important;
}

#chatOverlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,.48);
    backdrop-filter: blur(4px);
}

#chatOverlay[hidden] {
    display: none !important;
}

#chatWindow {
    display: flex;
    width: min(1180px,96vw);
    height: min(900px,92dvh);
    overflow: hidden;
    border-radius: 18px;
    background: white;
    color: #1e293b;
    box-shadow: 0 24px 80px rgba(0,0,0,.24);
    animation: chatAppear .22s ease-out;
}

@keyframes chatAppear {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#chatSidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    overflow: hidden;
}

#chatMain {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #e7eef4;
}

#chatMessages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px;
    background-image: radial-gradient(
        #cbd5e1 0.7px, transparent 0.7px
    );
    background-size: 22px 22px;
}

#chatOverlay button {
    cursor: pointer;
}

@media (max-width: 600px) {
    #requestNavigation {
        gap: 4px !important;
    }

    #requestNavigation > button {
        font-size: 12px !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    #chatWindow {
        width: 100%;
        height: 100dvh;
        border-radius: 0;
    }

    #chatSidebar {
        width: 100%;
    }

    #chatMain {
        display: none;
    }

    #chatWindow.room-open #chatSidebar {
        display: none;
    }

    #chatWindow.room-open #chatMain {
        display: flex;
    }

    #chatMessages {
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #chatWindow {
        animation: none;
    }
}

#chatWindow *,
#chatWindow *::before,
#chatWindow *::after {
    box-sizing: border-box;
}

#chatWindow [hidden] {
    display: none !important;
}

#chatWindow button {
    width: auto;
    margin: 0;
    border: 0;
    padding: 8px 12px;
    background: transparent;
    color: #64748b;
    border-radius: 9px;
    box-shadow: none;
    font-size: 18px;
}

#chatWindow button:hover {
    background: #e2e8f0;
}

.chat-sidebar-header,
#chatHeader {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.chat-sidebar-header strong,
#chatHeaderInfo {
    flex: 1;
    min-width: 0;
}

#chatHeaderInfo strong,
#chatHeaderInfo small {
    display: block;
}

#chatHeaderInfo small {
    color: #64748b;
    font-size: 12px;
    margin-top: 3px;
}

.chat-search-wrap {
    padding: 10px;
}

#chatWindow input:not([type=file]),
#chatWindow textarea {
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: #1e293b;
    font: inherit;
    outline: none;
}

#chatRooms,
#chatContacts {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#chatWindow .chat-room {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 12px;
    text-align: left;
    border-radius: 0;
    color: #1e293b;
}

#chatWindow .chat-room.active {
    background: #dbeafe;
}

.chat-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: #2563eb;
    color: white;
    font-weight: 600;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-room-info {
    flex: 1;
    min-width: 0;
}

.chat-room-info strong,
.chat-room-info small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-room-info strong {
    font-size: 14px;
}

.chat-room-info small {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.chat-room-unread {
    background: #2563eb;
    color: white;
    border-radius: 20px;
    padding: 3px 7px;
    font-size: 11px;
}

.chat-message-row {
    display: flex;
    justify-content: flex-start;
    margin: 7px 0;
    gap: 7px;
}

.chat-message-row.mine {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 78%;
    min-width: 90px;
    padding: 9px 12px;
    background: white;
    border-radius: 5px 15px 15px 15px;
    box-shadow: 0 1px 2px #0000000c;
    overflow-wrap: anywhere;
}

.mine .chat-bubble {
    background: #dcf8c6;
    border-radius: 15px 5px 15px 15px;
}

.chat-sender {
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-body {
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.chat-meta {
    margin-top: 4px;
    text-align: right;
    font-size: 10px;
    color: #64748b;
}

.chat-date {
    width: fit-content;
    margin: 14px auto;
    padding: 4px 12px;
    border-radius: 20px;
    background: #cbd5e1;
    color: #475569;
    font-size: 11px;
}

.chat-attachment {
    display: block;
    margin: 5px 0;
    padding: 9px;
    border-radius: 8px;
    background: #00000008;
    color: #2563eb;
    font-size: 13px;
    text-decoration: none;
}

#chatComposer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px;
    background: white;
}

#chatInput {
    resize: none;
    min-height: 42px;
    max-height: 140px;
}

#chatWindow #chatSendBtn {
    background: #2563eb;
    color: white;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

#chatSearchPanel,
#chatReplyPanel,
#chatFilePanel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

#chatReplyText,
#chatFileName {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

#chatConnectionStatus,
#chatStatus {
    font-size: 11px;
    color: #64748b;
    background: white;
    text-align: center;
    padding: 5px;
}

#chatStatus:empty {
    display: none;
}

#chatWindow #chatBackBtn {
    display: none;
}

@media (max-width: 600px) {
    #chatWindow #chatBackBtn {
        display: block;
        font-size: 28px;
    }

    .chat-bubble {
        max-width: 88%;
    }

    #chatComposer {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    #chatWindow textarea,
    #chatWindow input:not([type=file]) {
        font-size: 16px;
    }
}


.chat-message-row > .chat-avatar {
    width: 30px;
    height: 30px;
    font-size: 11px;
    align-self: flex-end;
}

.chat-bubble {
    position: relative;
}

.chat-check {
    margin-left: 4px;
    font-size: 13px;
    letter-spacing: -3px;
    padding-right: 3px;
}

.chat-check.read {
    color: #168bd2;
}

.chat-deleted {
    color: #94a3b8;
    font-style: italic;
    font-size: 13px;
}

.chat-quoted {
    border-left: 3px solid #2563eb;
    background: #2563eb0b;
    border-radius: 4px;
    padding: 6px 9px;
    margin-bottom: 6px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.chat-empty {
    text-align: center;
    color: #64748b;
    padding: 40px 15px;
    font-size: 14px;
}

.chat-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

#chatWindow .chat-reaction {
    font-size: 12px;
    padding: 3px 7px;
    border-radius: 14px;
    background: #eff6ff;
}

#chatWindow .chat-reaction.active {
    background: #bfdbfe;
}

#chatWindow .chat-message-actions {
    display: block;
    margin-left: auto;
    font-size: 16px;
    padding: 0 5px;
    line-height: 16px;
    opacity: .65;
}

.chat-attachment small {
    display: block;
    margin-top: 4px;
    color: #64748b;
}


#chatMessageMenu {
    position: fixed;
    z-index: 20002;
    width: 240px;
    max-width: calc(100vw - 16px);
    padding: 6px;
    border-radius: 14px;
    background: white;
    color: #334155;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
}

#chatMessageMenu > button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 11px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    text-align: left;
    font-size: 14px;
}

#chatMessageMenu > button:hover {
    background: #f1f5f9;
}

.chat-context-reactions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 4px;
    border-bottom: 1px solid #e2e8f0;
}

#chatMessageMenu .chat-context-reactions button {
    width: 20%;
    margin: 0;
    padding: 6px 0;
    border: 0;
    background: transparent;
    font-size: 20px;
}

#chatWindow button:disabled {
    opacity: .5;
    cursor: wait;
}


#chatViewBtn {
    background: #7c3aed !important;
    color: #ffffff !important;
    transition: background .2s, transform .15s;
}

#chatViewBtn:hover {
    background: #6d28d9 !important;
}

#chatViewBtn:active {
    transform: scale(.97);
}

#chatUnreadBadge {
    background: #ef4444;
    color: white;
    border-radius: 12px;
    padding: 2px 6px;
}


/* Independent messenger layout */

#chatOverlay #chatWindow {
    display: flex !important;
    flex-direction: row !important;
    gap: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

#chatOverlay #chatWindow #chatMain {
    flex: 1 1 0% !important;
    display: flex !important;
    flex-direction: column !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    position: relative !important;
    overflow: hidden !important;
}

#chatOverlay #chatSidebar {
    flex: 0 0 280px !important;
    width: 280px !important;
    margin: 0 !important;
}

#chatOverlay #chatHeader,
#chatOverlay #chatComposer {
    width: 100% !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

#chatOverlay #chatMessages {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 18px 24px !important;
}

@media (max-width: 600px) {
    #chatOverlay #chatWindow #chatSidebar {
        flex: 1 1 100% !important;
        width: 100% !important;
    }

    #chatOverlay #chatWindow #chatMain {
        display: none !important;
    }

    #chatOverlay #chatWindow.room-open #chatSidebar {
        display: none !important;
    }

    #chatOverlay #chatWindow.room-open #chatMain {
        display: flex !important;
        flex: 1 1 100% !important;
    }

    #chatOverlay #chatMessages {
        padding: 12px !important;
    }
}


/* Responsive emoji panel */

#chatWindow {
    position: relative;
}

#chatWindow #chatEmojiBtn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 24px;
    border-radius: 50%;
}

#chatWindow #chatEmojiBtn.active {
    background: #ede9fe;
}

#chatWindow #chatInput {
    min-width: 0;
    flex: 1 1 0%;
}

#chatEmojiPanel {
    display: flex;
    flex: 0 0 300px;
    flex-direction: column;
    width: 300px;
    min-width: 0;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    overflow: hidden;
}

#chatEmojiPanel[hidden] {
    display: none !important;
}

.chat-emoji-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-bottom: 1px solid #e2e8f0;
}

#chatWindow .chat-emoji-close {
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 24px;
}

#chatEmojiSearch {
    box-sizing: border-box;
    width: calc(100% - 20px);
    margin: 10px;
    padding: 12px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    font-size: 16px;
}

#chatEmojiCategories {
    display: flex;
    overflow-x: auto;
    flex-shrink: 0;
    gap: 4px;
    padding: 6px;
}

#chatWindow .chat-emoji-category {
    flex: 0 0 40px;
    height: 40px;
    padding: 0;
    font-size: 21px;
    border-radius: 10px;
}

#chatWindow .chat-emoji-category.active {
    background: #ede9fe;
}

#chatEmojiGrid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-content: start;
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 0%;
    min-height: 0;
}

#chatWindow .chat-emoji-item {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0;
    font-size: 25px;
    border-radius: 9px;
}

#chatWindow .chat-emoji-item:hover {
    background: #f1f5f9;
}

#chatWindow .chat-emoji-item:active {
    transform: scale(.88);
}

#chatWindow #chatMessages::before {
    content: "";
    flex: 1 0 0px;
}

#chatWindow #chatMessages {
    display: flex;
    flex-direction: column;
}

#chatWindow #chatMessages > * {
    flex-shrink: 0;
}

@media (max-width: 900px) {
    #chatEmojiPanel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: min(320px, 42dvh);
        border-left: 0;
        border-top: 1px solid #e2e8f0;
        z-index: 20;
        padding-bottom: env(safe-area-inset-bottom);
    }

    #chatWindow.emoji-open #chatMain {
        height: calc(100% - min(320px, 42dvh)) !important;
    }

    #chatEmojiGrid {
        grid-template-columns:
            repeat(auto-fit, minmax(44px, 1fr));
    }

    #chatWindow .chat-emoji-item {
        height: 46px;
        font-size: 27px;
    }

    #chatWindow #chatInput {
        font-size: 16px;
    }

    .chat-emoji-header {
        padding: 4px 12px;
    }

    #chatEmojiSearch {
        margin: 4px 10px;
        padding: 8px 12px;
    }
}



/* STICKERS_V1 */

#chatEmojiPanel [hidden] {
    display: none !important;
}

.chat-sticker-tabs {
    display: flex;
    gap: 6px;
    padding: 6px;
    flex-shrink: 0;
}

.chat-sticker-tabs button {
    flex: 1;
    padding: 9px 5px;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.chat-sticker-tabs button.active {
    background: #7c3aed;
    color: white;
}

.chat-sticker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    overflow-y: auto;
    min-height: 0;
    flex: 1;
    align-content: start;
}

.chat-sticker-item {
    width: 100%;
    padding: 4px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: transform .15s, background .15s;
}

.chat-sticker-item:hover {
    background: rgba(124, 58, 237, .08);
}

.chat-sticker-item:active {
    transform: scale(.90);
}

.chat-sticker-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    pointer-events: none;
}

#chatWindow .chat-sticker-bubble {
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
}

.chat-sticker-image {
    display: block;
    width: 160px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
}

@media (max-width: 900px) {
    .chat-sticker-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .chat-sticker-image {
        width: 145px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-sticker-item {
        transition: none;
    }
}


/* CHAT_SETTINGS_V1 */

#chatSettingsPanel[hidden] {
    display: none !important;
}

#chatSettingsBtn {
    font-size: 22px;
    transition: transform .2s ease;
}

#chatSettingsBtn:active {
    transform: rotate(30deg);
}

#chatSettingsPanel {
    flex-shrink: 0;
    padding: 14px 18px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
}

.chat-settings-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

#chatSettingsClose {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 22px;
    cursor: pointer;
}

.chat-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.chat-setting-row span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-setting-row strong {
    font-size: 14px;
}

.chat-setting-row small {
    color: #64748b;
    font-size: 12px;
}

.chat-setting-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 26px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: #94a3b8;
    cursor: pointer;
    transition: background .2s ease;
}

.chat-setting-row input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform .2s ease;
}

.chat-setting-row input:checked {
    background: #7c3aed;
}

.chat-setting-row input:checked::before {
    transform: translateX(18px);
}

.chat-setting-row input:disabled {
    opacity: .5;
    cursor: wait;
}

#chatSettingsStatus {
    font-size: 12px;
    color: #64748b;
    padding-top: 8px;
}

@media (prefers-reduced-motion: reduce) {
    #chatSettingsBtn,
    .chat-setting-row input,
    .chat-setting-row input::before {
        transition: none;
    }
}

/* CHAT_V21_THEME */
html[data-theme="dark"] #chatOverlay {background:rgba(8,15,23,.72)}
html[data-theme="dark"] :is(#chatWindow,#chatMessageMenu) {color:#e4edf5;background:#242f3d;color-scheme:dark}
html[data-theme="dark"] :is(#chatSidebar,#chatHeader,.chat-sidebar-header,#chatComposer,#chatEmojiPanel,#chatSettingsPanel,#chatConnectionStatus,#chatStatus) {background:#242f3d;color:#e4edf5;border-color:#394b5e}
html[data-theme="dark"] #chatMain {background:#17212b}
html[data-theme="dark"] #chatMessages {background-color:#17212b;background-image:radial-gradient(#344555 .7px,transparent .7px)}
html[data-theme="dark"] #chatWindow :is(button,.chat-room) {color:#c6d6e5}
html[data-theme="dark"] #chatWindow button:hover,html[data-theme="dark"] #chatMessageMenu > button:hover {background:#34475b}
html[data-theme="dark"] #chatWindow .chat-room.active {background:#365675;color:#fff}
html[data-theme="dark"] #chatWindow :is(input:not([type=file]):not([type=checkbox]),textarea) {background:#17212b;color:#e4edf5}
html[data-theme="dark"] #chatWindow :is(input,textarea)::placeholder {color:#9aafc3}
html[data-theme="dark"] #chatWindow .chat-bubble {background:#293949;color:#e4edf5}
html[data-theme="dark"] #chatWindow .mine .chat-bubble {background:#294d70;color:#f1f7ff}
html[data-theme="dark"] #chatWindow :is(.chat-sender,.chat-attachment,.chat-check.read) {color:#92caff}
html[data-theme="dark"] #chatWindow :is(.chat-meta,.chat-room-info small,#chatHeaderInfo small,.chat-attachment small,.chat-empty,.chat-deleted,.chat-setting-row small,#chatSettingsStatus) {color:#aabed0}
html[data-theme="dark"] #chatWindow :is(.chat-date,.chat-quoted,.chat-attachment,.chat-reaction) {background:#34475b;color:#d9e7f4}
html[data-theme="dark"] #chatWindow .chat-reaction.active {background:#416b91;color:#fff}
html[data-theme="dark"] :is(#chatSearchPanel,#chatReplyPanel,#chatFilePanel) {background:#293949;color:#e4edf5;border-color:#394b5e}
html[data-theme="dark"] #chatMessageMenu > button {color:#e4edf5}
html[data-theme="dark"] :is(.chat-context-reactions,.chat-emoji-header,.chat-setting-row) {border-color:#394b5e}
html[data-theme="dark"] #chatWindow :is(#chatEmojiBtn.active,.chat-emoji-category.active,.chat-sticker-tabs button) {background:#34475b;color:#e4edf5}
html[data-theme="dark"] #chatWindow :is(#chatSendBtn,.chat-sticker-tabs button.active) {background:#5288c1;color:#fff}
html[data-theme="dark"] #chatWindow .chat-setting-row input:checked {background:#5288c1}
html[data-theme="dark"] #chatWindow .chat-setting-row input:not(:checked) {background:#64748b}
html[data-theme="dark"] #chatWindow #chatSettingsClose {background:#34475b;color:#e4edf5}
#chatWindow button:focus-visible,#chatMessageMenu button:focus-visible,#chatWindow :is(input,textarea):focus-visible {outline:2px solid #5288c1;outline-offset:2px}

/* V21 readability */
#chatWindow .chat-bubble {font-size:17px;line-height:1.45;overflow-wrap:anywhere}
#chatWindow .chat-meta {font-size:12px;line-height:1.3}
#chatWindow .chat-sender,#chatWindow .chat-room-info strong {font-size:15px}
#chatWindow .chat-room-info small {font-size:13px}
#chatWindow #chatComposer textarea {font-size:16px;line-height:1.45}
#chatWindow .chat-emoji-item {font-size:32px;min-height:40px}
#chatWindow .chat-reaction {font-size:16px}
#chatMessageMenu .chat-context-reactions button {font-size:26px}
/* V22 chat sizes */
#chatWindow .chat-body {font-size:17px!important;line-height:1.45}
#chatWindow .chat-body .v22-emoji {font-size:23px;line-height:1.2}
#chatWindow .chat-body.v22-emoji-only .v22-emoji {font-size:48px}
#chatWindow .chat-emoji-item {font-size:34px!important;min-height:48px}
#chatWindow .chat-sticker-image {width:200px!important;max-width:100%;height:auto}
#chatWindow .chat-sticker-item {padding:0!important;min-width:0}
#chatWindow .chat-sticker-item img {width:100%;max-width:140px;margin:auto}
@media(min-width:901px){#chatWindow #chatEmojiPanel{width:330px;flex-basis:330px}#chatWindow #chatEmojiGrid{grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(max-width:900px){#chatWindow .chat-sticker-image{width:180px!important}}

/* V23 message layout */
#chatWindow .chat-bubble {box-sizing:border-box;min-width:100px;padding:12px 14px!important;}
#chatWindow .chat-body {text-align:left;overflow-wrap:anywhere;}
#chatWindow .chat-body.v22-emoji-only {text-align:center;line-height:1.2;padding:4px 0;}
#chatWindow .chat-body.v22-emoji-only .v22-emoji {display:inline-block;margin:0 3px;}
#chatWindow .chat-sticker-image {display:block;margin:0 auto;}
#chatWindow .v23-message-footer {display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-top:5px;min-height:20px;}
#chatWindow .v23-message-footer .chat-meta {margin:0!important;white-space:nowrap;line-height:1.3;}
#chatWindow .v23-actions {display:flex!important;align-items:center;justify-content:flex-end;margin:0!important;padding:0!important;position:static!important;}
#chatWindow .v23-actions button {margin:0!important;min-height:24px;padding:0 5px!important;line-height:1;}
#chatWindow .chat-sticker-bubble {padding:4px 8px!important;}

/* V24_MOBILE_PANEL */
@media (max-width:900px) {
 #chatOverlay #chatWindow.emoji-open #chatMain {height:100%!important;min-height:0!important;}
 #chatOverlay #chatMain #chatEmojiPanel:not([hidden]) {
 position:relative!important;inset:auto!important;width:100%!important;
 height:min(42dvh,360px)!important;flex:0 0 min(42dvh,360px)!important;
 min-height:0!important;max-height:48%;box-sizing:border-box;
 overflow:hidden;z-index:auto;display:flex;flex-direction:column;
 padding-bottom:env(safe-area-inset-bottom,0px);
 animation:v24PanelIn .16s ease-out;
 }
 #chatOverlay #chatMain #chatComposer {flex:0 0 auto!important;box-sizing:border-box;}
 #chatOverlay #chatEmojiCategories {display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;flex-shrink:0;}
 #chatOverlay #chatEmojiCategories button {min-width:0;padding:4px 0;}
 #chatOverlay #chatEmojiGrid {grid-template-columns:repeat(7,minmax(0,1fr));min-height:0;overflow-y:auto;gap:2px;}
 #chatOverlay #chatEmojiGrid .chat-emoji-item {min-width:0;padding:0!important;font-size:30px!important;}
 #chatOverlay .chat-sticker-grid {min-height:0;overflow-y:auto;}
}
@keyframes v24PanelIn {from {opacity:0;transform:translateY(8px)} to {opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){#chatEmojiPanel{animation:none!important}}
