/* 《墨爻》宣纸水墨主题层（叠在 style.css 之后）
 * 宣纸为底、浓淡墨为主，朱砂只用于印章、动爻记号与主按钮；
 * 次要强调用国画颜料「花青」，互卦用「赭石」。赛博感只保留在 HUD 细线、故障一闪与山谷城影里。 */

@font-face {
  font-family: "MoBrush";
  src: url("../fonts/mashanzheng-subset.woff2") format("woff2");
  font-display: swap;
}

/* 卦全名：志莽行书（SIL OFL），只裁卦全名用字 */
@font-face {
  font-family: "MoXing";
  src: url("../fonts/xingshu-subset.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "MoKai";
  src: url("../fonts/wenkai-subset.woff2") format("woff2");
  font-display: swap;
}

:root {
  /* 纸与墨 */
  --ink-void: #efe8d8;          /* 页面宣纸底 */
  --ink-deep: #e6dec9;
  --ink-panel: rgba(250, 246, 236, 0.84);
  --ink-card: rgba(250, 246, 236, 0.9);
  --paper: #1f1c18;             /* 浓墨：正文、爻画 */
  --paper-soft: #3d3933;        /* 次墨 */
  --ash: #6d675c;               /* 淡墨 */
  --ash-dim: #958e80;           /* 极淡墨 */
  --border-ink: rgba(31, 28, 24, 0.12);

  /* 颜料 */
  --cinnabar: #c42630;          /* 朱砂 */
  --cinnabar-glow: rgba(196, 38, 48, 0.25);
  --cinnabar-soft: rgba(196, 38, 48, 0.07);
  --jade: #2f5d7c;              /* 花青 */
  --jade-glow: rgba(47, 93, 124, 0.25);
  --jade-soft: rgba(47, 93, 124, 0.07);
  --border-jade: rgba(47, 93, 124, 0.35);
  --bronze: #a06c28;            /* 赭石 */

  --font-serif: "MoKai", "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", serif;
  --font-brush: "MoBrush", "Ma Shan Zheng", "MoKai", "Kaiti SC", "STKaiti", serif;
  --font-hud: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-mono: var(--font-serif);

  --brush-bar: url("../img/brush-bar.svg");
  --brush-swash: url("../img/brush-swash.svg");
  --seal-worn: url("../img/seal-worn.svg");
  --grain: url("../img/grain.svg");
}

html,
body {
  background: var(--ink-void);
  color: var(--paper);
}

body {
  letter-spacing: 0.02em;
}

/* ---------- 背景叠层：宣纸纤维；扫描线不用 ---------- */
.cyber-grid-overlay {
  background: var(--grain);
  background-size: 260px 260px;
  opacity: 0.35;
  mix-blend-mode: multiply;
}

.scanline-overlay {
  display: none;
}

/* ---------- 面板：一张压在宣纸上的熟宣 ---------- */
.ritual-panel,
.monument-panel,
.hex-page-card,
.modal-box {
  background: linear-gradient(180deg, rgba(252, 249, 241, 0.9), rgba(247, 242, 230, 0.92));
  border: 1px solid rgba(31, 28, 24, 0.12);
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 18px 50px rgba(70, 52, 25, 0.16),
    0 2px 6px rgba(70, 52, 25, 0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* 顶缘一笔淡墨 */
.ritual-panel::before,
.hex-page-card::before {
  top: 0;
  left: 6%;
  width: 46%;
  height: 7px;
  border: none;
  background: linear-gradient(90deg, rgba(31, 28, 24, 0.85), rgba(31, 28, 24, 0.2));
  -webkit-mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  opacity: 0.7;
}

/* 卦页已有卦印且右下角是按钮，不落小印 */
.hex-page-card::after {
  display: none;
}

/* 右下角一方小朱印 */
.ritual-panel::after {
  content: "卜";
  right: 14px;
  bottom: 12px;
  width: 24px;
  height: 24px;
  border: none;
  display: grid;
  place-items: center;
  font-family: var(--font-brush);
  font-size: 17px;
  line-height: 1;
  color: #fbf6ec;
  background: var(--cinnabar);
  -webkit-mask: var(--seal-worn) 0 0 / 100% 100% no-repeat;
  mask: var(--seal-worn) 0 0 / 100% 100% no-repeat;
  transform: rotate(-6deg);
  opacity: 0.85;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(180deg, rgba(239, 232, 216, 0.85), rgba(239, 232, 216, 0.35));
  border: none;
  border-bottom: 1px solid rgba(31, 28, 24, 0.14);
  box-shadow: none;
  backdrop-filter: blur(6px);
}

.topbar::before,
.topbar::after {
  display: none;
}

/* logo：「墨」字朱印 + 「爻」，合读为「墨爻」 */
.brand {
  gap: 6px;
}

.brand-text h1 {
  font-family: var(--font-brush);
  font-weight: 400;
  font-size: clamp(26px, 3.8dvh, 32px);
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--paper);
  align-items: baseline;
  gap: 10px;
  text-shadow: none;
  animation: inkBleed 1s cubic-bezier(0.25, 0.8, 0.3, 1) 0.15s both;
}

.brand-text .mono-tag {
  font-family: var(--font-serif);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--jade);
  text-shadow: none;
}

.telemetry-line {
  font-family: var(--font-hud);
  color: var(--ash);
  text-shadow: none;
  margin-top: 4px;
}

.telemetry-dot {
  background: var(--cinnabar);
  box-shadow: none;
}

/* 导航：墨字，选中处下方一笔朱墨 */
.nav-btn,
.icon-btn {
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--paper-soft);
}

.nav-btn .en {
  font-family: var(--font-hud);
  color: var(--ash);
}

.nav-btn::after,
.icon-btn::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 1px;
  height: 5px;
  background: currentColor;
  -webkit-mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  opacity: 0;
  transform: scaleX(0.4);
  transform-origin: left center;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-btn:hover {
  color: var(--paper);
  border: none;
}

.nav-btn:hover::after {
  opacity: 0.3;
  transform: scaleX(1);
}

.nav-btn.active,
.nav-btn.is-restart,
.nav-btn.is-restart.active {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--paper);
  text-shadow: none;
}

.nav-btn.active::after,
.nav-btn.is-restart::after {
  background: var(--cinnabar);
  opacity: 0.9;
  transform: scaleX(1);
  filter: none;
}

.nav-btn.active .en {
  color: var(--cinnabar);
}

.icon-btn {
  font-size: 12px;
  color: var(--ash);
}

.icon-btn.on {
  color: var(--jade);
  border: none;
}

/* ---------- 主按钮：一抹朱墨 ---------- */
.primary-cast-btn {
  isolation: isolate;
  background: none;
  border: none;
  box-shadow: none;
  padding: clamp(12px, 1.8dvh, 16px) 28px;
  font-family: var(--font-brush);
  font-weight: 400;
  font-size: clamp(21px, 3dvh, 25px);
  letter-spacing: 0.32em;
  color: #fbf6ec;
  text-shadow: 0 1px 0 rgba(80, 0, 10, 0.35);
  filter: drop-shadow(0 4px 8px rgba(120, 20, 25, 0.22));
  transition: filter 0.25s ease, transform 0.2s ease, opacity 0.2s ease;
}

.primary-cast-btn::before {
  content: "";
  position: absolute;
  inset: -2px -14px;
  z-index: -1;
  background: linear-gradient(90deg, #cf2a35 0%, #c42630 60%, #a51d29 100%);
  -webkit-mask: var(--brush-swash) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-swash) 0 0 / 100% 100% no-repeat;
}

.primary-cast-btn:hover:not(:disabled) {
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 6px 12px rgba(120, 20, 25, 0.32));
  transform: translateY(-1px);
}

.primary-cast-btn:disabled {
  opacity: 0.38;
  filter: grayscale(0.7);
}

.intro-panel .primary-cast-btn {
  max-width: 340px;
  white-space: nowrap;
  letter-spacing: 0.18em;
}

/* 其余推进按钮：一抹浓墨；进入朱批的用朱墨 */
.monument-cue-btn,
.next-stage-btn,
.jade-btn,
.cinnabar-btn {
  position: relative;
  isolation: isolate;
  background: none;
  border: none;
  box-shadow: none;
  font-family: var(--font-brush);
  font-weight: 400;
  font-size: clamp(18px, 2.6dvh, 21px);
  letter-spacing: 0.22em;
  color: #fbf6ec;
  padding: clamp(10px, 1.5dvh, 13px) clamp(22px, 4.5vw, 32px);
  filter: drop-shadow(0 4px 8px rgba(40, 30, 15, 0.2));
  transition: filter 0.25s ease, transform 0.2s ease;
  animation: none;
}

.monument-cue-btn::before,
.next-stage-btn::before,
.jade-btn::before,
.cinnabar-btn::before {
  content: "";
  position: absolute;
  inset: -2px -10px;
  z-index: -1;
  background: linear-gradient(90deg, #2a2621, #1f1c18 60%, #34302a);
  -webkit-mask: var(--brush-swash) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-swash) 0 0 / 100% 100% no-repeat;
}

.next-stage-btn.cinnabar::before,
.cinnabar-btn::before {
  background: linear-gradient(90deg, #cf2a35, #c42630 60%, #a51d29);
}

.next-stage-btn.cinnabar,
.cinnabar-btn {
  background: none;
  border: none;
  box-shadow: none;
  color: #fbf6ec;
}

.monument-cue-btn:hover,
.next-stage-btn:hover,
.next-stage-btn.cinnabar:hover,
.jade-btn:hover,
.cinnabar-btn:hover {
  background: none;
  border: none;
  box-shadow: none;
  transform: translateY(-1px);
  filter: drop-shadow(0 6px 12px rgba(40, 30, 15, 0.3));
}

.cue-pulse-dot {
  background: var(--cinnabar);
  box-shadow: none;
}

/* 次级按钮：墨字 + 下划一笔淡墨 */
.ghost-btn {
  position: relative;
  border: none;
  background: transparent;
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ash);
  padding: 6px 12px 9px;
}

.ghost-btn::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 2px;
  height: 4px;
  background: currentColor;
  -webkit-mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  opacity: 0.4;
}

.ghost-btn:hover:not(:disabled) {
  border: none;
  color: var(--paper);
  text-shadow: none;
}

/* =====================================================================
 * 爻：一律浓墨笔画，阴阳以形分；动爻不以色分，旁记 ○（老阳）×（老阴）
 * ===================================================================== */
.strip-bar .s-line,
.monument-stroke,
.yao-stroke,
.solo-yao span,
.solo-yao-btn span,
.asm-bar span,
.nuc-bar span,
.iy-bar span,
.mini-yao span,
.chg-half {
  clip-path: none;
  border-radius: 0;
  -webkit-mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
}

/* 统一墨色：覆盖原先阴爻浅灰、动爻朱色、变爻青色及其光晕 */
.strip-bar .s-line,
.strip-slot.yin .strip-bar .s-line,
.strip-slot.moving .strip-bar .s-line,
.monument-stroke,
.monument-row.yin .monument-stroke,
.monument-row.moving .monument-stroke,
.yao-row .yao-stroke,
.yao-row.is-yin .yao-stroke,
.yao-row.is-moving .yao-stroke,
.solo-yao span,
.solo-yao.yin span,
.solo-yao.moving span,
.solo-yao.changed-line span,
.solo-yao-btn span,
.solo-yao-btn.yin span,
.solo-yao-btn.moving span,
.solo-yao-btn.changed-line span,
.asm-bar span,
.asm-bar.yin span,
.asm-bar.moving span,
.nuc-bar span,
.nuc-bar.yin span,
.nuc-bar.moving span,
.iy-bar span,
.iy-row.yin .iy-bar span,
.iy-row.is-moving .iy-bar span,
.iy-row.is-changed .iy-bar span,
.mini-yao span,
.mini-yao.yin span,
.mini-yao.moving span,
.mini-yao.changed-line span,
.chg-bar .chg-half,
.chg-bar.init-yin .chg-half.l,
.chg-bar.init-yin .chg-half.r,
.chg-bar.is-moving .chg-half {
  background: var(--paper);
  box-shadow: none;
}

.monument-row.moving .monument-stroke {
  animation: none;
}

/* 动爻记号 */
.yao-mark {
  flex: none;
  width: 1.1em;
  font-style: normal;
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  color: var(--cinnabar);
}

.solo-yao,
.monument-bars {
  align-items: center;
}

/* 居中对齐后爻画需显式撑满行高 */
.solo-yao span {
  align-self: stretch;
}

/* 成卦陈列：爻位 | 爻画 | 记号 | 老少 */
.monument-row {
  grid-template-columns: 36px 1fr 18px 36px;
}

.solo-yao .yao-mark {
  font-size: 15px;
  margin-left: -4px;
}

.iy-bar .yao-mark {
  font-size: 13px;
  margin-left: -4px;
}

.monument-row .yao-mark {
  font-size: 16px;
}

.monument-stroke {
  height: 18px;
}

.strip-bar .s-line {
  height: 8px;
}

/* ---------- 序境 ---------- */
.intro-kicker {
  font-size: 13px;
  letter-spacing: 0.6em;
  color: var(--jade);
  text-shadow: none;
}

.intro-title {
  font-family: var(--font-brush);
  font-weight: 400;
  white-space: nowrap;
  font-size: min(8.4vw, 6dvh, 50px);
  letter-spacing: 0.12em;
  color: var(--paper);
  text-shadow: none;
}

.intro-title-dot {
  color: var(--cinnabar);
  text-shadow: none;
}

.intro-source {
  color: var(--ash);
}

/* 序号：朱色书法大字，右侧细墨线分栏 */
.intro-rites li {
  align-items: stretch;
  gap: 14px;
}

.rite-num {
  flex: none;
  width: 34px;
  height: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
  background: none;
  border: none;
  box-shadow: none;
  transform: none;
  font-family: var(--font-brush);
  font-size: 28px;
  line-height: 1;
  color: var(--cinnabar);
  text-shadow: none;
}

.rite-body {
  flex: 1;
  padding-left: 12px;
  border-left: 1px solid rgba(31, 28, 24, 0.16);
}

.rite-body b {
  font-family: var(--font-brush);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.24em;
  margin-bottom: 3px;
  color: var(--paper);
}

.rite-body p {
  font-size: 14px;
  color: var(--paper-soft);
}

.intro-hint {
  color: var(--ash);
}

/* ---------- 第一境：摇钱 ---------- */
.stage-header {
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--paper-soft);
}

.toss-readout .main-line {
  font-size: clamp(16px, 2.4dvh, 19px);
  letter-spacing: 0.14em;
  color: var(--paper);
}

.toss-readout .main-line.moving {
  color: var(--cinnabar);
  text-shadow: none;
}

.toss-readout .sub-line {
  color: var(--ash);
}

.strip-slot {
  border: none;
  background: rgba(31, 28, 24, 0.035);
}

.strip-slot.next {
  background: var(--jade-soft);
  box-shadow: inset 0 -2px 0 var(--jade);
}

.strip-slot.filled {
  background: rgba(31, 28, 24, 0.05);
}

.strip-slot.moving {
  background: var(--cinnabar-soft);
  box-shadow: inset 0 -2px 0 var(--cinnabar);
}

.strip-pos,
.strip-val {
  font-size: 12px;
}

.strip-slot.filled .strip-val {
  color: var(--paper-soft);
}

.strip-slot.moving .strip-val {
  color: var(--cinnabar);
}

/* 铜钱落在纸上：影子用暖褐色 */
.coin-shadow {
  background: radial-gradient(ellipse at center, rgba(60, 40, 15, 0.55) 0%, rgba(60, 40, 15, 0) 70%);
}

.coin-face.front,
.coin-face.back {
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25);
}

.ink-ripple {
  border-color: rgba(31, 28, 24, 0.5);
}

.ink-ripple.moving {
  /* 动爻落盘也只荡一圈墨，不再泛红（动爻已由爻条与读数里的朱色标出） */
  border-color: rgba(31, 28, 24, 0.5);
  box-shadow: none;
}

/* ---------- 第二境 ---------- */
.monument-kicker {
  font-family: var(--font-brush);
  font-size: 20px;
  letter-spacing: 0.24em;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--paper);
  text-shadow: none;
}

.hex-monument-btn,
.altar-arena .hex-monument-btn,
.hex-monument-btn:hover {
  background: none;
  border: none;
  box-shadow: none;
}

.monument-pos,
.monument-tag {
  color: var(--ash);
}

.monument-row.moving .monument-tag {
  color: var(--cinnabar);
}

.glyph-whole,
.glyph-half {
  font-family: var(--font-brush);
  font-weight: 400;
  color: var(--paper);
  text-shadow: 0 0 1px rgba(31, 28, 24, 0.4), 3px 3px 0 rgba(196, 38, 48, 0.18);
}

.taiji-svg {
  filter: drop-shadow(0 8px 20px rgba(40, 30, 15, 0.25));
}

/* ---------- 卦页 ---------- */
.step-nav-bar {
  border-bottom-color: rgba(31, 28, 24, 0.1);
}

.crumb-btn {
  font-family: var(--font-serif);
  letter-spacing: 0.16em;
  color: var(--ash);
  background: none;
  border-color: transparent;
}

.crumb-btn.active,
.crumb-btn.verdict-crumb.active {
  color: var(--paper);
  background: none;
  border-color: transparent;
  box-shadow: inset 0 -2px 0 var(--cinnabar);
}

.solo-title {
  font-family: var(--font-brush);
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--paper);
  text-shadow: none;
}

/* 卦全名用行书，与隶书卦印一写一刻 */
.gua-main-name {
  font-family: "MoXing", var(--font-brush);
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--paper);
  text-shadow: none;
}

