/* High-contrast form controls and surface corrections for the light theme.
   Loaded after page-level styles so embedded page rules use the same palette. */
html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="file"]):not([type="image"]):not([type="hidden"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] [contenteditable="true"] {
  color: #2c2418 !important;
  background-color: #fffdf9 !important;
  border-color: #b8ad9b !important;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder,
html[data-theme="light"] [contenteditable="true"][data-placeholder]::before {
  color: #756951;
  opacity: 1;
}

html[data-theme="light"] select option,
html[data-theme="light"] select optgroup {
  color: #2c2418;
  background-color: #fffdf9;
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] [contenteditable="true"]:focus {
  border-color: #8a1f1f !important;
  box-shadow: 0 0 0 3px rgba(138, 31, 31, .14) !important;
}

html[data-theme="light"] input[type="checkbox"],
html[data-theme="light"] input[type="radio"] {
  accent-color: #8a1f1f;
}

html[data-theme="light"] input:disabled,
html[data-theme="light"] select:disabled,
html[data-theme="light"] textarea:disabled {
  color: #71644f;
  background-color: #eee8dd;
}

html[data-theme="light"] .search-box:focus-within {
  border-color: #8a1f1f;
  box-shadow: 0 0 0 3px rgba(138, 31, 31, .1);
}

html[data-theme="light"] .topbar {
  background: rgba(250, 247, 240, .94);
}

/* Replace a few legacy dark-only surfaces in the recognition and admin views. */
html[data-theme="light"] .gen-review-panel,
html[data-theme="light"] .exp-stats-box,
html[data-theme="light"] .exp-suggest-body {
  color: #2c2418;
  background: #fffdf9;
  border-color: #c9bfaf;
}

html[data-theme="light"] .exp-stats-box {
  border: 1px solid #c9bfaf;
}

html[data-theme="light"] .exp-stats-list li {
  border-bottom-color: rgba(67, 52, 29, .16);
}

html[data-theme="light"] .exp-stats-list li b {
  color: #2c2418;
}

html[data-theme="light"] .exp-stats-list button,
html[data-theme="light"] .exp-hints-stat,
html[data-theme="light"] .exp-suggest-body.loading {
  color: #71644f;
}

html[data-theme="light"] .exp-fb-btn {
  color: #5a4e3a;
  border-color: #b8ad9b;
}

html[data-theme="light"] .exp-stats-list .hit-n,
html[data-theme="light"] .exp-import-msg.ok {
  color: #176b37;
}

html[data-theme="light"] .exp-stats-list .miss-n,
html[data-theme="light"] .exp-import-msg.err {
  color: #a01b1b;
}

html[data-theme="light"] #sys-usage-totals .u-cell {
  color: #2c2418;
  background: #fffdf9;
  border-color: #c9bfaf;
}

html[data-theme="light"] #sys-usage-totals .u-num {
  color: #2c2418;
}

html[data-theme="light"] #sys-usage-totals .u-lbl,
html[data-theme="light"] #view-system .gen-tag {
  color: #71644f;
}

html[data-theme="light"] #sys-usage-raw td {
  color: #2c2418;
}

html[data-theme="light"] #sys-admin-list {
  overflow-x: auto;
}

html[data-theme="light"] #sys-admin-list table {
  color: #2c2418;
}

html[data-theme="light"] #sys-admin-list th,
html[data-theme="light"] #sys-admin-list td {
  padding: 8px 10px;
  vertical-align: middle;
}

html[data-theme="light"] #sys-admin-list tbody tr:hover {
  background: rgba(67, 52, 29, .045);
}

html[data-theme="light"] #sys-admin-list .btn {
  min-height: 32px;
}

/* Keep the paper theme consistent across the rest of the application. */
html[data-theme="light"] .glass {
  background-color: rgba(255, 253, 249, .76);
  border-color: rgba(92, 72, 42, .16);
}

html[data-theme="light"] .glass:hover {
  border-color: rgba(92, 72, 42, .28);
}

html[data-theme="light"] .section-head .kicker,
html[data-theme="light"] .eyebrow {
  color: #72510c;
}

html[data-theme="light"] .nav a.active {
  color: #781e1c;
  background: rgba(138, 31, 31, .09);
}

html[data-theme="light"] .clan-card,
html[data-theme="light"] .feat,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .result-card {
  background-color: rgba(255, 253, 249, .8);
  border-color: #d0c6b6;
}

html[data-theme="light"] .view .section-head p,
html[data-theme="light"] .view .lead {
  color: #5a4e3a;
}

html[data-theme="light"] .tree-wrap,
html[data-theme="light"] #tree-svg {
  background-color: #f0e9dc;
  border-color: #d0c6b6;
}

html[data-theme="light"] .tree-btn,
html[data-theme="light"] .chip,
html[data-theme="light"] .person-chip {
  color: #514632;
  border-color: #c9bfaf;
}

html[data-theme="light"] .tree-btn:hover,
html[data-theme="light"] .chip:hover,
html[data-theme="light"] .person-chip:hover {
  background-color: rgba(138, 31, 31, .07);
}

html[data-theme="light"] .export-excel-btn,
html[data-theme="light"] .export-excel-btn:hover {
  color: #fff !important;
  border-color: transparent;
}

html[data-theme="light"] .rq-table,
html[data-theme="light"] .rq-table td,
html[data-theme="light"] .rq-table th,
html[data-theme="light"] #view-upload .uj-table td,
html[data-theme="light"] #view-upload .uj-table th,
html[data-theme="light"] #view-reclogs table td,
html[data-theme="light"] #view-reclogs table th {
  color: #393121;
  border-color: #d0c6b6;
}

html[data-theme="light"] #view-upload .uj-table th,
html[data-theme="light"] #view-reclogs table th {
  background: #eee6d8;
}

html[data-theme="light"] #view-upload .uj-row:hover td,
html[data-theme="light"] #view-reclogs tbody tr:hover td {
  background: rgba(92, 72, 42, .055);
}

html[data-theme="light"] #view-upload .uj-detail td,
html[data-theme="light"] #view-reclogs .rl-detail-row td {
  background: #f1eadf;
}

html[data-theme="light"] #view-upload .uj-success,
html[data-theme="light"] #view-reclogs .rl-done {
  color: #176b37;
}

html[data-theme="light"] #view-upload .uj-done_with_errors,
html[data-theme="light"] #view-reclogs .rl-awaiting_review {
  color: #795600;
}

html[data-theme="light"] #view-upload .uj-running,
html[data-theme="light"] #view-upload .uj-stopping,
html[data-theme="light"] #view-reclogs .rl-running {
  color: #174f99;
}

html[data-theme="light"] #view-upload .uj-stopped {
  color: #514632;
}

html[data-theme="light"] #view-upload .uj-failed,
html[data-theme="light"] #view-upload .uj-errs li,
html[data-theme="light"] #view-reclogs .rl-failed {
  color: #a01b1b;
}

/* Recognition review panels were authored with fixed dark surfaces. */
html[data-theme="light"] #view-generate .gen-review-panel,
html[data-theme="light"] #view-generate .gr-page,
html[data-theme="light"] #view-generate .gr-issue-current,
html[data-theme="light"] #view-generate .gr-proposal,
html[data-theme="light"] #view-generate .gr-exp-item {
  color: #2c2418;
  background: #fffdf9;
  border-color: #c9bfaf;
}

html[data-theme="light"] #view-generate .gr-stats,
html[data-theme="light"] #view-generate .gr-remark,
html[data-theme="light"] #view-generate .gr-exp-ts,
html[data-theme="light"] #view-generate .gr-exp-issue,
html[data-theme="light"] #view-generate .gr-speech-row textarea::placeholder {
  color: #71644f;
}

html[data-theme="light"] #view-generate .gr-stats b,
html[data-theme="light"] #view-generate .gr-page-no,
html[data-theme="light"] #view-generate .gr-name,
html[data-theme="light"] #view-generate .gr-xc-row b {
  color: #2c2418;
}

html[data-theme="light"] #view-generate .gr-father,
html[data-theme="light"] #view-generate .gr-father-adopt,
html[data-theme="light"] #view-generate .gr-bd,
html[data-theme="light"] #view-generate .gr-corr .reason {
  color: #514632;
}

html[data-theme="light"] #view-generate .gr-sim {
  color: #174f99;
  background: rgba(26, 86, 181, .07);
}

html[data-theme="light"] #view-generate .gen-tokens-body,
html[data-theme="light"] #view-generate .gen-logbox {
  color: #393121;
  background: #f1eadf;
  border-color: #d0c6b6;
}

html[data-theme="light"] #view-generate .gen-logbox .ln {
  color: #71644f;
}

html[data-theme="light"] #view-experience .exp-tab,
html[data-theme="light"] #view-experience .exp-badge,
html[data-theme="light"] #view-experience .exp-item {
  color: #393121;
  background: #fffdf9;
  border-color: #d0c6b6;
}

html[data-theme="light"] #view-experience .exp-item .exp-src {
  color: #514632;
  background: #eee8dd;
}

html[data-theme="light"] #view-experience .exp-item .exp-src.review_apply,
html[data-theme="light"] #view-experience .exp-item .exp-correction {
  color: #176b37;
}

html[data-theme="light"] #view-experience .exp-item .exp-src.review_record {
  color: #174f99;
}

html[data-theme="light"] #view-experience .exp-item .exp-src.auto,
html[data-theme="light"] #view-experience .exp-item .exp-pattern {
  color: #795600;
}

html[data-theme="light"] #view-experience .exp-fb-btn {
  color: #514632;
  border-color: #b8ad9b;
}

html[data-theme="light"] #view-system .cfg-group-title,
html[data-theme="light"] #view-system .usage-subtitle,
html[data-theme="light"] #view-system #sys-usage-by-model th,
html[data-theme="light"] #view-system #sys-usage-by-code th,
html[data-theme="light"] #view-system #sys-usage-by-day th,
html[data-theme="light"] #view-system #sys-usage-raw th {
  color: #70520d;
}

html[data-theme="light"] #view-system #sys-usage-by-model td,
html[data-theme="light"] #view-system #sys-usage-by-code td,
html[data-theme="light"] #view-system #sys-usage-by-day td,
html[data-theme="light"] #view-system #sys-usage-raw td {
  color: #393121;
  border-color: rgba(67, 52, 29, .13);
}

html[data-theme="light"] #view-system details[open] > summary {
  color: #514632;
  background: #f0e9dc;
}

/* Keep code readable while surrounding optimizer panels follow the paper theme. */
html[data-theme="light"] #view-optimizer .opt-files,
html[data-theme="light"] #view-optimizer .opt-evolve,
html[data-theme="light"] #view-optimizer .opt-evo-card,
html[data-theme="light"] #view-optimizer .opt-history-box,
html[data-theme="light"] #view-optimizer .opt-hist-item,
html[data-theme="light"] #view-optimizer .opt-journal-stats,
html[data-theme="light"] #view-optimizer .opt-journal-item,
html[data-theme="light"] #view-optimizer .opt-breadcrumb,
html[data-theme="light"] #view-optimizer .opt-guard-cell {
  color: #393121;
  background-color: rgba(255, 253, 249, .84);
  border-color: #d0c6b6;
}

