#galleryViewer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    color: #fff;
    background: rgba(3, 7, 18, .97);
    overflow: hidden;
}
#galleryViewer::backdrop { background: rgba(0, 0, 0, .8); }
#galleryViewer .gallery-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 76px 76px 64px;
    box-sizing: border-box;
    pointer-events: none;
}
#galleryViewerImage {
    display: block;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    object-fit: contain;
    pointer-events: auto;
    touch-action: pan-y pinch-zoom;
}
#galleryCaption {
    margin: 12px 0 0;
    text-align: center;
    color: #d1d5db;
    font-size: 14px;
}
#galleryViewer button {
    position: absolute;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 50%;
    background: #1f2937;
    color: #fff;
    font: inherit;
    font-size: 28px;
    cursor: pointer;
    z-index: 1;
}
#galleryViewer button:hover { background: #166534; }
#galleryViewer button:focus-visible { outline: 3px solid #4ade80; outline-offset: 4px; }
#galleryClose { top: max(16px, env(safe-area-inset-top)); right: 16px; }
#galleryCounter { position: absolute; top: max(28px, env(safe-area-inset-top)); left: 24px; font-size: 16px; }
#galleryPrevious { top: calc(50% - 24px); left: 16px; }
#galleryNext { top: calc(50% - 24px); right: 16px; }
@media (max-width: 640px) {
    #galleryViewer .gallery-stage { padding: 76px 12px 110px; }
    #galleryPrevious { top: auto; bottom: max(24px, env(safe-area-inset-bottom)); left: calc(50% - 64px); }
    #galleryNext { top: auto; bottom: max(24px, env(safe-area-inset-bottom)); right: calc(50% - 64px); }
}
