/* Writer's Lounge — channel sidebar + beta-style text chat */

* { box-sizing: border-box; }

:root {
    --bg: #0b1220;
    --panel: #111827;
    --panel-2: #172132;
    --text: #f9fafb;
    --muted: #9ca3af;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
    --nav-offset: var(--alysum-nav-sticky-offset, 45px);
}

body.light {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --panel-2: #f7f9fc;
    --text: #171717;
    --muted: #5f6470;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
}

.hidden { display: none !important; }

body {
    margin: 0;
    background:
        radial-gradient(ellipse 120% 60% at 50% -10%, var(--theme-body-spot, rgba(124, 58, 237, 0.2)) 0%, transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Full viewport — no page scroll; lists scroll internally */
body.lounge-viewport {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body.lounge-viewport > .wd-welcome-bar {
    flex-shrink: 0;
}

body.lounge-viewport > .wd-nav-wrap {
    flex-shrink: 0;
}

body.lounge-viewport > .lounge-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lounge-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 12px 10px;
}

body.lounge-viewport #mainLayout {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lounge-layout {
    display: grid;
    grid-template-columns: min(260px, 26vw) minmax(0, 1fr) min(200px, 18vw);
    gap: 10px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

@media (max-width: 1080px) {
    .lounge-layout {
        grid-template-columns: min(220px, 32vw) minmax(0, 1fr);
    }
    .lounge-members { display: none; }
}

@media (max-width: 720px) {
    .lounge-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }
    .lounge-channels {
        max-height: min(34vh, 220px);
        height: auto;
    }
    .lounge-channels.is-collapsed { display: none; }
    .lounge-mobile-channel-btn { display: inline-flex !important; }
    .text-panel {
        min-height: 0;
    }
}

.lounge-mobile-channel-btn {
    display: none;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.lounge-channels,
.lounge-members,
.text-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.lounge-sidebar-head {
    flex-shrink: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}

.lounge-sidebar-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 900;
}

.lounge-sidebar-head p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.lounge-channel-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.lounge-category-label {
    padding: 10px 10px 4px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.lounge-channel-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.lounge-channel-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.light .lounge-channel-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.lounge-channel-btn.is-active {
    background: var(--theme-accent-soft-bg, rgba(124, 58, 237, 0.16));
    border-color: var(--accent-muted, rgba(124, 58, 237, 0.22));
}

.lounge-channel-hash {
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 900;
    color: var(--muted);
}

.lounge-channel-btn.is-active .lounge-channel-hash {
    color: var(--theme-brand-kicker, #c4b5fd);
}

.lounge-channel-main { min-width: 0; flex: 1; }

.lounge-channel-name {
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lounge-channel-preview {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lounge-channel-lock {
    flex-shrink: 0;
    font-size: 12px;
    opacity: 0.7;
}

.lounge-channel-badge {
    flex-shrink: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ff3b30;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--panel, #111);
}

.ping-toast-stack {
    position: fixed;
    top: calc(var(--workspace-nav-height, 56px) + 12px);
    right: 12px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, calc(100vw - 24px));
    pointer-events: none;
}

.ping-toast {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--panel) 94%, #000);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    animation: ping-toast-in 0.22s ease;
}

.ping-toast.is-leaving {
    animation: ping-toast-out 0.2s ease forwards;
}

.ping-toast-kicker {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #ff3b30;
}

.ping-toast-title {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
}

.ping-toast-body {
    font-size: 13px;
    line-height: 1.35;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ping-toast:hover {
    border-color: rgba(10, 132, 255, 0.45);
    background: color-mix(in srgb, var(--panel) 88%, #0a84ff 12%);
}

@keyframes ping-toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes ping-toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
}

@media (max-width: 720px) {
    .ping-toast-stack {
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

.ping-toast.is-reply .ping-toast-kicker {
    color: #0a84ff;
}

body.light .ping-toast.is-reply .ping-toast-kicker {
    color: #007aff;
}

.text-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.text-panel-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}

.text-panel-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, var(--theme-header-mid, #6d28d9), var(--theme-header-end, #db2777));
}

.text-panel-title-wrap { min-width: 0; flex: 1; }

.text-panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-panel-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    line-height: 1.4;
}

.text-chat-msgs {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 14px 14px;
    display: flex;
    flex-direction: column;
    background: #000;
}

.text-chat-msgs-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
}

.text-chat-msgs-inner--empty {
    margin-top: auto;
    margin-bottom: auto;
}

body.light .text-chat-msgs {
    background: #fff;
}

/* iMessage-style group chat */
.sms-row {
    display: flex;
    width: 100%;
    padding: 0 2px;
}

.sms-row.is-group-start {
    margin-top: 8px;
}

.sms-row.is-group-start:first-child,
.load-older-btn + .sms-row.is-group-start {
    margin-top: 2px;
}

.sms-row.is-compact {
    margin-top: 1px;
}

.sms-row.sent {
    justify-content: flex-end;
}

.sms-sent-body {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    width: fit-content;
    max-width: min(72%, 460px);
}

.sms-row.sent .sms-sender-name {
    padding: 0 12px 2px;
    text-align: right;
    max-width: 100%;
    line-height: 1;
}

.sms-row.recv {
    justify-content: flex-start;
    align-items: flex-end;
    gap: 6px;
    padding-left: 10px;
}

.sms-row.recv.is-group-start {
    align-items: flex-start;
}

.sms-row.recv.is-compact {
    align-items: flex-end;
}

.sms-avatar-col {
    width: 32px;
    flex-shrink: 0;
    align-self: flex-end;
    overflow: visible;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.sms-avatar-col.is-empty {
    visibility: hidden;
}

.sms-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #636366, #48484a);
    overflow: hidden;
}

.sms-avatar.pfp-frame.has-deco {
    overflow: visible;
}

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

.sms-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: min(72%, 460px);
    min-width: 0;
}

.sms-day-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 14px 0 8px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #8e8e93;
    text-transform: none;
}

.sms-day-sep::before,
.sms-day-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(142, 142, 147, 0.28);
}

