.image-preview-dialog {
    width: min(960px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    padding: 0;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.image-preview-dialog::backdrop {
    background: rgba(20, 25, 30, 0.72);
}

.image-preview-dialog-header {
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px 10px 18px;
    border-bottom: 1px solid var(--line);
}

.image-preview-dialog-header h2 {
    overflow: hidden;
    min-width: 0;
    margin: 0;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-preview-dialog-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.image-preview-zoom {
    min-width: 48px;
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.image-preview-index {
    min-width: 44px;
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.image-preview-control {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 19px;
}

.image-preview-nav {
    font-size: 24px;
    line-height: 1;
}

.image-preview-control:hover:not(:disabled) {
    color: var(--text);
    background: #ffffff;
    border-color: var(--line-strong, #d0d5dd);
}

.image-preview-control:focus-visible {
    outline: 3px solid rgba(23, 107, 91, 0.22);
    outline-offset: 2px;
}

.image-preview-control:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

.image-preview-stage {
    height: min(calc(100dvh - 88px), 704px);
    max-height: calc(100dvh - 88px);
    overflow: auto;
    padding: 16px;
    background: #15191d;
    overscroll-behavior: contain;
    touch-action: none;
}

.image-preview-stage.is-pannable {
    cursor: grab;
}

.image-preview-stage.is-panning {
    cursor: grabbing;
}

.image-preview-stage img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100dvh - 120px);
    margin: 0 auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

@media (max-width: 680px) {
    .image-preview-dialog {
        width: calc(100% - 20px);
        max-height: calc(100dvh - 20px);
    }

    .image-preview-dialog-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .image-preview-dialog-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .image-preview-stage {
        height: calc(100dvh - 74px);
        max-height: calc(100dvh - 74px);
        padding: 8px;
    }

    .image-preview-stage img {
        max-height: calc(100dvh - 90px);
    }
}
