:root {
  --paper: #f4f0e8;
  --paper-deep: #e9e2d5;
  --ink: #1e2a24;
  --muted: #747a73;
  --sage: #66796b;
  --sage-dark: #344a3e;
  --gold: #ad7e36;
  --line: #aaa99e;
  --white: #fffdfa;
  --card-width: 112px;
  --row-height: 142px;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { color: inherit; font: inherit; }

.mobile-close { display: none; }
.mobile-tree-hint,
.mobile-lineage-status { display: none; }

main {
  height: 100vh;
  height: 100dvh;
  padding: clamp(20px, 3vh, 34px) clamp(12px, 3vw, 44px) clamp(12px, 2vh, 24px);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.2vh, 24px);
}

.intro {
  flex: 0 0 auto;
  text-align: center;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font: 500 clamp(34px, 4.5vw, 52px)/1 "Newsreader", serif;
  letter-spacing: -.035em;
}

h1 em { color: var(--sage); font-weight: 400; }

.tree-shell {
  min-height: 0;
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: rgba(255, 253, 250, .64);
  border: 1px solid rgba(52, 74, 62, .14);
  border-radius: 14px;
}

.zoom-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 40;
  display: flex;
  overflow: hidden;
  background: rgba(255, 253, 250, .94);
  border: 1px solid rgba(52, 74, 62, .2);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(43, 54, 47, .06);
}