.solo-title {
  animation: inkBleed 0.9s cubic-bezier(0.25, 0.8, 0.3, 1) 0.2s both;
}

/* 卦名：逐字晕墨 */
.gua-main-name .gn-ch {
  display: inline-block;
  font-style: normal;
  animation: inkBleed 0.8s cubic-bezier(0.25, 0.8, 0.3, 1) calc(0.1s + var(--i) * 0.11s) both;
}

.hex-page-card.morphing .gua-main-name .gn-ch,
.hex-page-card.name-handed .gua-main-name .gn-ch {
  animation: none;
}

.gua-sub-meta {
  color: var(--ash);
}

.solo-scripture-box,
.gua-overview-card,
.zhuxi-box,
.result-card,
.yao-texts-card,
.ai-teaser-card,
.log-item {
  border-color: rgba(31, 28, 24, 0.1);
  background-color: rgba(255, 255, 255, 0.38);
  box-shadow: none;
}

.gua-overview-card {
  border-top-color: var(--cinnabar);
}

.gua-overview-card.nuclear {
  border-top-color: var(--bronze);
}

.gua-overview-card.changed {
  border-top-color: var(--jade);
}

.gua-dictum-main {
  color: var(--paper);
}

.gua-dictum-xiang {
  color: var(--bronze);
}

.gua-dictum-brief {
  color: var(--paper-soft);
}

.iy-row {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(31, 28, 24, 0.08);
}

.iy-row:hover {
  background: rgba(255, 255, 255, 0.6);
}

.iy-row.is-moving {
  background: var(--cinnabar-soft);
  border-color: rgba(196, 38, 48, 0.3);
}

.iy-row.is-changed {
  background: var(--jade-soft);
  border-color: rgba(47, 93, 124, 0.3);
}

.iy-words {
  color: var(--paper);
}

.solo-role-pill {
  font-family: var(--font-brush);
  font-size: 16px;
  letter-spacing: 0.2em;
}

/* 卦页上部：首行卦名，次行左卦象、右卦辞 */
.gua-hero {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3.6vw, 30px);
  margin-top: clamp(4px, 0.8dvh, 8px);
  padding-top: clamp(10px, 1.6dvh, 14px);
  border-top: 1px solid rgba(31, 28, 24, 0.1);
}

.gua-figure {
  flex: none;
  padding: 4px 2px;
}

.gua-figure .solo-hex-bars {
  width: clamp(104px, 20vw, 146px);
  gap: clamp(8px, 1.2dvh, 10px);
}

.gua-figure .solo-yao {
  height: clamp(10px, 1.5dvh, 12px);
  gap: clamp(10px, 2.2vw, 14px);
}

.gua-hero .gua-dictum-block {
  flex: 1;
  min-width: 0;
  padding-top: 0;
  border-top: none;
}