html[data-theme="light"] #view-optimizer .opt-file-item .fi-name,
html[data-theme="light"] #view-optimizer .opt-hist-item .hv-note,
html[data-theme="light"] #view-optimizer .opt-journal-item .ji-file,
html[data-theme="light"] #view-optimizer .opt-journal-item .ji-note,
html[data-theme="light"] #view-optimizer .opt-guard-cell .gc-name {
  color: #393121;
}

html[data-theme="light"] #view-optimizer .opt-evo-card .ev-pri.high {
  color: #8b201b;
}

html[data-theme="light"] #view-optimizer .opt-evo-card .ev-pri.medium,
html[data-theme="light"] #view-optimizer .opt-evo-card .ev-file {
  color: #70520d;
}

html[data-theme="light"] #view-optimizer .opt-code-wrap,
html[data-theme="light"] #view-optimizer .opt-question,
html[data-theme="light"] #view-optimizer .opt-editor {
  background: #17202b;
  color: #e3e8ee;
}

/* Soft paper atmosphere for the non-home application views. */
.view:not(#view-home) {
  position: relative;
  isolation: isolate;
}

.view:not(#view-home)::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: min(440px, 48vh);
  pointer-events: none;
  background:
    radial-gradient(ellipse at 86% 5%, var(--gold-soft) 0, transparent 34%),
    radial-gradient(ellipse at 8% 18%, var(--accent-soft) 0, transparent 38%),
    linear-gradient(180deg, var(--surface) 0, transparent 100%);
  opacity: .17;
}

.view:not(#view-home) .section-head {
  position: relative;
  padding-bottom: 17px;
}

.view:not(#view-home) .section-head::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 54px;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  opacity: .72;
}

/* Give the existing domain icons a quiet seal-like backing. */
.feat .ico,
#view-optimizer .opt-hc-icon {
  display: inline-grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 3px;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, var(--border));
  border-radius: 16px 16px 16px 5px;
  background: linear-gradient(145deg, var(--surface-solid), color-mix(in srgb, var(--gold) 12%, transparent));
  box-shadow: inset 0 1px rgba(255,255,255,.32), 0 5px 14px rgba(57, 37, 12, .08);
  font-size: 27px;
  line-height: 1;
}

.clan-card,
.stat-card,
.feat,
.result-card,
.surname-card,
#view-generate .gd-card {
  position: relative;
  overflow: hidden;
}

.clan-card::before,
.stat-card::before,
.feat::before,
.result-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--accent));
  opacity: .55;
  transition: opacity .2s, width .2s;
}

.clan-card:hover::before,
.stat-card:hover::before,
.feat:hover::before,
.result-card:hover::before {
  width: 4px;
  opacity: .9;
}

.stat-card .sv {
  display: inline-block;
  padding: 2px 12px 5px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent-soft), transparent);
}

.surname-card {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, var(--glass-bg), var(--surface));
  aspect-ratio: auto;
  min-height: 148px;
  padding: 10px 7px 11px;
  justify-content: flex-start;
  gap: 3px;
  overflow: visible;
  box-shadow: inset 0 1px rgba(255,255,255,.42), 0 3px 10px rgba(57,37,12,.045);
}

.surname-grid {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  align-items: stretch;
  gap: 12px;
}

.surname-card:hover {
  z-index: 1;
  box-shadow: 0 8px 20px rgba(57,37,12,.12);
}

.surname-card .sc-char {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  margin: 0 0 3px;
  border: 1px solid color-mix(in srgb, var(--gold) 32%, var(--border));
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 35% 25%, var(--surface-solid), color-mix(in srgb, var(--gold) 13%, transparent));
  color: var(--accent);
  box-shadow: inset 0 1px rgba(255,255,255,.36), 0 3px 10px rgba(57,37,12,.07);
  white-space: nowrap;
  word-break: keep-all;
  line-height: 1;
}

.surname-card.compound .sc-char {
  flex-basis: 48px;
  width: 68px;
  border-radius: 999px;
  font-size: 21px;
  letter-spacing: -.06em;
}

.surname-card .sc-py {
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: .035em;
}

.surname-card .sc-meta {
  min-height: 1.35em;
  font-size: 10px;
  line-height: 1.35;
}

.surname-card .sc-badge {
  min-height: 19px;
  margin-top: auto;
  padding: 2px 8px;
  line-height: 1.35;
  border: 1px solid transparent;
}

.surname-card .sc-badge.tree {
  border-color: color-mix(in srgb, var(--green) 18%, transparent);
}

.surname-card .sc-badge.source {
  border-color: color-mix(in srgb, var(--blue) 18%, transparent);
}

.surname-card .sc-badge.pending {
  border-color: var(--border);
}

.bz-stats {
  gap: 14px;
  margin-bottom: 22px;
}

.bzstat {
  min-width: 112px;
  padding: 13px 18px 12px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, var(--glass-bg), var(--surface));
  box-shadow: inset 0 1px rgba(255,255,255,.4), 0 3px 10px rgba(57,37,12,.045);
}

.bzstat .bv {
  line-height: 1.1;
}

.bzstat .bl {
  margin-top: 6px;
}

@media (max-width: 420px) {
  .surname-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
  }

  .surname-card {
    min-height: 140px;
    padding-inline: 4px;
  }

  .bzstat {
    min-width: calc(50% - 7px);
    flex: 1 1 calc(50% - 7px);
  }
}

#view-generate .gd-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(150deg, var(--glass-bg), var(--surface));
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

#view-generate .gd-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-soft);
  box-shadow: var(--shadow);
}

.icon-btn,
.panel-toggle,
.tree-btn {
  transition: color .18s, background-color .18s, border-color .18s, transform .18s;
}

.icon-btn:hover,
.panel-toggle:hover,
.tree-btn:hover {
  transform: translateY(-1px);
}

/* ImageGen heritage icon sprites: same silhouettes, tuned for each theme. */
.feat .ico[data-icon],
#view-optimizer .opt-hc-icon[data-icon] {
  font-size: 0;
  background-repeat: no-repeat, no-repeat;
}

html[data-theme="light"] .feat .ico[data-icon] {
  background-image: url("../images/feature-icons-light.png"), linear-gradient(145deg, var(--surface-solid), color-mix(in srgb, var(--gold) 12%, transparent));
  background-size: 300% 200%, 100% 100%;
}

html[data-theme="dark"] .feat .ico[data-icon] {
  background-image: url("../images/feature-icons-dark.png"), linear-gradient(145deg, var(--surface-solid), color-mix(in srgb, var(--gold) 15%, transparent));
  background-size: 300% 200%, 100% 100%;
}

.feat .ico[data-icon="tree"] { background-position: 0% 0%, 0 0; }
.feat .ico[data-icon="search"] { background-position: 50% 0%, 0 0; }
.feat .ico[data-icon="chart"] { background-position: 100% 0%, 0 0; }
.feat .ico[data-icon="hall"] { background-position: 0% 100%, 0 0; }
.feat .ico[data-icon="theme"] { background-position: 50% 100%, 0 0; }
.feat .ico[data-icon="scroll"] { background-position: 100% 100%, 0 0; }

#view-optimizer .opt-hc-icon[data-icon] {
  width: 54px;
  height: 68px;
  margin-bottom: 8px;
  background-repeat: no-repeat, no-repeat;
  background-size: 400% 100%, 100% 100%;
  border-radius: 14px 14px 14px 5px;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, var(--border));
  box-shadow: inset 0 1px rgba(255,255,255,.28), 0 5px 14px rgba(57,37,12,.08);
}

html[data-theme="light"] #view-optimizer .opt-hc-icon[data-icon] {
  background-image: url("../images/optimizer-icons-light.png"), linear-gradient(145deg, var(--surface-solid), color-mix(in srgb, var(--gold) 12%, transparent));
}

html[data-theme="dark"] #view-optimizer .opt-hc-icon[data-icon] {
  background-image: url("../images/optimizer-icons-dark.png"), linear-gradient(145deg, var(--surface-solid), color-mix(in srgb, var(--gold) 15%, transparent));
}

#view-optimizer .opt-hc-icon[data-icon="files"] { background-position: 0% 50%, 0 0; }
#view-optimizer .opt-hc-icon[data-icon="ai"] { background-position: 33.333% 50%, 0 0; }
#view-optimizer .opt-hc-icon[data-icon="diff"] { background-position: 66.667% 50%, 0 0; }
#view-optimizer .opt-hc-icon[data-icon="shield"] { background-position: 100% 50%, 0 0; }

@media (prefers-reduced-motion: reduce) {
  .clan-card::before,
  .stat-card::before,
  .feat::before,
  .result-card::before,
  #view-generate .gd-card,
  .icon-btn,
  .panel-toggle,
  .tree-btn {
    transition: none;
  }
}

/* Long operational tables stay usable on phones without crushing columns. */
@media (max-width: 720px) {
  #view-upload .uj-jobs,
  #view-reclogs .rl-table-wrap,
  #view-system #sys-usage-by-model,
  #view-system #sys-usage-by-code,
  #view-system #sys-usage-by-day,
  #view-system #sys-usage-raw {
    overflow-x: auto;
  }

  #view-upload .uj-table,
  #view-reclogs table,
  #view-system #sys-usage-by-model table,
  #view-system #sys-usage-by-code table,
  #view-system #sys-usage-by-day table,
  #view-system #sys-usage-raw table {
    min-width: 620px;
  }
}

@media (max-width: 720px) {
  html[data-theme="light"] #sys-admin-list table {
    min-width: 520px;
  }
}

