/* ============================================================
   岁时记 · 二十四节气数字长卷 —— 视觉系统
   设计语汇:宣纸 / 墨色 / 朱砂 / 传统色 / 竖排 / 印章 / 留白
   ============================================================ */

:root {
  --paper: #f6f1e7;
  --paper-deep: #efe7d8;
  --ink: #2a2521;
  --ink-soft: #6b6157;
  --ink-faint: #9a8f83;
  --cinnabar: #b43a2b;
  --cinnabar-deep: #932d20;
  --gold: #c8a15a;
  --spring: #6e8b5e;
  --summer: #c04851;
  --autumn: #c98a2d;
  --winter: #4e6e8e;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong",
           "STZhongsong", "SimSun", "FangSong", serif;
  --ease-ink: cubic-bezier(.22, .75, .25, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  background-color: var(--paper);
  color: var(--ink);
  line-height: 1.9;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--cinnabar); color: var(--paper); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--paper-deep); }
::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--cinnabar); }

img, canvas, svg { display: block; max-width: 100%; }
button { font-family: var(--serif); cursor: pointer; }

/* ---------- 全局画布与纹理层(z 层级:山水0 < 纸纹1 < 内容2 < 粒子3) ---------- */
#fx {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9;   /* 粒子飘在节气二级页(8)之上,如下雪时翻卷 */
}

.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* ---------- 背景山水层 ---------- */
#bg-scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.sky { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; }
.sky.on { opacity: 1; }
.sky-spring { background: linear-gradient(180deg, rgba(178,206,164,.5), rgba(246,241,231,0) 62%); }
.sky-summer { background: linear-gradient(180deg, rgba(150,196,206,.5), rgba(246,241,231,0) 62%); }
.sky-autumn { background: linear-gradient(180deg, rgba(230,206,158,.55), rgba(246,241,231,0) 62%); }
.sky-winter { background: linear-gradient(180deg, rgba(176,198,218,.55), rgba(246,241,231,0) 62%); }

.clouds { position: absolute; top: 5vh; left: 0; width: 100%; height: 18vh; }
.clouds .cloud { fill: #fff; }
.clouds .c1 { opacity: .55; animation: cloudDrift 95s linear infinite; }
.clouds .c2 { opacity: .42; animation: cloudDrift 130s linear infinite; animation-delay: -40s; }
.clouds .c3 { opacity: .6; animation: cloudDrift 75s linear infinite; animation-delay: -20s; }
@keyframes cloudDrift {
  from { transform: translateX(-30%); }
  to   { transform: translateX(130%); }
}

/* 山体在 .mtn-layer 内作静态流成员即可 —— 位置由 layer 的 bottom:0 决定,
   基座用 top:100% 贴在它底边,两者自然严丝合缝 */
.mtn { position: relative; display: block; left: auto; bottom: auto; width: 100%; will-change: transform; }
/* ============================================================
 * 远山随季换气
 * ------------------------------------------------------------
 * 原先三层山的填色写死成冷蓝灰。滚到秋之门户时,天色已转金,
 * 山还是冬天那副蓝,上下两截接不上;冬天进夏之门户,青碧的天
 * 底下卧着几座冷蓝的山,尤其别扭。
 * 故把三层的色相做成变量:相邻季节之间只是色温的推移,
 * 山形的墨色层次(远淡近浓)始终不变 —— 变的是"气",不是"骨"。
 * 未设 data-season 时,回落到冬天那套中性蓝,不致失形。
 * ============================================================ */
#bg-scene { --m1: 96,116,138; --m2: 72,92,112; --m3: 46,60,76; }
#bg-scene[data-season="spring"] { --m1: 116,140,92;  --m2: 88,114,70;  --m3: 58,82,50; }
#bg-scene[data-season="summer"] { --m1: 80,132,142;  --m2: 58,104,116; --m3: 36,72,86; }
#bg-scene[data-season="autumn"] { --m1: 156,124,74;  --m2: 124,94,52;  --m3: 88,64,34; }
#bg-scene[data-season="winter"] { --m1: 100,120,146; --m2: 76,96,118;  --m3: 48,64,84; }
.mtn-far  { height: 36vh; fill: rgba(var(--m1), .13); }
.mtn-mid  { height: 28vh; fill: rgba(var(--m2), .16); }
.mtn-near { height: 19vh; fill: rgba(var(--m3), .19); }
/* 天色与远山一并过渡,换季时才不会"山先变、天后变" */
#bg-scene .mtn { transition: fill 1.6s ease; }

/* ---------- 载入页 ---------- */
#loader {
  position: fixed; inset: 0;
  background: var(--paper);
  z-index: 100;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 28px;
  transition: opacity .9s var(--ease-ink), visibility .9s, clip-path 1.1s var(--ease-ink);
}
#loader.done { opacity: 0; visibility: hidden; clip-path: inset(50% 0 50% 0); }

/* ============================================================
 * 启卷 · 开场动画(一册线装本自深处推近,逐叶翻开)
 * ------------------------------------------------------------
 * 全部用原生 CSS 3D 实现,不引 GSAP 之类的库 ——
 * 本作品对外承诺"零依赖零构建",开场是所有人第一眼看到的东西,
 * 更不该为它破一次例。
 * 翻页原理:每一叶以左边缘为轴(transform-origin: left center)
 * 绕 Y 轴转到 -176°,叶的正反两面各占一半、背面预旋转 180°,
 * 配合 backface-visibility: hidden,便只看到朝上的那一面。
 * z-index 的切换延迟到转动的一半(0.41s)再生效 ——
 * 那一瞬间纸是侧视的,看不见,故堆叠顺序的重排不会被察觉。
 * ============================================================ */
/* 舞台按"摊开的双页"给宽度:单页 min(310px, 47vw)。
   书脊落在正中,未翻的叶在右半,翻过去的叶落到左半 ——
   这才是翻书,而不是把两页挤在一个单页的宽度里。 */
/* 尺寸用 aspect-ratio 而非固定高:书的宽高比是定的(单页约 1:1.42,
   接近纸张开本的 1:√2),让它随宽度自动定高,窄屏上才不会拉成一条瘦长条。 */
/* ============================================================
 * 启卷 · 书左侧的主标题(题签)
 * ------------------------------------------------------------
 * 原先是空的 —— 书浮在正中,左边一大片留白,开场缺个"门头"。
 * 做成竖排双列:主题在右、副题在左(传统行序自右向左),
 * 与线装本的分量相称,也给这一屏一个正式的名分。
 *
 * 定位锚在"书的左边缘再让开一段":
 *   书的左边缘在 50% - min(420px, 48vw) 处(舞台宽 min(840px,96vw)),
 *   故用 right: calc(50% + min(420px,48vw) + 让距) 把它贴在左空白里。
 * 窄屏没有余量(左右各需约 110px),1080px 以下直接隐藏。
 *
 * 命名必须避开 .ov-title-sub —— 那个类名封面副题已经在用
 * (绝对定位于封面框右下),撞名的后果是两边互相污染:
 * 实测副题被染成封面那套浅米色 rgba(246,241,231,.62),在米色纸面上看不见。
 * 故这里一律用 .ov-np-* (np = nameplate) 前缀。
 *
 * 竖排只写在容器上,不再套 flex:早前容器用 flex、子元素各自竖排,
 * 两套坐标轴打架 —— 主题与副题实测挤在同一处(l 113 vs 129),没有分成两列。
 * 容器本身竖排后,两个 block 子元素会自动沿水平轴自右向左排列。
 * ============================================================ */
.ov-nameplate {
  position: absolute;
  top: 50%;
  right: calc(50% + min(420px, 48vw) + clamp(26px, 3.6vw, 68px));
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: upright;
  margin: 0;
  color: var(--ink);
  opacity: 0;
  /* 比书晚半拍浮上来:书先到、名后落,不抢戏 */
  animation: ovNameIn 1.15s var(--ease-ink) .5s both;
}
@keyframes ovNameIn { from { opacity: 0; } to { opacity: 1; } }

.ov-np-main {
  display: block;
  font-family: var(--serif);
  font-size: clamp(21px, 2.1vw, 32px);
  letter-spacing: .16em;
  color: var(--ink);
}
.ov-np-sub {
  display: block;
  /* 竖排时 block 轴是水平的,故用 block-start 让出两列之间的空隙 */
  margin-block-start: clamp(9px, 1.1vw, 16px);
  font-size: clamp(10.5px, .92vw, 13.5px);
  letter-spacing: .14em;
  color: var(--ink-soft);
}
/* 窄屏无余量,隐藏 */
@media (max-width: 1080px) { .ov-nameplate { display: none; } }

.ov-stage {
  perspective: 1700px;
  perspective-origin: 50% 46%;
  width: min(840px, 96vw);
  aspect-ratio: 2 / 1.42;
}
.ov-book {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  opacity: 0;
  /* 三个量都走变量:入场时推近,第一叶翻动时整体左移四分之一 ——
     合着的书只有右半被盖住,故先让右半居中;翻开后双页对分,再移回正中。
     用变量而非 animation,是为了让"移位"与"入场"能各自过渡、互不覆盖。 */
  transform: translateX(var(--shift, -25%)) scale(var(--k, .74)) translateZ(var(--z, -190px));
  transition: transform 1s var(--ease-ink), opacity .9s var(--ease-ink);
}
.ov-book.in { --k: 1; --z: 0; opacity: 1; }
.ov-book.opened { --shift: 0%; }
/* 尾页:左边是「开启岁时」、右边是二十四气总表 ——
   若仍按双页摊开摆,有字的那一半就偏在左边,看着像没对齐。
   整册再右移四分之一,让有字的左半落到屏幕正中。
   窄屏例外:书上已占 96vw,再右移 25% 会把右半页整个推出屏外
   (实测 390px 下衬页 left 落在 289px),故窄屏归零不右移。 */
.ov-book.last { --shift: 25%; }

/* 书脊:正中一道深绫,左右各压一线朱砂 */
.ov-spine {
  position: absolute; left: 50%; top: 0;
  width: 13px; height: 100%;
  margin-left: -6.5px;
  background: linear-gradient(90deg, #1f1c18, #3a352e 45%, #1f1c18);
  box-shadow: 0 0 0 1px rgba(180, 58, 43, .38);
  transform: translateZ(-8px);
}

.ov-leaf {
  position: absolute; left: 50%; top: 0;
  width: 50%; height: 100%;
  transform-style: preserve-3d;
  transform-origin: left center;      /* 轴即书脊 */
  /* 分层必须用 translateZ,不能只靠 z-index:
     父级 .ov-book 是 preserve-3d,浏览器在这类容器里按"3D 空间中的实际深度"
     排序,同一平面上的 z-index 说了不算 —— 早前三叶翻完会叠在一起,根子在此。
     未翻:叶 0 在最前((N-i)*2px);翻过:顺序反过来(i*2px),
     于是左边那半永远显示最后翻过去的那一叶。
     N 由 JS 写成 --n(总叶数),15 叶时深度差仅 30px,透视畸变可忽略。 */
  transform: translateZ(calc((var(--n, 3) - var(--i)) * 2px)) rotateY(0deg);
  z-index: calc(10 - var(--i));
  /* 时长 360ms —— 必须与 index.html 里 overture() 的 TURN 一致,
     否则叶还没翻到位就切下一叶,视觉上会跳页。
     420ms 是旧值:并发在翻的面有六叶,弱 GPU 上主线程光栅不过来。
     360ms 后并发降到五叶,总时长反而更短(约 1.68s)。
     曲线取前段慢、后段快:cubic-bezier 的两个值都 <1,
     起步有重量、收尾干脆,像真的把纸甩过去,而不是匀速滑动。 */
  transition: transform .36s cubic-bezier(.36, .06, .22, 1), z-index 0s .18s;
  /* 15 叶同处一个 preserve-3d 上下文,不预告浏览器就会每叶重建图层,
     翻页时必掉帧。will-change 让它们提前各占一层,合成交给 GPU。 */
  will-change: transform;
  /* 注意:这里**不能**加 backface-visibility: hidden。
     两侧的翻转靠的是 .ov-face 自己的 backface-visibility(见下),
     册叶容器本身若也设 hidden,翻转后的叶子会失去点击命中 ——
     实测尾页「开启岁时」点不动,elementFromPoint 落在 .ov-backcover 上。
     一句话:backface 只加在"两面"上,不加在"装两面的壳"上。 */
}
.ov-leaf.turned {
  transform: translateZ(calc(var(--i) * 2px)) rotateY(-177deg);  /* 留 3° 不压平,纸才有厚度 */
  z-index: calc(var(--i) + 1);
}

.ov-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  /* 把每面的重绘关在自己盒子里:15 叶同翻时,一面上的文字变化
     不会连带隔壁面一起失效 —— 弱 GPU 上翻书发卡,大头就在这里 */
  contain: layout paint;
}
.ov-face--back { transform: rotateY(180deg); }
/* 书角:外圆内方。back 面被 rotateY(180°) 镜像过,
   同一条圆角规则渲染出来自然落在书口那一侧,不必另写。 */
.ov-face { border-radius: 4px 10px 10px 4px; }

/* ============================================================
 * 封面:一块描金的深墨纸
 * ------------------------------------------------------------
 * 原先封面只有一块深色,看着"古板、太空" —— 缺的不是内容,
 * 是"金"。中式装帧里,深色封面上必有一圈描金的框与角饰,
 * 这是眼睛认得出"讲究"的地方。故:双线金框 + 四角如意云头
 * + 上下回纹带,全部由 .ov-gilt 这一层 SVG 画出。
 * 内部三件(题签 / 押角印 / 副题)一律绝对定位,不用 flex ——
 * 竖排文本在 flex 里宽度受限会自己分列,顺序就乱了。
 * ============================================================ */
