/* 天衍 —— 样式
   整站是一张蓝晒图纸：外框带天干地支分区，按钮、卡片用制图的角标，
   开关画成一根爻（关是阴爻，开是阳爻），结果页附图签和引线标注。
   展示字（卦名、标题）用站酷小薇（ZCOOL XiaoWei），正文用思源宋体（Noto Serif SC），两种都裁成子集随仓库走。
   结果页的正文铺一层淡淡的浅灰读纸，和满屏的蓝图装饰分开。
   动效只改 transform / opacity；六十四卦图层由 cosmos.js 逐帧补间。 */

/* 展示字：站酷小薇，裁成只含本站用到的字，放在仓库里（tools/subset-font.py 生成）。
   子集里没有的字（比如原字体本来就缺的「夬」「姤」）按 --display 往后退到思源宋体。 */
@font-face {
  font-family: "ZCOOL XiaoWei";
  src: url("fonts/ZCOOLXiaoWei-subset.woff2?v=b820063d") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* 正文：思源宋体，本站源码里出现过的字裁成一份（tools/subset-text-font.py 生成），不再从 Google Fonts 取（国内连不上）。
   用户自己写的问题、AI 解读里的其它常用字在 fonts/NotoSerifSC-ext.css 里按 unicode-range 另给一份，用到才下载。
   可变字体，字重 400–700 都在这一个文件里。 */
@font-face {
  font-family: "Noto Serif SC";
  src: url("fonts/NotoSerifSC-subset.woff2?v=4f2c784a") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@property --g {
  syntax: '<percentage>';
  inherits: true;
  initial-value: 0%;
}

:root {
  --blue: #17396E;
  --blue-deep: #102B55;
  --ink: #EEF2F7;
  /* --ink-3 在最亮的底色上也有约 4.4:1，小号标签仍看得清 */
  --ink-2: #C5D1E2;
  --ink-3: #A7B8D3;
  --rule: rgba(238, 242, 247, .26);
  --rule-soft: rgba(238, 242, 247, .12);
  --zhu: #FF8A5C;   /* 朱色只有两个意思：动爻与变（卦画、标注、之卦），以及报错和删除 */
  --dim: rgba(6, 16, 34, .58);

  --display: "ZCOOL XiaoWei", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --text: "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --ease: cubic-bezier(.65, 0, .25, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  /* 字号五档：注记 / 说明 / 次要按钮 / 界面 / 正文。更大的是展示字，各自定 */
  --fs-1: 12.5px;
  --fs-2: 13.5px;
  --fs-3: 14.5px;
  --fs-4: 15.5px;
  --fs-5: 17px;
  /* 时长两档：悬停变色，遮罩和弹层淡入 */
  --t-hover: .2s;
  --t-fade: .35s;
  --frame: 18px;
  --gutter: clamp(20px, 4vw, 56px);
  --head-h: 72px;
  color-scheme: dark;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--blue); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  background: transparent;
}
/* 纸面：曝光不匀 + 纸纹。放在固定层上，滚动时不重绘 */
body::before, .mat {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .075 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(110% 85% at 50% 46%, #1F4A88 0%, var(--blue) 52%, #10294F 100%);
}
/* 图框外的一圈纸边：和底纸一模一样，只是盖在内容上面，滚动的内容到图框线就被裁掉。
   顶栏区域不盖，内容可以一直滚到图框顶边 */
.mat {
  z-index: 2;
  clip-path: polygon(evenodd,
    0 0, 100% 0, 100% 100%, 0 100%, 0 0,
    var(--frame) var(--frame), var(--frame) calc(100% - var(--frame)),
    calc(100% - var(--frame)) calc(100% - var(--frame)), calc(100% - var(--frame)) var(--frame),
    var(--frame) var(--frame));
}
body.dialog-open { overflow: hidden; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
::selection { background: var(--ink); color: var(--blue-deep); }
a { color: inherit; }

.site { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; padding-top: calc(var(--frame) + var(--head-h)); }
.container { flex: 1; width: 100%; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 滚动条：轨道是一根细刻度线，滑块是一段细爻条 ---------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: linear-gradient(90deg, transparent 5px, var(--rule-soft) 5px 6px, transparent 6px); }
::-webkit-scrollbar-track:horizontal { background: linear-gradient(180deg, transparent 5px, var(--rule-soft) 5px 6px, transparent 6px); }
::-webkit-scrollbar-thumb {
  min-height: 44px;
  background-color: var(--ink-3);
  border: 3.5px solid transparent;
  border-radius: 0;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-2); }
::-webkit-scrollbar-thumb:active { background-color: var(--ink); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }
/* 文本框右下角的拖拽角：两道斜刻线 */
::-webkit-resizer {
  background:
    linear-gradient(135deg, transparent 0 52%, var(--ink-3) 52% 58%, transparent 58% 70%, var(--ink-3) 70% 76%, transparent 76%);
}
/* Firefox 只认标准属性；不对 Chrome 生效，免得盖掉上面的样式 */
@supports (-moz-appearance: none) {
  * { scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }
}
/* 页面本身不显示原生滚动条，由图框右边线兼任（见 .frame-scroll） */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* 侧页、弹层的滚动条压在内框线上：不画轨道，只留一段 3px 的滑块 */
.history-panel ::-webkit-scrollbar-track,
.share-box::-webkit-scrollbar-track,
.detail-box::-webkit-scrollbar-track { background: transparent; }
.history-panel ::-webkit-scrollbar-thumb,
.share-box::-webkit-scrollbar-thumb,
.detail-box::-webkit-scrollbar-thumb { border-width: 4px; }

/* ---------- 制图角标（按钮、卡片、弹层共用） ---------- */
.btn, .confirm-box, .detail-box, .ai-profile-bar, .title-block, .seg, .ben-zhi, .reading-sheet, .toggle-switch {
  --c: var(--rule);
  --t: 8px;
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
  background-size:
    var(--t) 1px, 1px var(--t), var(--t) 1px, 1px var(--t),
    var(--t) 1px, 1px var(--t), var(--t) 1px, 1px var(--t);
  background-position: 0 0, 0 0, 100% 0, 100% 0, 0 100%, 0 100%, 100% 100%, 100% 100%;
  background-repeat: no-repeat;
}

/* ---------- 下划线文字按钮 ----------
   正文里的次要操作都是一行带淡下划线的字，悬停时字和线一起亮起。
   通往设置的两处（首页的生辰、结果页的「去设置」）用虚线；删除类悬停变朱，见各自的规则 */
.mh-edit, .mh-switch, .daily-name, .ritual-skip, .ai-goset, .link-act, .btn-quiet, .am-clear,
.undo-btn, .btn-clear, .github-support-link, .birth-type-note button, .btn-profile {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-decoration-color: var(--rule);
  transition: color var(--t-hover) ease, text-decoration-color var(--t-hover) ease;
}
.mh-edit:hover, .mh-switch:hover, .ritual-skip:hover, .ai-goset:hover, .link-act:hover, .btn-quiet:hover, .am-clear:hover,
.undo-btn:hover, .github-support-link:hover, .birth-type-note button:hover, .btn-profile:hover { color: var(--ink); text-decoration-color: var(--ink); }
.mh-edit, .ai-goset { text-decoration-style: dotted; }
.btn-profile:disabled, .btn-clear:disabled { opacity: .4; cursor: default; pointer-events: none; }

/* ---------- 注记：图纸上的小字标签 ----------
   所问、链接、图签、AI 的字段名、今日一卦的眉标、顶栏上挂着的问题，都是同一种小字 */
.rq-label, .q-carry i, .link-label, .title-block dt, .ai-field-label, .daily-eyebrow, .gs-eyebrow, .gs-xiang span, .xiang-src .xs-label {
  font-size: var(--fs-1);
  letter-spacing: .2em;
  color: var(--ink-3);
}

/* ---------- 图框：天干横分、地支纵分 ---------- */
.frame {
  position: fixed;
  inset: var(--frame);
  z-index: 3;
  pointer-events: none;
  border: 1px solid var(--rule);
}
.frame-zones { position: absolute; display: flex; font-size: 12px; line-height: 1; color: var(--ink-3); }
.frame-zones span { flex: 1; display: grid; place-items: center; position: relative; opacity: .55; transition: opacity .6s ease, color .6s ease; }
/* 此刻：今天的日干、现在的时辰 */
.frame-zones span.now { opacity: 1; color: var(--ink); }
.frame-zones span.now::after { content: ""; position: absolute; background: var(--ink); }
.frame-top span.now::after { left: 50%; width: 12px; margin-left: -6px; top: 0; height: 1px; }
.frame-left span.now::after { top: 50%; height: 12px; margin-top: -6px; left: 0; width: 1px; }
.frame-zones span + span::before { content: ""; position: absolute; background: var(--rule); }
.frame-top { left: 0; right: 0; top: calc(-1 * var(--frame)); height: var(--frame); }
.frame-top span + span::before { left: 0; bottom: 0; width: 1px; height: 5px; }
.frame-left { top: 0; bottom: 0; left: calc(-1 * var(--frame)); width: var(--frame); flex-direction: column; }
.frame-left span + span::before { top: 0; right: 0; height: 1px; width: 5px; }
/* 图框右边线兼做页面滚动条：当前位置那一段加粗，可拖动、可点按 */
.frame-scroll {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -8px;
  width: 15px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
}
.frame-scroll.on { pointer-events: auto; opacity: 1; cursor: pointer; }
.frame-scroll i {
  position: absolute;
  top: 0;
  left: 6px;
  width: 3px;
  height: 40px;
  background: var(--ink-2);
  cursor: grab;
  transition: background-color .2s ease, width .2s ease, left .2s ease;
  will-change: transform;
}
.frame-scroll:hover i { left: 5px; width: 5px; background: var(--ink); }
.frame-scroll.drag i { left: 5px; width: 5px; background: var(--ink); cursor: grabbing; }
.crop { position: absolute; width: 9px; height: 9px; border: 0 solid var(--ink-3); }
.crop.tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.crop.tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.crop.bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.crop.br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

/* ---------- 卦画（可动画） ---------- */
.hx { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.hx .bar { position: relative; height: 12.6%; --g: 0%; transition: --g .6s var(--ease); }
.hx .bar::before, .hx .bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(50% - var(--g) / 2);
  background: var(--line, var(--ink));
  transition: background-color .5s ease;
}
.hx .bar::before { left: 0; }
.hx .bar::after { right: 0; }
.hx .bar.yin { --g: 17%; }
.hx .bar.chg { --line: var(--zhu); }
.hx .bar.empty::before { width: 100%; background: none; border: 1px dashed var(--rule); }
.hx .bar.empty::after { display: none; }
.hx .bar.drop { animation: bar-drop .45s var(--ease-out) both; }
@keyframes bar-drop { from { opacity: 0; transform: translateY(-80%) scaleX(.6); } to { opacity: 1; transform: none; } }

.yao-art { display: block; width: 100%; height: auto; }
.yao-art path { fill: none; stroke: currentColor; stroke-linecap: butt; }
.yao-art path.changing { stroke: var(--zhu); }

.minimap { display: inline-grid; grid-template-columns: repeat(8, 1fr); gap: 1px; width: 36px; aspect-ratio: 1; vertical-align: middle; }
.minimap i { background: rgba(238, 242, 247, .16); }
.minimap i.on { background: var(--ink); }
.minimap.big { width: 120px; gap: 3px; }
.mini-ring { display: inline-block; width: 36px; height: 36px; vertical-align: middle; }
.mini-ring .mr-tick { stroke: rgba(238, 242, 247, .32); stroke-width: 1; }
.mini-ring .mr-on { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }

/* ---------- 六十四卦图层 ---------- */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity .4s ease, visibility 0s linear 0s;
}
.cosmos.away { opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s; }
/* 首页圆图：图层跟着文档走，滚动交给浏览器（圆心是文档坐标） */
.cosmos.scrolling { position: absolute; bottom: auto; height: 100vh; height: 100lvh; }
.cosmos.instant-show { transition: none; }
.cosmos-ring, .cosmos-deco { position: absolute; inset: 0; animation: cosmos-spin 520s linear infinite; }
@keyframes cosmos-spin { to { transform: rotate(360deg); } }
/* 牌册 / 设置铺满整页时圆图被盖住，停转省得一直重绘；关上后接着原来的角度转 */
body.dialog-open .cosmos-ring, body.dialog-open .cosmos-deco { animation-play-state: paused; }
.cosmos-deco { opacity: 0; transition: opacity .7s ease; }
.cosmos.show-deco .cosmos-deco { opacity: 1; }
.cosmos-deco svg { position: absolute; inset: 0; overflow: visible; }
.cosmos-deco .d-ring { fill: none; stroke: rgba(238, 242, 247, .15); }
.cosmos-deco .d-ring.faint { stroke: rgba(238, 242, 247, .07); stroke-dasharray: 2 6; }
.cosmos-deco .d-tick { stroke: rgba(238, 242, 247, .22); }
.cosmos-deco .d-major { stroke: rgba(238, 242, 247, .4); }
.cosmos-deco .d-label { fill: var(--ink-3); font-family: var(--text); font-size: 13px; text-anchor: middle; dominant-baseline: central; }
/* 刻度盘转动时卦环和装饰一直留在合成层上，每掷一爻不用重新栅格化 */
.cosmos.is-dial .cosmos-ring, .cosmos.is-dial .cosmos-deco { will-change: transform, rotate, translate; }
.cosmos-deco .m-cut { stroke: rgba(238, 242, 247, .36); stroke-dasharray: 3 4; }
/* 起卦时的标线：两条半径线夹着一道弧，标出还剩下的那段；虚线是之前切掉的边界（画在装饰层里随卦环转）。
   半径线是绕圆心转的细条；弧拆成左右两半，每半是一个只露出半边的圆环，转多少度露出多长 */
.cosmos-marks { position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease; }
.cosmos.is-dial .cosmos-marks { opacity: 1; }
.cosmos-marks:not(.armed) > * { visibility: hidden; }
.cosmos-marks svg { position: absolute; inset: 0; overflow: visible; }
.cosmos-marks .m-half, .cosmos-marks .m-sweep { position: absolute; overflow: hidden; }
.cosmos-marks .m-sweep { top: 0; }
.cosmos-marks .m-circle { position: absolute; box-sizing: border-box; border: 1.2px solid var(--ink); border-radius: 50%; }
.cosmos-marks .m-spoke { position: absolute; width: 0; height: 0; }
.cosmos-marks .m-spoke i { position: absolute; }
.cosmos-marks .m-ray { left: -.5px; width: 1px; background: rgba(238, 242, 247, .2); }
.cosmos-marks .m-edge { left: -.6px; width: 1.2px; background: var(--ink); }
.cosmos-marks .m-label { paint-order: stroke; stroke: var(--blue); stroke-width: 7px; stroke-linejoin: round; fill: var(--ink); font-family: var(--text); font-size: 15px; letter-spacing: .16em; text-anchor: middle; dominant-baseline: central; }
.cg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 100px;
  opacity: 0;
  transform-origin: 50% 50%;
  contain: layout style;
}

