:root {
  --ink: #172128;
  --navy: #112d3f;
  --blue: #176b87;
  --cyan: #83b6c4;
  --green: #496b55;
  --gold: #a9772e;
  --red: #98453b;
  --paper: #ffffff;
  --mist: #eef3f3;
  --soft: #f5f7f6;
  --muted: #64727b;
  --line: #d8e0df;
  --line-dark: #aebdbc;
  --radius: 6px;
  --container: 1200px;
  --shadow: 0 18px 52px rgba(17, 45, 63, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}
a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
h1, h2, h3, p, dl, dd { margin-top: 0; }
:focus-visible { outline: 3px solid rgba(23, 107, 135, .46); outline-offset: 3px; }
.container { width: min(var(--container), calc(100% - 48px)); margin-inline: auto; }
.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; }
.skip-link { position: fixed; top: -80px; left: 18px; z-index: 100; padding: 10px 14px; color: #fff; background: var(--navy); border-radius: var(--radius); }
.skip-link:focus { top: 18px; }

.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { min-width: 236px; display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; color: #fff; background: var(--navy); border-radius: var(--radius); font-family: "STSong", "Songti SC", serif; font-size: 21px; font-weight: 700; }
.brand strong { display: block; font-size: 15px; line-height: 1.25; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-family: ui-monospace, "SFMono-Regular", monospace; font-size: 11px; letter-spacing: .02em; }
.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a { min-height: 44px; display: inline-flex; align-items: center; color: #51616b; border-bottom: 2px solid transparent; text-decoration: none; }
.main-nav a:hover { color: var(--navy); }
.main-nav a.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 700; }
.header-action { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; color: #fff; background: var(--navy); border: 1px solid var(--navy); border-radius: var(--radius); text-decoration: none; white-space: nowrap; }
.header-action.quiet { color: var(--navy); background: #fff; border-color: var(--line-dark); }

.eyebrow { color: var(--blue); font-family: ui-monospace, "SFMono-Regular", monospace; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 28px; padding: 0 20px; color: #fff; background: var(--navy); border: 1px solid var(--navy); border-radius: var(--radius); text-decoration: none; transition: transform .2s ease, background .2s ease; }
.button:hover { transform: translateY(-2px); background: #17405a; }

.home-hero { position: relative; overflow: hidden; color: #fff; background: var(--navy); }
.home-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .2; background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px); background-size: 52px 52px; mask-image: linear-gradient(90deg, transparent 18%, #000 100%); }
.home-grid { position: relative; z-index: 1; min-height: 560px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); align-items: stretch; }
.home-copy { align-self: center; padding: 70px 60px 72px 0; }
.home-copy .eyebrow { color: #9bc8d2; }
.home-title { max-width: 760px; margin: 16px 0 24px; font-family: "STSong", "Songti SC", serif; font-size: clamp(52px, 6.8vw, 88px); font-weight: 700; line-height: 1.05; letter-spacing: 0; }
.home-lead { max-width: 640px; margin-bottom: 30px; color: #d7e2e5; font-size: 19px; }
.button-arrow { color: var(--navy); background: #fff; border-color: #fff; }
.button-arrow:hover { color: var(--navy); background: #e7f0f1; }
.archive-index { align-self: stretch; padding: 70px 0 58px 42px; border-left: 1px solid rgba(255,255,255,.22); }
.archive-number { font-family: Georgia, serif; font-size: 108px; line-height: .95; color: #fff; }
.archive-index > p { margin: 10px 0 42px; color: #9bc8d2; }
.archive-index dl { margin-bottom: 0; }
.archive-index dl div { padding: 15px 0; border-top: 1px solid rgba(255,255,255,.18); }
.archive-index dt { color: #9fb0b8; font-size: 13px; }
.archive-index dd { color: #fff; font-weight: 600; }

.portal-section { padding: 66px 0 78px; background: var(--soft); }
.section-heading { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 26px; }
.section-number { color: var(--line-dark); font-family: Georgia, serif; font-size: 44px; line-height: 1; }
.section-heading h2 { margin: 3px 0 0; font-family: "STSong", "Songti SC", serif; font-size: 32px; }
.portal-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-dark); border-left: 1px solid var(--line-dark); }
.portal-card { min-height: 290px; display: flex; flex-direction: column; justify-content: space-between; padding: 26px; background: #fff; border-right: 1px solid var(--line-dark); border-bottom: 1px solid var(--line-dark); text-decoration: none; transition: background .2s ease, transform .2s ease; }
.portal-card:hover { position: relative; transform: translateY(-3px); background: #f8fbfb; box-shadow: var(--shadow); }
.portal-card.primary { color: #fff; background: var(--blue); }
.portal-card.primary:hover { background: #145d76; }
.portal-index { font-family: Georgia, serif; font-size: 18px; opacity: .65; }
.portal-card h3 { margin: 0 0 8px; font-family: "STSong", "Songti SC", serif; font-size: 34px; }
.portal-card p { margin: 0; color: var(--muted); }
.portal-card.primary p { color: #d9edf1; }
.portal-link { font-size: 14px; font-weight: 700; }

.database-intro, .module-hero { border-bottom: 1px solid var(--line); background: var(--soft); }
.database-intro-grid, .module-hero-grid { min-height: 194px; display: grid; grid-template-columns: 1.35fr .65fr; align-items: end; gap: 60px; padding-top: 42px; padding-bottom: 34px; }
.database-intro h1, .module-hero h1 { margin: 7px 0 0; font-family: "STSong", "Songti SC", serif; font-size: clamp(38px, 5vw, 60px); line-height: 1.1; }
.database-intro p, .module-hero p { margin-bottom: 4px; color: var(--muted); font-size: 17px; }
.database-toolbar { padding: 24px 0 18px; background: #fff; border-bottom: 1px solid var(--line); }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 14px; }
.search-box { min-height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 18px; background: var(--soft); border: 1px solid var(--line-dark); border-radius: var(--radius); }
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,107,135,.12); }
.search-icon { width: 18px; height: 18px; flex: 0 0 auto; border: 2px solid var(--navy); border-radius: 50%; position: relative; }
.search-icon::after { content: ""; position: absolute; width: 7px; height: 2px; right: -5px; bottom: -2px; background: var(--navy); transform: rotate(45deg); }
.search-box input { width: 100%; height: 54px; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 17px; }
.record-status { min-width: 124px; display: flex; align-items: baseline; justify-content: center; gap: 7px; padding: 0 16px; color: #fff; background: var(--navy); border-radius: var(--radius); }
.record-status strong { font-family: Georgia, serif; font-size: 29px; }
.record-status span { font-size: 13px; }
.filter-row { display: grid; grid-template-columns: repeat(4, 1fr) auto; align-items: end; gap: 12px; margin-top: 14px; }
.filter-row label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 13px; }
.filter-row select { width: 100%; min-height: 44px; padding: 0 34px 0 11px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.reset-button { min-height: 44px; padding: 0 15px; color: var(--navy); background: #fff; border: 1px solid var(--line-dark); border-radius: var(--radius); }
.database-content { min-height: 560px; padding: 24px 0 64px; background: var(--mist); }
.database-meta { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.metric-strip { display: flex; align-items: center; gap: 0; }
.metric-strip div { display: flex; align-items: baseline; gap: 7px; padding-right: 24px; margin-right: 24px; border-right: 1px solid var(--line-dark); }
.metric-strip div:last-child { border-right: 0; }
.metric-strip strong { font-family: Georgia, serif; font-size: 25px; }
.metric-strip span { color: var(--muted); font-size: 13px; }
.view-switch { display: inline-flex; padding: 3px; background: #dfe8e8; border-radius: var(--radius); }
.view-switch button { min-height: 36px; padding: 0 14px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; }
.view-switch button.active { color: var(--navy); background: #fff; box-shadow: 0 3px 10px rgba(17,45,63,.09); }
.case-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.case-grid.table-mode { display: block; overflow-x: auto; background: #fff; border: 1px solid var(--line); }
.case-card { min-height: 246px; display: flex; flex-direction: column; justify-content: space-between; padding: 19px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: var(--radius); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.case-card:hover { transform: translateY(-2px); border-color: var(--line-dark); box-shadow: 0 13px 30px rgba(17,45,63,.09); }
.case-id { color: var(--muted); font-family: ui-monospace, "SFMono-Regular", monospace; font-size: 11px; }
.case-card h3 { margin: 9px 0 8px; font-family: "STSong", "Songti SC", serif; font-size: 21px; line-height: 1.4; }
.case-card p { margin: 0; color: var(--muted); font-size: 14px; }
.case-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { min-height: 27px; display: inline-flex; align-items: center; padding: 2px 8px; color: #42515a; background: var(--soft); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
.tag.blue { color: #0b536b; background: #e8f2f4; border-color: #c6dfe5; }
.tag.green { color: #35523f; background: #eaf2ec; border-color: #cddfd1; }
.tag.gold { color: #7b5319; background: #f7efe1; border-color: #ead6b8; }
.tag.red { color: var(--red); background: #f9ecea; border-color: #e9cbc7; }
.case-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line); }
.verification-label { color: var(--muted); font-size: 12px; }
.verification-label::before { content: ""; width: 6px; height: 6px; display: inline-block; margin-right: 6px; background: var(--gold); border-radius: 50%; vertical-align: 1px; }
.link-button { min-height: 38px; padding: 0 12px; color: var(--navy); background: #fff; border: 1px solid var(--line-dark); border-radius: var(--radius); }
.link-button:hover { color: #fff; background: var(--navy); }
.table { width: 100%; min-width: 980px; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 13px; }
.table th { color: #40525c; background: var(--soft); }
.table td { color: #52616a; }
.table td:first-child { color: var(--ink); font-weight: 700; }
.empty { grid-column: 1 / -1; padding: 44px; color: var(--muted); background: #fff; border: 1px dashed var(--line-dark); text-align: center; }
.source-note { max-width: 860px; margin: 24px 0 0; color: var(--muted); font-size: 13px; }

.module-hero { color: #fff; background: var(--navy); }
.module-hero .eyebrow { color: #9bc8d2; }
.module-hero p { color: #d4e0e4; }
.library-content, .experience-content { padding: 54px 0 76px; }
.library-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 56px; }
.library-index { position: sticky; top: 104px; align-self: start; display: grid; }
.library-index span { padding-bottom: 10px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.library-index a { padding: 12px 0; color: #44545e; border-bottom: 1px solid var(--line); text-decoration: none; }
.library-index a:hover { color: var(--blue); }
.library-list { border-top: 1px solid var(--line-dark); }
.library-entry { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 24px; padding: 32px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 100px; }
.entry-number { color: var(--line-dark); font-family: Georgia, serif; font-size: 24px; }
.library-entry h2 { margin: 5px 0 9px; font-family: "STSong", "Songti SC", serif; font-size: 28px; }
.library-entry p { max-width: 690px; margin-bottom: 15px; color: var(--muted); }
.topic-list { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-list span { padding: 3px 9px; color: #40535d; background: var(--soft); border: 1px solid var(--line); font-size: 12px; }
.entry-state { align-self: start; padding: 4px 9px; color: var(--blue); border: 1px solid #b8d2d8; font-size: 12px; }
.experience-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 25px; }
.experience-heading h2 { margin: 5px 0 0; font-family: "STSong", "Songti SC", serif; font-size: 34px; }
.experience-heading p { margin: 0; color: var(--muted); }
.experience-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-dark); border-left: 1px solid var(--line-dark); }
.experience-card { min-height: 410px; display: flex; flex-direction: column; justify-content: space-between; padding: 26px; border-right: 1px solid var(--line-dark); border-bottom: 1px solid var(--line-dark); }
.experience-card.featured { background: var(--soft); }
.case-sequence { color: var(--line-dark); font-family: Georgia, serif; font-size: 28px; }
.availability { color: var(--blue); font-size: 12px; }
.experience-card h3 { margin: 10px 0 7px; font-family: "STSong", "Songti SC", serif; font-size: 26px; line-height: 1.35; }
.experience-card p { color: var(--muted); }
.experience-card dl { margin-bottom: 0; border-top: 1px solid var(--line); }
.experience-card dl div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.experience-card dt { color: var(--muted); font-size: 12px; }
.experience-card dd { font-size: 14px; }

.modal { position: fixed; inset: 0; z-index: 90; display: none; padding: 28px; background: rgba(7,22,31,.58); }
.modal.open { display: grid; place-items: center; }
.modal-panel { width: min(880px, 100%); max-height: min(790px, calc(100vh - 56px)); overflow: auto; background: #fff; border-radius: var(--radius); box-shadow: 0 32px 90px rgba(0,0,0,.25); }
.modal-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: start; justify-content: space-between; gap: 18px; padding: 22px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 5px 0 0; font-family: "STSong", "Songti SC", serif; font-size: 27px; }
.modal-body { padding: 24px; }
.detail-section { margin-bottom: 26px; }
.detail-section h3 { margin: 0 0 10px; color: var(--blue); font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: 120px 1fr; gap: 0 18px; margin: 0; }
.detail-grid dt, .detail-grid dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.detail-grid a { color: var(--blue); }
.close-button { width: 44px; height: 44px; flex: 0 0 auto; color: var(--navy); background: #fff; border: 1px solid var(--line-dark); border-radius: var(--radius); font-size: 24px; }
.site-footer { padding: 24px 0; color: #aebdc4; background: #0b202e; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; font-size: 13px; }
.footer-inner strong { color: #fff; }

@media (max-width: 980px) {
  .header-action { display: none; }
  .home-grid, .database-intro-grid, .module-hero-grid { grid-template-columns: 1fr; }
  .home-copy { padding-right: 0; }
  .archive-index { padding: 0 0 54px; border-left: 0; border-top: 1px solid rgba(255,255,255,.22); }
  .archive-number { margin-top: 34px; }
  .portal-grid, .case-grid, .experience-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-row { grid-template-columns: repeat(2, 1fr); }
  .reset-button { width: 100%; }
}
@media (max-width: 700px) {
  .container { width: min(var(--container), calc(100% - 28px)); }
  .header-inner { min-height: auto; display: grid; gap: 10px; padding: 12px 0 10px; }
  .brand { min-width: 0; }
  .main-nav { width: 100%; gap: 18px; overflow-x: auto; }
  .main-nav a { min-width: max-content; }
  .home-grid { min-height: 0; }
  .home-copy { padding: 54px 0 48px; }
  .home-title { font-size: 48px; }
  .home-lead { font-size: 17px; }
  .archive-number { font-size: 82px; }
  .portal-grid, .case-grid, .experience-grid, .filter-row { grid-template-columns: 1fr; }
  .portal-card { min-height: 230px; }
  .database-intro-grid, .module-hero-grid { min-height: 180px; gap: 16px; padding-top: 34px; padding-bottom: 28px; }
  .database-intro h1, .module-hero h1 { font-size: 38px; }
  .search-row { grid-template-columns: 1fr; }
  .record-status { min-height: 46px; }
  .database-meta { align-items: flex-start; }
  .metric-strip { display: grid; gap: 5px; }
  .metric-strip div { border-right: 0; }
  .library-layout { grid-template-columns: 1fr; gap: 28px; }
  .library-index { position: static; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .library-index span { grid-column: 1 / -1; }
  .library-index a { padding: 8px; border: 1px solid var(--line); text-align: center; }
  .library-entry { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
  .entry-state { grid-column: 2; justify-self: start; }
  .experience-heading { display: block; }
  .experience-heading p { margin-top: 8px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid dt { padding-bottom: 0; border-bottom: 0; }
  .detail-grid dd { padding-top: 3px; }
  .modal { padding: 12px; }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
