.file-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.file-drop__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 2px dashed var(--primary-color);
    border-radius: 0.5rem;
    background: var(--surface-color);
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.file-drop__overlay .material-symbols-outlined,
.file-drop__overlay .material-icons,
#open-file-button .material-icons,
#open-file-button .material-symbols-outlined {
    font-family: "Material Symbols Outlined", var(--font-sans);
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 400;
    font-style: normal;
    display: inline-flex;
    color: inherit;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.file-drop__overlay .material-symbols-outlined,
.file-drop__overlay .material-icons {
    color: var(--primary-color);
}

#open-file-button {
    font-family: var(--font-sans);
}

.input-section.is-dragover .file-drop__overlay {
    opacity: 1;
    visibility: visible;
}

.input-section.is-dragover #input-text {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--focus-field-ring);
}

.field-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.45rem;
}

.field-meta-row .field-meta {
    margin-top: 0;
}

.file-drop__hint {
    margin: 0;
    color: var(--meta-color);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.35;
}

/* Cleanup sits above the action row in whichever panel currently holds the
   converted text, so it is separated by a rule rather than by a container. */
.cleanup-controls {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    min-width: 0;
}

.cleanup-controls__label {
    display: block;
    margin-bottom: 0.7rem;
    color: var(--muted-color);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.35;
}

.cleanup-controls__options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.75rem;
}

.cleanup-option {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.25rem;
    margin: 0;
    padding: 0;
    border-radius: 0.375rem;
    color: var(--muted-color);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.35;
    cursor: pointer;
    transition: var(--transition);
}

.cleanup-option__box {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    border: 1px solid var(--quiet-color);
    border-radius: 0.3rem;
    background-color: var(--surface-color);
    color: var(--primary-text);
    transition: var(--transition);
}

/* Masked so the tick is drawn from currentColor and never falls back to
   the literal word an icon-font ligature would leave behind. */
.cleanup-option__box::after {
    content: "";
    width: 0.75rem;
    height: 0.75rem;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M4 10.5l4 4 8-8' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M4 10.5l4 4 8-8' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.cleanup-option:hover {
    color: var(--text-color);
}

.cleanup-option:hover .cleanup-option__box {
    border-color: var(--primary-color);
}

.cleanup-option:has(input:checked) {
    color: var(--text-color);
}

.cleanup-option:has(input:checked) .cleanup-option__box {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.cleanup-option:has(input:checked) .cleanup-option__box::after {
    opacity: 1;
    transform: none;
}

.cleanup-option:has(input:focus-visible) {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .cleanup-option {
        min-height: 44px;
    }
}

.cleanup-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.switch-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    align-self: start;
}

.switch-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0;
    padding: 0.8rem 1rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background-color: var(--surface-color);
    color: var(--button-secondary-text);
    box-shadow: var(--shadow);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
}

.switch-button__main {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Always-visible direction readout, e.g. "RTF → TXT"; doubles as the
   before-press explanation of what Switch does. */
.switch-button__direction {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--meta-color);
    white-space: nowrap;
}

.switch-button .material-icons {
    font-size: 1.25rem;
    color: var(--primary-color);
    transition: transform 0.35s ease;
}

.switch-button:hover {
    background-color: var(--chip-on-bg);
    border-color: var(--chip-on-border);
    color: var(--primary-hover);
}

.switch-button:hover .material-icons {
    color: var(--primary-hover);
}

.switch-button:focus-visible {
    border-radius: 0.75rem;
}

/* Reversed mode keeps a filled state on the control itself. */
.switch-button.is-reversed {
    background-color: var(--chip-on-bg);
    border-color: var(--chip-on-border);
    color: var(--primary-color);
}

.switch-button.is-reversed .material-icons {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .file-drop__hint {
        width: 100%;
    }

    /* Panels are full-width here, so the options read better as a list. */
    .cleanup-controls__options {
        flex-direction: column;
        gap: 0.25rem;
    }

    .cleanup-option {
        width: 100%;
    }

    .switch-column {
        align-self: auto;
        gap: 0.45rem;
    }

    /* Direction readout stays on its own row below the main action at
       every width — never let it sit beside "Switch" or wrap mid-word. */
    .switch-button {
        min-height: 3.25rem;
        padding: 0.6rem 1.1rem;
    }

    /* Panels stack vertically, so the arrows point up and down. */
    .switch-button .material-icons {
        transform: rotate(90deg);
    }

    .switch-button.is-reversed .material-icons {
        transform: rotate(270deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .file-drop__overlay,
    .cleanup-option,
    .cleanup-option__box,
    .cleanup-option__box::after,
    .switch-button .material-icons {
        transition: none;
    }
}
