/* ==========================================================================
   知命 · 设计体系（Design System）
   --------------------------------------------------------------------------
   设计哲学
     现代数字产品 × 东方审美：留白、层次、虚实、流动、平衡。
     不堆砌中国元素，只把「东方」转译为色彩、空间、节奏与动效。

   色彩逻辑（阴阳 / 五行）
     纸：宣纸 → 半宣 → 月白 → 纯白   （由外到内，越往里越亮）
     墨：黎黑 → 墨灰 → 岩灰 → 淡墨   （文字四级层次）
     彩：青黛（主）× 赭石（辅）× 暗朱（印）
     实：深墨面板，与大面积留白形成阴阳对比，不做装饰性太极图。

   所有颜色、间距、圆角、阴影、动效都收敛到本文件顶部的 token。
   改版时只改 token，不要在各处散写数值。

   目录
     01 字体      02 Token     03 基础      04 背景
     05 骨架      06 排版      07 组件      08 知命
     09 观运      10 问道      11 养运      12 同道
     13 自观      14 入内      15 商城      16 动效
     17 响应式    18 可访问性
   ========================================================================== */

/* ==========================================================================
   01 · 字体
   思源宋体子集（自托管，见 .fontwork/build_subset.py）
   单字重：东方排版的高级感来自字号 / 字距 / 墨色层次，而不是粗体。
   字重声明为区间，避免浏览器对衬线做合成加粗（会显糊、显旧）。
   ========================================================================== */
@font-face {
  font-family: "Zhiming Serif";
  src: url("fonts/NotoSerifSC-Display-400.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+2E80-9FFF, U+3000-303F, U+F900-FAFF, U+FF00-FFEF;
}

/* ==========================================================================
   02 · Token
   ========================================================================== */
:root {
  color-scheme: light;

  /* ---------- 纸 · 背景层次 ---------- */
  --paper:      #f1efe9;            /* 宣纸 · 页面底 */
  --paper-2:    #f7f5f0;            /* 半宣 · 次级底 / 吸底渐变 */
  --surface:    #fcfbf8;            /* 月白 · 卡片 */
  --surface-2:  #ffffff;            /* 纯白 · 输入 / 浮层 */
  --sunken:     #e9e6dd;            /* 岩灰 · 轨道 / 内嵌 */
  --veil:       rgba(252, 251, 248, 0.86);

  /* ---------- 实 · 深墨面板（与留白形成阴阳） ---------- */
  --deep:       #272c30;
  --deep-2:     #1b1f22;
  --deep-ink:   #f2f0ea;
  --deep-ink-2: rgba(242, 240, 234, 0.62);
  --deep-ink-3: rgba(242, 240, 234, 0.34);
  --deep-line:  rgba(242, 240, 234, 0.14);

  /* ---------- 墨 · 文字四级 ---------- */
  --ink:        #22262a;
  --ink-2:      #4e545a;
  --ink-3:      #6b7178;   /* 说明 / 辅助：小字号也要读得清 */
  --ink-4:      #8a9099;   /* 占位 / 最弱：仅用于非信息性文字 */
  --ink-inv:    #f2f0ea;

  /* ---------- 线 ---------- */
  --line:       #e5e2da;
  --line-soft:  #efedE6;
  --line-2:     #d4d0c4;

  /* ---------- 彩 · 品牌与强调（低饱和） ---------- */
  --primary:        #3c5b61;   /* 青黛 */
  --primary-deep:   #2b464b;
  --primary-soft:   #e5eceb;
  --accent:         #8e6f4b;   /* 赭石 / 茶褐 */
  --accent-soft:    #f1eadd;
  --seal:           #a25346;   /* 暗朱 · 仅用于印章与极少量提示 */

  /* ---------- 状态 ---------- */
  --ok:      #5b7a57;  --ok-soft:   #eaf1e7;
  --warn:    #977a40;
  --err:     #a25346;  --err-soft:  #f6eae5;

  /* ---------- 五行（低饱和传统色） ---------- */
  --wx-mu:   #5f7d5b;   /* 木 · 竹青 */
  --wx-huo:  #a3563f;   /* 火 · 赭红 */
  --wx-tu:   #9a7b46;   /* 土 · 土黄 */
  --wx-jin:  #87857c;   /* 金 · 缟灰 */
  --wx-shui: #47647f;   /* 水 · 黛蓝 */

  /* ---------- 圆角（分级，不做“气泡”） ---------- */
  --r-xs:   6px;    /* 徽标 / 小标签 */
  --r-sm:   9px;    /* 按钮 / 输入 */
  --r-md:   13px;   /* 卡片 */
  --r-lg:   18px;   /* 大面板 / 抽屉 */
  --r-pill: 999px;

  /* ---------- 间距（节奏来源） ---------- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 22px; --sp-6: 30px; --sp-7: 42px; --sp-8: 60px;

  /* ---------- 阴影（极轻：靠边界，不靠投影） ---------- */
  --sh-1: 0 1px 2px rgba(34, 38, 42, 0.035);
  --sh-2: 0 2px 10px -3px rgba(34, 38, 42, 0.07);
  --sh-3: 0 12px 32px -10px rgba(34, 38, 42, 0.14);
  --sh-4: 0 26px 64px -20px rgba(34, 38, 42, 0.24);

  /* ---------- 动效（慢、柔、只动 transform/opacity） ---------- */
  --e-out:   cubic-bezier(0.22, 0.61, 0.36, 1);
  --e-soft:  cubic-bezier(0.33, 0.02, 0.2, 1);
  --e-inout: cubic-bezier(0.45, 0.05, 0.55, 0.95);
  --t-fast:  0.18s;
  --t:       0.34s;
  --t-slow:  0.62s;
  --t-breath: 6.4s;   /* 「呼吸」节奏：问道入口圆环，慢到几乎察觉不到 */

  /* ---------- 字体 ---------- */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "HarmonyOS Sans SC",
    "PingFang SC", "Source Han Sans SC", "Noto Sans CJK SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Zhiming Serif", "Noto Serif SC", "Source Han Serif SC",
    "Songti SC", "STSong", "SimSun", serif;

  /* ---------- 字号 / 行高 / 字距 ---------- */
  --fs-2xs: 10.5px; --fs-xs: 11.5px; --fs-sm: 12.5px; --fs-base: 14px;
  --fs-md: 15px;    --fs-lg: 17px;   --fs-xl: 20px;   --fs-2xl: 24px;
  --fs-3xl: 28px;
  --lh-tight: 1.35; --lh-snug: 1.6; --lh-base: 1.8; --lh-loose: 2.05;
  --ls-1: 0.04em;  --ls-2: 0.12em;  --ls-3: 0.2em;  --ls-4: 0.32em;

  /* ---------- 布局 ---------- */
  --w-app: 680px;
  --pad-x: 20px;
  --pad-y: 24px;
  --nav-h: 56px;
  /* 虚拟键盘高度（由 keyboard.js 实测写入，未弹键盘时为 0） */
  --kb-h: 0px;
}

/* ---------- 深色（墨黑 → 黛青） ----------
   不是简单反色：把「纸」换成墨，把「彩」提亮一档以维持可读性，
   并保留极少量暖色（赭石 / 暗朱）作为温度。 */
[data-theme="dark"] {
  color-scheme: dark;

  /* 深色也要有层次：墨黑底 → 黛青面 → 深青浮层，而不是一片死黑 */
  --paper:      #10141a;   /* 墨黑 */
  --paper-2:    #151b21;
  --surface:    #1a2328;   /* 黛青 · 卡片 */
  --surface-2:  #212c33;   /* 深青 · 输入 / 浮层 */
  --sunken:     #0c1013;
  --veil:       rgba(16, 20, 26, 0.9);

  --deep:       #25343b;   /* 抬升面板：比底色更亮，表达「实」 */
  --deep-2:     #1b262c;
  --deep-ink:   #eef1ef;
  --deep-ink-2: rgba(238, 241, 239, 0.68);
  --deep-ink-3: rgba(238, 241, 239, 0.38);
  --deep-line:  rgba(238, 241, 239, 0.18);

  --ink:        #e7e9e7;
  --ink-2:      #b1b7b6;
  --ink-3:      #8b9394;
  --ink-4:      #737c7e;
  --ink-inv:    #10141a;

  --line:       #2c383e;
  --line-soft:  #232e34;
  --line-2:     #3d4b52;

  --primary:      #8db0b2;
  --primary-deep: #a9c8c9;
  --primary-soft: #1c2b2e;
  --accent:       #c9a87c;
  --accent-soft:  #2a2418;
  --seal:         #c4826f;

  --ok: #7fa57a;   --ok-soft:   #1c281c;
  --warn: #c2a067;
  --err: #c4826f;  --err-soft:  #2c211d;

  --wx-mu:   #85a680;
  --wx-huo:  #c97a5e;
  --wx-tu:   #c2a067;
  --wx-jin:  #a5a396;
  --wx-shui: #7d9cbb;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.34);
  --sh-2: 0 2px 12px -3px rgba(0, 0, 0, 0.46);
  --sh-3: 0 14px 36px -12px rgba(0, 0, 0, 0.62);
  --sh-4: 0 28px 68px -22px rgba(0, 0, 0, 0.74);
}

/* 兼容别名：早期版本/用户浏览器缓存的旧脚本内联样式里用过这些旧 token 名。
   新代码一律直接使用上面的语义 token；此块仅为兜底，不要在此扩展新 token。 */
:root,
[data-theme="dark"] {
  --card: var(--surface);
  --ink-soft: var(--ink-2);
  --ink-faint: var(--ink-3);
  --gold: var(--accent);
  --gold-soft: var(--accent-soft);
  --radius: var(--r-md);
  --shadow: var(--sh-1);
}

/* ==========================================================================
   03 · 基础
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t) var(--e-out), color var(--t) var(--e-out);
}

/* 抽屉打开时锁住背景滚动 */
body.drawer-open { overflow: hidden; }

.hidden { display: none !important; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: none; }

a { color: inherit; text-decoration: none; }

/* 统一焦点样式：只在键盘操作时出现，克制的青色细环 */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--primary-soft); color: var(--primary-deep); }

