.masthead .subject { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 20px; }
.toc { width: min(410px, calc(100vw - 24px)); right: 12px; padding: 0 0 12px; }
.toc .toc-heading { padding: 20px 20px 12px; font-size: 15px; font-weight: 700; color: var(--muted); }
.toc nav { display: block; padding: 0 10px; }
.toc-chapter { border-top: 1px solid var(--line); }
.toc-chapter summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 10px; font-size: 16px; font-weight: 700; line-height: 1.3; cursor: pointer; list-style: none; }
.toc-chapter summary::-webkit-details-marker { display: none; }
.toc-chapter summary::after { content: '+'; color: var(--blue); font-size: 22px; font-weight: 400; line-height: 1; }
.toc-chapter[open] > summary::after { content: '−'; }
.toc-chapter summary:focus-visible { outline: 3px solid #789cff; outline-offset: -3px; }
.toc-chapter-links { display: flex; flex-direction: column; padding: 0 0 10px; }
.toc .toc-subheading { padding: 13px 12px 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
.toc .toc-chapter-links a { display: block; padding: 8px 12px; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.chapter-back { position: fixed; z-index: 12; right: 24px; bottom: 24px; width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); box-shadow: 0 3px 12px var(--shadow); cursor: pointer; }
.chapter-back[hidden] { display: none !important; }
.chapter-back img { width: 22px; height: 22px; }
:root[data-theme="dark"] .chapter-back img { filter: invert(1); }
@media (max-width: 800px) {
  .masthead .subject { gap: 8px; font-size: 16px; }
  .chapter-back { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .toc { max-height: calc(100svh - 76px); }
}
@media print { .chapter-back, .toc { display: none !important; } }
