/* ============================================================================
   八字盘面设计令牌（手写段）
   ----------------------------------------------------------------------------
   把 mingyu 参考项目的令牌名绑定到玄机主题变量：
     - 亮/暗跟随 html[data-theme]
     - 强调色沿用玄机 --accent（金），保持与其余模块同一套观感
   本文件被 tools/extract-mingyu-bazi-css.mjs 原样前置到 bazi-board.css 顶部。
   ========================================================================== */

#screen-pan .mg-bazi-root {
  color-scheme: light;

  /* 文字 */
  --text-primary: var(--text);
  --text-strong: var(--text);
  --text-base: var(--text);
  --text-main: var(--text);
  --text-secondary: var(--muted);
  --text-muted: var(--muted);
  --text-soft: var(--muted);
  --danger-text: var(--danger);
  --success-text: var(--jade);
  --state-warning-text: var(--accent-2);

  /* 强调色 */
  --accent: var(--accent);
  --accent-strong: var(--accent);
  --accent-deep: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-soft-strong: color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-surface: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --accent-surface-solid: color-mix(in srgb, var(--accent) 13%, var(--surface));
  --secondary: var(--jade);
  --secondary-strong: var(--jade);
  --secondary-soft: color-mix(in srgb, var(--jade) 16%, transparent);
  --secondary-soft-strong: color-mix(in srgb, var(--jade) 24%, transparent);
  --highlight-soft: color-mix(in srgb, var(--accent) 13%, transparent);

  /* 表面 */
  --surface-page: var(--bg);
  --surface-page-end: var(--bg);
  --surface-base: var(--surface);
  --surface-base-rgb: 255 253 248;
  --surface-bg: var(--surface);
  --surface-panel: var(--surface);
  --surface-elevated: var(--surface-2);
  --surface-elevated-strong: var(--surface-2);
  --surface-soft: var(--surface-2);
  --surface-soft-solid: var(--surface-2);
  --surface-subtle: var(--surface-2);
  --surface-muted: var(--surface-3);
  --surface-muted-solid: var(--surface-3);
  --surface-overlay: var(--surface-2);

  /* 边框 */
  --border-soft: var(--line);
  --border-strong: var(--line);
  --border-color: var(--line);
  --border-contrast: color-mix(in srgb, var(--accent) 38%, transparent);

  /* 交互态 */
  --state-idle-surface: color-mix(in srgb, var(--surface-3) 46%, var(--surface));
  --state-hover-surface: color-mix(in srgb, var(--muted) 8%, var(--surface));
  --state-selected-surface: color-mix(in srgb, var(--accent) 15%, var(--surface));
  --state-selected-surface-strong: color-mix(in srgb, var(--accent) 24%, var(--surface));
  --state-selected-text: var(--accent);

  /* 阴影 / 圆角 / 滚动条 */
  --shadow-lg: var(--shadow);
  --shadow-md: var(--shadow);
  --shadow-card: var(--shadow);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.22);
  --backdrop-scrim: color-mix(in srgb, var(--bg) 76%, transparent);
  --radius-page-card: var(--radius);
  --radius-control: 10px;
  --radius-compact: 8px;
  --radius-pill: 999px;
  --workspace-scrollbar-thumb: color-mix(in srgb, var(--muted) 30%, var(--surface));
  --workspace-scrollbar-thumb-hover: color-mix(in srgb, var(--muted) 46%, var(--surface));

  /* 盘面基础 */
  box-sizing: border-box;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

#screen-pan .mg-bazi-root *,
#screen-pan .mg-bazi-root *::before,
#screen-pan .mg-bazi-root *::after {
  box-sizing: border-box;
}

/* 玄机全局给 button 了一套底色/内边距，盘面按钮一律由 bazi-board.css 自行接管 */
#screen-pan .mg-bazi-root button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

#screen-pan .mg-bazi-root h2,
#screen-pan .mg-bazi-root h3,
#screen-pan .mg-bazi-root p,
#screen-pan .mg-bazi-root ul,
#screen-pan .mg-bazi-root li {
  margin: 0;
}

#screen-pan .mg-bazi-root ul {
  padding: 0;
  list-style: none;
}

#screen-pan .mg-bazi-root details > summary {
  cursor: pointer;
  list-style: none;
}

#screen-pan .mg-bazi-root details > summary::-webkit-details-marker {
  display: none;
}

/* 结果页顶部的玄机 console 与盘面卡片之间留出呼吸位 */
#screen-pan .mg-bazi-root {
  padding-bottom: 96px;
}

/* 暖色（暗色主题）修正：把以白色为基底的半透明表面压回玄机的深色面板 */
html[data-theme='dark'] #screen-pan .mg-bazi-root {
  color-scheme: dark;
  --surface-base-rgb: 25 25 23;
}

/* 亮色主题下令牌里的“白”要跟着玄机的暖白走 */
html[data-theme='light'] #screen-pan .mg-bazi-root {
  color-scheme: light;
}

/* ============================================================================
   ▍玄机本地覆盖层（八字结果页子页 QIMEN-SUBPAGE-020，2026-10-01）
   ----------------------------------------------------------------------------
   为什么写在这里而不是 bazi-board.css：那个文件由 tools/extract-mingyu-bazi-css.mjs
   生成，手改会在下次重新抽取上游样式时丢掉。本文件是手写段，所以下面每条规则都靠
   **更高特异性**取胜 —— 不依赖加载顺序（tokens.css 在 bazi-board.css 之前）。
   ========================================================================== */

