:root {
    --paper: #f7f5f1;
    --card: #ffffff;
    --ink: #1b2229;
    --ink-soft: #4b5563;
    --muted: #8a919b;
    --line: #e8e5df;
    --line-strong: #d8d4cc;
    --accent: #0f766e;
    --accent-dark: #0b5d57;
    --accent-soft: #e6f2f0;
    --amber: #b45309;
    --amber-soft: #fff7ed;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --radius-lg: 20px;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(24, 33, 42, .05);
    --shadow: 0 18px 44px -28px rgba(24, 33, 42, .35), 0 1px 2px rgba(24, 33, 42, .04);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 78px; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        radial-gradient(1200px 500px at 15% -10%, rgba(15, 118, 110, .09), transparent 60%),
        radial-gradient(900px 400px at 90% 0%, rgba(180, 83, 9, .07), transparent 55%);
    background-repeat: no-repeat;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd { font-family: var(--mono); font-size: .9em; }

.icon { width: 18px; height: 18px; flex: none; }

/* ---------------------------------------------------------------- topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(247, 245, 241, .82);
    backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid rgba(232, 229, 223, .9);
}

.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }

.brand-mark {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: linear-gradient(160deg, #12867c, #0b5d57);
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    box-shadow: 0 6px 16px -8px rgba(15, 118, 110, .8);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: .01em; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.topnav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.topnav a { color: var(--ink-soft); }
.topnav a:hover { color: var(--accent); }
.topnav .ghost {
    padding: 6px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, .6);
}
.topnav .ghost:hover { border-color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------------ hero */

main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px 72px;
}

.hero { padding: 64px 0 40px; text-align: center; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px 5px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .01em;
    border: 1px solid rgba(15, 118, 110, .14);
}
.hero-badge .icon { width: 15px; height: 15px; }

.hero h1 {
    margin: 20px auto 0;
    max-width: 860px;
    font-size: clamp(30px, 4.6vw, 46px);
    line-height: 1.28;
    letter-spacing: -.02em;
    font-weight: 750;
    color: #131a20;
}

.grad {
    background: linear-gradient(100deg, #0f766e 0%, #12867c 42%, #b45309 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    max-width: 620px;
    margin: 18px auto 0;
    color: var(--ink-soft);
    font-size: 16.5px;
}

.hero-tags {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
    margin: 26px 0 0; padding: 0; list-style: none;
}
.hero-tags li {
    padding: 4px 12px;
    font-size: 12.5px;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, .7);
    border: 1px solid var(--line);
    border-radius: 999px;
}

/* ------------------------------------------------------------------ panel */

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
}

.converter { margin-top: 8px; }

.field + .field { margin-top: 20px; }

.field-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 9px;
}
.field-head label { font-weight: 650; font-size: 14.5px; letter-spacing: .01em; }
.hint { color: var(--muted); font-size: 12.5px; }

textarea, .select {
    width: 100%;
    font-family: var(--font);
    font-size: 15px;
    color: var(--ink);
    background: #fbfaf8;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    transition: border-color .16s, box-shadow .16s, background .16s;
}

textarea {
    min-height: 132px;
    padding: 15px 16px;
    resize: vertical;
    line-height: 1.7;
    word-break: break-all;
}

