:root {
  color-scheme: dark;
  --bg: #0a101c; --panel: #121d2d; --canvas: #0d1726; --soft: #172438;
  --line: #2a3950; --text: #f0f5ff; --muted: #a1b2cb; --quiet: #8196b4;
  --mint: #87e4d1; --blue: #79aaff; --ochre: #ffbd75; --pink: #ff9c9b;
  --theory-fill: #254c86; --experiment-fill: #9a582c; --primary-ink: #102b2b;
  --edge-earlier: #ff7373; --edge-later: #539dff; --edge-unknown: #bec9d8;
  --edge-shared: #80baff; --edge-independent: #d9b34b;
  --edge-opacity: .76; --edge-blocked-opacity: .46; --edge-dimmed-opacity: .14;
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root:not([data-theme="dark"]) {
  color-scheme: light;
  --bg: #f4f5f7; --panel: #ffffff; --canvas: #fafbfc; --soft: #e9edf2;
  --line: #c4cbd4; --text: #20242a; --muted: #46505c; --quiet: #596473;
  --mint: #245e9b; --blue: #3769a1; --ochre: #925211; --pink: #aa2d39;
  --theory-fill: #bfdaff; --experiment-fill: #ffcf98; --primary-ink: #ffffff;
  --edge-shared: #3769a1; --edge-independent: #805c0c;
  --edge-earlier: #b52e3c; --edge-later: #195da1; --edge-unknown: #5d6570;
}
#theme-toggle {
  display: grid; place-items: center; width: 28px; height: 28px; min-height: 0; padding: 0;
  background: transparent; border: 0; color: var(--muted); font: 19px/1 "Segoe UI Symbol", sans-serif;
}
#theme-toggle:hover, #theme-toggle:focus-visible { background: var(--soft); color: var(--text); }
@media (pointer: coarse) { #theme-toggle { width: 40px; height: 40px; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }
button { color: var(--text); cursor: pointer; }
input, select, button:not(.link) { min-height: 36px; background: var(--canvas); border: 1px solid var(--line); border-radius: 7px; color: var(--text); }
input, select { width: 100%; padding: 7px 9px; }
button:not(.link) { padding: 6px 12px; }
button:hover:not(.link) { background: var(--soft); border-color: var(--quiet); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
input::placeholder { color: var(--quiet); }
button[aria-pressed="true"] { color: var(--mint); background: var(--soft); border-color: var(--mint); }
.masthead { display: flex; align-items: center; justify-content: space-between; padding: 17px 24px 13px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; color: var(--mint); background: var(--soft); border: 1px solid var(--line); border-radius: 12px; font-size: 27px; }
h1, h2, p { margin: 0; }
h1 { font-weight: 650; font-size: 21px; letter-spacing: -.025em; }
h2 { font-size: 15px; letter-spacing: -.01em; font-weight: 650; }
.search-block { padding: 0 24px 12px; }
.query-controls { position: relative; display: flex; gap: 4px; align-items: stretch; }
.query-controls input { min-width: 0; }
#query-help summary { display: grid; place-items: center; height: 100%; width: 28px; color: var(--muted); border-radius: 5px; cursor: pointer; list-style: none; }
#query-help summary::-webkit-details-marker { display: none; }
#query-help summary:hover, #query-help[open] summary { background: var(--soft); color: var(--text); }
#query-help summary:focus-visible { outline: 2px solid var(--mint); }
#query-help[open] summary span { transform: rotate(180deg); }
.query-sheet { position: absolute; z-index: 3; right: 0; top: calc(100% + 4px); width: min(350px, calc(100vw - 32px)); padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 15px #0002; }
.query-sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0 0; font-size: 12px; }
.query-sheet dt { color: var(--muted); }
.query-sheet dd { margin: 0; }
#search-form { display: grid; grid-template-columns: minmax(0,1fr) 124px 93px auto; align-items: end; gap: 9px; }
#search-form > div > label, label:not(.check), .field-label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; font-weight: 600; }
button.primary { background: var(--mint); color: var(--primary-ink); border-color: var(--mint); padding-inline: 20px; font-weight: 720; }
button.primary:hover { background: var(--mint); border-color: var(--mint); }
.search-extras { display: flex; gap: 10px; align-items: center; margin-top: 8px; color: var(--quiet); font-size: 11px; }
.link { border: 0; background: transparent; padding: 0 2px; color: var(--mint); font-weight: 600; text-decoration: none; font-size: inherit; }
.link:hover { text-decoration: underline; }
.demo { margin-left: auto; }
.workspace { display: grid; grid-template-columns: 205px minmax(360px,1fr) 220px; gap: 11px; align-items: start; padding: 0 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-width: 0; overflow: hidden; }
.panel-title, .graph-header { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 13px; border-bottom: 1px solid var(--line); }
.panel-title .link { font-size: 12px; }
.filter-actions { display: flex; align-items: center; gap: 14px; }
#filter-toggle, #details-jump, .touch-hint { display: none; }
#filter-fields { padding: 11px 12px 5px; }
.filter-item { margin-bottom: 9px; }
.year-range { display: flex; gap: 5px; align-items: center; color: var(--muted); }
.year-range input { padding-inline: 5px; }
.check { display: flex; gap: 7px; align-items: center; min-height: 28px; font-size: 12px; color: var(--muted); cursor: pointer; }
.check input { min-height: 0; accent-color: var(--mint); width: 15px; height: 15px; }
.check:has(input:disabled) { opacity: .55; cursor: default; }
.filter-note { padding: 6px 12px 12px; color: var(--quiet); font-size: 11px; }
.graph-panel { display: grid; grid-template-rows: auto 1fr auto; min-height: 542px; height: max(542px, calc(100vh - 181px)); }
.graph-header p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.view-controls { display: flex; gap: 8px 12px; flex-wrap: wrap; justify-content: flex-end; }
.layout-buttons, .zoom-buttons { display: flex; gap: 4px; align-items: center; }
.layout-buttons button, .zoom-buttons button { min-height: 29px; font-size: 11px; padding: 4px 8px; }
.canvas-wrap { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(circle, color-mix(in srgb, var(--quiet) 24%, var(--canvas)) 1px, transparent 1px) var(--canvas) 0 0/20px 20px; }
#graph { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; }
#graph:not([data-has-nodes="true"]) { touch-action: pan-y; }
#graph.panning { cursor: grabbing; }
.graph-empty { pointer-events: none; position: absolute; inset: 30px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.graph-empty > span { color: var(--mint); font-size: 34px; margin-bottom: 8px; }
.graph-empty strong { color: var(--text); font-size: 16px; margin-bottom: 4px; }
.grid-status { position: absolute; inset: 8px 8px auto; display: flex; flex-flow: row-reverse wrap; justify-content: space-between; align-items: flex-start; gap: 4px; pointer-events: none; }
.grid-status > span { max-width: 100%; padding: 3px 7px; border-radius: 5px; background: var(--panel); color: var(--muted); font-size: 12px; pointer-events: none; }
.grid-status > span:empty { display: none; }
#trace-stat { margin-right: auto; }
.zoom-buttons { position: absolute; bottom: 10px; right: 10px; border-radius: 8px; padding: 4px; background: var(--panel); border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 13px; color: var(--muted); padding: 8px 12px; border-top: 1px solid var(--line); font-size: 10px; }
.legend .paper-kind { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.legend > span { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.routing-summary { flex: 1 0 100%; height: 14px; line-height: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#routing-note { color: var(--muted); }
.swatch { display: inline-block; }
.bubble { border-radius: 50%; width: 9px; height: 9px; }
.theory { background: var(--blue); }
.experiment { background: var(--ochre); }
.line { width: 13px; height: 2px; }
.line.shared { background: var(--edge-shared); opacity: var(--edge-opacity); }
.line.independent { height: 0; width: 20px; border-top: 2px dashed var(--edge-independent); opacity: var(--edge-opacity); }
.weights { border-top: 1px solid var(--muted); border-bottom: 2px solid var(--muted); height: 6px; }
.details-content { padding: 12px; overflow: auto; max-height: max(494px,calc(100vh - 225px)); overflow-wrap: anywhere; color: var(--muted); }
.details-content h3 { color: var(--text); font-size: 15px; margin: 6px 0; line-height: 1.28; }
.details-content p { font-size: 12px; margin: 0 0 9px; }
.details-content .abstract { color: var(--muted); line-height: 1.55; }
.detail-tag { color: var(--mint); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.detail-link { margin-bottom: 11px; display: inline-block; }
.neighbors { border-top: 1px solid var(--line); padding-top: 8px; }
.neighbors h4 { margin: 0 0 7px; color: var(--text); font-size: 12px; }
.neighbors button { display: block; text-align: left; width: 100%; font-size: 11px; color: var(--muted); margin: 4px 0; }
.neighbors button strong { display: block; color: var(--text); font-weight: 550; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 7px 24px; font-size: 11px; color: var(--quiet); }
.credits { flex-basis: 100%; line-height: 1.5; }
#message.error { color: var(--pink); }
.paper-node { cursor: pointer; outline: none; }
.paper-node circle { stroke-width: 1.7px; fill: var(--theory-fill); stroke: var(--blue); }
.paper-node.experimental circle { fill: var(--experiment-fill); stroke: var(--ochre); }
.paper-node.active circle, .paper-node.citation-preview circle, .paper-node:focus-visible circle { stroke: var(--text); stroke-width: 3px; }
.paper-node.neighbor circle { stroke-width: 2.7px; }
.paper-node .title-label { font-size: 11px; }
.paper-node text { fill: var(--text); paint-order: stroke; stroke: var(--canvas); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.paper-edge { fill: none; stroke: var(--edge-independent); opacity: var(--edge-opacity); stroke-linecap: round; stroke-linejoin: round; }
.paper-edge.shared-authors { stroke: var(--edge-shared); }
.paper-edge:not(.shared-authors) { stroke-dasharray: 7 8; }
.paper-edge.blocked { opacity: var(--edge-blocked-opacity); }
.paper-edge.concealed { display: none; }
.paper-edge.time-unknown { stroke: var(--edge-unknown); }
.paper-edge.to-earlier { stroke: var(--edge-earlier); }
.paper-edge.to-later { stroke: var(--edge-later); }
.paper-edge.emphasized { opacity: 1; }
.paper-edge.dimmed { opacity: var(--edge-dimmed-opacity); }
.paper-node .author-label { stroke-width: 1px; }
.paper-node:hover text, .paper-node.citation-preview text, .paper-node:focus-visible text { font-weight: 700; }
.axis line { stroke: var(--line); stroke-width: 1px; stroke-dasharray: 3 6; }
.axis text { fill: var(--muted); }
html[data-platform="web"] { font-size: 100%; }
html[data-platform="web"] :is(#search-form > div > label, label:not(.check), .field-label, .check, .layout-buttons button, .zoom-buttons button, .graph-header p) { font-size: .875rem; }
html[data-platform="web"] :is(.search-extras, .legend, .filter-note, footer, .details-content p, .neighbors button) { font-size: .8125rem; }
html[data-platform="web"] .routing-summary { height: auto; line-height: 1.35; white-space: normal; }
html[data-platform="web"] select {
  appearance: none;
  padding-inline-end: 27px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23a1b2cb' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
@media (max-width: 1090px) {
  .workspace { grid-template-columns: 167px minmax(325px,1fr) 182px; gap: 8px; }
  .workspace, .search-block, .masthead, footer { padding-inline: 13px; }
}
@media (max-width: 770px) {
  .workspace { grid-template-columns: 150px 1fr; }
  .details { grid-column: 1/-1; }
  .details-content { max-height: none; }
  #details-jump { display: inline-block; margin-top: 4px; }
}
@media (max-width: 620px) {
  .masthead { align-items: flex-start; gap: 10px; flex-wrap: wrap; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  #search-form { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr) auto; gap: 8px; }
  #search-form .query-field { grid-column: 1/-1; }
  button.primary { padding-inline: 13px; }
  .search-extras { flex-wrap: wrap; gap: 3px 10px; }
  .search-extras .link { min-height: 34px; }
  .demo { margin-left: 0; }
  .filter-actions .link, #details-jump { min-height: 34px; }
  #filter-toggle { display: inline-block; }
  .filters:not(.expanded) :is(#filter-fields, .filter-note, #reset) { display: none; }
  #filter-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
  .filter-item { margin-bottom: 0; }
  .filter-item:first-child { grid-column: 1/-1; }
  .year-range input { min-width: 0; }
  .graph-panel { min-height: 470px; height: clamp(470px, 70vh, 650px); height: clamp(470px, 70svh, 650px); }
  .graph-header { align-items: flex-start; flex-direction: column; padding: 10px 11px; }
  .view-controls { justify-content: flex-start; gap: 5px 9px; }
  .layout-buttons button, .zoom-buttons button { min-height: 38px; }
  .zoom-buttons { bottom: 6px; right: 6px; }
  .legend { gap: 5px 10px; }
  .routing-summary { height: auto; white-space: normal; }
  .details-content p { font-size: 14px; }
  #paper-details:focus { outline: 2px solid var(--mint); outline-offset: 2px; }
  footer { flex-wrap: wrap; }
}
@media (pointer: coarse) {
  .mouse-hint { display: none; }
  .touch-hint { display: inline; }
  input:not([type="checkbox"]), select { font-size: 1rem; min-height: 44px; }
  .check { min-height: 44px; }
  .check input { width: 18px; height: 18px; flex-shrink: 0; }
  button.primary, .layout-buttons button, .zoom-buttons button { min-height: 44px; }
}
