/* =========================================================================
   时间轴下的浩瀚世界文学作品 — 视觉基底
   气质：古籍藏书票 × 现代美术馆展签
   ========================================================================= */

:root {
  /* —— 配色 —— */
  --bg: #F7F4EC;
  --bg-soft: #F1ECDF;
  --bg-card: #FBF9F3;
  --ink: #2A2520;
  --ink-soft: #5c5347;
  --ink-faint: #A89C8A;
  --line: #DDD5C2;
  --line-soft: #E8E1D0;
  --line-strong: #C9BC9E;
  --paper: #FFFDF7;
  --cn: #8B2C1A;            /* 中国轨 · 朱砂红 */
  --cn-soft: rgba(139, 44, 26, .12);
  --world: #1F3D5C;         /* 世界轨 · 群青蓝 */
  --world-soft: rgba(31, 61, 92, .12);

  /* —— 字体 —— */
  --f-serif-cn: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
  --f-sans-cn: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --f-serif: 'EB Garamond', 'Noto Serif SC', Georgia, serif;
  --f-sans: 'Inter', 'Noto Sans SC', system-ui, sans-serif;

  --maxw: 1280px;
}

* { box-sizing: border-box; }
/* 防御：hidden 属性永远生效（否则 .gallery-overlay/.path-bar 的 display:flex 会盖掉 UA 的
   [hidden]{display:none}，形成 0 透明全屏罩，吃掉页面所有点击——本项目的真实事故） */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-sans-cn);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--cn); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* —— 全局纸张肌理：极淡噪点覆于全站，制造「纸面」质感 —— */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 45; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .055; mix-blend-mode: multiply;
}

/* =========================================================================
   顶栏
   ========================================================================= */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 244, 236, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px 12px;
}
.brand { margin-bottom: 12px; }
.brand-title { margin: 0; font-family: var(--f-serif-cn); font-weight: 700; font-size: 22px; letter-spacing: .02em; }
.brand-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-faint); letter-spacing: .04em; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.search-wrap { position: relative; flex: 0 1 280px; min-width: 160px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.search {
  width: 100%; padding: 7px 12px 7px 32px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-card); color: var(--ink); font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus { border-color: var(--ink-faint); box-shadow: 0 0 0 3px var(--line-soft); }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 12px; color: var(--ink-faint); letter-spacing: .08em; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px; transition: all .15s;
}
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* =========================================================================
   史诗序幕（首屏）：大标题 + 藏书票横卷 + 数据铭文
   ========================================================================= */
.prologue {
  position: relative; max-width: 1120px; margin: 0 auto;
  padding: 58px 28px 44px; text-align: center;
}
.pro-side {
  position: absolute; top: 74px;
  writing-mode: vertical-rl;
  font-family: var(--f-serif-cn); font-size: 12.5px; letter-spacing: .55em;
  color: var(--ink-faint); opacity: .6; user-select: none;
}
.pro-side-l { left: 30px; }
.pro-side-r { right: 30px; font-family: var(--f-serif); font-size: 10.5px; letter-spacing: .4em; text-transform: uppercase; }
.pro-kicker {
  margin: 0 0 16px; font-family: var(--f-serif-cn); font-size: 12.5px;
  letter-spacing: .55em; text-indent: .55em; color: var(--cn);
}
.pro-title {
  margin: 0 0 12px; font-family: var(--f-serif-cn); font-weight: 700;
  font-size: clamp(30px, 5vw, 54px); letter-spacing: .1em; line-height: 1.32;
  color: var(--ink);
}
.pro-sub {
  margin: 0; font-family: var(--f-serif-cn); font-size: 15px;
  letter-spacing: .14em; color: var(--ink-soft);
}
.pro-lead {
  max-width: 660px; margin: 20px auto 0;
  font-family: var(--f-serif-cn); font-size: 15.5px; line-height: 2.05;
  color: var(--ink); letter-spacing: .02em;
}

/* —— 藏书票横卷：二十张里程碑插画，从吉尔伽美什到百年孤独；全幅出血 —— */
.pro-strip {
  display: flex; justify-content: center; align-items: flex-end;
  gap: 12px; margin: 34px calc(50% - 50vw) 0; padding: 0 24px; flex-wrap: wrap;
}
.pro-strip img {
  width: 76px; height: 114px; object-fit: cover; display: block;
  background: var(--paper); padding: 4px;
  border: 1px solid var(--line); border-radius: 3px;
  box-shadow: 0 3px 10px rgba(42, 37, 32, .15);
  transition: transform .28s cubic-bezier(.2, .7, .3, 1.4), box-shadow .28s;
}
/* 宽屏：横卷放大并铺满 */
@media (min-width: 1800px) {
  .pro-strip { flex-wrap: nowrap; }
  .pro-strip img { width: 96px; height: 144px; }
}
.pro-strip img:nth-child(odd) { transform: rotate(-1.4deg) translateY(5px); }
.pro-strip img:nth-child(even) { transform: rotate(1.1deg); }
.pro-strip img:nth-child(3n) { transform: rotate(-.6deg) translateY(2px); }
.pro-strip img:hover {
  transform: scale(1.16) translateY(-7px);
  box-shadow: 0 12px 26px rgba(42, 37, 32, .3);
  position: relative; z-index: 2;
}
.pro-strip-cap { margin: 12px 0 0; font-size: 11.5px; color: var(--ink-faint); letter-spacing: .14em; }

