.compact-file-choice .compact-file-reselect,
.compact-file-choice .compact-file-name:empty,
.compact-file-side {
    display: none;
}

.compact-file-choice:has(.compact-file-name:not(:empty)) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 10px;
    min-height: 0;
    text-align: start;
}

.compact-file-choice:has(.compact-file-name:not(:empty)) .tool-drop-zone-content {
    display: none;
}

.compact-file-choice:has(.compact-file-name:not(:empty)) .compact-file-reselect {
    display: inline-flex;
    flex-shrink: 0;
    max-width: 55%;
    overflow-wrap: anywhere;
}

.compact-file-choice:has(.compact-file-name:not(:empty)) .compact-file-side {
    display: inline;
    overflow-wrap: anywhere;
}

.compact-file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 340px) and (max-width: 640px) {
    #po-settings[data-page-mode="number"] .tool-form-grid,
    #fs-split-input .tool-form-grid,
    #spdf-root .spdf-settings,
    #spreadsheet-converter .tool-form-grid,
    #lp-root[data-mode="poster"] .lp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #po-settings[data-page-mode="number"] .tool-form-grid {
        column-gap: 8px;
        row-gap: 6px;
    }

    #po-settings[data-page-mode="number"] .tool-label {
        margin-bottom: 4px;
    }

    #po-settings[data-page-mode="number"] .tool-field-control,
    #fs-split-input .tool-field-control,
    #spdf-root .tool-field-control,
    #lp-root[data-mode="poster"] .tool-field-control {
        max-width: 100%;
    }

    #fs-split-input .tool-form-field:has(#fs-source) {
        grid-column: 1 / -1;
    }

    #ps-settings {
        margin-top: 4px;
    }
}
