:root {
    --ofd-primary: #2563eb;
    --ofd-primary-strong: #1d4ed8;
    --ofd-bg: #f8fafc;
    --ofd-text: #1e293b;
    --ofd-muted: #475569;
    --ofd-border: #dbe4ef;
    --ofd-shadow-strong: 0 22px 48px rgba(15, 23, 42, 0.14);
}

body {
    min-height: 100%;
    background:
        radial-gradient(80rem 36rem at 5% -15%, rgba(37, 99, 235, 0.18), transparent 58%),
        radial-gradient(75rem 34rem at 95% 0%, rgba(249, 115, 22, 0.12), transparent 60%),
        linear-gradient(145deg, #f3f7ff 0%, var(--ofd-bg) 55%, #fff7f1 100%);
    color: var(--ofd-text);
    overflow-y: auto;
}

main.page {
    min-height: calc(100vh - 200px);
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 16px 18px 8px !important;
    margin: 0 auto;
}

.panel {
    width: min(100%, 620px);
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.9));
    border: 1px solid var(--ofd-border);
    border-radius: 24px;
    box-shadow: var(--ofd-shadow-strong);
    backdrop-filter: blur(7px);
    padding: clamp(16px, 2.1vw, 22px);
}

.app-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #d7e4ff;
    background: #eef4ff;
    color: #1e40af;
    font-size: 12px;
    font-weight: 700;
}

.app-identity {
    margin: 18px auto 0;
    display: grid;
    grid-template-columns: 64px auto;
    gap: 16px;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    text-align: left;
}

.app-mark {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #39baf4 0%, #22d3ee 100%);
    color: #ffffff;
    font-size: 28px;
    font-weight: 800;
}

.app-copy {
    min-width: 0;
}

.app-copy h1,
#pageTitle {
    margin: 0 0 8px;
    font-size: clamp(26px, 3.5vw, 34px);
    line-height: 1.18;
}

.subtitle,
#pageSubtitle {
    margin: 0;
    color: var(--ofd-muted);
    line-height: 1.65;
}