/* ---------- 顶栏 ---------- */
/* 顶栏固定在图框顶部，没有底色和遮罩，内容从它下面滚过去 */
.masthead {
  position: fixed;
  top: var(--frame);
  left: var(--frame);
  right: var(--frame);
  z-index: 4;
  height: var(--head-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.masthead::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: calc(-1 * var(--frame));
  right: calc(-1 * var(--frame));
  top: calc(-1 * var(--frame));
  bottom: -18px;
  background: linear-gradient(to bottom, var(--blue) 0, var(--blue) calc(100% - 18px), rgba(23, 57, 110, 0));
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
body.scrolled .masthead::before { opacity: 1; }
.brand { display: flex; align-items: center; gap: 12px; line-height: 1; padding: 6px 0; transition: opacity .5s ease; }
.brand b { font-family: var(--display); font-size: 21px; font-weight: 400; letter-spacing: .14em; }
.brand span { font-size: var(--fs-1); color: var(--ink-3); padding-left: 12px; border-left: 1px solid var(--rule); letter-spacing: .12em; }
body.view-home .brand { opacity: 0; pointer-events: none; }
/* 挂签：从图框顶边垂下来的两张竖排签条，顶上一个挂孔，底边剪成燕尾。
   悬停时签条往下一沉、整张反白；牌册的记录数是盖在签角上的一枚小印。 */
.masthead-nav { align-self: flex-start; display: flex; gap: 14px; }
.nav-tag {
  --tag-h: calc(var(--head-h) + 14px);
  --notch: 9px;
  position: relative;
  width: 40px;
  height: var(--tag-h);
  padding-top: 24px;
  display: flex;
  justify-content: center;
  color: var(--ink);
  transition: height .45s var(--ease-out);
}
/* 外层是签条的描边，内层是签面，两层同一个燕尾轮廓 */
.nav-tag::before, .nav-tag::after {
  content: "";
  position: absolute;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - var(--notch)), 0 100%);
  transform-origin: 50% 0;
}
.nav-tag::before { inset: 0; background: var(--rule); }
.nav-tag::after {
  inset: 0 1px 1.5px;
  background: linear-gradient(180deg, #1C4279, #183A6C);
  transition: background .35s ease;
}
.nav-tag-text {
  position: relative;
  z-index: 1;
  writing-mode: vertical-rl;
  font-family: var(--text);
  font-size: 17px;
  line-height: 1;
  letter-spacing: .32em;
  transition: color .35s ease;
}
/* 挂孔 */
.nav-tag-text::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -14px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--ink-3);
  transition: box-shadow .35s ease;
}
.nav-tag:hover, .nav-tag:focus-visible { --tag-h: calc(var(--head-h) + 22px); outline: none; }
.nav-tag:hover::after, .nav-tag:focus-visible::after { background: var(--ink); }
.nav-tag:hover .nav-tag-text, .nav-tag:focus-visible .nav-tag-text { color: var(--blue-deep); }
.nav-tag:hover .nav-tag-text::before, .nav-tag:focus-visible .nav-tag-text::before { box-shadow: inset 0 0 0 1px var(--blue-deep); }
.nav-tag:active { --tag-h: calc(var(--head-h) + 18px); }
/* 记录数：盖在签条右下角的小印，压出签边一点 */
.masthead-nav sup {
  position: absolute;
  z-index: 2;
  right: -11px;
  bottom: 16px;
  min-width: 20px;
  height: 18px;
  padding: 0 3px;
  display: grid;
  place-items: center;
  font-family: var(--text);
  font-size: 12px;
  line-height: 1;
  color: var(--ink);
  background: var(--blue-deep);
  border: 1px solid var(--ink);
  transform: rotate(-10deg);
}
.masthead-nav sup:empty { display: none; }
/* 入场：打开页面时签条从图框顶边依次垂落展开，落定轻晃一下，最后盖上小印。
   只在 body.intro 期间播放（theme.js 播完即撤），之后记录数出现或变化不会再重播 */
body.intro .nav-tag {
  transform-origin: 50% 0;
  animation: tag-drop 1.1s linear backwards;
  animation-delay: calc(640ms + var(--n, 0) * 140ms);
}
body.intro .nav-tag + .nav-tag { --n: 1; }
body.intro .masthead-nav sup { animation: seal-stamp .45s cubic-bezier(.3, 1.5, .5, 1) 1.55s backwards; }
/* 每段各用各的缓动：先垂落展开，再左右轻晃两下停住 */
@keyframes tag-drop {
  0% { clip-path: inset(0 -24px 100% -24px); transform: rotate(0); animation-timing-function: cubic-bezier(.3, .6, .35, 1); }
  50% { clip-path: inset(0 -24px -12px -24px); transform: rotate(2.6deg); animation-timing-function: ease-in-out; }
  75% { transform: rotate(-1.4deg); animation-timing-function: ease-in-out; }
  100% { clip-path: inset(0 -24px -12px -24px); transform: rotate(0); }
}
@keyframes seal-stamp {
  from { opacity: 0; transform: scale(1.9) rotate(-22deg); }
  to { opacity: 1; transform: rotate(-10deg); }
}

/* ---------- 首页 ---------- */
/* 首页固定一屏，不能滚动：内容整体落在图框里，矮屏时按高度收紧 */
html:has(> body.view-home), body.view-home { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.view-home .site { min-height: 0; height: 100svh; }
.home-view {
  height: calc(100svh - var(--head-h) - var(--frame) * 2);
  padding: 0 var(--gutter) 3vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.home-main { width: min(400px, 100%); text-align: center; }
/* 备案号贴着图框底边，不占首页那一屏的版面 */
.site-foot { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: var(--fs-1); line-height: 1.4; }
.site-foot a { color: var(--ink-3); text-decoration: none; transition: color var(--t-hover) ease; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.home-main > * { transition: opacity .35s ease, transform .5s var(--ease-out); }
/* 首次打开、脚本还没接手时先不露首页内容：否则未装好的原生下拉框等会先闪一下，接着入场动画又从头放一遍 */
body.intro .home-view:not(.entering) .home-main > * { opacity: 0; }
.home-view.entering .home-main > * {
  animation: rise .9s var(--ease-out) both;
  animation-delay: calc(var(--enter-delay, 0ms) + var(--k, 0) * 110ms);
}
body.casting .home-main > * {
  opacity: 0;
  transform: translateY(-12px);
  transition-delay: calc(var(--k, 0) * 60ms);
}
.home-title {
  font-family: var(--display);
  font-size: clamp(52px, 5.6vw, 72px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: .14em;
  text-indent: .14em;
}
/* 标题和输入区拉开：标题升到圆图上半部，输入区和按钮留在圆心附近 */
.question-area { margin-top: clamp(64px, 13vh, 130px); }
/* 尺寸线：两端短竖线。平时是浅一档的线；聚焦时底线加粗成两道、两端竖线拉长，仍是尺寸线的样子 */
.q-field { position: relative; border-bottom: 1px solid var(--ink-2); box-shadow: 0 1px 0 transparent; transition: border-color var(--t-hover) ease, box-shadow var(--t-hover) ease; }
.q-field::before, .q-field::after {
  content: "";
  position: absolute;
  bottom: -5px;
  width: 1px;
  height: 11px;
  background: var(--ink-2);
  transition: background-color var(--t-hover) ease, transform .3s var(--ease-out);
}
.q-field::before { left: 0; }
.q-field::after { right: 0; }
.q-field:focus-within { border-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
.q-field:focus-within::before, .q-field:focus-within::after { background: var(--ink); transform: scaleY(1.65); }
#question {
  display: block;
  width: 100%;
  padding: 8px 18px 10px;
  font-size: 21px;
  line-height: 1.5;
  text-align: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
}
#question::placeholder { color: var(--ink-3); opacity: .8; letter-spacing: .08em; transition: opacity .25s ease; }
#question:focus::placeholder { opacity: .45; }
/* 字数刻度平时不显示，离写满还剩 20 字时才出现 */
.q-count { position: absolute; left: 0; top: calc(100% + 7px); font-size: var(--fs-1); color: var(--ink-3); letter-spacing: .05em; opacity: 0; transition: opacity .25s ease; }
.q-count.show { opacity: 1; }
/* 尺寸线右端下面的一行小注「怎么问 ?」：悬停、聚焦或点一下，浮出提问的建议（借用术语浮窗）。
   字数刻度平时不显示，快写满时出现在同一行的左端，两者不打架 */
.q-help, .q-help.term {
  position: absolute; right: 0; top: calc(100% + 9px);
  font-family: var(--text); font-size: var(--fs-1); line-height: 1.4; letter-spacing: .1em; color: var(--ink-3);
  text-decoration: none; cursor: help; transition: color var(--t-hover) ease;
}
.q-help:hover, .q-help:focus-visible { color: var(--ink-2); }
.q-help:focus-visible { outline: 1px solid var(--ink-3); outline-offset: 3px; }
.form-row { margin-top: 34px; display: flex; align-items: center; justify-content: center; gap: 22px; }
/* 起卦方式下面的一行：铜钱画三枚铜钱，生辰画一弯月亮，后面跟已存的生辰；换一种起法时整行淡入 */
.method-hint { margin-top: 16px; min-height: 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; font-size: var(--fs-1); line-height: 1.6; color: var(--ink-3); }
.method-hint b { font-family: var(--text); font-weight: 600; font-size: var(--fs-3); letter-spacing: .12em; color: var(--ink-2); }
.mh-ico { height: 12px; width: auto; fill: none; stroke: var(--ink-2); stroke-width: 1; overflow: visible; }
.mh-ico .lit { fill: var(--ink-2); stroke: none; }
.method-hint.is-bazi b { color: var(--ink); }
.method-hint.is-bazi .mh-ico { stroke: var(--ink); }
.method-hint.is-bazi .mh-ico .lit { fill: var(--ink); }
.mh-edit { color: var(--ink); }
.mh-edit.need { text-decoration-color: var(--ink-2); }
/* 行尾换一种起法：前面一个间隔点，字本身是不抢眼的下划线小字 */
.mh-switch { display: inline-flex; align-items: center; gap: 10px; padding: 4px 0; white-space: nowrap; color: var(--ink-3); }
.mh-switch::before { content: "·"; text-decoration: none; display: inline-block; color: var(--ink-3); }
.method-hint.swap { animation: hint-swap .45s var(--ease-out); }
/* 报数起卦：问题框像一张牌那样绕横轴翻过去，背面是上卦、下卦两格。两面叠在同一个位置，翻的时候不占新地方。
   分两段翻：先把朝外的一面转到侧立（90°）并藏起来，另一面再从侧立转正。不靠 backface-visibility，
   输入框里的字单独合成时也不会从背面透出来 */
.q-flip { position: relative; perspective: 900px; }
.q-back {
  position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-end; gap: 36px;
  transform: rotateX(-90deg); visibility: hidden;
}
/* 翻回问题：报数那面先转走，问题那面随后转正 */
.q-flip > .q-field { transition: transform .32s var(--ease-out) .26s, visibility 0s .26s; }
.q-flip > .q-back { transition: transform .26s cubic-bezier(.5, 0, .9, .5), visibility 0s .26s; }
/* 翻到报数：问题那面先转走，报数那面随后转正 */
.q-flip.flipped > .q-field { transform: rotateX(90deg); visibility: hidden; transition: transform .26s cubic-bezier(.5, 0, .9, .5), visibility 0s .26s; }
.q-flip.flipped > .q-back { transform: none; visibility: visible; transition: transform .32s var(--ease-out) .26s, visibility 0s .26s; }
.q-back label { display: inline-flex; align-items: baseline; gap: 10px; font-size: var(--fs-1); letter-spacing: .12em; color: var(--ink-3); }
.q-back input {
  width: 4.6em; padding: 8px 2px 10px; font-size: 21px; line-height: 1.5; text-align: center; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--ink-2); border-radius: 0; outline: none;
  -moz-appearance: textfield; appearance: textfield; transition: border-color var(--t-hover) ease, box-shadow var(--t-hover) ease;
}
.q-back input::-webkit-outer-spin-button, .q-back input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.q-back input::placeholder { font-size: var(--fs-3); color: var(--ink-3); opacity: .8; letter-spacing: .08em; }
.q-back input:focus { border-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
/* 背面右下角「改问题」占「怎么问 ?」的位置 */
.q-return { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .q-flip > .q-field, .q-flip > .q-back, .q-flip.flipped > .q-field, .q-flip.flipped > .q-back { transition: none; } }
@keyframes hint-swap { from { opacity: 0; transform: translateY(6px); } }

/* 主按钮：实底，外加一道细线（像图纸上的双线框） */
.btn-divine, .cast-btn, .btn-primary {
  font-family: var(--text);
  font-weight: 600;
  background: var(--ink);
  color: var(--blue-deep);
  outline: 1px solid rgba(238, 242, 247, .5);
  outline-offset: 3px;
  transition: background-color .25s ease, outline-color .25s ease, transform .15s ease;
}
.btn-divine, .cast-btn { font-size: 18px; letter-spacing: .5em; text-indent: .5em; padding: 12px 32px; }
/* 悬停反白只给有鼠标的设备：触屏上 hover 会在点过之后一直留着，按钮看着像被禁用了 */
@media (hover: hover) {
  .btn-divine:hover, .cast-btn:hover, .btn-primary:hover { background: var(--blue-deep); color: var(--ink); outline-color: var(--ink); }
}
.btn-divine:active, .cast-btn:active, .btn-primary:active, .btn:active { transform: scale(.97); }
.btn-divine:disabled, .cast-btn:disabled { opacity: .55; cursor: default; }
.btn-divine:focus-visible, .cast-btn:focus-visible, .btn-primary:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* 两段切换（起卦方式 / 本卦之卦） */
.seg {
  --c: var(--rule);
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(var(--n, 2), 1fr);
  padding: 4px;
  background-color: transparent;
}
.seg-mark, .bz-mark {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / var(--n, 2));
  background: rgba(238, 242, 247, .14);
  box-shadow: inset 0 -2px 0 var(--ink);
  transform: translateX(calc(var(--idx, 0) * 100%));
  transition: transform .45s var(--ease-out);
}
.seg-opt { position: relative; z-index: 1; font-size: var(--fs-4); padding: 6px 16px; color: var(--ink-3); transition: color .25s ease; }
.seg-opt[aria-checked="true"] { color: var(--ink); }
.seg-opt:hover { color: var(--ink); }

/* 今日一卦：底部批注 */
/* 今日一卦：卦画居中，左边右对齐写「今日一卦」和卦名，右边左对齐写箴言，整块在首页居中 */
.daily-gua {
  margin: 46px auto 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  column-gap: 18px;
  align-items: center;
  cursor: pointer;
  padding: 8px 4px;
}
.daily-symbol { width: 30px; height: 30px; color: var(--ink-2); transition: color var(--t-hover) ease; }
.daily-symbol svg { display: block; width: 100%; height: 100%; }
.daily-side { display: grid; gap: 2px; line-height: 1.45; min-width: 0; }
.daily-side.left { justify-items: end; text-align: right; }
.daily-side.right { justify-items: start; text-align: left; }
.daily-name { font-size: var(--fs-4); color: var(--ink); }
/* 换行只落在标点后（和分享图一样），一句太长放不下才在句中断；再用 balance 把两行排匀，免得剩一个孤字 */
.daily-motto { font-size: var(--fs-3); color: var(--ink-2); max-width: 16em; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
/* 黄历一行：日干支 · 冲某生肖（· 本命年），横跨整张卡居中，比箴言再淡一档 */
.daily-almanac { grid-column: 1 / -1; justify-self: center; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; margin-top: 10px; font-size: var(--fs-1); letter-spacing: .12em; color: var(--ink-3); }
.daily-almanac span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.da-sep { font-style: normal; opacity: .6; }
.da-zod { display: block; width: 18px; height: 18px; color: var(--ink-2); }
.da-zod svg, .yw-zod svg { display: block; width: 100%; height: 100%; overflow: visible; }
.da-zod path, .da-zod line, .da-zod polyline, .da-zod circle, .da-zod ellipse,
.yw-zod path, .yw-zod line, .yw-zod polyline, .yw-zod circle, .yw-zod ellipse { stroke-width: 2.6; }
.da-ben { color: var(--ink-2); }
.daily-gua:hover .daily-symbol { color: var(--ink); }
.daily-gua:hover .daily-name { text-decoration-color: var(--ink); }

/* ---------- 仪式 ---------- */
/* 宽度跟着方图和掷钱栏走，整组在页面上居中，标题行也和它左右对齐 */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* 起卦：圆图当刻度盘。圆心是这一块（状态、铜钱、正在长出来的卦、掷钱按钮），
   六十四卦和标线在 cosmos 图层里，以这一块的中心为圆心 */
html:has(> body.view-ritual), body.view-ritual { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.view-ritual .site { min-height: 0; height: 100svh; }
.ritual-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  height: calc(100svh - var(--head-h) - var(--frame) * 2);
  display: grid;
  place-items: center;
  padding: 0 var(--gutter);
}
/* 「跳过」放在掷钱按钮正下方：主操作和次操作上下排着，不再挤在右上角的挂签底下 */
.ritual-foot { margin-top: 14px; text-align: center; }
.ritual-skip { font-size: var(--fs-3); color: var(--ink-3); padding: 6px 0; }
/* 高度固定：按钮出现、消失时圆心不挪 */
.dial-core { display: grid; justify-items: center; align-content: center; gap: 16px; width: min(280px, 78vw); height: 340px; }
.ritual-status { display: grid; align-content: end; justify-items: center; text-align: center; min-height: 72px; line-height: 1.45; }
.ritual-status-main { font-family: var(--display); font-size: 30px; font-weight: 400; letter-spacing: .08em; }
.ritual-status-sub { font-size: var(--fs-4); color: var(--ink-2); }
.coins { display: flex; gap: 12px; }
.coin { position: relative; width: 48px; height: 48px; perspective: 420px; }
.coin-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.coin-face { position: absolute; inset: 0; border-radius: 50%; background: var(--blue-deep); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.coin-face.bei { transform: rotateX(180deg); }
.coin-face svg { display: block; width: 100%; height: 100%; fill: none; stroke: var(--ink); stroke-width: 2; }
.coin-chars text { fill: var(--ink); stroke: none; font-family: var(--text); font-size: 17px; text-anchor: middle; }
.coin.toss-zi .coin-inner { animation: toss-zi var(--dur, 700ms) cubic-bezier(.3, .55, .35, 1) both; }
.coin.toss-bei .coin-inner { animation: toss-bei var(--dur, 700ms) cubic-bezier(.3, .55, .35, 1) both; }
@keyframes toss-zi {
  0% { transform: translateY(0) rotateX(0); }
  45% { transform: translateY(-34px) rotateX(calc(var(--turns, 3) * 170deg)); }
  100% { transform: translateY(0) rotateX(calc(var(--turns, 3) * 360deg)); }
}
@keyframes toss-bei {
  0% { transform: translateY(0) rotateX(0); }
  45% { transform: translateY(-34px) rotateX(calc(var(--turns, 3) * 170deg)); }
  100% { transform: translateY(0) rotateX(calc(var(--turns, 3) * 360deg + 180deg)); }
}
.cast-build { width: 112px; height: 100px; }
.cast-actions { min-height: 54px; display: grid; align-items: center; }
.ritual-stage.by-birth .coins { display: none; }
/* 立体铜钱：一张透明画布盖在这一格上，约 10 × 7 枚铜钱大，四边淡出（铜钱从画框外砸进来）；三枚散落比一行高，格子跟着高一点 */
.coins.coins-3d { position: relative; height: 72px; align-items: center; }
.coins.coins-3d .coin { visibility: hidden; }
.coins-3d-canvas { position: absolute; left: 50%; top: 50%; z-index: 1; transform: translate(-50%, -50%); pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent); mask-image: radial-gradient(closest-side, #000 72%, transparent); }
@media (max-height: 640px) {
  .dial-core { height: 290px; gap: 11px; }
  .ritual-status { min-height: 62px; }
  .ritual-status-main { font-size: 25px; }
  .coin { width: 40px; height: 40px; }
  .cast-build { width: 96px; height: 84px; }
}

/* 圆心的内容在圆图亮起时依次出现，结束时先退场 */
.dial-core > * { transition: opacity .55s ease, transform .7s var(--ease-out); }
.ritual-stage.pre .dial-core > * { opacity: 0; transform: translateY(10px); }
.dial-core > :nth-child(1) { transition-delay: 80ms; }
.dial-core > :nth-child(2) { transition-delay: 180ms; }
.dial-core > :nth-child(3) { transition-delay: 260ms; }
.dial-core > :nth-child(4) { transition-delay: 340ms; }
.dial-core > :nth-child(5) { transition-delay: 420ms; }
.ritual-stage.settling .dial-core > * { opacity: 0; transform: none; transition-duration: .3s; transition-delay: 0ms; }

.invocation { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; cursor: pointer; transition: opacity .38s ease; }
.invocation p { font-size: clamp(24px, 3.2vw, 30px); letter-spacing: .55em; writing-mode: vertical-rl; line-height: 1; }
.invocation span { display: inline-block; animation: char-in .7s var(--ease-out) both; animation-delay: calc(250ms + var(--k) * 85ms); }
@keyframes char-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.invocation.fade-out { opacity: 0; }

/* ---------- 结果页 ---------- */
.result { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter) 88px; transition: opacity .32s ease, transform .4s var(--ease-out); }
.result.entering [style^="--d"] { animation: rise .8s var(--ease-out) both; animation-delay: calc(180ms + var(--d) * 90ms); }
.result.leaving { opacity: 0; transform: translateY(-10px); }
.result-bar { display: flex; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-4); color: var(--ink-2); padding: 6px 0; transition: color var(--t-hover) ease, transform .25s var(--ease-out); }
.back-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.back-link:hover { color: var(--ink); transform: translateX(-3px); }
.result-question { margin-top: 22px; max-width: 32em; }
.rq-label { display: block; }
.result-question h1 { font-size: clamp(25px, 3.2vw, 32px); font-weight: 400; line-height: 1.45; overflow-wrap: anywhere; transition: opacity .22s ease; }
/* 问题从顶栏飞下来时：标题先空着、这一块不再上浮（落点要稳），「所问」小字照常浮现 */
.result.entering .result-question.carried { animation: none; }
.result-question.carried h1 { opacity: 0; transition: none; }
.result.entering .result-question.carried .rq-label { animation: rise .8s var(--ease-out) .27s both; }
/* 起卦时从输入框升到顶栏正中的问题（theme.js carryQuestion） */
.q-carry {
  position: fixed;
  z-index: 5;
  left: 0;
  top: 0;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  white-space: nowrap;
  pointer-events: none;
  transform-origin: 0 0;
}
.q-carry i { font-style: normal; }
.q-carry b { display: block; max-width: min(40vw, 520px); overflow: hidden; text-overflow: ellipsis; font-weight: 400; font-size: var(--fs-4); line-height: 1.45; color: var(--ink-2); }
.q-carry b.wrap { max-width: none; white-space: normal; overflow: visible; overflow-wrap: anywhere; color: var(--ink); }

.reading-layout {
  margin-top: 44px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(48px, 7vw, 104px);
  align-items: start;
}
.result-header { position: sticky; top: calc(var(--frame) + var(--head-h) + 24px); }

.glyph-figure { position: relative; width: 168px; height: 168px; }
.result-glyph { width: 168px; height: 168px; }
.result-glyph.awaiting { opacity: 0; }
.result-header:not(.landed) .hx .bar.chg { --line: var(--ink); }
.callouts { position: absolute; left: calc(100% + 10px); top: 0; height: 100%; width: 120px; margin: 0; padding: 0; list-style: none; }
.co {
  position: absolute;
  left: 0;
  top: calc(var(--r) * 17.48% + 6.3%);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-1);
  line-height: 1;
  color: var(--ink-3);
  white-space: nowrap;
}
.co::before {
  content: "";
  width: 20px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s var(--ease-out);
  transition-delay: calc(var(--r) * 55ms);
}
.co-name, .co-note { opacity: 0; transition: opacity .4s ease; transition-delay: calc(200ms + var(--r) * 55ms); }
.co.moving { color: var(--zhu); }
.landed .co::before { transform: scaleX(1); }
.landed .co-name, .landed .co-note { opacity: 1; }
.as-zhi .co-note { opacity: .5; }

.ben-zhi {
  --c: var(--rule);
  position: relative;
  margin-top: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  --n: 2;
}
.ben-zhi .bz-mark { --idx: 0; }
.as-zhi .ben-zhi .bz-mark { --idx: 1; }
.bz-opt { position: relative; z-index: 1; display: grid; text-align: left; padding: 7px 12px; font-size: var(--fs-1); color: var(--ink-3); line-height: 1.5; transition: color .25s ease; }
.bz-opt b { font-family: var(--text); font-size: var(--fs-5); font-weight: 600; color: var(--ink-2); transition: color .25s ease; }
.bz-opt[aria-pressed="true"] b { color: var(--ink); }
.bz-opt:hover b { color: var(--ink); }
.zhi-none { margin-top: 24px; font-size: var(--fs-3); color: var(--ink-3); }

/* 图签 */
.title-block {
  --c: var(--ink-3);
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--rule-soft);
}
.title-block > div { padding: 8px 12px; border-right: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); min-width: 0; }
.title-block > div:last-child { border-bottom: 0; }
.title-block .tb-wide { grid-column: span 2; border-right: 0; }
.title-block > div:nth-child(3), .title-block > div:nth-child(5) { border-right: 0; }
.title-block dt { line-height: 1.6; }
/* 标签带字距：术语的虚线只画在字下面，不拖出末尾那一截字距 */
.title-block dt .term { position: relative; text-decoration: none; }
.title-block dt .term::after { content: ""; position: absolute; left: 0; right: .2em; bottom: 0; border-bottom: 1px dotted var(--ink-3); }
.title-block dd { font-size: var(--fs-3); line-height: 1.5; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* 结果页图签：卦序｜上下 / 起卦｜方图 / 时间 */
.title-block.tb-result > div:nth-child(3), .title-block.tb-result > div:nth-child(5) { border-right: 1px solid var(--rule-soft); }
.title-block.tb-result > div:nth-child(2n):not(.tb-wide) { border-right: 0; }
.title-block.tb-result > div.tb-wide { border-right: 0; }

.reading { max-width: 39em; }
/* 读纸：正文区铺一层很淡的浅灰，和满屏的蓝图装饰分开；随结果页一起慢慢浮现 */
.reading-sheet {
  --t: 12px;
  margin-top: 40px;
  padding: 34px 36px 38px;
  background-color: rgba(226, 233, 243, .055);
  box-shadow: inset 0 0 0 1px var(--rule-soft);
}
.result.entering .reading-sheet { animation: sheet-in 1s ease both; animation-delay: 320ms; }
@keyframes sheet-in { from { opacity: 0; } to { opacity: 1; } }
.reading-sheet > .block:first-child { margin-top: 0; }
.reading-name-row { display: flex; align-items: center; gap: 26px; }
.hex-name { font-family: var(--display); font-size: clamp(46px, 6vw, 68px); font-weight: 400; line-height: 1.12; letter-spacing: .05em; }
/* 批印：双线方框，盖下去的动作 */
.verdict-seal {
  flex: none;
  width: 54px;
  height: 54px;
  padding: 3px;
  border: 2px solid currentColor;
  transform: rotate(-6deg);
}
.verdict-seal span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}
.verdict-seal.ji { color: var(--ink); }
.verdict-seal.xiong { color: var(--ink); }
.verdict-seal.xiong span { background: var(--ink); color: var(--blue-deep); border-color: var(--ink); }
.verdict-seal.ping { color: var(--ink-2); }
.result.entering .verdict-seal { animation: stamp .5s cubic-bezier(.3, 1.5, .5, 1) 1.15s both; }
@keyframes stamp { from { opacity: 0; transform: scale(1.9) rotate(-14deg); } to { opacity: 1; transform: scale(1) rotate(-6deg); } }
.hex-title { margin-top: 8px; font-size: 20px; color: var(--ink-2); }
/* 结果页的印章只说本卦的底色，不是结论：缩小、褪成淡色、不做盖印动作，旁边注明 */
.seal-wrap { display: flex; align-items: center; gap: 12px; flex: none; }
.seal-wrap.aside .verdict-seal { width: 40px; height: 40px; padding: 2px; border-width: 1px; color: var(--ink-3); transform: rotate(-4deg); }
.seal-wrap.aside .verdict-seal span { font-size: 18px; }
.result.entering .seal-wrap.aside .verdict-seal { animation: none; }
.seal-wrap.aside .verdict-seal.xiong span { background: var(--ink-3); border-color: var(--ink-3); }
.seal-note { font-size: var(--fs-1); line-height: 1.5; color: var(--ink-3); }
/* 术语：虚线下划，悬停、聚焦或点一下浮出一句白话（解释写在各处 term() 的 data-tip 里，theme.js 负责浮出） */
.term { cursor: help; text-decoration: underline dotted; text-decoration-color: var(--ink-3); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.term:focus-visible { outline: 1px solid var(--ink-3); outline-offset: 3px; }
.term-tip { position: fixed; z-index: 90; /* 要压过弹层（70）和确认框（80），弹层里的术语也会浮出解释 */left: 0; top: 0; max-width: min(300px, calc(100vw - 32px)); padding: 10px 13px 11px; background: var(--blue-deep); border: 1px solid var(--rule); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .65);
  font-family: var(--text); font-size: var(--fs-2); font-weight: 400; line-height: 1.7; letter-spacing: 0; text-align: left; color: var(--ink-2); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .16s ease, transform .2s var(--ease-out); }
.term-tip.on { opacity: 1; transform: none; }
.term-tip { white-space: pre-line; }
.term-tip b { display: block; margin-bottom: 3px; font-weight: 600; letter-spacing: .12em; color: var(--ink); }

/* 主断：结果页的主角。辞用展示字放大，出处和取法是两行小字 */
.main-reading { margin-top: 34px; padding-left: 22px; border-left: 2px solid var(--ink); }
.mr-label { font-family: var(--text); font-size: var(--fs-4); font-weight: 600; letter-spacing: .24em; color: var(--ink-2); }
.mr-line { margin-top: 10px; }
.mr-line + .mr-line { margin-top: 18px; }
.mr-quote { display: block; quotes: none; font-family: var(--display); font-size: clamp(30px, 3.5vw, 42px); line-height: 1.35; letter-spacing: .04em; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.mr-quote.long { font-size: clamp(24px, 2.5vw, 30px); line-height: 1.45; }
/* 展示字的逗号句号像西文标点：标点用正文字体，不加字距 */
.mr-quote .pu { font-family: var(--text); letter-spacing: 0; }
/* 标点挤压：全角标点只占半个字宽，字面在哪半边就收掉另一半，大字号下不再空出一大块 */
.mr-quote .pu { margin-right: -.42em; }
.mr-quote .pu.open { margin-right: 0; margin-left: -.42em; }
.mr-quote.xl { font-family: var(--text); font-size: 20px; line-height: 1.75; letter-spacing: .02em; }
.mr-from { display: block; margin-top: 6px; font-style: normal; font-size: var(--fs-4); color: var(--ink-2); }
.mr-how { margin-top: 12px; font-size: var(--fs-2); color: var(--ink-3); }
/* 主断的白话：紧跟在出处下面，正文字号，比辞淡一档 */
.mr-plain { margin-top: 10px; max-width: 34em; font-size: 17px; line-height: 1.85; color: var(--ink); opacity: .86; }

.block { margin-top: 46px; }
.block > h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-family: var(--text);
  font-size: var(--fs-4);
  font-weight: 400;
  letter-spacing: .24em;
  color: var(--ink-2);
}
.block > h3::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.rule-tag { font-family: var(--text); font-size: var(--fs-2); font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.analysis-list { font-size: 18px; line-height: 1.95; }
.change-details { margin-top: 16px; }
.change-details p { font-size: var(--fs-5); }
/* 象辞原文：放在白话前面，正文字体加粗一档，和下面的白话分开 */
.xiang-src, .change-details p.xiang-src { margin-bottom: 12px; font-size: 19px; font-weight: 600; line-height: 1.7; letter-spacing: .06em; color: var(--ink); }
.xiang-src .xs-label { margin-right: .9em; font-weight: 400; }
/* 之卦那段前面的一行小字：说明下面讲的是走向，不是眼下 */
.change-details p.zhi-lead { margin-bottom: 6px; font-size: var(--fs-2); color: var(--ink-3); }

/* 六爻：每一行开头是它自己那一根爻（阴爻中间断开，动爻朱色），左栏已经有大卦画，这里不再重画一个 */
.yao-list { list-style: none; margin: 4px 0 0; padding: 0; }
.yao-mark { --c: var(--ink-2); align-self: start; width: 32px; height: 6px; margin-top: .72em; background: var(--c); }
.yao-mark.yin { background: linear-gradient(90deg, var(--c) 40%, transparent 40% 60%, var(--c) 60%); }
.yao-item.changing .yao-mark { --c: var(--zhu); }
.yao-item {
  position: relative;
  display: grid;
  grid-template-columns: 32px 3.2em minmax(0, 1fr) auto;
  gap: 0 14px;
  align-items: baseline;
  padding: 10px 0;
  font-size: var(--fs-5);
}
.yao-name { font-family: var(--text); font-weight: 600; font-size: var(--fs-5); }
.yao-type { font-size: var(--fs-2); color: var(--ink-3); white-space: nowrap; }
.yao-item.changing .yao-type { color: var(--zhu); }
/* 点开一爻：白话从爻辞下面展开（高度用 grid 行从 0fr 过渡到 1fr） */
.yao-item.has-plain { cursor: pointer; }
.yao-item.has-plain:hover .yao-text, .yao-item.open .yao-text { color: var(--ink); }
.yao-item.has-plain:focus-visible { outline: 1px dashed var(--ink-3); outline-offset: 2px; }
.yao-plain { grid-column: 3 / -1; display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .35s var(--ease), opacity .25s ease; }
.yao-plain > span { min-height: 0; overflow: hidden; padding-top: 6px; font-size: 16px; line-height: 1.8; color: var(--ink-2); }
.yao-item.open .yao-plain { grid-template-rows: 1fr; opacity: 1; }

.ai-reading-text { white-space: pre-wrap; font-size: var(--fs-5); line-height: 1.9; }
.ai-error { color: var(--zhu); font-size: var(--fs-5); margin-bottom: 12px; }
/* AI 还没配置：不是出错，用说明文字的颜色；「去设置」和首页「去设置里修改生辰」同一个虚线下划线 */
.ai-unset { margin: 0; font-size: var(--fs-4); line-height: 1.8; color: var(--ink-3); }
.ai-unset-dot { margin: 0 .6em; }
.ai-goset { font-size: var(--fs-4); color: var(--ink); }
/* 复制提示词：没开站内解读时是这一栏的主按钮，下面一句说拿去哪里用；开了解读时排在「请 AI 解读」后面 */
.ai-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.ai-copy-note { margin-top: 12px; max-width: 36em; font-size: var(--fs-4); line-height: 1.8; color: var(--ink-3); }
.ai-copy-note .ai-goset { margin: 0 .2em; }
.ai-loading { display: flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: var(--fs-5); }
.ai-loading-dot { width: 16px; height: 4px; background: var(--ink-2); animation: ai-pulse 1.2s ease-in-out infinite; }
.ai-loading-dot:nth-child(2) { animation-delay: .15s; }
.ai-loading-dot:nth-child(3) { animation-delay: .3s; margin-right: 8px; }
@keyframes ai-pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.result-actions { margin-top: 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
/* 分享链接：一行链接 + 复制 / 发送，下面是「附上所问」和说明 */
/* 像图纸上的一行注记：虚线隔开，链接写在一道细线上，复制 / 发送是带下划线的字，不再是一组方框 */
.link-panel { margin-top: 22px; max-width: 600px; padding-top: 16px; border-top: 1px dashed var(--rule); }
.link-panel[hidden] { display: none; }
.link-row { display: flex; align-items: baseline; gap: 16px; }
.link-label { flex: none; }
.link-url { flex: 1; min-width: 0; padding: 3px 0 6px; font: 14px/1.5 var(--text); color: var(--ink-2); background: none; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; text-overflow: ellipsis; cursor: text; }
.link-url:focus { outline: none; color: var(--ink); border-bottom-color: var(--ink-3); }
.link-url::selection { background: rgba(238, 242, 247, .22); color: var(--ink); }
.link-act { flex: none; padding: 3px 0; font-size: var(--fs-3); color: var(--ink); }
.link-act.done { color: var(--ink-3); text-decoration-color: transparent; }
.link-foot { margin: 14px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; font-size: var(--fs-1); color: var(--ink-3); }
.link-q { position: relative; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; }
.link-q input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.link-box { position: relative; width: 13px; height: 13px; border: 1px solid var(--ink-3); transition: background-color .15s ease, border-color .15s ease; }
.link-box::after { content: ""; position: absolute; left: 3.5px; top: .5px; width: 4px; height: 8px; border: solid var(--blue-deep); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); opacity: 0; transition: opacity .15s ease; }
.link-q input:checked + .link-box { background: var(--ink); border-color: var(--ink); }
.link-q input:checked + .link-box::after { opacity: 1; }
.link-q input:focus-visible + .link-box { outline: 1px solid var(--ink); outline-offset: 3px; }
.shared-note { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--rule-soft); font-size: var(--fs-2); color: var(--ink-3); }
.btn {
  --c: var(--ink);
  position: relative;
  font-size: var(--fs-4);
  line-height: 1.5;
  padding: 9px 20px;
  background-color: transparent;
  box-shadow: inset 0 0 0 1px var(--rule-soft);
  transition: background-color var(--t-hover) ease, box-shadow var(--t-hover) ease, transform .15s ease;
}
.btn:hover { background-color: rgba(238, 242, 247, .08); box-shadow: inset 0 0 0 1px var(--rule); }
.btn.btn-primary { padding: 9px 22px; font-size: var(--fs-4); background-image: none; background-color: var(--ink); color: var(--blue-deep); box-shadow: none; }
@media (hover: hover) { .btn.btn-primary:hover { background-color: var(--blue-deep); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); } }
@media (hover: none) { .btn.btn-primary:hover { background-color: var(--ink); } }
.btn-quiet { background-image: none; box-shadow: none; color: var(--ink-2); }
.btn-quiet:hover { background-color: transparent; box-shadow: none; }
.btn-small { font-size: var(--fs-3); padding: 6px 14px; }
.btn:disabled { opacity: .45; cursor: default; }
.result-warning { margin-top: 18px; font-size: var(--fs-3); color: var(--ink-3); }


