/* D-061: reading controls belong to the right rail or the mobile bottom bar. */
.guide-b .guide-reader-nav[hidden], .guide-reader-nav [hidden] { display: none; }
.guide-b .guide-reader-nav {
  position: sticky;
  top: 12px;
  align-self: start;
  z-index: 6;
  min-width: 0;
  color: var(--ink);
  font-size: 1.125rem;
  line-height: 1.55;
}
.guide-reader-current { margin: 0 0 8px; }
.guide-reader-current span { font-weight: 700; }
.guide-reader-current [data-current-short] { display: none; }
.guide-reader-menu { background: var(--white); border: 1px solid var(--line); }
.guide-reader-menu > summary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 12px; cursor: pointer; list-style: none;
  color: var(--white); background: var(--blue); font-weight: 700;
}
.guide-reader-menu > summary::-webkit-details-marker { display: none; }
.guide-reader-menu:not([open]) .guide-reader-close, .guide-reader-menu[open] .guide-reader-open { display: none; }
.guide-reader-menu[open] > summary .arrow { transform: rotate(180deg); }
.guide-reader-panel { max-height: var(--reader-panel-space, calc(100svh - 220px)); overflow-y: auto; overscroll-behavior: contain; background: var(--white); }
.guide-b .guide-reader-title { margin: 0; padding: 12px 16px; color: var(--white); background: var(--blue); font-weight: 700; }
.guide-reader-list { list-style: none; padding: 8px 12px; }
.guide-reader-list > li + li { border-top: 1px solid var(--line); }
.guide-reader-list a { display: flex; align-items: baseline; gap: 10px; padding: 10px 4px; min-height: 44px; text-decoration: none; }
.guide-reader-list a:hover { text-decoration: underline; }
.guide-reader-list a[aria-current="location"] { background: var(--soft); color: var(--blue); font-weight: 700; border-left: 3px solid var(--blue); padding-left: 8px; }
.guide-reader-list ul { list-style: none; padding-left: 2.25em; }
.guide-reader-list ul a { text-decoration: underline; }
.guide-b .guide-reader-top {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--blue); color: var(--blue); background: var(--soft);
  font-weight: 700; text-decoration: none;
}
.guide-reader-menu > summary:hover, .guide-b .guide-reader-top:hover { color: var(--white); background: var(--ink); }
.guide-reader-top span { text-wrap: balance; }
.guide-reading-return { display: block; width: 100%; min-height: 44px; margin-top: 8px; padding: 10px; border: 1px solid var(--blue); background: var(--white); color: var(--blue); font: inherit; text-align: left; cursor: pointer; }
.guide-reading-return:hover { background: var(--soft); }
.guide-reading-return span { white-space: nowrap; }
.guide-b .question-number { color: var(--blue); font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
.guide-b .section-head .question-number { display: block; margin-bottom: 8px; font-size: 1.25rem; }
.guide-b #estimate .section-head .question-number { color: inherit; }
.guide-b .jump-grid .question-number { margin-right: 10px; }
.guide-b .chapter-next { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.guide-b .chapter-next a { display: inline-flex; align-items: center; gap: 16px; min-height: 48px; }
body.guide-b-page:has(dialog[open]) .guide-reader-nav { visibility: hidden; }
body.guide-b-page:has(.guide-reader-nav[data-active="true"]) .page-tools { display: none; }
@media (min-width: 1200px) {
  .guide-b:has(.guide-reader-nav:not([hidden])) .article-wrap { max-width: none; }
  .guide-reading-layout:has(.guide-reader-nav:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: start; }
  .guide-reader-nav { grid-column: 2; grid-row: 1; }
  .guide-chapters { grid-column: 1; grid-row: 1; min-width: 0; }
  .guide-reader-current, .guide-reader-menu > summary { display: none; }
}
@media (max-width: 1199px) {
  .guide-reader-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .guide-b .guide-reader-nav {
    position: fixed; inset: auto 0 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    border-top: 2px solid var(--blue); background: var(--white);
    container-type: inline-size;
  }
  .guide-reader-nav[data-active="false"] { visibility: hidden; pointer-events: none; }
  .guide-reader-menu { border: 0; }
  .guide-reader-menu > summary { height: 100%; padding-inline: 8px; gap: 6px; }
  .guide-b .guide-reader-top { margin-top: 0; padding-inline: 8px; gap: 6px; }
  .guide-reader-panel { position: absolute; bottom: calc(100% + 2px); inset-inline: 16px; border: 1px solid var(--line); }
  .guide-reading-return { padding: 6px 10px; }
}
@container (max-width: 14em) {
  .guide-reader-actions { grid-template-columns: 1fr; }
  .guide-reader-actions .arrow, .guide-reader-current [data-current-chapter] { display: none; }
  .guide-reader-current [data-current-short] { display: inline; }
}
@media print {
  .guide-b .guide-reader-nav { display: none; position: static; }
  .guide-reading-layout:has(.guide-reader-nav:not([hidden])) { display: block; }
  .guide-b .chapter-next { display: none; }
}