.sms-day-sep span {
    flex-shrink: 0;
}

body.light .sms-day-sep {
    color: #6c6c70;
}

body.light .sms-day-sep::before,
body.light .sms-day-sep::after {
    background: rgba(60, 60, 67, 0.18);
}

.load-older-btn + .sms-day-sep {
    margin-top: 10px;
}

.sms-time {
    display: block;
    padding: 1px 12px 0;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    color: #8e8e93;
    white-space: nowrap;
}

.sms-row.sent .sms-time {
    text-align: right;
}

.sms-row.recv .sms-time {
    text-align: left;
}

body.light .sms-time {
    color: #6c6c70;
}

.sms-sender-name {
    padding: 0 12px 2px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #8e8e93;
}

body.light .sms-sender-name {
    color: #6c6c70;
}

.sms-message-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 100%;
    flex-shrink: 0;
}

.sms-row.sent .sms-message-stack {
    align-items: flex-end;
}

.sms-row.recv .sms-message-stack {
    align-items: flex-start;
}

.sms-bubble-wrap {
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    max-width: 100%;
    flex-shrink: 0;
}

.sms-row.sent .sms-bubble-wrap {
    flex-direction: row-reverse;
}

.sms-bubble {
    padding: 7px 12px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.34;
    white-space: pre-wrap;
    word-break: break-word;
    flex-shrink: 0;
    width: auto;
    max-width: 100%;
}

.sms-row.recv .sms-bubble {
    background: #3a3a3c;
    color: #fff;
}

.sms-row.recv.is-group-end .sms-bubble {
    border-bottom-left-radius: 6px;
}

.sms-row.recv:not(.is-group-end) .sms-bubble {
    border-bottom-left-radius: 18px;
}

body.light .sms-row.recv .sms-bubble {
    background: #e9e9eb;
    color: #000;
}

.sms-row.sent .sms-bubble {
    background: #0a84ff;
    color: #fff;
}

.sms-row.sent.is-group-end .sms-bubble {
    border-bottom-right-radius: 6px;
}

