/* ==========================================================================
   atlas.css —— 地图册页面骨架（第二版：滚动叙事）
   --------------------------------------------------------------------------
   形态参照 storymap/index.html：地图固定在视口上半部，文字面板在其下方滚动推进。
   地图图层样式（自绘 SVG 与高德覆盖物）另见 css/map.css。
   ========================================================================== */

:root {
  --bg: #080b0f;
  --bg-1: #0c1117;
  --line: rgba(214, 196, 160, .18);
  --line-2: rgba(214, 196, 160, .32);
  --cream: #f4efe6;
  --dim: #b9b3a6;
  --faint: #8a8578;
  --gold: #e8b563;
  --gold-dim: #c9a86a;
  --red: #ff5a2b;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --sans: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  --nav-h: 50px;
  --snav-h: 40px;
  --stage-h: 46vh;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  color: var(--cream);
  font: 15px/1.8 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- 顶栏 */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: var(--nav-h);
  display: flex; align-items: center; gap: 14px; padding: 0 clamp(10px, 2vw, 22px);
  background: rgba(8, 11, 15, .95); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { font-family: var(--serif); font-size: 15px; color: var(--gold); letter-spacing: .06em; white-space: nowrap; }
.brand .sm { color: var(--faint); font-size: 12px; }
.top { flex-wrap: nowrap; overflow: visible; }
/* min-width:0 是关键：flex 子项默认不肯收缩到内容宽度以下，会把工具区顶出右边缘 */
.chnav, .snav { touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.chnav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.chnav::-webkit-scrollbar { display: none; }
.chnav a { padding: 4px 8px; border-radius: 3px; font-size: 12.5px; color: var(--dim); white-space: nowrap; border: 1px solid transparent; }
.chnav a:hover { color: var(--cream); background: rgba(244, 239, 230, .06); }
.chnav a.on { color: var(--gold); border-color: var(--line-2); background: rgba(232, 181, 99, .08); }
.tools { display: flex; gap: 6px; flex: none; }
.tools button {
  padding: 4px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  color: var(--gold); background: rgba(244, 239, 230, .05); border: 1px solid var(--line-2);
}
.tools button:hover { background: rgba(244, 239, 230, .13); }

/* ------------------------------------------------------- 章内小节导航 */
.snav {
  position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 35; height: var(--snav-h);
  display: flex; align-items: center; gap: 4px; padding: 0 clamp(10px, 2vw, 22px);
  background: rgba(8, 11, 15, .88); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.snav::-webkit-scrollbar { display: none; }
.snav a {
  padding: 3px 9px; border-radius: 999px; font-size: 12px; color: var(--dim);
  white-space: nowrap; border: 1px solid transparent;
}
.snav a:hover { color: var(--cream); background: rgba(244, 239, 230, .06); }
.snav a.on { color: var(--gold); border-color: var(--line-2); background: rgba(232, 181, 99, .1); }
/* 溢出提示：右侧渐隐 + 可点的左右箭头（由 js 在真溢出时显示） */
.chnav.is-scrollable, .snav.is-scrollable {
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 18px), transparent 100%);
}
.nav-arrow {
  flex: none; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; padding: 0; line-height: 1; font: 14px/1 system-ui, sans-serif;
  color: var(--gold); background: rgba(244, 239, 230, .06); border: 1px solid var(--line-2);
}
.nav-arrow:hover { background: rgba(244, 239, 230, .14); }
.nav-arrow[hidden] { display: none; }

/* ---------------------------------------------------------------- 地图 */
.stage {
  position: fixed; inset: 0; z-index: 0;
  background: var(--bg-1);
}
#map-stage { position: absolute; inset: 0; }
.stagemeta {
  position: absolute; left: 12px; top: 10px; z-index: 5; max-width: 58%;
  padding: 6px 10px; border-radius: 4px; font-size: 12px; color: var(--dim);
  background: rgba(8, 11, 15, .78); border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.stagemeta b { display: block; font-family: var(--serif); font-size: 15px; color: var(--cream); }
.stagemeta span { color: var(--faint); }
.legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 4px 14px; max-width: 60%;
  padding: 7px 11px; border-radius: 4px; font-size: 11.5px; color: var(--dim);
  background: rgba(8, 11, 15, .8); border: 1px solid var(--line);
}
.legend i { display: inline-block; vertical-align: middle; margin-right: 5px; }
.lg-item { display: inline-flex; align-items: center; }
.lg-item i { flex: none; }
.stagebar {
  position: absolute; right: 12px; bottom: 12px; z-index: 5;
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 999px;
  background: rgba(8, 11, 15, .82); border: 1px solid var(--line);
}
.stagebar button {
  width: 26px; height: 26px; border-radius: 50%; line-height: 1;
  color: var(--gold); background: rgba(244, 239, 230, .06); border: 1px solid var(--line-2);
}
.stagebar button:hover { background: rgba(244, 239, 230, .14); }
.stagebar .pos { font-size: 11.5px; color: var(--dim); min-width: 52px; text-align: center; }

/* ---------------------------------------------------------------- 正文 */
.story {
  position: relative; z-index: 10;
  max-width: 660px; margin: 0;
  padding: calc(var(--nav-h) + var(--snav-h) + 6vh) clamp(16px, 3vw, 28px) 40vh
           clamp(16px, 5vw, 84px);
}
.story { transition: opacity .3s ease; }
.ch-head {
  margin: 0 0 22px; padding: 22px 24px 20px;
  border: 1px solid var(--line); border-radius: 6px;
  background: rgba(8, 11, 15, .9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.ch-head .kicker { font-size: 12px; letter-spacing: .2em; color: var(--red); margin: 0 0 8px; }
.ch-head h1 { font-size: clamp(22px, 3vw, 30px); line-height: 1.45; }
.ch-head .summary { color: var(--dim); font-size: 14px; margin: 10px 0 0; }

.panel {
  margin: 0 0 26px; padding: 22px 24px 24px;
  border: 1px solid var(--line); border-radius: 6px;
  background: rgba(8, 11, 15, .9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: .82; transition: opacity .35s ease, border-color .35s ease;
}
.panel.is-cur { opacity: 1; border-color: var(--line-2); }
.panel:not(.is-cur) { background: rgba(8, 11, 15, .86); }
.panel .p-date { font-size: 12.5px; letter-spacing: .2em; color: var(--red); margin: 0 0 4px; }
.panel h2 { font-size: 21px; line-height: 1.5; margin-bottom: 10px; }
.panel .jump {
  margin-top: 14px; padding: 4px 12px; border-radius: 999px; font-size: 12px;
  color: var(--gold); background: rgba(244, 239, 230, .05); border: 1px solid var(--line-2);
}
.panel .jump:hover { background: rgba(244, 239, 230, .13); }

.b-date { font-size: 12.5px; letter-spacing: .2em; color: var(--gold-dim); margin: 22px 0 4px; }
.b-lead { font-size: 16.5px; line-height: 1.95; margin: 8px 0 12px; }
.b-p { color: var(--dim); margin: 10px 0; }
.b-note { font-size: 12.5px; color: var(--faint); border-left: 2px solid var(--line-2); padding-left: 10px; margin: 14px 0; }
.b-stat { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.b-stat li { flex: 1 1 150px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-1); }
.b-stat b { display: block; font-family: var(--serif); font-size: 20px; color: var(--gold); }
.b-stat span { font-size: 12px; color: var(--faint); }
.b-quote { margin: 20px 0; padding: 14px 18px; border-left: 3px solid var(--gold-dim); background: var(--bg-1); border-radius: 0 4px 4px 0; }
.b-quote p { margin: 0; font-family: var(--serif); font-size: 16px; line-height: 1.9; }
.b-quote cite { display: block; margin-top: 8px; font-size: 12px; color: var(--faint); font-style: normal; }
.b-plate { margin: 18px 0; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: 4px; font-size: 12.5px; color: var(--faint); }
.b-plate b { color: var(--dim); font-weight: 400; }

/* ------------------------------------------------------- 附表 / 图集 */
.ch-foot {
  margin: 0 0 26px; padding: 22px 24px 24px;
  border: 1px solid var(--line); border-radius: 6px;
  background: rgba(8, 11, 15, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.list-wrap { margin: 28px 0; }
.list-wrap h3 { font-size: 16px; margin-bottom: 6px; }
.list-wrap .note { font-size: 12px; color: var(--faint); margin: 0 0 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--gold-dim); font-weight: 400; font-size: 12px; }
.tbl td { color: var(--dim); }
.tbl tr:hover td { background: rgba(244, 239, 230, .03); }
.tbl .nm { color: var(--cream); }
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.gal figure { margin: 0; }
.gal img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; display: block; }
.gal figcaption { margin-top: 6px; font-size: 12px; color: var(--dim); line-height: 1.6; }
.gal figcaption b { display: block; color: var(--cream); font-weight: 400; font-size: 13px; }
.gal figcaption span { color: var(--faint); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 3px 8px; border-radius: 3px; font-size: 12px; color: var(--dim); border: 1px solid var(--line); background: var(--bg-1); }
.chapter-foot { margin-top: 30px; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.chapter-foot a { color: var(--gold); }

/* 文字开关：收起正文，让地图占满 */
/* 隐藏文字**必须用 opacity**：display:none 会把滚动内容整块拿掉，
   页面失去可滚高度，小节定位随之失效 —— 地图就"卡着不动"（v1、v2 各踩过一次）。 */
body.no-text .story { opacity: 0; pointer-events: none; }
body.no-text { --stage-h: calc(100vh - var(--nav-h) - var(--snav-h)); }

/* ---------------------------------------------------------------- 门户 */
.portal { max-width: 1160px; margin: 0 auto; padding: 46px clamp(16px, 3vw, 40px) 80px; }
.portal-head { border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 26px; }
.portal-head .eyebrow { font-size: 12px; letter-spacing: .16em; color: var(--red); margin: 0 0 10px; }
.portal-head h1 { font-size: clamp(24px, 3.6vw, 36px); line-height: 1.4; }
.portal-head .lede { font-family: var(--serif); font-size: 17px; color: var(--gold); margin: 10px 0 6px; }
.portal-head .meta { font-size: 13px; color: var(--faint); margin: 0; }
.portal-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.portal-map { /* 必须是已定位元素：内部 #map-stage 是 absolute */ position: sticky; top: 24px; height: clamp(300px, 46vh, 520px); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg-1); }
.portal-map #map-stage { position: absolute; inset: 0; }
.portal-map .legend { max-width: 80%; }
.chapter-cards li { margin-bottom: 12px; }
.chapter-cards a {
  display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--bg-1);
  transition: border-color .2s ease, transform .2s ease;
}
.chapter-cards a:hover { border-color: var(--gold-dim); transform: translateX(3px); }
.chapter-cards .no { font-family: var(--serif); font-size: 15px; color: var(--red); }
.chapter-cards h3 { font-size: 16px; line-height: 1.5; margin-bottom: 5px; }
.chapter-cards p { font-size: 12.5px; color: var(--dim); margin: 0 0 6px; line-height: 1.7; }
.chapter-cards .tags { font-size: 11.5px; color: var(--faint); }
.portal-foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.portal-foot h2 { font-size: 16px; margin-bottom: 10px; }
.portal-foot li { font-size: 12.5px; color: var(--faint); line-height: 1.9; padding-left: 14px; position: relative; }
.portal-foot li::before { content: "·"; position: absolute; left: 4px; color: var(--gold-dim); }

@media (max-width: 980px) {
  :root { --stage-h: 40vh; }
  .portal-main { grid-template-columns: minmax(0, 1fr); }
  .portal-map { position: relative; height: 42vh; }
  .stagemeta { max-width: 70%; }
}
@media print {
  .top, .snav, .stagebar, .legend, .panel .jump { display: none !important; }
  .stage { position: static; height: 300px; page-break-after: always; }
  .story { margin-top: 0; }
  body { background: #fff; color: #111; }
  .panel { opacity: 1; }
}

/* ==========================================================================
   图边指向 / 详情面板 / 清单检索（js/atlas-tools.js 用）
   ========================================================================== */
.edge { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.edge-mark {
  position: absolute; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px;
  border-radius: 50%; text-align: center; font: 700 9.5px/15px var(--sans);
  color: #0a1118; background: rgba(232, 181, 99, .92);
  box-shadow: 0 0 0 2px rgba(8, 11, 15, .55);
}
.edge-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  border: 5px solid transparent;
}
.edge-mark.dir-e::after { border-left-color: rgba(232, 181, 99, .95); margin: -5px 0 0 3px; }
.edge-mark.dir-w::after { border-right-color: rgba(232, 181, 99, .95); margin: -5px 0 0 -13px; }
.edge-mark.dir-n::after { border-bottom-color: rgba(232, 181, 99, .95); margin: -13px 0 0 -5px; }
.edge-mark.dir-s::after { border-top-color: rgba(232, 181, 99, .95); margin: -5px 0 0 -5px; }

.detail {
  /* 固定在视口右上：挂 body 顶层 + 最高层级，避免被任何容器压住（曾因放 .stage 里而"点了没反应"） */
  position: fixed; right: 12px; top: calc(var(--nav-h) + var(--snav-h) + 10px); z-index: 9999;
  width: min(340px, 46%); max-height: 72%; overflow: auto; display: none;
  border: 1px solid var(--line); border-radius: 6px;
  background: rgba(8, 11, 15, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.detail.is-open { display: block; }
.detail .dt-head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 4px; }
.detail .dt-head b { flex: 1; font-family: var(--serif); font-size: 15px; line-height: 1.5; color: var(--cream); }
.detail .dt-close {
  flex: none; width: 22px; height: 22px; border-radius: 50%; line-height: 1;
  color: var(--gold); background: rgba(244, 239, 230, .06); border: 1px solid var(--line-2);
}
.detail .dt-meta { margin: 0; padding: 0 12px; font-size: 12px; color: var(--gold-dim); }
.detail .dt-desc { margin: 8px 0 0; padding: 0 12px 12px; font-size: 13px; line-height: 1.8; color: var(--dim); }
.detail .dt-src { margin: 0; padding: 0 12px 12px; font-size: 11.5px; color: var(--faint); }

.list-search {
  width: 100%; margin: 0 0 10px; padding: 7px 10px; border-radius: 4px; font-size: 13px;
  color: var(--cream); background: var(--bg-1); border: 1px solid var(--line-2);
}
.list-search:focus { outline: none; border-color: var(--gold); }
.tbl tr.is-clickable { cursor: pointer; }
.tbl tr.is-clickable:hover td { background: rgba(232, 181, 99, .08); }

/* ---------------------------------------------------------------- 移动端
   与电脑端**同一形态**：地图铺满、文字浮层、小节导航与顶栏工具都在。
   只做尺寸适配——顶栏与导航保持横向滚动不换行，详情面板改底部抽屉，图例窄一点。 */
@media (max-width: 720px) {
  .top { gap: 8px; padding: 0 10px; }
  .brand { font-size: 13.5px; }
  .brand .sm { display: none; }
  .chnav a { padding: 3px 6px; font-size: 12px; }
  .tools button, .tool-link { padding: 3px 8px; font-size: 11.5px; }
  .snav { padding: 0 10px; }
  .snav a { padding: 2px 7px; font-size: 11.5px; }
  .story { max-width: none; padding-left: 10px; padding-right: 10px; }
  .panel { padding: 15px 15px 17px; margin-bottom: 18px; }
  .panel h2 { font-size: 18px; }
  .b-lead { font-size: 15.5px; }
  .stagemeta { left: 10px; top: 8px; max-width: 84%; padding: 5px 8px; font-size: 11px; }
  .stagemeta b { font-size: 13.5px; }
  .legend { left: 10px; bottom: 10px; max-width: 90%; padding: 5px 8px; font-size: 10.5px; }
  .stagebar { right: 10px; bottom: 10px; }
  .detail {
    left: 10px; right: 10px; top: auto; bottom: 56px; width: auto; max-height: 46%;
  }
  .edge-mark { width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; font-size: 9px; line-height: 13px; }
}

/* ==========================================================================
   窄视口 / 微信内置浏览器的适配
   --------------------------------------------------------------------------
   微信内置浏览器视口窄（常见 800～900 CSS 像素），高德按容器比缩放后整片区域变成远景，
   四套范围面的**大字标注**会压在彼此身上（截图里的乱象即由此而来）。
   门户这一页只需要"颜色能对上图例"，标注交给图例文字，因此在地图里收起面的名字。
   两类类名都要写：自绘引擎（SVG，.su-label/.lao-label/.physio-label/.admin-label）
   与实景引擎（HTML 覆盖物，.am-*）。
   ========================================================================== */
.portal-map .su-label,
.portal-map .lao-label,
.portal-map .physio-label,
.portal-map .admin-label,
.portal-map .physio-peak-label,
.portal-map .am-su, .portal-map .am-lao, .portal-map .am-physio,
.portal-map .am-admin, .portal-map .am-peak { display: none !important; }

/* 微信 X5 内核对无前缀 backdrop-filter 支持不全 */
.panel, .ch-head, .ch-foot, .stagemeta, .legend, .top, .snav {
  -webkit-backdrop-filter: blur(10px);
}

/* 窄屏：门户地图别太高（否则一屏都是地图），页脚字号收一档 */
@media (max-width: 980px) {
  .portal { padding-top: 26px; }
  .portal-map { height: 34vh; }
  .portal { padding-top: 20px; padding-bottom: 40px; }
  .portal-head { padding-bottom: 14px; margin-bottom: 16px; }
  .portal-head h1 { font-size: 22px; }
  .portal-head .lede { font-size: 15px; }
  .chapter-cards a { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 12px 13px; }
  .chapter-cards h3 { font-size: 15px; }
  .chapter-cards p { font-size: 12px; }
  .portal-foot li { font-size: 12px; }
  .zhuanti-entry span { font-size: 12px; }
  /* 章页：窄屏下文字卡片占满宽度，留出地图可见的部分 */
  .story { max-width: none; padding-left: 12px; padding-right: 12px; }
  .panel { padding: 16px 16px 18px; }
  .stagemeta { max-width: 82%; font-size: 11.5px; }
  .legend { max-width: 88%; font-size: 11px; }
}

/* 窄屏：按钮标签收短，给章节导航让出宽度 */
@media (max-width: 860px) {
  .tools button .lb-long, .tool-link .lb-long { display: none; }
}

/* ==========================================================================
   手机端顶栏与卡片（按实机反馈调整）
   --------------------------------------------------------------------------
   ① 导航箭头**保留**：窄屏隐藏箭头后实机"翻不动"，箭头才是可靠的可达手段
   ② 品牌文字在手机上隐藏（只留「目录」入口），按钮一律用短标签
   ③ 卡片底衬更实：手机上地图细节多，半透明会读不清
   ========================================================================== */
@media (max-width: 860px) {
  .nav-arrow { display: flex !important; }
  .brand .sm { display: none !important; }
  .brand { font-size: 0; }                 /* 隐藏文字，仅保留可点区域 */
  .brand::after { content: "目录"; font-size: 12.5px; color: var(--gold); }
  .tools button .lb-long, .tool-link .lb-long { display: none !important; }
  .tools button, .tool-link { padding: 3px 8px; font-size: 11.5px; }
  .panel { background: rgba(8, 11, 15, .92) !important; opacity: .88; }
  .panel.is-cur { opacity: 1; }
}

/* 自绘底图可拖动平移：光标提示 + 拖动时禁止选中文本 */
#map-stage { cursor: grab; }
#map-stage.is-dragging { cursor: grabbing; }
#map-stage.is-dragging, body.is-dragging { user-select: none; -webkit-user-select: none; }

/* 自绘底图：可拖动 + 可缩放（Ctrl/⌘+滚轮、双击、双指捏合） */
#map-stage { cursor: grab; }
#map-stage.is-dragging { cursor: grabbing; }
#map-stage, #map-stage * { -webkit-user-drag: none; }
body.is-zooming #map-stage { cursor: zoom-in; }

/* ==========================================================================
   文字列不截获地图鼠标事件（"地图拖不动"的真因）
   --------------------------------------------------------------------------
   .story 是 position:relative + z-index:10，压在地图上层；它的空白内边距同样会
   收走 mousedown —— 用户在这一侧拖地图时，地图根本收不到事件。
   做法：整层穿透（pointer-events:none），只让卡片本身恢复 auto。
   文字仍可选中、可点，空白处的鼠标事件落到地图上。
   ========================================================================== */
.story { pointer-events: none; }
.story .panel,
.story .ch-head,
.story .ch-foot,
.story .list-wrap,
.story .panel button,
.story .panel a { pointer-events: auto; }

/* 地图上的交互层保持可点（节流按钮、图例、详情、图边标记） */
.stagebar, .legend, .detail, .stagemeta { pointer-events: auto; }
.edge { pointer-events: none; }

/* ==========================================================================
   手机横屏（可用高度只有 ~400px）：把常驻条压扁，给地图让出高度
   —— 横屏本来视野就宽，不需要竖屏补偿，但顶部三条会吃掉两成高度。
   ========================================================================== */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --nav-h: 38px; --snav-h: 32px; }
  .top { height: 38px; padding: 0 10px; }
  .brand { font-size: 12.5px; }
  .chnav a, .snav a { padding: 3px 8px; font-size: 11.5px; }
  .tools button, .tool-link { padding: 2px 7px; font-size: 11px; }
  .legend { padding: 5px 9px; gap: 8px; font-size: 11px; }
  .legend .lg-item { font-size: 11px; }
  .stagebar { padding: 4px 8px; font-size: 11px; }
  .stagemeta { font-size: 11px; }
  .story { padding-top: calc(var(--nav-h) + var(--snav-h) + 3vh); padding-bottom: 24vh; }
  .panel { padding: 14px 16px 16px; margin-bottom: 16px; }
  .panel h2 { font-size: 17px; }
  /* 横屏的门户：地图与目录并排更合适（高度太浅，单列会看不到地图） */
  .portal-main { display: grid !important; grid-template-columns: 1.05fr 1fr; gap: 16px; }
  .chapter-cards { order: 0; }
  .portal-map { order: 0; position: sticky; top: 10px; height: auto; min-height: 62vh; margin-top: 0; }
}

/* 详情面板里的实图（一个点可对应多张） */
.dt-pics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 8px 0 6px; }
.dt-pics img { width: 100%; height: 96px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); }
@media (max-width: 720px) {
  .dt-pics { grid-template-columns: repeat(3, 1fr); }
  .dt-pics img { height: 74px; }
}

/* 阅读进度条与手感动效（与 atlas-extra.css 同步写入，便于样式守卫扫描到） */
.readProgress {
  position: fixed; left: 0; top: 0; height: 2px; width: 0; z-index: 9998;
  background: linear-gradient(90deg, #e8b563, #f4c98a);
  box-shadow: 0 0 6px rgba(232, 181, 99, .7);
  transition: width .12s linear; pointer-events: none;
}
html { scroll-behavior: smooth; }
.panel, .ch-head, .ch-foot { transition: opacity .28s ease, transform .28s ease, border-color .28s ease; }
.panel.is-cur { transform: translateY(-2px); }
.detail { animation: dtIn .16s ease-out; }
@keyframes dtIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .tools button, .tool-link, .chnav a, .snav a, .nav-arrow {
    min-height: 40px; display: inline-flex; align-items: center; -webkit-tap-highlight-color: transparent;
  }
  .chnav, .snav { -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
  .dt-close { width: 34px; height: 34px; }
}
button, a { -webkit-tap-highlight-color: transparent; }

/* 载入态 / 回到顶部 / 详情上下条 */
.loadingVeil {
  position: fixed; inset: 0; z-index: 9997; display: flex; align-items: center; justify-content: center;
  background: var(--bg-1, #0b0e12); color: var(--gold, #e8b563);
  font-family: var(--serif, serif); font-size: 15px; letter-spacing: .18em;
  transition: opacity .35s ease; pointer-events: none;
}
.loadingVeil.is-off { opacity: 0; }
.toTop {
  position: fixed; right: 14px; bottom: 16px; z-index: 9996; display: none;
  padding: 8px 13px; border-radius: 999px; font-size: 12px;
  color: #e8b563; border: 1px solid rgba(232, 181, 99, .45); background: rgba(8, 11, 15, .86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.toTop.is-on { display: block; }
.dt-nav { display: flex; gap: 8px; padding: 6px 12px 0; }
.dt-nav button {
  flex: 1; padding: 6px 0; border-radius: 4px; font-size: 12px; color: #e8b563;
  border: 1px solid rgba(232, 181, 99, .35); background: rgba(244, 239, 230, .05);
}
.dt-nav button:disabled { opacity: .35; }
tr.is-sel, .is-sel { background: rgba(232, 181, 99, .16); }

/* ④ 尊重系统的"减少动效"设置 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* toTop 在手机上抬高：避免压住小节导航与图例 */
@media (max-width: 900px) {
  .toTop { bottom: 74px; right: 10px; padding: 7px 11px; font-size: 11.5px; }
}

/* 图集"显示更多/收起" */
.gallery-more {
  display: block; margin: 14px auto 4px; padding: 9px 18px; border-radius: 999px;
  font-size: 12.5px; color: #e8b563; border: 1px solid rgba(232, 181, 99, .45);
  background: rgba(244, 239, 230, .05);
}
.gallery-more:disabled { opacity: .45; }

/* 图集：懒加载网格 */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: 104px; object-fit: cover; border-radius: 3px;
  border: 1px solid rgba(244, 239, 230, .16); }
.gallery figcaption { display: block; margin-top: 4px; font-size: 11px; line-height: 1.5; }
.gallery figcaption b { display: block; color: var(--cream, #f4efe6); font-weight: 600; }
.gallery figcaption span { color: var(--faint, #8b8f93); }
@media (max-width: 720px) {
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .gallery img { height: 92px; }
}
