:root {
  color-scheme: light;
  --paper: #f2f3ef;
  --surface: #fbfcf8;
  --ink: #17201d;
  --muted: #657069;
  --faint: #9aa29c;
  --line: #d8ddd8;
  --line-strong: #bfc8c1;
  --red: #bd3f2d;
  --red-soft: #f7e9e3;
  --green: #416a57;
  --gold: #aa7c35;
  --shadow: 0 22px 55px rgba(30, 40, 34, .13);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-sans-serif, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--paper); color: var(--ink); }
body.dialog-open { overflow: hidden; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
.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; }

.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(16px); }
.header-inner { width: min(1240px, calc(100% - 48px)); min-height: 66px; margin: auto; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-family: "Noto Serif SC", "Songti SC", SimSun, serif; font-size: 18px; font-weight: 800; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--red); background: var(--red); color: #fff; font-size: 18px; font-weight: 500; }
.brand em { display: block; margin-top: 2px; color: var(--muted); font-family: ui-sans-serif, sans-serif; font-size: 8px; font-style: normal; font-weight: 700; letter-spacing: 0; }
.main-nav { display: flex; gap: 3px; margin-left: auto; }
.nav-link { padding: 8px 12px; color: var(--muted); text-decoration: none; font-size: 13px; }
.nav-link:hover, .nav-link.is-active { color: var(--ink); }
.nav-link.is-active { font-weight: 700; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 19px; transition: border-color .2s, color .2s, transform .2s; }
.icon-button:hover { border-color: var(--red); color: var(--red); transform: translateY(-1px); }

