:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #f0f0f0;
  --surface-strong: #e6e6e6;
  --text: #181818;
  --secondary: #686868;
  --muted: #767676;
  --border: #e3e3e3;
  --accent: #202020;
  --accent-text: #fff;
  --danger: var(--text);
  --focus: #808080;
  --code-bg: #f1f1f1;
  --selection: #dedede;
  --gray: var(--secondary);
  --glass: rgb(250 250 250 / 88%);
  --shadow: 0 16px 64px rgb(0 0 0 / 9%);
  --rail-width: 240px;
  --reading-width: 740px;
  --reader-size: 17px;
  --reader-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: 320ms cubic-bezier(.22, 1, .36, 1);
  --header-height: calc(76px + env(safe-area-inset-top));
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171717;
  --surface: #222;
  --surface-strong: #303030;
  --text: #ededed;
  --secondary: #a5a5a5;
  --muted: #969696;
  --border: #303030;
  --accent: #ededed;
  --accent-text: #171717;
  --focus: #aaa;
  --code-bg: #202020;
  --selection: #414141;
  --glass: rgb(23 23 23 / 88%);
  --shadow: 0 16px 64px rgb(0 0 0 / 24%);
}
html[data-reading-size="small"] { --reader-size: 16px; }
html[data-reading-size="large"] { --reader-size: 20px; }
html[data-reading-font="serif"] { --reader-font: "Iowan Old Style", "Palatino Linotype", Georgia, serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; scrollbar-gutter: stable; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); -webkit-text-size-adjust: 100%; }
body { min-width: 320px; min-height: 100dvh; margin: 0; background: var(--bg); transition: background-color var(--ease), color var(--ease); }
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, h4, h5, h6, strong, b { font-weight: 600; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button { border: 0; background: transparent; }
a, button, input { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, a, input { transition: background-color var(--ease), color var(--ease), border-color var(--ease), opacity var(--ease), transform var(--ease); }
button:disabled { cursor: default; opacity: .45; }
form[aria-busy="true"] button[type="submit"] { opacity: .5; cursor: progress; }
button:active:not(:disabled) { transform: scale(.96); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
::selection { background: var(--selection); }
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: ease-out; }
.skip-link { position: fixed; z-index: 300; top: 12px; left: 12px; padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.muted { color: var(--secondary); }
.primary-button, .text-button, .icon-button, .add-button, .theme-toggle, .sidebar-toggle, .back-link, .reader-preferences { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; }
.primary-button { width: 100%; padding: 11px 20px; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600; }
.primary-button.small { width: auto; }
.text-button { padding: 8px 0; color: var(--secondary); font-size: 14px; text-align: left; }
.text-button:hover { color: var(--text); }
.icon-button { width: 44px; flex-shrink: 0; padding: 0; border-radius: 50%; color: var(--secondary); font-size: 24px; font-weight: 300; }
.add-button { width: 44px; padding: 0; border: 1px solid var(--border); border-radius: 50%; font-size: 26px; font-weight: 300; }
.icon-button:hover, .add-button:hover { background: var(--surface); color: var(--text); }
input:not([type="checkbox"]):not([type="file"]), select { width: 100%; min-height: 46px; min-width: 0; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: 16px; }
input::placeholder { color: var(--muted); }
input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type="file"] { width: 100%; max-width: 100%; min-width: 0; color: var(--secondary); font-size: 14px; }
input[type="file"]::file-selector-button { min-height: 44px; margin-right: 10px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); }
.stack-form, .login-form { display: grid; gap: 20px; }
.stack-form label, .login-form label { display: grid; min-width: 0; gap: 7px; }
.stack-form label > span, .login-form label > span { color: var(--secondary); font-size: 14px; }
.stack-form small { font-size: inherit; }
.check-row { display: flex !important; min-height: 44px; align-items: center; gap: 8px !important; font-size: 14px; }
.notice, .form-error, .inline-error { padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 250; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: calc(100% - 40px); padding: 12px 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 14px; transform: translateX(-50%); }
.section-nav { position: fixed; z-index: 80; inset: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; min-height: var(--header-height); padding: calc(12px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left)); align-items: center; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.section-nav-start, .section-nav-end { display: flex; align-items: center; min-width: 0; }
.section-nav-end { justify-content: flex-end; }
.section-switcher { display: flex; padding: 4px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); gap: 2px; }
.section-switcher a { display: inline-flex; min-height: 36px; align-items: center; padding: 0 18px; border-radius: 20px; color: var(--secondary); font-size: 14px; }
.section-switcher a[aria-current="page"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 4px rgb(0 0 0 / 5%); }
.theme-toggle, .sidebar-toggle, .back-link { width: 44px; padding: 0; border-radius: 50%; }
.theme-toggle:hover, .sidebar-toggle:hover, .back-link:hover { background: var(--surface); }
.control-dot { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--text); opacity: .75; transition: transform var(--ease), opacity var(--ease); }
.theme-dot { width: 14px; height: 14px; border: 1px solid var(--text); background: linear-gradient(90deg, var(--text) 50%, transparent 50%); }
html[data-theme="dark"] .theme-dot { transform: rotate(180deg); }
.sidebar-toggle[aria-expanded="false"] .control-dot { opacity: .45; }
.back-chevron { width: 8px; height: 8px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.brand-link { display: grid; width: 44px; min-height: 44px; place-items: center; font-size: 24px; font-weight: 600; letter-spacing: -.06em; }
.home-page { display: flex; flex-direction: column; }
.home-header, .home-footer { display: flex; width: min(100% - 48px, 680px); margin: 0 auto; align-items: center; justify-content: space-between; }
.home-header { padding-top: calc(32px + env(safe-area-inset-top)); }
.wordmark { font-size: 22px; letter-spacing: -.06em; font-weight: 600; }
.home-directions { display: grid; width: min(100% - 48px, 680px); margin: auto; padding: 70px 0; }
.home-direction { display: grid; min-height: 128px; grid-template-columns: 44px 1fr 32px; align-items: center; border-bottom: 1px solid var(--border); font-size: clamp(30px, 5vw, 46px); letter-spacing: -.045em; line-height: 1.2; }
.home-index { align-self: center; color: var(--muted); font-size: 12px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.home-arrow { color: var(--muted); font-size: 26px; transition: transform var(--ease), color var(--ease); }
.home-direction:hover .home-arrow { transform: translate(4px, -4px); color: var(--text); }
.home-direction:hover { padding-left: 8px; }
.home-footer { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
.login-page { display: grid; place-items: center; padding: 60px 24px; }
.login-shell { width: min(100%, 340px); }
.login-form h1 { margin: 0 0 28px; font-size: 38px; letter-spacing: -.065em; }
.login-theme { position: fixed; top: calc(20px + env(safe-area-inset-top)); right: 20px; }
.articles-layout { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 100dvh; }
.article-filters, .notes-list { position: fixed; z-index: 60; top: var(--header-height); bottom: 0; left: 0; display: flex; flex-direction: column; width: var(--rail-width); padding: 30px 18px 84px; border-right: 1px solid var(--border); background: var(--bg); transition: transform var(--ease), opacity var(--ease), visibility var(--ease); }
.sidebar-brand { width: fit-content; padding: 0 12px 26px; color: var(--secondary); font-size: 19px; font-weight: 600; letter-spacing: -.06em; }
.filter-nav { display: grid; gap: 4px; }
.filter-nav a { display: flex; min-height: 44px; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 10px; color: var(--secondary); font-size: 14px; gap: 12px; }
.filter-nav a[aria-current="page"], .filter-nav a:hover { background: var(--surface); color: var(--text); }
.filter-nav small { font-size: 12px; font-variant-numeric: tabular-nums; }
.manage-link { position: fixed; z-index: 82; bottom: calc(16px + env(safe-area-inset-bottom)); left: 24px; display: inline-flex; min-height: 44px; align-items: center; gap: 12px; padding: 0 12px; border: 1px solid var(--border); border-radius: 24px; background: var(--glass); color: var(--secondary); font-size: 13px; }
.manage-link .control-dot { width: 5px; height: 5px; }
.articles-main { grid-column: 2; width: min(100% - 88px, 820px); min-width: 0; margin: 0 auto; padding: var(--header-height) 0 90px; }
.articles-toolbar { display: flex; min-height: 102px; align-items: center; gap: 14px; border-bottom: 1px solid var(--border); }
.articles-toolbar h1 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.article-count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.article-preview { position: relative; padding: 28px 0; border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--header-height) + 20px); }
.article-preview h2 { margin: 9px 0; font-size: 21px; font-weight: 550; letter-spacing: -.025em; line-height: 1.4; overflow-wrap: anywhere; }
.article-preview h2 a::after { position: absolute; inset: 0; content: ""; }
.article-preview:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--muted); text-underline-offset: 4px; }
.article-preview p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--secondary); font-size: 16px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.article-preview:not(.is-unread) h2 { color: var(--secondary); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--secondary); font-size: 13px; }
.unread-dot { width: 5px; height: 5px; margin-right: 2px; border-radius: 50%; background: var(--text); }
.pagination { display: flex; min-height: 100px; align-items: center; justify-content: space-between; gap: 8px; color: var(--secondary); font-size: 14px; }
.pagination-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.pagination-pages a, .pagination-arrow, .pagination-ellipsis { display: inline-flex; min-width: 40px; min-height: 44px; align-items: center; justify-content: center; padding: 0 6px; border-radius: 10px; }
.pagination-pages a[aria-current="page"] { background: var(--surface); color: var(--text); }
.pagination-arrow { flex: 0 0 40px; }
.pagination-placeholder { visibility: hidden; }
.empty-state { display: flex; min-height: 48dvh; align-items: flex-start; justify-content: center; flex-direction: column; color: var(--secondary); }
.empty-state h2 { margin: 0 0 6px; color: var(--text); font-size: 23px; font-weight: 500; letter-spacing: -.03em; }
.empty-state p { max-width: 360px; margin: 6px 0; font-size: 16px; }
.sheet-dialog { width: min(100% - 40px, 460px); max-height: calc(100dvh - 40px); padding: 26px; overflow-y: auto; border: 1px solid var(--border); border-radius: 24px; background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.sheet-dialog[open] { animation: sheet-in var(--ease); }
.sheet-dialog::backdrop { background: rgb(0 0 0 / 32%); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-heading h2 { margin: 0; font-size: 22px; font-weight: 550; letter-spacing: -.035em; }
.drawer-mobile-heading, .drawer-backdrop { display: none; }
.reader-shell { width: min(100% - 64px, 900px); margin: 0 auto; padding-top: var(--header-height); }
.reader-article { width: min(100%, var(--reading-width)); margin: 30px auto 120px; }
.reader-heading { margin-bottom: 40px; }
.reader-heading h1 { margin: 16px 0 20px; font-size: clamp(30px, 4vw, 42px); font-weight: 600; letter-spacing: -.045em; line-height: 1.18; overflow-wrap: anywhere; }
.reader-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.original-link { margin-top: 44px; color: var(--secondary); font-size: 14px; }
.original-link a { text-decoration: underline; text-underline-offset: 4px; }
.content-body, .markdown-body { color: var(--text); font-family: var(--reader-font); font-size: var(--reader-size); line-height: 1.8; overflow-wrap: anywhere; }
.markdown-body { width: min(100%, var(--reading-width)); min-width: 0; margin: 24px auto 110px; }
.content-body > :first-child, .markdown-body > :first-child { margin-top: 0; }
.content-body :is(h1,h2,h3,h4,h5,h6), .markdown-body :is(h1,h2,h3,h4,h5,h6) { margin: 2em 0 .75em; font-weight: 600; letter-spacing: -.025em; line-height: 1.3; scroll-margin-top: calc(var(--header-height) + 24px); }
.content-body h1, .markdown-body h1 { font-size: 2em; }
.content-body h2, .markdown-body h2 { font-size: 1.5em; }
.content-body h3, .markdown-body h3 { font-size: 1.2em; }
.content-body h4, .markdown-body h4 { font-size: 1.05em; }
.markdown-body > h1:first-child { margin-bottom: 1em; font-size: clamp(30px, 4vw, 42px); letter-spacing: -.04em; }
.content-body :is(p,ul,ol,blockquote,table,pre), .markdown-body :is(p,ul,ol,blockquote,table,pre) { margin: 1.2em 0; }
.content-body :is(ul,ol), .markdown-body :is(ul,ol) { padding-left: 1.5em; }
.content-body li + li, .markdown-body li + li { margin-top: .35em; }
.content-body a, .markdown-body a { text-decoration: underline; text-decoration-color: var(--muted); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.content-body img, .markdown-body img { display: block; max-width: 100%; height: auto; margin: 1.6em auto; border-radius: 8px; }
.content-body blockquote, .markdown-body blockquote { padding: .1em 0 .1em 1.2em; border-left: 2px solid var(--border); color: var(--secondary); }
.content-body .callout, .markdown-body .callout { padding: .8em 1em; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.content-body code, .markdown-body code { padding: .15em .35em; border-radius: 4px; background: var(--code-bg); font: .86em/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.content-body pre, .markdown-body pre { max-width: 100%; padding: 20px; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--code-bg); line-height: 1.6; }
.content-body pre code, .markdown-body pre code { padding: 0; background: transparent; }
.code-actions { display: flex; justify-content: flex-end; margin-top: -12px; }
.copy-button { min-height: 36px; padding: 4px 8px; border-radius: 8px; color: var(--secondary); font: 12px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.copy-button:hover { background: var(--surface); color: var(--text); }
.content-body table, .markdown-body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .88em; line-height: 1.5; }
.content-body :is(th,td), .markdown-body :is(th,td) { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; hyphens: none; }
.content-body th, .markdown-body th { font-weight: 600; background: var(--surface); }
.content-body :is(th,td code), .markdown-body :is(th,td code) { white-space: nowrap; }
.source-label { display: inline-block; padding: .1em .4em; border-radius: 4px; font-size: .8em; font-weight: 600; white-space: nowrap; }
.source-cell, .source-label { background: var(--surface); color: var(--text); }
.source-proposal { border-left: 2px dashed var(--muted); }
.source-missing { color: var(--secondary); }
.source-technical, .source-mixed { border-left: 2px solid var(--muted); }
.content-body hr, .markdown-body hr { margin: 2.5em 0; border: 0; border-top: 1px solid var(--border); }
.task-list-item { list-style: none; }
.task-list-item input { margin: 0 .55em 0 -1.45em; vertical-align: -3px; }
.highlight :is(.c,.cm,.c1,.cs) { color: var(--secondary); font-style: italic; }
.highlight :is(.k,.kc,.kd,.kn,.kp,.kr) { color: var(--text); font-weight: 600; }
.highlight :is(.s,.s1,.s2,.sa,.sb,.o,.ow) { color: var(--secondary); }
.settings-shell { width: min(100% - 64px, 880px); margin: 0 auto; padding: var(--header-height) 0 calc(48px + env(safe-area-inset-bottom)); }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 42px 0 26px; }
.settings-heading h1 { margin: 0; font-size: 32px; font-weight: 550; letter-spacing: -.04em; }
.settings-section { padding: 24px 0; border-top: 1px solid var(--border); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading > span { color: var(--secondary); font-size: 14px; }
.import-tools > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; color: var(--secondary); font-size: 14px; list-style: none; }
.import-tools > summary::after { content: "+"; font-size: 20px; }
.import-tools[open] > summary::after { content: "−"; }
.import-tools .stack-form { margin: 16px 0; }
.feed-list-toolbar, .bulk-feed-actions { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 16px; }
.alphabet-sort { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--secondary); }
.alphabet-sort a { display: grid; min-width: 44px; min-height: 44px; place-items: center; }
.alphabet-sort a[aria-current="page"] { color: var(--text); text-decoration: underline; text-underline-offset: 5px; }
.feed-bulk-row { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 12px; border-top: 1px solid var(--border); }
.feed-select-cell { display: flex; min-height: 78px; align-items: flex-start; padding-top: 27px; }
.feed-details { min-width: 0; }
.feed-details > summary { display: grid; min-height: 78px; grid-template-columns: minmax(0,1fr) auto 16px; align-items: center; gap: 12px; list-style: none; }
.feed-details > summary::after { content: "+"; color: var(--muted); font-size: 20px; }
.feed-details[open] > summary::after { content: "−"; }
summary::-webkit-details-marker { display: none; }
.feed-summary-copy { display: grid; gap: 4px; min-width: 0; }
.feed-summary-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 500; }
.feed-summary-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--secondary); }
.feed-state { color: var(--secondary); font-size: 12px; }
.feed-state.has-error { color: var(--text); text-decoration: underline dotted; text-underline-offset: 4px; }
.feed-bulk-fields { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); gap: 14px; padding: 8px 0 22px; }
.feed-bulk-fields label { display: grid; min-width: 0; gap: 6px; }
.feed-bulk-fields label > span { font-size: 14px; color: var(--secondary); }
.feed-bulk-meta, .feed-bulk-fields .inline-error { grid-column: 1/-1; }
.feed-bulk-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; color: var(--secondary); font-size: 13px; }
.bulk-feed-actions { position: sticky; z-index: 20; bottom: 0; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.notes-layout, .books-layout { display: grid; min-height: 100dvh; grid-template-columns: var(--rail-width) minmax(0,1fr) 56px; }
.note-main, .book-main { grid-column: 2; min-width: 0; padding: var(--header-height) 44px 0; }
body.sidebar-collapsed :is(.articles-layout,.notes-layout,.books-layout) { grid-template-columns: 0 minmax(0,1fr); }
body.sidebar-collapsed :is(.article-filters,.notes-list) { transform: translateX(-100%); opacity: 0; visibility: hidden; }
.notes-groups, .books-list-items { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 0 24px; scrollbar-width: thin; }
.sidebar-search { display: block; margin: 0 6px 18px; }
.sidebar-search input[type="search"] { min-height: 42px; padding: 10px 12px; background: var(--surface); border-color: transparent; font-size: 14px; }
.notes-group + .notes-group { margin-top: 24px; }
.notes-group h2 { margin: 0 12px 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.notes-group a, .book-list-item { display: block; padding: 12px; border-radius: 10px; color: var(--secondary); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.notes-group a[aria-current="page"], .book-list-item[aria-current="page"], .notes-group a:hover, .book-list-item:hover { background: var(--surface); color: var(--text); }
.book-list-item { display: grid; gap: 5px; }
.book-list-item small { color: var(--muted); font-size: 12px; }
.notes-empty, .books-empty { max-width: var(--reading-width); margin: 0 auto; }
.reading-tools { display: flex; width: min(100%, var(--reading-width)); min-height: 50px; align-items: center; justify-content: flex-end; gap: 14px; margin: 10px auto 0; color: var(--secondary); }
.reader-preferences { width: 44px; padding: 0; border-radius: 12px; font-size: 17px; letter-spacing: -.06em; }
.reader-preferences:hover { background: var(--surface); color: var(--text); }
.reading-progress { font-size: 12px; font-variant-numeric: tabular-nums; }
.preference-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 14px; }
.segmented-control { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface); }
.segmented-control button { min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 9px; font-size: 14px; }
.segmented-control button[aria-pressed="true"] { background: var(--bg); box-shadow: 0 1px 4px rgb(0 0 0 / 6%); }
button[data-reading-size="small"] { font-size: 14px; }
button[data-reading-size="medium"] { font-size: 18px; }
button[data-reading-size="large"] { font-size: 22px; }
.book-heading { margin-bottom: 2.4em; }
.book-heading > p { margin: 0 0 14px; color: var(--secondary); font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.book-heading > h1 { margin: 0; font-size: clamp(30px, 4vw, 40px); font-weight: 550; letter-spacing: -.035em; }
.book-content > :first-child { margin-top: 0; }
.book-space { height: 1em; }
.book-poem { margin: 1.6em 0; padding-left: 1.2em; }
.book-stanza + .book-stanza { margin-top: 1em; }
.book-text-author { color: var(--secondary); text-align: right; }
.book-note-ref { font-size: .82em; vertical-align: super; }
.book-pager { display: grid; grid-template-columns: 1fr auto 1fr; min-height: 100px; align-items: center; gap: 12px; margin-top: 48px; border-top: 1px solid var(--border); color: var(--secondary); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.book-pager a { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; }
.book-pager a:last-child { justify-self: end; }
.notes-contents { position: fixed; z-index: 70; top: 50%; right: 8px; display: flex; width: 44px; max-height: 68dvh; align-items: center; justify-content: flex-end; transform: translateY(-50%); }
.toc-rail { position: relative; z-index: 2; display: flex; width: 44px; height: 180px; max-height: 50dvh; align-items: center; padding: 12px; }
.toc-label { display: none; }
.toc-rail-track { position: relative; display: block; width: 20px; height: 100%; border-right: 1px solid var(--border); }
.toc-progress-indicator { position: absolute; top: calc(var(--toc-progress, 0) * 100%); right: -1px; width: 14px; height: 2px; border-radius: 2px; background: var(--text); transition: top 100ms linear; }
.toc-panel { position: absolute; top: 50%; right: 44px; width: min(320px, calc(100vw - 80px)); max-height: min(70dvh, 660px); padding: 12px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: 18px; background: var(--bg); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(8px,-50%); visibility: hidden; scrollbar-width: thin; transition: opacity var(--ease), transform var(--ease), visibility var(--ease); }
.notes-contents.is-pinned .toc-panel { opacity: 1; pointer-events: auto; transform: translate(0,-50%); visibility: visible; }
@media (hover: hover) { .notes-contents:not(.is-dismissed):hover .toc-panel { opacity: 1; pointer-events: auto; transform: translate(0,-50%); visibility: visible; } }
.toc-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; color: var(--secondary); font-size: 13px; }
.toc-level { margin: 0; padding: 0; list-style: none; }
.toc-level .toc-level { margin: 2px 0 10px 10px; padding-left: 8px; border-left: 1px solid var(--border); }
.toc-level-0 > .toc-item + .toc-item { margin-top: 8px; }
.toc a { display: block; padding: 9px 10px; border-radius: 8px; color: var(--secondary); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.toc-level-0 > .toc-item > .toc-link { color: var(--text); font-weight: 500; }
.toc a:hover, .toc a.is-active { background: var(--surface); color: var(--text); }
.toc a.is-active { box-shadow: inset 2px 0 0 var(--text); }
.book-toc-depth-1 { padding-left: 18px !important; }
.book-toc-depth-2 { padding-left: 26px !important; }
.book-toc-depth-3 { padding-left: 34px !important; }
@media (min-width: 1440px) { :root { --rail-width: 260px; } .notes-layout, .books-layout { grid-template-columns: var(--rail-width) minmax(0,1fr) 120px; } }
@media (max-width: 1100px) and (min-width: 901px) { :root { --rail-width: 210px; } .note-main, .book-main { padding-right: 28px; padding-left: 28px; } }
@media (max-width: 900px) {
  :root { --header-height: calc(72px + env(safe-area-inset-top)); }
  body.drawer-open { overflow: hidden; }
  .articles-layout, .notes-layout, .books-layout { display: block; }
  .articles-main { width: min(100% - 48px, 740px); }
  .note-main, .book-main { padding-right: 24px; padding-left: 24px; }
  .drawer { z-index: 110; top: 0; width: min(88vw, 340px); padding: calc(16px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom)); transform: translateX(-102%); visibility: hidden; }
  .drawer.is-open { transform: none; visibility: visible; }
  .drawer-mobile-heading { display: flex; min-height: 52px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
  .drawer .sidebar-brand { display: none; }
  .drawer-backdrop { position: fixed; z-index: 100; inset: 0; display: block; background: rgb(0 0 0 / 32%); }
  .sidebar-search input[type="search"] { font-size: 16px; }
  .notes-contents { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); right: max(18px, env(safe-area-inset-right)); width: auto; max-height: none; transform: none; }
  .toc-rail { width: auto; height: 44px; max-height: none; padding: 0 16px; border: 1px solid var(--border); border-radius: 24px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: 13px; color: var(--secondary); }
  .toc-label { display: inline; }
  .toc-rail-track { display: none; }
  .notes-contents .toc-panel { position: absolute; top: auto; bottom: 54px; right: 0; width: min(350px, calc(100vw - 36px)); max-height: 62dvh; transform: translateY(10px); }
  .notes-contents:not(.is-pinned) .toc-panel { opacity: 0; pointer-events: none; visibility: hidden; transform: translateY(10px); }
  .notes-contents.is-pinned .toc-panel { opacity: 1; pointer-events: auto; visibility: visible; transform: none; }
  .manage-link { left: 18px; }
}
@media (max-width: 640px) {
  .section-nav { padding-right: max(10px, env(safe-area-inset-right)); padding-left: max(10px, env(safe-area-inset-left)); grid-template-columns: 44px minmax(0,1fr) 44px; gap: 4px; }
  .section-switcher { justify-self: center; min-width: 0; padding: 3px; }
  .section-switcher a { min-height: 38px; padding: 0 12px; font-size: 13px; }
  .articles-main, .reader-shell, .settings-shell { width: calc(100% - 40px); }
  .articles-toolbar { min-height: 86px; }
  .articles-toolbar h1 { font-size: 23px; }
  .article-preview { padding: 24px 0; }
  .article-preview h2 { font-size: 19px; }
  .article-preview p { font-size: 16px; }
  .pagination-pages a, .pagination-ellipsis { min-width: 30px; padding: 0 4px; }
  .pagination-arrow { min-width: 32px; flex-basis: 32px; }
  .reader-article { margin-top: 24px; }
  .reader-heading { margin-bottom: 30px; }
  .reader-heading h1 { font-size: 30px; }
  .note-main, .book-main { padding-right: max(20px, env(safe-area-inset-right)); padding-left: max(20px, env(safe-area-inset-left)); }
  .markdown-body { margin-top: 20px; }
  .content-body pre, .markdown-body pre { padding: 16px; }
  .settings-heading { margin: 30px 0 24px; }
  .settings-heading h1 { font-size: 28px; }
  .feed-bulk-fields { grid-template-columns: 1fr; }
  .feed-list-toolbar { gap: 8px; }
  .alphabet-sort { gap: 2px; }
  .alphabet-sort > span { display: none; }
  .bulk-feed-actions { gap: 12px; }
  .bulk-feed-actions .primary-button { padding: 11px 14px; }
  .bulk-feed-actions .text-button { font-size: 13px; }
  .sheet-dialog { width: 100%; max-width: none; max-height: 85dvh; margin: auto 0 0; padding: 22px 24px calc(26px + env(safe-area-inset-bottom)); border: 0; border-radius: 24px 24px 0 0; }
  .book-pager { gap: 10px; font-size: 13px; }
  .home-header { padding-top: calc(24px + env(safe-area-inset-top)); }
  .home-directions { padding: 40px 0; }
  .home-direction { min-height: 110px; grid-template-columns: 36px 1fr 26px; }
}
@media (max-width: 374px) { .section-switcher a { padding: 0 8px; } .section-nav { padding-right: 4px; padding-left: 4px; } .pagination { gap: 2px; } .pagination-pages { gap: 0; } .pagination-pages a, .pagination-ellipsis { min-width: 26px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }
