:root {
  color-scheme: light;
  --ink: #2f2924;
  --muted: #786b60;
  --paper: #f3ecdf;
  --card: rgba(255, 253, 248, .97);
  --line: #d9c8b3;
  --accent: #7d1414;
  --accent-soft: #f2e3df;
  --shadow: 0 10px 30px rgba(65, 43, 25, .08);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0, rgba(125, 20, 20, .07), transparent 28rem),
    linear-gradient(180deg, #f8f3e9 0, var(--paper) 28rem);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Microsoft YaHei", serif;
  font-size: 16px;
  line-height: 1.85;
}
.site-header, main { width: calc(100% - 28px); max-width: 760px; margin: 0 auto; }
.site-header { padding: 20px 8px 12px; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font: 600 .72rem/1.4 "Microsoft YaHei", sans-serif;
  letter-spacing: .16em;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: clamp(1.55rem, 4vw, 2rem); letter-spacing: .04em; }
.intro, .status, #person-identity, .record-meta { color: var(--muted); }
.intro { margin: 0; font-size: .94rem; }
.search-panel {
  position: sticky;
  z-index: 5;
  top: 0;
  padding: 12px 15px;
  margin-bottom: 14px;
  background: rgba(255, 253, 248, .95);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.search-panel h2, .search-panel label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.search-row { display: flex; gap: 9px; }
input, button { font: inherit; }
input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid #ccb8a0;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(125, 20, 20, .1); }
button {
  padding: 9px 18px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}
.status { margin: 9px 2px 0; font-size: .84rem; line-height: 1.5; }
.search-results { display: grid; gap: 7px; margin-top: 10px; }
.person-result {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}
.person-result span { color: var(--muted); font-size: .9rem; }
.person-view {
  padding: 22px;
  margin-bottom: 30px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.person-heading {
  padding: 2px 4px 16px;
  border-bottom: 2px solid var(--accent);
}
.person-heading h2 { margin-bottom: 3px; font-size: 1.75rem; }
#person-identity { margin: 0; font-size: .92rem; }
.source-card { margin-top: 12px; border: 1px solid #e2d4c4; border-radius: 11px; overflow: clip; background: #fffefa; }
.source-card summary { padding: 12px 15px; color: var(--accent); font-weight: 700; cursor: pointer; background: #fbf5eb; }
.source-body { padding: 16px; }
.source-body article + article { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--line); }
.record-title { margin: 0 0 5px; font-size: 1rem; }
.record-meta { margin: 0 0 7px; font: .83rem/1.6 "Microsoft YaHei", sans-serif; }
.record-text { white-space: pre-wrap; overflow-wrap: anywhere; text-align: justify; }
.person-citation { color: var(--accent); font-size: .82em; }
.person-cross-reference { color: #7f6a58; font-size: .82em; }
.person-document-quote {
  margin: 1em 0;
  padding: .7em 1.05em;
  border-left: 3px solid #a98565;
  background: #faf6ee;
  color: #40382f;
  white-space: normal;
}
.person-document-quote p { margin: .55em 0; text-indent: 2em; }
.anecdotes-list { white-space: normal; }
.anecdote-entry { padding: 3px 0 16px; }
.anecdote-entry + .anecdote-entry { padding-top: 17px; border-top: 1px dashed #ddcdbb; }
.anecdote-label {
  display: inline-block;
  margin-bottom: 7px;
  padding: 1px 8px;
  border-radius: 999px;
  color: #725b48;
  background: #f1e8da;
  font: .78rem/1.7 "Microsoft YaHei", sans-serif;
}
.anecdote-text { white-space: pre-wrap; text-align: justify; }
.anecdote-citation {
  display: block;
  width: fit-content;
  margin-top: 6px;
  line-height: 1.6;
}
.source-link {
  display: inline-block;
  margin: 0 0 9px;
  color: var(--accent);
  font: .82rem/1.5 "Microsoft YaHei", sans-serif;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.source-link:hover { color: #a11c1c; }

@media (max-width: 520px) {
  .site-header, main { width: min(100% - 18px, 760px); }
  .site-header { padding-top: 20px; }
  .search-panel, .person-view { padding: 13px; border-radius: 11px; }
  .search-row { flex-direction: column; }
  .person-result { flex-direction: column; gap: 0; }
  .source-body { padding: 13px; }
}

@media (min-width: 1000px) {
  .site-header, main { max-width: 1120px; width: calc(100% - 64px); }
  .site-header { padding-top: 32px; }
  .search-panel { padding: 14px 20px; }
  .person-view { padding: 28px 34px; }
  .source-body { padding: 20px 24px; }
}