/* ---------- 朱印：朱底宣白字（互卦赭石、之卦花青） ---------- */
.brand-seal,
.solo-seal,
.hex-seal-stamp {
  font-family: var(--font-brush);
  font-weight: 400;
  color: #fbf6ec;
  text-shadow: none;
  background: linear-gradient(135deg, #cf2a35, #b3212c);
  border: none;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(251, 246, 236, 0.28);
}

.brand-seal {
  font-size: clamp(22px, 3.2dvh, 26px);
  width: clamp(34px, 5dvh, 40px);
  height: clamp(34px, 5dvh, 40px);
  transform: rotate(-4deg);
}

.solo-seal.nuclear {
  color: #fbf6ec;
  background: linear-gradient(135deg, #b07a32, #8f5f22);
  box-shadow: inset 0 0 0 2px rgba(251, 246, 236, 0.28);
  border: none;
}

.solo-seal.changed {
  color: #fbf6ec;
  background: linear-gradient(135deg, #36698a, #264d68);
  box-shadow: inset 0 0 0 2px rgba(251, 246, 236, 0.28);
  border: none;
}

/* ---------- 弹窗 / 提示 ---------- */
.modal-head h3 {
  color: var(--paper);
}

.modal-close {
  color: var(--ash);
  background: none;
}

.toast {
  color: #fbf6ec;
  background: #1f1c18;
}

/* ---------- HUD：淡墨细线，只做一点点科技感 ---------- */
.hud-frame {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(31, 28, 24, 0.45);
}

.hud-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 0 solid rgba(31, 28, 24, 0.4);
}

.hud-corner.tl { top: 10px; left: 10px; border-width: 1.5px 0 0 1.5px; }
.hud-corner.tr { top: 10px; right: 10px; border-width: 1.5px 1.5px 0 0; border-color: rgba(196, 38, 48, 0.55); }
.hud-corner.bl { bottom: 10px; left: 10px; border-width: 0 0 1.5px 1.5px; border-color: rgba(196, 38, 48, 0.55); }
.hud-corner.br { bottom: 10px; right: 10px; border-width: 0 1.5px 1.5px 0; }

.hud-side {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  white-space: nowrap;
}

.hud-readout {
  position: absolute;
  right: 40px;
  bottom: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.hud-readout.left {
  right: auto;
  left: 40px;
  color: rgba(196, 38, 48, 0.6);
}

.hud-bars {
  color: var(--jade);
  letter-spacing: 0.05em;
  animation: hudBlink 2.4s steps(2, end) infinite;
}

@keyframes hudBlink {
  50% { opacity: 0.45; }
}

@media (max-width: 900px) {
  .hud-side,
  .hud-readout {
    display: none;
  }
  .hud-corner {
    width: 14px;
    height: 14px;
  }
  .hud-corner.tl, .hud-corner.tr { top: 4px; }
  .hud-corner.bl, .hud-corner.br { bottom: 4px; }
  .hud-corner.tl, .hud-corner.bl { left: 4px; }
  .hud-corner.tr, .hud-corner.br { right: 4px; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 640px) {
  .nav-btn,
  .icon-btn {
    font-size: 13px;
  }
  .intro-title {
    letter-spacing: 0.04em;
    gap: 0.25em;
  }
  .rite-body b {
    font-size: 18px;
  }
  .rite-body p {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .gua-hero {
    gap: 12px;
    align-items: flex-start;
  }
  .gua-figure {
    padding-top: 6px;
  }
  .gua-figure .solo-hex-bars {
    width: 84px;
    gap: 7px;
  }
  .gua-figure .solo-yao {
    height: 9px;
    gap: 7px;
  }
  .solo-yao .yao-mark {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-title,
  .brand-text h1,
  .solo-title,
  .gua-main-name,
  .gua-main-name .gn-ch,
  .hud-bars {
    animation: none;
  }
}

/* 铜钱两面：正面亮铜，背面暗铜（带铜绿，见 SVG） */
.coin-face.front {
  background: radial-gradient(circle at 32% 26%, #f3d68e 0%, #c9a04c 45%, #8a6424 85%, #6b4b18 100%);
  border: 1.5px solid #e6c57c;
}

.coin-face.back {
  background: radial-gradient(circle at 34% 28%, #cfa75a 0%, #9c7330 50%, #6e4e1a 88%, #553b12 100%);
  border: 1.5px solid #c9a35c;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* 朱批页底部只剩「落印成签」一个按钮，居中 */
.result-actions {
  justify-content: center;
  margin-top: 6px;
}

/* ---------- 卦页进场：卦象演变期间隐去文字，定住后依次淡入 ---------- */
.hex-page-card .gua-head-row,
.hex-page-card .gua-dictum-block,
.hex-page-card .integrated-yao-board,
.hex-page-card .solo-footer-nav {
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.hex-page-card .gua-dictum-block { transition-delay: 0.12s; }
.hex-page-card .integrated-yao-board { transition-delay: 0.24s; }
.hex-page-card .solo-footer-nav { transition-delay: 0.36s; }

.hex-page-card.morphing .gua-head-row,
.hex-page-card.morphing .gua-dictum-block,
.hex-page-card.morphing .integrated-yao-board,
.hex-page-card.morphing .solo-footer-nav {
  opacity: 0;
  transform: translateY(6px);
  transition: none;
  pointer-events: none;
}

/* 卦名的故障一闪留到文字现出时再闪 */
.hex-page-card.morphing .gua-main-name {
  animation: none;
}


.gua-figure {
  position: relative;
}

.gua-figure .solo-yao span {
  transform-origin: left center;
}


/* ---------- 序境逐条现出（由 JS 依次加 .shown / .on / .rites-done） ---------- */
.intro-rites li {
  animation: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro-rites li.shown {
  opacity: 1;
  transform: none;
}

.intro-rites li .rite-num {
  opacity: 0;
  transform: scale(1.5);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 1.3, 0.5, 1);
}

.intro-rites li.shown .rite-num {
  opacity: 1;
  transform: none;
}

/* 逐字：由虚到实，像墨落在纸上晕开 */
.rite-body p .ch {
  opacity: 0;
  filter: blur(3px);
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.rite-body p .ch.on {
  opacity: 1;
  filter: none;
}

.intro-panel .stage-actions {
  animation: none;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro-panel.rites-done .stage-actions {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .intro-rites li,
  .intro-rites li .rite-num,
  .rite-body p .ch,
  .intro-panel .stage-actions {
    transition: none;
  }
}

/* ---------- 进场推演舞台 ---------- */
.hex-page-card.morphing .gua-figure {
  opacity: 0;
}

.hex-page-card .gua-overview-card,
.hex-page-card .gua-hero {
  transition: background-color 0.5s ease, border-color 0.5s ease;
}

.hex-page-card.morphing .gua-overview-card,
.hex-page-card.morphing .gua-hero {
  background-color: transparent;
  border-color: transparent;
  transition: none;
}

.drv-stage {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
}

.drv-group {
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
}

.drv-line {
  position: absolute;
  top: 0;
  left: calc(var(--lw) / -2);
  width: var(--lw);
  height: var(--lh);
  display: flex;
  column-gap: calc(var(--lw) * 0.13);
  transform-origin: center;
}

.drv-line span {
  flex: 1;
  background: var(--paper);
  transform-origin: left center;
  -webkit-mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
}

.drv-line .yao-mark {
  position: absolute;
  right: -26px;
  top: 50%;
  margin-top: -0.5em;
  font-size: 17px;
}

.drv-cut {
  position: absolute;
  left: 50%;
  top: -70%;
  width: 2px;
  height: 240%;
  background: linear-gradient(180deg, rgba(196, 38, 48, 0), var(--cinnabar) 25%, var(--cinnabar) 75%, rgba(196, 38, 48, 0));
  transform-origin: 50% 0;
  opacity: 0;
}

/* 阴合为阳时，相触处的一点墨洇 */
.drv-join {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--lh) * 3.2);
  height: calc(var(--lh) * 2.4);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(31, 28, 24, 0.55), rgba(31, 28, 24, 0));
  pointer-events: none;
}

.drv-label {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--ash);
}

.drv-label.center {
  translate: -50% 0;
}

@media (max-width: 520px) {
  .drv-label {
    font-size: 12px;
    letter-spacing: 0.08em;
  }
  .drv-line .yao-mark {
    right: -22px;
    font-size: 15px;
  }
}

/* ---------- 掷钱底盘：圆相墨圈（取代旧罗盘） ---------- */
.enso {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  transform: rotate(0deg);
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 掷钱时墨圈随手势轻转一下 */
.compass-wrap.casting .enso {
  transform: rotate(-14deg) scale(1.02);
  transition-duration: 0.5s;
}

/* =====================================================================
 * 爻成一刻：盘心大书一爻 → 飞入下方爻位
 * ===================================================================== */
.strip-bar .s-line {
  animation: none;
}

.strip-slot.incoming .strip-bar,
.strip-slot.incoming .strip-val {
  visibility: hidden;
}

.strip-slot.landed {
  animation: slotLand 0.5s ease-out;
}

@keyframes slotLand {
  0% { box-shadow: inset 0 0 0 1px rgba(31, 28, 24, 0.45); transform: scale(1.06); }
  100% { transform: none; }
}

.yao-fly {
  position: fixed;
  z-index: 60;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 26px 16px;
  pointer-events: none;
}

.yf-row {
  position: relative;
  display: flex;
  align-items: center;
}

.yf-bar {
  display: flex;
  will-change: transform;
}

.yf-bar span {
  flex: 1;
  background: var(--paper);
  -webkit-mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-bar) 0 0 / 100% 100% no-repeat;
}

.yf-mark {
  position: absolute;
  left: 100%;
  margin-left: 12px;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  color: var(--cinnabar);
}

.yf-msg {
  font-size: clamp(16px, 2.4dvh, 19px);
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: var(--paper);
  will-change: transform;
}

.yf-msg.moving {
  color: var(--cinnabar);
}

.coins-cluster {
  transition: opacity 0.7s ease, filter 0.7s ease;
}

.compass-wrap.yao-showing .coins-cluster {
  opacity: 0.18;
  filter: blur(1.5px) grayscale(0.4);
}

.toss-readout > div {
  transition: opacity 0.3s ease;
}

.toss-readout.hush > div {
  opacity: 0;
}

/* ---------- AI 深度解卦弹窗 ---------- */
.ai-modal-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-modal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 12px;
  background: rgba(31, 28, 24, 0.04);
  border-left: 2px solid var(--cinnabar);
  font-size: 12px;
  color: var(--ash);
  letter-spacing: 0.06em;
}

.ai-modal-meta span:first-child {
  color: var(--paper);
  font-weight: 600;
}

.ai-field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--paper-soft);
  letter-spacing: 0.06em;
}

.ai-char-counter {
  font-family: var(--font-hud);
  font-size: 11px;
  color: var(--ash);
}

.ai-question-input {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 60px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(31, 28, 24, 0.2);
  border-radius: 2px;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.6;
  color: var(--paper);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.ai-question-input:focus {
  border-color: var(--cinnabar);
  background: rgba(255, 255, 255, 0.9);
}

.ai-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-status-text {
  font-size: 12px;
  color: var(--ash);
  letter-spacing: 0.04em;
}

.ai-status-text.is-error {
  color: var(--cinnabar);
}

.ai-reading-box {
  min-height: 128px;
  max-height: 44vh;
  overflow-y: auto;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(31, 28, 24, 0.12);
  border-radius: 2px;
  line-height: 1.85;
  font-size: 14.5px;
  color: var(--paper);
}

.ai-reading-box.has-content {
  border-left: 3px solid var(--jade);
}

.ai-reading-placeholder,
.ai-thinking {
  color: var(--ash);
  font-size: 13.5px;
  margin: 0;
}

.ai-reading-p {
  margin: 0 0 10px;
  text-align: justify;
}

.ai-reading-p:last-child {
  margin-bottom: 0;
}

.ai-reading-box.is-streaming .ai-reading-p:last-child::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  color: var(--cinnabar);
  animation: aiCaretBlink 0.9s steps(1, end) infinite;
}

@keyframes aiCaretBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.ai-sec-tag {
  color: var(--cinnabar);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-right: 2px;
}

.ai-modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.ai-disclaimer {
  font-size: 11px;
  color: var(--ash-dim);
  letter-spacing: 0.04em;
}

.ai-copy-btn {
  padding: 5px 12px;
  font-size: 12px;
}

/* 书爻之时墨环退隐，免得压住字 */
.compass-wrap .enso {
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s ease;
}

.compass-wrap.yao-showing .enso {
  opacity: 0.05;
}

.yf-msg span {
  display: inline-block;
  white-space: pre;
  transform-origin: 0 0;
  will-change: transform;
}

/* ---------- 卦象合成后的落款：朱印 + 卦名 ---------- */
.drv-title {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 0.12em;
  white-space: nowrap;
}

.drv-title .solo-seal {
  margin: 0 0.1em;
  display: grid;
  place-items: center;
  animation: none;
}

.drv-title .drv-ch {
  display: inline-block;
  margin: 0;
  animation: none;
}


/* ---------- 首页大标题：一笔挥就——笔锋自左向右扫过带出整行，朱点随即钤上 ---------- */
.intro-title .it-ch {
  display: inline-block;
  font-style: normal;
}

.title-inking .intro-title {
  -webkit-mask-image: linear-gradient(90deg, #000 44%, transparent 56%);
  mask-image: linear-gradient(90deg, #000 44%, transparent 56%);
  -webkit-mask-size: 260% 100%;
  mask-size: 260% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: titleSweep 0.7s cubic-bezier(0.45, 0, 0.2, 1) 0.15s both;
}

.title-inking .intro-title .it-ch {
  animation: chSettle 0.45s ease-out calc(0.15s + var(--i) * 0.07s) both;
}

.title-inking .intro-title .intro-title-dot {
  animation: dotStamp 0.32s cubic-bezier(0.3, 1.5, 0.5, 1) 0.62s both;
}

.title-inking .intro-source {
  animation: fadeRise 0.5s ease 0.8s both;
}

.title-inked .intro-title,
.title-inked .intro-title .it-ch,
.title-inked .intro-title .intro-title-dot,
.title-inked .intro-source {
  animation: none;
  -webkit-mask-image: none;
  mask-image: none;
}

@keyframes titleSweep {
  0% { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  100% { -webkit-mask-position: 0 0; mask-position: 0 0; }
}

@keyframes chSettle {
  0% { filter: blur(2.5px); transform: translateY(2px); }
  100% { filter: blur(0); transform: none; }
}

@keyframes inkBleed {
  0% { opacity: 0; filter: blur(9px); transform: scale(1.28); }
  35% { opacity: 0.75; filter: blur(3px); }
  100% { opacity: 1; filter: blur(0); transform: none; }
}

@keyframes dotStamp {
  0% { opacity: 0; transform: scale(2.4); }
  100% { opacity: 1; transform: none; }
}

@keyframes fadeRise {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .title-inking .intro-title,
  .title-inking .intro-title .it-ch,
  .title-inking .intro-title .intro-title-dot,
  .title-inking .intro-source {
    animation: none;
  }
}

/* ---------- logo「墨」：墨色白文印，干净利落（朱色留给动爻、本卦与断语） ---------- */
.brand-seal {
  color: #f3ecdc;
  background: linear-gradient(150deg, #2b2722 0%, #1a1714 100%);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px #1a1714, inset 0 0 0 3px rgba(243, 236, 220, 0.55);
  -webkit-mask: none;
  mask: none;
  transform: rotate(-3deg);
}

/* ---------- 长按聚钱：墨圈随蓄力微微收紧 ---------- */
.compass-wrap {
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.compass-wrap.holding .enso {
  transform: rotate(calc(var(--hold, 0) * -24deg)) scale(calc(0.985 - var(--hold, 0) * 0.05));
  transition: transform 0.25s ease-out, opacity 0.45s ease;
}

/* 掷钱按钮长按蓄力：深朱自左向右漫过笔触 */
#btn-toss {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#btn-toss::after {
  content: "";
  position: absolute;
  inset: -2px -14px;
  z-index: -1;
  background: linear-gradient(90deg, #8e1620, #6e0f17);
  -webkit-mask: var(--brush-swash) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-swash) 0 0 / 100% 100% no-repeat;
  clip-path: inset(0 calc((1 - var(--hold, 0)) * 100%) 0 0);
  opacity: 0;
  transition: opacity 0.2s ease;
}

#btn-toss.holding::after {
  opacity: 1;
}

#btn-toss.holding {
  transform: scale(calc(1 - var(--hold, 0) * 0.04));
}

/* ---------- 第二境：六爻收拢 → 墨晕 → 卦名现出 ---------- */
.ink-blot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70%;
  aspect-ratio: 1;
  margin: -35% 0 0 -35%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  background: radial-gradient(closest-side, rgba(31, 28, 24, 0.55), rgba(31, 28, 24, 0.22) 55%, rgba(31, 28, 24, 0) 100%);
  filter: blur(4px);
}

.glyph-whole.inked {
  transition: none;
  text-shadow: none;
}

/* ---------- 盘底八卦：墨圈之下缓转，蓄力时转急 ---------- */
.bagua-plate {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 116%;
  aspect-ratio: 1;
  translate: -50% -50%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.bagua-plate.on {
  opacity: 1;
}

/* 墨环已去，盘底八卦即是掷钱之盘：蓄力时微收，书爻时淡去 */
.bagua-plate {
  transition: opacity 0.6s ease, scale 0.3s ease-out;
}

.compass-wrap.holding .bagua-plate {
  scale: calc(1 - var(--hold, 0) * 0.06);
}

.compass-wrap.yao-showing .bagua-plate.on {
  opacity: 0.12;
}

.compass-wrap .enso {
  z-index: 1;
}

.bagua-flight {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 40;
  pointer-events: none;
}

/* 斩开的两半：仍是浓墨，刀口两侧各带一缕朱影 */
.glyph-half.severed {
  color: var(--paper);
  text-shadow: 3px 3px 0 rgba(196, 38, 48, 0.22);
}

/* ---------- 之卦变爻：斩击与相撞 ---------- */
.drv-slash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--lh) * 6);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(196, 38, 48, 0), #c42630 30%, #fff6ea 50%, #c42630 70%, rgba(196, 38, 48, 0));
  box-shadow: 0 0 6px rgba(196, 38, 48, 0.55);
  pointer-events: none;
  opacity: 0;
}

.drv-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  pointer-events: none;
}

.drv-impact {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--lh) * 4);
  height: calc(var(--lh) * 4);
  border-radius: 50%;
  border: 2px solid rgba(31, 28, 24, 0.55);
  pointer-events: none;
}

/* 入摇钱境：八卦落盘之前，铜钱先不现 */
.compass-wrap.coins-pending .coins-cluster {
  opacity: 0;
  transition: none;
}

/* ---------- 第二境卦名：完整卦名，本字作朱印 ---------- */
.glyph-whole.len3,
.glyph-half.len3 {
  font-size: clamp(50px, min(15vw, 9dvh), 76px);
  letter-spacing: 0.04em;
}

.glyph-whole.len4,
.glyph-half.len4 {
  font-size: clamp(42px, min(12.5vw, 7.6dvh), 64px);
  letter-spacing: 0.03em;
}

.gw-line {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.gw-seal {
  display: inline-grid;
  place-items: center;
  margin: 0 0.06em;
  padding: 0.06em 0.1em 0.1em;
  line-height: 1;
  color: #fbf6ec;
  background: linear-gradient(135deg, #cf2a35, #b3212c);
  border-radius: 0.08em;
  box-shadow: inset 0 0 0 0.04em rgba(251, 246, 236, 0.3);
  text-shadow: none;
}

.gw-seal.two {
  font-size: 0.8em;
  padding: 0.12em 0.12em 0.14em;
}

/* 本字从天而降：落地时荡开的一圈尘痕 */
.drv-drop-ring {
  position: absolute;
  width: 3.2em;
  height: 3.2em;
  border-radius: 50%;
  border: 2px solid rgba(31, 28, 24, 0.45);
  pointer-events: none;
}

.drv-title .drv-spark {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

/* 满蓄：盘底轻顿、按钮一闪 */
.compass-wrap.charged .bagua-plate.on {
  animation: plateCharged 0.5s ease-out;
}

/* 满蓄只让盘子轻轻一顿，不泛红光 */
@keyframes plateCharged {
  0% { transform: none; }
  30% { transform: scale(1.025); }
  100% { transform: none; }
}

#btn-toss.charged {
  animation: btnCharged 0.45s ease-out;
}

@keyframes btnCharged {
  0% { filter: drop-shadow(0 4px 8px rgba(120, 20, 25, 0.22)); }
  30% { filter: drop-shadow(0 0 14px rgba(196, 38, 48, 0.75)) brightness(1.15); }
  100% { filter: drop-shadow(0 4px 8px rgba(120, 20, 25, 0.22)); }
}

/* 第二境：六爻收拢成象后衬底的淡墨（在卦象之后） */
.ink-blot.faint {
  z-index: 4;
  width: 56%;
  margin: -28% 0 0 -28%;
}

/* 一刀斩开的卦象：两片拓本，各按刀线裁切 */
.hexcut {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  will-change: transform, opacity;
}

.hexcut .hexcut-row {
  position: absolute;
  display: block;
  margin: 0;
  opacity: 1;
  animation: none;
  transform-origin: 0 0;
}

/* 钤印按到底时，印泥在纸上洇开的一圈淡朱 */
.drv-seal-bloom {
  position: absolute;
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(196, 38, 48, 0.28), rgba(196, 38, 48, 0.1) 60%, rgba(196, 38, 48, 0) 100%);
  filter: blur(2px);
}


/* ---------- 卦印：马善政毛笔字；印泥有浓淡、带细纸纹，边缘略毛（像真按在宣纸上），无投影 ---------- */
.solo-seal,
.solo-seal.nuclear,
.solo-seal.changed {
  font-family: var(--font-brush);
  font-weight: 400;
  color: #fbf6ec;
  border: none;
  border-radius: 3px;
  box-shadow: none;
  background-color: #c0232e;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27200%27%20height%3D%27200%27%3E%3Cfilter%20id%3D%27c%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.035%27%20numOctaves%3D%273%27%20seed%3D%2711%27/%3E%3CfeColorMatrix%20values%3D%270%200%200%200%201%20%200%200%200%200%201%20%200%200%200%200%201%20%200%200%200%200.9%20-0.25%27/%3E%3C/filter%3E%3Crect%20width%3D%27200%27%20height%3D%27200%27%20filter%3D%27url%28%23c%29%27/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27160%27%20height%3D%27160%27%3E%3Cfilter%20id%3D%27g%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.8%27%20numOctaves%3D%272%27%20seed%3D%274%27/%3E%3CfeColorMatrix%20values%3D%270%200%200%200%200.35%20%200%200%200%200%200.05%20%200%200%200%200%200.05%20%200%200%200%200.55%200%27/%3E%3C/filter%3E%3Crect%20width%3D%27160%27%20height%3D%27160%27%20filter%3D%27url%28%23g%29%27/%3E%3C/svg%3E");
  background-size: 200px 200px, 160px 160px;
  background-blend-mode: soft-light, normal;
  mix-blend-mode: multiply;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%20100%20100%27%20preserveAspectRatio%3D%27none%27%3E%3Cfilter%20id%3D%27e%27%20x%3D%27-5%25%27%20y%3D%27-5%25%27%20width%3D%27110%25%27%20height%3D%27110%25%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.12%27%20numOctaves%3D%273%27%20seed%3D%275%27%20result%3D%27t%27/%3E%3CfeDisplacementMap%20in%3D%27SourceGraphic%27%20in2%3D%27t%27%20scale%3D%273.5%27%20xChannelSelector%3D%27R%27%20yChannelSelector%3D%27G%27/%3E%3C/filter%3E%3Crect%20x%3D%272.5%27%20y%3D%272.5%27%20width%3D%2795%27%20height%3D%2795%27%20rx%3D%273%27%20fill%3D%27%23000%27%20filter%3D%27url%28%23e%29%27/%3E%3C/svg%3E") 0 0 / 100% 100%;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%20100%20100%27%20preserveAspectRatio%3D%27none%27%3E%3Cfilter%20id%3D%27e%27%20x%3D%27-5%25%27%20y%3D%27-5%25%27%20width%3D%27110%25%27%20height%3D%27110%25%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.12%27%20numOctaves%3D%273%27%20seed%3D%275%27%20result%3D%27t%27/%3E%3CfeDisplacementMap%20in%3D%27SourceGraphic%27%20in2%3D%27t%27%20scale%3D%273.5%27%20xChannelSelector%3D%27R%27%20yChannelSelector%3D%27G%27/%3E%3C/filter%3E%3Crect%20x%3D%272.5%27%20y%3D%272.5%27%20width%3D%2795%27%20height%3D%2795%27%20rx%3D%273%27%20fill%3D%27%23000%27%20filter%3D%27url%28%23e%29%27/%3E%3C/svg%3E") 0 0 / 100% 100%;
}

.solo-seal.nuclear {
  background-color: #9a6427;
}

.solo-seal.changed {
  background-color: #2f5f80;
}

/* 盖印时印文先收成 0 宽的槽位，盖下时整行让出位置 */
.drv-seal-slot {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.drv-seal-slot .solo-seal {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% 0;
  margin: 0;
}

/* 钤印时印下方的同形方影：由偏移到贴合，触纸即灭（只在下压那 100ms 出现，不盖在印上） */
.drv-seal-shadow {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: rgba(31, 28, 24, 0.28);
  pointer-events: none;
  z-index: 0;
}

.drv-seal-slot .solo-seal {
  z-index: 1;
}

/* 页眉卦印带一点手按的微倾（与落款同角，交棒不跳） */
.gua-head-row .solo-seal {
  rotate: -1.8deg;
}

.gua-head-row .solo-seal.nuclear {
  rotate: 1.5deg;
}

.gua-head-row .solo-seal.changed {
  rotate: -1.2deg;
}

/* 摇钱时的经传引句：字距略收，长句也排得下 */
.toss-readout .main-line.quote {
  letter-spacing: 0.08em;
}

/* 本卦两卦相撞：接缝处的冲击圈是一道扁椭圆 */
.drv-impact.seam {
  width: calc(var(--lw) * 0.9);
  height: calc(var(--lw) * 0.9);
}

/* 互卦分身：两份三、四爻之间的墨丝（SVG 逐帧重画） */
.drv-threads {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  fill: rgba(31, 28, 24, 0.82);
}

/* 推演收尾交棒：页眉卦名行等落款飞到位后同一帧现出（不淡入、不上浮），避免两份字叠出重影 */
.hex-page-card.head-pending .gua-head-row {
  opacity: 0;
  transform: none;
  transition: none;
}

.hex-page-card.head-instant .gua-head-row {
  opacity: 1;
  transform: none;
  transition: none !important;
}

/* 盘底八卦比摇钱区大一圈（116%），上下各多留出这一圈的位置，免得卦名压到上方题字与下方读数 */
.compass-wrap {
  margin-block: clamp(20px, min(7.5vw, 4dvh), 34px);
}

/* 连按加速：每按一下按钮轻轻一顿 */
#btn-toss.hurried {
  animation: btnHurry 0.22s ease-out;
}

@keyframes btnHurry {
  0% { transform: scale(1); }
  40% { transform: scale(0.965); }
  100% { transform: scale(1); }
}

/* ======================================================================
 * 首页 · 题跋扉页：不再是一张白卡——先天八卦为主角（canvas 绘），
 * 题旨、出处、心法、按钮像题跋一样直接落在宣纸留白上；四礼收成四枚小签
 * ====================================================================== */
#stage-intro.intro-panel {
  position: relative;
  isolation: isolate;
  width: 100%;
  margin: 0 auto;
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  gap: 0;
}

