:root {
    --rc-layer-content: 0;
    --rc-layer-floating: 1;
    --rc-layer-navigation: 10;
    --rc-layer-drawer: 12;
    --rc-layer-popover: 14;
    --rc-mobile-panel: #181824;
    --rc-mobile-chat: #101118;
    --rc-mobile-bubble: #242232;
    --rc-mobile-own: #422b43;
}
html[data-randoms-theme="light"] {
    --rc-mobile-panel: #fff8ed;
    --rc-mobile-chat: #fbf6ed;
    --rc-mobile-bubble: #fffdf7;
    --rc-mobile-own: #f0dddf;
}
.rc-moderator-shield { z-index: var(--rc-layer-floating); }
body > main { isolation: isolate; z-index: var(--rc-layer-content); }
body > .topbar { z-index: var(--rc-layer-navigation); }
html body .rc-staff-launch { z-index: var(--rc-layer-floating); }
html body > .topbar .rc-notice-panel { z-index: var(--rc-layer-popover); }
.mobile-room-action, .mobile-room-actions, .mobile-drawer-heading,
.mobile-roster-backdrop, .mobile-dashboard-toggle, .mobile-only-action { display: none; }
[hidden] { display: none !important; }

.hero-feature { --rc-hero-image:url("../../plugins/randomchat-club/assets/hero.webp"); }
html .hero-feature .hero-art,
html[data-randoms-theme="light"] .hero-feature .hero-art {
    background: var(--rc-hero-image) 67% center / cover no-repeat;
}
.hero-feature .hero-art::before, .hero-feature .hero-art::after {
    content:"";
    position:absolute;
    inset:0;
    background:linear-gradient(90deg,#0c0b15f5 0%,#0d0c17ca 24%,#0b0a1460 52%,transparent 81%),
        linear-gradient(0deg,#090c18 0%,transparent 37%);
}
.hero-feature .hero-art::after {
    opacity:0;
    transition:opacity 160ms ease-out;
    background:linear-gradient(90deg,#291415f7 0%,#251819c7 26%,#1a101546 65%,transparent 85%),
        linear-gradient(0deg,#231414,transparent 38%);
}
html[data-randoms-theme="light"] .hero-feature .hero-art::after { opacity:1; }
@media (prefers-reduced-motion:reduce) {
    .hero-feature .hero-art::after { transition:none; }
}
@media (max-width: 780px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
    body { min-inline-size:0; }
    .shell, .shell > *, .panel, fieldset, .field, .chat-entry-main, .member-profile-hero > * { min-inline-size:0; }
    :is(.panel,.room-card,.profile-card,.member-card,.rc-staff-centre) :is(p,li,h1,h2,h3,small,dd,.button) { overflow-wrap:anywhere; }
    :is(.panel,.room-card,.profile-card,.member-card,.rc-staff-centre) .button { white-space:normal; }
    :is(.field,.panel,.rc-staff-centre) :is(input,select,textarea) { max-inline-size:100%; }
    :is(.dialog-actions,.hero-actions,.card-meta,.rc-participant-actions) { min-inline-size:0; flex-wrap:wrap; }
    :is(.panel,dialog) :is(pre,table) { max-inline-size:100%; }
    .panel pre { overflow-x:auto; }
    :is(dialog,.rc-staff-centre,.workspace-dialog,.rc-quiz-arena) { max-inline-size:calc(100vw - 14px); max-block-size:calc(100dvh - 14px); }
    .rc-staff-centre { overflow-wrap:anywhere; }
    .rc-staff-centre :is(input,select,textarea,button,form,article) { min-inline-size:0; }
    .topbar .nav-shell { gap:clamp(3px,1.15vw,9px); min-inline-size:0; }
    .topbar .nav-shell > .brand { min-inline-size:0; }
    .topbar .nav-shell > .brand svg:not(.rc-theme-sun,.rc-theme-moon) { max-inline-size:100%; }
    .topbar .nav-shell > :is(.nav-toggle,.mail-header-link,.rc-theme-switch,.rc-notice) .button,
    .topbar .nav-shell > :is(.nav-toggle,.mail-header-link,.rc-theme-switch,.room-invitation-header) {
        flex-shrink:0; min-inline-size:36px; padding-inline:6px;
    }
    .topbar #nav-links.open {
        z-index:var(--rc-layer-navigation);
        max-inline-size:100vw;
        max-block-size:calc(100dvh - 64px);
        overflow:auto;
        overscroll-behavior:contain;
    }
    .topbar #nav-links.open > * { white-space:normal; min-inline-size:0; }
    body:has(#nav-links.open) .rc-staff-launch { visibility:hidden; }

    .hero-feature { min-block-size:0; --rc-hero-image:url("../../plugins/randomchat-club/assets/hero-mobile.webp"); }
    html .hero-feature .hero-art, html[data-randoms-theme="light"] .hero-feature .hero-art { background-position:66% center; }
    .hero-feature .hero-art::before { background:linear-gradient(90deg,#100c18ec,#120e2078 70%,#120b2048),linear-gradient(0deg,#0d0b16c9,transparent 65%); }
    .hero-feature .hero-art::after { background:linear-gradient(90deg,#28191be6,#29151170 75%,#160a1350),linear-gradient(0deg,#291714c9,transparent 65%); }
    .hero-feature .hero-content { padding:clamp(18px,5vw,32px) clamp(14px,4vw,28px) 13px; }
    .hero-feature .hero-content .eyebrow { font-size:clamp(.61rem,2.5vw,.76rem); letter-spacing:.13em; }
    .hero-feature .hero-content h1 { font-size:clamp(2.15rem,9.7vw,4.15rem); margin:.56rem 0; line-height:1; overflow-wrap:normal; }
    .hero-feature .hero-content .hero-subtitle { max-inline-size:27rem; font-size:clamp(.9rem,3.9vw,1rem); line-height:1.42; }
    .hero-feature .hero-actions { margin-top:.85rem; gap:.45rem; }
    .hero-feature .hero-actions .button { min-block-size:41px; padding:.38rem .58rem; font-size:.83rem; }
    .hero-feature .hero-referral { margin:.62rem 0 0; font-size:.85rem; }
    .hero-feature .hero-perks { width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.3rem; margin:.8rem 0 0; }
    .hero-feature .hero-perks > span { display:flex; align-items:center; justify-content:center; gap:.35rem; padding:.38rem .2rem; border:0; border-radius:.5rem; background:#0e0d1848; white-space:normal; font-size:.75rem; }
    .hero-feature .hero-perks svg { width:1.12rem; height:1.12rem; }
    .hero-feature .hero-stats { margin:0 .65rem .65rem; padding:.4rem .15rem; }
    .hero-feature .hero-stats > :is(span,a) { gap:.25rem; padding:.15rem; }
    .hero-feature .hero-stats b { font-size:.92rem; }
    .hero-feature .hero-stats small { font-size:.65rem; line-height:1.25; }
    .hero-feature .hero-stats svg { inline-size:.9rem; }
    .hero-feature [data-total-breakdown] { display:none; }

    .mobile-dashboard-toggle { display:inline-flex; margin:.5rem 0; min-block-size:42px; }
    .dashboard-nav[data-mobile-dashboard]:not([data-mobile-open]) { display:none; }
    .dashboard-nav[data-mobile-dashboard][data-mobile-open] { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
    .dashboard-nav[data-mobile-dashboard] .button { white-space:normal; }
    .member-dashboard-header { gap:.55rem; }
    .member-dashboard-header .hero-actions { margin-top:0; gap:.35rem; }
    .member-dashboard-header .hero-actions .button { min-block-size:38px; padding:.35rem .55rem; }

    html.room-immersive body:has([data-room-window]) > .topbar { display:contents; }
    html.room-immersive body:has([data-room-window]) .topbar .nav-shell { display:contents; }
    html.room-immersive body:has([data-room-window]) .topbar .nav-shell > :not(.rc-notice) { display:none !important; }
    html.room-immersive body:has([data-room-window]) .topbar .rc-notice { display:contents; }
    html.room-immersive body:has([data-room-window]) .topbar .rc-notice-toggle { display:none; }
    html.room-immersive body:has([data-room-window]) .topbar [data-call-notice]:not([hidden]) { position:fixed; z-index:var(--rc-layer-popover); inset:3.5rem .5rem auto; }
    html.room-immersive body:has([data-room-window]) .rc-staff-launch { display:none; }
    html.room-immersive .page-room[data-room-window] {
        --rc-room-top:env(safe-area-inset-top,0px);
        --rc-room-bottom:env(safe-area-inset-bottom,0px);
        flex:none;
        height:var(--rc-room-height,100dvh);
        width:100%;
        max-width:none;
        padding:var(--rc-room-top) 0 0;
        grid-template-rows:auto minmax(0,1fr);
        gap:0;
        background:var(--room-background,var(--rc-mobile-chat));
    }
    html.room-immersive [data-room-window] .room-hero {
        display:grid;
        grid-template-columns:auto 31px minmax(0,1fr) auto auto;
        grid-template-rows:auto auto;
        grid-template-areas:"back photo name media actions" "back photo count media actions";
        align-items:center;
        align-content:center;
        gap:1px 5px;
        padding:.3rem max(.35rem,env(safe-area-inset-right)) .3rem max(.35rem,env(safe-area-inset-left));
        min-height:3.5rem;
        border-radius:0;
        border:0;
        border-bottom:1px solid var(--room-border,var(--line));
        background:var(--room-hero,var(--rc-mobile-panel));
        box-shadow:none;
    }
    html.room-immersive [data-room-window] .room-hero .room-avatar {
        grid-area:photo; display:block; width:31px; height:31px; border-radius:.55rem;
    }
    html.room-immersive [data-room-window] .room-heading { grid-area:name; align-self:end; }
    html.room-immersive [data-room-window] .room-heading h1 { font-size:clamp(.87rem,3.9vw,1.15rem); line-height:1.16; overflow-wrap:anywhere; }
    html.room-immersive [data-room-window] .room-badges { grid-area:count; align-self:start; min-width:0; }
    html.room-immersive [data-room-window] .room-badges > :not(:first-child),
    html.room-immersive [data-room-window] .room-badges > :first-child > svg { display:none; }
    html.room-immersive [data-room-window] .room-badges > :first-child { display:block; border:0; padding:0; background:none; color:var(--room-muted,var(--muted)); font-size:.7rem; line-height:1.2; }
    html.room-immersive [data-room-window] .room-badges [data-room-online-breakdown] { display:none; }
    html.room-immersive [data-room-window] .room-toolbar { display:none; }
    html.room-immersive [data-room-window] .room-toolbar:has(#join-room:not([hidden])) { display:flex; grid-column:1/-1; margin:0; justify-content:center; }
    html.room-immersive [data-room-window] .room-toolbar > :not(#join-room) { display:none; }
    .mobile-room-back { grid-area:back; }
    .mobile-room-actions { display:flex; grid-area:actions; }
    .mobile-room-action { display:grid; place-items:center; width:40px; height:44px; padding:0; color:var(--room-text,var(--text)); background:transparent; border:0; border-radius:.5rem; }
    .mobile-room-action[aria-expanded="true"] { background:var(--room-secondary,var(--rc-mobile-bubble)); }
    .mobile-only-action { display:grid; margin-top:.45rem; }
    html.room-immersive [data-room-window] .room-direct-controls { grid-area:media; margin:0; gap:1px; }
    html.room-immersive [data-room-window] .room-direct-controls button { width:36px; height:44px; }
    .mobile-room-actions .mobile-room-action { width:36px; }

    html.room-immersive [data-room-window] .room-layout {
        display:grid; position:relative;
        grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); gap:0;
        overflow:hidden;
    }
    html.room-immersive [data-room-window] .room-layout .chat-tabs { display:none; }
    html.room-immersive [data-room-window] .room-layout .room-camera-panel {
        grid-area:1 / 1; padding:0; min-width:0; margin:0; border:0; border-radius:0;
        background:var(--room-media,var(--rc-mobile-panel)); box-shadow:none;
    }
    html.room-immersive [data-room-window] .room-camera-tray {
        position: fixed; inset: 0; pointer-events: none; z-index: 8;
    }
    html.room-immersive [data-room-window] .room-camera-tray .room-camera-rail {
        display:block; overflow:visible; padding:0;
    }
    html.room-immersive [data-room-window] .room-camera-tray .camera-slot {
        width:var(--rc-cam-w); height:var(--rc-cam-h); max-height:none; pointer-events:auto;
    }
    html.room-immersive [data-room-window] .room-camera-tray .camera-slot video { width:100%; height:100%; object-fit:contain; }

    html.room-immersive [data-room-window] .room-layout .live-chat {
        display:flex; flex-direction:column; grid-area:2 / 1; gap:0; min-height:0;
        padding:0; border:0; border-radius:0; max-height:none; height:auto; margin:0; box-shadow:none;
        background:var(--room-chat,var(--rc-mobile-chat));
    }
    html.room-immersive [data-room-window] .live-chat .chat-heading { display:none; }
    html.room-immersive [data-room-window] .live-chat :is(.chat-pinned,.chat-typing,.chat-compose-context) { flex:none; margin:.2rem .6rem; font-size:.77rem; }
    html.room-immersive [data-room-window] .live-chat .chat-log {
        flex:1 1 0; min-height:0; max-height:none; padding:.6rem .55rem; overflow:auto;
        background:var(--room-chat,var(--rc-mobile-chat)); overscroll-behavior:contain;
    }
    html.room-immersive [data-room-window] .chat-log .chat-entry {
        display:grid; grid-template-columns:29px minmax(0,1fr) auto; align-items:start;
        border:0; margin:0 0 .54rem; gap:.3rem; padding:0; background:transparent;
    }
    [data-room-window] .chat-entry-main {
        padding:.43rem .56rem; border-radius:.22rem .78rem .78rem .78rem;
        background:var(--room-message,var(--rc-mobile-bubble)); max-inline-size:100%; min-width:0;
    }
    [data-room-window] .chat-entry[data-mine] .chat-entry-main { justify-self:end; inline-size:fit-content; background:var(--room-message,var(--rc-mobile-own)); border-radius:.78rem .23rem .78rem .78rem; }
    [data-room-window] .chat-entry .chat-avatar { margin-top:.12rem; }
    [data-room-window] .chat-entry .chat-author { flex-wrap:wrap; gap:.15rem .36rem; align-items:baseline; }
    [data-room-window] .chat-entry .chat-name { max-inline-size:100%; white-space:normal; overflow-wrap:anywhere; text-align:left; }
    [data-room-window] .chat-entry :is(.chat-body,blockquote) { overflow-wrap:anywhere; line-height:1.4; }
    [data-room-window] .chat-entry .chat-message-controls { width:30px; flex-wrap:wrap; justify-content:center; gap:2px; }
    [data-room-window] .chat-entry .chat-message-controls button, [data-room-window] .chat-entry .chat-message-controls summary { min-width:26px; min-height:25px; }
    [data-room-window] .chat-entry .chat-prestige { display:none; }
    [data-room-window] .chat-log img { max-inline-size:100%; height:auto; }
    [data-room-window] .chat-log .chat-avatar img { height:100%; }
    html.room-immersive [data-room-window] #chat-form {
        flex:none; display:grid; grid-template-columns:auto auto auto minmax(0,1fr) auto; align-items:end;
        gap:.24rem; padding:.4rem max(.35rem,env(safe-area-inset-right)) max(.4rem,var(--rc-room-bottom)) max(.35rem,env(safe-area-inset-left));
        border-top:1px solid var(--room-border,var(--line)); background:var(--room-composer,var(--rc-mobile-panel));
        margin:0; min-inline-size:0;
    }
    [data-room-window] #chat-form :is(input[name="message"],textarea[name="message"]) {
        grid-column:4; min-inline-size:0; width:100%; min-height:42px;
        max-height:6rem; padding:.55rem .59rem; font-size:16px; border-radius:1.15rem; resize:none;
    }
    [data-room-window] #chat-form .button, [data-room-window] #chat-form summary {
        padding:0 .26rem; min-inline-size:35px; min-block-size:42px; font-size:.75rem;
    }
    [data-room-window] #chat-form [type="submit"] { grid-column:5; inline-size:43px; border-radius:50%; }
    [data-room-window] #chat-form [data-pick-gif] { grid-column:1; }
    [data-room-window] #chat-emoji { grid-column:2; }
    [data-room-window] #chat-form .room-composer-desktop { display:none; }
    [data-room-window] #chat-form [data-pick-attachment] { grid-column:3; }
   
    html.room-immersive [data-room-window] .room-layout .room-roster {
        display:none; position:absolute; grid-area:auto; inset:0 0 0 auto;
        inline-size:min(100%,24rem); max-inline-size:100%; z-index:var(--rc-layer-popover);
        grid-template-rows:auto minmax(0,1fr) auto; margin:0; padding:.65rem; border-radius:.8rem 0 0 .8rem;
        overflow:hidden; overscroll-behavior:contain; background:var(--room-roster,var(--rc-mobile-panel)); box-shadow:-9px 0 30px #0005;
    }
    html.room-immersive [data-room-window] .room-layout[data-mobile-roster-open] > .room-roster { display:grid !important; }
    [data-room-window] .mobile-drawer-heading { display:flex; justify-content:space-between; align-items:center; gap:.5rem; padding:0 0 .35rem; }
    [data-room-window] .room-roster > details > summary { display:none; }
    [data-room-window] .room-roster .roster-filter { margin-top:.12rem; }
    [data-room-window] .room-roster .roster-person { align-items:start; }
    [data-room-window] .room-roster .roster-name { overflow-wrap:anywhere; white-space:normal; }
    [data-room-window] .room-layout[data-mobile-roster-open] .mobile-roster-backdrop {
        display:block; position:absolute; inset:0; z-index:var(--rc-layer-drawer);
        background:#06050a91; border:0; border-radius:0; padding:0;
    }
}
@media (max-width:365px) {
    .mobile-room-action { width:34px; }
    html.room-immersive [data-room-window] .room-hero {
        grid-template-columns:auto minmax(0,1fr) auto auto;
        grid-template-areas:"back name media actions" "back count media actions";
    }
    html.room-immersive [data-room-window] .room-hero .room-avatar { display:none; }
    html.room-immersive [data-room-window] .room-direct-controls button,
    .mobile-room-actions .mobile-room-action { width:34px; }
    .topbar .nav-shell > .nav-account .button { min-inline-size:34px; padding-inline:4px; }
    .hero-feature .hero-perks > span { font-size:.68rem; }
    [data-room-window] .chat-entry .chat-message-controls { width:25px; }
    [data-room-window] #chat-form .button:not([type="submit"]), [data-room-window] #chat-form summary { min-inline-size:31px; }
}

@media (max-width: 780px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
    body > .topbar > .nav-shell {
        display:grid; grid-auto-flow:column; grid-template-columns:minmax(0,1fr); grid-auto-columns:max-content;
        justify-content:stretch;
    }
    body > .topbar > .nav-shell > .brand { width:100%; overflow:hidden; justify-content:flex-start; }
    body > .topbar > .nav-shell > .brand :is(.randoms-wordmark,.rc-light-fallback) { width:min(100%,156px); height:auto; }
    body > .topbar > .nav-shell > .nav-account { gap:4px; flex-wrap:nowrap; }
    body > .topbar > .nav-shell > .nav-toggle { margin-inline-start:0; }
    body > .topbar > .nav-shell > .nav-account .button { white-space:nowrap; }
    .collection-preview-grid { grid-template-columns:minmax(0,1fr); }
    .collection-preview-grid > * { min-inline-size:0; }
    .collection-preview-grid > .collection-webcam-preview {
        inline-size:100%; max-inline-size:100%; min-block-size:0; aspect-ratio:16/9;
    }
    html.room-immersive [data-room-window] .chat-log .chat-entry,
    [data-room-window] .chat-entry.is-mentioned { grid-template-columns:29px minmax(0,1fr); gap:0 .35rem; }
    [data-room-window] .chat-entry .chat-message-controls {
        grid-column:2; width:auto; margin-top:2px; justify-content:flex-end;
    }
}