/* ---------- 侧页：牌册 / 设置 ---------- */
.history-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fade) ease;
}
.history-overlay.show { opacity: 1; pointer-events: auto; }
.history-panel {
  position: fixed;
  top: var(--frame);
  right: var(--frame);
  bottom: var(--frame);
  z-index: 61;
  width: min(480px, calc(100vw - var(--frame) * 2));
  display: flex;
  flex-direction: column;
  background: var(--blue-deep);
  border: 1px solid var(--rule);
  box-shadow: -30px 0 60px -30px rgba(0, 0, 0, .55);
  transform: translateX(calc(100% + var(--frame) + 40px));
  visibility: hidden;
  transition: transform .6s var(--ease-out), visibility 0s linear .6s;
}
.history-panel::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--rule-soft); pointer-events: none; }
.history-panel.show { transform: none; visibility: visible; transition: transform .6s var(--ease-out); }
/* 关着的页面：内容不排版、不绘制（settings.js 在收起动画放完后加上） */
.history-panel.parked { content-visibility: hidden; }
/* 从挂签展开 / 收回的过程中：面板停在展开位置，形状交给 theme.js 的 clip-path 动画 */
.history-panel.morphing,
#historyPanel.archive.morphing { visibility: visible; transform: none; opacity: 1; transition: none; }
/* 收回途中面板还看得见，但已经关了：点击要穿过去落到底下的页面上 */
.history-panel.morphing:not(.show) { pointer-events: none; }
.history-head {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 18px 28px;
  border-bottom: 1px solid var(--rule);
  margin: 0 5px;
}
.panel-title { display: flex; align-items: baseline; gap: 14px; }
.panel-title h3 { font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: .18em; line-height: 1.1; }
.panel-title span { font-size: var(--fs-1); color: var(--ink-3); }
.btn-close {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--rule);
  transition: transform .45s var(--ease-out), box-shadow .2s ease;
}
.btn-close::before, .btn-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 1.5px;
  margin: -.75px 0 0 -8px;
  background: var(--ink);
  transform: rotate(45deg);
}
.btn-close::after { transform: rotate(-45deg); }
.btn-close:hover { transform: rotate(90deg); box-shadow: inset 0 0 0 1px var(--ink); }
.settings-content { position: relative; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.history-panel.show .settings-group { animation: fade-in .5s ease both; animation-delay: calc(120ms + var(--k, 0) * 40ms); }
/* 设置像挂轴一样放下（theme.js unrollSettings）：轴从挂签处撑开、往下走，图纸跟着露出来；
   各组的浮现和分隔线由脚本按轴走到的时刻安排，这里的统一淡入让开 */
.history-panel.unrolling .settings-group, .history-panel.show.unrolled .settings-group { animation: none; }
.unrolling .settings-group { position: relative; border-bottom-color: transparent; }
.unrolling .settings-group:not(:last-child)::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; border-bottom: 1px dashed var(--rule); pointer-events: none; }
.scroll-rod { position: fixed; z-index: 62; height: 6px; margin-top: -3px; pointer-events: none; background: var(--ink-2); border-radius: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 10px 18px -8px rgba(0, 0, 0, .75); }
.scroll-rod::before, .scroll-rod::after { content: ""; position: absolute; top: -3px; width: 4px; height: 12px; background: var(--ink); border-radius: 1px; }
.scroll-rod::before { left: -5px; }
.scroll-rod::after { right: -5px; }