/* Public discovery surfaces: editorial paper, ink, and cinnabar. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.hero .container { max-width: 610px; }
.hero .eyebrow { color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .16em; }
.hero h1 { max-width: 620px; font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); }
.home-search {
  display: flex; align-items: center; gap: 12px; width: min(100%, 590px); min-height: 62px;
  padding: 7px 8px 7px 18px; margin: 24px 0 9px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface-solid); box-shadow: 0 12px 36px rgba(0,0,0,.12);
}
.home-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 12px 36px rgba(0,0,0,.12); }
.home-search-icon { color: var(--accent); font-size: 30px; line-height: 1; transform: rotate(-18deg); }
.home-search input {
  min-width: 0; flex: 1; height: 44px; padding: 0; border: 0; border-radius: 0;
  color: var(--text); background: transparent; box-shadow: none !important; font-size: 15px;
}
.home-search input:focus { outline: 0; }
.home-search button {
  min-height: 46px; padding: 0 17px; border: 0; border-radius: 7px;
  color: #fff; background: var(--accent); font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.home-search button:hover { background: #a42f25; transform: translateY(-1px); }
.home-search button span { margin-left: 7px; }
.home-search-hint { margin: 0 0 20px 4px; color: var(--text2); font-size: 12px; }
.hero .hero-stats { gap: 8px; margin: 20px 0 24px; }
.hero .hstat { min-width: 92px; padding: 9px 13px; }
.hero .hv { font-size: 23px; }
.hero .hl { font-size: 11px; }
.home-start-section { padding-top: 30px; }
.start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); }
.start-card {
  position: relative; display: flex; flex-direction: column; min-height: 220px; padding: 23px 25px 20px;
  color: var(--text); text-decoration: none; border-right: 1px solid var(--border);
  transition: background .2s ease, transform .2s ease;
}
.start-card:last-child { border-right: 0; }
.start-card:hover { color: var(--text); background: var(--surface-hover); transform: translateY(-2px); }
.start-no { position: absolute; top: 25px; right: 23px; color: var(--muted); font-size: 10px; letter-spacing: .16em; }
.start-icon {
  display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 20px;
  color: var(--accent); border: 1px solid var(--accent-soft); border-radius: 50%; font-size: 17px;
}
.start-title { font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); font-size: 20px; font-weight: 700; }
.start-copy { max-width: 270px; margin-top: 8px; color: var(--text2); font-size: 13px; line-height: 1.7; }
.start-arrow { display: flex; justify-content: space-between; margin-top: auto; padding-top: 20px; color: var(--accent); font-size: 12px; font-weight: 700; }
.library-section { padding-top: 52px; }
.library-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 30px; border-bottom: 1px solid var(--border-strong); }
.library-heading .kicker { color: var(--accent); font-size: 11px; letter-spacing: .14em; font-weight: 750; }
.library-heading h1 { margin: 9px 0 8px; color: var(--text); font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); font-size: clamp(34px, 4vw, 48px); line-height: 1.2; }
.library-heading p { max-width: 640px; margin: 0; color: var(--text2); font-size: 14px; line-height: 1.8; }
.library-total { display: flex; align-items: baseline; gap: 7px; flex: none; padding: 9px 0 4px 18px; border-left: 1px solid var(--border-strong); color: var(--text2); }
.library-total strong { color: var(--accent); font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); font-size: 34px; font-weight: 600; }
.library-total span { font-size: 12px; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 21px 0 22px; }
.library-search { display: flex; align-items: center; gap: 10px; width: min(100%, 460px); min-height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface-solid); }
.library-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.library-search > span { color: var(--accent); font-size: 23px; line-height: 1; }
.library-search input { flex: 1; min-width: 0; height: 40px; padding: 0; border: 0; background: transparent; box-shadow: none !important; font-size: 13px; }
.library-search input:focus { outline: 0; }
.library-search kbd { padding: 2px 6px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; font: 11px var(--mono); }
.library-filters { display: flex; justify-content: flex-end; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.library-filter { flex: none; min-height: 34px; padding: 0 12px; color: var(--text2); border: 1px solid transparent; border-radius: 99px; background: transparent; font-size: 12px; cursor: pointer; }
.library-filter:hover { color: var(--accent); background: var(--accent-soft); }
.library-filter.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); background: var(--accent-soft); font-weight: 700; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.library-card {
  position: relative; display: flex; flex-direction: column; min-height: 270px; padding: 20px 21px 16px;
  overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-solid);
  box-shadow: 0 7px 22px rgba(38,27,12,.045); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  animation: library-rise .35s ease both; animation-delay: calc(var(--card-index, 0) * 35ms);
}
.library-card::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); content: ""; transform: scaleY(.18); transform-origin: top; transition: transform .2s ease; }
.library-card:hover { border-color: color-mix(in srgb, var(--accent) 32%, var(--border)); box-shadow: 0 12px 30px rgba(38,27,12,.1); transform: translateY(-3px); }
.library-card:hover::before { transform: scaleY(1); }
.library-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.library-surname { color: var(--accent); font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); font-size: 23px; font-weight: 750; }
.library-surname small { margin-left: 2px; font-size: 12px; }
.library-card-index { color: var(--muted); font-size: 9px; letter-spacing: .11em; }
.library-card h2 { margin: 14px 0 4px; color: var(--text); font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); font-size: 19px; line-height: 1.4; }
.library-card-hall { color: var(--gold); font-size: 12px; }
.library-card-founder { display: flex; align-items: baseline; gap: 10px; margin-top: 20px; padding-top: 13px; border-top: 1px solid var(--border); }
.library-card-founder span { color: var(--muted); font-size: 11px; }
.library-card-founder strong { min-width: 0; overflow: hidden; color: var(--text2); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.library-card-stats { display: flex; gap: 16px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.library-card-stats strong { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.library-card-action { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: auto; padding: 13px 0 0; color: var(--accent); border: 0; border-top: 1px solid var(--border); background: transparent; font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; }
.library-card-action span { font-size: 16px; transition: transform .18s ease; }
.library-card-action:hover span { transform: translate(2px, -2px); }
.library-empty { grid-column: 1 / -1; padding: 60px 20px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--text); text-align: center; }
.library-empty > span { font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); font-size: 20px; font-weight: 700; }
.library-empty p { margin: 8px 0 18px; color: var(--text2); font-size: 13px; }
.library-note { display: flex; align-items: center; gap: 12px; margin-top: 26px; padding: 14px 16px; border-left: 2px solid var(--gold); background: var(--surface); }
.library-note-mark { display: grid; place-items: center; width: 27px; height: 27px; flex: none; color: var(--accent); border: 1px solid var(--accent-soft); border-radius: 50%; font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); font-size: 13px; }
.library-note p { margin: 0; color: var(--text2); font-size: 11px; line-height: 1.6; }
@keyframes library-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.public-mobile-nav { display: none; }
.public-mobile-nav[hidden] { display: none !important; }

@media (max-width: 900px) {
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-toolbar { align-items: flex-start; flex-direction: column; }
  .library-search { width: 100%; }
  .library-filters { justify-content: flex-start; width: 100%; }
}
@media (max-width: 768px) {
  body:has(.public-mobile-nav:not([hidden])) main { padding-bottom: 72px; }
  .hero .container { top: 32px; }
  .hero h1 { max-width: 440px; font-size: clamp(34px, 9vw, 44px); }
  .hero .lead { max-width: 410px; font-size: 14px; }
  .home-search { gap: 8px; min-height: 56px; margin-top: 19px; padding-left: 12px; }
  .home-search input { font-size: 13px; }
  .home-search button { min-height: 42px; padding: 0 11px; font-size: 12px; }
  .home-search button span { margin-left: 3px; }
  .home-search-hint { margin-bottom: 14px; font-size: 11px; }
  .hero .hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 300px; margin: 15px 0 17px; }
  .hero .hstat { min-width: 0; padding: 7px 10px; }
  .hero .hv { font-size: 19px; }
  .hero .cta { gap: 7px; }
  .hero .cta .btn { padding: 9px 11px; font-size: 12px; }
  .home-start-section { padding-top: 14px; }
  .start-grid { grid-template-columns: 1fr; }
  .start-card { min-height: 0; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; column-gap: 12px; padding: 16px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .start-card:last-child { border-bottom: 0; }
  .start-no { display: none; }
  .start-icon { grid-row: span 3; width: 36px; height: 36px; margin: 0; }
  .start-title { font-size: 16px; }
  .start-copy { grid-column: 2; margin-top: 3px; font-size: 11px; }
  .start-arrow { grid-column: 3; grid-row: 1 / span 2; gap: 5px; margin: 0; padding: 0; font-size: 10px; white-space: nowrap; }
  .library-section { padding-top: 30px; }
  .library-heading { align-items: flex-start; gap: 12px; padding-bottom: 20px; }
  .library-heading h1 { font-size: 32px; }
  .library-heading p { font-size: 12px; }
  .library-total { gap: 4px; padding-left: 10px; }
  .library-total strong { font-size: 27px; }
  .library-total span { font-size: 10px; white-space: nowrap; }
  .library-toolbar { gap: 11px; margin: 16px 0; }
  .library-search { min-height: 42px; }
  .library-search input { font-size: 12px; }
  .library-grid { grid-template-columns: 1fr; gap: 10px; }
  .library-card { min-height: 244px; padding: 17px 17px 14px; }
  .library-card h2 { font-size: 18px; }
  .library-note { align-items: flex-start; margin-top: 16px; }
  .public-mobile-nav:not([hidden]) {
    position: fixed; z-index: 1000; right: 0; bottom: 0; left: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-strong); background: color-mix(in srgb, var(--bg) 94%, transparent);
    box-shadow: 0 -8px 24px rgba(0,0,0,.08); backdrop-filter: blur(18px);
  }
  .public-mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 44px; color: var(--text2); font-size: 10px; text-decoration: none; }
  .public-mobile-nav a > span { color: var(--muted); font-family: var(--serif, "Songti SC", serif); font-size: 17px; line-height: 1.2; }
  .public-mobile-nav a.active { color: var(--accent); font-weight: 700; }
  .public-mobile-nav a.active > span { color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .library-card { animation: none; }
  .start-card, .library-card, .library-card::before, .library-card-action span { transition: none; }
}

/* MMJP public content, connected as attributed reading and catalogue cards. */
.mmjp-home-section { padding-top: 28px; }
.mmjp-home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mmjp-home-more { margin-top: 18px; }
.mmjp-home-more span { margin-left: 8px; }
.heritage-section { padding-top: 38px; }
.heritage-intro { position: relative; overflow: hidden; padding: clamp(30px, 6vw, 68px); border: 1px solid var(--border); background: radial-gradient(ellipse at 85% 20%, var(--gold-soft), transparent 32%), linear-gradient(120deg, var(--surface), var(--card)); }
.heritage-intro::after { content: "名"; position: absolute; right: 4%; bottom: -95px; color: var(--accent-soft); font-family: var(--serif, "Songti SC", serif); font-size: clamp(220px, 34vw, 420px); font-weight: 800; line-height: 1; opacity: .45; pointer-events: none; }
.heritage-intro > * { position: relative; z-index: 1; }
.heritage-intro h1 { max-width: 720px; margin: 18px 0 14px; color: var(--text); font-family: var(--serif, "Songti SC", "Noto Serif CJK SC", serif); font-size: clamp(42px, 6.2vw, 76px); line-height: 1.14; letter-spacing: .04em; }
.heritage-intro h1 span { color: var(--accent); }
.heritage-intro > p { max-width: 620px; color: var(--text2); font-size: 15px; line-height: 1.9; }
.heritage-shortcuts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.heritage-shortcuts a, .heritage-link-list a { display: inline-flex; align-items: center; gap: 16px; padding: 10px 13px; color: var(--text); border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--card) 78%, transparent); font-size: 12px; text-decoration: none; transition: border-color .18s ease, color .18s ease; }
.heritage-shortcuts a:hover, .heritage-link-list a:hover { color: var(--accent); border-color: var(--accent); }
.heritage-shortcuts span, .heritage-link-list span { color: var(--gold); }
.heritage-source-line { display: flex; align-items: center; gap: 9px; padding: 13px 0; color: var(--muted); border-bottom: 1px solid var(--border); font-size: 11px; }
.heritage-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold-soft); }
.heritage-source-line a { margin-left: auto; color: var(--text2); text-decoration: none; }
.heritage-block { padding-top: 58px; scroll-margin-top: 100px; }
.heritage-block-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.heritage-block-head h2, .heritage-more-links h2 { margin: 7px 0; color: var(--text); font-family: var(--serif, "Songti SC", serif); font-size: clamp(24px, 3vw, 34px); }
.heritage-block-head p, .heritage-more-links p { margin: 0; color: var(--text2); font-size: 12px; line-height: 1.7; }
.heritage-block-head > a { flex: none; padding-bottom: 4px; color: var(--accent); font-size: 12px; text-decoration: none; }
.heritage-block-head > a span { margin-left: 5px; }
.heritage-story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.heritage-event-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.heritage-event-card { display: grid; grid-template-columns: 42px 1fr; gap: 13px; padding: 16px; border: 1px solid var(--border); background: var(--card); animation: library-rise .42s both; animation-delay: calc(var(--story-index, 0) * 40ms); }
.heritage-event-mark { display: grid; place-items: center; width: 40px; height: 40px; color: var(--accent); border: 1px solid var(--accent-soft); border-radius: 50%; background: var(--surface); font-family: var(--serif, "Songti SC", serif); font-size: 18px; }
.heritage-event-card > div:last-child > span { color: var(--muted); font-size: 9px; }
.heritage-event-card h3 { margin: 7px 0 5px; color: var(--text); font-family: var(--serif, "Songti SC", serif); font-size: 16px; }
.heritage-event-card p { margin: 0; color: var(--text2); font-size: 11px; line-height: 1.7; }
.heritage-event-card a { display: inline-block; margin-top: 10px; color: var(--accent); font-size: 10px; text-decoration: none; }
.heritage-list-action { display: flex; justify-content: center; margin-top: 16px; }
.heritage-load-more { display: inline-flex; align-items: center; gap: 12px; padding: 10px 15px; color: var(--text2); border: 1px solid var(--border-strong); background: var(--surface); font-size: 11px; cursor: pointer; }
.heritage-load-more span { color: var(--muted); }
.heritage-load-more b { color: var(--accent); font-size: 14px; }
.heritage-load-more:disabled { opacity: .6; cursor: progress; }
.mmjp-story-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); background: var(--card); animation: library-rise .42s both; animation-delay: calc(var(--story-index, 0) * 45ms); }
.mmjp-story-image { display: block; height: 166px; overflow: hidden; background: linear-gradient(135deg, var(--accent-soft), var(--gold-soft)); }
.mmjp-story-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.mmjp-story-card:hover .mmjp-story-image img { transform: scale(1.035); }
.mmjp-story-placeholder { display: grid; place-items: center; color: var(--accent); font-family: var(--serif, "Songti SC", serif); font-size: 64px; opacity: .65; }
.mmjp-story-copy { display: flex; flex-direction: column; min-height: 205px; padding: 16px; }
.mmjp-story-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
.mmjp-story-copy h3 { margin: 11px 0 6px; color: var(--text); font-family: var(--serif, "Songti SC", serif); font-size: 18px; line-height: 1.4; }
.mmjp-story-copy h3 a { color: inherit; text-decoration: none; }
.mmjp-story-copy p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--text2); font-size: 12px; line-height: 1.75; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.mmjp-card-link { display: flex; justify-content: space-between; margin-top: auto; padding-top: 13px; color: var(--accent); border-top: 1px solid var(--border); font-size: 11px; text-decoration: none; }
.heritage-course-cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
.heritage-course-cat { display: flex; justify-content: space-between; gap: 8px; padding: 12px; color: var(--text2); border: 1px solid var(--border); background: var(--surface); font-size: 11px; text-decoration: none; }
.heritage-course-cat b { color: var(--gold); font-weight: 500; }
.heritage-course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.heritage-course-card { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; min-height: 190px; overflow: hidden; border: 1px solid var(--border); background: var(--card); }
.heritage-course-card > img { width: 100%; height: 100%; min-height: 190px; object-fit: cover; }
.heritage-course-placeholder { display: grid; place-items: center; min-height: 190px; color: var(--accent); background: var(--accent-soft); font-family: var(--serif, "Songti SC", serif); font-size: 54px; }
.heritage-course-card > div:last-child { display: flex; flex-direction: column; align-items: start; padding: 17px; }
.heritage-course-card > div > span { color: var(--gold); font-size: 10px; }
.heritage-course-card h3 { margin: 8px 0; color: var(--text); font-family: var(--serif, "Songti SC", serif); font-size: 18px; }
.heritage-course-card p { display: -webkit-box; overflow: hidden; margin: 0 0 12px; color: var(--text2); font-size: 11px; line-height: 1.7; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.heritage-course-card a { margin-top: auto; color: var(--accent); font-size: 11px; text-decoration: none; }
.heritage-book-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.heritage-book-card { display: grid; grid-template-columns: 82px 1fr; gap: 15px; min-height: 155px; padding: 14px; border: 1px solid var(--border); background: var(--card); animation: library-rise .42s both; animation-delay: calc(var(--story-index, 0) * 40ms); }
.heritage-book-cover { display: grid; place-items: center; width: 82px; min-height: 120px; overflow: hidden; color: var(--accent); background: linear-gradient(145deg, var(--accent-soft), var(--gold-soft)); font-family: var(--serif, "Songti SC", serif); font-size: 36px; }
.heritage-book-cover img { width: 100%; height: 100%; object-fit: cover; }
.heritage-book-cover-art { position: relative; display: block; width: 100%; height: 100%; min-height: 120px; overflow: hidden; }
.heritage-book-cover-art > img { display: block; width: 100%; height: 100%; object-fit: fill; }
.heritage-book-cover-label { position: absolute; left: 7.5%; top: 4%; display: flex; width: 29.5%; height: 73%; flex-direction: column; align-items: center; box-sizing: border-box; padding: 4% 2%; overflow: hidden; border: 1px solid #382d1e; outline: 1px solid #382d1e; outline-offset: -3px; background: #f6ebd5; color: #211a12; font-family: var(--serif, "Songti SC", serif); text-align: center; }
.heritage-book-cover-label small { display: block; width: 100%; padding-bottom: 3%; border-bottom: 1px solid #9b8a6c; font-size: 5px; line-height: 1.2; }
.heritage-book-cover-label b { display: block; margin: auto; font-size: 6px; font-weight: 600; line-height: 1.05; writing-mode: vertical-rl; }
.heritage-book-cover-art-detail { width: min(100%, 560px); height: auto; aspect-ratio: 170 / 224; margin: 0 auto 28px; }
.heritage-book-cover-art-detail > img { height: 100%; }
.heritage-book-cover-art-detail .heritage-book-cover-label small { font-size: clamp(8px, 2vw, 15px); }
.heritage-book-cover-art-detail .heritage-book-cover-label b { font-size: clamp(14px, 3vw, 24px); }
.heritage-book-copy { display: flex; flex-direction: column; min-width: 0; }
.heritage-book-code { color: var(--gold); font-size: 9px; letter-spacing: .12em; }
.heritage-book-copy h3 { margin: 7px 0 4px; color: var(--text); font-family: var(--serif, "Songti SC", serif); font-size: 15px; line-height: 1.45; }
.heritage-book-copy p { margin: 0; color: var(--muted); font-size: 10px; }
.heritage-book-foot { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; color: var(--text2); font-size: 10px; }
.heritage-book-foot a { color: var(--accent); text-decoration: none; }
.heritage-more-links { display: flex; align-items: center; justify-content: space-between; gap: 25px; margin-top: 48px; padding: 24px; border: 1px solid var(--border); background: var(--surface); }
.heritage-link-list { display: flex; flex-wrap: wrap; gap: 8px; }
.heritage-attribution { margin: 18px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.heritage-block[hidden], .heritage-more-links[hidden], #mmjp-local-detail[hidden] { display: none !important; }
#mmjp-local-detail { padding: 26px 0 10px; }
.heritage-detail { max-width: 900px; margin: 24px auto; padding: clamp(20px, 5vw, 48px); border: 1px solid var(--border); background: var(--card); }
.heritage-detail h1 { margin: 10px 0; color: var(--text); font-family: var(--serif, "Songti SC", serif); font-size: clamp(30px, 5vw, 48px); }
.heritage-detail time { color: var(--muted); font-size: 11px; }
.heritage-detail-image { display: block; max-width: min(100%, 560px); max-height: 420px; margin: 0 auto 28px; object-fit: contain; }
.heritage-detail-body { margin-top: 24px; color: var(--text2); font-size: 15px; line-height: 2; white-space: pre-line; overflow-wrap: anywhere; }
.admin-console { padding-top: 42px; padding-bottom: 80px; }
.nav-admin-btn { margin-left: 7px; padding: 8px 11px; color: var(--accent); border: 1px solid var(--accent-soft); background: var(--surface); font-size: 10px; cursor: pointer; white-space: nowrap; }
.nav-admin-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.admin-console-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 0 0 28px; border-bottom: 1px solid var(--border); }
.admin-console-head h1 { margin: 8px 0; color: var(--text); font: 600 clamp(32px, 4.2vw, 48px)/1.15 var(--serif, "Songti SC", serif); }
.admin-console-head p { max-width: 670px; margin: 0; color: var(--text2); font-size: 13px; line-height: 1.8; }
.admin-local-badge { display: flex; align-items: center; gap: 9px; padding: 10px 13px; color: var(--text2); border: 1px solid var(--border); background: var(--card); font-size: 10px; white-space: nowrap; }
.admin-local-badge span { width: 7px; height: 7px; border-radius: 50%; background: #67b987; box-shadow: 0 0 10px #67b98766; }
.admin-overview { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 22px 0; }
.admin-stat-card { position: relative; display: flex; flex-direction: column; align-items: start; gap: 5px; overflow: hidden; padding: 18px; text-align: left; color: var(--text2); border: 1px solid var(--border); background: var(--card); cursor: pointer; transition: border-color .2s, transform .2s; }
.admin-stat-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.admin-stat-card > span { font-size: 11px; }
.admin-stat-card > strong { color: var(--text); font: 600 30px/1.15 var(--serif, "Songti SC", serif); font-variant-numeric: tabular-nums; }
.admin-stat-card > small { color: var(--muted); font-size: 9px; }
.admin-stat-card > small b { color: var(--accent); }
.admin-stat-card > i { position: absolute; right: 16px; bottom: -19px; color: var(--accent-soft); font: 800 72px/1 var(--serif, "Songti SC", serif); opacity: .8; }
.admin-console-layout { display: grid; grid-template-columns: 205px minmax(0,1fr); min-height: 450px; border: 1px solid var(--border); background: var(--surface); }
.admin-console-nav { padding: 17px 10px; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--card) 75%, transparent); }
.admin-nav-label { padding: 3px 11px 12px; color: var(--muted); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; }
.admin-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; margin: 2px 0; padding: 10px 11px; text-align: left; color: var(--text2); border: 1px solid transparent; background: transparent; font-size: 11px; cursor: pointer; }
.admin-nav-item > span { display: grid; place-items: center; width: 23px; height: 23px; color: var(--gold); border: 1px solid var(--border); font: 13px var(--serif, "Songti SC", serif); }
.admin-nav-item small { margin-left: auto; color: var(--muted); font-size: 9px; }
.admin-nav-item:hover, .admin-nav-item.active { color: var(--text); border-color: var(--border); background: var(--surface); }
.admin-nav-item.active > span { color: var(--accent); border-color: var(--accent-soft); }
.admin-console-main { min-width: 0; padding: 21px; }
.admin-console-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 18px; min-height: 49px; margin-bottom: 16px; }
.admin-console-toolbar h2 { margin: 5px 0 0; color: var(--text); font: 600 22px/1.2 var(--serif, "Songti SC", serif); }
.admin-toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: end; gap: 7px; }
.admin-toolbar-actions .btn, .admin-editor-actions .btn, .admin-import-panel .btn { min-height: 35px; padding: 8px 12px; font-size: 10px; }
.admin-filter { display: flex; align-items: center; gap: 5px; min-width: 190px; padding: 0 9px; color: var(--muted); border: 1px solid var(--border); background: var(--card); }
.admin-filter input { width: 100%; min-width: 0; padding: 8px 0; border: 0; background: transparent; font-size: 10px; outline: 0; }
.admin-console-message { min-height: 0; margin: 0; font-size: 10px; }
.admin-console-message:not(:empty) { margin: 0 0 13px; padding: 9px 11px; border: 1px solid #6ca88455; color: #78c895; background: #1d443322; }
.admin-console-message.is-error { color: #ed8b82; border-color: #ce5a5055; background: #57211e33; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); }
.admin-content-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.admin-content-table th { padding: 11px; text-align: left; color: var(--muted); background: color-mix(in srgb, var(--card) 88%, transparent); font-size: 9px; font-weight: 500; white-space: nowrap; }
.admin-content-table td { max-width: 310px; padding: 11px; vertical-align: top; color: var(--text2); border-top: 1px solid var(--border); line-height: 1.55; }
.admin-content-table td:first-child { min-width: 150px; }
.admin-content-table td:first-child strong { display: block; color: var(--text); font-size: 11px; font-weight: 550; }
.admin-content-table td:first-child small { display: block; max-width: 190px; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.admin-content-table td:nth-child(3) { min-width: 155px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.admin-row-actions { display: flex; flex-wrap: wrap; gap: 8px; white-space: nowrap; }
.admin-row-actions button { padding: 2px 0; color: var(--accent); border: 0; background: none; font-size: 9px; cursor: pointer; }
.admin-row-actions button.danger { color: #d77770; }
.admin-status { display: inline-block; padding: 4px 7px; border: 1px solid; font-size: 8px; white-space: nowrap; }
.admin-status.published { color: #78c895; border-color: #6ca88455; background: #1d443322; }
.admin-status.draft { color: #e0b85b; border-color: #c7a25355; background: #60491e25; }
.admin-list-foot { padding: 9px 1px; color: var(--muted); font-size: 9px; }
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 13px; padding: 14px 0 5px; color: var(--text2); font-size: 10px; }
.admin-pagination .btn { min-height: 31px; padding: 6px 10px; font-size: 9px; }
.admin-pagination .btn:disabled { opacity: .42; cursor: not-allowed; }
.admin-backup-intro { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 15px; color: var(--text2); border: 1px solid var(--border); background: var(--card); }
.admin-backup-intro strong { flex: none; color: var(--text); font: 500 15px var(--serif, "Songti SC", serif); }
.admin-backup-intro span { font-size: 9px; line-height: 1.7; }
.admin-empty { display: grid; justify-items: center; padding: 55px 15px; text-align: center; border: 1px dashed var(--border-strong); }
.admin-empty > span { color: var(--accent); font: 44px var(--serif, "Songti SC", serif); opacity: .7; }
.admin-empty h3 { margin: 10px 0 4px; color: var(--text); font: 500 18px var(--serif, "Songti SC", serif); }
.admin-empty p { margin: 0 0 16px; color: var(--muted); font-size: 10px; }
.admin-editor { margin-top: 17px; padding: 18px; border: 1px solid var(--border-strong); background: var(--card); }
.admin-editor-top { display: flex; align-items: start; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.admin-editor-top h3 { margin: 5px 0 0; color: var(--text); font: 500 18px var(--serif, "Songti SC", serif); }
.admin-icon-close { color: var(--text2); border: 0; background: none; font-size: 22px; cursor: pointer; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 15px 0; }
.admin-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--text2); font-size: 9px; }
.admin-field.wide { grid-column: 1 / -1; }
.admin-field input, .admin-field textarea, .admin-field select { width: 100%; min-width: 0; padding: 9px 10px; color: var(--text); border: 1px solid var(--border); border-radius: 0; background: var(--surface); font-size: 10px; }
.admin-field textarea { line-height: 1.7; resize: vertical; }
.admin-field textarea.admin-body-input { min-height: 270px; font-size: 11px; }
.admin-field small { color: var(--muted); font-size: 8px; }
.admin-check { display: flex; align-items: center; gap: 8px; color: var(--text2); font-size: 10px; }
.admin-editor-actions { display: flex; justify-content: end; gap: 8px; padding-top: 11px; border-top: 1px solid var(--border); }
.admin-welcome { display: flex; align-items: center; gap: 20px; padding: 23px; border: 1px solid var(--border); background: var(--card); }
.admin-welcome-mark { display: grid; place-items: center; flex: none; width: 58px; height: 58px; color: var(--accent); border: 1px solid var(--accent-soft); font: 35px var(--serif, "Songti SC", serif); }
.admin-welcome h3 { margin: 7px 0 4px; color: var(--text); font: 500 17px var(--serif, "Songti SC", serif); }
.admin-welcome p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.admin-overview-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.admin-overview-links button { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 13px; text-align: left; color: var(--text2); border: 1px solid var(--border); background: var(--card); cursor: pointer; }
.admin-overview-links button:hover { border-color: var(--accent); }
.admin-overview-links span { font-size: 10px; }
.admin-overview-links b { color: var(--text); font-size: 16px; }
.admin-overview-links small { color: var(--muted); font-size: 8px; }
.admin-import-note { display: flex; align-items: center; gap: 13px; margin-top: 10px; padding: 15px; color: var(--text2); border: 1px solid var(--border); background: var(--surface); }
.admin-import-note b { flex: none; color: var(--text); font-size: 10px; }
.admin-import-note span { flex: 1; font-size: 9px; line-height: 1.6; }
.admin-import-panel { max-width: 780px; margin: 0 auto; padding: 20px; border: 1px solid var(--border); background: var(--card); }
.admin-import-intro { display: flex; gap: 14px; align-items: start; margin-bottom: 18px; }
.admin-import-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; color: var(--accent); border: 1px solid var(--accent-soft); font-size: 20px; }
.admin-import-intro h3 { margin: 2px 0 5px; color: var(--text); font: 500 17px var(--serif, "Songti SC", serif); }
.admin-import-intro p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.7; }
.admin-file-drop { display: grid; place-items: center; gap: 5px; padding: 25px; color: var(--text); border: 1px dashed var(--border-strong); background: var(--surface); cursor: pointer; }
.admin-file-drop input { max-width: 240px; color: var(--muted); font-size: 9px; }
.admin-file-drop > span { font-size: 11px; }
.admin-file-drop small { color: var(--muted); font-size: 8px; }
.admin-import-sections { display: flex; flex-wrap: wrap; gap: 9px 15px; align-items: center; margin: 17px 0; color: var(--text2); font-size: 9px; }
.admin-import-sections > span { width: 100%; color: var(--muted); }
.admin-import-sections label { display: flex; align-items: center; gap: 5px; }
.admin-import-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 13px 0; }
.admin-import-mode label { display: flex; align-items: start; gap: 8px; padding: 11px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.admin-import-mode label span { display: grid; gap: 4px; color: var(--text2); font-size: 9px; }
.admin-import-mode small { color: var(--muted); font-size: 8px; }
.admin-import-preview { min-height: 75px; overflow: auto; padding: 11px; color: var(--text2); border: 1px solid var(--border); background: var(--surface); font: 9px/1.7 ui-monospace, monospace; white-space: pre-wrap; }
.admin-quick-tools { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 10px; margin-top: 28px; padding: 19px; border: 1px solid var(--border); background: var(--card); }
.admin-quick-tools h2 { margin: 5px 0; color: var(--text); font: 500 19px var(--serif, "Songti SC", serif); }
.admin-quick-tools > div > p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.admin-tool-card { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 13px; color: var(--text2); border: 1px solid var(--border); text-decoration: none; transition: border-color .2s, background .2s; }
.admin-tool-card:hover { border-color: var(--accent); background: var(--surface); }
.admin-tool-card > span { color: var(--gold); font-size: 8px; letter-spacing: .06em; }
.admin-tool-card > strong { color: var(--text); font: 500 15px var(--serif, "Songti SC", serif); }
.admin-tool-card > small { color: var(--muted); font-size: 8px; }
@media (max-width: 900px) {
  .admin-console-layout { grid-template-columns: 170px minmax(0,1fr); }
  .admin-console-main { padding: 15px; }
  .admin-quick-tools { grid-template-columns: 1fr 1fr; }
  .admin-quick-tools > div { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .admin-console { padding-top: 25px; }
  .admin-console-head { align-items: start; flex-direction: column; gap: 13px; }
  .admin-local-badge { padding: 8px 10px; }
  .admin-overview { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .admin-stat-card { padding: 13px; }
  .admin-stat-card > strong { font-size: 25px; }
  .admin-console-layout { display: block; }
  .admin-console-nav { display: flex; gap: 5px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-nav-label { display: none; }
  .admin-nav-item { flex: 0 0 auto; width: auto; gap: 6px; margin: 0; padding: 7px; font-size: 9px; white-space: nowrap; }
  .admin-nav-item > span { width: 20px; height: 20px; }
  .admin-nav-item small { display: none; }
  .admin-console-main { padding: 11px; }
  .admin-console-toolbar { align-items: start; flex-direction: column; gap: 10px; }
  .admin-toolbar-actions { justify-content: start; width: 100%; }
  .admin-filter { flex: 1; min-width: 120px; }
  .admin-toolbar-actions .btn { padding: 7px 8px; font-size: 9px; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-backup-intro { align-items: start; flex-direction: column; gap: 6px; }
  .admin-field.wide { grid-column: auto; }
  .admin-overview-links { grid-template-columns: 1fr 1fr; }
  .admin-import-note { align-items: start; flex-wrap: wrap; }
  .admin-import-note span { flex-basis: 100%; }
  .admin-import-mode { grid-template-columns: 1fr; }
  .admin-quick-tools { grid-template-columns: 1fr; padding: 12px; }
  .admin-quick-tools > div { grid-column: auto; }
}
.mmjp-loading, .mmjp-empty { grid-column: 1 / -1; padding: 26px; color: var(--muted); border: 1px dashed var(--border-strong); font-size: 12px; }
.mmjp-empty a { display: inline-block; margin-left: 8px; color: var(--accent); }
.mmjp-empty-inline { color: var(--muted); font-size: 11px; }
.mmjp-story-card.is-compact { display: grid; grid-template-columns: 100px 1fr; }
.mmjp-story-card.is-compact .mmjp-story-image { height: 100%; min-height: 140px; }
.mmjp-story-card.is-compact .mmjp-story-copy { min-height: 140px; padding: 13px; }
.mmjp-story-card.is-compact .mmjp-story-copy h3 { font-size: 15px; }
.mmjp-story-card.is-compact .mmjp-story-copy p { -webkit-line-clamp: 2; font-size: 10px; }
.mmjp-story-card.is-compact .mmjp-story-meta { font-size: 8px; }
.mmjp-story-card.is-compact .mmjp-card-link { padding-top: 8px; font-size: 10px; }
@media (max-width: 900px) {
  .heritage-story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heritage-course-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .public-mobile-nav:not([hidden]) { grid-template-columns: repeat(5, 1fr); }
  .heritage-section { padding-top: 24px; }
  .heritage-intro { padding: 27px 20px; }
  .heritage-intro h1 { font-size: 42px; }
  .heritage-intro > p { font-size: 12px; }
  .heritage-shortcuts { gap: 6px; }
  .heritage-shortcuts a { gap: 7px; padding: 9px; font-size: 10px; }
  .heritage-source-line { align-items: flex-start; font-size: 9px; }
  .heritage-source-line a { flex: none; }
  .heritage-block { padding-top: 40px; }
  .heritage-block-head { align-items: flex-start; }
  .heritage-block-head h2 { font-size: 24px; }
  .heritage-block-head p { max-width: 250px; font-size: 10px; }
  .heritage-block-head > a { font-size: 10px; white-space: nowrap; }
  .heritage-story-grid, .heritage-event-grid, .mmjp-home-grid { grid-template-columns: 1fr; }
  .mmjp-story-image { height: 150px; }
  .heritage-course-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heritage-course-grid, .heritage-book-grid { grid-template-columns: 1fr; }
  .heritage-course-card { grid-template-columns: 100px 1fr; min-height: 170px; }
  .heritage-course-card > img, .heritage-course-placeholder { min-height: 170px; }
  .heritage-course-card > div:last-child { padding: 13px; }
  .heritage-course-card h3 { font-size: 15px; }
  .heritage-more-links { align-items: flex-start; flex-direction: column; gap: 18px; padding: 18px; }
  .heritage-link-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .heritage-link-list a { justify-content: space-between; gap: 5px; padding: 9px; font-size: 10px; }
  .mmjp-story-card.is-compact { grid-template-columns: 90px 1fr; }
}

/* Unified platform design system: archival paper, ink and cinnabar. */
:root,
html[data-theme="dark"] {
  --bg: #141812;
  --bg2: #1b211a;
  --bg3: #252c23;
  --surface: rgba(240, 233, 213, .055);
  --surface-hover: rgba(240, 233, 213, .095);
  --border: rgba(226, 216, 190, .13);
  --border-strong: rgba(226, 216, 190, .25);
  --text: #eee9dc;
  --text2: #c5bead;
  --muted: #9b9484;
  --accent: #a53a30;
  --accent-soft: rgba(165, 58, 48, .17);
  --accent-glow: rgba(165, 58, 48, .22);
  --gold: #c7a45b;
  --gold-soft: rgba(199, 164, 91, .48);
  --glass-bg: rgba(30, 36, 29, .88);
  --glass-border: rgba(226, 216, 190, .14);
  --surface-2: rgba(240, 233, 213, .075);
  --surface-solid: #1b211a;
  --shadow: 0 12px 34px rgba(0, 0, 0, .24);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
}

html[data-theme="light"] {
  --bg: #f4f0e6;
  --bg2: #ebe5d8;
  --bg3: #ded6c7;
  --surface: rgba(78, 58, 29, .045);
  --surface-hover: rgba(78, 58, 29, .075);
  --border: rgba(77, 59, 34, .15);
  --border-strong: rgba(77, 59, 34, .28);
  --text: #2b281f;
  --text2: #5c5546;
  --muted: #7a7160;
  --accent: #8f3028;
  --accent-soft: rgba(143, 48, 40, .09);
  --accent-glow: rgba(143, 48, 40, .17);
  --gold: #775b24;
  --gold-soft: #80652e;
  --glass-bg: rgba(255, 253, 247, .86);
  --glass-border: rgba(77, 59, 34, .14);
  --surface-2: rgba(77, 59, 34, .06);
  --surface-solid: #fffdf7;
  --shadow: 0 10px 28px rgba(64, 48, 24, .09);
}

body { line-height: 1.68; }
.container { max-width: 1240px; }
main { padding-top: 60px; }
.topbar {
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  border-bottom-color: var(--border);
  box-shadow: 0 5px 20px rgba(0, 0, 0, .08);
}
.brand { gap: 10px; }
.brand-text { line-height: 1.25; }
.brand-seal-image { border-radius: 9px; box-shadow: 0 3px 10px var(--accent-glow); }
.nav { gap: 3px; }
.nav a { padding: 7px 10px; font-size: 13px; }
.nav a.active { font-weight: 700; }
.nav-login-btn, .nav-admin-btn {
  min-height: 36px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 650; cursor: pointer;
}
.nav-login-btn:hover, .nav-admin-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.section { padding-top: 58px; padding-bottom: 58px; }
.section-head { margin-bottom: 32px; }
.section-head .kicker, .kicker { letter-spacing: .12em; }
.section-head h2, .heritage-block-head h2 { font-family: var(--serif); letter-spacing: .015em; }
.glass {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(7px);
}
.glass:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.btn { min-height: 40px; border-radius: 8px; }
.btn.primary, .gqa-send { background: var(--accent); box-shadow: 0 3px 10px var(--accent-glow); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
select, textarea { min-height: 40px; border-radius: 8px; }
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold) 68%, transparent);
  outline-offset: 2px;
}
.toolbar { border-radius: 11px; }
.view > .container > .section { min-height: 52vh; }
.view .section-head { text-align: left; }
.view .section-head p { margin-left: 0; }
.library-heading, .heritage-intro, .admin-console-head { border-radius: var(--radius); }
.clan-card, .result-card, .feat, .stat-card, .chart-card, .surname-card { border-radius: var(--radius); }
.tree-wrap, #tree-svg { border-radius: var(--radius); }
.modal-content, .modal-box { border-radius: 16px; }
.footer { border-top-color: var(--border); }
.admin-console-layout { border-radius: var(--radius); overflow: hidden; background: var(--glass-bg); }
.admin-console-head p, .admin-welcome p, .admin-empty p, .admin-import-intro p,
.admin-backup-intro span, .admin-import-note span, .admin-quick-tools > div > p { font-size: 13px; }
.admin-nav-item { font-size: 13px; border-radius: 8px; }
.admin-nav-item small, .admin-nav-label, .admin-local-badge, .admin-stat-card > small,
.admin-list-foot, .admin-pagination, .admin-toolbar-actions .btn,
.admin-editor-actions .btn, .admin-import-panel .btn { font-size: 12px; }
.admin-stat-card > span, .admin-overview-links span, .admin-import-note b,
.admin-field, .admin-check, .admin-import-sections, .admin-import-mode label span { font-size: 13px; }
.admin-content-table { font-size: 13px; }
.admin-content-table th { font-size: 12px; }
.admin-content-table td:first-child strong { font-size: 14px; }
.admin-content-table td:first-child small, .admin-overview-links small,
.admin-field small, .admin-file-drop small, .admin-import-mode small { font-size: 11px; }
.admin-row-actions button, .admin-status { font-size: 12px; }
.admin-field input, .admin-field textarea, .admin-field select,
.admin-filter input { font-size: 14px; }
.admin-field { gap: 8px; }
.admin-field input, .admin-field textarea, .admin-field select { border-radius: 8px; }
.admin-content-table th, .admin-content-table td { padding: 12px 14px; }
.admin-empty, .admin-import-panel, .admin-backup-intro, .admin-welcome,
.admin-quick-tools { border-radius: var(--radius); }

@media (max-width: 900px) {
  .container { max-width: 100%; }
  .topbar { gap: 10px; padding-inline: 16px; }
  .brand small, .brand-tag { display: none; }
  .nav a { padding-inline: 8px; }
}

@media (max-width: 768px) {
  .section { padding-top: 40px; padding-bottom: 40px; }
  .section-head { margin-bottom: 24px; }
  .view .section-head { text-align: left; }
  .view .section-head p { margin-left: 0; }
  .topbar { min-height: 56px; height: 56px; }
  .theme-switch { gap: 1px; }
  .theme-switch button { width: 31px; height: 31px; }
  .nav-login-btn, .nav-admin-btn { min-height: 33px; padding: 5px 10px; }
  .public-mobile-nav a { font-size: 12px; }
  .public-mobile-nav a > span { font-size: 19px; }
}

@media (max-width: 480px) {
  .topbar { gap: 6px; padding-inline: 10px; }
  .brand { gap: 6px; font-size: 13px; }
  .brand-seal-image { width: 30px; height: 30px; }
  .theme-switch button { width: 27px; height: 27px; }
  .nav-login-btn, .nav-admin-btn { padding: 5px 7px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Family services: private intake, evidence, and reviewed memory contributions. */
.community-services { padding-top: 42px; padding-bottom: 82px; }
.community-hero { position: relative; padding: 34px 38px 30px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(112deg, var(--surface-solid), color-mix(in srgb, var(--gold) 8%, var(--surface-solid))); }
.community-hero::after { content: "谱"; position: absolute; right: 4%; top: -52px; color: var(--accent-soft); font: 240px/1 var(--serif); pointer-events: none; }
.community-hero h1 { position: relative; z-index: 1; margin: 10px 0; color: var(--text); font: 600 clamp(34px, 4vw, 49px)/1.2 var(--serif); }
.community-hero h1 span { color: var(--accent); }
.community-hero > p { position: relative; z-index: 1; max-width: 660px; color: var(--text2); font-size: 14px; line-height: 1.9; }
.community-privacy-note { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; width: fit-content; margin-top: 21px; padding: 12px 16px; border: 1px solid var(--gold-soft); border-radius: 9px; background: var(--surface); }
.community-privacy-note > span { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--gold-soft); color: var(--gold); font: 17px var(--serif); }
.community-privacy-note div { display: grid; gap: 3px; }
.community-privacy-note strong { color: var(--text); font-size: 12px; }
.community-privacy-note small { color: var(--muted); font-size: 10px; }
.community-workspace { display: grid; grid-template-columns: 220px minmax(0,1fr); min-height: 500px; margin-top: 20px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--glass-bg); }
.community-nav { padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface); }
.community-nav-label { padding: 5px 10px 12px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.community-nav button { display: flex; align-items: center; gap: 10px; width: 100%; margin: 3px 0; padding: 11px 10px; text-align: left; color: var(--text2); border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 12px; cursor: pointer; }
.community-nav button span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--border); color: var(--gold); font: 15px var(--serif); }
.community-nav button:hover, .community-nav button.active { color: var(--text); border-color: var(--border); background: var(--surface-solid); }
.community-main { min-width: 0; padding: 25px; }
.community-message:empty { display: none; }
.community-message:not(:empty) { margin-bottom: 15px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--text2); background: var(--surface); font-size: 12px; }
.community-message.is-error { color: #b8473d; border-color: #b8473d66; }
.community-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.community-heading h2 { margin: 4px 0; color: var(--text); font: 550 25px/1.3 var(--serif); }
.community-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.community-service-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.community-service-card { display: flex; flex-direction: column; min-height: 190px; padding: 18px; text-align: left; color: var(--text2); border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; transition: transform .2s,border-color .2s,background .2s; }
.community-service-card:hover { transform: translateY(-2px); border-color: var(--gold-soft); background: var(--surface-solid); }
.community-service-card > span { color: var(--gold); font: 22px var(--serif); }
.community-service-card strong { margin: 15px 0 6px; color: var(--text); font: 550 17px var(--serif); }
.community-service-card p { margin: 0; font-size: 11px; line-height: 1.75; }
.community-service-card small { margin-top: auto; padding-top: 17px; color: var(--accent); font-size: 10px; }
.community-form { padding: 21px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.community-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.community-field { display: flex; flex-direction: column; gap: 6px; color: var(--text2); font-size: 12px; }
.community-field.wide { grid-column: 1 / -1; }
.community-field small { color: var(--muted); font-size: 10px; line-height: 1.6; }
.community-field input, .community-field textarea, .community-field select { width: 100%; padding: 10px 12px; color: var(--text); border: 1px solid var(--border); background: var(--surface-solid); font: 13px/1.6 var(--sans); }
.community-field textarea { min-height: 130px; resize: vertical; }
.community-field .community-short { min-height: 88px; }
.community-check { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0; color: var(--text2); font-size: 11px; line-height: 1.7; }
.community-upload-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.community-upload-chip { display: flex; align-items: center; gap: 8px; padding: 6px 9px; color: var(--text2); border: 1px solid var(--border); background: var(--surface-solid); font-size: 10px; }
.community-upload-chip button { border: 0; color: var(--accent); background: none; cursor: pointer; }
.community-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.community-record-list { display: grid; gap: 10px; }
.community-list-tools, .community-toolbar { display: flex; align-items: center; gap: 8px; margin: 0 0 13px; }
.community-list-tools input, .community-toolbar input, .community-toolbar select { min-width: 0; min-height: 38px; padding: 8px 10px; color: var(--text); border: 1px solid var(--border); background: var(--surface-solid); font-size: 12px; }
.community-list-tools input { flex: 1; }
.community-toolbar input { flex: 1; }
.community-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.community-pager > div { display: flex; gap: 7px; }
.community-pager button { min-height: 34px; padding: 6px 11px; border: 1px solid var(--border); color: var(--text2); background: var(--surface); font-size: 11px; cursor: pointer; }
.community-pager button:disabled { opacity: .45; cursor: default; }
.community-record { padding: 16px 17px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.community-record-head { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.community-record h3 { margin: 0 0 5px; color: var(--text); font: 550 16px var(--serif); }
.community-record p { margin: 8px 0; color: var(--text2); font-size: 12px; line-height: 1.8; white-space: pre-line; }
.community-record-meta { color: var(--muted); font-size: 10px; line-height: 1.7; }
.community-status { flex: none; padding: 4px 8px; border: 1px solid var(--gold-soft); color: var(--gold); font-size: 10px; }
.community-status.accepted { border-color: #49835977; color: #4d9961; }
.community-status.rejected, .community-status.closed { border-color: #a8494277; color: #b64e45; }
.community-reply { margin-top: 11px; padding: 11px 13px; border-left: 2px solid var(--gold); color: var(--text2); background: var(--surface-solid); font-size: 11px; line-height: 1.7; }
.community-history { margin-top: 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.community-history > summary { padding: 9px 12px; color: var(--text2); font-size: 11px; cursor: pointer; }
.community-history > summary span { margin-left: 5px; color: var(--muted); }
.community-history ol { display: grid; gap: 0; margin: 0 12px 10px; padding: 0 0 0 13px; list-style: none; border-left: 1px solid var(--border-strong); }
.community-history li { position: relative; padding: 9px 0 9px 12px; }
.community-history li::before { content: ""; position: absolute; left: -17px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.community-history-head { display: flex; justify-content: space-between; gap: 10px; color: var(--text2); font-size: 11px; }
.community-history-head time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.community-history li p { margin: 5px 0 0; }
.community-history-internal { margin-top: 5px; color: var(--muted); font-size: 10px; white-space: pre-wrap; }
.community-admin-review { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); }
.community-admin-review textarea { width: 100%; min-height: 75px; padding: 9px; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); font: 12px/1.6 var(--sans); }
.community-admin-review select { min-height: 36px; padding: 5px 8px; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); }
.community-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.community-attachments a { padding: 7px 9px; color: var(--accent); border: 1px solid var(--border); font-size: 10px; text-decoration: none; }
.community-attachments button { padding: 7px 9px; color: var(--accent); border: 1px solid var(--border); background: var(--surface-solid); font-size: 10px; cursor: pointer; }
.community-empty { padding: 45px 18px; text-align: center; border: 1px dashed var(--border-strong); color: var(--muted); font-size: 12px; }
@media(max-width: 820px) { .community-workspace { grid-template-columns: 170px minmax(0,1fr); } .community-service-grid { grid-template-columns: 1fr; } }
@media(max-width: 600px) {
  .community-services { padding-top: 24px; }
  .community-hero { padding: 23px 18px; }
  .community-hero::after { right: -36px; top: -22px; font-size: 160px; }
  .community-hero > p { font-size: 12px; }
  .community-privacy-note { align-items: start; width: auto; padding: 10px; }
  .community-privacy-note small { font-size: 9px; }
  .community-workspace { display: block; }
  .community-nav { display: flex; gap: 5px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .community-nav-label { display: none; }
  .community-nav button { flex: 0 0 auto; width: auto; gap: 5px; margin: 0; padding: 6px 8px; font-size: 10px; white-space: nowrap; }
  .community-nav button span { width: 21px; height: 21px; }
  .community-main { padding: 13px; }
  .community-form { padding: 13px; }
  .community-form-grid { grid-template-columns: 1fr; }
  .community-field.wide { grid-column: auto; }
  .community-heading { align-items: start; flex-direction: column; }
  .community-actions { flex-wrap: wrap; }
  .community-list-tools, .community-toolbar { flex-wrap: wrap; }
  .community-list-tools input, .community-toolbar input { flex-basis: 100%; }
  .community-pager { align-items: flex-start; flex-direction: column; }
}

/* Section hero artwork generated for the genealogy collection pages */
.library-heading {
  position: relative;
  min-height: 280px;
  align-items: center;
  padding: 38px clamp(22px, 4vw, 52px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface-solid);
  background-image: linear-gradient(90deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 90%, transparent) 34%, color-mix(in srgb, var(--surface-solid) 18%, transparent) 68%, transparent 100%), url('../images/section-heroes/library.webp');
  background-size: cover;
  background-position: center 56%;
}
.library-heading > div:first-child { max-width: min(62%, 700px); }
.library-heading h1 { font-size: clamp(38px, 4.4vw, 56px); }
.library-heading .library-total { position: absolute; right: clamp(20px, 4vw, 50px); bottom: 28px; z-index: 1; padding: 8px 0 5px 16px; border-color: rgba(236,226,202,.36); color: #f4eddd; text-shadow: 0 1px 12px #101a14; }
.library-heading .library-total strong { color: #f2d99b; }
.library-heading .library-heading-copy { position: relative; }
.library-toolbar { margin-top: 24px; }

.heritage-intro {
  min-height: 370px;
  padding: clamp(32px, 5vw, 64px);
  background-color: var(--surface-solid);
  background-image: linear-gradient(90deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 94%, transparent) 33%, color-mix(in srgb, var(--surface-solid) 20%, transparent) 70%, transparent 100%), url('../images/section-heroes/heritage.webp');
  background-size: cover;
  background-position: center 56%;
}
.heritage-intro::after { display: none; }
.heritage-intro h1 { max-width: 610px; font-size: clamp(42px, 5.4vw, 68px); }
.heritage-intro > p { max-width: 560px; }
.heritage-shortcuts a { background: color-mix(in srgb, var(--surface-solid) 76%, transparent); backdrop-filter: blur(8px); }

.community-hero {
  min-height: 355px;
  padding: clamp(28px, 4vw, 48px);
  background-color: var(--surface-solid);
  background-image: linear-gradient(90deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 94%, transparent) 34%, color-mix(in srgb, var(--surface-solid) 12%, transparent) 74%, transparent 100%), url('../images/section-heroes/services.webp');
  background-size: cover;
  background-position: center 56%;
}
.community-hero::after { display: none; }
.community-hero > p { max-width: 540px; }
.community-privacy-note { max-width: 510px; backdrop-filter: blur(8px); }

#view-surnames .section-head {
  position: relative;
  display: flex;
  min-height: 335px;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 4vw, 50px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface-solid);
  background-image: linear-gradient(90deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 93%, transparent) 34%, color-mix(in srgb, var(--surface-solid) 5%, transparent) 75%, transparent 100%), url('../images/section-heroes/surnames.webp');
  background-size: cover;
  background-position: center 52%;
}
#view-surnames .section-head > * { position: relative; z-index: 1; max-width: 600px; }
#view-surnames .section-head h2 { max-width: 640px; font-size: clamp(36px, 5vw, 58px); }
#view-surnames .section-head p { max-width: 550px; color: var(--text2); line-height: 1.85; }
#view-surnames .toolbar { margin-top: 23px; }

@media (max-width: 768px) {
  .library-heading { min-height: 290px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 24px; padding: 25px 20px; background-position: 61% center; }
  .library-heading > div:first-child { max-width: 100%; }
  .library-heading h1 { max-width: 70%; font-size: 36px; }
  .library-heading p { max-width: 70%; font-size: 12px; }
  .library-heading .library-total { right: 16px; bottom: 18px; flex-direction: column; gap: 0; padding-left: 10px; }
  .library-heading .library-total strong { font-size: 25px; }
  .library-heading .library-total span { font-size: 10px; }
  .heritage-intro { min-height: 395px; padding: 26px 20px; background-position: 60% center; }
  .heritage-intro h1 { max-width: 74%; font-size: 39px; }
  .heritage-intro > p { max-width: 80%; font-size: 12px; }
  .heritage-shortcuts { max-width: 100%; }
  .community-hero { min-height: 405px; padding: 24px 18px; background-position: 61% center; }
  .community-hero h1 { max-width: 78%; font-size: 36px; }
  .community-hero > p { max-width: 78%; font-size: 12px; }
  #view-surnames .section-head { min-height: 390px; padding: 25px 20px; background-position: 64% center; }
  #view-surnames .section-head h2 { max-width: 75%; font-size: 38px; }
  #view-surnames .section-head p { max-width: 78%; font-size: 12px; }
}
@media (max-width: 420px) {
  .library-heading h1 { max-width: 75%; font-size: 32px; }
  .library-heading p { max-width: 75%; }
  .heritage-intro h1 { max-width: 82%; font-size: 34px; }
  .heritage-intro > p { max-width: 88%; }
  .community-hero h1, .community-hero > p { max-width: 88%; }
  #view-surnames .section-head h2, #view-surnames .section-head p { max-width: 88%; }
}

/* Tool workspaces: consistent editorial headers and calmer data surfaces */
#view-explore .section-head,
#view-dashboard .section-head,
#view-search .section-head,
#view-editor .section-head,
#view-generate .section-head,
#view-experience .section-head,
#view-system .section-head,
#view-reclogs .section-head,
#view-upload .section-head {
  position: relative;
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 3.5vw, 42px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface-solid);
  background-image: linear-gradient(90deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 95%, transparent) 36%, color-mix(in srgb, var(--surface-solid) 25%, transparent) 73%, transparent 100%), var(--section-art);
  background-size: cover;
  background-position: center 52%;
  box-shadow: 0 10px 34px rgba(13, 23, 18, .12);
}
#view-explore .section-head > *,
#view-dashboard .section-head > *,
#view-search .section-head > *,
#view-editor .section-head > *,
#view-generate .section-head > *,
#view-experience .section-head > *,
#view-system .section-head > *,
#view-reclogs .section-head > *,
#view-upload .section-head > * { position: relative; z-index: 1; max-width: 700px; }
#view-editor .section-head,
#view-generate .section-head,
#view-experience .section-head,
#view-system .section-head,
#view-reclogs .section-head,
#view-upload .section-head {
  background-image: linear-gradient(90deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 96%, transparent) 35%, color-mix(in srgb, var(--surface-solid) 30%, transparent) 75%, transparent 100%), var(--section-art);
}
#view-explore { --section-art: url('../images/section-heroes/explore.webp'); }
#view-search { --section-art: url('../images/section-heroes/search.webp'); }
#view-dashboard { --section-art: url('../images/section-heroes/dashboard.webp'); }
#view-editor { --section-art: url('../images/section-heroes/editor.webp'); }
#view-generate { --section-art: url('../images/section-heroes/generate.webp'); }
#view-experience { --section-art: url('../images/section-heroes/experience.webp'); }
#view-system { --section-art: url('../images/section-heroes/system.webp'); }
#view-reclogs { --section-art: url('../images/section-heroes/reclogs.webp'); }
#view-upload { --section-art: url('../images/section-heroes/upload.webp'); }
#view-explore .section-head h2,
#view-dashboard .section-head h2,
#view-search .section-head h2,
#view-editor .section-head h2,
#view-generate .section-head h2,
#view-experience .section-head h2,
#view-system .section-head h2,
#view-reclogs .section-head h2,
#view-upload .section-head h2 { margin: 9px 0; font: 600 clamp(32px, 4vw, 48px)/1.2 var(--serif); letter-spacing: .02em; }
#view-explore .section-head p,
#view-dashboard .section-head p,
#view-search .section-head p,
#view-editor .section-head p,
#view-generate .section-head p,
#view-experience .section-head p,
#view-system .section-head p,
#view-reclogs .section-head p,
#view-upload .section-head p { max-width: 620px; color: var(--text2); font-size: 13px; line-height: 1.8; }