.pro-stats { margin: 20px 0 0; font-size: 12.5px; color: var(--ink-faint); letter-spacing: .12em; }
.pro-stats b { font-family: var(--f-serif); font-weight: 600; font-size: 18px; color: var(--ink-soft); margin: 0 3px; }

.pro-actions { margin-top: 26px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.btn-unroll {
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--bg);
  padding: 12px 38px; border-radius: 999px;
  font-family: var(--f-serif-cn); font-size: 14.5px; letter-spacing: .3em; text-indent: .3em;
  transition: background .2s, border-color .2s, transform .2s;
}
.btn-unroll:hover { background: var(--cn); border-color: var(--cn); transform: translateY(-1px); }
.pro-hint { margin: 18px 0 0; font-size: 12px; color: var(--ink-faint); letter-spacing: .08em; }

/* 入场渐次浮现（prefers-reduced-motion 下由全局规则关闭） */
.pro-inner > * { animation: pro-in .8s cubic-bezier(.2, .6, .2, 1) both; }
.pro-inner > *:nth-child(1) { animation-delay: .05s; }
.pro-inner > *:nth-child(2) { animation-delay: .14s; }
.pro-inner > *:nth-child(3) { animation-delay: .22s; }
.pro-inner > *:nth-child(4) { animation-delay: .32s; }
.pro-inner > *:nth-child(5) { animation-delay: .4s; }
.pro-inner > *:nth-child(6) { animation-delay: .48s; }
.pro-inner > *:nth-child(7) { animation-delay: .54s; }
.pro-inner > *:nth-child(8) { animation-delay: .6s; }
.pro-inner > *:nth-child(9) { animation-delay: .66s; }
.pro-inner > *:nth-child(10) { animation-delay: .72s; }
@keyframes pro-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* —— 阅读主线（主题旅程）—— */
.path-entry { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 26px; }
.path-entry-label { font-size: 12px; color: var(--ink-faint); letter-spacing: .12em; }
.path-chip {
  border: 1px solid var(--cn); background: transparent; color: var(--cn);
  padding: 6px 16px; border-radius: 999px; font-size: 13.5px;
  font-family: var(--f-serif-cn); transition: all .15s;
}
.path-chip:hover { background: var(--cn); color: var(--bg); }
.path-chip.active { background: var(--cn); color: var(--bg); }
.path-bar {
  position: sticky; bottom: 0; z-index: 35;
  background: rgba(247, 244, 236, .95); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 12px 28px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.path-bar-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.path-bar-title { font-family: var(--f-serif-cn); font-weight: 700; font-size: 15px; color: var(--cn); }
.path-bar-progress { font-family: var(--f-serif); font-size: 11.5px; color: var(--ink-faint); }
.path-bar-desc { flex: 1; min-width: 200px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }
.path-bar-actions { display: flex; gap: 6px; margin-left: auto; }
.path-bar-actions button {
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-soft);
  padding: 6px 14px; border-radius: 6px; font-size: 13px; transition: all .15s;
}
.path-bar-actions button:hover { border-color: var(--cn); color: var(--cn); }
.path-bar-actions button[data-path-act="exit"]:hover { border-color: var(--ink-faint); color: var(--ink); }
@media (max-width: 820px) {
  .path-bar-desc { display: none; }
  .path-bar { padding: 10px 16px; gap: 10px; }
}

/* =========================================================================
   纵向连续长河
   ========================================================================= */
.timeline { max-width: none; margin: 0 auto; padding: 0 24px 40px; }
.loading { text-align: center; color: var(--ink-faint); padding: 80px 0; font-family: var(--f-serif); font-style: italic; }

.river-shell {
  display: flex;
  gap: 14px;
  height: calc(100vh - 150px);
  min-height: 520px;
}

/* —— 左侧 mini-map —— */
.river-minimap {
  flex: 0 0 46px;
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.mm-mark {
  position: absolute; left: 3px; right: 3px;
  font-size: 10px; font-family: var(--f-serif-cn);
  color: var(--ink-faint);
  transform: translateY(-50%);
  text-align: center;
  pointer-events: none;
  transition: color .15s;
}
.mm-mark.current { color: var(--ink); font-weight: 600; }
.mm-viewport {
  position: absolute; left: 0; right: 0;
  background: rgba(42, 37, 32, .10);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  pointer-events: none;
  transition: top .1s, height .1s;
}

/* —— 右侧主区 —— */
.river-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.river-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 0 0 10px; flex-wrap: wrap;
}
.era-tab {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  padding: 4px 12px; border-radius: 999px; font-size: 12.5px;
  font-family: var(--f-serif-cn); transition: all .15s;
}
.era-tab:hover { border-color: var(--ink-faint); color: var(--ink); }
.era-tab.current { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.river-tools { margin-left: auto; display: flex; gap: 4px; }
.river-tools button {
  min-width: 28px; height: 28px;
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-soft);
  border-radius: 6px; font-size: 15px; line-height: 1; padding: 0 6px;
}
.river-tools button:hover { border-color: var(--ink-faint); color: var(--ink); }

