.mpv-backdrop {
    align-items: center;
    background: rgba(0, 0, 0, .70);
    display: flex;
    inset: 0;
    justify-content: center;
    opacity: 0;
    padding: 24px;
    pointer-events: none;
    position: fixed;
    transition: opacity .20s ease, visibility .20s ease;
    visibility: hidden;
    z-index: 2147483000;
}

.mpv-backdrop[hidden] {
    display: none !important;
}

.mpv-backdrop.mpv-visible {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.mpv-dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 70px rgba(0, 0, 0, .35);
    max-height: min(520px, calc(100vh - 80px));
    max-width: min(760px, calc(100vw - 40px));
    position: relative;
}

.mpv-link {
    display: block;
    line-height: 0;
}

.mpv-image {
    border-radius: 12px;
    display: block;
    height: auto;
    max-height: min(520px, calc(100vh - 80px));
    max-width: min(760px, calc(100vw - 40px));
    object-fit: contain;
    width: auto;
}

.mpv-close {
    align-items: center;
    background: #fff;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .28);
    color: #252525;
    cursor: pointer;
    display: flex;
    font-family: Arial, sans-serif;
    font-size: 25px;
    height: 38px;
    justify-content: center;
    line-height: 1;
    padding: 0 0 3px;
    position: absolute;
    right: -14px;
    top: -14px;
    transition: background-color .15s ease, transform .15s ease;
    width: 38px;
    z-index: 2;
}

.mpv-close:hover,
.mpv-close:focus-visible {
    background: #f0f0f0;
    transform: scale(1.05);
}

.mpv-close:focus-visible {
    outline: 3px solid rgba(30, 115, 190, .45);
    outline-offset: 2px;
}

html.mpv-lock {
    overflow: hidden;
}

@media (max-width: 640px) {
    .mpv-backdrop {
        padding: 18px;
    }

    .mpv-dialog,
    .mpv-image {
        max-height: calc(100vh - 64px);
        max-width: calc(100vw - 36px);
    }

    .mpv-dialog {
        width: calc(100vw - 36px);
    }

    .mpv-image {
        width: 100%;
    }

    .mpv-close {
        right: -8px;
        top: -14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mpv-backdrop,
    .mpv-close {
        transition: none;
    }
}
