/* ============================================================
   舆图 · 设计系统
   签名元素：朱印（篆刻红章）。其余一切保持安静、克制。
   色彩取自谭其骧图集纸面：米黄纸 / 松烟墨 / 藏朱砂。
   ============================================================ */
:root {
  --paper: #f1e9d6;
  --paper-2: #eae0c6;
  --paper-3: #e2d5b2;
  --ink: #292216;
  --ink-soft: #6b5f4a;
  --ink-faint: #9c9078;
  --line: #c8ba97;
  --seal: #a63a24;        /* 藏朱 · 印泥 */
  --seal-deep: #872d1b;
  --gold: #a8842c;
  --kai: "Kaiti SC", "KaiTi", "STKaiti", "楷体", "Noto Serif SC", serif;
  --songti: "Songti SC", "SimSun", "Noto Serif SC", serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --shadow: 0 2px 16px rgba(41, 34, 22, .16);
  --shadow-soft: 0 1px 8px rgba(41, 34, 22, .10);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}

/* 纸面肌理：两层晕染 + 细噪点，multiply 让矢量色像印进纸里 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 500;
  background-image:
    radial-gradient(1100px 560px at 18% 8%, rgba(255, 252, 240, .5), transparent 60%),
    radial-gradient(940px 720px at 86% 92%, rgba(172, 150, 108, .16), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

#map { position: absolute; inset: 0; background: #d9d3be; } /* 海 = 冷纸色，陆由 land 面填充 */
.leaflet-container { font-family: var(--sans); background: #d9d3be; outline: none; }
/* 注：勿对 svg path 使用 mix-blend-mode——与合成 pane、路径动画叠加时
   Chromium 偶发把混合层光栅化为空（疆域填充消失）。水墨质感由纸纹层承担。 */

:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; border-radius: 2px; }
/* 地图矢量选中态用描边高亮，不出浏览器焦点矩形 */
.leaflet-interactive:focus, .leaflet-interactive:focus-visible { outline: none; }

/* ============ 品牌 · 朱印签名 ============ */
#brand {
  position: absolute; top: 14px; left: 14px; z-index: 600;
  display: flex; align-items: center; gap: 16px;
  max-width: calc(100vw - 28px);
  background: linear-gradient(165deg, rgba(248, 243, 229, .93), rgba(240, 231, 207, .93));
  border: 1px solid var(--line); border-radius: 3px;
  box-shadow: var(--shadow-soft);
  padding: 10px 14px;
}
#brandHead { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
#brandSeal {
  width: 46px; height: 46px; flex: 0 0 auto;
  background: var(--seal);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1.5px rgba(241, 233, 214, .85), inset 0 0 0 4px var(--seal), 1px 2px 6px rgba(41, 34, 22, .3);
  display: grid; grid-template: 1fr 1fr / 1fr 1fr;
  padding: 5px;
  transform: rotate(-3deg);
  transition: transform .3s ease;
}
#brandSeal:hover { transform: rotate(0deg); }
#brandSeal span {
  font-family: var(--kai); font-size: 17px; line-height: 1;
  color: #f3ecdb; display: flex; align-items: center; justify-content: center;
}
#brandSeal span:first-child { grid-area: 1 / 2; }
#brandSeal span:last-child { grid-area: 2 / 1; }
#brandText { line-height: 1.25; }
.brand-sub {
  font-family: var(--kai); font-size: 16px; letter-spacing: 5px; color: var(--ink);
}
.brand-en {
  font-family: var(--sans); font-size: 8.5px; letter-spacing: 2.2px;
  color: var(--ink-faint); margin-top: 3px;
}
#tools { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; }
#tools button, #basemaps button {
  font-family: var(--sans); font-size: 12px; letter-spacing: 2px; cursor: pointer;
  color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 3px;
  padding: 4px 9px 4px 11px;
  transition: all .15s;
}
#tools button:hover, #basemaps button:hover { border-color: var(--ink-soft); background: rgba(41, 34, 22, .05); }
#tools button.toggle.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
#tools #btnPlay { width: 36px; text-align: center; padding-left: 9px; }
#basemaps { display: flex; gap: 5px; flex: 0 0 auto; }
#basemaps button { font-size: 11px; letter-spacing: 1.5px; color: var(--ink-soft); }
#basemaps button:hover { color: var(--ink); }
#basemaps button.on { color: var(--paper); background: var(--ink-soft); border-color: var(--ink-soft); }