#view-explore .section,
#view-search .section,
#view-dashboard .section,
#view-editor .section,
#view-generate .section,
#view-reclogs .section { padding-top: 34px !important; }
#view-explore .toolbar,
#view-search .toolbar,
#view-dashboard .toolbar,
#view-editor .editor-toolbar,
#view-reclogs .toolbar,
#view-upload .uj-filter,
#view-experience .exp-toolbar {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(13, 23, 18, .05);
}
#view-explore .explore-layout { gap: 16px; margin-top: 16px; }
#view-explore .tree-wrap,
#view-explore .bands,
#view-explore .detail,
#view-dashboard .chart-card,
#view-editor .editor-list,
#view-editor .editor-center,
#view-editor .editor-drawer,
#view-editor .review-queue,
#view-editor .version-list,
#view-editor .version-diff,
#view-editor .meta-edit,
#view-generate .gen-card,
#view-system .gen-card,
#view-reclogs .gen-card,
#view-upload .gen-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  box-shadow: 0 8px 24px rgba(13, 23, 18, .07);
}
#view-explore .tree-wrap { min-height: 560px; overflow: hidden; }
#view-explore .detail { padding: 18px; }
#view-search .search-results { margin-top: 18px; }
#view-search .result-card { border-radius: var(--radius); background: var(--card); box-shadow: 0 6px 20px rgba(13,23,18,.06); }
#view-dashboard .dash-stats { gap: 12px; margin: 15px 0; }
#view-dashboard .stat-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: 0 6px 20px rgba(13,23,18,.06); }
#view-dashboard .chart-card { padding: clamp(18px, 3vw, 28px); }
#view-dashboard .chart-title { color: var(--text); font: 600 18px/1.4 var(--serif); }
#view-editor .editor-toolbar { gap: 12px; }
#view-editor .editor-pane { margin-top: 16px; }
#view-editor .panel-head { min-height: 48px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--gold) 5%, var(--surface)); }
#view-editor .panel-title { color: var(--text); font-weight: 700; }
#view-editor .export-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: 0 6px 20px rgba(13,23,18,.06); }
#view-generate .gen-layout { gap: 18px; }
#view-generate .gen-card, #view-system .gen-card, #view-reclogs .gen-card { padding: clamp(16px, 2.2vw, 24px); }
#view-generate .gen-card h3, #view-system .gen-card h3 { font-family: var(--serif); }
#view-experience .exp-tab,
#view-experience .exp-badge,
#view-experience .exp-item,
#view-experience .exp-toolbar input,
#view-experience .exp-toolbar select {
  border-radius: 8px;
  border-color: var(--border);
  background-color: var(--surface-solid);
  color: var(--text2);
}
#view-experience .exp-tab.active { border-color: color-mix(in srgb, var(--gold) 54%, var(--border)); background: var(--gold-soft); color: var(--text); }
#view-experience .exp-item { box-shadow: 0 4px 16px rgba(13,23,18,.05); }
#view-system .gen-grid { gap: 16px; }
#view-system .gen-card h3 { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
#view-system .usage-subtitle { margin-top: 22px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
#view-optimizer .opt-hero { border: 1px solid var(--border); border-radius: var(--radius); background-color: var(--surface-solid); background-image: linear-gradient(90deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 93%, transparent) 42%, color-mix(in srgb, var(--surface-solid) 18%, transparent) 100%), url('../images/section-heroes/optimizer.webp'); background-size: cover; background-position: center; box-shadow: 0 10px 32px rgba(13,23,18,.08); }
#view-optimizer .opt-hero-title { font-family: var(--serif); }
#view-optimizer .opt-hero-card { border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--surface-solid) 88%, transparent); }
#view-upload .uj-jobs,
#view-reclogs .rl-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
#view-upload .uj-table th,
#view-reclogs .rl-table th { padding: 11px 12px; background: color-mix(in srgb, var(--gold) 9%, var(--surface)); }
#view-upload .uj-table td,
#view-reclogs .rl-table td { padding: 10px 12px; }
#view-upload .uj-row:hover td,
#view-reclogs tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
#view-reclogs .rl-badge, #view-upload .uj-badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 99px; }

