.zfg {
    --zfg-line: #dce1df;
    --zfg-text: #202a27;
    margin: 0;
    min-width: 0;
    color: var(--zfg-text);
}

.zfg-frame {
    position: relative;
    border: 1px solid var(--zfg-line);
    border-radius: 12px;
    overflow: hidden;
    background: #f7f7f6;
}

.zfg-stage {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    max-height: 560px;
    touch-action: pan-y;
    cursor: zoom-in;
}

.zfg-stage img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.zfg-step, .zfg-rotate {
    display: grid;
    place-items: center;
    min-height: 44px;
    border: 1px solid var(--zfg-line);
    border-radius: 24px;
    background: #fff;
    color: var(--zfg-text);
    cursor: pointer;
}
.zfg [hidden] { display: none; }
.zfg-step {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    font-size: 26px;
    line-height: 1;
}
.zfg-prev { left: 8px; }
.zfg-next { right: 8px; }
.zfg-rotate { padding: 5px 14px; font-size: 13px; font-weight: 700; text-align: center; }
.zfg-step:hover, .zfg-rotate:hover { background: #eef4df; }
.zfg-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-block: 8px; font-size: 13px; }
.zfg-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 3px; margin-inline: -3px; }
.zfg-thumb {
    position: relative;
    display: block;
    flex: 0 0 clamp(48px, 13vw, 68px);
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid var(--zfg-line);
    border-radius: 8px;
    background: #fafafa;
}
.zfg-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.zfg-thumb[aria-current] { border-color: #557018; box-shadow: inset 0 0 0 1px #557018; }
.zfg-thumb span { position: absolute; bottom: 2px; right: 3px; border-radius: 4px; background: #fff; color: #202a27; padding: 0 4px; font-size: 11px; font-weight: 700; }
.zfg-note { margin: 8px 0 0; font-size: 12px; line-height: 1.4; }
.zfg :focus-visible { outline: 2px solid #557018; outline-offset: 2px; }
.zfg-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 8px; }
.zfg-controls .zfg-rotate[aria-pressed=true] { background: #edf4d5; border-color: #557018; }
.zfg-frame:fullscreen .zfg-stage { height: 100%; max-height: none; }
.zfg-product-rotation { margin-block-start: .9rem; }
.zfg-product-rotation > button {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border-color: var(--primary, #557018);
}
.zfg-product-rotation > button span { font-size: 1.2rem; line-height: 1; }
.zfg-dialog {
    width: min(92vw, 650px);
    max-width: none;
    max-height: 92dvh;
    margin: auto;
    padding: clamp(.7rem, 2.5vw, 1.3rem);
    border: 1px solid var(--zfg-line);
    border-radius: 16px;
    color: var(--zfg-text);
    background: #fff;
    overflow: auto;
}
.zfg-dialog::backdrop { background: #111c19bf; }
.zfg-dialog-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-block-end: .7rem; }
.zfg-dialog-bar button { width: 44px; padding: 0; font-size: 1.35rem; }
.zfg-dialog .zfg-stage { aspect-ratio: auto; height: clamp(180px, 54dvh, 480px); cursor: grab; }
.zfg-dialog .zfg-stage:active { cursor: grabbing; }
.zfg-dialog .zfg-frame:fullscreen .zfg-stage { height: 100%; }
.zfg-dialog [data-zfg-status] { font-weight: 700; font-variant-numeric: tabular-nums; }