.ov-cover {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 30% 12%, rgba(200, 161, 90, .14), transparent 62%),
    linear-gradient(160deg, #3a342b, #232019 55%, #2b2721);
  overflow: hidden;
  border-radius: 4px 10px 10px 4px;
  box-shadow: inset 0 0 0 1px rgba(246, 241, 231, .12);
}
/* 内页纸面与页内排版 */
.ov-inner {
  background:
    linear-gradient(90deg, rgba(42, 37, 33, .14), rgba(42, 37, 33, .035) 9%, transparent 21%),
    linear-gradient(180deg, #fdfaf2, #f7f1e4);
  box-shadow: inset 0 0 0 1px rgba(42, 37, 33, .07);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  padding: clamp(24px, 4vmin, 44px) clamp(20px, 3.4vmin, 40px) clamp(24px, 4vmin, 44px) clamp(28px, 5vmin, 54px);
  text-align: center;
  color: var(--ink);
}
.ov-folio {
  position: absolute; right: 16px; bottom: 14px;
  font-size: 10.5px; letter-spacing: .1em;
  color: rgba(42, 37, 33, .34);
}
.ov-h {
  font-size: clamp(15px, 3vmin, 21px);
  font-weight: 600;
  letter-spacing: .26em; text-indent: .26em;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(42, 37, 33, .16);
}
.ov-list {
  font-size: clamp(12px, 2.4vmin, 15px);
  line-height: 2.1;
  letter-spacing: .06em;
  color: var(--ink);
}
.ov-note {
  font-size: clamp(10px, 1.9vmin, 12.5px);
  line-height: 1.95;
  letter-spacing: .08em;
  color: var(--ink-faint);
}
.ov-face--back .ov-folio { right: auto; left: 16px; }

/* 描金层:铺满封面,在题签之下 */
.ov-gilt {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
/* 题签:朱砂签条,竖排书名,钤在框内上半居中处 */
.ov-label {
  position: absolute;
  top: 9%; left: 50%;
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  text-orientation: upright;
  background: var(--cinnabar);
  color: #f6f1e7;
  font-size: clamp(18px, 3.2vmin, 26px);
  letter-spacing: .26em;
  line-height: 1;
  padding: 17px 9px;
  border-radius: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(246, 241, 231, .22);
}
/* 节气歌:竖排四句、四列,落在封面正中。
   封面原先中段是一大片空,题签在上、副题在下,中间什么都没有 ——
   补上这四句,空白有了内容,而且翻开的正是这二十四个名字。 */
.ov-couplet {
  position: absolute;
  left: 50%; top: 48%;
  transform: translate(-50%, -50%);
  margin: 0;
  writing-mode: vertical-rl;
  font-size: clamp(12px, 2.15vmin, 16px);
  letter-spacing: .3em;
  line-height: 2.1;
  color: rgba(200, 161, 90, .66);
  text-shadow: 0 0 10px rgba(200, 161, 90, .18);
  white-space: nowrap;
}

/* 副题:框内右下 */
.ov-title-sub {
  position: absolute;
  right: 11%; bottom: 11%;
  color: rgba(246, 241, 231, .62);
  font-size: clamp(11px, 2.2vmin, 14px);
  line-height: 2;
  letter-spacing: .2em;
  text-align: right;
}
/* 押角印:框内左下 */
.ov-stamp {
  position: absolute; left: 11%; bottom: 11%;
  width: clamp(38px, 5vmin, 48px); height: clamp(38px, 5vmin, 48px);
  display: grid; place-items: center;
  color: #f6f1e7; background: var(--cinnabar);
  font-size: clamp(12px, 1.5vmin, 15px); letter-spacing: 0;
  border-radius: 4px;
  transform: rotate(-4deg);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .32);
}


/* 跳过 */
.ov-skip {
  position: absolute; bottom: 6vh; left: 50%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-size: 12px; letter-spacing: .18em; text-indent: .18em;
  color: var(--ink-faint);
  background: none;
  border: 1px solid rgba(42, 37, 33, .2);
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
  transition: color .3s, border-color .3s;
}
/* 每季一色:青 / 赤 / 金 / 黛 —— 翻到哪一季,整页的色就换过去,
   颜色丰满了,翻动也才有了"过了一季"的实感。 */
.ov-inner--spring { background-image: linear-gradient(180deg, #fdfaf2, #f2f5e8); }
.ov-inner--summer { background-image: linear-gradient(180deg, #fdfaf2, #fbf0ee); }
.ov-inner--autumn { background-image: linear-gradient(180deg, #fdfaf2, #faf2e2); }
.ov-inner--winter { background-image: linear-gradient(180deg, #fdfaf2, #eef1f6); }
.ov-inner--spring, .ov-inner--summer, .ov-inner--autumn, .ov-inner--winter {
  background-image:
    linear-gradient(90deg, rgba(42, 37, 33, .14), rgba(42, 37, 33, .035) 9%, transparent 21%),
    var(--season-tint, linear-gradient(180deg, #fdfaf2, #f7f1e4));
}
.ov-inner--spring { --season-tint: linear-gradient(180deg, #fdfaf2, #eff4e6); }
.ov-inner--summer { --season-tint: linear-gradient(180deg, #fdfaf2, #fbeeea); }
.ov-inner--autumn { --season-tint: linear-gradient(180deg, #fdfaf2, #faf1de); }
.ov-inner--winter { --season-tint: linear-gradient(180deg, #fdfaf2, #ecf0f6); }

/* 二十四节气:三列两行,每名前置一枚季节色小点 */
.ov-terms {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: clamp(7px, 1.5vmin, 13px) clamp(9px, 2vmin, 18px);
  margin: 2px 0 2px;
}
.ov-terms span {
  position: relative;
  padding-left: 13px;
  font-size: clamp(12px, 2.5vmin, 15px);
  letter-spacing: .08em;
  color: var(--ink);
  white-space: nowrap;
}
.ov-terms span::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--sc, var(--ink-faint));
}
/* 二十四节气页:一叶两面,每面只放三样 —— 名(带序数)、三候、一句诗。
   册页只有单页宽,字必须克制;塞满反而看不清,不如留白。 */
.ov-term { gap: clamp(6px, 1.4vmin, 12px); }
.ov-h--term { font-size: clamp(17px, 3.6vmin, 26px); letter-spacing: .2em; text-indent: .2em; }
.ov-term-py {
  font-size: clamp(8.5px, 1.5vmin, 10.5px);
  letter-spacing: .18em;
  color: var(--ink-faint);
  margin: -4px 0 0;
}
.ov-hou {
  display: flex; flex-direction: column;
  gap: clamp(3px, .7vmin, 6px);
  margin: clamp(2px, .8vmin, 8px) 0;
}
.ov-hou span {
  position: relative;
  padding-left: 12px;
  font-size: clamp(10px, 1.9vmin, 12.5px);
  letter-spacing: .1em;
  color: var(--ink);
  text-align: left;
}
.ov-hou span::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 5px; height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: var(--sc, var(--ink-faint));
}
.ov-term-poem {
  font-size: clamp(9px, 1.7vmin, 11.5px);
  line-height: 1.85;
  letter-spacing: .06em;
  color: var(--ink-faint);
  margin: 0;
  max-width: 88%;
}
.ov-term-poem i {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: .86em;
  letter-spacing: .04em;
  opacity: .74;
}

/* 尾页:一册线装本的卷终交代。
   原先只有一行字 + 一枚按钮,右半衬页整片空白 —— 翻完像"没翻完"。
   故做厚三件事:九十六色色带(一眼看见"走过了多少颜色")、
   三项数字(节气/物候/色谱,各有实数)、一句收束的话。
   信息都取自 js/data.js 的 TERMS,不另编数字。 */
.ov-inner--last { gap: clamp(9px, 1.8vmin, 16px); }
.ov-last-kicker {
  font-size: clamp(13px, 2.7vmin, 17px);
  letter-spacing: .3em; text-indent: .3em;
  color: var(--ink);
  margin: 0;
}
/* 九十六色:24 气 × 4 色,排成一条细带。
   每格只 2~3px 宽 —— 目的是"数得出密度",不是"看得清色名"。 */
.ov-spectrum {
  display: flex;
  width: 100%;
  height: clamp(10px, 1.6vmin, 16px);
  border-radius: 1px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(42, 37, 33, .1);
}
.ov-spectrum i { flex: 1 1 0; display: block; }
/* 三项数字:横排三栏,字要小而清楚,不能抢了「开启岁时」 */
.ov-last-stat {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 3.4vmin, 34px);
  margin: clamp(2px, .6vmin, 6px) 0;
}
.ov-last-stat > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ov-last-stat dt {
  font-size: clamp(8.5px, 1.5vmin, 10.5px);
  letter-spacing: .22em; text-indent: .22em;
  color: var(--ink-faint);
}
.ov-last-stat dd {
  margin: 0;
  font-size: clamp(12px, 2.2vmin, 15px);
  letter-spacing: .1em;
  color: var(--ink);
}
.ov-last-line {
  font-size: clamp(11px, 2.1vmin, 13.5px);
  line-height: 2;
  letter-spacing: .12em;
  color: var(--ink-soft);
  margin: 0;
}
.ov-enter {
  font-family: var(--serif);
  font-size: clamp(14px, 3vmin, 18px);
  letter-spacing: .3em; text-indent: .3em;
  color: #f6f1e7;
  background: var(--cinnabar);
  border: none;
  border-radius: 3px;
  padding: 13px 30px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(180, 58, 43, .32);
  transition: transform .4s var(--ease-ink), box-shadow .4s, background .4s;
}
.ov-enter:hover {
  transform: translateY(-3px);
  background: var(--cinnabar-deep);
  box-shadow: 0 14px 30px rgba(180, 58, 43, .42);
}
.ov-enter:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.ov-enter:disabled { opacity: .55; cursor: default; transform: none; }

.ov-skip:hover { color: var(--cinnabar); border-color: var(--cinnabar); }
.ov-skip:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 3px; }

/* 手机上单页只剩一百八十来像素宽,内边距与字号必须一并收一档 ——
   否则「溯源 · 四季门户 · 节气罗盘」这种短句也要折行,读起来就碎了。 */
@media (max-width: 520px) {
  .ov-inner { gap: 8px; padding: 20px 10px 18px 22px; }
  .ov-cover { padding: 18px 14px; }
  .ov-stamp { left: 16px; bottom: 16px; }
  .ov-figs { gap: 12px; }
  .ov-figs b { font-size: 26px; }
  .ov-figs em { font-size: 9.5px; letter-spacing: .08em; }
  .ov-h { font-size: 14px; letter-spacing: .16em; text-indent: .16em; padding-bottom: 6px; }
  .ov-list { font-size: 11px; line-height: 1.95; }
  .ov-note { font-size: 9.5px; line-height: 1.8; }
  .ov-folio { font-size: 9.5px; bottom: 10px; }
  .ov-face--back .ov-folio { left: 10px; }
  .ov-folio { right: 10px; }
  .ov-skip { bottom: 4vh; font-size: 11.5px; padding: 7px 16px; }
}

/* ---------- 顶部进度与工具 ---------- */
#progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0;
  background: linear-gradient(90deg, var(--cinnabar), var(--gold));
  z-index: 30;
}

/* ---------- 中国风顶部导航 ---------- */
#cn-nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 25;
  display: flex; align-items: center; gap: 3vw;
  padding: 16px 34px;
  transition: padding .4s, background .4s, box-shadow .4s;
}
/* 导航吸顶后原本用 backdrop-filter: blur(10px) 做"毛玻璃"。
   导航是整条通栏且永远在视野里,浏览器于是每帧都要为它重算一遍背后
   整幅画面的模糊 —— 这是全页卡顿最重的一笔,而 .92 的底色已经几乎
   把模糊盖住,观感差别微乎其微。改为提高底色不透明度,去掉滤镜。 */
#cn-nav.solid {
  background: rgba(246, 241, 231, .97);
  box-shadow: 0 1px 0 rgba(42, 37, 33, .12);
  padding: 8px 34px;
}
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: none; }
.nav-seal {
  width: 40px; height: 40px;
  background: var(--cinnabar);
  color: var(--paper);
  display: grid; place-items: center;
  font-size: 15px; line-height: 1.1;
  border-radius: 6px;
  transform: rotate(-3deg);
  box-shadow: 3px 3px 0 rgba(42, 37, 33, .15);
  transition: transform .3s var(--ease-ink);
}
.nav-brand:hover .nav-seal { transform: rotate(3deg) scale(1.06); }
.nav-title { font-size: 19px; letter-spacing: .24em; line-height: 1.2; }
.nav-title small { display: block; font-size: 10.5px; letter-spacing: .3em; color: var(--ink-faint); }

.nav-menu { display: flex; align-items: center; gap: clamp(10px, 1.6vw, 26px); margin-left: auto; }
.nav-menu a {
  position: relative;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: .18em;
  padding: 8px 4px;
  transition: color .3s, transform .3s;
}
.nav-menu a::after {
  content: "";
  position: absolute; left: 50%; bottom: 0;
  width: 0; height: 6px;
  transform: translateX(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 8'%3E%3Cpath d='M2,5 Q15,1 30,4 T58,3 Q55,7.5 30,6.5 T2,5 Z' fill='%23b43a2b'/%3E%3C/svg%3E") no-repeat center / contain;
  transition: width .35s var(--ease-ink);
}
.nav-menu a:hover { color: var(--cinnabar); transform: translateY(-2px); }
.nav-menu a:hover::after, .nav-menu a.active::after { width: 118%; }
.nav-menu a.active { color: var(--cinnabar); font-weight: 600; }

.nav-actions { display: flex; align-items: center; gap: 12px; flex: none; }
#audio-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  background: rgba(246, 241, 231, .8);
  color: var(--ink-soft);
  font-size: 15px;
  transition: all .3s;
}
#audio-btn.on { border-color: var(--cinnabar); color: var(--cinnabar); }
#audio-btn:hover { transform: rotate(-8deg) scale(1.08); }

#nav-burger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px;
  border: 1px solid var(--ink-faint);
  border-radius: 6px;
  background: rgba(246, 241, 231, .8);
  padding: 0 9px;
}
#nav-burger i { height: 1.6px; background: var(--ink-soft); border-radius: 2px; transition: all .3s; }
#nav-burger.open i:nth-child(1) { transform: translateY(6.6px) rotate(45deg); }
#nav-burger.open i:nth-child(2) { opacity: 0; }
#nav-burger.open i:nth-child(3) { transform: translateY(-6.6px) rotate(-45deg); }

/* 移动端抽屉菜单 */
@media (max-width: 1080px) {
  .nav-menu {
    position: fixed; inset: 0;
    background: rgba(246, 241, 231, .985);
    flex-direction: column;
    justify-content: center;
    gap: 4vh;
    opacity: 0; visibility: hidden;
    transition: opacity .4s, visibility .4s;
    z-index: -1;
  }
  .nav-menu.open { opacity: 1; visibility: visible; z-index: 1; }
  .nav-menu a { font-size: 26px; letter-spacing: .4em; text-indent: .4em; }
  #nav-burger { display: flex; }
  .nav-title small { display: none; }
}

/* ---------- 通用面板与章节头 ---------- */
.panel { position: relative; z-index: 2; padding: 14vh 6vw; }
.panel-inner { max-width: 1180px; margin: 0 auto; }

.section-head {
  display: flex; align-items: center; gap: 22px;
  margin-bottom: 7vh;
}
.sec-no {
  flex: none;
  width: 58px; height: 58px;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font-size: 24px;
  border-radius: 6px;
  box-shadow: 4px 4px 0 rgba(42, 37, 33, .15);
}
.section-head h2 {
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 600;
  letter-spacing: .18em;
}
.section-head .sub {
  color: var(--ink-faint);
  font-size: 13px; letter-spacing: .28em;
  text-transform: uppercase;
  margin-top: 2px;
}
.sec-desc { max-width: 640px; color: var(--ink-soft); margin: -3vh 0 6vh; }

/* ---------- 序章 ---------- */
#hero {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding-top: 10vh;
}

/* 首屏的节气黄经盘。定位在首屏正中、标题之下,作为宣纸上的暗纹:
   透明度压到 7%~13%,正着看是一圈纹样,侧着看才发现是刻度。
   尺寸取 88vh,让盘的上下边缘刚好探出屏幕 —— 露出一段弧比露出整圆
   更像"印上去"的,也更像一具真的架在那里的仪器。 */
#hero-dial {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(76vh, 730px, 92vw); height: min(76vh, 730px, 92vw);
  z-index: 0; pointer-events: none;
  opacity: 0;
}
/* 盘的入场改为由 JS 在"入卷"那一刻才加 .in ——
   原先它一进页面就自己播,可那时还被开场盖着,白播一场。 */
#hero-dial.in { animation: dialIn 1.8s var(--ease-ink) .1s forwards; }
#hero-dial svg { display: block; width: 100%; height: 100%; }
#hero-dial .dial-name {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .34em;
  fill: var(--cinnabar);
  fill-opacity: .46;
}
@keyframes dialIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.93); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
/* 这面盘刻意不转。
   起初想让它 210 秒自转一圈,只要盯着看就会发现它是活的 ——
   但转起来指针就不再落在今日节气上了,一具会指错的仪器比一块静纹样更糟。
   准确性优先:盘是静的,只有入场时从 93% 涨到 100%,像一枚印正落下去。 */

.hero-inner { position: relative; z-index: 1; }

/* 入卷:开场收起的同时,首屏从下方整块升起。
   按「开启岁时」才播,故观者会觉得自己这一下按动了整卷。 */
body.ov-entering .hero-inner { opacity: 0; transform: translateY(56px) scale(.985); }
body.ov-entered .hero-inner { animation: heroIn 1.15s var(--ease-ink) .08s both; }
@keyframes heroIn {
  from { opacity: 0; transform: translateY(56px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.hero-kicker {
  font-size: clamp(12px, 1.4vw, 15px);
  letter-spacing: .5em; text-indent: .5em;
  color: var(--ink-soft);
  margin-bottom: 4vh;
}
.hero-kicker .line {
  display: inline-block; width: 52px; height: 1px;
  background: var(--ink-faint);
  vertical-align: middle; margin: 0 16px;
}
.hero-title {
  display: flex; justify-content: center; gap: clamp(14px, 3vw, 34px);
  font-size: clamp(84px, 17vw, 190px);
  font-weight: 700;
  line-height: 1.1;
  filter: url(#ink);
  margin-bottom: 3.5vh;
}
.hero-title span {
  display: inline-block;
  opacity: 0;
  animation: charIn 1.3s var(--ease-ink) forwards;
}
.hero-title span:nth-child(1) { animation-delay: .25s; }
.hero-title span:nth-child(2) { animation-delay: .55s; }
.hero-title span:nth-child(3) { animation-delay: .85s; }
@keyframes charIn {
  0%   { opacity: 0; transform: translateY(34px) scale(1.15); filter: blur(10px); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}
.hero-sub {
  font-size: clamp(17px, 2.2vw, 24px);
  letter-spacing: .6em; text-indent: .6em;
  color: var(--ink);
  margin-bottom: 1.6vh;
}
/* 浮签里的黄经读数:等宽数字 + 更细的字距,一眼就是"仪表"而非句子 */
#today-chip .chip-lon {
  display: inline-block;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(42, 37, 33, .18);
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  color: var(--ink-faint);
}
.hero-en {
  font-size: 12px; letter-spacing: .3em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 5vh;
}
#today-chip {
  display: inline-flex; align-items: center; gap: 14px;
  border: 1px solid var(--ink-faint);
  padding: 10px 26px;
  border-radius: 999px;
  font-size: 14px; letter-spacing: .15em;
  color: var(--ink-soft);
  background: rgba(255, 252, 245, .65);
  cursor: pointer;
  transition: all .35s;
}
#today-chip:hover { border-color: var(--cinnabar); color: var(--cinnabar); transform: translateY(-2px); }
#today-chip b { color: var(--cinnabar); font-size: 17px; letter-spacing: .1em; }
.scroll-hint {
  position: absolute; bottom: 5vh; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--ink-faint);
  font-size: 12px; letter-spacing: .4em;
  writing-mode: vertical-rl;
}
.scroll-hint::after {
  content: "";
  width: 1px; height: 56px;
  background: linear-gradient(var(--ink-faint), transparent);
  animation: hintDrop 1.8s ease-in-out infinite;
}
@keyframes hintDrop {
  0% { transform: scaleY(0); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: top; }
  56% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- 溯源 ---------- */
.origin-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 5vw;
  align-items: center;
}
.origin-text p { margin-bottom: 1.4em; color: var(--ink-soft); text-align: justify; }
.origin-text p b { color: var(--ink); }
.origin-text .lede {
  font-size: clamp(17px, 1.8vw, 20px);
  color: var(--ink);
}
.song-box {
  border-left: 3px solid var(--cinnabar);
  background: rgba(255, 252, 245, .6);
  padding: 18px 24px;
  margin: 2em 0;
  font-size: 17px; letter-spacing: .12em;
}
.song-box small { display: block; margin-top: 8px; color: var(--ink-faint); font-size: 12px; letter-spacing: .2em; }
.badge-unesco {
  display: inline-flex; align-items: center; gap: 12px;
  border: 1px solid var(--gold);
  color: #8a6a2b;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 13.5px; letter-spacing: .1em;
  background: rgba(200, 161, 90, .08);
}
.orbit-wrap { position: relative; }
#orbit { width: 100%; aspect-ratio: 1; cursor: crosshair; }
.orbit-tip {
  text-align: center;
  color: var(--ink-faint);
  font-size: 12.5px; letter-spacing: .25em;
  margin-top: 8px;
}

/* ---------- 四季门户(主页面) ---------- */
.season-portal {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.season-big {
  position: absolute;
  font-size: clamp(200px, 42vw, 480px);
  font-weight: 700;
  line-height: 1;
  opacity: .1;
  user-select: none;
  will-change: transform;
}
.season[data-season="spring"] .season-big { color: var(--spring); }
.season[data-season="summer"] .season-big { color: var(--summer); }
.season[data-season="autumn"] .season-big { color: var(--autumn); }
.season[data-season="winter"] .season-big { color: var(--winter); }
.portal-inner { position: relative; width: min(1180px, 92vw); }

.season-meta { text-align: center; margin-bottom: clamp(30px, 5vh, 54px); }
.season-meta .sec-no { margin: 0 auto 18px; }
.season-meta h2 { font-size: clamp(30px, 4.6vw, 52px); letter-spacing: .4em; text-indent: .4em; margin-bottom: 16px; }
.season-line { font-size: clamp(16px, 2vw, 21px); letter-spacing: .35em; text-indent: .35em; color: var(--cinnabar); margin-bottom: 12px; }
.season-desc { max-width: 520px; margin: 0 auto; color: var(--ink-soft); }
.portal-hint {
  margin-top: 18px;
  font-size: 12.5px; letter-spacing: .34em; text-indent: .34em;
  color: var(--ink-faint);
}
.portal-hint::before, .portal-hint::after { content: "—"; margin: 0 12px; opacity: .5; }

/* ---------- 节气牌(宽幅画卷卡,悬停浮签,点击展开二级页) ---------- */
.term-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 1.9vw, 26px);
}

/* ============================================================
 * 节气牌 v2:不再是瘦长条,是一幅"横卷"
 * ------------------------------------------------------------
 * 原先六列小牌,牌内只有几行字,看着"瘦小"。参考画谱的版式是
 * 三列宽幅:上画下题 —— 画是横构图小景,题是「大字节气名 +
 * 右侧四字短语 + 一行七言」。故整块重排:
 *   ① 画幅铺满牌宽,牌面即画心,不再另垫白底;
 *   ② 画角右下一枚朱印(牌名竖排),仿画上钤印;
 *   ③ 题款一栏:名左、四字短语右,短语取该节气传统色深档;
 *   ④ 七言一行灰墨压底,如画上题跋。
 * 拼音/日期/黄经移入悬停浮签,牌面只留最干净的四个元素。
 * ============================================================ */
.term-tile {
  position: relative;
  display: flex; flex-direction: column;
  padding: 10px 10px 0;
  background: rgba(253, 250, 241, .88);
  border: 1px solid rgba(42, 37, 33, .16);
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--serif);
  color: var(--ink);
  text-align: left;
  transition: transform .45s var(--ease-ink), box-shadow .45s, border-color .45s;
}
.term-tile:hover, .term-tile:focus-visible {
  transform: translateY(-9px);
  border-color: rgba(180, 58, 43, .45);
  background: #fffdf6;
  box-shadow: 0 20px 40px rgba(42, 37, 33, .16);
  outline: none;
  z-index: 5;
}

/* 画心:插画铺满牌宽,靠 SVG 固有比例(200×125)自撑高度 */
.tile-art-box {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 2px;
  pointer-events: none;
}
.tile-art-box .term-art {
  display: block;
  width: 100%; height: auto;
  transition: transform .55s var(--ease-ink);
  /* 悬停推近走合成器:提前升为独立层,免得 200+ 节点的大 SVG
     在 hover 过渡期间逐帧重绘 —— 卡顿就卡在这里 */
  will-change: transform;
}
/* 纸帘:展卷动画的遮幅。旧方案对 SVG 做 clip-path 逐帧重绘,
   二十四幅一起动时主线程吃不消;改为一块纸色帘子向右抽走,
   动画全程只有 transform,走合成器,与牌的飘入同帧也不卡。 */
.tile-veil {
  position: absolute; inset: -1px;
  background: #fdfaf1;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
}
/* 悬停时画幅微微推近一寸:牌浮起,画也跟着走近 */
.term-tile:hover .tile-art-box .term-art,
.term-tile:focus-visible .tile-art-box .term-art { transform: scale(1.05); }

/* 画角朱印:竖排牌名,仿画上钤印 */
.tile-stamp {
  position: absolute; right: 8px; bottom: 8px;
  width: 27px; height: 27px;
  display: grid; place-items: center;
  writing-mode: vertical-rl; text-orientation: upright;
  font-size: 10.5px; line-height: 1; font-style: normal;
  letter-spacing: .06em;
  color: #fff8ee;
  background: var(--cinnabar);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(180, 58, 43, .35);
  transform: rotate(-2.5deg);
  transition: transform .45s var(--ease-ink);
}
.term-tile:hover .tile-stamp { transform: rotate(2.5deg) scale(1.08); }
.term-tile.today .tile-stamp { animation: sealBreath 2.8s ease-in-out infinite; }

/* 题款:名左 / 四字短语右 */
.tile-cap {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 5px 0;
}
.tile-name {
  font-size: 21px; letter-spacing: .16em; text-indent: .04em;
  /* 24 枚牌名各自跑一个 5s 无限浮动 —— 常驻动画在低端平板上是纯开销。
     改为「悬停/聚焦才浮」:该看的时候才动,静止时零成本。 */
}
.term-tile:hover .tile-name,
.term-tile:focus-visible .tile-name {
  animation: tileFloat 5s ease-in-out infinite;
  animation-delay: calc(var(--f, 0) * .6s);
}
.tile-motto {
  margin-left: auto;
  font-style: normal;
  font-size: 12.5px; letter-spacing: .14em;
  color: var(--tc2, var(--cinnabar));
}
/* 题跋:一行七言,灰墨压底 */
.tile-line {
  display: block;
  padding: 4px 5px 13px;
  font-size: 11.5px; letter-spacing: .05em;
  color: var(--ink-faint);
}

.tile-ribbon {
  position: absolute; top: -9px; right: -7px;
  font-size: 10.5px; letter-spacing: .18em;
  color: var(--paper);
  background: var(--cinnabar);
  border-radius: 999px;
  padding: 3px 10px 3px 12px;
  box-shadow: 0 4px 10px rgba(180, 58, 43, .35);
}
/* 今日之牌:三面描朱,画角印随之呼吸 ——
   高的是"今日"这件事,不是把节气色盖掉。 */
.term-tile.today {
  border-color: rgba(180, 58, 43, .5);
}

@keyframes tileFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes sealBreath {
  0%, 100% { box-shadow: 0 2px 6px rgba(180, 58, 43, .35); }
  50% { box-shadow: 0 2px 6px rgba(180, 58, 43, .35), 0 0 0 5px rgba(180, 58, 43, .16); }
}

/* 悬停浮卡 */
.tile-pop {
  position: absolute;
  left: 50%; bottom: calc(100% + 14px);
  transform: translate(-50%, 8px);
  width: min(258px, 72vw);
  display: block;
  padding: 15px 17px 13px;
  background: #fffdf6;
  border: 1px solid rgba(42, 37, 33, .16);
  border-top: 3px solid var(--cinnabar);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(42, 37, 33, .22);
  opacity: 0; visibility: hidden;
  pointer-events: none;
  transition: opacity .35s var(--ease-ink), transform .35s var(--ease-ink), visibility .35s;
  text-align: left;
  z-index: 30;
}
.tile-pop::after {          /* 指向牌面的小三角 */
  content: "";
  position: absolute; left: 50%; top: 100%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #fffdf6;
}
.term-tile:hover .tile-pop, .term-tile:focus-visible .tile-pop {
  opacity: 1; visibility: visible;
  transform: translate(-50%, 0);
}
.tile-pop b { font-size: 15.5px; letter-spacing: .2em; }
.tile-pop em {
  display: block; font-style: normal;
  font-size: 11px; letter-spacing: .08em;
  color: var(--cinnabar); margin: 4px 0 8px;
}
.tile-pop .tile-hou {
  display: block;
  font-size: 12px; line-height: 1.9;
  color: var(--ink-soft); letter-spacing: .06em;
  border-top: 1px dashed rgba(42, 37, 33, .14);
  padding-top: 8px;
}
.tile-pop .tile-hou i {
  font-style: normal;
  color: var(--gold);
  margin-right: 7px;
  letter-spacing: .1em;
}
.tile-pop q {
  display: block; margin-top: 8px;
  font-size: 12.5px; line-height: 1.75;
  color: var(--ink); letter-spacing: .04em;
  quotes: "「" "」";
}
.tile-pop small {
  display: block; margin-top: 9px;
  font-size: 10.5px; letter-spacing: .2em;
  color: var(--ink-faint); text-align: right;
}

/* ---------- 节气二级页(沉浸式卷页) ---------- */
#term-page { position: fixed; inset: 0; z-index: 8; }
#term-page[hidden] { display: none; }
/* 二级页的遮罩原本还带一层 backdrop-filter。它盖的是整屏,
   而身后的粒子画布仍在逐帧重绘 —— 于是每帧都要重算一次整屏模糊,
   二级页里翻页、滚动的发涩都出在这里。改为把遮罩本身加深一点,
   一样压得住背景,却不用滤镜。 */
.tp-backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(42, 37, 33, .5), rgba(42, 37, 33, .76));
  opacity: 0; transition: opacity .4s;
}
#term-page.open .tp-backdrop { opacity: 1; }

.tp-sheet {
  --tp-accent: var(--cinnabar);
  position: absolute; left: 50%; top: calc(50% + 18px);   /* 让开顶部导航 */
  transform: translate(-50%, -46%) scale(.96);
  width: min(1060px, 94vw);
  max-height: calc(100vh - 118px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(rgba(255, 253, 246, .96), rgba(255, 253, 246, .96)),
    var(--paper);
  border: 1px solid rgba(42, 37, 33, .2);
  border-radius: 10px;
  box-shadow: 0 40px 90px rgba(20, 17, 14, .45);
  padding: clamp(24px, 4vh, 46px) clamp(22px, 4vw, 56px);
  opacity: 0;
  transition: opacity .45s var(--ease-ink), transform .45s var(--ease-ink);
}
#term-page.open .tp-sheet { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.tp-sheet.flip { opacity: .12; transform: translate(-50%, -50%) scale(.985) translateY(8px); }
.tp-sheet::-webkit-scrollbar { width: 8px; }
.tp-sheet::-webkit-scrollbar-thumb { background: rgba(42, 37, 33, .2); border-radius: 4px; }

#term-page[data-season="spring"] .tp-sheet { --tp-accent: var(--spring); }
#term-page[data-season="summer"] .tp-sheet { --tp-accent: var(--summer); }
#term-page[data-season="autumn"] .tp-sheet { --tp-accent: var(--autumn); }
#term-page[data-season="winter"] .tp-sheet { --tp-accent: var(--winter); }
.tp-sheet::before {          /* 顶部季节色绸带 */
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--tp-accent), transparent);
  opacity: .8;
}

#tp-close {
  position: absolute; right: 14px; top: 12px;
  width: 38px; height: 38px;
  border: 1px solid rgba(42, 37, 33, .2);
  border-radius: 50%;
  background: rgba(255, 253, 246, .9);
  color: var(--ink-soft);
  font-size: 20px; line-height: 1;
  cursor: pointer;
  transition: all .3s;
  z-index: 3;
}
#tp-close:hover { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--paper); transform: rotate(90deg); }

.tp-body {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 54px);
}