.sms-row.sent:not(.is-group-end) .sms-bubble {
    border-bottom-right-radius: 18px;
}

body.light .sms-row.sent .sms-bubble {
    background: #007aff;
}

.sms-reactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
    padding: 0;
    min-height: 0;
}

.sms-row.sent .sms-reactions {
    justify-content: flex-end;
}

.sms-reaction-pill,
.sms-reaction-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 24px;
    padding: 0 6px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: rgba(127, 127, 127, 0.16);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    line-height: 1;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.sms-reaction-pill:hover,
.sms-reaction-add:hover {
    background: rgba(127, 127, 127, 0.24);
}

.sms-reaction-pill.is-mine {
    background: rgba(10, 132, 255, 0.16);
    border-color: rgba(10, 132, 255, 0.28);
}

.sms-reaction-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    min-width: 0.5ch;
    font-variant-numeric: tabular-nums;
}

.sms-reaction-pill.is-mine .sms-reaction-count {
    color: #7ec3ff;
}

.sms-reaction-pill.is-bump {
    animation: lounge-reaction-bump 0.34s ease;
}

.sms-reaction-pill.is-bump .lounge-reaction-emoji,
.sms-reaction-pill.is-bump .lounge-reaction-icon {
    animation: lounge-reaction-shake 0.34s ease;
}

@keyframes lounge-reaction-bump {
    0% { transform: scale(0.92); }
    45% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

@keyframes lounge-reaction-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-7deg); }
    75% { transform: rotate(7deg); }
}

@media (prefers-reduced-motion: reduce) {
    .sms-reaction-pill.is-bump,
    .sms-reaction-pill.is-bump .lounge-reaction-emoji,
    .sms-reaction-pill.is-bump .lounge-reaction-icon {
        animation: none;
    }
}

.sms-reaction-add {
    width: 24px;
    min-width: 24px;
    height: 24px;
    padding: 0;
    color: var(--muted);
    opacity: 0;
    pointer-events: none;
    background: transparent;
}

.sms-row:hover .sms-reaction-add,
.sms-row:focus-within .sms-reaction-add {
    opacity: 1;
    pointer-events: auto;
}

.sms-reaction-add:hover {
    background: rgba(127, 127, 127, 0.16);
}

.sms-reaction-add svg {
    display: block;
}

.lounge-reaction-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 1;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.lounge-reaction-emoji--custom {
    width: 18px;
    height: 18px;
}

.lounge-reaction-icon {
    display: block;
    width: 100%;
    height: 100%;
}

.lounge-reaction-icon--sparkles {
    overflow: visible;
}

.emoji-picker-cell .lounge-reaction-emoji,
.emoji-picker-cell .lounge-reaction-emoji--custom {
    width: 22px;
    height: 22px;
    font-size: 22px;
}

body.light .sms-reaction-pill {
    background: rgba(15, 23, 42, 0.06);
}

body.light .sms-reaction-pill:hover {
    background: rgba(15, 23, 42, 0.1);
}

body.light .sms-reaction-pill.is-mine {
    background: rgba(0, 122, 255, 0.12);
    border-color: rgba(0, 122, 255, 0.22);
}

body.light .sms-reaction-pill.is-mine .sms-reaction-count {
    color: #007aff;
}

.sms-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 2px 10px 0;
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.sms-row:hover .sms-actions,
.sms-row:focus-within .sms-actions,
.sms-row.is-editing .sms-actions {
    opacity: 1;
    pointer-events: auto;
}

.sms-action-link {
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    color: #8e8e93;
    cursor: pointer;
}

.sms-action-link:hover {
    color: #0a84ff;
}

body.light .sms-action-link {
    color: #6c6c70;
}

body.light .sms-action-link:hover {
    color: #007aff;
}

.sms-action-link.danger:hover {
    color: #ef4444;
}

.sms-action {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(127, 127, 127, 0.22);
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sms-action:hover {
    color: var(--text);
    background: rgba(127, 127, 127, 0.35);
}

.sms-action.danger:hover {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.35);
}