/* ---------- 图册（牌册）：整页升起，左边方图总览，右边时间线 ---------- */
/* 整页图册原地展开：不上下移动，只淡入并从略小放到原大 */
#historyPanel.archive {
  left: var(--frame);
  width: auto;
  opacity: 0;
  transform: scale(.985);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6);
  transition: opacity .35s ease, transform .5s var(--ease-out), visibility 0s linear .5s;
}
#historyPanel.archive.show { opacity: 1; transform: none; transition: opacity .35s ease, transform .5s var(--ease-out); }
/* 卦飞进方图时面板必须已在原大：show 和 morphing 同时挂上时，不能让上面从 .985 放大的过渡生效，
   否则量到的格子位置是缩小了的，卦落定后会跳一下 */
#historyPanel.archive.show.morphing { transform: none; transition: none; }
.archive .history-head { padding: 22px 22px 18px 32px; }
.archive-body { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(330px, 420px) minmax(0, 1fr); margin: 0 5px; }
.archive-map { overflow-y: auto; padding: 28px 34px 28px 28px; border-right: 1px solid var(--rule-soft); overscroll-behavior: contain; }
.archive-list { overflow-y: auto; padding: 8px 40px 40px 36px; overscroll-behavior: contain; }

.am-big { font-size: var(--fs-4); color: var(--ink-2); }
.am-big b { font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--ink); margin-right: 2px; }
.am-big b + b, .am-big b:last-child { font-size: 22px; }
.am-bar { display: flex; height: 4px; gap: 2px; margin-top: 12px; }
.am-bar i { min-width: 0; }
.am-bar .ji { background: var(--ink); }
.am-bar .ping { background: var(--ink-3); }
.am-bar .xiong { background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px); }
.am-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: var(--fs-1); color: var(--ink-3); }
.am-legend .am-legend-k { color: var(--ink-3); letter-spacing: .1em; }
.am-legend .ji { color: var(--ink); }
.am-legend .xiong { color: var(--ink-2); }
/* 图例前画一小段和比例条同色的色块，说明哪段颜色是吉、平、凶 */
.am-legend .ji::before, .am-legend .ping::before, .am-legend .xiong::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 4px;
  margin-right: 6px;
  vertical-align: middle;
}
.am-legend .ji::before { background: var(--ink); }
.am-legend .ping::before { background: var(--ink-3); }
.am-legend .xiong::before { background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px); }
.am-top { margin-left: auto; }

.am-frame {
  margin-top: 26px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: 22px auto;
}
.am-cols, .am-rows { display: grid; font-size: 12px; color: var(--ink-3); line-height: 1; }
.am-cols { grid-column: 2; grid-template-columns: repeat(8, 1fr); text-align: center; align-items: center; }
.am-rows { grid-column: 1; grid-row: 2; grid-template-rows: repeat(8, 1fr); align-items: center; }
.am-grid {
  grid-column: 2;
  grid-row: 2;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 1px solid var(--rule);
  background-image: linear-gradient(var(--rule-soft) 1px, transparent 1px), linear-gradient(90deg, var(--rule-soft) 1px, transparent 1px);
  background-size: 12.5% 12.5%;
  background-position: -1px -1px;
}
.am-cell { position: relative; display: grid; place-items: center; padding: 22%; cursor: default; }
.am-cell .hx { opacity: .09; transition: opacity .3s ease, transform .3s var(--ease-out); }
.am-cell.lit { cursor: pointer; }
.am-cell.lit .hx { opacity: calc(.38 + var(--w) * .62); }
.am-cell em { position: absolute; right: 2px; top: 1px; font-style: normal; font-size: 9.5px; line-height: 1; color: var(--ink-2); }
.am-cell.lit:hover .hx, .am-cell.hover .hx { opacity: 1; transform: scale(1.15); }
.am-cell.hover, .am-cell.lit:hover { box-shadow: inset 0 0 0 1px var(--ink-2); }
.am-cell.sel { box-shadow: inset 0 0 0 1.5px var(--ink); }
.am-cell.sel .hx { opacity: 1; --line: var(--ink); }
.am-cell:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.history-panel.show:not(.quiet) .am-cell.lit .hx { animation: cell-lit .6s var(--ease-out) both; animation-delay: calc(260ms + var(--o) * 32ms); }
@keyframes cell-lit { from { opacity: 0; transform: scale(.4); } }
/* 亮着的卦飞进方图的过程中：亮格子里的真卦画先藏起来，落定后换回；卦是飞进来亮起的，不再另放点亮动画 */
.history-panel.flying .am-cell.lit .hx { visibility: hidden; }
/* 不在滚动区里的格子不飞，真卦画照常显示（被滚动区裁掉，看不到也不会跳） */
.history-panel.flying .am-cell.lit.am-still .hx { visibility: visible; }
#historyPanel.dousing { pointer-events: none; }
.history-panel.flying .am-cell.lit .hx, .history-panel.show.flown:not(.quiet) .am-cell.lit .hx { animation: none; }
.archive-flyer { position: fixed; z-index: 62; pointer-events: none; transform-origin: 50% 50%; }
.am-caption { margin-top: 14px; font-size: var(--fs-2); color: var(--ink-3); min-height: 2.6em; }
.am-caption b { font-family: var(--text); font-weight: 600; color: var(--ink); }
.am-clear { margin-left: 8px; font-size: var(--fs-1); color: var(--ink-2); }

