:root { --ml-accent: #7c5cff; --ml-text: #f7f7fb; }

body.ml-locked { overflow: hidden !important; }

.ml-overlay {
    position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center;
    padding: 28px; color: var(--ml-text); background: rgba(7, 8, 14, .86);
    -webkit-backdrop-filter: blur(22px) saturate(130%); backdrop-filter: blur(22px) saturate(130%);
    opacity: 0; visibility: hidden; transition: opacity .32s ease, visibility .32s ease;
    font-family: Inter, Poppins, system-ui, sans-serif;
}
.ml-overlay::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(circle at 20% 20%, rgba(124,92,255,.16), transparent 35%),
                radial-gradient(circle at 80% 80%, rgba(0,209,255,.11), transparent 36%);
}
.ml-overlay.is-open { opacity: 1; visibility: visible; }
.ml-stage { position: relative; width: min(1180px, 100%); height: min(82vh, 850px); display: grid; place-items: center; }
.ml-media-wrap {
    position: relative; display: grid; place-items: center; max-width: 100%; max-height: 100%;
    transform: translateY(18px) scale(.965); opacity: 0;
    transition: transform .42s cubic-bezier(.2,.8,.2,1), opacity .3s ease;
}
.is-open .ml-media-wrap { transform: none; opacity: 1; }
.ml-image {
    display: block; max-width: min(100%, 1120px); max-height: 76vh; object-fit: contain;
    border-radius: 16px; box-shadow: 0 30px 90px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.12);
    user-select: none; transition: opacity .18s ease, transform .35s cubic-bezier(.2,.8,.2,1);
}
.ml-image.is-switching { opacity: 0; transform: scale(.975); }
.ml-image.is-zoomed { transform: scale(1.65); cursor: zoom-out; }
.ml-loader {
    position: absolute; width: 42px; height: 42px; border: 3px solid rgba(255,255,255,.18);
    border-top-color: #fff; border-radius: 50%; animation: ml-spin .75s linear infinite; display: none;
}
.ml-loader.is-active { display: block; }
@keyframes ml-spin { to { transform: rotate(360deg); } }
.ml-toolbar { position: absolute; z-index: 3; top: 20px; right: 22px; display: flex; gap: 10px; }
.ml-button {
    width: 46px; height: 46px; border: 1px solid rgba(255,255,255,.15); border-radius: 14px;
    display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.09);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); cursor: pointer;
    transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.ml-button:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); transform: translateY(-2px); }
.ml-button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.ml-nav { position: absolute; z-index: 3; top: 50%; transform: translateY(-50%); }
.ml-prev { left: 22px; } .ml-next { right: 22px; }
.ml-nav[hidden] { display: none; }
.ml-footer {
    position: absolute; z-index: 3; left: 50%; bottom: 18px; transform: translateX(-50%);
    min-width: 160px; max-width: calc(100% - 150px); padding: 10px 15px; border-radius: 14px;
    text-align: center; background: rgba(13,14,22,.7); border: 1px solid rgba(255,255,255,.1);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.ml-caption { font-size: 13px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-counter { color: rgba(255,255,255,.62); font-size: 11px; letter-spacing: .12em; margin-top: 2px; }
.ml-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; overflow: hidden; }
.ml-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--ml-accent), #00d1ff); transition: width .35s ease; }

@media (max-width: 700px) {
    .ml-overlay { padding: 12px; }
    .ml-stage { height: 84vh; }
    .ml-image { max-height: 72vh; border-radius: 12px; }
    .ml-toolbar { top: 12px; right: 12px; }
    .ml-button { width: 42px; height: 42px; border-radius: 13px; }
    .ml-prev { left: 10px; } .ml-next { right: 10px; }
    .ml-nav { top: auto; bottom: 16px; transform: none; }
    .ml-footer { bottom: 17px; max-width: calc(100% - 130px); padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .ml-overlay, .ml-media-wrap, .ml-image, .ml-button { transition-duration: .01ms !important; }
}