.tp-visual {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px;
  padding-top: 6px;
}
.tp-vertical {
  writing-mode: vertical-rl;
  font-size: clamp(56px, 7vw, 88px);
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1;
  color: var(--ink);
  animation: tileFloat 6s ease-in-out infinite;
}
.tp-seal {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  font-size: 17px; line-height: 1.05;
  background: var(--cinnabar);
  color: var(--paper);
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(42, 37, 33, .18);
  transform: rotate(-3deg);
}
#term-page.today .tp-seal { animation: sealBreath 2.8s ease-in-out infinite; }
.tp-py { font-size: 13px; letter-spacing: .3em; color: var(--ink-soft); }
.tp-en { font-size: 11px; letter-spacing: .12em; color: var(--ink-faint); text-align: center; }

.tp-info { min-width: 0; }
.tp-meta {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-size: 12.5px; letter-spacing: .12em;
  color: var(--ink-soft);
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(42, 37, 33, .12);
  margin-bottom: 20px;
}
.tp-meta span { display: inline-flex; align-items: center; gap: 7px; }
.tp-meta span::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--tp-accent);
  transform: rotate(45deg);
}
.tp-desc { font-size: clamp(15.5px, 1.55vw, 17.5px); line-height: 2; margin-bottom: 24px; }

/* ---------- 三候卡:物候白描 + 候名 + 阅典故 ----------
 * 由 .tp-hou > div 改为 button:整张卡可点开三级典故层。
 * 白描线条由 --hou-c 取节气次色的加深值,浅色系节气(白露、大雪)
 * 也能看清笔画;墨色一律走 currentColor,不写死颜色。 */