/* ============ 地名检索 ============ */
#searchWrap { position: relative; width: 168px; flex: 0 0 auto; }
#searchInput {
  width: 100%; font-family: var(--kai); font-size: 13px; letter-spacing: 2px;
  color: var(--ink); background: rgba(255, 252, 240, .75);
  border: 1px solid var(--line); border-radius: 3px;
  padding: 5px 10px; outline: none;
}
#searchInput::placeholder { color: var(--ink-faint); letter-spacing: 2px; }
#searchInput:focus { border-color: var(--seal); background: rgba(255, 252, 240, .95); }
#searchDrop {
  position: absolute; top: calc(100% + 4px); left: 0; right: -40px; z-index: 700;
  max-height: 300px; overflow-y: auto; scrollbar-width: none;
  background: rgba(250, 246, 234, .98); border: 1px solid var(--line);
  border-top: 2px solid var(--seal); border-radius: 3px; box-shadow: var(--shadow);
}
#searchDrop::-webkit-scrollbar { display: none; }
.sr-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 6px 12px; cursor: pointer; border-bottom: 1px dashed rgba(200, 186, 151, .5);
}
.sr-item:hover { background: rgba(41, 34, 22, .06); }
.sr-item .sr-name { font-family: var(--kai); font-size: 14px; color: #292216; }
.sr-item .sr-dyn { font-size: 10.5px; color: var(--ink-faint); letter-spacing: 1px; white-space: nowrap; }
.sr-empty { padding: 10px 12px; font-size: 12px; color: var(--ink-faint); }

/* ============ 大事年表抽屉 ============ */
#chronDrawer {
  position: absolute; top: 14px; right: 14px; bottom: 132px; z-index: 590;
  width: 248px; display: flex; flex-direction: column;
  background: linear-gradient(175deg, rgba(250, 246, 234, .97), rgba(242, 234, 212, .97));
  border: 1px solid var(--line); border-top: 3px solid var(--seal);
  border-radius: 3px; box-shadow: var(--shadow-soft);
  animation: cardIn .3s ease both;
}
#chronDrawer h3 {
  font-family: var(--kai); font-size: 17px; letter-spacing: 4px; margin: 0;
  padding: 12px 16px 8px; color: var(--ink);
}
#chronClose {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 3px; cursor: pointer; font-size: 12px; line-height: 1;
}
#chronList { flex: 1; overflow-y: auto; scrollbar-width: none; padding: 0 0 8px; }
#chronList::-webkit-scrollbar { display: none; }
.ch-item {
  padding: 7px 16px 7px 14px; cursor: pointer; border-left: 3px solid transparent;
  transition: all .15s;
}
.ch-item:hover { background: rgba(41, 34, 22, .05); }
.ch-item .ch-year { font-size: 10.5px; color: var(--seal-deep); font-family: var(--songti); letter-spacing: 1px; }
.ch-item .ch-title { font-family: var(--kai); font-size: 13.5px; color: #292216; line-height: 1.4; }
.ch-item.now { background: rgba(166, 58, 36, .1); border-left-color: var(--seal); }

/* ============ 叙事卡 ============ */
#card {
  position: absolute; left: 14px; top: 150px; bottom: 128px; z-index: 550;
  width: 318px; display: flex; flex-direction: column;
  background: linear-gradient(175deg, rgba(250, 246, 234, .96), rgba(242, 234, 212, .96));
  border: 1px solid var(--line); border-radius: 3px; box-shadow: var(--shadow-soft);
  transition: transform .3s ease;
}
#card.collapsed #cardBody { display: none; }
#card.collapsed { bottom: auto; }
#cardToggle {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 3px; cursor: pointer; font-size: 12px; line-height: 1;
}
#cardBody { padding: 15px 16px 12px; overflow-y: auto; scrollbar-width: none; }
#cardBody::-webkit-scrollbar { display: none; }
#cardBody.card-in { animation: cardIn .35s ease; }
.card-dyn {
  font-family: var(--kai); font-size: 31px; font-weight: 700; line-height: 1.1;
  display: flex; align-items: baseline; gap: 9px;
}
.card-dyn .ft { font-size: 15px; color: var(--ink-soft); font-weight: 400; letter-spacing: 2px; }
.card-year {
  display: inline-block; margin-top: 8px; padding: 2px 10px;
  font-size: 11.5px; letter-spacing: 2px; color: var(--paper);
  background: var(--ink); border-radius: 2px;
}
.card-span { font-size: 11.5px; color: var(--ink-soft); margin-top: 6px; letter-spacing: 1.5px; font-family: var(--songti); }
.card-intro {
  font-family: var(--songti); font-size: 12.5px; line-height: 1.85; margin: 10px 0;
  color: #3b3223; text-align: justify;
}
.card-cap-label { font-size: 10px; color: var(--ink-faint); letter-spacing: 4px; margin: 9px 0 6px; }
.cap-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cap-chips button {
  font-family: var(--kai); font-size: 12.5px; color: var(--seal-deep); cursor: pointer;
  background: rgba(166, 58, 36, .06); border: 1px solid rgba(166, 58, 36, .3);
  border-radius: 2px; padding: 2px 9px; transition: all .15s; letter-spacing: 1px;
}
.cap-chips button:hover {
  background: rgba(166, 58, 36, .14); transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(166, 58, 36, .18);
}
.card-actions { display: flex; gap: 8px; }
.card-actions button {
  font-size: 12px; letter-spacing: 1px; cursor: pointer;
  color: var(--paper); background: var(--ink); border: 1px solid var(--ink);
  border-radius: 3px; padding: 5px 12px; transition: all .15s;
}
.card-actions button:hover { background: var(--seal-deep); border-color: var(--seal-deep); }
.facts { margin: 3px 0 0; padding: 0; list-style: none; }
.facts li {
  position: relative; font-size: 12px; line-height: 1.75; color: #453d2c;
  padding: 6px 0 6px 16px; border-top: 1px dashed var(--line);
}
.facts li::before {
  content: ""; position: absolute; left: 2px; top: 10px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--seal); opacity: .8;
  box-shadow: inset 0 0 0 1px rgba(134, 45, 27, .4);
}

