.ksp-popup[hidden] {
    display: none !important;
}

.ksp-popup {
    align-items: center;
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    padding: 24px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 999999;
}

.ksp-popup__backdrop {
    background: rgba(0, 0, 0, 0.62);
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.ksp-popup__dialog {
    background: #ffffff;
    border: 6px solid #ffffff;
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38), 0 0 34px rgba(255, 255, 255, 0.34);
    max-height: min(86vh, 900px);
    max-width: min(92vw, 840px);
    overflow: hidden;
    position: relative;
    width: max-content;
}

.ksp-popup__close {
    align-items: center;
    background: #ffffff;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    color: #111827;
    cursor: pointer;
    display: flex;
    font-size: 30px;
    font-weight: 600;
    height: 42px;
    justify-content: center;
    line-height: 1;
    padding: 0 0 3px;
    position: absolute;
    right: 10px;
    top: 10px;
    transition: transform 160ms ease, box-shadow 160ms ease;
    width: 42px;
    z-index: 2;
}

.ksp-popup__close:hover,
.ksp-popup__close:focus {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    transform: translateY(-1px);
}

.ksp-popup__media-wrap {
    background: #ffffff;
    display: grid;
    max-height: calc(86vh - 12px);
    max-width: calc(92vw - 12px);
}

.ksp-popup__slide {
    display: none;
    grid-area: 1 / 1;
    margin: 0;
}

.ksp-popup__slide.is-active {
    display: block;
}

.ksp-popup__slide img {
    display: block;
    height: auto;
    max-height: calc(86vh - 12px);
    max-width: calc(92vw - 12px);
    object-fit: contain;
    width: auto;
}

.ksp-popup__controls {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    bottom: 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
    display: flex;
    gap: 10px;
    left: 50%;
    padding: 6px;
    position: absolute;
    transform: translateX(-50%);
}

.ksp-popup__nav {
    align-items: center;
    background: #111827;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    font-size: 28px;
    height: 34px;
    justify-content: center;
    line-height: 1;
    padding: 0 0 3px;
    width: 34px;
}

.ksp-popup__nav:hover,
.ksp-popup__nav:focus {
    background: #2271b1;
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.ksp-popup__counter {
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    min-width: 48px;
    text-align: center;
}

body.ksp-popup-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .ksp-popup {
        padding: 14px;
    }

    .ksp-popup__dialog {
        border-width: 4px;
        border-radius: 12px;
        max-height: 88vh;
        max-width: 94vw;
    }

    .ksp-popup__media-wrap,
    .ksp-popup__slide img {
        max-height: calc(88vh - 8px);
        max-width: calc(94vw - 8px);
    }

    .ksp-popup__close {
        height: 38px;
        right: 8px;
        top: 8px;
        width: 38px;
    }
}