/* ① 四柱盘表头主标对齐
   bazi-board.css 把 .is-head 做成 flex column + justify-content:center：带副标的列
   （大运/流年/流月/流日/流时）两行内容居中 → 主标偏上；不带副标的柱列（年柱/月柱/
   日柱/时柱）单行居中 → 主标偏下。同一行里两种主标错开半行，看着就是「不齐」。
   改成顶部对齐后，10 列主标落在同一条水平线上。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-pillars-cell.is-head {
  justify-content: flex-start;
}

/* ② 结果页两个子页（基础 / 高级）
   2026-10-02：两个页签合并成一个切换按钮（文案＝当前页），所以这里从 repeat(2) 改成单列。
   按钮始终代表「当前所在页」，故恒带 .is-active 的高亮外观（由 applySubpage 回填文案）。 */
#screen-pan .mg-bazi-root .bazi-subpage-tabs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

#screen-pan .mg-bazi-root .bazi-subpage-tab {
  min-height: 36px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

#screen-pan .mg-bazi-root .bazi-subpage-tab.is-active {
  border-color: var(--accent-deep);
  background: var(--state-selected-surface);
  color: var(--state-selected-text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* 非活动页整页下线。本仓没有全局 [hidden] 兜底规则，所以一律靠 class 控制显示，
   不用 hidden 属性，免得又要点名补一条 `.bazi-subpage[hidden]{display:none}`。 */
#screen-pan .mg-bazi-root .bazi-subpage {
  display: none;
}

#screen-pan .mg-bazi-root .bazi-subpage.is-active {
  display: grid;
  gap: 12px;              /* 与 .bazi-showcase-card 的 gap 一致，换页不改节奏 */
  align-content: start;
  animation: bazi-subpage-in 0.22s ease both;
}

@keyframes bazi-subpage-in {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

/* ③ 页签与盘面都是「结果页头部之下的一层」，在窄屏给页签留出足够的点按高度。 */
@media (max-width: 560px) {
  #screen-pan .mg-bazi-root .bazi-subpage-tab {
    min-height: 38px;
    font-size: 13.5px;
  }
}

/* ④ 日柱列不再高亮（用户 2026-10-01：「排盘结果页不要高亮日柱那一列，丑」）
   bazi-board.css 给 .is-day-master 留了两层底色：
     ① #screen-pan .mg-bazi-root .bazi-pillars-cell.is-day-master{background:var(--accent-soft)}             （1 id + 3 class）
     ② #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-cell.is-day-master{background:var(--chart-accent-soft)}（1 id + 4 class）
   ② 特异性更高，盘面上真正生效的是它。
   ⚠️ 实测这条在**亮色主题下解析失败**：--chart-accent-soft 链条是
        --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent)
        --chart-accent-soft: color-mix(in srgb, var(--accent-soft) 58%, var(--surface-base))
      而 --accent 在本作用域里写的是 `--accent: var(--accent)`（自引用 → guaranteed-invalid），
      于是整条链失效，background 退成 transparent，露出 .bazi-pillars-table 的 --chart-border 灰底
      —— 这正是用户看到的「日柱那一整列（含表头）是灰的」。
   这里用再多带一层 .bazi-pillars-table 的更高特异性（1 id + 5 class）把**整列**（表头格、行标签
   以外的所有日柱格）压回普通格底色。规则不排除 .is-head，所以表头格一并覆盖，不用再写第二条
   —— 实测 --surface-soft 与 --surface-elevated 在本仓是同一个变量（都指向 --surface-2），
   写两条第二条是死代码。
   只改底色，**不删 .is-day-master 这个 class** —— 术语释义、日主标记仍靠它定位。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-pillars-cell.is-day-master {
  background: var(--surface-elevated);
}

/* ⑤ 结果页两个小按钮（「分享排盘」/「今」）：不再吃浏览器 UA 默认外观
   改前实测（artifacts/bazi-btn-probe/before-*.png）：两个按钮都渲染成
     border: 2px outset #fff ｜ background: rgb(107,107,107) ｜ font-size: 13px ｜ border-radius: 0
   —— 盘面上就是两块突兀的灰砖。成因是两条样式链都断了：
     · .fortune-today-button 在 bazi-board.css 里只有一条规则，形如
       `#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-fortune-board .fortune-today-button`，
       而 DOM 里**没有 .bazi-fortune-board 这个类**（只有 .fortune-selector-card / .fortune-selector-head），
       所以那条 24×24 的方形样式整条是死代码；
     · .bazi-share-chart-btn 在全部样式表里 0 命中，连死代码都没有。
   用户 2026-10-01：「非常丑，颜色对齐背景框，框子对齐字体高度，框子里面的字变小」。
   做法：底色透明（与所在卡片背景同色，不再是一块灰）+ 1px 极淡描边，高度紧贴文字，
   字号 13px → 10px。不写死像素宽高，尺寸一律由 font-size / line-height / padding 决定。
   放在手写段（本文件）而不是生成物 bazi-board.css，靠特异性取胜，重抽上游样式不会丢。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage .bazi-pillars-header .bazi-share-chart-btn,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage .fortune-selector-card .fortune-selector-head .fortune-today-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 1px 5px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.02em;
  cursor: pointer;
}

/* 「分享排盘」紧跟在「四柱盘」标题后面，原来 0 间距贴成一坨，加一点点呼吸位。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage .bazi-pillars-header .bazi-share-chart-btn {
  margin-left: 8px;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage .bazi-pillars-header .bazi-share-chart-btn:hover,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage .bazi-pillars-header .bazi-share-chart-btn:focus-visible,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage .fortune-selector-card .fortune-selector-head .fortune-today-button:hover,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage .fortune-selector-card .fortune-selector-head .fortune-today-button:focus-visible {
  outline: none;
  border-color: var(--border-strong);
  background: var(--surface-soft);
  color: var(--text-secondary);
}

/* ============================================================================
   ▍玄机本地覆盖层（八字结果页 BAZI-RESULT-POLISH-025，2026-10-02）
   ----------------------------------------------------------------------------
   用户一次点了五条，本条只落 CSS 部分（DOM/事件部分见 algorithms/bazi/bazi-board.js）：
     ①顶部两个页签合并成一个「基础/高级」切换按钮（CSS 见 ② 段）
     ②顶部时间条改奇门口径（纯 JS，见 src/ui/app.js 的 baziTimeContext）
     ③头部只留「姓名 + 性别」，字号缩小，删掉整排 chips（CSS 见 ⑦ 段）
     ④旺衰/命格/五行取用/五行所忌 四卡排成一行、单行显示，删掉「取用依据」信息卡改气泡（CSS 见 ⑥ 段）
     ⑤四柱盘「信息」列改竖排居中（CSS 见 ⑧ 段）
   仍然全部写在这个手写段：bazi-board.css 是 tools/extract-mingyu-bazi-css.mjs 的生成物，
   手改会在下次抽取时丢掉。每条都靠**更高特异性**取胜（本文件前置在 bazi-board.css 之前），
   必要时才加 !important —— 上游 ≤768px 那一大块媒体查询本身就带 !important。
   ========================================================================== */

