/* L3 星图推演 + 算筹手稿：夜里演算，天明落定。首屏每种语言只取 T4 的一片 700 字重。 */




:root {
  color-scheme: light dark;
  --bg: #F5F0E6;
  --surface: #FFFDF8;
  --surface-2: #EDE6D8;
  --text: #2B2620;
  --muted: #635A4F;
  --primary: #2F5D62;
  --on-primary: #FFFFFF;
  --accent: #7A5214;
  --seal: #9E2A2B;
  --on-seal: #FFFFFF;
  --border: #DDD3C2;
  --border-strong: #B9AC96;
  --term: #46666E;
  --term-wash: #E4ECEC;
  --hl: #F0EADF;
  --radius: 10px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --dou-sans: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --dou-serif: "Dou Serif SC", "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --font: var(--dou-sans);
  --font-brand: var(--dou-serif);
  /* 演出夜色令牌 */
  --n-bg: #16130F;
  --n-cell: #1B1712;
  --n-line: #2F2921;
  --n-star: #EFE7D8;
  --n-dim: #9C8F7E;
  --n-gold: #D9B36C;
  --n-seal: #D9776F;
  --n-term: #8AAEB4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130F;
    --surface: #211D17;
    --surface-2: #2A241C;
    --text: #EFE7D8;
    --muted: #B5AA97;
    --primary: #7FB3B0;
    --on-primary: #10201F;
    --accent: #D9B36C;
    --seal: #D9776F;
    --on-seal: #1B0D0C;
    --border: #3A332A;
    --border-strong: #5A5044;
    --term: #8AAEB4;
    --term-wash: #1E292B;
    --hl: #29241D;
  }
}
:root:lang(zh-Hant) {
  --dou-sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  --dou-serif: "Dou Serif TC", "Songti TC", "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif;
}
:root:lang(ja) {
  --dou-sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --dou-serif: "Dou Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
}
:root:lang(en) {
  --dou-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --dou-serif: "Dou Serif Latin", "Source Serif 4", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(47, 93, 98, .22); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { width: 100%; max-width: 1380px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 960px) { .wrap { padding-inline: 28px; } }

/* ── 顶栏 ── */
.top { border-bottom: 1px solid var(--border); background: var(--bg); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-height: 44px; }
.brand-seal { width: 30px; height: 30px; fill: var(--seal); flex: none; }
.wordmark { font-family: var(--font-brand); font-size: 18px; font-weight: 700; letter-spacing: .04em; }
.langs { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.langs button { border: 0; background: none; padding: 5px 11px; min-height: 36px; border-radius: 999px; font-size: 13px; cursor: pointer; color: var(--muted); }
.langs button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 700; }
@media (pointer: coarse) { .langs button { min-height: 44px; } }

/* ── 首屏布局 ── */
.hero { padding-block: 18px 32px; display: grid; gap: 20px; }
.hero-head { display: grid; gap: 10px; }
@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
    grid-template-areas: "head chart" "intake chart";
    grid-template-rows: auto 1fr;
    gap: 18px 36px; align-items: start; padding-block: 28px 40px;
  }
  .hero-head { grid-area: head; }
  .intake { grid-area: intake; }
  .chart { grid-area: chart; }
}
#hero-claim { font-family: var(--font-brand); font-size: clamp(1.38rem, 1.1rem + 1.1vw, 1.9rem); font-weight: 700; letter-spacing: .01em; line-height: 1.35; }
.hero-sub { font-size: 14.5px; color: var(--muted); line-height: 1.65; }