/* —— 视口 —— */
.river-viewport {
  flex: 1; position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg-card);
  cursor: grab;
  touch-action: none;
}
.river-viewport:active { cursor: grabbing; }
.river-content {
  position: absolute; top: 0; left: 0; right: 0;
  height: 100%; /* JS 按缩放设定 */
  will-change: transform;
}

/* —— 时代背景带（连续，交替底色）；几何按布局分流：.river-v 横带 / .river-h 竖条 —— */
.era-bands { position: absolute; inset: 0; pointer-events: none; }
.era-band { position: absolute; background: var(--bg-soft); overflow: hidden; }
.river-v .era-band { left: 0; right: 0; }
.river-h .era-band { top: 0; bottom: 0; }
.era-band.odd { background: transparent; }

/* —— 时代卷首（排版共享；定位按布局分流） —— */
.era-head { position: absolute; inset: 0; z-index: 0; }
.river-v .eh-cn {
  position: absolute; top: 30px; left: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.eh-badge { width: 34px; height: 34px; color: var(--cn); opacity: .55; }
.eh-vname {
  writing-mode: vertical-rl;
  font-family: var(--f-serif-cn); font-weight: 700; font-size: 30px;
  letter-spacing: .34em; color: var(--cn); opacity: .32;
}
.river-v .eh-world { position: absolute; top: 34px; right: 26px; text-align: right; }
.eh-wname {
  display: block; font-family: var(--f-serif-cn); font-weight: 600; font-size: 18px;
  letter-spacing: .2em; color: var(--world); opacity: .5;
}
.river-v .eh-wyears { display: block; margin-top: 5px; font-family: var(--f-serif); font-size: 11px; color: var(--world); opacity: .5; letter-spacing: .06em; }
.river-v .eh-plaque {
  position: absolute; top: 24px; left: 50%; transform: translateX(-50%);
  width: min(400px, 46%); text-align: center;
}
.eh-eyebrow { font-family: var(--f-serif-cn); font-size: 13px; color: var(--ink-soft); letter-spacing: .12em; }
.eh-eyebrow b { color: var(--cn); font-weight: 600; }
.eh-years { display: block; margin-top: 3px; font-family: var(--f-serif); font-size: 11px; color: var(--ink-faint); letter-spacing: .1em; }
.eh-note { margin: 9px 0 0; font-size: 12px; line-height: 1.75; color: var(--ink-soft); opacity: .9; }
.eh-quotes { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.eh-q {
  font-family: var(--f-serif-cn); font-size: 11.5px; line-height: 1.7; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.eh-q em { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }
.eq-cn { border-top: 1px solid rgba(139, 44, 26, .3); padding-top: 7px; }
.eq-world { border-top: 1px solid rgba(31, 61, 92, .3); padding-top: 7px; }

/* 时代带尺寸自适应（app.mjs 按实际像素加类；纵向看高度，横向看宽度） */
.river-v .band-short .eh-quotes, .river-v .band-short .eh-note { display: none; }
.river-v .band-short .eh-plaque { top: 14px; }
.river-v .band-short .eh-vname { font-size: 18px; letter-spacing: .22em; }
.river-v .band-short .eh-badge { display: none; }
.river-v .band-tiny .eh-plaque, .river-v .band-tiny .eh-world, .river-v .band-tiny .eh-cn { display: none; }
.river-h .band-short .eh-plaque { display: none; }
.river-h .band-short .eh-vname { font-size: 19px; letter-spacing: .22em; }
.river-h .band-short .eh-badge { display: none; }
.river-h .band-tiny .eh-plaque, .river-h .band-tiny .eh-world, .river-h .band-tiny .eh-cn { display: none; }
/* 金句与引言是全局视角的家具；放大后让位给节点（铭牌只留眉题+年份） */
.zoom-mid .eh-quotes, .zoom-fine .eh-quotes,
.zoom-mid .eh-note, .zoom-fine .eh-note { display: none; }

/* —— 时代背景纹理（PRD FR-3.3）：每个 era 独特的低透气质感；纵向横带版 —— */
.river-v .era-band::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .6; }
.river-v .era-band[data-era="ancient"]::before { background-image: repeating-linear-gradient(45deg, transparent 0, transparent 20px, rgba(139,44,26,.07) 20px, rgba(139,44,26,.07) 22px); }
.river-v .era-band[data-era="axial"]::before { background-image: repeating-linear-gradient(90deg, transparent 0, transparent 24px, rgba(31,61,92,.06) 24px, rgba(31,61,92,.06) 26px); }
.river-v .era-band[data-era="han-six"]::before { background-image: radial-gradient(ellipse 30px 8px at 50% 0, rgba(31,61,92,.06) 0, transparent 100%); background-size: 60px 16px; background-repeat: repeat; }
.river-v .era-band[data-era="tang-song"]::before { background-image: linear-gradient(180deg, rgba(139,44,26,.05) 0%, transparent 30%, transparent 70%, rgba(31,61,92,.05) 100%); }
.river-v .era-band[data-era="yuan-ming-qing"]::before { background-image: repeating-linear-gradient(0deg, transparent 0, transparent 30px, rgba(139,44,26,.05) 30px, rgba(139,44,26,.05) 31px), repeating-linear-gradient(90deg, transparent 0, transparent 30px, rgba(139,44,26,.05) 30px, rgba(139,44,26,.05) 31px); }
.river-v .era-band[data-era="modern"]::before { background-image: repeating-linear-gradient(0deg, transparent 0, transparent 8px, rgba(31,61,92,.05) 8px, rgba(31,61,92,.05) 9px); }
.river-v .era-band[data-era="contemporary"]::before { background-image: repeating-linear-gradient(0deg, transparent 0, transparent 12px, rgba(31,61,92,.045) 12px, rgba(31,61,92,.045) 13px), repeating-linear-gradient(90deg, transparent 0, transparent 12px, rgba(31,61,92,.045) 12px, rgba(31,61,92,.045) 13px); }
/* —— 时代纹理·横向竖条版（轴向旋转 90°） —— */
.river-h .era-band::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .6; }
.river-h .era-band[data-era="ancient"]::before { background-image: repeating-linear-gradient(-45deg, transparent 0, transparent 20px, rgba(139,44,26,.07) 20px, rgba(139,44,26,.07) 22px); }
.river-h .era-band[data-era="axial"]::before { background-image: repeating-linear-gradient(0deg, transparent 0, transparent 24px, rgba(31,61,92,.06) 24px, rgba(31,61,92,.06) 26px); }
.river-h .era-band[data-era="han-six"]::before { background-image: radial-gradient(ellipse 8px 30px at 0 50%, rgba(31,61,92,.06) 0, transparent 100%); background-size: 16px 60px; background-repeat: repeat; }
.river-h .era-band[data-era="tang-song"]::before { background-image: linear-gradient(90deg, rgba(139,44,26,.05) 0%, transparent 30%, transparent 70%, rgba(31,61,92,.05) 100%); }
.river-h .era-band[data-era="yuan-ming-qing"]::before { background-image: repeating-linear-gradient(0deg, transparent 0, transparent 30px, rgba(139,44,26,.05) 30px, rgba(139,44,26,.05) 31px), repeating-linear-gradient(90deg, transparent 0, transparent 30px, rgba(139,44,26,.05) 30px, rgba(139,44,26,.05) 31px); }
.river-h .era-band[data-era="modern"]::before { background-image: repeating-linear-gradient(90deg, transparent 0, transparent 8px, rgba(31,61,92,.05) 8px, rgba(31,61,92,.05) 9px); }
.river-h .era-band[data-era="contemporary"]::before { background-image: repeating-linear-gradient(0deg, transparent 0, transparent 12px, rgba(31,61,92,.045) 12px, rgba(31,61,92,.045) 13px), repeating-linear-gradient(90deg, transparent 0, transparent 12px, rgba(31,61,92,.045) 12px, rgba(31,61,92,.045) 13px); }

/* —— 中央时间线：书脊 + 刻度 + 界碑（纵向几何；横向见 .river-h 覆写） —— */
.river-v .river-axis { position: absolute; left: 50%; top: 0; bottom: 0; width: 0; pointer-events: none; }
.river-v .axis-line {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%);
  background: linear-gradient(to bottom,
    rgba(92, 83, 71, 0) 0, rgba(92, 83, 71, .45) 40px,
    rgba(92, 83, 71, .45) calc(100% - 40px), rgba(92, 83, 71, 0) 100%);
}
.river-v .axis-tick { position: absolute; left: 50%; width: 9px; height: 1px; background: var(--ink-soft); opacity: .45; transform: translateX(-50%); }
.river-v .axis-tick.major { width: 17px; height: 1.5px; opacity: .7; }
.river-v .axis-label {
  position: absolute; left: calc(50% - 15px); transform: translate(-100%, -50%);
  font-family: var(--f-serif); font-size: 11px; color: var(--ink-faint);
  white-space: nowrap; letter-spacing: .03em;
}
/* 界碑：时代交界处的菱形印 + 年份 */
.river-v .axis-stele { position: absolute; left: 50%; transform: translate(-50%, -50%); }
.river-v .axis-stele i {
  display: block; width: 9px; height: 9px; margin: 0 auto;
  transform: rotate(45deg);
  background: var(--bg-card); border: 1.5px solid var(--ink-soft);
  box-shadow: 0 0 0 3px var(--bg-card);
}
.river-v .axis-stele b {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  font-family: var(--f-serif); font-weight: 500; font-size: 10.5px;
  color: var(--ink-faint); white-space: nowrap; letter-spacing: .04em;
}

