:root {
  color-scheme: light;
  --ink: #162e35;
  --muted: #496068;
  --paper: #f0f4f4;
  --sheet: #ffffff;
  --teal: #194b50;
  --gold: #93652a;
  --line: #c9d6d8;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.65; }
a { color: var(--teal); text-underline-offset: .18em; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button {
  min-height: 44px;
  padding: .55rem .95rem;
  border: 1px solid #879fa3;
  border-radius: 5px;
  background: var(--sheet);
  color: var(--ink);
  font-weight: 650;
}
button:hover { border-color: var(--teal); background: #e7f0ef; }
button.primary { background: var(--teal); border-color: var(--teal); color: white; }
button.primary:hover { background: #123b3f; }
button.quiet { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: .16em; }
:focus-visible { outline: 3px solid #a36b20; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h2 { font-size: 1.43rem; line-height: 1.3; }
h3 { font-size: 1.08rem; line-height: 1.35; }
.top { border-bottom: 1px solid var(--line); background: var(--sheet); }
.top-inner, .shell { max-width: 1120px; margin-inline: auto; padding-inline: 28px; }
.top-inner { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { font-weight: 800; text-decoration: none; }
.brand span { padding-left: .5rem; font-size: .875rem; font-weight: 600; color: var(--muted); }
.local-label, .hint { color: var(--muted); font-size: .88rem; }
.intro { padding: 2.4rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.section-mark { color: var(--gold); font-weight: 750; margin-bottom: .45rem; }
h1 { font-family: "Songti SC", SimSun, "Microsoft YaHei", serif; font-size: clamp(2.2rem, 5.2vw, 4.1rem); line-height: 1.12; margin-bottom: .75rem; letter-spacing: -.04em; }
.lead { font-size: clamp(1rem, 2.3vw, 1.18rem); max-width: 38em; color: var(--muted); }
.intro .hint { margin: .8rem 0 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.notice { margin: 1rem 0 0; padding: .65rem .85rem; border-left: 3px solid var(--teal); background: #e6efee; overflow-wrap: anywhere; }
.notice[data-error="true"] { border-color: #a14c38; background: #f8ece7; color: #673525; }
.steps { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1.35rem; margin: 1.15rem 0; font-size: .91rem; }
.mode-label { font-weight: 800; color: var(--teal); }
.practice { padding: 1.2rem 1.35rem; background: #f9f4e8; border-left: 4px solid var(--gold); margin-bottom: 1.25rem; }
.practice p:last-child { margin-bottom: 0; }
.sheet { padding: 1.45rem; margin-bottom: 1.25rem; background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; scroll-margin-top: 1rem; }
.sheet-head { display: flex; gap: .9rem; align-items: baseline; padding-bottom: .7rem; margin-bottom: .8rem; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin-bottom: .25rem; }
.sheet-head p { color: var(--muted); margin: 0; }
.step-number { color: var(--gold); font-size: 1.15rem; font-weight: 800; }
.field-grid, .review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1.25rem; }
.field { display: grid; gap: .25rem; margin-bottom: .6rem; min-width: 0; }
.field span { font-weight: 650; }
input, textarea, select { display: block; width: 100%; min-width: 0; padding: .55rem .65rem; color: var(--ink); background: #fbfcfc; border: 1px solid #97afb2; border-radius: 4px; min-height: 44px; }
textarea { resize: vertical; }
.subhead { display: flex; flex-wrap: wrap; gap: .4rem .65rem; justify-content: space-between; align-items: center; margin: .85rem 0 .45rem; }
.subhead h3 { margin: 0; }
.subhead button { font-size: .89rem; }
.rows > p { margin: .3rem 0 .6rem; }
.record-row { border: 1px solid var(--line); border-top: 3px solid var(--teal); padding: .85rem .9rem .65rem; margin: .6rem 0; min-width: 0; }
.record-row h4 { margin: 0 0 .5rem; font-size: .95rem; color: var(--teal); }
.permission .record-row { border-top-color: var(--gold); }
.permission .record-row h4 { color: var(--gold); }
.ledger { min-width: 0; }
.choice { margin-top: .9rem; }
.reply-block { padding: .8rem .9rem .5rem; margin-bottom: .85rem; border-left: 3px solid var(--gold); background: #faf7ef; }
.reply-block .hint { margin: .4rem 0; }
.archive, .takeaway { border-top: 1px solid var(--line); padding: 1.2rem 0; }
.archive h2, .takeaway h2 { margin-bottom: .35rem; }
.archive details { background: var(--sheet); padding: .65rem .85rem; border: 1px solid var(--line); border-bottom: 0; }
.archive details:last-child { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; color: var(--teal); font-weight: 700; min-height: 34px; }
.reading { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; background: #f3f7f7; padding: .65rem .75rem; margin: .45rem 0 .7rem; }
dialog { border: 1px solid #8fa7aa; border-radius: 8px; padding: 1.15rem; width: min(850px, calc(100% - 24px)); max-height: calc(100% - 28px); color: var(--ink); overflow: auto; }
dialog::backdrop { background: rgba(18, 43, 49, .62); }
.handoff-choices { min-width: 0; border: 1px solid var(--line); margin: 0 0 .85rem; padding: .35rem .75rem; }
.handoff-choices legend { font-weight: 700; }
.handoff-choices label { display: flex; min-height: 40px; align-items: center; gap: .65rem; cursor: pointer; }
.handoff-choices input { width: 1.1rem; height: 1.1rem; min-height: 0; padding: 0; accent-color: var(--teal); }
#handoffPreview { background: #f3f7f7; }
dialog h2 { margin-bottom: .55rem; }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.comparison-grid section { min-width: 0; }
.comparison-grid .reading { max-height: 15rem; overflow: auto; }
.diff-part { padding-top: .65rem; border-top: 1px solid var(--line); }
.diff-part h3 { margin-bottom: .25rem; }
.diff-part .reading { max-height: 8rem; }
.compare-label { font-weight: 700; color: var(--teal); margin-bottom: .2rem; font-size: .88rem; }
.dialog-actions { padding-top: .85rem; }
footer { margin-top: 1rem; padding: 1rem 1.25rem 1.7rem; text-align: center; font-size: .85rem; color: var(--muted); }
@media (max-width: 700px) {
  .top-inner, .shell { padding-inline: 16px; }
  .intro { padding-top: 1.7rem; }
  .field-grid, .review-grid, .comparison-grid { grid-template-columns: minmax(0, 1fr); }
  .sheet { padding: .95rem; }
  .steps { gap: .35rem .9rem; }
  .sheet-head { gap: .55rem; }
  .comparison-grid .reading { max-height: 9rem; }
}

/* Decision reflection stays in the same workspace as the draft. */
.reflection:not([hidden]), .reflection-result:not([hidden]), .reflection-item {
  display: grid;
  gap: .85rem;
  min-width: 0;
}
.reflection { margin-top: 1rem; }
.reflection fieldset { min-width: 0; border: 1px solid currentColor; border-radius: .6rem; padding: .75rem; }
.reflection fieldset > div { display: grid; gap: .65rem; }
.reflection-check { display: flex; align-items: flex-start; gap: .55rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.reflection-check input[type="checkbox"] { flex: none; inline-size: 1.15rem; block-size: 1.15rem; min-inline-size: 1.15rem; min-block-size: 0; padding: 0; margin: .15rem 0 0; accent-color: var(--teal); }
.reflection-check span { flex: 1; min-inline-size: 0; }
.reflection-result, .reflection-item { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid currentColor; }
.reflection-result > :is(h3,p), .reflection-item > :is(h4,p,ul) { margin: 0; }
.reflection-refs { padding-inline-start: 1.25rem; overflow-wrap: anywhere; }
.reflection .reading, #reflectionDialog .reading { overflow-wrap: anywhere; }
#reflectionDialog .reading { max-height: 42vh; overflow: auto; }