/* 数字统一用等宽字形：命盘 / 大运 / 流年 / 统计表对齐更稳 */
.num,
.wx-count, .ln-year, .tl-year, .tl-score, .stat-v, .od-amt, .od-total,
.dayun-table td, .trend-ages, .pt-wx {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ==========================================================================
   04 · 背景（存在感极低，被感知但说不清哪里不同）
   不使用大面积水墨图；只用极淡的纸纹与两道几乎不可见的气。
   全部走 transform / opacity，避免逐帧重绘。
   ========================================================================== */
.ink-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* 极轻的纸张颗粒：两层错位细网格，几乎不可见 */
  background-image:
    repeating-linear-gradient(0deg, rgba(120, 116, 104, 0.016) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120, 116, 104, 0.016) 0 1px, transparent 1px 3px);
}

.ink-blob {
  position: absolute;
  border-radius: 50%;
  /* 原实现叠了 blur(60px) 的大面积滤镜：视觉收益低、绘制代价高，已移除。
     radial-gradient 本身就是柔和的，省下滤镜即省下每帧合成成本。 */
  background-repeat: no-repeat;
}

.ink-blob.b1 {
  width: 90vmax; height: 90vmax; top: -34vmax; left: -26vmax;
  background-image: radial-gradient(closest-side, rgba(60, 91, 97, 0.055), transparent 72%);
  animation: drift1 96s var(--e-inout) infinite alternate;
}
.ink-blob.b2 {
  width: 76vmax; height: 76vmax; bottom: -30vmax; right: -24vmax;
  background-image: radial-gradient(closest-side, rgba(142, 111, 75, 0.045), transparent 72%);
  animation: drift2 120s var(--e-inout) infinite alternate;
}
.ink-blob.b3 {
  width: 54vmax; height: 54vmax; top: 34%; left: 52%;
  background-image: radial-gradient(closest-side, rgba(34, 38, 42, 0.035), transparent 72%);
  animation: drift1 148s var(--e-inout) infinite alternate-reverse;
}
@keyframes drift1 { to { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); } }
@keyframes drift2 { to { transform: translate3d(-3.5vmax, -2.5vmax, 0) scale(1.06); } }

/* 云雾：一道极淡的斜向光。改用 transform 位移，不再是 background-position 动画 */
.mist {
  position: absolute;
  top: -20%;
  left: -60%;
  width: 220%;
  height: 140%;
  background: linear-gradient(
    104deg,
    transparent 34%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 66%
  );
  opacity: 0.16;
  animation: mistDrift 74s linear infinite;
  will-change: transform;
}
@keyframes mistDrift {
  from { transform: translate3d(-14%, 0, 0); }
  to   { transform: translate3d(14%, 0, 0); }
}
[data-theme="dark"] .mist { opacity: 0.07; }
[data-theme="dark"] .ink-bg {
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px);
}

/* 五行动态底色画布（wuxing-bg.js 注入，低分辨率放大，几乎不耗性能） */
#wuxing-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ==========================================================================
   05 · 骨架与视图切换
   ========================================================================== */
.app {
  width: 100%;
  max-width: var(--w-app);
  margin: 0 auto;
  padding: var(--pad-y) var(--pad-x) calc(var(--nav-h) + env(safe-area-inset-bottom) + 44px);
}

.view { display: none; }
.view.active { display: block; animation: viewIn var(--t-slow) var(--e-out) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to   { opacity: 1; transform: none; }
}

/* 内容渐进浮现：水墨晕染式的依次落定，幅度很小 */
.view.active.stagger > * {
  opacity: 0;
  animation: rise var(--t-slow) var(--e-out) forwards;
}
.view.active.stagger > *:nth-child(1) { animation-delay: 0.04s; }
.view.active.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.view.active.stagger > *:nth-child(3) { animation-delay: 0.16s; }
.view.active.stagger > *:nth-child(4) { animation-delay: 0.22s; }
.view.active.stagger > *:nth-child(5) { animation-delay: 0.28s; }
.view.active.stagger > *:nth-child(6) { animation-delay: 0.34s; }
.view.active.stagger > *:nth-child(7) { animation-delay: 0.40s; }
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 7px, 0); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   06 · 排版
   标题用衬线（书卷气），正文用现代无衬线（可读性）。
   层级靠字号 / 字距 / 墨色浓度建立，不靠粗体堆叠。
   ========================================================================== */
.page-head { margin: 0 2px var(--sp-5); }

.brand-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 34px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 400;
  letter-spacing: var(--ls-4);
  line-height: var(--lh-tight);
  color: var(--ink);
  /* 标题左侧一道极细的青黛，替代原来「加粗 + 金色」的表达 */
  padding-left: var(--sp-3);
  border-left: 2px solid var(--primary);
}
.page-title.small { font-size: var(--fs-xl); letter-spacing: var(--ls-3); }

.page-sub {
  color: var(--ink-3);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-2);
  margin-top: var(--sp-2);
}

/* 区块标签：一行小字 + 右侧一道渐隐的细线 */
.sec-label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-3);
  color: var(--ink-3);
  margin: var(--sp-5) 0 var(--sp-3);
}
.sec-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.hint { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 6px; line-height: var(--lh-snug); }

.foot-note {
  text-align: center;
  color: var(--ink-3);
  font-size: var(--fs-2xs);
  letter-spacing: var(--ls-2);
  line-height: var(--lh-loose);
  margin-top: var(--sp-7);
}

.disclaimer {
  margin-top: var(--sp-5);
  font-size: var(--fs-2xs);
  color: var(--ink-3);
  text-align: center;
  line-height: var(--lh-loose);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   07 · 组件
   ========================================================================== */

/* ---------- 7.1 卡片：细边界 + 极浅阴影，不要厚投影 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-5) var(--sp-4);
  margin-top: var(--sp-3);
  box-shadow: var(--sh-1);
}

/* ---------- 7.2 按钮 ----------
   三级层次：
     primary  主操作（青黛实底，全站唯一「实」的按钮色）
     ghost    次操作（细边界，悬停才显色）
     quiet    轻操作（纯文字，用于列表内的破坏性/次要动作）
   反馈克制：颜色微变 + 1px 位移，不做发光。 */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 13px var(--sp-4);
  margin-top: var(--sp-2);
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  letter-spacing: var(--ls-3);
  transition: background-color var(--t-fast) var(--e-out),
              transform var(--t-fast) var(--e-out),
              opacity var(--t-fast) var(--e-out);
}
.btn-primary:hover { background: var(--primary-deep); }
.btn-primary:active { transform: translate3d(0, 1px, 0); }
.btn-primary:disabled { opacity: 0.45; cursor: wait; transform: none; }
[data-theme="dark"] .btn-primary { color: var(--ink-inv); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin: var(--sp-4) auto 0;
  padding: 9px var(--sp-6);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-1);
  white-space: nowrap;
  transition: border-color var(--t-fast) var(--e-out),
              color var(--t-fast) var(--e-out),
              background-color var(--t-fast) var(--e-out);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-ghost:disabled { opacity: 0.5; cursor: default; }
.btn-ghost.small { padding: 7px 15px; font-size: var(--fs-xs); min-height: 34px; }
/* 块级用法（自观页退出登录等） */
.btn-ghost.block { display: flex; width: 100%; }
#zg-logout { width: 100%; margin-top: var(--sp-6); }
#save-chart-btn { width: 100%; margin-top: var(--sp-4); }

/* 表单内联按钮（提交按钮统一视觉） */
.afield ~ .abtn { min-height: 40px; }

/* ---------- 7.3 表单 ---------- */
.field { margin-bottom: var(--sp-4); }
.field label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  letter-spacing: var(--ls-1);
  margin-bottom: 7px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-md);
  color: var(--ink);
  outline: none;
  transition: border-color var(--t-fast) var(--e-out),
              box-shadow var(--t-fast) var(--e-out),
              background-color var(--t-fast) var(--e-out);
}
.field textarea {
  border-radius: var(--r-sm);
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
  resize: vertical;
  min-height: 72px;
}
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--line-2); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-4); }
/* 数字型输入去掉浏览器步进器的突兀感（保留可点，只是更细） */
.field input[type="number"] { -moz-appearance: textfield; }

.field-row { display: flex; gap: var(--sp-3); align-items: flex-start; }
.field-row .field { flex: 1; min-width: 0; }
.row3 { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: var(--sp-3); }

/* 性别：药丸单选 */
.gender-toggle { display: flex; gap: var(--sp-3); }
.gender-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-pill { display: inline-flex; }
.radio-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 42px;
  padding: 9px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--fs-base);
  color: var(--ink-2);
  background: var(--surface-2);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--e-out),
              border-color var(--t-fast) var(--e-out),
              color var(--t-fast) var(--e-out);
}
.radio-pill:hover span { border-color: var(--line-2); }
.radio-pill input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
[data-theme="dark"] .radio-pill input:checked + span { color: var(--ink-inv); }
.radio-pill input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* 复选框行 */
.check-line {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  margin-bottom: var(--sp-3);
  cursor: pointer;
  min-height: 32px;
}
.check-line input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- 7.4 分段切换器（公历｜农历｜八字 等） ---------- */
.zm-mode-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--sunken);
  border-radius: var(--r-sm);
  flex-wrap: nowrap;
}
.zm-mode-tab {
  border: none;
  background: none;
  min-height: 34px;
  padding: 8px 15px;
  border-radius: 7px;
  font-size: var(--fs-sm);
  color: var(--ink-3);
  letter-spacing: var(--ls-1);
  transition: background-color var(--t-fast) var(--e-out), color var(--t-fast) var(--e-out);
}
.zm-mode-tab:hover { color: var(--ink-2); }
.zm-mode-tab.active {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--sh-1);
}
.mode-field { flex: 0 0 auto; }
.mode-field .zm-mode-tabs { margin-top: 1px; }

/* 公历 / 农历 / 八字：任何宽度下都横向完整显示，不折行、不换行成两排 */
.zm-mode-tabs { flex-wrap: nowrap; }
.zm-mode-tab { white-space: nowrap; flex: 0 0 auto; }
/* .field-row .field{flex:1} 会连「排盘方式」一起压缩，导致「公历」折成两行 */
.field-row .mode-field { flex: 0 0 auto; }

/* ---------- 7.5 标签页（命盘内页签 / AI 页签 / 登录页签） ---------- */
.zm-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: var(--sp-4) 0 var(--sp-4);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.zm-tabs::-webkit-scrollbar { display: none; }
.zm-tab {
  flex: 1;
  min-width: 64px;
  padding: 10px 2px;
  background: none;
  border: none;
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  letter-spacing: var(--ls-2);
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--t-fast) var(--e-out), border-color var(--t) var(--e-out);
}
.zm-tab:hover { color: var(--ink-2); }
.zm-tab.active { color: var(--ink); border-bottom-color: var(--primary); }