/* 题跋背后一团极柔的宣纸雾，保证字压在远山城影上也清楚 */
#stage-intro.intro-panel::before {
  content: "";
  position: absolute;
  inset: -6% -10%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(248, 244, 234, 0.78), rgba(248, 244, 234, 0.4) 60%, rgba(248, 244, 234, 0) 100%);
}

#stage-intro .intro-kicker {
  font-size: 13px;
  letter-spacing: 0.6em;
  margin-bottom: clamp(10px, 1.6dvh, 16px);
}

#stage-intro .intro-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  white-space: normal;
  line-height: 1.22;
  letter-spacing: 0.1em;
}

/* 两行微错落：上行「居则观其象」，下行以朱点起势「· 动则观其变」 */
#stage-intro .intro-title > span:first-child {
  flex-basis: 100%;
}

#stage-intro .intro-title-dot {
  margin: 0 0.12em 0 1.15em;
}

#stage-intro .intro-source {
  margin: clamp(8px, 1.2dvh, 12px) 0 clamp(14px, 2.2dvh, 22px);
  font-size: 12.5px;
  letter-spacing: 0.12em;
}

#stage-intro .intro-line {
  margin: 0 0 clamp(16px, 2.6dvh, 26px);
  min-height: 1.7em;
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.12em;
  color: var(--paper-soft);
}

