:root {
  --gold: #d4b06a;
  --gold-bright: #f3dfb0;
  --gold-deep: #9a7438;
  --parchment: #f3ead4;
  --parchment-dim: #c9b896;
  --ink: #120d09;
  --panel: rgba(16, 11, 8, 0.78);
  --panel-strong: rgba(12, 8, 6, 0.9);
  --line: rgba(212, 176, 106, 0.32);
  --flame: #ffd9a0;
  --d0: #f7f2e4;
  --d1: #d4af37;
  --d2: #2f5f9e;
  --d3: #9eb6ce;
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, serif;
  --display: "Cinzel", "Times New Roman", serif;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { color-scheme: dark; }
body {
  margin: 0;
  color: var(--parchment);
  font-family: var(--serif);
  background: #090705;
  overflow: hidden;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 20;
  color: var(--ink);
  background: var(--gold);
  padding: 6px 10px;
}
.skip:focus { top: 12px; }

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 700px at 30% 55%, rgba(20, 12, 8, 0.15), rgba(6, 4, 3, 0.55) 55%, rgba(4, 3, 2, 0.78)),
    url("../assets/background.jpg") center 40% / cover no-repeat;
  transform: scale(1.04);
  filter: saturate(0.92);
  transition: filter 0.8s ease, transform 1.2s ease;
}
body.is-exploring .atmosphere {
  filter: saturate(0.62) brightness(0.26);
}
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.graph {
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
body.is-exploring .graph {
  opacity: 1;
  pointer-events: auto;
}
.graph,
.graph .scene-container {
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}
.graph canvas {
  outline: none;
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

.mast {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  pointer-events: none;
}
.mast > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: 0;
  color: var(--gold-bright);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-align: left;
  text-decoration: none;
}
.mark {
  width: 42px;
  height: 42px;
  color: var(--gold);
  flex: 0 0 auto;
}
.mark.large { width: 72px; height: 72px; }
.brand-name {
  display: block;
  font-family: var(--display);
  letter-spacing: 0.18em;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}
.brand-tag {
  display: block;
  margin-top: 3px;
  font-style: italic;
  color: var(--parchment-dim);
  letter-spacing: 0.04em;
  font-size: 14px;
}

.mast-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.translation-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}
.badge {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.2em;
  border: 1px solid var(--line);
  color: var(--gold);
  padding: 6px 10px 5px;
  border-radius: 999px;
  background: rgba(20, 12, 8, 0.45);
}
button.badge {
  cursor: pointer;
  text-transform: uppercase;
  line-height: 1;
}
button.badge:hover {
  border-color: var(--gold);
  color: var(--parchment);
}
button.badge.is-on {
  background: linear-gradient(180deg, #e6c37a, #b8893e);
  color: var(--ink);
  border-color: transparent;
  font-weight: 600;
}
button.badge.is-on:hover { color: var(--ink); }

.icon-btn, .go, .book-grid button, .num-grid button {
  font-family: var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.icon-btn {
  color: var(--gold-bright);
  background: rgba(18, 12, 8, 0.55);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  backdrop-filter: blur(10px);
  text-decoration: none;
  display: inline-block;
}
.icon-btn.ghost { background: transparent; }
.icon-btn:hover, .go:hover { border-color: var(--gold); color: var(--parchment); }

.load-gate {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: rgba(8, 6, 4, 0.28);
  backdrop-filter: blur(2px);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.load-gate.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.load-inner { text-align: center; color: var(--gold-bright); }
.load-kicker, .kicker, .reader-kicker {
  font-family: var(--display);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
  margin: 18px 0 8px;
}
.load-bar {
  width: min(280px, 70vw);
  height: 1px;
  margin: 18px auto 10px;
  background: rgba(212, 176, 106, 0.2);
}
.load-bar span {
  display: block;
  height: 100%;
  width: 8%;
  background: var(--gold);
  transition: width 0.3s ease;
}
.load-status, .search-hint, .stats, .reader-note, .prune, .hint, .colophon {
  font-size: 14px;
  color: var(--parchment-dim);
}
.spin-ring { transform-origin: 24px 24px; animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.gate {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1.15fr minmax(320px, 0.85fr);
  align-items: center;
  padding: 10vh 6vw 8vh;
  gap: 2vw;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.gate.is-overlay {
  z-index: 8;
  background: rgba(6, 4, 3, 0.55);
}
.gate-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 36px 28px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 236, 200, 0.08);
  backdrop-filter: blur(18px);
  max-width: 560px;
  justify-self: end;
}
.gate-close {
  position: absolute;
  top: 16px;
  right: 16px;
}
.gate.is-overlay .gate-card { padding-top: 52px; }
body.is-finding .reader,
body.is-finding .depth-dock,
body.is-finding .legend,
body.is-finding .hint,
body.is-finding .prune,
body.is-finding .model-note,
body.is-finding .verse-peek {
  visibility: hidden;
  pointer-events: none;
}
body.is-constellation .translation-switch { display: none; }
.mast-model { display: none; gap: 4px; flex-wrap: wrap; }
body.is-exploring .mast-model { display: flex; }

.model-chooser {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.model-btn {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--gold);
  padding: 8px 14px 7px;
  border-radius: 999px;
  background: rgba(20, 12, 8, 0.45);
  cursor: pointer;
}
.model-btn:hover { border-color: var(--gold); color: var(--parchment); }
.model-btn.is-on {
  background: linear-gradient(180deg, #e6c37a, #b8893e);
  color: var(--ink);
  border-color: transparent;
  font-weight: 600;
}
.model-hint {
  margin: 0 0 14px;
  font-size: 14px;
  font-style: italic;
  color: var(--parchment-dim);
}
.range-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 2px 0;
}
.range-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 16px;
  color: var(--parchment);
  cursor: pointer;
}
.range-check input {
  margin-top: 4px;
  accent-color: var(--gold);
}
.range-check span { line-height: 1.3; }

.thread-name { display: none; }
.thread-rail { margin: 8px 0 2px; }
.thread-rail-label { display: none; }
.thread-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.thread-chip {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 236, 200, 0.05);
  border: 1px solid rgba(212, 176, 106, 0.2);
  color: var(--parchment);
  font-family: var(--serif);
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
}
.thread-chip:hover { border-color: var(--gold); color: var(--gold-bright); }
.thread-chip.is-on {
  background: linear-gradient(180deg, #e6c37a, #b8893e);
  color: var(--ink);
  border-color: transparent;
}
.thread-reason {
  margin: 10px 0 6px;
  font-style: italic;
  font-size: 15px;
  color: var(--gold-bright);
}
.passage-ref {
  margin: 12px 0 4px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.passage-text { margin: 0 0 8px; }
.model-note {
  position: fixed;
  z-index: 7;
  left: 24px;
  bottom: 52px;
  margin: 0;
  max-width: 420px;
  font-size: 14px;
  color: var(--gold-bright);
  text-shadow: 0 2px 12px #000;
}
.gate h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.18;
  margin: 8px 0 14px;
  color: var(--parchment);
  letter-spacing: 0.02em;
}
.lede {
  font-size: 19px;
  line-height: 1.45;
  color: var(--parchment-dim);
  margin: 0 0 18px;
}
.rule {
  height: 1px;
  margin: 8px 0 22px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  position: relative;
}
.rule::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
}

.search-label {
  display: block;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.search-wrap { display: flex; gap: 8px; }
.search {
  flex: 1;
  background: rgba(8, 6, 4, 0.45);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--parchment);
  font-family: var(--serif);
  font-size: 22px;
  padding: 12px 18px;
  outline: none;
}
.search:focus { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(212, 176, 106, 0.25); }
.search::placeholder { color: rgba(243, 234, 212, 0.28); }
.go {
  background: linear-gradient(180deg, #e6c37a, #b8893e);
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  font-size: 12px;
  font-weight: 600;
}
.search-hint {
  min-height: 1.2em;
  margin: 8px 4px 0;
  font-style: italic;
}
.suggest {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 220px;
  overflow: auto;
}
.suggest button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--parchment);
  font-family: var(--serif);
  font-size: 18px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.suggest button:hover, .suggest button[aria-selected="true"] {
  background: rgba(212, 176, 106, 0.12);
  color: var(--gold-bright);
}

.seeds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.seed {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--gold-bright);
  background: rgba(212, 176, 106, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.seed:hover { background: rgba(212, 176, 106, 0.18); }
.text-link {
  display: inline-block;
  margin-top: 16px;
  background: none;
  border: 0;
  color: var(--gold);
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.gate-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
}
a.text-link { color: var(--gold); }
.gate-links a[href^="mailto:"] { overflow-wrap: anywhere; }
.donate-chip {
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold-bright);
  background: rgba(212, 176, 106, 0.10);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.donate-chip:hover {
  border-color: var(--gold);
  color: var(--parchment);
  background: rgba(212, 176, 106, 0.18);
}

.browse {
  position: fixed;
  inset: 0;
  z-index: 11;
  background: rgba(6, 4, 3, 0.55);
  display: grid;
  place-items: center;
  padding: 4vh 4vw;
}
.browse-panel {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.browse-head, .reader-top { display: block; }
.browse-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.browse-head h2, .reader h2, .dialog h2 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 16px;
  margin: 0;
  color: var(--gold-bright);
}
.browse-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 10px;
}
.browse h3, .nums-pane h3 {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 16px 0 10px;
}
.book-grid, .num-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 6px;
}
.book-grid button, .num-grid button {
  background: rgba(255, 236, 200, 0.04);
  border: 1px solid rgba(212, 176, 106, 0.18);
  color: var(--parchment);
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.num-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
.num-grid button {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
}
.book-grid button:hover, .num-grid button:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.reader {
  position: fixed;
  z-index: 6;
  top: 78px;
  right: 22px;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 130px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.reader-toolbar {
  position: sticky;
  top: -22px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 28px;
  margin: 0 0 2px;
  padding: 4px 0 8px;
  background: var(--panel);
}
.reader-toolbar .text-link {
  margin-top: 0;
  margin-right: auto;
}
.reader-toggle,
#printBtn {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 10px;
  letter-spacing: 0.16em;
}
.reader .reader-kicker { margin: 4px 0 0; }
.reader h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gold-bright);
  margin: 4px 0 12px;
  font-weight: 600;
}
.reader.is-min {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  max-height: none;
  overflow: hidden;
  padding: 10px 12px 10px 16px;
  cursor: pointer;
}
.reader.is-min .reader-toolbar {
  display: contents;
}
.reader.is-min #backBtn {
  order: 0;
  flex: 0 0 auto;
  margin: 0;
  font-family: var(--display);
  font-style: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--gold-bright);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
}
.reader.is-min #printBtn {
  order: 2;
}
.reader.is-min .reader-toggle {
  order: 3;
}
.reader.is-min .reader-kicker,
.reader.is-min .reader-body { display: none; }
.reader.is-min h2 {
  order: 1;
  flex: 1;
  min-width: 0;
  font-size: 20px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scripture {
  margin: 0;
  font-size: 22px;
  line-height: 1.4;
  color: var(--parchment);
  font-style: italic;
}
.verse-cite {
  margin: 10px 0 0;
  font-family: var(--display);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
}
.source-cite {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(212, 176, 106, 0.55);
}
.source-cite:hover {
  color: var(--gold-bright);
  text-decoration-color: currentColor;
}
.reader-note { margin: 10px 0 0; }
.stats { margin: 14px 0 4px; letter-spacing: 0.04em; }
.depths { margin-top: 8px; }
.depth-block h3 {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.depth-block h3 .swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.verse-list { display: flex; flex-wrap: wrap; gap: 6px; }
.verse-chip {
  background: rgba(255, 236, 200, 0.05);
  border: 1px solid rgba(212, 176, 106, 0.2);
  color: var(--parchment);
  font-family: var(--serif);
  font-size: 14px;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.verse-chip:hover { border-color: var(--gold); color: var(--gold-bright); }
.verse-chip.is-woc {
  border-color: #e53935;
  box-shadow: 0 0 0 1px #e53935, 0 0 8px rgba(229, 57, 53, 0.45);
}
.verse-chip.is-woc:hover {
  border-color: #e53935;
  color: var(--gold-bright);
}

.depth-dock {
  position: fixed;
  z-index: 7;
  left: 24px;
  bottom: 168px;
  pointer-events: auto;
}
.depth-dock-label {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 8px;
}
.depth-btns { display: flex; gap: 6px; }
.depth-btn {
  font-family: var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold-bright);
  background: rgba(18, 12, 8, 0.62);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  min-width: 64px;
}
.depth-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--parchment); }
.depth-btn.is-on {
  background: linear-gradient(180deg, #e6c37a, #b8893e);
  color: var(--ink);
  border-color: transparent;
  font-weight: 600;
}
.depth-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.legend, .hint, .prune {
  position: fixed;
  z-index: 6;
  pointer-events: none;
}
.legend {
  left: 24px;
  bottom: 86px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--parchment-dim);
}
.legend span { display: flex; align-items: center; gap: 8px; }
.swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.s0 { background: var(--d0); color: var(--d0); }
.s1 { background: var(--d1); color: var(--d1); }
.s2 { background: var(--d2); color: var(--d2); }
.s3 { background: var(--d3); color: var(--d3); }
.s-woc {
  background: var(--d1);
  color: #e53935;
  box-shadow: 0 0 0 2px #e53935, 0 0 8px #e53935;
}
.hint {
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px #000;
}
.prune {
  left: 24px;
  bottom: 22px;
  margin: 0;
  max-width: 420px;
}