.ai-quota-hint {
  margin-bottom: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--ink-3);
  text-align: center;
  letter-spacing: 0.02em;
  min-height: 1em;
}
.ai-quota-hint:empty { margin-bottom: 0; }
.ai-quota-hint.tight { color: var(--seal); }
.ai-tabs { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.ai-tab {
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: none;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  transition: background-color var(--t-fast) var(--e-out),
              border-color var(--t-fast) var(--e-out),
              color var(--t-fast) var(--e-out);
}
.ai-tab:hover { border-color: var(--line-2); }
.ai-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] .ai-tab.active { color: var(--ink-inv); }
.vip-badge {
  font-size: 9px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0 3px;
  margin-left: 3px;
  vertical-align: 1px;
  letter-spacing: 0;
}
.ai-tab.active .vip-badge { color: #fff; border-color: rgba(255, 255, 255, 0.55); }

.auth-tabs {
  display: flex;
  gap: var(--sp-1);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.auth-tab {
  flex: 1;
  padding: 11px 0;
  background: none;
  border: none;
  font-size: var(--fs-md);
  color: var(--ink-3);
  letter-spacing: var(--ls-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t-fast) var(--e-out), border-color var(--t) var(--e-out);
}
.auth-tab.active { color: var(--ink); border-bottom-color: var(--primary); }

/* ---------- 7.6 药丸标签 / 芯片 ---------- */
.chip {
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  background: var(--sunken);
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background-color var(--t-fast) var(--e-out),
              border-color var(--t-fast) var(--e-out),
              color var(--t-fast) var(--e-out);
}
.chip.accent { background: var(--primary); color: #fff; }
[data-theme="dark"] .chip.accent { color: var(--ink-inv); }
.chip.good { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--err-soft); color: var(--err); }
.cmp-mode-row .chip { cursor: pointer; opacity: 0.62; }
.cmp-mode-row .chip:hover { opacity: 1; }
.cmp-mode-row .chip.active {
  opacity: 1;
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-deep);
}

/* ---------- 7.7 子页返回栏 ---------- */
.sub-head { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-4); }
.zm-back {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-md);
  line-height: 1;
  box-shadow: var(--sh-1);
  transition: color var(--t-fast) var(--e-out),
              border-color var(--t-fast) var(--e-out),
              transform var(--t) var(--e-out);
}
.zm-back:hover { color: var(--ink); border-color: var(--primary); transform: translate3d(-2px, 0, 0); }
.sub-title {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  letter-spacing: var(--ls-3);
  color: var(--ink-2);
}

/* ---------- 7.8 顶栏账号区 ---------- */
.auth-area { display: flex; align-items: center; gap: var(--sp-3); padding-bottom: 4px; }
.auth-link {
  background: none;
  border: none;
  padding: 4px 2px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  border-bottom: 1px solid transparent;
  transition: color var(--t-fast) var(--e-out), border-color var(--t-fast) var(--e-out);
}
.auth-link:hover { color: var(--ink); border-bottom-color: var(--primary); }
.auth-user {
  font-size: var(--fs-sm);
  color: var(--ink);
  cursor: pointer;
  padding-bottom: 2px;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
  transition: border-color var(--t-fast) var(--e-out);
}
.auth-user:hover { border-bottom-color: var(--primary); }

/* ---------- 7.9 抽屉 / 弹窗 ----------
   统一为「遮罩淡入 + 面板轻上移」。移动端从底部升起，桌面端居中。 */
.drawer-wrap {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20, 19, 16, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: veilIn var(--t) var(--e-out) both;
}
@keyframes veilIn { from { opacity: 0; } to { opacity: 1; } }

.drawer-panel {
  width: 100%;
  max-width: var(--w-app);
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-2) var(--pad-x) calc(var(--sp-6) + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 48px -14px rgba(20, 19, 16, 0.34);
  animation: sheetUp var(--t) var(--e-soft) both;
}
@keyframes sheetUp {
  from { transform: translate3d(0, 34px, 0); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0 var(--sp-4);
  background: linear-gradient(var(--paper) 70%, transparent);
}
.drawer-title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  letter-spacing: var(--ls-2);
  color: var(--ink);
}
.drawer-close {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  font-size: 19px;
  line-height: 1;
  transition: color var(--t-fast) var(--e-out), background-color var(--t-fast) var(--e-out);
}
.drawer-close:hover { color: var(--ink); background: var(--sunken); }

/* ---------- 7.10 底部导航 ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  max-width: var(--w-app);
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  background: var(--veil);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  min-height: var(--nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 0 7px;
  color: var(--ink-4);
  font-family: var(--font-serif);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-2);
  transition: color var(--t) var(--e-out);
}
.nav-item svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t) var(--e-soft);
}
.nav-item svg .fill { fill: currentColor; stroke: none; }
.nav-item:hover { color: var(--ink-2); }
.nav-item.active { color: var(--primary); }
.nav-item.active svg { transform: translate3d(0, -1px, 0); }

/* ---------- 7.11 轻提示 ---------- */
#zm-tip {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 22px);
  z-index: 99;
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--deep);
  color: var(--deep-ink);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  text-align: center;
  box-shadow: var(--sh-3);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-50%, 8px, 0);
  transition: opacity var(--t) var(--e-out), transform var(--t) var(--e-out);
}
#zm-tip.show { opacity: 1; transform: translate3d(-50%, 0, 0); }

/* ---------- 7.12 主题切换（分段控件，明 / 暗 / 随系统） ---------- */
.theme-seg { display: flex; gap: 2px; padding: 3px; background: var(--sunken); border-radius: var(--r-sm); }
.theme-seg button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: var(--fs-sm);
  color: var(--ink-3);
  transition: background-color var(--t-fast) var(--e-out), color var(--t-fast) var(--e-out);
}
.theme-seg button:hover { color: var(--ink-2); }
.theme-seg button.active { background: var(--surface-2); color: var(--ink); box-shadow: var(--sh-1); }

/* ==========================================================================
   08 · 知命
   ========================================================================== */

/* ---------- 8.1 人物入口 ---------- */
.person-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  position: relative;
  z-index: 5;
}
.person-switch {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  letter-spacing: var(--ls-1);
  color: var(--ink);
  box-shadow: var(--sh-1);
  transition: border-color var(--t-fast) var(--e-out), background-color var(--t-fast) var(--e-out);
}
.person-switch:hover { border-color: var(--primary); background: var(--primary-soft); }
.person-switch::after { content: "▾"; margin-left: 7px; font-size: 10px; color: var(--ink-3); }

.person-menu {
  margin: 0 0 var(--sp-3);
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  animation: rise var(--t) var(--e-out) both;
}
.person-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  font-size: var(--fs-base);
  color: var(--ink);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--e-out);
}
.person-item:hover { background: var(--sunken); }
.person-item.active { background: var(--primary-soft); }
.person-item .dot { color: var(--primary); font-size: 9px; line-height: 1; }
.person-item .pname { font-weight: 500; }
.person-item .pmeta {
  margin-left: auto;
  font-size: var(--fs-2xs);
  color: var(--ink-4);
  letter-spacing: 0.04em;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdel {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  color: var(--ink-4);
  font-size: 15px;
  line-height: 1;
  transition: color var(--t-fast) var(--e-out), background-color var(--t-fast) var(--e-out);
}
.pdel:hover { color: var(--err); background: var(--err-soft); }
.person-empty { font-size: var(--fs-sm); color: var(--ink-4); text-align: center; padding: var(--sp-4); }
.person-menu-foot {
  width: 100%;
  min-height: 42px;
  margin-top: 5px;
  padding: 10px 6px 8px;
  border: none;
  border-top: 1px solid var(--line-soft);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  transition: color var(--t-fast) var(--e-out);
}
.person-menu-foot:hover { color: var(--primary); }

/* ---------- 8.2 知命首页：留白 + 一处「实」 ---------- */
.entry-poem { text-align: center; margin: var(--sp-6) 0 var(--sp-5); }
.ep-line {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  letter-spacing: var(--ls-3);
  color: var(--ink);
}
.ep-sub {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  letter-spacing: var(--ls-1);
  margin-top: var(--sp-3);
}

/* 起盘入口：全站唯一的深墨面板。大面积留白之上的「实」，
   与问道页那个发光的「问」字按钮互为阴阳。 */
.start-card {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 18px 20px;
  background: linear-gradient(150deg, var(--deep) 0%, var(--deep-2) 100%);
  border: 1px solid var(--deep-line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  text-align: left;
  overflow: hidden;
  transition: transform var(--t) var(--e-soft), box-shadow var(--t) var(--e-soft);
}
/* 一道极淡的光，从左上掠过。静态，不参与动画循环 */
.start-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 12% 0%, rgba(255, 255, 255, 0.09), transparent 62%);
}
.start-card:hover { transform: translate3d(0, -2px, 0); box-shadow: var(--sh-4); }
.start-card:active { transform: translate3d(0, 0, 0); }
.sc-seal {
  position: relative;
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--deep-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--deep-ink);
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
}
.sc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sc-title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  letter-spacing: var(--ls-3);
  color: var(--deep-ink);
}
.sc-sub { font-size: var(--fs-xs); color: var(--deep-ink-2); letter-spacing: 0.02em; }
.sc-arrow { flex: 0 0 auto; font-size: 20px; color: var(--deep-ink-3); line-height: 1; }

/* ---------- 8.3 观运 ---------- */
.fun-label { margin-top: var(--sp-6); }
.fun-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.fun-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px 13px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  cursor: pointer;
  text-align: left;
  transition: transform var(--t) var(--e-soft),
              border-color var(--t) var(--e-out),
              box-shadow var(--t) var(--e-soft);
}
.fun-card:hover { transform: translate3d(0, -2px, 0); border-color: var(--line-2); box-shadow: var(--sh-2); }
.fun-icon {
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  margin-bottom: 2px;
}
[data-theme="dark"] .fun-icon { color: var(--primary); }
.fun-name { font-size: var(--fs-base); font-weight: 500; color: var(--ink); letter-spacing: var(--ls-1); }
.fun-sub { font-size: var(--fs-2xs); color: var(--ink-4); }
.sys-more { font-size: var(--fs-2xs); color: var(--ink-4); }

