/* 命盘研究所 · 命书
   Day: 线装古籍 (bamboo paper, indigo cover cloth, cinnabar seal). Night: 夜读 (deep indigo, candle, moonlight).
   The palette follows the system appearance, the same way iOS switches light and dark. */

/* Self-hosted OFL subsets (see licenses/ and scripts/build-fonts.sh). The serif covers only fixed
   headings, pillars and table-driven titles; other characters fall back to system fonts. */
@font-face {
  font-family: "MP Serif";
  src: url("fonts/mp-serif.v3.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "MP Numeral";
  src: url("fonts/mp-numeral.v1.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0030-0039, U+002D, U+002F, U+00B7, U+2013;
}

:root {
  color-scheme: light dark;
  --bg: #EEE6D3;
  --bg2: #E3D8C0;
  --desk: #D9CEB6;
  --accent: #22385A;
  --title: #1B1914;
  --mark: #9E3524;
  --pin: #2A7A64;
  --text: #2C2820;
  --muted: #625B4E;
  --on-accent: #F4EEDF;
  --shadow: rgba(52, 38, 18, .22);
  --line: color-mix(in srgb, var(--accent) 42%, transparent);
  --line2: color-mix(in srgb, var(--accent) 18%, transparent);
  --wash: color-mix(in srgb, var(--accent) 9%, transparent);
  --serif: "MP Serif", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --numeral: "MP Numeral", "Bodoni 72", "Didot", "MP Serif", "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --gutter: 12px;
}
/* 夜读: the system's dark mode, unless the reader picked day with the switch (data-theme, set by theme.js / app.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101A2D;
    --bg2: #17233A;
    --desk: #0A101D;
    --accent: #E2B25C;
    --title: #F5E8CB;
    --mark: #8DB2D3;
    --pin: #5CC9A7;
    --text: #DCE2EC;
    --muted: #9AA7BA;
    --on-accent: #101A2D;
    --shadow: rgba(0, 0, 0, .55);
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101A2D;
  --bg2: #17233A;
  --desk: #0A101D;
  --accent: #E2B25C;
  --title: #F5E8CB;
  --mark: #8DB2D3;
  --pin: #5CC9A7;
  --text: #DCE2EC;
  --muted: #9AA7BA;
  --on-accent: #101A2D;
  --shadow: rgba(0, 0, 0, .55);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 64px; scroll-padding-bottom: 112px; }
body { margin: 0; min-height: 100svh; background: var(--desk); color: var(--text); font: 15px/1.8 var(--sans); overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button, a, select, summary, label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, .seg span, .dock { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; background: var(--accent); color: var(--on-accent); }
.skip:focus { left: 12px; }
main { position: relative; }

/* Logo motion: same rhythm as public/logo.svg */
.orbit-ball { offset-path: path("M 57 32 A 25 10.5 0 1 1 7 32 A 25 10.5 0 1 1 57 32"); offset-rotate: 0deg; animation: ball-move 18s linear infinite; }
.orbit-ball-b { animation-delay: -9s; }
@keyframes ball-move { from { offset-distance: 0%; } to { offset-distance: 100%; } }

/* ---------- Buttons ---------- */
.solid-btn, .ghost-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; font: 15px var(--serif); letter-spacing: .14em; }
.solid-btn { background: var(--accent); color: var(--on-accent); }
.ghost-btn { border: 1px solid var(--line); color: var(--title); }
button:disabled { opacity: .55; cursor: progress; }

/* ---------- Home: 书衣 + 版权页 ---------- */
.home { min-height: 100svh; padding: var(--gutter); display: grid; place-items: center; }
.cover { width: 100%; max-width: 560px; background: var(--bg); box-shadow: 0 1px 0 var(--line2), 0 24px 60px var(--shadow); padding: 14px; }
.cover-face { display: flex; justify-content: space-between; gap: 14px; min-height: 250px; padding: 26px 16px 22px; border: 1px solid var(--line); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--line2); }
.cover-left { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.cover-mark { width: 64px; height: 64px; }
.cover-value { margin: 0; font: 16px/1.85 var(--sans); color: var(--text); }
.cover-right { display: flex; gap: 12px; align-items: flex-start; }
.spine { writing-mode: vertical-rl; margin: 4px 0 0; font: 13px/20px var(--serif); color: var(--muted); letter-spacing: .14em; }
.spine span { display: block; }
.tiqian { writing-mode: vertical-rl; margin: 0; padding: 20px 11px 12px; font: 400 32px/1 var(--serif); color: var(--title); letter-spacing: .3em; border: 1px solid var(--accent); outline: 1px solid var(--line2); outline-offset: 4px; background: var(--bg); }

.colophon { padding: 8px 4px 2px; }
.row { display: grid; grid-template-columns: 70px minmax(0, 1fr); column-gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line2); margin: 0; }
.row-label { display: block; font: 15px/44px var(--serif); color: var(--accent); letter-spacing: .04em; }
.row-body { display: grid; gap: 8px; min-width: 0; }
.seg { display: inline-flex; width: max-content; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-width: 60px; height: 44px; padding: 0 14px; border: 1px solid var(--line2); font: 15px var(--serif); color: var(--muted); transition: color .3s, background .3s; }
.seg label + label span { border-left: 0; }
.seg input:checked + span { color: var(--title); background: var(--wash); box-shadow: inset 0 0 0 1px var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--mark); outline-offset: 1px; }
.picks { display: grid; gap: 8px; }
.picks-3 { grid-template-columns: 1.3fr 1fr 1fr; }
.picks-2 { grid-template-columns: 1fr 1fr; }
select, .place input, .pro-grid input, .pro-grid select {
  width: 100%; height: 44px; padding: 0 22px 0 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background-color: transparent; color: var(--title); font: 18px/1 var(--numeral); -webkit-appearance: none; appearance: none;
}
select {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 10px) 20px, calc(100% - 6px) 20px; background-size: 4px 4px; background-repeat: no-repeat;
}
select:has(option[value=""]:checked) { color: var(--muted); }
select:disabled { opacity: .45; cursor: not-allowed; }
option { background: var(--bg); color: var(--text); }
.place input, .pro-grid input { font: 16px var(--sans); padding-right: 30px; }
.place input::placeholder { color: var(--muted); }
select:focus, .place input:focus, .pro-grid input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.time-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 28px; }
.shichen { font: 15px var(--serif); color: var(--title); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.check input:focus-visible { outline: 2px solid var(--mark); outline-offset: 3px; }
.place { position: relative; }
.place-spin { position: absolute; right: 4px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--accent); opacity: 0; }
.place.is-busy .place-spin { opacity: 1; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.place-status { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.place-status[data-kind="ok"] { color: var(--accent); }
.place-status[data-kind="error"] { color: var(--mark); }
.ask { margin: 14px 0 0; padding: 14px; border: 1px solid var(--mark); background: color-mix(in srgb, var(--mark) 7%, transparent); }
.ask p { margin: 0 0 10px; font-size: 14px; color: var(--title); }
.ask-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.go-bar { position: sticky; bottom: 0; z-index: 2; margin: 0 -18px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.go { display: flex; align-items: center; justify-content: center; width: 100%; height: 54px; background: var(--accent); color: var(--on-accent); font: 400 18px/1 var(--serif); letter-spacing: .3em; padding-left: .3em; box-shadow: 0 8px 24px var(--shadow); transition: transform .2s var(--ease); }
.go:hover { transform: translateY(-1px); }
.is-casting .go span { animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.form-status { margin: 0; color: var(--mark); font-size: 14px; }
.form-status:not(:empty) { margin: 2px 2px 8px; }
.sample { display: flex; flex-direction: column; align-items: center; margin: 2px auto 0; min-height: 44px; padding: 4px 18px; font: 15px var(--serif); color: var(--accent); letter-spacing: .1em; }
.sample small { font: 12px var(--sans); color: var(--muted); letter-spacing: 0; }
.pro { margin: 8px 0 0; border-top: 1px solid var(--line2); }
.pro summary { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; min-height: 44px; padding: 12px 0 6px; list-style: none; cursor: pointer; font: 14px var(--serif); color: var(--accent); }
.pro summary::-webkit-details-marker { display: none; }
.pro summary::before { content: "+"; width: 12px; color: var(--muted); }
.pro[open] summary::before { content: "−"; }
.pro summary span { font: 12px var(--sans); color: var(--muted); }
.pro-grid { display: grid; gap: 12px; padding: 4px 0 12px; }
.pro-grid label:not(.check) { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.pro-grid select { font: 15px var(--sans); }

/* ---------- Report: 命书 ---------- */
.report { outline: none; padding: 0 0 120px; }
.book { width: 100%; max-width: 640px; margin: 0 auto; background: var(--bg); min-height: 100svh; box-shadow: 0 0 60px var(--shadow); }
.book-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 8px 0 14px; background: var(--bg); border-bottom: 1px solid var(--line2); }
.book-mark { width: 28px; height: 28px; flex: none; margin-right: 4px; }
.tabs { display: flex; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; flex: 1 0 auto; display: grid; place-items: center; min-width: 46px; height: 44px; padding: 0 4px; font: 15px var(--serif); color: var(--muted); text-decoration: none; letter-spacing: .06em; transition: color .4s; }
.tabs a.is-on { color: var(--title); }
.tabs a::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 18px; height: 1px; margin-left: -9px; background: var(--accent); opacity: 0; transition: opacity .4s; }
.tabs a.is-on::after { opacity: 1; }
.theme-btn { display: grid; place-items: center; flex: none; width: 40px; height: 44px; color: var(--accent); }
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn .i-moon { fill: currentColor; }
.theme-btn .i-sun { display: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.theme-btn .i-sun circle { fill: currentColor; stroke: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: inline; }
}
.book-head .theme-btn { width: 36px; }
.cover-top { display: flex; justify-content: space-between; align-items: center; }
.cover-theme { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; }
.cover-theme svg { width: 18px; height: 18px; }
.head-back, .head-btn { flex: none; min-height: 44px; padding: 0 8px; font: 14px var(--sans); color: var(--accent); }
.head-btn { display: none; }
.book-meta { display: flex; justify-content: space-between; gap: 12px; padding: 64px 22px 14px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.ai-pill { display: flex; align-items: center; gap: 8px; margin: 0 12px 16px; padding: 6px 6px 6px 14px; min-height: 36px; border: 1px solid var(--line2); color: var(--muted); font-size: 13px; line-height: 1.5; }
.ai-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.ai-pill span { flex: 1; }
.ai-pill[data-state="pending"] i { animation: breathe 1.4s ease-in-out infinite; }
.ai-pill[data-state="ok"] { color: var(--accent); }
.ai-pill[data-state="partial"] i { background: var(--mark); }
.ai-pill[data-state="error"] { color: var(--mark); border-color: var(--mark); }
.ai-pill[data-state="error"] i { background: var(--mark); }
.ai-pill button { flex: none; min-height: 32px; padding: 0 12px; border: 1px solid currentColor; font-size: 13px; color: inherit; }
[data-polish] { transition: opacity .22s ease; }
[data-polish].is-polishing { opacity: .15; }

.juan { margin: 0 10px 24px; padding: 18px 14px 24px; border: 1px solid var(--line); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--line2); scroll-margin-top: 64px; }
.with-margin { display: grid; grid-template-columns: 78px minmax(0, 1fr); column-gap: 12px; }
.margin { border-right: 1px solid var(--line2); padding-right: 8px; font-size: 12px; line-height: 1.6; color: var(--mark); overflow-wrap: anywhere; }
.margin-title { margin: 2px 0 10px; font: 13px/1 var(--serif); color: var(--accent); letter-spacing: .4em; }
.margin ul { margin: 0; padding: 0; list-style: none; }
.margin li { margin-bottom: 9px; }
.margin li span { display: block; color: var(--muted); }
.margin a { display: block; min-height: 24px; text-decoration: none; }
.margin a:hover { text-decoration: underline; text-underline-offset: 3px; }
.body { margin: 0; font: 15px/1.9 var(--sans); color: var(--text); }
.strip { writing-mode: vertical-rl; display: flex; align-items: center; gap: 10px; flex: none; width: 42px; padding: 14px 0 16px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); font-family: var(--serif); }
.strip-no { font-size: 14px; color: var(--accent); letter-spacing: .24em; }
.strip-mark { display: block; width: 14px; height: 9px; fill: var(--mark); }
.strip-name { font-size: 24px; color: var(--title); letter-spacing: .16em; }
.juan-open { display: flex; flex-direction: row-reverse; align-items: stretch; gap: 14px; margin-bottom: 18px; }
.lead { writing-mode: vertical-rl; margin: 0; max-height: 14.4em; padding: 12px 0 4px; font: 15px/2.1 var(--serif); color: var(--text); letter-spacing: .12em; }

.portrait { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.headline { writing-mode: vertical-rl; margin: 0; font: 400 50px/1.2 var(--serif); color: var(--title); letter-spacing: .05em; max-height: 560px; }
.pillars { display: flex; flex-direction: column; gap: 6px; width: 56px; margin: 0; padding: 0; list-style: none; }
.pillar { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 0 10px; border: 1px solid transparent; }
.pillar-label { font-size: 12px; line-height: 16px; color: var(--muted); }
.pillar-label b { margin-left: 4px; font: 400 13px var(--serif); color: var(--mark); }
.pillar-chars { writing-mode: vertical-rl; font: 22px/1 var(--serif); color: var(--text); letter-spacing: .14em; }
.pillar.is-day { border-color: var(--mark); }
.pillar.is-day .pillar-chars { color: var(--title); }
.portrait-text { border-top: 1px solid var(--line2); padding-top: 16px; }
.limit { margin: 12px 0 0; padding: 10px 12px; border-left: 2px solid var(--mark); color: var(--mark); font-size: 14px; }
/* 命印: the emblem under the portrait; the backdrop and the SVG follow the page palette. */
/* The key (每一处怎么读) is first in the markup so that opening it can number the parts on the emblem; the
   flex order puts it back under the emblem and its caption. */
.emblem-figure { display: flex; flex-direction: column; margin: 22px 0 0; }
.emblem-art { order: 1; position: relative; width: min(100%, 320px); aspect-ratio: 1; background: var(--bg) var(--emblem-day) center / cover no-repeat; }
.emblem-art svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.emblem-art .emblem-night { display: none; }
.emblem-read { order: 2; max-width: 420px; margin-top: 6px; }
.emblem-read > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font: 15px var(--serif); color: var(--accent); letter-spacing: .06em; cursor: pointer; list-style: none; }
.emblem-read > summary::-webkit-details-marker { display: none; }
.emblem-read > summary::after { content: ""; width: 7px; height: 7px; margin-top: -4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .3s var(--ease); }
.emblem-read[open] > summary::after { margin-top: 3px; transform: rotate(-135deg); }
.emblem-keys { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line2); }
.emblem-keys li { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 10px; padding: 10px 0 11px; border-bottom: 1px solid var(--line2); }
.emblem-keys i { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--pin); color: var(--bg); font: 600 11px/1 var(--sans); font-style: normal; }
.key-head { margin: 0; font-size: 15px; line-height: 1.5; }
.key-head b { margin-right: .7em; font: 400 15px var(--serif); color: var(--title); }
.key-head span { color: var(--text); }
.key-meaning { margin: 2px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.emblem-art .emblem-pins { opacity: 0; transition: opacity .35s var(--ease); pointer-events: none; }
.emblem-read[open] ~ .emblem-art .emblem-pins { opacity: 1; }
.pin-halo { fill: none; stroke: var(--bg); stroke-width: 1.5; stroke-linecap: round; }
.pin-line { fill: none; stroke: var(--pin); stroke-width: .6; stroke-linecap: round; }
.pin-dot { fill: var(--pin); stroke: var(--bg); stroke-width: .6; }
.pin circle { fill: var(--pin); stroke: var(--bg); stroke-width: .8; }
.pin text { fill: var(--bg); font: 700 4.6px var(--sans); text-anchor: middle; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .emblem-art { background-image: var(--emblem-night); }
  :root:not([data-theme="light"]) .emblem-art .emblem-day { display: none; }
  :root:not([data-theme="light"]) .emblem-art .emblem-night { display: block; }
}
:root[data-theme="dark"] .emblem-art { background-image: var(--emblem-night); }
:root[data-theme="dark"] .emblem-art .emblem-day { display: none; }
:root[data-theme="dark"] .emblem-art .emblem-night { display: block; }

/* 星图插页 */
.plate { margin: 0 0 22px; padding: 8px; border: 1px solid var(--line); background: var(--bg2); }
.orbit-stage { position: relative; height: 360px; overflow: hidden; background: radial-gradient(90% 70% at 50% 16%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 64%), var(--bg); touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.orbit-dial { position: absolute; inset: 0; width: 100%; height: 100%; }
.dial-rotor { transform-box: view-box; transform-origin: 600px 1360px; transition: transform 1.15s var(--ease); }
.ring { fill: none; stroke: var(--line); stroke-width: 1.6; }
.ring-outer { stroke: var(--line2); stroke-dasharray: 2 12; }
.ring-inner { stroke: var(--line2); }
.tick { stroke: var(--line2); stroke-width: 1.4; }
.tick-major { stroke: var(--accent); stroke-width: 2; opacity: .7; }
.dial-progress { fill: none; stroke: url(#progress-gradient); stroke-width: 4; stroke-linecap: round; transition: stroke-dasharray 1.15s var(--ease); }
.period { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; opacity: .5; }
.period-1 { opacity: .2; }
.period-guide { fill: none; stroke: none; }
.period-label { fill: var(--muted); font: 22px var(--sans); letter-spacing: .1em; }
.dial-node { cursor: pointer; }
.node-hit { fill: transparent; }
.node-shape { fill: var(--bg); stroke: var(--accent); stroke-width: 2.6; transition: fill .4s, stroke .4s; }
.dial-node.is-key .node-shape { stroke: var(--title); }
.dial-node.is-selected .node-shape { fill: var(--mark); stroke: var(--mark); }
.luck-mark { stroke: var(--title); stroke-width: 2.4; opacity: .6; }
.dial-label { fill: var(--muted); font: 24px var(--numeral); text-anchor: middle; dominant-baseline: middle; cursor: pointer; }
.dial-label.is-selected { fill: var(--title); font-weight: 600; }
.comet { fill: var(--mark); }
.comet-glow { transform-box: fill-box; transform-origin: center; }
.comet-tail { fill: none; stroke: var(--mark); stroke-width: 3.5; stroke-linecap: round; opacity: 0; }
.pointer { fill: var(--title); }
.stage-orbits ellipse { fill: none; stroke: var(--line2); stroke-width: 1.4; }
.stage-ball { fill: var(--mark); opacity: .75; offset-path: path("M 290 0 A 290 118 0 1 1 -290 0 A 290 118 0 1 1 290 0"); offset-rotate: 0deg; animation: ball-move 40s linear infinite; }
.stage-ball-b { animation-delay: -20s; }
.orbit-center { position: absolute; left: 0; right: 0; top: 38px; text-align: center; pointer-events: none; }
.orbit-kicker { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); letter-spacing: .06em; }
.orbit-kicker .flag { padding: 1px 8px; border: 1px solid var(--mark); color: var(--mark); font: 12px var(--serif); }
.orbit-year { margin: 4px 0 0; font: 400 84px/1 var(--numeral); color: var(--title); font-variant-numeric: lining-nums tabular-nums; }
.orbit-year number-flow { --number-flow-mask-height: .18em; }
.orbit-theme { margin: 8px 0 0; font: 400 20px/1.3 var(--serif); color: var(--accent); letter-spacing: .16em; }
.orbit-center.is-swapping .orbit-theme, .orbit-center.is-swapping .orbit-kicker { animation: rise .7s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.orbit-controls { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 10px; }
.icon-btn, .play-btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; border: 1px solid var(--line); background: var(--bg); color: var(--title); }
.icon-btn { width: 44px; }
.play-btn { gap: 6px; padding: 0 16px 0 12px; font: 14px var(--serif); letter-spacing: .1em; }
.icon-btn svg, .play-btn svg { width: 18px; height: 18px; }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.play-btn svg { fill: currentColor; }
.play-btn .i-pause, .play-btn[aria-pressed="true"] .i-play { display: none; }
.play-btn[aria-pressed="true"] .i-pause { display: inline; }
.play-btn[aria-pressed="true"] { border-color: var(--mark); color: var(--mark); }
/* The year under the star chart (the offline page lists every year under the two ten-year headings instead). */
.year-focus { margin-top: -8px; border-top: 1px solid var(--line); }
.index-head { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.index-head > div { padding: 10px 8px 9px; }
.index-head > div + div { border-left: 3px double var(--line2); }
.index-head b { display: block; font: 400 15px/1.5 var(--serif); color: var(--accent); }
.index-head span { font-size: 12px; color: var(--muted); }
.year-detail { padding: 18px 0 22px; border-bottom: 1px solid var(--line); }
.year-list-static .year-detail { border-bottom: 1px solid var(--line2); }
.year-meta { margin: 0; font-size: 13px; color: var(--muted); }
.year-num { margin-right: 8px; font: 30px/1 var(--numeral); color: var(--title); vertical-align: -3px; }
.year-meta2 { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.year-flag { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid var(--mark); font-size: 11px; line-height: 18px; color: var(--mark); }
.year-title { margin: 8px 0 10px; font: 400 24px/1.4 var(--serif); color: var(--title); letter-spacing: .06em; }
.act { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line2); font-size: 15px; line-height: 1.8; color: var(--title); }
.act b { margin-right: .6em; font: 400 13px var(--serif); color: var(--mark); letter-spacing: .3em; }

/* 七事 */
.topic { padding: 22px 0 24px; border-top: 1px solid var(--line2); }
.juan-open + .topic { border-top-color: var(--line); }
.topic-label { margin: 0 0 10px; font: 400 16px/1.4 var(--serif); color: var(--accent); letter-spacing: .08em; }
.topic-label i { font-style: normal; color: var(--muted); margin-right: .7em; }
.topic-headline { margin: 0 0 12px; font: 600 17px/1.7 var(--sans); color: var(--title); }
.points { margin: 0; padding: 0; list-style: none; }
.points li { position: relative; padding-left: 14px; margin-bottom: 6px; font-size: 15px; line-height: 1.8; }
.points li::before { content: ""; position: absolute; left: 1px; top: .78em; width: 5px; height: 5px; border: 1px solid var(--accent); border-radius: 50%; }

/* 十二月 */
.calendar { display: flex; flex-direction: row-reverse; border-top: 1px solid var(--line); }
.calendar + .calendar { border-top-color: var(--line2); border-bottom: 1px solid var(--line); }
.month { flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 212px; padding: 12px 0 14px; border-left: 1px solid var(--line2); transition: background .4s; }
.month:last-child { border-left: 0; }
.month-l { font: 15px/1.2 var(--serif); color: var(--accent); }
.month-g { margin: 3px 0 10px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.month-v { writing-mode: vertical-rl; }
.month-f { display: block; font: 16px/22px var(--serif); color: var(--title); letter-spacing: .08em; }
.month-n { display: block; font-size: 13px; line-height: 19px; color: var(--muted); }
.month[aria-pressed="true"] { background: var(--wash); }
.month[aria-pressed="true"] .month-l { color: var(--title); }
.month-facts { margin-top: 16px; }
.month-facts p { margin: 0; font-size: 14px; line-height: 1.75; color: var(--mark); }

/* 附卷 */
.juan-appendix { padding: 0; }
.appendix > summary { display: flex; gap: 14px; align-items: center; min-height: 72px; padding: 14px; cursor: pointer; list-style: none; }
.appendix > summary::-webkit-details-marker { display: none; }
.appendix-strip { writing-mode: vertical-rl; padding: 8px 6px; border: 1px solid var(--line); font: 15px var(--serif); color: var(--accent); letter-spacing: .3em; }
#appendix-title { display: block; font: 400 17px/1.4 var(--serif); color: var(--title); letter-spacing: .06em; }
.appendix-sub { display: block; font-size: 13px; color: var(--muted); }
.appendix-body { padding: 0 14px 18px; }
.ax-block { margin-top: 22px; }
.ax-block h4 { margin: 0 0 6px; font: 400 15px var(--serif); color: var(--accent); letter-spacing: .06em; }
.ax-note { margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.ax-block ul { margin: 0; padding-left: 20px; font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line2); }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: top; white-space: nowrap; }
thead th { color: var(--accent); font-weight: 600; background: var(--wash); }
tbody th { position: sticky; left: 0; color: var(--title); font-weight: 600; background: var(--bg); }
td { color: var(--text); }
#ai-payload { max-height: 360px; overflow: auto; padding: 12px; border: 1px solid var(--line2); background: var(--bg2); font-size: 12px; white-space: pre-wrap; }
.book-end { display: flex; flex-direction: column; align-items: center; padding: 18px 28px 40px; }
.fin { writing-mode: vertical-rl; margin-bottom: 18px; font: 16px/1 var(--serif); color: var(--accent); letter-spacing: .5em; }
.book-end p { margin: 0; font-size: 13px; line-height: 1.8; color: var(--muted); }

/* ---------- Dock, toast, sheet ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line2); }
.dock button { min-height: 48px; }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 40; width: min(92vw, 520px); transform: translateX(-50%); padding: 12px 16px; background: var(--title); color: var(--bg); font-size: 14px; box-shadow: 0 16px 40px var(--shadow); transition: opacity .3s, transform .3s; }
.toast.is-out { opacity: 0; transform: translate(-50%, 8px); }
.sheet { position: fixed; inset: auto 0 0; width: min(100%, 520px); max-width: 100%; max-height: 100%; margin: 0 auto; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; }
.sheet::backdrop { background: rgba(10, 8, 4, .62); }
.sheet-panel { position: relative; width: 100%; max-height: 100svh; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); text-align: center; animation: sheet-up .32s var(--ease); }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
.sheet-title { margin: 2px 0 12px; font: 400 17px/1.5 var(--serif); color: var(--title); letter-spacing: .08em; }
.sheet-image { display: block; width: min(76vw, 340px, calc((100svh - 230px) * .5625)); aspect-ratio: 9 / 16; height: auto; margin: 0 auto; border: 1px solid var(--line2); background: var(--bg2); -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.sheet-hint { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.sheet-note { max-width: 340px; margin: 12px auto 0; color: var(--text); font-size: 13px; line-height: 1.6; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.sheet-actions button { min-height: 48px; }
.is-sheet-open { overflow: hidden; }

/* ---------- Short phones: get the form onto the first screen ---------- */
@media (max-width: 719px) and (max-height: 780px) {
  .cover-face { min-height: 210px; padding: 20px 14px 16px; }
  .cover-mark { width: 52px; height: 52px; }
  .cover-value { font-size: 15px; line-height: 1.75; }
  .tiqian { font-size: 28px; }
  .row { padding: 8px 0; }
  .orbit-stage { height: 330px; }
  .orbit-year { font-size: 72px; }
}

/* ---------- Tablet and desktop ---------- */
/* 翻页版 (?pages=1, prototype): one screen per page between the sticky header and the dock. Pages snap lightly
   (proximity: only when a scroll ends near a page); 七事 swipes sideways through its seven cards, which snap firmly. */
html.is-snapping { scroll-snap-type: y proximity; scroll-padding-top: 56px; scroll-padding-bottom: var(--dock-h, 76px); }
.is-snapping .report { padding-bottom: var(--dock-h, 76px); }
.is-paged { --page-h: calc(100svh - 56px - var(--dock-h, 76px)); }
.page { display: grid; grid-template-columns: minmax(0, 1fr) 34px; column-gap: 10px; min-height: var(--page-h); padding: 14px 10px 14px 16px; border-bottom: 1px solid var(--line); scroll-snap-align: start; }
.page-body { display: flex; flex-direction: column; min-width: 0; }
.page-ear { display: flex; }
.page-ear .strip { align-self: stretch; width: 34px; padding: 10px 0; gap: 8px; }
.page-ear .strip-name { font-size: 20px; }
/* 封底: the last page centres the closing note over the appendix entry instead of leaving them at the top. */
.page-last { display: flex; flex-direction: column; justify-content: center; gap: 28px; min-height: var(--page-h); padding: 24px 16px; scroll-snap-align: start; }
.back-cover { display: flex; flex-direction: column; align-items: center; text-align: center; }
.back-mark { width: 64px; height: 64px; margin-bottom: 18px; }
.back-cover .fin { margin-bottom: 16px; }
.back-note { max-width: 20em; margin: 0; font-size: 13px; line-height: 1.8; color: var(--muted); }
.page-last .juan-appendix { margin: 0; }
.page-meta { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 8px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.is-paged .ai-pill { margin: 0 0 12px; min-height: 30px; padding: 2px 4px 2px 10px; font-size: 12px; }
.is-paged .ai-pill button { min-height: 26px; }
.page-title { margin: 0 0 4px; font: 400 15px/1.5 var(--serif); color: var(--accent); letter-spacing: .08em; }
.page-hint { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.page-empty { margin: auto 0; font-size: 15px; line-height: 1.9; color: var(--muted); }
.page-basis { margin: 10px 0 0; font-size: 12px; line-height: 1.65; color: var(--mark); }
.page-basis b { margin-right: .6em; font: 400 12px var(--serif); color: var(--accent); letter-spacing: .2em; }
.is-paged .body { font-size: 15px; line-height: 1.8; }
.is-paged .act { margin-top: 10px; padding-top: 8px; font-size: 14px; line-height: 1.7; }

.paged-portrait { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 0 0 14px; }
.paged-portrait .headline { font-size: 40px; max-height: 320px; }
.paged-portrait .pillars { gap: 2px; }
.paged-portrait .pillar { padding: 6px 0 8px; }
.paged-portrait .pillar-chars { font-size: 20px; }


.page-years .plate { margin: 0 0 8px; padding: 4px; }
.page-years .orbit-stage { height: clamp(220px, calc(var(--page-h) - 396px), 330px); }
/* The year card below carries the 干支, age and theme, so the chart keeps only the big year. */
.page-years .orbit-kicker, .page-years .orbit-theme { display: none; }
.year-card .page-basis { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.year-card .year-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 0; font-size: 12px; }
.year-card .year-num { font-size: 26px; }
.year-card .year-flag { margin-left: 6px; }
.year-card .year-title { margin: 4px 0 6px; font-size: 20px; }

/* 拨盘 (public/scrubber.js): a ruler that scrolls under a fixed centre mark; choices shrink and fade with their
   distance from the centre (--d, set per frame), the centred one takes the dial's colour. Each choice is a
   52px-wide target, so neighbours are hard to hit by mistake. */
.scrubber { --dial: var(--accent); position: relative; flex: none; margin: 2px 0 8px; }
.scrubber.is-key { --dial: var(--pin); }
.scrubber::before { content: ""; position: absolute; left: 50%; top: 0; z-index: 1; border: 5px solid transparent; border-top: 6px solid var(--dial); transform: translateX(-50%); pointer-events: none; }
.scrub-track { display: flex; overflow-x: auto; padding: 0 calc(50% - 26px); scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; border-bottom: 1px solid var(--line2); -webkit-mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent); mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent); }
.scrub-track::-webkit-scrollbar { display: none; }
.scrub-item { position: relative; flex: 0 0 52px; display: grid; place-items: center; height: 50px; scroll-snap-align: center; color: var(--muted); }
.scrub-item::before, .scrub-item::after { content: ""; position: absolute; bottom: 0; width: 1px; background: var(--line); }
.scrub-item::before { left: 0; height: 9px; }
.scrub-item::after { left: 50%; height: 5px; background: var(--line2); }
.scrub-item span { display: block; font: 400 20px/1 var(--numeral); transform: scale(calc(1.32 - var(--d, 0) * .2)); opacity: calc(1 - var(--d, 0) * .3); transition: color .25s; }
.scrubber.is-topic .scrub-item span { font: 400 19px/1 var(--serif); }
.scrub-item[aria-checked="true"] { color: var(--dial); }
.haptic-switch { position: fixed; left: -200px; top: 0; opacity: 0; pointer-events: none; }
.topic-pager { display: flex; flex: 1; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.topic-pager::-webkit-scrollbar { display: none; }
.topic-card { flex: 0 0 100%; min-width: 0; padding: 2px 2px 0; scroll-snap-align: start; scroll-snap-stop: always; }
.topic-card .topic-headline { font-size: 16px; line-height: 1.65; margin-bottom: 10px; }
.topic-card .points li { font-size: 14px; line-height: 1.7; margin-bottom: 4px; }

.month-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); direction: rtl; margin-top: 8px; border-top: 1px solid var(--line); }
.month-grid .month { direction: ltr; min-height: 0; padding: 8px 0 10px; border-left: 0; border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
.month-grid .month:nth-child(6n) { border-right: 0; }
.month-grid .month-g { margin-bottom: 6px; }
.month-grid .month-f { font-size: 15px; line-height: 20px; }
.month-detail { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line2); }
.md-head { margin: 0; font: 15px/1.6 var(--serif); color: var(--title); }
.md-head b { margin-right: .6em; font-weight: 400; color: var(--accent); }
.md-head span { margin-left: .6em; font: 13px var(--sans); color: var(--muted); }
.month-detail .page-basis { margin-top: 4px; }

/* 命印 page: numbers on the emblem are buttons; the chosen one stays lit, the others step back. */
.paged-emblem .emblem-art { margin: 4px auto 0; }
.paged-emblem.is-tap .emblem-art { width: clamp(200px, calc(var(--page-h) - 236px), 400px); max-width: 100%; }
.paged-emblem .emblem-art .emblem-pins { opacity: 1; }
.paged-emblem.is-tap .emblem-pins { pointer-events: auto; }
.paged-emblem.is-tap .pin { cursor: pointer; }
.pin-hit { fill: transparent; stroke: none; }
.paged-emblem.is-tap .pin, .paged-emblem.is-tap .pin-lead { opacity: .38; transition: opacity .3s var(--ease); }
.paged-emblem.is-tap[data-key-on="0"] [data-key="0"], .paged-emblem.is-tap[data-key-on="1"] [data-key="1"],
.paged-emblem.is-tap[data-key-on="2"] [data-key="2"], .paged-emblem.is-tap[data-key-on="3"] [data-key="3"],
.paged-emblem.is-tap[data-key-on="4"] [data-key="4"], .paged-emblem.is-tap[data-key-on="5"] [data-key="5"],
.paged-emblem.is-tap[data-key-on="6"] [data-key="6"], .paged-emblem.is-tap[data-key-on="7"] [data-key="7"] { opacity: 1; }
.paged-emblem.is-tap + .scrubber { margin-top: 10px; }
/* The entries stack in one grid cell; the chosen one slides in from the side the dial moved towards. */
.key-stage { display: grid; padding-top: 4px; touch-action: pan-y; }
.key-card { grid-area: 1 / 1; min-width: 0; opacity: 0; transform: translateX(14px); transition: opacity .28s var(--ease), transform .38s var(--ease); pointer-events: none; }
.key-stage[data-dir="prev"] .key-card:not(.is-on) { transform: translateX(-14px); }
.key-card.is-on { opacity: 1; transform: none; pointer-events: auto; }
.kc-head { display: flex; align-items: center; gap: 8px; margin: 0; font: 400 17px/1.4 var(--serif); color: var(--title); }
.kc-head i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--pin); color: var(--bg); font: 700 12px/1 var(--sans); font-style: normal; }
.kc-head b { font-weight: 400; }
.kc-value { margin: 4px 0 0 30px; font-size: 15px; line-height: 1.6; color: var(--text); }
.kc-meaning { margin: 2px 0 0 30px; font-size: 13px; line-height: 1.6; color: var(--muted); }
/* Filling each page: whatever room a page has left is shared out between its blocks instead of pooling at the
   foot, and tall screens (Safari on a 6.1" phone leaves about 720px per page) get larger type. */
.page-emblem .page-body, .page-months .page-body { justify-content: space-evenly; }
.paged-portrait { flex: 1 0 auto; align-items: center; }
.topic-card { display: flex; flex-direction: column; }
.basis-grid { margin-top: auto; padding-top: 12px; }
.basis-grid > p { margin: 0 0 6px; font: 400 12px var(--serif); color: var(--accent); letter-spacing: .3em; }
.basis-grid ul { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line2); }
.basis-grid li { padding: 6px 0 7px; border-bottom: 1px solid var(--line2); font-size: 13px; line-height: 1.5; color: var(--mark); }
.basis-grid li span { display: block; font-size: 11px; color: var(--muted); }
.month-grid .month-n { font-size: 12px; line-height: 16px; }
@media (min-height: 780px) {
  .paged-portrait .headline { font-size: 46px; max-height: 390px; }
  .paged-portrait .pillar { padding: 8px 0 10px; }
  .paged-portrait .pillar-chars { font-size: 22px; }
  .is-paged .body { font-size: 16px; line-height: 1.9; }
  .scrub-item { height: 56px; }
  .scrub-item span { font-size: 22px; }
  .kc-head { font-size: 19px; }
  .kc-head i { width: 24px; height: 24px; font-size: 13px; }
  .kc-value { margin-left: 32px; font-size: 17px; }
  .kc-meaning { margin-left: 32px; font-size: 15px; }
  .topic-card .topic-label { font-size: 17px; }
  .topic-card .topic-label { margin-bottom: 14px; }
  .topic-card .topic-headline { font-size: 18px; line-height: 1.75; margin-bottom: 18px; }
  .topic-card .points li { font-size: 16px; line-height: 1.85; margin-bottom: 8px; }
  .topic-card .act { margin-top: 18px; padding-top: 14px; font-size: 15px; line-height: 1.8; }
  .basis-grid li { font-size: 14px; padding: 8px 0 9px; }
  .basis-grid li span { font-size: 12px; }
  .month-grid .month { padding: 12px 0 14px; }
  .month-grid .month-l { font-size: 16px; }
  .month-grid .month-f { font-size: 17px; line-height: 22px; }
  .month-grid .month-n { font-size: 13px; line-height: 19px; }
  .md-head { font-size: 16px; }
  .month-detail { padding: 14px 14px; }
  .month-detail .page-basis { font-size: 13px; }
  .year-card .year-title { font-size: 22px; }
}
/* Short screens (WeChat on a 6.1" phone leaves about 575px per page): tighter portrait and star chart. */
@media (max-height: 760px) {
  .paged-portrait .headline { font-size: 34px; max-height: 270px; }
  .paged-portrait .pillar { padding: 3px 0 5px; gap: 3px; }
  .paged-portrait .pillar-chars { font-size: 18px; }
  .page-years .orbit-year { font-size: 60px; }
  .page-years .orbit-center { top: 24px; }
  .is-paged .body { line-height: 1.65; }
  .page-years .orbit-stage { height: 212px; }
  .basis-grid li { padding: 3px 0 4px; font-size: 12px; }
  .basis-grid li span { display: inline; margin-right: .4em; }
  .year-card .year-title { margin: 2px 0 4px; }
}
@media (max-height: 700px) {
  .page-years .orbit-stage { height: 192px; }
  .page-years .orbit-year { font-size: 52px; }
  .page-years .orbit-center { top: 18px; }
}

