.file-gallery {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #0b0f19;
    color: #fff;
    overflow: hidden;
}

.file-gallery::backdrop {
    background: #000;
}

.file-gallery[open] {
    display: block;
    animation: galleryFadeIn .22s ease both;
}

.file-gallery[open] .gallery-limit-area {
    animation: galleryStageIn .28s cubic-bezier(.2, .8, .2, 1) both;
}

.file-gallery.is-closing {
    animation: galleryFadeOut .18s ease forwards;
}

.file-gallery.is-closing .gallery-limit-area {
    animation: galleryStageOut .18s ease forwards;
}

.file-gallery .file-gallery-count {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    left: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #f8fafc;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
    transform: translateX(-50%);
}

.file-gallery .gallery-limit-area {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0b0f19;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.file-gallery .gallery-track {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.file-gallery .gallery-track .gallery-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.file-gallery .gallery-track .gallery-slide.is-sliding-next {
    animation: gallerySlideNext .26s cubic-bezier(.2, .8, .2, 1) both;
}

.file-gallery .gallery-track .gallery-slide.is-sliding-prev {
    animation: gallerySlidePrev .26s cubic-bezier(.2, .8, .2, 1) both;
}

.file-gallery .gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform .22s ease, opacity .18s ease;
    opacity: 0;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: auto;
}

.file-gallery .gallery-image.is-loaded {
    opacity: 1;
}

.file-gallery .gallery-image.is-zoomed {
    cursor: grab;
}

.file-gallery .gallery-image.is-dragging {
    cursor: grabbing;
}

.file-gallery .gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 46px;
    height: 58px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 10px;
    background: rgba(15, 23, 42, .42);
    color: #fff;
    cursor: pointer;
    transform: translateY(-50%);
    backdrop-filter: blur(4px);
    transition: background .18s ease, opacity .18s ease;
}

.file-gallery .gallery-arrow:hover {
    background: rgba(255, 255, 255, .14);
}

.file-gallery .gallery-arrow:disabled {
    opacity: 0;
    pointer-events: none;
}

.file-gallery .gallery-arrow.gallery-prev {
    left: 14px;
}

.file-gallery .gallery-arrow.gallery-next {
    right: 14px;
}

.file-gallery .gallery-loader {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 72px 24px 96px;
    background: #0b0f19;
    color: #94a3b8;
    text-align: center;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
}

.file-gallery .gallery-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.file-gallery .gallery-loader p {
    margin: 0;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
}

.file-gallery .gallery-loader.is-error .gallery-skeleton {
    animation: none;
    opacity: .35;
}

.file-gallery .gallery-skeleton {
    width: min(76vw, 760px);
    height: min(52vh, 420px);
    border-radius: 16px;
    background: linear-gradient(100deg, #131a2a 15%, #1d2740 35%, #131a2a 55%);
    background-size: 220% 100%;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
    animation: gallerySkeletonShimmer 1.15s linear infinite;
}

.file-gallery .gallery-actions {
    position: absolute;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 50%;
    z-index: 4;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    user-select: none;
    transform: translateX(-50%);
}

.file-gallery .gallery-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: .85rem 1rem;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 8px;
    background: rgba(15, 23, 42, .55);
    color: #eeee;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background .18s ease, box-shadow .18s ease, transform .15s ease;
}

.file-gallery .gallery-action:hover {
    background: rgba(255, 255, 255, .16);
    box-shadow: 0 0 12px rgba(255, 255, 255, .18);
}

.file-gallery .gallery-action:active {
    transform: scale(.97);
}

@keyframes galleryFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes galleryFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes galleryStageIn {
    from { opacity: 0; transform: scale(.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes galleryStageOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(.97); }
}

@keyframes gallerySlideNext {
    from { opacity: 0; translate: 32px 0; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes gallerySlidePrev {
    from { opacity: 0; translate: -32px 0; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes gallerySkeletonShimmer {
    from { background-position: 120% 0; }
    to { background-position: -120% 0; }
}

@media (max-width: 575.98px) {
    .file-gallery .gallery-arrow {
        display: none;
    }

    .file-gallery .gallery-loader {
        padding-bottom: 110px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .file-gallery,
    .file-gallery .gallery-limit-area,
    .file-gallery .gallery-slide,
    .file-gallery .gallery-image,
    .file-gallery .gallery-skeleton {
        animation: none !important;
        transition: none !important;
    }
}
