/* 命理交叉驗證：iOS 規格。顏色、字級都照 SPEC2，不加裝飾。 */
:root {
  --bg: #F2F2F7; --card: #FFFFFF; --label: #000000; --label2: rgba(60,60,67,.6); --label3: rgba(60,60,67,.3);
  --sep: rgba(60,60,67,.29); --fill: rgba(118,118,128,.12); --press: #D1D1D6; --chev: #C4C4C6;
  --accent: #1F7A4D; --accent-soft: rgba(31,122,77,.1); --on-accent: #FFFFFF;
  --ochre: #9A6B00; --ochre-soft: rgba(154,107,0,.12); --red: #D70015; --red-soft: rgba(215,0,21,.09);
  --bar: rgba(249,249,249,.94); --tab-off: #8E8E93; --thumb: #FFFFFF; --back: rgba(0,0,0,.4); --bubble: #E9E9EB;
  --ease: cubic-bezier(.32,.72,0,1);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --nav-h: calc(44px + var(--sat)); --tab-h: calc(49px + var(--sab));
  --font: -apple-system, "SF Pro Text", "PingFang TC", "Microsoft JhengHei UI", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --card: #1C1C1E; --label: #FFFFFF; --label2: rgba(235,235,245,.6); --label3: rgba(235,235,245,.3);
    --sep: rgba(84,84,88,.65); --fill: rgba(118,118,128,.24); --press: #2C2C2E; --chev: rgba(235,235,245,.3);
    --accent: #30D158; --accent-soft: rgba(48,209,88,.16); --on-accent: #000000;
    --ochre: #E3AE3C; --ochre-soft: rgba(227,174,60,.16); --red: #FF453A; --red-soft: rgba(255,69,58,.16);
    --bar: rgba(29,29,31,.94); --tab-off: #98989D; --thumb: #636366; --back: rgba(0,0,0,.6); --bubble: #26252A;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --card: #1C1C1E; --label: #FFFFFF; --label2: rgba(235,235,245,.6); --label3: rgba(235,235,245,.3);
  --sep: rgba(84,84,88,.65); --fill: rgba(118,118,128,.24); --press: #2C2C2E; --chev: rgba(235,235,245,.3);
  --accent: #30D158; --accent-soft: rgba(48,209,88,.16); --on-accent: #000000;
  --ochre: #E3AE3C; --ochre-soft: rgba(227,174,60,.16); --red: #FF453A; --red-soft: rgba(255,69,58,.16);
  --bar: rgba(29,29,31,.94); --tab-off: #98989D; --thumb: #636366; --back: rgba(0,0,0,.6); --bubble: #26252A;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--label); font: 400 17px/22px var(--font); overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
#app { position: relative; width: 100%; max-width: 720px; height: 100%; height: 100dvh; margin: 0 auto; overflow: hidden; background: var(--bg); }
@media (min-width: 721px) { #app { border-left: .5px solid var(--sep); border-right: .5px solid var(--sep); } }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; touch-action: manipulation; }
button:disabled { cursor: default; }
input, textarea { font: inherit; color: inherit; }
p, h1, h2, h3, h4 { margin: 0; font-weight: inherit; font-size: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
[hidden] { display: none !important; }
.ic { display: block; flex: none; }

/* ---- 分頁和導覽 ---- */
.tab-views { position: absolute; inset: 0; }
.tab-view { position: absolute; inset: 0; visibility: hidden; }
.tab-view.on { visibility: visible; }
.stack { position: absolute; inset: 0; overflow: hidden; }
.page { position: absolute; inset: 0; background: var(--bg); visibility: inherit; contain: layout paint; }
.page.is-under { visibility: hidden; }
.page.moving { box-shadow: -.5px 0 0 var(--sep); }
.page-dim { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 20; }
.edge { position: absolute; left: 0; top: var(--nav-h); bottom: var(--tab-h); width: 20px; z-index: 15; touch-action: pan-y; }
.scroller { position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: calc(var(--tab-h) + var(--footer-h, 0px) + 32px); }
.nav-spacer { height: var(--nav-h); }
.nb-sentinel { height: 1px; }

.navbar { position: absolute; top: 0; left: 0; right: 0; z-index: 10; height: var(--nav-h); padding-top: var(--sat); display: flex; align-items: center; }
.navbar.collapsed { background: var(--bar); box-shadow: 0 .5px 0 var(--sep); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.nb-left, .nb-right { position: relative; z-index: 1; flex: 1 1 0; min-width: 0; display: flex; align-items: center; height: 44px; }
.nb-right { justify-content: flex-end; padding-right: 8px; gap: 4px; }
.nb-title { flex: 0 1 auto; max-width: 56%; font-weight: 600; font-size: 17px; line-height: 22px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .2s; }
.navbar.is-large .nb-title { opacity: 0; }
.navbar.is-large.collapsed .nb-title { opacity: 1; }
.nb-back { display: flex; align-items: center; gap: 0; color: var(--accent); height: 44px; padding: 0 8px 0 4px; min-width: 44px; max-width: 100%; }
.nb-back:active { opacity: .4; }
.nb-back-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: -2px; }
.nb-ic { color: var(--accent); width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.nb-ic:active { opacity: .4; }
.nb-txt { color: var(--accent); height: 44px; padding: 0 8px; }
.nb-txt:active { opacity: .4; }
.nb-txt:disabled { color: var(--label3); }
.large-title { font-weight: 700; font-size: 34px; line-height: 41px; letter-spacing: .01em; padding: 3px 16px 8px; overflow-wrap: anywhere; }
.page-body { min-width: 0; }
.page-footer { position: absolute; left: 0; right: 0; bottom: var(--tab-h); z-index: 9; }
.page-footer:empty { display: none; }

.tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; height: var(--tab-h); padding-bottom: var(--sab); display: flex; background: var(--bar); box-shadow: 0 -.5px 0 var(--sep); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.kb-open .tabbar { display: none; }
.kb-open .page-footer { bottom: 0; }
.tab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 5px; color: var(--tab-off); gap: 1px; }
.tab.on { color: var(--accent); }
.tab-l { font-size: 10px; line-height: 12px; font-weight: 500; }

/* ---- 清單 ---- */
.group { margin: 0 0 35px; }
.group-h { font-size: 13px; line-height: 18px; font-weight: 400; color: var(--label2); padding: 0 32px 7px; }
.group-f { font-size: 13px; line-height: 18px; color: var(--label2); padding: 7px 32px 0; overflow-wrap: anywhere; }
.group-f.solo { padding: 0 32px 24px; }
.page-body > .group:first-child, .page-body > div:first-child > .group:first-child, .sheet-stack > .group:first-child { margin-top: 10px; }
.list { margin: 0 16px; background: var(--card); border-radius: 10px; overflow: hidden; }
.list > * { position: relative; }
.list > * + *::before, .rest > * + *::before, .rest > *:first-child::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); z-index: 1; }
.rest > * { position: relative; }

.row { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 11px 16px; font-size: 17px; line-height: 22px; min-width: 0; }
button.row.tap:active { background: var(--press); }
.row.active .row-value { color: var(--accent); }
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.row-title { min-width: 0; }
.row-sub { font-size: 15px; line-height: 20px; color: var(--label2); }
.row-value { flex: 0 1 auto; min-width: 0; max-width: 62%; color: var(--label2); text-align: right; overflow-wrap: anywhere; }
.row.stacked .row-main { gap: 3px; }
.row.row-accent, .row.row-accent .row-title { color: var(--accent); }
.row.more .row-title { color: var(--accent); }
.row.muted .row-title { color: var(--label2); }
.row.row-center { justify-content: center; }
.row.row-center .row-main { flex: 0 1 auto; align-items: center; color: var(--accent); }
.chev { color: var(--chev); flex: none; margin-right: -4px; }
.dis-chev { transition: transform .28s var(--ease); }
.dis-chev.turned { transform: rotate(90deg); }
.dis-body { padding: 0 16px 13px; font-size: 15px; line-height: 21px; color: var(--label2); overflow-wrap: anywhere; }
.dis-body p + p, .dis-body .kv + p { margin-top: 6px; }
.kv { display: flex; flex-direction: column; gap: 1px; padding: 5px 0; }
.kv-k { color: var(--label); font-size: 15px; }
.kv-v { font-size: 13px; line-height: 18px; }
.exp { height: 0; overflow: hidden; transition: height .32s var(--ease); }
.exp-in { display: flow-root; }
.person-sub { display: flex; flex-direction: column; gap: 1px; }
.pillars { color: var(--label); }
.st { display: inline-flex; align-items: center; flex: none; color: var(--label2); font-size: 15px; }
.st.ok { color: var(--accent); }
.mini-btn { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--fill); color: var(--accent); font-size: 15px; font-weight: 600; }
.mini-btn:active { opacity: .5; }

