:root {
  color-scheme: light;
  --ground: #e7ece6;
  --paper: #fdfdfa;
  --ink: #212a23;
  --muted: #525d52;
  --line: #cdd1c4;
  --line-soft: #e2e4da;
  --line-strong: #a5ae9f;
  --field-line: #879182;
  --green: #283830;
  --green-strong: #192b22;
  --green-pale: #e2e8db;
  --oxide: #923c2c;
  --rust-wash: #f7eee4;
  --radius: 4px;
  --measure: 72ch;
  --gutter: 34px;
  --actions: 76px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-bottom: calc(var(--actions) + env(safe-area-inset-bottom) + 14px); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-size: .9375rem;
  line-height: 1.55;
}
::selection { background: #d6e4cf; color: var(--green-strong); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--oxide); outline-offset: 3px; }
a { color: var(--green-strong); text-underline-offset: .2em; }
h1, h2, h3, p { margin: 0; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 650;
  white-space: nowrap;
}
.button svg, [data-icon] svg { display: block; }
.button:disabled { opacity: .6; cursor: not-allowed; }
.ghost { background: transparent; color: var(--green-strong); }
.ghost:hover { background: var(--green-pale); }
.outline { border-color: var(--field-line); background: var(--paper); color: var(--green-strong); }
.outline:hover { background: var(--green-pale); }
.primary { background: var(--green); color: var(--paper); }
.primary:hover { background: var(--green-strong); }

.topbar { background: var(--green); color: #fcfcf3; }
.top-inner, .page, .action-inner {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.top-inner, .action-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-inner { min-height: 62px; }
.brand, .top-actions, .foot-actions, .dialog-actions { display: flex; align-items: center; gap: 10px; }
.brand { white-space: nowrap; gap: 12px; }
.brand strong { font-size: 1rem; font-weight: 750; letter-spacing: .06em; }
.brand span { font-size: .8125rem; color: #d9e3d6; padding-left: 12px; border-left: 1px solid #839482; }
.topbar .button { min-height: 40px; color: #fcfcf3; background: transparent; }
.topbar .outline { border-color: #9ba998; }
.topbar .button:hover { background: #415549; }
.topbar :focus-visible { outline-color: #e6d0a7; }

.page {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  padding-block: 32px calc(var(--actions) + env(safe-area-inset-bottom) + 26px);
}
.contents { position: sticky; top: 24px; min-width: 0; }
.contents-title { font-size: .875rem; font-weight: 750; padding: 5px 0 12px; border-bottom: 1px solid var(--line); }
.contents ol { list-style: none; padding: 0; margin: 0; }
.step-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-size: .875rem;
}
.step-link:hover { background: #e8ebdf; }
.step-link[aria-current="location"] { background: var(--green-pale); color: var(--green-strong); font-weight: 750; }
.step-number, .chapter-number, .review-status strong {
  font-variant-numeric: lining-nums tabular-nums;
}
.step-number { color: var(--muted); font-size: .8125rem; }
.step-link[aria-current="location"] .step-number { color: var(--oxide); }
.contents-note { color: var(--muted); font-size: .8125rem; margin-top: 16px; }

.sheet {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--oxide);
  padding: 32px 42px 23px;
}
.sheet-heading { padding-bottom: 22px; }
.sheet-heading h1 {
  font-family: "Noto Serif CJK SC", "Songti SC", "SimSun", serif;
  font-size: 2.125rem;
  font-weight: 750;
  line-height: 1.26;
  letter-spacing: .01em;
}
.sheet-heading p, .chapter-head p { color: var(--muted); max-width: var(--measure); }
.sheet-heading p { margin-top: 9px; }
.chapter { border-top: 1px solid var(--line-strong); padding: 24px 0 30px; scroll-margin-top: 20px; }
.chapter-head { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: baseline; gap: 12px; }
.chapter-number { color: var(--oxide); font-size: 1rem; font-weight: 700; }
.chapter-head h2 { font-size: 1.375rem; line-height: 1.35; }
.chapter-head p { margin-top: 3px; font-size: .875rem; }
.chapter-body { margin: 17px 0 0 48px; min-width: 0; }
.chapter-note { margin-top: 17px; border-top: 1px solid var(--line-soft); padding-top: 9px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; color: var(--muted); font-size: .8125rem; }
.chapter-note strong { color: var(--ink); }
.sheet-end { padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 16px;
  padding: 3px 9px 3px 12px;
  background: var(--rust-wash);
  color: #693625;
  font-size: .875rem;
}
.demo-banner .button { color: inherit; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 20px; }
.wide { grid-column: 1 / -1; }
.field { display: grid; align-content: start; min-width: 0; }
.field-group { min-width: 0; }
.field-group + .field-group { margin-top: 21px; }
.group-title { padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px solid var(--line-soft); font-size: .9375rem; font-weight: 750; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.field-name, .field-title, fieldset legend { color: var(--ink); font-weight: 650; font-size: .875rem; }
.key {
  display: inline-block;
  margin-inline-start: 6px;
  font-weight: 650;
  color: var(--oxide);
  font-size: .75rem;
}
.skip {
  flex: none;
  min-height: 34px;
  padding: 1px 6px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: .8125rem;
  text-decoration: underline;
  text-decoration-color: #879283;
  text-underline-offset: .2em;
}
.skip:hover { background: var(--green-pale); color: var(--green-strong); }
.skip[data-restore] { color: var(--green-strong); font-weight: 700; }
.field input, .field select, .field textarea, .photo select, .copy-fallback {
  min-height: 42px;
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  color: var(--ink);
  caret-color: var(--oxide);
  background: #fff;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
}
.field select, .photo select { padding-right: 24px; }
.field textarea { min-height: 83px; line-height: 1.55; resize: vertical; field-sizing: content; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--muted); }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline-offset: 1px; }
.hint { color: var(--muted); font-size: .8125rem; line-height: 1.55; }
.field .hint:not(.skipped-note) { margin-top: 5px; }
.skipped-note { min-height: 42px; display: flex; align-items: center; border-bottom: 1px dashed var(--field-line); padding: 5px 10px; }

fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
fieldset legend { padding: 0; margin-bottom: 6px; }
fieldset legend .skip { margin-left: 6px; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.choice, .chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: .875rem;
  cursor: pointer;
}
.choice:hover, .chip:hover { border-color: var(--green); }
.choice:has(input:checked), .chip:has(input:checked) { background: var(--green-pale); border-color: var(--green); }
.choice input, .chip input { margin: 0; accent-color: var(--green); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.notice { padding: 8px 11px; background: #edf0e5; color: #3d5143; font-size: .875rem; line-height: 1.55; }
#kind-fields:empty { display: none; }
.section-rule { border-top: 1px solid var(--line); padding-top: 10px; }

.attachments { display: grid; gap: 7px; }
.attachment-head { display: flex; align-items: center; gap: 12px; }
.photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.photo { min-width: 0; padding: 7px; border: 1px solid var(--line); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--ground); display: block; }
.photo p { margin: 5px 0; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo select { min-height: 36px; font-size: .875rem; }
.photo .button { min-height: 36px; padding-inline: 6px; margin-top: 3px; }

.review-status { display: flex; flex-wrap: wrap; gap: 5px 19px; margin-bottom: 18px; padding: 10px 12px; background: #edf0e5; font-size: .875rem; }
.review-status strong { color: var(--green-strong); }
.review-block { border-top: 1px solid var(--line-soft); padding: 13px 0; }
.review-block h3 { margin-bottom: 5px; font-size: .9375rem; }
.review-block p, .review-block li { font-size: .875rem; }
.review-block ul { margin: 0; padding-left: 21px; }
.review-block li + li { margin-top: 5px; }
.review-block.risks h3 { color: var(--oxide); }
.review-block a { display: inline-block; padding: 3px 0; }
.review-block a:hover { color: var(--oxide); }

.action-bar {
  position: fixed;
  z-index: 2;
  inset: auto 0 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.action-inner { min-height: 64px; }
.save-status { color: var(--muted); font-size: .8125rem; display: flex; align-items: center; gap: 7px; }
.save-status i { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #426a4f; }
.save-status.problem { color: var(--oxide); }
.save-status.problem i { background: var(--oxide); }

dialog { width: min(420px, calc(100% - 28px)); border: 1px solid var(--field-line); border-radius: var(--radius); padding: 22px; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #18261db3; }
dialog h2 { margin-bottom: 7px; font-size: 1.25rem; }
dialog p { color: var(--muted); }
.dialog-actions { justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; bottom: calc(var(--actions) + env(safe-area-inset-bottom)); right: 18px; z-index: 3; max-width: min(420px, calc(100% - 36px)); background: var(--green-strong); color: var(--paper); border-radius: var(--radius); padding: 10px 14px; }
.copy-fallback { margin-top: 8px; min-height: 120px; }

@media (max-width: 970px) {
  :root { --gutter: 22px; }
  .page { grid-template-columns: 145px minmax(0, 1fr); gap: 18px; }
  .sheet { padding-inline: 27px; }
  .chapter-body { margin-left: 0; }
}
@media (max-width: 700px) {
  :root { --gutter: 13px; }
  html { scroll-padding-top: 52px; }
  .top-inner { min-height: 53px; }
  .brand { gap: 7px; }
  .brand span { padding-left: 7px; }
  .top-actions, .foot-actions { gap: 5px; }
  .top-actions .button { padding-inline: 7px; font-size: .8125rem; min-height: 44px; }
  .page { display: block; padding-top: 0; }
  .contents { top: 0; z-index: 1; background: var(--ground); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); border-bottom: 1px solid var(--line); }
  .contents-title, .contents-note, .step-number { display: none; }
  .contents ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .step-link { min-height: 47px; justify-content: center; padding: 5px 2px; border-bottom: 2px solid transparent; text-align: center; font-size: .8125rem; }
  .step-link[aria-current="location"] { border-bottom-color: var(--oxide); }
  .sheet { margin-top: 12px; padding: 19px 14px 17px; }
  .sheet-heading { padding-bottom: 16px; }
  .sheet-heading h1 { font-size: 1.625rem; }
  .sheet-heading p { margin-top: 7px; font-size: .875rem; }
  .chapter { padding: 18px 0 23px; scroll-margin-top: 8px; }
  .chapter-head { grid-template-columns: 27px minmax(0, 1fr); gap: 5px; }
  .chapter-head h2 { font-size: 1.1875rem; }
  .chapter-body { margin-top: 13px; }
  .chapter-note { gap: 7px; }
  .fields { gap: 8px 12px; }
  .field input, .field select, .field textarea { font-size: 1rem; }
  .skip { min-height: 44px; }
  .choice, .chip { min-height: 44px; }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-inner { min-height: 60px; }
  .action-inner .button { min-height: 44px; padding-inline: 8px; }
  .save-status { gap: 4px; }
}
@media (max-width: 480px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .brand span { display: none; }
  .step-link { white-space: nowrap; }
  .action-inner { flex-wrap: wrap; row-gap: 4px; padding-block: 7px; }
  .foot-actions { margin-left: auto; }
  #copy-button [data-icon] { display: none; }
}
@media (forced-colors: active) {
  .step-link[aria-current="location"] { outline: 1px solid currentColor; outline-offset: -1px; }
}
