:root {
  --ink: #17212b;
  --ink-soft: #536171;
  --muted: #7b8794;
  --line: #dfe5ea;
  --line-strong: #cbd4dc;
  --canvas: #f4f6f8;
  --panel: #ffffff;
  --blue: #1769e0;
  --blue-dark: #0f53b7;
  --blue-soft: #edf4ff;
  --green: #16845a;
  --green-soft: #eaf8f1;
  --amber: #a46612;
  --amber-soft: #fff6e7;
  --red: #b64646;
  --red-soft: #fff0f0;
  --radius: 8px;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid rgba(23, 105, 224, .25); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 5vw, 72px); background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border: 1px solid #d4e4ff; border-radius: 8px; }
.brand-mark svg { width: 21px; height: 21px; }
.brand strong { display: block; font-size: 15px; line-height: 1.1; letter-spacing: .01em; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.privacy-note { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.page-content { max-width: 1240px; margin: 0 auto; padding: 52px clamp(20px, 5vw, 72px) 28px; }
.intro-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 11px; color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.eyebrow span { margin: 0 5px; color: var(--line-strong); }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 680px; margin-bottom: 10px; font-size: 38px; line-height: 1.18; letter-spacing: 0; }
.intro-copy { max-width: 650px; margin-bottom: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.75; }
.engine-summary { min-width: 194px; max-width: 100%; padding: 13px 15px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.engine-summary-label { color: var(--muted); font-size: 11px; }
.engine-summary-value { margin-top: 4px; color: var(--ink); font-size: 14px; font-weight: 700; }
.engine-summary-detail { margin-top: 3px; color: var(--green); font-size: 11px; }

.workspace-grid { display: grid; grid-template-columns: minmax(330px, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: stretch; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(31, 48, 64, .035); }
.control-panel, .status-panel { padding: 25px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 19px; }
.section-kicker { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.panel h2 { margin-bottom: 0; font-size: 19px; letter-spacing: 0; }
.step-badge { padding: 5px 7px; color: var(--muted); background: #f7f9fa; border: 1px solid var(--line); border-radius: 4px; font-size: 9px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }

.mode-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 18px; padding: 5px; background: #f2f5f7; border: 1px solid var(--line); border-radius: 7px; }
.mode-button { min-width: 0; min-height: 67px; display: flex; align-items: center; gap: 8px; padding: 8px 8px; color: var(--ink-soft); background: transparent; border: 1px solid transparent; border-radius: 5px; text-align: left; }
.mode-button:hover { color: var(--ink); background: rgba(255,255,255,.7); }
.mode-button.is-active { color: var(--blue); background: #fff; border-color: #cfe0fa; box-shadow: 0 2px 5px rgba(25, 71, 120, .08); }
.mode-icon { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 5px; color: currentColor; background: #e7edf3; font-size: 10px; font-weight: 800; letter-spacing: 0; }
.is-active .mode-icon { background: var(--blue-soft); }
.mode-icon svg { width: 17px; height: 17px; }
.mode-copy { min-width: 0; }
.mode-copy strong, .mode-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-copy strong { font-size: 11px; }
.mode-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.upload-zone { min-height: 185px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 22px 18px; color: var(--ink-soft); background: #fbfcfd; border: 1px dashed #b9c5cf; border-radius: 7px; text-align: center; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.upload-zone:hover, .upload-zone.is-dragover { color: var(--blue); background: #f6faff; border-color: var(--blue); }
.upload-zone.is-dragover { transform: translateY(-1px); }
.upload-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 12px; color: var(--blue); background: var(--blue-soft); border: 1px solid #d6e6ff; border-radius: 50%; }
.upload-icon svg { width: 21px; height: 21px; }
.upload-zone strong { font-size: 13px; }
.upload-zone > span:not(.upload-format) { margin-top: 6px; color: var(--muted); font-size: 11px; }
.upload-format { margin-top: 13px; padding: 3px 7px; color: var(--blue); background: var(--blue-soft); border-radius: 3px; font-size: 9px; font-weight: 700; letter-spacing: .08em; }

.selected-file { min-height: 67px; display: flex; align-items: center; gap: 11px; margin-top: 10px; padding: 11px 12px; background: #f8fafb; border: 1px solid var(--line); border-radius: 6px; }
.file-type-badge, .mini-file-icon { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 37px; color: #7a4b1c; background: #fff1dc; border: 1px solid #f1d6ac; border-radius: 5px; font-size: 9px; font-weight: 800; }
.selected-file-copy { min-width: 0; flex: 1; }
.selected-file-copy strong, .selected-file-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file-copy strong { font-size: 12px; }
.selected-file-copy span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 5px; }
.icon-button:hover { color: var(--red); background: var(--red-soft); border-color: #f3d4d4; }
.icon-button svg { width: 18px; height: 18px; }

.options-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.options-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 12px; font-weight: 700; }
.options-note { color: var(--muted); font-size: 10px; font-weight: 400; }
.option-row { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.option-label { color: var(--ink-soft); font-size: 11px; }
.segmented-control { display: inline-flex; padding: 3px; background: #f1f4f6; border: 1px solid var(--line); border-radius: 5px; }
.segment { min-width: 48px; height: 26px; padding: 0 9px; color: var(--muted); background: transparent; border: 0; border-radius: 3px; font-size: 10px; font-weight: 700; }
.segment.is-active { color: var(--blue); background: #fff; box-shadow: 0 1px 3px rgba(31, 48, 64, .12); }
.select-control { max-width: 185px; height: 32px; padding: 0 27px 0 10px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 5px; font-size: 11px; }
.quality-row { display: block; padding-top: 7px; }
.quality-row .option-label { display: flex; justify-content: space-between; margin-bottom: 5px; }
.quality-row output { color: var(--blue); font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--blue); }

.primary-button, .download-button, .secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; font-size: 12px; font-weight: 700; text-decoration: none; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.primary-button { width: 100%; margin-top: 21px; color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.primary-button:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; color: #aab4be; background: #eef1f3; border-color: #e1e6e9; }
.primary-button svg, .download-button svg, .secondary-button svg { width: 17px; height: 17px; }
.privacy-footnote { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 12px 0 0; color: var(--muted); font-size: 10px; }
.privacy-footnote svg { width: 13px; height: 13px; }

.status-pill { min-height: 26px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); background: #f7f9fa; font-size: 10px; white-space: nowrap; }
.status-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.is-working { color: var(--blue); background: var(--blue-soft); border-color: #d4e4ff; }
.status-pill.is-success { color: var(--green); background: var(--green-soft); border-color: #c8ecd9; }
.status-pill.is-error { color: var(--red); background: var(--red-soft); border-color: #f1d2d2; }
.idle-state { min-height: 385px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 25px 25px 31px; text-align: center; }
.idle-illustration { position: relative; width: 150px; height: 132px; margin-bottom: 18px; }
.paper { position: absolute; display: block; width: 68px; height: 87px; border: 1px solid var(--line-strong); border-radius: 5px; background: #f7f9fa; transform: rotate(-8deg); }
.paper-back { top: 23px; left: 30px; opacity: .72; }
.paper-front { top: 14px; left: 51px; display: grid; place-items: center; color: var(--blue); background: #fff; border-color: #b9d2f6; transform: rotate(5deg); box-shadow: 0 6px 12px rgba(25, 71, 120, .08); }
.paper-front svg { width: 37px; height: 37px; }
.paper-arrow { position: absolute; right: 14px; bottom: 13px; color: var(--green); font-size: 29px; font-weight: 300; transform: rotate(-12deg); }
.idle-state h3 { margin-bottom: 7px; font-size: 15px; }
.idle-state p { max-width: 340px; margin-bottom: 24px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.idle-metrics { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.idle-metrics span { display: flex; flex-direction: column; gap: 3px; }
.idle-metrics strong { color: var(--blue); font-size: 12px; }
.idle-metrics small { font-size: 9px; }
.idle-metrics i { width: 25px; height: 1px; background: var(--line-strong); }

.progress-state, .result-state, .error-state { min-height: 385px; padding: 43px 38px; }
.processing-head { display: flex; align-items: center; gap: 14px; margin: 70px 0 28px; }
.processing-icon { width: 46px; height: 46px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border: 1px solid #d4e4ff; border-radius: 50%; animation: spin 1.2s linear infinite; }
.processing-icon svg { width: 23px; height: 23px; }
.processing-head strong, .processing-head span { display: block; }
.processing-head strong { font-size: 15px; }
.processing-head span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.progress-track { height: 7px; overflow: hidden; background: #e9eef2; border-radius: 4px; }
.progress-track span { display: block; width: 12%; height: 100%; background: var(--blue); border-radius: inherit; transition: width .35s ease; }
.progress-meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 10px; }
.progress-meta strong { color: var(--blue); }
.processing-file { display: flex; align-items: center; gap: 9px; margin-top: 35px; padding: 10px 11px; background: #f8fafb; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-soft); font-size: 11px; }
.mini-file-icon { width: 27px; height: 27px; font-size: 7px; }
.processing-file span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-state { padding-top: 31px; }
.result-banner { display: flex; align-items: center; gap: 13px; padding: 16px; color: var(--green); background: var(--green-soft); border: 1px solid #c8ecd9; border-radius: 6px; }
.result-check { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--green); border-radius: 50%; }
.result-check svg { width: 18px; height: 18px; }
.result-banner strong, .result-banner span { display: block; }
.result-banner strong { color: var(--ink); font-size: 14px; }
.result-banner span { margin-top: 4px; color: var(--green); font-size: 11px; }
.result-details { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(82px, .7fr)); gap: 12px; margin-top: 22px; padding: 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-details span, .result-details strong { display: block; }
.result-details span { margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.result-details strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.result-actions { display: flex; gap: 9px; margin-top: 23px; }
.download-button { flex: 1; color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.download-button:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.secondary-button { padding: 0 15px; color: var(--ink-soft); background: #fff; border: 1px solid var(--line-strong); }
.secondary-button:hover { color: var(--ink); background: #f7f9fa; border-color: #aeb9c3; }
.secondary-button.compact { margin-top: 18px; min-height: 38px; }
.result-warning { margin: 20px 0 0; padding: 9px 11px; color: var(--amber); background: var(--amber-soft); border: 1px solid #f0d7a9; border-radius: 5px; font-size: 10px; line-height: 1.6; }
.error-state { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.error-symbol { width: 39px; height: 39px; display: grid; place-items: center; margin-bottom: 15px; color: #fff; background: var(--red); border-radius: 50%; font-size: 20px; font-weight: 700; }
.error-state strong { font-size: 15px; }
.error-state p { max-width: 400px; margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }

.page-footer { display: flex; justify-content: center; gap: 8px; margin-top: 19px; color: var(--muted); font-size: 10px; }

@media (max-width: 860px) {
  .intro-row { align-items: flex-start; flex-direction: column; gap: 18px; }
  .engine-summary { width: 100%; }
  .workspace-grid { grid-template-columns: 1fr; }
  .idle-state, .progress-state, .result-state, .error-state { min-height: 320px; }
  .processing-head { margin-top: 42px; }
}
@media (max-width: 540px) {
  .topbar { height: 65px; padding: 0 17px; }
  .privacy-note { font-size: 0; }
  .privacy-note .status-dot { width: 8px; height: 8px; }
  .page-content { padding: 33px 14px 23px; }
  h1 { font-size: 28px; }
  .control-panel, .status-panel { padding: 18px; }
  .mode-switch { gap: 3px; padding: 3px; }
  .mode-button { min-width: 0; width: 100%; min-height: 61px; flex-direction: column; justify-content: center; gap: 4px; padding: 6px 2px; text-align: center; }
  .mode-copy { width: 100%; min-width: 0; }
  .mode-copy strong { font-size: 9px; }
  .mode-copy small { display: none; }
  .mode-icon { width: 24px; height: 24px; font-size: 8px; }
  .mode-icon svg { width: 15px; height: 15px; }
  .result-details { grid-template-columns: 1.4fr .8fr; }
  .result-details > div:last-child { grid-column: 2; grid-row: 1; }
  .result-actions { flex-direction: column; }
  .page-footer { flex-wrap: wrap; }
}