.settings-panel {
  max-width: 560px;
  margin: 0 auto;
}
.settings-panel p {
  font-size: 17px;
  line-height: 1.45;
  color: var(--parchment-dim);
}
.settings-panel code { color: var(--gold-bright); }
.settings-actions { margin-top: 16px; display: flex; justify-content: flex-end; }

.colophon {
  position: fixed;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 8px 16px 10px;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  color: rgba(201, 184, 150, 0.55);
  pointer-events: none;
}
.colophon a { color: rgba(212, 176, 106, 0.8); pointer-events: auto; }
body.is-exploring .colophon { opacity: 0; pointer-events: none; }

.verse-peek {
  position: fixed;
  z-index: 8;
  width: min(300px, calc(100vw - 24px));
  padding: 14px 16px 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.verse-peek.is-woc {
  border-color: #e53935;
  box-shadow: var(--shadow), 0 0 0 1px #e53935, 0 0 12px rgba(229, 57, 53, 0.4);
}
.verse-peek-ref {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--gold-bright);
  margin: 0 0 6px;
  font-weight: 600;
}
.verse-peek-text {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.35;
  color: var(--parchment);
  font-style: italic;
}
.verse-peek-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}
.verse-peek .go {
  padding: 8px 14px;
  font-size: 10px;
}
.verse-peek .icon-btn {
  padding: 6px 12px;
  font-size: 10px;
}