/* ⑥ 四张摘要卡：一行四格 + 单行「小标题 短值」
   上游把 .result-summary-grid-bazi 做成 repeat(4)，但 ≤720px / ≤640px / ≤520px / ≤768px
   四层媒体查询又逐层压回 repeat(2)。要真正锁死一行四格，特异性必须高过
   `#screen-pan .mg-bazi-root .result-summary-grid-bazi`（≤768px 那条还带 !important），
   所以这里多带一层 .bazi-showcase-card + 一个专用钩子类 .bazi-stat-row（1 id + 4 class）。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .result-summary-grid-bazi.bazi-stat-row {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* 卡片本身：从 display:grid（三行）改成一行 flex。字号与内边距同样按最高特异性压回，
   不然 ≤420px 的 `.bazi-showcase-card .result-stat-card{padding:8px 8px}` 与 ≤768px 的
   `padding:6px 8px !important` 会把一行四格挤到换行。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .result-summary-grid-bazi.bazi-stat-row .result-stat-card {
  display: flex !important;
  flex-wrap: nowrap;
  align-items: baseline;
  justify-content: center;
  gap: 3px !important;
  min-width: 0;
  min-height: 30px !important;
  padding: 8px 3px !important;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .result-summary-grid-bazi.bazi-stat-row .result-stat-card span {
  flex: 0 0 auto;
  font-size: 10.5px !important;
  line-height: 1.15;
  white-space: nowrap;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .result-summary-grid-bazi.bazi-stat-row .result-stat-card strong {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 12.5px !important;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ⑦ 头部只留「姓名 + 性别」：姓名从 26/24/20px 一路缩到 17px，性别做成紧随其后的淡描边胶囊。
   上游 `.traditional-chart-layout .result-showcase-head h2`(24px) 与
   ≤720px 的 `.result-showcase-head h2`(20px) 都比本规则少一层 class，故不必再加 !important。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .result-showcase-head h2.bazi-name-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-strong);
}

#screen-pan .mg-bazi-root .bazi-showcase-card .result-showcase-head h2.bazi-name-head .bazi-name-gender {
  flex: 0 0 auto;
  padding: 1px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

/* ⑧ 四柱盘「信息」行标签列改竖排、居中
   上游给 .bazi-pillars-cell.is-label 的是 `justify-content:flex-start; padding-left:9px`
   （≤720px 变 5px、≤420px 变 4px），文字靠左贴着格线。用户 2026-10-02：「信息列改为竖排
   文字。居中」⇒ 竖向书写 + 两个方向都居中，并清掉为横排留的左内边距。
   注意：本规则同时命中角上的 `信息` 表头格（它也是 .is-label），这正是要的。
   ⚠️ 列宽不用改：上游 ≤420px 已经把标签列收到 minmax(26px, 34px)，竖排后刚好。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-pillars-cell.is-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  justify-content: center;
  align-items: center;
  padding: 6px 2px;
  line-height: 1.15;
  letter-spacing: 0.04em;
  font-weight: 700;
}

/* ⑨ 摘要卡气泡里的「术语释义」入口
   气泡本体复用 app.css 的 .shensha-bubble（position:fixed + 全局主题变量），
   这里只补按钮样式；气泡挂在 #screen-pan 上（.mg-bazi-root 之外），故不能用 mg-bazi 作用域变量。 */
#screen-pan .bazi-tip-bubble .bazi-tip-term {
  justify-self: start;
  margin-top: 3px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.4;
  cursor: pointer;
}

