* {
    box-sizing: border-box;
}

.mc-lb-overlay {
    --mc-lb-accent: var(--color--background--accent-1, rgba(255, 255, 255, 0.12));
    --mc-lb-accent-hover: var(--color--background--accent-1-hover, rgba(255, 255, 255, 0.25));
    --mc-lb-accent-text: #1e2122;

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
    padding: 0;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-tap-highlight-color: transparent;
}

.mc-lb-overlay.mc-lb-active {
    opacity: 1;
    visibility: visible;
}

.mc-lb-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
        padding: 8px;
        --mc-lb-padding-block: 5dvh;
        padding-block: 5vh;
        padding-block: var(--mc-lb-padding-block);
}

.mc-lb-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    margin: 0 auto;
    transition: transform 0.15s ease-out;
}

.mc-lb-video {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    background: #000;
    border-radius: 10px;
    margin: 0 auto;
    outline: none;
}

.mc-lb-video:fullscreen,
.mc-lb-video:-webkit-full-screen,
.mc-lb-video:-moz-full-screen,
.mc-lb-video:-ms-fullscreen {
    max-height: none;
    max-width: none;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: #000;
}

.mc-lb-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--mc-lb-accent-text);
    cursor: pointer;
    z-index: 1000000;
    background: var(--mc-lb-accent);
    border: none;
    transition: background 0.2s ease;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.mc-lb-close-icon {
    display: block;
    width: 24px;
    height: 24px;
}

.mc-lb-prev,
.mc-lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mc-lb-accent-text);
    font-size: 36px;
    background: var(--mc-lb-accent);
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mc-lb-close:hover,
.mc-lb-prev:hover,
.mc-lb-next:hover {
    background: var(--mc-lb-accent-hover);
}

.mc-lb-prev { left: 10px; }
.mc-lb-next { right: 10px; }

.mc-lb-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--mc-lb-accent-text);
    font-size: 14px;
    font-family: sans-serif;
    background: var(--mc-lb-accent);
    padding: 4px 12px;
    border-radius: 12px;
    z-index: 1000000;
    pointer-events: none;
}

.mc-lb-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mc-spin 0.8s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -20px 0 0 -20px;
}

@keyframes mc-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .mc-lb-container {
        padding: 6px;
    }

    .mc-lb-image {
        max-width: 100%;
        max-height: 100%;
    }

    .mc-lb-close {
        width: 44px;
        height: 44px;
        top: 8px;
        right: 8px;
    }

    .mc-lb-close-icon {
        width: 22px;
        height: 22px;
    }

    .mc-lb-prev,
    .mc-lb-next {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .mc-lb-prev,
    .mc-lb-next {
        display: none;
    }
}

@media (orientation: landscape) and (max-height: 480px) {
    .mc-lb-container {
        padding: 2px;
    }

    .mc-lb-image {
        max-width: 100%;
        max-height: 100%;
    }

    .mc-lb-close {
        width: 40px;
        height: 40px;
        top: 6px;
        right: 6px;
    }

    .mc-lb-close-icon {
        width: 20px;
        height: 20px;
    }

    .mc-lb-counter {
        bottom: 6px;
    }
}