/* ---------- 8.4 起盘表单 ---------- */
.entry-card { padding: var(--sp-5) var(--sp-4) var(--sp-5); }
.entry-row { align-items: flex-end; }
.gz-input-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.gz-input-row input {
  text-align: center;
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  letter-spacing: var(--ls-1);
}

.city-field { position: relative; }
.city-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 26px);
  z-index: 30;
  max-height: 244px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-3);
  animation: rise var(--t-fast) var(--e-out) both;
}
.city-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 40px;
  padding: 9px 14px;
  font-size: var(--fs-base);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--e-out);
}
.city-item:hover { background: var(--sunken); }
.city-lon { font-size: var(--fs-2xs); color: var(--ink-4); }
.city-none { padding: 12px 14px; font-size: var(--fs-sm); color: var(--ink-4); }

.guest-hint {
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: var(--sp-3);
  letter-spacing: 0.02em;
}

/* ---------- 8.5 命盘头 ---------- */
.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-2) 0 var(--sp-4);
}
.chart-title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  letter-spacing: var(--ls-2);
  color: var(--ink);
}
.chart-sub { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 5px; }
.save-hint { display: block; text-align: left; font-size: var(--fs-xs); color: var(--ink-3); margin: 6px 0 0; }
#zm-save-hint { display: block; }

/* 四柱速览 */
.pillars-top { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-5); }
.pt-pillar {
  padding: 13px 4px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  text-align: center;
  box-shadow: var(--sh-1);
}
.pt-pillar.day {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.pt-name { display: block; font-size: var(--fs-2xs); color: var(--ink-3); letter-spacing: var(--ls-2); }
.pt-gz {
  display: block;
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: var(--ls-1);
  line-height: 1.3;
  margin: 3px 0 2px;
}
.pt-wx { display: block; font-size: var(--fs-2xs); color: var(--ink-4); }

.pane { animation: rise var(--t-slow) var(--e-out) both; }

/* 命盘详表 */
.pillar-head-row,
.pillar-row {
  display: grid;
  grid-template-columns: 54px repeat(4, 1fr);
  gap: var(--sp-1);
  padding: 8px 0;
  text-align: center;
  border-bottom: 1px dashed var(--line);
}
.pillar-head-row { border-bottom: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); }
.pillar-head-row span:last-child { color: var(--primary); }
.pr-label { font-size: var(--fs-xs); color: var(--ink-3); text-align: left; line-height: 2.4; }
.pr-big { font-family: var(--font-serif); font-size: 19px; letter-spacing: 0.04em; line-height: 1.9; }
.pr-small { font-size: var(--fs-sm); color: var(--ink-2); line-height: 2.2; }

.cg-row { display: flex; align-items: center; gap: 7px; padding: 7px 0; flex-wrap: wrap; }
.cg-chip {
  padding: 4px 9px;
  background: var(--sunken);
  border-radius: var(--r-sm);
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
}
.cg-chip i { font-style: normal; font-size: var(--fs-2xs); color: var(--ink-4); margin-left: 5px; }
.mp-meta { margin-top: var(--sp-3); font-size: var(--fs-xs); color: var(--ink-3); line-height: var(--lh-loose); }
.cur-mark { color: var(--primary); font-size: var(--fs-xs); }

/* 大运 / 流年 */
.dayun-note { font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--sp-3); }
.dayun-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dayun-table { border-collapse: collapse; min-width: 100%; }
.dayun-table th,
.dayun-table td {
  padding: 9px 13px;
  font-size: var(--fs-sm);
  text-align: center;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.dayun-table th { color: var(--ink-4); font-weight: 400; }
.dayun-table td.gz { font-family: var(--font-serif); font-size: var(--fs-lg); letter-spacing: var(--ls-1); }
.dayun-table tr.current td { background: var(--primary-soft); }
.dayun-table tr.current td.gz { color: var(--primary-deep); }

.liunian-item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  padding: 11px 4px;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.liunian-item:last-child { border-bottom: none; }
.ln-year { font-size: var(--fs-base); font-weight: 500; width: 90px; }
.ln-gz { font-family: var(--font-serif); font-size: 18px; width: 54px; }
.ln-god { font-size: var(--fs-xs); color: var(--ink-3); width: 46px; }
.ln-rels { flex: 1; min-width: 160px; }
.ln-rel { font-size: var(--fs-xs); color: var(--primary); margin-right: var(--sp-2); }
.ln-none { font-size: var(--fs-xs); color: var(--ink-4); }

/* 命局 */
.mj-hero { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.mj-daymaster {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  letter-spacing: var(--ls-2);
  color: var(--ink);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 2px;
}
.mj-ge-name { font-family: var(--font-serif); font-size: 22px; letter-spacing: var(--ls-2); color: var(--ink); }
.mj-note { font-size: var(--fs-sm); color: var(--ink-2); line-height: var(--lh-loose); margin: var(--sp-2) 0; }
.mj-warn {
  font-size: var(--fs-xs);
  color: var(--err);
  background: var(--err-soft);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  margin: 7px 0;
  line-height: var(--lh-snug);
}

.kp-item { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px dashed var(--line); }
.kp-item:last-child { border-bottom: none; }
.kp-no {
  min-width: 30px;
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--primary);
  line-height: 1.2;
}
.kp-title { font-size: var(--fs-base); font-weight: 500; color: var(--ink); }
.kp-body { font-size: var(--fs-sm); color: var(--ink-2); line-height: var(--lh-loose); margin-top: 3px; }

/* 五行结构 */
.wx-row { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.wx-label { flex: 0 0 auto; width: 46px; font-size: var(--fs-base); text-align: right; }
.wx-bar-track { flex: 1; height: 18px; background: var(--sunken); border-radius: var(--r-pill); overflow: hidden; }
.wx-bar {
  height: 100%;
  border-radius: var(--r-pill);
  min-width: 4px;
  transition: width var(--t-slow) var(--e-soft);
}
.wx-count { flex: 0 0 auto; width: 44px; font-size: var(--fs-sm); color: var(--ink-3); }

.xiji-line { display: flex; gap: var(--sp-5); margin: var(--sp-2) 0 var(--sp-3); flex-wrap: wrap; }
.xiji-line > div { display: flex; align-items: center; gap: 7px; font-size: var(--fs-base); }
.xiji-k {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
}
.xiji-k.good { background: var(--ok-soft); color: var(--ok); }
.xiji-k.bad { background: var(--err-soft); color: var(--err); }

.why-box { margin-top: var(--sp-2); font-size: var(--fs-sm); }
.why-box summary {
  cursor: pointer;
  color: var(--primary);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  margin-bottom: 7px;
  list-style: none;
}
.why-box summary::-webkit-details-marker { display: none; }
.why-box summary::after { content: " ›"; transition: transform var(--t-fast) var(--e-out); }
.why-box[open] summary::after { content: " ⌄"; }
.why-box p {
  color: var(--ink-2);
  line-height: var(--lh-loose);
  padding: var(--sp-3) var(--sp-4);
  background: var(--sunken);
  border-radius: var(--r-sm);
}

/* 人生趋势 */
.trend-svg2 { width: 100%; height: 120px; margin: var(--sp-2) 0 2px; }
.trend-area2 { fill: var(--primary-soft); opacity: 0.85; }
.trend-line2 {
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trend-dot { fill: var(--primary); }
/* viewBox 被拉伸铺满宽度，所以让描边不随缩放变粗 */
.trend-line2, .trend-grid, .trend-area2 { vector-effect: non-scaling-stroke; }
.trend-grid { stroke: var(--line-2); stroke-width: 0.8; stroke-dasharray: 3 4; opacity: 0.7; }
.trend-grid-label { font-size: 9px; fill: var(--ink-3); text-anchor: middle; }
.trend-ages { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--ink-3); }
.trend-note { font-size: var(--fs-xs); color: var(--ink-3); margin: var(--sp-2) 0 var(--sp-1); line-height: var(--lh-loose); }

.td-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
.td-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-1);
}
.td-chip b { font-family: var(--font-serif); font-size: var(--fs-md); letter-spacing: var(--ls-1); }
.td-chip span { font-size: var(--fs-2xs); color: var(--ink-4); }
.td-chip i { font-style: normal; font-size: var(--fs-xs); color: var(--ink-2); line-height: var(--lh-snug); }
.td-chip.hi { border-color: rgba(91, 122, 87, 0.4); background: var(--ok-soft); }
.td-chip.lo { border-color: rgba(162, 83, 70, 0.32); background: var(--err-soft); }

.tl-list { display: flex; flex-direction: column; gap: 2px; }
.tl-row { display: flex; align-items: center; gap: var(--sp-3); padding: 5px 0; }
.tl-year { min-width: 44px; font-size: var(--fs-xs); color: var(--ink-3); }
.tl-gz { min-width: 40px; font-family: var(--font-serif); font-size: var(--fs-base); letter-spacing: 1px; }
.tl-bar-track { flex: 1; height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.tl-bar { height: 100%; background: var(--ink-4); border-radius: 3px; }
.tl-bar.hi { background: var(--wx-mu); }
.tl-bar.lo { background: var(--wx-huo); }
.tl-score { min-width: 24px; text-align: right; font-size: var(--fs-xs); color: var(--ink-4); }

/* AI 解读 */
.ai-pane { animation: rise var(--t) var(--e-out) both; }
.annual-bar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.annual-bar label { font-size: var(--fs-sm); color: var(--ink-2); }
.annual-bar input {
  width: 104px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-base);
  outline: none;
}
.annual-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.ai-thinking { display: flex; align-items: center; gap: 5px; padding: var(--sp-4) 0; color: var(--ink-4); font-size: var(--fs-sm); }
.ai-thinking span {
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--primary);
  animation: breathe 1.6s var(--e-inout) infinite;
}
.ai-thinking span:nth-child(2) { animation-delay: 0.22s; }
.ai-thinking span:nth-child(3) { animation-delay: 0.44s; }
@keyframes breathe { 0%, 100% { opacity: 0.22; } 50% { opacity: 1; } }
.ai-thinking-inline { font-size: var(--fs-xs); color: var(--ink-4); margin-bottom: 6px; }

.ai-sec-title {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  color: var(--primary);
  letter-spacing: var(--ls-1);
  margin: var(--sp-4) 0 6px;
}
.ai-sec-title:first-child { margin-top: 0; }
.ai-sec-body { font-size: var(--fs-base); line-height: var(--lh-loose); color: var(--ink); }
.ai-error { background: var(--err-soft); color: var(--err); border-radius: var(--r-sm); padding: 11px 14px; font-size: var(--fs-sm); }