.zoom-controls button {
  width: 34px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.zoom-controls button + button { border-left: 1px solid rgba(52, 74, 62, .14); }
.zoom-controls button:hover:not(:disabled) { background: var(--paper-deep); }
.zoom-controls button:focus-visible { position: relative; outline: 2px solid var(--gold); outline-offset: -3px; }
.zoom-controls button:disabled { color: #a9aca7; cursor: default; }

.tree-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  outline: none;
  background-image: radial-gradient(rgba(52, 74, 62, .12) .65px, transparent .65px);
  background-size: 17px 17px;
}

.tree-viewport:focus-visible { box-shadow: inset 0 0 0 2px rgba(183, 139, 69, .55); }

.tree-stage {
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  transform-origin: top center;
  transition: top .68s cubic-bezier(.16, 1, .3, 1), transform .68s cubic-bezier(.16, 1, .3, 1);
}

.generation {
  width: 100%;
  height: var(--row-height);
  flex: 0 0 var(--row-height);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.generation.has-secondary {
  height: 210px;
  flex-basis: 210px;
}

.generation-title {
  min-height: 17px;
  margin: 0 0 9px;
  padding: 3px 9px;
  position: relative;
  z-index: 3;
  color: #848982;
  background: rgba(255, 253, 250, .96);
  border-radius: 20px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .17em;
  line-height: 1.35;
  text-transform: uppercase;
}

.people-row {
  --row-card-width: var(--card-width);
  width: max-content;
  padding: 0;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
}

.people-row::before {
  content: "";
  position: absolute;
  top: 24px;
  left: calc(var(--row-card-width) / 2);
  right: calc(var(--row-card-width) / 2);
  z-index: 0;
  border-top: 1px solid var(--line);
}

.people-row[data-count="1"]::before { display: none; }

.generation::before {
  content: "";
  width: 1px;
  height: var(--row-height);
  position: absolute;
  top: calc(-1 * var(--row-height) + 50px);
  left: 50%;
  z-index: 0;
  background: var(--line);
}

.generation:first-of-type::before { display: none; }

.primary-people-row { gap: 18px; }

.minor-people-row {
  width: 980px;
  margin: 7px auto 0;
  padding: 8px 10px;
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  background: rgba(244, 240, 232, .82);
  border: 1px solid rgba(52, 74, 62, .1);
  border-radius: 10px;
}

.minor-row-title { display: none; }

.person {
  width: var(--card-width);
  flex: 0 0 var(--card-width);
  position: relative;
  z-index: 1;
  padding: 0;
  overflow: visible;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: center;
  transition: opacity .2s, transform .2s cubic-bezier(.22, .85, .32, 1);
}

.person-details {
  width: 100%;
  padding: 0;
  display: block;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: center;
}

.avatar {
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0 auto 6px;
  display: grid;
  place-items: center;
  position: relative;
  color: var(--sage-dark);
  background: var(--white);
  border: 1px solid #aaa99e;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(43, 54, 47, .07);
  transition: transform .2s, border-color .2s, box-shadow .2s;
  cursor: pointer;
}

.person:hover .avatar,
.person:focus-within .avatar {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 6px 14px rgba(43, 54, 47, .13);
}

.avatar:focus-visible,
.person-details:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.person.is-uncertain .avatar {
  border: 2px dotted #777d77;
  box-shadow: none;
}

.person.is-uncertain:hover .avatar,
.person.is-uncertain:focus-within .avatar { border-color: var(--gold); }

.person.is-focus .avatar {
  width: 54px;
  height: 54px;
  margin-bottom: 0;
  color: var(--white);
  background: var(--sage-dark);
  border: 3px solid var(--white);
  outline: 1px solid var(--gold);
}

.person-symbol {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: visible;
  font: 500 21px/1 "DM Sans", "Arial Unicode MS", sans-serif;
}

.person-symbol.male { color: #4f7fa8; }
.person-symbol.female { color: #c06f87; }
.person-symbol.mixed { color: var(--gold); font-size: 13px; }
.person.is-focus .person-symbol { color: #fff; }

.crown,
.featured-star {
  position: absolute;
  display: grid;
  place-items: center;
  border: 2px solid var(--white);
  border-radius: 50%;
  line-height: 1;
}

.crown {
  width: 19px;
  height: 19px;
  top: -7px;
  right: -3px;
  color: #76511b;
  background: #f2dcae;
  font-size: 10px;
}

.featured-star {
  width: 18px;
  height: 18px;
  top: -7px;
  left: -3px;
  color: #fff;
  background: var(--gold);
  font: 600 8px/1 "DM Sans", sans-serif;
  box-shadow: 0 2px 5px rgba(75, 55, 25, .14);
}

.person-name {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 1px 4px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  overflow: hidden;
  color: var(--ink);
  background: rgba(249, 247, 241, .82);
  border-radius: 3px;
  font: 500 14px/1.15 "Newsreader", serif;
  overflow-wrap: anywhere;
  white-space: normal;
}

.person-name-text { min-width: 0; overflow-wrap: anywhere; }

.order-badge {
  min-width: 21px;
  height: 16px;
  padding: 0 4px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #4d7193;
  background: #e1ebf3;
  border: 1px solid #bfd1e0;
  border-radius: 9px;
  font: 600 8px/1 "DM Sans", sans-serif;
}

.order-badge.reference { color: #fff; background: var(--gold); border-color: var(--gold); }

.person-role {
  width: fit-content;
  max-width: 100%;
  margin: 3px auto 0;
  padding: 1px 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
  color: #888d86;
  background: rgba(249, 247, 241, .8);
  border-radius: 3px;
  font-size: 7.5px;
  letter-spacing: .055em;
  line-height: 1.2;
  text-transform: uppercase;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

.person-role > span:not(.role-separator) { max-width: 100%; }
.person-role.has-separator > span:not(.role-separator) { white-space: nowrap; }

.role-separator {
  color: #3f4a44;
  font-size: 12px;
  font-weight: 600;
  line-height: .5;
}

.minor-person {
  width: auto;
  min-width: 104px;
  height: 28px;
  padding: 3px 8px 3px 4px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 253, 250, .9);
  border: 1px solid rgba(52, 74, 62, .14);
  border-radius: 16px;
}

.minor-person .avatar {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 20px;
  box-shadow: none;
}

.minor-person .person-symbol { font-size: 10px; }
.minor-person .person-details { min-width: 0; width: auto; flex: 1 1 auto; }
.minor-person .person-name { max-width: none; gap: 6px; font: 500 11px/1 "Newsreader", serif; }
.minor-person .order-badge { min-width: 18px; height: 15px; padding: 0 3px; font-size: 7px; }
.minor-person:hover .avatar,
.minor-person:focus-within .avatar { transform: none; }

.moving-position { transition: opacity .25s, transform .2s; }
.moving-position::after {
  content: "";
  width: 19px;
  height: 19px;
  position: absolute;
  top: 16px;
  left: 50%;
  border: 2px dotted var(--gold);
  border-radius: 50%;
  opacity: 0;
  transform: translateX(-50%) scale(.65);
  transition: opacity .25s .1s, transform .3s .1s;
}
.moving-position:not(.at-origin) .avatar,
.moving-position:not(.at-origin) .person-name,
.moving-position:not(.at-origin) .person-role { opacity: 0; transform: scale(.65); pointer-events: none; }
.moving-position:not(.at-origin)::after { opacity: 1; transform: translateX(-50%) scale(1); }
.moving-position:not(.at-origin) { cursor: default; pointer-events: none; }
.away-at-origin { opacity: 0; pointer-events: none; }
.bounce-down { animation: mover-bounce-down .7s cubic-bezier(.2, .75, .3, 1) both; }
.bounce-up { animation: mover-bounce-up .7s cubic-bezier(.2, .75, .3, 1) both; }
@keyframes mover-bounce-down {
  0% { opacity: 1; transform: translateY(calc(-1 * var(--mover-distance))) scale(.9); }
  65% { opacity: 1; transform: translateY(8px) scale(1.03); }
  82% { transform: translateY(-4px) scale(.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes mover-bounce-up {
  0% { opacity: 1; transform: translateY(var(--mover-distance)) scale(.9); }
  65% { opacity: 1; transform: translateY(-8px) scale(1.03); }
  82% { transform: translateY(4px) scale(.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.hover-preview {
  width: 225px;
  position: fixed;
  z-index: 1000;
  padding: 14px;
  visibility: hidden;
  opacity: 0;
  color: var(--white);
  background: rgba(30, 42, 36, .82);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(20, 26, 22, .16);
  transform: translateY(-5px);
  transition: opacity .18s, transform .18s, visibility .18s;
  text-align: left;
  pointer-events: none;
  backdrop-filter: blur(3px);
}

.hover-preview::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: var(--pointer-x, 50%);
  border: 6px solid transparent;
  border-bottom-color: rgba(30, 42, 36, .82);
  transform: translateX(-50%);
}

.hover-preview.visible { visibility: visible; opacity: 1; transform: translateY(0); }
.person.has-parents { transition: opacity .2s, transform .2s cubic-bezier(.22, .85, .32, 1); }
.person.has-parents:hover,
.person.has-parents:focus-visible { z-index: 25; transform: translateY(-5px); }
.person.related-parent .avatar { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(183, 139, 69, .14); }
.hover-preview strong { display: block; margin-bottom: 5px; font: 500 16px "Newsreader", serif; }
.parent-note { display: block; margin: -1px 0 8px; color: #e4bd78; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.hover-preview p { margin: 0 0 8px; color: #d3d6d1; font-size: 11px; line-height: 1.5; }
.hover-preview small { color: #e4bd78; font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }

.relationship-lines {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 12;
  overflow: visible;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.relationship-lines.visible { opacity: 1; }
.relationship-lines path { fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 5; stroke-linecap: round; }

.detail-panel {
  width: min(480px, 94vw);
  height: 100%;
  padding: 32px;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 101;
  overflow-y: auto;
  background: var(--white);
  box-shadow: -20px 0 60px rgba(25, 33, 28, .16);
  transform: translateX(105%);
  transition: transform .35s cubic-bezier(.22, .85, .32, 1);
}

.detail-panel.open { transform: translateX(0); }
.panel-backdrop { position: fixed; inset: 0; z-index: 100; visibility: hidden; opacity: 0; background: rgba(30, 42, 36, .22); transition: .3s; backdrop-filter: blur(2px); }
.panel-backdrop.open { visibility: visible; opacity: 1; }
.panel-kicker { margin: 18px 0 10px; color: var(--gold); font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.panel-name { margin: 0; font: 500 42px/1 "Newsreader", serif; }
.panel-relation { margin: 8px 0 28px; color: var(--muted); font: 400 17px "Newsreader", serif; }
.panel-bio { padding: 22px 0; border-block: 1px solid #e2ded5; font: 400 17px/1.65 "Newsreader", serif; }
.verse-heading { margin: 25px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.verse-title { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.translation-label { color: var(--gold); font-size: 9px; font-weight: 600; letter-spacing: .08em; text-align: right; text-transform: uppercase; }
.verse { margin-bottom: 10px; padding: 14px; background: var(--paper); border-radius: 9px; }
.verse strong { display: block; margin-bottom: 4px; color: var(--sage-dark); font-size: 11px; }
.verse span { color: var(--muted); font: 400 13px/1.5 "Newsreader", serif; }

.passage-list { display: grid; gap: 10px; }
.passage-loading,
.passage-error { margin: 0; padding: 16px; color: var(--muted); background: var(--paper); border-radius: 3px; font: 400 14px/1.55 "Newsreader", serif; }
.passage-error { color: #81513f; background: #f7ece6; }

.passage-card {
  height: 90px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--white);
  border: 1px solid #dedad2;
  border-radius: 3px;
}

.passage-heading {
  padding: 8px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f7f4ee;
  border-bottom: 1px solid #e1dcd2;
}

.passage-heading-title { min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.passage-heading-title strong { overflow: hidden; color: var(--sage-dark); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.passage-heading-title > span { flex: 0 0 auto; color: var(--sage-dark); font-family: inherit; font-size: 12px; font-weight: 500; }

.passage-preview {
  min-height: 0;
  padding: 9px 11px 6px;
  position: relative;
  overflow: hidden;
  color: inherit;
  background: var(--white);
  border: 0;
  cursor: pointer;
  text-align: left;
}

.passage-preview:hover { background: #f8f4eb; }
.passage-preview:focus-visible { z-index: 1; outline: 2px solid var(--gold); outline-offset: -3px; }
.passage-snippet { margin: 0; display: grid; grid-template-columns: 23px minmax(0, 1fr); gap: 5px; }
.passage-snippet sup { padding-top: 3px; color: var(--gold); font: 600 9px/1 "DM Sans", sans-serif; text-align: right; }
.passage-snippet span {
  display: -webkit-box;
  overflow: hidden;
  color: #333d37;
  font: 400 14px/1.4 "Newsreader", serif;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.bible-gateway-link {
  padding: 2px 0;
  flex: 0 0 auto;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid #bbb5aa;
  border-radius: 0;
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.bible-gateway-link:hover { color: var(--sage-dark); border-color: var(--sage-dark); }
.bible-gateway-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.passage-verse {
  margin: 0 0 10px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 5px;
  color: #333d37;
  font: 400 15px/1.55 "Newsreader", serif;
}

.passage-verse sup {
  padding-top: 3px;
  color: var(--gold);
  font: 600 9px/1 "DM Sans", sans-serif;
  text-align: right;
}

.passage-reader-backdrop {
  padding: 16px;
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  opacity: 0;
  display: grid;
  place-items: center;
  background: rgba(24, 32, 27, .52);
  backdrop-filter: blur(5px);
  transition: opacity .22s, visibility .22s;
}

.passage-reader-backdrop.open { visibility: visible; opacity: 1; }
.passage-reader {
  width: min(720px, 100%);
  max-height: min(850px, 88vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid rgba(52, 74, 62, .18);
  border-radius: 5px;
  box-shadow: 0 22px 60px rgba(18, 25, 21, .22);
  transform: translateY(10px) scale(.985);
  transition: transform .24s cubic-bezier(.22, .85, .32, 1);
}

.passage-reader-backdrop.open .passage-reader { transform: translateY(0) scale(1); }
.passage-reader-header { padding: 20px 24px 17px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #e1dcd2; }
.passage-reader-header p { margin: 0 0 5px; color: var(--gold); font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.passage-reader-header h2 { margin: 0; color: var(--sage-dark); font: 500 30px/1 "Newsreader", serif; }
.passage-reader-actions { display: flex; align-items: center; gap: 12px; }
.passage-reader-gateway { padding: 3px 0; color: var(--muted); border-bottom: 1px solid #bbb5aa; font-size: 8px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; }
.passage-reader-gateway:hover { color: var(--sage-dark); border-color: var(--sage-dark); }
.passage-reader-gateway:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.passage-reader-content { min-height: 0; padding: 24px clamp(20px, 6vw, 52px) 30px; overflow-y: auto; scroll-behavior: smooth; }
.passage-reader-content .full-chapter { max-width: 590px; margin-inline: auto; }
.full-chapter + .full-chapter { margin-top: 22px; padding-top: 18px; border-top: 1px solid #e1dcd2; }
.full-chapter h4 { margin: 0 0 14px 29px; color: var(--sage-dark); font: 500 18px/1 "Newsreader", serif; }
.full-chapter .passage-verse { margin-inline: -4px; padding: 2px 4px; border-radius: 4px; }
.full-chapter .passage-verse.is-cited { background: #f5eddd; }
.sr-only { width: 1px; height: 1px; padding: 0; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  :root {
    --card-width: 72px;
  }

  main { padding: 12px 6px 6px; gap: 8px; }
  .eyebrow { margin-bottom: 3px; font-size: 8px; }
  h1 { font-size: clamp(28px, 9vw, 36px); }
  .mobile-tree-hint { margin: 5px 0 0; display: block; color: var(--muted); font-size: 8px; }
  .tree-shell { border-radius: 11px; }
  .zoom-controls { display: none; }
  .hover-preview { display: none; }

  .tree-viewport {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .tree-stage {
    position: relative;
    top: 0;
    padding: 10px 0 24px;
    transform: none;
    transition: none;
  }

  .generation,
  .generation.has-secondary,
  .generation.is-wide-generation,
  .generation.is-wide-generation.has-secondary {
    height: auto;
    min-height: 105px;
    padding: 0 3px 16px;
    flex: 0 0 auto;
    border-bottom: 1px dotted rgba(52, 74, 62, .38);
  }

  .generation + .generation { padding-top: 12px; }
  .generation:last-of-type { border-bottom: 0; }
  .generation::before { display: none; }
  .generation-title { margin-bottom: 7px; font-size: 7px; }

  .people-row,
  .people-row.is-wide {
    --row-card-width: var(--card-width);
    width: calc(100% - 8px);
    padding: 0;
    flex-wrap: wrap;
    gap: 9px 6px;
    background: none;
  }

  .people-row::before,
  .people-row.is-wide::after { display: none; }
  .primary-people-row { gap: 9px 6px; }

  .person { width: var(--card-width); flex-basis: var(--card-width); }
  .avatar { width: 36px; height: 36px; margin-bottom: 4px; }
  .person.is-focus .avatar { width: 40px; height: 40px; }
  .person-symbol { font-size: 17px; }
  .person-name {
    padding-inline: 2px;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
  }
  .person-name-text { overflow-wrap: normal; word-break: normal; }
  .person-role {
    margin-top: 3px;
    overflow-wrap: normal;
    word-break: normal;
    font-size: 6.5px;
    letter-spacing: .025em;
  }
  .person-role.has-separator { width: 100%; flex-direction: column; gap: 1px; }
  .person-role.has-separator > span:not(.role-separator) { width: 100%; white-space: normal; }
  .person-role .role-separator { display: none; }
  .order-badge { min-width: 18px; height: 14px; padding-inline: 3px; font-size: 7px; }
  .crown { width: 17px; height: 17px; }
  .featured-star { width: 16px; height: 16px; }
  .moving-position { display: none; }

  .tree-stage.has-lineage .person:not(.lineage-selected):not(.related-parent) { opacity: .28; }
  .tree-stage.has-lineage .person.lineage-selected,
  .tree-stage.has-lineage .person.related-parent { opacity: 1; }
  .person.lineage-selected .avatar { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(183, 139, 69, .2); }

  .mobile-lineage-status:not([hidden]) {
    max-width: calc(100% - 16px);
    min-height: 46px;
    padding: 7px 7px 7px 11px;
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    background: rgba(30, 42, 36, .94);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 5px;
    box-shadow: 0 7px 20px rgba(20, 26, 22, .2);
    transform: translateX(-50%);
  }

  #lineageSummary { min-width: 0; line-height: 1.25; }
  #lineageSummary > strong { display: block; color: #e4bd78; font: 500 13px/1.2 "Newsreader", serif; }
  #lineageSummary > span { display: block; margin-top: 2px; color: #d3d6d1; font-size: 9px; }
  #lineageSummary button {
    padding: 0;
    color: var(--white);
    background: none;
    border: 0;
    border-bottom: 1px dotted #e4bd78;
    cursor: pointer;
    font-weight: 600;
  }
  #lineageSummary button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
  .lineage-unknown { color: #c3c8c3; }
  .lineage-clear {
    width: 30px;
    height: 30px;
    padding: 0;
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    color: var(--white);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
  }
  .lineage-clear:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

  .minor-people-row {
    width: calc(100% - 12px);
    margin: 12px auto 0;
    padding: 9px;
    gap: 6px;
    justify-content: flex-start;
    background: rgba(244, 240, 232, .72);
    border-style: dotted;
  }

  .minor-row-title {
    width: 100%;
    margin-bottom: 1px;
    display: block;
    color: var(--muted);
    font-size: 7px;
    font-weight: 600;
    letter-spacing: .13em;
    text-align: center;
    text-transform: uppercase;
  }

  .minor-person {
    width: calc(50% - 3px);
    min-width: 0;
    height: auto;
    min-height: 28px;
    padding-right: 5px;
    flex: 0 1 calc(50% - 3px);
  }

  .minor-person .person-name {
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    text-align: left;
  }

  .mobile-close {
    width: 32px;
    height: 32px;
    padding: 0;
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid rgba(52, 74, 62, .2);
    border-radius: 3px;
    cursor: pointer;
    font: 500 16px/1 "DM Sans", sans-serif;
  }

  .mobile-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
  .detail-panel { width: 100%; padding: 14px 16px 24px; overflow-x: hidden; }
  .detail-close { position: sticky; top: 0; z-index: 2; margin-left: auto; }
  .panel-kicker { margin-top: 4px; }
  .panel-name { font-size: 36px; overflow-wrap: anywhere; }
  .panel-relation { margin-bottom: 20px; }
  .panel-bio { padding-block: 18px; }
  .verse-heading { align-items: flex-start; flex-wrap: wrap; gap: 6px 12px; }
  .translation-label { text-align: left; }
  .passage-heading { align-items: flex-start; flex-wrap: wrap; gap: 6px; }
  .passage-heading-title { max-width: 100%; flex-wrap: wrap; }
  .passage-heading-title strong { white-space: normal; overflow-wrap: anywhere; }

  .passage-reader-backdrop { padding: 8px; }
  .passage-reader { height: calc(100dvh - 16px); max-height: none; border-radius: 4px; }
  .passage-reader-header { padding: 14px; align-items: flex-start; gap: 10px; }
  .passage-reader-header > div:first-child { min-width: 0; }
  .passage-reader-header h2 { font-size: 26px; }
  .passage-reader-actions { flex: 0 0 auto; align-items: flex-start; gap: 9px; }
  .passage-reader-gateway { margin-top: 10px; }
  .passage-reader-content { padding: 20px 18px 26px; }
}

@media (max-height: 680px) {
  main { padding-top: 12px; gap: 10px; }
  .eyebrow { margin-bottom: 4px; }
  h1 { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .tree-stage,
  .detail-panel,
  .passage-reader,
  .passage-reader-backdrop,
  .avatar { transition: none; }
}
