[hidden] { display: none !important; }
/* 因果靈數：黑暗神秘風（2026-11-17 站長指定，參考暗黑命理站的氛圍，用自己的配色與符號）
   一律深色：近黑底、羊皮紙色字、朱砂紅標題、古金細線；襯線字；主選單固定在畫面底部。 */
:root {
  --bg: #0b0907;
  --surface: #15110d;
  --surface-2: #1b1611;
  --text: #ece3d2;          /* 正文：15.1:1 on the card */
  --muted: #bfb4a0;         /* 次要文字：9.4:1 */
  --line: #3a3128;
  --accent: #d3b478;        /* 古金：9.7:1 */
  --accent-ink: #0c0a08;
  --seal: #ec8274;          /* 朱砂（文字用；≥6.5:1） */
  --seal-deep: #8a3127;     /* 朱砂底色、框線 */
  --good: #a6cba3;          /* 吉：玉 10.7:1 */
  --good-bg: #101812;
  --bad: #ec8679;           /* 凶：赭紅 7.6:1 */
  --bad-bg: #1c0f0d;
  --neutral: #b9b3d3;
  --neutral-bg: #15131c;
  --radius: 4px;
  --nav-h: 68px;
  --num-font: "Noto Serif TC", "Source Han Serif TC", serif; /* lining, equal-height digits (Georgia's are old-style) */
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* 圈字母版（站長 B17；js/glyph.js）：圓圈或方框裡的單字一律置中。框（大小、邊、顏色）各自的 CSS 管；這裡只管置中：
   格線置中行框、行高 1，字的墨跡再由 glyph.js 依字形量測移到正中（--gx/--gy 用 em，跟著介面大小一起縮放）。
   各種圈字不准再自己加 padding 或 line-height 去「抬一下」 */
.glyph { display: inline-grid; place-items: center; line-height: 1; letter-spacing: 0; text-indent: 0; text-align: center; }
.glyph-ink { display: block; line-height: 1; transform: translate(var(--gx, 0), var(--gy, 0)); }
/* 介面大小（js/textsize.js）：全站字級都是 rem，跟著這一個數字走 */
html { font-size: calc(100% * var(--ui-text-scale, 1)); }
html { background: var(--bg); }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(138, 49, 39, .10), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(143, 122, 78, .04), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 1.1875rem/1.85 "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  font-variant-numeric: lining-nums tabular-nums;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* ---------- 頁首：只放品牌 ---------- */
.top { border-bottom: 1px solid var(--line); background: rgba(8, 6, 5, .85); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: center; padding: 14px 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.seal { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--seal); color: var(--seal); font-size: 1.375rem; font-weight: 900; line-height: 1; box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 3px rgba(184, 57, 44, .5); }
.brand-zh { font-size: 1.625rem; font-weight: 900; letter-spacing: .32em; color: var(--seal); text-shadow: 0 0 18px rgba(138, 49, 39, .18); }
.brand-en { font-size: 0.9375rem; color: var(--muted); letter-spacing: .3em; text-transform: uppercase; font-family: var(--num-font); }

/* ---------- 常駐底部列（沿用 lawcase：懸浮毛玻璃膠囊、圖示＋小字、選中亮膠囊、按壓縮放） ---------- */
:root { --press: scale(.94); --t: .15s; }
.dock {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom));
  width: calc(100% - 20px); max-width: 560px; z-index: 10;
  background: rgba(20, 15, 11, .72); backdrop-filter: saturate(160%) blur(22px); -webkit-backdrop-filter: saturate(160%) blur(22px);
  border: 1px solid rgba(201, 163, 78, .22); border-radius: 24px; padding: 4px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 240, 210, .06);
}
.dock-in { display: flex; }
.dock button {
  flex: 1 1 0; min-width: 0; border: 0; background: none; font: inherit; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}
.dock .ic { display: grid; place-items: center; width: 48px; height: 30px; border-radius: 15px; transition: background .25s cubic-bezier(.2,0,0,1), transform var(--t), color .2s; }
.dock svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dock .lb { font-size: 0.9375rem; letter-spacing: .08em; line-height: 1.2; }
.dock button:active .ic { transform: scale(.86); }
.dock button[aria-selected="true"] { color: #f1e6cc; }
.dock button[aria-selected="true"] .ic { background: rgba(138, 49, 39, .38); color: #f0a093; box-shadow: 0 0 14px rgba(138, 49, 39, .18); }
.dock button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 14px; }
@media (hover: hover) { .dock button:hover .ic { background: rgba(255, 240, 210, .06); } }
body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- 按鈕系統（唯一母版）：.primary 主要｜.btn.ghost 次要｜.cta 大入口｜.seg 分段切換 ---------- */
.primary, .btn, .cta, .seg button, .rel-types button, button.rel, .link-btn { -webkit-tap-highlight-color: transparent; transition: transform var(--t), background .2s, color .2s, box-shadow .2s; }
.primary:active, .btn:active, .cta:active, .seg button:active, .rel-types button:active, button.rel:active { transform: var(--press); }
.primary:focus-visible, .btn:focus-visible, .cta:focus-visible, .seg button:focus-visible, .rel-types button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { font: inherit; font-size: 1.0625rem; color: var(--accent); background: transparent; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; cursor: pointer; }
.ctas { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 18px; }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, rgba(138, 49, 39, .10), rgba(18, 14, 11, .9)); border: 1px solid rgba(138, 49, 39, .18);
  border-radius: 6px; padding: 16px 18px; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); }