/* 时间线 */
.tl-group { position: relative; max-width: 760px; }
.tl-group h4 {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  padding: 22px 0 10px;
  background: var(--blue-deep);
  font-family: var(--text);
  font-size: var(--fs-4);
  font-weight: 400;
  letter-spacing: .2em;
  color: var(--ink-2);
}
.tl-group h4 em { font-family: var(--text); font-style: normal; font-size: var(--fs-1); letter-spacing: 0; color: var(--ink-3); }
.tl-group h4::after { content: ""; flex: 1; height: 1px; background: var(--rule-soft); align-self: center; }
.tl-group ol { list-style: none; margin: 0; padding: 0; position: relative; }
/* 竖向时间轴 */
.tl-group ol::before { content: ""; position: absolute; left: 52px; top: 0; bottom: 0; width: 1px; background: var(--rule-soft); }
.tl-row {
  position: relative;
  display: grid;
  grid-template-columns: 40px 26px minmax(0, 1fr) 30px;
  gap: 0 22px;
  align-items: center;
  padding: 10px 8px 10px 0;
  cursor: pointer;
  border-radius: 2px;
  transition: background-color var(--t-hover) ease;
}
.tl-row::before {
  content: "";
  position: absolute;
  left: 49px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--blue-deep);
  box-shadow: inset 0 0 0 1px var(--ink-3);
  transition: background-color var(--t-hover) ease, box-shadow var(--t-hover) ease;
}
.tl-row:hover, .tl-row:focus-visible { background: rgba(238, 242, 247, .05); outline: none; }
.tl-row:hover::before, .tl-row:focus-visible::before { background: var(--ink); box-shadow: none; }
.tl-time { font-size: var(--fs-1); color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.history-thumb { width: 26px; height: 26px; margin-left: 12px; }
.tl-main { min-width: 0; display: grid; gap: 2px; margin-left: 12px; }
.history-q { font-size: var(--fs-5); line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-q.blank { color: var(--ink-3); }
.history-gua { font-size: var(--fs-1); color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 0 .7em; align-items: baseline; }
.history-gua b { font-family: var(--text); font-weight: 600; font-size: var(--fs-3); color: var(--ink); }
.history-change { color: var(--ink-3); }
/* 吉凶小印紧跟本卦名：说的是本卦，不是箭头后面的之卦 */
.history-verdict { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; margin-left: -.35em; border: 1px solid currentColor; font-size: 11px; line-height: 1; align-self: center; }
.history-verdict.v-ji { color: var(--ink); }
/* 叉号还是 28px 那么大，可点范围用负外边距扩到 40px，不挤动这一行的布局 */
.history-del { position: relative; width: 40px; height: 40px; margin: -6px; border-radius: 50%; opacity: 0; transition: opacity var(--t-hover) ease, background-color var(--t-hover) ease; }
.history-del::before, .history-del::after { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 1.3px; margin: -.65px 0 0 -5.5px; background: var(--ink-2); transform: rotate(45deg); }
.history-del::after { transform: rotate(-45deg); }
.history-item:hover .history-del, .history-item:focus-within .history-del { opacity: 1; }
.history-del:hover { background: rgba(255, 138, 92, .18); }
.history-del:hover::before, .history-del:hover::after { background: var(--zhu); }
/* 第一下点过：整行染一层淡朱，× 换成带框的「删除」，等第二下 */
.history-item.arming, .history-item.arming:hover { background: rgba(255, 138, 92, .1); box-shadow: inset 2px 0 0 var(--zhu); }
.history-del.arm { width: auto; height: auto; margin: 0; padding: 4px 10px; justify-self: end; border-radius: 0; opacity: 1; background: none; box-shadow: inset 0 0 0 1px var(--zhu); font-size: var(--fs-2); line-height: 1.4; letter-spacing: .12em; text-indent: .12em; white-space: nowrap; color: var(--zhu); }
.history-del.arm:hover { background: rgba(255, 138, 92, .18); }
.history-del.arm::before, .history-del.arm::after { display: none; }
.history-panel.show:not(.quiet) .tl-row { animation: fade-in .45s ease both; animation-delay: calc(160ms + var(--k, 0) * 30ms); }
.history-item.deleting { animation: row-out .3s ease forwards !important; pointer-events: none; }
@keyframes row-out { to { opacity: 0; transform: translateX(-16px); } }
/* 空牌册：左栏是全暗的方图，右栏只有两行字 */
.history-empty { padding: 72px 0; text-align: center; }
.history-empty p { font-size: var(--fs-5); }
.am-frame-empty { margin-top: 0; }
.history-empty .history-empty-hint { margin-top: 4px; font-size: var(--fs-3); color: var(--ink-3); }
.history-panel.show:not(.quiet) .history-empty { animation: fade-in .5s ease both; animation-delay: .15s; }
.panel-foot { position: relative; flex: none; margin: 0 5px 5px; padding: 12px 23px; border-top: 1px solid var(--rule-soft); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
/* 删掉一条后底栏右边的「已删除 · 撤销」，几秒后自己淡出 */
.undo-note { min-width: 0; font-size: var(--fs-2); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s; }
.undo-note.on { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.undo-btn { margin-left: 12px; font-size: var(--fs-3); color: var(--ink); }
/* 删除类（清空牌册、删除 AI 配置）平时和别的文字按钮一样是中性色，指上去才变朱 */
.btn-clear { font-size: var(--fs-3); color: var(--ink-3); padding: 4px 0; }
.btn-clear:hover, .btn-profile-del:hover { color: var(--zhu); text-decoration-color: var(--zhu); }

/* 设置 */
.settings-content { padding: 6px 28px 28px; }
.settings-group { padding: 20px 0; border-bottom: 1px dashed var(--rule); }
.settings-group:last-child { border-bottom: 0; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-label { display: block; font-size: var(--fs-5); }
.settings-group > .settings-label { margin-bottom: 10px; }
/* 从首页的生辰那一行点进设置：左边一道竖线自上而下引出，标题提亮，年轮、月相带、时辰钟依次亮起 */
#baziSettings { position: relative; }
#baziSettings.beckon::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 22px;
  bottom: 22px;
  width: 2px;
  background: var(--ink);
  transform-origin: 50% 0;
  animation: bz-mark 1.7s var(--ease-out) .55s both;
}
#baziSettings.beckon > .settings-label { animation: bz-label 1.7s ease .55s both; }
/* 从结果页「去设置」进来，AI 那一组用同一道竖线引一下 */
.settings-group.beckon:not(#baziSettings) { position: relative; }
.settings-group.beckon:not(#baziSettings)::before { content: ""; position: absolute; left: -14px; top: 22px; bottom: 22px; width: 2px; background: var(--ink); transform-origin: 50% 0; animation: bz-mark 1.7s var(--ease-out) .55s both; }
.settings-group.beckon:not(#baziSettings) > .settings-row > .settings-label { animation: bz-label 1.7s ease .55s both; }
#baziSettings.beckon .slip-part { animation: bz-wake .7s var(--ease-out) .7s both; }
#baziSettings.beckon .slip-part:nth-child(2) { animation-delay: .85s; }
#baziSettings.beckon .slip-part:nth-child(3) { animation-delay: 1s; }
@keyframes bz-mark { 0% { transform: scaleY(0); opacity: 1; } 35% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes bz-label { 0%, 70% { color: var(--ink); } }
@keyframes bz-wake { from { opacity: .18; transform: translateY(8px); } }
.settings-hint { margin-top: 8px; font-size: var(--fs-2); line-height: 1.7; color: var(--ink-3); }
/* 关于：原来的页脚挪到设置最后 */
.settings-about .github-support-link { margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-3); color: var(--ink-2); }
.about-copy { margin-top: 10px; font-size: var(--fs-1); color: var(--ink-3); }
.settings-input, .settings-select {
  display: block;
  width: 100%;
  padding: 6px 0 7px;
  font-size: var(--fs-4);
  line-height: 1.5;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  outline: none;
  transition: border-color var(--t-hover) ease;
}
.settings-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23A7B8D3' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}
.settings-select option { background: var(--blue-deep); color: var(--ink); }
.settings-input:focus, .settings-select:focus { border-color: var(--ink); }
.settings-input::placeholder, .settings-textarea::placeholder { color: var(--ink-3); opacity: .7; }
.settings-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: var(--fs-2);
  line-height: 1.7;
  background: rgba(4, 12, 28, .25);
  border: 1px solid var(--rule-soft);
  border-radius: 0;
  outline: none;
  resize: vertical;
}
.settings-textarea:focus { border-color: var(--ink); }
.settings-panel .seg { flex: none; }
/* 起卦方式：五行单选，每行只写名字；选中的一行提亮并在左边划一道竖线。
   做法和出处收进每行右端的「?」，和首页「怎么问 ?」同一种小字，悬停或点一下浮出 */
.method-list { margin-top: 12px; display: flex; flex-direction: column; border-top: 1px solid var(--rule-soft); }
.ml-row { position: relative; }
.ml-opt {
  position: relative; display: flex; align-items: baseline; gap: 14px; width: 100%; padding: 7px 40px 7px 14px; text-align: left;
  border-bottom: 1px solid var(--rule-soft); color: var(--ink-3); transition: color var(--t-hover) ease, background-color var(--t-hover) ease;
}
.ml-opt b { flex: none; font-weight: 600; font-size: var(--fs-3); letter-spacing: .1em; color: var(--ink-2); }
.ml-opt::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--ink); transform: scaleY(0); transition: transform .3s var(--ease-out); }
.ml-opt:hover { color: var(--ink-2); background: rgba(238, 242, 247, .04); }
.ml-opt[aria-checked="true"] { color: var(--ink-2); background: rgba(238, 242, 247, .07); }
.ml-opt[aria-checked="true"] b { color: var(--ink); }
.ml-opt[aria-checked="true"]::before { transform: none; }
.ml-opt:focus-visible { outline: 1px solid var(--ink-3); outline-offset: -1px; }
.ml-help, .ml-help.term {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px;
  font-family: var(--text); font-size: var(--fs-1); line-height: 32px; letter-spacing: .1em; text-align: center; color: var(--ink-3);
  text-decoration: none; cursor: help; transition: color var(--t-hover) ease;
}
.ml-help:hover, .ml-help:focus-visible { color: var(--ink-2); }
.ml-help:focus-visible { outline: 1px solid var(--ink-3); outline-offset: -3px; }

.sr-native { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* 生辰直接输入：年、月、日、时辰一行，和下面三件器具互相同步 */
.birth-type { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.birth-type label { display: inline-flex; align-items: flex-end; gap: 6px; color: var(--ink-3); font-size: var(--fs-3); }
.birth-type input, .birth-type select {
  padding: 6px 2px 7px; font-size: var(--fs-5); line-height: 1.5; text-align: center; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; outline: none;
  transition: border-color var(--t-hover) ease;
}
.birth-type input { -moz-appearance: textfield; appearance: textfield; }
.birth-type input::-webkit-outer-spin-button, .birth-type input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.birth-type input::placeholder { color: var(--ink-3); opacity: .7; }
#baziYear { width: 4.2em; }
#baziDay { width: 2.6em; }
.birth-type select {
  appearance: none; -webkit-appearance: none; text-align: left; padding-right: 20px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23A7B8D3' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 4px center;
}
.birth-type select option { background: var(--blue-deep); color: var(--ink); }
.birth-type input:focus, .birth-type select:focus { border-color: var(--ink); }
/* 月份、时辰的宫格选择（instruments.js makeGridPick）：按钮长得和旁边的输入框一样，展开是一块带裁切角的深蓝图纸 */
.pick { position: relative; display: inline-block; }
.pick-btn {
  min-width: 3.6em; padding: 6px 22px 7px 2px; font-size: var(--fs-5); line-height: 1.5; text-align: left; color: var(--ink);
  background: transparent no-repeat right 4px center; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; outline: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23A7B8D3' stroke-width='1.4'/%3E%3C/svg%3E");
  transition: border-color var(--t-hover) ease;
}
/* 宽度固定，按最长的那一项留够：换选项时这一行不会忽宽忽窄、把时辰挤到下一行 */
.pick-baziMonth .pick-btn { width: 4em; }
.pick-baziHour .pick-btn { width: 7.6em; }
.pick-btn.empty { color: var(--ink-3); }
.pick-btn:hover, .pick-btn:focus-visible, .pick-btn[aria-expanded="true"] { border-color: var(--ink); outline: none; }
.pick-pop {
  position: absolute; z-index: 6; top: calc(100% + 8px); left: 0;
  padding: 10px; background: var(--blue-deep); border: 1px solid var(--rule);
  box-shadow: 0 12px 32px rgba(4, 12, 28, .5);
  animation: pick-in .18s var(--ease-out);
}
.pick-pop.end { left: auto; right: 0; }
@keyframes pick-in { from { opacity: 0; transform: translateY(-4px); } }
.pick-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(52px, auto)); gap: 2px; }
.pick-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 40px; padding: 6px 8px; font-size: var(--fs-4); color: var(--ink-2); white-space: nowrap;
  background: transparent; border: 0; cursor: pointer; outline: none;
  transition: color var(--t-hover) ease, background-color var(--t-hover) ease;
}
.pick-cell b { font-family: var(--display); font-weight: 400; font-size: 20px; line-height: 1.2; }
.pick-cell small { font-size: var(--fs-1); color: var(--ink-3); }
.pick-cell.wide { grid-column: 1 / -1; flex-direction: row; gap: 10px; }
.pick-cell:hover, .pick-cell:focus-visible { color: var(--ink); background: rgba(238, 242, 247, .07); }
.pick-cell:focus-visible { box-shadow: inset 0 0 0 1px var(--ink-3); }
.pick-cell[aria-selected="true"] { color: var(--ink); background: rgba(238, 242, 247, .12); box-shadow: inset 0 -2px 0 var(--ink); }
.pick-cell[aria-selected="true"] small { color: var(--ink-2); }
.birth-type-note { margin: 10px 0 16px; font-size: var(--fs-2); line-height: 1.7; color: var(--ink-3); }
.birth-type-note button { color: var(--ink-2); }

/* 生辰签：上面敲的公历，换成程序实际起卦用的农历年、月日、时辰。
   一行大字，四角裁切线框住，细竖线分成三段，月日配当天的月相、时辰配一个小钟面，注记写在下面。
   三段各是一个按钮，点开下面对应的器具；点开的那段，字下画一道线 */
.birth-slip {
  position: relative; display: flex; padding: 16px 4px 14px;
  --c: var(--ink-3);
  background:
    linear-gradient(var(--c), var(--c)) left top / 12px 1px no-repeat, linear-gradient(var(--c), var(--c)) left top / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 12px 1px no-repeat, linear-gradient(var(--c), var(--c)) right top / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 12px 1px no-repeat, linear-gradient(var(--c), var(--c)) left bottom / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 12px 1px no-repeat, linear-gradient(var(--c), var(--c)) right bottom / 1px 12px no-repeat;
}
.slip-part { flex: 1 1 0; min-width: 0; padding: 2px 8px; text-align: center; }
.slip-part:nth-child(2) { flex-grow: 1.3; }
.slip-part + .slip-part { box-shadow: -1px 0 0 var(--rule-soft); }
.slip-v { display: grid; justify-items: center; row-gap: 4px; }
.slip-v b {
  position: relative; padding-bottom: 5px; margin-right: -.12em;
  font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.2; letter-spacing: .12em; color: var(--ink); white-space: nowrap;
}
.slip-v b::after { content: ""; position: absolute; left: 10%; right: calc(10% + .12em); bottom: 0; height: 1.5px; background: var(--ink); transform: scaleX(0); transition: transform .35s var(--ease-out); }
.slip-part[aria-expanded="true"] b::after { transform: scaleX(1); }
/* 注记一行：生肖、月相、小钟面放在字的下面，跟着注记走，大字那一行不挤 */
.slip-sub { display: inline-flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; min-width: 0; }
.slip-v small { font-size: 12px; line-height: 1.4; letter-spacing: .2em; margin-right: -.2em; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-ico { flex: none; width: 14px; height: 14px; }
.slip-ico:empty { display: none; }
.slip-ico.zod { width: 20px; height: 20px; color: var(--ink-2); }
.slip-ico svg { display: block; width: 100%; height: 100%; overflow: visible; }
.slip-ico.zod path, .slip-ico.zod line, .slip-ico.zod polyline, .slip-ico.zod circle, .slip-ico.zod ellipse { stroke-width: 2.6; }
.slip-ico .m-dark { fill: rgba(238, 242, 247, .07); stroke: var(--ink-3); stroke-width: 1; }
.slip-ico .m-lit { fill: var(--ink-2); }
.slip-ico .c-ring { fill: none; stroke: var(--ink-3); stroke-width: 1.2; }
.slip-ico .c-tick { stroke: var(--ink-3); stroke-width: 1.2; }
.slip-ico .c-hand { stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; }
.slip-ico .c-dot { fill: var(--ink-2); }
.slip-part:hover b, .slip-part:focus-visible b { text-shadow: 0 0 12px rgba(238, 242, 247, .35); }
.slip-part:focus-visible { outline: 1px dashed var(--ink-3); outline-offset: -2px; }
.slip-part.empty b { color: var(--ink-3); }
@media (max-width: 440px) {
  .slip-part { padding: 2px 4px; }
  .slip-v b { font-size: 20px; letter-spacing: .06em; margin-right: -.06em; }
  .slip-v small { letter-spacing: .1em; margin-right: -.1em; }
  .slip-sub { gap: 4px; }
  .slip-ico.zod { width: 18px; height: 18px; }
}
.slip-note { margin-top: 8px; font-size: var(--fs-1); line-height: 1.6; color: var(--ink-2); }
.slip-note:empty { display: none; }

/* 器具平时收着，点生辰签的一段才展开那一件；同一时间只开一件 */
.birth-tool { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .45s var(--ease), opacity .3s ease; }
.birth-tool.open { grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows .45s var(--ease), opacity .35s ease .1s; }
.birth-tool-in { min-height: 0; overflow: hidden; }
.birth-tool.open .birth-tool-in { padding: 16px 0 4px; }
.birth-tool .birth-tool-in { transition: padding .45s var(--ease); }
.birth-dial { display: grid; place-items: center; }

/* 年：竖向年轮。中间读数框里的一行最大最亮，越往上下越小越淡；每行写年份和干支、生肖 */
.yw { display: grid; gap: 8px; }
.yw-window {
  position: relative;
  height: 168px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
.yw.dragging .yw-window { cursor: grabbing; }
.yw-window:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.yw-list { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.yw-row {
  --k: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 18px;
  opacity: calc(.18 + var(--k) * .82);
  transform: scale(calc(.66 + var(--k) * .34));
  transform-origin: 18px 50%;
}
.yw-row b { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1; letter-spacing: .04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.yw-row span { font-family: var(--text); font-size: 15px; letter-spacing: .12em; color: var(--ink-2); }
.yw-row.on span { color: var(--ink); }
.yw-row span { display: inline-flex; align-items: center; }
.yw-zod { display: block; width: 24px; height: 24px; margin-left: 10px; color: var(--ink); }
.yw-row.on:has(.yw-zod) em { display: none; }
.yw-row em { font-style: normal; margin-left: .35em; }
.yw.empty .yw-row.on b, .yw.empty .yw-row.on span { color: var(--ink-3); }
/* 读数框：上下两道细线，左边一道亮色短线 */
.yw-frame { position: absolute; left: 0; right: 0; top: 50%; height: 40px; margin-top: -20px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); pointer-events: none; }
.yw-frame::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; background: var(--ink); }
.yw.empty .yw-frame::before { opacity: .45; }
.yw-note { font-size: 12px; line-height: 1.6; color: var(--ink-3); }

/* 月相带：一整年的月相排成一条胶片，拖到出生那天停在指针下；上方一排月份做粗调 */
.band { display: grid; gap: 10px; }
.band-read { display: grid; justify-items: start; gap: 2px; min-height: 52px; }
.band-date { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.15; letter-spacing: .06em; color: var(--ink); }
.band-date small { margin-left: 10px; font-family: var(--text); font-size: var(--fs-1); letter-spacing: .2em; color: var(--ink-3); }
.band-lunar { font-size: var(--fs-1); letter-spacing: .06em; color: var(--ink-2); }
.band.empty .band-date { color: var(--ink-3); }
.band.empty .band-lunar { color: var(--ink-3); }
.band-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.band-months button { position: relative; padding: 4px 0 7px; font-size: 12px; color: var(--ink-3); transition: color var(--t-hover) ease; }
.band-months button::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: 2px; height: 1.5px; background: var(--ink); transform: scaleX(0); transition: transform .3s var(--ease-out); }
.band-months button:hover { color: var(--ink); }
.band-months button.on { color: var(--ink); }
.band-months button.on::after { transform: scaleX(1); }
.band-window {
  position: relative;
  height: 76px;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
.band.dragging .band-window { cursor: grabbing; }
.band-window:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.band-tape { position: absolute; left: 0; top: 0; will-change: transform; }
.band-tape svg { display: block; }
.bt-month { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 3; }
.bt-mname { fill: var(--ink-3); font-family: var(--text); font-size: 12px; letter-spacing: .1em; }
.bt-dark { fill: rgba(238, 242, 247, .05); stroke: rgba(238, 242, 247, .2); stroke-width: .8; }
.bt-lit { fill: rgba(238, 242, 247, .55); }
.bt-day.new .bt-dark { stroke: var(--ink-2); stroke-opacity: .7; }
.bt-num { fill: var(--ink-3); font-size: 10.5px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.bt-day { transition: opacity var(--t-hover) ease; }
.bt-day.on .bt-dark { fill: rgba(238, 242, 247, .16); stroke: var(--ink); stroke-width: 1.2; }
.bt-day.on .bt-lit { fill: var(--ink); }
.bt-day.on .bt-num { fill: var(--ink); font-weight: 600; }
.band.empty .bt-day.on .bt-dark { fill: rgba(238, 242, 247, .05); stroke: rgba(238, 242, 247, .2); }
.band.empty .bt-day.on .bt-lit { fill: rgba(238, 242, 247, .55); }
/* 指针：一根亮色竖线，上下各一个小三角 */
.band-needle { position: absolute; left: 50%; top: 0; bottom: 0; width: 1.5px; margin-left: -.75px; background: linear-gradient(var(--ink), var(--ink)) center / 1.5px 100% no-repeat; opacity: .85; pointer-events: none; }
.band-needle::before, .band-needle::after { content: ""; position: absolute; left: 50%; margin-left: -5px; border: 5px solid transparent; }
.band-needle::before { top: 0; border-top-color: var(--ink); }
.band-needle::after { bottom: 0; border-bottom-color: var(--ink); }
.band.empty .band-needle { opacity: .45; }

.dial { position: relative; width: 100%; max-width: 200px; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; outline-offset: 6px; border-radius: 50%; }
.dial svg { display: block; width: 100%; height: 100%; overflow: visible; cursor: grab; }
.dial.dragging svg { cursor: grabbing; }
.hd-night { fill: rgba(4, 12, 28, .32); }
.hd-ring { fill: none; stroke: var(--rule); }
.hd-tick { stroke: rgba(238, 242, 247, .3); }
.hd-bound { stroke: var(--ink-3); }
.hd-hour { fill: var(--ink-3); font-family: var(--text); font-size: 11.5px; text-anchor: middle; dominant-baseline: central; }
.hd-name { fill: var(--ink-2); font-family: var(--text); font-weight: 400; font-size: 14px; text-anchor: middle; dominant-baseline: central; transition: fill var(--t-hover) ease; }
.hd-name.on { fill: var(--ink); }
.hd-sel { transition: transform .45s cubic-bezier(.3, 1.4, .5, 1); }
.hd-sel path { fill: rgba(238, 242, 247, .12); stroke: rgba(238, 242, 247, .55); }
.dial.dragging .hd-sel { transition: transform .18s ease-out; }
.dial.empty .hd-sel { opacity: 0; }
.hd-hand line { stroke: var(--ink); stroke-width: 1.6; }
.hd-hand circle { fill: var(--ink); stroke: var(--blue-deep); stroke-width: 2.5; }
.dial.empty .hd-hand { opacity: .5; }
.dial-read { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; line-height: 1.3; }
.dial-read b { font-family: var(--text); font-size: 20px; font-weight: 600; }
.dial-read span { font-size: 12px; color: var(--ink-3); }
.dial.empty .dial-read b { color: var(--ink-3); }

/* AI 配置：图纸页签 */
.tabs { flex: 1; min-width: 0; display: flex; overflow-x: auto; border-bottom: 1px solid var(--rule); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  flex: none;
  padding: 7px 14px 8px;
  margin-bottom: -1px;
  font-size: var(--fs-3);
  color: var(--ink-3);
  white-space: nowrap;
  border: 1px solid transparent;
  border-bottom: 0;
  transition: color var(--t-hover) ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  color: var(--ink);
  border-color: var(--rule);
  background: var(--blue-deep);
  box-shadow: inset 0 2px 0 var(--ink);
}
.btn-save-bazi { margin-top: 16px; }
.bazi-status { margin-top: 10px; font-size: var(--fs-2); line-height: 1.6; }
.bazi-status:empty { display: none; }
.bazi-status.success { color: var(--ink-2); }
.bazi-status.error { color: var(--zhu); }
.bazi-status.dirty { color: var(--ink-2); }
/* 保存按钮的状态：和已存生辰一致时常亮为「✓ 生辰已保存」；改了没存时右上角一个亮色小点，写「保存改动」 */
.btn-save-bazi.is-saved { --c: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(238, 242, 247, .45); background-color: rgba(238, 242, 247, .08); cursor: default; }
.btn-save-bazi.is-saved::before { content: "✓"; margin-right: 6px; }
.btn-save-bazi.is-dirty { box-shadow: inset 0 0 0 1px var(--ink-2); }
.btn-save-bazi.is-dirty::after { content: ""; position: absolute; top: -3px; right: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--blue-deep); }
/* AI 配置的保存按钮用同一套状态：存着的和表单一致就是描边的「✓ 配置已保存」，改了没存是实心按钮加一个小点 */
.btn.btn-primary.btn-save-ai.is-saved, .btn.btn-primary.btn-save-ai.is-saved:hover { --c: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(238, 242, 247, .45); background-color: rgba(238, 242, 247, .08); cursor: default; }
.btn-save-ai.is-saved::before { content: "✓"; margin-right: 6px; }
.btn-save-ai.is-dirty::after { content: ""; position: absolute; top: -3px; right: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--blue-deep); }

/* 爻开关：关是阴爻，开是阳爻 */
/* 开关：一根爻套在制图角标里，和按钮、分段切换是同一套框；点整行都算数 */
.toggle-row { position: relative; }
.toggle-switch {
  flex: none; display: inline-flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 14px; cursor: pointer;
  transition: background-color var(--t-hover) ease;
}
.toggle-row:hover .toggle-switch { --c: var(--ink-2); background-color: rgba(238, 242, 247, .06); }
.toggle-switch input:focus-visible ~ .toggle-slider { outline: 2px solid var(--ink); outline-offset: 10px; }
.toggle-switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle-slider { position: relative; width: 48px; height: 8px; --g: 34%; transition: --g .5s var(--ease); }
/* 爻旁写明开关状态：初次使用的人不一定认得阴阳爻 */
.toggle-state { order: -1; font-size: var(--fs-2); line-height: 1; color: var(--ink-3); transition: color var(--t-hover) ease; }
.toggle-state::before { content: "关"; }
.toggle-switch input:checked ~ .toggle-state { color: var(--ink); }
.toggle-switch input:checked ~ .toggle-state::before { content: "开"; }
.toggle-slider::before, .toggle-slider::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(50% - var(--g) / 2);
  background: var(--ink-3);
  transition: background-color var(--t-hover) ease;
}
.toggle-slider::before { left: 0; }
.toggle-slider::after { right: 0; }
.toggle-switch input:checked + .toggle-slider { --g: 0%; }
.toggle-switch input:checked + .toggle-slider::before,
.toggle-switch input:checked + .toggle-slider::after { background: var(--ink); }
.toggle-row:hover .toggle-slider::before, .toggle-row:hover .toggle-slider::after { background: var(--ink); }
.toggle-row:hover input:checked + .toggle-slider::before, .toggle-row:hover input:checked + .toggle-slider::after { background: var(--ink); }

.ai-config { margin-top: 18px; }
.ai-profile-bar { --c: var(--ink-3); padding: 14px 16px 16px; background-color: transparent; }
.ai-profile-row { display: flex; align-items: center; gap: 12px; }
.ai-profile-count { flex: none; font-size: var(--fs-1); color: var(--ink-3); }
.ai-profile-actions { display: flex; gap: 18px; margin-top: 10px; }
.btn-profile { font-size: var(--fs-3); color: var(--ink-2); padding: 2px 0; }
.ai-field { display: block; margin-top: 16px; }
.ai-field-label { display: block; }
.ai-auto-row { margin-top: 22px; }
.ai-auto-row .settings-label { font-size: var(--fs-4); }
.btn-reset-prompt { margin-top: 10px; }
.ai-actions { display: flex; gap: 14px; margin-top: 22px; }
.ai-warn { margin-top: 14px; }

/* ---------- 弹层 ---------- */
.share-overlay, .confirm-overlay, .detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--dim);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-fade) ease, visibility 0s linear var(--t-fade);
}
.share-overlay.show, .confirm-overlay.show, .detail-overlay.show { opacity: 1; visibility: visible; transition: opacity var(--t-fade) ease; }
.confirm-overlay { z-index: 80; }
.share-box, .confirm-box, .detail-box {
  --c: var(--ink);
  position: relative;
  background-color: var(--blue-deep);
  box-shadow: inset 0 0 0 1px var(--rule), 0 40px 80px -30px rgba(0, 0, 0, .7);
  transform: translateY(16px) scale(.98);
  transition: transform .5s var(--ease-out);
}
.show > .share-box, .show > .confirm-box, .show > .detail-box { transform: none; }
/* 分享图：不要外框，卡片像一张刚洗出来的照片直接放在暗下来的桌面上；
   上方一行小字，下方两个带线描图标的文字按钮，右上角圆形关闭钮 */
