#chart-tabs { display: flex; position: sticky; top: 0; z-index: 3; background: #211f1d; }
#chart-tabs button { flex: 1; min-height: 46px; background: transparent; color: #f9f6f1; border: 0; border-bottom: 2px solid transparent; font-weight: 550; }
#chart-tabs button[aria-selected="true"] { color: #e9cc90; border-bottom-color: #c4a165; }
.term { background: transparent; font: inherit; border: 0; border-radius: 2px; padding: 1px 2px; line-height: inherit; color: inherit; cursor: help; text-align: inherit; }
.term:focus-visible { outline-offset: 0; }
@media (hover:hover) { .term:hover { background: #e9dfca; text-decoration: underline; text-underline-offset: 3px; } }
.chart-matrix td > .term { display: block; margin: 0 auto; }
.chart-matrix .wood { color: #297344; } .chart-matrix .fire { color: #b23931; }
.chart-matrix .earth { color: #835327; } .chart-matrix .metal { color: #936914; } .chart-matrix .water { color: #285fab; }
.chart-matrix .star-name { color: #795c24; font-size: .82rem; line-height: var(--caption-leading); }
.matrix-scroll { overflow-x:auto; }
.pro-matrix { width:100%; table-layout:auto; }
.pro-matrix td,.pro-matrix th { min-width: 55px; white-space:nowrap; padding: 2px; }
.pro-matrix tbody th,.pro-matrix thead th:first-child { width:auto; min-width:43px; position:sticky; left:0; z-index:1; background:#f0eeea; }
.pro-matrix .hidden-stem span { display:inline; line-height:inherit; }
.pro-matrix td { border-left:1px solid #f1efea; }
.pro-matrix .natal-start { border-left:2px solid #d6c6a7; }
.pro-matrix tbody tr.large td { font-size:1.7rem; padding-block:3px; }
.pro-matrix tbody tr:not(.large) .term { font-size:.8rem; }
.chart-matrix .star-name { text-wrap:balance; }
#pro-pillars:not(.all-stars) .star-name ~ .star-name { display:none; }
.stars-toggle { background:transparent; border:0; color:#73592f; font-size:.8rem; cursor:pointer; }
.stars-toggle { color:inherit; white-space:nowrap; padding:4px 0; }
.stars-toggle::after { display:inline-block; content:""; width:4px; height:4px; margin:0 1px 3px 4px; border:solid currentColor; border-width:0 1px 1px 0; transform:rotate(45deg); }
.stars-toggle[aria-expanded="true"]::after { transform:rotate(225deg); margin-bottom:0; }
/* Keep the compact header shared between tabs. At larger type sizes tools get their own row. */
.birth-header { position:relative; display:flex; flex-wrap:wrap; align-items:center; gap:2px 6px; padding:3px 10px; }
.birth-summary { display:flex; flex:1 1 14em; flex-wrap:wrap; align-items:center; gap:2px 8px; min-width:0; }
.birth-header .birth-dates { flex:1 1 12em; font-size:.8rem; line-height:1.2; row-gap:0; }
.birth-tools { margin-inline-start:auto; }
.birth-tools .pro-header-actions { display:grid; justify-items:end; visibility:hidden; }
.professional-view .pro-header-actions { visibility:visible; }
.pro-header-actions > * { z-index:1; }
.chart-matrix .pillar-stars > :is(th,td) { vertical-align:top; }
.palace-switch,.pro-header-actions summary { color:#ecd6a6; font-size:.78rem; cursor:pointer; }
.palace-switch { display:flex; gap:5px; align-items:center; min-height:25px; }
.palace-switch input { appearance:none; margin:0; width:24px; height:14px; border:1px solid #938b7c; border-radius:10px; background:#595650; cursor:pointer; }
.palace-switch input::before { content:""; display:block; width:10px; height:10px; margin:1px; border-radius:50%; background:white; }
.palace-switch input:checked { background:#957440; }
.palace-switch input:checked::before { transform:translateX(10px); }
.pro-header-actions summary { padding:4px 0 4px 8px; }
.pro-options { position:absolute; top:100%; right:8px; z-index:4; padding:6px 12px; background:white; border:1px solid var(--line); border-radius:5px; box-shadow:0 3px 10px #302a2422; }
.pro-options label { display:flex; align-items:center; gap:6px; min-height:36px; color:var(--ink); font-size:.83rem; }
.pro-options select { font:inherit; color:inherit; background:white; padding:5px; border:1px solid var(--line); border-radius:4px; }
.chart-fold > summary { cursor:pointer; color:#675d4b; font-size:.84rem; padding:9px 14px; }
.chart-fold > summary { border-bottom:1px solid var(--line); }
#pro-status:empty { display:none; }
#flow-hint:not(:empty) { padding:0 14px; }
.relation-empty { margin:3px 14px; font-size:.86rem; }
.professional-view .mast-inner { min-height:34px; }
  .professional-view .wordmark { font-size:1rem; }
  .professional-view .seal { width:18px; height:20px; font-size:13px; }
  .professional-view #phone-link { padding-block:6px; }
  .professional-view #chart-tabs button { min-height:38px; }
  .professional-view #luck { border-top-width:2px; }
  .professional-view #luck .section-head { padding:5px 12px 1px; }
  .professional-view #luck-heading { font-size:1rem; }
  .professional-view #luck-start { font-size:.76rem; line-height:var(--caption-leading); margin:0 12px 3px; }
  .professional-view .luck-cell { gap:1px; padding:3px 0; min-height:44px; }
  .professional-view .luck-cell b { font-size:1.06rem; line-height:1.05; }
  .professional-view .luck-cell span { line-height:1.1; }
  .pro-matrix { table-layout:fixed; min-width:calc(32px + var(--columns) * 31px); line-height:1.15; }
  .pro-matrix th,.pro-matrix td { min-width:0; padding:1px 0; white-space:normal; }
  .pro-matrix tbody th,.pro-matrix thead th:first-child { min-width:0; width:32px; }
  .pro-matrix tbody tr.large td { font-size:1.5rem; line-height:1.06; padding-block:1px; }
  .pro-matrix .star-name { line-height:1.15; }
  .pro-matrix .term { max-width:100%; padding:0; }
  .pro-matrix .stars-toggle { font-size:.73rem; }
@media (max-width:410px) {
  .pro-matrix .hidden-stem span { display:none; }
  .pro-matrix .hidden-stem::after { content:attr(data-short); }
}
@media (max-width:560px) and (max-height:700px) {
  .professional-view .mast { display:none; }
  .professional-view #luck { display:flex; flex-direction:column; }
  .professional-view #luck :is(.section-head,#luck-change,.luck-board) { order:-1; }
  .professional-view #luck-start { margin-block:5px; }
}
.info-block h2,.relation-block h2 { font-size:1rem; padding:14px 16px 9px; }
.info-block dl { margin:0; }
.info-block dl > div { display:grid; grid-template-columns: minmax(7em,30%) minmax(0,1fr); align-items:center; padding:8px 16px; font-size:.88rem; gap:8px; }
.info-block dl > div:nth-child(odd) { background:#f5f4f1; }
.info-block dt { color:#60594f; }
.info-block dd { margin:0; overflow-wrap:anywhere; }
.relation-block { padding-block:5px; }
.relation-line { display:grid; grid-template-columns:3em minmax(0,1fr); padding:3px 16px; font-size:.84rem; line-height:var(--note-leading); }
.relation-line strong { color:#856832; }
.relation-line .term { margin:0 7px 1px 0; border-bottom:1px dotted #d3c5a9; }
#term-tip { box-sizing:border-box; position:fixed; inset:auto; width:max-content; max-width:min(340px,calc(100vw - 16px)); max-height:46dvh; overflow:auto; margin:0; padding:12px 32px 12px 14px; background:#fffdf7; border:1px solid #cabea1; border-radius:8px; color:#322e26; box-shadow:0 5px 20px #31291b33; z-index:50; }
#tip-heading { font-size:.94rem; color:#705426; }
#tip-text { margin:3px 0 0; font-size:.86rem; line-height:var(--note-leading); white-space:pre-line; }
#tip-close { position:absolute; top:2px; right:2px; width:30px; height:32px; border:0; background:transparent; font-size:1.12rem; color:#635644; }

/* Native-style profile and paired almanac rows. */
.info-view .workspace > aside { display:none; }
.info-profile { display:flex; align-items:center; gap:14px; padding:20px 16px 26px; color:#e7cf98; background:linear-gradient(125deg,#302b23,#1d1c1a 75%); }
.zodiac-seal { display:grid; place-items:center; flex:0 0 46px; height:46px; border:2px double #bfaa76; border-radius:50%; font:600 1.5rem var(--serif); }
.profile-name { flex:1; min-width:0; overflow-wrap:anywhere; border:0; padding:6px 0; text-align:left; background:none; color:inherit; font:600 1.08rem var(--serif); }
.profile-badges { display:grid; justify-items:end; gap:1px; white-space:nowrap; }
.profile-badges .term { padding:2px 8px; line-height:1.25; border:1px solid #544c40; border-radius:5px; background:#34302a; color:#fff8e8; font-size:.78rem; }
.info-sheet { margin:-10px 0 0; overflow:hidden; border-radius:12px 12px 0 0; background:white; position:relative; }
.info-sheet > div { display:grid; align-items:baseline; padding:5px 14px; column-gap:6px; font-size:.85rem; line-height:1.3; }
.info-sheet .info-single { grid-template-columns:auto 1fr; }
.info-sheet .info-pair { grid-template-columns:auto minmax(0,1fr) auto minmax(0,1fr); }
.info-sheet > div:nth-child(even) { background:#eeedeb; }
.info-sheet dt { color:#524e48; }
.info-sheet dd { margin:0; min-width:0; overflow-wrap:anywhere; }
.info-sheet .term { padding:0; }
.natal-section { padding:14px; border-top:6px solid #f3f2ef; background:#fff; }
.natal-section h2,.star-list h2 { margin:0; font:600 1rem var(--serif); }
.natal-heading { display:flex; align-items:center; justify-content:space-between; }
.natal-heading .term { color:#806536; font-size:.76rem; }
.natal-cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin-top:12px; background:#f7f5ef; border-radius:5px; padding:10px 0; }
.natal-stat { text-align:center; display:grid; gap:2px; padding:2px; }
.natal-stat + .natal-stat { border-left:1px solid #ded9cc; border-radius:0; }
.natal-section small,.star-period small { color:var(--muted); font-size:.76rem; }
.natal-stat strong,.natal-pattern > .term { font:600 .95rem var(--serif); color:#72582a; }
.strength-factors { margin:6px 0 0; font-size:.82rem; line-height:var(--note-leading); }
.strength-factors > div { display:grid; grid-template-columns:3.5em 1fr; gap:8px; padding:4px 4px; }
.strength-factors > div + div { border-top:1px solid #eeebe4; }
.strength-factors dt { font-weight:600; color:#59544e; }
.strength-factors dt.supported { color:#72582a; }
.strength-factors dd { margin:0; }
.natal-pattern { margin-top:10px; padding:8px 10px; border-left:2px solid #b39961; background:#fbfaf7; }
.natal-pattern > .term { margin-left:12px; }
.natal-pattern p { margin:3px 0 0; color:#686055; font-size:.8rem; line-height:var(--note-leading); }
.energy-summary { margin-top:12px; font-variant-numeric:tabular-nums; }
.energy-summary thead td { width:4rem; }
.energy-summary thead th { padding:8px 0 0; background:white; font:600 .94rem/1.4 var(--serif); }
.energy-summary tr > :not(:first-child) { border-inline-start:1px solid #ede9e1; }
.energy-summary tbody th { text-align:left; padding-inline:0; font-size:.78rem; white-space:nowrap; }
.energy-summary tbody tr + tr { border-top:1px solid #eeebe4; }
.energy-summary tbody tr:first-child td { padding-top:2px; }
.energy-summary strong { font-size:1.08rem; line-height:1.35; font-variant-numeric:tabular-nums; }
.energy-track { width:70%; height:4px; margin:6px auto 0; background:#f0ede7; border-radius:5px; overflow:hidden; }
.energy-track i { display:block; height:100%; background:currentColor; border-radius:inherit; }
#pro-relations .relation-line { grid-template-columns:5em minmax(0,1fr); }
#pro-relations .relation-block + .relation-block { border-top:1px solid var(--line); }
.star-list-head { display:flex; align-items:center; justify-content:space-between; background:#f4f3f1; padding:9px 14px; }
.star-list-head button { color:#766348; background:none; border:0; font-size:.8rem; }
.star-list-row { display:grid; grid-template-columns:4em minmax(0,1fr); align-items:start; gap:6px; padding:5px 14px; line-height:var(--caption-leading); }
.star-period { display:grid; justify-items:center; text-align:center; min-width:0; }
.star-period strong { display:inline-block; padding:2px 8px; font-size:.86rem; border-radius:14px; background:#f5f4f1; }
.star-period.selected strong { background:#94773d; color:white; }
.star-period small { display:block; font-size:.67rem; }
.star-tags { display:flex; flex-wrap:wrap; align-items:baseline; gap:1px 6px; color:#806735; font-size:.85rem; }
.star-tags .term { padding:2px 0; }
#luck .luck-cell b[data-god]::after { content:attr(data-god); color:#97584a; font:500 .62rem/1 sans-serif; vertical-align:middle; }
#annual-label { writing-mode:horizontal-tb; grid-template-rows:1fr auto; padding:5px 0; }
#annual-label span { writing-mode:vertical-rl; }
#annual-label small,.minor-year { white-space:nowrap; letter-spacing:0; font:.72rem/1.2 var(--serif); color:#625d55; }
#annuals .luck-cell { gap:2px; padding:5px 0; }
#annuals .minor-year { margin-top:auto; padding-top:2px; }
#map-body { padding:8px 14px; }
#map-body select { font:inherit; padding:4px 6px; }
.map-row { display:grid; grid-template-columns:3em minmax(4em,1fr) minmax(5em,1.1fr); align-items:center; margin:3px 0; gap:8px; font-size:.8rem; line-height:var(--note-leading); }
.map-row .term { text-align:center; background:#f4efe6; border-radius:4px; }
@media(max-width:370px) {
  #luck .band-title { flex-basis:30px; }
  #luck .luck-cell span { font-size:.63rem; }
  #luck .luck-cell b[data-god]::after { font-size:.55rem; }
}

@media (max-width:560px) and (max-height:620px) {
  .professional-view #luck .section-head { padding-block:0; }
  .professional-view .mobile-nav a { min-height:50px; }
}
#map-body { padding:0; }
.gz-board { --track-paper:#fffdf7; background:var(--track-paper); }
.gz-region h4 { margin:0; padding:6px 12px; background:#f6f0e4; color:#6a5b45; font:600 .7rem/1.2 var(--sans); letter-spacing:.09em; }
.gz-tracks { overflow-y:auto; max-height:clamp(110px,21vh,185px); scrollbar-width:thin; scrollbar-color:#c3b393 transparent; }
.gz-axis,.gz-tracks { background-image:repeating-linear-gradient(90deg,transparent 0 calc(100% / var(--gz-cols) - 1px),#e9decb calc(100% / var(--gz-cols) - 1px) calc(100% / var(--gz-cols))); }
.gz-axis { display:grid; grid-template-columns:repeat(var(--gz-cols),minmax(0,1fr)); border-block:1px solid #bbab8e; background-color:#f8f0e1; }
.gz-axis button { display:grid; align-content:center; justify-items:center; gap:1px; min-width:0; padding:6px 0; background:none; border:0; border-radius:0; }
.gz-axis button[aria-pressed=true] { background:#f6dfd0; box-shadow:inset 0 -3px #a73d32; }
.gz-axis small { white-space:nowrap; color:#635643; font:550 clamp(9px,2.8vw,12px)/1.25 var(--sans); }
.gz-axis b { font:700 clamp(18px,5.4vw,26px)/1.08 var(--serif); }
.gz-board .gz-lane { appearance:none; background:transparent; cursor:pointer; display:block; width:100%; height:38px; border:0; border-radius:0; position:relative; padding:0; color:#70503a; font:600 12px/1 var(--sans); }
.gz-lane + .gz-lane { border-top:1px dotted #eee5d6; }
.gz-region:last-child .gz-lane { color:#3f624f; }
.gz-stroke { position:absolute; top:26px; height:1px; background:currentColor; opacity:.75; }
.gz-end { position:absolute; top:18px; transform:translateX(-50%); padding-inline:2px; background:var(--track-paper); font:650 14px/1.15 var(--serif); }
.gz-caption { position:absolute; top:2px; width:var(--label-w); text-align:center; white-space:nowrap; font-size:11px; }
.gz-empty { margin:0; padding:10px 12px; color:var(--muted); font-size:.75rem; }

.chart-classics { margin:12px 0 16px; border:1px solid #d9ccb7; border-radius:8px; color:#392f23; background:#fffcf5; overflow:clip; --reader-top:calc(var(--top-edge,60px) + 41px); scroll-margin-top:var(--reader-top); }
#partial-chart .chart-classics { --reader-top:var(--top-edge,60px); }
.classic-heading,.classic-toolbar,.classic-cases h4,.classic-case header { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.classic-heading { padding:11px 12px 5px; flex-wrap:wrap; }
.classic-heading h2,.classic-text h3,.classic-cases h4 { margin:0; font-family:var(--serif,serif); }
.classic-heading h2 { font-size:1.08rem; }
.classic-heading small,.classic-source,.classic-case header span,.classic-case small { color:#746857; font-size:.74rem; }
.classic-shelf { position:sticky; top:var(--reader-top); z-index:2; background:#fffcf5; display:flex; align-items:center; gap:4px; padding:6px 5px 8px; border-bottom:1px solid #e5d7c2; }
.classic-books,.classic-chapters { display:flex; min-width:0; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:none; }
.classic-books::-webkit-scrollbar,.classic-chapters::-webkit-scrollbar { display:none; }
.classic-books { flex:1; gap:4px; scroll-snap-type:x proximity; }
.classic-book { flex:0 0 calc((100% - 12px)/4); scroll-snap-align:start; min-width:0; min-height:42px; padding:4px 1px 4px 4px; border:1px solid #d9cbb5; border-left:3px double #b4a286; border-radius:3px; background:#f6efe1; color:#584b39; font:600 clamp(12px,3.4vw,16px)/1.15 var(--serif,serif); white-space:nowrap; }
.classic-book[aria-pressed=true] { color:#fffaf0; background:#884432; border-color:#76422f; border-left-color:#e5c5a1; }
.classic-shelf-arrow { flex:none; width:24px; min-height:38px; padding:0; font:24px/1 sans-serif; border:0; color:#604e36; background:transparent; }
.classic-shelf-arrow:disabled { opacity:.25; }
.classic-toolbar { padding:0; align-items:center; flex-wrap:wrap; gap:4px 8px; }
.classic-toolbar .classic-modes { margin-left:auto; flex:none; }
.classic-modes { display:inline-flex; padding:2px; border:1px solid #dbcfbc; background:#f0eadf; border-radius:6px; }
.classic-modes button { min-height:29px; padding:3px 9px; border:0; background:transparent; color:#615749; font:inherit; font-size:.84rem; border-radius:4px; }
.classic-modes button[aria-pressed=true] { background:#435944; color:#fffdf5; }
.classic-chapters { gap:6px; padding:3px 12px 6px; }
.classic-chapters button { flex:none; min-height:30px; padding:3px 8px; background:transparent; border:0; border-bottom:2px solid transparent; font:inherit; font-size:.81rem; color:#655848; }
.classic-chapters button[aria-pressed=true] { color:#8a3a2b; border-color:#a64f3d; font-weight:650; }
.classic-text,.classic-evidence,.classic-cases { margin:8px 13px 13px; }
.classic-text { overflow-wrap:anywhere; }
.classic-text h3 { font-size:1.13rem; line-height:1.35; }
.classic-article-meta { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:2px 8px; margin:2px 0 8px; }
.classic-source { margin:0; }
.classic-article-meta button { padding:4px 0 4px 9px; border:0; background:transparent; color:#874332; font:600 .78rem/1.4 sans-serif; }
.classic-cases { scroll-margin-top:calc(var(--reader-top) + 64px); }
.classic-pair + .classic-pair { padding-top:10px; margin-top:10px; border-top:1px solid #e9dfcb; }
.classic-pair small { font:600 .73rem/1.2 sans-serif; color:#80523a; }
.classic-pair p,.classic-case-note { margin:3px 0; line-height:1.65; text-align:start; }
.classic-original p { font-family:var(--serif,serif); }
.classic-translation { padding:6px 9px; background:#f1f3e9; border-radius:4px; margin-top:6px; }
.classic-translation small { color:#486347; }
.classic-translation p { color:#354033; font-size:.91rem; }
:is(.classic-text,.classic-cases)[data-mode="原文"] .classic-translation,:is(.classic-text,.classic-cases)[data-mode="译文"] .classic-original { display:none; }
.classic-text[data-mode="译文"] .classic-translation { background:transparent; padding:0; margin:0; }
.classic-evidence { padding:8px 0; border-block:1px solid #e4d8c2; display:flex; align-items:baseline; gap:8px; font-size:.83rem; line-height:1.45; color:#4d5845; }
.classic-evidence b { flex:none; }
.classic-cases:empty { display:none; }
.classic-cases h4 { justify-content:start; font-size:1rem; }
.classic-cases h4 small { font:500 .75rem/1 sans-serif; color:#796953; }
.classic-case { margin-top:8px; padding:8px 9px; background:#f6f0e5; border-radius:5px; }
.classic-case header { align-items:baseline; flex-wrap:wrap; font-size:.81rem; }
.classic-case-pillars { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); margin:7px 0 4px; }
.classic-case-pillars div { text-align:center; }
.classic-case-pillars div+div { border-left:1px solid #dcd0bd; }
.classic-case-pillars dt { font-size:.74rem; color:#766958; }
.classic-case-pillars dd { margin:1px 0; font:600 1.05rem/1.35 var(--serif,serif); }
.classic-case-note { font-size:.86rem; }
.classic-case small { display:block; margin-top:4px; }
.classic-loading,.classic-empty,.classic-retry { margin:12px; }
@media(prefers-reduced-motion:reduce) { .classic-books { scroll-behavior:auto; } }
.classic-article-actions { display:flex; align-items:center; flex-wrap:wrap; }
.classic-study { margin:12px 13px; border-block:1px solid #ddcfb9; padding:10px 0; scroll-margin-top:calc(var(--reader-top) + 64px); }
.classic-study h4,.classic-case-study h5 { margin:0 0 5px; font:650 .97rem/1.35 var(--serif,serif); color:#503d2c; }
.classic-case-study { margin-top:8px; padding-top:7px; border-top:1px solid #dfd3c0; }
.classic-reasoning { margin:0; }
.classic-reasoning > div { display:grid; grid-template-columns:4.2em minmax(0,1fr); gap:6px; padding:4px 0; align-items:baseline; }
.classic-reasoning dt,.classic-comparison b { font:650 .77rem/1.45 var(--sans,sans-serif); color:#486147; }
.classic-reasoning dd,.classic-comparison { margin:0; font-size:.88rem; line-height:1.57; overflow-wrap:anywhere; }
.classic-comparison { padding:7px 8px; margin-top:4px; background:#fffaf1; border-radius:4px; }
.classic-comparison b { margin-right:6px; }
.classic-match-basis { margin:3px 0 6px; color:#5b554b; font-size:.84rem; line-height:1.5; }
#case-note h3 { font:650 1rem/1.4 var(--serif,serif); margin:6px 0; }

:root { --mountain-art: url("/assets/23940002bb85b0e4/mountains-small.webp"); }

/* 浅土盘面，木绿辅助操作，朱红主操作。 */
:root {
  color-scheme:light;
  --ground:#f6efe2; --sheet:#fffdf7; --raised:#f4ebdc; --deep:#f5eedf;
  --ink:#312b20; --muted:#695e50; --line:#ded3c0;
  --relation-red:#b13e32; --flame:#9f3530; --sand:#765333; --clay:#ebd9bc; --leaf:#35573f;
  --wood-button:#415e43; --red-button:#af403c; --red-wash:#f2d6cd;
  --gold:var(--sand); --dark:var(--deep); --mast-h:max(60px,3.75rem);
  --serif:"Songti SC","STSong","Noto Serif CJK SC",serif;
  --sans:"PingFang SC","Hiragino Sans GB",system-ui,sans-serif;
  font-family:var(--sans); color:var(--ink); background:#e7d9c4;
}
html { scroll-padding-block:calc(var(--mast-h) + 44px + env(safe-area-inset-top)) 74px; }
body { background:#eae2d4; }
.app-shell,.app-shell:has(#entry:not([hidden])),.app-shell:has(#records:not([hidden])) { background:var(--ground); box-shadow:0 0 0 1px #d4c2a9,0 12px 90px #48342112; }
.app-shell { --top-edge:calc(var(--mast-h) + env(safe-area-inset-top)); padding-top:var(--top-edge); padding-bottom:calc(70px + env(safe-area-inset-bottom)); }
.icon-sprite { position:absolute; width:0; height:0; overflow:hidden; pointer-events:none; }
.ui-icon { width:1.1em; height:1.1em; flex:none; fill:none; stroke:currentColor; stroke-width:1.55; stroke-linecap:round; stroke-linejoin:round; vertical-align:-.16em; }
:focus-visible,.segments input:focus-visible + span { outline-color:var(--flame); }
.mast,.professional-view .mast { display:block; position:fixed; inset:0 0 auto; z-index:9; margin:auto; max-width:560px; padding-top:env(safe-area-inset-top); background:var(--ground); }
.mast-inner,.professional-view .mast-inner { justify-content:space-between; height:var(--mast-h); min-height:0; padding:0 18px; }
.mast .brand { display:flex; align-items:center; gap:9px; min-width:0; text-align:left; }
.mast .brand > div { min-width:0; }
.app-shell:has(#entry:not([hidden])) .brand { padding:0; }
.brand img { flex:none; width:38px; height:38px; border-radius:7px; background:#140915; }
.wordmark,.professional-view .wordmark { justify-content:start; font:800 1.28rem/1.1 var(--serif); letter-spacing:.12em; color:var(--ink); }
.mast .brand-line { display:block; margin:2px 0 0; color:var(--sand); font:.65rem/1.2 var(--sans); letter-spacing:.08em; }
#phone-link,.professional-view #phone-link { position:static; display:flex; align-items:center; gap:6px; min-height:36px; padding:0 10px; border:1px solid #60755a; border-radius:20px; background:var(--wood-button); color:#f5f8ee; text-decoration:none; font-size:.72rem; }
#phone-link svg { width:15px; height:15px; }
.mobile-nav { z-index:8; max-width:560px; padding:0 0 env(safe-area-inset-bottom); background:#fbf4e8; border-color:var(--line); }
.mobile-nav a,.professional-view .mobile-nav a { flex-direction:column; gap:3px; min-height:52px; color:var(--muted); font-size:.71rem; }
.mobile-nav a[aria-current=page] { color:var(--flame); font-weight:650; }
.mobile-nav a[aria-disabled=true] { color:#786d60; }
.mobile-nav svg { width:21px; height:21px; }
.mobile-nav #analysis-button { display:none; }
#entry,#records { padding:6px 15px 22px; background:var(--ground); }
.today-card { --almanac-inset:clamp(12px, 4vw, 20px); overflow:hidden; margin:0 0 14px; padding:0; border:1px solid #cebfa6; border-radius:8px; background:var(--sheet); }
.records-heading::before { content:""; position:absolute; z-index:-1; inset:0; pointer-events:none; background-image:linear-gradient(90deg,#f7efdfed,transparent 75%),var(--mountain-art); background-size:cover; background-position:right center; }
.dial-layout { display:grid; grid-template-columns:minmax(0,1fr) clamp(82px,23vw,100px); gap:12px; align-items:center; padding:10px var(--almanac-inset); background-color:#f3e5ce; background-image:linear-gradient(90deg,#f8efdf 4%,#f7ecd8d9 42%,#f3e4c833 82%),var(--mountain-art); background-position:center,right 48%; background-size:cover; }
.dial-date { min-width:0; }
.almanac-heading { display:flex; align-items:center; flex-wrap:wrap; gap:5px 8px; color:#614c35; }
.dial-date h2 { margin:0; font:700 .86rem/1.2 var(--serif); letter-spacing:.06em; }
#today-year { padding-left:8px; border-left:1px solid #c7af8b; font:.72rem/1 var(--sans); color:#705e48; }
#today-solar { display:block; margin:5px 0 3px; color:#403326; font:600 clamp(2rem,9vw,2.65rem)/1 var(--sans); font-variant-numeric:tabular-nums; letter-spacing:-.035em; }
#today-lunar { color:#594b39; font-size:.78rem; margin:0; line-height:1.25; }
#hour-dial { display:block; width:100%; aspect-ratio:1; height:auto; }
.dial-face { fill:#f5e4c7; stroke:#b28d64; stroke-width:1; }
.dial-rim,.dial-tick { stroke:#917859; fill:none; stroke-width:.75; }
.dial-letter { fill:#493d32; text-anchor:middle; font:600 9px var(--serif); }
.dial-current { fill:#863c27; }
.dial-letter.active { fill:#fff1db; }
.dial-needle { fill:#a0462b; stroke:#843b26; stroke-width:.5; }
.dial-hub { fill:#4a372a; stroke:#edc397; stroke-width:1; }
#today-pillars { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); margin:0; padding:0; min-width:0; border:0; }
.today-pillar { grid-template-columns:repeat(2,max-content); justify-content:center; align-content:center; column-gap:0; row-gap:3px; border-color:#e3d6c1; }
.today-pillar small { grid-column:1/-1; color:var(--muted); font-size:.7rem; }
.today-pillar b { font:650 clamp(1.2rem,5.4vw,1.52rem)/1.08 var(--serif); }
.today-reading { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; padding:8px 10px 8px 2px; border-top:1px solid #ddceb7; }
#beijing-clock { margin:4px 0 0; color:#584b3a; font:.75rem/1.25 var(--sans); font-variant-numeric:tabular-nums; }
#instant-chart { display:inline-flex; justify-content:center; align-items:center; gap:6px; min-height:40px; margin:0; padding:0 9px; white-space:nowrap; border:0; background:var(--wood-button); color:#f5f8ee; font-size:.8rem; }
.entry-title,.records-heading h1,.section-head h2,.natal-section h2,.relation-block h2,.star-list h2,#editor-title,#records-empty h2 { color:var(--ink); font-family:var(--sans); font-weight:650; }
.entry-title { margin:0 0 10px 2px; font-size:1.15rem; }
.entry-card { padding:12px 13px 2px; border:1px solid var(--line); background:var(--sheet); border-radius:15px; }
.choice-pair,.birth-clock-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.choice-pair .form-choice { border:0; min-height:0; }
.choice-pair .form-choice legend { float:none; height:auto; font-size:.72rem; color:var(--muted); margin-bottom:4px; }
.choice-pair .segments { justify-content:stretch; gap:2px; min-height:0; padding:3px; background:var(--deep); border-radius:9px; }
.segments label + label { margin:0; }
.choice-pair .segments label { flex:1; min-width:0; min-height:32px; }
.segments span { min-width:0; padding-inline:8px; height:32px; border-radius:6px; background:transparent; color:var(--muted); }
.segments input:checked + span { background:var(--wood-button); color:#f5f8ee; }
.entry-option .segments input:disabled + span { background:var(--deep); color:#807566; }
.birth-clock-fields { padding:12px 0; }
.birth-clock-fields .form-row { grid-template-columns:minmax(0,1fr); align-content:start; gap:2px; padding:8px 9px; background:var(--deep); border:1px solid var(--line); border-radius:9px; }
.birth-clock-fields .form-row label,.birth-clock-fields .field-label { font-size:.72rem; color:var(--muted); }
.birth-clock-fields .form-row input { min-height:27px; height:27px; width:100%; text-align:left; justify-self:stretch; }
.birth-clock-fields input::-webkit-date-and-time-value { text-align:left; }
.birth-clock-fields:has(#lunar-fields:not([hidden])) { grid-template-columns:1fr; }
.birth-clock-fields #lunar-fields { display:flex; align-items:center; justify-content:space-between; }
.birth-clock-fields .lunar-selects select { background:var(--deep); }
.entry-card .form-row small { color:var(--muted); font-size:.65rem; }
.entry-option,.form-row,.region-field { border-color:var(--line); }
.entry-option summary,.entry-save .form-row,.entry-card .save-row { min-height:44px; }
.entry-option summary,.form-row > label,.field-label { font-size:.86rem; color:var(--ink); }
.form-row > label .ui-icon,.field-label .ui-icon,.entry-option summary .ui-icon { color:var(--leaf); width:15px; height:15px; }
.form-row > label .ui-icon,.field-label .ui-icon { margin-right:5px; }
.entry-save { gap:8px; }
.region-selects select,.time-preview,.pro-options select,#map-body select { background:var(--deep); color:var(--ink); border-color:var(--line); border-radius:6px; }
.time-preview dt,.entry-option summary span,.entry-option .region-field legend { color:var(--muted); }
.form-row input::placeholder,.record-search input::placeholder { color:#746957; }
#save-record { background:#b9ab97; }
#save-record:checked,.palace-switch input:checked { background:var(--wood-button); }
.primary,#go-entry,#commit-edit { display:inline-flex; align-items:center; justify-content:center; gap:9px; border:0; background:var(--red-button); color:#fff6ee; border-radius:10px; font-family:var(--sans); font-weight:700; }
.primary { min-height:47px; margin-top:12px; letter-spacing:.06em; }
.primary:active,#go-entry:active,#commit-edit:active { background:#8e302e; }
.status,#delete-record { color:var(--flame); }
.retry,.edit-record,.star-list-head button,.natal-heading .term { color:var(--leaf); }
/* internal pages */
/* 卷首页题与检索栏 */
.records-heading { position:relative; isolation:isolate; overflow:hidden; display:grid; justify-content:start; align-content:center; justify-items:start; gap:4px; min-height:116px; margin:0 0 12px; padding:17px 23px; border:1px solid #cfbea1; border-radius:5px; }
.records-heading::before { background-position:78% 54%; }
.records-heading h1 { margin:0; font:750 1.9rem/1.15 var(--serif); letter-spacing:.08em; }
.record-tools { display:grid; grid-template-columns:minmax(0,1fr) minmax(92px,31%); gap:8px; }

#record-count { font-variant-numeric:tabular-nums; }
.record-title .group-tag { border:1px solid #d9d2bc; border-radius:3px; padding:1px 5px; font:.65rem/var(--caption-leading) var(--sans); color:#546048; background:#f4f3e8; overflow-wrap:anywhere; }
.record-search,.pro-options,#record-editor { background:var(--sheet); border:1px solid var(--line); border-radius:11px; }
.record-search svg { stroke:var(--leaf); }
.record-search input { color:var(--ink); }
.filter-row { min-width:0; position:relative; padding:0; }
.filter-row select { appearance:none; width:100%; max-width:100%; height:100%; border:1px solid #c9cdb9; border-radius:6px; background:#eef0e3; color:var(--leaf); padding:0 22px 0 12px; font:600 .82rem var(--sans); text-overflow:ellipsis; }
.filter-row::after { content:""; pointer-events:none; position:absolute; right:11px; top:50%; width:6px; height:6px; border:solid var(--leaf); border-width:0 1.5px 1.5px 0; transform:translateY(-65%) rotate(45deg); }
#record-list { display:grid; gap:0; margin-top:12px; overflow:hidden; background:var(--sheet); border:1px solid var(--line); border-radius:6px; }
#record-list:empty { display:none; }
.record-row,.record-row:last-child { padding:0 7px 0 0; background:transparent; border:0; }
.record-row + .record-row { border-top:1px solid var(--line); }
.record-row .record-item { display:grid; grid-template-columns:3.55rem minmax(0,1fr); align-items:center; column-gap:12px; padding:15px 0 15px 13px; background:transparent; color:var(--ink); min-width:0; }
.record-date { display:grid; align-content:center; justify-items:center; gap:2px; align-self:stretch; padding-right:9px; border-right:1px solid #dfd0ba; font-variant-numeric:tabular-nums; white-space:nowrap; }
.record-date b { color:#89503a; font:500 1.15rem/1.2 var(--sans); font-variant-numeric:lining-nums tabular-nums; }
.record-date span { color:var(--muted); font:.66rem/1.4 var(--sans); }
.record-details { display:grid; min-width:0; gap:2px; }
.record-title { align-items:center; gap:6px; }
.record-item strong { font:750 1.05rem/1.3 var(--serif); }
.record-item .record-pillars { display:flex; flex-wrap:wrap; gap:0 .57em; color:#675032; font:600 .91rem/var(--caption-leading) var(--serif); letter-spacing:.01em; }
.record-item .record-meta { font:.74rem/var(--caption-leading) var(--sans); font-variant-numeric:tabular-nums; }
.edit-record { display:inline-flex; align-items:center; gap:3px; justify-content:center; padding:4px; font-size:.76rem; }
.edit-record .ui-icon { width:13px; height:13px; }
.record-actions { display:grid; justify-items:stretch; align-items:center; }
.resume-record { min-height:40px; padding:0 7px; border:0; background:transparent; color:var(--leaf); font-size:.76rem; font-weight:650; white-space:nowrap; }
.book-mark { width:52px; height:52px; color:var(--sand); background:var(--clay); border:1px solid #6e5845; border-radius:14px; }
.book-mark svg { width:26px; height:26px; }
#records-empty { padding:36px 16px; }
#chart-tabs { top:var(--top-edge); background:var(--deep); border-bottom:1px solid var(--line); }
#chart-tabs button,#chart-tabs button[aria-selected=true] { min-height:40px; color:var(--muted); font:600 .88rem var(--sans); border-bottom:2px solid transparent; }
#chart-tabs button[aria-selected=true] { color:var(--flame); border-bottom-color:var(--flame); background:var(--red-wash); }
/* 三个命盘共用的题头与印色。 */
.workspace aside,.info-profile {
  color:#fff9e9; background-color:#294437;
  background-image:linear-gradient(100deg,rgba(32,59,46,.97) 12%,rgba(39,66,52,.94) 62%,rgba(34,56,44,.84)),var(--mountain-art);
  background-position:center,right 56%; background-size:cover;
  border-bottom:1px solid #9b805a;
}
.pro-header-actions summary,.palace-switch { color:#f2dfb7; }
#chart-name,.profile-name { color:#fff9e9; font-family:var(--serif); font-weight:750; }
.profile-name { font-size:1.3rem; }
#birth-solar > span:last-child { font-weight:650; }
#place-summary,#timing-summary { color:inherit; }
.palace-switch input { background:#53645a; border-color:#a6b4a1; }
.palace-switch input:checked { background:#ad4634; }
.workspace aside :focus-visible,.info-profile :focus-visible { outline-color:#f3d89d; }
#chart,#luck,#pro-links,.info-sheet,.natal-section,.luck-board,.luck-cell { background:var(--sheet); color:var(--ink); }
.info-sheet { margin:0; border-radius:0; }
.info-profile { padding:13px 15px; }
.zodiac-seal,#birth-kind { background:#a24633; color:#fff2d7; border:1px solid #ce9779; box-shadow:inset 0 0 0 2px #a24633,inset 0 0 0 3px #d89e7c; }
.info-profile .profile-badges .term { color:#f4e9d2; background:#34503f; border-color:#73856e; }
.info-profile .profile-badges .term:hover { background:#435d49; }
.info-sheet dt,.info-sheet dd,.natal-pattern p,.strength-factors dt,.minor-year,#annual-label small { color:var(--muted); }
.info-sheet dd,.strength-factors dt.supported,.natal-stat strong { color:var(--ink); }
.chart-matrix,.energy-summary { background:var(--sheet); }
thead th,.pro-matrix tbody th,.pro-matrix thead th:first-child,.band-title,.star-list-head { background:#e7d5b7; color:#51402f; }
.info-sheet > div:nth-child(even),tbody tr:nth-child(even),.info-block dl > div:nth-child(odd) { background:#f6eedf; }
.pro-matrix td,.energy-summary tr > :not(:first-child),.strength-factors > div + div,.energy-summary tbody tr + tr,.luck-cell { border-color:var(--line); }
.pro-matrix .natal-start { border-left:1px solid #ddcfbb; }
.natal-section { border-color:var(--ground); }
#chart:not([hidden]) + #luck { border-top:2px solid #f1e8d9; }
.natal-cards { background:var(--raised); }
.natal-stat + .natal-stat { border-color:var(--line); }
.natal-pattern { background:var(--clay); border-color:#bc8b63; }
.natal-pattern > .term,.relation-line strong,.star-tags,.chart-matrix .star-name { color:var(--sand); }
.natal-pattern p { color:#524332; }
.chart-fold > summary { color:var(--ink); }
.energy-summary thead th { background:var(--sheet); }
.energy-track { background:#e2d5c4; }
.energy-summary .ui-icon { display:block; width:16px; height:16px; margin:0 auto 3px; }
/* end internal pages */
.wood,.chart-matrix .wood { color:#197c32; }
.fire,.chart-matrix .fire { color:#c32022; }
.earth,.chart-matrix .earth { color:#80543d; }
.metal,.chart-matrix .metal { color:#9c6a00; }
.water,.chart-matrix .water { color:#235ed1; }
.chart-matrix td > .element-term { display:inline-flex; align-items:baseline; justify-content:center; gap:3px; white-space:nowrap; }
.element-term .element-mark { width:clamp(16px,4.6vw,20px); height:auto; aspect-ratio:1; align-self:center; margin-top:.14em; }
/* internal pages */
#luck .luck-cell b[data-god]::after { color:#984731; }
.star-period.selected strong { background:var(--red-wash); color:var(--flame); }
.chart-matrix,#luck,.luck-board,#luck .luck-cell:not([aria-pressed=true]) { background:#fffdf8; }
.chart-matrix tbody tr:nth-child(even) { background:#faf6ed; }
.chart-matrix thead th,.pro-matrix tbody th,.pro-matrix thead th:first-child,#luck .band-title { background:#f4ecdd; }
.chart-matrix,.chart-matrix td,.luck-board,.luck-band + .luck-band,#luck .luck-cell { border-color:#e8dfce; }
#luck-heading { display:flex; align-items:center; gap:6px; }
.luck-actions { display:flex; align-items:center; justify-content:flex-end; gap:6px; color:var(--muted); font-size:.76rem; }
#luck-today { flex:none; min-width:36px; min-height:36px; padding:0; border:1px solid #c4cfba; border-radius:6px; color:var(--leaf); background:#edf1e5; font:700 .9rem var(--sans); }
#luck-change { display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 6px; margin:0; padding:4px 12px; border-block-start:1px solid var(--line); background:var(--sheet); font-variant-numeric:tabular-nums; }
#luck-change[hidden] { display:none; }
#luck-change time,.luck-change-periods { white-space:nowrap; }
.luck-change-periods { color:var(--flame); }
@media(max-width:380px) {
  #luck-direction { max-width:7.7em; text-align:right; }
}
#selected-year { padding:2px 6px; border-radius:3px; color:#963930; background:#fae9df; font:650 .8rem/1.3 var(--sans); font-variant-numeric:tabular-nums; white-space:nowrap; }
#luck .luck-cell[aria-pressed=true] { color:#fffaf0; background:#a73d34; }
#luck .luck-cell[aria-pressed=true] :is(span,b,small),
#luck .luck-cell[aria-pressed=true] b[data-god]::after { color:inherit; }
#annuals .luck-cell[aria-pressed=true] > span { font-weight:750; }

.star-period strong,.map-row .term { color:var(--ink); background:var(--raised); }
#record-editor { padding:18px; }
#record-editor::backdrop { background:#1d140faa; }
.dialog-actions button { border-radius:8px; }
#cancel-edit { background:var(--wood-button); color:#f5f8ee; }
#commit-edit.danger { background:#93312e; color:white; }
#term-tip { background:#fff7eb; border:1px solid #c8b69d; color:#392e22; box-shadow:0 6px 24px #35271b26; border-radius:11px; }
#tip-heading,#tip-close { color:#795237; }
.action-notice { line-height:var(--note-leading); position:fixed; bottom:calc(67px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100vw - 32px); padding:10px 16px; border:1px solid #bb9875; border-radius:10px; background:#f3e2c7; color:#493523; z-index:15; font-size:.88rem; }
/* end internal pages */
/* 表单与弹窗沿用同一套选择框、焦点和分隔线。 */
:is(#birth-form,#editor-form,.pro-options,#map-body) select {
  appearance:none; padding-inline:8px 22px; border-radius:5px;
  background-image:linear-gradient(45deg,transparent 48%,#766954 50% 62%,transparent 64%),linear-gradient(-45deg,transparent 48%,#766954 50% 62%,transparent 64%);
  background-size:5px 6px; background-position:right 12px center,right 8px center; background-repeat:no-repeat;
}
#record-editor { border-top:3px solid var(--leaf); }
#editor-title { padding-bottom:10px; border-bottom:1px solid var(--line); }
#editor-fields .form-row { grid-template-columns:4.5em minmax(0,1fr); gap:8px; }
#editor-fields :is(input,select) { text-align:left; text-align-last:left; }
#editor-fields input { padding-inline:8px; }
/* 页边、栏线与控件共用同一条对齐线。 */
.app-shell { --gutter:clamp(12px,3.7vw,20px); }
.mast { box-shadow:inset 0 -1px #d7c9b399; }
.mast-inner,.professional-view .mast-inner { padding-inline:var(--gutter); }
#entry,#records { padding-top:10px; }
#phone-link,.professional-view #phone-link { background:#f6efe2e8; color:var(--leaf); border-color:#b1bcaa; border-radius:5px; }
.entry-title,.section-head h2,.natal-section h2,.star-list h2,#editor-title,#records-empty h2 { font-family:var(--serif); font-weight:750; }
.entry-title { display:flex; align-items:center; gap:10px; margin-left:0; letter-spacing:.07em; font-size:1.27rem; }
.entry-title::after { content:""; flex:1; height:1px; background:var(--line); }
.entry-card { padding-inline:14px; border-radius:6px; }
.choice-pair .segments { border-radius:5px; background:#eee8db; }
.segments span,.birth-clock-fields .form-row,.record-search,.primary,#instant-chart,#go-entry,#commit-edit { border-radius:5px; }
.form-row > label,.field-label { display:inline-flex; align-items:center; gap:6px; line-height:1.3; }
.form-row > label .ui-icon,.field-label .ui-icon { margin:0; }
.entry-option summary { gap:6px; }
.entry-option summary span,.form-row small,.today-pillar small,#beijing-clock,#record-count,#luck-direction,.energy-summary tbody th,.natal-stat small { line-height:var(--caption-leading); }
.birth-clock-fields .form-row { background:#fbf8f0; grid-template-rows:auto 1fr; }
.birth-clock-fields .form-row > label { flex-wrap:wrap; row-gap:1px; }
.birth-clock-fields .form-row input { align-self:end; padding-inline:0; font-variant-numeric:tabular-nums; }
.record-tools .record-search:focus-within,.birth-clock-fields .form-row:focus-within { border-color:var(--leaf); }
.mobile-nav { background:#fffbf3; }
.mobile-nav a { position:relative; }
.mobile-nav a[aria-current=page]::before { content:""; position:absolute; top:0; width:28px; height:2px; border-radius:0 0 2px 2px; background:var(--flame); }
#birth-kind { display:grid; place-items:center; flex:none; min-width:2.45em; height:2.12em; border-radius:3px; font:700 1rem/1 var(--serif); }
.birth-detail { display:grid; grid-template-columns:4.15em minmax(0,1fr); gap:5px; align-items:baseline; }
.birth-detail > span:first-child { color:#d0d9c7; }
#chart-tabs { background:#faf5e9; }
#chart-tabs button[aria-selected=true] { background:#faf1e5; }
#luck .band-title { justify-content:center; }
#luck .section-head { align-items:center; }
.info-sheet dt { white-space:nowrap; }
.info-sheet .info-single { grid-template-columns:6.1em minmax(0,1fr); }
.info-sheet .info-pair { grid-template-columns:6.1em minmax(0,1fr) 4em minmax(0,1fr); }
.chart-matrix tbody tr.large td { vertical-align:middle; }
#pro-settings summary { list-style:none; }
#pro-settings summary::-webkit-details-marker { display:none; }
#pro-settings summary::after { content:""; display:inline-block; width:5px; height:5px; margin:0 2px 3px 5px; border:solid currentColor; border-width:0 1px 1px 0; transform:rotate(45deg); }
#pro-settings[open] summary::after { transform:rotate(225deg); }
@media(hover:hover) {
  .term:hover,.map-row .term:hover,.record-item:hover { background:var(--raised); }
  #phone-link:hover { background:#e1e8d7; }
  .mobile-nav a:not([aria-disabled=true]):hover { color:var(--flame); }
}
#entry,#records { padding-inline:var(--gutter); }
  .pro-matrix td > .element-term { font-size:clamp(19px,5.4vw,24px); }
  #record-editor { width:min(100%,500px); inset:auto 0 0; max-width:100%; max-height:82dvh; margin:auto; padding-bottom:calc(16px + env(safe-area-inset-bottom)); border-radius:15px 15px 0 0; }
@media(pointer:coarse) and (max-width:600px) {
  #term-tip { inset:auto 8px calc(60px + env(safe-area-inset-bottom)) !important; margin:auto; width:auto; max-width:480px; padding:15px 40px 15px 16px; }
  #tip-close { min-height:40px; min-width:40px; }
}
@media (max-width:350px) {
  .app-shell { --gutter:10px; }
  .entry-card { padding-inline:9px; }
  .birth-clock-fields { gap:6px; }
  .birth-clock-fields .form-row { padding-inline:6px; }
}


/* internal pages */
/* 书架与古籍阅读 */
#knowledge { padding:10px var(--gutter) 22px; }
.library-tabs { display:flex; border-bottom:1px solid var(--line); margin-bottom:12px; gap:20px; }
.library-tabs a { display:grid; align-items:center; min-height:42px; border-bottom:2px solid transparent; color:var(--muted); font-weight:600; }
.library-tabs a[aria-current=page] { color:var(--flame); border-color:currentColor; }
#knowledge a { text-decoration:none; }
#shelf-tools { display:flex; gap:8px; align-items:center; margin-bottom:12px; }
#shelf-tools .record-search { min-width:0; flex:1; }
#shelf-count { color:var(--muted); font-size:.78rem; }
#book-shelf,.shelf-section { display:grid; min-width:0; gap:5px; }
#book-shelf { padding-bottom:12px; gap:14px; }
.shelf-title { grid-column:1/-1; display:flex; align-items:center; gap:9px; margin:4px 0; color:var(--ink); font:700 1.02rem var(--serif); }
.shelf-title::after { content:""; flex:1; border-top:1px solid var(--line); }
.shelf-book { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:6px; padding-right:6px; border:1px solid var(--line); border-radius:5px; background:var(--sheet); }
.book-card { display:grid; grid-template-columns:44px minmax(0,1fr); align-items:center; gap:12px; padding:8px 0 8px 9px; min-width:0; color:var(--ink); }
.book-cover { display:block; position:relative; height:58px; border-radius:1px 3px 3px 1px; background:#414d3d url("/assets/21181cd5d5f7d2b1/books/woodcuts.webp") 0 0 / 300% 200%; box-shadow:2px 1px #d7c5a8; }
.book-cover::before { content:""; position:absolute; inset:0 auto 0 0; width:9%; border-right:1px solid #f2e6c348; background:#302b244d; }
.book-cover:is([data-book=shenfeng],[data-book=minglizhenbao],[data-book=sanming]) { background-position:100% 0; }
.book-cover:is([data-book=luolu],[data-book=ditiansui]) { background-position:50% 0; }
.book-cover:is([data-book=yuzhao],[data-book=ziping],[data-book=duanshilixiang]) { background-position:50% 100%; }
.book-cover:is([data-book=mangpaimingli],[data-book=yuanhai]) { background-position:0 100%; }
.book-cover:is([data-book=wuxingjingji],[data-book=qiongtong]) { background-position:100% 100%; }
.cover-slip { position:absolute; left:16%; top:6%; max-height:88%; writing-mode:vertical-rl; overflow:hidden; border:1px solid #d0b58d; padding:2px 1px; background:#f8ecd2; color:#342a20; font:700 8px/1.12 var(--serif); }
.book-copy { display:grid; gap:3px; overflow-wrap:anywhere; }
.book-copy strong { font:700 1.02rem/1.3 var(--serif); }
.book-copy small,#book-reader > small { color:var(--muted); font-size:.77rem; line-height:1.35; }
.book-copy .shelf-place { color:var(--leaf); }
.shelf-toc { display:grid; place-items:center; min-width:44px; min-height:44px; color:var(--leaf); font-size:.84rem; }
.shelf-toc:focus-visible,.shelf-toc:hover { text-decoration:underline; }
#knowledge-topics,.lesson-list { display:grid; gap:7px; }
.lesson-list .shelf-title { margin:8px 0 0; }
.lesson-search { padding-inline:12px; }
.lesson-match-count { font-size:.78rem; color:var(--muted); }
.lesson-link { display:grid; grid-template-columns:32px minmax(0,1fr) 7px; gap:10px; align-items:center; padding:10px 12px; background:var(--sheet); color:var(--ink); border:1px solid var(--line); border-radius:6px; }
.lesson-copy { display:grid; gap:3px; }
.lesson-copy strong { font:700 1rem/1.3 var(--serif); }
.lesson-copy small { color:var(--muted); font-size:.75rem; line-height:1.35; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.topic-symbol { display:grid; place-items:center; height:32px; color:var(--leaf); background:#e9ecdf; border:1px solid #d6dbc7; border-radius:6px; }
.lesson-link::after,.knowledge-topic summary::after,.reader-toc summary::after { content:""; width:6px; height:6px; border:solid currentColor; border-width:0 1px 1px 0; transform:rotate(45deg); }
.lesson-link::after { color:var(--muted); transform:rotate(-45deg); }
.lesson-tools { position:sticky; top:var(--top-edge); z-index:2; display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:44px; background:var(--ground); }
.lesson-tools select { width:auto; max-width:59%; padding:6px 8px; font-size:.84rem; color:var(--leaf); background:var(--sheet); border:1px solid var(--line); border-radius:5px; }
.lesson-reader { min-width:0; }
.lesson-reader h2 { margin:5px 0; font:700 1.35rem/1.35 var(--serif); }
.lesson-intro { margin:0 0 12px; color:var(--muted); font-size:.88rem; line-height:1.55; }
.knowledge-topic { margin-bottom:7px; background:var(--sheet); border:1px solid var(--line); border-radius:6px; }
.knowledge-topic summary { display:flex; justify-content:space-between; align-items:center; gap:9px; list-style:none; min-height:44px; padding:8px 12px; font:700 .96rem/1.5 var(--serif); cursor:pointer; }
.knowledge-topic summary::after { flex:none; color:var(--muted); }
.knowledge-topic summary::-webkit-details-marker,.reader-toc summary::-webkit-details-marker { display:none; }
.knowledge-topic[open] summary::after,.reader-toc[open] summary::after { transform:rotate(225deg); }
.knowledge-topic[open] summary { color:var(--leaf); }
.knowledge-topic > p,.lesson-example { margin:0 12px 10px; font-size:.9rem; line-height:1.6; overflow-wrap:anywhere; }
.knowledge-topic dl { margin:0 12px 8px; }
.knowledge-topic dl > div { display:grid; grid-template-columns:minmax(4em,23%) minmax(0,1fr); padding:8px 0; gap:8px; border-top:1px solid #ece4d8; }
.knowledge-topic dt { color:var(--leaf); font:650 .86rem/1.5 var(--sans); }
.knowledge-topic dd { margin:0; font-size:.87rem; line-height:1.55; }
.lesson-example { padding:8px 10px; border-inline-start:2px solid #bc8b65; color:var(--ink); background:#f6eee0; font-size:1rem; }
.lesson-example strong { color:var(--flame); margin-inline-end:.5em; }
.stage-lookup { margin:0 12px 12px; }
.stage-lookup label { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--leaf); font-size:.86rem; }
.stage-lookup select { min-height:36px; padding:2px 8px; background:var(--sheet); color:var(--ink); border:1px solid var(--line); border-radius:5px; font:inherit; }
.stage-lookup .stage-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1px; margin:6px 0 0; padding:1px; background:var(--line); }
.stage-lookup .stage-grid > div { display:flex; flex-direction:column; gap:1px; text-align:center; border:0; padding:4px 2px; background:#faf5eb; }
.lesson-found { background:#fbefde; }
.knowledge-topic :is(summary,.lesson-found) { scroll-margin-top:calc(var(--top-edge) + 55px); }
.lesson-source { display:block; padding:10px 0; font-size:.86rem; color:var(--leaf); }
#book-reader { max-width:42rem; margin:auto; padding:0 clamp(12px,3vw,25px) 12px; border:1px solid var(--line); border-radius:5px; background:var(--sheet); color:var(--ink); }
.book-back,.book-source { display:block; color:var(--leaf); font-size:.84rem; padding-block:10px; }
#book-reader h1 { margin:8px 0 16px; font:750 1.38rem/1.4 var(--serif); overflow-wrap:anywhere; }
.reader-toolbar { position:sticky; top:var(--top-edge); z-index:3; display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-height:46px; padding-block:2px; margin-bottom:14px; border-bottom:1px solid var(--line); background:var(--sheet); }
.reader-toolbar .book-back { margin-right:auto; padding:10px 0; }
.reader-size,.reader-toc summary { display:flex; align-items:center; gap:4px; min-height:40px; font-size:.82rem; color:var(--leaf); }
.reader-size select { width:auto; min-height:36px; padding:2px 1px; color:var(--ink); font:inherit; background:var(--sheet); border:0; }
.reader-toc summary { padding:5px 2px; list-style:none; cursor:pointer; }
.reader-toc summary small { color:var(--muted); font-size:.72rem; font-variant-numeric:tabular-nums; }
.reader-toolbar .toc-pane { position:absolute; top:100%; inset-inline:0; display:flex; flex-direction:column; gap:6px; max-height:min(66dvh,calc(100dvh - var(--top-edge) - 124px - env(safe-area-inset-bottom))); padding:10px; background:var(--sheet); border:1px solid var(--line); border-radius:0 0 6px 6px; box-shadow:0 6px 14px #48342124; }
.toc-pane > p,.toc-links p { margin:3px 0; padding:6px; color:var(--muted); font-size:.88rem; }
.toc-pane > button { align-self:flex-start; min-height:40px; border:1px solid var(--line); border-radius:5px; background:var(--sheet); color:var(--leaf); }
.toc-filters { display:flex; flex-wrap:wrap; align-items:center; gap:5px; }
.toc-filters input,.toc-filters select { min-width:0; height:40px; padding:5px 8px; color:var(--ink); background:#faf5eb; border:1px solid var(--line); border-radius:4px; }
.toc-filters input { flex:1 1 8em; font-size:1rem; }
.toc-filters select { max-width:44%; font-size:.875rem; }
.toc-links { min-height:0; overflow:auto; overscroll-behavior:contain; }
.toc-links a { display:flex; align-items:baseline; gap:8px; min-height:42px; padding:9px 6px; border-bottom:1px solid var(--line); color:var(--ink); font:.94rem/1.5 var(--sans); overflow-wrap:anywhere; }
.toc-number { flex:none; min-width:2.2em; text-align:center; color:var(--muted); font-size:.76rem; }
.toc-links a small { display:block; color:var(--muted); font-size:.75rem; }
.toc-links a[aria-current] { color:var(--flame); background:var(--red-wash); font-weight:650; }
.book-prose { color:var(--ink); font:400 1.125rem/1.8 var(--serif); overflow-wrap:anywhere; line-break:strict; }
.book-prose[data-size="小"] { font-size:1rem; }
.book-prose[data-size="大"] { font-size:1.3rem; }
.book-prose[data-size="特大"] { font-size:1.5rem; }
.book-prose p { margin:0 0 .82em; text-indent:2em; }
.book-prose p:has(+ .book-note) { margin-bottom:.25em; text-indent:0; font-weight:600; }
.book-prose .book-note { margin:0 0 1.2em; padding:.32em 0 .32em .7em; border-inline-start:2px solid #c3a581; color:#514335; text-indent:0; font-size:.96em; line-height:1.7; }
.book-note-label { display:inline-block; margin-inline-end:.55em; color:#824425; font:650 .82em/1.35 var(--sans); }
.book-turn { display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:14px 0 4px; border-top:1px solid var(--line); }
.book-turn a { display:flex; align-items:center; justify-content:center; gap:10px; min-height:42px; padding:6px; border:1px solid #c6cbb9; border-radius:5px; background:#eef0e5; color:var(--leaf); font-size:.9rem; }
.book-turn a[rel=next] { grid-column:2; background:var(--wood-button); border-color:var(--wood-button); color:#fffdf7; }
.book-turn a::before,.book-turn a::after { width:6px; height:6px; border:solid currentColor; border-width:1.5px 1.5px 0 0; }
.book-turn a[rel=prev]::before { content:""; transform:rotate(-135deg); }
.book-turn a[rel=next]::after { content:""; transform:rotate(45deg); }
.reader-edition { margin-top:7px; }
.reader-edition summary { padding:8px 0; color:var(--muted); font-size:.79rem; cursor:pointer; }
.book-credits { color:var(--muted); font-size:.8rem; line-height:1.5; }
.book-credits a { color:var(--leaf); }

/* Keep the element colours legible through a brief background pulse. */
#result :is(.chart-matrix .relation-hit,.gz-axis .relation-hit,
  .relation-line .term[aria-pressed=true],.gz-lane[aria-pressed=true] .gz-end) {
  background-color:#f8dfbc;
  animation:relation-pulse .8s ease-in-out 3;
}
.gz-axis b { width:100%; }
.gz-axis small { padding:1px 3px; }
.relation-line .term[data-relation-key] { padding:2px 4px; cursor:pointer; }
.relation-line .term[aria-pressed=true],.gz-lane[aria-pressed=true] .gz-caption { color:var(--relation-red); }
.gz-lane[aria-pressed=true] .gz-stroke { height:2px; background:var(--relation-red); opacity:1; animation:relation-line-pulse .8s ease-in-out 3; }
@keyframes relation-pulse { 50% { background-color:#f2ae60; } }
@keyframes relation-line-pulse { 50% { opacity:.24; } }
@media(prefers-reduced-motion:reduce) {
  #result :is(.chart-matrix .relation-hit,.gz-axis .relation-hit,.relation-line .term[aria-pressed=true],
      .gz-lane[aria-pressed=true] .gz-end,.gz-lane[aria-pressed=true] .gz-stroke) { animation:none; }
}
.gz-selection { display:flex; align-items:baseline; gap:7px; padding:6px 10px; background:#fffaef; border-bottom:1px solid var(--line); font:.72rem/1.45 var(--sans); }
.matrix-scroll .gz-selection { position:sticky; left:0; z-index:2; }
.gz-selection details { flex:1; min-width:0; }
.gz-selection summary { cursor:pointer; font-weight:600; color:#82392f; }
.gz-selection details p { margin:5px 0; }
.gz-selection > button { flex:none; min-height:30px; padding:2px 8px; background:var(--sheet); border:1px solid var(--line); border-radius:4px; font:inherit; color:var(--leaf); }

/* end internal pages */
.date-part { display:inline-block; white-space:nowrap; }
#resume-book { display:grid; grid-template-columns:auto minmax(0,1fr); gap:2px 10px; align-items:baseline; margin:0 0 12px; padding:10px 12px; color:var(--ink); border-left:3px solid var(--leaf); background:#e9eddf; }
#resume-book span { grid-row:span 2; color:var(--leaf); font-weight:650; }
#resume-book strong { font:700 1rem/1.4 var(--serif); }
#resume-book small { font-size:.78rem; color:var(--muted); overflow-wrap:anywhere; }
#resume-book small:empty { display:none; }
#resume-book[hidden] { display:none; }
#save-copy { display:block; margin:6px auto; min-height:40px; }
#save-copy[hidden] { display:none; }
/* internal pages */
/* The two charts use the same vertical rhythm for consecutive star names. */
:is(#pillars,#pro-pillars) .pillar-stars td > .star-name {
  display:block; font-size:.82rem; line-height:var(--caption-leading); min-height:0; padding:1px 2px;
}
#pro-pillars .pillar-stars td > .star-name { width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#pro-pillars:not(.all-stars) .pillar-stars td > .star-name ~ .star-name { display:none; }
#record-tabs { margin-inline:14px; }
.case-card,.case-year { display:flex; justify-content:space-between; align-items:center; gap:10px; color:var(--ink); text-decoration:none; }
.case-card,.case-article,.famous-record { background:var(--sheet); border:1px solid var(--line); border-radius:7px; }
.case-card,.case-article { padding:12px 14px; margin:0 0 9px; }
.case-card > span:first-child { display:grid; gap:4px; }
.case-card strong,.case-article h2 { font:700 1.12rem/1.35 var(--serif); }
.case-card small,.case-credits,.famous-record .case-card > span > span:not(.case-pillars) { color:var(--muted); font-size:.8rem; }
.case-chevron,.case-credits a,.case-year span { color:var(--leaf); }
.case-pillars { color:var(--sand); font:600 .94rem/1.4 var(--serif); word-spacing:.3em; }
.case-article h2,.case-article p,.case-credits p { margin:4px 0; }
.case-credits { line-height:1.45; padding:8px 0; }
.case-credits a { display:inline-block; padding:6px 0; margin-right:12px; text-decoration:underline; }
.case-event { border-top:1px solid var(--line); padding:6px 0; }
.case-event dl { margin:4px 0 10px; }
.case-event dt { font-size:.76rem; font-weight:650; color:var(--leaf); }
.case-event dd { margin:3px 0 9px; font-size:.92rem; line-height:1.5; }
.case-year { min-height:44px; color:var(--flame); }
.case-year span,.case-cycle-note { font-size:.8rem; }
.case-cycle-note { color:var(--sand); line-height:1.4; }
#case-note { margin:4px 12px; }
#case-loading { margin:12px; }
#famous-list { padding:0 14px; }
.famous-record { margin:8px 0; overflow:hidden; }
.famous-record .case-card { margin:0; border:0; }
.famous-record .case-credits { border-top:1px solid var(--line); margin:0 14px; }
#public-provenance { padding:6px 12px; background:var(--raised); }
#public-provenance a { padding:2px 0; }
#records .record-switcher { position:sticky; top:var(--top-edge); z-index:3; background:var(--ground); padding:7px 0 9px; }
#record-tabs { display:flex; width:min(100%,19rem); margin:0 auto; padding:3px; border:1px solid #c3b69f; border-radius:9px; background:#ebe2d2; }
#record-tabs a { flex:1; display:grid; place-items:center; min-height:36px; border-radius:6px; font-weight:650; color:var(--muted); text-decoration:none; }
#record-tabs a[aria-current=page] { background:var(--wood-button); color:#fffdf7; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
#famous-records .record-tools { display:flex; align-items:center; gap:8px; }
#famous-records .record-search { flex:1; min-width:0; }
#record-count,#famous-count { display:block; color:var(--muted); font-size:.76rem; }
#personal-records .record-tools { display:flex; flex-direction:column; gap:6px; }
#personal-records .record-search { width:100%; min-height:42px; margin:0; }
.record-filter-line { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.record-filter-line .filter-row { width:max-content; max-width:70%; }
.record-filter-line select { min-height:38px; padding-inline:11px 29px; }
#record-count { white-space:nowrap; padding-inline:5px; }

#birth-versions { background:var(--sheet); padding:8px 12px; border-bottom:1px solid var(--line); }
#birth-versions h2 { font:700 .9rem var(--serif); margin:0 0 4px; }
.birth-version { display:grid; align-items:center; grid-template-columns:minmax(0,1fr) auto; gap:8px; padding:5px 0; }
.birth-version + .birth-version { border-top:1px solid var(--line); }
.birth-version strong { margin-right:7px; font-size:.9rem; }
.birth-version a { color:var(--leaf); font-size:.8rem; }
.birth-version small { display:block; line-height:1.4; color:var(--muted); font-size:.76rem; margin-top:2px; }
.version-action { display:grid; place-items:center; padding:0 9px; min-height:38px; border:1px solid var(--line); border-radius:5px; font-size:.76rem; text-decoration:none; }
.is-current .version-action { color:var(--flame); background:#fbf0e8; border-color:transparent; }
#famous-groups { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; padding:3px 0 8px; }
#famous-groups button { min-height:38px; padding:2px 0; border:1px solid var(--line); border-radius:5px; background:var(--sheet); color:var(--muted); font:inherit; }
#famous-groups button[aria-pressed=true] { color:var(--flame); border-color:var(--flame); background:#faeee4; font-weight:650; }
#famous-list { padding:0; }
.famous-record { margin:0 0 5px; }
.person-link { display:grid; gap:3px; padding:9px 12px; text-decoration:none; color:var(--ink); }
.person-heading { display:flex; align-items:center; justify-content:space-between; gap:4px; }
.person-heading strong { font:700 1.04rem/1.3 var(--serif); }
.person-heading small { font-size:.71rem; padding:2px 5px; border-radius:3px; }
.time-qualified { color:#864028; background:#f8eadb; }
.time-recorded { color:var(--leaf); background:#eaefe5; }
.person-meta { color:var(--muted); font-size:.8rem; line-height:1.4; }
.partial-chart { margin:12px; padding:12px 16px; border:1px solid var(--line); background:var(--sheet); }
.partial-chart h1 { font:700 1.5rem var(--serif); margin:8px 0; }
.partial-pillars { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); border-block:1px solid var(--line); padding:12px 0; text-align:center; }
.partial-pillars dt { color:var(--muted); font-size:.78rem; }
.partial-pillars dd { margin:4px 0 0; color:var(--sand); font:700 1.22rem var(--serif); }

.publisher-chapter { position:relative; width:100%; overflow:hidden; background:#fff; }
.publisher-chapter iframe { display:block; position:absolute; inset:0 auto auto 0; border:0; max-width:none; transform-origin:top left; }
.original-leaf { margin:10px 0 18px; }
.original-leaf .book-source { display:block; padding:0; }
.original-leaf img { display:block; width:100%; height:auto; background:var(--raised); }
.original-leaf figcaption { margin-top:4px; color:var(--muted); text-align:center; font:.76rem var(--sans); }
.book-prose blockquote { margin:18px 0; padding:4px 12px; border-left:2px solid var(--line); }

#local-library { margin:12px 0 16px; padding:12px; border:1px solid var(--line); border-radius:6px; background:var(--sheet); }
.local-library-bar,.local-book { display:flex; align-items:center; gap:10px; }
.local-library-bar { justify-content:space-between; }
.local-library-bar h2 { margin:0; font:700 1.06rem var(--serif); }
.local-book small { color:var(--muted); font-size:.73rem; line-height:1.35; }
.local-book { border-top:1px solid var(--line); margin-top:7px; padding:8px 0 1px; color:var(--ink); text-decoration:none; }
.local-book .ui-icon { flex:none; width:22px; color:var(--leaf); }
.local-book span:first-of-type { flex:1; min-width:0; display:grid; }
.local-book strong { overflow-wrap:anywhere; font-family:var(--serif); }
.local-book span:last-child { flex:none; font-size:.8rem; color:var(--leaf); }
.imported-prose { overflow-wrap:anywhere; }
.imported-prose img { max-width:100%; height:auto; vertical-align:middle; }
.imported-prose > img { display:block; width:100%; margin:auto; }
.imported-prose table { display:block; overflow:auto; max-width:100%; border-collapse:collapse; }
.imported-prose td,.imported-prose th { border:1px solid var(--line); padding:3px 6px; }
.imported-prose pre { white-space:pre-wrap; }

/* end internal pages */
@font-face { font-family:XuanshuDigits; src:local("Arial"),local("Roboto"),local("Helvetica"); unicode-range:U+0030-0039; font-style:normal; font-weight:100 550; }
@font-face { font-family:XuanshuDigits; src:local("Arial Bold"),local("Roboto Bold"),local("Helvetica Bold"); unicode-range:U+0030-0039; font-style:normal; font-weight:551 1000; }
:root { --sans:XuanshuDigits,"PingFang SC","Hiragino Sans GB",system-ui,sans-serif; --serif:XuanshuDigits,"Songti SC","STSong","Noto Serif CJK SC",serif; --page-width:460px; font-variant-numeric:tabular-nums; }
.app-shell,.mast,.professional-view .mast,.mobile-nav { max-width:var(--page-width); }
.mast-actions { display:flex; align-items:center; gap:6px; min-width:0; }
#account-button { display:inline-flex; align-items:center; gap:5px; max-width:7.5em; min-height:36px; padding:0 12px; border:1px solid #c3c9b7; border-radius:6px; background:#f0f1e7; color:var(--leaf); font:650 .78rem var(--sans); }
#account-button span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#account-button[hidden] { display:none; }
.mast-actions #phone-link { width:36px; justify-content:center; padding:0; }
.mast-actions #phone-link span { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.info-sheet > div { align-items:baseline; gap:3px 8px; }
.info-sheet .info-single,.info-sheet .solar-terms { grid-template-columns:6.2em minmax(0,1fr); }
.info-sheet .info-pair:not(.solar-terms) { grid-template-columns:2.2em minmax(0,1fr) 2.2em minmax(0,1fr); }
.info-sheet :is(dd,button,.term) { min-width:0; max-width:100%; white-space:normal; overflow-wrap:anywhere; text-align:start; }
.info-sheet .solar-terms .term { white-space:normal; font-variant-numeric:tabular-nums; }
#pro-pillars { min-width:0; overscroll-behavior-x:contain; }
#pro-pillars .pro-matrix { table-layout:fixed; min-width:calc(40px + var(--columns) * 42px); }
#pro-pillars .pro-matrix :is(thead th:first-child,tbody th) { width:40px; }
#pro-pillars .term { max-width:100%; line-height:1.25; overflow-wrap:anywhere; }
input,button,select,time { font-variant-numeric:tabular-nums; }
#account-dialog { width:min(calc(100% - 32px),348px); max-height:88dvh; padding:0; color:var(--ink); border:1px solid #ccbba1; border-radius:14px; background:var(--sheet); box-shadow:0 14px 64px #38281733; }
#account-dialog::backdrop { background:#28211666; }
.account-card { position:relative; padding:23px 22px 15px; }
.account-card h2 { margin:0 32px 5px 0; font:700 1.32rem var(--serif); overflow-wrap:anywhere; }
#account-caption,#account-error { margin:4px 0 14px; font:.8rem/1.45 var(--sans); color:var(--muted); }
#account-error { color:var(--flame); }
#account-error:empty { display:none; }
.dialog-close { position:absolute; right:9px; top:9px; width:36px; height:36px; color:var(--muted); border:0; background:transparent; font-size:1.4rem; }
#account-fields { margin:16px 0 12px; padding:0; border:0; }
#account-fields label { display:grid; gap:5px; margin:0 0 10px; color:var(--leaf); font:600 .8rem var(--sans); }
#account-fields input { width:100%; min-height:42px; padding:6px 10px; border:1px solid var(--line); background:#faf6ed; border-radius:5px; color:var(--ink); font:1rem var(--sans); }
#account-submit { width:100%; min-height:42px; color:white; background:var(--wood-button); border-radius:6px; }
#account-mode { width:100%; min-height:38px; color:var(--leaf); background:transparent; border:0; font-size:.82rem; }
#action-notice { inset:auto auto calc(68px + env(safe-area-inset-bottom)) 50%; margin:0; max-width:min(418px,calc(100vw - 24px)); align-items:center; gap:9px; background:#37362c; color:#fffaf0; border:0; border-radius:9px; padding:6px 8px 6px 13px; box-shadow:0 4px 18px #2e261e30; pointer-events:auto; }
#action-notice:not([hidden]) { display:flex; }
#action-notice span { min-width:0; overflow-wrap:anywhere; }
#action-notice button { flex:none; padding:4px; min-height:32px; border:0; background:none; color:inherit; }
#action-notice .notice-retry { color:#f2cf8f; }
.notice-close { font-size:1.1rem; }
#form-status,#today-status,#region-status,#preview-status,#flow-hint,#records-status,#pro-status,#case-status,#retry-today,#retry-regions,#retry-preview,#retry-records,#retry-case,#pro-retry { display:none; }
.buffering .mast::after { content:""; position:absolute; inset:auto 0 0; height:2px; background:linear-gradient(90deg,transparent,#b04135,transparent) 0 0 / 45% 100% no-repeat; animation:loading-stroke 1.2s ease-in-out infinite alternate; }
@keyframes loading-stroke { to { background-position:100% 0; } }
@media(prefers-reduced-motion:reduce) { .buffering .mast::after { animation:none; background:var(--leaf); } }
@media(max-width:380px) {
  #pro-pillars .pro-matrix { min-width:calc(38px + var(--columns) * 39px); }
  #pro-pillars .pro-matrix :is(thead th:first-child,tbody th) { width:38px; }
  #luck .luck-cell { flex-basis:max(31px,calc(100% / var(--visible-luck-cells))); }
}

/* The hour adds one scrollable transit column. The four natal cells stay at
   the same right-hand offsets as in the day view. */
#pro-pillars { container-type:inline-size; --axis-width:40px; }
@media(max-width:380px) { #pro-pillars { --axis-width:38px; } }
#pro-pillars .day-matrix {
  --unit:max(31px, calc((100cqw - var(--axis-width)) / var(--visible-columns)));
  width:calc(var(--axis-width) + var(--columns) * var(--unit));
  min-width:0; border-spacing:0; border-collapse:separate;
}
.day-matrix tr > :nth-last-child(-n+4) { position:sticky; z-index:1; background-color:var(--sheet); }
.day-matrix thead tr > :nth-last-child(-n+4) { background-color:#f4ecdd; }
.day-matrix tbody tr:nth-child(even) > :nth-last-child(-n+4) { background-color:#faf6ed; }
.day-matrix tr > :last-child { right:0; }
.day-matrix tr > :nth-last-child(2) { right:var(--unit); }
.day-matrix tr > :nth-last-child(3) { right:calc(2 * var(--unit)); }
.day-matrix tr > :nth-last-child(4) { right:calc(3 * var(--unit)); }

/* internal pages */
#analysis-button {
  display:none; flex:1; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; min-height:52px; min-width:44px; padding:0; border:0; border-radius:0;
  color:#83382a; background:transparent; font:650 .71rem/1.2 var(--sans);
  cursor:pointer;
}
#result:not([hidden]) ~ .mobile-nav #analysis-button:not([hidden]) { display:flex; }
#analysis-button:focus-visible { outline-offset:-3px; }
.analysis-orb {
  position:relative; display:block; width:23px; height:23px; border-radius:50%;
  background:radial-gradient(ellipse at 34% 26%,#fffbe7 0%,#ffe7a3 9%,#f9b961 26%,#c6623d 55%,#742e36 82%,#432b38 100%);
  box-shadow:inset 0 0 0 1px #9d402740,inset -2px -2px 4px #64253880,0 0 6px #d9944440;
}
.analysis-orb::before,.analysis-orb::after { content:""; position:absolute; pointer-events:none; }
.analysis-orb::before {
  inset:4px -4px; border:1.5px solid #a5502e; border-top-color:transparent;
  border-bottom-color:#f9d889; border-radius:50%; transform:rotate(-32deg);
  animation:orb-orbit 5s ease-in-out infinite alternate;
}
.analysis-orb::after {
  top:2px; right:0; width:7px; height:7px; background:#fff9cf;
  clip-path:polygon(50% 0,62% 35%,100% 50%,62% 61%,50% 100%,37% 61%,0 50%,37% 36%);
  animation:orb-glint 3s ease-in-out infinite alternate;
}
@keyframes orb-orbit { to { transform:rotate(-10deg) scaleY(.72); } }
@keyframes orb-glint { to { transform:scale(.7); opacity:.55; } }
@media(prefers-reduced-motion:reduce) {
  .analysis-orb::before,.analysis-orb::after { animation:none; }
}
#analysis-dialog {
  inset:auto 0 0;
  margin:auto;
  padding:0 0 env(safe-area-inset-bottom);
  width:min(100%, var(--page-width));
  max-width:100%;
  max-height:min(79dvh, 710px);
  border:1px solid var(--line);
  border-radius:14px 14px 0 0;
  background:var(--sheet);
  color:var(--ink);
}
#analysis-dialog[open] { display:flex; flex-direction:column; }
#analysis-dialog::backdrop { background:#2924197a; }
.analysis-header { position:relative; flex:none; padding:14px 48px 10px 15px; background:var(--ground); border-bottom:1px solid var(--line); }
.analysis-header h2 { margin:0; font:700 1.1rem var(--serif); }
#analysis-scope { margin:4px 0 0; color:var(--muted); font-size:.77rem; }
#analysis-body { min-height:0; overflow:auto; overscroll-behavior:contain; padding:12px 15px 18px; }
#analysis-status { margin:4px 0 8px; color:var(--muted); font-size:.88rem; }
#analysis-retry { min-height:40px; padding:0 18px; border:1px solid var(--line); border-radius:5px; color:var(--leaf); background:var(--sheet); }
#analysis-reading section + section { padding-top:13px; margin-top:13px; border-top:1px solid var(--line); }
#analysis-reading h3 { font:700 1rem var(--serif); margin:0 0 7px; }
#analysis-reading p { font:.88rem/1.55 var(--sans); margin:5px 0; white-space:pre-wrap; }
#analysis-reading p strong { margin-inline-end:.5em; color:var(--leaf); font-size:.77rem; }

#analysis-reading details { margin-top:6px; color:var(--muted); }
#analysis-reading summary { cursor:pointer; width:fit-content; padding:6px 0; font:.8rem var(--sans); color:var(--leaf); }
#analysis-reading details p, #analysis-reading .reading-limits { font-size:.78rem; color:var(--muted); }
#analysis-reading .reading-limits { margin-top:.7em; }
/* end internal pages */

/* internal pages */
.scan-preview {
  display:block; width:100%; min-height:44px; margin:0; padding:0;
  border:1px solid var(--line); border-radius:4px; background:var(--sheet);
  color:var(--leaf); font:500 .88rem var(--sans); overflow:hidden; cursor:zoom-in;
}
.scan-dialog {
  box-sizing:border-box; width:min(100%, var(--page-width)); height:100%;
  height:100dvh; max-width:100%; max-height:100%; max-height:100dvh;
  inset:0; margin:auto; padding:0; border:0; overflow:hidden;
  background:var(--raised); color:var(--ink);
}
.scan-dialog[open] { display:flex; flex-direction:column; }
.scan-dialog::backdrop { background:#25221dcc; }
.scan-header {
  flex:none; display:flex; align-items:center; gap:8px; padding:6px 10px;
  padding-top:max(6px,env(safe-area-inset-top)); border-bottom:1px solid var(--line);
  background:var(--sheet);
}
.scan-header strong { flex:1; font:650 1rem/1.25 var(--serif); }
.scan-header button,.scan-retry {
  min-height:44px; min-width:48px; padding:0 10px; border:1px solid var(--line);
  border-radius:6px; background:var(--sheet); color:var(--leaf); font:600 .85rem var(--sans);
}
.scan-header button:disabled { opacity:.5; }
.scan-pane {
  flex:1; min-height:0; min-width:0; overflow:auto; overscroll-behavior:contain;
  padding-bottom:env(safe-area-inset-bottom); text-align:center;
}
.scan-pane img { display:block; width:100%; max-width:none; height:auto; }
.scan-pane.scan-zoomed img { width:180%; }
.scan-pane [hidden] { display:none; }
.scan-status { display:block; margin:36px 12px 12px; color:var(--muted); font:.9rem var(--sans); }
/* end internal pages */
