:root {
  color-scheme: light;
  --background: #f6f6f3;
  --surface: #ffffff;
  --surface-raised: #fbfbf9;
  --foreground: #242422;
  --secondary: #565651;
  --tertiary: #696963;
  --border: #dfdfd9;
  --border-strong: #cecec6;
  --hover: #ecece7;
  --selected: #e5ebf5;
  --accent: #28599f;
  --accent-strong: #1f4d8e;
  --accent-soft: #e8eef8;
  --ring: #28599f;
  --positive: #24864a;
  --shadow: 0 16px 44px rgba(28, 32, 40, .16);
  --topbar: calc(56px + env(safe-area-inset-top, 0px));
  --notebooks: 214px;
  --notes: 336px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --background: #181817;
  --surface: #20201f;
  --surface-raised: #252523;
  --foreground: #f0f0ec;
  --secondary: #c3c3bc;
  --tertiary: #aaa9a2;
  --border: #393936;
  --border-strong: #4b4b46;
  --hover: #2d2d2a;
  --selected: #2d394c;
  --accent: #9ab9ea;
  --accent-strong: #b5cdf1;
  --accent-soft: #28364c;
  --ring: #9ab9ea;
  --positive: #63c989;
  --shadow: 0 18px 48px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  background: var(--background);
  color: var(--foreground);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: rgba(40, 89, 159, .12); }
a { color: inherit; }
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
[hidden] { display: none !important; }
.drawer-only, .single-pane-only { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: calc(var(--topbar) + 8px);
  left: 10px;
  z-index: 100;
  width: 1px;
  height: 1px;
  padding: 9px 13px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  clip-path: inset(50%);
  opacity: 0;
  white-space: nowrap;
  text-decoration: none;
}
.skip-link:focus-visible {
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  opacity: 1;
}

.topbar {
  position: relative;
  z-index: 40;
  height: var(--topbar);
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  backdrop-filter: blur(14px);
}
.topbar-start, .topbar-actions, .brand, .sync-label { display: flex; align-items: center; }
.topbar-start, .topbar-actions { gap: 6px; }
.brand {
  min-height: 44px;
  gap: 9px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 690;
  letter-spacing: -.01em;
}
.brand-mark {
  width: 29px;
  height: 29px;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .2);
}
.sync-label { gap: 7px; color: var(--secondary); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }
.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--secondary);
  background: transparent;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 100ms ease;
}
.icon-button:hover { color: var(--foreground); background: var(--hover); }
.icon-button:active { transform: scale(.96); background: var(--selected); }
.moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }
.reader-control { transition: background-color 150ms ease, color 150ms ease, transform 100ms ease, opacity 150ms ease; }
body:not(.note-open) .reader-control { visibility: hidden; opacity: 0; pointer-events: none; }
.font-size-symbol { font-family: Georgia, "Times New Roman", serif; font-size: 16px; font-weight: 700; letter-spacing: -.08em; }

.notebook-layout {
  height: calc(100dvh - var(--topbar));
  display: grid;
  grid-template-columns: var(--notebooks) var(--notes) minmax(0, 1fr);
}
.notebooks-pane, .notes-pane, .reader { min-width: 0; min-height: 0; }
.notebooks-pane {
  padding: 12px 9px max(10px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--background);
}
.pane-heading {
  min-height: 38px;
  padding: 3px 9px 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: .05em;
}
.notebook-nav { display: grid; gap: 2px; overflow-y: auto; }
.notebook-link {
  width: 100%;
  min-height: 44px;
  padding: 9px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  color: var(--secondary);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 100ms ease;
}
.notebook-link:hover { color: var(--foreground); background: var(--hover); }
.notebook-link:active { transform: scale(.985); }
.notebook-link.active { color: var(--foreground); background: var(--selected); font-weight: 680; }
.notebook-link svg { width: 18px; height: 18px; }
.notebook-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notebook-link small { color: var(--tertiary); font-size: 12px; font-variant-numeric: tabular-nums; }
.notebooks-footer {
  margin-top: auto;
  padding: 14px 9px 4px;
  border-top: 1px solid var(--border);
  color: var(--tertiary);
  font-size: 12px;
}
.notebooks-footer p { margin: 0 0 3px; }
.notebooks-footer a { min-height: 32px; display: inline-flex; align-items: center; color: var(--secondary); text-decoration: none; }
.notebooks-footer a:hover { color: var(--accent); }

