/* final4（2026-11-21，裁決 8、12、13，visual.md §3–§4）：封面兩層與轉場、音效鈕、號碼圖（陰陽關係圖、能量柱）、
   分數儀表、結局光帶、命書章節色點、因果線四碼節、進階細算。顏色一律取 style.css 的 token 與 .st-* 色票。 */

/* ---------- 封面：八卦環與陰陽核心反向旋轉（方向每次隨機）；點了之後文字淡出、圖轉到中央放大、由中央圓形展開 ---------- */
.gate-art > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.ga-ring { animation: spin 90s linear infinite; }
.ga-core { width: 100% !important; height: 100% !important; inset: 0 !important; /* same frame as the ring; size set in hero-core.svg */ animation: spin 40s linear infinite reverse;
  filter: drop-shadow(0 0 22px rgba(201, 163, 78, .16)); }
.gate-art[data-dir="ccw"] .ga-ring { animation-direction: reverse; }
.gate-art[data-dir="ccw"] .ga-core { animation-direction: normal; }
.gate-art { transform-origin: 50% 50%; will-change: transform; }
.gate.leaving .gate-in > :not(.gate-art) { opacity: 0 !important; transition: opacity .35s ease; animation: none; }
.gate.leaving { overflow: hidden; }
.gate.leaving .gate-art { z-index: 2; }
.gate-sfx { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 14px; z-index: 3; }
.sfx-toggle { padding: 6px 10px; }
.sfx-toggle .ico { width: 20px; height: 20px; }
.sfx-toggle[aria-pressed="true"] { color: var(--muted); }
/* reduced motion: the art stands still in its upright (上南) position; must sit after the spin rules above, which
   otherwise override style.css's animation:none */
@media (prefers-reduced-motion: reduce) { .ga-ring, .ga-core { animation: none; } .gate.leaving .gate-in > :not(.gate-art) { transition: none; } }

/* ---------- 號碼圖：陽星列下面是弧線與陰星圈，再下面是能量柱 ---------- */
.ng { position: relative; }
.ng-arcs { grid-row: 4; grid-column: 1 / -1; width: 100%; height: .7em; display: block; overflow: visible; }
.ng-arc { fill: none; stroke: var(--st); stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: .75; transition: opacity .2s; }
.ng-arc.unscored { stroke-dasharray: 4 4; opacity: .55; }
.ng-yrow { grid-row: 5; grid-column: 1 / -1; position: relative; width: 100%; height: 1.15em; }
.ng-y { position: absolute; top: 0; transform: translateX(-50%); display: grid; place-items: center;
  width: 1.75em; height: 1.75em; padding: 0; border-radius: 50%; cursor: pointer; font: inherit; font-size: .62em; font-weight: 300;
  font-family: "Noto Serif TC", serif; line-height: 1; color: var(--st); background: var(--bg);
  border: 1px dashed color-mix(in srgb, var(--st) 80%, transparent); text-decoration: none; transition: transform .2s, box-shadow .2s, opacity .2s; }