/* —— 节点（共享基底；定位按布局分流） —— */
.river-nodes { position: absolute; inset: 0; }
.node {
  position: absolute;
  display: flex; align-items: center; gap: 8px;
  border: none; background: none; padding: 0;
  z-index: 2; white-space: nowrap;
  transition: opacity .2s;
}
.river-v .node.r-cn { right: calc(50% + 8px); flex-direction: row-reverse; transform: translateY(-50%); }
.river-v .node.r-world { left: calc(50% + 8px); transform: translateY(-50%); }
.r-cn { --dot-color: var(--cn); }
.r-world { --dot-color: var(--world); }

.node-dot {
  border-radius: 50%; background: var(--dot-color);
  box-shadow: 0 0 0 3px var(--bg-card), 0 1px 3px rgba(42, 37, 32, .25);
  flex: 0 0 auto; transition: transform .15s;
}
.node:hover .node-dot { transform: scale(1.3); }
.node:hover { z-index: 6; }

/* 里程碑 · 明珠（插画上浮） */
.node-gem {
  flex: 0 0 auto; width: 46px; height: 46px; padding: 2px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 5px;
  box-shadow: 0 2px 9px rgba(42, 37, 32, .22);
  transition: transform .18s, box-shadow .18s;
}
.node-gem img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; display: block; }
.node:hover .node-gem { transform: scale(1.14); box-shadow: 0 6px 16px rgba(42, 37, 32, .3); }
.zoom-coarse .node-gem { width: 30px; height: 30px; padding: 1.5px; border-radius: 4px; }

