*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #ffffff;
}

.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
}

.converters-page-title {
    text-align: center;
    color: #317d8b;
    margin: 0 auto 28px;
    max-width: fit-content;
    padding: 14px 28px;
    border: 2px solid #317d8b;
    border-radius: 14px;
    background: #f1f7f8;
    box-sizing: border-box;
}

.converters-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 8px;
}

.converter-row {
    display: grid;
    gap: 20px;
    align-items: stretch;
}

.converter-row--pair {
    grid-template-columns: 1fr 1fr;
}

.converter-row--pair .card {
    min-width: 0;
}

.converter-row--single {
    grid-template-columns: 1fr;
}

.converter-row--single .card {
    width: 100%;
}

@media (max-width: 640px) {
    .converter-row--pair {
        grid-template-columns: 1fr;
    }

    .converters-page-title {
        padding: 12px 18px;
        font-size: 1.25rem;
        max-width: 100%;
    }
}

.card {
    border: 2px solid #317d8b;
    border-radius: 10px;
    padding: 15px;
    background: #f9f9f9;
}

.card h3 {
    margin: 0 0 10px;
    color: #317d8b;
    font-size: 16px;
    text-align: center;
    letter-spacing: 0.05em;
    line-height: 1.3;
}

.card-file-box {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 34px;
    margin-bottom: 10px;
    border: 2px solid #317d8b;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
}

.card-file-box:focus-within {
    outline: 2px solid #317d8b;
    outline-offset: 2px;
}

.card-file-box:has(.card-file-input:disabled) {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.card-file-choose {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 5px 12px;
    background: #317d8b;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.card-file-name {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 5px 10px;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-file-name.is-empty {
    color: #888;
}

.card-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
    z-index: 1;
}

.card-text-output {
    margin-top: 12px;
}

.card-text-output-label {
    font-size: 12px;
    color: #555;
    margin-bottom: 6px;
}

.card-ocr-meta {
    font-size: 11px;
    color: #666;
    line-height: 1.35;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: #ecf5f7;
    border-radius: 6px;
    border-left: 3px solid #317d8b;
}

.card-text-area {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 8px;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    font-family: ui-monospace, monospace;
}

.copy-text-btn {
    padding: 6px 14px;
    font-size: 13px;
    border: 1px solid #317d8b;
    border-radius: 6px;
    background: #e4f1f4;
    color: #317d8b;
    cursor: pointer;
}

.copy-text-btn:hover {
    background: #cadde4;
}

.convert-btn {
    display: block;
    margin: 0 auto;
    min-width: 168px;
    padding: 10px 26px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(165deg, #52aab8 0%, #317d8b 42%, #286e7a 100%);
    border: none;
    border-radius: 999px;
    box-shadow:
        0 2px 10px rgba(49, 125, 139, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    cursor: pointer;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        filter 0.18s ease;
}

.convert-btn:hover:not(:disabled) {
    filter: brightness(1.05);
    box-shadow:
        0 5px 18px rgba(49, 125, 139, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.convert-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow:
        0 2px 8px rgba(49, 125, 139, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.convert-btn:focus-visible {
    outline: 2px solid #1a4f59;
    outline-offset: 3px;
}

.convert-btn.is-loading {
    cursor: wait;
    opacity: 0.92;
    transform: none;
    pointer-events: none;
}

.convert-btn:disabled {
    cursor: wait;
    transform: none;
    filter: grayscale(0.08);
}

.card-progress {
    margin-top: 10px;
}

.card-progress-label {
    font-size: 12px;
    color: #555;
    margin-bottom: 6px;
    min-height: 1.2em;
}

.card-progress-track {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.card-progress-fill {
    height: 100%;
    width: 0%;
    background: #317d8b;
    border-radius: 4px;
    transition: width 0.12s ease-out;
}

.card-progress-track.is-indeterminate .card-progress-fill {
    width: 35% !important;
    border-radius: 4px;
    animation: card-progress-indeterminate 1.1s ease-in-out infinite;
}

@keyframes card-progress-indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}