.mobile-account-menu,
.mobile-room-toggle { display: none; }

.room-rail-content,
.room-voice-content { display: contents; }

@media (max-width: 640px) {
    html { scroll-padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

    .site {
        width: calc(100% - 24px);
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    .topbar {
        display: flex;
        justify-content: space-between;
        min-height: 60px;
        padding-block: 0;
    }

    .mobile-account-menu { display: block; position: relative; z-index: 21; }
    .mobile-account-menu summary {
        display: grid;
        place-items: center;
        min-height: 44px;
        padding-inline: .85rem;
        border: 1px solid #704456;
        border-radius: 12px;
        background: #211721;
        color: #fff3fa;
        cursor: pointer;
        list-style: none;
    }
    .mobile-account-menu summary::-webkit-details-marker { display: none; }
    .mobile-account-actions {
        position: absolute;
        inset: calc(100% + .4rem) 0 auto auto;
        display: grid;
        gap: .45rem;
        min-width: 9rem;
        padding: .5rem;
        border: 1px solid #704456;
        border-radius: 12px;
        background: #211721;
        box-shadow: 0 12px 30px #0009;
    }
    .mobile-account-actions .button { width: 100%; }

    .topbar .hotbar {
        position: fixed;
        inset: auto max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
        z-index: 20;
        width: auto;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: .25rem;
        gap: .2rem;
    }
    .topbar .hotbar-member { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .topbar .hotbar a { min-height: 44px; margin: 0; padding: .25rem .1rem; font-size: .73rem; }
    .topbar .hotbar .nav-form,
    .topbar .hotbar .nav-admin { display: none; }
    .toast { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }

    .community-heading { align-items: center; }
    .forum-sidebar h2 { margin-bottom: .4rem; }
    .forum-category-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: .3rem;
        scroll-snap-type: x proximity;
    }
    .forum-category-list a {
        flex: 0 0 auto;
        min-height: 44px;
        align-content: center;
        scroll-snap-align: start;
    }
    .forum-search {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .forum-search [type="search"] { grid-column: 1 / -1; }
    .view input:not([type="checkbox"], [type="radio"], [type="range"]),
    .view select,
    .view textarea { font-size: 16px; }
    .view .button { min-height: 44px; }
    .toast { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

    .room-console {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
    }
    .room-console > .room-rail,
    .room-console > .room-voice {
        grid-row: 1;
        grid-column: auto;
        padding: .45rem;
        border: 0;
        border-bottom: 1px solid var(--room-border);
    }
    .room-console > .room-rail { grid-column: 1; }
    .room-console-text > .room-rail { grid-column: 1 / -1; }
    .room-console > .room-voice { grid-column: 2; }
    .room-console > .room-center { grid-area: 2 / 1 / auto / -1; }
    .mobile-room-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 44px;
        padding: .4rem .65rem;
        border: 1px solid #704456;
        border-radius: 10px;
        background: #241827;
        color: #fff3fa;
        font: inherit;
        cursor: pointer;
    }
    .mobile-room-toggle::after {
        content: '';
        width: .45rem;
        height: .45rem;
        border: solid currentColor;
        border-width: 0 1.5px 1.5px 0;
        transform: rotate(45deg);
    }
    .mobile-room-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
    .mobile-room-toggle[aria-expanded="false"] + div { display: none; }
    .mobile-room-toggle[aria-expanded="true"] + div {
        display: grid;
        min-width: 0;
        gap: .4rem;
        padding-top: .5rem;
        overflow-wrap: anywhere;
    }
    .room-console .room-links { display: grid; max-height: 35svh; }
    .room-console .room-links a { min-height: 44px; }
    .room-console .room-center {
        height: clamp(330px, calc(100svh - 190px), 650px);
        min-height: 0;
    }
    .room-console .room-heading { padding: .55rem .65rem; }
    .room-console .room-tabs button { min-height: 44px; }
    .room-console .chat-composer { padding: .45rem; }
    .room-console .chat-composer textarea { min-height: 48px; }
}
