:root {
  color-scheme: light;
  --line: #c0c0b8;
  --ink: #1a1a1a;
  --muted: #555550;
  --paper: #f7f4ee;
  --accent: #2b579a;
  --card: #ffffff;
  --soft: #dfdeff;
  --danger: #9d1c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.top { position: sticky; top: 0; z-index: 2; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px 12px 20px; }
.year-strip { width: 100%; }
.timeline-line { position: relative; height: 10px; margin: 16px 8px 14px; background: var(--line); touch-action: none; user-select: none; }
.timeline-ticks { position: absolute; inset: 0; pointer-events: none; }
.timeline-tick { position: absolute; top: 12px; height: auto; background: transparent; color: var(--muted); font-size: 11px; line-height: 1; white-space: nowrap; transform: translateX(-50%); }
.timeline-edge { position: absolute; top: 12px; color: var(--muted); font-size: 11px; line-height: 1; white-space: nowrap; pointer-events: none; }
.timeline-edge.start { left: 0; }
.timeline-edge.end { right: 0; }
.timeline-mark { position: absolute; top: 2px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--accent); }
.timeline-selector { position: absolute; z-index: 1; top: -11px; height: 32px; min-width: 52px; background: var(--paper); border: 1px solid var(--ink); }
.timeline-body { position: absolute; inset: 0 8px; cursor: grab; }
.timeline-handle { position: absolute; top: -4px; bottom: -4px; width: 8px; cursor: ew-resize; }
.timeline-handle.left { left: 0; }
.timeline-handle.right { right: 0; }
.timeline-caption { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--ink); font-size: 10px; line-height: 1; text-align: center; white-space: nowrap; pointer-events: none; }
html.timeline-dragging, html.timeline-dragging * { cursor: grabbing; user-select: none; }
html.timeline-resizing, html.timeline-resizing * { cursor: ew-resize; user-select: none; }
.chip { border: 1px solid var(--line); background: #fff; color: inherit; border-radius: 999px; padding: 4px 10px; }
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 52px); }
.filters { border-right: 1px solid var(--line); padding: 12px; }
.search-row { display: flex; gap: 6px; margin-bottom: 12px; }
#search { flex: 1; min-width: 0; border: 1px solid var(--line); background: #fff; padding: 8px; }
#reset-filters { border: 1px solid var(--line); background: #fff; padding: 8px; white-space: nowrap; }
.filters h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 6px; }
.filters .tag-row { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.filters .tag-row.dim { color: #b0aea6; }
.tri { width: 18px; height: 18px; flex: 0 0 18px; padding: 0; border: 1px solid var(--ink); background: #fff; color: var(--ink); line-height: 16px; text-align: center; }
.tri-off { color: var(--danger); }
.tri.dim { border-color: #b0aea6; color: #b0aea6; }
main { padding: 20px; }
.feed { max-width: 920px; }
.material { background: var(--card); border: 1px solid var(--line); padding: 16px; margin-bottom: 16px; }
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 { line-height: 1.25; margin: 1em 0 .4em; }
.content h1 { font-size: 1.6em; }
.content h2 { font-size: 1.3em; }
.content h3 { font-size: 1.1em; }
.content p, .content ul, .content ol, .content pre, .content table, .content blockquote { margin: 0 0 .8em; }
.content ul, .content ol { padding-left: 1.2em; }
.content blockquote { padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.content pre { overflow: auto; background: var(--paper); padding: 8px; }
.content code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.content table { border-collapse: collapse; width: 100%; }
.content th, .content td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.content th { background: var(--paper); }
.content img, .content .diagram svg { max-width: 100%; height: auto; }
.content .diagram { margin: 0 0 .8em; overflow-x: auto; }
.content .diagram-error { color: var(--danger); }
.material .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sources { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; color: var(--muted); }
.sources a, .content a { color: var(--accent); }
.hidden { display: none !important; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-page .card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); padding: 16px; }
.auth-page label { display: block; margin: 8px 0; }
.auth-page input { width: 100%; border: 1px solid var(--line); padding: 8px; }
.error { color: var(--danger); min-height: 1.2em; }