/* 光标 */
.cursor {
  display: inline-block;
  width: 6px; height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--primary);
  animation: blink 0.9s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ==========================================================================
   09 · 问道
   ========================================================================== */
.wendao-intro { text-align: center; margin: var(--sp-7) 0 var(--sp-4); }
.intro-line {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  letter-spacing: var(--ls-3);
  color: var(--ink);
}
.intro-sub {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: var(--sp-3);
  line-height: var(--lh-loose);
  letter-spacing: var(--ls-1);
}

/* 「问」：一枚会呼吸的圆。与知命页的深墨面板互为阴阳——
   这里是「虚」：纸面上的一圈墨气。 */
.wd-entrance { text-align: center; margin: var(--sp-8) 0 var(--sp-5); }
.wd-new-btn {
  position: relative;
  width: 108px; height: 108px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: radial-gradient(circle at 36% 30%, var(--surface-2) 0%, var(--surface) 56%, var(--paper-2) 100%);
  box-shadow: var(--sh-2), inset 0 0 22px rgba(120, 108, 82, 0.06);
  animation: wdBreath var(--t-breath) var(--e-inout) infinite;
  transition: transform var(--t-slow) var(--e-soft);
}
@keyframes wdBreath {
  0%, 100% { box-shadow: var(--sh-2), inset 0 0 20px rgba(120, 108, 82, 0.05); }
  50%      { box-shadow: var(--sh-3), inset 0 0 26px rgba(120, 108, 82, 0.11); }
}
.wd-new-btn:hover { transform: scale(1.035); }
.wd-new-btn:active { transform: scale(0.975); }
.wd-ring {
  position: absolute;
  inset: -10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  pointer-events: none;
  animation: wdRipple var(--t-breath) var(--e-out) infinite;
}
.wd-ring.r2 { animation-delay: 3.2s; }
@keyframes wdRipple {
  0%   { transform: scale(0.965); opacity: 0.5; }
  55%  { opacity: 0.1; }
  100% { transform: scale(1.2); opacity: 0; }
}
.wd-core {
  position: relative;
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 40px;
  line-height: 108px;
  letter-spacing: 0;
  color: var(--ink);
  text-shadow: 0 0 12px rgba(34, 38, 42, 0.1);
  user-select: none;
}
.wd-new-btn.wd-inked::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  pointer-events: none;
  background: radial-gradient(circle, rgba(34, 38, 42, 0.13) 0%, transparent 68%);
  animation: wdInk 1s var(--e-out) forwards;
}
@keyframes wdInk {
  from { transform: scale(0.6); opacity: 0.9; }
  to   { transform: scale(2.1); opacity: 0; }
}
.wd-caption {
  margin-top: var(--sp-4);
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  letter-spacing: var(--ls-4);
  color: var(--ink);
}
.wd-caption-sub { margin-top: 7px; font-size: var(--fs-2xs); color: var(--ink-3); letter-spacing: var(--ls-1); }

/* 历史问道 */
.wd-history-sec { margin-top: var(--sp-7); }
.wd-h-group { font-size: var(--fs-2xs); color: var(--ink-4); letter-spacing: var(--ls-2); margin: var(--sp-4) 2px var(--sp-2); }
.wd-h-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 46px;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color var(--t-fast) var(--e-out);
}
.wd-h-item:hover { background: var(--sunken); }
.wd-h-item:last-child { border-bottom: none; }
.wd-h-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  color: var(--ink);
  line-height: var(--lh-snug);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wd-h-time { flex: 0 0 auto; font-size: var(--fs-2xs); color: var(--ink-4); }
.wd-h-del {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  color: var(--ink-4);
  font-size: var(--fs-md);
  line-height: 1;
  transition: color var(--t-fast) var(--e-out), background-color var(--t-fast) var(--e-out);
}
.wd-h-del:hover { color: var(--err); background: var(--err-soft); }
.wd-h-empty { text-align: center; font-size: var(--fs-sm); color: var(--ink-4); padding: var(--sp-5) 0 var(--sp-2); letter-spacing: var(--ls-1); line-height: var(--lh-loose); }
.wd-h-login { text-align: center; padding: var(--sp-4) 0 var(--sp-2); }
.wd-h-login p { font-size: var(--fs-sm); color: var(--ink-2); line-height: var(--lh-loose); margin-bottom: var(--sp-4); }

/* 或从一问开始 */
.q-list { margin-top: var(--sp-6); }
.q-hint { font-size: var(--fs-2xs); color: var(--ink-3); letter-spacing: var(--ls-3); margin-bottom: var(--sp-3); text-align: center; }
.q-chip {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-bottom: var(--sp-2);
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  text-align: left;
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
  color: var(--ink-2);
  transition: transform var(--t) var(--e-soft),
              border-color var(--t) var(--e-out),
              color var(--t) var(--e-out);
}
.q-chip:hover { transform: translate3d(0, -2px, 0); border-color: var(--line-2); color: var(--ink); }

/* 对话页 */
.wd-chat-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-1) 2px var(--sp-3);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-4);
}
.wd-back {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-lg);
  line-height: 1;
  transition: color var(--t-fast) var(--e-out), background-color var(--t-fast) var(--e-out);
}
.wd-back:hover { color: var(--ink); background: var(--sunken); }
.wd-chat-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wd-head-ink {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  box-shadow: var(--sh-1);
}
[data-theme="dark"] .wd-head-ink { color: var(--ink-inv); }

.wd-chart-chip {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  letter-spacing: 0.02em;
  margin: 0 2px var(--sp-3);
  padding: 7px 11px;
  background: var(--primary-soft);
  border-radius: var(--r-sm);
}

/* 消息流 */
.chat-log { display: flex; flex-direction: column; gap: var(--sp-5); margin: 0 0 var(--sp-4); }
.wd-bubble { max-width: 100%; animation: rise var(--t) var(--e-out) both; }
.wd-bubble.user {
  align-self: flex-end;
  max-width: 86%;
  padding: 11px 16px;
  background: var(--deep);
  color: var(--deep-ink);
  border-radius: 16px 16px 4px 16px;
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  box-shadow: var(--sh-2);
}
.wd-bubble.ai {
  align-self: stretch;
  max-width: 100%;
  padding: 2px 6px 2px 15px;
  border-left: 1px solid var(--line-2);
  font-size: var(--fs-base);
}
.wd-bubble.ai p { margin: 0; line-height: var(--lh-loose); color: var(--ink); }
.wd-bubble.ai p + p { margin-top: 0.85em; }

/* 思量中 */
.wd-thinking { display: flex; align-items: center; gap: 5px; padding: 8px 6px 8px 15px; }
.wd-dot {
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--ink-4);
  animation: wdThink 2.1s var(--e-inout) infinite;
}
.wd-dot:nth-child(2) { animation-delay: 0.36s; }
.wd-dot:nth-child(3) { animation-delay: 0.72s; }
@keyframes wdThink {
  0%, 100% { opacity: 0.2; transform: translate3d(0, 0, 0); }
  50%      { opacity: 0.8; transform: translate3d(0, -2px, 0); }
}
.wd-think-text {
  margin-left: 7px;
  font-size: var(--fs-xs);
  color: var(--ink-4);
  letter-spacing: var(--ls-2);
  animation: wdThinkText 3.6s var(--e-inout) infinite;
}
@keyframes wdThinkText { 0%, 100% { opacity: 0.62; } 50% { opacity: 1; } }

/* 失败与重试 */
.wd-error-bubble {
  border-left-color: var(--seal);
  background: var(--err-soft);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}
.wd-err-text { font-size: var(--fs-sm); color: var(--err); line-height: var(--lh-base); margin: 0 0 var(--sp-3); }
.wd-retry {
  padding: 6px 17px;
  border: 1px solid rgba(162, 83, 70, 0.36);
  border-radius: var(--r-sm);
  background: none;
  color: var(--err);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-1);
  transition: background-color var(--t-fast) var(--e-out);
}
.wd-retry:hover { background: rgba(162, 83, 70, 0.09); }

/* 输入区：吸底 + 移动端安全区 */
.wd-input-area {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 6px);
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-3) 0 var(--sp-2);
  margin-top: var(--sp-1);
  background: linear-gradient(to top, var(--paper) 76%, transparent);
}
.wd-input-area textarea {
  flex: 1;
  min-height: 46px;
  max-height: 128px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--fs-md);
  line-height: var(--lh-snug);
  box-shadow: var(--sh-1);
  resize: none;
  outline: none;
  transition: border-color var(--t) var(--e-out), box-shadow var(--t) var(--e-out);
}
.wd-input-area textarea::placeholder { color: var(--ink-4); }
.wd-input-area textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.wd-input-area button {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  box-shadow: var(--sh-2);
  transition: background-color var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-out);
}
[data-theme="dark"] .wd-input-area button { color: var(--ink-inv); }
.wd-input-area button:disabled { opacity: 0.34; cursor: default; }
.wd-input-area button:not(:disabled):hover { background: var(--primary-deep); }
.wd-input-area button:not(:disabled):active { transform: scale(0.95); }
.chat-note {
  text-align: center;
  font-size: var(--fs-2xs);
  color: var(--ink-3);
  margin: var(--sp-2) 0 var(--sp-1);
  letter-spacing: 0.04em;
}

/* ==========================================================================
   10 · 养运
   ========================================================================== */
.yangyun-intro {
  text-align: center;
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  color: var(--ink-2);
  letter-spacing: var(--ls-2);
  line-height: var(--lh-loose);
  margin: var(--sp-5) 0 var(--sp-7);
}

/* 五行五圆：用色彩本身的性格表达流通，不加纹样 */
.wx-circle-row { display: flex; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-7); }
.wx-circle {
  flex: 1;
  aspect-ratio: 1;
  max-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-1);
  transition: transform var(--t-slow) var(--e-soft), border-color var(--t) var(--e-out);
}
.wx-circle:hover { transform: translate3d(0, -4px, 0); border-color: var(--line-2); }
.wx-circle span { font-family: var(--font-serif); font-size: var(--fs-lg); line-height: 1.2; }
.wx-circle i { font-style: normal; font-size: 9px; color: var(--ink-4); letter-spacing: 0.04em; }
.wx-circle.c-mu span   { color: var(--wx-mu); }
.wx-circle.c-huo span  { color: var(--wx-huo); }
.wx-circle.c-tu span   { color: var(--wx-tu); }
.wx-circle.c-jin span  { color: var(--wx-jin); }
.wx-circle.c-shui span { color: var(--wx-shui); }

