.kfg-lightbox {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(8, 14, 25, .97);
    color: #fff;
    overflow: hidden;
    box-sizing: border-box;
    font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.kfg-lightbox::backdrop { background: rgba(8, 14, 25, .85); }
.kfg-lightbox[open] { display: block; }
.kfg-lightbox [hidden] { display: none !important; }
.kfg-lightbox *, .kfg-lightbox *::before, .kfg-lightbox *::after { box-sizing: border-box; }
.kfg-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100%;
    padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.kfg-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 4px 12px; }
.kfg-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 18px; min-width: 0; }
.kfg-lightbox .kfg-title { color: #fff; font: 600 clamp(16px, 2.2vw, 21px)/1.3 system-ui, sans-serif; margin: 0; max-width: 70vw; overflow-wrap: anywhere; }
.kfg-counter { color: #d2dae7; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kfg-lightbox .kfg-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    cursor: pointer;
    font: 400 37px/1 system-ui, sans-serif;
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.kfg-lightbox .kfg-close { font-size: 31px; }
.kfg-lightbox .kfg-control:hover { background: rgba(255, 255, 255, .2); border-color: #fff; }
.kfg-lightbox .kfg-control:focus-visible, .kfg-lightbox a:focus-visible { outline: 3px solid #f2d080; outline-offset: 4px; }
.kfg-stage { min-height: 0; display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; gap: 10px; touch-action: pan-y pinch-zoom; }
.kfg-previous { grid-column: 1; }
.kfg-next { grid-column: 3; justify-self: end; }
.kfg-figure { grid-column: 2; grid-row: 1; margin: 0; height: 100%; min-width: 0; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.kfg-lightbox .kfg-photo { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; border: 0; border-radius: 2px; box-shadow: none; user-select: none; -webkit-user-select: none; }
.kfg-status { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; padding: 9px 14px; border-radius: 4px; background: rgba(8, 14, 25, .9); color: #fff; text-align: center; font-size: 14px; }
.kfg-status:empty { display: none; }
.kfg-footer { padding: 12px 4px 0; }
.kfg-caption { margin: 0 0 8px; text-align: center; font-size: 15px; max-height: 16vh; overflow-y: auto; overflow-wrap: anywhere; }
.kfg-details { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 18px; }
.kfg-help { font-size: 12px; color: #bac6d8; }
.kfg-lightbox .kfg-original { display: inline-flex; align-items: center; min-height: 44px; padding: 7px 0; color: #fff; font-size: 13px; text-underline-offset: 4px; text-decoration: underline; }
.kfg-lightbox .kfg-original:hover { color: #f2d080; }
.kfg-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
    .kfg-shell { padding-right: max(8px, env(safe-area-inset-right)); padding-left: max(8px, env(safe-area-inset-left)); }
    .kfg-toolbar { gap: 8px; padding: 0 4px 8px; }
    .kfg-heading { gap: 3px 12px; }
    .kfg-stage { grid-template-columns: 1fr; gap: 0; position: relative; }
    .kfg-figure { grid-column: 1; }
    .kfg-previous, .kfg-next { position: absolute; z-index: 1; top: 50%; transform: translateY(-50%); background: rgba(8, 14, 25, .75) !important; }
    .kfg-previous { left: 4px; }
    .kfg-next { right: 4px; }
    .kfg-caption { font-size: 14px; max-height: 12vh; }
    .kfg-details { justify-content: center; gap: 0 12px; }
    .kfg-help { text-align: center; }
    .kfg-footer { padding-top: 8px; }
}
@media (max-height: 500px) {
    .kfg-shell { padding-top: 5px; padding-bottom: 5px; }
    .kfg-toolbar { padding-bottom: 4px; }
    .kfg-footer { padding-top: 4px; }
    .kfg-help { display: none; }
    .kfg-caption { max-height: 10vh; margin-bottom: 0; }
    .kfg-original { min-height: 36px !important; padding: 2px 0 !important; }
}
@media (prefers-reduced-motion: reduce) { .kfg-lightbox, .kfg-lightbox * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