#screen-pan .bazi-tip-bubble .bazi-tip-term:hover,
#screen-pan .bazi-tip-bubble .bazi-tip-term:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ⑩ 起运 / 交运两行（2026-10-02 新增，对齐问真「专业细盘」盘下方那两行）
   背景：引擎 result.luckInfo.startInfo / handoverInfo 从 v1 就在（形如
   「出生后 5 年 4 月 14 天 15 小时 16 分 起运（按实际节气时刻计算，三日折一年）」与
   「首运于公历 2006年9月4日 19:36（北京时间 UTC+8）交脱大运…」），
   但整个 src/ 从没有一处读过这两个字段 ⇒ 属于「引擎给了、界面没用」，这里补渲染。
   位置：四柱盘卡片内部、表格正下方（问真也是紧贴盘下方 y1865/y1911）。
   这两行是**新元素**、不是覆盖上游规则，故不必抬特异性，也不必 !important。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-summary {
  display: grid;
  gap: 2px;
  margin: 8px 0 0;
  padding: 7px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-base);
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-base);
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-row em {
  flex: 0 0 auto;
  font-style: normal;
  font-weight: 700;
  color: var(--accent);
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-row span {
  min-width: 0;
}

/* ⑪ 四柱盘表头行（流年 / 大运 / 年柱 / 月柱 …）字体变淡
   2026-10-02 用户口径：「流年大运年柱月柱那一行，字体变淡」。
   上游给 `.is-head` 与 `.is-label` 的都是 `color: var(--text-strong)` + `font-weight:700`，
   表头比数据还抢眼。这里只压**表头行**（.is-head），行名列（.is-label）里的
   「信息 / 天干 / 地支 …」保持原强度；角上那个「信息」格同时带两个类，会一起被压淡，这正是要的。
   ⚠️ 特异性：上游是 1 id + 4 class，本规则同为 4 class 时靠顺序会输（tokens.css 在前、
   bazi-board.css 在后），所以多带一层 `.bazi-pillars-table` 抬到 5 class。
   · YIRUI-001（2026-10-11）：补字号 11px（易瑞表头 13px）、字重 600 → 500
     （用户「字体不要那么粗」）。🔴 表头行的颜色/字重**只有这一条**是真源，
     下面 YIRUI 段的 ④ 刻意不重复写 —— 免得反证 `head-not-faded` 打空。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-pillars-cell.is-head {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-pillars-cell.is-head > small {
  color: var(--text-muted);
}

/* ⑫ 术语弹层「补字段」三段（2026-10-02 · BAZI-TERM-EXTRA-001）
   内容来自 src/shared/bazi-term-extra.js —— 只补引擎没有、参考件问真有的三样：
   十神「取象」、十神「功能」、神煞「查法」。
   ⚠️ 弹层宿主是 `#screen-pan > .mg-bazi-term-layer`，**不是** .bazi-showcase-card 的后代，
      所以选择器不能沿用盘面那套前缀（写了就不命中）。
   ⚠️ 这三段都是**新元素**，不是覆盖上游规则，故不必抬特异性、也不必 !important。 */
#screen-pan .mg-bazi-term-layer .term-xiang-box {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

#screen-pan .mg-bazi-term-layer .term-xiang-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#screen-pan .mg-bazi-term-layer .term-xiang-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
}

#screen-pan .mg-bazi-term-layer .term-xiang-row em {
  flex: 0 0 auto;
  padding: 0 5px;
  border-radius: 4px;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

#screen-pan .mg-bazi-term-layer .term-xiang-row.is-like em {
  background: color-mix(in srgb, var(--jade) 18%, transparent);
  color: var(--jade);
}

#screen-pan .mg-bazi-term-layer .term-xiang-row.is-dislike em {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
}

#screen-pan .mg-bazi-term-layer .term-functions-section,
#screen-pan .mg-bazi-term-layer .term-chafa-section {
  margin: 12px 0 0;
}

#screen-pan .mg-bazi-term-layer .term-function-item {
  margin: 6px 0 0;
  padding-left: 9px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, var(--line));
}

#screen-pan .mg-bazi-term-layer .term-function-name {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
}

#screen-pan .mg-bazi-term-layer .term-function-text {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
}

#screen-pan .mg-bazi-term-layer .term-chafa-main {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}

#screen-pan .mg-bazi-term-layer .term-chafa-verse {
  margin: 6px 0 0;
  padding: 6px 9px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

#screen-pan .mg-bazi-term-layer .term-chafa-table {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* ⑬ 术语弹层：窄屏也要「居中弹窗卡」，不要底部滑出（2026-10-02 用户口径）
   「我需要点击后弹开弹窗卡这种，不是从下面划出来。并且有返回机制。」
   真凶：参考项目 workspace-ui.css 在 `@media (max-width: 979px)` 下把遮罩改成
   `align-items: flex-end; padding: 0`、卡片改成 `width:100%; border-radius:18px 18px 0 0`
   —— 那是它在窄屏的 bottom-sheet 设计。玄机照搬后手机上就是「从下面滑出来」。
   ⚠️ 上游那条与基础规则**同特异性**（1 id + 2 class），而 tokens 段是被**前置**到
      bazi-board.css 顶部的 ⇒ 同特异性时上游后写者胜。所以必须带 `.mg-bazi-root` 抬到 1 id + 3 class。
   ⚠️ 只作用于 `.mg-bazi-term-layer`：其他弹窗（设置等）在窄屏仍是 bottom-sheet，不去动它们。 */
