.eg-gallery-popup.mfp-bg {
    background: #14232c;
    opacity: .78;
}

.eg-gallery-popup .mfp-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.eg-gallery-popup .mfp-container::before,
.eg-gallery-popup .mfp-figure::after {
    display: none;
}

.eg-gallery-popup .mfp-content {
    width: 1120px;
    max-width: 100%;
    margin: 0;
}

.eg-gallery-popup .eg-gallery {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) 96px;
    width: 100%;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    max-height: 900px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
}

.eg-gallery-popup .eg-gallery.mfp-loading {
    display: grid;
}

.eg-gallery__toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 44px;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    border-bottom: 1px solid #e7eef3;
}

.eg-gallery__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: #192d39;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.eg-gallery__counter {
    color: #697b87;
    font-size: 13px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.eg-gallery-popup button.eg-gallery__close,
.eg-gallery-popup button.eg-gallery__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: #213744;
    background: #fff;
    border: 1px solid #dce7ee;
    border-radius: 50%;
    font-size: 20px;
    opacity: 1;
    cursor: pointer;
}

.eg-gallery-popup button.eg-gallery__close {
    position: static;
}

.eg-gallery-popup button.eg-gallery__arrow {
    top: 50%;
    margin: 0;
    transform: translateY(-50%);
}

.eg-gallery-popup .mfp-arrow-left { left: 16px; }
.eg-gallery-popup .mfp-arrow-right { right: 16px; }
.eg-gallery-popup .mfp-arrow::before,
.eg-gallery-popup .mfp-arrow::after { display: none; }
.eg-gallery-popup button .icon { pointer-events: none; }

.eg-gallery-popup button:hover {
    background: #edfafd;
    border-color: #22bad7;
}

.eg-gallery-popup button:focus-visible {
    outline: 2px solid #22bad7;
    outline-offset: 3px;
}

.eg-gallery__stage {
    position: relative;
    min-height: 0;
    padding: 20px 76px;
    touch-action: pan-y;
}

.eg-gallery-popup img.mfp-img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none !important;
    padding: 0;
    margin: 0;
    object-fit: contain;
}

.eg-gallery__thumbs {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding: 12px 20px;
    border-top: 1px solid #e7eef3;
    background: #f7fafc;
    overscroll-behavior-x: contain;
}

.eg-gallery__thumb {
    flex: 0 0 68px;
    width: 68px;
    height: 68px;
    padding: 4px;
    border: 1px solid #dce7ee;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.eg-gallery__thumb[aria-pressed="true"] {
    border: 2px solid #22bad7;
    padding: 3px;
}

.eg-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (max-width: 767px) {
    .eg-gallery-popup .mfp-container { padding: 0; }
    .eg-gallery-popup .mfp-content { width: 100%; }
    .eg-gallery-popup .eg-gallery {
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        grid-template-rows: auto minmax(0, 1fr) 88px;
    }
    .eg-gallery__toolbar {
        gap: 10px;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px;
    }
    .eg-gallery__title { font-size: 13px; }
    .eg-gallery__counter { font-size: 12px; }
    .eg-gallery__stage { padding: 12px 48px; }
    .eg-gallery-popup button.eg-gallery__arrow { width: 36px; height: 36px; }
    .eg-gallery-popup .mfp-arrow-left { left: 6px; }
    .eg-gallery-popup .mfp-arrow-right { right: 6px; }
    .eg-gallery__thumbs { padding: 10px 12px; }
    .eg-gallery__thumb { flex-basis: 60px; width: 60px; height: 60px; }
}