/* ── 表单 ── */
.intake { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.intake h2 { font-size: 16px; font-weight: 700; }
#birth-form { display: grid; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 374px) { .row2 { grid-template-columns: 1fr; } }
.field { display: grid; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > span, legend { font-size: 13px; color: var(--muted); padding: 0; }
input, select {
  width: 100%; min-height: 44px; padding: 8px 10px;
  font-size: max(1rem, 1em);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
select:disabled { opacity: .55; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg legend { width: 100%; margin-bottom: 4px; }
.seg label { flex: 1 1 120px; position: relative; min-height: 44px; }
.seg input { position: absolute; opacity: 0; inset: 0; min-height: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 44px; padding-inline: 8px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 14px; }
.seg input:checked + span { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg); font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--text); }
.ghost-chip { border-color: transparent; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: .2em; }
@media (pointer: coarse) { .chip { min-height: 44px; } }
.error { margin: 0; font-size: 13.5px; color: var(--seal); font-weight: 700; }
.error:empty { display: none; }
.primary {
  min-height: 48px; border: 0; border-radius: 8px; background: var(--seal); color: var(--on-seal);
  font-weight: 700; font-size: 16px; letter-spacing: .04em; cursor: pointer;
  transition: opacity .15s ease, transform .1s ease;
}
.primary:hover:not(:disabled) { opacity: .92; }
.primary:active:not(:disabled) { transform: scale(.99); }
.primary:disabled { opacity: .6; cursor: progress; }

/* ── 命盘头与舞台 ── */
.chart { min-width: 0; display: grid; gap: 10px; }
.chart-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 44px; }
.chart-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chart-head h2 { font-size: 18px; font-family: var(--font-brand); }
.chart-head h2:focus { outline: none; }
.chart-head h2:focus-visible { outline: 2px solid var(--primary); }
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.badge[data-kind="user"] { background: var(--term-wash); border-color: var(--primary); color: var(--primary); }
.meta { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.skip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--n-line); background: var(--n-bg); color: var(--n-star); font-size: 13px; cursor: pointer; }
.skip:hover { border-color: var(--n-dim); }
@media (pointer: coarse) { .skip { min-height: 44px; } }

.stage { position: relative; --cell-h: 124px; }
@media (min-width: 960px) {
  .stage { --cell-h: 116px; }
  .stage.is-playing { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 12px; align-items: stretch; }
}
.board {
  --cell: var(--surface); --grid: var(--border); --tx: var(--text); --tx2: var(--muted); --gold: var(--accent);
  --dip-line: var(--border-strong); --dip-star: var(--border-strong); --dip-lit: var(--text);
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(var(--cell-h), auto));
  gap: 1px; background: var(--grid); border: 1px solid var(--grid); border-radius: var(--radius);
  transition: background-color .5s ease, border-color .5s ease;
}
.board.night {
  --cell: var(--n-cell); --grid: var(--n-line); --tx: var(--n-star); --tx2: var(--n-dim); --gold: var(--n-gold);
  --dip-line: #3B342A; --dip-star: #4A4237; --dip-lit: var(--n-star);
  --seal: var(--n-seal); --term-wash: #1F2A2C; --accent: var(--n-gold); --primary: var(--n-term);
  background: var(--n-line);
}
.palace {
  position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 6px 6px 5px; border: 0; margin: 0; text-align: left; line-height: 1.28;
  background: var(--cell); color: var(--tx); z-index: 0;
  transition: background-color .5s ease, color .5s ease;
}
button.palace { cursor: pointer; }
button.palace:hover { background: var(--hl); }
.board.night button.palace:hover { background: var(--cell); }
.palace.rel { background: var(--hl); }
.board.playing .palace.rel { background: var(--cell); }
.palace.cur { background: var(--term-wash); }
.board.playing .palace.cur:not(.cur-on) { background: var(--cell); }
.palace[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--primary); }
.palace:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }

.majors { display: flex; flex-wrap: wrap; gap: 2px 6px; padding-right: 24px; font-family: var(--font-brand); font-size: 15px; font-weight: 700; }
.star { display: inline-flex; align-items: baseline; gap: 2px; transition: opacity .6s, color .6s; }
.star b { font-weight: 700; transition: text-shadow .6s, color .6s; }
.star .lv { font-family: var(--font); font-size: 11px; font-weight: 400; color: var(--tx2); }
.flying { position: relative; z-index: 10; }
.hua { font-family: var(--font); font-style: normal; font-weight: 700; font-size: 10.5px; line-height: 1; padding: 2px 3px 1px; margin-left: 2px; border-radius: 3px; border: 1px solid currentColor; align-self: center; }
.h-禄 { color: var(--accent); }
.h-权 { color: var(--primary); }
.h-科 { color: var(--term); }
.h-忌 { color: #fff; background: var(--seal); border-color: var(--seal); }
.board.night .h-忌 { color: #1B0D0C; }

.empty { display: grid; font-family: var(--font); font-weight: 400; font-size: 12px; color: var(--tx2); line-height: 1.3; }
.empty small { font-size: 11px; }
.aux { display: flex; flex-wrap: wrap; gap: 1px 5px; font-size: 11.5px; color: var(--tx2); }
.auxs.lucky { color: var(--gold); }
.dust { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; padding: 3px 0 2px; }
.dust i { width: 3px; height: 3px; border-radius: 50%; background: var(--tx2); opacity: .55; }
.board.night .dust i { background: var(--n-star); opacity: .5; }
.foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; font-size: 11.5px; }
.pname { font-weight: 700; }
.gz { color: var(--tx2); }
.brc { transition: color .3s, text-shadow .3s; }
.board.night .brc.lit { color: var(--n-gold); text-shadow: 0 0 8px rgba(217, 179, 108, .8); }
.age { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--tx2); font-size: 11px; white-space: nowrap; }
.marks { position: absolute; top: 5px; right: 5px; display: flex; gap: 2px; }
.mk { display: grid; place-items: center; min-width: 17px; height: 17px; padding-inline: 2px; border-radius: 3px; font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 1; }
.mk-ming { background: var(--seal); color: #fff; }
.board.night .mk-ming { color: #1B0D0C; }
.mk-shen { border: 1px solid var(--seal); color: var(--seal); }

/* 夜色中的星光 */
.board.night .star.major[data-glow="3"] b { text-shadow: 0 0 8px rgba(239, 231, 216, .7), 0 0 20px rgba(217, 179, 108, .35); }
.board.night .star.major[data-glow="2"] b { text-shadow: 0 0 6px rgba(239, 231, 216, .45); }
.board.night .star.major.on[data-glow="0"] { opacity: .65; }
.board.night .star.major[data-star="紫微"] b { color: #FFF4D6; text-shadow: 0 0 6px #F4D89A, 0 0 18px rgba(217, 179, 108, .9); }

.board.playing .r:not(.on) { opacity: 0; }
.bigb { position: absolute; inset: 0; display: grid; place-items: center; z-index: -1; pointer-events: none; font-family: var(--font-brand); font-size: 42px; color: var(--n-star); opacity: 0; transition: opacity .6s, color .3s, text-shadow .3s; }
.board.night .bigb { opacity: .07; }
.board.night .palace.lit .bigb { opacity: .5; color: var(--n-gold); text-shadow: 0 0 18px rgba(217, 179, 108, .7); }

/* 中宫 */
.core { grid-area: 2 / 2 / 4 / 4; position: relative; display: grid; place-items: center; overflow: hidden; background: var(--cell); color: var(--tx); text-align: center; transition: background-color .5s ease, color .5s ease; }
.board.night .core { background: radial-gradient(closest-side, #241E17, var(--n-cell)); }
.dipper { position: absolute; inset: 0; margin: auto; width: 80%; height: auto; aspect-ratio: 1120 / 600; opacity: .16; transform-origin: 50% 50%; }
.board.playing .dipper { opacity: 1; }
.dipper .dl { fill: none; stroke: var(--dip-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.dipper .ds { fill: var(--dip-star); transform-box: fill-box; transform-origin: center; transition: fill .4s; }
.dipper .ds.lit { fill: var(--dip-lit); }
.board.night .dipper .ds.lit { filter: drop-shadow(0 0 5px rgba(239, 231, 216, .9)); }
.dipper .dlg { fill: none; stroke: var(--n-gold); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }

.core-play { position: relative; z-index: 1; width: 100%; padding: 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.board:not(.playing) .core-play { display: none; }
.board.night .core-play { text-shadow: 0 0 4px var(--n-cell); }
.board.night :is(.core-lines, .core-big, .pillars) {
  padding: 8px 16px; border-radius: 36%;
  background: radial-gradient(closest-side, rgba(27, 23, 18, .94) 72%, rgba(27, 23, 18, 0));
}
.core-big:empty, .pillars:empty, .core-lines:empty, .core-step:empty { display: none; }
.core-step { display: flex; align-items: center; gap: 8px; font-family: var(--font-brand); font-size: 12px; letter-spacing: .18em; color: var(--n-gold); line-height: 1; }
.core-step::before, .core-step::after { content: ""; width: 14px; height: 1px; background: currentColor; opacity: .5; }
.core-big { font-family: var(--font-brand); font-size: 19px; line-height: 1.3; display: grid; justify-items: center; gap: 4px; }
.in-line { font-size: 14px; text-wrap: balance; }
.lunar { font-size: 18px; }
.lunar.solar { color: var(--tx2); }
.lunar .muted { font-size: .78em; color: var(--tx2); }
.core-lines { display: grid; gap: 2px; font-size: 12.5px; line-height: 1.5; color: var(--tx); text-wrap: balance; }
.ln.strong { font-weight: 700; }
.ln.note { color: var(--gold); }
.ln.mono { font-variant-numeric: tabular-nums; font-family: var(--font-brand); font-size: 1.2em; }
.tk { white-space: nowrap; }
.pillars { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pcol { display: grid; justify-items: center; gap: 2px; }
.pv { writing-mode: vertical-rl; font-family: var(--font-brand); font-size: 22px; font-weight: 700; letter-spacing: .06em; }
:root:lang(en) .pv { writing-mode: horizontal-tb; font-size: 14px; letter-spacing: 0; }
.pcol small { font-size: 11px; color: var(--tx2); }
.ju-big { font-family: var(--font-brand); font-size: 30px; font-weight: 700; line-height: 1.2; }
.ju-big .sub { font-size: .7em; color: var(--tx2); }
.elem { color: var(--gold); }
.judots { display: flex; gap: 7px; }
.judots i { width: 7px; height: 7px; border-radius: 50%; background: var(--n-gold); }
.formula { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-brand); font-size: 24px; font-variant-numeric: tabular-nums; }
.formula .op { color: var(--tx2); font-size: .8em; }
.formula .gold { color: var(--n-gold); }
.formula .big { font-size: 1.25em; font-weight: 700; }
.stem-big { font-family: var(--font-brand); font-size: 52px; font-weight: 700; color: var(--n-gold); line-height: 1.1; }
.grp { font-size: 14px; color: var(--n-gold); min-height: 1.3em; }
.count { font-family: var(--font-brand); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }

.core-final { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px; }
.board.playing .core-final { position: absolute; inset: 0; }
.core-final p { margin: 0; font-size: 12.5px; line-height: 1.5; }
.core-final .muted { color: var(--tx2); }
.core-final .ju { font-family: var(--font-brand); font-size: 23px; letter-spacing: .04em; margin-bottom: 2px; }
.seal { width: 38px; height: 38px; fill: var(--seal); margin-bottom: 6px; }

/* 叠加层 */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.fx-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fx-svg path { fill: none; }
.fxn { position: absolute; left: 0; top: 0; translate: -50% -50%; }
.spark { width: 10px; height: 10px; border-radius: 50%; background: #FFF1CC; box-shadow: 0 0 8px 3px rgba(217, 179, 108, .75); }
.spark.sun { width: 15px; height: 15px; background: radial-gradient(circle, #FFF6DD 30%, #E8C47A 70%); }
.spark.echo { width: 8px; height: 8px; background: var(--n-term); }
.trail { width: 6px; height: 6px; border-radius: 50%; background: #F4D89A; }
.tag { font-family: var(--font-brand); font-size: 13px; font-weight: 700; color: var(--n-star); text-shadow: 0 0 6px rgba(0, 0, 0, .9); }
.tag.gold { color: var(--n-gold); }
.tag.hr { color: var(--n-term); }
.tag.dim { color: var(--n-dim); font-size: 12px; }
.ripple { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--n-star); }
.ripple.soft { border-color: rgba(239, 231, 216, .6); }
.ripple.gold { border-color: var(--n-gold); width: 54px; height: 54px; }
.ripple.rs { border-color: var(--n-seal); }
.ripple.term { border-color: var(--n-term); width: 60px; height: 60px; }
.ripple.h-禄 { border-color: var(--n-gold); }
.ripple.h-权 { border-color: var(--n-term); }
.ripple.h-科 { border-color: #B9D3D6; }
.ripple.h-忌 { border-color: var(--n-seal); }
.flygz { font-family: var(--font-brand); font-size: 15px; font-weight: 700; color: var(--n-gold); }
.ring { stroke: rgba(239, 231, 216, .22); stroke-width: 1; stroke-dasharray: 2 5; }
.arc { stroke-width: 3; stroke-linecap: round; }
.arc-lon { stroke: var(--n-term); }
.arc-eot { stroke: var(--n-gold); }
.axis { stroke: var(--n-seal); stroke-width: 1; stroke-dasharray: 4 4; opacity: .8; }
.tick { fill: none; stroke: rgba(239, 231, 216, .7); stroke-width: 1.2; }
.borrow { stroke: var(--n-dim); stroke-width: 1; stroke-dasharray: 3 4; }
.hua-line { stroke-width: 1.5; stroke-linecap: round; }
.hl-禄 { stroke: var(--n-gold); }
.hl-权 { stroke: var(--n-term); }
.hl-科 { stroke: #B9D3D6; }
.hl-忌 { stroke: var(--n-seal); }

.dawn-clone { position: absolute; z-index: 2; pointer-events: none; mask-image: radial-gradient(closest-side, #000 78%, transparent); mask-repeat: no-repeat; mask-size: 0 0; }
.board.no-tr, .board.no-tr * { transition: none !important; }

/* 同一时间线上的算筹手稿。默认不占位，脚本失效时完整命盘仍保持可用。 */
.manuscript { display: none; min-width: 0; overflow: hidden; border: 1px solid var(--n-line); border-radius: var(--radius); background: #19150F; color: var(--n-star); transition: background-color .56s ease, color .56s ease, border-color .56s ease; }
.stage.is-playing .manuscript { display: block; }
.manuscript ol { list-style: none; margin: 0; padding: 12px 10px; height: 100%; display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 5px; overflow: hidden; }
.mline { position: relative; writing-mode: vertical-rl; min-width: 16px; max-height: calc(4 * var(--cell-h) - 24px); padding: 6px 1px; font-family: var(--font-brand); font-size: 13px; line-height: 1.22; letter-spacing: .05em; color: var(--n-star); opacity: .12; transition: opacity .18s ease, color .56s ease, background-color .18s ease; }
.mline.is-done { opacity: .6; }
.mline.is-current { opacity: 1; color: #FFF4D6; background: rgba(217, 179, 108, .08); }
.mline-no { color: var(--n-gold); font-size: 11px; margin-block-end: 4px; }
.mline-title { font-weight: 700; color: var(--n-gold); }
.mglyph { display: inline-block; }
.mrods { width: 18px; height: 30px; margin-block: 5px; overflow: visible; }
.mrod { fill: none; stroke: var(--n-seal); stroke-width: 1.7; stroke-linecap: round; stroke-dasharray: 1; }
.stage.is-dawning .manuscript { background: var(--surface); color: var(--text); border-color: var(--border); }
.stage.is-dawning .mline { color: var(--text); }
.stage.is-dawning .mline-title { color: var(--accent); }
.stage.is-dawning .mrod { stroke: var(--seal); }

@media (max-width: 959px) {
  .stage.is-playing { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .manuscript { height: 96px; }
  .manuscript ol { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 0; padding: 7px 10px; }
  .mline { display: none; writing-mode: horizontal-tb; max-height: none; min-width: 0; padding: 3px 4px; font-size: 12px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mline.is-prev, .mline.is-current { display: block; }
  .mline.is-prev { opacity: .6; }
  .mline-no { margin: 0 5px 0 0; }
  .mrods { width: 30px; height: 18px; margin: 0 4px; vertical-align: middle; }
}

/* 说明、按钮、详情、日志 */
.caption { min-height: 2.8em; margin: 2px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); text-align: center; }
.after { display: flex; justify-content: center; min-height: 44px; }
.ghost { min-height: 44px; padding: 0 18px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: 14px; cursor: pointer; }
.ghost:hover { border-color: var(--text); }
.final-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.action-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding-inline: 18px; text-decoration: none; font-size: 14px; }
.final-actions .primary { min-height: 44px; }

.detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.detail h3 { font-size: 16px; font-family: var(--font-brand); }
.detail h3 small { font-family: var(--font); font-size: 13px; color: var(--muted); font-weight: 400; }
.detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 8px 0 0; font-size: 13.5px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.detail .muted { color: var(--muted); font-size: 13.5px; }

.log { border-top: 1px solid var(--border); padding-top: 8px; }
.log summary { cursor: pointer; font-size: 14px; font-weight: 700; min-height: 40px; display: flex; align-items: center; }
.log ol { margin: 8px 0 0; padding-left: 1.5em; display: grid; gap: 8px; font-size: 13.5px; }
.log ul { margin: 2px 0 0; padding-left: 1.1em; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 手机端字号 ≥ 11px（带框单字徽标 ≥ 10px），零溢出 */
.bw-short { display: none; }
@media (max-width: 959px) {
  .stage { --cell-h: 110px; }
  .bw-long { display: none; }
  .bw-short { display: inline; }
  .palace { padding: 5px 4px 4px; }
  .majors { font-size: 12.5px; gap: 1px 4px; padding-right: 18px; }
  :root:lang(en) .majors { font-size: 11.5px; }
  .star .lv { font-size: 11px; }
  .hua { font-size: 10px; padding: 1px 2px; }
  .marks { top: 4px; right: 3px; }
  .mk { min-width: 15px; height: 15px; font-size: 10px; }
  .aux { font-size: 11px; gap: 0 3px; }
  .foot { font-size: 11px; gap: 0 2px; }
  .age { font-size: 11px; }
  .empty { font-size: 11.5px; }
  .empty small { font-size: 11px; }
  .bigb { font-size: 30px; }
  .core-play { padding: 6px; gap: 3px; }
  .core-step { font-size: 11px; letter-spacing: .1em; }
  .core-big { font-size: 15px; }
  .in-line { font-size: 12px; }
  .lunar { font-size: 14px; }
  .core-lines { font-size: 11.5px; line-height: 1.4; }
  .pv { font-size: 17px; }
  .ju-big { font-size: 24px; }
  .formula { font-size: 18px; gap: 4px; }
  .stem-big { font-size: 40px; }
  .count { font-size: 26px; }
  .core-final .ju { font-size: 18px; }
  .core-final p { font-size: 11.5px; }
  .seal { width: 28px; height: 28px; margin-bottom: 4px; }
  .tag { font-size: 11.5px; }
}

/* ── 北斗分隔与下方 4 个区块 ── */
.dip-divider { display: flex; justify-content: center; padding-block: 14px 8px; color: var(--border-strong); }
.band { padding-block: 36px; border-top: 1px solid var(--border); display: grid; gap: 20px; }
@media (min-width: 960px) {
  .band { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 36px; align-items: start; }
}
.band-head { display: grid; gap: 8px; }
.band-head h2 { font-family: var(--font-brand); font-size: clamp(1.25rem, 1.05rem + .6vw, 1.55rem); }
.sec-lead { font-size: 14.5px; color: var(--muted); line-height: 1.65; }
.band-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.sec-item { padding-bottom: 14px; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.sec-item:last-child { border-bottom: 0; padding-bottom: 0; }
.sec-item h3 { font-size: 15.5px; font-weight: 700; color: var(--text); }
.sec-item p { font-size: 14.5px; color: var(--muted); }

/* 出处示范区块 */
.source-demo { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; }
.src-head { display: grid; gap: 6px; }
.src-tag { justify-self: start; font-size: 12px; font-weight: 700; color: var(--primary); background: var(--term-wash); padding: 2px 9px; border-radius: 999px; }
.src-title { font-family: var(--font-brand); font-size: 17px; }
.src-body { font-size: 15px; line-height: 1.7; color: var(--text); }
.src-exp { border-top: 1px solid var(--border); padding-top: 10px; }
.src-exp summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--primary); min-height: 36px; display: flex; align-items: center; }
.basis-list { margin: 8px 0 0; padding-left: 1.3em; display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); }
.classic-quote { margin: 8px 0 6px; padding-left: 12px; border-left: 2px solid var(--seal); font-family: var(--font-brand); font-size: 14.5px; color: var(--text); }
.classic-note { font-size: 13.5px; color: var(--muted); }

/* ── 页脚 ── */
.foot-bar { border-top: 1px solid var(--border); padding-block: 24px 40px; }
.foot-in { display: grid; gap: 6px; font-size: 13px; }
.foot-in .muted { color: var(--muted); }
