/* Keep desktop alignment; give narrow headers explicit rows instead of competing columns. */
@media(max-width:1100px){
 #communityPage>header.room-header-centered{grid-template-columns:40px minmax(0,1fr);gap:10px 12px;align-items:center;padding:14px 16px;margin-top:0;box-sizing:border-box}
 #communityPage>header.room-header-centered>.room-identity{grid-column:1;grid-row:1;align-self:center}
 #communityPage .room-centered-brand{display:contents}
 #communityPage .room-centered-brand>.brand{grid-column:2;grid-row:1;justify-self:center;max-width:100%;font-size:20px;line-height:1.4}
 #communityPage .room-centered-brand>.room-top-socials{grid-column:1 / -1;grid-row:2;justify-self:start;width:auto;justify-content:flex-start;gap:8px}
 #communityPage>header.room-header-centered>.room-toolbar{grid-column:1 / -1;grid-row:2;justify-self:end;display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;gap:8px;max-width:none;width:auto;min-width:0}
 #communityPage>header.room-header-centered .room-toolbar>*{flex-shrink:0}
 #communityPage>header.room-header-centered .community-account-actions{display:flex;align-items:center;flex-wrap:nowrap;gap:8px}
 #communityPage .stream-section-tabs{flex-wrap:nowrap;justify-content:flex-start;gap:4px;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin;max-width:100%;min-width:0;box-sizing:border-box;margin-top:0;margin-bottom:12px;padding:0 12px 4px;scroll-padding-inline:12px}
 #communityPage .stream-section-tabs>button,#communityPage .stream-section-tabs>form{flex:0 0 auto;white-space:nowrap}
 #communityPage .stream-section-tabs button{min-height:44px;padding:10px 9px;line-height:1.25}
 #communityPage .stream-section-tabs .top-signout-form{margin:0;align-self:stretch;display:flex;align-items:stretch}
}
@media(max-width:480px){
 #communityPage>header.room-header-centered{padding:12px;gap:8px}
 #communityPage .room-centered-brand>.brand{font-size:18px}
 #communityPage .room-centered-brand>.room-top-socials{grid-column:1 / -1;grid-row:2;justify-self:center;justify-content:center}
 #communityPage>header.room-header-centered>.room-toolbar{grid-column:1 / -1;grid-row:3;justify-self:center;justify-content:center;gap:8px;max-width:100%;flex-wrap:wrap}
 #communityPage .room-top-socials .room-social-menu>summary,#communityPage .room-top-socials .room-join-discord,#communityPage #messagesToggle{min-height:44px;box-sizing:border-box}
 #communityPage .room-top-socials .room-join-discord,#communityPage #messagesToggle{min-width:44px}
 #communityPage .stream-section-tabs{padding-inline:8px;scroll-padding-inline:8px}
}
/* Popout headers retain their simple brand/actions arrangement, with room to wrap. */
@media(max-width:600px){
 #communityPage:is(.chat-popout,.members-popout,.video-popout)>header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;padding:12px;box-sizing:border-box}
 #communityPage:is(.chat-popout,.members-popout,.video-popout)>header>.brand{font-size:18px;line-height:1.4;max-width:100%}
 #communityPage:is(.chat-popout,.members-popout,.video-popout)>header .community-account-actions{display:flex;align-items:center;gap:8px;margin-left:auto}
}

/* The shared mobile site bar is fixed; reserve its actual layout space. */
@media(max-width:900px){
 body.cgp-community-page:has(.cgp-topbar) #communityPage:not(.chat-popout):not(.members-popout):not(.video-popout){padding-top:var(--cgp-topbar-height,62px)!important}
}
@media(max-width:1100px){
 #communityPage .stream-section-tabs{scrollbar-width:none;gap:2px;margin-bottom:8px;padding-bottom:0;min-height:48px}
 #communityPage .stream-section-tabs::-webkit-scrollbar{display:none;width:0;height:0}
 #communityPage .stream-section-tabs button{padding:10px 8px}
 #communityPage>header.room-header-centered{padding-bottom:12px;border-bottom:1px solid #27364a}
 #communityPage>header.room-header-centered .room-toolbar{gap:6px}
 #communityPage>header.room-header-centered .community-account-actions{gap:6px}
}
@media(max-width:480px){
 #communityPage>header.room-header-centered{gap:6px;padding-block:10px}
 #communityPage .room-centered-brand>.room-top-socials{grid-column:1 / -1;grid-row:2;justify-self:start;justify-content:flex-start}
 #communityPage>header.room-header-centered>.room-toolbar{grid-row:3;justify-self:center;padding-top:2px}
}