.share-overlay { flex-direction: column; background: radial-gradient(90% 70% at 50% 45%, rgba(6, 16, 34, .78), rgba(4, 10, 22, .92)); }
.share-box {
  --card-h: min(74svh, 760px);
  width: auto;
  max-width: 100%;
  max-height: calc(100svh - 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  box-shadow: none;
  transform: none;
  transition: none;
}
.share-caption { font-family: var(--text); font-size: var(--fs-3); letter-spacing: .6em; text-indent: .6em; color: var(--ink-3); }
.share-preview { position: relative; margin: 14px 0 20px; min-height: 260px; display: grid; place-items: center; text-align: center; }
.share-preview img {
  display: block;
  max-width: calc(100vw - 32px);
  max-height: var(--card-h);
  box-shadow: 0 2px 0 rgba(255, 255, 255, .06), 0 30px 60px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(238, 242, 247, .12);
}
/* 分享图的版：和成图同比例。先画出底色、网格、外框和四角裁切线，结果页上的东西飞来拼上，最后换成生成好的图。
   --k 是版宽和卡片原宽（500）之比，网格和裁切线按它缩放，和图上的位置对得上 */
.share-plate {
  --k: .8;
  position: relative;
  width: min(calc(100vw - 32px), calc(var(--card-h) * 500 / 888));
  aspect-ratio: 500 / 888;
}
.share-plate > i { position: absolute; display: block; pointer-events: none; }
.sp-base { inset: 0; box-shadow: 0 30px 60px -18px rgba(0, 0, 0, .8); }
/* 分享卡是「图纸背面」的白纸：空版不画网格，外框和裁切线用蓝墨 */
.sp-grid { display: none; }
.sp-line { background: rgba(23, 57, 110, .4); will-change: transform; }
.sp-line.t { left: 0; right: 0; top: 0; height: 1px; transform-origin: 0 50%; }
.sp-line.r { top: 0; bottom: 0; right: 0; width: 1px; transform-origin: 50% 0; }
.sp-line.b { left: 0; right: 0; bottom: 0; height: 1px; transform-origin: 100% 50%; }
.sp-line.l { top: 0; bottom: 0; left: 0; width: 1px; transform-origin: 50% 100%; }
.sp-crop { width: calc(22px * var(--k)); height: calc(22px * var(--k)); border: 0 solid rgba(23, 57, 110, .45); }
.sp-crop.tl { left: calc(18px * var(--k)); top: calc(18px * var(--k)); border-width: 1.2px 0 0 1.2px; }
.sp-crop.tr { right: calc(18px * var(--k)); top: calc(18px * var(--k)); border-width: 1.2px 1.2px 0 0; }
.sp-crop.bl { left: calc(18px * var(--k)); bottom: calc(18px * var(--k)); border-width: 0 0 1.2px 1.2px; }
.sp-crop.br { right: calc(18px * var(--k)); bottom: calc(18px * var(--k)); border-width: 0 1.2px 1.2px 0; }
.share-preview .share-plate-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  opacity: 0;
  transition: opacity .24s ease-out;
}
.share-preview .share-plate-img.in { opacity: 1; }
.share-plate:has(.share-plate-img.in) .sp-line { opacity: 0; transition: opacity .3s ease; }
.share-flyer-text { white-space: normal; overflow-wrap: anywhere; will-change: transform; }
.share-hint { margin-top: 10px; font-size: var(--fs-2); color: var(--ink-3); }
.share-error { color: var(--zhu); font-size: var(--fs-5); }
.share-error small { display: block; margin-top: 6px; font-size: var(--fs-1); color: var(--ink-3); word-break: break-all; }
.share-actions { display: flex; align-items: center; gap: 36px; }
.share-act {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  font-family: var(--text);
  font-size: var(--fs-5);
  letter-spacing: .14em;
  color: var(--ink-2);
  transition: color var(--t-hover) ease;
}
.share-act svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease-out); }
.share-act::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px; background: currentColor; transform: scaleX(.25); transform-origin: left; opacity: .6; transition: transform .35s var(--ease-out), opacity .25s ease; }
.share-act:hover, .share-act:focus-visible { color: var(--ink); outline: none; }
.share-act:hover::after, .share-act:focus-visible::after { transform: scaleX(1); opacity: 1; }
.share-act:hover svg { transform: translateY(2px); }
/* 成图前两个按钮不出现，图显出来后淡入；点过之后按钮上原地回一句：成功是亮白，失败是朱色 */
.share-actions { transition: opacity .35s ease .1s; }
.share-actions.waiting { opacity: 0; visibility: hidden; transition: none; }
.share-act.done { color: var(--ink); }
.share-act.fail { color: var(--zhu); }
#shareCopyBtn:hover svg { transform: translate(-1px, -1px); }
.share-close { position: absolute; top: calc(var(--frame) + 14px); right: calc(var(--frame) + 14px); }
/* 从结果页飞到相纸上的那份卦画，显影时淡去 */
.share-flyer { position: fixed; z-index: 72; pointer-events: none; transform-origin: 0 0; will-change: transform; }

