.pbg-gallery-wrap {
    margin-top: 24px;
}

.pbg-gallery-grid {
    display: grid;
    gap: var(--pbg-gap, 14px);
}

.pbg-layout-grid {
    grid-template-columns: repeat(var(--pbg-columns, 3), minmax(0, 1fr));
}

.pbg-layout-grid .pbg-gallery-card {
    margin: 0;
}

.pbg-layout-masonry {
    display: block;
    column-count: var(--pbg-columns, 3);
    column-gap: var(--pbg-gap, 14px);
}

.pbg-layout-masonry .pbg-gallery-card {
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin: 0 0 var(--pbg-gap, 14px);
}

.pbg-layout-justified {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pbg-gap, 14px);
    align-items: flex-start;
    justify-content: flex-start;
}

.pbg-layout-justified .pbg-gallery-card {
    flex: 0 0 auto;
    margin: 0;
}

.pbg-gallery-item {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.pbg-gallery-card {
    content-visibility: auto;
    contain-intrinsic-size: 320px 320px;
}

.pbg-ratio-box {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    background: #f5f5f5;
}

.pbg-ratio-box img,
.pbg-gallery-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .25s ease, opacity .25s ease;
}

.pbg-ratio-original {
    padding-top: 0 !important;
}

.pbg-ratio-original img,
.pbg-ratio-original .pbg-gallery-image {
    position: static;
    width: 100%;
    height: auto;
}

.pbg-justified-box img,
.pbg-justified-box .pbg-gallery-image {
    position: static;
    width: 100%;
    height: 100% !important;
}

.pbg-gallery-item:hover .pbg-ratio-box img {
    transform: scale(1.025);
    opacity: .96;
}

.pbg-gallery-caption {
    display: grid;
    gap: 4px;
    margin-top: 8px;
}

.pbg-gallery-title {
    font-size: 15px;
    line-height: 1.4;
}

.pbg-gallery-desc {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

.pbg-player {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    gap: 14px;
    align-items: center;
}

.pbg-player-stage {
    position: relative;
    min-height: 52vh;
    width: 100%;
    border: none;
    padding: 0;
    background: #111;
    color: #fff;
    border-radius: 18px;
    overflow: hidden;
    cursor: zoom-in;
}

.pbg-player-media {
    display: block;
    width: 100%;
    height: 100%;
}

.pbg-player-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #111;
}

.pbg-player-open-hint {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.52);
    color: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    line-height: 1;
    backdrop-filter: blur(4px);
}

.pbg-player-nav {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    color: #111;
    font-size: 34px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pbg-player-meta {
    grid-column: 1 / -1;
    text-align: center;
    display: grid;
    gap: 6px;
    margin-top: 4px;
}

.pbg-player-counter {
    font-size: 13px;
    color: #666;
}

.pbg-player-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.pbg-player-caption {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
}

.pbg-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    display: none;
    z-index: 99999;
}

.pbg-lightbox.is-open {
    display: block;
}

.pbg-lightbox-dialog {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-height: none;
}

.pbg-lightbox-content {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 0;
    height: 100%;
}

.pbg-lightbox-stage {
    overflow: auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
    padding: 72px 88px 120px;
    box-sizing: border-box;
}

.pbg-lightbox-stage.is-zoomed {
    cursor: grab;
}

.pbg-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    border-radius: 14px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
    transition: transform .2s ease;
    transform-origin: center center;
}

.pbg-lightbox-meta {
    color: #fff;
    text-align: center;
    display: grid;
    gap: 4px;
    padding: 0 24px 20px;
}

.pbg-lightbox-counter {
    font-size: 13px;
    opacity: 0.82;
}

.pbg-lightbox-title {
    font-size: 16px;
    font-weight: 600;
}

.pbg-lightbox-caption {
    font-size: 14px;
    opacity: 0.92;
}

.pbg-lightbox-close,
.pbg-lightbox-nav,
.pbg-lightbox-toolbar button {
    position: absolute;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    backdrop-filter: blur(6px);
}

.pbg-lightbox-close {
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    font-size: 26px;
    line-height: 1;
    z-index: 3;
}

.pbg-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 999px;
    font-size: 34px;
    line-height: 1;
    z-index: 3;
}

.pbg-lightbox-prev {
    left: 18px;
}

.pbg-lightbox-next {
    right: 18px;
}

.pbg-lightbox-toolbar {
    position: absolute;
    left: 18px;
    top: 18px;
    display: flex;
    gap: 8px;
    z-index: 3;
}

.pbg-lightbox-toolbar button {
    position: static;
    min-width: 42px;
    height: 42px;
    border-radius: 999px;
    font-size: 16px;
    padding: 0 14px;
}

@media (max-width: 960px) {
    .pbg-layout-grid {
        grid-template-columns: repeat(var(--pbg-mobile-columns, 2), minmax(0, 1fr));
    }

    .pbg-layout-masonry {
        column-count: var(--pbg-mobile-columns, 2);
    }

    .pbg-player {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 8px;
    }

    .pbg-player-stage {
        min-height: 42vh;
        border-radius: 14px;
    }

    .pbg-player-nav {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }

    .pbg-player-open-hint {
        bottom: 12px;
        font-size: 12px;
        padding: 7px 12px;
    }

    .pbg-lightbox-stage {
        padding: 70px 16px 110px;
    }

    .pbg-lightbox-nav {
        width: 42px;
        height: 42px;
        font-size: 28px;
    }

    .pbg-lightbox-prev {
        left: 6px;
    }

    .pbg-lightbox-next {
        right: 6px;
    }

    .pbg-lightbox-close {
        top: 6px;
        right: 6px;
        width: 38px;
        height: 38px;
        font-size: 24px;
    }

    .pbg-lightbox-toolbar {
        top: 6px;
        gap: 6px;
    }

    .pbg-lightbox-toolbar button {
        min-width: 38px;
        height: 38px;
        padding: 0 10px;
        font-size: 14px;
    }
}


.pbg-player-thumbs {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 2px;
    scroll-behavior: smooth;
}

.pbg-player-thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f3f3;
    cursor: pointer;
}

.pbg-player-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pbg-player-thumb.is-active {
    border-color: #111;
}