.graph-tooltip {
  font-family: var(--serif) !important;
  background: rgba(16, 11, 8, 0.92) !important;
  border: 1px solid rgba(212, 176, 106, 0.35);
  color: var(--parchment) !important;
  padding: 8px 12px !important;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.graph-tooltip .tip-ref { color: var(--gold-bright); font-style: italic; font-size: 16px; }
.graph-tooltip .tip-text { display: block; max-width: 260px; font-size: 14px; opacity: 0.85; }

@media (max-width: 980px) {
  .mast { padding: 12px 14px; }
  .mast-actions { gap: 6px; max-width: 62%; }
  .badge { letter-spacing: 0.08em; padding: 5px 7px 4px; font-size: 9px; }
  .brand-name { letter-spacing: 0.12em; font-size: 12px; }
  .gate {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 108px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  }
  .gate-spacer { display: none; }
  .gate-card { justify-self: stretch; max-width: none; padding: 24px 18px 18px; }
  .gate-close { top: 12px; right: 12px; }
  .browse-cols { grid-template-columns: 1fr; }
  .reader {
    top: auto;
    right: 10px;
    left: 10px;
    bottom: 42px;
    width: auto;
    max-height: 32vh;
  }
  .reader-toggle,
  #printBtn,
  .reader.is-min #backBtn {
    min-height: 36px;
    min-width: 64px;
  }
  .reader.is-min {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: none;
  }
  .legend { display: none; }
  .depth-dock { left: 12px; bottom: calc(32vh + 56px); }
  body.is-reader-min .depth-dock {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  body.is-reader-min .hint { display: none; }
  .depth-btn { min-width: 56px; padding: 7px 10px; }
  .hint { font-size: 12px; bottom: 8px; }
  .prune { display: none; }
  .model-note { left: 12px; right: 12px; max-width: none; bottom: 8px; }
  .mast-model .badge { letter-spacing: 0.06em; padding: 5px 7px 4px; font-size: 9px; }
  .colophon { display: none; }
}

.print-sheet { display: none !important; }

@media print {
  html:has(body.is-printing),
  body.is-printing {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
    color: #1a140e !important;
    color-scheme: light;
  }
  body.is-printing .atmosphere,
  body.is-printing .graph,
  body.is-printing .mast,
  body.is-printing .skip,
  body.is-printing .load-gate,
  body.is-printing .gate,
  body.is-printing .browse,
  body.is-printing .reader,
  body.is-printing .depth-dock,
  body.is-printing .legend,
  body.is-printing .hint,
  body.is-printing .prune,
  body.is-printing .model-note,
  body.is-printing .colophon,
  body.is-printing .graph-tooltip,
  body.is-printing .verse-peek {
    display: none !important;
  }
  body.is-printing .print-sheet {
    display: block !important;
    position: static;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    color: #1a140e;
    background: #fff;
    font-family: var(--serif);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12pt;
    margin: 0 0 8pt;
    padding: 0 0 6pt;
    border-bottom: 1pt solid #c9b896;
  }
  .print-brand,
  .print-kicker,
  .print-cite,
  .print-stats,
  .print-foot {
    font-family: var(--display);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 8.5pt;
    margin: 0;
    color: #6b4e1f;
  }
  .print-site {
    font-family: var(--display);
    font-size: 8.5pt;
    margin: 0;
    color: #6b4e1f;
    letter-spacing: 0.06em;
    text-transform: none;
  }
  .print-ref {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 600;
    font-size: 22pt;
    letter-spacing: 0;
    text-transform: none;
    color: #3d2a10;
    margin: 8pt 0 12pt;
  }
  .print-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14pt;
  }
  .print-figure {
    margin: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .print-figure img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 9.2in;
    object-fit: contain;
    background: #090705;
    border-radius: 6pt;
  }
  .print-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8pt 14pt;
    margin: 8pt 0 0;
    font-size: 9pt;
    color: #3d2a10;
  }
  .print-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5pt;
  }
  .print-legend .swatch,
  .print-depth-block h3 .swatch {
    width: 8pt;
    height: 8pt;
    border-radius: 50%;
    display: inline-block;
  }
  .print-legend .s0,
  .print-legend .s1,
  .print-legend .s2,
  .print-legend .s3,
  .print-depth-block h3 .swatch {
    box-shadow: 0 0 0 0.6pt #8a7350;
  }
  .print-kicker { margin: 0 0 4pt; }
  .print-scripture {
    margin: 0;
    font-size: 13pt;
    line-height: 1.4;
    font-style: italic;
    color: #1a140e;
  }
  .print-cite { margin: 6pt 0 0; }
  .print-note,
  .print-prune,
  .print-more {
    margin: 8pt 0 0;
    font-size: 10pt;
    color: #5a4a38;
  }
  .print-stats { margin: 10pt 0 0; letter-spacing: 0.04em; }
  .print-depth-block h3 {
    font-family: var(--display);
    font-size: 8.5pt;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6b4e1f;
    margin: 12pt 0 6pt;
    display: flex;
    align-items: center;
    gap: 6pt;
  }
  .print-verse-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5pt;
  }
  .print-chip {
    display: inline-block;
    border: 0.6pt solid #c9b896;
    border-radius: 999px;
    padding: 1.5pt 7pt;
    font-size: 10pt;
    color: #1a140e;
  }
  .print-chip.is-woc {
    border-color: #e53935;
    box-shadow: 0 0 0 0.6pt #e53935;
  }
  .print-foot {
    margin: 16pt 0 0;
    padding: 8pt 0 0;
    border-top: 1pt solid #c9b896;
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 8pt;
    line-height: 1.45;
    color: #5a4a38;
  }
  .print-foot p { margin: 0 0 4pt; }
  @page { margin: 0.45in; }
}