/* 里程碑 · 印章（无插画的作品） */
.node-seal {
  flex: 0 0 auto; width: 27px; height: 27px; border-radius: 4px;
  background: var(--dot-color); color: var(--paper);
  font-family: var(--f-serif-cn); font-weight: 700; font-size: 15px; line-height: 27px; text-align: center;
  box-shadow: 0 1px 4px rgba(42, 37, 32, .3);
  transition: transform .15s;
}
.node:hover .node-seal { transform: scale(1.15); }
.zoom-coarse .node-seal { width: 22px; height: 22px; font-size: 12px; line-height: 22px; }

.node-label {
  font-family: var(--f-serif-cn); font-size: 13px; color: var(--ink-soft);
  opacity: 0; transition: opacity .15s;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis;
}
.river-v .node-label { position: relative; top: calc(var(--lane, 0) * 13px);  /* 纵向 lane：同轨标签逐行下移 */ }
.node-label em { font-style: normal; font-family: var(--f-serif); font-size: 10.5px; color: var(--ink-faint); margin-left: 5px; }
.node:hover .node-label { opacity: 1; color: var(--ink); }

/* 重要度 → 节点大小 */
.node.imp-5 .node-label { font-weight: 600; }
.node.imp-4 .node-dot { width: 11px; height: 11px; }
.node.imp-3 .node-dot { width: 8px; height: 8px; }
.node.imp-2 .node-dot { width: 6px; height: 6px; background: transparent; border: 1.5px solid var(--dot-color); box-shadow: 0 0 0 3px var(--bg-card); }
.node.imp-1 .node-dot { width: 5px; height: 5px; background: transparent; border: 1.5px solid var(--dot-color); box-shadow: 0 0 0 3px var(--bg-card); }

/* 名字分级显示：全局仅地标（anchor）常显；放大逐级显更多；hover 永远可见 */
.zoom-coarse .node.anchor .node-label,
.zoom-mid .node.imp-4 .node-label, .zoom-mid .node.imp-5 .node-label,
.zoom-fine .node.imp-3 .node-label, .zoom-fine .node.imp-4 .node-label, .zoom-fine .node.imp-5 .node-label { opacity: 1; }
.zoom-coarse .node.anchor .node-label,
.node.imp-5 .node-label { color: var(--ink); }

/* 区间作品：纵向为竖线、横向为横线 */
.river-v .node-range {
  position: absolute; width: 3px; transform: translateX(-50%);
  opacity: .35; z-index: 1; border-radius: 1.5px;
}
.river-v .node-range.r-cn { left: calc(50% - 7px); background: var(--cn); }
.river-v .node-range.r-world { left: calc(50% + 7px); background: var(--world); }

/* =========================================================================
   横向长卷（river-h）：时间从左向右流，中国轨在轴上、世界轨在轴下
   ========================================================================= */
.river-shell.layout-h { flex-direction: column; }
.river-shell.layout-h .river-main { order: 1; flex: 1; min-height: 0; }
.river-shell.layout-h .river-minimap { order: 2; flex: 0 0 44px; width: 100%; }
.river-content.river-h { right: auto; height: 100%; }