#stage-intro .stage-actions {
  width: auto;
  margin: 0;
  opacity: 1;
  transform: none;
  animation: none;
  transition: none;
  pointer-events: none;
}

#stage-intro.rites-done .stage-actions {
  pointer-events: auto;
}

#stage-intro .primary-cast-btn {
  min-width: 230px;
}

/* 四签：澄心 · 存思 · 演易 · 玩辞 */
#stage-intro .intro-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: clamp(14px, 2.2dvh, 22px);
}

#stage-intro .intro-tag {
  background: none;
  border: none;
  padding: 4px 6px;
  font-family: var(--font-brush);
  font-size: 17px;
  letter-spacing: 0.12em;
  color: var(--ash);
  cursor: pointer;
  transition: color 0.2s ease, box-shadow 0.2s ease;
}

#stage-intro .intro-tag:hover,
#stage-intro .intro-tag.on {
  color: var(--paper);
  box-shadow: inset 0 -2px 0 rgba(196, 38, 48, 0.55);
}

#stage-intro .intro-tag-dot {
  font-style: normal;
  color: var(--ash-dim, #b3a993);
}

#stage-intro .intro-hint {
  display: none;
  margin-top: 8px;
  font-size: 11.5px;
  letter-spacing: 0.14em;
}

/* 只有能悬停的设备（有键盘）才提示回车 */
@media (hover: hover) and (pointer: fine) {
  #stage-intro .intro-hint {
    display: block;
  }
}

/* 桌面：左题跋 · 右天象 */
@media (min-width: 960px) {
  #stage-intro.intro-panel {
    max-width: 940px;
    min-height: calc(100dvh - 170px);
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    padding: 0 0 6dvh clamp(16px, 3vw, 40px);
  }
  #stage-intro.intro-panel > * {
    max-width: 460px;
  }
  #stage-intro.intro-panel::before {
    right: auto;
    width: 560px;
    left: -60px;
  }
  #stage-intro .intro-title {
    font-size: clamp(40px, 4vw, 56px);
  }
  #stage-intro .stage-actions {
    align-items: flex-start;
  }
  #stage-intro .intro-tags {
    margin-left: -6px;
  }
}

/* 窄屏与平板：上天象 · 中题旨 · 下起手（八卦由 canvas 画在题旨上方的留白里） */
@media (max-width: 959px) {
  #stage-intro.intro-panel {
    align-items: center;
    text-align: center;
    padding: clamp(220px, 37dvh, 340px) 12px 20px;
  }
  #stage-intro.intro-panel::before {
    top: clamp(200px, 34dvh, 320px);
  }
  #stage-intro .intro-title {
    justify-content: center;
    font-size: min(10.5vw, 5.4dvh, 46px);
    letter-spacing: 0.06em;
  }
  #stage-intro .intro-title > span:first-child {
    text-align: center;
  }
  #stage-intro .intro-title-dot {
    margin-left: 0;
  }
  #stage-intro .intro-line {
    font-size: 14px;
  }
}

/* ---- 开场（.title-inking 期间播放，.title-inked 落定后撤掉动画） ---- */
.title-inking #stage-intro .intro-kicker,
#stage-intro.title-inking .intro-kicker {
  animation: fadeRise 0.3s ease 0.12s both;
}