/* ============ 事件卡 ============ */
#eventCard {
  position: absolute; right: 14px; top: 14px; z-index: 560; width: 298px;
  background: linear-gradient(175deg, rgba(250, 246, 234, .97), rgba(242, 234, 212, .97));
  border: 1px solid var(--line); border-left: 2px solid var(--seal);
  border-radius: 3px; box-shadow: var(--shadow); padding: 15px 17px;
  animation: cardIn .3s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(-6px); } }
#eventCard .ev-type {
  display: inline-block; font-size: 11px; padding: 1px 9px; color: var(--paper);
  border-radius: 2px; letter-spacing: 3px; margin-bottom: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}
#eventCard h3 { font-family: var(--kai); margin: 0 0 4px; font-size: 22px; letter-spacing: 1px; }
#eventCard .ev-year { font-size: 12px; color: var(--ink-soft); letter-spacing: 1.5px; font-family: var(--songti); }
#eventCard p { font-size: 13px; line-height: 1.85; margin: 9px 0 0; text-align: justify; color: #3b3223; font-family: var(--songti); }
#eventCard .ev-close {
  position: absolute; top: 6px; right: 8px; border: 0; background: none;
  color: var(--ink-faint); font-size: 16px; cursor: pointer;
}
#eventCard.fading { animation: cardOut .3s ease forwards; }
@keyframes cardOut { to { opacity: 0; transform: translateY(-8px); } }

/* ============ 缩放控件 ============ */
#zoomCtrl { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); z-index: 540; display: flex; flex-direction: column; gap: 6px; }
#zoomCtrl button {
  width: 32px; height: 32px; font-size: 14px; cursor: pointer;
  background: rgba(248, 243, 229, .92); border: 1px solid var(--line); border-radius: 3px; color: var(--ink);
  box-shadow: var(--shadow-soft);
}
#zoomCtrl button:hover { background: var(--paper-2); }
#zoomCtrl button:hover { background: var(--paper-2); }

/* ============ 页脚法务 ============ */
#legal {
  position: absolute; right: 14px; bottom: 132px; z-index: 540;
  font-size: 10.5px; color: var(--ink-faint); letter-spacing: .5px;
  max-width: 46vw; text-align: right; pointer-events: none;
  text-shadow: 0 1px 0 rgba(248, 243, 229, .8);
}

/* ============ 加载指示 ============ */
#loading {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 700;
  font-size: 13px; letter-spacing: 4px; color: var(--ink-soft);
  background: rgba(248, 243, 229, .92); border: 1px solid var(--line); border-radius: 3px;
  padding: 10px 20px; box-shadow: var(--shadow-soft);
}
.ink-drop {
  display: inline-block; width: 9px; height: 9px; margin-right: 8px;
  background: var(--ink); border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  animation: drop 1.1s ease-in-out infinite;
}
@keyframes drop { 0%, 100% { transform: rotate(-45deg) scale(.55); opacity: .4; } 50% { transform: rotate(-45deg) scale(1); opacity: 1; } }

/* ============ 时间轴 · 按真实年代分配宽度 ============ */
#timeline {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 600; height: 116px;
  background: linear-gradient(0deg, rgba(240, 232, 208, .97), rgba(246, 240, 222, .95));
  border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(41, 34, 22, .08);
  display: flex; flex-direction: column;
}
#tlHead { display: flex; align-items: baseline; gap: 14px; padding: 9px 20px 0; }
.tl-year { font-family: var(--kai); font-size: 25px; font-weight: 700; letter-spacing: 3px; min-width: 150px; color: var(--ink); }
.tl-dyn { font-size: 12px; color: var(--ink-soft); letter-spacing: 2px; }
#tlTrack {
  position: relative; flex: 1; margin: 4px 12px 10px; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: none; cursor: pointer;
}
#tlTicks { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.tl-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(156, 144, 120, .18); }
.tl-tick.major { background: rgba(120, 106, 80, .38); }
.tl-tick-label {
  position: absolute; bottom: 1px; font-size: 8px; color: var(--ink-faint);
  transform: translateX(3px); letter-spacing: .5px; white-space: nowrap;
}
#tlSegs { display: flex; height: 100%; position: relative; z-index: 1; }
.seg {
  position: relative; flex: 0 0 auto; cursor: pointer;
  border-left: 1px solid rgba(156, 144, 120, .3);
  padding: 8px 6px 4px 9px; display: flex; flex-direction: column; justify-content: space-between;
  transition: background .15s;
}
/* 空缺灰段（楚汉/新莽等政权空缺期） */
.seg.gap {
  background: repeating-linear-gradient(45deg, rgba(120,110,90,.08) 0 6px, transparent 6px 12px);
  cursor: default; opacity: .75;
}
.seg.gap .s-dyn { color: var(--ink-faint); font-size: 11px; letter-spacing: 1px; }
.seg.gap .s-year { color: var(--ink-faint); }
.seg.gap::after { display: none; }
/* 并立过渡带：与前朝重叠期用斜纹提示 */
.seg.has-overlap::before {
  content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 6px;
  background: repeating-linear-gradient(135deg, rgba(166,58,36,.35) 0 3px, transparent 3px 6px);
  z-index: 2;
}
.seg::after {
  content: ""; position: absolute; top: 0; left: 9px; right: 6px; height: 3px;
  background: var(--seg-color, var(--ink-faint)); opacity: .5; border-radius: 0 0 2px 2px;
  transition: opacity .15s, height .15s;
}
.seg:hover { background: rgba(41, 34, 22, .05); }
.seg:hover::after { opacity: .85; }
.seg .s-dyn { font-family: var(--kai); font-size: 15px; line-height: 1.1; color: #4a4030; }
.seg .s-year { font-size: 9.5px; color: var(--ink-faint); letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg .s-ev { position: absolute; top: 14px; right: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--seal); opacity: .65; }
.seg.active { background: rgba(41, 34, 22, .09); }
.seg.active::after { opacity: 1; height: 6px; }
.seg.active .s-dyn { color: var(--ink); }
#playhead {
  position: absolute; top: 0; bottom: 6px; width: 2px; background: var(--seal);
  pointer-events: none; transform: translateX(0);
  transition: transform .45s cubic-bezier(.5, 0, .3, 1);
  will-change: transform;
}
#playhead::after {
  content: ""; position: absolute; top: -2px; left: -3.5px;
  width: 9px; height: 9px; background: var(--seal);
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
}