/* ---- 分段控制 ---- */
.seg { position: relative; display: flex; height: 32px; padding: 2px; background: var(--fill); border-radius: 9px; }
.seg-thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / var(--n)); background: var(--thumb); border-radius: 7px; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); transition: transform .3s var(--ease); }
.seg-btn { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; line-height: 18px; font-weight: 500; white-space: nowrap; }
.seg-btn span { position: relative; }
.seg-btn.sel { font-weight: 600; }
.seg-btn + .seg-btn::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; border-left: 1px solid var(--sep); opacity: .55; transition: opacity .2s; }
.seg-btn.sel::before, .seg-btn.sel + .seg-btn::before { opacity: 0; }
.seg-block { padding: 0 16px 12px; }
.seg-block.slim { padding-top: 0; }
.seg-sub { width: 176px; height: 28px; font-size: 12px; }
.seg-sub .seg-btn { font-size: 12px; }
.seg-inline { flex: none; width: 112px; }
.seg-inline.wide { width: 148px; }

/* ---- 開關 ---- */
.sw { position: relative; flex: none; display: inline-block; width: 51px; height: 31px; }
.sw-in { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.sw-track { position: absolute; inset: 0; border-radius: 31px; background: var(--fill); transition: background .25s; pointer-events: none; }
.sw-thumb { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #FFF; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 3px 1px rgba(0,0,0,.06); transition: transform .28s var(--ease); }
.sw-in:checked + .sw-track { background: var(--accent); }
.sw-in:checked + .sw-track .sw-thumb { transform: translateX(20px); }
.sw-in:focus-visible + .sw-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 按鈕、標籤 ---- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 17px; text-align: center; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.plain { background: var(--fill); color: var(--accent); }
.btn:active { opacity: .7; }
.btn:disabled { opacity: .35; }
.btn-s { font-weight: 400; font-size: 15px; opacity: .85; }
.cta { padding: 0 16px 35px; }
.tag { display: inline-block; flex: none; padding: 1px 8px; border-radius: 6px; font-size: 13px; line-height: 18px; font-weight: 600; }
.tag.ok { color: var(--accent); background: var(--accent-soft); }
.tag.mid { color: var(--ochre); background: var(--ochre-soft); }
.tag.bad { color: var(--red); background: var(--red-soft); }
.tag.solo { color: var(--label2); background: var(--fill); }
.empty { padding: 56px 32px 24px; text-align: center; color: var(--label2); font-size: 15px; line-height: 21px; }
.empty .btn { margin-top: 20px; }
.toast { position: absolute; left: 50%; bottom: calc(var(--tab-h) + 64px); transform: translateX(-50%); z-index: 400; width: max-content; max-width: calc(100% - 48px); padding: 9px 16px; border-radius: 20px; background: #2C2C2E; color: #FFF; font-size: 15px; line-height: 20px; text-align: center; pointer-events: none; }

/* ---- 輸入 ---- */
.field { display: block; width: 100%; min-width: 0; background: none; border: 0; padding: 0; font-size: 17px; line-height: 22px; }
.field::placeholder { color: var(--label3); }
.row-field .row-main { flex: none; }
.row-field .field { flex: 1 1 auto; text-align: right; }
.list > .row-field > .field:only-child { text-align: left; }
.area { resize: none; }
.area-wrap { margin: 8px 16px 24px; padding: 11px 16px; background: var(--card); border-radius: 10px; }

/* ---- 滾輪 ---- */
.wheel-holder { padding: 0 8px 8px; }
.wheel { position: relative; display: flex; height: calc(var(--wh) * var(--rows)); margin: 0 8px; user-select: none; -webkit-user-select: none; }
.wheel-band { position: absolute; left: 0; right: 0; top: calc(var(--wh) * ((var(--rows) - 1) / 2)); height: var(--wh); border-radius: 8px; background: var(--fill); pointer-events: none; }
.wcol { position: relative; flex: 1 1 0; min-width: 0; height: 100%; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y mandatory; scrollbar-width: none; padding: calc(var(--wh) * ((var(--rows) - 1) / 2)) 0; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 34%, #000 66%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 34%, #000 66%, transparent 100%); cursor: grab; }
.wcol::-webkit-scrollbar { display: none; }
.wi { height: var(--wh); line-height: var(--wh); text-align: center; scroll-snap-align: center; scroll-snap-stop: always; font-size: 17px; font-variant-numeric: tabular-nums; color: var(--label2); white-space: nowrap; overflow: hidden; }
.wi.sel { color: var(--label); }

/* ---- sheet ---- */
.sheet-root { position: absolute; inset: 0; z-index: 200; }
.sheet-back { position: absolute; inset: 0; background: var(--back); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - var(--sat) - 44px); display: flex; flex-direction: column; background: var(--bg); border-radius: 13px 13px 0 0; overflow: hidden; }
.sheet.full { height: calc(100% - var(--sat) - 44px); }
.sheet-head { flex: none; position: relative; touch-action: none; cursor: grab; padding-top: 5px; }
.grabber { width: 36px; height: 5px; border-radius: 2.5px; background: var(--label3); margin: 0 auto; }
.sheet-bar { display: flex; align-items: center; height: 44px; }
.sb-l, .sb-r { flex: 1 1 0; min-width: 0; display: flex; }
.sb-r { justify-content: flex-end; }
.sb-t { flex: 0 1 auto; max-width: 60%; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-act { color: var(--accent); height: 44px; padding: 0 16px; white-space: nowrap; }
.sh-act.strong { font-weight: 600; }
.sh-act:active { opacity: .4; }
.sh-act:disabled { color: var(--label3); }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(var(--sab) + 24px); }
.sheet-stack { padding-top: 8px; }
.sheet-stack .group { margin-bottom: 28px; }
.ask-sheet { padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.ask-msg { font-size: 15px; line-height: 21px; color: var(--label2); padding: 0 8px 8px; }
.prose-row { padding: 11px 16px; font-size: 17px; line-height: 24px; overflow-wrap: anywhere; }

/* ---- 個人頁 ---- */
.person-line { padding: 0 16px 14px; font-size: 15px; line-height: 20px; color: var(--label2); overflow-wrap: anywhere; }
.inline-info { display: inline-flex; vertical-align: -3px; margin-left: 4px; color: var(--accent); padding: 0 2px; }
.inline-warn { display: inline; margin-left: 6px; color: var(--ochre); font-size: 15px; line-height: 20px; font-weight: 500; }
.ys-wrap { position: sticky; top: var(--nav-h); z-index: 5; background: var(--bg); margin-bottom: 12px; box-shadow: 0 .5px 0 var(--sep), 0 -.5px 0 var(--sep); }
.ys { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; cursor: grab; }
.ys::-webkit-scrollbar { display: none; }
.ys-track { position: relative; }
.ys-bands { position: relative; height: 22px; }
.ys-band { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; font-size: 12px; line-height: 16px; color: var(--label2); white-space: nowrap; }
.ys-band + .ys-band { border-left: .5px solid var(--sep); }
.ys-band.on { color: var(--accent); font-weight: 600; }
.ys-band-t { position: sticky; left: 8px; padding: 0 8px; }
.ys-cells { display: flex; padding-bottom: 6px; }
.ys-cell { flex: none; width: 58px; padding: 3px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 0; border-radius: 10px; }
.ys-y { font-size: 12px; line-height: 16px; color: var(--label2); font-variant-numeric: tabular-nums; }
.ys-gz { font-size: 17px; line-height: 22px; font-weight: 600; }
.ys-a { font-size: 12px; line-height: 16px; color: var(--label2); }
.ys-cell.now:not(.sel) .ys-y { color: var(--accent); font-weight: 600; }
.ys-cell.sel { background: var(--accent); color: var(--on-accent); }
.ys-cell.sel .ys-y, .ys-cell.sel .ys-a { color: var(--on-accent); opacity: .85; }
.chart-wrap { padding: 0 16px 28px; }
.chart-hint { font-size: 13px; line-height: 18px; color: var(--label2); padding: 7px 16px 0; }
.men-content { min-width: 0; }

/* 八字表 */
.bz { display: grid; grid-template-columns: 30px repeat(6, minmax(0, 1fr)); background: var(--card); border-radius: 10px; overflow: hidden; padding: 4px 0 6px; }
.bz-h, .bz-l, .bz-c { min-width: 0; display: flex; align-items: center; justify-content: center; text-align: center; }
.bz-h { font-size: 12px; line-height: 16px; color: var(--label2); padding: 7px 0 5px; }
.bz-l { font-size: 12px; line-height: 16px; color: var(--label2); padding-left: 6px; border-top: .5px solid var(--sep); }
.bz-c { border-top: .5px solid var(--sep); padding: 5px 0; font-size: 12px; line-height: 16px; }
.bz-h.flow { color: var(--accent); }
.bz-c.big { font-size: 26px; line-height: 32px; font-weight: 400; padding: 3px 0; }
.bz-c.small { color: var(--label2); }
.bz-c.dm { color: var(--accent); font-weight: 600; }
.bz-c.hid { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; padding: 6px 0; }
.hid-l { display: flex; justify-content: center; align-items: baseline; gap: 2px; font-size: 12px; line-height: 15px; white-space: nowrap; }
.hid-l b { font-weight: 500; }
.hid-l span { color: var(--label2); font-size: 11px; }
.bz-c.none { color: var(--label2); font-size: 12px; }
.bz > :nth-child(7n + 6) { box-shadow: -.5px 0 0 var(--sep); }
/* 交運那一年多一欄：交運前、交運後 */
.bz.two-yun { grid-template-columns: 30px repeat(7, minmax(0, 1fr)); }
.bz.two-yun > :nth-child(7n + 6) { box-shadow: none; }
.bz.two-yun > :nth-child(8n + 6) { box-shadow: -.5px 0 0 var(--sep); }
.bz.two-yun .bz-c.big { font-size: 22px; }

/* 紫微方盤 */
.zr { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(128px, auto)); grid-auto-rows: 1fr; background: var(--card); border-radius: 10px; overflow: hidden; }
.zp { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; padding: 5px 5px 4px; box-shadow: inset -.5px -.5px 0 var(--sep); text-align: left; transition: background .15s; }
.zp:active { background: var(--press); }
.zp.rel { background: var(--accent-soft); }
.zp.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.zp-stars { min-width: 0; display: flex; flex-direction: column; gap: 0; }
.zs { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 2px; min-width: 0; }
.zs.maj { font-size: 14px; line-height: 18px; font-weight: 600; }
.zs.min { font-size: 11px; line-height: 15px; color: var(--label2); }
.zs-b { font-size: 10px; font-weight: 400; color: var(--label2); }
.hua { font-size: 10px; line-height: 13px; font-weight: 600; color: var(--on-accent); background: var(--accent); border-radius: 3px; padding: 0 2px; align-self: center; }
.hua.ji { background: var(--ochre); }
.flow-h { font-size: 10px; line-height: 13px; font-weight: 600; color: var(--accent); }
.flow-h.ji { color: var(--ochre); }
.zp-foot { margin-top: 4px; }
.zp-marks { display: flex; gap: 3px; min-height: 0; }
.zp-mark { font-size: 10px; line-height: 13px; font-weight: 600; color: var(--accent); }
.zp-name { display: flex; align-items: baseline; gap: 3px; flex-wrap: wrap; }
.zp-nm { font-size: 12px; line-height: 16px; font-weight: 600; }
.zp.ming .zp-nm { color: var(--accent); }
.zp-body { font-size: 10px; line-height: 13px; font-weight: 600; color: var(--ochre); }
.zp-gz { font-size: 11px; line-height: 16px; color: var(--label2); }
.zp-range { font-size: 10px; line-height: 13px; color: var(--label2); font-variant-numeric: tabular-nums; }
.zc { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; min-width: 0; padding: 8px 10px; text-align: center; box-shadow: inset -.5px -.5px 0 var(--sep); pointer-events: none; }
/* 字有底色，連線從字後面穿過，看得清楚 */
.zc-name, .zc-l, .zc-year { background: var(--card); padding: 0 3px; max-width: 100%; }
.zc-name { font-size: 17px; line-height: 22px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.zc-l { font-size: 12px; line-height: 17px; color: var(--label2); overflow-wrap: anywhere; }
.zc-year { font-size: 12px; line-height: 17px; color: var(--accent); font-weight: 600; margin-top: 3px; }
.zr-lines { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.zr-lines line { stroke: var(--accent); stroke-width: 1; opacity: .75; }
@media (min-width: 600px) {
  .zr { grid-template-rows: repeat(4, minmax(146px, auto)); }
  .zp { padding: 7px 8px 6px; }
  .zs.maj { font-size: 15px; line-height: 20px; }
  .zs.min { font-size: 12px; line-height: 16px; }
  .zs-b, .hua, .flow-h, .zp-mark, .zp-range { font-size: 11px; }
  .zp-nm { font-size: 13px; }
  .zc-l, .zc-year { font-size: 13px; line-height: 19px; }
}

/* 奇門九宮 */
.qm { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--card); border-radius: 10px; overflow: hidden; }
.qc { display: flex; flex-direction: column; min-width: 0; min-height: 118px; padding: 8px 9px 7px; box-shadow: inset -.5px -.5px 0 var(--sep); text-align: left; }
button.qc:active { background: var(--press); }
.qc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; margin-bottom: 4px; }
.qc-god { font-size: 13px; line-height: 18px; color: var(--label2); }
.qc-gua { font-size: 11px; line-height: 18px; color: var(--label2); }
.qc-line { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.qc-star, .qc-door { font-size: 15px; line-height: 21px; font-weight: 600; min-width: 0; }
.qc-gan { font-size: 15px; line-height: 21px; }
.qc-gan.dim { color: var(--label2); }
.hi { color: var(--accent); }
.qc-flags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; padding-top: 5px; min-height: 22px; }
.qc-flag { font-size: 11px; line-height: 15px; padding: 0 4px; border-radius: 4px; background: var(--fill); color: var(--label2); }
.qc-flag.good { color: var(--accent); background: var(--accent-soft); }
.qc-flag.mid { color: var(--ochre); background: var(--ochre-soft); }
.qc.center { align-items: center; justify-content: center; text-align: center; gap: 1px; }
.qc-ju { font-size: 15px; line-height: 21px; font-weight: 600; margin-bottom: 2px; }
.qc-sm { font-size: 12px; line-height: 17px; color: var(--label2); }

/* ---- 報告 ---- */
.rp-head { padding: 4px 16px 18px; }
.rp-title { font-size: 22px; line-height: 28px; font-weight: 700; overflow-wrap: anywhere; }
.rp-sub { font-size: 13px; line-height: 18px; color: var(--label2); margin-top: 4px; }
.rp-note { font-size: 15px; line-height: 21px; color: var(--label2); padding: 0 16px 12px; }
.sec-t { font-size: 22px; line-height: 28px; font-weight: 700; padding: 0 0 8px; }
.sec-t.pad { padding: 0 16px 10px; }
.answer { padding: 0 16px 32px; }
.answer-t { font-size: 20px; line-height: 29px; overflow-wrap: anywhere; }
.answer .btn { margin-top: 14px; }
.events { margin-bottom: 20px; }
.ev-card { margin: 0 16px 10px; background: var(--card); border-radius: 12px; overflow: hidden; }
.ev-head { display: block; width: 100%; padding: 11px 16px 13px; }
.ev-head:active { background: var(--press); }
.ev-top { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.ev-aspect { flex: none; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--accent); }
.ev-time { flex: 1 1 auto; min-width: 0; text-align: right; font-size: 13px; line-height: 18px; color: var(--label2); overflow-wrap: anywhere; }
.ev-title { font-size: 17px; line-height: 23px; font-weight: 600; margin-top: 6px; overflow-wrap: anywhere; }
.ev-tagline { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ev-who { font-size: 13px; line-height: 18px; color: var(--label2); }
.ev-body { padding: 0 16px 6px; }
.ev-m { border-top: .5px solid var(--sep); padding: 10px 0 11px; }
.ev-men { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--label2); margin-bottom: 3px; }
.ev-st { font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }
.ev-why { font-size: 13px; line-height: 18px; color: var(--label2); margin-top: 3px; overflow-wrap: anywhere; }
.ev-why.strong { font-size: 15px; line-height: 21px; color: var(--label); margin-top: 0; }
.reading { padding: 4px 16px 28px; }
.rd-sum { font-size: 17px; line-height: 25px; font-weight: 600; margin-bottom: 18px; overflow-wrap: anywhere; }
.rd-sec { margin-bottom: 22px; }
.rd-t { font-size: 17px; line-height: 22px; font-weight: 600; margin-bottom: 7px; overflow-wrap: anywhere; }
.rd-p { margin-bottom: 13px; }
.rd-p > p { font-size: 17px; line-height: 25px; overflow-wrap: anywhere; }
.cites { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; }
.cite { display: block; width: 100%; font-size: 13px; line-height: 18px; color: var(--label2); overflow-wrap: anywhere; }
.cite:active { opacity: .5; }
.ct-st { white-space: nowrap; font-weight: 600; }
.ct-st.ok { color: var(--accent); }
.ct-st.bad { color: var(--red); }
.rd-more { font-size: 13px; line-height: 18px; color: var(--label2); }
.rd-cost { font-size: 13px; line-height: 18px; color: var(--label2); margin-top: 4px; }
.chat { padding: 0 0 12px; display: flex; flex-direction: column; }
.bubble { max-width: 78%; padding: 7px 12px; border-radius: 18px; margin: 0 16px 6px; font-size: 17px; line-height: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.bubble.them { align-self: flex-start; background: var(--bubble); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 6px 12px 7px; background: var(--bar); box-shadow: 0 -.5px 0 var(--sep); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.cp-year { flex: none; height: 34px; padding: 0 10px; border-radius: 17px; background: var(--fill); color: var(--accent); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cp-box { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; min-height: 34px; padding: 2px 3px 2px 12px; border-radius: 17px; background: var(--card); box-shadow: inset 0 0 0 .5px var(--sep); }
.cp-in { flex: 1 1 auto; min-width: 0; display: block; resize: none; border: 0; background: none; padding: 4px 0; font-size: 17px; line-height: 22px; max-height: 110px; }
.cp-in::placeholder { color: var(--label3); }
.cp-send { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); margin-left: 6px; }
.cp-send:disabled { background: var(--fill); color: var(--label3); }

/* ---- 盲測 ---- */
.deck { display: flex; flex-direction: column; min-height: calc(100dvh - var(--nav-h) - var(--tab-h) - 32px); padding: 4px 16px 0; }
.deck-bar { height: 3px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.deck-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s var(--ease); }
.deck-count { font-size: 13px; line-height: 18px; color: var(--label2); padding: 7px 0 12px; text-align: center; }
.deck-stage { position: relative; flex: 1 1 auto; display: flex; align-items: center; min-height: 300px; }
.dk-card { position: relative; width: 100%; min-height: 320px; max-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 28px 24px; background: var(--card); border-radius: 14px; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.dk-time { font-size: 15px; line-height: 20px; color: var(--label2); margin-bottom: 10px; }
.dk-text { font-size: 22px; line-height: 32px; font-weight: 600; overflow-wrap: anywhere; }
.dk-prev { font-size: 13px; line-height: 18px; color: var(--label2); margin-top: 12px; }
.dk-yes, .dk-no { position: absolute; top: 18px; font-size: 17px; font-weight: 700; opacity: 0; pointer-events: none; }
.dk-yes { left: 22px; color: var(--accent); }
.dk-no { right: 22px; color: var(--label2); }
.deck-btns { display: flex; gap: 10px; padding: 14px 0 0; }
.deck-btns.in-sheet { padding: 0 16px 8px; }
.dk-btn { flex: 1 1 0; min-height: 50px; border-radius: 12px; background: var(--card); color: var(--accent); font-weight: 600; text-align: center; }
.sheet .dk-btn { background: var(--card); }
.dk-btn.ghost { color: var(--label2); font-weight: 400; }
.dk-btn.on { background: var(--accent); color: var(--on-accent); }
.dk-btn:active { opacity: .5; }
.result { margin: 8px 16px 35px; padding: 16px; background: var(--card); border-radius: 12px; }
.cmp + .cmp { margin-top: 16px; }
.cmp-top { display: flex; justify-content: space-between; align-items: baseline; }
.cmp-l { font-size: 15px; line-height: 20px; color: var(--label2); }
.cmp-v { font-size: 34px; line-height: 41px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-track { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 2px; }
.cmp-fill { height: 100%; border-radius: 3px; }
.cmp-fill.real { background: var(--accent); }
.cmp-fill.decoy { background: var(--tab-off); }
.cmp-n { font-size: 13px; line-height: 18px; color: var(--label2); margin-top: 5px; }
.result-t { margin-top: 18px; padding-top: 14px; border-top: .5px solid var(--sep); font-size: 17px; line-height: 25px; overflow-wrap: anywhere; }

/* ---- 登入 ---- */
.login { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--sat) + 24px) 16px calc(var(--sab) + 96px); gap: 0; }
.login-t { font-size: 34px; line-height: 41px; font-weight: 700; padding: 0 16px; }
.login-s { font-size: 15px; line-height: 20px; color: var(--label2); padding: 6px 16px 24px; }
.login .list { margin: 0; }
.login-err { font-size: 13px; line-height: 18px; color: var(--red); padding: 8px 16px 12px; min-height: 38px; }

/* ---- 減少動態 ---- */
@keyframes mx-spin { to { transform: rotate(360deg); } }
.spin { display: block; color: var(--label2); animation: mx-spin 1s steps(8) infinite; }
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0s !important; animation-duration: 0s !important; }
  .spin { animation: mx-spin 1.6s steps(8) infinite !important; }
  .ys, .wcol { scroll-behavior: auto; }
}