/* 雅物（视觉占位） */
.item-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.item-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-1);
  transition: transform var(--t) var(--e-soft), box-shadow var(--t) var(--e-soft);
}
.item-card:hover { transform: translate3d(0, -2px, 0); box-shadow: var(--sh-2); }
.item-visual {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 6px;
  font-family: var(--font-serif);
  font-size: 30px;
  letter-spacing: var(--ls-3);
}
.iv-1 { background: linear-gradient(158deg, #e9ede6, #dde4d8); color: var(--wx-mu); }
.iv-2 { background: linear-gradient(158deg, #ebe7db, #ded6c4); color: var(--accent); }
.iv-3 { background: linear-gradient(158deg, #f0eade, #e5dcc8); color: var(--wx-tu); }
.iv-4 { background: linear-gradient(158deg, #e5eaee, #d6dee4); color: var(--wx-shui); }
[data-theme="dark"] .iv-1 { background: linear-gradient(158deg, #1e2a22, #233026); }
[data-theme="dark"] .iv-2 { background: linear-gradient(158deg, #262219, #2c271c); }
[data-theme="dark"] .iv-3 { background: linear-gradient(158deg, #292519, #302b1d); }
[data-theme="dark"] .iv-4 { background: linear-gradient(158deg, #1b242c, #1f2a33); }
.item-name { padding: var(--sp-3) var(--sp-4) 0; font-family: var(--font-serif); font-size: var(--fs-md); letter-spacing: var(--ls-2); }
.item-desc { padding: 3px var(--sp-4) var(--sp-4); font-size: var(--fs-2xs); color: var(--ink-4); line-height: var(--lh-snug); }

/* ==========================================================================
   11 · 同道
   ========================================================================== */
.topic {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px 17px;
  margin-bottom: var(--sp-2);
  box-shadow: var(--sh-1);
  transition: transform var(--t) var(--e-soft), border-color var(--t) var(--e-out);
}
.topic:hover { transform: translate3d(0, -2px, 0); border-color: var(--line-2); }
.topic-t { font-size: var(--fs-base); line-height: var(--lh-snug); color: var(--ink); }
.topic-m { font-size: var(--fs-2xs); color: var(--ink-4); margin-top: 6px; letter-spacing: 0.04em; }

.share-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--primary);
  border-radius: var(--r-md);
  padding: 17px 18px;
  box-shadow: var(--sh-1);
}
.share-text { font-size: var(--fs-sm); line-height: var(--lh-loose); color: var(--ink-2); }
.share-m { font-size: var(--fs-2xs); color: var(--ink-4); margin-top: var(--sp-2); }

/* ==========================================================================
   12 · 自观
   ========================================================================== */
.self-quote {
  text-align: center;
  margin: var(--sp-6) 0 var(--sp-6);
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  letter-spacing: var(--ls-3);
  line-height: var(--lh-loose);
  color: var(--ink);
}
.self-quote p + p { margin-top: 4px; }
.zg-contact { font-size: var(--fs-xs); color: var(--ink-4); margin-top: var(--sp-3); letter-spacing: 0.02em; }

.self-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.self-card {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  cursor: pointer;
  transition: transform var(--t) var(--e-soft),
              border-color var(--t) var(--e-out),
              box-shadow var(--t) var(--e-soft);
}
.self-card:hover { transform: translate3d(0, -1px, 0); border-color: var(--line-2); box-shadow: var(--sh-2); }
.self-k {
  flex: 0 0 auto;
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  letter-spacing: var(--ls-1);
  color: var(--ink);
}
.self-v { font-size: var(--fs-xs); color: var(--ink-3); min-width: 0; }
.self-card[data-go], .self-card.record { justify-content: space-between; }

.self-card.record { display: block; position: relative; cursor: pointer; }
.record-main { display: flex; flex-direction: column; gap: 3px; padding-right: 30px; }
.record-main .self-v.gz { color: var(--ink); letter-spacing: var(--ls-1); font-size: var(--fs-sm); }
.record-del {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translate3d(0, -50%, 0);
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  color: var(--ink-4);
  font-size: 17px;
  line-height: 1;
  transition: color var(--t-fast) var(--e-out), background-color var(--t-fast) var(--e-out);
}
.record-del:hover { color: var(--err); background: var(--err-soft); }
.zg-empty { font-size: var(--fs-sm); color: var(--ink-4); text-align: center; padding: var(--sp-5) 0; }

/* 设置子页 · 只读信息行 */
.info-card .info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 6px 0;
}
.info-k { flex: 0 0 auto; font-size: var(--fs-sm); color: var(--ink-3); letter-spacing: 0.04em; }
.info-v { font-size: var(--fs-base); color: var(--ink); text-align: right; word-break: break-all; }

/* --------------------------------------------------------------------------
   自观 · 个人中心（会员 / 积分 / 邀请 / 命盘与解读）
   全部使用语义 token，暗色主题自动跟随；不新增颜色字面量。
   -------------------------------------------------------------------------- */

/* ---------- 首页速览三格 ---------- */
.me-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  margin: var(--sp-5) 0 var(--sp-4);
}
.me-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: var(--sp-4) var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform var(--t-fast) var(--e-out),
              border-color var(--t-fast) var(--e-out),
              box-shadow var(--t-fast) var(--e-out);
}
.me-stat.is-static { cursor: default; }
.me-stat:not(.is-static):hover {
  transform: translate3d(0, -1px, 0);
  border-color: var(--line-2);
  box-shadow: var(--sh-2);
}
.me-stat-v {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: var(--ls-1);
}
.me-stat-k { font-size: var(--fs-2xs); color: var(--ink-4); letter-spacing: var(--ls-2); }

/* ---------- 积分中心 · 余额面板 ---------- */
.me-balance {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  margin-bottom: var(--sp-5);
}
.me-bal-v {
  font-family: var(--font-serif);
  font-size: var(--fs-3xl);
  line-height: 1;
  color: var(--ink);
  letter-spacing: var(--ls-2);
}
.me-bal-k { font-size: var(--fs-xs); color: var(--ink-4); letter-spacing: var(--ls-2); }
.me-bal-sub {
  display: flex;
  gap: var(--sp-5);
  margin: var(--sp-3) 0 var(--sp-5);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}
.me-bal-sub b { color: var(--ink-2); font-weight: 400; }
.me-balance .btn-primary { margin-top: 2px; }
.me-balance .hint { text-align: center; margin-top: var(--sp-3); }
#zg-checkin-btn.is-done {
  background: none;
  color: var(--ink-3);
  border: 1px solid var(--line);
  letter-spacing: var(--ls-1);
}

/* ---------- 通用「键 — 值」行（规则 / 价格 / 额度 / 权益） ---------- */
.me-rows { padding: var(--sp-2) var(--sp-4); }
.me-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.me-row:last-child { border-bottom: none; }
.me-row.is-block { display: block; }
.me-row-k {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--fs-base);
  color: var(--ink-2);
}
.me-row-v { flex: 0 0 auto; font-size: var(--fs-sm); color: var(--ink); letter-spacing: var(--ls-1); }
.me-row-sub { font-size: var(--fs-2xs); color: var(--ink-4); letter-spacing: var(--ls-1); }
.me-row-sub-plain { font-size: var(--fs-xs); color: var(--ink-3); line-height: var(--lh-snug); }

/* ---------- 积分明细 ---------- */
.me-tx-item { display: flex; align-items: center; gap: var(--sp-3); }
.me-tx-item .record-main { flex: 1; min-width: 0; padding-right: 0; }
.me-tx-amt {
  flex: 0 0 auto;
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  letter-spacing: var(--ls-1);
  color: var(--ink-3);
}
.me-tx-amt.is-in { color: var(--primary); }

/* ---------- 邀请好友 ---------- */
.me-invite { padding: var(--sp-5); margin-bottom: var(--sp-4); }
.me-invite-label { font-size: var(--fs-xs); color: var(--ink-4); letter-spacing: var(--ls-2); }
.me-code {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  letter-spacing: var(--ls-3);
  color: var(--ink);
  margin: var(--sp-3) 0 var(--sp-4);
}
.me-link-row { display: flex; gap: var(--sp-2); align-items: center; }
.me-link {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-family: var(--font-sans);
}
.me-link-row .btn-ghost { flex: 0 0 auto; }
.me-chip {
  flex: 0 0 auto;
  align-self: center;
  font-size: var(--fs-2xs);
  letter-spacing: var(--ls-1);
  color: var(--ink-3);
  background: var(--sunken);
  border-radius: var(--r-xs);
  padding: 4px 9px;
}
.me-chip.is-ok { color: var(--ok); background: var(--ok-soft); }

/* ---------- 会员中心 ---------- */
.me-vip-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: var(--sp-6) var(--sp-5);
  margin-bottom: var(--sp-5);
  background: var(--deep);
  border-color: var(--deep-line);
}
.me-vip-tier {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  letter-spacing: var(--ls-3);
  color: var(--deep-ink);
}
.me-vip-desc { font-size: var(--fs-xs); color: var(--deep-ink-2); line-height: var(--lh-snug); }
.me-plan { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.me-plan .record-main { padding-right: 0; flex: 1; min-width: 0; }

/* ---------- 我的命盘与解读 ---------- */
.me-chart { display: block; }
.me-chart .record-main { padding-right: 0; }
.me-chart-ops { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.me-chart-ops .btn-ghost { flex: 0 0 auto; }
.btn-ghost.is-danger { color: var(--err); border-color: var(--err-soft); }
.btn-ghost.is-danger:hover { color: var(--err); border-color: var(--err); background: var(--err-soft); }
.me-read { display: flex; align-items: center; gap: var(--sp-3); }
.me-read .record-main { flex: 1; min-width: 0; padding-right: 0; }
.me-chev { flex: 0 0 auto; color: var(--ink-4); font-size: var(--fs-lg); line-height: 1; }

/* ---------- 解读阅读态 ---------- */
.me-reader-meta { font-size: var(--fs-xs); color: var(--ink-4); margin: 0 0 var(--sp-3); letter-spacing: var(--ls-1); }
.me-reader {
  padding: var(--sp-5);
  font-size: var(--fs-base);
  line-height: var(--lh-loose);
  color: var(--ink-2);
  word-break: break-word;
}
.me-reader p { margin: 0 0 var(--sp-4); }
.me-reader p:last-child { margin-bottom: 0; }
.me-reader b { color: var(--ink); font-weight: 500; }
.me-reader code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: var(--sunken);
  border-radius: var(--r-xs);
  padding: 1px 5px;
}
.me-reader .md-h {
  font-family: var(--font-serif);
  color: var(--ink);
  letter-spacing: var(--ls-2);
  margin: var(--sp-5) 0 var(--sp-3);
}
.me-reader .md-h:first-child { margin-top: 0; }
.me-reader .md-h.lv1 { font-size: var(--fs-lg); }
.me-reader .md-h.lv2 { font-size: var(--fs-md); }
.me-reader .md-h.lv3,
.me-reader .md-h.lv4,
.me-reader .md-h.lv5,
.me-reader .md-h.lv6 { font-size: var(--fs-base); }
.me-reader .md-li { padding-left: 1.15em; text-indent: -1.15em; }
.me-reader .md-li::before { content: "· "; color: var(--accent); }
#zg-reader-del { margin-top: var(--sp-5); }

/* ==========================================================================
   13 · 入内（登录 / 注册）
   ========================================================================== */
.auth-card { padding-bottom: var(--sp-5); }
.auth-alt { text-align: center; font-size: var(--fs-sm); color: var(--ink-2); margin-top: var(--sp-5); }
.auth-alt a { color: var(--primary); border-bottom: 1px solid var(--primary-soft); }
.auth-alt a:hover { border-bottom-color: var(--primary); }
.auth-msg {
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  padding: 11px 14px;
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-4);
}
.auth-msg.err { background: var(--err-soft); color: var(--err); border: 1px solid rgba(162, 83, 70, 0.22); }
.auth-msg.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(91, 122, 87, 0.22); }
#resend-verify { font-size: var(--fs-sm); background: none; border: none; padding: 0; color: var(--primary); }

.auth-gate { text-align: center; padding: var(--sp-3) 0 var(--sp-5); }
.auth-gate-text { font-size: var(--fs-sm); color: var(--ink-2); line-height: var(--lh-loose); margin-bottom: var(--sp-5); }

/* ==========================================================================
   14 · 抽屉内容：运势 / 合盘 / 随卦
   ========================================================================== */

/* 运势 */
.daily-date {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  letter-spacing: var(--ls-2);
  color: var(--ink);
  margin-bottom: var(--sp-3);
}
.daily-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
.daily-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.daily-cell.wide { grid-column: span 2; }
.daily-cell .k { font-size: var(--fs-2xs); color: var(--ink-4); letter-spacing: var(--ls-2); }
.daily-cell .k.good { font-family: var(--font-serif); font-size: var(--fs-md); color: var(--ok); letter-spacing: var(--ls-1); }
.daily-cell .k.bad { font-family: var(--font-serif); font-size: var(--fs-md); color: var(--err); letter-spacing: var(--ls-1); }
.daily-cell .v { font-size: var(--fs-sm); color: var(--ink); line-height: var(--lh-snug); }
.daily-note { font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--sp-4); line-height: var(--lh-loose); }

/* 合盘 */
.cmp-mode-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.cmp-hint { font-size: var(--fs-sm); color: var(--ink-4); text-align: center; padding: var(--sp-4) 0; line-height: var(--lh-loose); }
.cmp-title { font-family: var(--font-serif); font-size: var(--fs-md); letter-spacing: var(--ls-1); color: var(--ink); margin-bottom: var(--sp-3); }

/* 随卦 —— 呈现层级与「一卦」小程序结果页一致：
   卦名 → 六爻卦象 → 上/下卦与动爻 → 基础卦义 → 分节解读。
   卦象是主角，四周留最大的白；解读靠分卡压缩，不靠拉长页面。 */
.hexa-idle { text-align: center; padding: var(--sp-6) 0; }
.hexa-poem {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  letter-spacing: var(--ls-3);
  color: var(--ink-2);
  margin-bottom: var(--sp-5);
}

/* 起卦过程：六爻自下而上渐次落定（只动 opacity / transform） */
.hexa-casting { text-align: center; padding: var(--sp-4) 0; }
.hexa-lines { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: var(--sp-4); }
.hexa-line {
  width: 132px;
  height: 9px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--ink-2), transparent);
  opacity: 0;
  animation: lineIn 1.1s var(--e-out) forwards;
}
@keyframes lineIn {
  0%   { opacity: 0; transform: scaleX(0.3); }
  100% { opacity: 1; transform: scaleX(1); }
}

/* 卦名 + 卦象名 */
.hexa-head { text-align: center; padding-top: var(--sp-3); }
.hexa-name {
  font-family: var(--font-serif);
  font-size: var(--fs-3xl);
  line-height: 1.3;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--ink);
}
.hexa-xiang {
  margin-top: var(--sp-2);
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--ink-3);
}

/* 六爻卦画：阳爻一整条、阴爻中间断开；动爻标暗朱（整页唯一暖色）。
   线粗 9px : 行距 10px ≈ 10:9，接近传统卦画 —— 这组配比是试出来的，别随意回退。 */
.hexa-gua { margin: var(--sp-6) auto 0; }
.yao {
  display: grid;
  grid-template-columns: 26px 150px 26px;
  align-items: center;
  justify-content: center;
  height: 15px;
  margin-bottom: 10px;
  animation: rise var(--t) var(--e-out) both;
}
.yao:last-child { margin-bottom: 0; }
/* 自下而上依次浮现：DOM 第一行是上爻，所以延迟反过来给 */
.yao:nth-child(1) { animation-delay: 0.45s; }
.yao:nth-child(2) { animation-delay: 0.36s; }
.yao:nth-child(3) { animation-delay: 0.27s; }
.yao:nth-child(4) { animation-delay: 0.18s; }
.yao:nth-child(5) { animation-delay: 0.09s; }
.yao:nth-child(6) { animation-delay: 0s; }
.yao-bar { display: flex; justify-content: space-between; width: 150px; height: 9px; }
.bar { height: 100%; border-radius: 2px; background: var(--ink); display: block; }
.bar.full { width: 100%; }
.bar.half { width: 43%; }
.bar.is-moving { background: var(--seal); }
.yao-name {
  font-family: var(--font-serif);
  font-size: 11px;
  line-height: 1;
  text-align: right;
  color: var(--ink-3);
}
.yao-name.is-moving { color: var(--seal); }
.yao-flag {
  font-family: var(--font-serif);
  font-size: 11px;
  line-height: 1;
  text-align: left;
  color: var(--seal);
}

/* 上卦 / 下卦 / 动爻 */
.hexa-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: var(--sp-6);
}
.meta-item { display: flex; flex-direction: column; align-items: center; padding: 0 var(--sp-4); }
.meta-k { font-size: var(--fs-2xs); letter-spacing: var(--ls-2); text-indent: var(--ls-2); color: var(--ink-3); }
.meta-v { margin-top: var(--sp-1); font-family: var(--font-serif); font-size: var(--fs-lg); letter-spacing: 0.06em; color: var(--ink); }
.meta-sep { width: 1px; height: var(--sp-6); background: var(--line); }

/* 基础卦义：全部来自程序数据，不依赖 AI，所以每次起卦都稳定 */
.hexa-base {
  margin-top: var(--sp-6);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}
.base-row { display: flex; align-items: baseline; }
.base-name {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  line-height: 1.3;
  letter-spacing: 0.14em;
  color: var(--ink);
}
.base-mean {
  margin-left: var(--sp-3);
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  color: var(--accent);
}
.base-bian {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-soft);
}
.bian-arrow { margin-right: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-3); }
.bian-label { margin-right: var(--sp-2); font-size: var(--fs-2xs); letter-spacing: var(--ls-2); color: var(--ink-3); }
.bian-label.stable { margin-right: 0; letter-spacing: var(--ls-1); }
.bian-name { font-family: var(--font-serif); font-size: var(--fs-lg); letter-spacing: 0.1em; color: var(--ink-2); }
.bian-xiang { margin-left: var(--sp-2); font-size: var(--fs-xs); color: var(--ink-3); }

