:root {
  --paper: #f6f3eb;
  --paper-deep: #eee9dc;
  --ink: #14283c;
  --muted: #66727b;
  --teal: #087e82;
  --teal-dark: #056467;
  --line: #d9d5c9;
  --white: #fffef9;
  --danger: #a13d35;
  --shadow: 0 18px 50px rgba(20, 40, 60, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  background-image: radial-gradient(circle at 20% 0%, rgba(8,126,130,.07), transparent 30%), linear-gradient(rgba(20,40,60,.018) 1px, transparent 1px);
  background-size: auto, 100% 28px;
}
button, input, textarea { font: inherit; }
button, .dropzone { -webkit-tap-highlight-color: transparent; }
a { color: var(--teal-dark); }

.site-header, footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-header { border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; background: var(--ink); color: var(--white); border-radius: 4px 12px 4px 4px; font-family: Georgia, serif; font-size: 21px; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; letter-spacing: .13em; }
.source-link { font-size: 13px; text-decoration: none; padding: 8px 0; border-bottom: 1px solid var(--teal); }

main { max-width: 1320px; margin: 0 auto; padding: 64px 36px 38px; }
.intro { max-width: 760px; margin-bottom: 38px; }
.eyebrow { margin: 0 0 16px; color: var(--teal-dark); font-size: 11px; font-weight: 750; letter-spacing: .19em; }
h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(38px, 5vw, 68px); line-height: 1.08; letter-spacing: -.035em; font-weight: 500; }
.intro > p:not(.eyebrow):not(.availability) { color: var(--muted); font-size: 16px; line-height: 1.8; max-width: 650px; }
.intro .availability { display: inline-block; margin: 3px 0 0; border-left: 2px solid #d29129; padding: 5px 10px; color: #765f3c; background: rgba(210,145,41,.07); font-size: 11px; line-height: 1.55; }

.workspace { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 20px; align-items: stretch; }
.panel { padding: 28px; border: 1px solid var(--line); background: rgba(255,254,249,.86); box-shadow: var(--shadow); min-width: 0; }
.panel-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.panel-heading .step { font-family: Georgia, serif; color: var(--teal); font-size: 14px; border: 1px solid rgba(8,126,130,.35); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; flex: 0 0 auto; }
.panel-heading h2 { margin: 0 0 3px; font-family: Georgia, "Songti SC", serif; font-size: 20px; font-weight: 600; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.result-heading .status-dot { margin-left: auto; width: 9px; height: 9px; border-radius: 50%; background: #a8afb3; box-shadow: 0 0 0 5px rgba(168,175,179,.15); }
.status-dot[data-state="working"] { background: #d29129; box-shadow: 0 0 0 5px rgba(210,145,41,.15); animation: pulse 1.2s infinite; }
.status-dot[data-state="success"] { background: var(--teal); box-shadow: 0 0 0 5px rgba(8,126,130,.14); }
.status-dot[data-state="error"] { background: var(--danger); box-shadow: 0 0 0 5px rgba(161,61,53,.13); }
@keyframes pulse { 50% { opacity: .45; } }

.dropzone { min-height: 265px; position: relative; border: 1.5px dashed #9bb5b3; background: rgba(8,126,130,.025); display: grid; place-items: center; cursor: pointer; overflow: hidden; transition: .2s ease; outline: none; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-dragging { border-color: var(--teal); background: rgba(8,126,130,.065); }
.upload-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px; padding: 35px; }
.upload-icon { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: white; font-size: 28px; font-weight: 200; margin-bottom: 4px; }
.upload-empty strong { font-size: 15px; }
.upload-empty span:last-child { color: var(--muted); font-size: 11px; line-height: 1.6; }
.preview { width: 100%; height: 265px; object-fit: contain; background: #e9e7df; }
.remove-file { position: absolute; right: 10px; top: 10px; border: 0; border-radius: 50%; width: 30px; height: 30px; background: rgba(20,40,60,.85); color: #fff; cursor: pointer; font-size: 20px; }
.file-row { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); }
.file-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-button { border: 0; background: none; color: var(--teal-dark); font-weight: 650; cursor: pointer; white-space: nowrap; }

.task-picker { border: 0; padding: 22px 0 18px; margin: 0; }
.task-picker legend { font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.task-grid label { position: relative; cursor: pointer; }
.task-grid input { position: absolute; opacity: 0; }
.task-grid span { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); padding: 12px 14px; transition: .18s ease; }
.task-grid b { font-size: 13px; }
.task-grid small { color: var(--muted); font-size: 10px; }
.task-grid input:checked + span { border-color: var(--teal); background: rgba(8,126,130,.07); box-shadow: inset 3px 0 var(--teal); }
.task-grid input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.primary-button { width: 100%; border: 0; padding: 15px 17px; display: flex; justify-content: space-between; background: var(--ink); color: white; cursor: pointer; font-weight: 700; transition: background .2s; }
.primary-button:hover { background: var(--teal-dark); }
.primary-button:disabled { opacity: .48; cursor: wait; }
.boundary { margin: 16px 0 0; font-size: 11px; color: var(--muted); line-height: 1.65; }

.output-panel { min-height: 620px; display: flex; flex-direction: column; }
.result-empty { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; padding: 50px 12%; }
.empty-glyph { width: 90px; height: 110px; border: 1px solid #aeb8ba; margin-bottom: 23px; padding: 28px 17px; transform: rotate(1.5deg); box-shadow: 8px 8px 0 var(--paper-deep); }
.empty-glyph span { display: block; height: 2px; margin-bottom: 12px; background: #98aaaa; }
.empty-glyph span:nth-child(2) { width: 75%; }
.result-empty strong { font-family: Georgia, "Songti SC", serif; font-size: 20px; }
.result-empty p { max-width: 380px; margin: 10px 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.result-wrap { flex: 1; min-height: 0; }
#result { width: 100%; min-height: 440px; resize: vertical; border: 1px solid var(--line); background: #fbfaf5; padding: 20px; color: var(--ink); font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; line-height: 1.7; outline: none; }
#result:focus { border-color: var(--teal); }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.result-actions button { border: 1px solid var(--line); background: var(--white); color: var(--ink); padding: 8px 12px; cursor: pointer; font-size: 11px; }
.result-actions button:hover { border-color: var(--teal); color: var(--teal-dark); }
.result-actions .quiet { margin-left: auto; }
.error-box { margin: auto 0; border-left: 3px solid var(--danger); background: rgba(161,61,53,.055); padding: 22px; }
.error-box strong { color: var(--danger); }
.error-box p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.error-box a { font-size: 12px; }

.service-note { margin-top: 20px; border: 1px solid var(--line); padding: 18px 22px; display: flex; gap: 14px; background: rgba(255,254,249,.5); }
.service-note > span { color: var(--teal); }
.service-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.service-note strong { color: var(--ink); }
footer { color: var(--muted); font-size: 10px; letter-spacing: .08em; border-top: 1px solid var(--line); margin-top: 30px; }

@media (max-width: 850px) {
  .site-header, footer { padding-inline: 20px; }
  main { padding: 42px 20px 30px; }
  .workspace { grid-template-columns: 1fr; }
  .output-panel { min-height: 500px; }
}
@media (max-width: 520px) {
  .brand small { display: none; }
  .source-link { font-size: 11px; }
  .panel { padding: 20px; }
  .task-grid { grid-template-columns: 1fr; }
  .dropzone { min-height: 220px; }
  .preview { height: 220px; }
  .result-actions .quiet { margin-left: 0; }
  footer { align-items: flex-start; gap: 15px; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