/* ⑭ 弹层打开期间摘掉 `#screen-pan` 的 transform
   为什么：带 transform 的元素会成为后代的 `position:fixed` **包含块**。`#screen-pan` 有
   `transform: matrix(1,0,0,1,0,4)`（屏幕位移动画）⇒ 遮罩不再是「全屏视口」而是「整页内容高」
   （实测 1266 vs 视口 749），卡片被居中到视口外。JS 在 openTerm 时加这个类、关闭时移除。
   ⚠️ 用 `!important`：该 transform 来自 app.css 的动画/屏幕规则，特异性不好压。
   🔴 光写 `transform: none` **不够**：那个 transform 来自
      `.screen{animation:fade .2s ease}` + `@keyframes fade{from{transform:translateY(4px)}}`，
      而**动画运行期间 `@keyframes` 的优先级高于作者的 `!important` 声明** ⇒ 必须连动画一起
      `animation: none` 关掉，transform 才能落回常规层叠、被下面那条压成 none。
      （本轮就是这个原因导致第一次修复无效：量出来还是 633 而非视口中心 374.5。） */
#screen-pan.is-term-layer-open {
  animation: none !important;
  transform: none !important;
}

@media (max-width: 979px) {
  #screen-pan .mg-bazi-root.mg-bazi-term-layer .workspace-ui-dialog-backdrop {
    align-items: center;
    justify-content: center;
    padding: 16px;
  }

  #screen-pan .mg-bazi-root.mg-bazi-term-layer .workspace-ui-dialog {
    width: min(680px, 100%);
    max-height: min(86dvh, 760px);
    border-radius: 18px;
  }
}

/* ============================================================================
   ▍REF-WZBAZI-001（2026-10-03）专业细盘：起运交运 / 岁数 / 点击高亮 / 五行配色
   ----------------------------------------------------------------------------
   对标件：真机 USB 直读「问真八字」排盘结果页 → 专业细盘（com.wzwh.bzpaipan，
   1080×2400 / density 450 ⇒ CSS 384×853）。原始截图与量测在 artifacts/REF-WZBAZI-001/：
     now-01.png 默认态 / now-02.png 点 2026 大运 / now-03.png 点流年 / now-04.png 点流月，
     sem-0x.txt（语义树逐元素 CSS 坐标+主色）、scan-line 分段（高亮的精确 x/y 边界）。

   用户口径：「模仿…排盘结果页专业细盘的 UI，起运交运，以及有个多少岁，
   还有特别是大运流年流月流日点击有个高亮，还有整体页面 UI 配色」。

   ① 起运／交运 = **极淡浅灰块 + 无描边**（问真实测块底 #F9F9F9、没有边框，纯靠底色差分层）。
   ② 起运行右端挂「X岁」＝当前选中大运的起始年龄（问真 y397 右端，点大运列会跟着变）。
   ③ 点中的那一格 = **浅灰实底**（问真实测 #EDEDED，整列铺满；文字保持原色，
      不是玄机原来的「强调色淡底 + 紫色文字」）。JS 侧另修了 activeKey 数字 vs keyOf 字符串
      的类型不匹配 —— 那个 bug 让五行运算盘**从来没有高亮过**。
   ④ 五行色对齐问真：木 #2FA13A／火 #D30505／土 #8B6D03／金 #EF9104／水 #2E83F6
      （深色取同一色相提亮的一套）。🔴 只在本盘作用域内换，**不动全局 `--wx-*`**
      （那是 REF-YIRUI-001 首页四柱定的色，用户没说改）。

   ⚠️ 特异性：本文件被 tools/extract-mingyu-bazi-css.mjs **前置**到 bazi-board.css 顶部
      ⇒ 同特异性时上游后写者胜。所以下面每条都要么多带一层类，要么带 `html[data-theme]` 前缀。
   ========================================================================== */
#screen-pan .mg-bazi-root {
  --bazi-luck-surface: #f9f9f9;
  --bazi-luck-line: transparent;
  --bazi-fortune-active: #ededed;
  --bazi-wx-wood: #2fa13a;
  --bazi-wx-fire: #d30505;
  --bazi-wx-earth: #8b6d03;
  --bazi-wx-metal: #ef9104;
  --bazi-wx-water: #2e83f6;
}

html[data-theme='dark'] #screen-pan .mg-bazi-root {
  --bazi-luck-surface: #22221f;
  --bazi-luck-line: transparent;
  --bazi-fortune-active: #34332e;
  --bazi-wx-wood: #4cc55a;
  --bazi-wx-fire: #ff5a5a;
  --bazi-wx-earth: #c9a227;
  --bazi-wx-metal: #ffb43a;
  --bazi-wx-water: #5aa6ff;
}

/* ① 起运 / 交运块：去掉描边、底色压到极淡（问真那两行就是靠一层浅灰跟白卡分家） */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-summary {
  gap: 3px;
  padding: 8px 10px;
  border-color: var(--bazi-luck-line);
  background: var(--bazi-luck-surface);
}

