body.ugl-open {
    overflow: hidden;
}

.ugl-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.ugl-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.ugl-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 10, 0.94);
    transition: background 0.28s ease;
}

.ugl-shell {
    position: relative;
    z-index: 2;
    width: min(96vw, 1600px);
    height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    align-items: center;
    gap: 12px;
    padding: 24px 12px;
}

.ugl-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-height: 100%;
}

.ugl-image {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    background: #111;
    opacity: 1;
    transform: scale(1);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
    will-change: opacity, transform;
}

.ugl-overlay.is-switching .ugl-image {
    opacity: 0.72;
    transform: scale(0.985);
}

.ugl-caption-wrap {
    width: 100%;
    max-width: 1000px;
    text-align: center;
    color: #fff;
    padding-top: 16px;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.ugl-overlay.is-switching .ugl-caption-wrap {
    opacity: 0.65;
    transform: translateY(4px);
}

.ugl-counter {
    font-size: 0.9rem;
    opacity: 0.75;
    margin-bottom: 8px;
}

.ugl-caption {
    font-size: 1rem;
    line-height: 1.5;
    opacity: 0.92;
}

.ugl-nav,
.ugl-close {
    appearance: none;
    border: 0;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        background 0.2s ease,
        transform 0.2s ease,
        opacity 0.2s ease;
}

.ugl-nav {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    font-size: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    justify-self: center;
}

.ugl-nav:hover,
.ugl-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.03);
}

.ugl-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    font-size: 32px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

@media (max-width: 980px) {
    .ugl-shell {
        grid-template-columns: 56px minmax(0, 1fr) 56px;
        width: 100vw;
        padding: 20px 8px;
    }

    .ugl-nav {
        width: 46px;
        height: 46px;
        font-size: 24px;
    }

    .ugl-image {
        max-height: calc(100vh - 140px);
    }

    .ugl-caption {
        font-size: 0.95rem;
    }
}

@media (max-width: 640px) {
    .ugl-shell {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 10px 18px;
    }

    .ugl-stage {
        order: 1;
    }

    .ugl-prev,
    .ugl-next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 15;
    }

    .ugl-prev {
        left: 10px;
    }

    .ugl-next {
        right: 10px;
    }

    .ugl-nav:hover {
        transform: translateY(-50%) scale(1.03);
    }

    .ugl-close {
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
        font-size: 28px;
    }

    .ugl-image {
        max-height: calc(100vh - 170px);
    }
}