/* Hamrah 4.12.7 R5D — navigation-safe gallery and usable Android share focus */
:root{--hamrah-r5d-call-banner-height:0px}
body.hamrah-r5d-call-active #g119aMinibar,body.hamrah-r5d-call-active #g9CallBar{top:max(6px,env(safe-area-inset-top));inset-inline:8px;height:auto;min-height:48px;max-width:none;border-radius:16px;padding:6px 8px;z-index:130}
body.hamrah-r5d-call-active .g113-media-backdrop{padding-top:calc(var(--hamrah-r5d-call-banner-height) + max(8px,env(safe-area-inset-top)))}
.hamrah-r5d-gallery{z-index:125;align-items:stretch;padding:0;background:rgba(3,10,17,.82)}
.hamrah-r5d-gallery .g113-media-sheet{width:100%;max-width:none;height:calc(100dvh - var(--hamrah-r5d-call-banner-height));max-height:none;margin-top:var(--hamrah-r5d-call-banner-height);border-radius:24px 24px 0 0;display:flex;flex-direction:column;overflow:hidden;padding:0}
.hamrah-r5d-gallery .sheet-handle{display:none}
.hamrah-r5d-gallery .g113-media-titlebar{position:sticky;top:0;z-index:8;min-height:64px;padding:max(10px,env(safe-area-inset-top)) 14px 10px;display:flex;align-items:center;gap:12px;background:rgba(9,25,40,.97);border-bottom:1px solid rgba(255,255,255,.08)}
.hamrah-r5d-gallery .g113-media-titlebar>div{min-width:0;flex:1}.hamrah-r5d-gallery .g113-media-titlebar h2{font-size:18px;margin:0}.hamrah-r5d-gallery .g113-media-titlebar p{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:2px 0 0}
.hamrah-r5d-gallery .g113-media-titlebar [data-close]{order:-1;flex:0 0 48px;width:48px;height:48px;min-width:48px;border-radius:16px;font-size:26px}
.g113-r5d-header-count{display:block;margin-top:3px;font-size:11px;color:#91cfff}
.hamrah-r5d-gallery .g113-device-browser{min-height:0;flex:1;display:flex;flex-direction:column;overflow:hidden}
.hamrah-r5d-gallery .g113-media-toolbar{padding:10px 12px 6px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
.hamrah-r5d-gallery .g113-album-chips{display:flex;direction:rtl;overflow-x:auto;overscroll-behavior-inline:contain;scroll-snap-type:x proximity;gap:8px;padding:6px 14px 10px;scroll-padding-inline:14px;flex:0 0 auto}
.hamrah-r5d-gallery .g113-album-chips::before,.hamrah-r5d-gallery .g113-album-chips::after{content:"";flex:0 0 2px}.hamrah-r5d-gallery .g113-album-chips button{scroll-snap-align:start;flex:0 0 auto;min-height:42px;padding-inline:15px}
.hamrah-r5d-gallery .g113-device-media-grid{min-height:0;flex:1;overflow-y:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(94px,1fr));gap:6px;padding:4px 10px 116px;align-content:start;content-visibility:auto}
.hamrah-r5d-gallery .g113-media-tile{aspect-ratio:1/1;border-radius:13px;overflow:hidden;position:relative}.hamrah-r5d-gallery .g113-media-tile img{width:100%;height:100%;object-fit:cover;image-rendering:auto;transform:translateZ(0)}
.hamrah-r5d-gallery .g113-media-tile>i{width:30px;height:30px;min-width:30px;display:grid;place-items:center;inset-inline-end:7px;top:7px}
.hamrah-r5d-gallery .g113-media-footer{position:absolute;z-index:12;bottom:0;inset-inline:0;min-height:82px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:10px;background:linear-gradient(180deg,rgba(8,23,37,.88),rgba(8,23,37,.99) 22%);border-top:1px solid rgba(255,255,255,.09);backdrop-filter:blur(16px)}
.hamrah-r5d-gallery .g113-media-footer button{min-height:48px;border-radius:15px;padding-inline:12px}.hamrah-r5d-gallery #g113ConfirmMedia{justify-self:stretch}.hamrah-r5d-gallery #g113SystemPicker{justify-self:stretch}.hamrah-r5d-gallery #g113SelectedCount{text-align:center;font-size:11px;max-width:92px}
.hamrah-r5d-gallery .g113-selected-strip{position:absolute;z-index:13;bottom:calc(78px + env(safe-area-inset-bottom));inset-inline:8px;padding:6px;border-radius:15px;background:rgba(7,20,32,.92);backdrop-filter:blur(12px)}
#g113MediaPreview:not(.hidden){position:fixed;inset:0;z-index:160;display:grid;place-items:center;padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom));background:rgba(0,0,0,.92)}
.g113-r5d-preview-card{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:12px}.g113-r5d-preview-card>button{position:absolute;top:0;inset-inline-start:0;width:48px;height:48px;z-index:2;border-radius:16px;font-size:27px}.g113-r5d-preview-card img{max-width:100%;max-height:calc(100% - 64px);object-fit:contain;border-radius:12px}.g113-r5d-preview-loading{color:#dcecff}
.g119a-r5d-viewer-controls{display:flex;gap:5px;align-items:center}.g119a-r5d-viewer-controls button{min-width:48px;min-height:48px;padding:6px 8px;border-radius:14px;background:rgba(255,255,255,.1);color:#fff;border:1px solid rgba(255,255,255,.14);font-weight:800}.g119a-r5d-viewer-controls button.active{background:#168fd0}.g119a-r5d-viewer-controls button:disabled{opacity:.46}
.g119a-share-video-wrap{overflow:hidden;touch-action:none}.g119a-share-video{will-change:transform;transition:transform .08s linear,object-fit .18s ease!important}
.g119a-layer[data-focus="true"] .g119a-share-video{width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;transform-origin:50% 50%}
.g119a-layer[data-focus="true"] .g119a-share-actions{display:flex;gap:6px;align-items:center}.g119a-layer[data-focus="true"] .g119a-r5d-controls-hidden .g119a-share-header,.g119a-layer[data-focus="true"] .g119a-r5d-controls-hidden~.g119a-controls{opacity:0;pointer-events:none}
@media(max-width:430px){.hamrah-r5d-gallery .g113-device-media-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.hamrah-r5d-gallery .g113-media-footer{grid-template-columns:1fr auto 1fr}.g119a-r5d-viewer-controls button{min-width:45px;font-size:11px}.g119a-layer[data-focus="true"] .g119a-share-header{inset-inline:8px!important}}
@media(orientation:landscape) and (max-height:600px){.hamrah-r5d-gallery .g113-media-titlebar{min-height:54px;padding-block:6px}.hamrah-r5d-gallery .g113-device-media-grid{grid-template-columns:repeat(auto-fill,minmax(88px,1fr))}.hamrah-r5d-gallery .g113-media-footer{min-height:66px;padding-block:6px}.g119a-layer[data-focus="true"] .g119a-share-header{max-width:calc(100vw - 120px)}}