/* ② 两行两端对齐：左「标签 ＋ 正文」，右「X岁」 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-row {
  justify-content: space-between;
  gap: 8px;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-row > span {
  flex: 1 1 auto;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-age {
  flex: 0 0 auto;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ②′ 交运行右端的「司令：X」（BAZI-LUCK-COMMANDER-001，2026-10-03）
   用户：「还有那个今字（司令），也是放在起运交运那，要和问真一样的排布」。
   问真原文（sem-01.txt）：起运行右端「6岁」[315,397]、交运行右端「司令：戊」[288,413]，
   **两者的右缘都是 334** ⇒ 右端对齐在同一条竖线上。
   ⚠️ 真正把尾标顶到右端的是上面 ② 段的 `.bazi-luck-row > span{flex:1 1 auto}`
      （正文格吃掉剩余宽度），不是 `justify-content` —— 实测把 justify-content 改成 flex-start 也照样对齐，
      所以门禁的反证砸的是那个 flex。
   这里只管自身不缩、字重与「X岁」同档；「戊」的五行色由下面的 ④′ 段给出。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-commander {
  flex: 0 0 auto;
  font-weight: 750;
  color: var(--text);
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-commander strong {
  font-weight: 750;
}

/* ②″ 交运行右端的「今」按钮（BAZI-LUCK-TODAY-001，2026-10-03）
   用户：「岁运旁边的今字按钮放在司令:X 旁边，但是高度刚好对齐XX岁与司令的高度」。
   它是从岁运算盘头部（`.fortune-selector-head`）搬过来的 ⇒ 老样式那两条
   （⑤ 段里只命中 `.fortune-selector-card .fortune-selector-head .fortune-today-button`）**不再命中**，
   外观必须由本规则自带（含 hover），否则会掉回 UA 默认的灰砖（⑤ 段的注释记过这次事故）。
   🔴 高度＝`1.45em`，即 `.bazi-luck-row` 的 line-height（11.5px × 1.45 ≈ 16.7px）；
      `box-sizing: border-box` 把 1px 描边也算进高度里，
      于是按钮外框与「26岁」「司令：戊」这两个纯文本尾标的行高**逐像素一致**。
   ⚠️ 只在高级页出现（基础页没有岁运算盘，画上去是个哑控件）—— 由 luckSummaryHtml(withToday) 控制。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-today {
  flex: 0 0 auto;
  align-self: center;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 1.45em;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 5px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: inherit;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-today:hover,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-card .bazi-luck-today:focus-visible {
  outline: none;
  border-color: var(--border-strong);
  background: var(--surface-soft);
  color: var(--text-secondary);
}

/* ③ 岁运算盘：点中的那一格铺浅灰实底（问真口径），文字不再跟着变紫 */
#screen-pan .mg-bazi-root .fortune-selector-card .fortune-item.active {
  border-color: transparent;
  background: var(--bazi-fortune-active);
  box-shadow: none;
}

#screen-pan .mg-bazi-root .fortune-selector-card .fortune-item.active .fortune-year,
#screen-pan .mg-bazi-root .fortune-selector-card .fortune-item.active .fortune-age {
  color: var(--text);
}

/* ④ 五行色：三套选择器（岁运算盘的 .wuxing-* / 四柱盘的 [data-wuxing] / 分布条的标签）
   统一到 --bazi-wx-*。加 html[data-theme] 前缀抬特异性，顺便把深浅两套写清楚。 */
html[data-theme='light'] #screen-pan .mg-bazi-root .wuxing-mu,
html[data-theme='dark'] #screen-pan .mg-bazi-root .wuxing-mu { color: var(--bazi-wx-wood); }

html[data-theme='light'] #screen-pan .mg-bazi-root .wuxing-huo,
html[data-theme='dark'] #screen-pan .mg-bazi-root .wuxing-huo { color: var(--bazi-wx-fire); }

html[data-theme='light'] #screen-pan .mg-bazi-root .wuxing-tu,
html[data-theme='dark'] #screen-pan .mg-bazi-root .wuxing-tu { color: var(--bazi-wx-earth); }

html[data-theme='light'] #screen-pan .mg-bazi-root .wuxing-jin,
html[data-theme='dark'] #screen-pan .mg-bazi-root .wuxing-jin { color: var(--bazi-wx-metal); }

