:root {
  color-scheme: dark;
  --bg: #080f16;
  --panel: #101b24;
  --panel-raised: #162530;
  --line: #273a45;
  --text: #edf3f4;
  --muted: #a2b3be;
  --faint: #7e939f;
  --accent: #8ce8c1;
  --error: #ffb4a9;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sidebar {
  min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #38505c transparent;
  padding: 18px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #101b24, #0b151d);
}
.sidebar-header { position: relative; margin-bottom: 24px; }
.brand { display: block; color: var(--text); text-decoration: none; text-align: center; }
.brand img { display: block; width: 200px; max-width: 100%; height: auto; margin: 0 auto; }
.brand h1, .brand-caption { display: block; font-size: 14px; font-weight: 500; letter-spacing: .3px; margin: 4px 0 0; }
.site-nav { display: flex; gap: 8px; margin: 16px 0 24px; }
.site-nav a {
  flex: 1; display: grid; place-items: center; min-height: 40px;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font-size: 12px; text-decoration: none;
}
.site-nav a:hover, .site-nav a[aria-current] { color: var(--accent); background: var(--panel-raised); }
.sidebar-counter { display: flex; justify-content: center; margin-top: 12px; }
.sidebar-counter a { display: inline-flex; align-items: center; min-height: 44px; }
.sidebar-counter img { display: block; border: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; top: 8px; left: 8px; transform: translateY(-150%); padding: 10px 14px; background: var(--panel); border: 1px solid var(--accent); }
.skip-link:focus { transform: none; }
html[data-night="true"] {
  --bg: #000; --panel: #000; --panel-raised: #180000; --line: #600000;
  --text: #f00000; --muted: #d00000; --faint: #b00000; --accent: #ff0000; --error: #ff0000;
}
html[data-night="true"] .sidebar { background: var(--bg); }
html[data-night="true"] .brand img, html[data-night="true"] .sidebar-counter img,
html[data-night="true"] .article-photo img, html[data-night="true"] .catalog-item img,
html[data-night="true"] .reader-mobile-brand img { filter: url(#night-red); }
@media (min-width: 1600px) { .sidebar { padding: 22px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
