/* Gallery enhancement is scoped to unlocked rooms; the original feed is the no-JS fallback. */
.wall-purpose { padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.wall-purpose summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; }
.wall-purpose p { color: var(--muted); line-height: 1.5; }
.wall-purpose a { display: block; padding: 10px 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
body.room-gallery-page { overflow: hidden; background: #101015; }
#wallCommunityPage.has-room-gallery .wall-v7-layout { grid-template-areas: "gallery chat"; align-items: stretch; }
#wallCommunityPage.has-room-gallery .room-gallery { grid-area: gallery; }
#wallCommunityPage.has-room-gallery .wall-v7-main { grid-area: chat; }
#wallCommunityPage.has-room-gallery #wallCommunityChat .public-chat-v1-entry { display: block; padding-left: 38px; }
#wallCommunityPage.has-room-gallery #wallCommunityChat .wall-v9-stream-avatar-shell { left: 0; top: 0; }
#wallCommunityPage.has-room-gallery #wallCommunityChat .public-chat-v1-card { display: block; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: none !important; }
#wallCommunityPage.has-room-gallery #wallCommunityChat .public-chat-v1-author-row strong { font-size: 14px; }
#wallCommunityPage.has-room-gallery #wallCommunityChat .public-chat-v1-message-body { font-size: 16px; line-height: 1.6; }
#wallCommunityPage.has-room-gallery #wallCommunityChat .wall-v10-timeline-region { height: auto; }
#wallCommunityPage.has-room-gallery #wallCommunityChat #wallChatFeed { gap: 20px !important; min-height: 0; }
#wallCommunityPage.has-room-gallery #wallRoomPanel { display: none !important; }
#wallCommunityPage.has-room-gallery #wallRoomPanel.is-mobile-open { display: flex !important; }
#wallCommunityPage.has-room-gallery { width: 100%; max-width: none; margin: 0; padding: 0 24px !important; box-sizing: border-box; height: var(--room-height); min-height: 0; display: flex; flex-direction: column; gap: 0; overflow: hidden; }
.has-room-gallery *, .has-room-gallery *::before, .has-room-gallery *::after { box-sizing: border-box; }
#wallCommunityPage.has-room-gallery .wall-v7-layout { flex: 1; width: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 350px; grid-template-rows: minmax(0, 1fr); gap: 0; padding: 0; overflow: hidden; }
.has-room-gallery .room-gallery, #wallCommunityPage.has-room-gallery .wall-v7-main { min-width: 0; min-height: 0; height: auto; margin: 0; overflow: hidden; }
#wallCommunityPage.has-room-gallery .wall-v7-main { display: flex; flex-direction: column; border-left: 1px solid #ffffff16; }
#wallCommunityPage.has-room-gallery .wall-v7-room { flex: 1; min-height: 0; height: auto; border: 0; border-radius: 0; background: #14141b; margin: 0; }
#wallCommunityPage.has-room-gallery .wall-v8-room-shell { height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 0; gap: 0; }
#wallCommunityPage.has-room-gallery .wall-v10-timeline-region { flex: 1; min-height: 0; height: auto; padding: 0; margin: 0; }
#wallCommunityPage.has-room-gallery #wallTimelineScroller { height: 100%; min-height: 0; max-height: none; padding: 18px 16px; overflow-y: auto; scrollbar-width: thin; }
#wallCommunityPage.has-room-gallery #wallTimelineScrollbar { display: none; }
#wallCommunityPage.has-room-gallery #wallChatFeed { min-height: 0; gap: 20px; padding: 0; }
#wallCommunityPage.has-room-gallery .public-chat-v1-entry { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; margin: 0; padding: 0; border: 0; }
#wallCommunityPage.has-room-gallery .public-chat-v1-avatar { width: 28px; height: 28px; min-width: 28px; border-radius: 50%; }
#wallCommunityPage.has-room-gallery .public-chat-v1-card { padding: 0; border: 0; background: none; box-shadow: none; min-width: 0; }
#wallCommunityPage.has-room-gallery .public-chat-v1-card-head { gap: 6px; flex-wrap: wrap; margin: 0 0 6px; }
#wallCommunityPage.has-room-gallery .public-chat-v1-author-row { font-size: 14px; min-width: 0; }
#wallCommunityPage.has-room-gallery .public-chat-v1-time { font-size: 12px; color: #aaa7b5; }
#wallCommunityPage.has-room-gallery .public-chat-v1-body { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
#wallCommunityPage.has-room-gallery #wallChatFeed .wall-v8-timeline-preview { width: 100%; max-width: 95px; height: 52.5px; min-height: 0; border-radius: 8px; display: block; margin-top: 8px; overflow: hidden; background: #08080d; }
#wallCommunityPage.has-room-gallery #wallChatFeed .wall-v8-timeline-preview img { width: 100%; height: 100%; max-height: 52.5px; object-fit: contain; }
.room-gallery { display: flex; flex-direction: column; background: #101015; }
.room-gallery-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; min-height: 74px; padding: 14px 24px 14px 0; border-bottom: 1px solid #ffffff12; }
.room-gallery-heading { flex: 1; min-width: 120px; }
.room-gallery-heading h2, .room-gallery-chat-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.room-gallery-count { display: block; font-size: 11px; color: #9694a1; margin-top: 5px; }
.room-gallery-modes { display: flex; gap: 3px; padding: 3px; background: #ffffff05; border: 1px solid #ffffff14; border-radius: 9px; }
.has-room-gallery .room-gallery-button, .room-gallery-viewer-controls .room-gallery-button { appearance: none; cursor: pointer; border: 0; background: transparent; color: #aaa7b5; padding: 10px 12px; min-height: 40px; border-radius: 6px; font: inherit; font-size: 12px; }
.has-room-gallery .room-gallery-button:hover, .room-gallery-viewer-controls .room-gallery-button:hover { background: #ffffff0c; color: #fff; }
.has-room-gallery .room-gallery-button[aria-pressed="true"] { background: #ffffff10; color: #fff; }
.has-room-gallery .room-gallery-share { min-height: 42px; padding: 10px 16px; font-size: 12px; border-radius: 9px; }
.has-room-gallery button:focus-visible { outline: 2px solid #e991d1; outline-offset: 3px; }
.room-gallery-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 22px 24px 28px 0; }
.room-gallery-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 9px; align-items: start; }
.room-gallery-tile { min-width: 0; }
.room-gallery-photo, .room-gallery-stage-photo { position: relative; display: block; width: 100%; cursor: pointer; border: 0; padding: 0; background: #08080c; color: #fff; border-radius: 9px; overflow: hidden; }
.room-gallery-photo { aspect-ratio: 2 / 3; }
.room-gallery-photo img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 180ms ease; }
.room-gallery-photo:hover img { transform: scale(1.015); }
.room-gallery-expiry { position: absolute; right: 8px; bottom: 8px; font-size: 10px; border-radius: 5px; background: #080810c9; color: #eee; padding: 5px 7px; }
.room-gallery-caption { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; }
.room-gallery-caption strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.room-gallery-caption span { color: #aaa7b5; white-space: nowrap; }
.room-gallery-image-title { margin: 5px 0 0; color: #8d8b98; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-gallery-empty { max-width: 380px; margin: 12vh auto; text-align: center; padding: 24px; }
.room-gallery-empty h3 { font-size: 22px; font-weight: 550; }
.room-gallery-empty p { color: #aaa7b5; font-size: 14px; line-height: 1.7; }
.room-gallery-empty.room-gallery-quiet { max-width: 520px; margin: clamp(16px, 5vh, 64px) auto; padding: 24px 12px; }
.room-gallery-quiet-symbol { display: block; color: #d4a4ef; font-size: 40px; line-height: 1; margin-bottom: 20px; }
.room-gallery-quiet h3 { margin: 0 0 12px; }
.room-gallery-quiet-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.has-room-gallery .room-gallery-quiet-actions .btn { min-height: 44px; padding: 12px 18px; white-space: normal; text-align: center; font-size: 14px; line-height: 1.4; }
.room-gallery-quiet-actions a:focus-visible { outline: 2px solid #e991d1; outline-offset: 3px; }
.room-gallery-empty .room-gallery-quiet-note { margin: 20px 0 0; font-size: 13px; }
@media (max-width: 600px) {
    .room-gallery-quiet-actions { flex-direction: column; }
    .room-gallery-quiet-actions .btn { width: 100%; }
}
.room-gallery-more { display: block; margin: 24px auto 0; }
.room-gallery-focus { display: grid; grid-template-columns: minmax(0, 1fr) 86px; gap: 16px; }
.room-gallery-stage { min-width: 0; }
.room-gallery-stage-photo { height: min(66vh, 760px); }
.room-gallery-stage-photo img { width: 100%; height: 100%; object-fit: contain; }
.room-gallery-stage p { color: #aaa7b5; font-size: 12px; }
.room-gallery-filmstrip { display: flex; flex-direction: column; gap: 9px; max-height: 70vh; overflow: auto; }
.room-gallery-filmstrip button { flex: 0 0 108px; padding: 0 !important; overflow: hidden; border: 2px solid transparent !important; }
.room-gallery-filmstrip button[aria-pressed="true"] { border-color: #e77cb9 !important; }
.room-gallery-filmstrip img { width: 100%; height: 100%; object-fit: cover; }
.room-gallery-chat-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 14px 16px; min-height: 74px; border-bottom: 1px solid #ffffff12; }
.room-gallery-chat-head h2 { flex: 1; white-space: nowrap; }
#wallCommunityPage.has-room-gallery .wall-private-chat-launcher { width: auto; min-height: 40px; padding: 8px; margin: 0; background: none; border: 0; font-size: 11px; }
#wallCommunityPage.has-room-gallery .wall-private-chat-launcher-icon { display: none; }
#wallCommunityPage.has-room-gallery .wall-v8-room-compose { position: static; flex: 0 0 auto; width: 100%; padding: 14px; margin: 0; border-top: 1px solid #ffffff12; border-radius: 0; background: #14141b; }
#wallCommunityPage.has-room-gallery .wall-v8-compose-inline-layout { display: flex; flex-direction: column; gap: 10px; }
#wallCommunityPage.has-room-gallery .wall-v8-chat-composer { width: 100%; min-width: 0; }
#wallCommunityPage.has-room-gallery #wallChatMessage { min-height: 62px; height: 62px; max-height: 100px; padding: 12px; font-size: 16px; border: 1px solid #ffffff18; border-radius: 9px; background: #1b1b24; }
#wallCommunityPage.has-room-gallery .wall-v8-compose-control-rail { width: 100%; display: flex; gap: 12px; justify-content: space-between; align-items: center; }
#wallCommunityPage.has-room-gallery .wall-v8-compose-upload { flex: 1; min-width: 0; width: auto; }
#wallCommunityPage.has-room-gallery .wall-v6-file-trigger { width: auto; min-height: 40px; padding: 8px; font-size: 11px; }
#wallCommunityPage.has-room-gallery .wall-v6-file-trigger-meta { font-size: 9px; }
#wallCommunityPage.has-room-gallery .wall-v8-send-button { width: auto; min-width: 74px; min-height: 42px; padding: 10px 16px; font-size: 12px; }
#wallCommunityPage.has-room-gallery .wall-v14-room-rules { position: static; margin: 0; padding: 8px 16px; font-size: 10px; line-height: 1.4; }
.room-gallery-reference { display: block; width: 45px; height: 33px; border: 1px solid #ffffff22; border-radius: 6px; padding: 0; overflow: hidden; cursor: pointer; background: #090910; }
.room-gallery-reference img { width: 100%; height: 100%; object-fit: contain; }
.room-gallery-viewer-controls { display: flex; flex: 0 0 auto; justify-content: center; flex-wrap: wrap; align-items: center; gap: 4px; width: 100%; padding: 4px; border-radius: 9px; background: #14141bf5; }
.room-gallery-viewer-controls button { white-space: normal; min-width: 0; }
.room-gallery-page .wall-v3-modal-dialog { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); overflow-y: auto; }
.room-gallery-page .wall-v11-modal-media-shell { flex: 1 1 auto; min-height: 120px; }
.room-gallery-page .wall-v11-modal-stats-row { flex: 0 0 auto; }
#wallCommunityPage.has-room-gallery > .wall-v15-room-picker { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 66px; margin: 0; padding: 12px 0; border: 0; background: none; }
#wallCommunityPage.has-room-gallery .wall-v15-room-picker-head { display: block; }
#wallCommunityPage.has-room-gallery .wall-v15-room-picker h2 { margin: 0; font-size: 20px; }
#wallCommunityPage.has-room-gallery .wall-v15-room-form { width: 170px; max-width: 100%; margin-left: auto; }
#wallCommunityPage.has-room-gallery .wall-v15-room-form select { min-height: 40px; }
#wallCommunityPage.has-room-gallery .wall-mobile-room-actions { display: flex; }
#wallCommunityPage.has-room-gallery .member-private-room-live-head { flex: 0 0 auto; margin: 0; min-height: 82px; padding: 14px 0; }
#wallCommunityPage.has-room-gallery .wall-mobile-room-toolbar { display: flex; min-height: 60px; flex: 0 0 auto; justify-content: space-between; }
#wallCommunityPage.has-room-gallery #wallRoomPanel { display: none; position: fixed; top: 16px; bottom: 16px; right: 16px; left: auto; width: min(370px, calc(100vw - 32px)); max-height: none; z-index: 1500; overflow: auto; padding: 52px 18px 20px; background: #181821; border: 1px solid #ffffff22; border-radius: 15px; transform: none; visibility: visible; }
#wallCommunityPage.has-room-gallery #wallRoomPanel.is-mobile-open { display: flex; flex-direction: column; }
#wallCommunityPage.has-room-gallery .wall-mobile-panel-close { display: block; position: absolute; top: 8px; right: 10px; }
.room-gallery-page.wall-mobile-panel-open .wall-mobile-panel-backdrop { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1499; background: #000b; border: 0; }
.room-gallery-tabs { display: none; }
.has-room-gallery [hidden] { display: none !important; }
@media (min-width: 1650px) { .room-gallery-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (min-width: 901px) and (max-width: 1190px) { .room-gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } #wallCommunityPage.has-room-gallery .wall-v7-layout { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 900px) {
    #wallCommunityPage.has-room-gallery { padding: 0 14px !important; }
    #wallCommunityPage.has-room-gallery .wall-v7-layout { display: flex; }
    #wallCommunityPage.has-room-gallery .room-gallery, #wallCommunityPage.has-room-gallery .wall-v7-main { flex: 1; border: 0; width: 100%; }
    .has-room-gallery[data-room-view="gallery"] .wall-v7-main, .has-room-gallery[data-room-view="chat"] .room-gallery { display: none !important; }
    .room-gallery-toolbar { padding: 10px 0; gap: 8px; min-height: 65px; }
    .room-gallery-toolbar > .room-gallery-share { display: none; }
    .room-gallery-scroll { padding: 16px 0 24px; }
    .room-gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 6px; }
    .room-gallery-caption { font-size: 11px; margin-top: 8px; }
    .room-gallery-image-title { font-size: 10px; }
    .room-gallery-tabs { display: flex; flex: 0 0 auto; gap: 8px; justify-content: space-around; align-items: center; padding: 7px 0 max(7px, env(safe-area-inset-bottom)); border-top: 1px solid #ffffff18; background: #101015; min-height: 60px; }
    .room-gallery-tabs .room-gallery-button { flex: 1; min-height: 44px; }
    .has-room-gallery .room-gallery-share { padding: 10px; font-size: 11px; }
    .room-gallery-chat-head { min-height: 55px; padding: 6px 0; }
    #wallCommunityPage.has-room-gallery .wall-v8-room-compose { padding: 10px 0; }
    #wallCommunityPage.has-room-gallery #wallTimelineScroller { padding: 14px 0; }
    #wallCommunityPage.has-room-gallery .wall-v14-room-rules { display: none; }
    #wallCommunityPage.has-room-gallery > .wall-v15-room-picker { min-height: 60px; padding: 8px 0; gap: 8px; }
    #wallCommunityPage.has-room-gallery .wall-v15-room-picker-head { display: none; }
    #wallCommunityPage.has-room-gallery .wall-v15-room-form { flex: 1; margin: 0; max-width: 165px; }
    #wallCommunityPage.has-room-gallery .wall-mobile-room-actions { margin-left: auto; }
    #wallCommunityPage.has-room-gallery .member-private-room-live-head { padding: 10px 0; min-height: 95px; }
    .room-gallery-focus { display: flex; flex-direction: column; }
    .room-gallery-stage-photo { height: 47vh; }
    .room-gallery-filmstrip { flex-direction: row; height: 84px; overflow-x: auto; }
    .room-gallery-filmstrip button { flex: 0 0 58px; }
    .room-gallery-viewer-controls .room-gallery-button { font-size: 10px; padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { .room-gallery-photo img { transition: none; } }

#wallCommunityPage.has-room-gallery #wallCommunityChat { min-height: 0; max-height: none; height: auto; }
#wallCommunityPage.has-room-gallery #wallCommunityChat .wall-v8-room-shell { height: 100%; min-height: 0; max-height: none; border-radius: 0; background: #14141b; }
#wallCommunityPage.has-room-gallery #wallCommunityChat #wallChatSendButton { min-height: 44px; height: 44px; min-width: 44px; width: 44px; }
#wallCommunityPage.has-room-gallery .wall-mobile-room-action, #wallCommunityPage.has-room-gallery .wall-mobile-rules > summary { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; min-width: 40px; padding: 5px 9px; background: #ffffff05; color: #eee; border: 1px solid #ffffff14; border-radius: 9px; cursor: pointer; list-style: none; }
.room-gallery-caption .room-gallery-like { padding: 4px; min-height: 32px; color: #b9b4c5; font-size: 12px; white-space: nowrap; }
.room-gallery-caption .room-gallery-like[aria-pressed="true"] { background: none; color: #f29dcc; }
.room-gallery-reply { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 10px; border-left: 2px solid #dc81bc; background: #ffffff06; font-size: 11px; color: #b9b2c4; }
.room-gallery-reply span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.room-gallery-reference-unavailable { width: auto; height: auto; padding: 8px; font-size: 11px; color: #aaa7b5; }
.room-gallery-tabs .room-gallery-button[aria-pressed="true"] { color: #efa7d2; box-shadow: inset 0 -2px #dd81ba; background: #ffffff06; }

.room-gallery-chat-tabs { display: flex; gap: 2px; flex: 1; min-width: 0; }
.room-gallery-chat-tabs .room-gallery-button { padding: 10px 8px; min-height: 44px; }
.room-gallery-chat-tabs [aria-selected="true"] { color: #efa7d2; box-shadow: inset 0 -2px #dd81ba; }
.room-gallery-chat-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#wallCommunityPage.has-room-gallery #wallRoomPanel { position: static; display: flex !important; flex-direction: column; flex: 1; min-height: 0; width: 100%; max-height: none; padding: 16px; border: 0; border-radius: 0; z-index: auto; overflow-y: auto; background: #14141b; }
#wallCommunityPage.has-room-gallery #wallRoomPanel[hidden] { display: none !important; }
#wallCommunityPage.has-room-gallery .wall-mobile-panel-close, #wallCommunityPage.has-room-gallery .wall-mobile-panel-backdrop { display: none !important; }
#wallCommunityPage.has-room-gallery #wallOnlineUsers { width: 100%; min-width: 0; }
.room-gallery-caption { gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.room-gallery-expiry { right: 3px; bottom: 3px; padding: 3px; font-size: 9px; }
.public-wall-page .room-gallery-expiry { font-size: 12px; line-height: 1.3; padding: 4px; background: #080810ed; }
.public-wall-page .room-gallery-caption .room-gallery-like { font-size: 16px; min-height: 40px; min-width: 40px; color: #d8d2e3; }
[data-wall-nickname-close] { float: right; min-width: 44px; min-height: 44px; font-size: 22px; }
@media (max-width: 900px) {
    .room-gallery-caption strong { flex-basis: 100%; }
    .room-gallery-caption .room-gallery-like { min-height: 32px; padding: 2px; }
    .room-gallery-chat-head { padding: 6px 0; }
    #wallCommunityPage.has-room-gallery #wallRoomPanel { padding: 14px 0; }
}

.room-gallery-room-dialog { box-sizing: border-box; width: min(400px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; overflow-y: auto; border: 1px solid #676977; border-radius: 16px; background: #191b23; color: #f4f3f6; box-shadow: 0 24px 80px #0008; }
.room-gallery-room-dialog::backdrop { background: #08090dcc; }
.room-gallery-room-dialog h2 { margin: 0 0 20px; font-size: 21px; line-height: 1.3; }
.room-gallery-room-choices { display: grid; gap: 8px; margin-bottom: 20px; }
.room-gallery-room-dialog .btn { width: 100%; min-height: 44px; white-space: normal; }
.room-gallery-room-choices [aria-current="true"] { border-color: #ffb4d8; background: #ff4fa314; }