html[data-theme='light'] #screen-pan .mg-bazi-root .wuxing-shui,
html[data-theme='dark'] #screen-pan .mg-bazi-root .wuxing-shui { color: var(--bazi-wx-water); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='木'],
html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='木'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='木'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='木'] { color: var(--bazi-wx-wood); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='火'],
html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='火'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='火'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='火'] { color: var(--bazi-wx-fire); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='土'],
html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='土'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='土'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='土'] { color: var(--bazi-wx-earth); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='金'],
html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='金'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='金'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='金'] { color: var(--bazi-wx-metal); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='水'],
html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='水'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-ganzhi-symbol[data-wuxing='水'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-hidden-stem-list strong[data-wuxing='水'] { color: var(--bazi-wx-water); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='木'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='木'] { color: var(--bazi-wx-wood); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='火'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='火'] { color: var(--bazi-wx-fire); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='土'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='土'] { color: var(--bazi-wx-earth); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='金'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='金'] { color: var(--bazi-wx-metal); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='水'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-wuxing-label[data-wuxing='水'] { color: var(--bazi-wx-water); }

/* ④′ 起运/交运右端的「司令：X」里那颗人元也用同一套五行色（BAZI-LUCK-COMMANDER-001）。
   问真实测：`司令：戊` 的「戊」是 #8B6D03 ⇒ 正是问真的土色（本文件的 --bazi-wx-earth 浅色值）。 */
html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='木'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='木'] { color: var(--bazi-wx-wood); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='火'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='火'] { color: var(--bazi-wx-fire); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='土'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='土'] { color: var(--bazi-wx-earth); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='金'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='金'] { color: var(--bazi-wx-metal); }

html[data-theme='light'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='水'],
html[data-theme='dark'] #screen-pan .mg-bazi-root .bazi-showcase-card .bazi-luck-commander strong[data-wuxing='水'] { color: var(--bazi-wx-water); }


/* ============================================================================
   BAZI-HEAD-TIGHT-001（2026-10-03）八字结果页顶部收紧 + 神煞行一行化
   用户三句话：
     ① 「基础排盘与专业细盘要和姓名在一行，现在的位置白占一行空间」
     ② 「缩小字体，我不要一行字转折，福星贵人什么的，我要一行字，我看问真不就能放下吗，
         你就把底部的容器取消，放大空间」
     ③ 「然后一列一列的线取消。隐藏」
   ⇒ ① 页签（.pan-subpage-switch）由 bazi-board.js 渲染进 `.result-showcase-head` 右端；
     ② 神煞标签 8px + nowrap（专业细盘 10 列时列宽仅 ≈35.5px，「福星贵人」@9px 会折成两行
        —— 实测 `福星贵人[2行 30.5x20.2 @9px]`）；「底部的容器」＝ `.is-shensha` 格子的
        padding/min-height，一并取消，把列宽全部让给文字；
     ③ 列线 = `.bazi-pillars-cell` 的 border-right，置 transparent（保留 1px 占位，不改列宽）。
   ⚠️ 本文件被 tools/extract-mingyu-bazi-css.mjs **前置**到 bazi-board.css 顶部 ⇒
     同特异性时上游后写者胜，所以这里一律靠**更高特异性**（多带一层 `.bazi-pillars-table`
     或 `.traditional-chart-layout`）取胜，不依赖加载顺序。
   问真实测（artifacts/REF-WZBAZI-001/sem-01.txt）：神煞格 55×16、标签文字**不折行**、
   行距 16px —— 本轮目标就是「一格一个标签、一格一行」。
   ============================================================================ */

/* ①-1 姓名行改成不换行的 flex（≤720px 媒体查询里上游把它改成了 grid，
   两个子元素会竖成两行 ⇒ 页签又跑到姓名下方，正是用户嫌的「白占一行」）。 */
#screen-pan .mg-bazi-root .bazi-showcase-card.traditional-chart-layout .result-showcase-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

/* ①-2 页签本体：贴着姓名行右端，尺寸收到 22px / 10px（原 34px / 11px 是给紧凑头第 1 行对齐用的）。 */
#screen-pan .mg-bazi-root .bazi-showcase-card.traditional-chart-layout .result-showcase-head .pan-subpage-switch {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  margin: 0;
}
#screen-pan .mg-bazi-root .bazi-showcase-card.traditional-chart-layout .result-showcase-head .pan-subpage-switch .bazi-subpage-tab {
  height: 22px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 10px;
}

/* ② 神煞行：取消格子容器的内边距与最小高，标签强制一行、字号缩到 8px。
   ⚠️ 横向 padding 必须是 0：360px 宽下 10 列的列宽只剩 ≈33.2px，留 1px 横向内边距就会把
      「福星贵人」(31.6px) 顶出格子 0.61px（实测）。纵向留 2px 做行间呼吸。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-pillars-cell.is-shensha {
  min-height: 0;
  padding: 2px 0;
}
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-shensha-list {
  gap: 1px;
}
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-shensha-tag {
  white-space: nowrap;
  font-size: 8px;
  letter-spacing: -0.1px;
  max-width: 100%;
}

/* ③ 列线取消：置透明而不是 border-right:0 —— 保住 1px 占位，各列宽度不变，排版不跳。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table .bazi-pillars-cell {
  border-right-color: transparent;
}

/* ============================================================================
   ▍YIRUI-001 · 四柱盘对齐易瑞笔记（2026-10-11）
   ----------------------------------------------------------------------------
   用户口径：「四柱盘全面学习易瑞笔记 …… 但是我们字体不要那么粗」+ 拍板：
     · 专业细盘 9 列 → **8 列**（移出「流时」，见 bazi-board.js 的 boardColumns）
     · 「主星就是十神」⇒ **不新增主星行**（十神就长在天干/地支格内，2026-10-02 定的）
     · 字号字重按建议下调（干支 750→500、小字 600→400）
   ⚠️ **字重只能取 400/500 这一档，别写 450/550/600**：系统 CJK 字体（Windows Microsoft YaHei、
      Android Noto Sans CJK 的常见档）只有 Regular/Bold 两档，CSS 的 450~550 会按「≥500 先升序找、
      找不到再降」的匹配规则**向上取整成 Bold(700)** —— 实测 20px/550 的竖笔 3.0px（笔画比 0.150，
      仍旧是粗体），改成 500 后掉到 2.0px（比 0.100，与易瑞小字 0.097 同档）。
      写了 550 = 白改，这条踩过坑，务必按 400 / 500 写。
   参考件实测：`docs/REF-易瑞笔记八字四柱盘-20261011.md`、`artifacts/REF-YIRUI-BAZI-001/`。
   易瑞关键量（384px）：列宽 42.7、干支 22px、小字 11~13px **常规字重**、
   笔画比 小字 0.097（≈400~500）／大字 0.162；本仓改前小字笔画比 0.143（≈650~700）。
   🔴 保留（本仓相对易瑞的优势，不许撤）：神煞吉凶着色 · 干支可点查义 · 地支十神 · 流日。
   ⚠️ 特异性：本文件在 bazi-board.css **之前**，一律靠多带 `.bazi-pillars-scroll`
      （1 id + 6 class）压过上游的 1 id + 3~5 class，不依赖加载顺序。
   ========================================================================== */