.tp-hou {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.tp-hou-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  padding: 15px 12px 12px;
  border: 1px dashed rgba(42, 37, 33, .25);
  border-top: 3px solid rgba(42, 37, 33, .3);
  border-radius: 10px;
  background: rgba(246, 241, 231, .5);
  font-family: var(--serif);
  text-align: center;
  cursor: pointer;
  transition: transform .35s var(--ease-ink), box-shadow .35s, border-color .35s;
}
.tp-hou-item .hou-fig {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  margin-bottom: 9px;
  border: 1px solid;
  border-radius: 50%;
  background: #fffdf6;
  transition: box-shadow .35s var(--ease-ink), transform .35s var(--ease-ink);
}
.tp-hou-item .hou-ico { width: 32px; height: 32px; }
.tp-hou-item b {
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .26em; text-indent: .26em;
  color: var(--hou-c);
  opacity: .9;
}
.tp-hou-item > span { font-size: 15px; letter-spacing: .12em; color: var(--ink); }
.tp-hou-item em {
  width: 100%;
  margin-top: 9px; padding-top: 7px;
  border-top: 1px dashed rgba(42, 37, 33, .16);
  font-style: normal;
  font-size: 10.5px; letter-spacing: .18em; text-indent: .18em;
  color: var(--ink-faint);
  transition: color .35s;
}
.tp-hou-item:hover {
  transform: translateY(-4px);
  border-color: var(--hou-c);
  box-shadow: 0 12px 26px rgba(42, 37, 33, .12);
}
.tp-hou-item:hover .hou-fig { transform: scale(1.06); box-shadow: 0 0 0 4px rgba(42, 37, 33, .05); }
.tp-hou-item:hover em { color: var(--hou-c); }
.tp-hou-item.reading { border-color: var(--hou-c); background: #fffdf6; }
.tp-hou-item.reading em { color: var(--hou-c); }

.tp-poem {
  position: relative;
  background: rgba(255, 252, 245, .75);
  border: 1px solid rgba(42, 37, 33, .1);
  border-left: 3px solid var(--cinnabar);
  padding: 20px 26px;
  margin-bottom: 22px;
}
.tp-poem p { font-size: clamp(16px, 1.75vw, 20px); letter-spacing: .12em; line-height: 2; }
.tp-poem cite {
  display: block; text-align: right;
  font-style: normal;
  color: var(--ink-faint);
  font-size: 13px; margin-top: 10px;
  letter-spacing: .1em;
}

/* ---------- 节气二级页:立轴图景与行事卡 ---------- */
.tp-scroll {
  width: min(200px, 60vw);
  padding: 10px 10px 6px;
  border: 1px solid rgba(42, 37, 33, .2);
  box-shadow: 0 12px 30px rgba(42, 37, 33, .14), inset 0 0 0 4px rgba(255, 253, 246, .9);
  position: relative;
}
.tp-scroll::before, .tp-scroll::after {   /* 天杆与地轴 */
  content: "";
  position: absolute; left: -7px; right: -7px;
  height: 6px; border-radius: 3px;
  background: linear-gradient(180deg, #3a332d, #201b17);
  box-shadow: 0 2px 5px rgba(20, 17, 14, .35);
}
.tp-scroll::before { top: -9px; }
.tp-scroll::after { bottom: -9px; }
.tp-scroll-mat {
  background: #fffdf6;
  border: 1px solid rgba(42, 37, 33, .12);
  padding: 6px;
}
.tp-scene { width: 100%; height: auto; display: block; }
.tp-scroll-cap {
  text-align: center;
  font-size: 11px; letter-spacing: .22em;
  color: var(--ink-soft);
  padding: 7px 0 3px;
}

/* 图景微动效 */
.sc-drift { animation: scDrift 5s ease-in-out infinite alternate; }
@keyframes scDrift { from { transform: translateY(-4px); } to { transform: translateY(6px); } }
.sc-glow { animation: scPulse 2.6s ease-in-out infinite; }
@keyframes scPulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.sc-rain { animation: scRainFall 1.5s linear infinite; }
@keyframes scRainFall { to { stroke-dashoffset: -68; } }

/* 岁时行事卡 */
.tp-acts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.tp-act {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: var(--act, rgba(42, 37, 33, .06));
  border: 1px dashed rgba(42, 37, 33, .22);
  border-radius: 8px;
  padding: 11px 13px;
  font-family: var(--serif);
  font-size: 13.5px; letter-spacing: .08em;
  text-align: left;
  cursor: pointer;
  transition: transform .35s var(--ease-ink), box-shadow .35s, border-color .35s;
}
.tp-act.reading { border-style: solid; border-color: currentColor; background: #fffdf6; }
.tp-act i {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: #fffdf6;
  border: 1px solid rgba(42, 37, 33, .16);
  border-radius: 50%;
}
.tp-act i svg { width: 18px; height: 18px; }
.tp-act:hover {
  transform: translateY(-3px);
  border-color: currentColor;
  box-shadow: 0 10px 22px rgba(42, 37, 33, .12);
}
.tp-act span { line-height: 1.5; }

/* 分节标题 */
.tp-sec {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; font-weight: 600;
  letter-spacing: .3em;
  color: var(--ink-soft);
  margin: 26px 0 14px;
}
.tp-sec::before, .tp-sec::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(42, 37, 33, .22), transparent);
}

.tp-badges {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}

/* 节气设色:整体居中。四个色块若靠左悬空,与居中排布的
   三候、诗词、行事三节对不齐,页脚会显得歪。 */
.tp-colors { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.swatch {
  width: 64px;
  cursor: pointer;
  text-align: center;
  transition: transform .3s var(--ease-ink);
}
.swatch:hover { transform: translateY(-5px); }
.swatch i {
  display: block;
  width: 64px; height: 64px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(42, 37, 33, .1), 3px 3px 8px rgba(42, 37, 33, .12);
  margin-bottom: 7px;
}
.swatch small { font-size: 12px; color: var(--ink-soft); letter-spacing: .05em; }
.swatch em { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-faint); letter-spacing: .04em; }

/* ============================================================
 * 三级页 · 典故层
 * ------------------------------------------------------------
 * 挂在 body 上而非卷页之内:#term-page 自身是 z-index 8 的层叠上下文,
 * 弹层若放在其中,导航(25)、导览员(40)、粒子(9)都会压在它上面。
 * 逐层收起:ESC 先收典故层,再按一次才收卷页。
 * ============================================================ */
.tp-detail {
  position: fixed; inset: 0; z-index: 68;
  display: grid; place-items: center;
  padding: 22px;
}
.tp-detail[hidden] { display: none; }
.tp-detail-mask {
  position: absolute; inset: 0;
  background: rgba(26, 22, 18, .46);
  opacity: 0; transition: opacity .34s var(--ease-ink);
}
.tp-detail.on .tp-detail-mask { opacity: 1; }

.tp-detail-card {
  position: relative;
  width: min(620px, 94vw);
  max-height: min(84vh, 790px);
  overflow: hidden;
  padding: 26px 32px 20px;
  background: #fffdf6;
  border-top: 3px solid var(--cinnabar);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(20, 17, 14, .42);
  opacity: 0; transform: translateY(22px) scale(.975);
  transition: opacity .36s var(--ease-ink), transform .36s var(--ease-ink);
}
.tp-detail.on .tp-detail-card { opacity: 1; transform: none; }

.tp-detail-x {
  position: absolute; top: 13px; right: 15px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid rgba(42, 37, 33, .2); border-radius: 50%;
  background: none; color: var(--ink-soft); cursor: pointer;
  font-family: var(--serif); font-size: 17px; line-height: 1;
  transition: all .3s;
}
.tp-detail-x:hover { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--paper); }

.tp-detail-hd {
  display: flex; align-items: center; gap: 16px;
  padding-right: 38px;
  margin-bottom: 18px;
}
.tp-detail-fig {
  flex: none;
  width: 68px; height: 68px;
  display: grid; place-items: center;
  border: 1px solid rgba(42, 37, 33, .2);
  border-radius: 50%;
  background: #fffdf6;
}
.tp-detail-fig .hou-ico { width: 40px; height: 40px; }
.tp-detail-fig > svg { width: 32px; height: 32px; }
.tp-detail-kind { font-size: 11.5px; letter-spacing: .24em; color: var(--ink-faint); }
.tp-detail-meta h4 {
  margin: 4px 0 3px;
  font-size: clamp(22px, 2.6vw, 30px); font-weight: 600;
  letter-spacing: .2em; text-indent: .2em;
  color: var(--ink);
}
.tp-detail-from { font-size: 12px; letter-spacing: .1em; color: var(--ink-faint); }

.tp-detail-bd {
  max-height: 50vh;
  overflow: auto;
  padding-right: 6px;
}
.dl-sec { margin-bottom: 18px; }
.dl-sec[hidden] { display: none; }
.dl-sec h5 {
  font-size: 12.5px; font-weight: 600;
  letter-spacing: .3em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.dl-sec p {
  font-size: 14.5px; line-height: 2.05; letter-spacing: .03em;
  color: var(--ink);
  text-align: justify;
}
.dl-ref {
  display: block; text-align: right;
  font-style: normal; font-size: 12.5px; letter-spacing: .06em;
  color: var(--ink-faint);
  border-top: 1px dashed rgba(42, 37, 33, .14);
  padding-top: 10px;
  min-height: 1px;
}
.tp-detail-ft {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid rgba(42, 37, 33, .1);
}
.dl-nav {
  font-family: var(--serif);
  font-size: 12.5px; letter-spacing: .12em;
  padding: 7px 16px;
  border: 1px solid rgba(42, 37, 33, .22);
  border-radius: 999px;
  background: none; color: var(--ink-soft); cursor: pointer;
  transition: all .3s;
}
.dl-nav i { font-style: normal; }
.dl-nav:hover:not(:disabled) { border-color: var(--cinnabar); color: var(--cinnabar); }
.dl-nav:disabled { opacity: .3; cursor: not-allowed; }

.tp-switch {
  display: flex; justify-content: space-between; gap: 14px;
  margin-top: 30px;
  border-top: 1px dashed rgba(42, 37, 33, .16);
  padding-top: 18px;
}
.tp-switch button {
  display: inline-flex; align-items: center; gap: 12px;
  background: none; border: 1px solid rgba(42, 37, 33, .2);
  border-radius: 10px;
  padding: 9px 18px;
  font-family: var(--serif);
  font-size: 12.5px; letter-spacing: .1em;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .35s;
  text-align: left;
}
.tp-switch button i { font-style: normal; font-size: 16px; color: var(--tp-accent); transition: transform .35s; }
.tp-switch button b { font-size: 14px; letter-spacing: .18em; color: var(--ink); font-weight: 600; }
.tp-switch button:hover { border-color: var(--tp-accent); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(42, 37, 33, .1); }
.tp-switch button:first-child:hover i { transform: translateX(-4px); }
.tp-switch button:last-child:hover i { transform: translateX(4px); }

body.tp-open { overflow: hidden; }

/* ---------- 溯源 · 时间线 ---------- */
.timeline-wrap { margin-top: clamp(40px, 7vh, 84px); }
.tl-title {
  text-align: center;
  font-size: clamp(19px, 2.2vw, 25px);
  letter-spacing: .3em; text-indent: .3em;
  margin-bottom: clamp(36px, 6vh, 64px);
}
.tl-title span {
  display: block;
  font-size: 12.5px; letter-spacing: .3em;
  color: var(--ink-faint);
  margin-top: 12px;
}

#timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 0 6px;
}
#timeline::before {          /* 墨线:入卷后自左向右生长 */
  content: "";
  position: absolute; left: 2%; right: 2%; top: 9px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(42, 37, 33, .45) 6%, rgba(42, 37, 33, .45) 94%, transparent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1.6s var(--ease-ink);
}
#timeline.in::before { transform: scaleX(1); }

