* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, sans-serif; }
a, button, summary, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--link-color); outline-offset: 3px; }
.skip-link { position: absolute; top: -100px; z-index: 10; padding: 12px; background: var(--page-bg); }
.skip-link:focus { top: 0; }
.reader-header { display: flex; align-items: center; gap: 24px; padding: 8px 24px; border-bottom: 1px solid var(--border-color); font-size: 15px; min-height: 56px; }
.reader-header a { color: var(--text-color); text-decoration: none; padding: 10px 0; }
.reader-brand { font-weight: 700; font-size: 20px; }
.community-link { margin-left: auto; }
.reader-more { position: relative; }
.reader-more summary { cursor: pointer; padding: 10px 4px; }
.more-links { position: absolute; right: 0; top: 100%; min-width: 140px; padding: 8px 16px; background: var(--page-bg); border: 1px solid var(--border-color); border-radius: 8px; z-index: 3; box-shadow: 0 4px 12px #0002; }
.more-links a { display: block; }
.reader-toolbar { display: flex; align-items: center; gap: 20px; padding: 16px 24px; max-width: 1160px; margin: auto; }
#contentsToggle { padding: 12px 16px; font: inherit; background: var(--panel-bg); color: var(--text-color); border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; min-height: 44px; }
.nav-search { position: relative; margin: 0; flex: 1; max-width: 480px; gap: 4px; }
.nav-search-label { font-size: 12px; text-transform: none; letter-spacing: normal; }
.nav-search-input { padding: 10px 12px; font-size: 16px; min-height: 44px; }
.nav-search-results { position: absolute; top: 100%; left: 0; right: 0; max-height: 60vh; overflow-y: auto; padding: 8px; background: var(--page-bg); border: 1px solid var(--border-color); border-radius: 8px; z-index: 2; box-shadow: 0 4px 12px #0002; }
.reader-layout { max-width: 1160px; margin: auto; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
.reading-column { min-width: 0; width: 100%; max-width: 75ch; margin: auto; padding: 8px 24px 48px; }
#selected-node-text { padding: 0; font: 18px/1.65 system-ui, sans-serif; overflow: visible; overflow-wrap: anywhere; }
#selected-node-text h1, #selected-node-text h2, #selected-node-text h3 { line-height: 1.25; margin: 1.4em 0 .65em; }
#selected-node-text h1 { font-size: 30px; }
#selected-node-text h2 { font-size: 25px; }
#selected-node-text :is(h1,h2,h3,h4,h5,h6) a { color: inherit; text-decoration: none; }
#selected-node-text :is(h1,h2,h3,h4,h5,h6) a:hover { text-decoration: underline; }
figure { padding: 12px 0; margin: 20px 0; }
img, svg { max-width: 100%; height: auto; }
.chapter-navigation { border-top: 1px solid var(--border-color); margin-top: 40px; padding-top: 16px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; font-size: 15px; }
.chapter-navigation a { padding: 12px 0; }
#overview-panel { width: auto; min-width: 0; max-width: none; padding: 16px 24px; border: 1px solid var(--border-color); margin: 0 24px 20px; max-height: 60vh; overflow: auto; }
.overview-leaf { text-decoration: none; padding: 8px 0; font-size: 15px; }
.overview-leaf[aria-current=page] { font-weight: 700; color: var(--link-color); }
.overview-branch summary { padding: 10px 0; font-size: 15px; }
@media (min-width: 1100px) {
 .reader-layout.contents-open { grid-template-columns: 240px minmax(0, 1fr); }
 #overview-panel { position: sticky; top: 16px; margin: 8px 0 20px; max-height: calc(100vh - 32px); border: 0; border-right: 1px solid var(--border-color); }
}
@media (max-width: 480px) {
 .reader-header { gap: 14px; padding: 8px 16px; font-size: 14px; }
 .reader-brand { font-size: 18px; }
 .reader-toolbar { padding: 12px 16px; gap: 12px; align-items: flex-end; }
 #contentsToggle { padding: 10px; font-size: 14px; }
 .reading-column { padding: 8px 16px 32px; }
 #overview-panel { margin: 0 16px 16px; padding: 12px; }
}

#selected-node-text > :is(h1,h2,h3,h4,h5,h6):first-child { font-size: 30px; line-height: 1.25; margin-top: 1em; }