@media print and (orientation: landscape) {
  body.is-printing .print-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: start;
  }
  body.is-printing .print-figure img { max-height: 7.4in; }
}

@media (prefers-reduced-motion: reduce) {
  .spin-ring { animation: none; }
  .atmosphere, .graph { transition: none; }
  html:has(body.legal) { scroll-behavior: auto; }
}

html:has(body.legal) {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}
body.legal {
  overflow: visible;
  height: auto;
  min-height: 100%;
  padding-bottom: 45vh;
}
body.legal .legal-doc {
  position: relative;
  z-index: 2;
  width: min(720px, calc(100% - 32px));
  margin: 96px auto 48px;
  padding: 36px 36px 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
body.legal .legal-doc h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: var(--parchment);
  margin: 8px 0 18px;
}
body.legal .legal-doc h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin: 28px 0 10px;
  scroll-margin-top: 96px;
}
body.legal .legal-doc p {
  font-size: 19px;
  line-height: 1.6;
  color: var(--parchment-dim);
  margin: 0 0 12px;
}
body.legal .legal-doc a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.legal .legal-doc a:hover { color: var(--gold-bright); }
body.legal .colophon {
  position: static;
  display: block;
  opacity: 1;
  pointer-events: auto;
  padding: 8px 16px 36px;
  font-size: 13px;
  color: var(--parchment-dim);
}
@media (max-width: 980px) {
  body.legal .legal-doc {
    margin-top: 88px;
    padding: 24px 18px 28px;
  }
  body.legal .colophon { display: block; }
}