.tl-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding-top: 0;
  outline: none;
}
.tl-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid rgba(42, 37, 33, .35);
  box-shadow: 0 0 0 3px rgba(246, 241, 231, .9);
  position: relative; z-index: 1;
  transition: all .5s var(--ease-ink);
  transition-delay: calc(var(--i) * 180ms);
}
#timeline.in .tl-dot {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  box-shadow: 0 0 0 3px rgba(246, 241, 231, .9), 0 0 0 7px rgba(180, 58, 43, .14);
}
.tl-item:hover .tl-dot, .tl-item:focus-visible .tl-dot {
  transform: scale(1.35);
  box-shadow: 0 0 0 3px rgba(246, 241, 231, .9), 0 0 0 9px rgba(180, 58, 43, .2);
}

.tl-year {
  margin-top: 13px;
  font-size: 12px; letter-spacing: .1em;
  color: var(--ink-soft);
}

.tl-card {
  position: absolute;
  left: 50%; top: calc(100% + 8px);
  transform: translate(-50%, 10px);
  width: min(240px, 60vw);
  background: #fffdf6;
  border: 1px solid rgba(42, 37, 33, .16);
  border-top: 3px solid var(--gold);
  border-radius: 8px;
  padding: 14px 16px 12px;
  box-shadow: 0 18px 40px rgba(42, 37, 33, .22);
  opacity: 0; visibility: hidden;
  pointer-events: none;
  transition: opacity .35s var(--ease-ink), transform .35s var(--ease-ink), visibility .35s;
  z-index: 20;
  text-align: left;
}
.tl-item:hover .tl-card, .tl-item:focus-visible .tl-card {
  opacity: 1; visibility: visible;
  transform: translate(-50%, 0);
}
.tl-card em {
  font-style: normal;
  display: inline-block;
  font-size: 10.5px; letter-spacing: .24em;
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 8px;
}
.tl-card h4 { font-size: 15px; letter-spacing: .14em; margin-bottom: 6px; }
.tl-card p { font-size: 12.5px; line-height: 1.85; color: var(--ink-soft); letter-spacing: .03em; }

/* ---------- 滚动显现动画 ---------- */
/* 滚动入场:位移与缩放一并给足,缓动末端留一点过冲 ——
   "蹦出来"的手感就来自这一下回弹。 */
.reveal {
  opacity: 0;
  transform: translateY(88px) scale(.982);
  transition: opacity 1.05s var(--ease-ink), transform 1.05s cubic-bezier(.2, 1.14, .34, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- 节气罗盘 ---------- */
.compass-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 4vw;
  align-items: center;
  max-width: 1180px; margin: 0 auto;
}
#compass svg { width: 100%; height: auto; }
.wedge { cursor: pointer; transition: opacity .3s; }
.wedge:hover path { fill: var(--cinnabar); }
.wedge.now path { fill: var(--ink); }
.wedge.sel path { fill: var(--cinnabar); }
#wheel-rot { transition: transform .9s var(--ease-ink); }

#compass-panel {
  background: rgba(255, 252, 245, .72);
  border: 1px solid rgba(42, 37, 33, .14);
  border-radius: 8px;
  padding: 34px 36px;
  min-height: 480px;
  box-shadow: 6px 6px 0 rgba(42, 37, 33, .07);
}
#compass-panel h3 { font-size: 30px; letter-spacing: .3em; margin-bottom: 2px; }
#compass-panel .cp-en { color: var(--ink-faint); font-size: 12.5px; letter-spacing: .2em; display: block; margin-bottom: 16px; }
#compass-panel .cp-meta { font-size: 13px; color: var(--ink-soft); letter-spacing: .12em; margin-bottom: 14px; }
#compass-panel .cp-desc { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 16px; }
#compass-panel .cp-hou { font-size: 13.5px; color: var(--ink); margin-bottom: 14px; line-height: 2; }
#compass-panel .cp-poem { font-size: 14.5px; color: var(--cinnabar-deep); margin-bottom: 6px; }
#compass-panel .cp-from { font-size: 12px; color: var(--ink-faint); margin-bottom: 18px; }
#compass-panel .cp-colors { display: flex; gap: 10px; margin-bottom: 22px; }
#compass-panel .cp-colors i { width: 34px; height: 34px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(42,37,33,.12); }

.btn-ink {
  display: inline-block;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 11px 30px;
  font-size: 14px; letter-spacing: .25em; text-indent: .25em;
  border-radius: 4px;
  transition: all .35s;
  text-decoration: none;
}
.btn-ink:hover { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--paper); }
.btn-ink.solid { background: var(--ink); color: var(--paper); }
.btn-ink.solid:hover { background: var(--cinnabar); border-color: var(--cinnabar); }

/* ---------- 生辰寻节气 ---------- */
/* ---------- 生辰寻节气 ----------
 * 左栏不加白色边框卡 —— 那层白框在宣纸底上是一块生硬的补丁。
 * 改用"把左栏内容本身放大"来压住右侧卷卡的重量:
 * 左栏略宽于右栏,字号与控件同步放大,刻度尺拉长,
 * 于是两侧体量相当而左栏仍是通透的纸面。 */
.birthday-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  gap: 3.4vw;
  align-items: center;
  max-width: 1220px; margin: 0 auto;
}
.birthday-form { min-width: 0; }   /* 刻度尺改为自身横滚,不撑破移动端 */
.birthday-form .lead {
  color: var(--ink-soft);
  font-size: 16.5px; line-height: 2;
  margin-bottom: 26px;
}
.date-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
#bd-input {
  font-family: var(--serif);
  font-size: 17px;
  padding: 13px 20px;
  border: 1px solid var(--ink-faint);
  border-radius: 4px;
  background: rgba(255, 252, 245, .8);
  color: var(--ink);
  letter-spacing: .1em;
}
.date-row .btn-ink { font-size: 15px; padding: 13px 26px; }
#bd-input:focus { outline: none; border-color: var(--cinnabar); }

#bd-result { min-height: 170px; }
.bd-card {
  /* 结果区不再用朱红实线:左栏已是一张有边框的卡,再叠一道红线会显得碎 */
  border-top: 1px dashed rgba(42, 37, 33, .16);
  padding-top: 20px;
  animation: bdIn .8s var(--ease-ink);
}
@keyframes bdIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; } }
.bd-card h3 { font-size: 44px; letter-spacing: .3em; margin-bottom: 4px; }
.bd-card .bd-en { color: var(--ink-faint); font-size: 13px; letter-spacing: .16em; display: block; margin-bottom: 16px; }
.bd-card p { color: var(--ink-soft); font-size: 15px; margin-bottom: 8px; }
.bd-card p b { color: var(--cinnabar); font-weight: 600; }
.bd-card .bd-colors { display: flex; gap: 10px; margin: 16px 0 22px; }
.bd-card .bd-colors i { width: 40px; height: 40px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(42,37,33,.12); }

/* ---------- 二十四节气刻度尺 ---------- */
#bd-ruler { margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
#bd-ruler::-webkit-scrollbar { display: none; }
#bd-ruler svg { display: block; width: 100%; min-width: 600px; }
.rl-cap { text-align: center; font-size: 13px; letter-spacing: .18em; color: var(--ink-faint); margin-top: 10px; }
.rl-season { font-size: 14.5px; letter-spacing: .2em; fill: var(--ink-faint); font-family: var(--serif); }
.rl-tick { stroke: rgba(42, 37, 33, .38); stroke-width: 1.3; }
.rl-tick.major { stroke: var(--ink); stroke-width: 2; }
.rl-name { font-size: 13.5px; letter-spacing: .08em; fill: var(--ink-soft); font-family: var(--serif); }
.rl-dot { fill: #fffdf6; stroke: rgba(42, 37, 33, .4); stroke-width: 1.2; transition: fill .3s, stroke .3s; }
.rl-hit { cursor: pointer; }
.rl-hit:hover .rl-dot, .rl-hit:focus-visible .rl-dot { fill: var(--cinnabar); stroke: var(--cinnabar); }
.rl-hit:focus-visible { outline: none; }
.rl-stem { stroke: rgba(42, 37, 33, .4); stroke-width: 1.2; }
.rl-mark path { stroke: rgba(255, 253, 246, .9); stroke-width: 1; }
.rl-mark.today path { fill: var(--cinnabar); }
.rl-mark.mine path { fill: var(--gold); }
.rl-label { font-size: 11px; letter-spacing: .16em; font-family: var(--serif); }
.rl-mark.today .rl-label { fill: var(--cinnabar); }
.rl-mark.mine .rl-label { fill: var(--gold); }

.share-wrap { text-align: center; }
#share-card {
  width: min(100%, 380px);
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(42, 37, 33, .2);
  margin: 0 auto 20px;
  background: var(--paper);
}

/* ---------- 岁时色谱 ---------- */
/* 色卡网格用"固定列数"而非 auto-fill:
 * 十六色须恰好铺满整两行,九十六色须恰好铺满整十二行。
 * 8 是 16 与 96 的公约数,故取 8 列;auto-fill 会让末行残缺
 * (实测 11 列时第二行只剩 5 张,右侧空出一大片)。 */
#color-wall {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 18px;
  max-width: 1180px; margin: 0 auto;
}
@media (max-width: 800px) {
  #color-wall { grid-template-columns: repeat(4, 1fr); gap: 14px; }
}
.color-cell {
  cursor: pointer; text-align: center;
  transition: transform .3s var(--ease-ink);
  animation: colorIn .6s var(--ease-ink) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}
.color-cell:hover { transform: translateY(-6px); }
@keyframes colorIn {
  from { opacity: 0; transform: translateY(14px); filter: blur(2px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
#color-more { display: block; margin: 32px auto 0; }
#color-more:active { transform: translateY(1px); }
.color-cell i {
  position: relative;
  display: block;
  width: 100%; aspect-ratio: 1 / 1.15;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(42, 37, 33, .1), 3px 4px 10px rgba(42, 37, 33, .12);
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow .35s;
}
.color-cell:hover i {
  box-shadow: inset 0 0 0 1px rgba(42, 37, 33, .18), 5px 8px 18px rgba(42, 37, 33, .18);
}
.color-cell i svg { display: block; width: 100%; height: 100%; }
.color-cell i u {          /* 落款小印:即该色本尊 */
  position: absolute; right: 7px; bottom: 7px;
  width: 11px; height: 11px; border-radius: 2.5px;
  box-shadow: inset 0 0 0 1px rgba(42, 37, 33, .2);
  transform: rotate(-4deg);
  text-decoration: none;
}
.color-cell small { font-size: 12.5px; color: var(--ink); letter-spacing: .06em; display: block; }
.color-cell em { font-style: normal; font-size: 10.5px; color: var(--ink-faint); }

/* ---------- 尾声 ---------- */
#epilogue { text-align: center; padding-bottom: 8vh; }
.epi-title {
  font-size: clamp(30px, 4.5vw, 50px);
  letter-spacing: .45em; text-indent: .45em;
  margin-bottom: 4vh;
}
.epi-text { max-width: 640px; margin: 0 auto 6vh; color: var(--ink-soft); }
.epi-credits {
  border-top: 1px solid rgba(42, 37, 33, .14);
  max-width: 1080px; margin: 0 auto;
  padding-top: 4vh;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 26px;
  text-align: left;
  font-size: 13px;
  color: var(--ink-faint);
}
/* 四栏在中等宽度下会折成「3 + 1」,最后那栏孤零零挂在第二行很难看。
   故在排不下四栏时直接降为两栏,永远是 4 / 2 / 1 这三种整齐的形态。 */
@media (max-width: 1120px) { .epi-credits { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.epi-credits h4 { font-size: 14px; color: var(--ink); letter-spacing: .2em; margin-bottom: 10px; }
.epi-credits ul { margin: 0; padding: 0; }
.epi-credits li {
  list-style: none;
  line-height: 1.9;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
/* 考据来源做成真链接:评委可以当场点开核对出处,比一行书名可信得多。
   外链标记用 ::after 画,不额外加元素 —— 免得又撞上别处的元素选择器。 */
.epi-credits a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dashed rgba(42, 37, 33, .3);
  padding-bottom: 1px;
  transition: color .3s, border-bottom-color .3s;
}
.epi-credits a::after {
  content: "↗";
  margin-left: 4px;
  font-size: 10px;
  vertical-align: 1px;
  color: var(--ink-faint);
  transition: color .3s;
}
.epi-credits a:hover { color: var(--cinnabar); border-bottom-color: var(--cinnabar); }
.epi-credits a:hover::after { color: var(--cinnabar); }
.epi-credits a:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 3px; }
/* 版本信息:书名之下的一行小注,给"出处确有其书"一个凭据 */
.epi-credits .src {
  display: block;
  font-size: 11.5px;
  line-height: 1.7;
  letter-spacing: .04em;
  color: var(--ink-faint);
  opacity: .85;
}
/* 「关于本作品」一栏里,小注在正文之上,作为字段名 */
.epi-credits .src-top {
  letter-spacing: .18em;
  color: rgba(42, 37, 33, .56);
  margin-bottom: 1px;
}
.epi-seal {
  width: 74px; height: 74px;
  margin: 5vh auto 0;
  background: var(--cinnabar);
  color: var(--paper);
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 8px;
  transform: rotate(-4deg);
  box-shadow: 4px 4px 0 rgba(42, 37, 33, .18);
}

#to-top {
  position: fixed; right: 26px; bottom: 26px;
  z-index: 25;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  background: rgba(246, 241, 231, .9);
  color: var(--ink-soft);
  font-size: 17px;
  opacity: 0; visibility: hidden;
  transition: all .4s;
}
#to-top.show { opacity: 1; visibility: visible; }
#to-top:hover { border-color: var(--cinnabar); color: var(--cinnabar); }

/* ---------- 复制提示 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 26px;
  border-radius: 999px;
  font-size: 13.5px; letter-spacing: .15em;
  opacity: 0; visibility: hidden;
  transition: all .4s var(--ease-ink);
  z-index: 60;
}
#toast.show { opacity: 1; visibility: visible; transform: translateX(-50%); }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .origin-grid, .compass-grid, .birthday-grid { grid-template-columns: 1fr; }
  .orbit-wrap { max-width: 520px; margin: 0 auto; }
  #compass { max-width: 520px; margin: 0 auto; }
}
@media (max-width: 1060px) {
  /* 时间线转纵向:墨线自上而下生长,节点内容常显 */
  #timeline { display: block; padding-left: 32px; }
  #timeline::before {
    left: 9px; right: auto; top: 6px; bottom: 6px;
    width: 2px; height: auto;
    background: linear-gradient(180deg, transparent, rgba(42, 37, 33, .45) 6%, rgba(42, 37, 33, .45) 94%, transparent);
    transform: scaleY(0);
    transform-origin: top center;
  }
  #timeline.in::before { transform: scaleY(1); }
  .tl-item { display: block; text-align: left; padding: 0 0 30px; }
  .tl-item:last-child { padding-bottom: 0; }
  .tl-dot { position: absolute; left: -32px; top: 2px; }
  .tl-year { margin-top: 0; display: inline-block; margin-bottom: 2px; }
  .tl-card {
    position: static; width: auto;
    transform: none; opacity: 1; visibility: visible;
    pointer-events: auto;
    margin-top: 10px;
    box-shadow: 0 8px 20px rgba(42, 37, 33, .08);
  }
}

@media (max-width: 960px) {
  .term-grid { grid-template-columns: repeat(3, 1fr); }
  .tp-body { grid-template-columns: 1fr; gap: 22px; }
  .tp-visual { flex-direction: row; justify-content: flex-start; align-items: flex-end; gap: 16px; padding-top: 0; flex-wrap: wrap; }
  .tp-scroll { width: 132px; }
  .tp-scroll-cap { font-size: 9.5px; letter-spacing: .14em; }
  .tp-vertical { writing-mode: horizontal-tb; font-size: clamp(40px, 9vw, 62px); animation: none; }
  .tp-seal { width: 40px; height: 40px; font-size: 14px; }
  .tp-en { display: none; }
  .tp-acts { grid-template-columns: repeat(2, 1fr); }
  .tp-hou { grid-template-columns: repeat(3, 1fr); gap: 9px; }
}

@media (max-width: 860px) {
  .panel { padding: 10vh 7vw; }
  .term-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .term-tile { padding: 8px 8px 0; }
  .tile-name { font-size: 17px; }
  .tile-motto { font-size: 11px; }
  .tile-line { font-size: 10.5px; padding-bottom: 10px; }
  .tile-stamp { width: 22px; height: 22px; font-size: 8.5px; }
  .tp-hou { grid-template-columns: 1fr; gap: 9px; }
  .tp-sheet { width: 96vw; }
  .tp-switch button { padding: 8px 12px; gap: 8px; }
  #cn-nav { padding: 12px 18px; gap: 14px; }
  #cn-nav.solid { padding: 8px 18px; }
  .nav-title { font-size: 16px; }
  .nav-seal { width: 34px; height: 34px; font-size: 13px; }
  #today-chip { display: none; }
  .hero-title { filter: none; }
  #guide { right: 14px; bottom: 80px; }
  #guide-bubble { right: 8px; bottom: 176px; }
  .guide-hi { display: none; }
}

/* ---------- 虚拟导览员 · 小岁时 ---------- */
#guide { position: fixed; right: 26px; bottom: 92px; z-index: 40; }

#guide-avatar {
  position: relative;
  width: 84px; height: 96px;
  border: 1px solid rgba(42, 37, 33, .18);
  border-radius: 44px 44px 20px 20px;
  background: linear-gradient(180deg, #fffdf6, var(--paper-deep));
  box-shadow: 0 10px 26px rgba(42, 37, 33, .18);
  cursor: grab;
  touch-action: none;
  transition: transform .35s var(--ease-ink), box-shadow .35s;
  overflow: visible;
  padding: 6px 0 0;
  user-select: none;
  -webkit-user-select: none;
}
#guide-avatar svg { width: 100%; height: 100%; pointer-events: none; }
#guide-avatar:hover { transform: translateY(-5px); box-shadow: 0 16px 32px rgba(42, 37, 33, .24); }
body.dragging-guide #guide-avatar {
  cursor: grabbing;
  transform: scale(1.06) rotate(-2deg);
  box-shadow: 0 22px 44px rgba(42, 37, 33, .3);
  transition: none;
}