/* 分节线：一个「解」字作分隔，是「卦」到「解」的过渡 */
.hexa-rule { display: flex; align-items: center; margin: var(--sp-7) 0 var(--sp-5); }
.rule-line { flex: 1; height: 1px; background: var(--line); }
.rule-text {
  margin: 0 var(--sp-4);
  font-family: var(--font-serif);
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--ink-3);
}

/* 一句话卦意：紧贴卦象，字略大，是「卦」到「解」的第一句 */
.hexa-brief {
  padding: 0 2px;
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  line-height: 1.9;
  letter-spacing: 0.03em;
  color: var(--ink);
}

/* 用户问过的问题：原样复述，让解读有明确的落点 */
.hexa-qcard {
  margin-top: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.q-k { display: block; font-size: var(--fs-2xs); letter-spacing: var(--ls-2); color: var(--ink-3); }
.q-v {
  display: block;
  margin-top: var(--sp-1);
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  line-height: 1.7;
  color: var(--ink);
}

/* 解读各节：各自成卡，避免变成一大块密密麻麻的文字 */
.hexa-sec {
  margin-top: var(--sp-3);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  animation: rise var(--t) var(--e-out) both;
}
.sec-head { display: flex; align-items: center; margin-bottom: var(--sp-3); }
.sec-dot { width: 5px; height: 5px; margin-right: var(--sp-2); border-radius: 50%; background: var(--primary); }
.sec-title { font-family: var(--font-serif); font-size: var(--fs-md); letter-spacing: var(--ls-2); color: var(--ink); }
.sec-body {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  line-height: 1.95;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}

/* ==========================================================================
   15 · 商城（雅物）
   ========================================================================== */
.shop-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.shop-chip { padding: 5px 13px; }
.shop-empty { text-align: center; font-size: var(--fs-sm); color: var(--ink-4); padding: var(--sp-6) 0 var(--sp-2); letter-spacing: var(--ls-1); }
.shop-card { cursor: pointer; }
.shop-visual {
  height: 120px;
  margin: var(--sp-2) var(--sp-2) 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--sunken);
  display: flex;
  align-items: center;
  justify-content: center;
}
.shop-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-placeholder { font-family: var(--font-serif); font-size: 30px; color: var(--accent); opacity: 0.7; }
.shop-placeholder.sd-big { height: 190px; font-size: 50px; border-radius: var(--r-sm); }
.shop-price { padding: var(--sp-2) var(--sp-4) var(--sp-4); font-size: var(--fs-md); font-weight: 500; color: var(--ink); letter-spacing: 0.01em; }

