/* Mobile report reading only; the desktop and print layouts keep their original content. */
.reader-top-bar, .reader-mobile-only { display:none; }
.reader-frontmatter, .reader-profile, .reader-introduction { display:contents; }
#report-secondary-tools { display:flex; gap:10px; }

@media screen and (max-width:680px) {
  #report-view {
    --reader-navigation:#0b182b;
    --reader-text:#edf2f8;
    --reader-border:#425369;
    --reader-summary-background:#faf8f5;
    --reader-summary-text:#303a3f;
    --reader-summary-label:#555b5e;
    --reader-summary-accent:#775b25;
    --reader-summary-border:#e3ddd3;
    --reader-body-size:15px;
    --reader-topic-size:17px;
    padding-top:6px;
    padding-bottom:calc(80px + env(safe-area-inset-bottom));
  }
  :root[data-theme="light"] #report-view {
    --reader-navigation:#fff;
    --reader-text:#1c314a;
    --reader-border:#d9dee5;
  }
  body[data-view="report"] > .site-header { display:none; }
  body[data-view="report"].reader-in-content .reader-top-bar {
    display:flex; align-items:center; gap:12px; height:48px; padding:0 12px;
    position:fixed; inset:0 0 auto; z-index:40;
    background:var(--reader-navigation); color:var(--reader-text); border-bottom:1px solid var(--reader-border);
  }
  .reader-top-bar button { flex-shrink:0; min-height:44px; padding:8px 4px; background:none; border:0; color:var(--theme-text-accent,#eed18b); font-size:14px; cursor:pointer; }
  #reader-current-chapter { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:14px; }
  #report-view .report-bottom-bar {
    background:var(--reader-navigation); border-color:var(--reader-border);
    padding:8px 14px max(8px,env(safe-area-inset-bottom)); gap:0 10px;
    backdrop-filter:none;
  }
  #report-view .report-bottom-bar > button { min-height:44px; font-size:14px; }
  #report-view #report-directory { bottom:calc(68px + env(safe-area-inset-bottom)); max-height:min(70dvh,calc(100dvh - 126px - env(safe-area-inset-bottom))); }
  #report-view .report-section { scroll-margin-top:56px; padding:24px 0 4px; }
  #report-view .report-topic-anchor { scroll-margin-top:76px; }

  #report-view .report-toolbar { gap:8px; margin-bottom:6px; }
  #report-view .report-toolbar > div { position:relative; flex-wrap:nowrap; gap:8px; }
  #report-view .report-toolbar button { min-height:44px; }
  #report-view #reader-more { display:block; }
  #report-view #report-secondary-tools { display:none; }
  #report-view #report-secondary-tools.is-open {
    display:grid; position:absolute; right:0; top:calc(100% + 6px); z-index:42;
    min-width:148px; padding:8px; background:var(--reader-navigation); border:1px solid var(--reader-border); border-radius:8px;
  }
  #report-view #report-secondary-tools button { width:100%; margin:0; background:none; color:var(--theme-text-accent,#eed18b); border:0; text-align:left; font-size:14px; }

  #report-view .reader-frontmatter {
    display:block; margin:0 0 16px; padding:16px 16px 6px;
    background:var(--reader-summary-background); color:var(--reader-summary-text);
    border-bottom:1px solid var(--reader-summary-border); border-radius:12px;
  }
  #report-view .report-cover { padding:0 0 6px; border:0; }
  #report-view .report-cover::after { content:""; display:block; width:28px; height:1px; margin-top:12px; background:var(--reader-summary-accent); }
  #report-view .report-cover .eyebrow { display:none; }
  #report-view .report-cover h1 { margin:0; color:var(--reader-summary-text); font-size:22px; line-height:1.5; text-wrap:balance; overflow-wrap:anywhere; }
  #report-view .report-meta { display:none; }
  #report-view .reader-generated-at { display:block; margin:24px 0 0; padding:12px 0 0; border-top:1px solid #ddd1bd; color:#6c6963; font:12px/1.8 var(--sans); }

  #report-view .reader-profile { display:block; margin:0; border:0; background:none; }
  #report-view .reader-profile-toggle { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; min-height:44px; padding:10px 0; border:0; border-radius:0; background:none; text-align:left; cursor:pointer; }
  .reader-profile-toggle > span:first-child { display:flex; align-items:baseline; flex-wrap:wrap; gap:4px 12px; min-width:0; }
  .reader-profile-toggle strong { flex-shrink:0; color:var(--reader-summary-label); font:500 14px/1.5 var(--serif); }
  .reader-profile-toggle > span:first-child > span { min-width:0; color:var(--reader-summary-text); font-size:14px; line-height:1.5; overflow-wrap:anywhere; }
  .reader-profile-action { display:flex; align-items:center; gap:8px; flex-shrink:0; font-size:12px; color:var(--reader-summary-accent); }
  .reader-profile-action::after { content:""; width:6px; height:6px; border-right:1px solid currentColor; border-bottom:1px solid currentColor; transform:translateY(-2px) rotate(45deg); }
  [aria-expanded="true"] > .reader-profile-action::after { transform:translateY(2px) rotate(225deg); }
  #report-view .reader-profile:not(.is-expanded) .customer-profile { display:none; }
  #report-view .reader-profile .customer-profile { margin:0; padding:0 0 12px; border:0; background:none; }
  #report-view .reader-profile .customer-profile > h2 { display:none; }
  #report-view .customer-profile .profile-field { display:grid; grid-template-columns:64px minmax(0,1fr); gap:8px; padding:10px; }
  #report-view .customer-profile .profile-field dd { margin:0; }
  #report-view .customer-profile .profile-field-wide,
  #report-view .customer-profile .customer-profile-report .profile-field { grid-template-columns:minmax(0,1fr); gap:4px; }
  #report-view .customer-profile .profile-yearly-timeline { padding:8px 4px; }
  #report-view .marriage-profile .customer-profile-subject + .customer-profile-subject { margin-top:14px; padding-top:14px; }

  #report-view .reading-guide { margin:20px 0 8px; padding:16px 14px; }
  #report-view .reader-introduction { display:block; margin:0; border:0; border-top:1px solid var(--reader-summary-border); background:none; }
  #report-view .reader-introduction-toggle { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; min-height:44px; padding:10px 0; border:0; border-radius:0; background:none; color:var(--reader-summary-label); font:500 14px/1.5 var(--serif); text-align:left; cursor:pointer; }
  #report-view .reader-introduction:not(.is-expanded) .yearly-report-intro { display:none; }
  #report-view .reader-introduction .yearly-report-intro { margin:0; padding:0 0 12px; border:0; background:none; }
  #report-view .reader-introduction .yearly-report-intro p { color:var(--reader-summary-label); }
  #report-view .reader-introduction .yearly-report-intro > strong { display:none; }
  #report-view .yearly-report-intro p + p { margin-top:12px; }
  #report-view .natal-contents { display:none; }
  #report-view .yearly-background-note { padding:14px; margin-bottom:18px; }
  #report-view .yearly-brief-list { gap:16px; }
  #report-view .yearly-brief-card { grid-template-columns:auto minmax(0,1fr); gap:0 8px; padding:16px 14px; }
  #report-view .yearly-brief-card > .yearly-brief-number { grid-column:1; grid-row:1; padding-top:5px; }
  #report-view .yearly-brief-card > div { display:contents; }
  #report-view .yearly-brief-card > div > * { grid-column:1 / -1; min-width:0; }
  #report-view .yearly-brief-card > div > h3 { grid-column:2; grid-row:1; margin:0 0 16px; font-size:var(--reader-topic-size); text-wrap:balance; }
  #report-view .report-paper-natal .natal-topic > p,
  #report-view .report-paper-yearly .yearly-card-copy p { font-size:var(--reader-body-size); line-height:1.95; }
  #report-view .report-paper-marriage .marriage-person-topic h5,
  #report-view .report-paper-marriage .marriage-person > h5 { font-size:var(--reader-topic-size); }
  #report-view .report-paper-marriage .marriage-person p { font-size:var(--reader-body-size); line-height:1.95; }
  #report-view .report-natal-section { padding-top:16px; }
  #report-view .natal-topic { padding:16px 14px; }
  #report-view .natal-chapter-heading { gap:8px; margin-bottom:14px; padding-bottom:12px; }
  #report-view .natal-chapter-heading h2 { margin:0; color:#26384a; font-family:var(--sans); font-size:18px; font-weight:600; line-height:1.55; text-align:left; }
  #report-view .report-paper-natal :is(.reading-guide,.risk-scale-note,.applicability-note,.health-principle-note,.disclaimer) strong { font-family:var(--sans); font-size:13px; font-weight:600; }
  #report-view .yearly-time-section + .yearly-time-section,
  #report-view .yearly-stage-reference { margin-top:18px; padding-top:18px; }
  #report-view .report-paper-yearly .report-cover h1 { font-size:22px; }
  #report-view .report-paper-yearly .report-section > h2 { font-size:20px; }
  #report-view .report-paper-yearly .yearly-brief-card h3 { font-size:17px; }
  #report-view .report-paper-yearly .yearly-card-copy p { font-size:15px; }
  #report-view .report-paper-yearly .yearly-card-note-investment p { font-size:13.5px; }
  #report-view .report-paper-yearly .yearly-brief-card-health > div > .yearly-time-section:first-child:has(> h3) { display:contents; }
  #report-view .report-paper-yearly .yearly-brief-card-health > div > .yearly-time-section:first-child > h3 { grid-column:2; grid-row:1; margin:0 0 16px; text-wrap:balance; }
  #report-view .report-paper-yearly .yearly-brief-card-health > div > .yearly-time-section:first-child > .risk-attention,
  #report-view .report-paper-yearly .yearly-brief-card-health > div > .yearly-time-section:first-child > .yearly-card-copy { grid-column:1 / -1; }
  /* 已确认的手机本命／流年／合婚阅读布局；桌面和其他报告继续沿用原样。 */
  body[data-view="report"].reader-compact #report-view {
    padding-top:52px;
    padding-bottom:calc(64px + env(safe-area-inset-bottom));
  }
  body[data-view="report"].reader-compact #report-view .report-paper { padding-inline:0; }
  /* 深色手机本命／流年／合婚：暖灰衬底承接浅色纸面，导航继续使用深蓝。 */
  :root:not([data-theme="light"]) body[data-view="report"].reader-compact { background:#e8e5df; }
  :root:not([data-theme="light"]) body[data-view="report"].reader-compact > .cosmos { display:none; }
  :root:not([data-theme="light"]) body[data-view="report"].reader-compact #report-view .report-paper { box-shadow:0 4px 16px rgba(62,53,38,.06); }
  body[data-view="report"].reader-compact #report-view .reader-frontmatter { padding-inline:18px; }
  body[data-view="report"].reader-compact #report-view .report-toolbar { display:none; }
  body[data-view="report"].reader-compact #report-view .reader-top-bar {
    display:flex; align-items:center; gap:12px;
    position:fixed; inset:0 0 auto; z-index:40;
    height:44px; padding:0 12px;
    color:var(--reader-text); background:var(--reader-navigation);
    border-bottom:1px solid var(--reader-border);
  }
  body[data-view="report"].reader-compact #report-view .reader-top-bar button { min-height:44px; padding-block:0; }
  body[data-view="report"].reader-compact #report-view .report-bottom-bar {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:center; gap:0;
    height:calc(48px + env(safe-area-inset-bottom));
    padding:1px 8px calc(2px + env(safe-area-inset-bottom));
  }
  body[data-view="report"].reader-compact #report-view .report-bottom-bar > button {
    display:flex; align-items:center; justify-content:center; gap:4px;
    width:100%; min-width:0; min-height:44px; margin:0; padding:0 5px;
    border:0; border-radius:6px; background:transparent; box-shadow:none;
    color:var(--reader-text); font:400 14px/1.5 var(--sans); white-space:nowrap;
  }
  body[data-view="report"].reader-compact #report-view .report-bottom-bar > button.gold-button {
    color:var(--theme-text-accent,#eed18b); background:transparent; box-shadow:none;
  }
  body[data-view="report"].reader-compact #report-view .report-bottom-bar > button:hover { transform:none; filter:none; }
  body[data-view="report"].reader-compact #report-view .report-bottom-bar > button:focus-visible { outline:2px solid var(--theme-border-accent,#d5bb7e); outline-offset:-3px; }
  body[data-view="report"].reader-compact #report-view #reader-return { display:none; }
  body[data-view="report"].reader-compact #report-view #report-directory {
    bottom:calc(56px + env(safe-area-inset-bottom));
    max-height:min(70dvh,calc(100dvh - 116px - env(safe-area-inset-bottom)));
  }
  body[data-view="report"].reader-compact #report-view :is(.report-section,.report-topic-anchor) { scroll-margin-top:60px; }
  /* 本命开篇采用已确认的独立标题与轻量入口；首章前空白为原32px的一半。 */
  body[data-view="report"].reader-compact #report-view .report-paper-natal .reader-frontmatter {
    margin:0; padding:0; border:0; border-radius:0; background:transparent;
  }
  #report-view .report-paper-natal .report-cover { margin-bottom:8px; padding:8px 18px 0; }
  #report-view .report-paper-natal .report-cover h1 { font-size:24px; font-weight:500; text-align:center; }
  #report-view .report-paper-natal .report-cover::after { display:none; }
  /* 资料与说明组成独立浅底区，圆角底边之后保留16px纸面空白。 */
  #report-view .report-paper-natal .reader-profile,
  #report-view .report-paper-natal .reader-introduction { margin-inline:0; padding-inline:18px; background:var(--reader-summary-background); }
  #report-view .report-paper-natal .reader-profile { border-radius:12px 12px 0 0; }
  #report-view .report-paper-natal .reader-introduction { padding-bottom:6px; border-top:0; border-bottom:1px solid var(--reader-summary-border); border-radius:0 0 12px 12px; }
  #report-view .report-paper-natal .reader-introduction-toggle { border-top:1px solid var(--reader-summary-border); }
  #report-view .report-paper-natal .reader-profile-toggle strong,
  #report-view .report-paper-natal .reader-introduction-toggle { font-weight:400; }
  /* 合婚保留框外居中章标题；仅调整已确认的标题、人物标识与分组留白。 */
  #report-view .report-paper-marriage-compatibility .report-cover h1 { font-size:24px; font-weight:500; text-align:center; }
  #report-view .report-paper-marriage-compatibility .report-cover::after { display:none; }
  #report-view .report-paper-marriage-compatibility .marriage-chapter-heading { margin-bottom:22px; }
  #report-view .report-paper-marriage-compatibility .marriage-chapter-heading h2 { margin:0; font-size:20px; }
  #report-view .report-paper-marriage-compatibility :is(.marriage-panel,.marriage-person,.marriage-joint) { padding:18px 14px; }
  #report-view .report-paper-marriage-compatibility .marriage-person h4 { font-size:16px; font-weight:600; }
  #report-view .report-paper-marriage-compatibility .marriage-person-scope { font-size:13px; }
  #report-view .report-paper-marriage-compatibility .marriage-person > p + h5 { margin-top:24px; padding-top:16px; }
  #report-view .report-paper-marriage-compatibility .marriage-person-topic + .marriage-person-topic { margin-top:24px; padding-top:16px; }
  /* 框外说明对齐卡片正文；收紧文末留白，保留展开按钮的触摸高度。 */
  #report-view .report-paper-marriage-compatibility .marriage-chapter > .marriage-empty-notice { padding-inline:18px 15px; }
  #report-view .report-paper-marriage-compatibility .disclaimer { padding-bottom:8px; }
  #report-view .report-paper-marriage-compatibility .reader-generated-at { margin-top:12px; padding:8px 26px 0; }
  #report-view :is(.reader-introduction-toggle,.reader-profile-toggle,.reader-top-bar button,#reader-more):focus-visible { outline:2px solid #9d824f; outline-offset:3px; }
}

@media print {
  .reader-frontmatter, .reader-profile, .reader-introduction { display:contents; }
  .reader-top-bar, .reader-mobile-only { display:none !important; }
}