/* 首次打招呼气泡 */
.guide-hi {
  position: absolute; right: 96px; top: 8px;
  white-space: nowrap;
  background: var(--ink); color: var(--paper);
  font-size: 12.5px; letter-spacing: .08em;
  padding: 7px 14px;
  border-radius: 14px 14px 4px 14px;
  animation: hiFloat 2.6s ease-in-out infinite;
}
.guide-hi::after {
  content: "";
  position: absolute; right: -5px; bottom: 6px;
  border: 5px solid transparent;
  border-left-color: var(--ink);
  border-bottom: none;
}
@keyframes hiFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* 眨眼与呼吸 */
#g-eye-l, #g-eye-r { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95%, 97% { transform: scaleY(.08); } }
#g-body, #g-arm-l, #g-arm-r { transform-box: fill-box; transform-origin: center bottom; animation: breathe 3.4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(1.03); } }
#guide-avatar:hover #g-head { transform-box: fill-box; transform-origin: center bottom; animation: headTilt .8s var(--ease-ink); }
@keyframes headTilt { 0%,100% { transform: rotate(0); } 35% { transform: rotate(-5deg); } 70% { transform: rotate(3deg); } }

/* 对话框(默认右下角,JS 随头像位置智能重定位) */
#guide-bubble {
  position: fixed; right: 26px; bottom: 200px;
  width: min(372px, 92vw);
  max-height: min(520px, 74vh);
  display: flex; flex-direction: column;
  background: #fffdf6;
  border: 1px solid rgba(42, 37, 33, .16);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(42, 37, 33, .28);
  overflow: hidden;
  animation: gbIn .45s var(--ease-ink);
}
@keyframes gbIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; } }

#guide-bubble[hidden] { display: none; }

.gb-head {
  display: flex; align-items: center; gap: 10px;
  background: var(--cinnabar);
  color: var(--paper);
  padding: 12px 16px;
}
.gb-dot { width: 9px; height: 9px; border-radius: 50%; background: #8fd18b; box-shadow: 0 0 0 3px rgba(143,209,139,.3); flex: none; }
.gb-id { line-height: 1.35; }
.gb-id b { font-size: 15px; letter-spacing: .15em; }
.gb-id small { display: block; font-size: 11px; opacity: .85; letter-spacing: .1em; }
#gb-close {
  margin-left: auto;
  background: none; border: none;
  color: var(--paper); font-size: 20px;
  width: 30px; height: 30px;
  border-radius: 50%;
  transition: background .3s;
}
#gb-close:hover { background: rgba(255,255,255,.18); }

#gb-msgs {
  flex: 1; overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 180px;
  scroll-behavior: smooth;
}
.gm { max-width: 86%; padding: 10px 14px; border-radius: 12px; font-size: 13.8px; line-height: 1.8; letter-spacing: .02em; animation: gmIn .3s var(--ease-ink); white-space: pre-wrap; }
@keyframes gmIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
.gm.bot { align-self: flex-start; background: var(--paper); border: 1px solid rgba(42,37,33,.12); border-left: 3px solid var(--cinnabar); border-radius: 4px 12px 12px 12px; }
.gm.user { align-self: flex-end; background: var(--cinnabar); color: var(--paper); border-radius: 12px 4px 12px 12px; }
.gm .gm-act { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--cinnabar); border: 1px solid currentColor; border-radius: 999px; padding: 2px 12px; cursor: pointer; background: none; transition: all .3s; }
.gm .gm-act:hover { background: var(--cinnabar); color: var(--paper); }
.gm.typing::after { content: "▍"; color: var(--cinnabar); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.gb-qs {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 12px;
  border-top: 1px dashed rgba(42,37,33,.14);
}
.gb-qs button {
  flex: none;
  font-size: 12px; letter-spacing: .05em;
  border: 1px solid var(--ink-faint);
  background: var(--paper);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 5px 13px;
  transition: all .3s;
}
.gb-qs button:hover { border-color: var(--cinnabar); color: var(--cinnabar); }

.gb-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(42,37,33,.1); background: var(--paper); }
#gb-text {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: 14px;
  height: 40px;
  line-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(42,37,33,.2);
  border-radius: 10px;
  background: #fffdf6;
  color: var(--ink);
}
#gb-text:focus { outline: none; border-color: var(--cinnabar); }
#gb-send {
  flex: none;
  width: 58px; height: 40px;
  border: none; border-radius: 10px;
  background: var(--ink); color: var(--paper);
  font-size: 14px; letter-spacing: .2em; text-indent: .2em;
  transition: background .3s;
}
#gb-send:hover { background: var(--cinnabar); }

/* 导览员引擎徽标(DeepSeek / 本地知识库) */
#gb-engine { display: inline-flex; align-items: center; gap: 4px; }
#gb-engine::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .9;
}
#gb-engine.ai { color: #ffd9a0; }

/* ---------- 玖 · 岁时雅集(信笺墙) ---------- */
.wall-grid {
  display: grid;
  grid-template-columns: 296px 1fr;
  gap: 22px;
  align-items: start;
}

/* 寄信台 */
.letter-compose {
  position: sticky; top: 86px;
  background: #fffdf6;
  border: 1px solid rgba(42,37,33,.16);
  border-top: 3px solid var(--cinnabar);
  border-radius: 6px;
  padding: 20px 20px 16px;
  box-shadow: 0 14px 34px rgba(42,37,33,.1);
}
.letter-compose.replying { border-top-color: var(--gold); }
.compose-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.compose-head h3 { font-size: 19px; letter-spacing: .14em; cursor: default; }
.letter-compose.replying .compose-head h3 { cursor: pointer; color: var(--cinnabar); }
.compose-stamp {
  font-size: 11.5px; letter-spacing: .08em;
  color: var(--ink-soft);
  border: 1px solid rgba(180,58,43,.4);
  border-radius: 4px;
  padding: 3px 8px;
  transform: rotate(2deg);
  white-space: nowrap;
}
.compose-stamp b { color: var(--cinnabar); }

#wall-name, #wall-content {
  width: 100%;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(42,37,33,.18);
  border-radius: 8px;
  padding: 9px 12px;
  transition: border-color .3s;
}
#wall-name { margin-bottom: 10px; height: 38px; }
#wall-content { resize: vertical; min-height: 96px; line-height: 1.8; }
#wall-name:focus, #wall-content:focus { outline: none; border-color: var(--cinnabar); }

.compose-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}
.wall-count { font-size: 12px; color: var(--ink-faint); letter-spacing: .06em; }
.wall-note {
  margin: 12px 0 0;
  font-size: 11.5px; letter-spacing: .05em;
  color: var(--ink-faint);
  border-top: 1px dashed rgba(42,37,33,.14);
  padding-top: 10px;
}
.wall-note.offline { color: #a3651d; }

/* ============================================================
 * 岁时果树:一封笺即一枚果
 * ------------------------------------------------------------
 * 构图要点:
 *  - 容器宽高比锁定 600:480,与 SVG 的 viewBox 完全一致。
 *    只有这样,"按百分比定位的果实"才会与"按 viewBox 绘制的枝干"
 *    永远咬合;若让高度自适应,果实会随容器比例漂移出枝头。
 *  - 果实尺寸用 px,位置用 %:缩放窗口时果实只挪位不变形。
 *  - 容器不设 overflow:hidden,否则最下一排果实的名牌会被裁掉。
 * ============================================================ */
.tree-fig { margin: 0 0 20px; }

.fruit-tree {
  position: relative;
  width: min(100%, 600px);
  aspect-ratio: 600 / 480;
  margin: 0 auto;
}
.fruit-tree .tree-ink { position: absolute; inset: 0; width: 100%; height: 100%; }

.fruit {
  position: absolute;
  left: 50%; top: 50%;
  width: var(--s, 28px); height: var(--s, 28px);
  margin: calc(var(--s, 28px) / -2) 0 0 calc(var(--s, 28px) / -2);
  padding: 0; border: none; background: none;
  cursor: pointer;
  /* 果实不自摆:整棵树持续晃动会让这一章始终"在动",与全卷的静气不合。 */
  transition: transform .32s var(--ease-ink);
  z-index: 2;
}
.fruit:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 5px; border-radius: 50%; }

/* 苹果本体:一枚 SVG,果身 = 暗底 + 左上受光渐变,故有真实的体积。
 * 早先是一个纯色圆 + 白色高光点,无论染成什么颜色都像挂上去的彩球。 */
.fruit .ap {
  display: block;
  width: 100%; height: 100%;
  overflow: visible;                     /* 果柄与叶片略出果身,不许裁掉 */
  transform: rotate(var(--rot, 0deg));
  filter: drop-shadow(0 3px 3px rgba(28, 42, 16, .42));
  transition: filter .4s var(--ease-ink);
}
.fruit .ap-body { fill: var(--fc-d); }
/* .ap-shade 的 fill 由 JS 按季节写成 url(#apv-<季>),此处不可再设 fill:
   CSS 声明会压过 SVG 的表现属性,写了就会把五色压成同一色。 */
