:root {
  --bg-0: #05060a;
  --ink: #dbdff5;
  --muted: #7a7fa0;
  --accent: #9adfff;
  --panel: rgba(14, 16, 28, 0.82);
  --border: rgba(255, 255, 255, 0.06);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #05060a;
  color: var(--ink);
  font-family: "Inter", "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Arial Hebrew", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }

header {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  gap: 10px;
  z-index: 10; pointer-events: none;
}
header > * { pointer-events: auto; }
.brand-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.icon-btn {
  display: none;
  padding: 6px 8px;
  color: var(--ink);
}
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 4; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
.brand {
  font-weight: 600; letter-spacing: 0.02em; font-size: 13.5px;
  color: #c4c9ea;
}
.brand .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  margin-right: 8px; vertical-align: middle;
}
.brand .sub { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 12px;}

.tools { display: flex; gap: 8px; align-items: center; }
.search-wrap { position: relative; }
.results {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 6px;
  display: none;
  z-index: 12;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
}
.results.open { display: block; }
.results .r-row {
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  transition: background .1s;
}
.results .r-row:hover, .results .r-row.focus {
  background: rgba(255,255,255,0.06);
}
.results .r-title {
  font-size: 12.5px; color: var(--ink); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.results .r-meta {
  font-size: 10.5px; color: var(--muted); margin-top: 3px;
  display: flex; gap: 6px; align-items: center;
}
.results .r-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.results .r-empty {
  padding: 16px 12px; font-size: 12px; color: var(--muted); text-align: center;
}
.results .r-count {
  padding: 6px 10px 2px; font-size: 10px; color: var(--muted);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.search {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 7px 14px; font-size: 12.5px;
  border-radius: 999px; width: 220px;
  outline: none;
  transition: border-color .15s, background .15s, width .2s;
}
.search::placeholder { color: #595d7a; }
.search:focus {
  border-color: rgba(154,223,255,0.35);
  background: rgba(154,223,255,0.04);
  width: 260px;
}
.btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 6px 12px; font-size: 12px; border-radius: 999px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.help-btn { font-weight: 700; padding: 4px 10px; font-size: 13px; line-height: 1; }

.modal {
  position: fixed; inset: 0; z-index: 30;
  display: none; align-items: center; justify-content: center;
  background: rgba(3, 4, 10, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 32px 20px;
  overflow-y: auto;
}
.modal.open { display: flex; }
.modal-card {
  position: relative; max-width: 620px; width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px 24px;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.modal-card h2 {
  margin: 0 0 10px; font-size: 18px; font-weight: 600;
}
.modal-card h3 {
  margin: 18px 0 8px; font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.modal-card .lede {
  font-size: 13px; line-height: 1.6; color: #bfc3de; margin: 0 0 4px;
}
.modal-card .lede strong { color: var(--ink); font-weight: 600; }
.modal-card .aside { color: var(--muted); font-size: .92em; }
.modal-card ol.flow, .modal-card ul.flow {
  font-size: 12.5px; line-height: 1.65; color: #bfc3de;
  padding-left: 20px; margin: 0;
}
.modal-card ol.flow li, .modal-card ul.flow li { margin-bottom: 4px; }
.modal-card code {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 11.5px; padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,0.05); color: var(--accent);
}
.modal-card .foot {
  font-size: 11.5px; color: var(--muted); margin: 20px 0 0;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.modal-card .close {
  position: absolute; top: 14px; right: 18px; cursor: pointer;
  color: var(--muted); font-size: 16px; background: none; border: none;
}
.modal-card .close:hover { color: var(--ink); }

#stage { position: absolute; inset: 0; }
canvas { display: block; }

.legend {
  position: fixed; left: 16px; top: 64px; bottom: 16px;
  width: 252px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 14px 12px 10px;
  overflow-y: auto;
  z-index: 5;
}
.legend h3 {
  margin: 2px 8px 10px; font-size: 10.5px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.mode-toggle { margin: 0 0 12px; padding: 0 2px 10px; border-bottom: 1px solid var(--border); }
.mode-row { display: flex; gap: 6px; padding: 0 6px; }
.mode-opt {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 8px; font-size: 11.5px; cursor: pointer;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 999px;
  color: var(--muted); transition: background .12s, color .12s, border-color .12s;
}
.mode-opt input { accent-color: var(--accent); margin: 0; }
.mode-opt:has(input:checked) { color: var(--ink); background: rgba(154,223,255,0.08); border-color: rgba(154,223,255,0.35); }
.cluster {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 10px;
  cursor: pointer; user-select: none;
  transition: background .12s, opacity .12s;
}
.cluster:hover { background: rgba(255,255,255,0.04); }
.cluster.dim { opacity: 0.28; }
.swatch {
  width: 10px; height: 10px; border-radius: 3px; flex: none;
}
.cluster .label {
  font-size: 12px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis;
}
.cluster .label .cnt {
  color: var(--muted); font-size: 10.5px; margin-left: 5px;
}
.cluster .label .cl-name { display: block; }
.cluster .label .cl-stat {
  display: block; font-size: 9.5px; color: var(--muted);
  opacity: .8; margin-top: 2px; font-variant-numeric: tabular-nums;
}
.legend-chart { margin: 0 6px 14px; text-align: center; }
.donut { width: 100%; max-width: 152px; height: auto; display: block; margin: 0 auto; }
.donut .slice {
  cursor: pointer; stroke: rgba(5,6,10,0.55); stroke-width: 1;
  transition: opacity .15s;
}
.donut .slice:hover { stroke: rgba(255,255,255,0.5); }
.donut .slice.faint { opacity: .28; }
.donut .slice.off { opacity: .12; }
.donut-c1 { fill: var(--ink); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-c2 { fill: var(--muted); font-size: 8px; letter-spacing: .08em; }
.chart-cap {
  font-size: 10px; color: var(--muted); margin-top: 7px; line-height: 1.4;
  min-height: 2.6em; padding: 0 4px;
}
.legend .hint-text {
  font-size: 10.5px; color: var(--muted); padding: 10px 12px 2px;
  line-height: 1.5;
}

/* connectivity view: gradient key + ranked hubs / islands */
.conn-key { margin: 0 6px 12px; }
.conn-bar { height: 10px; border-radius: 999px; }
.conn-bar-lbls {
  display: flex; justify-content: space-between; direction: ltr;
  font-size: 10px; color: var(--muted); margin-top: 5px;
}
.conn-cap {
  font-size: 10.5px; color: var(--muted); line-height: 1.5;
  margin-top: 9px; text-align: center; padding: 0 2px;
}
.conn-sec {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  margin: 12px 8px 5px; padding-top: 9px; border-top: 1px solid var(--border);
}
.conn-sec:first-child { border-top: none; padding-top: 0; margin-top: 2px; }
.conn-row .cl-stat { opacity: .85; }

/* jump to the first episode of each book */
.book-bar-wrap { margin: 0 0 12px; padding: 2px 0 11px; border-bottom: 1px solid var(--border); }
.book-bar { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 6px; }
.book-jump {
  flex: 1 1 auto; min-width: 0; white-space: nowrap;
  padding: 5px 9px; font: inherit; font-size: 11px; cursor: pointer;
  color: var(--bk, var(--ink));
  background: color-mix(in srgb, var(--bk, #8a90b0) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--bk, #8a90b0) 42%, transparent);
  border-radius: 999px; transition: background .12s, border-color .12s, transform .08s;
}
.book-jump:hover { background: color-mix(in srgb, var(--bk, #8a90b0) 24%, transparent); }
.book-jump:active { transform: translateY(1px); }

/* before / after pager in the info card */
.pager { display: flex; gap: 8px; margin: 2px 0 14px; }
.pager-btn {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 8px 11px; cursor: pointer; font: inherit; color: var(--ink);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border); border-radius: 12px;
  transition: background .12s, border-color .12s;
}
.pager-btn.next { flex-direction: row-reverse; }
.pager-btn:hover:not(:disabled) { background: rgba(255,255,255,0.07); border-color: rgba(154,223,255,0.35); }
.pager-btn:disabled { opacity: .28; cursor: default; }
.pager-ar { font-size: 18px; line-height: 1; color: var(--muted); flex: none; }
.pager-txt { display: flex; flex-direction: column; gap: 1px; overflow: hidden; align-items: flex-start; }
.pager-btn.next .pager-txt { align-items: flex-end; }
.pager-lbl {
  font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.pager-name {
  font-size: 12px; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.info {
  position: fixed; top: 64px; right: 16px; bottom: 16px;
  width: 440px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 20px 22px;
  overflow-y: auto;
  transform: translateX(calc(100% + 24px));
  transition: transform .24s cubic-bezier(.2,.7,.2,1);
  z-index: 5;
}
.info.open { transform: translateX(0); }
.info .close {
  position: absolute; top: 14px; right: 16px; cursor: pointer;
  color: var(--muted); font-size: 16px; background: none; border: none;
}
.info .close:hover { color: var(--ink); }
.info h2 {
  margin: 0 0 8px; font-size: 15.5px; line-height: 1.4; padding-right: 22px;
  font-weight: 600;
}
.info .meta {
  font-size: 11px; color: var(--muted); margin-bottom: 14px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.info .meta .tag {
  border-radius: 999px; padding: 2px 9px; font-size: 10.5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  text-decoration: none;
}
.info .meta .tag.link { color: var(--accent); border-color: rgba(154,223,255,0.35); }
.info .meta .tag.link:hover { background: rgba(154,223,255,0.08); }
.info .body {
  font-size: 12.5px; line-height: 1.65; color: #bfc3de;
  white-space: pre-wrap;
}

.links {
  white-space: normal;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.links-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.links-h {
  margin: 0; font-size: 11px; font-weight: 600;
  letter-spacing: .04em; color: var(--muted); text-transform: uppercase;
}
.twin-toggle {
  display: inline-flex; gap: 2px; padding: 2px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 999px;
}
.twin-mode {
  font: inherit; font-size: 10.5px; cursor: pointer;
  color: var(--muted); background: none; border: none;
  border-radius: 999px; padding: 3px 11px; transition: background .15s, color .15s;
}
.twin-mode.active { background: rgba(154,223,255,0.14); color: var(--accent); }
.scope-toggle { margin: 9px 0 2px; }
.twin-mode:disabled { opacity: .35; cursor: default; }
.twin-mode:not(.active):not(:disabled):hover { color: var(--ink); }
.link-row {
  display: flex; gap: 10px; align-items: flex-start;
  width: 100%; text-align: inherit;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px; margin-bottom: 7px;
  cursor: pointer; color: inherit; font: inherit;
  transition: background .15s, border-color .15s;
}
.link-row:hover { background: rgba(154,223,255,0.07); border-color: rgba(154,223,255,0.3); }
.link-z {
  flex: 0 0 auto; align-self: center; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: rgba(154,223,255,0.1); border-radius: 12px;
  padding: 3px 8px; font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.link-p { font-size: 8.5px; font-weight: 600; color: var(--muted); opacity: .85; }
.link-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.link-title { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.twin-kind {
  font-size: 9px; font-weight: 600; color: var(--accent);
  border: 1px solid rgba(154,223,255,0.35); border-radius: 4px;
  padding: 0 4px; margin-inline-start: 6px; vertical-align: middle;
}
.link-ref { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.link-echo { font-size: 9.5px; letter-spacing: .03em; color: var(--muted); opacity: .8; margin-top: 2px; }
.link-verse { font-size: 11.5px; line-height: 1.5; color: #aab0d0; }
.link-verse b { color: var(--accent); font-weight: 600; margin-inline-end: 4px; }

.tip {
  position: fixed; pointer-events: none;
  max-width: 300px;
  background: rgba(8, 9, 18, 0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 11.5px;
  line-height: 1.45;
  opacity: 0; transition: opacity .12s;
  z-index: 8;
  backdrop-filter: blur(10px);
}
.tip.show { opacity: 1; }
.tip .t-title { font-weight: 600; margin-bottom: 3px; color: var(--ink); font-size: 12px; word-break: break-word; }
.tip .t-team { color: var(--muted); font-size: 10px; margin-bottom: 5px; display: flex; align-items: center; gap: 5px; }
.tip .t-team .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.tip .t-prev { color: #a7acce; font-size: 11px; }

.hint {
  position: fixed; bottom: 18px; right: 18px;
  font-size: 10.5px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 999px;
  z-index: 3;
  transition: opacity .3s;
}
.hint.hidden { opacity: 0; pointer-events: none; }

.loading {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12.5px; letter-spacing: 0.04em;
  z-index: 20; background: #05060a;
  transition: opacity .4s;
}
.loading.hidden { opacity: 0; pointer-events: none; }
.loading .pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  margin-right: 10px; vertical-align: middle;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

@media (max-width: 900px) {
  .legend { width: 200px; }
  .info { width: calc(100% - 32px); }
  .search { width: 140px; }
  .search:focus { width: 180px; }
}

@media (max-width: 720px) {
  header { padding: 10px 12px; }
  .brand { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand .sub { display: none; }
  .icon-btn { display: inline-flex; align-items: center; justify-content: center; }
  .search { width: 130px; padding: 6px 12px; font-size: 12px; }
  .search:focus { width: 150px; }
  .btn { padding: 6px 10px; font-size: 11.5px; }

  .legend {
    top: 0; left: 0; bottom: 0; width: 80vw; max-width: 320px;
    border-radius: 0 14px 14px 0;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.2,.7,.2,1);
    padding-top: 54px;
  }
  .legend.open { transform: translateX(0); }

  .info {
    top: 0; right: 0; bottom: 0; width: 100%;
    border-radius: 14px 0 0 14px;
    transform: translateX(100%);
    padding-top: 54px;
  }

  .results { width: calc(100vw - 24px); right: -60px; max-height: 60vh; }
  .hint { display: none; }

  /* Modal: top-align on mobile so the whole card is reachable via scroll;
     centering vertically clips the top above the scroll window. */
  .modal { align-items: flex-start; padding: 16px 12px; }
  .modal-card { padding: 22px 22px 20px; border-radius: 14px; }
  .modal-card h2 { padding-inline-end: 40px; }
  .modal-card .close {
    top: 8px;
    inset-inline-end: 8px; inset-inline-start: auto;
    width: 36px; height: 36px; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
  }
}

/* Hide the whole header while an overlay pane is open — the header's `?`
   otherwise lands in the same top-right spot as the pane's `✕`. */
body.modal-open header,
body.info-open header { display: none !important; }

@media (max-width: 720px) {
  .info .close {
    top: 8px;
    inset-inline-end: 8px; inset-inline-start: auto;
    width: 36px; height: 36px; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
  }
  .info { padding-top: 18px; }
  .info h2 { padding-inline-end: 44px; }
}

/* ---------- RTL / Hebrew ---------- */
html[dir="rtl"] body {
  font-family: "Heebo", "Inter", -apple-system, "Arial Hebrew", sans-serif;
}
html[dir="rtl"] .brand .dot { margin-right: 0; margin-left: 8px; }
html[dir="rtl"] .brand .sub { margin-left: 0; margin-right: 8px; }
html[dir="rtl"] .results { left: 0; right: auto; }
html[dir="rtl"] .cluster .label .cnt { margin-left: 0; margin-right: 5px; }
html[dir="rtl"] .modal-card ol.flow,
html[dir="rtl"] .modal-card ul.flow { padding-left: 0; padding-right: 20px; }
html[dir="rtl"] .modal-card .close { right: auto; left: 18px; }
html[dir="rtl"] .modal-card h3 { letter-spacing: .04em; }
html[dir="rtl"] .info { right: auto; left: 16px; transform: translateX(calc(-100% - 24px)); }
html[dir="rtl"] .info.open { transform: translateX(0); }
html[dir="rtl"] .info .close { right: auto; left: 16px; }
html[dir="rtl"] .info h2 { padding-right: 0; padding-left: 22px; }
html[dir="rtl"] .legend { left: auto; right: 16px; }
html[dir="rtl"] .hint { right: auto; left: 18px; }
html[dir="rtl"] .lang-btn { font-family: "Inter", sans-serif; }

@media (max-width: 720px) {
  html[dir="rtl"] .legend {
    left: auto; right: 0;
    border-radius: 14px 0 0 14px;
    transform: translateX(100%);
  }
  html[dir="rtl"] .legend.open { transform: translateX(0); }
  html[dir="rtl"] .info {
    left: 0; right: auto;
    border-radius: 0 14px 14px 0;
    transform: translateX(-100%);
  }
  html[dir="rtl"] .info.open { transform: translateX(0); }
  html[dir="rtl"] .results { right: auto; left: -60px; }
}


/* Slim dark scrollbars on all scrollable panels */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* Connections tour */
.tour {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(150%);
  display: flex; align-items: center; gap: 12px;
  max-width: min(720px, calc(100% - 28px));
  transition: transform .3s cubic-bezier(.2,.7,.2,1);
  z-index: 6;
}
.tour.open { transform: translateX(-50%) translateY(0); }
.tour-main {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 14px 18px 15px;
  min-width: 0; flex: 1;
  box-shadow: 0 18px 48px rgba(0,0,0,0.5);
}
.tour-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.tour-badges { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.tour-lens {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--lens, var(--accent));
  background: color-mix(in srgb, var(--lens, var(--accent)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--lens, var(--accent)) 36%, transparent);
  border-radius: 999px; padding: 2px 11px;
}
.tour-lens::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--lens, var(--accent));
  box-shadow: 0 0 7px var(--lens, var(--accent));
}
.tour-stat { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tour-stat em { font-style: normal; opacity: .7; }
.tour-chi {
  font-size: 9.5px; font-weight: 600; color: var(--accent);
  border: 1px solid rgba(154,223,255,0.35); border-radius: 4px; padding: 0 5px;
}
.tour-count {
  margin-inline-start: auto; flex: 0 0 auto;
  font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tour-top .close {
  flex: 0 0 auto; cursor: pointer; border: none; background: none;
  color: var(--muted); font-size: 13px; padding: 0; line-height: 1;
}
.tour-top .close:hover { color: var(--ink); }
.tour-note { font-size: 13px; line-height: 1.6; color: var(--ink); }
.tour-evidence {
  margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border);
  display: grid; gap: 6px;
}
.tour-evidence:empty { display: none; }
.ev-row { display: flex; gap: 9px; align-items: baseline; font-size: 11.5px; line-height: 1.5; }
.ev-ref {
  flex: 0 0 auto; color: var(--accent); font-weight: 600; font-size: 10.5px;
  white-space: nowrap; opacity: .9;
}
.ev-text { color: #aab0d0; min-width: 0; }
.tour-nav {
  background: var(--panel); border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px; color: var(--ink); font-size: 17px; cursor: pointer;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  flex: 0 0 auto; transition: border-color .15s, background .15s, color .15s;
}
.tour-nav:hover { border-color: rgba(154,223,255,0.4); background: rgba(154,223,255,0.08); }
@media (max-width: 720px) {
  .tour { bottom: 12px; }
  .tour-btn { display: none; }
}

/* Tour side-by-side full-text panes */
.tour-pane {
  position: fixed; top: 64px; bottom: 150px;
  width: min(360px, 30vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 16px 18px;
  overflow-y: auto;
  z-index: 5;
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.tour-pane.pane-a { right: 16px; transform: translateX(24px); }
.tour-pane.pane-b { left: 16px; transform: translateX(-24px); }
body.touring .tour-pane { opacity: 1; pointer-events: auto; transform: none; }
body.touring .legend { display: none; }
.tour-pane h2 { margin: 0 0 8px; font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.tour-pane .meta {
  font-size: 11px; color: var(--muted); margin-bottom: 12px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.tour-pane .meta .tag {
  border-radius: 999px; padding: 2px 9px; font-size: 10.5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  text-decoration: none;
}
.tour-pane .meta .tag.link { color: var(--accent); border-color: rgba(154,223,255,0.35); }
.tour-pane .meta .tag.link:hover { background: rgba(154,223,255,0.08); }
.tour-pane .body { font-size: 12px; line-height: 1.75; color: #bfc3de; white-space: pre-wrap; }
@media (max-width: 980px) { .tour-pane { display: none; } }