/* ① 列宽：行标签列回到 38~44px（横排两字放得下），数据列均分。
   改前 ≤420px 那档是 minmax(26px,34px)，横排「藏干」(24px) + padding 会溢出。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table {
  grid-template-columns: minmax(38px, 44px) repeat(
      var(--bazi-display-column-count, 4),
      minmax(0, 1fr)
    );
}

/* ② 极浅行底（易瑞实测：藏干/星运/纳音 一档、空亡/自坐/神煞 一档、表头一档）。
   用 color-mix 直接由文字色与格底色推，浅色主题下 ≈ #f5f5f5 / #fafafa（与易瑞同值），
   深色主题自动变成「比格底略亮」，不用再维护两套色号。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-table {
  --bazi-band-strong: color-mix(in srgb, var(--text-primary) 4%, var(--surface-elevated));
  --bazi-band-soft: color-mix(in srgb, var(--text-primary) 2%, var(--surface-elevated));
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-band-strong {
  background: var(--bazi-band-strong);
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-band-soft {
  background: var(--bazi-band-soft);
}

/* ③ 格子基色：字号抬到 12px（易瑞同档的小字是 11~13），字重压到常规。
   🔴 这里**不写 color** —— 本规则与 ⑪（表头变淡）同为 1 id + 5 class，若在此写
      `color: var(--text-primary)` 会因靠后而把表头的 muted 顶掉（validate-bazi-pillar-rows
      报过：表头色 actual rgb(29,27,32) / expected rgb(122,126,131)）。
      文字色一律交给各自更精确的规则：⑪(表头) / ⑤(行标签) / ⑩(空亡星运自坐纳音)。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell {
  min-height: 30px;
  padding: 5px 2px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.15;
}

/* ④ 表头行：只补「高度 + 副标字号」。改前表头行高 39px、易瑞 27.7 ⇒ 收到 34px。
   🔴 颜色 / 字重刻意**不在这里写** —— 那两样仍只由上面 ⑪ 一条说了算。
   写了就等于开第二条真源，而反证表里的 `head-not-faded` 打的正是 ⑪，
   第二条会把它盖住 ⇒ 那条反证会退化成「假红」。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-head {
  min-height: 34px;
  gap: 1px;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-head > small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
}

/* ⑤ 行标签列：竖排 → **横排居中**（易瑞是横排；列宽已放宽到 38~44px）。
   ⚠️ 覆盖 tokens ⑧ 的 `writing-mode: vertical-rl`，那是为 26~34px 窄列写的。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-label {
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  justify-content: center;
  align-items: center;
  padding: 5px 3px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0;
}

/* ⑥ 干支本字：18px / 字重 550（改前 14px / 750 —— 用户要的「不要那么粗」）。
   基础页列宽是细盘的两倍，各给一档：基础 20px、细盘 18px。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage[data-bazi-page='base'] {
  --bazi-glyph: 20px;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-subpage[data-bazi-page='advanced'] {
  --bazi-glyph: 18px;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-stem .bazi-ganzhi-symbol,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-branch .bazi-ganzhi-symbol {
  font-size: var(--bazi-glyph, 18px);
  font-weight: 500;
  line-height: 1;
}

/* ⑦ 天干/地支行留出「十神 + 本字」两行的高度。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-stem,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-branch {
  min-height: 42px;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillar-value {
  gap: 3px;
}

/* ⑧ 格内十神：四柱位用主文字色、运位用灰（易瑞「主星」行就是四柱近黑、运列灰）。
   本仓没有独立主星行，十神长在天干/地支格内，所以按“列”分色 —— .is-fortune-cell 即运列。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-stem .bazi-pillar-value > small,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-branch .bazi-pillar-value > small {
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-fortune-cell.is-stem .bazi-pillar-value > small,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-fortune-cell.is-branch .bazi-pillar-value > small {
  color: var(--text-muted);
  font-weight: 400;
}

/* ⑨ 藏干：干 12px + 十神 10px，一律常规字重（易瑞 藏干 干11/十神9.5）。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-hidden-stems {
  min-height: 58px;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-hidden-stem-list strong {
  font-size: 12px;
  font-weight: 400;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-hidden-stem-list small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-hidden-stem-list {
  gap: 2px;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-hidden-stem-list > span {
  gap: 3px;
}

/* ⑩ 空亡 / 星运 / 自坐 / 纳音：灰字 + 常规字重（易瑞这几行都是 #777 的 12~13px）。
   纳音 3 字最宽，细盘 360px 下要放得进 40px 列 ⇒ 单独压到 11.5px。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-kongwang,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-life-stage,
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-zizuo {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-nayin {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 400;
}

/* ⑪ 神煞：8px → 9px（瘦身成 8 列后细盘列宽由 ≈35.5px 回到 ≈43px，仍有富余）。
   🔴 上限 9px：tests/validate-bazi-head-tight.mjs 钉着「标签字号落在 7~9px」，同时它也在
      360px 宽下查「不折行/不溢出」——再大就会在 360px 的 40px 列里顶出去。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-shensha-tag {
  font-size: 9px;
  font-weight: 400;
}

/* ⑫ 神煞格必须**保住**上面 tokens ② 的「取消容器内边距 / 最小高」。
   本段 ③ 是 `.bazi-pillars-cell` 的通用格，与 ② 同为 1 id + 5 class，靠后写会把它压掉
   （validate-bazi-head-tight 报过：「神煞格容器内边距未取消 padding 5/5」）。
   这里多带 `.bazi-pillars-scroll` 抬到 6 class 把 ② 的口径重新钉回来。 */
#screen-pan .mg-bazi-root .bazi-showcase-card .bazi-pillars-scroll .bazi-pillars-table .bazi-pillars-cell.is-shensha {
  min-height: 0;
  padding: 2px 0;
}