@media (max-width: 768px) {
  #view-explore .section-head,
  #view-dashboard .section-head,
  #view-search .section-head,
  #view-editor .section-head,
  #view-generate .section-head,
  #view-experience .section-head,
  #view-system .section-head,
  #view-reclogs .section-head,
  #view-upload .section-head { min-height: 200px; padding: 24px 18px; background-position: 58% center; }
  #view-explore .section-head,
  #view-dashboard .section-head,
  #view-search .section-head,
  #view-editor .section-head,
  #view-generate .section-head,
  #view-experience .section-head,
  #view-system .section-head,
  #view-reclogs .section-head,
  #view-upload .section-head {
    background-image: linear-gradient(90deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 94%, transparent) 57%, color-mix(in srgb, var(--surface-solid) 78%, transparent) 100%), var(--section-art);
  }
  #view-explore .section-head h2,
  #view-dashboard .section-head h2,
  #view-search .section-head h2,
  #view-editor .section-head h2,
  #view-generate .section-head h2,
  #view-experience .section-head h2,
  #view-system .section-head h2,
  #view-reclogs .section-head h2,
  #view-upload .section-head h2 { max-width: 90%; font-size: 34px; }
  #view-explore .section-head p,
  #view-dashboard .section-head p,
  #view-search .section-head p,
  #view-editor .section-head p,
  #view-generate .section-head p,
  #view-experience .section-head p,
  #view-system .section-head p,
  #view-reclogs .section-head p,
  #view-upload .section-head p { max-width: 88%; font-size: 12px; }
  #view-explore .tree-wrap { min-height: 420px; }
  #view-experience .exp-toolbar { align-items: stretch; }
  #view-system .gen-grid { grid-template-columns: 1fr !important; }
}