.confirm-box { width: min(360px, 100%); padding: 26px 24px 22px; }
.confirm-msg { font-size: 18px; line-height: 1.7; }
.confirm-actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 12px; margin-top: 24px; }
.confirm-yes { --c: var(--zhu); color: var(--zhu); box-shadow: inset 0 0 0 1px rgba(255, 138, 92, .4); }
.confirm-yes:hover { background-color: rgba(255, 138, 92, .14); box-shadow: inset 0 0 0 1px var(--zhu); }

.detail-box { width: min(580px, 100%); max-height: calc(100svh - 32px); overflow-y: auto; padding: 30px 30px 26px; }
.detail-close { position: absolute; top: 14px; right: 14px; }
.detail-section { margin-top: 30px; }
.detail-section h3 { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-family: var(--text); font-size: var(--fs-3); font-weight: 400; letter-spacing: .24em; color: var(--ink-2); }
.detail-section h3::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.detail-analysis p { font-size: var(--fs-5); display: inline; }

/* 今日一卦详解：一张小图纸，爻辞用引线标在每一爻旁边 */
.gua-sheet { width: min(600px, 100%); padding: 32px 36px 30px; }
.gs-xiang { margin-top: 6px; font-size: var(--fs-4); color: var(--ink-2); }
.gs-xiang span { margin-right: .8em; }
.gs-name-row { display: flex; align-items: center; gap: 22px; margin-top: 6px; padding-right: 44px; }
.gs-name-row h2 { font-family: var(--display); font-size: 44px; font-weight: 400; line-height: 1.15; letter-spacing: .05em; }
.gs-sub { margin-top: 4px; font-size: 18px; color: var(--ink-2); }
.gs-figure { position: relative; margin-top: 28px; padding: 22px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 132px minmax(0, 1fr); }
.gs-glyph { width: 132px; height: 132px; }
.gs-yao { position: relative; height: 132px; margin: 0; padding: 0; list-style: none; }
.gs-yao li {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--r) * 17.48% + 6.3%);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-4);
  line-height: 1;
  white-space: nowrap;
}
.gs-yao li::before {
  content: "";
  flex: none;
  width: 26px;
  height: 1px;
  margin-left: 10px;
  background: var(--ink-3);
  transform-origin: left;
}
.gs-pos { flex: none; font-family: var(--text); font-weight: 600; font-size: var(--fs-3); color: var(--ink); width: 2.4em; }
.gs-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.show .gs-glyph .bar { animation: bar-drop .45s var(--ease-out) both; }
.show .gs-glyph .bar:nth-child(6) { animation-delay: .15s; }
.show .gs-glyph .bar:nth-child(5) { animation-delay: .23s; }
.show .gs-glyph .bar:nth-child(4) { animation-delay: .31s; }
.show .gs-glyph .bar:nth-child(3) { animation-delay: .39s; }
.show .gs-glyph .bar:nth-child(2) { animation-delay: .47s; }
.show .gs-glyph .bar:nth-child(1) { animation-delay: .55s; }
/* 从首页飞过来的那份卦画：飞行时在最上层，落地后换回详情页里的真卦画，所以爻条不再逐根落下 */
.gs-flyer { position: fixed; z-index: 75; margin: 0; pointer-events: none; transform-origin: 0 0; }
.gs-flown .gs-glyph .bar { animation: none; }
.show .gs-yao li::before { animation: lead-in .45s var(--ease-out) both; animation-delay: calc(.3s + (5 - var(--r)) * 80ms); }
.show .gs-yao li span { animation: fade-in .4s ease both; animation-delay: calc(.45s + (5 - var(--r)) * 80ms); }
@keyframes lead-in { from { transform: scaleX(0); } }
.gua-sheet .detail-section { margin-top: 24px; }
.gua-sheet .title-block.gs-tb { margin-top: 24px; grid-template-columns: 1fr 1fr 1fr; }
.gua-sheet .gs-tb > div { border-right: 1px solid var(--rule-soft); border-bottom: 0; }
.gua-sheet .gs-tb > div:last-child { border-right: 0; }
.gua-sheet .gs-tb dd { justify-content: flex-start; }
.gua-sheet .gs-tb .mini-ring { width: 32px; height: 32px; }

.toast-container {
  position: fixed;
  left: 50%;
  bottom: calc(var(--frame) + 22px);
  z-index: 95;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  justify-items: center;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
/* 分享弹层打开时按钮在屏幕底部，提示挪到顶上，不压住按钮 */
body:has(#shareImageContainer.show) .toast-container { bottom: auto; top: calc(var(--frame) + 22px); }
.toast {
  padding: 10px 18px 10px 20px;
  font-size: var(--fs-4);
  line-height: 1.6;
  color: var(--ink);
  background: var(--blue-deep);
  box-shadow: inset 3px 0 0 var(--ink-3), inset 0 0 0 1px var(--rule), 0 16px 32px -14px rgba(0, 0, 0, .7);
  animation: toast-in .45s var(--ease-out) both;
}
.toast-error { box-shadow: inset 3px 0 0 var(--zhu), inset 0 0 0 1px rgba(255, 138, 92, .45), 0 16px 32px -14px rgba(0, 0, 0, .7); }
.toast-success { box-shadow: inset 3px 0 0 var(--ink), inset 0 0 0 1px rgba(238, 242, 247, .45), 0 16px 32px -14px rgba(0, 0, 0, .7); }
.toast-success::before { content: "✓"; margin-right: .6em; }
.toast-out { animation: toast-out .25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.back-to-top {
  position: fixed;
  right: calc(var(--frame) + 18px);
  bottom: calc(var(--frame) + 18px);
  z-index: 40;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-deep);
  box-shadow: inset 0 0 0 1px var(--rule);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--t-fade) ease, transform .4s var(--ease-out);
}
.back-to-top.visible { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.6; }

/* ---------- 矮屏：首页不滚动，按高度收紧 ---------- */
@media (max-height: 720px) {
  .home-title { font-size: clamp(44px, 8vh, 64px); }
  .question-area { margin-top: clamp(40px, 9vh, 64px); }
  .daily-gua { margin-top: 18px; }
}
/* 手机横屏这类实在放不下的高度，退回可以滚动，免得内容被裁掉 */
@media (max-height: 500px) {
  html:has(> body.view-home), body.view-home { height: auto; overflow: visible; }
  body.view-home .site { height: auto; }
  .home-view { height: auto; min-height: calc(100svh - var(--head-h) - var(--frame) * 2); padding-bottom: 44px; }
}

/* ---------- 手机 ---------- */
@media (max-width: 768px) {
  :root { --frame: 7px; --head-h: 56px; --gutter: 16px; }
  body { font-size: 16px; }
  .frame-zones, .crop { display: none; }
  .frame { border-color: var(--rule-soft); }
  .brand span { display: none; }
  .q-carry i { display: none; }
  .q-carry b { max-width: 34vw; }
  .masthead-nav { gap: 12px; }
  .nav-tag { width: 42px; padding-top: 20px; --notch: 8px; }
  .nav-tag-text { font-size: 15px; letter-spacing: .26em; }
  .nav-tag-text::before { top: -12px; }
  .masthead-nav sup { right: -15px; }
  .band-months button { font-size: 12px; letter-spacing: -.1em; }
  .home-title { font-size: 56px; }
  .question-area { margin-top: clamp(56px, 10vh, 96px); }
  #question { font-size: 19px; }
  .btn-divine { padding: 11px 26px; }
  .daily-gua { margin-top: 40px; }
  /* 起卦方式只留一行「◎ 铜钱起卦 · 改用生辰」：说明小字收起；生辰模式下已存的生辰换到第二行，两种模式第一行长得一样 */
  .method-hint > span { display: none; }
  .method-hint .mh-edit { order: 3; flex-basis: 100%; }

  .ritual-status-main { font-size: 26px; }
  .cast-btn { padding: 12px 36px; }

  .result-question { margin-top: 16px; }
  /* 手机上把两栏拆开重排：卦画 → 卦名 → 本/之切换 → 正文 → 图签 → 按钮 */
  .reading-layout { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin-top: 26px; }
  .result-header, .reading { display: contents; }
  .glyph-figure { order: 1; }
  .ben-zhi, .zhi-none { order: 2; align-self: start; min-width: 240px; }
  .reading-head { order: 3; margin-top: 30px; }
  .main-reading { order: 4; margin-top: 26px; padding-left: 16px; }
  .reading-sheet { order: 5; margin-top: 30px; padding: 24px 18px 28px; }
  .title-block { order: 6; margin-top: 40px; }
  .result-actions { order: 7; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  /* 主按钮占一整行，下面两个等宽；只剩一个时（朋友分享的那页没有「再问一卦」）也占满；「翻阅牌册」是单独一行的字 */
  .result-actions .btn-primary, .result-actions #linkBtn:nth-last-child(2) { grid-column: 1 / -1; }
  .result-actions .btn-quiet { grid-column: 1 / -1; justify-self: center; padding: 6px 4px; }
  .link-panel { order: 7; }
  .result-warning { order: 8; }
  .mr-quote { font-size: 28px; }
  .mr-quote.long { font-size: 23px; }
  .mr-quote.xl { font-size: 18px; }
  .glyph-figure, .result-glyph { width: 116px; height: 116px; }
  .callouts { width: 110px; }
  .co::before { width: 14px; }
  .title-block { margin-top: 18px; }
  .hex-name { font-size: 46px; }
  .verdict-seal { width: 46px; height: 46px; }
  .verdict-seal span { font-size: 21px; }
  .block { margin-top: 38px; }
  .analysis-list { font-size: 17px; }
  .xiang-src, .change-details p.xiang-src { font-size: 18px; }
  .yao-item { grid-template-columns: 24px 2.8em minmax(0, 1fr); gap: 2px 12px; font-size: 16px; }
  .yao-mark { width: 24px; height: 5px; }
  .yao-type { grid-column: 3; }

  .history-panel {
    top: auto;
    left: var(--frame);
    right: var(--frame);
    width: auto;
    height: calc(90svh - var(--frame));
    transform: translateY(calc(100% + var(--frame) + 40px));
  }
  .archive-body { display: block; overflow-y: auto; overscroll-behavior: contain; }
  .archive-map { overflow: visible; padding: 20px 18px 8px; border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .am-frame { margin-top: 18px; max-width: 320px; }
  .archive-list { overflow: visible; padding: 0 14px 28px 10px; }
  .tl-group ol::before { left: 40px; }
  .tl-row { grid-template-columns: 30px 24px minmax(0, 1fr) 28px; gap: 0 14px; }
  .tl-row::before { left: 37px; }
  .history-thumb { width: 24px; height: 24px; margin-left: 8px; }
  .tl-main { margin-left: 4px; }
  .history-q { font-size: 15px; }
  #historyPanel.archive { height: auto; top: var(--frame); transform: scale(.985); }
  .history-head { padding: 16px 14px 14px 18px; }
  .panel-title h3 { font-size: 22px; }
  .settings-content { padding: 4px 18px 24px; }
  .history-del { opacity: 1; }
  .detail-box { padding: 26px 20px 22px; }
  .gua-sheet { padding: 26px 18px 22px; }
  .gs-name-row h2 { font-size: 34px; }
  /* 手机上爻辞放不进卦画旁的一行：卦画居中放在上面，爻辞在下面占满整行，一条条能折行，不再截成省略号 */
  .gs-figure { grid-template-columns: minmax(0, 1fr); gap: 20px 0; }
  .gs-glyph { width: 96px; height: 96px; justify-self: center; }
  .gs-yao { height: auto; display: grid; gap: 8px; }
  .gs-yao li { position: static; transform: none; display: grid; grid-template-columns: 2.6em minmax(0, 1fr); align-items: baseline; gap: 0 6px; font-size: 14px; line-height: 1.55; white-space: normal; }
  .gs-yao li::before { display: none; }
  .gs-pos { width: auto; font-size: 14px; }
  .gs-text { overflow: visible; text-overflow: clip; }
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
  .cosmos-ring, .cosmos-deco { animation: none !important; }
}
