/* Dense reading interface, with the original muted green links. */
:root {
  color-scheme: light;
  --surface: oklch(98% .006 145); --toolbar: oklch(94% .008 145);
  --input: oklch(99% .003 145); --text: oklch(25% .008 145);
  --muted: oklch(45% .015 145); --border: oklch(65% .012 145); --rule: oklch(86% .008 145);
  --link: oklch(38% .07 145); --highlight: oklch(37% .12 30);
  --highlight-bg: oklch(93% .04 80); --notice: oklch(43% .08 65);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: oklch(19% .008 145); --toolbar: oklch(23% .009 145);
  --input: oklch(16% .006 145); --text: oklch(89% .008 145);
  --muted: oklch(72% .012 145); --border: oklch(53% .012 145); --rule: oklch(32% .008 145);
  --link: oklch(80% .065 145); --highlight: oklch(92% .085 85);
  --highlight-bg: oklch(32% .025 80); --notice: oklch(81% .075 80);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --surface: oklch(19% .008 145); --toolbar: oklch(23% .009 145);
    --input: oklch(16% .006 145); --text: oklch(89% .008 145);
    --muted: oklch(72% .012 145); --border: oklch(53% .012 145); --rule: oklch(32% .008 145);
    --link: oklch(80% .065 145); --highlight: oklch(92% .085 85);
    --highlight-bg: oklch(32% .025 80); --notice: oklch(81% .075 80);
  }
}
html { font-size: 100%; background: var(--surface); color: var(--text); }
body { background: var(--surface); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration: underline; }
#searchbox { background: var(--toolbar); border-color: var(--border); }
.tractor-form { display: flex; gap: 1rem; padding: .75rem 1rem; align-items: flex-start; max-width: 84rem; margin: auto; }
.tractor-form > div { min-width: 0; }
.query-control { flex: 1; }
.tractor-form label { display: block; font-weight: 600; font-size: .8125rem; }
input, select, button { box-sizing: border-box; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: 3px; font-size: .875rem; padding: .35rem .5rem; min-height: 2rem; }
input:focus, select:focus, button:focus { color: var(--text); border-color: var(--link); }
button { cursor: pointer; }
button:hover { background: var(--toolbar); }
.actions { display: flex; gap: 1rem; align-items: center; margin-top: .375rem; font-size: .8125rem; }
.actions button { padding-inline: 1.25rem; }
.actions .gray { margin-left: auto; }
.query-help { color: var(--muted); font-size: .75rem; line-height: 1.5; margin: .35rem 0 0; }
.rank-control, .theme-control { flex: 0 0 6rem; }
#status { color: var(--muted); background: var(--toolbar); border-color: var(--border); font-size: .8125rem; margin: .75rem 1rem; padding: .55rem .75rem; line-height: 1.6; }
.ranking-summary { margin-left: .75rem; }
.compare-link, .explore-link { margin-left: .75rem; text-decoration: underline; white-space: nowrap; }
.candidate-summary { display: block; }
.notice { margin-left: .75rem; color: var(--notice); }
#results { max-width: 52rem; margin: auto; padding: 0 1.5rem 0 3.5rem; }
.search-result { margin: 0; padding: 1.1rem 0; background: transparent; border-bottom: 1px solid var(--rule); }
.search-result-title { float: none; margin: 0 0 .3rem; font-size: 1rem; line-height: 1.4; font-weight: 650; }
.search-result-title a { color: var(--text); }
.search-result-number { color: var(--muted); width: 2.5rem; margin-left: -3.2rem; font-size: .8125rem; line-height: 1.75; font-variant-numeric: tabular-nums; }
.search-result-author, .passage-label { color: var(--muted); font-size: .8125rem; line-height: 1.5; margin-bottom: .25rem; }
.search-result-author a, .passage-label a { color: var(--link); text-decoration: underline; }
.passage-label { clear: both; }
.search-result-snippet { border: 0; padding: 0; margin: .35rem 0 0; color: var(--text); font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.6; text-align: left; max-width: 75ch; overflow-wrap: anywhere; }
mark.search-result-highlight { color: var(--highlight); background: var(--highlight-bg); font-weight: 600; border-radius: 2px; }
.read-passage { display: inline-block; font-size: .8125rem; margin-top: .35rem; text-decoration: underline; }
.more-passages { font-size: .8125rem; margin-top: .45rem; color: var(--muted); }
summary { cursor: pointer; width: fit-content; }
summary:hover { color: var(--link); }
.extra-passage { margin-top: 1rem; }
.tractor-pages { display: flex; justify-content: center; gap: 1.5rem; font-size: .875rem; margin: 1.5rem; }
.tractor-pages a { text-decoration: underline; }
.tractor-footer { max-width: 52rem; padding: 0 1.5rem 0 3.5rem; margin: 1.5rem auto; font-size: .8125rem; line-height: 1.6; color: var(--muted); }
.empty { margin: 2rem auto; max-width: 48rem; padding: 1rem; }
.passage-view { max-width: 75ch; margin: 2rem auto; padding: 0 1rem; }
.passage-view h1 { font-size: 1.5rem; line-height: 1.3; }
.passage-view details { margin-top: 1.5rem; font-size: .875rem; color: var(--muted); }
.passage-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .875rem; }
.passage-toolbar select { width: auto; margin-left: .5rem; }
.gray { color: var(--muted); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
::selection { background: var(--highlight-bg); color: var(--highlight); }
.comparison-view { max-width: 72rem; margin: 1.5rem auto 3rem; padding: 0 1.25rem; }
.comparison-view h1 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 .75rem; }
.comparison-view h2 { font-size: 1.125rem; line-height: 1.4; margin: 1.75rem 0 .35rem; }
.comparison-view h3 { font-size: 1rem; margin: .65rem 0 .35rem; }
.comparison-view h4 { font-size: .8125rem; margin: 1rem 0 .35rem; }
.comparison-intro { max-width: 75ch; font-size: .875rem; line-height: 1.6; margin: 0 0 .65rem; }
.comparison-context { color: var(--muted); font-size: .8125rem; line-height: 1.6; margin-bottom: .65rem; }
.comparison-context .notice, .sparse-coverage { display: block; margin-left: 0; }
.comparison-methods, .comparison-notice, .chart-help, .query-evidence { font-size: .8125rem; line-height: 1.6; }
.comparison-methods { color: var(--muted); max-width: 90ch; }
.comparison-methods ul { padding-left: 1.25rem; }
.comparison-methods li { margin: .5rem 0; }
.comparison-notice { color: var(--notice); padding: .6rem 0; border-bottom: 1px solid var(--rule); }
.rank-plot { max-width: 58rem; margin: 0 auto; }
.rank-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.plot-work path { fill: none; stroke: var(--border); stroke-width: 1; }
.plot-work circle { fill: var(--muted); }
.plot-work text { fill: var(--text); font-size: 12px; }
.plot-work .plot-rank { fill: var(--muted); font-variant-numeric: tabular-nums; }
.plot-heading { fill: var(--text); font-size: 14px; font-weight: 650; }
.plot-bottom { fill: var(--muted); font-size: 11px; }
.plot-work.is-selected path, .plot-work.is-active path, .plot-work:focus path { stroke: var(--link); stroke-width: 2.5; }
.plot-work.is-selected circle, .plot-work.is-active circle, .plot-work:focus circle { fill: var(--link); }
.plot-work.is-selected text, .plot-work.is-active text, .plot-work:focus text { font-weight: 650; }
.paired-passages { border-top: 1px solid var(--rule); margin-top: 1rem; scroll-margin-top: 1rem; }
.passage-comparison { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
.compared-passage { min-width: 0; }
.score-evidence { margin-top: .7rem; font-size: .8125rem; line-height: 1.6; color: var(--muted); }
.score-evidence dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .75rem; max-width: 28rem; }
.score-evidence dt { margin: 0; }
.score-evidence dd { margin: 0; font-variant-numeric: tabular-nums; }
.evidence-help { font-size: .8125rem; line-height: 1.6; color: var(--muted); max-width: 75ch; }
.rank-table, .term-evidence { border-collapse: collapse; font-size: .8125rem; width: 100%; line-height: 1.5; }
.rank-table td, .rank-table th, .term-evidence td, .term-evidence th { padding: .5rem .65rem; border: 0; border-bottom: 1px solid var(--rule); text-align: left; }
.rank-table thead, .term-evidence thead { color: var(--muted); }
.rank-table td { font-variant-numeric: tabular-nums; }
.rank-table th[scope="row"] { font-weight: 500; }
.rank-table th[scope="row"] a { text-decoration: underline; text-decoration-color: var(--rule); }
.rank-table th[scope="row"] a:hover { text-decoration-color: var(--link); }
.rank-table td:first-child, .rank-table td:nth-child(2) { width: 4.5rem; }
.rank-table .rank-change { width: 7rem; color: var(--muted); }
.rank-table tr.is-selected, .rank-table tr.is-active { background: var(--toolbar); }
.term-evidence { max-width: 26rem; }
.term-evidence td { font-variant-numeric: tabular-nums; text-align: right; }
.term-evidence th { font-weight: 500; }
.query-evidence { margin-top: 1.5rem; color: var(--muted); }
.explore-view { max-width: 84rem; margin: 1.25rem auto 3rem; padding: 0 1.25rem; }
.explore-view h1 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 .45rem; }
.explore-view h2 { font-size: 1.125rem; line-height: 1.4; margin: 0 0 .4rem; }
.explore-view h3 { font-size: 1rem; margin: 1.5rem 0 .65rem; }
.explore-view h4 { font-size: .875rem; margin: .65rem 0 .3rem; }
.explore-view-control { flex: 0 0 11rem; }
.explore-status, .explore-intro, .map-help, .relation-context, .selected-themes, .explore-method { font-size: .8125rem; line-height: 1.6; }
.explore-status, .map-help, .relation-context, .selected-themes, .explore-method { color: var(--muted); }
.explore-status .notice { display: block; margin-left: 0; }
.explore-intro { margin: .35rem 0 1rem; max-width: 85ch; }
.explore-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(16rem, 1fr); gap: 1.5rem; align-items: start; }
.explore-map-section, .explore-book-section { min-width: 0; }
.explore-map-disclosure > summary { font-size: .875rem; font-weight: 650; margin-bottom: .5rem; }
.map-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.map-toolbar button { font-size: .8125rem; padding: .3rem .6rem; }
.map-toolbar button:disabled { opacity: .5; cursor: default; }
.map-toolbar button[hidden] { display: none; }
.map-legend { display: inline-flex; gap: .3rem; align-items: center; margin-left: auto; font-size: .6875rem; color: var(--muted); }
.legend-dot, .legend-match { width: .4rem; height: .4rem; border-radius: 50%; display: inline-block; background: var(--link); }
.legend-match { background: var(--surface); border: 1px solid var(--link); margin-left: .5rem; }
.map-stage { position: relative; height: 460px; border: 1px solid var(--rule); background: var(--surface); }
.map-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.map-stage canvas:active { cursor: grabbing; }
.map-stage canvas[data-hover="work"] { cursor: pointer; }
.map-stage canvas[hidden] { display: none; }
.map-loading { color: var(--muted); font-size: .875rem; padding: 1rem; max-width: 65ch; line-height: 1.6; }
.map-hover { position: absolute; left: .5rem; right: .5rem; bottom: .25rem; padding: .2rem .35rem; margin: 0; background: var(--surface); color: var(--text); pointer-events: none; font-size: .8125rem; line-height: 1.4; }
.map-hover:empty { display: none; }
.map-help { margin: .5rem 0; max-width: 85ch; }
.topic-filter { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; margin: .7rem 0; }
.topic-filter label { flex: 0 0 auto; font-weight: 600; }
.topic-filter select { min-width: 0; max-width: 30rem; }
.book-list-heading { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.book-list-heading > a { font-size: .8125rem; text-decoration: underline; }
.relation-context { margin: .2rem 0 .65rem; }
.explore-book-list { list-style: none; padding: 0; margin: 0; max-height: 495px; overflow-y: auto; }
.explore-book-list li { padding: .65rem .35rem; border-bottom: 1px solid var(--rule); }
.explore-book-list li > a { color: var(--text); font-weight: 600; font-size: .875rem; line-height: 1.45; display: block; }
.explore-book-list li.is-map-active, .explore-book-list li:focus-within { background: var(--toolbar); }
.explore-book-list li.is-match > a::before { content: '● '; color: var(--link); font-size: .65rem; }
.book-author, .book-themes, .book-note { display: block; font-size: .75rem; line-height: 1.5; color: var(--muted); margin-top: .15rem; }
.book-author { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-note { display: inline-block; margin-right: .65rem; font-style: italic; }
.explore-pages { display: flex; gap: 1rem; justify-content: center; font-size: .8125rem; margin: .75rem 0; }
.explore-pages a { text-decoration: underline; }
.explore-selected { border-top: 1px solid var(--rule); margin-top: 1.5rem; padding-top: 1.25rem; scroll-margin-top: 1rem; }
.explore-selected > h2 { font-size: 1.35rem; max-width: 70ch; }
.explore-passage { max-width: 75ch; margin: 1rem 0 1.5rem; }
.selected-themes { max-width: 85ch; }
.connection-evidence { padding: .65rem 0; border-bottom: 1px solid var(--rule); }
.connection-evidence > summary { font-size: .8125rem; line-height: 1.5; color: var(--muted); }
.connection-evidence > summary a { color: var(--text); font-weight: 600; text-decoration: underline; }
.connection-passages { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; margin-top: .5rem; }
.explore-selection-hint { color: var(--muted); font-size: .875rem; margin: 1.5rem 0; }
.explore-method { max-width: 90ch; margin-top: 1.5rem; }
@media (max-width: 700px) {
  .tractor-form { flex-wrap: wrap; gap: .65rem; }
  .query-control { flex-basis: 100%; }
  .tractor-form > div:not(.query-control) { flex: 1 1 5rem; }
  .query-help { display: none; }
  #results, .tractor-footer { padding-left: 2.6rem; padding-right: 1rem; }
  .search-result-number { margin-left: -2.4rem; width: 2rem; }
  .ranking-summary { display: block; margin-left: 0; }
  .notice { display: block; margin-left: 0; }
  .compare-link, .explore-link { margin-left: 0; }
  .comparison-view { margin-top: 1rem; padding: 0 1rem; }
  .passage-comparison { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .compared-passage + .compared-passage { border-top: 1px solid var(--rule); padding-top: .5rem; }
  .rank-plot { display: none; }
  .rank-table td, .rank-table th { padding: .5rem .25rem; }
  .rank-table td:first-child, .rank-table td:nth-child(2) { width: 3rem; }
  .rank-table .rank-change { width: 4rem; }
  .rank-table th[scope="row"] { overflow-wrap: anywhere; }
  .explore-view { padding: 0 1rem; }
  .explore-layout, .connection-passages { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .explore-map-section { order: 2; }
  .explore-book-section { order: 1; }
  .explore-book-list { max-height: 420px; }
  .map-stage { height: 330px; }
  .topic-filter { flex-wrap: wrap; }
  .topic-filter label { flex-basis: 100%; }
  .topic-filter select { flex: 1; }
  .explore-form .actions { flex-wrap: wrap; gap: .65rem; }
}