/* 首页四主题图片轮播 */
#view-home .hero-art { width: min(64%, 940px); }
#view-home .hero-art .hero-slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity 900ms ease;
  object-position: center; will-change: opacity;
}
#view-home .hero-art .hero-slide.is-active { opacity: 1; }
.hero-carousel-controls {
  position: absolute; z-index: 3; right: max(24px, calc((100% - 1160px) / 2)); bottom: 24px;
  display: flex; align-items: center; gap: 11px; padding: 8px 10px 8px 14px;
  border: 1px solid var(--glass-border); border-radius: 999px; color: var(--text);
  background: color-mix(in srgb, var(--bg) 76%, transparent); backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(30, 20, 8, .12);
}
.hero-carousel-label { min-width: 64px; color: var(--text2); font-size: 12px; letter-spacing: .04em; }
.hero-carousel-arrow {
  display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%;
  color: var(--text); background: transparent; cursor: pointer; font: 22px/1 var(--serif);
  transition: color .2s, background .2s;
}
.hero-carousel-arrow:hover { color: var(--accent); background: var(--surface-hover); }
.hero-carousel-dots { display: flex; align-items: center; gap: 6px; }
.hero-carousel-dots button {
  width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--text2) 48%, transparent); cursor: pointer;
  transition: width .25s ease, background .25s ease;
}
.hero-carousel-dots button.is-active { width: 22px; background: var(--accent); }
.hero-carousel-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 768px) {
  #view-home .hero-art { width: 100%; opacity: 1; }
  #view-home .hero-art .hero-slide { object-position: 65% center; }
  .hero-carousel-controls { right: 16px; bottom: 17px; gap: 7px; padding: 6px 8px 6px 11px; }
  .hero-carousel-label { min-width: 56px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  #view-home .hero-art .hero-slide,
  .hero-carousel-dots button { transition: none; }
}
@media (max-width: 480px) {
  #view-explore .section-head,
  #view-dashboard .section-head,
  #view-search .section-head,
  #view-editor .section-head,
  #view-generate .section-head,
  #view-experience .section-head,
  #view-system .section-head,
  #view-reclogs .section-head,
  #view-upload .section-head { min-height: 220px; }
  #view-explore .section-head h2,
  #view-dashboard .section-head h2,
  #view-search .section-head h2,
  #view-editor .section-head h2,
  #view-generate .section-head h2,
  #view-experience .section-head h2,
  #view-system .section-head h2,
  #view-reclogs .section-head h2,
  #view-upload .section-head h2 { font-size: 30px; }
  #view-explore .toolbar, #view-search .toolbar, #view-dashboard .toolbar { padding: 10px; }
}