.notes-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface-raised);
}
.notes-toolbar { flex: 0 0 auto; padding: 13px; border-bottom: 1px solid var(--border); }
.compact-search {
  min-height: 42px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.compact-search:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 15%, transparent); }
.compact-search svg { flex: 0 0 auto; width: 17px; height: 17px; color: var(--secondary); }
.compact-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--foreground); background: transparent; font-size: 14px; }
.compact-search input::placeholder { color: var(--tertiary); opacity: 1; }
kbd {
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--secondary);
  background: var(--background);
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
}
.list-heading { min-height: 38px; padding: 13px 2px 0; display: flex; align-items: end; gap: 10px; }
.list-heading h1 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; line-height: 1.3; letter-spacing: -.025em; }
.list-heading > span:not(.visually-hidden) { margin-left: auto; flex: 0 0 auto; color: var(--tertiary); font-size: 12px; }
.notes-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.note-row {
  width: 100%;
  min-height: 108px;
  padding: 14px 15px;
  display: block;
  border-bottom: 1px solid var(--border);
  color: inherit;
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}
.note-row:hover { background: var(--hover); }
.note-row:active { background: var(--selected); }
.note-row.active { background: var(--selected); box-shadow: inset 3px 0 0 var(--accent); }
.note-row-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--tertiary); font-size: 11px; }
.note-row-meta > span:first-child { color: var(--accent); font-weight: 700; }
.note-row-status { display: inline-flex; align-items: center; gap: 6px; }
.pinned-label { color: var(--secondary); }
.pinned-label::before { content: "•"; margin-right: 5px; color: var(--accent); }
.note-row h2 { margin: 7px 0 4px; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 14px; line-height: 1.42; letter-spacing: -.012em; }
.note-row p { margin: 0; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--secondary); font-size: 12px; line-height: 1.5; }
.note-row mark { padding: 0 1px; border-radius: 2px; color: var(--foreground); background: #ffe08a; }
[data-theme="dark"] .note-row mark { color: #191816; background: #e4bd59; }
.note-row p.search-snippet { color: var(--foreground); }
.empty-state, .reader-error, .reader-loading, .offline-card, .load-error { text-align: center; }
.empty-state, .load-error { margin: auto; padding: 28px 22px max(28px, env(safe-area-inset-bottom, 0px)); justify-items: center; color: var(--secondary); }
.empty-state:not([hidden]), .load-error:not([hidden]) { display: grid; }
.empty-state svg { width: 28px; height: 28px; color: var(--tertiary); }
.empty-state strong, .load-error strong { color: var(--foreground); font-size: 15px; }
.empty-state p, .load-error p { margin: -3px 0 2px; font-size: 12px; }
.empty-state button, .primary-button, .secondary-button {
  min-height: 44px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  color: var(--accent);
  background: transparent;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { color: #fff; background: #28599f; }
.primary-button:hover { background: #1f4d8e; }
.secondary-button { border: 1px solid var(--border-strong); color: var(--foreground); background: var(--surface); }

.reader { position: relative; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); scroll-padding-top: 24px; }
.reading-progress { position: sticky; z-index: 30; top: 0; height: 3px; overflow: hidden; background: transparent; pointer-events: none; opacity: 0; }
.reading-progress.active { opacity: 1; }
.reading-progress span { width: 100%; height: 100%; display: block; background: var(--accent); transform: scaleX(0); transform-origin: left center; transition: transform 80ms linear; }
.reader-empty { height: calc(100% - 3px); display: grid; align-content: center; justify-items: center; gap: 10px; color: var(--tertiary); }
.reader-empty svg { width: 32px; height: 32px; }
.reader-empty p { margin: 0; font-size: 12px; }
.reader-loading { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 11px; color: var(--secondary); font-size: 13px; }
.loading-spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#article-view { width: min(calc(100% - 56px), 1040px); margin: 0 auto; padding: 42px 0 max(88px, calc(60px + env(safe-area-inset-bottom, 0px))); }
#article-view:focus { outline: none; }
.article-main { width: min(100%, 720px); margin: 0 auto; }
.article-header { padding-bottom: 25px; border-bottom: 1px solid var(--border); }
.article-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.category-tag, .evergreen-label { font-size: 12px; font-weight: 720; text-decoration: none; }
.category-tag { min-height: 30px; display: inline-flex; align-items: center; color: var(--accent); }
.category-tag:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.evergreen-label { padding: 2px 7px; border-radius: 99px; color: var(--secondary); background: var(--hover); font-size: 10px; }
.article-header h1 { max-width: 20ch; margin: 10px 0 12px; font-size: clamp(28px, 3vw, 39px); line-height: 1.23; letter-spacing: -.038em; text-wrap: balance; }
.article-summary { max-width: 62ch; margin: 0 0 16px; color: var(--secondary); font-size: 15px; line-height: 1.7; }
.article-toolbar { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.article-meta { margin: 0; display: flex; align-items: center; gap: 7px; color: var(--tertiary); font-size: 12px; font-variant-numeric: tabular-nums; }
.share-button, .back-to-top {
  min-height: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  color: var(--secondary);
  background: transparent;
  cursor: pointer;
}
.share-button svg, .back-to-top svg { width: 17px; height: 17px; }
.share-button:hover, .back-to-top:hover { color: var(--foreground); background: var(--hover); }
.share-button:active, .back-to-top:active { background: var(--selected); }
.tag-list { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { min-height: 30px; padding: 3px 8px; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 7px; color: var(--secondary); background: var(--surface-raised); font-size: 11px; text-decoration: none; }
.tag::before { content: "#"; margin-right: 2px; color: var(--tertiary); }
.tag:hover { border-color: var(--border-strong); color: var(--foreground); }
.article-body { padding-top: 25px; color: var(--foreground); font-size: 16px; line-height: 1.84; }
.article-body .lead { margin-top: 0; color: var(--secondary); font-size: 17px; line-height: 1.78; }
.article-body h2, .article-body h3 { position: relative; scroll-margin-top: 24px; }
.article-body h2 { margin: 42px 0 12px; font-size: 22px; line-height: 1.4; letter-spacing: -.025em; }
.article-body h3 { margin: 28px 0 9px; font-size: 17px; line-height: 1.5; letter-spacing: -.012em; }
.heading-link { margin-left: 8px; color: var(--tertiary); opacity: 0; font-size: .8em; font-weight: 500; text-decoration: none; transition: opacity 130ms ease, color 130ms ease; }
.article-body h2:hover .heading-link, .article-body h3:hover .heading-link, .heading-link:focus-visible { opacity: 1; color: var(--accent); }
.article-body p, .article-body ul, .article-body ol { max-width: 68ch; }
.article-body p { margin-block: 1em; }
.article-body ul, .article-body ol { padding-left: 1.45em; }
.article-body li { margin: 6px 0; padding-left: .16em; }
.article-body strong { font-weight: 720; }
.article-body a:not(.heading-link) { color: var(--accent); text-underline-offset: 3px; }
.article-body blockquote { margin: 25px 0; padding: 15px 17px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; color: var(--secondary); background: var(--accent-soft); }
.article-body blockquote p { margin: 4px 0; }
.article-body blockquote strong { color: var(--foreground); }
[data-reader-size="large"] .article-body { font-size: 18px; line-height: 1.82; }
[data-reader-size="large"] .article-body .lead { font-size: 19px; }
[data-reader-size="xlarge"] .article-body { font-size: 20px; line-height: 1.78; }
[data-reader-size="xlarge"] .article-body .lead { font-size: 21px; }
.compact-outline { margin: 22px 0 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-raised); }
.compact-outline summary { min-height: 46px; padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--foreground); font-weight: 680; cursor: pointer; list-style: none; }
.compact-outline summary::-webkit-details-marker { display: none; }
.compact-outline summary::after { content: "+"; margin-left: auto; color: var(--tertiary); font-size: 18px; font-weight: 400; }
.compact-outline[open] summary::after { content: "−"; }
.compact-outline summary span { color: var(--tertiary); font-size: 11px; font-weight: 500; }
.compact-outline nav { padding: 0 13px 12px; border-top: 1px solid var(--border); }
.compact-outline ol, .desktop-outline ol { margin: 9px 0 0; padding: 0; list-style: none; }
.compact-outline li { margin: 1px 0; }
.compact-outline a { min-height: 36px; padding: 6px 3px; display: flex; align-items: center; color: var(--secondary); font-size: 12px; line-height: 1.45; text-decoration: none; }
.compact-outline .outline-level-3 { padding-left: 15px; }
.compact-outline a:hover, .compact-outline a[aria-current="location"] { color: var(--accent); }
.desktop-outline { display: none; position: sticky; top: 25px; max-height: calc(100dvh - var(--topbar) - 50px); overflow-y: auto; align-self: start; }
.outline-title { margin: 0 0 10px; color: var(--tertiary); font-size: 11px; font-weight: 720; letter-spacing: .05em; }
.desktop-outline li { margin: 2px 0; }
.desktop-outline .outline-level-3 { padding-left: 13px; }
.desktop-outline a { padding: 5px 0 5px 10px; display: block; border-left: 2px solid var(--border); color: var(--tertiary); font-size: 11px; line-height: 1.45; text-decoration: none; transition: color 130ms ease, border-color 130ms ease; }
.desktop-outline a:hover, .desktop-outline a[aria-current="location"] { border-left-color: var(--accent); color: var(--foreground); }
.article-pagination { margin-top: 48px; padding-top: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--border); }
.pagination-link { min-height: 76px; padding: 12px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--border); border-radius: 9px; text-decoration: none; }
.pagination-link.next { text-align: right; }
.pagination-link:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.pagination-link span { color: var(--tertiary); font-size: 11px; }
.pagination-link strong { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.back-to-top { margin: 22px auto 0; display: flex; }
.floating-top {
  position: fixed;
  z-index: 45;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  width: 48px;
  height: 48px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--foreground);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  cursor: pointer;
}
.floating-top:active { transform: scale(.95); }
.floating-top svg { width: 19px; height: 19px; }
.back-link { min-height: 44px; align-items: center; gap: 5px; margin: -4px 0 13px; border-radius: 7px; color: var(--secondary); font-weight: 620; text-decoration: none; }
.back-link svg { width: 18px; height: 18px; }
.reader-error { min-height: 60vh; display: grid; place-content: center; justify-items: center; gap: 7px; color: var(--secondary); }
.reader-error strong { color: var(--foreground); font-size: 18px; }
.reader-error p { margin: 0 0 8px; }
.notebooks-scrim { display: none; border: 0; }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(22px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  max-width: min(calc(100vw - 32px), 420px);
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--foreground);
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 13px;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.noscript-banner { position: fixed; z-index: 90; right: 12px; bottom: 12px; margin: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--secondary); background: var(--surface); box-shadow: var(--shadow); font-size: 12px; }

.offline-page { min-height: 100dvh; overflow: auto; display: grid; place-items: center; padding: 24px; }
.offline-card { width: min(100%, 440px); padding: 38px 28px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 14px 44px rgba(28, 32, 40, .1); }
.offline-card img { border-radius: 13px; box-shadow: 0 5px 18px rgba(15, 23, 42, .18); }
.offline-card .eyebrow { margin: 15px 0 4px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.offline-card h1 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.offline-card > p:not(.eyebrow) { margin: 10px auto 20px; color: var(--secondary); }

@media (min-width: 1580px) {
  .article-layout { display: grid; grid-template-columns: minmax(0, 720px) 190px; justify-content: space-between; gap: 54px; }
  .article-main { margin: 0; }
  .desktop-outline { display: block; }
  .compact-outline { display: none; }
}

@media (max-width: 1179px) {
  :root { --notes: 318px; }
  .drawer-only { display: grid !important; }
  .notebook-layout { grid-template-columns: var(--notes) minmax(0, 1fr); }
  .notebooks-pane {
    position: fixed;
    z-index: 60;
    inset: var(--topbar) auto 0 0;
    width: min(84vw, 294px);
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-102%);
    box-shadow: var(--shadow);
    transition: transform 190ms ease, visibility 190ms step-end;
  }
  .notebooks-open .notebooks-pane { visibility: visible; pointer-events: auto; transform: translateX(0); transition: transform 190ms ease, visibility 0s; }
  .notebooks-scrim { position: fixed; z-index: 50; inset: var(--topbar) 0 0; background: rgba(12, 16, 24, .38); cursor: default; }
  .notebooks-open .notebooks-scrim { display: block; }
  .notes-pane { grid-column: 1; }
  .reader { grid-column: 2; }
  #article-view { width: min(calc(100% - 42px), 760px); padding-top: 34px; }
}

@media (max-width: 820px), (max-height: 500px) and (max-width: 1024px) {
  .single-pane-only { display: inline-flex !important; }
  body { overflow: hidden; }
  .sync-label { display: none; }
  .notebook-layout { display: block; }
  .notes-pane, .reader { position: absolute; inset: var(--topbar) 0 0; border-right: 0; }
  .notes-pane { display: flex; }
  .reader { display: none; }
  .note-open .notes-pane { display: none; }
  .note-open .reader { display: block; }
  .notes-toolbar { padding: 12px max(14px, env(safe-area-inset-right, 0px)) 12px max(14px, env(safe-area-inset-left, 0px)); }
  .compact-search { min-height: 46px; }
  .compact-search input { font-size: 16px; }
  .compact-search kbd { display: none; }
  .note-row { min-height: 104px; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); }
  .notes-list { padding-bottom: env(safe-area-inset-bottom, 0px); }
  #article-view { width: min(calc(100% - 32px), 700px); padding: 16px 0 max(64px, calc(44px + env(safe-area-inset-bottom, 0px))); }
  .article-header h1 { max-width: none; font-size: 28px; }
  .article-summary { font-size: 14px; }
  .article-body { font-size: 16px; line-height: 1.8; }
  .article-body h2 { margin-top: 36px; font-size: 21px; }
  .tag, .category-tag { min-height: 44px; }
  .share-button { min-height: 44px; }
  .back-to-top { min-height: 44px; }
}

@media (max-width: 460px) {
  .brand span { font-size: 13px; }
  .article-toolbar { align-items: flex-start; }
  .article-meta { padding-top: 9px; flex-wrap: wrap; }
  .article-header h1 { font-size: 27px; }
  .article-pagination { grid-template-columns: 1fr; }
  .pagination-link.next { text-align: left; }
}

@media (max-height: 500px) and (max-width: 1024px) {
  :root { --topbar: calc(50px + env(safe-area-inset-top, 0px)); }
  #article-view { padding-top: 10px; }
  .back-link { margin-bottom: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (forced-colors: active) {
  .status-dot, .reading-progress span { forced-color-adjust: none; }
  .note-row.active { outline: 2px solid Highlight; outline-offset: -2px; }
}