/* ============ 开场 · 水墨山水 + 钤印 ============ */
#hero {
  position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse 120% 90% at 50% 42%, #32291a 0%, #1c170e 70%, #14100a 100%);
  cursor: pointer;
}
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; }
#hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.9 0 0 0 0 0.85 0 0 0 0 0.7 0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* 山脊三层依次洇开 */
.h-ridge { opacity: 0; transform: translateY(26px); filter: blur(10px); animation: ridgeIn 2.2s ease forwards; }
.h-ridge.r1 { animation-delay: .25s; }
.h-ridge.r2 { animation-delay: .6s; }
.h-ridge.r3 { animation-delay: .95s; }
@keyframes ridgeIn { to { opacity: 1; transform: translateY(0); filter: blur(0); } }
.h-moon { opacity: 0; animation: moonIn 2.6s 1s ease forwards; }
@keyframes moonIn { to { opacity: 1; } }
.h-mist { opacity: .16; filter: blur(10px); animation: mistDrift 16s ease-in-out infinite alternate; }
.h-mist.m2 { animation-duration: 21s; animation-delay: -6s; opacity: .13; }
@keyframes mistDrift { from { transform: translateX(-70px); } to { transform: translateX(70px); } }
.hero-inner { text-align: center; color: #efe6cf; position: relative; }
.hero-scroll { display: inline-flex; align-items: flex-end; gap: 26px; animation: heroRise 1.1s .9s ease both; }
@keyframes heroRise { from { opacity: 0; transform: translateY(18px); } }
.hero-title {
  /* 2026-09-20 审计 P3-4：元素由 div 改为 h1（补语义化标题，此前整页无 h1）。
     本文件没有针对 h1 的全局 margin 重置，若不显式清零，浏览器默认的
     `0.67em` 上下外边距会按 118px 字号撑出约 79px 的空白、顶歪 hero 区。
     故此处显式 margin: 0，视觉与改前完全一致。 */
  margin: 0;
  font-family: var(--kai); font-size: 118px; font-weight: 700; letter-spacing: 36px; margin-left: 36px;
  line-height: 1; color: #efe6cf; text-shadow: 0 6px 40px rgba(0, 0, 0, .55);
}
#heroSeal {
  width: 88px; height: 88px; margin-bottom: 10px;
  background: var(--seal);
  border-radius: 6px;
  box-shadow: inset 0 0 0 2.5px rgba(241, 233, 214, .9), inset 0 0 0 7px var(--seal), 2px 4px 18px rgba(0, 0, 0, .5);
  display: grid; grid-template: 1fr 1fr / 1fr 1fr; padding: 9px;
  transform: rotate(-4deg) scale(2.1); opacity: 0;
  animation: stamp .5s 1.75s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes stamp {
  0% { transform: rotate(-14deg) scale(2.1); opacity: 0; }
  62% { transform: rotate(-3deg) scale(.96); opacity: 1; }
  100% { transform: rotate(-4deg) scale(1); opacity: 1; }
}
#heroSeal span {
  font-family: var(--kai); font-size: 27px; line-height: 1; color: #f3ecdb;
  display: flex; align-items: center; justify-content: center;
}
/* 传统印文读法：右上→右下→左上→左下 */
#heroSeal span:nth-child(1) { grid-area: 1 / 2; }
#heroSeal span:nth-child(2) { grid-area: 2 / 2; }
#heroSeal span:nth-child(3) { grid-area: 1 / 1; }
#heroSeal span:nth-child(4) { grid-area: 2 / 1; }
.hero-sub { font-family: var(--kai); font-size: 21px; letter-spacing: 13px; margin-top: 24px; color: #c9bb98; animation: heroRise 1s 1.35s ease both; }
.hero-note { font-size: 12px; letter-spacing: 6px; margin-top: 24px; color: #837860; animation: heroRise 1s 1.55s ease both; }
#heroGo {
  margin-top: 42px; font-family: var(--kai); font-size: 17px; letter-spacing: 10px;
  color: #efe6cf; background: transparent; cursor: pointer;
  border: 1px solid #857a5f; border-radius: 2px; padding: 12px 44px 12px 54px;
  transition: all .25s;
  animation: heroRise 1s 1.75s ease both;
}
#heroGo:hover { border-color: #efe6cf; background: rgba(239, 230, 207, .08); letter-spacing: 13px; }

/* ============ 面板（关于/游戏） ============ */
.panel { position: fixed; inset: 0; z-index: 800; background: rgba(28, 23, 14, .5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.panel-card {
  position: relative; width: min(560px, 94vw); max-height: 82vh; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--seal);
  border-radius: 3px; box-shadow: var(--shadow); padding: 26px 30px; scrollbar-width: none;
  animation: cardIn .28s ease both;
}
.panel-card::-webkit-scrollbar { display: none; }
.panel-card h2 { font-family: var(--kai); font-size: 27px; margin: 0 0 14px; letter-spacing: 5px; }
.panel-card p { font-size: 13px; line-height: 1.95; text-align: justify; color: #3b3223; font-family: var(--songti); }
/* 常见问题（折叠问答，保持纸质墨韵风格） */
.faq-item { margin: 10px 0; border: 1px solid rgba(146, 130, 96, .55); border-radius: 3px; background: rgba(255,255,255,.5); overflow: hidden; }
.faq-item summary { cursor: pointer; padding: 10px 14px 10px 22px; font-size: 13.5px; color: #2e2717; font-family: var(--kai); list-style: none; position: relative; background: rgba(210, 196, 160, .18); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: '＋'; position: absolute; left: 7px; top: 50%; transform: translateY(-50%); color: var(--seal); font-family: var(--kai); font-size: 13px; line-height: 1; }
.faq-item[open] summary::before { content: '－'; }
.faq-item summary:hover { background: rgba(186, 172, 137, .12); }
.faq-item p { padding: 0 14px 11px; margin: 0; }
.faq-group { font-family: var(--kai); font-size: 14px; letter-spacing: 2px; color: var(--seal); margin: 22px 0 10px; padding-bottom: 4px; border-bottom: 1px dashed rgba(146, 130, 96, .35); }
.faq-group:first-of-type { margin-top: 6px; }
/* SEO 语义索引：屏外定位，用户不可见，但内容保留在 DOM 供搜索引擎读取，不影响外观 */
#seoIndex { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ 疆域研究文献 ============ */
.sch-lead { font-size: 12.5px; color: #9a8f77; margin: -6px 0 16px; letter-spacing: .5px; }
.sch-group-title { display: none; } /* 朝代组标题：供搜索引擎与读屏识别结构，视觉上由面板标题承担 */
.sch-item { margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px dashed rgba(146, 130, 96, .35); }
.sch-item:last-child { margin-bottom: 0; padding-bottom: 2px; border-bottom: 0; }
.sch-head { display: flex; align-items: baseline; gap: 9px; }
.sch-idx {
  flex: 0 0 20px; width: 20px; height: 20px; line-height: 20px; text-align: center;
  font-family: var(--sans); font-size: 11px; color: var(--paper);
  background: var(--seal); border-radius: 2px; opacity: .92; transform: translateY(-1px);
}
.sch-title { font-family: var(--kai); font-size: 15.5px; color: var(--ink); letter-spacing: .5px; line-height: 1.5; }
.sch-meta { font-size: 11.5px; color: #9a8f77; letter-spacing: .5px; margin: 5px 0 0 29px; }
.sch-item p { font-size: 13px; line-height: 1.9; text-align: justify; color: #3b3223; font-family: var(--songti); margin: 7px 0 0 29px; }

/* ============ 国势曲线（历代疆域面积） ============ */
#areaWrap { margin-left: auto; display: flex; align-items: center; gap: 8px; align-self: center; }
#areaSpark { display: block; }
.area-now { font-family: var(--kai); font-size: 11px; letter-spacing: .5px; color: #9a8f77; white-space: nowrap; }

/* ============ 更多工具（⋯菜单） ============ */
#moreWrap { position: relative; flex: 0 0 auto; }
#btnMore {
  font-family: var(--sans); font-size: 14px; cursor: pointer; color: var(--ink);
  background: transparent; border: 1px solid var(--line); border-radius: 3px;
  padding: 4px 8px 6px; transition: all .15s;
}
#btnMore:hover { border-color: var(--ink-soft); background: rgba(41, 34, 22, .05); }
#moreMenu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 650;
  min-width: 128px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 3px; box-shadow: var(--shadow); padding: 5px;
  display: flex; flex-direction: column; gap: 2px;
}
#moreMenu.hidden { display: none; }
#moreMenu button {
  font-family: var(--kai); font-size: 13px; letter-spacing: 1.5px; text-align: left;
  color: var(--ink); background: transparent; border: 0; border-radius: 2px;
  padding: 8px 12px; cursor: pointer;
}
#moreMenu button:hover { background: rgba(166, 58, 36, .08); color: var(--seal); }

/* ============ 课堂放映（全屏） ============ */
body.theater #brand, body.theater #card, body.theater #zoomCtrl,
body.theater #legal, body.theater #searchWrap, body.theater #areaWrap { display: none; }
body.theater #timeline { height: 148px; }
body.theater #tlHead { padding: 14px 28px 0; }
body.theater .tl-year { font-size: 40px; }
body.theater .tl-dyn { font-size: 15px; }
body.theater .card-dyn { font-size: 30px; }
#theaterExit {
  position: fixed; bottom: 168px; right: 20px; z-index: 640;
  font-family: var(--kai); font-size: 13px; letter-spacing: 2px;
  color: var(--paper); background: rgba(41, 34, 22, .82);
  border: 1px solid rgba(248, 243, 229, .35); border-radius: 20px;
  padding: 8px 16px; cursor: pointer; display: none;
}
body.theater #theaterExit { display: block; }
#theaterExit:hover { background: rgba(166, 58, 36, .88); }

/* ============ 嵌入模式（?embed=1）：只留地图与时间轴 ============ */
body.embed #brand, body.embed #card, body.embed #zoomCtrl,
body.embed #legal, body.embed #hero, body.embed #theaterExit { display: none; }

/* ============ 嵌入代码面板 ============ */
.embed-card { width: min(520px, 94vw); }
#embedCode {
  width: 100%; box-sizing: border-box; resize: vertical;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.7;
  color: #3b3223; background: rgba(255, 252, 240, .8);
  border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; outline: none;
}
#btnCopyEmbed {
  margin-top: 12px; font-family: var(--kai); font-size: 14px; letter-spacing: 3px;
  color: var(--paper); background: var(--seal); border: 0; border-radius: 3px;
  padding: 9px 22px; cursor: pointer; transition: opacity .15s;
}
#btnCopyEmbed:hover { opacity: .88; }

/* ============ 事件类型筛选 chips（年表抽屉顶部） ============ */
#typeChips { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 0 10px; }
.type-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--songti); font-size: 11px; letter-spacing: .5px;
  color: #4a4030; background: rgba(255, 252, 240, .7);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 3px 9px; cursor: pointer; transition: all .15s;
}
.type-chip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.type-chip:hover { border-color: var(--ink-soft); }
.type-chip.off { opacity: .42; }
.type-chip.off i { background: #b6ab93 !important; }
.type-chip.off span, .type-chip.off { text-decoration: line-through; text-decoration-color: rgba(90,78,58,.5); }

/* ============ 城市沿革 ============ */
#citySelect {
  width: 100%; box-sizing: border-box; margin-bottom: 14px;
  font-family: var(--kai); font-size: 14px; letter-spacing: 1px; color: var(--ink);
  background: rgba(255, 252, 240, .8); border: 1px solid var(--line); border-radius: 3px;
  padding: 8px 10px; outline: none; cursor: pointer;
}
#cityTimeline { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; }
.city-row { display: flex; align-items: baseline; gap: 8px; border-bottom: 1px dashed rgba(146,130,96,.22); padding-bottom: 5px; }
.city-row .cr-dyn { flex: 0 0 88px; font-family: var(--kai); font-size: 12.5px; color: #872d1b; }
.city-row .cr-val { font-family: var(--songti); font-size: 13px; color: #3b3223; }
.city-row.now { background: rgba(166, 58, 36, .06); border-radius: 2px; padding-left: 4px; }
@media (max-width: 640px) { #cityTimeline { grid-template-columns: 1fr; } }

/* ============ 比例尺（纸墨风重绘） ============ */
.leaflet-control-scale-line {
  background: rgba(248, 243, 229, .85) !important;
  border: 1px solid rgba(90, 78, 58, .55) !important;
  border-top: 0 !important;
  color: #4a4030 !important;
  font-family: var(--sans); font-size: 10px; letter-spacing: .5px;
  padding: 1px 5px 1px 5px !important;
  box-shadow: 0 1px 3px rgba(41, 34, 22, .12);
}
.leaflet-bottom.leaflet-right { z-index: 620; }
body.theater .leaflet-control-scale, body.embed .leaflet-control-scale { display: none; }

/* ============ 打印：只留地图与来源 ============ */
@media print {
  #brand, #card, #eventCard, #zoomCtrl, #searchWrap, #timeline,
  #chronDrawer, #aboutPanel, #scholPanel, #embedPanel, #cityPanel,
  #moreWrap, #theaterExit, #toast, #loading, #hero, #areaWrap { display: none !important; }
  #map { position: fixed; inset: 0; width: 100vw; height: 100vh; }
  body { background: #efe8d2; }
}
.panel-close {
  position: sticky; top: 8px; float: right; z-index: 5;
  margin: -16px -18px 0 0; /* 复刻原 absolute 角落位置；滚动时吸附在可视区顶部，长内容任意处可关 */
  width: 30px; height: 30px;
  font-size: 20px; cursor: pointer; color: var(--ink-soft);
  background: rgba(248, 243, 229, .88); border: 1px solid var(--line); border-radius: 3px;
}

/* ============ 地图标注 ============ */
.polity-label {
  font-family: var(--kai); font-size: 13.5px; font-weight: 700; color: #2f2617;
  text-shadow: 0 0 3px rgba(241, 233, 214, .95), 0 0 7px rgba(241, 233, 214, .85);
  letter-spacing: 2.5px; white-space: nowrap;
}
.admin-label {
  font-family: var(--kai); font-size: 10.5px; color: #5d5240;
  text-shadow: 0 0 3px rgba(241, 233, 214, .95); white-space: nowrap;
}

/* hover 显示的名称：醒目纸签（区别于常显淡标注） */
.leaflet-tooltip.admin-label.hoverable, .leaflet-tooltip.polity-label.hoverable {
  font-family: var(--kai); font-size: 14px; font-weight: 700; letter-spacing: 2px;
  color: #292216; white-space: nowrap;
  background: rgba(250, 246, 234, .98);
  border: 1px solid #b8a87f; border-left: 3px solid var(--seal);
  border-radius: 3px; box-shadow: 0 3px 10px rgba(41, 34, 22, .14);
  padding: 4px 11px;
}
.leaflet-tooltip.admin-label.hoverable::before, .leaflet-tooltip.polity-label.hoverable::before { display: none; }
/* 分级常显：small=小字号常显；dense=缩放≥5 后显示（body.zoom5 由 JS 维护） */
.admin-label.small, .polity-label.small { font-size: 9.5px; letter-spacing: 1px; opacity: .92; }
.admin-label.dense, .polity-label.dense { font-size: 10px; letter-spacing: 1px; opacity: .92; }
/* 密集层标注：低缩放隐藏、放大后显示（body.zoom5 由 JS 维护） */
body:not(.zoom5) .leaflet-tooltip.admin-label.dense,
body:not(.zoom5) .leaflet-tooltip.polity-label.dense { display: none; }
/* 周边政权补注：据谭图位置的文字示意（无边界数据） */
.leaflet-tooltip.neighbor-label {
  font-family: var(--kai); font-size: 14px; font-weight: 700; color: #6a5c44;
  letter-spacing: 4px; white-space: nowrap;
  background: transparent; border: 0; box-shadow: none; padding: 0;
  text-shadow: 0 0 3px rgba(241, 233, 214, .95), 0 0 7px rgba(241, 233, 214, .85);
  opacity: .85;
}
body.modern-basemap .leaflet-tooltip.neighbor-label {
  color: #efe6cf; text-shadow: 0 0 5px rgba(0,0,0,.9), 0 0 10px rgba(0,0,0,.8);
}
.leaflet-tooltip.polity-label, .leaflet-tooltip.admin-label { background: transparent; border: 0; box-shadow: none; padding: 0; }
/* 悬停标签不拦截点击（sticky 标签会跟着鼠标走到点击点下方） */
.leaflet-tooltip { pointer-events: none; }
/* 事件点悬停提示：与政区悬停同族的纸签楷体风 */
.leaflet-tooltip.ev-tip {
  font-family: var(--kai); font-size: 12.5px; font-weight: 700; color: #292216;
  background: rgba(248, 243, 229, .96); border: 1px solid var(--line);
  box-shadow: var(--shadow-soft); padding: 2px 10px; border-radius: 3px;
  white-space: nowrap; letter-spacing: 1px;
}
.leaflet-tooltip.ev-tip::before { display: none; }

/* 政权面切换 · 整层淡入（div 级动画，避开 per-path 动画 + 混合的合成 bug） */
.leaflet-overlay-pane.swap { animation: paneIn .7s ease; }
@keyframes paneIn { from { opacity: 0; } }

/* 事件点脉动（当前年份 ±6 年） */
.ev-pulse { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { stroke-opacity: 1; } 70% { stroke-opacity: .25; } 100% { stroke-opacity: 1; } }
/* 事件点：默认精致小点（白晕光感） */
#map .leaflet-overlay-pane circle {
  stroke: rgba(43, 36, 25, .9); stroke-width: 1.2;
}
/* 事件聚焦：朱环 + 放大 + 光晕 */
.ev-focus {
  stroke: var(--seal) !important; stroke-width: 2.8 !important;
}
/* 播放中非当前事件点：半透明保留（不消失，不抢焦点） */
.ev-dim { fill-opacity: .28 !important; stroke-opacity: .3 !important; }
/* 当前事件点放大动画 */
.ev-focus { animation: evFocusIn .4s ease; }
@keyframes evFocusIn { from { r: 5.5px; } to { r: 9px; } }
/* 墨滴涟漪：SVG circle transform: scale 扩散（fill-box 围绕自身中心） */
.ev-ripple0, .ev-ripple1 {
  animation: ripple 1.6s ease-out forwards;
  transform-box: fill-box; transform-origin: center;
}
.ev-ripple1 { animation-delay: .4s; }
@keyframes ripple {
  0% { transform: scale(0.1); opacity: .85; }
  100% { transform: scale(6); opacity: 0; }
}

/* 政区/政权标注统一走悬停或常显，不再按缩放隐藏 */
.card-actions { display: flex; gap: 8px; }
.card-actions button {
  font-size: 12px; letter-spacing: 1px; cursor: pointer;
  color: var(--paper); background: var(--ink); border: 1px solid var(--ink);
  border-radius: 3px; padding: 5px 12px; transition: all .15s;
}
.card-actions button:hover { background: var(--seal-deep); border-color: var(--seal-deep); }

/* 今图模式：标注加重 */
body.modern-basemap .polity-label { color: #1f180d; text-shadow: 0 0 4px rgba(255, 252, 240, .95), 0 0 8px rgba(255, 252, 240, .9); }
body.modern-basemap .admin-label { color: #332b1d; text-shadow: 0 0 4px rgba(255, 252, 240, .95); }

/* ============ toast ============ */
#toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 950;
  background: var(--ink); color: var(--paper); font-size: 13px; letter-spacing: 2px;
  padding: 9px 20px; border-radius: 3px; box-shadow: var(--shadow);
  animation: cardIn .3s ease both;
}

.hidden { display: none !important; }
/* 事件卡淡出（播放中自动收起） */
#eventCard.fading { animation: cardOut .3s ease forwards; }
@keyframes cardOut { to { opacity: 0; transform: translateY(-8px); } }

/* ============ 动效尊重 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* 关闭动效时入场元素直接可见 */
  .h-ridge, .h-moon, .h-mist, #heroSeal { opacity: 1 !important; transform: rotate(-4deg) !important; filter: none !important; }
}

/* ============ 移动端 ============ */
@media (max-width: 860px) {
  /* —— 顶栏：三组控件拆行，避免溢出截断 —— */
  #brand {
    top: 8px; left: 8px; right: 8px; max-width: none;
    flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px;
  }
  #brandHead { gap: 8px; }
  .brand-sub { font-size: 13px; letter-spacing: 3px; }
  .brand-en { display: none; }
  #brandSeal { width: 36px; height: 36px; padding: 4px; }
  #brandSeal span { font-size: 13px; }
  #tools { width: 100%; gap: 5px; order: 3; }
  #tools button, #basemaps button { font-size: 11px; letter-spacing: 1px; padding: 5px 8px; }
  #tools #btnPlay { width: 34px; }
  #basemaps { margin-left: auto; gap: 5px; }
  #searchWrap { width: auto; flex: 1 1 auto; min-width: 120px; margin-left: auto; order: 2; }
  #searchInput { font-size: 12px; padding: 5px 9px; }

  /* —— 地图全高，卡片让位 —— */
  #card {
    left: 8px; right: 8px; width: auto; top: auto; bottom: 128px;
    max-height: 34vh; border-left: 3px solid var(--seal);
  }
  #card.collapsed { bottom: auto; top: auto; }
  .card-dyn { font-size: 26px; }

  #zoomCtrl { right: 8px; top: 46%; gap: 5px; }
  #legal { display: none; }

  /* —— 时间轴：底部信息不换行；窄屏一屏铺满全部断代(无横滑冲突,段内只留朝代名) —— */
  #timeline { height: 108px; }
  #tlHead { gap: 8px; padding: 8px 14px 0; }
  .tl-year { font-size: 20px; letter-spacing: 1px; min-width: auto; }
  .tl-dyn { font-size: 11px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
  #areaWrap { display: none; } /* 手机时间轴头部不放曲线，保持简洁 */
  #tlTrack { margin: 3px 8px 8px; }
  #tlSegs { min-width: 0; } /* 允许段在容器内收缩，一屏铺满 */
  .seg { padding: 7px 3px 4px 4px; min-width: 0; }
  .seg .s-dyn { font-size: 12px; letter-spacing: 0; white-space: nowrap; text-align: center; }
  .seg .s-year { display: none; } /* 手机隐藏年份数字，窄段只留朝代名，避免挤/截断 */

  /* —— 事件卡：底部抽屉式，不遮地图太狠 —— */
  #eventCard { left: 8px; right: 8px; width: auto; top: auto; bottom: 116px; max-height: 46vh; overflow-y: auto; }

  /* —— hero 入场：手机精简，标题/副题/说明/按钮适配窄屏不溢出 —— */
  #hero { padding: 0 16px; }
  .hero-scroll { gap: 16px; }
  .hero-title { font-size: 46px; letter-spacing: 14px; margin-left: 14px; }
  #heroSeal { width: 48px; height: 48px; padding: 6px; }
  #heroSeal span { font-size: 16px; }
  .hero-sub { font-size: 16px; letter-spacing: 5px; margin-top: 18px; }
  .hero-note { font-size: 10.5px; letter-spacing: 1.5px; margin-top: 16px; white-space: normal; }
  #heroGo { margin-top: 30px; font-size: 15px; letter-spacing: 6px; padding: 11px 34px 11px 40px; }

  /* —— 放映模式（手机）：时间轴收窄、退出钮贴底 —— */
  body.theater #timeline { height: 128px; }
  body.theater .tl-year { font-size: 26px; }
  #theaterExit { bottom: 140px; right: 12px; font-size: 12px; padding: 7px 13px; }
}
