:root {
    --bg: #eef1f5;
    --window: #ffffff;
    --panel: #f6f7f9;
    --line: #d3d7dd;
    --line-strong: #b8bec8;
    --text: #1f2933;
    --muted: #5b6570;
    --accent: #2f5d87;
    --accent-soft: #d8e4ef;
    --error-bg: #f8e6e6;
    --error-text: #8a1f1f;
    --shadow: 0 18px 50px rgba(35, 45, 55, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
}

.site-header {
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 22px rgba(35, 45, 55, 0.06);
}

.site-header-inner {
    width: min(100%, 920px);
    margin: 0 auto;
    padding: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 18px;
}

.site-brand {
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.page-shell {
    padding: 32px 18px 48px;
    display: flex;
    justify-content: center;
}

.app-window {
    width: min(100%, 920px);
    background: var(--window);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.app-header h1 {
    margin: 0;
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    line-height: 1.08;
}

.lead {
    margin: 14px 0 0;
    max-width: 60ch;
    color: var(--muted);
    line-height: 1.6;
}

.converter-form {
    margin-top: 26px;
}

.converter-form.is-busy {
    cursor: progress;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
}

.panel + .panel {
    margin-top: 14px;
}

.field-block {
    margin: 0;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.field-help,
.action-note {
    color: var(--muted);
}

.field-help,
.field-error {
    margin: 8px 0 0;
    font-size: 0.95rem;
}

.field-error:empty {
    display: none;
}

.field-error {
    color: var(--error-text);
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 18px;
    align-items: start;
}

.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.choice-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 86px;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.choice-pill:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.choice-pill.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.choice-pill input {
    accent-color: var(--accent);
}

input[type="file"],
input[type="number"] {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: white;
    color: var(--text);
    font: inherit;
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #f0f2f5;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 16px;
    margin-top: 18px;
}

.submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border: 1px solid var(--accent);
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.submit-button:hover {
    background: #264c6d;
}

.header-download-button {
    text-decoration: none;
}

.message {
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
}

.error-message {
    background: var(--error-bg);
    border-color: #e0b8b8;
    color: var(--error-text);
}

.error-message p {
    margin: 0;
}

.is-hidden:empty,
.is-hidden {
    display: none;
}

.is-disabled {
    opacity: 0.5;
}

.panel-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 1.1rem;
}

.progress-label,
.status-message,
.status-note {
    margin: 0;
}

.progress-label {
    color: var(--muted);
}

.progress-panel,
.status-panel {
    margin-top: 14px;
}

.progress-track {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: white;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3f79a8 0%, var(--accent) 100%);
    border-radius: inherit;
    transition: width 180ms ease;
}

.status-panel {
    min-height: 236px;
}

.status-message {
    min-height: 2.8em;
    font-size: 1rem;
    line-height: 1.4;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    margin: 16px 0 0;
}

.status-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
}

.status-row dt,
.status-row dd {
    margin: 0;
}

.status-row dt {
    color: var(--muted);
}

.status-row dd {
    text-align: right;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.status-note {
    min-height: 1.4em;
    margin-top: 14px;
    color: var(--muted);
    line-height: 1.45;
}

@media (max-width: 760px) {
    .site-header-inner {
        padding: 16px 18px;
    }

    .app-window {
        padding: 20px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }
}