.cta span { display: flex; flex-direction: column; }
.cta b { font-size: 1.3125rem; letter-spacing: .2em; color: #f1e6cc; }
.cta small { font-size: 1rem; color: var(--muted); }
.cta i { font-style: normal; font-size: 1.75rem; color: var(--seal); }
.seg { display: flex; background: #0b0907; border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin: 4px 0 16px; }
.seg button { flex: 1; font: inherit; font-size: 1.0625rem; letter-spacing: .2em; padding: 9px 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: #f1e6cc; box-shadow: 0 1px 6px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(201, 163, 78, .3); }

main { padding-top: 28px; padding-bottom: 24px; }

/* ---------- 共用元件 ---------- */
.hero { text-align: center; margin: 8px 0 26px; }
.hero h1 { margin: 6px 0; font-size: 2.125rem; font-weight: 900; letter-spacing: .3em; color: var(--seal); }
.hero p { margin: 0; color: var(--muted); letter-spacing: .12em; }
.rule { height: 1px; background: linear-gradient(to right, transparent, var(--accent), transparent); opacity: .5; margin: 18px auto; max-width: 420px; }

.card { background: linear-gradient(to bottom, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; position: relative; }
.card::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(201, 163, 78, .08); pointer-events: none; }
.form, .form.column { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1 1 200px; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 1rem; color: var(--muted); letter-spacing: .08em; }
input, select, textarea {
  font: inherit; font-size: 1.25rem; color: var(--text); background: #0b0907;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; width: 100%;
}
input { letter-spacing: .14em; }
input::placeholder, textarea::placeholder { color: #8a8070; letter-spacing: .04em; font-size: 1.0625rem; font-weight: 300; opacity: 1; } /* 5.1:1 on #0b0907 (B8) */
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.primary {
  font: inherit; font-size: 1.25rem; font-weight: 700; letter-spacing: .5em; text-indent: .5em;
  color: var(--accent); background: transparent; border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 14px 22px; cursor: pointer; width: 100%; margin-top: 4px;
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px rgba(201, 163, 78, .35);
}
.primary:hover { background: rgba(201, 163, 78, .1); color: #f1e6cc; }
.privacy { margin: -6px 4px 18px; font-size: 1rem; color: var(--muted); text-align: center; }
.error { color: var(--bad); }

h2 { margin: 0 0 10px; font-size: 1.5rem; letter-spacing: .12em; color: var(--accent); font-weight: 700; }
h3 { margin: 0 0 12px; font-size: 1.25rem; letter-spacing: .1em; color: var(--accent); font-weight: 700; }
.muted { color: var(--muted); }
a { color: var(--accent); }

.summary { display: grid; gap: 14px; }
.number { font-size: 1.875rem; font-weight: 900; letter-spacing: .16em; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 62px; padding: 6px 10px; border-radius: var(--radius); font-size: 0.9375rem; line-height: 1.3; border: 1px solid transparent; }
.chip b { font-size: 1.125rem; }
.chip small { font-size: 0.9375rem; }
.chip.good { background: var(--good-bg); color: var(--good); border-color: rgba(156, 199, 154, .25); }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: rgba(226, 103, 90, .25); }
.chip.tail { border-color: currentColor; border-width: 2px; }
.verdict { padding: 14px 16px; border-radius: var(--radius); font-weight: 700; text-align: center; border: 1px solid currentColor; }
.verdict.good { background: var(--good-bg); color: var(--good); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.verdict.neutral { background: var(--neutral-bg); color: var(--neutral); }
.stats { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; font-size: 1.0625rem; color: var(--muted); }

/* Table master (owner 11-22: no wide gaps, left and right margins equal, nothing pushed to the left). Every cell is
   centred and keeps its words on one line, so short columns shrink to their content. A cell of running text is marked
   .prose (core.js cellClass): it reads from the left, wraps, and takes all the spare width, so the slack never turns
   into gaps between short columns and the table never runs out past the card's right padding. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 1.0625rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; white-space: nowrap; }
thead th { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
th.prose, td.prose { text-align: left; white-space: normal; width: 100%; min-width: 6em; }
@media (max-width: 560px) {
  th, td { padding: 8px 6px; }
  /* phone: a text table (.ftable, marked .stack by core.js stackTables) becomes one card per row — the first cell is
     the card's title, every other cell reads 「欄名　內容」 — so nothing scrolls sideways out of sight */
  table.stack, table.stack tbody, table.stack tr { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
  table.stack th, table.stack td { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 10px; align-items: baseline; letter-spacing: 0; width: auto; min-width: 0;
    border: 0; padding: 4px 0; text-align: left; white-space: normal; }
  table.stack [data-label]::before { content: attr(data-label); color: var(--muted); font-size: 0.9375rem; font-weight: 400; }
  table.stack tr > :first-child { display: block; font-weight: 700; color: var(--accent); padding-bottom: 6px; }
  table.stack tr > :first-child::before { content: none; }
}
th { color: var(--muted); font-weight: 600; font-size: 0.9375rem; letter-spacing: .08em; }
td.good { color: var(--good); font-weight: 700; }
td.bad { color: var(--bad); font-weight: 700; }
.bar { position: relative; width: 90px; height: 6px; background: var(--line); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.bar i { position: absolute; inset: 0 auto 0 0; }
.bar i.good { background: var(--good); }
.bar i.bad { background: var(--bad); }

ul.lines, ol.lines { margin: 0; padding-left: 22px; }
.lines li { margin: 10px 0; }
.grid2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid2 .card { margin-bottom: 0; }

.rank-table td:first-child { font-weight: 900; color: var(--accent); }
.rank-table tr { cursor: pointer; }
.rank-table tr:hover td { background: rgba(201, 163, 78, .06); }

.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { display: inline-block; font-size: 0.9375rem; padding: 2px 9px; border-radius: 2px; font-weight: 600; white-space: nowrap; border: 1px solid currentColor; background: transparent; }
.badge.owner, .badge.lb-practice { color: #d6bd84; }
.badge.tradition, .badge.lb-heritage { color: #a9bcd6; }
.badge.common, .badge.lb-restored { color: #a6cba3; }
.badge.table, .badge.lb-original { color: #c3b2dc; }
.badge.engine { color: #d8d1c2; }
.badge.risk-low { color: var(--good); }
.badge.risk-mid { color: #d6bd84; }
.badge.risk-high { color: var(--bad); }
.doc-group { margin: 28px 4px 10px; font-size: 1.0625rem; color: var(--muted); letter-spacing: .3em; text-align: center; }
.doc { display: grid; gap: 8px; }
.doc h3 { margin: 0; }
.doc .note { font-size: 1rem; color: var(--muted); border-left: 2px solid var(--seal); padding-left: 12px; }
.link-btn { font: inherit; font-size: 1.0625rem; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }

.foot { padding-bottom: 28px; font-size: 1rem; color: var(--muted); text-align: center; }

/* ---------- 學說根基 ---------- */
.stance { display: inline-block; margin: 0 0 10px; font-size: 0.9375rem; letter-spacing: .12em; color: var(--muted); border: 1px solid var(--line); padding: 3px 12px; }
.quick li { margin: 8px 0; }
.fsec .lead { color: var(--muted); margin: 0 0 14px; }
.claim { border-top: 1px solid var(--line); }
.claim summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 14px 0; }
.claim summary::-webkit-details-marker { display: none; }
.claim summary::after { content: '＋'; grid-column: 2; justify-self: end; font-size: 1.125rem; color: var(--accent); margin-top: -26px; }
.claim[open] summary::after { content: '－'; }
.claim-id { grid-row: span 3; font-size: 0.9375rem; font-weight: 900; color: var(--seal); border: 1px solid var(--seal); padding: 1px 6px; height: fit-content; margin-top: 4px; font-family: var(--num-font); }
.claim-title { font-weight: 700; font-size: 1.25rem; color: var(--text); }
.claim-verdict { color: var(--text); }
.claim-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.claim-body { padding: 0 0 16px 16px; border-left: 2px solid var(--line); }
.claim-body p { margin: 10px 0; }
.debate { background: #0b0907; border: 1px solid var(--line); padding: 4px 14px; margin: 12px 0; }
.ev { font-size: 0.9375rem; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); padding: 0 6px; text-decoration: none; font-family: var(--num-font); }
.evidence { padding-left: 0; list-style: none; margin: 0; }
.evidence li { font-size: 1.0625rem; padding: 12px 6px; border-top: 1px solid var(--line); transition: background .4s; }
.evidence li.flash { background: rgba(184, 57, 44, .2); }
.evidence q { color: var(--muted); }
.correction { border-left: 2px solid var(--seal); padding: 2px 14px; margin: 12px 0; }
.correction p { margin: 6px 0; }
.dots { color: var(--accent); letter-spacing: 3px; }
.demo { background: #0b0907; border: 1px solid var(--line); padding: 16px; margin: 6px 0 16px; }
.demo-gua { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }
.demo-gua > div > b { display: block; text-align: center; margin-bottom: 8px; }
.demo-arrow { font-size: 1.625rem; color: var(--muted); }
.yao { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.yao-pos { font-size: 0.9375rem; color: var(--muted); width: 2.4em; }
.yao i { display: block; height: 10px; width: 34px; background: var(--text); }
.yao.yang i { width: 76px; }
.yao.yang i + i { display: none; }
.yao.moved i { background: var(--seal); box-shadow: 0 0 10px rgba(184, 57, 44, .6); }
.demo-star { font-size: 1.625rem; font-weight: 900; padding: 12px 18px; text-align: center; border: 1px solid currentColor; }
.demo-star small { display: block; font-size: 0.9375rem; font-weight: 600; }
.demo-star.good { background: var(--good-bg); color: var(--good); }
.demo-star.bad { background: var(--bad-bg); color: var(--bad); }

/* 因果關係標籤：剋類＝玉色、守住／延續＝紫灰、更凶／沒接住／轉凶＝朱紅、繞路＝紫 */
.rel { display: inline-block; font-size: 0.9375rem; font-weight: 700; padding: 1px 8px; border: 1px solid currentColor; margin: 0 4px; white-space: nowrap; cursor: default; font-family: inherit; background: transparent; }
button.rel { cursor: pointer; margin: 0; }
.rel-catch { background: var(--good); color: var(--bg); border-color: var(--good); }
.rel-catchSky, .rel-flow, .rel-repeat { color: var(--good); }
.rel-carry { color: var(--neutral); }
.rel-worse { background: var(--bad); color: var(--bg); border-color: var(--bad); }
.rel-miss, .rel-turnBad { color: var(--bad); }
.rel-detour { color: #c3b2dc; }
.relgrid { border-collapse: collapse; font-size: 0.9375rem; }
.relgrid th, .relgrid td { padding: 5px; text-align: center; border-bottom: 1px solid var(--line); }
.relgrid th.good { color: var(--good); } .relgrid th.bad { color: var(--bad); }
/* phone: the 9×9 前後 grid fits the screen instead of scrolling half of it out of sight */
@media (max-width: 560px) { .relgrid th, .relgrid td { padding: 4px 1px; font-size: 0.8125rem; white-space: normal; word-break: break-all; line-height: 1.2; }
  .relgrid button.rel { padding: 3px 2px; font-size: 0.75rem; white-space: normal; word-break: break-all; line-height: 1.2; max-width: 2.6em; } }
.grid-title { font-size: 1.0625rem; margin: 20px 0 10px; }
.lines.chain li { margin-bottom: 8px; }
.ftable { font-size: 1rem; }
.life-seg { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.life-seg > b { min-width: 9em; font-size: 1rem; color: var(--accent); }
.life-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

/* ---------- 配對 ---------- */
.rel-types { display: flex; flex-wrap: wrap; gap: 8px; }
.rel-types button { font: inherit; font-size: 1.0625rem; color: var(--text); background: transparent; border: 1px solid var(--line); padding: 6px 14px; cursor: pointer; letter-spacing: .08em; }
.rel-types button[aria-pressed="true"] { color: var(--seal); border-color: var(--seal); background: rgba(184, 57, 44, .1); }
.rel-group { font-size: 0.9375rem; color: var(--muted); letter-spacing: .3em; margin: 10px 0 6px; }
.match-head { text-align: center; }
.match-head .pair { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 1.125rem; }
.match-head .gua { display: inline-flex; flex-direction: column; align-items: center; border: 1px solid var(--line); padding: 8px 16px; min-width: 110px; }
.match-head .gua b { font-size: 1.875rem; color: var(--accent); line-height: 1.2; }
.match-head .link { font-size: 1.625rem; color: var(--seal); }
.match-star { font-size: 2.5rem; font-weight: 900; letter-spacing: .3em; text-indent: .3em; margin: 12px 0 4px; }
.match-star.good { color: var(--good); text-shadow: 0 0 20px rgba(156, 199, 154, .3); }
.match-star.bad { color: var(--bad); text-shadow: 0 0 20px rgba(226, 103, 90, .35); }
.reading { font-size: 1.25rem; line-height: 1.9; }

@media (max-width: 560px) {
  body { font-size: 1.125rem; line-height: 1.8; }
  .brand-zh { font-size: 1.375rem; letter-spacing: .24em; }
  .brand-en { display: none; }
  .hero h1 { font-size: 1.75rem; }
  .number { font-size: 1.5rem; }
  .card { padding: 18px 16px; }
  .match-star { font-size: 2.125rem; }
}
b.good, span.good { color: var(--good); }
b.bad, span.bad { color: var(--bad); }
#result, #match-result, #rank-result, #chain-out, .evidence li, .claim { scroll-margin-top: 84px; }

/* ===== 第五輪：現代化（圓角卡片、頁首左品牌右工具）、入口、儀式、紀錄、逐列輸入、全解 ===== */
:root { --radius: 14px; }
.card { border-radius: var(--radius); }
.card::before { border-radius: calc(var(--radius) - 4px); }
.top-inner { justify-content: space-between; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.brand { text-decoration: none; gap: 10px; min-width: 0; }
.logo { width: 36px; height: 44px; flex: none; filter: drop-shadow(0 0 8px rgba(138, 49, 39, .18)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-zh { font-size: 1.375rem; letter-spacing: .18em; }
.brand-en { font-size: 0.9375rem; letter-spacing: .14em; text-transform: none; }
.top-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 1rem; color: var(--text);
  background: rgba(255, 240, 210, .05); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.pill svg, .btn svg, .primary svg, .icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pill select { border: 0; background: none; color: var(--text); font: inherit; font-size: 0.9375rem; padding: 0; width: auto; letter-spacing: 0; }
.pill:active { transform: var(--press); }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.primary svg { width: 22px; height: 22px; }
.btn { display: inline-flex; align-items: center; gap: 6px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.danger { color: var(--bad); border-color: rgba(226, 103, 90, .4); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:active { transform: var(--press); }
.small { font-size: 0.9375rem; }
.center { text-align: center; }

/* 逐列輸入（比號碼） */
.rows { display: flex; flex-direction: column; gap: 8px; }
.rrow { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 8px; align-items: center; }
.rrow input { font-size: 1.125rem; padding: 10px 12px; }
.row-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* 全解 */
.fate-head { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.fate-head b { font-size: 2.625rem; letter-spacing: .3em; text-indent: .3em; line-height: 1.2; }
.fate-head small { color: var(--muted); font-size: 0.9375rem; letter-spacing: .1em; }
.portrait { font-size: 1.25rem; text-align: center; margin: 8px 0 4px; }
.aspects { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 12px; }
.aspect { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: rgba(0, 0, 0, .25); }
.aspect h4 { margin: 0 0 4px; color: var(--seal); letter-spacing: .3em; font-size: 1.0625rem; }
.aspect p { margin: 4px 0; }

/* 入口 */
.gate { position: fixed; inset: 0; z-index: 30; overflow-y: auto; display: grid; place-items: center; text-align: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(138, 49, 39, .12), transparent 60%), var(--bg); transition: opacity .6s, visibility .6s; }
.gate.gone { opacity: 0; visibility: hidden; }
.gate-in { max-width: 620px; padding: 32px 20px 40px; }
.gate-art { width: min(620px, 88vw, 58vh); aspect-ratio: 1; margin: 0 auto; position: relative; }
.gate h1 { font-size: clamp(40px, 9vw, 64px); letter-spacing: .4em; text-indent: .4em; color: var(--seal); margin: 10px 0 18px; font-weight: 900; text-shadow: 0 0 30px rgba(138, 49, 39, .22); }
.gate .kicker { font-size: clamp(16px, 3.6vw, 23px); letter-spacing: .42em; text-indent: .42em; color: var(--seal); font-family: var(--num-font); font-weight: 700; margin: -8px 0 26px; opacity: .92; text-shadow: 0 0 18px rgba(138, 49, 39, .22); } /* 站長 11-21：英文品牌在因果靈數正下方，同朱砂色、寬度約與中文標題齊 */
.gate-line { font-size: 1.25rem; margin: 8px 0; opacity: 0; animation: rise .9s ease forwards; }
.gate-line:nth-of-type(1) { animation-delay: .3s; } .gate-line:nth-of-type(2) { animation-delay: 1.1s; } .gate-line:nth-of-type(3) { animation-delay: 1.9s; }
.gate-line.dim { color: var(--muted); font-size: 1.0625rem; }
.gate-enter { max-width: 280px; margin: 26px auto 10px; opacity: 0; animation: rise .9s ease 2.5s forwards; }
.gate-note { font-size: 1rem; color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* 起卦儀式 */
.ritual { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; align-content: center; gap: 14px; background: rgba(5, 4, 3, .92); backdrop-filter: blur(6px); }
.ritual-art { width: min(440px, 70vw, 50vh); height: auto; animation: spin 1.2s cubic-bezier(.5, 0, .3, 1) infinite; }
.ritual p { font-size: 1.625rem; letter-spacing: .6em; text-indent: .6em; color: #f1e6cc; margin: 0; }

/* 歷史紀錄面板 */
.hist-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.hist { width: 100%; text-align: left; font: inherit; color: var(--text); background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; gap: 0 10px; }
.hist-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist small { color: var(--muted); font-size: 0.9375rem; }
@media (max-width: 560px) {
  .pill-lb, .brand-en { display: none; }
  .rrow { grid-template-columns: 1fr 1fr auto; }
  .fate-head b { font-size: 2.125rem; }
}
@media (prefers-reduced-motion: reduce) { .ga-ring, .ga-core, .ritual-art { animation: none; } .gate-line, .gate-enter { animation: none; opacity: 1; } }

/* 不顯示捲軸（仍可捲動） */
html, body, .gate, .layer-in, .table-wrap { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar, .gate::-webkit-scrollbar, .layer-in::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ===== 統一下拉選單（js/select.js；原生 select 仍是資料來源，只換外觀） ===== */
.sel { position: relative; display: block; width: 100%; }
.sel > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; width: 100%; }
.sel-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; font: inherit; font-size: 1.125rem; color: var(--text);
  background: #0b0907; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; cursor: pointer; text-align: left; letter-spacing: .04em; }
.sel-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.sel-btn[aria-expanded="true"] { border-color: var(--accent); }
.sel-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.sel-btn:focus-visible { outline: 1px solid var(--accent); }
.sel-list { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; max-height: 300px; overflow-y: auto;
  background: rgba(14, 11, 9, .97); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, .7); scrollbar-width: none; }
.sel-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 1.0625rem; }
.sel-list li:hover { background: rgba(255, 240, 210, .05); }
.sel-list li[aria-selected="true"] { color: #f1e6cc; background: rgba(138, 49, 39, .25); }
.sel-list li[aria-disabled="true"] { color: var(--muted); opacity: .5; cursor: not-allowed; }
.pill .sel { width: auto; }
.pill .sel-btn { border: 0; background: none; padding: 0; font-size: 1rem; gap: 4px; }
.pill .sel-list { left: auto; right: -12px; min-width: 150px; }

/* ===== 統一圖示與能量條 ===== */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.primary .ico { width: 22px; height: 22px; }
.dock .ico { width: 22px; height: 22px; stroke-width: 1.7; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ebar { display: block; width: 100%; min-width: 40px; height: 4px; margin-top: 4px; background: rgba(255, 240, 210, .08); border-radius: 2px; overflow: hidden; }
.ebar i { display: block; height: 100%; background: currentColor; opacity: .8; }
.fate-head .ebar { width: 160px; height: 6px; margin: 6px auto 0; }

/* ===== 八星配色（單一來源；final4 裁決 13，visual.md §2）=====
   先用八宅五行上色，同五行撞色時改用同一顆星在紫白九星裡的色名；顏色只是典故，不參與計分。
   生氣 貪狼木 青綠｜天醫 巨門土 金黃｜延年 武曲金 銀白｜伏位 右弼九紫 紫
   禍害 祿存三碧 碧｜六煞 文曲水 水藍｜五鬼 廉貞火 火橙｜絕命 破軍七赤 赤紅
   最小色差 ΔE2000 22.5，三種色盲模擬 ≥9.4，在 #1b1611 上對比 ≥4.85:1（palette.py）。 */
.st-shengqi { --st: #6fdc9f; } .st-tianyi { --st: #f2d763; } .st-yannian { --st: #e2e4e8; } .st-fuwei { --st: #cfa3f2; }
.st-huohai { --st: #4fb3b8; } .st-liusha { --st: #5b8cf5; } .st-wugui { --st: #ec8f2e; } .st-jueming { --st: #e5534b; }
b[class*="st-"], span[class*="st-"]:not(.chip) { color: var(--st); }
.chip[class*="st-"] { color: var(--st); background: color-mix(in srgb, var(--st) 13%, #0a0807); border-color: color-mix(in srgb, var(--st) 38%, transparent); }
.chip[class*="st-"].tail { border-color: var(--st); }
.fate-head b[class*="st-"] { color: var(--st); }
.card h3 .ico { margin-right: 6px; }
h4.sub { margin: 18px 0 6px; color: var(--accent); font-size: 1.125rem; letter-spacing: .12em; }

.btn.back { margin-top: 10px; }
.return-pill { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 12;
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 1.0625rem; color: var(--text); cursor: pointer;
  background: rgba(20, 15, 11, .85); backdrop-filter: blur(14px); border: 1px solid rgba(143, 122, 78, .35); border-radius: 999px; padding: 8px 18px; }
.sel-btn .ico, .sel-list .ico { margin-right: 8px; color: var(--accent); }

/* 方印 Logo（傾斜、斑駁、左框缺口）；品牌字改古銅色，不再與印章同色 */
.logo { width: 42px; height: 42px; filter: none; }
.brand-zh { color: #e3d3ab; text-shadow: none; }

/* 比號碼表在手機上改成一列一張卡，右邊不再被切掉 */
@media (max-width: 640px) {
  .rank-table thead { display: none; }
  .rank-table, .rank-table tbody, .rank-table tr, .rank-table td { display: block; width: 100%; }
  .rank-table tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
  .rank-table td { display: flex; gap: 12px; border: 0; padding: 4px 0; white-space: normal; }
  .rank-table td::before { content: attr(data-label); flex: 0 0 6.5em; color: var(--muted); font-size: 0.9375rem; }
}

/* 評分 */
b.score, .stats .score b { color: var(--st-tianyi, #d4b25c); font-size: 1.15em; font-variant-numeric: tabular-nums; }

/* Beta badge with a tap-to-open explanation (names are scored on trial) */

/* 號碼本身（站長 2026-11-19 第十五輪）：每個數字底下是同大小的卦與卦名，變爻紅色，兩數之間的下方是八星單字 */
.ng { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: 0; row-gap: .1em; justify-items: center; align-items: center;
  font-size: min(max(1.375rem, 7.4vw), 2.375rem, 7.6vw); width: 100%; max-width: calc(var(--cols) * 1.5em); margin: 4px auto 10px; }
.ng-d { grid-row: 1; font-weight: 900; line-height: 1.1; font-family: var(--num-font); font-variant-numeric: lining-nums; color: var(--text); }
.ng-pre { color: var(--muted); }
.ng-g { grid-row: 2; width: min(.74em, 70%); height: auto; aspect-ratio: 60 / 58; display: block; } /* narrower than its column, so neighbours never touch (owner 2026-11-20) */
.ng-g svg { width: 100%; height: 100%; display: block; fill: var(--accent); }
.ng-g rect.chg { fill: #d0342c; }
.ng-mark svg { fill: var(--muted); }
.yin-ending { font-size: 1em; color: var(--text); border-left: 2px solid var(--accent); padding-left: .6em; margin: .5em 0; }
.badge.lv-yijing, .badge.lv-laozi { color: #dcc07a; }
.badge.lv-classic, .badge.lv-later, .badge.lv-buddhist, .badge.lv-modern { color: #a9bcd6; }
.badge.lv-lin, .badge.lv-baji, .badge.lv-web { color: #d6bd84; }
.badge.lv-witness, .badge.lv-derived { color: #c3b2dc; }

/* ===== 定稿可讀性（站長 2026-11-19：黑暗風但要看得清楚、字大）＋ 推理段落、因果線 ===== */
small { font-size: 0.9375rem; }
.claim-id { border-color: var(--seal-deep); }
.rel-catch { color: #0c0a08; }
.rel-worse { color: #0c0a08; }
.hint, .more-info { font-size: 1rem; color: var(--muted); margin: 0; line-height: 1.75; }
.more-info { border-left: 2px solid var(--accent); padding-left: .7em; margin: 10px 0; }
dl.reason { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 10px 0 4px; }
dl.reason dt { font-size: 0.9375rem; font-weight: 700; color: var(--accent); letter-spacing: .2em; padding-top: .2em; white-space: nowrap; }
dl.reason dd { margin: 0; }
.cpairs { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 14px; }
.cpair { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: rgba(0, 0, 0, .22); }
.cpair.ph-end { border-color: rgba(211, 180, 120, .45); }
.cp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 1.25rem; }
.cp-join { color: var(--muted); font-size: 1rem; }
.cp-digits { font-family: var(--num-font); letter-spacing: .08em; color: var(--text); font-size: 1.125rem; }
.phase { font-size: 0.9375rem; color: var(--accent); border: 1px solid rgba(211, 180, 120, .45); border-radius: 999px; padding: 0 10px; }
.cp-text { font-weight: 700; margin: 8px 0 2px; }
.yin-card h3 { margin-bottom: 4px; }
@media (max-width: 560px) {
  dl.reason { grid-template-columns: 1fr; gap: 2px; }
  dl.reason dt { padding-top: 6px; }
  .cp-head { font-size: 1.125rem; }
}
.legend .badge { white-space: normal; }

/* 終則有始：尾接回頭 (owner 2026-11-19) */
.creturn { margin-top: 14px; padding: 14px 16px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--surface-2); }
.creturn.bad { border-color: var(--seal-deep); }

/* 性別：三個圖案按鈕 */
.gender-seg { max-width: 260px; margin-bottom: 4px; }
.gender-seg button { letter-spacing: 0; padding: 7px 0; }
.gender-seg button svg { width: 26px; height: 26px; }
.gender-seg button[data-gender="male"][aria-pressed="true"] { color: #9cc3ee; }
.gender-seg button[data-gender="female"][aria-pressed="true"] { color: #f0a3c0; }
.ctx-person h4.sub { margin-top: 4px; }

/* 品牌字不拆行（375px 時「因果靈數」被拆成兩行） */
.brand-zh { white-space: nowrap; }
@media (max-width: 400px) { .brand-zh { font-size: 1.25rem; letter-spacing: .1em; } }

/* 陰星：放在兩顆星的正中間（槽位橫跨兩顆星，字用絕對定位） */
.ng-y-slot { grid-row: 4; justify-self: stretch; position: relative; height: 1.3em; font-size: .56em; }
.ng-y-slot .ng-y { position: absolute; top: 0; transform: translateX(-50%); font-size: 1em; white-space: nowrap; }

/* 比號碼手機版：星序整串可換行，最後一個字不被切 */
@media (max-width: 700px) { .rank-table td[data-label="星序"] { flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; } }

/* ===== 因果線（站長 2026-11-21）：左側一條線串起每一步，點開看細節 ===== */
.cl-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cl-all { font: inherit; font-size: 1rem; color: var(--accent); background: transparent; border: 1px solid rgba(211, 180, 120, .45); border-radius: 999px; padding: 4px 14px; cursor: pointer; }
.cl-all:focus-visible, .cl-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cl-list { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.cl-list::before { content: ""; position: absolute; left: calc(1.1875rem - 1px); top: 20px; bottom: 20px; width: 2px;
  background: linear-gradient(var(--accent), rgba(211, 180, 120, .2)); }
.cl-node { position: relative; padding: 0 0 16px; }
.cl-phase { display: block; margin: 2px 0 8px calc(2.375rem + 14px); font-size: 0.9375rem; color: var(--accent); letter-spacing: .2em; }
.cl-head { display: grid; grid-template-columns: 2.375rem 1fr; column-gap: 14px; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: transparent; border: 0; padding: 0; cursor: pointer; }
/* 星字置中（站長 2026-11-20「天字偏下」）：圓用 em 跟字一起長大；line-height 1 讓字不撐出圓而貼上緣排；Noto Serif TC 字面略偏下，
   padding-bottom 往上抬（ui6 量測：375 與 1280、100% 與 150% 字面中心與圓心差 ≤1px） */
.cl-dot { grid-row: 1 / span 2; align-self: start; position: relative; z-index: 1; width: 2em; height: 2em; border-radius: 50%; display: grid; place-items: center;
  font-family: "Noto Serif TC", serif; font-weight: 700; font-size: 1.1875rem; color: var(--st); background: var(--bg);
  border: 2px solid color-mix(in srgb, var(--st) 70%, transparent); box-shadow: 0 0 0 4px var(--surface); transition: box-shadow .2s, transform .2s; }
.cl-node.bad .cl-dot { border-style: dashed; }
.cl-line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 1.1875rem; padding-top: 4px; }
.cl-sum { font-size: 1.0625rem; color: var(--muted); line-height: 1.7; margin-top: 2px; }
.cl-head:hover .cl-dot, .cl-node.open .cl-dot { box-shadow: 0 0 0 4px var(--surface), 0 0 14px color-mix(in srgb, var(--st) 55%, transparent); transform: scale(1.06); }
.cl-node.open .cl-sum { color: var(--text); font-weight: 700; }
.cl-body { margin: 8px 0 0 calc(2.375rem + 14px); padding: 10px 14px; border-left: 2px solid var(--line); background: rgba(0, 0, 0, .22); border-radius: 0 8px 8px 0; }
.cl-yin { margin: 0 0 6px; line-height: 1.75; }
.cl-ytag { display: inline-block; margin-right: 8px; font-weight: 500; border-bottom: 1px dashed var(--st); }
@media (max-width: 560px) {
  .cl-head { grid-template-columns: 1.875rem 1fr; column-gap: 10px; }
  .cl-dot { font-size: 1rem; width: 1.875em; height: 1.875em; }
  .cl-phase { margin-left: calc(1.875rem + 10px); }
  .cl-body { margin-left: calc(1.875rem + 10px); padding: 8px 10px; }
  .cl-line1 { font-size: 1.0625rem; }
}

/* 因果線互動（站長 2026-11-21）：點亮的那顆放大，外框順時針轉；其餘變暗 */
.cl-dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--st) 80%, transparent);
  opacity: 0; transition: opacity .2s; pointer-events: none; }
.cl-head:hover .cl-dot, .cl-node.open .cl-dot { transform: scale(1.22); }
.cl-head:hover .cl-dot::after, .cl-node.open .cl-dot::after { opacity: 1; animation: cl-spin 6s linear infinite; }
.cl-list:has(.cl-node.open) .cl-node:not(.open) { opacity: .55; transition: opacity .2s; }
.cl-list:has(.cl-node.open) .cl-node:not(.open):hover { opacity: 1; }
@keyframes cl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cl-head:hover .cl-dot::after, .cl-node.open .cl-dot::after { animation: none; } }

/* 封面爻印（站長 2026-11-21，B10）：「因果靈數」四字自己置中，爻印放大掛在左邊、不推動文字；傾斜只在 logo.svg（單一真相源） */
.gate-title { position: relative; display: inline-block; }
.gate-seal { position: absolute; right: 100%; top: 50%; translate: -.12em -50%; width: 1.6em; height: 1.6em;
  filter: drop-shadow(0 0 12px rgba(138, 49, 39, .4)); pointer-events: none; }
@media (max-width: 560px) { .gate-seal { width: 1.4em; height: 1.4em; translate: -.06em -50%; } } /* 站長 11-21：375 寬原本 1.05em 太小 */
.gate-art { cursor: pointer; }
.gate-art:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 50%; }

/* ===== 學說頁頂端：北斗九星（owner B12；js/beidou-view.js）=====
   深夜藍黑星空；星點平常是暖白，點了才轉成八星色（不先洩漏吉凶）。八星色沿用上方 .st-* 單一來源。 */
.bd-title { font-size: 1.75rem; letter-spacing: .18em; }
.bd-quote { margin: 16px 0; padding: 12px 16px; border-left: 2px solid var(--seal-deep); background: rgba(8, 6, 5, .45); }
.bd-quote blockquote { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text); letter-spacing: .04em; }
.bd-quote figcaption { margin-top: 4px; color: var(--accent); font-size: 1rem; }
.bd-quote figcaption::before { content: '出自 '; color: var(--muted); }
.bd-plain { margin: 6px 0 0; color: var(--muted); }
.bd-map { margin: 18px 0 10px; border: 1px solid rgba(201, 163, 78, .22); background: #05060c; line-height: 0; }
.bd-svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
.bd-pole { stroke: rgba(232, 226, 208, .16); stroke-width: 1.5; stroke-dasharray: 3 9; }
.bd-line, .bd-fu { stroke: rgba(232, 226, 208, .22); stroke-width: 2; }
.bd-fu { stroke-dasharray: 4 6; }
.bd-star { cursor: pointer; outline: none; }
.bd-hit { fill: transparent; }
.bd-halo { fill: var(--st); opacity: 0; filter: url(#bd-glow); transition: opacity .3s; }
.bd-core { fill: #f3ecd8; transform-box: fill-box; transform-origin: center; transition: fill .3s, transform .3s, opacity .3s;
  animation: bd-breathe var(--dur, 4s) ease-in-out var(--delay, 0s) infinite alternate; }
.bd-star.faint .bd-core { opacity: .35; animation: none; }
.bd-label { fill: rgba(236, 227, 210, .78); paint-order: stroke; stroke: #05060c; stroke-width: 7px; stroke-linejoin: round; font-size: 22px; text-anchor: middle; font-family: "Noto Serif TC", serif; letter-spacing: .08em; pointer-events: none; }
@keyframes bd-breathe { from { opacity: .62; } to { opacity: 1; } }
.sky-focus .bd-star:not(.picked) .bd-core { opacity: .4; }
.bd-tag { display: none; fill: rgba(236, 227, 210, .9); paint-order: stroke; stroke: #05060c; stroke-width: 9px; stroke-linejoin: round; font-size: 46px; font-weight: 700; font-family: "Noto Serif TC", serif; pointer-events: none; }
.bd-label-bx { font-weight: 700; }
.sky-focus .bd-star:not(.picked) .bd-label, .sky-focus .bd-star:not(.picked) .bd-tag { fill: rgba(236, 227, 210, .4); }
.bd-star.picked .bd-core { fill: var(--st); opacity: 1; transform: scale(1.7); animation: none; }
.bd-star.picked .bd-halo { opacity: .55; }
.bd-star.picked .bd-label, .bd-star.picked .bd-tag { fill: var(--st); font-weight: 700; }
.bd-star:focus-visible .bd-hit { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 5 5; }
.bd-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.bd-chip { font: inherit; font-size: 1rem; min-height: 44px; padding: 6px 12px; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 22px; cursor: pointer; }
.bd-chip[aria-pressed="true"] { color: var(--st); border-color: var(--st); background: color-mix(in srgb, var(--st) 12%, transparent); font-weight: 700; }
.bd-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bd-card { border: 1px solid var(--line); padding: 14px 16px; min-height: 96px; background: rgba(8, 6, 5, .5); }
.bd-card[class*="st-"] { border-color: color-mix(in srgb, var(--st) 45%, var(--line)); }
.bd-card p { margin: 6px 0; }
.bd-card-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 1.25rem; font-weight: 700; }
.bd-card-name b { font-size: 1.5rem; }
.bd-jun { color: var(--muted); font-size: 1rem; margin: 8px 0 0; }
.bd-maptitle { margin: 16px 0 8px; }
.bd-tablenote { font-size: 1rem; margin-top: 6px; }
.bd-skynote { font-size: 1rem; margin-top: 12px; }
.bd-essence { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.bd-yaorow { display: flex; align-items: center; gap: 14px; }
.bd-yaorow p { margin: 0; }
.bd-yaos { display: grid; gap: 5px; flex: none; }
.bd-yao { display: grid; grid-template-columns: 1.4em 46px; align-items: center; gap: 4px; }
.bd-yao em { font-style: normal; font-size: 0.9375rem; color: var(--muted); }
.bd-yao i { height: 7px; background: rgba(236, 227, 210, .22); }
.bd-yao.moved i { background: var(--st, var(--accent)); box-shadow: 0 0 8px color-mix(in srgb, var(--st, #d3b478) 60%, transparent); }
.bd-yao.moved em { color: var(--st, var(--accent)); font-weight: 700; }
.bd-intro { border-top: 1px solid var(--line); padding: 18px 0 8px; scroll-margin-top: 84px; }
.bd-intro h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 2px 0 4px; font-size: 1.375rem; color: var(--text); }
.bd-intro h3 b { font-size: 1.5rem; }
.bd-order { color: var(--accent); font-size: 1rem; letter-spacing: .12em; }
.badge.bd-good { color: var(--good); } .badge.bd-bad { color: var(--bad); }
.bd-four { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 10px 0; }
.bd-four dt { color: var(--accent); font-size: 1rem; padding-top: 2px; }
.bd-four dd { margin: 0; }
.bd-agree, .bd-example { margin: 10px 0; }
.bd-agree b, .bd-example b, .bd-yaorow b { color: var(--accent); font-weight: 700; }
.bd-intro .bd-yaorow { border-left: 2px solid color-mix(in srgb, var(--st) 50%, transparent); padding-left: 12px; margin: 10px 0; }
.bd-consensus { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.bd-h3 { margin: 20px 0 6px; color: var(--accent); font-size: 1.1875rem; letter-spacing: .1em; }
.primer-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.primer-steps li { padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.primer-steps li:last-child { border-bottom: 0; padding-bottom: 0; }
.primer-steps h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 1.1875rem; color: var(--text); }
.primer-no { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 50%; color: var(--accent); font: 700 0.9375rem/1 var(--num-font); }
.primer-steps p { margin: 4px 0; }
.primer-more { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.bd-chart { margin: 0; }
/* 八星傾向階表 (owner 11-21): a full grid (the 星 column used to have no left edge and read as hollow), every column
   centred so the star names sit under 「星＼階」. Numbers take their star's colour mixed into a warm grey, so the eight
   hues stay apart without glowing; the strongest step is the dimmest-safe one, never brighter than the page text. */
.bd-ttable { border: 1px solid var(--line); }
/* the h2 above already shows the title; the caption names the table for screen readers only */
.bd-ttable caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bd-ttable th, .bd-ttable td { text-align: center; font-family: var(--num-font); border: 1px solid var(--line); white-space: nowrap; }
.bd-ttable tbody th b { color: color-mix(in srgb, var(--st) 78%, #b3a998); }
.bd-ttable td.bd-step.s1 { color: color-mix(in srgb, var(--st) 50%, #9a917f); background: color-mix(in srgb, var(--st) 3%, transparent); }
.bd-ttable td.bd-step.s2 { color: color-mix(in srgb, var(--st) 58%, #a49a88); background: color-mix(in srgb, var(--st) 6%, transparent); }
.bd-ttable td.bd-step.s3 { color: color-mix(in srgb, var(--st) 66%, #aea492); background: color-mix(in srgb, var(--st) 9%, transparent); }
.bd-ttable td.bd-step.s4 { color: color-mix(in srgb, var(--st) 72%, #b3a998); background: color-mix(in srgb, var(--st) 12%, transparent); font-weight: 700; }
.bd-chart-note { margin: 10px 0 0; color: var(--muted); font-size: 1rem; }
.bd-ink { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; margin: 10px 0 4px; border-radius: 8px; } /* 3:2 wide ink picture fills the card width */
.bd-ink-sm { float: right; width: 96px; height: 96px; margin: 0 0 8px 12px; border-radius: 50%; }
.bd-examples { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.bd-examples li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.bd-ex-num { font-family: var(--num-font); font-weight: 700; min-width: 5.5em; letter-spacing: .05em; }
.bd-dots { display: inline-flex; gap: 4px; }
.bd-dots i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(211, 180, 120, .45); }
.bd-dots i.up { border-style: dashed; }
.bd-dots i.on { background: var(--accent); border-color: var(--accent); }
.bd-dots i.on.up { background: #f3ecd8; border-color: #f3ecd8; box-shadow: 0 0 6px rgba(243, 236, 216, .6); }
/* 九星一字（R15）：表、卡片標題的大字、0 與 5 的單爻。隱元（右弼）沒有吉凶，用淡銀色，不跟八星色撞。 */
.st-zerofive { --st: #b9c3cf; }
.bd-char { flex: none; width: 1.9em; height: 1.9em; border: 1px solid color-mix(in srgb, var(--st, var(--accent)) 55%, transparent);
  border-radius: 50%; font-size: 1.375rem; color: var(--st, var(--accent)); font-family: "Noto Serif TC", serif; }
.bd-intro h3 .bd-char { font-size: 1.5rem; }
.bd-name { font-size: 1.375rem; }
.bd-line { font-size: 1.1875rem; font-weight: 700; color: var(--text); margin: 8px 0; }
.badge.bd-none { color: var(--muted); }
.bd-yao.bd-one { grid-template-columns: 1.4em 46px; }
.bd-yin { display: flex; gap: 8px; background: none !important; box-shadow: none !important; }
.bd-yin b { flex: 1; height: 7px; background: rgba(236, 227, 210, .38); }
.bd-defchar b { font-size: 1.25rem; font-family: "Noto Serif TC", serif; }
.bd-notes { margin-top: 12px; }
.bd-origin { border-top: 1px solid var(--line); margin-top: 14px; }
.bd-origin p { margin: 8px 0; }
@media (max-width: 560px) {
  .bd-label { display: none; }
  .bd-tag { display: inline; }
  .bd-quote blockquote { font-size: 1.125rem; }
  .bd-four { grid-template-columns: 1fr; gap: 2px; }
  .bd-four dd { margin-bottom: 8px; }
  .bd-chip { flex: 1 1 calc(33% - 8px); padding: 6px 4px; font-size: 0.9375rem; }
  .bd-ttable { table-layout: fixed; }
  .bd-ttable th, .bd-ttable td { padding: 8px 1px; font-size: 0.9375rem; }
  .bd-ttable thead th:first-child, .bd-ttable tbody th { width: 3.6em; }
  .bd-intro .bd-yaorow { flex-direction: column; align-items: flex-start; gap: 8px; }
  .bd-yaos { grid-auto-flow: column; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .bd-core { animation: none; opacity: .9; }
  .bd-core, .bd-halo, .sky-line { transition: none; }
}