.sms-edit {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(100%, 420px);
}

.sms-row.sent .sms-edit {
    align-items: flex-end;
}

.sms-edit-input {
    width: 100%;
    min-height: 68px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel);
    color: var(--text);
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.35;
    font-family: inherit;
    outline: none;
}

.sms-edit-input:focus {
    border-color: color-mix(in srgb, var(--theme-header-mid, #7c3aed) 45%, transparent);
    box-shadow: 0 0 0 3px var(--accent-muted, rgba(124, 58, 237, 0.12));
}

.sms-edit-actions {
    display: flex;
    gap: 8px;
}

.sms-edit-btn {
    border: none;
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.22);
    color: var(--text);
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
}

.sms-edit-btn.primary {
    color: #fff;
    background: #0a84ff;
}

body.light .sms-edit-btn.primary {
    background: #007aff;
}

.text-empty {
    margin: auto;
    max-width: 280px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
    padding: 12px;
}

.sms-bubble-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    max-width: 100%;
}

.sms-reply-quote {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(127, 127, 127, 0.18);
    border-left: 3px solid #0a84ff;
    cursor: pointer;
    max-width: 100%;
}

.sms-row.recv .sms-reply-quote {
    border-left-color: #8e8e93;
}

.sms-reply-quote-name {
    font-size: 11px;
    font-weight: 800;
    color: #0a84ff;
}

.sms-row.recv .sms-reply-quote-name {
    color: #8e8e93;
}

.sms-row.sent .sms-reply-quote-name {
    color: rgba(255, 255, 255, 0.92);
}

.sms-row.sent .sms-reply-quote {
    background: rgba(0, 0, 0, 0.18);
    border-left-color: rgba(255, 255, 255, 0.55);
}

.sms-reply-quote-body {
    font-size: 12px;
    line-height: 1.3;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sms-row.sent .sms-reply-quote-body {
    color: rgba(255, 255, 255, 0.72);
}

.sms-mention {
    color: #0a84ff;
    font-weight: 700;
}

.sms-row.sent .sms-mention {
    color: #fff;
    font-weight: 800;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.55);
    text-underline-offset: 2px;
}

body.light .sms-mention {
    color: #007aff;
}

body.light .sms-row.sent .sms-mention {
    color: #fff;
    text-decoration-color: rgba(255, 255, 255, 0.65);
}

.sms-row.is-highlight .sms-bubble {
    outline: 2px solid rgba(10, 132, 255, 0.55);
}

.text-composer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}

.composer-reply {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(127, 127, 127, 0.12);
    border-left: 3px solid #0a84ff;
}

.composer-reply-main {
    flex: 1;
    min-width: 0;
}

.composer-reply-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
}

.composer-reply-label strong {
    color: #0a84ff;
}

