/* 本地古籍装帧稿：维持亮度，只增强材质、边饰和层级。 */
:root {
  --heritage-ink: #253f3a;
  --heritage-green: #4c705b;
  --heritage-bronze: #8b6738;
  --heritage-red: #9b4737;
  --heritage-rule: #c3a878;
  --heritage-hairline: #e1d4ba;
  --heritage-paper: #f6f2e9;
  --heritage-card: #fffcf5;
  --heritage-display: "Kaiti SC", "STKaiti", "Songti SC", "STSong", serif;
  --heritage-serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --heritage-corner: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%239b7947' stroke-width='1'%3E%3Cpath d='M2 43V2h41M8 31V8h23M2 15h14V2M8 21h13V8'/%3E%3C/g%3E%3C/svg%3E");
  --heritage-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.74' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.045'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='.55'/%3E%3C/svg%3E");
}
html { background: var(--heritage-paper); }
body {
  background-image: var(--heritage-grain), radial-gradient(ellipse at 40% 0, #fffdf7 0, transparent 70%);
  background-size: 180px 180px, auto;
}
body[data-view="report"], body.flow-preview, body.season-page {
  background-image: var(--heritage-grain), radial-gradient(ellipse at 40% 0, #fffdf7 0, transparent 70%);
}

/* 顶部沿用真实品牌，以书脊色块和双线作区隔。 */
.topbar { border-bottom: 3px double #c9b58e; }
.brand-copy strong { font-family: var(--heritage-serif); font-weight: 600; letter-spacing: .08em; }
.xiuzheng-logo { background: #365748; border: 1px solid #a4a88d; box-shadow: inset 0 0 0 2px #365748; border-radius: 2px; }
.local-tag { font-family: var(--heritage-serif); }
.mode-nav-shell { border-bottom: 1px solid #d3c4a6; background: #f6f2e9f5; }
.report-mode-nav { gap: 7px; padding: 5px; border: 1px solid #c5b08a; border-radius: 2px; background: #fffdf6; box-shadow: 0 2px 0 #e8dfcd; }
.report-mode-nav a { border-radius: 0; }
.report-mode-nav a strong { font-family: var(--heritage-display); font-size: 25px; font-weight: 500; }
.report-mode-nav a[aria-current="page"] { border-color: #8b9d7c; background: linear-gradient(135deg, #eff1e5, #e8ecdd); box-shadow: inset 3px 0 #5a775b; }
.report-mode-nav a[aria-current="page"]:after { content: ""; position: absolute; bottom: 6px; right: 7px; width: 4px; height: 4px; background: var(--heritage-red); transform: rotate(45deg); }
.report-mode-nav a { position: relative; }

/* 首部题签：主标题用楷意，正文维持清晰的现有字体。 */
.intro, .report-hero, .flow-hero, .season-intro { position: relative; }
.intro h1, .report-hero h1, .flow-hero h1, .season-intro h1 {
  font-family: var(--heritage-display);
  font-weight: 500;
  letter-spacing: .08em;
}
.intro .eyebrow, .report-hero .eyebrow, .flow-hero .eyebrow, .season-intro .eyebrow {
  display: inline-block;
  padding: 3px 11px 3px 0;
  border-bottom: 1px solid #c6b38e;
  font-family: var(--heritage-serif);
  letter-spacing: .14em;
}
.report-hero { border-bottom: 3px double #c9b58e; }
.hero-ornament img, .intro-ornament { opacity: .72; }
.hero-ornament>span { font-family: var(--heritage-display); }
.seal, .season-seal {
  color: var(--heritage-red);
  border-color: var(--heritage-red);
  outline: 1px solid #9b47373b;
  outline-offset: 3px;
  background: #9b473707;
  font-family: var(--heritage-display);
  border-radius: 1px;
  transform: rotate(-4deg);
}

/* 同一套书页边框：双线、回纹角和细书脊，不遮盖内容。 */
.birth-form, .report-section, .season-frame {
  border: 1px solid #bda47a;
  border-radius: 2px;
  background-color: var(--heritage-card);
  background-image: linear-gradient(90deg, #ddd0b33b 0, #e9e1ce38 7px, transparent 7px), var(--heritage-grain);
  box-shadow: inset 0 0 0 4px #fffcf5, inset 0 0 0 5px #d7c7a45e, 4px 4px 0 #e3d8bf4a, 0 8px 24px #64533608;
}
.birth-form::before, .birth-form::after, .report-section::before, .report-section::after,
.season-frame::before, .season-frame::after {
  width: 37px;
  height: 37px;
  background: var(--heritage-corner) no-repeat center / contain;
  border: 0;
  opacity: .75;
  z-index: 0;
}
.birth-form::before, .report-section::before, .season-frame::before { top: 7px; left: 7px; }
.birth-form::after, .report-section::after, .season-frame::after { bottom: 7px; right: 7px; transform: rotate(180deg); }
.birth-form>* , .report-section>*, .season-frame>* { position: relative; z-index: 1; }
.form-title { font: 19px/1.6 var(--heritage-display); letter-spacing: .18em; }
.form-title span { width: 42px; background: #b79a64; }
.field>label { font-family: var(--heritage-serif); font-size: 13px; letter-spacing: .08em; }
.field>label span { font-family: -apple-system, "PingFang SC", sans-serif; letter-spacing: 0; }
.birth-form input:not([type="checkbox"]), .birth-form select { border-radius: 2px; border-color: #c9bea5; background-color: #fffef9; }
.time-panel { border-radius: 2px; background: #f5f2e7; border-color: #dcd3bd; }
.gender-buttons button { border-radius: 2px; }
.gender-buttons button[aria-pressed="true"] { box-shadow: inset 0 -2px #73916e; }
.gender-buttons #female[aria-pressed="true"] { box-shadow: inset 0 -2px #b87975; }
.submit-button { border-radius: 2px; background: linear-gradient(120deg, #466951, #365745); border: 1px solid #365745; box-shadow: inset 0 0 0 3px #7f967b55, 0 4px 0 #e3dac6; font-family: var(--heritage-serif); }
.submit-button:hover { background: #35543f; }
.examples button { font-family: var(--heritage-serif); }
.report-toolbar button { border-radius: 2px; border-color: #c6b693; background: #fffdf6; font-family: var(--heritage-serif); }

/* 章回标题与排盘：朱砂序章、青绿墨字、古铜横线。 */
.section-heading { gap: 12px; }
.section-num {
  color: #fffdf5;
  background: var(--heritage-red);
  border: 1px solid #9b4737;
  outline: 1px solid #9b47374a;
  outline-offset: 2px;
  width: 24px;
  height: 29px;
  font: 16px/1 var(--heritage-display);
  transform: rotate(-2deg);
}
.section-heading h2 { font-family: var(--heritage-display); font-size: 25px; font-weight: 500; letter-spacing: .08em; }
.heading-rule { height: 3px; background: linear-gradient(180deg, #c8b38d 0 1px, transparent 1px 3px); position: relative; }
.heading-rule:after { content: ""; position: absolute; right: 0; top: -2px; width: 6px; height: 6px; background: #c8b38d; transform: rotate(45deg); }
.birth-subtitle { font-family: var(--heritage-serif); font-size: 19px; color: #7a5930; }
.bazi-block { border-bottom: 3px double #d8c7a5; }
.birth-layout .pillar-row { border: 1px solid #bea982; border-radius: 1px; background: #f6f0e2; box-shadow: inset 0 0 0 3px #fffaf1; }
.birth-layout .pillar+.pillar { border-left-color: #cebb98; }
.birth-layout .pillar small { font-family: var(--heritage-serif); letter-spacing: .12em; }
.birth-layout .pillar span { font-family: var(--heritage-display); font-size: 29px; }
.birth-layout .chart-panel { border-color: #c4b08d; border-radius: 1px; background: #dacbb0; }
.birth-layout .chart-panel .metric, .birth-layout .chart-cycle .metric { background: #fbf7ee; }
.birth-layout .chart-panel .metric:hover { background: #eef1e5; }
.birth-layout .metric-label, .birth-layout .metric-core { font-family: var(--heritage-serif); }
.birth-layout .metric-year-state { border-radius: 1px; background: rgba(var(--element-rgb), .08); }
.birth-layout .metric-source-mark { color: #7c795f; }
.element-frontispiece { border-bottom: 3px double #cdbb98; }
.frontispiece-label { font-family: var(--heritage-display); font-size: 17px; letter-spacing: .18em; }
.frontispiece-label>span { width: 38px; }
.element-medallion .medallion-name { font-family: var(--heritage-display); font-size: 23px; }
.classical { border-left: 3px solid #a98850; border-radius: 0; background: #f4efdf; box-shadow: inset 0 1px #e5d9bf, inset 0 -1px #e5d9bf; }
.classical small { font-family: var(--heritage-serif); letter-spacing: .12em; }
.relations { gap: 11px; }
.relation { background: #f8f3e8; border-color: #d6c5a4; border-radius: 1px; }
.relation h3 { font-family: var(--heritage-display); font-size: 19px; color: #825f33; }
.body-fact { background: #eff2e6; border: 1px solid #ccd3bd; border-radius: 1px; box-shadow: inset 3px 0 #a1b0974a; }
.body-fact strong { font-family: var(--heritage-serif); }
.body-reading h3, .symptom-block h3, .five-bias-reading h3 { font-family: var(--heritage-display); font-size: 20px; letter-spacing: .1em; }
.symptom-tags { gap: 8px; }
.symptom-tags span { border-radius: 1px; background: #f0f2e6; border-color: #bac8aa; padding: 6px 12px; box-shadow: inset 0 -2px #dce5d3; }
.report-summary { background: #f6f0e2; border-left-color: #a98850; border-radius: 0; }
.five-bias-reading { border-top: 3px double #d6c5a4; }
.source-details { border-radius: 1px; border-color: #d3c3a2; background: #f5f1e6; }
.source-details summary { font-family: var(--heritage-serif); }
.division-credit { border-top: 3px double #c7b38d; padding-top: 23px; }
.division-credit strong { font-family: var(--heritage-display); font-size: 27px; letter-spacing: .12em; }
.division-credit small { letter-spacing: .08em; }

/* 流年题笺与节令历，继续使用同一装帧语言。 */
.flow-hero { border-bottom: 3px double #c9b58e; }
.natal-stamp { border-color: #a37e48; outline-color: #cab58e; font-family: var(--heritage-display); background: #f4ecdb; }
.natal-foot span { border-bottom-style: double; border-bottom-width: 3px; }
.annual-metric, .period-pair>div { border-color: #cfbd9a; border-radius: 1px; background: #fbf6eb; box-shadow: inset 0 0 0 3px #fffcf5; }
.annual-metric>small, .period-pair small { font-family: var(--heritage-serif); }
.annual-metric strong, .period-pair strong { font-family: var(--heritage-display); }
.annual-state { border-radius: 1px; }
.annual-summary { border-left: 3px solid #7b9069; background: #f0f2e6; }
.current-period { font-family: var(--heritage-display); }
.qi-rail li { border-top-color: #bdad8c; background: #f4f0e5; }
.qi-rail li>span { font-family: var(--heritage-serif); }
.qi-rail .is-current { background: #e8eddf; border-top-color: #58764e; box-shadow: inset 0 -1px #aaba92; }
.personal-reading { background: #f0f2e6; border: 1px solid #bfcbad; border-left: 3px solid #738a61; }
.focus-seal { border-radius: 1px; color: var(--heritage-red); border-color: #b07862; font-family: var(--heritage-display); background: #9b473705; transform: rotate(-3deg); }
.focus-line strong { font-family: var(--heritage-display); font-size: 25px; }
.season-query { border-bottom: 3px double #d0bd98; }
.query-heading>span { font-family: var(--heritage-display); font-size: 20px; letter-spacing: .12em; }
.query-heading button, .term-navigation button { border-color: #c7b28a; border-radius: 1px; font-family: var(--heritage-serif); background: #fffdf5; }
.season-query input, .season-jumps select { border-color: #cbbd9f; border-radius: 1px; background: #fffef8; }
.season-query>label, .season-jumps label { font-family: var(--heritage-serif); }
.term-medallion { color: #825f33; border-color: #b99b66; outline-color: #c9b48b; background: #f7f0df; box-shadow: inset 0 0 0 6px #fffdf5, inset 0 0 0 7px #cdb98e, 0 0 0 11px #e5d9ba17; }
.term-medallion span { font-family: var(--heritage-display); font-size: 38px; }
.term-caption { border-left: 3px double #cbb58d; padding-left: 16px; }
.term-caption h2 { font-family: var(--heritage-display); font-size: 31px; }
.season-image { font-family: var(--heritage-serif); border-left: 3px solid #b1915c; background: linear-gradient(90deg, #f4eddb8c, transparent); padding-top: 8px; padding-bottom: 8px; }
.season-reading h3, .season-food h3, .season-daily h3 { font-family: var(--heritage-display); font-size: 20px; }
.season-reading h2 { font-family: var(--heritage-display); }
.food-direction-chip { border-radius: 1px; background: #f8f5e9; box-shadow: inset 0 0 0 3px #fffdf5; }
.open-food-search { border-radius: 1px; border-color: #c4cba8; background: #eff1e4; }
.season-metric { background: #f8f3e7; }
.season-footer { border-top: 3px double #c7b38d; }
.season-footer strong { font-family: var(--heritage-display); font-size: 29px; }

/* 典籍与食材弹窗像一页展开的书册，关闭和搜索仍保持原交互。 */
.source-dialog, .food-dialog { border: 1px solid #ac8c55; border-radius: 2px; background: var(--heritage-card); box-shadow: 0 24px 80px #3e493d30, inset 0 0 0 4px #e8dcc159; }
.source-dialog-head, .food-dialog-header { background: #f4ecd9; border-bottom: 3px double #c7b38d; }
.source-dialog-head h2, .food-dialog-header h2 { font-family: var(--heritage-display); font-size: 26px; }
.source-dialog-head button, .food-dialog-header>button { border-radius: 1px; border-color: #bca77e; }
.source-block { background: #f9f5e9; border-color: #d6c4a1; border-radius: 1px; }
.source-block h3, .source-group-title { font-family: var(--heritage-display); }
.source-block blockquote { padding-left: 0; line-height: 2.1; }
.source-block a { text-underline-offset: 4px; }
.food-category-tabs button { border-radius: 1px; font-family: var(--heritage-serif); }
.food-category-tabs button[aria-selected="true"] { background: #eaf0df; border-color: #93a67f; box-shadow: inset 0 -2px #728d5e; }
.food-search-row input, .food-search-row button, .food-nature-filter button { border-radius: 1px; }
.food-entry { border-radius: 1px; background: #f9f5e9; border-color: #d9c9a8; box-shadow: inset 0 0 0 3px #fffcf5; }
.food-entry strong { font-family: var(--heritage-display); }
.food-detail h3 { font-family: var(--heritage-display); }

@media (min-width: 1100px) {
  body:not([data-portal-view]) .report-screen { max-width: 1040px; }
  .report-section { padding: 32px 35px; }
  .intro h1, .report-hero h1, .flow-hero h1 { font-size: 37px; }
}
@media (max-width: 600px) {
  .report-mode-nav a strong { font-size: 24px; }
  .intro h1, .report-hero h1, .flow-hero h1 { font-size: 28px; }
  .season-intro h1 { font-size: 32px; }
  .birth-form::before, .birth-form::after, .report-section::before, .report-section::after,
  .season-frame::before, .season-frame::after { width: 27px; height: 27px; }
  .section-heading h2 { font-size: 23px; }
  .section-num { width: 21px; height: 25px; font-size: 14px; }
  .birth-layout .pillar span { font-size: 25px; }
  .form-title { font-size: 18px; }
  .relation h3 { font-size: 18px; }
  .term-medallion span { font-size: 32px; }
  .term-caption h2 { font-size: 28px; }
  .season-reading h3, .season-food h3, .season-daily h3 { font-size: 19px; }
}
@media (max-width: 360px) {
  .intro h1, .report-hero h1, .flow-hero h1 { font-size: 25px; }
  .section-heading h2 { font-size: 21px; }
  .section-heading { gap: 10px; }
  .report-mode-nav a strong { font-size: 22px; }
  .birth-layout .pillar span { font-size: 23px; }
  .brand-copy strong { letter-spacing: .02em; }
  .term-caption h2 { font-size: 26px; }
}
@media print {
  body, body[data-view="report"], body.flow-preview, body.season-page { background: #fff; }
  .birth-form, .report-section, .season-frame { box-shadow: none; background: #fff; }
  .birth-form::before, .birth-form::after, .report-section::before, .report-section::after { display: none; }
  .section-num { background: transparent; color: #654b2d; outline: none; }
}

/* 带茶色衬底的小字保持清晰；朱砂状态签只调整呈现色。 */
.birth-layout .metric-annual[data-element="火"] .metric-year-state { color: #9b4737; }
.classical small, .source-dialog-head small, .food-dialog-header small { color: #806031; }