.hero { position: relative; min-height: 560px; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--surface); }
.hero::after { content: ""; position: absolute; top: 28px; right: max(calc((100% - 1240px) / 2), 3vw); width: min(43vw, 520px); height: 600px; background: url("assets/xu-xiake.png") top center / contain no-repeat; mix-blend-mode: multiply; opacity: .9; filter: contrast(1.03); }
.hero-inner { position: relative; z-index: 1; width: min(1240px, calc(100% - 48px)); min-height: 560px; margin: auto; padding: 86px 0 38px; }
.hero-copy { position: relative; z-index: 2; width: min(650px, 62%); }
.eyebrow { margin: 0 0 13px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: 0; line-height: 1.5; }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--green); vertical-align: 1px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0 0 22px; font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, serif; font-size: 88px; font-weight: 700; line-height: 1.08; letter-spacing: 0; }
.hero-intro { max-width: 540px; margin-bottom: 28px; color: var(--muted); font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, serif; font-size: 17px; line-height: 1.9; }
.primary-link { display: inline-flex; align-items: center; gap: 25px; padding: 12px 17px; border: 1px solid var(--ink); color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.primary-link:hover { border-color: var(--red); background: var(--red); color: #fff; }
.hero-stats { position: absolute; left: 0; bottom: 35px; display: flex; gap: 0; }
.hero-stats div { min-width: 126px; padding-right: 26px; margin-right: 26px; border-right: 1px solid var(--line); }
.hero-stats div:last-child { border: 0; }
.hero-stats strong, .hero-stats span { display: block; }
.hero-stats strong { font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.hero-stats span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.portrait-note { position: absolute; right: 0; bottom: 24px; z-index: 2; margin: 0; color: var(--faint); font-size: 10px; writing-mode: vertical-rl; }

.route-band { border-bottom: 1px solid var(--line); background: #e8ede8; }
.route-inner { width: min(1240px, calc(100% - 48px)); margin: auto; padding: 29px 0 31px; }
.route-line { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 22px; }
.route-line div { display: grid; grid-template-columns: 30px auto; column-gap: 10px; align-items: center; }
.route-line div > span { grid-row: span 2; color: var(--red); font-family: Georgia, serif; font-size: 14px; }
.route-line strong { font-family: "Noto Serif SC", "Songti SC", SimSun, serif; font-size: 15px; }
.route-line small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.route-line i { display: block; height: 1px; background: var(--line-strong); }

.archive-shell { width: min(1240px, calc(100% - 48px)); margin: auto; }
.toolbar { position: sticky; top: 66px; z-index: 12; display: flex; align-items: center; gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(14px); }
.search-box { display: flex; align-items: center; flex: 1; min-width: 220px; height: 43px; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface); }
.search-icon { margin-right: 8px; color: var(--red); font-size: 23px; line-height: 0; transform: rotate(-20deg); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box kbd { padding: 2px 6px; border: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.filter-row { display: flex; gap: 3px; }
.filter-button { min-height: 36px; padding: 7px 10px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.filter-button span { margin-left: 3px; color: var(--faint); font-size: 10px; }
.filter-button:hover, .filter-button.is-selected { background: var(--red-soft); color: var(--ink); }
.filter-button.is-selected { font-weight: 700; }
.random-button { min-height: 36px; padding: 7px 11px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font-size: 12px; }
.random-button:hover { border-color: var(--red); color: var(--red); }
.random-button span { margin-right: 5px; font-size: 15px; }

.content-layout { display: grid; grid-template-columns: minmax(0, 1fr) 282px; gap: 70px; padding: 52px 0 90px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-family: "Noto Serif SC", "Songti SC", SimSun, serif; font-size: 27px; font-weight: 700; letter-spacing: 0; }
.result-count { color: var(--muted); font-size: 12px; }
.record-list { border-top: 1px solid var(--line-strong); }
.record-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) 92px; gap: 18px; padding: 24px 0 22px; border-bottom: 1px solid var(--line); }
.record-index { color: var(--red); font-family: Georgia, serif; font-size: 14px; }
.record-card h3 { margin: 0 0 8px; font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, serif; font-size: 21px; font-weight: 700; line-height: 1.35; }
.record-card h3 button { padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.record-card h3 button:hover { color: var(--red); }
.record-meta { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.record-meta .place { color: var(--green); font-weight: 700; }
.record-excerpt { display: -webkit-box; max-width: 690px; margin: 0; overflow: hidden; color: #57615b; font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, serif; font-size: 14px; line-height: 1.85; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.record-actions { display: flex; flex-direction: column; align-items: end; gap: 9px; }
.record-year { color: var(--ink); font-family: Georgia, serif; font-size: 17px; }
.record-actions button, .record-actions a { padding: 0; border: 0; background: transparent; color: var(--faint); font-size: 11px; text-decoration: none; }
.record-actions button:hover, .record-actions a:hover, .record-actions .is-saved { color: var(--red); }
.empty-state { padding: 70px 0; border-bottom: 1px solid var(--line); text-align: center; }
.empty-state > span { width: 46px; height: 46px; display: inline-grid; place-items: center; border: 1px solid var(--red); color: var(--red); font-family: "Noto Serif SC", serif; }
.empty-state h3 { margin: 14px 0 7px; }
.empty-state p { color: var(--muted); font-size: 13px; }

.side-rail { padding-left: 27px; border-left: 1px solid var(--line); }
.rail-block { padding: 0 0 29px; margin-bottom: 29px; border-bottom: 1px solid var(--line); }
.rail-block h2 { margin-bottom: 12px; font-family: "Noto Serif SC", "Songti SC", SimSun, serif; font-size: 18px; }
.rail-block p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.8; }
.text-link { display: inline-flex; gap: 8px; color: var(--red); font-size: 12px; font-weight: 700; line-height: 1.6; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.saved-title { display: flex; justify-content: space-between; align-items: start; }
.saved-title strong { min-width: 28px; color: var(--red); font-family: Georgia, serif; font-size: 24px; text-align: right; }
.text-button { display: flex; justify-content: space-between; width: 100%; padding: 9px 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 12px; text-align: left; }
.text-button:hover { color: var(--red); }
.chronology ol { padding: 0; margin: 0; list-style: none; }
.chronology li { display: grid; grid-template-columns: 42px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.chronology li:last-child { border-bottom: 1px solid var(--line); }
.chronology time { color: var(--red); font-family: Georgia, serif; font-size: 12px; }
.chronology span { color: var(--muted); font-size: 11px; line-height: 1.6; }
.source-note { border: 0; }

.site-footer { width: min(1240px, calc(100% - 48px)); margin: auto; padding: 25px 0 34px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer strong { color: var(--ink); }
.site-footer a { color: var(--red); text-decoration: none; }

.record-dialog { width: min(760px, calc(100% - 32px)); max-height: min(820px, calc(100% - 32px)); padding: 0; overflow: hidden; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.record-dialog::backdrop { background: rgba(17, 27, 22, .55); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 16px; right: 16px; z-index: 2; }
#dialogBody { max-height: calc(min(820px, 100vh - 32px) - 61px); padding: 44px 50px 35px; overflow-y: auto; }
.dialog-kicker { margin: 0 0 14px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.record-dialog h2 { max-width: 610px; margin: 0 0 12px; font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, serif; font-size: 34px; letter-spacing: 0; }
.dialog-meta { color: var(--muted); font-size: 11px; }
.dialog-rule { width: 42px; height: 2px; margin: 24px 0; background: var(--red); }
.dialog-lead { margin-bottom: 18px; color: var(--green); font-family: "Noto Serif SC", "Songti SC", serif; font-size: 15px; line-height: 1.8; }
.dialog-text { white-space: pre-line; color: #414a45; font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, serif; font-size: 16px; line-height: 2.05; }
.dialog-note { margin-top: 28px; padding: 16px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.7; }
.dialog-links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.dialog-links a { color: var(--red); font-size: 12px; font-weight: 700; text-decoration: none; }
.dialog-nav { min-height: 61px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 18px; border-top: 1px solid var(--line); background: var(--paper); }
.dialog-nav button { padding: 8px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.dialog-nav button:last-child { text-align: right; }
.dialog-nav button:hover { color: var(--red); }
.dialog-nav span { color: var(--faint); font-family: Georgia, serif; font-size: 11px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 30; padding: 10px 15px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

body.dark { --paper: #141916; --surface: #1c221e; --ink: #edf1ed; --muted: #a2ada5; --faint: #737e77; --line: #303a33; --line-strong: #48544c; --red: #df735f; --red-soft: #372521; --green: #8eb79f; --shadow: 0 22px 55px rgba(0,0,0,.3); }
body.dark .route-band { background: #202a24; }
body.dark .hero::after { mix-blend-mode: screen; filter: invert(1); opacity: .45; }
body.dark .record-excerpt, body.dark .dialog-text { color: #bdc6c0; }

@media (max-width: 1100px) and (min-width: 641px) {
  h1 { font-size: 70px; }
}

@media (max-width: 930px) {
  .content-layout { grid-template-columns: 1fr; gap: 45px; }
  .side-rail { padding: 38px 0 0; border-top: 1px solid var(--line); border-left: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
  .rail-block { margin-bottom: 0; }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
}

@media (max-width: 640px) {
  .header-inner, .hero-inner, .route-inner, .archive-shell, .site-footer { width: min(100% - 28px, 1240px); }
  .header-inner { min-height: 59px; gap: 8px; }
  .brand { font-size: 15px; }
  .brand-mark { width: 29px; height: 29px; }
  .main-nav { gap: 0; }
  .nav-link { padding: 7px 6px; font-size: 11px; }
  .icon-button { width: 34px; height: 34px; }
  .hero { min-height: 590px; }
  .hero::after { top: 335px; right: -14px; width: 220px; height: 330px; opacity: .55; }
  .hero-inner { min-height: 590px; padding-top: 61px; }
  .hero-copy { width: 100%; }
  h1 { font-size: 49px; }
  .hero-intro { width: 82%; font-size: 14px; }
  .hero-stats { bottom: 25px; z-index: 2; }
  .hero-stats div { min-width: 0; padding-right: 14px; margin-right: 14px; }
  .hero-stats strong { font-size: 22px; }
  .portrait-note { display: none; }
  .route-line { grid-template-columns: 1fr; gap: 13px; }
  .route-line i { display: none; }
  .toolbar { top: 59px; gap: 9px; }
  .filter-row { max-width: calc(100% - 92px); overflow-x: auto; }
  .filter-button { flex: 0 0 auto; }
  .random-button { margin-left: auto; }
  .content-layout { padding-top: 38px; }
  .section-heading h2 { font-size: 23px; }
  .record-card { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
  .record-card h3 { font-size: 18px; }
  .record-excerpt { font-size: 13px; -webkit-line-clamp: 4; }
  .record-actions { grid-column: 2; flex-direction: row; align-items: center; }
  .record-year { margin-right: auto; font-size: 14px; }
  .side-rail { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; align-items: start; }
  #dialogBody { padding: 40px 24px 28px; }
  .record-dialog h2 { font-size: 27px; }
  .dialog-text { font-size: 15px; }
}