@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .dock { display: none !important; }
  .head-btn { display: inline-flex; align-items: center; }
  .toast { bottom: 28px; }
  .report { padding: 28px 0 60px; }
  .book { min-height: 0; }
  .book-meta { padding-top: 72px; }
  .juan { margin: 0 22px 28px; padding: 22px 22px 28px; }
  .with-margin { grid-template-columns: 96px minmax(0, 1fr); column-gap: 18px; }
  .headline { font-size: 58px; }
  .orbit-stage { height: 400px; }
  .orbit-year { font-size: 96px; }
}
@media (min-width: 960px) {
  .home { padding: 24px; }
  .cover { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 26px; max-width: 1060px; max-height: calc(100svh - 48px); padding: 18px; }
  .cover-face { min-height: 0; height: 100%; padding: 40px 32px 36px; }
  .cover-mark { width: 92px; height: 92px; }
  .cover-value { font-size: 18px; line-height: 1.9; }
  .spine { font-size: 15px; line-height: 24px; }
  .tiqian { font-size: 46px; padding: 28px 16px 16px; }
  .colophon { display: flex; flex-direction: column; padding: 6px 8px 0; overflow-y: auto; }
  .go-bar { position: static; margin: 4px 0 0; padding: 14px 0 6px; background: none; }
  .pro-grid { grid-template-columns: 1fr 1fr; }
  .pro-grid .check { grid-column: 1 / -1; min-height: 32px; }
}
@media (min-width: 960px) and (max-height: 820px) {
  .row { padding: 7px 0; }
  .cover-face { padding: 30px 26px 28px; }
  .tiqian { font-size: 40px; }
  .cover-mark { width: 76px; height: 76px; }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .orbit-ball, .stage-ball-a { offset-distance: 0%; }
  .orbit-ball-b, .stage-ball-b { offset-distance: 50%; }
}
@media print {
  :root, :root[data-theme] { --bg: #fff; --bg2: #fff; --desk: #fff; --accent: #22385A; --title: #111; --mark: #9E3524; --pin: #2A7A64; --text: #222; --muted: #555; --shadow: transparent; }
  .home, .dock, .toast, .book-head, .ai-pill, .theme-btn, .emblem-read, .orbit-controls, .head-back, #ai-preview { display: none !important; }
  .report { display: block !important; padding: 0; }
  .book { box-shadow: none; max-width: none; }
  .juan, .plate { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  th, td { white-space: normal; }
}
