html:has(.cinema-gallery[open]){overflow:hidden;scrollbar-gutter:stable}
.gallery-dialog.cinema-gallery[open]{
 display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto auto auto;
 width:min(1280px,calc(100vw - 48px));height:min(920px,calc(100dvh - 48px));max-width:none;max-height:none;
 margin:auto;padding:64px 28px 20px;gap:12px;border:1px solid #36383b;border-radius:8px;
 background:#111315;color:#f7f7f8;overflow:hidden;box-shadow:0 24px 96px #0009;color-scheme:dark;
}
.gallery-dialog.cinema-gallery::backdrop{background:#07090bed;backdrop-filter:blur(5px)}
.gallery-dialog.cinema-gallery>img{
 display:block;grid-row:1;width:100%;height:100%;max-width:100%;max-height:100%;min-width:0;min-height:0;
 aspect-ratio:auto;object-fit:contain;object-position:center;background:transparent;border:0;border-radius:0;
 filter:none;touch-action:pan-y pinch-zoom;transition:opacity .16s ease;
}
.gallery-dialog.cinema-gallery[data-image-state=loading]>img{opacity:.25}
.gallery-dialog.cinema-gallery[data-image-state=error]>img{opacity:0}
.gallery-dialog.cinema-gallery>p{
 grid-row:2;max-width:900px;justify-self:center;margin:0;color:#e4e5e8;font-size:13px;line-height:1.6;
 text-align:center;overflow:auto;max-height:72px;padding:0 6px;white-space:normal;overflow-wrap:anywhere;
}
.gallery-dialog.cinema-gallery .gallery-controls{grid-row:3;display:flex;align-items:center;justify-content:center;gap:18px;margin:0;padding:0;min-height:44px}
.gallery-dialog.cinema-gallery .gallery-counter{color:#c9cbd0;font-size:12px;font-variant-numeric:tabular-nums;min-width:60px;text-align:center}
.gallery-dialog.cinema-gallery .icon-button{
 display:grid;place-items:center;flex:none;width:44px;height:44px;min-width:44px;min-height:44px;padding:10px;
 color:#fff;background:#25282c;border:1px solid #4a4e54;border-radius:50%;cursor:pointer;
}
.gallery-dialog.cinema-gallery .icon-button:hover{background:#3b3f45;border-color:#c4c6cb}
.gallery-dialog.cinema-gallery .icon-button:disabled{opacity:.35;cursor:default}
.gallery-dialog.cinema-gallery .icon-button svg{width:20px;height:20px}
.gallery-dialog.cinema-gallery .gallery-close{position:absolute;inset:12px 16px auto auto;z-index:2}
.gallery-dialog.cinema-gallery>.gallery-thumbnails{
 grid-row:4;display:flex;justify-content:start;gap:8px;width:100%;min-width:0;min-height:68px;overflow-x:auto;
 overflow-y:hidden;overscroll-behavior-x:contain;padding:5px 2px;scrollbar-width:thin;scrollbar-color:#73777d #111315;
}
.gallery-dialog.cinema-gallery .gallery-thumbnails button{
 width:76px;height:56px;flex:0 0 76px;padding:2px;border:1px solid #50545a;border-radius:4px;background:#202327;opacity:.65;cursor:pointer;
}
.gallery-dialog.cinema-gallery .gallery-thumbnails button[aria-pressed=true]{border-color:#edbfc6;box-shadow:0 0 0 1px #edbfc6;opacity:1}
.gallery-dialog.cinema-gallery .gallery-thumbnails img{display:block;width:100%;height:100%;object-fit:cover;border-radius:2px}
.gallery-dialog.cinema-gallery .gallery-load-status{position:absolute;top:42%;left:50%;transform:translate(-50%,-50%);width:min(80%,480px);text-align:center;font-size:13px;line-height:1.6;color:#f2f2f4;pointer-events:none}
.gallery-dialog.cinema-gallery [hidden]{display:none}
.gallery-dialog.cinema-gallery button:focus-visible{outline:2px solid #f2c1c9;outline-offset:3px}
@media(max-width:700px){
 .gallery-dialog.cinema-gallery[open]{width:100vw;height:100dvh;border:0;border-radius:0;padding:64px 12px max(14px,env(safe-area-inset-bottom));gap:10px}
 .gallery-dialog.cinema-gallery>p{font-size:12px;max-height:76px;line-height:1.5}
 .gallery-dialog.cinema-gallery .gallery-close{right:12px;top:max(12px,env(safe-area-inset-top))}
 .gallery-dialog.cinema-gallery .gallery-thumbnails button{width:64px;height:48px;flex-basis:64px}
 .gallery-dialog.cinema-gallery>.gallery-thumbnails{min-height:60px}
}
@media(max-height:500px) and (orientation:landscape){
 .gallery-dialog.cinema-gallery[open]{width:100vw;height:100dvh;border:0;border-radius:0;padding:12px 70px;grid-template-rows:minmax(0,1fr) auto auto;gap:6px}
 .gallery-dialog.cinema-gallery>.gallery-thumbnails{display:none}
 .gallery-dialog.cinema-gallery>p{max-height:40px;font-size:11px}
 .gallery-dialog.cinema-gallery .gallery-controls{min-height:36px}
 .gallery-dialog.cinema-gallery .icon-button{width:36px;height:36px;min-height:36px;min-width:36px;padding:8px}
}
@media(prefers-reduced-motion:reduce){.gallery-dialog.cinema-gallery>img{transition:none}.gallery-dialog.cinema-gallery::backdrop{backdrop-filter:none}}