.feature-strip {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.feature-chip {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #1e3a8a;
    background: linear-gradient(135deg, #eff5ff, #eef2ff);
    border: 1px solid #d7e4ff;
}

.converter-form {
    width: 100%;
    margin-top: 18px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid #e6edf8;
    background:
        linear-gradient(180deg, #ffffff, #fbfdff),
        linear-gradient(135deg, rgba(37, 99, 235, 0.03), rgba(249, 115, 22, 0.03));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.field {
    display: block;
    position: relative;
    z-index: 1;
    margin-bottom: 14px;
}

.field:last-of-type {
    margin-bottom: 0;
}

.field.is-select-open {
    z-index: 80;
}

.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.mode-hint {
    margin: 0 0 12px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px dashed #d2ddf5;
    background: #f8fbff;
    font-size: 13px;
    color: var(--ofd-muted);
}

.converter-form small {
    display: inline-block;
    margin-top: 7px;
    font-size: 12px;
    color: #64748b;
}

.select-shell {
    position: relative;
    z-index: 1;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(145deg, #cfe0ff 0%, #b8cefa 38%, #d6e4fb 100%);
    box-shadow: 0 10px 22px rgba(29, 78, 216, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.select-shell::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: 1px;
    height: 40%;
    border-radius: 14px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0));
}

.select-shell:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(29, 78, 216, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.select-shell:focus-within {
    background: linear-gradient(145deg, #6b9dff 0%, #5c87f1 52%, #7ea8ff 100%);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), 0 14px 30px rgba(29, 78, 216, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transform: translateY(0);
}

.select-shell.is-custom-ready select {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.converter-form select,
.kq-select-trigger {
    width: 100%;
    min-height: 50px;
    border-radius: 15px;
    border: 0;
    background: linear-gradient(165deg, #ffffff 0%, #f7fbff 56%, #eef5ff 100%);
    color: var(--ofd-text);
    font: inherit;
    font-size: 15px;
    padding: 0 44px 0 16px;
    position: relative;
    z-index: 1;
}

.kq-select {
    position: relative;
}

.kq-select-trigger {
    border: 0;
    text-align: left;
    cursor: pointer;
}

.converter-form select:focus,
.kq-select-trigger:focus-visible {
    outline: none;
}

.converter-form select:hover,
.kq-select-trigger:hover {
    background: linear-gradient(165deg, #ffffff 0%, #f1f7ff 58%, #e8f2ff 100%);
}

.select-icon {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #4f6fae;
    pointer-events: none;
    transition: transform 200ms ease, color 180ms ease;
    z-index: 2;
}

.select-shell:focus-within .select-icon,
.select-shell.is-open .select-icon {
    color: #1e429f;
    transform: translateY(-50%) rotate(180deg);
}

.select-icon svg {
    width: 17px;
    height: 17px;
    display: block;
}

.kq-select-value {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kq-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 55;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid #bfd0ea;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.14);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.select-shell.is-open .kq-select-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.select-shell.is-open {
    z-index: 40;
}

.kq-select-option {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #1e293b;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 12px;
    text-align: left;
    cursor: pointer;
}

.kq-select-option:hover,
.kq-select-option:focus-visible {
    outline: none;
    background: #e9f2ff;
    color: #1d4ed8;
}

.kq-select-option.is-selected {
    background: linear-gradient(145deg, #2d66d4 0%, #2256b8 100%);
    color: #ffffff;
}

.kq-select-option[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.converter-form select option {
    font-weight: 500;
    color: #0f172a;
    background: #f5f9ff;
}

.file-upload {
    position: relative;
    border: 1px dashed #c7d6ef;
    border-radius: 14px;
    background: linear-gradient(165deg, #ffffff 0%, #f2f7ff 100%);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.file-upload:hover {
    border-color: #9bb9ef;
    transform: translateY(-1px);
}

.file-upload:focus-within {
    border-color: var(--ofd-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    transform: translateY(0);
}

.file-upload.is-dragover {
    border-color: var(--ofd-primary);
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
    background: linear-gradient(165deg, #ffffff 0%, #eaf2ff 100%);
    transform: translateY(-1px);
}

.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-main {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    padding: 12px;
}

.file-upload-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #e8f1ff, #dbe9ff);
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.file-upload-icon svg {
    width: 22px;
    height: 22px;
}

.file-upload-copy {
    min-width: 0;
}

.file-action-text {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.file-meta {
    margin: 4px 0 0;
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-browse-btn {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 92px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid #c7d6ef;
    background: #ffffff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
}

.file-upload.has-file {
    border-style: solid;
    border-color: #8eb0ea;
    background: linear-gradient(165deg, #ffffff 0%, #eef5ff 100%);
}

.file-upload.has-file .file-upload-icon {
    background: linear-gradient(145deg, #d9e8ff, #c8ddff);
}

.file-upload.has-file .file-meta {
    color: #1e40af;
    font-weight: 500;
}

.actions {
    margin-top: 14px;
}

.actions > button,
#convertBtn {
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    background: linear-gradient(130deg, var(--ofd-primary) 0%, var(--ofd-primary-strong) 60%, #1e40af 100%);
    box-shadow: 0 16px 26px rgba(37, 99, 235, 0.28);
    transition: transform 150ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.actions > button:hover,
#convertBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.32);
    filter: saturate(1.04);
}

.actions > button:active,
#convertBtn:active {
    transform: translateY(0);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.26);
}

.actions > button:focus-visible,
#convertBtn:focus-visible {
    outline: 3px solid rgba(96, 165, 250, 0.45);
    outline-offset: 2px;
}

.actions > button:disabled,
#convertBtn:disabled {
    cursor: not-allowed;
    opacity: 0.72;
    transform: none;
    box-shadow: 0 8px 14px rgba(71, 85, 105, 0.18);
}

.status {
    margin: 10px 2px 0;
    min-height: 24px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--ofd-muted);
    font-size: 13px;
    line-height: 1.35;
}

.status.pending {
    color: #92400e;
    border-color: #f3d7b2;
    background: #fff6e8;
}

.status.ok {
    color: #116a3f;
    border-color: #b8e6cc;
    background: #effcf4;
}

.status.error {
    color: #9f1239;
    border-color: #f5c8d2;
    background: #fff1f5;
}

.language-switcher {
    width: min(100%, 980px);
    margin: 0 auto;
    padding-top: 0;
}

.language-card {
    border-radius: 14px;
    border: 1px solid #dfe7f3;
    background: #ffffff;
    padding: 10px 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.language-title {
    margin: 0 0 8px;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: #64748b;
}

.language-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 4px;
}

.language-link {
    border: 0;
    background: transparent;
    color: #475569;
    padding: 0 8px;
    font-size: 13px;
    line-height: 1.8;
    cursor: pointer;
}

.language-link:first-child {
    padding-left: 0;
}

.language-link + .language-link {
    border-left: 1px solid #d7e2f2;
}

.language-link:hover {
    color: #1e3a8a;
}

.language-link.is-active {
    color: #1d4ed8;
    font-weight: 600;
}

@media (max-width: 768px) {
    main.page {
        align-items: start;
        min-height: auto;
        gap: 6px;
        padding: 78px 10px 8px !important;
    }

    .panel {
        border-radius: 18px;
        padding: 14px;
    }

    .app-identity {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .app-copy {
        text-align: center;
    }
}
