/* 不使用 Google Fonts（中国大陆访问不稳定），全部用系统字体。 */
:root {
  --bg: #F2F4F6; --surface: #FFFFFF; --note: #E8EDF1; --ink: #17212B; --ink-2: #4A5866; --line: #D5DBE1;
  --accent: #0E6A73; --accent-ink: #FFFFFF;
  --high-bg: #F9DAD6; --high-line: #B3372B; --mid-bg: #FBEBC8; --mid-line: #A56A12; --lex: #2B5FA8;
  --font-display: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --font-text: Georgia, "Times New Roman", "Songti SC", "Noto Serif CJK SC", serif;
  --font-ui: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11171D; --surface: #1A222A; --note: #25303A; --ink: #E6EBEF; --ink-2: #9DAAB6; --line: #2D3843;
    --accent: #4FB6C0; --accent-ink: #0B1A1D;
    --high-bg: #4A2420; --high-line: #FF8A7A; --mid-bg: #45351A; --mid-line: #E7B65A; --lex: #7FB0F0;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.65 var(--font-ui); }
.wrap {
  max-width: 860px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right)) 56px max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 22px;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
h1 { font: 700 28px/1.25 var(--font-display); margin: 0; text-wrap: balance; }
h2 { font: 700 15px/1.3 var(--font-ui); margin: 0; letter-spacing: .04em; }
.lede { margin: 6px 0 0; color: var(--ink-2); max-width: 62ch; }
.langsw { flex: none; color: var(--accent); font-weight: 500; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: var(--surface); }
.langsw:hover { border-color: var(--accent); }

.mode { display: flex; gap: 10px; flex-wrap: wrap; }
.seg {
  flex: 1 1 150px; min-height: 48px; padding: 6px 16px; border-radius: 8px; cursor: pointer; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); font: 700 16px/1.2 var(--font-ui); display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.seg small { font: 400 12px/1 var(--font-ui); color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; }
.seg.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg:disabled { opacity: .6; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-weight: 700; font-size: 14px; }
select, .coderow input {
  min-height: 44px; padding: 0 12px; font: 400 15px/1.3 var(--font-ui); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; max-width: 100%;
}
.coderow { display: flex; gap: 10px; flex-wrap: wrap; }
.coderow input { flex: 1 1 200px; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.hint { margin: 0; font-size: 13px; color: var(--ink-2); }
.typeNote { margin: 0; font-size: 13.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.typeNote .lim { color: var(--ink); font-weight: 500; }

.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 22px 16px; border: 2px dashed var(--line); border-radius: 8px; cursor: pointer; background: var(--bg); }
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); }
.drop b { font-size: 15px; }
.drop span { font-size: 13px; color: var(--ink-2); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.filebox { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.fileline { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.fileline b { overflow-wrap: anywhere; }
summary { cursor: pointer; color: var(--accent); font-size: 13.5px; }
.preview { margin-top: 8px; max-height: 220px; overflow: auto; font: 400 14px/1.7 var(--font-text); white-space: pre-wrap; background: var(--bg); border-radius: 6px; padding: 10px 12px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.count { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
button { font: 500 14px/1 var(--font-ui); min-height: 40px; padding: 0 16px; border-radius: 6px; cursor: pointer; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, .drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.status { margin: 0; min-height: 22px; font-size: 13.5px; color: var(--ink-2); }
.status.busy::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 8px; vertical-align: -1px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation: none; } }
.privacy { margin: 0; font-size: 13px; color: var(--ink-2); }

.chip { display: inline-block; font-size: 13px; line-height: 1.4; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.chip.warn { border-color: var(--mid-line); background: var(--mid-bg); color: var(--ink); }
.chip.ok { border-color: var(--accent); color: var(--ink); }

.rhead { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 26px; height: 14px; border-radius: 2px; }
.sw.high { background: var(--high-bg); border-bottom: 2px solid var(--high-line); }
.sw.mid { background: var(--mid-bg); border-bottom: 2px dashed var(--mid-line); }
.sw.lexsw { height: 10px; border-bottom: 2px dotted var(--lex); }

.overall { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-overall { margin: 0; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.ai-overall b { margin-right: 6px; }

.essay { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.para { padding-block: 10px; border-top: 1px solid var(--line); }
.ptext { margin: 0; font: 400 17px/2 var(--font-text); overflow-wrap: anywhere; }
.s { border-radius: 2px; padding: 1px 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.s.high { background: var(--high-bg); text-decoration: underline solid var(--high-line) 2px; text-underline-offset: 3px; }
.s.mid { background: var(--mid-bg); text-decoration: underline dashed var(--mid-line) 2px; text-underline-offset: 3px; }
.s.kept { background: transparent; text-decoration: none; }
.lex { text-decoration: underline dotted var(--lex) 2px; text-underline-offset: 4px; }

.br { font: 400 13.5px/1.7 var(--font-ui); color: var(--ink); background: var(--note); border-radius: 4px; padding: 2px 6px; margin-inline: 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.br .tag { font-weight: 700; font-size: 12px; margin-right: 4px; padding: 0 6px; border-radius: 3px; border: 1px solid var(--line); }
.br.high .tag { background: var(--high-bg); border-color: var(--high-line); }
.br.mid .tag { background: var(--mid-bg); border-color: var(--mid-line); }
.br.kept { color: var(--ink-2); }
.lnk { min-height: 0; padding: 0 4px; margin-left: 4px; background: none; border: none; color: var(--accent); text-decoration: underline; font: 500 13px/1.6 var(--font-ui); cursor: pointer; }
.why { margin: 6px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.why p { margin: 0; }
.why .src { font-size: 12px; color: var(--ink-2); }
.why .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.why .tags .chip { font-size: 12px; padding: 1px 8px; }
.why button { align-self: flex-start; min-height: 34px; font-size: 13px; }

.foot { font-size: 13px; color: var(--ink-2); max-width: 80ch; border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.foot p { margin: 0; }

dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 22px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 16, 22, .6); }
dialog h2 { font: 700 20px/1.3 var(--font-display); letter-spacing: 0; margin-bottom: 10px; }
dialog p { margin: 0 0 12px; }
dialog input { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--note); color: var(--ink-2); font: 400 15px/1 var(--font-ui); }
dialog .note { font-size: 13px; color: var(--ink-2); margin-top: 10px; }
dialog .row { display: flex; justify-content: flex-end; margin-top: 16px; }

@media (max-width: 640px) { h1 { font-size: 24px; } .ptext { font-size: 16px; } }

.demobar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; justify-content: space-between; background: var(--note); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.why .exp { color: var(--ink); }