.sd-gallery { display: flex; gap: var(--sp-2); overflow-x: auto; margin-bottom: var(--sp-4); -webkit-overflow-scrolling: touch; }
.sd-gallery img { height: 150px; border-radius: var(--r-sm); object-fit: cover; flex: 0 0 auto; cursor: pointer; }
.sd-gallery img.sd-thumb { height: 190px; outline: 1.5px solid var(--primary); outline-offset: -1.5px; }
.sd-name { font-family: var(--font-serif); font-size: var(--fs-lg); margin: 2px 0 5px; }
.sd-sub { font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--sp-2); }
.sd-price { font-size: 20px; font-weight: 500; color: var(--ink); margin-bottom: var(--sp-4); }
.sd-cat {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs);
  font-weight: 400;
  color: var(--ink-3);
  vertical-align: 2px;
}
.sd-qty { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); font-size: var(--fs-sm); color: var(--ink-2); }
.qty-btn {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-md);
  transition: border-color var(--t-fast) var(--e-out), color var(--t-fast) var(--e-out);
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
#qty-val { min-width: 22px; text-align: center; font-size: var(--fs-md); color: var(--ink); }
.sd-detail {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
  color: var(--ink-2);
  word-break: break-word;
}
.sd-login-hint { font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--sp-3); }

.sd-confirm, .sd-success { padding: var(--sp-1) 0; }
.sd-line { display: flex; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-2); }
.sd-total { margin: var(--sp-3) 0 var(--sp-4); font-size: var(--fs-md); font-weight: 500; color: var(--ink); }
.sd-confirm .btn-ghost { margin-top: var(--sp-2); margin-left: 10px; }
.sd-success { text-align: center; padding: var(--sp-3) 0; }
.sd-success-mark {
  width: 46px; height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 20px;
}
.sd-success-t { font-family: var(--font-serif); font-size: var(--fs-md); margin-bottom: 4px; }
.sd-success-no { font-size: var(--fs-xs); color: var(--ink-4); letter-spacing: 0.04em; margin-bottom: var(--sp-2); }
.sd-success .btn-ghost { margin-top: var(--sp-3); }

/* 我的订单 */
.orders-loading, .orders-empty { text-align: center; font-size: var(--fs-sm); color: var(--ink-4); padding: var(--sp-7) 0; letter-spacing: var(--ls-1); }
.od-card {
  padding: 13px 15px;
  margin-bottom: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}
.od-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.od-no { font-size: var(--fs-xs); color: var(--ink-4); letter-spacing: 0.02em; }
.od-status { padding: 2px 10px; border-radius: var(--r-pill); background: var(--sunken); color: var(--ink-2); font-size: var(--fs-2xs); }
.st-pending_pay { color: var(--warn); }
.st-paid, .st-completed { color: var(--ok); }
.st-cancelled, .st-closed { color: var(--ink-4); }
.st-after_sale { color: var(--err); }
.od-item { display: flex; align-items: center; gap: var(--sp-3); padding: 6px 0; border-top: 1px dashed var(--line); font-size: var(--fs-sm); }
.od-img { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; flex: 0 0 auto; }
.od-ph { display: inline-flex; align-items: center; justify-content: center; background: var(--sunken); color: var(--accent); font-family: var(--font-serif); }
.od-name { flex: 1; color: var(--ink); min-width: 0; }
.od-amt { color: var(--ink-2); }
.od-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--line); }
.od-total { font-size: var(--fs-sm); font-weight: 500; color: var(--ink); }
.od-actions { display: flex; gap: var(--sp-2); }
.od-as-box { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--line); }

/* ==========================================================================
   16 · 动效降级与性能
   尊重 prefers-reduced-motion：关闭装饰性动画，只保留必要的状态切换。
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ink-blob, .mist, .wd-ring, .wd-new-btn { animation: none !important; }
  .hexa-line { animation: none !important; opacity: 1; transform: none; filter: none; }
  /* 六爻与解读分卡都以 rise 渐入且带延迟，降级时必须重置延迟，
     否则 fill-mode: both 会让元素在延迟期间停留在 opacity: 0（看起来是丢了） */
  .yao, .hexa-sec { animation: none !important; opacity: 1; transform: none; }
  .view.active, .view.active.stagger > *, .pane, .ai-pane, .drawer-panel, .person-menu, .city-list {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ==========================================================================
   17 · 响应式
   手机端不是把 PC 缩小，而是重新排布信息层级。
   ========================================================================== */
@media (min-width: 640px) {
  :root { --pad-x: 26px; --pad-y: 34px; }
  .page-title { font-size: var(--fs-3xl); }
  .pt-gz { font-size: 30px; }
  .trend-svg2 { height: 132px; }
  .item-visual { height: 108px; }
  .drawer-wrap { align-items: center; padding: var(--sp-4); }
  .drawer-panel {
    border-radius: var(--r-lg);
    max-height: 82vh;
    padding: var(--sp-3) var(--sp-5) var(--sp-5);
    box-shadow: var(--sh-4);
    animation: modalIn var(--t) var(--e-soft) both;
  }
  @keyframes modalIn {
    from { transform: translate3d(0, 12px, 0) scale(0.985); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }
  .td-grid { grid-template-columns: repeat(3, 1fr); }
  .item-grid { grid-template-columns: repeat(4, 1fr); }
}

/* 大屏：不把手机版直接放大，而是给内容更舒展的行宽与纵向节奏。
   宽度只加到 760px——这是一款「阅读 + 单体操作」型产品，
   行宽再大反而破坏东方留白的紧凑感。 */
@media (min-width: 1024px) {
  :root { --w-app: 760px; --pad-x: 34px; --pad-y: 46px; }
  .pt-gz { font-size: 32px; }
  .trend-svg2 { height: 145px; }
  .wx-circle-row { justify-content: space-around; }
  .wx-circle { max-width: 68px; }
}

/* 触屏设备：输入框不小于 16px，避免 iOS 聚焦时整页缩放 */
@media (max-width: 639px) {
  .field input,
  .field select,
  .field textarea,
  .wd-input-area textarea,
  .annual-bar input { font-size: 16px; }
  .field input[type="date"],
  .field input[type="time"] { min-height: 46px; }

  /* 弹窗三层关系：页面 → 遮罩 → 面板，遮罩加深以保证面板可读 */
  .drawer-wrap {
    background: rgba(20, 19, 16, 0.62);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .drawer-panel {
    max-height: 90vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: 0 -12px 44px rgba(20, 19, 16, 0.36);
  }
}

@media (max-width: 420px) {
  :root { --pad-x: 16px; }
  .entry-row { flex-wrap: wrap; row-gap: var(--sp-4); }
  .field-row .mode-field { flex: 1 1 100%; }
  .mode-field .zm-mode-tabs { display: flex; width: 100%; }
  .mode-field .zm-mode-tab { flex: 1; text-align: center; padding: 9px 4px; min-height: 38px; }
  .radio-pill span { padding: 9px 18px; min-width: 56px; }
  .fun-grid { grid-template-columns: repeat(2, 1fr); }
  .pillars-top { gap: 6px; }
  .pt-gz { font-size: 23px; }
  .wx-circle i { display: none; }
  .person-item .pmeta { max-width: 34%; }
}


/* 横向溢出兜底：任何情况下不出现整页左右滚动 */
html, body { overflow-x: hidden; }
img, svg, canvas { max-width: 100%; }
.sd-gallery, .dayun-scroll, .zm-tabs { max-width: 100%; }

/* ==========================================================================
   18 · 可访问性
   ========================================================================== */
@media (prefers-contrast: more) {
  :root { --ink-3: #5f666d; --ink-4: #7c828a; --line: #d3cfc4; }
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 打印：只留内容 */
@media print {
  .ink-bg, .bottom-nav, #wuxing-canvas, .person-bar, #zm-tip, .drawer-wrap { display: none !important; }
  body { background: #fff; }
  .app { max-width: none; padding: 0; }
  .view { display: block !important; }
}

/* ============================================================
   8. 移动端虚拟键盘（小米浏览器 / Chrome / Safari 兼容）
   ------------------------------------------------------------
   不同安卓浏览器在软键盘弹出时对布局视口的处理并不一致：有的会压缩
   布局视口，把 position:fixed; bottom:0 的底部导航顶到页面中间；
   有的只平移视觉视口，让吸底元素被键盘盖住。

   这里的做法是「键盘出现就收起底部导航」——用户在填写信息时本就不
   需要五栏主导航，同时也绕开了各家浏览器对 fixed bottom 的差异处理。
   keyboard.js 只负责测量并把结果写成 .kb-open 与 --kb-h，
   具体表现全部收敛在这一段 CSS 里，不散落在各页面。
   ============================================================ */

/* 键盘弹出时隐藏底部主导航（避免被顶到页面中间） */
html.kb-open .bottom-nav { display: none; }

/* 吸底元素改为让位给键盘：浏览器没压缩布局视口时用 --kb-h 顶上去 */
html.kb-open #zm-tip {
  bottom: calc(var(--kb-h) + env(safe-area-inset-bottom) + 22px);
}
html.kb-open .wd-input-area {
  bottom: calc(var(--kb-h) + env(safe-area-inset-bottom) + 6px);
}

/* 键盘占位：保证最后一个输入框也能滚到键盘上方 */
html.kb-open .app {
  padding-bottom: calc(var(--nav-h) + var(--kb-h) + env(safe-area-inset-bottom) + 44px);
}

/* 抽屉里的输入同样需要这份底部余量 */
html.kb-open .drawer-panel {
  padding-bottom: calc(var(--kb-h) + env(safe-area-inset-bottom));
}

/* dvh 让页面高度跟随「动态视口」（地址栏伸缩时更自然）。
   不支持的浏览器继续用 vh，行为与改动前一致。 */
@supports (min-height: 100dvh) {
  body { min-height: 100dvh; }
}

/* ============================================================
   9. 自观 · 我的命盘与解读
   ============================================================ */
.me-mine-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  color: var(--accent);
  vertical-align: middle;
}
.me-mine-ops {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.me-mine-ops .btn-ghost { flex: 1; }