.ng-y.unscored { border-style: dotted; }
.ng-y.strong { box-shadow: 0 0 8px color-mix(in srgb, var(--st) 45%, transparent); }
.ng-y.luck { background: color-mix(in srgb, var(--st) 22%, var(--bg)); }
.ng-y:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ng-mid { grid-row: 6; grid-column: 1 / -1; align-self: center; width: 100%; height: 1px; background: rgba(211, 180, 120, .28); }
.ng-e { grid-row: 6; justify-self: center; position: relative; width: .34em; height: 2.2em; transition: opacity .2s, filter .2s; }
.ng-e i { position: absolute; left: 0; right: 0; border-radius: 2px; background: var(--st); transform-origin: 50% 100%; }
.ng-e.up i { bottom: 50%; } .ng-e.down i { top: 50%; transform-origin: 50% 0; }
.ng-e.strong i { height: 48%; box-shadow: 0 0 9px color-mix(in srgb, var(--st) 70%, transparent); }
.ng-e.weak i { height: 22%; opacity: .7; }
.ng-e.down i { background: repeating-linear-gradient(var(--st) 0 3px, transparent 3px 5px); } /* 凶：虛柱（不只靠顏色，WCAG 1.4.1） */
.ng-e em { position: absolute; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .3em; line-height: 1; color: var(--st); white-space: nowrap; }
.ng-e.up.strong em { bottom: 100%; } .ng-e.down.strong em { top: 100%; }
.ng-e.up.weak em { bottom: 75%; } .ng-e.down.weak em { top: 75%; }
@media (prefers-reduced-motion: no-preference) {
  .ng-e i { animation: bar-in .5s cubic-bezier(.2, .8, .2, 1) both; }
  .ng-e:nth-of-type(2) i { animation-delay: .06s; } .ng-e:nth-of-type(3) i { animation-delay: .12s; } .ng-e:nth-of-type(4) i { animation-delay: .18s; }
  .ng-e:nth-of-type(5) i { animation-delay: .24s; } .ng-e:nth-of-type(6) i { animation-delay: .3s; } .ng-e:nth-of-type(7) i { animation-delay: .36s; }
}
@keyframes bar-in { from { transform: scaleY(0); } to { transform: none; } }
/* focus + context：點了的那幾顆亮，其他淡到 40% */
.ng.focus .ng-s:not(.hl), .ng.focus .ng-y:not(.hl), .ng.focus .ng-e:not(.hl), .ng.focus .ng-arc:not(.hl), .ng.focus .ng-d:not(.hl), .ng.focus .ng-g:not(.hl) { opacity: .4; }
/* 點星時它讀的數字與卦一起亮（站長 2026-11-20）：數字發光、卦加光暈，其他淡到 40% */
.ng-d, .ng-g { transition: opacity .2s, text-shadow .2s, filter .2s; }
.ng .ng-d.hl { color: #fff3d6; text-shadow: 0 0 14px rgba(211, 180, 120, .85), 0 0 3px rgba(211, 180, 120, .6); }
.ng .ng-g.hl { filter: drop-shadow(0 0 5px rgba(211, 180, 120, .8)); }
.ng .ng-arc.hl { opacity: 1; stroke-width: 2.5; }
.ng .ng-y.hl { transform: translateX(-50%) scale(1.12); background: color-mix(in srgb, var(--st) 18%, var(--bg)); border-style: solid; box-shadow: 0 0 12px color-mix(in srgb, var(--st) 70%, transparent); }
.ng .ng-e.hl { filter: drop-shadow(0 0 6px var(--st)); }
.ng-cap { margin: 0 4px; font-size: 1rem; line-height: 1.7; color: var(--text); border-left: 2px solid var(--accent); padding-left: .7em; }
.ng-legend { margin: 0 4px; font-size: 0.9375rem; line-height: 1.7; color: var(--muted); }

/* ---------- 分數儀表、結局光帶、生天延星芒 ---------- */
.gauges { display: flex; justify-content: center; gap: 22px; margin: 14px 0 6px; }
.gauge { margin: 0; width: 132px; text-align: center; position: relative; }
.gauge svg { width: 100%; height: auto; display: block; }
.g-track, .g-val { fill: none; stroke-width: 7; stroke-linecap: round; }
.g-track { stroke: rgba(211, 180, 120, .16); }
.g-val { stroke: var(--accent); filter: drop-shadow(0 0 4px rgba(211, 180, 120, .45)); }
.gauge figcaption { margin-top: -34px; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.gauge figcaption b.score { font-size: 1.875rem; color: #f1e6cc; }
.gauge figcaption span { font-size: 0.9375rem; color: var(--muted); letter-spacing: .2em; text-indent: .2em; }
.stats .sty { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }
.stats .sty .ico { fill: currentColor; stroke: none; width: 16px; height: 16px; }
.verdict.band { display: flex; align-items: center; gap: 14px; text-align: left; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-left: 4px solid var(--st); box-shadow: inset 14px 0 22px -16px var(--st); font-weight: 500; line-height: 1.7; }
.v-seal { flex: none; width: 1.85em; height: 1.85em; border: 1px solid var(--st); color: var(--st);
  font-size: 1.5rem; font-weight: 900; border-radius: 4px; text-shadow: 0 0 10px color-mix(in srgb, var(--st) 50%, transparent); }

/* 延年的銀白太接近正文，星名加一圈冷光（visual.md §2.3） */
b.st-yannian, span.st-yannian:not(.chip) { text-shadow: 0 0 8px rgba(226, 228, 232, .35); }

/* ---------- 命書章節：主星色點；讀過的章號變暗 ---------- */
.rd-dot { width: 9px; height: 9px; margin-top: 12px; border-radius: 50%; background: var(--st, transparent); box-shadow: 0 0 8px color-mix(in srgb, var(--st, transparent) 60%, transparent); }
.rd-ch.read:not([open]) .rd-no { color: var(--muted); opacity: .7; }

/* ---------- 因果線四碼節 ---------- */
.cl-carry { font-size: 0.9375rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; margin-right: 2px; }
.cl-yline { grid-column: 2; font-size: 1rem; color: var(--muted); }
.cl-yline .cl-ytag { margin-right: 0; font-weight: 300; }
.cl-k { display: inline-block; min-width: 4.5em; margin-right: 8px; font-size: 0.9375rem; color: var(--accent); letter-spacing: .1em; }
.cl-body p { margin: 0 0 8px; line-height: 1.75; }
.cl-tris { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.cl-tri { display: grid; gap: 2px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; }
.cl-tri > span:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.cl-tri small { font-size: 0.9375rem; }
.cl-tri-text { font-size: 1.0625rem; line-height: 1.7; }
.cl-node.open .cl-dot::before { content: ""; position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 70%, var(--st));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
  animation: cl-spin 3s linear infinite; }
.cl-node.open .cl-dot { box-shadow: 0 0 0 4px var(--surface), 0 0 22px color-mix(in srgb, var(--st) 70%, transparent); }
@media (max-width: 560px) { .cl-list { padding-left: 8px; } .cl-list::before { left: calc(8px + .9375rem - 1px); } .cl-yline { grid-column: 2; } }
@media (prefers-reduced-motion: reduce) { .cl-node.open .cl-dot::before { animation: none; } .ng-e i { animation: none; } }

/* ---------- 進階細算 ---------- */
.adv-toggle { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adv-toggle::after { content: '＋'; color: var(--accent); }
.adv-toggle[aria-expanded="true"]::after { content: '－'; }
.ng-rows { margin: 0 0 6px; text-align: center; font-size: 0.9375rem; color: var(--muted); line-height: 1.6; }
.adv-tag { font-size: 0.9375rem; color: var(--muted); letter-spacing: .04em; font-weight: 400; }
.adv-panel { display: flex; flex-direction: column; gap: 14px; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; }
.adv-panel input[type="date"] { letter-spacing: .04em; min-height: 52px; }
.gender-seg.locked button:disabled { cursor: not-allowed; opacity: .55; }
.gender-seg.locked button[aria-pressed="true"]:disabled { opacity: 1; }
.adv-box { border: 1px dashed var(--line); border-radius: 10px; padding: 4px 14px; }
.adv-box summary { cursor: pointer; padding: 10px 0; color: var(--accent); font-size: 1.0625rem; }
.adv-box[open] { padding-bottom: 14px; }
.adv-box .hint { margin-bottom: 10px; }
.adv-table td.adv-num { font-family: var(--num-font); letter-spacing: .06em; }
.adv-table td.adv-stars span { font-weight: 700; }
.adv-table small { font-size: 0.9375rem; margin-left: 4px; }
.rd-adv h3 small { font-size: 0.9375rem; font-weight: 400; margin-left: 6px; }
@media (max-width: 640px) {
  .adv-table thead { display: none; }
  .adv-table, .adv-table tbody, .adv-table tr, .adv-table th, .adv-table td { display: block; width: 100%; white-space: normal; }
  .adv-table tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
  .adv-table th, .adv-table td { border: 0; padding: 2px 0; }
}
.cl-head > .cl-sum, .cl-head > .cl-line1 { grid-column: 2; }
/* 375px header: brand, sound, history and language must fit on one line */
@media (max-width: 560px) {
  .top-actions { gap: 6px; }
  .pill.lang .sel-btn > span { display: none; }
  .pill.lang { padding: 6px 10px; }
  .top .sfx-toggle { padding: 6px 8px; }
}

/* ===== ui5（站長 2026-11-21）：號碼圖點擊不變形、說明就地顯示、因果線獨立在上、呼吸感 ===== */

/* 陽星是按鈕：點了就地顯示說明。亮起來只改光暈與底色，不放大、不位移（以前整格放大 1.25 倍，弧線跟著從圖的左上角被拉歪） */
.ng-s { grid-row: 3; font: inherit; font-size: .66em; font-weight: 700; font-family: "Noto Serif TC", serif; line-height: 1; color: var(--st, var(--text));
  background: transparent; border: 1px solid transparent; border-radius: 999px; padding: .08em .32em; margin-top: .15em; cursor: pointer;
  transition: opacity .2s, background-color .2s, box-shadow .2s; -webkit-tap-highlight-color: transparent; }
.ng-s:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ng .ng-s.hl { background: color-mix(in srgb, var(--st) 16%, transparent); border-color: color-mix(in srgb, var(--st) 55%, transparent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--st) 70%, transparent); }
.ng .ng-arc.hl { opacity: 1; stroke-width: 2.5; }
.ng-arc { transform: none; }

/* 呼吸：號碼、卦、陽星、弧線、陰星、能量柱之間留白 */
.ng { row-gap: .3em; margin: 10px auto 18px; }
.ng-arcs { height: 1em; margin-top: .1em; }
.ng-yrow { height: 1.3em; }
.ng-e { margin-top: .35em; }

/* 點星的說明：就在號碼圖下面 */
.ng-cap { margin: 2px 4px 4px; padding: 14px 16px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  background: rgba(0, 0, 0, .28); font-size: 1rem; line-height: 1.75; }
.ng-cap p { margin: 0 0 8px; }
.ng-cap p:last-child { margin-bottom: 0; }
.ng-cap .ng-cap-t { font-size: 1.0625rem; font-weight: 700; color: var(--text); }
.ng-cap .ng-cap-sec { font-size: .9375rem; color: var(--accent); letter-spacing: .08em; }
.ng-legend { margin-top: 6px; }

/* 版面呼吸感（站長「都黏在一起」）：卡片之間、標題與內文、清單每一列都多留一點 */
.card { margin-bottom: 28px; padding: 26px 24px; }
@media (max-width: 560px) { .card { padding: 22px 18px; margin-bottom: 24px; } }
.card h3 { margin-bottom: 16px; }
.summary { gap: 18px; }
.rd-lines li { padding: 16px 0; }
.rd-ch > summary { padding: 20px 2px; }
.rd-cb { padding-bottom: 22px; }
.rd-cb > p, .rd-cb > dl, .rd-cb > ul { margin-bottom: 14px; }
.rd-road { margin-bottom: 22px; }
.rd-list li { padding: 12px 0; }
.rd-bad { padding: 14px 0; }

/* 因果線：獨立一張卡，放在號碼正下方 */
.rd-causal { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.rd-causal > h3 { font-size: 1.375rem; letter-spacing: .3em; }
.rd-causal > .muted { margin: 0 0 6px; }
.cl-tip { margin: 0 0 4px; font-size: 1rem; color: var(--muted); line-height: 1.75; }
.cl-list { margin-top: 18px; }
.cl-node { padding-bottom: 24px; }
.cl-node:last-child { padding-bottom: 4px; }
.cl-body { margin-top: 12px; padding: 14px 16px; }
.cl-sum { margin-top: 4px; }

/* 頁首只剩音效（B16 拔掉 Aa）：44px 觸控區 */
.top .pill.sfx-toggle { min-height: 44px; min-width: 44px; justify-content: center; }
/* 換介面大小時只有畫面上那一段要重排：畫面外的長段落先跳過（以前每換一級整頁重排，約一秒，拖起來就卡） */
#result > *, #match-result > *, #rank-result > *, #foundation > *, #doctrine-list > *, #home-cta, .foot { content-visibility: auto; contain-intrinsic-size: auto 600px; }
/* 頁首品牌、頁首按鈕與底部主選單維持原尺寸（同翻譯產品：品牌字不隨介面大小長大），內文才放大；否則 150% 時品牌撞到音效鈕、主選單字斷成兩行 */
.top .brand-zh { font-size: calc(1.375rem / var(--ui-text-scale, 1)); }
.top .brand-en { font-size: calc(.9375rem / var(--ui-text-scale, 1)); }
.top .pill { font-size: calc(1rem / var(--ui-text-scale, 1)); }
.dock .lb { font-size: calc(.9375rem / var(--ui-text-scale, 1)); }
@media (max-width: 400px) { .top .brand-zh { font-size: calc(1.25rem / var(--ui-text-scale, 1)); } }
/* 封面一屏看得完（一窺因果鈕原本在 375×812 剛好壓在底邊、1280×800 要往下捲才看得到） */
.gate-art { width: min(560px, 80vw, 36vh); }
.gate-in { padding: 16px 20px 24px; }


/* ---------- 因果線五格（final8）：星名列、一句傾向、生活場景、兩面、順逆；「為什麼」淡一行 ---------- */
.cl-names { color: var(--muted); font-size: 0.9375rem; letter-spacing: .04em; }
.cl-core { font-size: 1.125rem; font-weight: 700; color: var(--text); }
.cl-body > .cl-core { display: none; } /* the head's cl-sum already says it; kept in the markup for the number picture's caption */
.cl-cell { line-height: 1.8; }
.cl-under { font-weight: 300; text-decoration: underline dashed var(--muted); text-underline-offset: 6px; text-decoration-thickness: 1px; }
.cl-pair2 { display: grid; gap: 0 18px; padding-top: 6px; border-top: 1px dashed var(--line); }
@media (min-width: 760px) { .cl-pair2 { grid-template-columns: 1fr 1fr; } }
.cl-body .rd-why { display: block; margin-top: 6px; font-size: 0.9375rem; line-height: 1.7; color: var(--muted); }
.cl-node.dp-hit:not(.open) .cl-dot { box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px color-mix(in srgb, var(--st) 65%, transparent); }

/* ---------- 號碼頁的北斗小圖（final8 verdict 5）：靜態索引，點了才亮；只有按「走一遍」才動 ---------- */
.st-zf { --st: #d9cfb8; }
.dp { margin: 6px 0 16px; }
.dp-mini { display: block; width: 100%; max-width: 480px; height: auto; margin: 0 auto; background: #05060c; border: 1px solid rgba(201, 163, 78, .22); border-radius: 8px; }
.dp-line { stroke: rgba(232, 226, 208, .2); stroke-width: 3; }
.dp-fu { stroke: rgba(232, 226, 208, .2); stroke-width: 2.5; stroke-dasharray: 6 8; }
/* 北斗圖選取（B16；js/skymap.js，學說大圖與號碼小圖共用）：點的那顆與相連的線亮，其他線變暗但留著 */
.sky-line { transition: stroke .25s, opacity .25s; }
.sky-focus .sky-line { opacity: .35; }
.sky-focus .sky-line.lit { opacity: 1; stroke: var(--accent); }
.dp-star.picked .dp-core { transform: scale(1.4); fill: var(--st); }
.dp-star.picked .dp-halo { opacity: .55; }
.dp-path { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; opacity: .75; }
.dp-star { cursor: pointer; }
.dp-hit { fill: transparent; }
.dp-core { fill: rgba(243, 236, 216, .22); transform-box: fill-box; transform-origin: center; transition: opacity .25s, transform .25s; }
.dp-ring { fill: none; stroke: transparent; stroke-width: 3.5; }
.dp-halo { fill: var(--st); opacity: 0; transition: opacity .25s; }
.dp-star.has .dp-core { fill: var(--st); }
.dp-star.yin .dp-ring, .dp-star.on-yin .dp-ring { stroke: var(--st); stroke-dasharray: 7 6; }
.dp-zf { fill: var(--muted); font-size: 34px; text-anchor: middle; font-family: "Noto Serif TC", serif; pointer-events: none; }
.dp.sel .dp-star:not(.on):not(.on-yin) { opacity: .28; }
.dp-star.on .dp-core { transform: scale(1.4); fill: var(--st); }
.dp-star.on .dp-halo { opacity: .4; }
.dp-star.end .dp-halo { opacity: .7; }
.dp-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.dp-chip { min-height: 44px; padding: 6px 4px; font: inherit; font-size: 1rem; line-height: 1.3; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; word-break: keep-all; }
.dp-chip.has { color: var(--st); border-color: color-mix(in srgb, var(--st) 45%, transparent); }
.dp-chip.yin { color: var(--st); border-style: dashed; border-color: color-mix(in srgb, var(--st) 60%, transparent); font-weight: 300; }
.dp-chip[aria-pressed="true"] { color: var(--st); border-color: var(--st); background: color-mix(in srgb, var(--st) 14%, transparent); font-weight: 700; }
.dp-chip small { margin-left: 4px; font-size: 0.9375rem; }
.dp-chip:focus-visible, .dp-play:focus-visible, .dp-first:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dp-bar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.dp-cap { flex: 1 1 240px; margin: 0; font-size: 1.0625rem; line-height: 1.75; min-height: 1.75em; }
.dp-play, .dp-first { min-height: 44px; padding: 6px 16px; font: inherit; font-size: 1rem; color: var(--accent); background: transparent;
  border: 1px solid rgba(211, 180, 120, .45); border-radius: 999px; cursor: pointer; }
.dp-first { margin-top: 6px; }
.dp.walking .dp-play { background: rgba(211, 180, 120, .14); }
.dp-steps { margin: 10px 0 0; padding-left: 1.6em; line-height: 1.8; font-size: 1.0625rem; }
.dp-steps li { color: var(--st, var(--text)); }
@media (prefers-reduced-motion: reduce) { .dp-core, .dp-halo, .sky-line { transition: none; } }
