.ipopup-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(14px, 3vw, 36px);
    background: rgba(5, 8, 14, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
    box-sizing: border-box;
}

.ipopup-overlay.ipopup-is-visible {
    opacity: 1;
    visibility: visible;
}

.ipopup-shell {
    position: relative;
    max-width: min(92vw, 1400px);
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(10px) scale(.985);
    transition: transform .22s ease;
}

.ipopup-overlay.ipopup-is-visible .ipopup-shell {
    transform: translateY(0) scale(1);
}

.ipopup-link {
    display: block;
    line-height: 0;
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none !important;
    outline: none;
}

.ipopup-image {
    display: block;
    width: auto;
    height: auto;
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 22px 65px rgba(0, 0, 0, .48);
}

.ipopup-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 3;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: rgba(17, 24, 39, .96);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    transition: transform .16s ease, background .16s ease;
    padding: 0;
}

.ipopup-close span {
    display: block;
    font-size: 30px;
    line-height: 38px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 300;
    transform: translateY(-1px);
}

.ipopup-close:hover,
.ipopup-close:focus-visible {
    transform: scale(1.06);
    background: #000;
    outline: 2px solid rgba(255,255,255,.8);
    outline-offset: 2px;
}

body.ipopup-lock {
    overflow: hidden !important;
    touch-action: none;
}

@media (max-width: 782px) {
    .ipopup-overlay {
        padding: 14px;
    }

    .ipopup-shell {
        max-width: 94vw;
        max-height: 94vh;
    }

    .ipopup-image {
        max-width: 94vw;
        max-height: 90vh;
        border-radius: 14px;
    }

    .ipopup-link {
        border-radius: 14px;
    }

    .ipopup-close {
        top: -11px;
        right: -8px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 420px) {
    .ipopup-overlay {
        padding: 10px;
    }

    .ipopup-image {
        max-width: 96vw;
        max-height: 91vh;
        border-radius: 12px;
    }

    .ipopup-close {
        top: -8px;
        right: -4px;
        width: 38px;
        height: 38px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ipopup-overlay,
    .ipopup-shell,
    .ipopup-close {
        transition: none !important;
    }
}