.composer-reply-preview {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-reply-cancel {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(127, 127, 127, 0.18);
    color: var(--muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.composer-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
}

.emoji-toggle {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.emoji-toggle:hover,
.emoji-toggle.is-active {
    color: var(--text);
    background: rgba(127, 127, 127, 0.16);
}

.emoji-toggle:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.emoji-picker {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    display: flex;
    flex-direction: column;
    width: min(100%, 352px);
    max-height: min(420px, 52vh);
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    z-index: 25;
}

.emoji-picker--floating {
    position: fixed;
    z-index: 45;
    left: 8px;
    top: 8px;
    right: auto;
    bottom: auto;
    width: min(352px, calc(100vw - 16px));
}

.emoji-picker-search-wrap {
    flex-shrink: 0;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--border);
}

.emoji-picker-search {
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-radius: 8px;
    background: rgba(127, 127, 127, 0.14);
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.emoji-picker-search:focus {
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.35);
}

.emoji-picker-search::placeholder {
    color: var(--muted);
}

.emoji-picker-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 8px 8px;
}

.emoji-picker-category-label {
    flex-shrink: 0;
    padding: 8px 4px 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

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

.emoji-picker-cell {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.emoji-picker-cell:hover {
    background: rgba(127, 127, 127, 0.18);
}

.emoji-picker-empty {
    grid-column: 1 / -1;
    padding: 28px 12px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.emoji-picker-tabs {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--panel) 88%, var(--bg));
    overflow-x: auto;
}

.emoji-picker-tab {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.72;
}

.emoji-picker-tab:hover {
    opacity: 1;
    background: rgba(127, 127, 127, 0.14);
}

.emoji-picker-tab.is-active {
    opacity: 1;
    background: rgba(10, 132, 255, 0.18);
}

body.light .emoji-picker {
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
}

body.light .emoji-picker-search {
    background: rgba(15, 23, 42, 0.06);
}

@media (max-width: 640px) {
    .emoji-picker {
        width: 100%;
        max-height: min(380px, 48vh);
    }

    .emoji-picker-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .emoji-picker-cell {
        font-size: 20px;
    }
}

.composer-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.mention-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: var(--shadow);
    z-index: 20;
}

.mention-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    padding: 8px 10px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.mention-option:hover,
.mention-option.is-active {
    background: rgba(10, 132, 255, 0.14);
}

.mention-empty {
    padding: 10px 12px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.mention-option-name {
    font-size: 13px;
    font-weight: 700;
}

.mention-option-handle {
    font-size: 12px;
    color: #0a84ff;
    font-weight: 700;
}

.text-composer:has(.text-input:disabled) {
    cursor: pointer;
}

body.light .text-composer {
    background: #f7f7fb;
}

.text-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--text);
    padding: 11px 16px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
}

.text-input:focus {
    border-color: color-mix(in srgb, var(--theme-header-mid, #7c3aed) 45%, transparent);
    box-shadow: 0 0 0 3px var(--accent-muted, rgba(124, 58, 237, 0.12));
}

.text-send {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    background: #0a84ff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

body.light .text-send {
    background: #007aff;
}

.text-send:disabled { opacity: 0.45; cursor: not-allowed; }

.text-status {
    margin: 0 12px 10px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
}

.text-status.wait {
    background: var(--theme-accent-soft-bg, rgba(124, 58, 237, 0.16));
    border: 1px solid var(--accent-muted, rgba(124, 58, 237, 0.28));
    color: var(--theme-brand-kicker, #c4b5fd);
}

.text-status.error {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.28);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.load-older-btn {
    align-self: center;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
}

.load-older-btn:hover { color: var(--text); }

.lounge-member-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.lounge-member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
}

.lounge-member-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.lounge-member-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    flex-shrink: 0;
}

.lounge-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, var(--theme-header-mid, #6d28d9), var(--theme-header-end, #db2777));
    flex-shrink: 0;
}

.lounge-member-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lounge-member-ping,
.lounge-member-block {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.lounge-member-row:hover .lounge-member-ping,
.lounge-member-row:hover .lounge-member-block,
.lounge-member-row:focus-within .lounge-member-ping,
.lounge-member-row:focus-within .lounge-member-block {
    opacity: 1;
}

.lounge-member-ping:hover {
    color: #0a84ff;
    background: rgba(10, 132, 255, 0.16);
}

.lounge-member-block:hover {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.18);
}

.safety-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.55);
}

.safety-card {
    width: min(440px, 100%);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.safety-card h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 900;
}

.safety-card p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.safety-card label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.dob-fields {
    display: grid;
    grid-template-columns: 1.35fr 0.75fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.dob-fields select {
    width: 100%;
    margin-bottom: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
}

.age-gate-hint {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    color: #fca5a5;
}

.age-gate-hint.hidden { display: none; }

.safety-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.safety-actions .btn {
    min-width: 110px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}

.safety-actions .btn.primary {
    background: linear-gradient(135deg, var(--theme-header-mid, #6d28d9), var(--theme-header-end, #db2777));
    color: #fff;
    border-color: transparent;
}

.schema-banner {
    flex-shrink: 0;
    margin-bottom: 8px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(127, 29, 29, 0.28);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
    font-size: 14px;
    line-height: 1.5;
}

.loading-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
    padding: 20px;
}