/* —— 横向·卷首（竖排在窄带里如鱼得水） —— */
.river-h .eh-cn {
  position: absolute; top: 18px; left: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.river-h .eh-badge { width: 30px; height: 30px; }
.river-h .eh-vname { font-size: 26px; }
.river-h .eh-world {
  position: absolute; bottom: 18px; right: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.river-h .eh-wname { writing-mode: vertical-rl; font-size: 15px; letter-spacing: .26em; }
.river-h .eh-wyears { display: none; }
.river-h .eh-plaque {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  width: min(300px, 84%); text-align: center;
}

/* —— 横向·中书脊 —— */
.river-h .river-axis { position: absolute; left: 0; right: 0; top: 50%; height: 0; pointer-events: none; }
.river-h .axis-line {
  position: absolute; left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-50%);
  background: linear-gradient(to right,
    rgba(92, 83, 71, 0) 0, rgba(92, 83, 71, .45) 40px,
    rgba(92, 83, 71, .45) calc(100% - 40px), rgba(92, 83, 71, 0) 100%);
}
.river-h .axis-tick { position: absolute; top: 50%; width: 1px; height: 9px; background: var(--ink-soft); opacity: .45; transform: translateY(-50%); }
.river-h .axis-tick.major { width: 1.5px; height: 17px; opacity: .7; }
.river-h .axis-label {
  position: absolute; top: calc(50% + 15px); transform: translateX(-50%);
  font-family: var(--f-serif); font-size: 11px; color: var(--ink-faint);
  white-space: nowrap; letter-spacing: .03em;
}
.river-h .axis-stele { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.river-h .axis-stele i {
  display: block; width: 9px; height: 9px; margin: 0 auto;
  transform: rotate(45deg);
  background: var(--bg-card); border: 1.5px solid var(--ink-soft);
  box-shadow: 0 0 0 3px var(--bg-card);
}
.river-h .axis-stele b {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-family: var(--f-serif); font-weight: 500; font-size: 10.5px;
  color: var(--ink-faint); white-space: nowrap; letter-spacing: .04em;
}

/* —— 横向·节点（中国上 / 世界下；标签竖排；lane 向远离轴方向错列） —— */
.river-h .node { top: 50%; flex-direction: column; gap: 8px; }
.river-h .node.r-cn { bottom: calc(50% + 8px); top: auto; flex-direction: column-reverse; transform: translateX(-50%); }
.river-h .node.r-world { top: calc(50% + 8px); transform: translateX(-50%); }

.river-h .node-label {
  writing-mode: vertical-rl;
  max-width: none; max-height: 104px;
  font-size: 12.5px; letter-spacing: .12em;
}
/* lane 错列：竖排标签离轴更远 + 引线连回标记 */
.river-h .r-cn .node-label { margin-bottom: calc(var(--lane, 0) * 22px); position: relative; }
.river-h .r-world .node-label { margin-top: calc(var(--lane, 0) * 22px); position: relative; }
.river-h .node-label::after {
  content: ''; position: absolute; left: 50%; margin-left: -.5px; width: 1px;
  height: calc(var(--lane, 0) * 22px);
  background: var(--line-strong);
  opacity: calc(var(--lane, 0) * .9);
}
.river-h .r-cn .node-label::after { top: 100%; }
.river-h .r-world .node-label::after { bottom: 100%; }

/* 区间作品·横线 */
.river-h .node-range {
  position: absolute; height: 3px; transform: translateY(-50%);
  opacity: .35; z-index: 1; border-radius: 1.5px;
}
.river-h .node-range.r-cn { bottom: calc(50% + 5px); background: var(--cn); }
.river-h .node-range.r-world { top: calc(50% + 5px); background: var(--world); }

/* —— 横向·底部 mini-map —— */
.river-shell.layout-h .mm-mark {
  top: 50%; right: auto; transform: translate(-50%, -50%);
  font-size: 9.5px; white-space: nowrap;
}
.river-shell.layout-h .mm-viewport {
  top: 0; bottom: 0; right: auto;
  border-top: none; border-bottom: none;
  border-left: 2px solid var(--ink); border-right: 2px solid var(--ink);
}

/* 筛选/选中 */
.node.dimmed { opacity: .1; pointer-events: none; }
.node.active .node-dot { box-shadow: 0 0 0 3px var(--bg-card), 0 0 0 6px var(--dot-color); }
.node.active .node-gem { box-shadow: 0 0 0 3px var(--bg-card), 0 0 0 5px var(--dot-color), 0 4px 12px rgba(42, 37, 32, .3); }
.node.active .node-seal { box-shadow: 0 0 0 3px var(--bg-card), 0 0 0 5px var(--dot-color); }
.node.active .node-label { opacity: 1 !important; color: var(--ink); font-weight: 600; }

/* =========================================================================
   藏书票封面（程序化生成，零版权）
   ========================================================================= */
.bookplate {
  margin: 0 0 22px; padding: 26px 24px 22px;
  background: var(--bg-card); border: 1px solid var(--line);
  position: relative; text-align: center;
}
.bookplate::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--bp-color, var(--cn)); opacity: .35; pointer-events: none; }
.bp-cn { --bp-color: var(--cn); }
.bp-world { --bp-color: var(--world); }
.bp-inner { position: relative; }
.bp-corner { position: absolute; width: 10px; height: 10px; border: 1.5px solid var(--bp-color); opacity: .65; }
.bp-corner.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.bp-corner.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.bp-corner.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.bp-corner.br { bottom: -2px; right: -2px; border-left: none; border-top: none; }
.bp-topline { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .12em; color: var(--ink-faint); margin-bottom: 14px; }
.bp-dot { color: var(--bp-color); margin-right: 4px; }
.bp-seal { width: 30px; height: 30px; margin: 0 auto 12px; border-radius: 4px; background: var(--bp-color); color: var(--bg); font-family: var(--f-serif-cn); font-size: 16px; line-height: 30px; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.bp-title { font-family: var(--f-serif-cn); font-weight: 700; font-size: 30px; line-height: 1.2; margin: 0; color: var(--ink); letter-spacing: .04em; }
.bp-orig { font-family: var(--f-serif); font-style: italic; font-size: 14px; color: var(--ink-faint); margin: 4px 0 0; }
.bp-rule { color: var(--bp-color); opacity: .5; font-size: 13px; margin: 12px 0 8px; letter-spacing: .5em; }
.bp-author { font-family: var(--f-serif-cn); font-size: 15px; color: var(--ink-soft); margin: 0; }
.bp-year { font-family: var(--f-serif); font-size: 12px; color: var(--ink-faint); margin: 3px 0 0; letter-spacing: .03em; }
.bookplate.imp-1, .bookplate.imp-2, .bookplate.imp-3 { padding: 18px 22px 16px; }
.bookplate.imp-1 .bp-title, .bookplate.imp-2 .bp-title, .bookplate.imp-3 .bp-title { font-size: 24px; }

/* =========================================================================
   详情抽屉
   ========================================================================= */
.drawer-overlay { position: fixed; inset: 0; background: rgba(42, 37, 32, .28); z-index: 50; opacity: 0; transition: opacity .2s; }
.drawer-overlay.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(600px, 100%);
  background: var(--bg); z-index: 60;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  display: flex; flex-direction: column;
  box-shadow: -10px 0 40px rgba(42, 37, 32, .12);
  border-left: 1px solid var(--line);
}
.drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; top: 14px; right: 16px; border: none; background: none; font-size: 26px; line-height: 1; color: var(--ink-faint); z-index: 2; width: 34px; height: 34px; border-radius: 50%; transition: background .15s, color .15s; }
.drawer-close:hover { background: var(--bg-soft); color: var(--ink); }
.drawer-content { overflow-y: auto; padding: 40px 34px 24px; flex: 1; }
.drawer-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-soft); padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); margin-bottom: 20px; }
.drawer-meta b { color: var(--ink-faint); font-weight: 500; margin-right: 4px; }
.drawer-tags { display: contents; }
.drawer-tag { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--bg-soft); color: var(--ink-soft); }
.drawer-body { font-size: 14.5px; line-height: 1.85; color: var(--ink); }
.drawer-body h2 { font-family: var(--f-serif-cn); font-size: 17px; font-weight: 600; margin: 26px 0 8px; color: var(--ink); }
.drawer-body h2:first-child { margin-top: 0; }
.drawer-body p { margin: 0 0 14px; }
.drawer-body blockquote { margin: 18px 0; padding: 10px 18px; border-left: 3px solid var(--cn); background: var(--cn-soft); color: var(--ink-soft); font-family: var(--f-serif-cn); font-size: 14px; }
.drawer[data-region="world"] .drawer-body blockquote { border-left-color: var(--world); background: var(--world-soft); }
.drawer-related { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.drawer-related-title { font-size: 12px; color: var(--ink-faint); letter-spacing: .1em; margin-bottom: 8px; }
.drawer-related a { display: inline-flex; align-items: center; gap: 5px; margin: 0 6px 6px 0; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--ink-soft); }
.drawer-related a em { font-style: normal; font-size: 11px; color: var(--ink-faint); margin-left: 2px; }
.rel-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.rel-dot.r-cn { background: var(--cn); }
.rel-dot.r-world { background: var(--world); }
.wiki-link { display: inline-block !important; }
/* 插画、收藏按钮、同时代块 */
.drawer-cover {
  display: block; width: 100%; max-height: 260px; object-fit: cover;
  margin: 0 0 18px; border-radius: 5px;
  background: var(--paper); padding: 5px;
  border: 1px solid var(--line);
  box-shadow: 0 3px 14px rgba(42, 37, 32, .14);
}
.fav-btn {
  margin-top: 14px; padding: 5px 18px; border: 1px solid var(--bp-color, var(--ink-faint));
  background: transparent; color: var(--ink-soft); border-radius: 999px; font-size: 12.5px;
  font-family: var(--f-sans-cn); transition: all .15s;
}
.fav-btn:hover, .fav-btn.on { background: var(--bp-color, var(--cn)); color: var(--bg); border-color: var(--bp-color, var(--cn)); }
.drawer-contemp { background: var(--bg-soft); padding: 12px 14px; border-radius: 6px; border: 1px dashed var(--line); }
.drawer-contemp .drawer-related-title { color: var(--ink-soft); }
.drawer-related a:hover { border-color: var(--ink-faint); color: var(--ink); }
.drawer-nav { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--bg-soft); gap: 12px; }
.drawer-nav button { border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-soft); padding: 7px 14px; border-radius: 6px; font-size: 13px; transition: all .15s; }
.drawer-nav button:hover { border-color: var(--ink-faint); color: var(--ink); }
.drawer-nav-hint { font-size: 11px; color: var(--ink-faint); text-align: center; flex: 1; }

/* =========================================================================
   页脚
   ========================================================================= */
/* —— 额外入口（金句长廊 / 随机） —— */
.extra-entry { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.extra-entry button {
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-soft);
  padding: 7px 18px; border-radius: 999px; font-size: 13px;
  font-family: var(--f-serif-cn); transition: all .15s;
}
.extra-entry button:hover { border-color: var(--cn); color: var(--cn); }

/* —— 金句长廊 —— */
.gallery-overlay {
  position: fixed; inset: 0; z-index: 55; background: rgba(42,37,32,.35);
  opacity: 0; transition: opacity .2s; display: flex; justify-content: center;
}
.gallery-overlay.show { opacity: 1; }
.gallery-panel {
  position: relative; width: min(800px, 92vw); max-height: 88vh; margin: auto;
  background: var(--bg); border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden; display: flex; flex-direction: column;
}
.gallery-close {
  position: absolute; top: 12px; right: 16px; border: none; background: none;
  font-size: 26px; color: var(--ink-faint); z-index: 2; width: 34px; height: 34px;
  border-radius: 50%; transition: background .15s;
}
.gallery-close:hover { background: var(--bg-soft); color: var(--ink); }
.gallery-title { font-family: var(--f-serif-cn); font-weight: 700; font-size: 22px; margin: 0; padding: 24px 30px 4px; }
.gallery-sub { font-size: 12.5px; color: var(--ink-faint); margin: 0 30px 14px; line-height: 1.6; }
.gallery-content { overflow-y: auto; padding: 0 30px 24px; }
.gallery-era { margin-bottom: 20px; }
.gallery-era-title { font-family: var(--f-serif-cn); font-size: 15px; font-weight: 600; color: var(--cn); margin: 0 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.gallery-item {
  display: block; padding: 10px 0; border-bottom: 1px solid var(--line-soft);
  cursor: pointer; transition: background .15s; border-radius: 4px;
}
.gallery-item:hover { background: var(--bg-soft); padding-left: 8px; padding-right: 8px; }
.gallery-quote { display: block; font-family: var(--f-serif-cn); font-size: 14px; line-height: 1.7; color: var(--ink); margin-bottom: 3px; }
.gallery-from { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-faint); }

.footer { max-width: none; margin: 40px auto 0; padding: 24px 28px 50px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 12.5px; text-align: center; }
.footer p { margin: 4px 0; }
.footer-hint { font-family: var(--f-serif); font-style: italic; }

/* =========================================================================
   响应式
   ========================================================================= */
@media (max-width: 820px) {
  .topbar { padding: 12px 16px 10px; }
  .brand-title { font-size: 18px; }
  .controls { gap: 12px; }
  .search-wrap { flex-basis: 100%; }
  .timeline { padding: 0 12px 30px; }
  .river-shell { height: calc(100vh - 170px); gap: 8px; }
  .river-minimap { flex-basis: 34px; }
  .mm-mark { font-size: 9px; }
  .node-label { font-size: 12px; max-width: 110px; }
  .node-gem { width: 36px; height: 36px; }
  .drawer-content { padding: 40px 20px 16px; }
  /* 序幕移动端 */
  .prologue { padding: 36px 16px 30px; }
  .pro-side { display: none; }
  .pro-title { font-size: 23px; letter-spacing: .06em; }
  .pro-strip { gap: 8px; }
  .pro-strip img { width: 58px; height: 87px; }
  .eh-cn { left: 10px; }
  .eh-vname { font-size: 19px; }
  .eh-badge { width: 22px; height: 22px; }
  .eh-world { right: 12px; }
  .eh-wname { font-size: 13px; }
  .eh-plaque { width: 60%; }
  .eh-quotes { display: none; }
  .axis-stele b { display: none; }
  /* 横向长卷移动端 */
  .river-shell.layout-h { gap: 8px; }
  .river-shell.layout-h .river-minimap { flex-basis: 32px; }
  .river-h .node-label { font-size: 11px; max-height: 80px; }
  .river-h .r-cn .node-label { margin-bottom: calc(var(--lane, 0) * 17px); }
  .river-h .r-world .node-label { margin-top: calc(var(--lane, 0) * 17px); }
  .river-h .node-label::after { height: calc(var(--lane, 0) * 17px); }
  .river-h .eh-plaque { display: none; }
  .river-h .eh-vname { font-size: 18px; }
  .river-h .eh-badge { width: 20px; height: 20px; }
  .river-h .eh-wname { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