.fruit .ap-rl { fill: #fff; opacity: .15; }
.fruit .ap-hl { fill: #fff; opacity: .46; }
.fruit .ap-stem { fill: none; stroke: #4a3a24; stroke-width: 1.6; stroke-linecap: round; }
.fruit .ap-leaf { fill: #7c9a54; }
.fruit .ap-leaf2 { fill: #6d8b49; }

/* 果后的金色光晕:只有被指到的那一枚才有,给"这枚果在说话"的分量。
   树在无人触碰时是全静的 —— 不设任何自动点亮。 */
.fruit::after {
  content: ""; position: absolute; inset: -40%;
  border-radius: 50%; pointer-events: none; z-index: -1;
  background: radial-gradient(circle, rgba(198, 150, 52, .42), rgba(198, 150, 52, 0) 70%);
  opacity: 0; transition: opacity .42s var(--ease-ink);
}
.fruit:hover, .fruit:focus-visible { transform: translateY(-3px); z-index: 7; }  /* 名牌要压过相邻的果 */
.fruit:hover::after, .fruit:focus-visible::after { opacity: 1; }
.fruit:hover .ap, .fruit:focus-visible .ap {
  filter: drop-shadow(0 3px 3px rgba(28, 42, 16, .42))
          drop-shadow(0 0 9px rgba(196, 148, 50, .85));
}

/* 悬停时浮出的名牌:署名一行 + 正文数行。
 * 挂在果实左右而非上下 —— 冠盖是一整团绿,上下浮出会压在叶上读不清;
 * 右半树的果子由 JS 翻到左侧,免得越出容器。
 * 宽度由 JS 写进 --tip-w(随容器实宽变化),正文转折而不截断 ——
 * 早先写死 200px + nowrap,长信一律被切成"…",根本看不全。
 * 只做淡入淡出,不做位移:位移会给整棵树添一层"在滑动"的错觉。 */
.fruit-tip {
  position: absolute; left: calc(100% + 12px); top: 50%;
  transform: translateY(-50%);
  width: max-content;
  max-width: var(--tip-w, 228px);
  padding: 8px 12px 9px;
  background: rgba(255, 253, 246, .985);
  border: 1px solid rgba(42, 37, 33, .16);
  border-left: 2px solid var(--gold, #b98a2f);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(42, 37, 33, .22);
  font-size: 12.5px; line-height: 1.75; letter-spacing: .03em;
  color: var(--ink-soft);
  white-space: normal; overflow-wrap: anywhere;
  opacity: 0; pointer-events: none;
  transition: opacity .28s var(--ease-ink);
  z-index: 9;
}
.fruit-tip .tp-who {
  display: block;
  margin-bottom: 3px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(42, 37, 33, .14);
  color: var(--ink); font-weight: 600; letter-spacing: .08em;
}
.fruit-tip .tp-txt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
/* 窄屏上左右都挂不住时,名牌改落在果实下方(或上方)并夹回容器内。
   位置与宽度都由 JS 逐枚算好写进变量,这里只负责摆。 */
.fruit.tip-c .fruit-tip {
  left: var(--tip-x, 0px); right: auto;
  top: calc(100% + 9px);
  transform: none;
  border-left: 1px solid rgba(42, 37, 33, .16);
  border-right: 1px solid rgba(42, 37, 33, .16);
  border-top: 2px solid var(--gold, #b98a2f);
}
.fruit.tip-c.tip-a .fruit-tip { top: auto; bottom: calc(100% + 9px); }

.fruit:hover .fruit-tip, .fruit:focus-visible .fruit-tip { opacity: 1; }
.fruit.tip-l .fruit-tip {
  left: auto; right: calc(100% + 12px);
  border-left: 1px solid rgba(42, 37, 33, .16);
  border-right: 2px solid var(--gold, #b98a2f);
}

.tree-cap {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px; letter-spacing: .22em; text-indent: .22em;
  color: var(--ink-faint);
}
.tree-cap b { color: var(--cinnabar); font-weight: 600; }

/* 信笺流 */
.wall-stream { min-width: 0; }
.wall-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.wall-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.wall-filters button {
  font-size: 12.5px; letter-spacing: .12em;
  border: 1px solid var(--ink-faint);
  background: none; color: var(--ink-soft);
  border-radius: 999px;
  padding: 5px 15px;
  transition: all .3s;
}
.wall-filters button:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.wall-filters button.on {
  background: var(--ink); border-color: var(--ink);
  color: var(--paper);
}
.wall-stat { font-size: 12px; letter-spacing: .1em; color: var(--ink-faint); }

/* ============================================================
 * 信笺墙:固定四封,两行两列
 * ------------------------------------------------------------
 * 原先用 CSS 多列(column-count)做瀑布流:卡片各随内容生长,
 * 整块区域像是页面上一个"自己会动"的独立区,与全页的纵向
 * 节奏对不上。改为 2×2 网格 —— 恰好四封、行列对齐、
 * 不设内部滚动,整页只有一条滚动线,其余信笺由树上点果换阅。
 * ============================================================ */
.wall-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 760px) { .wall-list { grid-template-columns: 1fr; } }

.wall-list > .letter { width: 100%; margin: 0; }

/* 信笺卡:宣纸 + 微倾斜,悬停回正。
 * 用纵向 flex 让"封缄条/展信"永远贴住卡底 ——
 * 四张卡列成两行两列后,若底栏随内容浮动,行内两张会一高一低,
 * 网格看着就散。贴底之后四卡成整齐的一方。 */
.letter {
  background: #fffdf6;
  border: 1px solid rgba(42,37,33,.14);
  border-radius: 6px;
  padding: 12px 14px 10px;
  box-shadow: 0 8px 22px rgba(42,37,33,.08);
  transform: rotate(-.7deg);
  position: relative;
  display: flex; flex-direction: column;
  transition: transform .45s var(--ease-ink), box-shadow .45s;
}
.letter:nth-child(even) { transform: rotate(.6deg); }
.letter:hover {
  transform: rotate(0) translateY(-4px);
  box-shadow: 0 18px 36px rgba(42,37,33,.16);
  z-index: 2;
}
/* 信笺卡不再做入场动画:换页时四张卡一起上浮,
   看着就像右侧那块内容在自己滑动。改为直接呈现。 */

/* 从树上点拨果实时,对应信笺亮一下,让"果 → 笺"的对应关系一目了然 */
.letter.flash { animation: letterFlash 1.7s var(--ease-ink); }
@keyframes letterFlash {
  0%   { box-shadow: 0 0 0 0 rgba(185, 138, 47, .55), 0 8px 22px rgba(42,37,33,.08); }
  55%  { box-shadow: 0 0 0 12px rgba(185, 138, 47, 0), 0 8px 22px rgba(42,37,33,.08); }
  100% { box-shadow: 0 0 0 0 rgba(185, 138, 47, 0), 0 8px 22px rgba(42,37,33,.08); }
}

.letter-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 9px;
  /* 卡片较窄时禁止内部元素被挤压换行,
     "第 15 封""展信"等一旦折行会破坏版面 */
  flex-wrap: nowrap;
  min-width: 0;
}
.letter-seal {
  writing-mode: vertical-rl;
  font-size: 10.5px; letter-spacing: .14em;
  color: var(--ink);
  border: 1px solid rgba(42,37,33,.35);
  border-radius: 3px;
  padding: 4px 2px;
  line-height: 1.1;
  flex-shrink: 0;
}
.letter-floor {
  font-size: 11px; letter-spacing: .1em;
  color: var(--cinnabar);
  border-bottom: 1px solid rgba(180,58,43,.35);
  padding-bottom: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}
.letter-head time {
  margin-left: auto;
  font-size: 11px; color: var(--ink-faint);
  letter-spacing: .04em;
  white-space: nowrap;
}
.letter-body {
  font-size: 13.8px; line-height: 1.9; letter-spacing: .02em;
  color: var(--ink);
  word-break: break-word;
  white-space: pre-wrap;
}
/* 封缄态预览:只留两行
 * 折起时若只剩"此笺已封"四字,整面墙会显得空而寡淡;
 * 露出两行原文,既让墙有内容,又不至于把长信摊开。
 * 展开后即隐去,由 .letter-content 承接全文。 */
.letter-pre {
  font-size: 13.4px; line-height: 1.85; letter-spacing: .02em;
  color: var(--ink-soft);
  word-break: break-word;
}
.letter-pre p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.letter-pre .pre-by {
  display: block; margin-top: 7px;
  text-align: right;
  font-size: 12px; color: var(--ink-faint); letter-spacing: .06em;
}
.letter.opened .letter-pre { display: none; }

.letter-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed rgba(42,37,33,.14);
}
.letter-by {
  font-size: 12px; color: var(--ink-soft);
  letter-spacing: .06em;
  margin-right: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.letter-btn {
  flex: none;
  font-size: 12px; letter-spacing: .08em;
  border: 1px solid rgba(42,37,33,.25);
  background: none; color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 12px;
  cursor: pointer;
  transition: all .3s;
  font-family: var(--serif);
}
.letter-btn:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.letter-btn.like { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; }
.letter-btn.like i {
  font-style: normal;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  transition: all .3s;
}
.letter-btn.like b { font-weight: 400; font-size: 12px; }
.letter-btn.like.on { border-color: var(--cinnabar); color: var(--cinnabar); }
.letter-btn.like.on i { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--paper); }

/* 回复(嵌套) */
.letter-replies {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.letter.reply {
  background: var(--paper);
  border: 1px dashed rgba(42,37,33,.2);
  box-shadow: none;
  transform: none;
  padding: 9px 12px 8px;
}
.letter.reply.in { animation: none; opacity: 1; }
.letter.reply:hover { transform: none; }
.letter.reply .letter-body { font-size: 12.8px; line-height: 1.75; }
.letter.reply .letter-foot { padding-top: 6px; margin-top: 6px; }

/* 封缄与展读:主帖默认折起,轻点展开 */
.letter-content { display: none; }
.letter.opened .letter-content { display: block; animation: letterUnfold .55s var(--ease-ink); }
@keyframes letterUnfold { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
#wall-list > .letter { cursor: pointer; }
.letter-fold {
  display: flex; align-items: center; gap: 10px;
  margin-top: auto;            /* 贴住卡底,行内两卡底栏对齐 */
  padding-top: 10px;
  border-top: 1px dashed rgba(42, 37, 33, .16);
  user-select: none;
}
.letter-fold::before {          /* 封缄火漆点 */
  content: ""; flex: none;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cinnabar); opacity: .85;
  box-shadow: 0 0 0 2px rgba(180, 58, 43, .15);
  transition: all .3s;
}
.letter.opened .letter-fold::before { background: var(--gold); box-shadow: 0 0 0 2px rgba(185, 138, 47, .16); }
.fold-hint {
  flex: 1; font-size: 11.5px; letter-spacing: .08em; color: var(--ink-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fold-btn {
  flex: none;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 12px; letter-spacing: .28em; text-indent: .28em;
  color: var(--cinnabar); background: none;
  border: 1px solid rgba(180, 58, 43, .45);
  border-radius: 999px; padding: 3px 11px;
  cursor: pointer; transition: all .3s;
}
.fold-btn:hover { background: var(--cinnabar); color: var(--paper); }

/* 空态 / 分页 */
.wall-empty { text-align: center; padding: 44px 0 20px; }
.wall-empty .empty-seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 92px; height: 92px;
  border: 2px solid rgba(180,58,43,.55);
  border-radius: 8px;
  color: var(--cinnabar);
  font-size: 20px; letter-spacing: .18em;
  transform: rotate(-6deg);
  opacity: .8;
}
.wall-empty p { margin-top: 14px; font-size: 13px; color: var(--ink-soft); letter-spacing: .1em; }
/* 提示行取代了原先的「展开更多」按钮:不占按钮的分量,
   只在确有未显示的信笺时出现 */
.wall-hint {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px; letter-spacing: .16em;
  color: var(--ink-faint);
}
.wall-hint[hidden] { display: none; }

@media (max-width: 1000px) {
  .wall-grid { grid-template-columns: 1fr; }
  .letter-compose { position: static; }
}
@media (max-width: 640px) {
  .wall-list { grid-template-columns: 1fr; }
  .term-grid { grid-template-columns: 1fr; }
  .term-tile { padding: 8px 8px 0; }
  .tile-stamp { width: 22px; height: 22px; font-size: 8.5px; }
  .tp-sheet { width: 96vw; padding: 26px 18px 20px; }
  /* 三候与典故层在小屏上收紧:三格仍在同一行,不折行 */
  .tp-hou { gap: 8px; }
  .tp-hou-item { padding: 11px 6px 9px; }
  .tp-hou-item .hou-fig { width: 46px; height: 46px; margin-bottom: 6px; }
  .tp-hou-item .hou-ico { width: 25px; height: 25px; }
  .tp-hou-item > span { font-size: 12.5px; letter-spacing: .04em; }
  .tp-hou-item em { font-size: 9.5px; letter-spacing: .1em; text-indent: .1em; }
  .swatch, .swatch i { width: 56px; }
  .swatch i { height: 56px; }
  .tp-detail { padding: 12px; }
  .tp-detail-card { width: 96vw; padding: 20px 18px 15px; max-height: 88vh; }
  .tp-detail-bd { max-height: 46vh; }
  .tp-detail-fig { width: 54px; height: 54px; }
  .tp-detail-fig .hou-ico { width: 30px; height: 30px; }
  .tp-detail-meta h4 { letter-spacing: .12em; text-indent: .12em; }
  .tp-switch button span { display: none; }
  .tp-switch button { padding: 10px 14px; }
  .tp-switch { margin-top: 20px; }
}

/* 手机竖屏:首屏的宽字距在窄屏上会把「长卷」二字挤到下一行,
   单独留一个字在末行很难看。逐项收紧字距与字号,让副题回到一行。 */
@media (max-width: 480px) {
  .hero-kicker { font-size: 11px; letter-spacing: .16em; }
  .hero-sub { font-size: 14px; letter-spacing: .26em; text-indent: .26em; }
  .hero-en { font-size: 10px; letter-spacing: .16em; }
  .epi-credits { gap: 20px; }
  .epi-credits li { line-height: 1.75; }
  .epi-credits a { border-bottom-style: dotted; }
  /* 章节标题的 .18em 字距在窄屏上会把最后一个字挤成孤字,收紧即可整句成行 */
  .section-head { gap: 12px; margin-bottom: 5vh; }
  .sec-no { width: 44px; height: 44px; font-size: 19px; }
  .section-head h2 { font-size: 21px; letter-spacing: .06em; }
  .section-head .sub { font-size: 11px; letter-spacing: .16em; }
}

/* 手机上导览员缩成左下角一枚小圆牌。
   原先固定右下 84×96,正好压住寄信台的「落笔寄出」按钮 —— 浮动元素在
   390px 宽的屏上总会盖住点什么,那就让它去盖最不碍事的那个角落:
   左下角既没有主按钮,也让开了右下角的回顶箭头。 */
@media (max-width: 640px) {
  #guide { right: auto; left: 12px; bottom: 14px; }
  #guide-avatar { width: 58px; height: 66px; border-radius: 30px 30px 14px 14px; padding-top: 4px; }
  #guide-bubble { right: auto; left: 10px; bottom: 92px; max-width: 76vw; }
}

/* 触屏无悬停:浮卡让位,直接点开成卷 */
@media (hover: none) {
  .tile-pop { display: none; }
  .tl-card { display: none; }
  #timeline .tl-item { padding-bottom: 18px; }
  .tl-year { color: var(--ink); }
}

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

/* ============================================================
 * 书体三件:书口纸叠 / 右半衬页 / 封底
 * ------------------------------------------------------------
 * 这三条本来跟在封面之后,重写封面那一段时被一并覆盖掉了(我的失误),
 * 后果是书口、衬页、封底一起失去定位,尾页右侧那半张纸直接消失。
 * 此处按原样补回,并统一加上与书页一致的圆角。
 * ============================================================ */
.ov-block {
  position: absolute; left: 50%; top: 0;
  width: 50%; height: 100%;
  transform: translate3d(9px, 5px, -16px);
  background: repeating-linear-gradient(90deg, #d6cbb5 0 1px, #f7f1e4 1px 3px);
  border-radius: 4px 10px 10px 4px;
  box-shadow: 0 30px 56px rgba(42, 37, 33, .3);
  z-index: 0;
}
/* 衬页(右半固定页):做「二十四气总表」。
   原先是一张空白纸 —— 翻完后右半整片留白,用户明确说过"有点空"。
   线装本的衬纸本就该有印,故排四季四列、每列六气:
   一眼把一岁看全,也让"一岁二十四气"这句话有了具体所指。 */
.ov-endpaper {
  position: absolute; left: 50%; top: 0;
  width: 50%; height: 100%;
  background: linear-gradient(180deg, #fdfaf2, #f4ecdd);
  border-radius: 4px 10px 10px 4px;
  box-shadow: inset 0 0 0 1px rgba(42, 37, 33, .07),
              inset 22px 0 26px -22px rgba(42, 37, 33, .4);
  display: flex; align-items: center; justify-content: center;
}
.ov-endpaper-in {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(10px, 2.2vmin, 20px);
  width: 100%;
  padding: clamp(20px, 4vmin, 40px) clamp(16px, 3vmin, 34px);
  text-align: center;
  color: var(--ink);
}
.ov-endpaper-t {
  font-size: clamp(11px, 2vmin, 14px);
  letter-spacing: .3em; text-indent: .3em;
  color: var(--ink-soft);
  margin: 0;
  padding-bottom: clamp(6px, 1.2vmin, 11px);
  border-bottom: 1px solid rgba(42, 37, 33, .14);
}
.ov-endpaper-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(6px, 1.6vmin, 16px);
  width: 100%;
}
.ov-endpaper-col {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(4px, .9vmin, 8px);
  padding-bottom: clamp(4px, .9vmin, 8px);
  border-bottom: 1px solid rgba(42, 37, 33, .1);
}
/* 季字压顶,一季一色 —— 与正文的季色同一套(--sc 来自 JS) */
.ov-endpaper-s {
  font-size: clamp(13px, 2.6vmin, 18px);
  letter-spacing: .1em;
  color: var(--sc, var(--ink));
  margin-bottom: 2px;
}
.ov-endpaper-t2 {
  font-size: clamp(9.5px, 1.8vmin, 12.5px);
  line-height: 1.5;
  letter-spacing: .04em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.ov-endpaper-f {
  font-size: clamp(8.5px, 1.5vmin, 10.5px);
  letter-spacing: .18em;
  color: var(--ink-faint);
  margin: 0;
}
.ov-backcover {
  position: absolute; left: 0; top: 0;
  width: 50%; height: 100%;
  z-index: 0;
  background: linear-gradient(160deg, #26231e, #35312a);
  border-radius: 4px 10px 10px 4px;
  box-shadow: inset 0 0 0 1px rgba(246, 241, 231, .12), 0 30px 56px rgba(42, 37, 33, .3);
  opacity: 0;
  transition: opacity .5s ease .28s;
}
.ov-book.opened .ov-backcover { opacity: 1; }

/* ============================================================
 * Lenis 平滑滚动所需的基础样式(官方要求,缺一条就会打架)
 * ------------------------------------------------------------
 * 尤其第一条:原站有 html { scroll-behavior: smooth },
 * 与 Lenis 同时生效会让滚动"抖两下",必须由 Lenis 接管为 auto。
 * ============================================================ */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ============================================================
 * 飘入动画的配套样式
 * ------------------------------------------------------------
 * 起始位形由 GSAP 在运行时写进 inline style(见 js/scroll-scene.js),
 * 这里只提前把 will-change 挂上,让这些元素一开始就各占一个合成层 ——
 * 滚动时位移才不会临时提升层、造成掉帧。
 * ============================================================ */
.section-head h2,
.season-line, .section-head .sub, .epi-title,
.season-big, .term-tile, .color-wall .swatch {
  will-change: transform, opacity;
}

/* ============================================================
 * 山脚基座:用 SVG 渐隐基座补长,不用 ::after,也不用 box-shadow
 * ------------------------------------------------------------
 * 要解决的问题:三层山都 bottom:0 锚定,视差把它们整体上推最多 420px,
 * 山体若到自身底边就结束,屏幕下方会露出空白,山脚凭空断掉。
 *
 * 走过的三条弯路,都是"半透明色块盖住下层"惹的祸:
 *  ① ::after 渐变补底 —— 渐变到透明会把下层山体洗白,更像"迭代"。
 *  ② ::after 纯色补底 —— 实测更糟:上层元素底边恰好落在下层山体中间,
 *     那块半透明色把下层山体的上沿洗白,于是每条山脊下方都多出
 *     一条浅色平行带,就是用户说的"山峰下面重影"。
 *  ③ box-shadow: 0 1500px 0 0 —— 看着像"向下复制一块",其实阴影副本
 *     从「元素底边 +1500」才开始,中间 1500px 是空的。实测视差满值时
 *     far 层底边在 201px,下方 420px 完全没有覆盖,原本一条底边硬线
 *     变成三段真空隙。方向就错了,不是偏移量大小的问题。
 *
 * 现在的做法:每层山脚接一段渐隐基座(.mtn-base),顶边与山体底边严丝合缝,
 * 用 CSS linear-gradient 从山体同色渐隐到全透明。因为渐隐到 0,
 * 它不会像前两版那样在半途留下一个"色块边界",也就没有可洗白下层的
 * 接缝 —— 山脚是溶进纸面的,没有线可以留。墨色向下散尽,
 * 恰是国画里的「山脚云烟」。
 *
 * 基座为什么是 HTML div 而不是 SVG 里的 rect:
 * rect 的 height 是 SVG 用户单位,会随 viewBox 按 vh 缩放(实测 460 单位
 * 在 621px 视口下只渲染 321px),而视差位移是**固定 px**,两者量纲不一致 ——
 * 大屏上墨拖到屏幕底部还收不干(整片灰重,纸面发闷、衬得正文也闷),
 * 小屏上又盖不住空隙。CSS 盒模型的 px 不吃 viewBox 缩放,与视差同量纲,
 * 任何视口下都能严丝合缝。CSS 属性改不了 SVG 几何,只能出 SVG。
 *
 * 层序:三层 .mtn-layer 按 far → mid → near 排列,DOM 顺序即绘制顺序,
 * 近山压远山,半透明墨叠在半透明墨上,与山体本身的层叠关系完全一致。
 * 换季时只改 --m1/--m2/--m3 一处,基座颜色自动跟随。
 * ============================================================ */
/* 每层山 = .mtn-layer(山体 + 脚下的渐隐基座)
 * 视差作用在 .mtn-layer 上,山体与基座作为整体一起动,
 * 接缝在结构上就不可能裂开 —— 比分别给两者写两组位移可靠得多。
 * 层序靠 DOM 顺序:近山在远山之后,自然压住远山。 */
.mtn-layer {
  position: absolute; left: 0; right: 0; bottom: 0;
  will-change: transform;
}
/* 基座颜色走 background,靠 --m1/--m2/--m3 随季节一起换。
   过渡时长必须与山体的 fill 过渡一致(1.6s,见文件前部 #bg-scene .mtn):
   山体是渐变过去的,基座若瞬切,换季途中山脊是一种墨、山脚是另一种墨,
   接缝处就看得出色差。同步时长 + 同一条曲线,才真是一起换的。 */
/* 基座颜色走 background-color + mask 渐隐,不用 linear-gradient。
   原因:linear-gradient 不可插值,transition 对它无效 —— 换季时
   山体(fill)渐变过去、基座(渐变)瞬切,途中山脊一种墨、山脚另一种墨。
   background-color 可插值,mask 只负责"往下淡出",两者各司其职:
   颜色跟山体同步渐变,层次靠 mask,接缝处仍是同色连续。 */
/* 基座:贴在山体底边(top:100% 即层底之下),向下延伸出视差露出的空隙。
   顶边不透明度与山体 fill 同值,接缝处连续,看不出起点;
   向下淡出到全透明,故不会在半途留下"色块边界"去洗白下层 ——
   山脚是溶进纸面的,没有线可以留。墨色散尽,正是国画里的「山脚云烟」。
   渐隐交给 mask 而非 gradient,原因见下。 */
.mtn-base {
  position: absolute; left: 0; right: 0; top: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom,
      #000 0%, rgba(0,0,0,.45) 42%, transparent 100%);
  mask-image: linear-gradient(to bottom,
      #000 0%, rgba(0,0,0,.45) 42%, transparent 100%);
  transition: background-color 1.6s ease;   /* 与山体 fill 同长,一起换季 */
}
/* 高度按各层视差位移给足余量:位移 420 / 240 / 85 px,各留约 1.1 倍。
   必须是 CSS px(盒模型不吃 viewBox 缩放),才能与固定 px 的视差位移同量纲 */
.mtn-layer-mtn-far  .mtn-base { height: 460px; background-color: rgba(var(--m1), .13); }
.mtn-layer-mtn-mid  .mtn-base { height: 300px; background-color: rgba(var(--m2), .16); }
.mtn-layer-mtn-near .mtn-base { height: 150px; background-color: rgba(var(--m3), .19); }

/* ============================================================
 * 启卷窄屏适配(520px 以下)
 * ------------------------------------------------------------
 * 必须放在文件末尾 —— 基础规则(.ov-endpaper-grid 等)定义在很靠后
 * 的位置,若媒体查询写在它们之前,同特异度下后来者会把它盖掉,
 * 表现为「窄屏已改 2 列,实测仍是 4 列」。
 * 单页只有视口一半宽:390px 屏上每页约 187px,四列必然挤破。
 * ============================================================ */
@media (max-width: 520px) {
  /* 二十四节气页:单页只有约 187px 宽,三候与诗句都要再收一档 */
  .ov-term { gap: 5px; padding-left: 18px; }
  .ov-h--term { font-size: 15px; letter-spacing: .12em; text-indent: .12em; }
  .ov-term-py { font-size: 8px; letter-spacing: .1em; margin-top: -2px; }
  .ov-hou span { font-size: 9px; padding-left: 10px; }
  .ov-term-poem { font-size: 8.5px; line-height: 1.7; max-width: 100%; }
  /* 衬页总表:四列在单页里必然挤破(实测 390px 下横向溢出),改 2×2 */
  .ov-endpaper-in { padding: 14px 10px; gap: 8px; }
  .ov-endpaper-grid { grid-template-columns: repeat(2, 1fr); gap: 6px 10px; }
  .ov-endpaper-t { font-size: 10.5px; letter-spacing: .18em; text-indent: .18em; }
  .ov-endpaper-s { font-size: 12px; }
  .ov-endpaper-t2 { font-size: 9px; }
  .ov-endpaper-f { font-size: 8px; letter-spacing: .1em; }

  /* 尾页右移在窄屏会把书推出屏外(见 .ov-book.last 的注释),故归零 */
  .ov-book.last { --shift: 0%; }
  /* 尾页:色带与三项数字在窄屏也要收窄 */
  .ov-last-kicker { font-size: 12px; letter-spacing: .2em; text-indent: .2em; }
  .ov-last-stat { gap: 10px; }
  .ov-last-stat dt { font-size: 8px; letter-spacing: .12em; text-indent: .12em; }
  .ov-last-stat dd { font-size: 11px; }
  .ov-last-line { font-size: 10px; line-height: 1.85; letter-spacing: .06em; }
}

/* ============================================================
 * 二级页 / 三级页 · 深度中国风改造(2026-10-12)
 * ------------------------------------------------------------
 * 二级页现状:
 *   立轴天头地脚挂绸(--silk 由 bodyHTML 传节气深色);
 *   诗词竖排(tp-poem) —— 三列块级:诗句两句 + 落款列,朱丝栏界格;
 *   三候编号改朱印、行事图框改方印。
 *   (横批与画签两版试过,用户定稿:都不要 —— 相关样式已随之删净)
 * 三级页(tp-detail):文武线册页卡 + 方印图头 + 界格标题 + 跋文出处。
 * 注意:本段自带窄屏 @media,置于文末,勿上移(规则:MQ 必须在所覆规则后)。
 * ============================================================ */

/* 天头地脚:挂绸,取节气深色一抹 */
.tp-scroll-mat {
  position: relative;
  border-top: 22px solid color-mix(in srgb, var(--silk, #7d6a4f) 55%, #fffdf6);
  border-bottom: 22px solid color-mix(in srgb, var(--silk, #7d6a4f) 55%, #fffdf6);
}

/* ---------- 二级页 · 诗词竖排(朱丝栏笺 · 三列) ----------
 * 块级竖排,不用 flex:flex 在 vertical-rl 里主轴转向纵列,布局不可测。
 * 三列:诗句按标点拆出的两句 + 末列落款,定高 210px 正好填满;
 * 每列文字 text-align:center 居中,列间距走块方向margin。 */
.tp-poem {
  position: relative;
  display: block;
  width: fit-content;
  min-width: 260px;
  max-width: 100%;
  margin: 0 auto 24px;
  writing-mode: vertical-rl;
  height: 210px;
  padding: 18px 26px;
  border-left: none;
  border-right: 3px solid var(--cinnabar);
  overflow: hidden;
}
.tp-pl {
  display: block;
  height: 100%;
  text-align: center;
  margin-left: 7px;
  margin-right: 7px;
  font-weight: 400;
}
.tp-poem .tp-pl {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .34em;
  line-height: 2.3;
  color: var(--ink);
}
.tp-poem .tp-cite {
  font-size: 11.5px;
  letter-spacing: .22em;
  line-height: 2;
  color: var(--ink-faint);
  align-self: flex-end;
}
/* 朱丝栏:栏线随字行,界出笺纸的味道。
   z-index:-1 —— 栏线压在笺底之上、退到字后;红线穿字就俗了。
   栏距 5 等分:三列诗字 + 缓冲正好落在栏间 */
.tp-poem::before {
  content: "";
  position: absolute; inset: 12px 14px;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg,
      transparent 0, transparent calc(100% / 5 - 1px),
      rgba(180, 58, 43, .15) calc(100% / 5 - 1px), rgba(180, 58, 43, .15) calc(100% / 5));
}

/* ---------- 二级页 · 三候朱印编号 + 行事方印 ---------- */
.tp-hou-item b {
  display: inline-block;
  font-weight: 400;
  font-size: 10.5px; letter-spacing: .1em;
  color: #fff8ee;
  background: var(--hou-c, var(--cinnabar));
  border-radius: 3px;
  padding: 2px 8px 2px 9px;
  margin-bottom: 2px;
  box-shadow: 1px 1px 0 rgba(42, 37, 33, .16);
}
.tp-act i {
  border-radius: 6px;
  border-color: rgba(42, 37, 33, .2);
  box-shadow: inset 0 0 0 2px rgba(255, 253, 246, .9);
}

/* ---------- 三级页 · 文武线册页卡 ---------- */
.tp-detail-card {
  position: relative;
}
.tp-detail-card::before {
  content: "";
  position: absolute; inset: 8px;
  border: 1px solid rgba(42, 37, 33, .14);
  pointer-events: none;
  background:
    radial-gradient(circle 2.5px at 8px 8px, rgba(42, 37, 33, .32) 99%, transparent 100%),
    radial-gradient(circle 2.5px at calc(100% - 8px) 8px, rgba(42, 37, 33, .32) 99%, transparent 100%),
    radial-gradient(circle 2.5px at 8px calc(100% - 8px), rgba(42, 37, 33, .32) 99%, transparent 100%),
    radial-gradient(circle 2.5px at calc(100% - 8px) calc(100% - 8px), rgba(42, 37, 33, .32) 99%, transparent 100%);
}
/* 图头改方印:圆形是现代头像的语言,方形才是印 */
.tp-detail-fig {
  border-radius: 6px;
  background: #fffdf6;
  box-shadow: 2px 2px 0 rgba(42, 37, 33, .12);
}
/* 类别改朱文小签 */
.tp-detail-kind {
  display: inline-block;
  font-size: 10.5px; letter-spacing: .14em;
  color: var(--cinnabar);
  border: 1px solid rgba(180, 58, 43, .4);
  border-radius: 3px;
  padding: 2px 9px 2px 10px;
  margin-bottom: 6px;
}
/* 界格标题:朱点引首 + 细线随行 */
.dl-sec h5 {
  display: flex; align-items: center; gap: 10px;
  letter-spacing: .24em;
}
.dl-sec h5::before {
  content: "";
  flex: none;
  width: 6px; height: 6px;
  background: var(--cinnabar);
  transform: rotate(45deg);
}
.dl-sec h5::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(42, 37, 33, .2), transparent);
}
/* 出处改跋文:靠右走,前压一道细线 */
.dl-ref {
  display: block;
  text-align: right;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px dashed rgba(42, 37, 33, .16);
}

/* ---------- 深改段 · 窄屏 ---------- */
@media (max-width: 860px) {
  .tp-poem { height: 178px; padding: 14px 18px; }
}
@media (max-width: 640px) {
  .tp-poem { height: 158px; padding: 12px 16px; }
  .tp-poem .tp-pl { font-size: 14.5px; letter-spacing: .24em; }
}
