.room-console {
    --room-surface: #17131b;
    --room-main: #111015;
    --room-border: #423344;
    --room-accent: #ffd1e7;
    --room-muted: #beafc0;
    display: grid;
    grid-template-columns: minmax(12rem, 14rem) minmax(0, 1fr) minmax(14rem, 16rem);
    min-height: min(76vh, 58rem);
    border-radius: 17px;
    background: var(--room-main);
    border-color: var(--room-border);
}

.room-console > .room-rail,
.room-console > .room-voice {
    display: flex;
    flex-direction: column;
    padding: .85rem;
    min-width: 0;
    background: var(--room-surface);
}

.room-console > .room-rail { border-right: 1px solid var(--room-border); }
.room-console > .room-voice { border-left: 1px solid var(--room-border); }
.room-rail-head,
.room-voice-head,
.room-heading,
.room-heading-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
}
.room-voice-head { justify-content: space-between; }
.room-rail-head { padding: .25rem .25rem .65rem; }
.room-rail-head h1,
.room-voice-head h2,
.room-heading h2 {
    margin: 0;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.room-rail-head h1 { font-size: .99rem; }
.room-voice-head h2 { font-size: .97rem; }
.room-heading h2 { font-size: 1.35rem; letter-spacing: -.025em; }
.room-rail-head p,
.room-voice-head p,
.room-heading p {
    color: var(--room-muted);
    font-size: .77rem;
    margin: .25rem 0 0;
    overflow-wrap: anywhere;
}
.room-mark {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    flex: none;
    color: var(--room-accent);
    background: #472b41;
    border-radius: 10px;
    font-weight: 850;
    border: 1px solid #79506e;
}

.room-links {
    min-height: 0;
    max-height: 38vh;
    overflow: auto;
    margin: .25rem 0 .4rem;
}
.room-links a { gap: .5rem; min-width: 0; }
.room-mode { flex: 0 0 1.15rem; color: #d3a8c9; }
.room-link-name { display: grid; min-width: 0; }
.room-link-name strong { font-size: .85rem; overflow-wrap: anywhere; }
.room-link-name small { color: var(--room-muted); font-size: .68rem; }
.room-manage-link { margin: .35rem 0; justify-self: start; }
.room-account { margin-top: auto; }
.room-account .chat-profile-link { width: 100%; }

.room-center {
    min-width: 0;
    height: clamp(35rem, 76vh, 58rem);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}
.room-heading {
    justify-content: space-between;
    padding: .8rem 1rem .7rem;
    background: #18121d;
}
.room-heading > div:first-child { min-width: 0; }
.room-heading-actions { flex-wrap: wrap; justify-content: flex-end; }
.room-tag {
    display: inline-flex;
    border: 1px solid #6b4c68;
    color: #e6cae1;
    background: #362634;
    border-radius: 999px;
    padding: .22rem .48rem;
    font-size: .71rem;
    white-space: nowrap;
}
.room-tabs {
    display: flex;
    border-bottom: 1px solid var(--room-border);
    gap: .35rem;
    padding: .25rem .85rem .4rem;
    background: #18121d;
}
.room-tabs button {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 34px;
    padding: .38rem .55rem;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--room-muted);
    background: transparent;
    font-size: .82rem;
}
.room-tabs button[aria-pressed=true] {
    border-color: #704566;
    background: #3b263c;
    color: #fff0fb;
}
.room-tabs [data-screen-badge] {
    border-radius: 4px;
    padding: .05rem .3rem;
    color: #21131d;
    background: #f0adce;
    font-weight: 750;
}
.room-messages {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
}
.room-messages .chat-stream { max-height: none; }
.room-readonly {
    margin: .5rem;
    padding: .65rem;
    color: var(--room-muted);
    border: 1px solid var(--room-border);
    border-radius: 9px;
}
.room-record-preview { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.room-screen.chat-stage {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    background: #0e0c12;
}
.room-screen .chat-stage-header { padding: .2rem .15rem .65rem; }
.room-screen h3 { margin: 0; font-size: .95rem; }
.room-screen-empty {
    min-height: 13rem;
    border: 1px dashed #604364;
    border-radius: 12px;
    display: grid;
    justify-items: center;
    align-content: center;
    text-align: center;
    gap: .55rem;
    padding: 1rem;
    margin: .35rem 0;
    color: #f2dce9;
}
.room-screen-empty > span { font-size: 1.75rem; color: #d893bd; line-height: 1; }
.room-screen-empty p { max-width: 30rem; color: var(--room-muted); margin: 0; font-size: .84rem; }
.room-screen .chat-cast video { max-height: 38vh; }
.room-screen.chat-stage-expanded .chat-share { grid-template-columns: 1fr; }
.room-screen.chat-stage-expanded .chat-cast video { max-height: 54vh; }

.room-voice-head { border-bottom: 1px solid var(--room-border); padding-bottom: .65rem; }
.room-voice > h3 { margin: 1rem 0 .4rem; font-size: .84rem; }
.room-voice-status,
.room-peers-empty {
    color: var(--room-muted);
    margin: .6rem 0 .25rem;
    line-height: 1.45;
    font-size: .83rem;
}
.room-voice-actions { margin-top: .5rem; }
.room-voice-actions > button { flex: 1 1 auto; }
.room-voice .chat-participants { max-height: 34vh; overflow-y: auto; }
.room-voice .chat-participants li { display: grid; gap: .32rem; font-size: .83rem; }
.room-voice li small { color: var(--room-muted); }
.room-voice li input { width: 100%; accent-color: #d191bd; }
.room-voice .chat-speaking small { color: #b6efc8; }
.room-empty { display: block; padding: 1rem; }

.room-manager { max-width: 1000px; }
.room-manager-list { display: grid; gap: .7rem; }
.room-admin-card {
    border: 1px solid #4d354c;
    border-radius: 13px;
    background: #1b141d;
    padding: .85rem 1rem;
}
.room-admin-card > summary,
.room-delete-area > summary {
    cursor: pointer;
    color: #ffe1ef;
    overflow-wrap: anywhere;
}
.room-admin-card summary small {
    display: block;
    margin-top: .25rem;
    color: var(--muted);
    font-size: .78rem;
}
.room-admin-card summary .room-tag { margin-top: .35rem; }
.room-admin-card form { margin-top: .8rem; }
.room-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.room-field-wide { grid-column: 1 / -1; }
.room-form-flags { display: flex; flex-wrap: wrap; gap: .55rem 1rem; }
.room-admin-secondary { display: flex; gap: .5rem; flex-wrap: wrap; align-items: start; margin-top: .6rem; }
.room-admin-secondary form { margin: 0; }
.room-delete-area { margin-top: .75rem; border-top: 1px solid #56364b; padding-top: .7rem; }
.room-delete-area p { color: var(--muted); }

@media (max-width: 1060px) {
    .room-console { grid-template-columns: minmax(11rem, 13rem) minmax(0, 1fr); }
    .room-console > .room-voice {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 1px solid var(--room-border);
    }
}
@media (max-width: 620px) {
    .room-console { grid-template-columns: minmax(0, 1fr); }
    .room-console > .room-rail { border-right: 0; border-bottom: 1px solid var(--room-border); }
    .room-links { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 23vh; }
    .room-links a { padding: .35rem .45rem; }
    .room-center { height: min(75vh, 44rem); min-height: 360px; }
    .room-account { margin-top: .65rem; }
    .room-heading { align-items: flex-start; flex-wrap: wrap; }
    .room-heading-actions { justify-content: flex-start; }
    .room-form-grid { grid-template-columns: minmax(0, 1fr); }
    .room-field-wide { grid-column: auto; }
}

/* Keep the message scrollbar visible without competing with the conversation. */
.room-console .chat-stream { scrollbar-gutter: stable; }

.chat-audio-panel[open] {
    display: grid;
    flex-basis: 100%;
    gap: .45rem;
    padding: .55rem;
    border: 1px solid var(--room-border);
    border-radius: 10px;
}
.chat-audio-panel summary { cursor: pointer; list-style: none; }
.chat-audio-panel summary::-webkit-details-marker { display: none; }
.chat-audio-panel label { color: var(--room-muted); font-size: .85rem; }
.chat-audio-panel input { width: 100%; min-width: 0; }

.room-channel-group {
    flex-basis: 100%;
    margin: .55rem 0 .1rem;
    color: var(--room-muted);
    font-size: .73rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.room-console-text { grid-template-columns: minmax(12rem, 14rem) minmax(0, 1fr); }
.room-console-voice .room-center { min-width: 0; }
.room-voice-only { margin: auto; padding: 1rem; color: var(--room-muted); }
.chat-audio-player {
    display: grid;
    grid-template-columns: auto minmax(38px, 1fr) auto;
    align-items: center;
    gap: .55rem;
    width: min(100%, 29rem);
    margin-top: .5rem;
    padding: .5rem;
    border: 1px solid #67435d;
    border-radius: 12px;
    background: linear-gradient(120deg, #302031, #1d1722);
}
.chat-audio-player button {
    min-height: 44px;
    border: 1px solid #885270;
    border-radius: 9px;
    padding-inline: .5rem;
    color: #ffe4f2;
    background: #47283e;
    cursor: pointer;
}
.chat-audio-player input { width: 100%; min-width: 0; accent-color: #ff91bf; }
.chat-audio-player span { color: #f0cadd; white-space: nowrap; font-size: .75rem; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
    .room-console-text { grid-template-columns: minmax(0, 1fr); }
    .room-console-text > .room-rail { grid-column: 1 / -1; }
}

@media (forced-colors: none) {
    @supports selector(::-webkit-scrollbar) {
        .room-console .chat-stream::-webkit-scrollbar { width: 10px; }
        .room-console .chat-stream::-webkit-scrollbar-track {
            margin-block: 9px;
            border: 2px solid #111015;
            border-radius: 999px;
            background: #251b27;
        }
        .room-console .chat-stream::-webkit-scrollbar-thumb {
            min-height: 36px;
            border: 2px solid #111015;
            border-radius: 999px;
            background: linear-gradient(180deg, #d295ad, #975d80);
            box-shadow: inset 1px 0 #f4c2d64d;
        }
        .room-console .chat-stream::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #f3bdd0, #bd7b9f);
        }
        .room-console .chat-stream::-webkit-scrollbar-thumb:active { background: #edafca; }
        .room-console .chat-stream::-webkit-scrollbar-button { display: none; }
    }

    @supports not selector(::-webkit-scrollbar) {
        .room-console .chat-stream {
            scrollbar-width: thin;
            scrollbar-color: #ba809c #251b27;
        }
    }
}

.chat-attachment-tools { display: flex; align-items: flex-start; gap: .45rem; }
.chat-attachment-tools .chat-audio-panel { position: relative; }
.chat-attachment-tools .chat-audio-panel[open] { flex-basis: auto; min-width: 0; }
.chat-link-card {
    display: grid;
    gap: .25rem;
    width: min(100%, 30rem);
    margin-block: .4rem;
    padding: .65rem .8rem;
    border: 1px solid #67435d;
    border-inline-start: 3px solid #e584b0;
    border-radius: 9px;
    background: #261b2a;
    color: #ffdef1;
    overflow-wrap: anywhere;
    text-decoration: none;
}
.chat-link-card small { color: #cfb8ce; }
.chat-link-card:hover { background: #37253b; }

.chat-link-card { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .65rem; }
.chat-link-icon { display: grid; place-items: center; width: 36px; aspect-ratio: 1; border-radius: 9px; background: #59354f; font-weight: 750; }
.chat-link-copy { display: grid; gap: .22rem; }
.chat-link-copy span { color: #e6d3e2; font-size: .86rem; }
.chat-link-copy span:empty { display: none; }