textarea::placeholder { color: #b4b7bc; }

textarea:hover, .select:hover { border-color: #c8c3b9; }

textarea:focus, .select:focus {
    outline: none;
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .12);
}

.select {
    appearance: none;
    height: 46px;
    padding: 0 40px 0 14px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23767c85' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.field-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.count { font-size: 13px; color: var(--muted); }
.count b { color: var(--accent-dark); font-weight: 700; }

.field-foot-actions { display: flex; gap: 6px; }

.linkbtn {
    border: 0;
    background: none;
    padding: 2px 4px;
    font-size: 13px;
    color: var(--ink-soft);
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
}
.linkbtn:hover { color: var(--accent); text-decoration: underline; }

.options {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 20px;
    margin-top: 22px;
}
.options .field + .field { margin-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px 7px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink-soft);
    transition: border-color .15s, background .15s, color .15s, transform .12s;
}
.chip:hover { border-color: #b9b4aa; transform: translateY(-1px); }
.chip:active { transform: translateY(0); }
.chip.is-active {
    background: var(--accent-soft);
    border-color: rgba(15, 118, 110, .45);
    color: var(--accent-dark);
    font-weight: 600;
}

.chip-badge {
    display: inline-grid;
    place-items: center;
    min-width: 38px;
    padding: 2px 6px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .03em;
    color: #fff;
    background: #94a3b8;
}
.chip-badge.md { background: #2f6f5e; }
.chip-badge.html { background: #b45309; }
.chip-badge.docx { background: #2b579a; }
.chip-badge.pdf { background: #b42318; }

.switches { margin-top: 20px; }

.switch {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
    user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
    position: relative;
    width: 40px; height: 23px;
    border-radius: 999px;
    background: #d9d6cf;
    transition: background .18s;
    flex: none;
}
.switch-dot {
    position: absolute;
    top: 2.5px; left: 2.5px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-dot { transform: translateX(17px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px rgba(15, 118, 110, .16); }

.switch-text { font-size: 14px; display: flex; flex-direction: column; line-height: 1.35; }
.switch-text small { color: var(--muted); font-size: 12px; }

.submit-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px dashed var(--line);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 11px 22px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 650;
    cursor: pointer;
    transition: transform .12s, box-shadow .16s, background .16s, border-color .16s, color .16s;
    white-space: nowrap;
}

.btn.primary {
    color: #fff;
    background: linear-gradient(160deg, #12867c, #0b5d57);
    box-shadow: 0 10px 24px -14px rgba(11, 93, 87, .9);
    padding: 13px 26px;
    font-size: 15px;
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -14px rgba(11, 93, 87, .95); }
.btn.primary:active { transform: translateY(0); }
.btn.primary[disabled] { opacity: .62; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary .icon { transition: transform .18s; }
.btn.primary:hover .icon { transform: translateX(3px); }

.btn.small { padding: 8px 16px; font-size: 13.5px; }
.btn.outline {
    background: #fff;
    border-color: var(--line-strong);
    color: var(--ink-soft);
}
.btn.outline:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn[hidden] { display: none !important; }

.submit-tip { color: var(--muted); font-size: 12.5px; }
kbd {
    padding: 1px 5px;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #fbfaf8;
    font-size: 11px;
    color: var(--ink-soft);
}

.pdf-tip { color: var(--amber); font-size: 12.5px; }

/* ---------------------------------------------------------------- results */

.results { margin-top: 22px; padding: 22px 24px 20px; scroll-margin-top: 78px; }

.results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.results-title { display: flex; align-items: baseline; gap: 10px; }
.results-title h2 { margin: 0; font-size: 17px; letter-spacing: .01em; }
.results-progress { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.results-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.progress {
    height: 4px;
    margin: 16px 0 14px;
    border-radius: 999px;
    background: #eeebe5;
    overflow: hidden;
}
.progress span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #12867c, #0f766e);
    transition: width .35s ease;
}

.results-list { display: flex; flex-direction: column; gap: 10px; }

.item {
    display: flex;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fdfcfa;
    animation: fadeUp .25s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: none; }
}

.item.is-error { border-color: #f3d3cf; background: var(--danger-soft); }

.item-thumb {
    width: 58px; height: 58px;
    flex: none;
    border-radius: 10px;
    background: #f0ede7 center/cover no-repeat;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #c2bdb3;
    font-size: 11px;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.item-main { flex: 1; min-width: 0; }

.item-title {
    font-size: 15px;
    font-weight: 650;
    line-height: 1.45;
    color: var(--ink);
    word-break: break-word;
    margin-bottom: 4px;
}
.item-title a { color: inherit; }
.item-title a:hover { color: var(--accent); text-decoration: none; }

.item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 12.5px;
    color: var(--muted);
}
.item-meta .meta-item { white-space: nowrap; }
.item-meta .meta-item + .meta-item::before {
    content: "·";
    color: #d3cfc7;
    margin: 0 7px;
}

.item-warn {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--amber);
    background: var(--amber-soft);
    border: 1px solid #f6e0c4;
    border-radius: 8px;
    padding: 6px 10px;
    line-height: 1.6;
}

.item-files { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px; }

.file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
    transition: border-color .15s, color .15s, background .15s;
}
.file:hover { text-decoration: none; border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
.file span { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.file .icon { width: 14px; height: 14px; }
.file .fmt {
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #fff;
    background: #64748b;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
}
.file:hover .fmt { background: var(--accent); }

.chip.is-disabled { opacity: .45; cursor: not-allowed; }

.file.preview { cursor: pointer; font-family: inherit; }
.file.retry { cursor: pointer; font-family: inherit; color: var(--danger); border-color: #f0cdc8; background: #fff; }
.file.retry:hover { background: #fff2f0; border-color: var(--danger); color: var(--danger); }

.item-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.spinner {
    width: 15px; height: 15px;
    border-radius: 50%;
    border: 2px solid #dcd8d0;
    border-top-color: var(--accent);
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #efede8 25%, #f7f5f1 37%, #efede8 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.error-text { color: var(--danger); font-size: 13px; }

/* ----------------------------------------------------------------- guide */

.guide, .faq { margin-top: 64px; }
.guide h2, .faq h2 {
    font-size: 22px;
    letter-spacing: -.01em;
    margin: 0 0 20px;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.guide-card {
    position: relative;
    padding: 22px 22px 20px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--line);
}
.guide-num {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: .1em;
}
.guide-card h3 { margin: 8px 0 6px; font-size: 15.5px; }
.guide-card p { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.7; }

.faq details {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .72);
    padding: 0 18px;
    margin-bottom: 10px;
}
.faq details[open] { background: #fff; box-shadow: var(--shadow-sm); }
.faq summary {
    cursor: pointer;
    padding: 15px 26px 15px 0;
    font-size: 14.5px;
    font-weight: 600;
    list-style: none;
    position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    position: absolute;
    right: 2px; top: 50%;
    transform: translateY(-50%);
    font-size: 19px;
    color: var(--muted);
    font-weight: 400;
    transition: transform .18s;
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq p { margin: 0 0 16px; color: var(--ink-soft); font-size: 14px; line-height: 1.75; }
.faq code { background: #f4f2ed; padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* ---------------------------------------------------------------- footer */

.footer {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 24px 56px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-soft);
}
.footer p { margin: 4px 0; }
.footer .muted { color: var(--muted); font-size: 12.5px; }

/* ----------------------------------------------------------------- modal */

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(20, 26, 32, .46);
    backdrop-filter: blur(3px);
    animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-body {
    position: relative;
    width: min(900px, 100%);
    height: min(88vh, 900px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .55);
    animation: popIn .2s ease both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #fcfbf9;
}
.modal-head strong { font-size: 14px; font-weight: 650; }
.modal-head-actions { display: flex; align-items: center; gap: 10px; }

.iconbtn {
    display: grid; place-items: center;
    width: 30px; height: 30px;
    border: 0; border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}
.iconbtn:hover { background: #efede8; color: var(--ink); }

#modalFrame { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------------------------------------------------------------- toasts */

.toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, calc(100vw - 40px));
}

.toast {
    padding: 11px 14px;
    border-radius: 10px;
    background: #1f2937;
    color: #f8fafc;
    font-size: 13.5px;
    line-height: 1.55;
    box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .6);
    animation: toastIn .2s ease both;
}
.toast.error { background: #7f1d1d; }
.toast.success { background: #0b5d57; }
.toast.is-out { animation: toastOut .2s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
    .options { grid-template-columns: 1fr; }
    .guide-grid { grid-template-columns: 1fr; }
    .item { flex-direction: column; }
    .item-files { padding-left: 0; }
}

@media (max-width: 640px) {
    main { padding: 0 16px 56px; }
    .topbar-inner { padding: 10px 16px; }
    .topnav { gap: 14px; font-size: 13px; }
    .topnav a:not(.ghost) { display: none; }
    .hero { padding: 44px 0 28px; }
    .hero-sub { font-size: 15px; }
    .panel { padding: 20px 16px; border-radius: 16px; }
    .results { padding: 18px 16px; }
    .submit-row { gap: 12px; }
    .btn.primary { width: 100%; }
    .submit-tip { display: none; }
    .item-thumb { width: 44px; height: 44px; }
    .footer { padding: 24px 16px 48px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
