/* V0.4 structural rules. The screen-only V0.2 theme below preserves mobile metrics and print. */
:root{--paper:#f7f7f7;--surface:#fff;--ink:#222;--muted:#555;--line:#ccc}
*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;line-height:1.6}
[hidden]{display:none!important}button,input,select,textarea{font:inherit;min-width:0}button,a,input,select,summary{touch-action:manipulation}
button,.button{min-height:44px;border:1px solid #999;border-radius:3px;padding:8px 12px;background:var(--surface);color:var(--ink);cursor:pointer;display:inline-flex;justify-content:center;align-items:center;text-decoration:none}
button:disabled{opacity:.5;cursor:not-allowed}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,.scroll-table:focus-visible{outline:2px solid #222;outline-offset:2px}
.page-header{max-width:1440px;margin:auto;padding:16px;display:flex;align-items:baseline;gap:16px;flex-wrap:wrap;border-bottom:1px solid var(--line)}h1{font-size:24px;margin:0}h2{font-size:20px;margin:0 0 16px}h3{font-size:16px;margin:16px 0 8px}h3 small{font-size:12px;font-weight:400;color:var(--muted)}
.input-page{max-width:620px;margin:20px auto;padding:0 16px}.result-page{max-width:1440px;margin:20px auto;padding:0 16px}.panel{min-width:0;background:var(--surface);border:1px solid var(--line);padding:20px;margin-bottom:20px}
.fields label,.field-label{display:block;margin:12px 0 6px}.fields input:not([type=checkbox]),.fields select,.date-controls input{width:100%;height:48px;border:1px solid #999;padding:8px;background:white;font-size:16px}
.two,.three{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.three{grid-template-columns:repeat(3,minmax(0,1fr))}.fields .check{display:flex;align-items:center;gap:8px;min-height:44px}.check input{width:20px;height:20px;margin:0}.primary{width:100%;min-height:52px;font-weight:700;margin-top:12px;background:#eee}
.status,.note{font-size:13px;overflow-wrap:anywhere}.status{min-height:22px}.status[data-kind=error]{font-weight:700}.note{color:var(--muted)}.toolbar{display:flex;flex-wrap:wrap;gap:8px}.result-actions{margin-bottom:12px}
.profile-text{font-size:14px}.basic-row{display:grid;grid-template-columns:112px minmax(0,1fr);gap:12px;padding:8px 0;border-bottom:1px solid #ddd}.basic-row b{font-weight:600}.basic-row span{overflow-wrap:anywhere}
[data-field="bone-comment"]{display:inline;white-space:normal;font:inherit;vertical-align:baseline;overflow-wrap:anywhere}
.basic-row:has([data-field="bone-comment"]){align-items:start}
.chenggu-content{min-width:0;margin:8px 0 12px;padding:11px 13px;border-left:2px solid #a33d32;background:#fbf6ef;overflow-wrap:anywhere;word-break:break-word}
.chenggu-content>*{max-width:100%}.chenggu-content p{margin:5px 0}.chenggu-content-title{margin:0 0 7px;font:700 16px/1.5 "Songti SC","Noto Serif CJK SC",serif;color:#a33d32}
.chenggu-content-subtitle{margin:4px 0 7px;font:700 15px/1.5 "Songti SC","Noto Serif CJK SC",serif;color:inherit}.chenggu-content-kind{font-size:12px;color:#686055}
.chenggu-content-reading,.chenggu-content-explanation{line-height:1.75}.chenggu-content-status,.chenggu-content-notice{font-size:12px;color:#686055}
.chenggu-preview-warning{font-size:12px;font-weight:700;color:#a33d32}
.pc-shensha-name,.pc-pillar-relationship{display:block;overflow-wrap:anywhere}.pc-pillar-relationship{text-align:left}.pc-changsheng-stage{display:inline-block}
.scroll-table{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin}table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:14px}th,td{border-right:1px solid var(--line);border-bottom:1px solid var(--line);padding:10px 6px;text-align:center;vertical-align:middle;overflow-wrap:anywhere;background:white}tr>*:first-child{border-left:1px solid var(--line)}thead th{border-top:1px solid var(--line);background:#eee}tbody th{background:#f3f3f3}th:first-child{width:100px}.stem,.branch{font-size:26px;font-weight:700}.hidden-line{display:block;line-height:1.8}.hidden-line b{margin-right:4px}.compare{min-width:900px}.compare th:first-child{width:100px}.comprehensive{min-width:1380px}.comprehensive th:first-child{width:120px}
.compare th:first-child,.comprehensive th:first-child{position:sticky;left:0;z-index:1}.selected-column{background:#e5e5e5;box-shadow:inset 0 0 0 1px #555}.comprehensive button{width:100%;font-size:13px;padding:6px 2px}.comprehensive td{font-size:13px}.annual-choice > span{display:block}.date-controls{display:block;font-size:14px;max-width:300px}.date-controls input{display:block;margin-top:4px}.query-level{min-width:0}.scroll-strip{position:relative;display:flex;gap:8px;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;padding:4px 2px 12px;scrollbar-width:thin}.strip-item{flex:0 0 92px;min-height:72px;display:grid;gap:2px;align-content:center;border:2px solid #bbb;white-space:nowrap}.strip-item small{font-size:12px}.strip-item b{font-size:18px}.strip-item.selected{background:#ddd;border-color:#222;font-weight:700}.strip-item.selected small:first-child:before{content:"选中 "}.strip-item.selected small{font-weight:600}
.element-木{color:#238047}.element-火{color:#c9443c}.element-土{color:#9c6a33}.element-金{color:#be801f}.element-水{color:#256ab6}/* Existing five-element semantics only. */
.json-area{margin-top:16px}.json-area summary{min-height:44px;cursor:pointer;padding:10px 0}.json-area pre{font-size:12px;white-space:pre-wrap;overflow-wrap:anywhere;background:#f3f3f3;padding:12px}.json-area pre,.profile-text{min-width:0}#copy-text{width:100%;font-size:14px}#aux{font-size:14px}
.comprehensive .annual-choice{display:block}
.comprehensive .annual-choice[aria-pressed=true]{background:#ddd;border-color:#222;font-weight:700}
@media(max-width:768px){.page-header{padding:12px;gap:8px}.page-header span{font-size:12px}h1{font-size:22px}.input-page,.result-page{padding:0 12px;margin:12px auto}.panel{padding:14px 10px;margin-bottom:16px}h2{font-size:18px}.profile-text{font-size:13px}.basic-row{grid-template-columns:76px minmax(0,1fr);gap:8px}#pillar-table table{font-size:12px}#pillar-table th:first-child{width:44px}#pillar-table th,#pillar-table td{padding:8px 2px}#pillar-table .hidden-line{font-size:12px}#pillar-table .stem,#pillar-table .branch{font-size:25px}.two,.three{gap:8px}.toolbar{gap:8px}.toolbar button,.toolbar a{font-size:13px;flex:1 1 120px}.date-controls{max-width:none}.note{font-size:12px}}
@media(max-width:768px){.chenggu-content{margin:7px 0 10px;padding:9px 10px}.chenggu-content-title{font-size:15px}}
@media print{body{background:white}.page-header{padding:0 0 8px}.result-page{max-width:none;margin:0;padding:0}.result-actions,.date-controls,.scroll-strip,.query-level,#manual-copy,.json-area,#status{display:none!important}.panel{padding:8px;border-color:#999;margin-bottom:12px}.scroll-table{overflow:visible}.compare,.comprehensive{min-width:0}.compare th:first-child,.comprehensive th:first-child{position:static;width:62px}table,.comprehensive td{font-size:8px}th,td{padding:5px 2px}.comprehensive button{font-size:8px;border:0;min-height:0;padding:2px 0}.stem,.branch{font-size:16px}h2{font-size:16px}thead{display:table-header-group}tr{break-inside:avoid}.basic-row{padding:3px 0;font-size:11px}.selected-column{box-shadow:none}.annual-choice span{font-size:8px}}
@media print{.chenggu-content[data-chenggu-preview]{display:none!important}.chenggu-content{background:white;border-color:#777;break-inside:avoid}.panel>h2{break-after:avoid-page;page-break-after:avoid}}
@media print{.basic-row:has([data-field="bone-comment"]),.pc-profile-line:has([data-field="bone-comment"]){break-inside:avoid;page-break-inside:avoid}}
@media print{
  /* 统一细盘与流年流月查询打印适配：隐藏右侧操作区，仅打印左侧排盘表与深度指标看板 */
  .xipan-right-column, .xipan-tier-box, .xipan-dash-prompt { display: none !important; }
  .xipan-unified-container { display: block !important; }
  .xipan-left-column { width: 100% !important; max-width: none !important; }
  #pc-dynamic-xipan { background: white !important; border: 1px solid #999 !important; box-shadow: none !important; margin-bottom: 12px; padding: 10px !important; break-inside: avoid; page-break-inside: avoid; }
  .xipan-compare-table-wrap { overflow: visible !important; border: 1px solid #999 !important; box-shadow: none !important; margin-bottom: 10px !important; }
  .xipan-compare-table th, .xipan-compare-table td { padding: 4px 2px !important; font-size: 11px !important; border-color: #999 !important; }
  .xipan-compare-table .stem, .xipan-compare-table .branch { font-size: 16px !important; }
  .xipan-dashboard { background: transparent !important; border: 1px solid #999 !important; box-shadow: none !important; padding: 8px !important; break-inside: avoid; page-break-inside: avoid; }
  .xipan-dash-header { border-bottom: 1px solid #999 !important; padding-bottom: 6px !important; margin-bottom: 8px !important; }
  .xipan-metrics-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; margin-bottom: 10px !important; }
  .xipan-metric-card { background: white !important; border: 1px solid #888 !important; box-shadow: none !important; break-inside: avoid; page-break-inside: avoid; padding: 6px 10px !important; }
  .xipan-section-row { border-top: 1px dashed #bbb !important; padding-top: 6px !important; margin-top: 6px !important; }
  .xipan-badge-shensha, .xipan-badge-clash, .xipan-badge-combine { background: white !important; color: #111 !important; border: 1px solid #777 !important; box-shadow: none !important; font-size: 11px !important; padding: 2px 6px !important; }
  #query { display: none !important; }

  /* 程序综合分析打印优化：隐藏下拉级联工具条，保留高清内容卡片与防跨页截断 */
  .pa-topbar{display:none!important}
  #pc-program-analysis{background:white!important;border:1px solid #999!important;box-shadow:none!important;margin-bottom:12px;padding:10px!important}
  .pa-content-area{background:white!important;border:none!important;box-shadow:none!important;padding:0!important}
  .pa-header-card{background:#fdfdfd!important;border:1px solid #777!important;box-shadow:none!important;padding:8px 12px!important;break-inside:avoid;page-break-inside:avoid}
  .pa-cards-grid{grid-template-columns:repeat(2,1fr)!important;gap:10px!important}
  .pa-card,.classic-card,.pc-wuxing-card,.pa-section{background:white!important;border:1px solid #888!important;box-shadow:none!important;break-inside:avoid;page-break-inside:avoid}
  .pa-text-box{background:#fdfdfd!important;border:1px solid #aaa!important;color:#111!important;box-shadow:none!important}
  .pa-card-verse{background:#f5f5f5!important;border-left:3px solid #444!important;color:#111!important}
  .pa-pillar-tag,.pa-kind-tag{background:#333!important;color:#fff!important;border:none!important}

  /* 古籍模块打印防切断 */
  .classics-tabs-header{display:none!important}
  #pc-classics-analysis{background:white!important;border:1px solid #999!important;box-shadow:none!important;margin-bottom:12px;padding:10px!important}
}

/* Restore verified V0.2 colors, surfaces and typography, not its obsolete page layout.
   Source: BaZi_A_Engine_V0_2.zip / BaZi_A_Engine_V0_2/src/style.css.
   Keep V0.4 control sizes, column widths, mobile spacing and all print rules above. */
@media screen {
  :root {
    --paper:#faf7f1; --surface:#fffdf9; --line:#e9dfd1; --ink:#302b27;
    --muted:#82796d; --red:#a33d32; --redlight:#f9eeeb; --gold:#ad8750;
    --green:#258046; --wood:#238047; --fire:#c9443c; --earth:#9c6a33;
    --metal:#be801f; --water:#256ab6;
    --shadow:0 8px 30px rgba(75,53,24,.045);
  }
  body {
    background:linear-gradient(180deg,#f4eee4 0,#faf7f1 260px);
    font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Noto Sans CJK SC","Microsoft YaHei",sans-serif;
  }
  .page-header {border-bottom-color:#e5dacf}
  .page-header span {color:var(--muted)}
  .panel {background:rgba(255,253,249,.95);border-radius:14px;box-shadow:var(--shadow)}
  button,.button {border-color:var(--line);background:#fffaf5;border-radius:7px;color:var(--red)}
  .fields label,.field-label {color:#524d46}
  .fields input:not([type=checkbox]),.fields select,.date-controls input {
    border-color:#e0d6ca;border-radius:8px;color:var(--ink);
  }
  .fields input:focus,.fields select:focus,.date-controls input:focus {
    border-color:#c59d80;box-shadow:0 0 0 3px #ecd9cb;
  }
  button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,.scroll-table:focus-visible {
    outline-color:var(--red);
  }
  .primary {
    background:linear-gradient(120deg,#a53b32,#bf5e4a);color:white;border-color:#a9473b;
    border-radius:9px;box-shadow:0 5px 13px #a6433226;
  }
  .status {color:var(--green)}
  .status[data-kind=error] {color:#c22}
  .basic-row {border-bottom-color:#f2eae0}
  .basic-row b {color:#686055}
  h3 {color:#6a594a}
  th,td {border-color:#eee5da;background:var(--surface)}
  tr>*:first-child,thead th {border-color:#eee5da}
  thead th {background:#f1e9dd;color:#504840}
  tbody th {background:#f7f2e9;color:#686155}
  .selected-column {background:var(--redlight);box-shadow:inset 0 0 0 1px #bd725d}
  .strip-item {background:white;border-color:#e7dcd0;border-radius:9px;color:var(--ink)}
  .strip-item small {color:var(--muted)}
  /* The original active-tab vermilion also matches the retained Stage 3 selection treatment. */
  .strip-item.selected {background:var(--red);border-color:var(--red);color:white}
  .strip-item.selected small,.strip-item.selected [class^=element-] {color:white}
  .comprehensive .annual-choice[aria-pressed=true] {
    background:#fff0e9;border-color:#bd725d;box-shadow:inset 0 0 0 1px #e7b6a7;color:var(--red);
  }
  .element-木 {color:var(--wood)} .element-火 {color:var(--fire)}
  .element-土 {color:var(--earth)} .element-金 {color:var(--metal)} .element-水 {color:var(--water)}
  .json-area pre {background:#f7f3ed;border-radius:8px}
  .json-area summary::marker {color:var(--red)}
}

@media screen and (min-width:769px) {
  h1 {font-family:"Songti SC","Noto Serif CJK SC",serif;font-size:25px;letter-spacing:3px}
  h2 {font-family:"Songti SC","Noto Serif CJK SC",serif;font-size:19px;font-weight:750;letter-spacing:1px}
  .page-header span {font-size:12px;border:1px solid var(--line);padding:8px 12px;border-radius:24px}
  .fields label,.field-label {font-weight:650}
}
@media screen and (min-width:1024px) {
  /* Same four existing siblings; desktop presentation requested by the user, no DOM reordering. */
  #chart {display:grid;grid-template-columns:minmax(0,.86fr) minmax(0,1.14fr);gap:16px;align-items:start}
  #chart>.module {margin-bottom:0}
  #pc-dynamic-xipan,#pc-program-analysis,#pc-classics-analysis,#query,#details {grid-column:1 / -1}
}

/* V0.4.2: only the PC brand, first row and action placement. Phone and
   lower-module styles are intentionally unchanged; print uses the legacy DOM. */
.pc-brand-header {display:none}
@media print {.pc-print>.page-header>span{display:none}}
@media print {
  .pc-print .element-金 {color:#ff8000}
  .pc-print .element-木 {color:#008800}
  .pc-print .element-水 {color:#1800f0}
  .pc-print .element-火 {color:#f00000}
  .pc-print .element-土 {color:#995000}
}
@media screen and (min-width:1024px) {
  /* V0.4.3 user-specified element colors, consistently inherited by every PC field. */
  body.pc-result {--metal:#ff8000;--wood:#008800;--water:#1800f0;--fire:#f00000;--earth:#995000}
  .pc-result>.page-header {display:none}
  .pc-result .pc-brand-header {
    display:flex;align-items:center;justify-content:space-between;gap:24px;
    max-width:1440px;margin:auto;padding:24px 16px;border-bottom:1px solid #e5dacf;
  }
  .pc-brand {display:flex;align-items:center;gap:14px}
  .pc-brand strong {font:750 30px "Songti SC","Noto Serif CJK SC",serif;letter-spacing:3px}
  .pc-brand p,.pc-page-intro p {margin:5px 0 0;font-size:14px;color:var(--muted)}
  .pc-seal {display:grid;place-items:center;width:42px;height:42px;flex-shrink:0;border:2px solid #b9695b;border-radius:8px;color:var(--red);font:26px "Songti SC",serif}
  .pc-page-intro {text-align:right}
  .pc-page-title {font:750 25px "Songti SC","Noto Serif CJK SC",serif;letter-spacing:1px}
  .pc-result #chart {grid-template-columns:minmax(0,.45fr) minmax(0,.55fr)}
  .pc-result #basic,.pc-result #four {align-self:stretch}
  .pc-result #basic-body {font-size:15px;line-height:1.8}
  .pc-result .pc-profile-line {margin:7px 0;overflow-wrap:anywhere}
  .pc-result .pc-profile-line>b {font-weight:650;color:#686055}
  .pc-inline-field {display:inline-block;margin-right:10px}
  .pc-result #pillar-table th,.pc-result #pillar-table td {padding:8px 6px}
  .pc-result #pillar-table .stem,.pc-result #pillar-table .branch {font-size:29px;font-weight:780;line-height:1.15}
  .pc-result #pillar-table td.pc-shensha-cell {font-size:13px;line-height:1.5;vertical-align:middle}
  .pc-result .pc-shensha-name {display:block;overflow-wrap:anywhere}
  .pc-result .pc-shensha-name+.pc-shensha-name {margin-top:2px}
  .pc-result .pc-shensha-empty {color:var(--muted)}
  .pc-result #pillar-table td.pc-changsheng-cell {font-size:13px;line-height:1.5;vertical-align:middle;font-weight:600}
  .pc-result #pillar-table td.pc-pillar-relationships {text-align:left;vertical-align:top;font-size:12px;line-height:1.55}
  .pc-result .pc-pillar-relationship {display:block;overflow-wrap:anywhere}
  .pc-result .pc-pillar-relationship+.pc-pillar-relationship {margin-top:3px}
  .pc-result .pc-pillar-relationship b {font-weight:650;color:#686055}
  .pc-result .pc-pillar-relationship-empty {display:block;color:var(--muted)}
  .pc-result #four>#aux,.pc-result #four>.note {display:none}
  .pc-result #pc-shensha-scope {margin:8px 0 0;font-size:12px;color:var(--muted)}
  .pc-result #pc-four-notes {margin-top:14px;border-top:1px solid var(--line);font-size:14px}
  .pc-result .pc-rule-details {margin-top:16px;border-top:1px solid var(--line)}
  .pc-result .pc-rule-details summary {min-height:44px;padding:10px 0;cursor:pointer;font-size:14px}
  .pc-result .pc-rule-details summary::marker {color:var(--red)}
  .pc-result .pc-rule-details .basic-row {font-size:13px}
  .pc-result #result-footer {margin-top:20px;padding:16px 0;border-top:1px solid #e5dacf}
  .pc-result #result-footer .result-actions {margin-bottom:0}
  .pc-result #result-footer .status {margin:0 0 12px}
  .pc-result #result-footer .pc-development-status {display:none}
  .pc-result #result-footer #manual-copy {margin-top:16px}
}

/* V0.5: compact PC query only. Legacy mobile and print layout is restored by
   the controller, while all pre-existing control IDs and handlers stay intact. */
@media screen and (min-width:1024px) {
  .pc-result .element-金 {font-weight:700;-webkit-text-stroke:.35px #784000}
  .pc-result .strip-item.selected .element-金 {-webkit-text-stroke:0}
  .pc-query .pc-query-compare {min-width:900px}
  .pc-query .pc-query-compare td {padding:7px 4px}
  .pc-query .pc-query-compare td small {display:block;font-size:13px;color:var(--ink)}
  .pc-query .pc-query-compare .stem,.pc-query .pc-query-compare .branch {font-size:26px;line-height:1.3}
  .pc-query .pc-time-table {max-width:100%;margin-top:14px}
  .pc-query .pc-time-table th {width:66px;background:#f7f3ed}
  .pc-query .pc-time-table tr:first-child>* {border-top:1px solid var(--line)}
  .pc-query .pc-time-table td {min-width:0;padding:4px 7px;text-align:left}
  .pc-query .query-level h3 {margin:0 0 2px;font-size:12px;font-weight:400;color:var(--muted)}
  .pc-query .query-level:first-child h3 small {font-size:12px}
  .pc-query .scroll-strip {gap:0;padding:0 0 4px}
  .pc-query .strip-item {flex:0 0 80px;min-height:58px;padding:3px 2px;border-width:1px;border-radius:0;gap:0}
  .pc-query .strip-item b {font-size:19px;line-height:1.35}
  .pc-query .strip-item small {font-size:12px;line-height:1.35}
  .pc-query #query-days .strip-item {flex-basis:44px;min-height:48px}
  .pc-query #query-days .strip-item b {font-size:17px}
  .pc-query .strip-item.selected {box-shadow:inset 0 0 0 1px var(--red)}
  .pc-query .strip-item.selected small:first-child:before {content:"选中";display:block;font-size:10px;line-height:1}
  .pc-query #query-notes {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 16px;margin-top:12px}
  .pc-query #query-notes p {margin:0;font-size:14px;line-height:1.8}
  .pc-query #query-notes b {color:var(--muted);font-weight:600}
}

/* V0.5.1: only the PC third-module comparison/header. V0.5 selector rows,
   element color tokens, other modules, mobile and print styles are untouched. */
@media screen and (min-width:1024px) {
  .pc-query .pc-query-heading {display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:8px}
  .pc-query .pc-query-heading h2 {margin:0}
  .pc-query .pc-query-heading .date-controls {display:flex;align-items:center;gap:8px;max-width:none;font-size:13px;white-space:nowrap}
  .pc-query .pc-query-heading input {width:188px;min-height:42px;margin:0;padding:7px 9px}
  .pc-query #query-label {margin:5px 0;font-size:14px}
  .pc-query .pc-query-rules {margin-bottom:8px}
  .pc-query .pc-query-rules summary {padding:8px 0;min-height:36px;cursor:pointer;font-size:13px}
  .pc-query .pc-query-rules summary::marker {color:var(--red)}
  .pc-query .pc-query-rules p {margin:4px 0 8px}
  .pc-query .pc-query-compare {min-width:0;max-width:860px;margin:0 auto}
  .pc-query .pc-query-compare th:first-child {width:72px}
  .pc-query .pc-query-compare tbody tr:nth-child(2) td,
  .pc-query .pc-query-compare tbody tr:nth-child(3) td {height:68px;padding:8px 6px}
  .pc-query .pc-god-pair {display:inline-flex;align-items:center;justify-content:center;gap:6px;vertical-align:middle}
  .pc-query .pc-god-stack {display:flex;flex-direction:column;align-items:center;gap:2px}
  .pc-query .pc-query-compare .pc-god {font-size:13px;line-height:1.1;color:var(--ink);writing-mode:vertical-rl;text-orientation:upright}
}

/* V0.5.2: PC third-module columns only. Preserve all selector cells and
   local scroll regions; the presentation adapter restores mobile/print DOM. */
@media screen and (min-width:1024px) {
  .pc-query .pc-query-body {display:grid;grid-template-columns:minmax(0,.45fr) minmax(0,.55fr);gap:16px;align-items:start;margin-top:8px}
  .pc-query .pc-query-results {min-width:0}
  .pc-query .pc-query-results .pc-query-compare {width:100%;max-width:none;margin:0}
  .pc-query .pc-query-body>.pc-time-table {min-width:0;width:100%;margin-top:0}
  .pc-query .pc-query-results #query-notes {grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px}
}

/* V0.6: only the PC fourth-module overview and professional disclosure. */
@media screen and (min-width:1024px) {
  #details.pc-overview .overview-table {min-width:1240px}
  #details.pc-overview .overview-table th:first-child {width:100px;position:sticky;left:0;z-index:1}
  #details.pc-overview .overview-table th,#details.pc-overview .overview-table td {padding:7px 4px}
  #details.pc-overview .overview-luck {width:100%;min-height:34px;padding:4px 2px;font-size:24px;font-weight:700;background:transparent;border-color:transparent}
  #details.pc-overview .overview-luck[aria-pressed=true] {background:var(--redlight);border-color:var(--red)}
  #details.pc-overview .overview-table tbody tr:nth-child(3) td {font-size:24px;font-weight:700}
  #details.pc-overview .overview-table tbody tr:last-child td {vertical-align:top}
  #details.pc-overview .overview-year {display:block;width:100%;min-height:28px;padding:2px 1px;border:0;border-radius:0;background:transparent;font-size:14px;line-height:1.5;color:var(--ink);white-space:nowrap}
  #details.pc-overview .overview-year[aria-pressed=true] {background:var(--redlight);box-shadow:inset 0 0 0 1px var(--red);font-weight:700}
  #details.pc-overview .overview-year small {display:block;font-size:11px;line-height:1.2;color:var(--muted)}
  #details.pc-overview .overview-note {margin:10px 0}
  #details.pc-overview #luck-professional {margin-top:12px;border-top:1px solid var(--line)}
  #details.pc-overview #luck-professional>summary {padding:10px 0;min-height:44px;cursor:pointer;font-size:14px}
  #details.pc-overview #luck-professional>summary::marker {color:var(--red)}
}

/* JSON tools are console-only; no URL or UI switch exposes them. */
.result-page [data-debug-only]{display:none!important}

/* V0.7.1: neutral emphasis only in the PC fourth module; no mobile styles. */
@media screen and (min-width:1024px) {
  #details.pc-overview .changsheng-stage {font-weight:700;color:inherit}
}

/* 五行能量量化与日主强弱看板 */
.pc-wuxing-card {
  margin-top: 16px;
  padding: 16px;
  background: #faf8f5;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}
.pc-wuxing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.pc-wuxing-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.pc-wuxing-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 13px;
  background: #eee8df;
  color: #4a4238;
  border: 1px solid #dcd4c8;
}
.pc-wuxing-badge b {
  color: #a33d32;
}
.pc-wuxing-bar-wrap {
  width: 100%;
  height: 14px;
  background: #e6e0d8;
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 14px;
}
.pc-wuxing-bar {
  display: flex;
  height: 100%;
  width: 100%;
}
.pc-wuxing-seg {
  height: 100%;
  transition: width .3s ease;
}
.seg-木 { background: #238047; }
.seg-火 { background: #c9443c; }
.seg-土 { background: #9c6a33; }
.seg-金 { background: #d49b29; }
.seg-水 { background: #256ab6; }

.pc-wuxing-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.pc-wuxing-item {
  padding: 8px 6px;
  background: #fff;
  border: 1px solid #e5dfd5;
  border-radius: 4px;
  text-align: center;
}
.pc-wuxing-item-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
}
.wuxing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-木 { background: #238047; }
.dot-火 { background: #c9443c; }
.dot-土 { background: #9c6a33; }
.dot-金 { background: #d49b29; }
.dot-水 { background: #256ab6; }

.pc-wuxing-score {
  font-size: 16px;
  font-weight: 700;
  margin: 3px 0 1px;
  color: #2b2621;
}
.pc-wuxing-score small {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 2px;
}
.pc-wuxing-pct {
  font-size: 12px;
  color: var(--muted);
}
.pc-wuxing-status {
  font-size: 11px;
  color: #7a6e60;
  margin-top: 3px;
}

.pc-party-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 640px) {
  .pc-party-section {
    grid-template-columns: 1fr;
  }
}
.pc-party-box {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e5dfd5;
  border-radius: 4px;
}
.pc-party-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}
.party-same .pc-party-title { color: #a33d32; }
.party-diff .pc-party-title { color: #205c9e; }
.pc-party-roles {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 6px;
}
.pc-party-bar {
  width: 100%;
  height: 8px;
  background: #eee8e0;
  border-radius: 4px;
  overflow: hidden;
}
.pc-party-fill {
  height: 100%;
  border-radius: 4px;
}
.fill-same { background: linear-gradient(90deg, #d85c4f, #c9443c); }
.fill-diff { background: linear-gradient(90deg, #3d80c7, #256ab6); }

.pc-wuxing-advice {
  padding-top: 10px;
  border-top: 1px dashed #ded6ca;
  font-size: 13px;
  line-height: 1.6;
}
.pc-advice-line {
  margin: 4px 0;
}
.pc-badge-like {
  color: #1a6b38;
  font-weight: 600;
}
.pc-badge-dislike {
  color: #a33d32;
  font-weight: 600;
}

/* ========================================================
   流运细盘 (大运 -> 流年 -> 流月 -> 流日 四级联动与动态神煞刑冲)
   ======================================================== */
#pc-dynamic-xipan {
  position: relative;
  margin-top: 24px;
}
.xipan-unified-container {
  display: grid;
  grid-template-columns: minmax(0, 0.4fr) minmax(0, 0.6fr);
  gap: 16px;
  align-items: start;
}
.xipan-left-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.xipan-right-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* 左侧上半部：并列排盘表 */
.xipan-compare-table-wrap {
  background: #fff;
  border: 1px solid #ebd9c8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(120, 85, 45, 0.06);
}
.xipan-compare-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
  margin: 0;
}
.xipan-compare-table th,
.xipan-compare-table td {
  border-right: 1px solid #ebd9c8;
  border-bottom: 1px solid #ebd9c8;
  padding: 8px 4px;
  text-align: center;
  vertical-align: middle;
  background: #fff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.xipan-compare-table thead th {
  background: #faf5ed;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.xipan-compare-table thead th:hover {
  background: #f5ece0;
}
.xipan-compare-table th.xipan-th-label {
  width: 52px;
  cursor: default;
  background: #f7f0e6;
  color: #7a6e60;
  font-size: 12px;
}
.xipan-compare-table th.xipan-row-label {
  width: 52px;
  background: #faf5ed;
  color: #7a6e60;
  font-size: 12px;
  font-weight: 600;
  border-left: none;
}
.xipan-compare-table tr > *:last-child {
  border-right: none;
}
.xipan-compare-table tr:last-child > * {
  border-bottom: none;
}

/* 激活列一体化外圈高亮框（消除内部割断横线） */
.xipan-compare-table th.col-active {
  background: rgba(166, 52, 43, 0.08) !important;
  color: #a6342b !important;
  font-weight: 800;
  border-top: 2.5px solid #a6342b !important;
  border-left: 2px solid #a6342b !important;
  border-right: 2px solid #a6342b !important;
  border-bottom: 1px dashed rgba(166, 52, 43, 0.15) !important;
  box-shadow: none !important;
}
.xipan-compare-table td.col-active {
  background: rgba(166, 52, 43, 0.04) !important;
  border-left: 2px solid #a6342b !important;
  border-right: 2px solid #a6342b !important;
  border-bottom: 1px dashed rgba(166, 52, 43, 0.15) !important;
  box-shadow: none !important;
}
.xipan-compare-table tr:last-child td.col-active {
  border-bottom: 2.5px solid #a6342b !important;
}

.xipan-compare-table .xipan-td-time {
  line-height: 1.35;
  padding: 6px 2px;
  vertical-align: middle;
}
.xipan-compare-table .xipan-dual-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.xipan-compare-table .xipan-time-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}
.xipan-compare-table .xipan-time-row b {
  display: inline;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.xipan-compare-table .xipan-time-row small {
  display: inline;
  font-size: 10px;
  margin: 0;
}

/* 干支大字容器与十神排布：大字精准居中，十神副字挂靠右侧不偏心 */
.xipan-compare-table .xipan-td-stem,
.xipan-compare-table .xipan-td-branch {
  position: relative;
  text-align: center;
  vertical-align: middle;
  height: 48px;
  padding: 6px 2px;
}
.xipan-compare-table .pc-god-pair {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.xipan-compare-table .stem,
.xipan-compare-table .branch {
  display: inline-block;
  width: 28px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.xipan-compare-table .pc-god-stack {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 2px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  white-space: nowrap;
}
.xipan-compare-table .xipan-td-stem .pc-god-stack .pc-god {
  display: inline-block;
  font-size: 11px;
  line-height: 1.1;
  font-weight: 700;
  color: #724b26;
  background: #fbf0e4;
  border-radius: 3px;
  padding: 1px 3px;
}
.xipan-compare-table .xipan-td-branch .pc-god-stack {
  gap: 1px;
}
.xipan-compare-table .xipan-hidden-god-item {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}
.xipan-compare-table .xipan-hidden-god-item .pc-god {
  font-size: 10px;
  color: #8c7f70;
}
.xipan-td-xunkong {
  font-size: 12px;
  color: #724b26;
  font-weight: 600;
  padding: 8px 3px;
}

/* 动态指标看板 (Hero Dashboard Card) */
.xipan-dashboard {
  background: linear-gradient(135deg, #fffdfa 0%, #fbf5ee 100%);
  border: 1px solid #ebd9c8;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 4px 18px rgba(120, 85, 45, 0.06);
}
.xipan-dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #eddcca;
}
.xipan-dash-target {
  display: flex;
  align-items: center;
  gap: 12px;
}
.xipan-dash-tier-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--red);
  color: #fff;
  letter-spacing: 0.5px;
}
.xipan-dash-focus-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.xipan-dash-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.xipan-dash-ganzhi {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
}
.xipan-dash-prompt {
  font-size: 12px;
  color: var(--muted);
}

.xipan-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 900px) {
  .xipan-unified-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
@media (max-width: 820px) {
  .xipan-metrics-grid {
    grid-template-columns: 1fr;
  }
}
.xipan-metric-card {
  background: #fff;
  border: 1px solid #e7ded4;
  border-radius: 8px;
  padding: 10px 14px;
}
.xipan-metric-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.xipan-metric-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.xipan-metric-sub {
  font-size: 12px;
  color: #7a6e60;
  margin-top: 4px;
}

/* 神煞与刑冲合害展示条 */
.xipan-section-row {
  margin-top: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e7ded4;
  border-radius: 8px;
}
.xipan-row-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.xipan-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.xipan-badge-shensha {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #fbf0e4;
  color: #925200;
  border: 1px solid #ecc99e;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(146, 82, 0, 0.08);
}
.xipan-badge-clash {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #fdf0ee;
  color: #b32d20;
  border: 1px solid #f2bcb6;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(179, 45, 32, 0.08);
}
.xipan-badge-combine {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #edf6f0;
  color: #1f6b3b;
  border: 1px solid #bce1c9;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(31, 107, 59, 0.08);
}
.xipan-empty-tag {
  font-size: 12px;
  color: var(--muted);
}

/* 层级卡片与网格 (Tiers & Grid) */
.xipan-tier-box {
  background: #fff;
  border: 1px solid #e7dfd4;
  border-radius: 10px;
  padding: 14px 16px;
}
.xipan-tier-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.xipan-tier-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: #eedfd0;
  color: #724b26;
}
.xipan-tier-head strong {
  font-size: 15px;
  color: var(--ink);
}
.xipan-tier-head small {
  font-size: 12px;
  color: var(--muted);
}

/* 大运选项卡 */
.xipan-luck-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(166, 52, 43, 0.25) rgba(0, 0, 0, 0.03);
  -webkit-overflow-scrolling: touch;
}
.xipan-tab-card {
  flex: 0 0 110px;
  min-height: 80px;
  padding: 8px 10px;
  background: #faf7f2;
  border: 1.5px solid #ded5c8;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: all 0.15s ease-in-out;
}
.xipan-tab-card:hover {
  background: #fdf5ec;
  border-color: #c98c52;
}
.xipan-tab-card.selected-luck {
  background: #fdf8f2;
  border-color: #d19a66;
}
.xipan-tab-card.active-card,
.xipan-tab-card.active {
  background: #fff6f0 !important;
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(163, 61, 50, 0.25), 0 4px 12px rgba(163, 61, 50, 0.12) !important;
}
.xipan-tab-step {
  font-size: 11px;
  color: var(--muted);
}
.xipan-tab-gz {
  font-size: 18px;
  font-weight: 700;
  margin: 2px 0;
}
.xipan-tab-meta {
  font-size: 11px;
  color: #6d6255;
}

/* 通用单行横向滚动轨道 (流年、流月、流日滚动条) */
.xipan-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}
.xipan-year-grid,
.xipan-month-grid,
.xipan-day-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(166, 52, 43, 0.25) rgba(0, 0, 0, 0.03);
  -webkit-overflow-scrolling: touch;
}

/* 隐藏系统粗滚动条，定制为 4px 细扁平浅色滑块 */
.xipan-luck-tabs::-webkit-scrollbar,
.xipan-year-grid::-webkit-scrollbar,
.xipan-month-grid::-webkit-scrollbar,
.xipan-day-grid::-webkit-scrollbar {
  height: 4px;
}
.xipan-luck-tabs::-webkit-scrollbar-track,
.xipan-year-grid::-webkit-scrollbar-track,
.xipan-month-grid::-webkit-scrollbar-track,
.xipan-day-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 2px;
}
.xipan-luck-tabs::-webkit-scrollbar-thumb,
.xipan-year-grid::-webkit-scrollbar-thumb,
.xipan-month-grid::-webkit-scrollbar-thumb,
.xipan-day-grid::-webkit-scrollbar-thumb {
  background: rgba(166, 52, 43, 0.25);
  border-radius: 2px;
}
.xipan-luck-tabs::-webkit-scrollbar-thumb:hover,
.xipan-year-grid::-webkit-scrollbar-thumb:hover,
.xipan-month-grid::-webkit-scrollbar-thumb:hover,
.xipan-day-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(166, 52, 43, 0.45);
}

/* 单元卡片（flex: 0 0 auto 防止挤压变形） */
.xipan-item-card {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 8px 8px;
  background: #fdfaf6;
  border: 1.5px solid #e5ddd1;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  transition: all 0.15s ease-in-out;
}
.xipan-year-grid .xipan-item-card {
  min-width: 78px;
}
.xipan-month-grid .xipan-item-card {
  min-width: 84px;
}
.xipan-day-grid .xipan-item-card {
  min-width: 72px;
}
.xipan-item-card:hover {
  background: #faf2e6;
  border-color: #caa17a;
}
.xipan-item-card.selected-year,
.xipan-item-card.selected-month,
.xipan-item-card.selected-day {
  background: #fdf8f2;
  border-color: #d19a66;
}
.xipan-item-card.active-card,
.xipan-item-card.active {
  background: #fff7f2 !important;
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(163, 61, 50, 0.25), 0 3px 10px rgba(163, 61, 50, 0.12) !important;
}
.xipan-card-top {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.xipan-card-top b {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.xipan-card-gz {
  font-size: 17px;
  font-weight: 700;
  margin: 2px 0;
}
.xipan-card-bottom {
  font-size: 11px;
  color: #605649;
  white-space: nowrap;
}
.xipan-card-bottom small {
  font-size: 10px;
}

/* ========================================================
   古籍名著精粹解盘（《穷通宝鉴》《三命通会》《滴天髓》）
   古典书卷气、雅致宣纸质感与选项卡卡片设计
   ======================================================== */
#pc-classics-analysis {
  position: relative;
  margin-top: 24px;
}
.classics-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.classics-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  border-bottom: 1.5px solid #ebd9c8;
}
.classics-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 15px;
  font-weight: 600;
  color: #6d5b4a;
  background: #fbf7f0;
  border: 1.5px solid #e7ded2;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  white-space: nowrap;
}
.classics-tab:hover {
  background: #f7ede0;
  border-color: #d1b498;
  color: #8c3226;
}
.classics-tab.active {
  background: #fffdfa;
  color: #a33d32;
  border-color: #a33d32;
  border-bottom-color: #fffdfa;
  margin-bottom: -1.5px;
  box-shadow: 0 -2px 8px rgba(163, 61, 50, 0.08);
  font-weight: 700;
}
.classic-tab-badge {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  background: #efe3d5;
  color: #7a5431;
  border-radius: 4px;
  letter-spacing: 0;
}
.classics-tab.active .classic-tab-badge {
  background: #f8e5e2;
  color: #a33d32;
}

/* 内容面板 */
.classics-content {
  background: linear-gradient(180deg, #fffdfa 0%, #faf5ec 100%);
  border: 1px solid #ebd9c8;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 4px 20px rgba(100, 70, 30, 0.05);
}

.classic-article {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 顶部标题与标签 */
.classic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #e2d1be;
}
.classic-title {
  margin: 0;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 19px;
  font-weight: 700;
  color: #3b2c20;
  letter-spacing: 0.5px;
}
.classic-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: #fbf0ee;
  color: #a33d32;
  border: 1px solid #f2cfca;
}
.classic-badge.secondary,
.classic-badge.classic-badge-success,
.classic-badge-success {
  background: #edf4ee;
  color: #276c3e;
  border-color: #c7dfcd;
}
.classic-badge.classic-badge-neutral,
.classic-badge-neutral {
  background: #f4efe9;
  color: #6d6154;
  border-color: #ded6cb;
}

/* 诗赋原著引言 Banner */
.classic-verse-banner {
  background: #fdfaf4;
  border-left: 4px solid #a33d32;
  border-top: 1px solid #efe4d5;
  border-right: 1px solid #efe4d5;
  border-bottom: 1px solid #efe4d5;
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin: 4px 0;
}
.classic-verse-banner blockquote {
  margin: 0 0 6px 0;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 17px;
  line-height: 1.85;
  font-weight: 700;
  color: #4a2d1d;
  letter-spacing: 0.5px;
}
.classic-verse-banner .verse-source {
  font-size: 12px;
  color: #8c7a6b;
  text-align: right;
  font-style: italic;
}

/* 模块小卡片 */
.classic-box {
  background: #ffffff;
  border: 1px solid #ebd9c8;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.classic-box h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 700;
  color: #5c4533;
  display: flex;
  align-items: center;
  gap: 6px;
}
.classic-box h4::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 14px;
  background: #a33d32;
  border-radius: 2px;
}
.classic-quote {
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 15px;
  line-height: 1.8;
  color: #3b2e25;
  background: #faf6ef;
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 3px solid #d4b596;
}
.classic-desc {
  font-size: 14px;
  line-height: 1.75;
  color: #55483e;
}
.classic-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.classic-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
}
.classic-tag.favorable {
  background: #eef6f0;
  color: #1f6b3b;
  border: 1px solid #c0e2cb;
}
.classic-tag.unfavorable {
  background: #fdf1ef;
  color: #b3362a;
  border: 1px solid #f4c5be;
}
.classic-note {
  font-size: 12px;
  color: #85786c;
  line-height: 1.6;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #e8dcd0;
}

@media (max-width: 768px) {
  .classics-content {
    padding: 14px 12px;
  }
  .classics-tab {
    padding: 6px 12px;
    font-size: 13px;
  }
  .classic-title {
    font-size: 16px;
  }
  .classic-verse-banner blockquote {
    font-size: 15px;
  }
  .classic-quote {
    font-size: 13.5px;
  }
}

/* ========================================================
 * 八字命理全景详析样式
 * ======================================================== */
#pc-program-analysis {
  position: relative;
  margin-top: 24px;
}

.pa-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 顶部操作条与级联选择器 */
.pa-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fdf9f2 0%, #f6efe2 100%);
  border: 1.5px solid #ebd9c8;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(100, 70, 30, 0.04);
}

.pa-intro {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pa-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  background: #a33d32;
  color: #fff;
  letter-spacing: 0.5px;
}

.pa-subtitle {
  font-size: 13.5px;
  color: #735e4b;
  font-weight: 500;
}

.pa-cascade-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pa-control-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #4a3828;
}

.pa-control-item label b {
  font-weight: 600;
  color: #5a4230;
}

.pa-select {
  height: 38px;
  min-width: 140px;
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #38291c;
  background: #fffdfa;
  border: 1.5px solid #d4c0ab;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.pa-select:hover {
  border-color: #a33d32;
  box-shadow: 0 0 0 2px rgba(163, 61, 50, 0.1);
}

.pa-select:focus {
  border-color: #a33d32;
  box-shadow: 0 0 0 3px rgba(163, 61, 50, 0.2);
}

/* 核心内容展示区 */
.pa-content-area {
  background: linear-gradient(180deg, #fffdfa 0%, #faf6ee 100%);
  border: 1px solid #ebd9c8;
  border-radius: 12px;
  padding: 22px 26px;
  box-shadow: 0 4px 20px rgba(100, 70, 30, 0.05);
  animation: paFadeIn 0.25s ease-out;
}

@keyframes paFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.pa-article {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* 顶部项目大标题卡片 */
.pa-header-card {
  padding-bottom: 16px;
  border-bottom: 1.5px solid #ebdcd0;
}

.pa-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pa-title {
  margin: 0;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 21px;
  font-weight: 700;
  color: #3b2818;
  letter-spacing: 0.5px;
}

.pa-badge-accent {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: #fbf0ee;
  color: #a33d32;
  border: 1px solid #f2cfca;
}

.pa-summary {
  margin: 6px 0 0;
  font-size: 14.5px;
  line-height: 1.75;
  color: #63503f;
}

/* 各细分章节 */
.pa-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pa-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 6px;
  border-left: 3.5px solid #ad8750;
  padding-left: 10px;
}

.pa-section-title {
  margin: 0;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 16.5px;
  font-weight: 700;
  color: #4a3320;
}

.pa-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pa-tag {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 7px;
  background: #f2e9dc;
  color: #694a2b;
  border-radius: 4px;
}

.pa-section-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pa-text-box {
  background: #fdfbf7;
  border: 1px solid #efe4d6;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.85;
  color: #3d3024;
}

.pa-text-box blockquote {
  margin: 8px 0;
  padding: 10px 14px;
  background: #fff8ef;
  border-left: 3px solid #a33d32;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 14.5px;
  line-height: 1.8;
  color: #4a2818;
}

/* 结构化卡片网格系统（彻底解决文字重叠与换行缺失） */
.pa-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.pa-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fffefb;
  border: 1px solid #ebd9c8;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(90, 60, 20, 0.03);
  transition: all 0.2s ease;
}

.pa-card:hover {
  border-color: #c9ad93;
  box-shadow: 0 4px 14px rgba(90, 60, 20, 0.07);
  transform: translateY(-1px);
}

.pa-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pa-pillar-tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  background: #735338;
  color: #fff;
  border-radius: 3px;
}

.pa-kind-tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  background: #a33d32;
  color: #fff;
  border-radius: 3px;
}

.pa-card-label {
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 15px;
  color: #a33d32;
}

.pa-card-title-inline {
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 14.5px;
  color: #3b2818;
}

.pa-card-subtitle {
  font-size: 13.5px;
  font-weight: 600;
  color: #5e4733;
}

.pa-card-verse {
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 14px;
  font-weight: 700;
  color: #8c3b2d;
  background: #fcf6ee;
  padding: 6px 10px;
  border-left: 2.5px solid #a33d32;
  border-radius: 0 4px 4px 0;
  margin: 2px 0;
}

.pa-card-desc {
  font-size: 13.5px;
  line-height: 1.8;
  color: #4a3d31;
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (max-width: 768px) {
  .pa-topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .pa-cascade-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .pa-control-item {
    justify-content: space-between;
  }
  .pa-select {
    width: 60%;
  }
  .pa-content-area {
    padding: 14px 12px;
  }
  .pa-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
 * 首页视觉与品牌质感全新升级（温润宣纸质感 / 朱砂红微光）
 * ======================================================== */
body[data-page="input"] {
  background: #f7f3eb radial-gradient(circle at 50% 120px, #fdfbf7 0%, #f4eee2 100%);
  min-height: 100vh;
}

.home-hero {
  max-width: 620px;
  margin: 38px auto 18px;
  padding: 0 16px;
  text-align: center;
}

.home-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.home-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, #b3392f 0%, #8f271f 100%);
  color: #fffaf0;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", "SimSun", serif;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: 2px;
  padding-left: 2px;
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(166, 52, 43, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  border: 1px solid #731e17;
  user-select: none;
}

.home-title {
  margin: 0;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", "SimSun", serif;
  font-size: 28px;
  font-weight: 800;
  color: #2c251f;
  letter-spacing: 2.5px;
  line-height: 1.35;
}

.home-subtitle {
  margin: 8px 0 0;
  font-size: 13.5px;
  font-weight: 500;
  color: #857463;
  letter-spacing: 1.8px;
}

.home-card {
  background: linear-gradient(180deg, #fdfbf7 0%, #faf5ed 100%) !important;
  border: 1px solid #e7ddcf !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 36px rgba(84, 58, 30, 0.055), 0 2px 6px rgba(84, 58, 30, 0.02) !important;
  padding: 26px 26px 22px !important;
  margin-bottom: 30px !important;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid #ebd9c8;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.card-header h2 {
  font-family: "Songti SC", "Noto Serif CJK SC", serif;
  font-size: 18px;
  font-weight: 750;
  color: #38312a;
  letter-spacing: 1px;
  margin: 0;
}

.card-tag {
  font-size: 12px;
  color: #998a79;
  letter-spacing: 0.5px;
}

.home-card .field-group {
  display: flex;
  flex-direction: column;
}

.home-card .fields label,
.home-card .field-label {
  color: #4a4239;
  font-size: 13.5px;
  font-weight: 600;
  margin: 12px 0 6px;
  letter-spacing: 0.5px;
}

.home-card input:not([type=checkbox]),
.home-card select {
  width: 100%;
  height: 46px;
  border: 1px solid #ded5c8 !important;
  border-radius: 8px !important;
  padding: 8px 12px;
  background: #ffffff !important;
  color: #2b2520;
  font-size: 15px;
  box-shadow: inset 0 1.5px 3.5px rgba(0, 0, 0, 0.035) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-card input:not([type=checkbox])::placeholder {
  color: #b8aea2;
  font-weight: 400;
}

.home-card input:not([type=checkbox]):focus,
.home-card select:focus {
  border-color: #a6342b !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02), 0 0 0 3px rgba(166, 52, 43, 0.14) !important;
  outline: none;
}

.field-rule-tip {
  font-size: 12px;
  color: #8c7e6f;
  margin: 14px 0 16px;
  line-height: 1.5;
  text-align: center;
}

.home-run-btn {
  width: 100%;
  min-height: 50px;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #ffffff !important;
  background: linear-gradient(135deg, #b83a30 0%, #a6342b 55%, #8f2820 100%) !important;
  border: 1px solid #7d2019 !important;
  border-radius: 9px !important;
  box-shadow: 0 5px 16px rgba(166, 52, 43, 0.32), inset 0 1px 1px rgba(255, 255, 255, 0.3) !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}

.home-run-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #c24035 0%, #ad382e 55%, #992c23 100%) !important;
  box-shadow: 0 7px 20px rgba(166, 52, 43, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.38) !important;
  transform: translateY(-1px);
}

.home-run-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(166, 52, 43, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.18) !important;
}

.home-run-btn:disabled {
  opacity: 0.55;
  background: #d4ccc0 !important;
  border-color: #c2b8ab !important;
  color: #7d7265 !important;
  text-shadow: none;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
}

.home-feature-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 12px;
  margin: 22px 0 16px;
  padding-top: 18px;
  border-top: 1px dashed #e8ded4;
}

.feature-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  color: #7d493a;
  background: #fbf5ee;
  border: 1px solid #ebdccc;
  border-radius: 20px;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.badge-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a6342b;
}

.home-footer-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6px;
}

.home-privacy-tip {
  font-size: 12px;
  color: #9e9386;
  text-align: center;
  margin: 8px 0 12px;
  line-height: 1.5;
}

.btn-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  color: #8c8173 !important;
  background: transparent !important;
  border: 1px solid #ded5c8 !important;
  border-radius: 6px !important;
  padding: 6px 16px !important;
  min-height: 34px !important;
  cursor: pointer;
  margin: 0 auto;
  transition: all 0.2s ease;
}

.btn-clear:hover {
  background: #f4ece1 !important;
  color: #a6342b !important;
  border-color: #c9bbae !important;
}

@media (max-width: 640px) {
  .home-hero {
    margin: 24px auto 14px;
  }
  .home-title {
    font-size: 23px;
    letter-spacing: 1.5px;
  }
  .home-subtitle {
    font-size: 12px;
    letter-spacing: 1px;
  }
  .home-card {
    padding: 18px 14px 16px !important;
  }
  .home-feature-badges {
    gap: 6px 8px;
  }
  .feature-badge {
    font-size: 11px;
    padding: 3px 8px;
  }
}

/* ========================================================
 * 全球真太阳时与城市联动选择器样式
 * ======================================================== */
.city-picker-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.city-picker-row select {
  flex: 1;
  min-width: 0;
  height: 42px;
  font-size: 14px;
}

.solar-time-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 14px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #fdfbf7 0%, #f7efe4 100%);
  border: 1px solid #ebd9c8;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(80, 50, 20, 0.03);
}

.solar-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: #3b2818;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.solar-toggle-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #a33d32;
  cursor: pointer;
  margin: 0;
}

.solar-time-tip {
  font-size: 12px;
  font-weight: 500;
  color: #8c3b2d;
  background: #fffcf8;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px dashed #d6b89c;
  line-height: 1.4;
  letter-spacing: 0.2px;
}

.solar-time-tip.disabled {
  color: #887b6d;
  background: #f0eae1;
  border-color: #d8cebf;
}

.highlight-solar-time {
  color: #a33d32;
  font-weight: 700;
  font-size: 15px;
}

.pc-solar-badge {
  display: inline-block;
  background: #fdf0ee;
  color: #a33d32;
  border: 1px solid #f2ceca;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Desktop presentation only. The original energy card stays in the right
   column, with its original dimensions, heading and expanded analysis. */
@media screen and (min-width:1024px) {
  .pc-result #basic-body {font-size:14px;line-height:1.75}
  .pc-result .pc-profile-line {margin:6px 0}
  .pc-result .pc-bone-block {margin-top:14px;padding-top:12px;border-top:1px solid var(--line)}
  .pc-result .pc-bone-block>h3 {margin:0 0 8px;font-size:14px;color:#686055}
  .pc-result #four>#pc-relationship-analysis {margin:16px 0 0;padding:16px;background:#faf8f5;border:1px solid var(--line);border-radius:6px;font-size:14px}
  .pc-result #pc-relationship-analysis>h2 {font-size:15px;line-height:1.6}

  /* Inserted only during the desktop render and removed on mobile/print. */
  .pc-result #pc-wuxing-teaching {min-width:0;display:grid;gap:16px;margin-top:20px}
  .pc-result .pc-element-diagram {min-width:0;margin:0;padding:16px;background:linear-gradient(145deg,#fffdf8,#f9f4eb);border:1px solid #e6d9c5;border-radius:8px;box-shadow:0 2px 8px #795d3010}
  .pc-result .pc-element-diagram figcaption {position:relative;padding-left:12px}
  .pc-result .pc-element-diagram figcaption::before {content:"";position:absolute;inset:3px auto 3px 0;width:3px;border-radius:2px;background:#b89661}
  .pc-result .pc-element-diagram h3 {margin:0;color:var(--ink);font:700 19px/1.4 "Songti SC","Noto Serif CJK SC",serif;letter-spacing:1px}
  .pc-result .pc-diagram-subtitle {margin:4px 0 0;color:#887c6b;font-size:12px;line-height:1.6;overflow-wrap:anywhere}
  .pc-result .pc-diagram-canvas {display:block;width:100%;max-width:280px;height:auto;margin:10px auto 12px}
  .pc-result .pc-diagram-wood {--diagram-tone:#547b45;--diagram-light:#91b279;--diagram-deep:#375b2d;--diagram-tint:#f1f6ed;--diagram-line:#d6e2ca;color:var(--diagram-tone)}
  .pc-result .pc-diagram-fire {--diagram-tone:#bf5142;--diagram-light:#e9947c;--diagram-deep:#9a342b;--diagram-tint:#fcf0eb;--diagram-line:#eed4cb;color:var(--diagram-tone)}
  .pc-result .pc-diagram-earth {--diagram-tone:#a77b43;--diagram-light:#cfb17a;--diagram-deep:#7f552b;--diagram-tint:#f8f2e8;--diagram-line:#e6d8c1;color:var(--diagram-tone)}
  .pc-result .pc-diagram-metal {--diagram-tone:#bf962d;--diagram-light:#e6ce79;--diagram-deep:#86631c;--diagram-tint:#fbf7e7;--diagram-line:#e9dfb6;color:var(--diagram-tone)}
  .pc-result .pc-diagram-water {--diagram-tone:#3f83a8;--diagram-light:#87bbd4;--diagram-deep:#285e80;--diagram-tint:#eef5f9;--diagram-line:#cfe0eb;color:var(--diagram-tone)}
  .pc-result .pc-diagram-gradient-light {stop-color:var(--diagram-light)}
  .pc-result .pc-diagram-gradient-main {stop-color:var(--diagram-tone)}
  .pc-result .pc-diagram-gradient-deep {stop-color:var(--diagram-deep)}
  .pc-result .pc-diagram-edge {fill:none;stroke-linecap:round;stroke-linejoin:round}
  .pc-result .pc-diagram-ring-edge {stroke:currentColor;stroke-width:4;stroke-opacity:.72}
  .pc-result .pc-diagram-star-edge {stroke:#98723f;stroke-width:2.2}
  .pc-result .pc-diagram-node-halo {fill:currentColor;fill-opacity:.07}
  .pc-result .pc-diagram-node-body {stroke:var(--diagram-deep);stroke-width:1.1}
  .pc-result .pc-diagram-node-ring {fill:none;stroke:#fff9e8;stroke-opacity:.8;stroke-width:1}
  .pc-result .pc-diagram-node-shine {fill:none;stroke:white;stroke-opacity:.4;stroke-width:1.5;stroke-linecap:round}
  .pc-result .pc-diagram-node text {fill:#fffdf5;font:700 29px "Songti SC","Noto Serif CJK SC",serif}
  .pc-result .pc-diagram-node-icon {fill:none;stroke:#fff9e8;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round;opacity:.6}
  .pc-result .pc-diagram-center {fill:#806b4c;font:600 22px "Songti SC","Noto Serif CJK SC",serif;letter-spacing:3px}
  .pc-result .pc-diagram-orbit {fill:none;stroke:#d8c9af;stroke-width:1;stroke-dasharray:3 5;opacity:.65}
  .pc-result .pc-diagram-center-ring {fill:none;stroke:#d8c9af;stroke-width:1;opacity:.4}
  .pc-result .pc-diagram-landscape {fill:#b6a386;fill-opacity:.09;stroke:#b6a386;stroke-opacity:.12;stroke-width:1}
  .pc-result .pc-diagram-cloud {fill:none;stroke:#c6a978;stroke-width:1.4;stroke-linecap:round;opacity:.18}
  .pc-result .pc-diagram-notes {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:0;padding:0;list-style:none}
  .pc-result .pc-diagram-note-card {min-width:0;display:grid;grid-template-columns:minmax(0,1fr) 18px;align-content:start;align-items:center;gap:4px 6px;padding:8px 9px;background:var(--diagram-tint);border:1px solid var(--diagram-line);border-radius:5px}
  .pc-result .pc-diagram-note-card:last-child {grid-column:1 / -1;grid-template-columns:auto minmax(0,1fr) 18px;column-gap:9px}
  .pc-result .pc-diagram-tag {justify-self:start;padding:1px 8px;border-radius:12px;background:var(--diagram-deep);color:#fffdf5;font:600 12px/1.7 "Songti SC","Noto Serif CJK SC",serif;white-space:nowrap}
  .pc-result .pc-diagram-note-icon {display:block;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round;opacity:.7}
  .pc-result .pc-diagram-note-card p {grid-column:1 / -1;min-width:0;margin:0;color:#665c4e;font-size:13px;line-height:1.65;overflow-wrap:anywhere}
  .pc-result .pc-diagram-note-card:last-child p {grid-column:2;grid-row:1}
  .pc-result .pc-diagram-note-card:last-child .pc-diagram-note-icon {grid-column:3;grid-row:1}
  .pc-result .pc-diagram-note {margin:0;padding:2px 2px 0;color:var(--muted);font-size:12px;line-height:1.7;overflow-wrap:anywhere}
  .pc-result .pc-pattern-classification-note {margin:10px 0 0;color:#686055;font-size:13px;font-weight:400;line-height:1.7}
  /* Let the long role caption wrap before the score, never split a score. */
  .pc-result #four .pc-party-box {min-width:0}
  .pc-result #four .pc-party-head {align-items:flex-start;flex-wrap:wrap;gap:4px 8px}
  .pc-result #four .pc-party-title {flex:1 1 10em;min-width:0;overflow-wrap:anywhere}
  .pc-result #four .pc-party-val {flex:0 0 auto;white-space:nowrap}

  .pc-result .pc-rule-details,
  .pc-result .pc-analysis-details,
  .pc-result .pc-reading-details {border-top:1px solid var(--line);margin-top:14px}
  .pc-result .pc-analysis-details>summary,
  .pc-result .pc-reading-details>summary,
  .pc-result .pc-rule-details>summary {min-height:44px;padding:10px 0;cursor:pointer;color:#686055;font-size:14px;font-weight:600;line-height:1.65}
  .pc-result details>summary::marker {color:var(--red)}
  .pc-result details>summary:focus-visible {outline:2px solid var(--red);outline-offset:4px;border-radius:3px}
  .pc-result .pc-rule-details .basic-row {grid-template-columns:92px minmax(0,1fr);font-size:13px}
  .pc-result .pc-rule-details .basic-row b {color:#686055}
  .pc-result #pc-relationship-analysis h2 {margin-bottom:0}
  .pc-result #pc-relationship-analysis #pc-four-notes {margin:0;border:0}
  .pc-result #pc-four-dynamic-transit {margin-top:12px;font-size:13px}
  .pc-result .pc-reading-details .pa-article {max-width:1100px;margin-inline:auto}
  .pc-result .pc-reading-details .pa-container,
  .pc-result .pc-reading-details .classics-card {margin-top:8px}
  .pc-result #pc-program-analysis>h2,
  .pc-result #pc-classics-analysis>h2 {margin-bottom:0}
}

/* Mobile reading layer. Desktop starts at 1024px in pc-result.js; keep these
   metrics screen-only so the original full-table print layout is untouched. */
body[data-page="result"] .mobile-scroll-hint {display:none}
/* Print-only overflow/pagination fixes; screen and mobile layout are unchanged. */
@media print {
  body[data-page="result"] :is(#pillar-table,#details-table,#xipan-compare-table-wrap) {overflow:visible!important;max-height:none!important;width:100%!important}
  body[data-page="result"] :is(#pillar-table,#details-table,#xipan-compare-table-wrap) table {min-width:0!important;width:100%!important}
  body[data-page="result"] :is(#pillar-table,#details-table,#xipan-compare-table-wrap) th:first-child {position:static!important}
  body[data-page="result"] :is(#pc-dynamic-xipan,.xipan-dashboard,.pc-wuxing-card,.pa-section,.classic-card) {break-inside:auto!important;page-break-inside:auto!important}
  body[data-page="result"] :is(.pa-content-area,.classics-content,.xipan-compare-table-wrap) {animation:none!important;overflow:visible!important}
  body[data-page="result"] .xipan-dash-prompt {display:block!important}
  body[data-page="result"] .xipan-compare-table :is(td,th) {min-width:0!important}
}
@media screen and (max-width:1023px) {
  body[data-page="result"] {font-size:15px;line-height:1.75}
  body[data-page="result"] .result-page {width:100%;min-width:0;margin:12px auto;padding:0 12px}
  body[data-page="result"] .panel {min-width:0;max-width:100%;padding:16px 12px;margin-bottom:16px}
  body[data-page="result"] #chart {min-width:0;max-width:100%}
  body[data-page="result"] .panel>h2 {font:700 20px/1.45 "Songti SC","Noto Serif CJK SC",serif;letter-spacing:.5px;margin-bottom:14px}
  body[data-page="result"] .panel p {overflow-wrap:anywhere}
  body[data-page="result"] .note {font-size:13px;line-height:1.75}
  body[data-page="result"] #basic-body {font-size:15px;line-height:1.75}
  body[data-page="result"] #basic-body .basic-row {grid-template-columns:6em minmax(0,1fr);gap:10px;padding:9px 0}
  body[data-page="result"] #basic-body .basic-row>span {min-width:0;overflow-wrap:anywhere}
  body[data-page="result"] .mobile-bone-block {margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}
  body[data-page="result"] .mobile-bone-block>h3 {margin:0 0 4px;font:700 16px/1.6 "Songti SC","Noto Serif CJK SC",serif;color:var(--ink)}
  body[data-page="result"] .mobile-rule-details {margin-top:14px;border-top:1px solid var(--line)}
  body[data-page="result"] .mobile-rule-details>summary {min-height:48px;padding:12px 0;font-size:14px;font-weight:600;line-height:1.7;color:var(--red);cursor:pointer;overflow-wrap:anywhere}
  body[data-page="result"] .mobile-rule-details summary::marker {color:var(--red)}
  body[data-page="result"] #basic-body .mobile-rule-details .basic-row {font-size:14px;line-height:1.8}

  /* Scroll each wide data region, not the document. Keep every original row. */
  body[data-page="result"] :is(#pillar-table,#details-table,#xipan-compare-table-wrap) {display:block;width:100%;max-width:100%;min-width:0;overflow:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
  body[data-page="result"] #pillar-table table {width:100%;min-width:440px;font-size:14px}
  body[data-page="result"] #pillar-table th,
  body[data-page="result"] #pillar-table td {padding:10px 8px;line-height:1.7;vertical-align:top}
  body[data-page="result"] #pillar-table th:first-child {position:sticky;left:0;z-index:2;width:80px;background:#f7f2e9}
  body[data-page="result"] #pillar-table thead th {background:#f1e9dd}
  body[data-page="result"] #pillar-table thead th:first-child {z-index:3}
  body[data-page="result"] #pillar-table :is(.stem,.branch) {font-size:28px;line-height:1.5}
  body[data-page="result"] #pillar-table .hidden-line {font-size:14px;line-height:1.85;white-space:nowrap}

  body[data-page="result"] #pc-dynamic-xipan .xipan-unified-container {grid-template-columns:minmax(0,1fr);gap:16px}
  body[data-page="result"] #pc-dynamic-xipan :is(.xipan-left-column,.xipan-right-column,.xipan-tier-box) {min-width:0;max-width:100%}
  body[data-page="result"] #pc-dynamic-xipan .xipan-tier-box {padding:12px}
  body[data-page="result"] #pc-dynamic-xipan .xipan-tier-head {flex-wrap:wrap;gap:6px 8px;margin-bottom:6px}
  body[data-page="result"] #pc-dynamic-xipan .xipan-tier-head small {flex:1 1 100%;min-width:0;font-size:13px;line-height:1.65;overflow-wrap:anywhere}
  body[data-page="result"] #pc-dynamic-xipan :is(.xipan-luck-tabs,.xipan-year-grid,.xipan-month-grid,.xipan-day-grid) {width:100%;min-width:0;max-width:100%;gap:10px;padding:4px 4px 10px;overflow-x:auto;overscroll-behavior-x:contain;scroll-padding-inline:4px}
  body[data-page="result"] #pc-dynamic-xipan .xipan-tab-card {flex:0 0 122px;min-height:108px;padding:10px 8px}
  body[data-page="result"] #pc-dynamic-xipan .xipan-item-card {flex:0 0 104px;min-width:104px;min-height:96px;padding:10px 8px}
  body[data-page="result"] #pc-dynamic-xipan :is(.xipan-tab-gz,.xipan-card-gz) {font-size:21px;line-height:1.5}
  body[data-page="result"] #pc-dynamic-xipan :is(.xipan-tab-step,.xipan-tab-meta,.xipan-card-top,.xipan-card-bottom,.xipan-card-bottom small) {font-size:12px;line-height:1.6}
  /* The existing date caption is inline-sized at 10px; enlarge only on mobile. */
  body[data-page="result"] #pc-dynamic-xipan .xipan-tab-date {font-size:12px!important;white-space:normal}
  body[data-page="result"] #pc-dynamic-xipan .xipan-compare-table {min-width:560px;font-size:14px}
  body[data-page="result"] #pc-dynamic-xipan .xipan-compare-table th,
  body[data-page="result"] #pc-dynamic-xipan .xipan-compare-table td {padding:9px 6px}
  body[data-page="result"] #pc-dynamic-xipan .xipan-dash-header {flex-wrap:wrap;gap:8px}

  /* Ten 160px decade columns plus the original 120px row-label column. */
  body[data-page="result"] #details-table .comprehensive {width:100%;min-width:1720px;font-size:14px}
  body[data-page="result"] #details-table .comprehensive th:first-child {width:120px;position:sticky;left:0;z-index:2;background:#f7f2e9}
  body[data-page="result"] #details-table .comprehensive thead th:first-child {z-index:3;background:#f1e9dd}
  body[data-page="result"] #details-table .comprehensive th,
  body[data-page="result"] #details-table .comprehensive td {padding:10px 8px;font-size:14px;line-height:1.75}
  body[data-page="result"] #details-table .comprehensive button {min-height:48px;padding:8px 6px;font-size:14px;line-height:1.65;white-space:normal}
  body[data-page="result"] #details-table .annual-choice>span {overflow-wrap:anywhere}
  body[data-page="result"] #details-table .annual-choice>span:nth-child(n+3) {font-size:12px;line-height:1.75}
  body[data-page="result"] .mobile-scroll-hint {display:block;margin:0 0 10px;color:#786b5b;font-size:13px;line-height:1.65}
}

@media screen and (max-width:768px) {
  #pc-dynamic-xipan.xipan-mobile-layout .xipan-unified-container,
  .xipan-mobile-layout .xipan-left-column {gap:12px}
  .xipan-mobile-selection {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-bottom:12px}
  .xipan-mobile-selection button {
    display:grid;align-content:start;gap:2px;min-height:60px;padding:8px 10px;
    border:1px solid #ded5c8;border-radius:6px;background:#fff;color:var(--ink);
    text-align:left;font-size:14px;line-height:1.45;overflow-wrap:anywhere;
  }
  .xipan-mobile-selection button strong {font-size:15px}
  .xipan-mobile-selection button[aria-current="true"] {border-inline-start:4px solid var(--red)}
  .xipan-mobile-selection button[aria-expanded="true"] {background:#f7f0e6;border-color:var(--red)}
  .xipan-mobile-layout :is(button,select,summary):focus-visible {outline:2px solid var(--red);outline-offset:2px}
  .xipan-mobile-layout .xipan-tier-box :is(.selected-luck,.selected-year,.selected-month) {border-color:var(--red)}
  #pc-dynamic-xipan.xipan-mobile-layout #xipan-month-grid .xipan-item-card {
    flex:0 0 82px;min-width:82px;min-height:64px;padding:6px 8px;
  }
  .xipan-mobile-layout #xipan-month-grid .xipan-card-bottom,
  .xipan-mobile-layout #xipan-picker-day .mobile-scroll-hint,
  .xipan-mobile-layout #xipan-day-grid {display:none}
  .xipan-mobile-date-control {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px;font-size:14px}
  .xipan-mobile-date-control label {grid-column:1 / -1}
  .xipan-mobile-date-control :is(select,button) {
    min-height:48px;padding:8px 10px;
    border:1px solid #b9a999;border-radius:6px;background:white;color:var(--ink);font-size:16px;
  }
  .xipan-mobile-date-control select {width:100%}
  .xipan-mobile-date-control button {white-space:nowrap}
  .xipan-mobile-layout #xipan-compare-table-wrap {
    box-sizing:border-box;width:100%;min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;
  }
  .xipan-mobile-layout .xipan-compare-table :is(.xipan-th-label,.xipan-row-label) {
    position:sticky;left:0;z-index:1;
  }
  .xipan-mobile-full > summary {min-height:48px;padding:10px 0;color:var(--red);font-weight:700;cursor:pointer}
}

#mobile-result-nav,#mobile-chart-overview,#mobile-other-actions {display:none}

@media screen and (max-width:768px) {
  #chart[data-mobile-section="overview"] > section:not(#basic),
  #chart[data-mobile-section="chart"] > section:not(#four),
  #chart[data-mobile-section="transit"] > section:not(#pc-dynamic-xipan,#details),
  #chart[data-mobile-section="reading"] > section:not(#pc-program-analysis,#pc-classics-analysis) {display:none}

  .result-page:has(> #chart:not([hidden])) {padding-bottom:calc(76px + env(safe-area-inset-bottom, 0px))}
  #mobile-result-nav {
    position:fixed;z-index:20;inset:auto 0 0;
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;
    padding:5px max(8px, env(safe-area-inset-right, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    border-top:1px solid var(--line);background:#fffdf9;
  }
  #mobile-result-nav button {
    display:grid;justify-items:center;align-content:center;gap:2px;
    min-height:52px;padding:4px;border-color:transparent;background:transparent;
    color:var(--ink);font-size:14px;line-height:1.25;
  }
  #mobile-result-nav button[aria-pressed="true"] {border-color:#e5bfb6;background:var(--redlight);color:var(--red);font-weight:700}
  #mobile-result-nav button:focus-visible {outline:2px solid var(--red);outline-offset:-2px}
  #mobile-result-nav svg {width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}

  #mobile-chart-overview:not(:empty) {display:block;margin-bottom:12px;padding-bottom:12px;border-bottom:1px solid var(--line)}
  #mobile-chart-overview .pc-profile-line {margin:4px 0}
  .mobile-overview-pillars {
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
    margin:0 0 12px;padding:8px 0;border-block:1px solid var(--line);text-align:center;
  }
  .mobile-overview-pillars > div + div {border-inline-start:1px solid var(--line)}
  .mobile-overview-pillars dt {color:#665c4e;font-size:13px}
  .mobile-overview-pillars dd {margin:0;font:700 23px/1.5 "Songti SC","Noto Serif CJK SC",serif}

  #four > #pc-wuxing-teaching {display:grid;gap:12px;margin-top:16px}
  #four .pc-element-diagram {min-width:0;margin:0;padding:12px;border:1px solid var(--line);border-radius:8px;background:#fffdf8}
  #four .pc-element-diagram h3 {margin:0}
  #four .pc-diagram-subtitle,#four .pc-diagram-note {margin:4px 0;color:#665c4e;font-size:13px}
  #four .pc-diagram-canvas {display:block;width:100%;max-width:280px;height:auto;margin:8px auto}
  #four .pc-diagram-wood {color:#547b45}
  #four .pc-diagram-fire {color:#bf5142}
  #four .pc-diagram-earth {color:#a77b43}
  #four .pc-diagram-metal {color:#aa741c}
  #four .pc-diagram-water {color:#3f83a8}
  #four .pc-diagram-gradient-light,#four .pc-diagram-gradient-main,#four .pc-diagram-gradient-deep {stop-color:currentColor}
  #four .pc-diagram-edge {fill:none;stroke:currentColor;stroke-width:4;stroke-linecap:round}
  #four .pc-diagram-star-edge {stroke:#98723f}
  #four .pc-diagram-node-halo {fill:currentColor;opacity:.1}
  #four .pc-diagram-node-ring,#four .pc-diagram-orbit,#four .pc-diagram-center-ring {fill:none;stroke:#b89661;stroke-opacity:.55}
  #four .pc-diagram-node-shine,#four .pc-diagram-node-icon {fill:none;stroke:white;stroke-width:1.5}
  #four .pc-diagram-node text {fill:#fffdf5;font:700 29px "Songti SC",serif}
  #four .pc-diagram-center {fill:#665c4e;font-size:22px;font-weight:700}
  #four .pc-diagram-landscape,#four .pc-diagram-cloud {fill:none;stroke:#b89661;stroke-opacity:.2}
  #four .pc-diagram-notes {display:grid;gap:5px;list-style:none;margin:0;padding:0}
  #four .pc-diagram-note-card {display:grid;grid-template-columns:4em 16px minmax(0,1fr);align-items:start;gap:6px;font-size:13px}
  #four .pc-diagram-note-icon {width:16px;height:16px;margin-top:3px;stroke:currentColor}
  #four .pc-diagram-note-card p {margin:0;color:#665c4e}
  #four .pc-diagram-tag {font-weight:700}
}

@media screen and (max-width:768px) {
  #mobile-other-actions {display:block;margin-top:16px;padding-top:12px;border-top:1px solid var(--line)}
  #mobile-other-actions h3 {margin:0 0 10px;font-size:16px}
  #mobile-other-actions .result-actions {display:grid;gap:8px;margin:0}
  #mobile-other-actions .result-actions :is(button,a) {width:100%;min-height:48px;font-size:15px}

  body[data-page="result"] #pillar-table {overflow:visible}
  body[data-page="result"] #pillar-table table {width:100%;min-width:0;table-layout:fixed;font-size:14px}
  body[data-page="result"] #pillar-table th,
  body[data-page="result"] #pillar-table td {
    min-width:0;padding:8px 3px;line-height:1.65;vertical-align:top;overflow-wrap:anywhere;white-space:normal;
  }
  body[data-page="result"] #pillar-table th:first-child {position:static;width:3.8em}
  body[data-page="result"] #pillar-table .hidden-line {white-space:normal;line-height:1.8}
  body[data-page="result"] #pillar-table .hidden-line b {margin-right:2px}
  body[data-page="result"] #four > .mobile-scroll-hint {display:none}

  #mobile-pillar-details {min-width:0;margin:14px 0}
  #mobile-pillar-details h3 {margin:0 0 8px;font-size:16px}
  #mobile-pillar-details details {margin-bottom:6px;border:1px solid var(--line);border-radius:6px;overflow:hidden}
  #mobile-pillar-details summary {min-height:48px;padding:10px 12px;color:var(--red);font-weight:700;cursor:pointer}
  #mobile-pillar-details table {width:100%;table-layout:fixed;font-size:14px}
  #mobile-pillar-details th {width:5em}
  #mobile-pillar-details :is(th,td) {padding:8px;white-space:normal;overflow-wrap:anywhere;vertical-align:top}
  #mobile-pillar-details .pc-pillar-relationship {text-align:left}
}

/* Fold only this mobile module; keep the original ten-column live table. */
@media screen and (max-width:768px) {
  body[data-page="result"] #details .details-rule-version {display:none}
  body[data-page="result"] #details[data-mobile-luck-open="false"] > :not(h2) {display:none!important}
  body[data-page="result"] #details[data-mobile-luck-open="false"] > h2 {margin-bottom:0}
  #details .mobile-luck-disclosure {
    display:flex;align-items:center;justify-content:space-between;gap:12px;
    width:100%;min-width:0;min-height:48px;padding:4px 0;
    border:0;background:transparent;color:inherit;text-align:left;font:inherit;
  }
  #details .mobile-luck-disclosure > span:first-child {min-width:0;overflow-wrap:anywhere}
  #details .mobile-luck-disclosure-state {flex-shrink:0;color:var(--red);font:600 14px/1.6 sans-serif}
  #details .mobile-luck-disclosure:focus-visible {outline:2px solid var(--red);outline-offset:3px}
  body[data-page="result"] #details #details-table {
    box-sizing:border-box;width:100%;min-width:0;max-width:100%;
    overflow-x:auto;overscroll-behavior-x:contain;isolation:isolate;
    scroll-padding-left:120px;
  }
  body[data-page="result"] #details #details-table .comprehensive {
    width:100%;min-width:1720px;table-layout:fixed;border-collapse:separate;border-spacing:0;
  }
  body[data-page="result"] #details #details-table .comprehensive th:first-child {
    box-sizing:border-box;position:sticky;left:0;z-index:2;width:120px;
    background:#f7f2e9;box-shadow:1px 0 0 var(--line);
  }
  body[data-page="result"] #details #details-table .comprehensive thead th:first-child {z-index:3;background:#f1e9dd}
}