#stage-intro.title-inking .intro-title {
  animation: titleSweep 0.58s cubic-bezier(0.45, 0, 0.2, 1) 0.26s both;
}

#stage-intro.title-inking .intro-title .it-ch {
  animation: chSettle 0.4s ease-out calc(0.26s + var(--i) * 0.045s) both;
}

/* 朱点「寸劲」落定：急收、无回弹 */
#stage-intro.title-inking .intro-title .intro-title-dot {
  animation: dotPress 0.11s cubic-bezier(0.75, 0, 1, 0.45) 0.78s both;
}

/* 出处与心法等题旨下行写完（约 1.2s）再现，不抢在字前头 */
#stage-intro.title-inking .intro-source {
  animation: fadeRise 0.3s ease 1s both;
}

#stage-intro.title-inking .intro-line {
  animation: fadeRise 0.3s ease 1.08s both;
}

/* 按钮：朱墨底自左向右一笔刷出；按钮本体不裁切，1.05 秒起整块可点 */
#stage-intro.title-inking .primary-cast-btn {
  animation: plainFade 0.2s ease 0.95s both;
}

#stage-intro.title-inking .primary-cast-btn::before {
  animation: btnWipe 0.3s cubic-bezier(0.3, 0.7, 0.4, 1) 0.95s both;
}

#stage-intro.title-inking .intro-tags,
#stage-intro.title-inking .intro-hint {
  animation: fadeRise 0.3s ease 1.35s both;
}

#stage-intro.title-inked .intro-kicker,
#stage-intro.title-inked .intro-source,
#stage-intro.title-inked .primary-cast-btn::before,
#stage-intro.title-inked .intro-line,
#stage-intro.title-inked .primary-cast-btn,
#stage-intro.title-inked .intro-tags,
#stage-intro.title-inked .intro-hint {
  animation: none;
}

@keyframes dotPress {
  0% { opacity: 0; transform: scale(2); }
  100% { opacity: 1; transform: none; }
}

@keyframes btnWipe {
  0% { clip-path: inset(-20% 110% -20% -10%); }
  100% { clip-path: inset(-20% -10% -20% -10%); }
}

/* 离开首页：题跋淡墨散去，八卦随即飞向盘心 */
#stage-intro.leaving > * {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* 顶栏站名：不再大模糊晕入（首帧像没加载完），轻轻一现即可 */
.brand-text h1 {
  animation: plainFade 0.28s ease both;
}

@keyframes plainFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #stage-intro .intro-kicker,
  #stage-intro .intro-source,
  #stage-intro .primary-cast-btn::before,
  #stage-intro .intro-line,
  #stage-intro .primary-cast-btn,
  #stage-intro .intro-tags,
  #stage-intro .intro-hint {
    animation: none !important;
  }
}

/* ---- 首页题旨：逐字落墨（替代整行遮罩扫出）——每字由一团虚墨收拢成形，
 *      上行写完、朱点寸劲落定，下行接着写 ---- */
#stage-intro.title-inking .intro-title {
  animation: none;
  -webkit-mask-image: none;
  mask-image: none;
}

#stage-intro.title-inking .intro-title .it-ch {
  animation: inkDrop 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) calc(0.22s + var(--i) * 0.055s + var(--line2, 0s)) both;
}

/* 下行比上行多等一拍（朱点落在两行之间） */
#stage-intro .intro-title > span:last-child .it-ch {
  --line2: 0.1s;
}

@keyframes inkDrop {
  0% { opacity: 0; filter: blur(7px); transform: translateY(-3px) scale(1.18); text-shadow: 0 0 14px rgba(31, 28, 24, 0.5); }
  45% { opacity: 0.9; filter: blur(1.6px); transform: translateY(0) scale(1.03); text-shadow: 0 0 6px rgba(31, 28, 24, 0.3); }
  100% { opacity: 1; filter: blur(0); transform: none; text-shadow: none; }
}

#stage-intro.title-inking .intro-title .intro-title-dot {
  animation: dotPress 0.12s cubic-bezier(0.75, 0, 1, 0.45) 0.58s both;
}

/* ---- 主按钮待机：开场后每隔几秒，朱墨笔触里缓缓拂过一道淡淡的光，不闪不跳 ---- */
#btn-enter-cast::after {
  content: "";
  position: absolute;
  inset: -2px -14px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 38%, rgba(255, 236, 214, 0.32) 50%, transparent 62%) no-repeat;
  background-size: 260% 100%;
  background-position: 130% 0;
  -webkit-mask: var(--brush-swash) 0 0 / 100% 100% no-repeat;
  mask: var(--brush-swash) 0 0 / 100% 100% no-repeat;
  opacity: 0;
}

#stage-intro.title-inked #btn-enter-cast::after {
  animation: btnSheen 5.5s ease-in-out 1.6s infinite;
}

@keyframes btnSheen {
  0% { background-position: 130% 0; opacity: 0; }
  6% { opacity: 1; }
  30% { background-position: -30% 0; opacity: 1; }
  34%, 100% { background-position: -30% 0; opacity: 0; }
}

/* ---- 窄屏顶栏收紧：两行合计约 80px，给首页八卦让出画心 ---- */
@media (max-width: 640px) {
  .topbar {
    padding: 6px 10px 4px;
    gap: 2px 8px;
  }
  .brand {
    gap: 8px;
  }
  .brand-seal {
    width: 30px;
    height: 30px;
    font-size: 19px;
  }
  .brand-text h1 {
    font-size: 23px;
  }
  .telemetry-line {
    font-size: 11px;
  }
  .nav-btn,
  .icon-btn {
    padding-top: 3px;
    padding-bottom: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #stage-intro .intro-title .it-ch,
  #btn-enter-cast::after {
    animation: none !important;
  }
}

/* 点击跳过开场（.title-inked）时题旨立即落定 */
#stage-intro.title-inked .intro-title .it-ch,
#stage-intro.title-inked .intro-title .intro-title-dot {
  animation: none;
}

/* ---- 首页题旨 v3：一字一笔「写」出来——每字沿左上→右下的笔势由淡墨边缘显出（不模糊、不缩放），
 *      上行五字依次写完，朱点落定，下行接着写 ---- */
#stage-intro .intro-title .it-ch {
  -webkit-mask-image: linear-gradient(135deg, #000 42%, transparent 58%);
  mask-image: linear-gradient(135deg, #000 42%, transparent 58%);
  -webkit-mask-size: 320% 320%;
  mask-size: 320% 320%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
}

#stage-intro.title-inking .intro-title .it-ch {
  animation: charWrite 0.28s cubic-bezier(0.4, 0, 0.3, 1) calc(0.15s + var(--i) * 0.07s + var(--line2, 0s)) both;
}

#stage-intro .intro-title > span:last-child .it-ch {
  --line2: 0.08s;
}

@keyframes charWrite {
  0% { -webkit-mask-position: 100% 100%; mask-position: 100% 100%; }
  100% { -webkit-mask-position: 0 0; mask-position: 0 0; }
}

#stage-intro.title-inking .intro-title .intro-title-dot {
  animation: dotPress 0.12s cubic-bezier(0.75, 0, 1, 0.45) 0.66s both;
}

#stage-intro.title-inked .intro-title .it-ch,
#stage-intro.title-inked .intro-title .intro-title-dot {
  animation: none;
}

/* 脚本接手前先藏住题跋（否则会先露出一遍完整的字，再从头播动画）；八卦照常在画布上 */
#stage-intro:not(.title-inking):not(.title-inked) > * {
  opacity: 0;
}

/* 窄屏：题跋背后的宣纸雾一直托到四签底下；四签字色加深，压得住近山 */
@media (max-width: 959px) {
  #stage-intro.intro-panel::before {
    inset: clamp(200px, 34dvh, 320px) -14% -8%;
    background: radial-gradient(ellipse 62% 58% at 50% 46%, rgba(248, 244, 234, 0.82), rgba(248, 244, 234, 0.5) 62%, rgba(248, 244, 234, 0) 100%);
  }
  #stage-intro .intro-tag {
    color: rgba(31, 28, 24, 0.72);
  }
}

/* 从首页进摇钱页：面板晚一拍铺开，飞来的八卦先过、不压字 */
#stage-cast.active {
  animation: stageEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.22s backwards;
}

/* ---- 首页 v4：只有题旨两句有动画（一字一笔慢写），其余开门即在 ---- */
#stage-intro.title-inking .intro-kicker,
#stage-intro.title-inking .intro-source,
#stage-intro.title-inking .intro-line,
#stage-intro.title-inking .primary-cast-btn,
#stage-intro.title-inking .primary-cast-btn::before,
#stage-intro.title-inking .intro-tags,
#stage-intro.title-inking .intro-hint {
  animation: none;
}

/* 每字 0.55 秒写成，字间 0.16 秒；上行写完朱点落定，停一拍再写下行 */
#stage-intro.title-inking .intro-title .it-ch {
  animation: charWrite 0.55s cubic-bezier(0.4, 0, 0.3, 1) calc(0.3s + var(--i) * 0.16s + var(--line2, 0s)) both;
}

#stage-intro .intro-title > span:last-child .it-ch {
  --line2: 0.35s;
}

#stage-intro.title-inking .intro-title .intro-title-dot {
  animation: dotPress 0.16s cubic-bezier(0.75, 0, 1, 0.45) 1.5s both;
}

/* 脚本接手前只藏题旨两句，其余照常显示 */
#stage-intro:not(.title-inking):not(.title-inked) > * {
  opacity: 1;
}

#stage-intro:not(.title-inking):not(.title-inked) .intro-title {
  opacity: 0;
}

/* ---- 首页题旨 v5「墨渗」：每字先以淡墨现出、再慢慢转浓（略带虚化、轻浮 3px），一字接一字 ---- */
#stage-intro .intro-title .it-ch {
  -webkit-mask-image: none;
  mask-image: none;
}

#stage-intro.title-inking .intro-title .it-ch {
  animation: inkSoak 0.95s cubic-bezier(0.25, 0.6, 0.3, 1) calc(0.2s + var(--i) * 0.2s + var(--line2, 0s)) both;
}

#stage-intro .intro-title > span:last-child .it-ch {
  --line2: 0.25s;
}

#stage-intro.title-inking .intro-title .intro-title-dot {
  animation: plainFade 0.5s ease calc(0.2s + 5 * 0.2s + 0.1s) both;
}

@keyframes inkSoak {
  0% { opacity: 0; color: rgba(31, 28, 24, 0.15); filter: blur(2.5px); transform: translateY(3px); }
  35% { opacity: 1; color: rgba(31, 28, 24, 0.38); filter: blur(1px); }
  100% { opacity: 1; color: var(--paper); filter: blur(0); transform: none; }
}

/* ---- 首页题旨 v6「墨晕成字」：由 JS 在字上叠一张 SVG 逐字做墨晕，HTML 字先藏着，成字后换回 ---- */
#stage-intro.title-inking .intro-title .it-ch,
#stage-intro.title-inking .intro-title .intro-title-dot {
  animation: none;
}

#stage-intro .intro-title {
  position: relative;
}

#stage-intro .intro-title.svg-inking .it-ch,
#stage-intro .intro-title.svg-inking .intro-title-dot {
  visibility: hidden;
}

#stage-intro .it-svg {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
}

/* 本卦两卦相撞：接缝处横贯的一道墨光 */
.drv-seam-flash {
  position: absolute;
  height: 3px;
  border-radius: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(31, 28, 24, 0), rgba(31, 28, 24, 0.85) 30%, rgba(196, 38, 48, 0.75) 50%, rgba(31, 28, 24, 0.85) 70%, rgba(31, 28, 24, 0));
}

/* 推演收尾的落款：印比页眉的大一号（飞回页眉时随之缩小） */
.drv-title .solo-seal {
  width: clamp(52px, 14.5vw, 68px);
  min-width: clamp(52px, 14.5vw, 68px);
  height: clamp(52px, 14.5vw, 68px);
  font-size: clamp(33px, 9.4vw, 44px);
}

.drv-title .solo-seal.two-char {
  width: auto;
  padding: 0 clamp(10px, 2.8vw, 16px);
  font-size: clamp(25px, 7vw, 33px);
}

/* 解卦弹框：问所感何事 → 朱批（朱熹取爻原文）+ 义理参悟原文 */
.jiegua-result { display: flex; flex-direction: column; margin-top: 14px; }
.jiegua-result[hidden] { display: none; }
.jiegua-result .zhuxi-box { margin: 10px 0 18px; padding: 16px 16px 12px; }
.jiegua-result .zhuxi-focus-text { font-size: 16px; line-height: 1.7; }
.jiegua-ai-head { font-size: 12px; color: var(--jade); letter-spacing: 0.24em; margin-bottom: 6px; }
.jiegua-wrap .ai-reading-box { max-height: none; min-height: 72px; }
.jiegua-foot-btns { display: inline-flex; gap: 8px; align-items: center; }
.jiegua-foot-btns [hidden] { display: none; }
.jiegua-foot-btns { flex-shrink: 0; }
.jiegua-foot-btns .ghost-btn { white-space: nowrap; }
.jiegua-wrap .ai-modal-foot { gap: 10px; }

/* 解卦等待：三点墨依次洇开又收回 + 一句「参悟卦理」之类的话 */
.ai-wait { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 96px; }
.ai-wait-ink { display: inline-flex; gap: 7px; }
.ai-wait-ink i {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #2a2520 0 45%, rgba(31, 28, 24, 0.55) 70%, transparent 100%);
  animation: aiInkDrop 1.5s ease-in-out infinite;
}
.ai-wait-ink i:nth-child(2) { animation-delay: 0.22s; }
.ai-wait-ink i:nth-child(3) { animation-delay: 0.44s; background: radial-gradient(circle at 45% 40%, var(--cinnabar) 0 45%, rgba(196, 38, 48, 0.5) 70%, transparent 100%); }
@keyframes aiInkDrop {
  0%, 100% { transform: scale(0.45); opacity: 0.25; filter: blur(0.5px); }
  40% { transform: scale(1.15); opacity: 1; filter: blur(0); }
  70% { transform: scale(0.9); opacity: 0.7; }
}
.ai-wait-text { font-family: var(--font-serif); font-size: 15px; letter-spacing: 0.22em; color: var(--ink-soft, #4a443c); }
@media (prefers-reduced-motion: reduce) { .ai-wait-ink i { animation: none; opacity: 0.7; } }

/* logo：「墨」印与「爻」同一行居中对齐（不再与「爻 + 干支行」整块居中，否则印比爻低半行） */
.brand { --brand-h1: clamp(26px, 3.8dvh, 32px); --brand-seal: clamp(34px, 5dvh, 40px); align-items: flex-start; }
.brand-text h1 { font-size: var(--brand-h1); }
.brand-seal { width: var(--brand-seal); height: var(--brand-seal); margin-top: calc((var(--brand-h1) - var(--brand-seal)) / 2); }
@media (max-width: 640px) {
  .brand { --brand-h1: 23px; --brand-seal: 30px; padding-top: 4px; }
}

/* ---------- 释义弹框：额度 / 次卡兑换码区 + 一卦一释锁定态 ---------- */
.jiegua-compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-quota-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(31, 28, 24, 0.035);
  border: 1px solid rgba(31, 28, 24, 0.1);
  border-radius: 2px;
}

.ai-quota-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ai-quota-pill {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ash);
}

.ai-quota-pill.is-ok {
  color: var(--jade);
}

.ai-quota-pill.is-warn {
  color: var(--cinnabar);
}

.ai-code-toggle {
  background: none;
  border: none;
  padding: 2px 4px;
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--jade);
  letter-spacing: 0.06em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ai-code-toggle:hover {
  color: var(--cinnabar);
}

.ai-code-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(31, 28, 24, 0.14);
}

.ai-code-panel[hidden] {
  display: none;
}

.ai-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-code-input {
  flex: 1;
  min-width: 170px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(31, 28, 24, 0.2);
  border-radius: 2px;
  font-family: var(--font-hud);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  outline: none;
}

.ai-code-input:focus {
  border-color: var(--jade);
  background: rgba(255, 255, 255, 0.96);
}

.ai-code-bind-btn {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.ai-code-clear-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--ash);
  cursor: pointer;
}

.ai-code-clear-btn:hover {
  color: var(--cinnabar);
}

.ai-code-clear-btn[hidden],
.ai-buy-link[hidden] {
  display: none;
}

.ai-code-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-code-msg {
  font-size: 11.5px;
  color: var(--ash);
  letter-spacing: 0.03em;
}

.ai-code-msg.is-error {
  color: var(--cinnabar);
}

.ai-buy-link {
  font-size: 12px;
  color: var(--cinnabar);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.ai-buy-link:hover {
  text-decoration: underline;
}

.jiegua-locked-q {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(31, 28, 24, 0.1);
  border-radius: 2px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--paper);
}

.jiegua-locked-q[hidden] {
  display: none;
}

.jiegua-locked-tag {
  flex: none;
  font-size: 11.5px;
  color: var(--jade);
  letter-spacing: 0.14em;
  padding: 1px 6px;
  background: var(--jade-soft);
  border-radius: 2px;
}

.jiegua-ai-head-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.jiegua-ai-head-row .jiegua-ai-head {
  margin-bottom: 0;
}

.jiegua-done-note {
  font-size: 11.5px;
  color: var(--ash);
  letter-spacing: 0.04em;
}

.ai-turnstile-wrap {
  padding-top: 4px;
}

.ai-turnstile-wrap[hidden] {
  display: none;
}

.poster-img {
  -webkit-touch-callout: default;
}

.poster-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.poster-save-hint {
  font-size: 12px;
  color: var(--ash);
  letter-spacing: 0.04em;
}
