:root {
  color-scheme: light dark;
  --bg: #f1efea;
  --panel: #faf9f5;
  --result: #fffefa;
  --ink: #242e2a;
  --subtle: #53635b;
  --accent: #225446;
  --on-accent: #fffefa;
  --line: #cbd1c8;
  --wash: #e4ebe3;
  font: 16px/1.55 "Instrument Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18211d;
    --panel: #202c26;
    --result: #22332a;
    --ink: #f3f4ed;
    --subtle: #bec9bf;
    --accent: #b5deca;
    --on-accent: #17352a;
    --line: #53635b;
    --wash: #304238;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
main { width: min(100%, 1240px); margin: 0 auto; padding: 0 clamp(14px, 4vw, 44px) 36px; }
nav { padding: 17px 0; border-bottom: 1px solid var(--line); font-size: .84rem; }
nav a { color: var(--subtle); text-decoration: none; }
nav a:hover { text-decoration: underline; }
h1, h2, p { margin: 0; }
.head { margin: clamp(21px, 4vw, 44px) 0 1.25rem; }
h1 {
  color: var(--accent);
  font: 800 clamp(2.25rem, 5vw, 3.55rem)/1.14 "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", SimSun, serif;
  letter-spacing: .055em;
}
.head p, .help { color: var(--subtle); margin-top: .58rem; font-size: .88rem; }
.rules {
  display: flex; flex-wrap: wrap; gap: .35rem .6rem; min-width: 0; margin: 0; padding: .48rem 0 0;
  border: 0; font-size: .88rem;
}
.rules legend { padding: 0; font-weight: 700; font-size: .87rem; }
.rules label {
  display: inline-flex; align-items: center; gap: .38rem; min-height: 36px;
  padding: .12rem .6rem; border: 1px solid var(--line); border-radius: .42rem; cursor: pointer;
}
.rules label:has(:checked) { background: var(--wash); }
.rules input { margin: 0; width: 15px; height: 15px; accent-color: var(--accent); cursor: inherit; }
.help { margin: .48rem 0 1rem; font-size: .78rem; }
.editors { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(.7rem, 2vw, 1.1rem); }
.panel {
  padding: clamp(.8rem, 2.5vw, 1.25rem); background: var(--panel);
  border: 1px solid var(--line); border-radius: .7rem; min-width: 0;
}
.output { background: var(--result); }
.panel-head {
  display: flex; min-height: 37px; margin-bottom: .65rem; align-items: center; justify-content: space-between; gap: .35rem;
}
.panel-head h2 { font-size: 1.07rem; letter-spacing: .03em; }
.actions { display: flex; align-items: center; gap: .25rem; }
button {
  min-height: 38px; padding: .35rem .62rem; border: 1px solid transparent; border-radius: .34rem;
  font: inherit; font-size: .86rem; cursor: pointer; white-space: nowrap;
}
button:disabled { cursor: default; opacity: .54; }
.quiet { color: var(--accent); background: transparent; }
.quiet:hover:not(:disabled) { background: var(--wash); }
.primary { color: var(--on-accent); background: var(--accent); font-weight: 700; }
.primary:hover:not(:disabled) { filter: brightness(.87); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
textarea {
  display: block; width: 100%; height: clamp(230px, 47vh, 550px);
  padding: .82rem; border: 1px solid var(--line); border-radius: .45rem;
  background: var(--bg); color: var(--ink); font: inherit; line-height: 1.7; resize: vertical;
}
textarea::placeholder { opacity: 1; color: var(--subtle); }
#result { background: var(--result); }
.status { color: var(--subtle); font-size: .8rem; }
.status:not(:empty) { margin-top: .52rem; }
@media (max-width: 690px) {
  .editors { grid-template-columns: minmax(0, 1fr); }
  textarea { height: 215px; }
  .rules label { min-height: 40px; }
  button { min-height: 42px; }
}
