:root {
  color-scheme: dark;
  --bg: #101c16;
  --surface: #1b2c22;
  --raised: #293f32;
  --ink: #eeeadd;
  --muted: #c6c8b2;
  --gold: #d6ae50;
  --line: #788668;
  --shadow: 0 16px 38px #0003;
  font-family: "EB Garamond", "Libre Caslon Text", Georgia, serif;
  font-size: 18px;
  background: var(--bg);
  color: var(--ink);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5efdf;
  --surface: #fcf8ed;
  --raised: #ebe5d3;
  --ink: #24392c;
  --muted: #53634e;
  --gold: #805b12;
  --line: #8b8c70;
  --shadow: 0 16px 38px #354c2116;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button,
.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
  padding: 11px 16px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover,
.button:hover {
  border-color: var(--gold);
  background: var(--surface);
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button.primary {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
  font-weight: 700;
}
a {
  color: var(--gold);
  text-underline-offset: 4px;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
::selection {
  background: var(--gold);
  color: var(--bg);
}
input,
select,
textarea {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  max-width: 100%;
  caret-color: var(--gold);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
header {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 15px 24px;
  border-bottom: 1px solid var(--line);
  min-height: 82px;
  flex-wrap: wrap;
}
.brand img {
  width: 190px;
  display: block;
}
.tree-picker {
  flex: 1;
  min-width: 160px;
  max-width: 330px;
}
.tree-picker select {
  width: 100%;
}
nav {
  display: flex;
  gap: 5px;
  align-items: center;
}
nav a {
  padding: 12px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
nav a[aria-current="page"] {
  border-color: var(--gold);
}
.old-ui {
  font-size: 14px;
}
#credits {
  font-size: 15px;
  color: var(--muted);
}
#notice {
  min-height: 0;
  padding: 0 24px;
  background: var(--raised);
  line-height: 1.5;
}
#notice:not(:empty) {
  padding: 14px 24px;
  border-bottom: 1px solid var(--gold);
}
#notice.error {
  color: #ffcbba;
}
#notice.error button {
  margin-left: 14px;
}
[data-theme="light"] #notice.error {
  color: #8e2819;
}
#workspace {
  display: flex;
  min-height: calc(100dvh - 82px);
}
main {
  flex: 1;
  min-width: 0;
}
h1,
h2,
h3 {
  font-family: Cinzel, Georgia, serif;
  line-height: 1.25;
  font-weight: 500;
  overflow-wrap: anywhere;
}
h1 {
  font-size: 30px;
  margin: 12px 0;
}
h2 {
  font-size: 24px;
  margin: 0 0 18px;
}
h3 {
  font-size: 20px;
  margin: 0 0 12px;
}
p {
  line-height: 1.55;
  max-width: 70ch;
}
small,
.muted {
  color: var(--muted);
  font-size: 15px;
}
.view {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}
.view-top {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
}
.view-top a {
  font-size: 16px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.panel-heading h2 {
  margin: 8px 0;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin: 28px 0 24px;
  overflow: auto;
}
.tabs a {
  padding: 10px 0;
  text-decoration: none;
  white-space: nowrap;
}
.tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 3px solid var(--gold);
}
section {
  margin-top: 28px;
}
.row {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.row:first-child {
  border-top: 1px solid var(--line);
}
.row p {
  margin: 8px 0;
}
.row .actions {
  margin-bottom: 0;
}
.status {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--gold);
  margin: 14px 0;
}
.status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
  margin: 22px 0;
}
.facts dt {
  font-size: 14px;
  color: var(--muted);
}
.facts dd {
  margin: 6px 0;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 24px;
}
.family {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.family a {
  display: block;
  background: var(--raised);
  padding: 18px;
  text-decoration: none;
  border-radius: 8px;
  color: var(--ink);
}
.family small {
  display: block;
  margin-top: 7px;
}
.form {
  max-width: 650px;
}
.form label {
  display: block;
  margin: 18px 0 8px;
}
.form input,
.form select,
.form textarea {
  width: 100%;
}
.finding {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.finding h3 {
  font-size: 22px;
}
.finding details {
  margin: 18px 0;
}
.finding summary {
  cursor: pointer;
  color: var(--gold);
  min-height: 40px;
}
.finding blockquote {
  margin: 12px 0;
  font-family: "EB Garamond", serif;
  font-size: 22px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.saved {
  color: var(--gold);
  font-weight: 600;
}
.empty {
  padding: 32px 0;
  color: var(--muted);
}
.prose {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 23px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.task-summary {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.tree-toolbar {
  display: flex;
  padding: 20px 24px;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.tree-toolbar form {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 500px;
}
.tree-toolbar input {
  min-width: 100px;
  flex: 1;
}
.tree-frame {
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  overscroll-behavior: contain;
  overflow-anchor: none;
  height: calc(100dvh - 175px);
  min-height: 240px;
  position: relative;
  scrollbar-color: var(--line) var(--bg);
}
.tree-frame.is-panning, .tree-frame.is-panning * { cursor: grabbing !important; }
#workspace:has(.tree-frame) { min-height: 0; }
.tree-frame:focus-visible { outline-offset: -3px; }
.canvas-hint { font-family: "IM Fell English", serif; font-size: 16px; font-style: italic; color: var(--muted); }
#zoom-level { min-width: 48px; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 15px; }
.tree-plane {
  position: relative;
  transform-origin: 0 0;
}
.tree-plane svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.tree-plane .register-branches path {
  stroke: var(--line);
  stroke-width: 2;
  fill: none;
}
.person-card {
  position: absolute;
  width: 280px;
  height: 176px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 13px;
  color: var(--ink);
  text-decoration: none;
}
.person-card strong {
  font:
    600 19px Cinzel,
    serif;
}
.person-card span {
  color: var(--gold);
  font-size: 16px;
}
.person-card em {
  font:
    italic 19px "EB Garamond",
    serif;
  color: var(--muted);
}
.person-card.highlight {
  border-color: var(--gold);
  outline: 3px solid var(--gold);
  outline-offset: 5px;
}
.tree-plane .parent-link {
  position: absolute;
  font-size: 14px;
  min-height: 38px;
  padding: 8px;
  color: var(--gold);
  background: var(--bg);
  border: 1px dashed var(--gold);
  border-radius: 6px;
  text-decoration: none;
}
.task-strip {
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 18px;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.task-strip a {
  font-size: 16px;
  flex-shrink: 0;
}
/* One persistent companion, floated above the tree and native parchment modals. */
#archivist-dock {
  position: fixed;
  inset: auto 24px 24px auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  max-width: calc(100vw - 48px);
  color: #4a3320;
  font-family: "IM Fell English", serif;
  --bg: #f5eedc;
  --surface: #f5eedc;
  --raised: #e6dac0;
  --ink: #4a3320;
  --muted: #705940;
  --line: #cdbb95;
  --gold: #8c3b2a;
  color-scheme: light;
}
#chat-launcher {
  color: #f5eedc;
  background: #263e30;
  border: 1px solid #d6ae50;
  border-radius: 28px;
  padding: 10px 20px 10px 12px;
  font-size: 19px;
  box-shadow: 0 8px 24px #101c1633;
}
#chat-launcher:hover { background: #354d3b; }
#archivist-dock svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
#chat-launcher svg { width: 32px; height: 32px; color: #dfbd71; }
#chat {
  width: 420px;
  max-width: 100%;
  height: min(640px, calc(100dvh - 130px));
  min-height: 320px;
  border: 1px solid #bca579;
  border-radius: 14px 14px 5px 5px;
  background: #f5eedc;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 56px #101c1640;
}
#chat[hidden], #chat-launcher[hidden] { display: none; }
#chat .panel-heading {
  padding: 18px 18px 14px;
  gap: 4px;
  background: #263e30;
  color: #f5eedc;
  border-bottom: 1px solid #d6ae50;
  flex-shrink: 0;
}
#chat .panel-heading > div { flex: 1; min-width: 0; }
#chat .panel-heading h2 { font-family: "IM Fell English", serif; color: #f5eedc; font-size: 25px; margin: 0; font-weight: 400; }
#chat .panel-heading p { font-size: 15px; font-style: italic; color: #ded6bf; margin: 5px 0 0; }
#chat .panel-heading button { padding: 8px; min-width: 44px; background: transparent; border-color: transparent; color: #dfbd71; }
#chat .panel-heading button:hover { background: #354d3b; }
.chat-subject { padding: 12px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #d8c9a8; flex-shrink: 0; }
#chat-person { border: 0; background: transparent; padding: 0; min-height: 44px; text-align: left; justify-content: start; flex: 1; }
#chat-person:disabled { cursor: default; opacity: 1; }
#chat-context { color: #4a3320; font-size: 17px; }
.chat-subject label { display: flex; align-items: center; gap: 5px; min-height: 44px; color: #705940; font-size: 14px; cursor: pointer; }
#chat-pin { accent-color: #8c3b2a; margin: 0; width: 16px; height: 16px; }
#messages { flex: 1; min-height: 0; overflow: auto; padding: 0 20px; scrollbar-color: #bca579 #f5eedc; overscroll-behavior: contain; }
.message { padding: 20px 0; border-bottom: 1px solid #d8c9a8; line-height: 1.55; font-size: 18px; overflow-wrap: anywhere; }
.message p { margin: 8px 0; }
.message > strong { display: block; font-family: "Libre Caslon Text", serif; font-size: 13px; color: #8c3b2a; margin-bottom: 10px; }
.message strong:not(:first-child) { display: inline; }
.message.user { color: #705940; font-size: 17px; }
.message.user > strong { color: #705940; }
.message a { color: #76541d; }
.chat-welcome { padding: 32px 6px; text-align: center; }
.chat-welcome h3 { font-size: 25px; font-weight: 400; margin: 0 0 16px; }
.chat-welcome p { font-size: 18px; line-height: 1.55; color: #705940; }
.chat-thinking { font-size: 17px; font-style: italic; color: #705940; }
#chat-form { padding: 14px 18px 16px; border-top: 1px solid #cdbb95; background: #efe4cd; flex-shrink: 0; }
#chat-form label { font-size: 15px; color: #705940; display: block; margin-bottom: 8px; }
#chat-form textarea { width: 100%; min-height: 72px; max-height: 150px; resize: vertical; background: #fffaf0; font-size: 18px; line-height: 1.4; }
.chat-compose-footer { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
#chat-draft-context { flex: 1; font-size: 13px; line-height: 1.4; color: #705940; }
#chat-form button { background: #d6ae50; color: #4a3320; border-color: #ac8333; font-weight: 700; min-width: 92px; }
#chat-form button:hover { background: #e3bf70; }
body.chat-expanded #chat { width: 560px; height: calc(100dvh - 100px); }
@media (min-width: 1200px) {
  body.chat-open .person-dialog {
    width: min(880px, calc(100vw - 500px));
    margin-left: max(24px, calc((100vw - 480px - 880px) / 2));
    margin-right: auto;
  }
  body.chat-open.chat-expanded .person-dialog {
    width: min(880px, calc(100vw - 640px));
    margin-left: max(24px, calc((100vw - 620px - 880px) / 2));
  }
}
@media (max-width: 600px) {
  #archivist-dock { inset: auto 12px max(12px, env(safe-area-inset-bottom)) auto; max-width: calc(100vw - 24px); }
  #chat { width: calc(100vw - 24px); height: min(640px, 76dvh); min-height: 280px; }
  #chat .panel-heading { padding: 14px; }
  #chat .panel-heading p { font-size: 14px; }
  .chat-subject { padding: 10px 14px; }
  .chat-subject label { max-width: 112px; }
  body.chat-expanded #chat { height: calc(100dvh - 28px); }
  #chat-form { padding: 12px 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  #chat { animation: archivist-arrive 220ms cubic-bezier(.16,1,.3,1); }
  @keyframes archivist-arrive { from { opacity: .65; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
@media (max-width: 900px) {
  header {
    gap: 10px;
    padding: 12px;
  }
  .brand img {
    width: 140px;
  }
  header nav {
    order: 3;
    width: 100%;
  }
  .view {
    padding: 20px;
  }
  .tree-toolbar {
    padding: 16px;
  }
  .tree-frame {
    height: calc(100dvh - 240px);
  }
  h1 {
    font-size: 26px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .person-card.highlight {
    animation: arrive 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes arrive {
    from {
      outline-offset: 15px;
    }
    to {
      outline-offset: 5px;
    }
  }
}

.tree-frame {
  display: flex;
  align-items: flex-start;
}
.tree-plane {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  will-change: transform;
}
.message p {
  margin: 8px 0;
  white-space: normal;
}

[data-theme="light"] .brand img {
  filter: brightness(0.4) saturate(0.8);
}

.person-card strong,
.person-card span,
.person-card em {
  overflow-wrap: anywhere;
}
.person-card strong {
  line-height: 1.25;
}
.person-card em {
  line-height: 1.2;
}

/* Archival colors on an open canvas; the time guide belongs to the viewport. */
.canvas-shell { position:relative; }
.tree-frame {
  background: #f5eedc;
}
.decade-guide { position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:5; }
.decade-marker { position:absolute; left:0; right:0; height:0; border-top:1px solid #d8c9a866; }
.decade-marker[hidden] { display:none; }
.decade-marker span { position:absolute; left:12px; top:0; transform:translateY(-50%); background:#f5eedc; color:#8a7358; padding:5px 8px; font:14px/1.2 "Libre Caslon Text",serif; font-variant-numeric:tabular-nums; }
@media(max-width:600px) { .decade-marker span { left:4px; padding:4px; font-size:12px; } }
.family-register {
  color: #4a3320;
  font-family: "IM Fell English", serif;
}
.family-register .register-branches {
  z-index: 1;
}
.family-register .register-branches path {
  stroke: #4a3320;
  stroke-width: 2.2;
  stroke-linejoin: round;
  fill: none;
}
.family-register .person-card {
  z-index: 2;
  background: #f5eedc;
  border: 1.4px solid #8a7358;
  border-radius: 2px;
  color: #4a3320;
  box-shadow: none;
  padding: 16px;
  gap: 8px;
}
.family-register .person-card:after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 0.6px solid #cdbb95;
  pointer-events: none;
}
.family-register .person-card strong {
  font:
    400 25px/1.12 "IM Fell English",
    serif;
}
.family-register .person-card span {
  font:
    700 14px/1.3 "Libre Caslon Text",
    serif;
  color: #4a3320;
}
.family-register .person-card em {
  font:
    italic 16px/1.2 "IM Fell English",
    serif;
  color: #8a7358;
}
.family-register .person-card small {
  font:
    italic 13px "IM Fell English",
    serif;
  color: #8a7358;
}
.family-register .person-card:hover {
  border-color: #4a3320;
  background: #f1e5c9;
}
.family-register .person-card.highlight {
  outline: 2px solid #8c3b2a;
  outline-offset: 5px;
  border-color: #8c3b2a;
}
.family-register .register-slot {
  border: 1px dashed #8c3b2a;
  background: #f5eedc;
}
.family-register .register-slot .slot-role {
  font:
    11px "Libre Caslon Text",
    serif;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #8c3b2a;
}
.family-register .register-slot.ready {
  border: 2px solid #8c3b2a;
  animation: register-arrival 0.4s ease-out;
}
.family-register .register-slot.working strong {
  font-style: italic;
}
@keyframes register-arrival {
  from {
    transform: translateY(5px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .family-register .register-slot.ready {
    animation: none;
  }
}

.person-dialog {
  width: min(880px, calc(100vw - 40px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid #8a7358;
  outline: 4px double #cdbb95;
  outline-offset: 4px;
  border-radius: 4px;
  background: #f5eedc;
  color: #4a3320;
  --bg: #f5eedc;
  --surface: #f5eedc;
  --raised: #e6dac0;
  --ink: #4a3320;
  --muted: #8a7358;
  --line: #cdbb95;
  --gold: #8c3b2a;
  font-family: "IM Fell English", serif;
  overscroll-behavior: contain;
  animation: profile-open 160ms ease-out;
}
.person-dialog::backdrop {
  background: rgb(16 28 22 / 0.5);
}
.person-dialog .view {
  padding: 24px 32px 36px;
  max-width: none;
  margin: 0;
}
.person-dialog h1,
.person-dialog h2,
.person-dialog h3 {
  font-family: "IM Fell English", serif;
}
.person-dialog .view-top {
  position: sticky;
  top: -24px;
  background: #f5eedc;
  z-index: 3;
  padding: 12px 0;
}
.person-dialog .view-top a {
  visibility: hidden;
}
@keyframes profile-open {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 600px) {
  .person-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 28px);
  }
  .person-dialog .view {
    padding: 18px;
  }
  .person-dialog .view-top {
    top: -18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .person-dialog {
    animation: none;
  }
}

/* Keep the folio still while its pages change. */
.person-dialog {
  height: min(860px, calc(100dvh - 48px));
  overflow: hidden;
}
.person-dialog .view {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.person-dialog .view > * {
  flex-shrink: 0;
}
.person-dialog .profile-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 12px;
  scrollbar-gutter: stable;
}
.person-dialog .tabs {
  margin-bottom: 16px;
}
.person-dialog .view-top {
  padding: 0 0 12px;
}
.person-dialog h1 {
  margin: 8px 0;
}
.person-dialog .view > .actions {
  margin: 8px 0;
}
.parent-discoveries {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.parent-discover {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 16px;
  border: 1px dashed #8c3b2a;
  text-decoration: none;
  background: #f5eedc;
  color: #4a3320;
  border-radius: 3px;
}
.parent-discover strong {
  font:
    400 21px "IM Fell English",
    serif;
}
.parent-discover span {
  font:
    italic 14px "IM Fell English",
    serif;
  color: #8a7358;
}
.parent-discover:hover {
  background: #e6dac0;
}
.parent-discover.ready {
  border-style: solid;
  border-width: 2px;
}
.both-parents {
  flex-basis: 100%;
  padding: 7px;
  min-height: 38px;
}
.card-parent-actions {
  position: absolute;
  width: 280px;
  z-index: 3;
}
.card-parent-actions .parent-discoveries {
  margin: 0;
  gap: 6px;
}
.card-parent-actions .parent-discover {
  padding: 8px;
  min-width: 0;
  text-align: center;
}
.card-parent-actions .parent-discover strong {
  font-size: 16px;
}
.card-parent-actions .parent-discover span {
  font-size: 13px;
}
.person-facts {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 8px 0 24px;
}
.person-facts dt {
  font-style: italic;
  color: #8a7358;
}
.person-facts dd {
  margin: 4px 0;
  font-family: "Libre Caslon Text", serif;
  font-size: 15px;
}
.person-dialog blockquote {
  margin: 14px 0;
  padding: 12px 16px;
  background: #e6dac0;
  border-left: 1px solid #8a7358;
}
.chronicle-reading summary {
  font-size: 21px;
  cursor: pointer;
}
.chronicle-reading summary span {
  display: block;
  font-size: 15px;
}
@media (max-width: 600px) {
  .person-dialog {
    height: calc(100dvh - 28px);
  }
  .person-dialog .view {
    padding: 14px;
  }
  .person-dialog .parent-discoveries {
    margin: 8px 0;
  }
  .person-dialog .parent-discover {
    padding: 8px;
  }
  .person-dialog .tabs {
    margin-top: 8px;
  }
  .person-dialog .profile-content {
    padding-right: 6px;
  }
  .person-dialog .view > .muted {
    margin: 4px 0;
  }
}

/* Parent discovery grows upward, in the same place as the future family. */
.card-parent-actions {
  height: 116px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.branch-invitation {
  text-align: center;
  font:
    italic 14px "IM Fell English",
    serif;
  color: #8a7358;
  margin-bottom: 7px;
}
.card-parent-actions .parent-discoveries {
  position: relative;
  z-index: 2;
}
.card-parent-actions .parent-discover {
  background: #f1e4c6;
  border: 1px solid #8c3b2a;
  border-radius: 12px 12px 3px 3px;
  transition:
    transform 160ms ease-out,
    background 160ms ease-out;
  min-height: 64px;
  justify-content: center;
}
.card-parent-actions .parent-discover:hover {
  background: #ead6a6;
  transform: translateY(-4px);
}
.card-parent-actions .parent-discover:active {
  transform: translateY(-1px) scale(0.97);
}
.card-parent-actions .parent-discover strong {
  font-size: 19px;
  color: #4a3320;
}
.card-parent-actions .parent-discover.ready {
  background: #e6cc8a;
  border: 2px solid #8c3b2a;
}
.branch-stem {
  position: relative;
  flex: 1;
  width: 1px;
  background: #8c3b2a;
  align-self: center;
  min-height: 16px;
  opacity: 0.7;
}

.family-register .person-card.new-discovery {
  animation: discovery-unfold 850ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes discovery-unfold {
  0% {
    opacity: 0.2;
    transform: translateY(20px) scale(0.92);
    background: #e6cc8a;
    outline: 3px solid #8c3b2a;
    outline-offset: 12px;
  }
  60% {
    opacity: 1;
    transform: translateY(-3px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
    background: #f5eedc;
    outline-offset: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .family-register .person-card.new-discovery {
    animation: none;
  }
  .card-parent-actions .parent-discover {
    transition: none;
  }
  .card-parent-actions .parent-discover:hover {
    transform: none;
  }
}
.register-branches .branch-new {stroke-dasharray:2000;animation:branch-draw 1100ms ease-out both;}
@keyframes branch-draw {from{stroke-dashoffset:2000}to{stroke-dashoffset:0}}
@media(prefers-reduced-motion:reduce){.register-branches .branch-new{animation:none;stroke-dasharray:none}}

/* V1's archival invitations, carried into the register. */
.card-parent-actions { height:145px; }
.card-parent-actions .parent-discoveries { gap:6px; }
.parent-discover { position:relative; }
.card-parent-actions .parent-discover {
  background:#fdfcfa;
  border:1.8px dashed #82601d;
  border-radius:10px;
  min-height:86px;
  padding:10px 5px;
  gap:4px;
}
.card-parent-actions .parent-discover::before {
  content:""; position:absolute; inset:5px; pointer-events:none;
  background:linear-gradient(#aa8843,#aa8843) left top/9px 1px no-repeat,
    linear-gradient(#aa8843,#aa8843) left top/1px 9px no-repeat,
    linear-gradient(#aa8843,#aa8843) right top/9px 1px no-repeat,
    linear-gradient(#aa8843,#aa8843) right top/1px 9px no-repeat;
}
.card-parent-actions .parent-discover strong { font-size:14px; text-transform:uppercase; letter-spacing:.04em; color:#705019; }
.card-parent-actions .parent-discover span { font:12px/1.3 "Libre Caslon Text",serif; color:#65583e; }
.parent-discover small { color:#82601d; text-transform:uppercase; font-size:11px; letter-spacing:.07em; }
.card-parent-actions .parent-discover:hover { background:#fffdf8; border-color:#d8aa4e; box-shadow:0 6px 20px rgb(152 112 36 / .23); }
.card-parent-actions .both-parents { flex-basis:auto; margin:0 auto; padding:3px 14px; min-height:27px; border-radius:20px; color:#76541d; border:1px solid #a68032; background:#f5eedc; font-size:13px; }
.card-parent-actions .parent-discover.ready { background:#f5e5b6; border-style:solid; }
.person-dialog.action-dialog { width:min(640px,calc(100vw - 40px)); height:auto; max-height:calc(100dvh - 48px); overflow:auto; }
.action-dialog .view { height:auto; min-height:0; }
.action-dialog h1 { font-size:32px; }
.action-dialog p { line-height:1.6; }
.action-dialog .research-invitation { font-size:22px; font-style:italic; margin-bottom:0; }
.action-dialog textarea { background:#fffaf0; color:#4a3320; border:1px solid #b6a07b; }
.action-dialog .primary { background:#d8aa4e; color:#332614; border:1px solid #8e6a27; font-family:"IM Fell English",serif; font-size:20px; }
.action-dialog .primary:hover { background:#e4bc69; }
.card-parent-actions .parent-discoveries { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.card-parent-actions .both-parents { grid-column:1 / -1; justify-self:center; }
.person-dialog.action-dialog .view { height:auto; min-height:0; overflow:visible; }
.person-dialog.action-dialog { margin:auto; color-scheme:light; }
.person-dialog.action-dialog { height:fit-content; }
.person-dialog h1:focus { outline:none; }
/* Unexplored ancestors occupy the same card-sized spaces as discoveries. */
.card-parent-actions { width:614px; height:280px; }
.card-parent-actions .parent-discoveries { grid-template-columns:280px 280px; column-gap:54px; }
.card-parent-actions .parent-discover { width:280px; height:176px; border-radius:4px; padding:24px; gap:12px; }
.card-parent-actions .parent-discover strong { font-size:21px; }
.card-parent-actions .parent-discover span { font-size:15px; }
.card-parent-actions .parent-discover small { font-size:13px; }
.card-parent-actions .parent-discover:only-child { grid-column:1 / -1; justify-self:center; }
.card-parent-actions .parent-discover::before { inset:7px; }
.card-parent-actions .both-parents { margin-top:6px; }

.evidence-notes { border-top:1px solid #cdbb95; border-bottom:1px solid #cdbb95; padding:16px 0; margin:20px 0; }
.evidence-notes summary { cursor:pointer; color:#76541d; font-size:18px; }
.source-excerpt { font-size:16px; line-height:1.65; overflow-wrap:anywhere; max-height:300px; overflow:auto; padding:16px 12px 8px 0; }
.source-excerpt p { margin:0 0 12px; }
.archivist-note { font-style:italic; color:#765e3d; }
.action-dialog .prose { font-size:23px; line-height:1.4; margin:16px 0; }
.narrative { line-height:1.65; max-width:65ch; }
/* Discovery leads; the credit price remains clear without shouting. */
.card-parent-actions .parent-discover strong { text-transform:none; letter-spacing:0; font-size:25px; }
.card-parent-actions .parent-discover span { font-family:"IM Fell English",serif; font-style:italic; font-size:17px; }
.parent-discover small { text-transform:none; letter-spacing:0; font-size:14px; }
.card-parent-actions .parent-discover small { font-size:14px; }

/* Ink trails connect each invitation to its place in the family. */
.card-parent-actions .parent-discoveries { position:relative; height:280px; grid-template-rows:176px 28px; row-gap:20px; align-content:start; }
.invitation-branches { position:absolute; inset:0; pointer-events:none; overflow:visible; }
.invitation-branches path { fill:none; stroke:#9b7736; stroke-width:1.6; stroke-dasharray:3 5; stroke-linecap:round; }
.invitation-branches.searching path { animation:ink-trail 2s linear infinite; }
.card-parent-actions .parent-discover { position:relative; z-index:1; background:#fbf7ec; border-color:#aa8843; border-radius:8px; gap:9px; padding:16px 24px; box-shadow:0 3px 10px rgb(89 62 25 / .06); }
.card-parent-actions .parent-discover::before { inset:6px; opacity:.6; }
.card-parent-actions .parent-discover:hover { background:#fffaf0; border-color:#916726; transform:translateY(-3px); box-shadow:0 8px 20px rgb(89 62 25 / .16); }
.card-parent-actions .parent-discover strong { font-size:25px; }
.card-parent-actions .parent-discover small { color:#76541d; }
.card-parent-actions .both-parents { z-index:2; margin:0; height:28px; padding:3px 12px; background:#f5eedc; }
.invitation-ornament { width:20px; height:20px; flex-shrink:0; fill:none; stroke:#a68032; stroke-width:.9; }
.card-parent-actions .parent-discover.ready { background:#f2dfac; border:1px solid #9b7736; }
.card-parent-actions .parent-discover.ready strong { font-size:24px; }
.card-parent-actions .parent-discover.working { background:#f5efdf; }
.card-parent-actions .parent-discover.working strong { font-size:22px; }
.card-parent-actions .parent-discover.working .invitation-ornament { animation:search-glimmer 2.4s ease-in-out infinite; }
.discovery-seal { display:block; width:44px; height:44px; flex-shrink:0; }
.discovery-seal svg { width:100%; height:100%; overflow:visible; filter:drop-shadow(0 2px 2px rgb(70 32 15 / .2)); }
.discovery-seal .seal-wax { fill:#93442d; stroke:#773622; stroke-width:1; }
.discovery-seal circle { fill:none; stroke:#c38058; stroke-width:1; }
.discovery-seal .seal-mark { fill:none; stroke:#f0c99c; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.discovery-seal.large { width:68px; height:68px; margin:0 auto 22px; }
.person-dialog:has(.discovery-story) { width:min(720px,calc(100vw - 40px)); background:radial-gradient(ellipse at 50% 25%,#fffaf0,#f2e7cd); }
.person-dialog:has(.discovery-story) .view { padding:20px 40px 34px; }
.person-dialog:has(.discovery-story) .view > h1 { font-size:22px; text-align:center; font-style:italic; font-weight:400; color:#76541d; margin:4px 0 28px; }
.discovery-story { text-align:center; }
.archivist-introduction { font-size:18px; color:#765e3d; font-style:italic; max-width:42ch; margin:0 auto 16px; }
.discovery-story .discovered-name { font-size:42px; font-weight:400; line-height:1.1; text-wrap:balance; margin:0; }
.discovered-relationship { color:#76541d; font-size:18px; margin:10px 0 24px; }
.discovery-account { text-align:left; font-size:19px; line-height:1.6; margin-top:26px; padding-top:20px; border-top:1px solid #cdbb95; }
.discovery-account p { margin:0 0 12px; }
.discovery-actions { justify-content:center; margin-top:24px; }
.discovery-actions .primary { padding:12px 24px; background:linear-gradient(145deg,#e2bc69,#c89636); box-shadow:inset 0 1px 0 #f6dca0,0 4px 12px rgb(100 66 20 / .14); border-radius:7px; }
.discovery-actions .primary:hover { background:#e6bf70; transform:translateY(-1px); }
.person-dialog:has(.discovery-story) .archivist-note { text-align:center; font-size:16px; }
.evidence-notes summary { font-size:16px; line-height:1.4; }
.source-links a { font-size:15px; line-height:1.5; }
.conflict-note { color:#8c3b2a; }
.discovery-story .discovered-name { animation:name-reveal 600ms cubic-bezier(.16,1,.3,1) both; }
@keyframes name-reveal { from { clip-path:inset(0 100% 0 0); } to { clip-path:inset(0); } }
@keyframes ink-trail { to { stroke-dashoffset:-16; } }
@keyframes search-glimmer { 50% { opacity:.35; } }
@media(max-width:600px) {
  .person-dialog:has(.discovery-story) .view { padding:16px 22px 28px; }
  .discovery-story .discovered-name { font-size:34px; }
  .discovery-account { font-size:18px; }
  .discovery-actions { align-items:stretch; flex-direction:column; }
}
@media(prefers-reduced-motion:reduce) {
  .invitation-branches.searching path,.card-parent-actions .parent-discover.working .invitation-ornament,.discovery-story .discovered-name,.register-branches .branch-new { animation:none; }
}
/* Keep card ornaments inside their cards, independent of the canvas SVG layers. */
.family-register .invitation-ornament { position:static; width:20px; height:20px; }
.family-register .discovery-seal svg { position:static; width:44px; height:44px; }
.card-parent-actions .parent-discover.ready { gap:5px; padding:10px 20px; }
.card-parent-actions .parent-discover.ready span:not(.discovery-seal) { font-size:16px; }
.invitation-branches { z-index:0; }
.discovery-seal svg { display:block; }
.person-dialog[data-steady="true"] .discovered-name { animation:none; }
#notice.discovery-notice { background:#ead6a6; color:#4a3320; border-bottom-color:#a68032; font:20px/1.5 "IM Fell English",serif; }
.card-parent-actions .single-parent .parent-discover { grid-column:1 / -1; justify-self:center; }
.card-parent-actions .parent-discover > .discovery-seal,
.card-parent-actions .parent-discover > .invitation-ornament { align-self:center; }
.card-parent-actions .parent-discover.unresolved { background:#f4ead2; border-color:#9b8968; }
.card-parent-actions .parent-discover.unresolved strong { font-size:23px; }

/* Branch controls belong to the register, outside the person/profile link. */
.family-register .branch-toggle {
  position:absolute;
  z-index:4;
  transform:translateX(-50%);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
  padding:8px 14px;
  border:1px solid #cdbb95;
  border-radius:20px;
  background:#f5eedc;
  color:#4a3320;
  font:16px/1.2 "IM Fell English",serif;
  white-space:nowrap;
}
.family-register .branch-toggle:hover { background:#eaddbe; border-color:#8a7358; }
.family-register .branch-toggle.folded { border-color:#8c3b2a; color:#8c3b2a; }
.family-register .branch-toggle svg { position:static; width:16px; height:16px; }
.family-register .branch-toggle path { fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.family-register .family-bond rect { fill:#f5eedc; stroke:#8a7358; stroke-width:1; }
.family-register .family-bond ellipse { fill:none; stroke:#4a3320; stroke-width:1.3; }
.unresolved-story h2 { font-size:29px; line-height:1.2; text-wrap:balance; }
.unresolved-story .research-invitation { color:#76541d; }
.unresolved-story .actions a:first-child { background:#d8aa4e; color:#332614; border-color:#8e6a27; }

/* Known family first; research remains an explicit alternative. */
.parent-discover .known-parent { display:flex; flex-direction:column; align-items:center; gap:9px; color:inherit; text-decoration:none; width:100%; }
.parent-discover .parent-search-option { font-size:14px; color:#76541d; text-decoration:underline; text-underline-offset:3px; padding:5px 0; }
.parent-discover .known-parent:hover strong { text-decoration:underline; text-underline-offset:4px; }
.missing-parent-slot .parent-discoveries { height:176px; }

.family-register .register-branches path.placeholder-branch { stroke-dasharray:5 6; stroke:#aa8843; }

/* Keep basic family details and the save action within easy reach. */
.year-fields { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form details { margin:16px 0; }
.form details summary { cursor:pointer; }

/* Overview removes fine print; Find and Back to family restore readable cards. */
.overview-scale .person-card em,
.overview-scale .person-card small { visibility: hidden; }
.overview-scale .person-card strong { font-size: 32px; }

.chat-attachment-label { margin-top: .6rem; font-size: 1rem; }
#chat-image { max-width: 100%; font-size: .9rem; }
#chat-attachments { display:flex; flex-wrap:wrap; gap:.5rem; }
#chat-attachments span { max-width:100%; overflow-wrap:anywhere; }
#chat-attachments button { padding:.2rem .5rem; }

#discovery-moment { position:fixed; z-index:40; bottom:5rem; left:1.25rem; width:min(29rem, calc(100vw - 2.5rem)); padding:1.15rem 3rem 1rem 1.3rem; color:#4a3320; background:#ead6a6; border:1px solid #a68032; border-radius:14px; font:20px/1.45 "IM Fell English",serif; }
#discovery-moment[hidden] { display:none; }
#discovery-moment p { margin:.4rem 0 0; }
#discovery-moment a { color:#4a3320; text-decoration:underline; }
#discovery-moment button { position:absolute; right:.35rem; top:.35rem; width:44px; height:44px; padding:0; color:#4a3320; background:transparent; border:0; }
@media(prefers-reduced-motion:no-preference) { #discovery-moment { animation:discovery-rise .4s cubic-bezier(.2,.8,.2,1) both; } }
@keyframes discovery-rise { from { opacity:0; transform:translateY(25px); } to { opacity:1; transform:translateY(0); } }

/* A quiet invitation stays beside the tree; it never moves the camera or opens a modal. */
#next-thread { position: fixed; left: 1rem; bottom: 4.5rem; z-index: 12; width: min(21rem, calc(100vw - 2rem)); padding: 1.25rem 2.5rem 1.25rem 1.25rem; background: #f5eedc; color: #4a3320; border: 1px solid #b79a60; border-radius: 12px; font-family: "IM Fell English", serif; }
#next-thread[hidden] { display: none; }
#next-thread strong { display: block; font-size: 1.25rem; line-height: 1.3; }
#next-thread p { margin: .5rem 0; line-height: 1.4; }
#next-thread a { display: inline-block; margin: .6rem .5rem 0 0; color: #684a1e; }
#next-thread a.button { background: #294333; color: #f5eedc; border-color: #697d60; text-decoration: none; }
#next-thread a.button:hover { background: #355441; color: #fff9eb; }
#next-thread a:focus-visible { outline: 2px solid #8c3b2a; outline-offset: 4px; }
#next-thread > button { position: absolute; top: .15rem; right: .15rem; width: 44px; height: 44px; padding: 0; background: transparent; color: #4a3320; border: 0; }
.life-detail { margin: 1.75rem 0; padding-bottom: 1.5rem; border-bottom: 1px solid #cdbb95; }
.life-detail h3 { margin-bottom: .6rem; }
.story-invitation { padding: 1rem 0; }
@media (max-width: 700px) { #next-thread { bottom: 5rem; width: min(18rem, calc(100vw - 2rem)); } }

/* Discovery reading: the person and their account share the first viewport. */
.person-dialog:has(.compact-discovery) { width:min(820px,calc(100vw - 32px)); }
.person-dialog:has(.compact-discovery) .view { padding:16px 32px 22px; }
.person-dialog:has(.compact-discovery) .view-top { position:absolute; top:16px; right:24px; left:auto; padding:0; min-height:0; margin:0; background:transparent; border:0; }
.person-dialog:has(.compact-discovery) .view > h1 { text-align:left; margin:0 130px 20px 0; min-height:42px; display:flex; align-items:center; font-size:20px; }
.discovery-identity { display:flex; align-items:center; gap:18px; text-align:left; }
.compact-discovery .discovery-seal.large { width:52px; height:52px; margin:0; }
.compact-discovery .discovered-name { font-size:36px; }
.compact-discovery .discovered-relationship { margin:6px 0 0; font-size:18px; }
.compact-discovery .discovery-account { margin-top:20px; padding-top:16px; font-size:20px; line-height:1.45; }
.record-account { text-align:left; font-size:19px; line-height:1.5; }
.record-account p { margin:0 0 16px; }
.review-source-links { margin:8px 0; overflow-wrap:anywhere; }
.original-transcript { margin:8px 0; }
.original-transcript .source-excerpt { white-space:pre-wrap; max-height:220px; overflow:auto; font-size:16px; line-height:1.5; }
.person-dialog:has(.compact-discovery) .archivist-note { text-align:left; margin:12px 0; line-height:1.4; }
.person-dialog:has(.compact-discovery) .discovery-actions { justify-content:flex-start; margin:12px 0 0; }
@media(max-width:600px) {
  .person-dialog:has(.compact-discovery) .view { padding:14px 20px 20px; }
  .compact-discovery .discovered-name { font-size:29px; }
  .discovery-identity { gap:12px; }
  .compact-discovery .discovery-seal.large { width:40px; height:40px; }
}

/* Collateral siblings remain close, like cards tucked into a family folio. */
.sibling-stack { position:absolute; width:280px; height:176px; z-index:2; pointer-events:none; }
.sibling-stack::before, .sibling-stack::after { content:""; position:absolute; inset:0; background:#e9dec3; border:1px solid #b49c73; transform:translate(8px,8px); z-index:-1; }
.sibling-stack::before { transform:translate(15px,15px); background:#e2d3b1; }
.sibling-stack summary { position:absolute; top:181px; right:0; cursor:pointer; pointer-events:auto; list-style:none; background:#f5eedc; color:#4a3320; border:1px solid #b49c73; border-radius:14px; padding:5px 12px; font-size:16px; box-shadow:0 2px 3px #4a332015; }
.sibling-stack summary::-webkit-details-marker { display:none; }
.sibling-stack summary span::before { content:"＋ "; }
.sibling-stack[open] summary span::before { content:"− "; }
.sibling-stack[open] { z-index:12; }
.sibling-stack-list { position:absolute; top:221px; left:0; width:320px; padding:18px; background:#f5eedc; border:1px solid #b49c73; box-shadow:0 8px 20px #4a332025; pointer-events:auto; }
.sibling-stack-list h3 { margin:0 0 12px; font-size:19px; }
.sibling-stack-list a { display:block; padding:12px 0; color:#4a3320; }
.sibling-stack-list a + a { border-top:1px solid #d8c9a8; }
.sibling-stack-list a span { display:block; font-size:16px; color:#735c40; }
.sibling-stack summary:focus-visible { outline:2px solid #8c3b2a; outline-offset:3px; }
.sibling-stack[open]::before, .sibling-stack[open]::after { visibility:hidden; }

/* The two-parent expedition is the featured choice, with its saving explicit. */
.both-parents, .card-parent-actions .both-parents {
  display:flex; align-items:center; justify-content:center; gap:22px;
  width:410px; max-width:100%; height:54px; min-height:54px; padding:5px 20px;
  margin:0; border:1px solid #88611d; border-radius:4px;
  background:#e4c171; color:#422d12;
  box-shadow:none;
  text-decoration:none; font:24px/1.05 "IM Fell English",serif;
  transition:background-color 160ms ease,border-color 160ms ease;
}
.both-parents .both-label { text-align:left; }
.both-parents .both-label small { display:block; font:15px/1.2 "IM Fell English",serif; margin-top:3px; color:#543715; }
.both-parents .both-price { display:flex; align-items:baseline; gap:5px; padding-left:18px; border-left:1px solid #987027; font-size:29px; }
.both-parents .both-price small { font-size:16px; }
.both-parents .both-arrow { font-size:22px; }
.card-parent-actions .parent-discoveries { grid-template-rows:176px 54px; row-gap:24px; }
.both-parents:hover, .card-parent-actions .both-parents:hover { background:#edcf8a; color:#422d12; transform:none; box-shadow:none; }
.both-parents:active, .card-parent-actions .both-parents:active { background:#d5b063; transform:none; box-shadow:none; }
.both-parents:focus-visible { outline:3px solid #8c3b2a; outline-offset:5px; }
@media(prefers-reduced-motion:reduce) { .both-parents { transition:none; } }
@media(max-width:480px) { .parent-discoveries:not(.compact) .both-parents { width:100%; gap:12px; font-size:21px; } }
.both-parents .both-price small { color:#422d12; }

/* Active work reads as an occupied archive card, not another purchase. */
.parent-discover.working, .card-parent-actions .parent-discover.working {
  background:#294333; color:#f5eedc; border:1px solid #637c60; box-shadow:none;
}
.parent-discover.working:hover, .card-parent-actions .parent-discover.working:hover {
  background:#344f3d; border-color:#c3ad70; transform:none; box-shadow:none;
}
.parent-discover.working strong, .parent-discover.working span { color:#f5eedc; }
.parent-discover.working small, .card-parent-actions .parent-discover.working small {
  color:#f0d18b; border-bottom:1px solid #bfa568; padding-bottom:2px;
}
.parent-discover.working .invitation-ornament { stroke:#e7c575; }
.parent-discover.working.queued .invitation-ornament,
.parent-discover.working.waiting_provider .invitation-ornament { animation:none; }

/* A readable edition of the same evidence graph used by the Archivist. */
.ravelpedia-heading { padding: 1rem 0 1.25rem; border-bottom: 1px solid #cdbb95; }
.ravelpedia-heading .eyebrow { color: #8c3b2a; letter-spacing: .15em; font-size: .8rem; margin: 1.5rem 0 .5rem; }
.ravelpedia-heading h1 { margin: .25rem 0; font-size: clamp(2rem, 4vw, 3.25rem); }
.record-edition { font-style: italic; color: #8a7358; }
.ravelpedia-reading { max-width: 66ch; margin: 1.5rem auto; line-height: 1.65; }
.ravelpedia-reading h2 { font-size: 1.5rem; margin-top: 1.5rem; }
.ravelpedia-connections { margin: 1.5rem 0; }
.ravelpedia-connections a { display: block; padding: .8rem 0; border-bottom: 1px solid #d8c9a8; text-decoration: none; }
.ravelpedia-connections a span { display: block; font-size: .9rem; margin-top: .25rem; }
.ravelpedia-sources { margin-top: 2rem; }
.ravelpedia-sources details, .record-history { padding: .8rem 0; border-top: 1px solid #d8c9a8; }
.ravelpedia-sources blockquote { font-size: 1rem; line-height: 1.5; }

/* ==========================================================================
   TACTILE CARTOGRAPHER'S DESK & "ONE MORE TURN" FRONTIER AESTHETIC
   Mildly skeuomorphic brass, vellum & wax-seal mechanics (Myst / Civilization)
   ========================================================================== */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
header {
  gap: 9px;
  padding: 10px 18px;
  min-height: 64px;
  background: linear-gradient(180deg, #17271f 0%, #101c16 100%);
  border-bottom: 1.5px solid #594b2d;
  box-shadow: 0 6px 22px rgb(9 16 12 / 0.42), inset 0 -1px 0 rgb(214 174 80 / 0.22);
}
header .brand img {
  width: 154px;
}
header .tree-picker {
  min-width: 140px;
  max-width: 205px;
}
header button,
header select,
header nav a {
  padding: 7px 12px;
  min-height: 38px;
  font-size: 15px;
}
header nav {
  margin-left: auto;
  gap: 2px;
}
[data-theme="light"] header {
  background: linear-gradient(180deg, #f9f3e3 0%, #efe6cf 100%);
  border-bottom-color: #b89f6d;
  box-shadow: 0 4px 16px rgb(74 51 32 / 0.08), inset 0 -1px 0 rgb(255 253 248 / 0.8);
}
button, .button {
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), background-color 180ms cubic-bezier(0.16, 1, 0.3, 1), border-color 180ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.1), 0 2px 6px rgb(9 16 12 / 0.22);
}
#next-thread > button,
#discovery-moment button,
#chat-person,
#chat .panel-heading button {
  box-shadow: none;
}
#next-thread {
  background: linear-gradient(165deg, #fffdf7 0%, #f3e6c8 100%);
  border: 1.5px solid #9e782f;
  box-shadow: inset 0 1px 0 #ffffff, 0 14px 34px -4px rgb(36 24 10 / 0.32);
}
#discovery-moment {
  box-shadow: inset 0 1px 0 #fffdf7, 0 14px 34px -4px rgb(36 24 10 / 0.35);
}
button:active, .button:active {
  transform: translateY(1px) scale(0.98);
}
#credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  min-height: 38px;
  border-radius: 999px;
  background: linear-gradient(145deg, #2b3f31, #1b2a21);
  border: 1px solid #b58d3d;
  box-shadow: inset 0 1px 0 rgb(246 220 160 / 0.28), 0 3px 10px rgb(9 16 12 / 0.3);
  color: #f3dfb1;
  font-family: "Cinzel", Georgia, serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
#credits::before {
  content: "✦";
  color: #e6bf63;
  font-size: 14px;
}
#credits:hover {
  border-color: #e6bf63;
  background: linear-gradient(145deg, #354e3d, #223529);
  transform: translateY(-1px);
}
[data-theme="light"] #credits {
  background: linear-gradient(145deg, #fcf6e6, #eadbb9);
  color: #4a3320;
  border-color: #9e782f;
  box-shadow: inset 0 1px 0 #fffdf8, 0 2px 8px rgb(74 51 32 / 0.12);
}
.tree-toolbar {
  padding: 10px 18px;
  gap: 8px;
  background: linear-gradient(180deg, #16251d 0%, #121f18 100%);
  border-bottom: 1px solid #483f29;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05);
}
.tree-toolbar form {
  max-width: 270px;
}
.tree-toolbar button,
.tree-toolbar input {
  padding: 7px 12px;
  min-height: 38px;
  font-size: 15px;
}
.tree-toolbar .canvas-hint {
  margin-left: auto;
  font-size: 14.5px;
}
[data-theme="light"] .tree-toolbar {
  background: linear-gradient(180deg, #f3ebd6 0%, #e9dec3 100%);
  border-bottom-color: #c5b084;
}
/* One-More-Turn Frontier Compass Pill in the Toolbar */
.frontier-turn-pill {
  border-radius: 999px;
  padding: 9px 18px;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 17px;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgb(255 253 245 / 0.45), 0 4px 14px rgb(16 28 22 / 0.28);
}
.frontier-turn-pill.is-ready {
  background: linear-gradient(145deg, #9e3d26, #7a2b18);
  border-color: #e6b85c;
  color: #fff8eb;
  animation: compass-pulse 2.6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.frontier-turn-pill.is-harder {
  background: linear-gradient(145deg, #4b2816, #30180c);
  border-color: #e0a946;
  color: #fbe5b5;
}
.frontier-turn-pill.is-working {
  background: linear-gradient(145deg, #214030, #162c21);
  border-color: #78b894;
  color: #e6f7ed;
}
.frontier-turn-pill.is-unexplored {
  background: linear-gradient(145deg, #e5c274, #c99b3b);
  border-color: #7c5816;
  color: #2f1f0b;
  font-weight: 700;
}
.frontier-turn-pill:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}
@keyframes compass-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgb(255 253 245 / 0.45), 0 0 0 0 rgb(214 174 80 / 0.45); }
  50% { box-shadow: inset 0 1px 0 rgb(255 253 245 / 0.65), 0 0 0 6px rgb(214 174 80 / 0); }
}

/* Cartographer's Parchment Map Table */
.tree-frame {
  background-color: #f2e8cf;
  background-image:
    radial-gradient(ellipse at 50% 38%, rgb(255 251 240 / 0.68) 0%, rgb(238 225 194 / 0.35) 58%, rgb(196 173 128 / 0.42) 100%),
    repeating-linear-gradient(0deg, transparent 0, transparent 79px, rgb(138 115 88 / 0.07) 79px, rgb(138 115 88 / 0.07) 80px),
    repeating-linear-gradient(90deg, transparent 0, transparent 79px, rgb(138 115 88 / 0.07) 79px, rgb(138 115 88 / 0.07) 80px);
  box-shadow: inset 0 10px 28px rgb(48 33 15 / 0.18), inset 0 0 0 1px rgb(138 115 88 / 0.35);
}
.decade-marker {
  border-top: 1px dashed rgb(138 115 88 / 0.36);
}
.decade-marker span {
  background: linear-gradient(180deg, #faf3e1 0%, #ede0c2 100%);
  color: #5b4328;
  border: 1px solid #b89e6e;
  border-radius: 999px;
  padding: 4px 11px;
  box-shadow: inset 0 1px 0 #fffdf8, 0 2px 6px rgb(74 51 32 / 0.12);
  font: 700 12px/1.2 "Cinzel", Georgia, serif;
  letter-spacing: 0.06em;
}

/* Double-Bezel Vellum & Brass Heirloom Person Plates */
.family-register .register-branches path {
  stroke: #47321d;
  stroke-width: 2.5;
  filter: drop-shadow(0 1px 1px rgb(255 251 240 / 0.65));
}
.family-register .person-card {
  background: linear-gradient(168deg, #fffdf7 0%, #f7eed8 62%, #efe1c0 100%);
  border: 1.6px solid #7c6038;
  border-radius: 9px;
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -2px 0 rgb(166 132 76 / 0.22),
    0 8px 22px -4px rgb(58 39 18 / 0.18),
    0 2px 6px rgb(58 39 18 / 0.1);
  transition:
    transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 240ms cubic-bezier(0.16, 1, 0.3, 1),
    background 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.family-register .person-card::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgb(172 140 84 / 0.52);
  border-radius: 5px;
  pointer-events: none;
  background:
    linear-gradient(#9c7732, #9c7732) left top / 8px 1.5px no-repeat,
    linear-gradient(#9c7732, #9c7732) left top / 1.5px 8px no-repeat,
    linear-gradient(#9c7732, #9c7732) right top / 8px 1.5px no-repeat,
    linear-gradient(#9c7732, #9c7732) right top / 1.5px 8px no-repeat,
    linear-gradient(#9c7732, #9c7732) left bottom / 8px 1.5px no-repeat,
    linear-gradient(#9c7732, #9c7732) left bottom / 1.5px 8px no-repeat,
    linear-gradient(#9c7732, #9c7732) right bottom / 8px 1.5px no-repeat,
    linear-gradient(#9c7732, #9c7732) right bottom / 1.5px 8px no-repeat;
}
.family-register .person-card.root-card {
  border: 2px solid #966b1d;
  background: linear-gradient(168deg, #fffef9 0%, #f9efd4 58%, #eed9a4 100%);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 10px 26px -4px rgb(120 84 22 / 0.26),
    0 0 0 3px rgb(214 174 80 / 0.24);
}
.family-register .person-card:hover {
  transform: translateY(-4px);
  border-color: #9e7222;
  background: linear-gradient(168deg, #ffffff 0%, #fbf3df 65%, #f3e4be 100%);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 14px 30px -6px rgb(58 39 18 / 0.26),
    0 0 0 2px rgb(214 174 80 / 0.32);
}
.family-register .person-card:active {
  transform: translateY(-1px) scale(0.985);
}
.family-register .person-card span {
  font-variant-numeric: tabular-nums;
  color: #6e4e1e;
}

/* Frontier Discovery Tiles: Fog of Time, Wax Seals, and Myst Cipher Locks */
.card-parent-actions .parent-discover {
  background: linear-gradient(165deg, #fffdf8 0%, #f6ebd1 100%);
  border: 1.6px dashed #9e762a;
  border-radius: 10px;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 6px 16px -4px rgb(74 51 32 / 0.14);
  transition:
    transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 220ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.card-parent-actions .parent-discover.unexplored {
  animation: frontier-breathe 4.4s ease-in-out infinite;
}
@keyframes frontier-breathe {
  0%, 100% {
    border-color: #9e762a;
    box-shadow: inset 0 1px 0 #ffffff, 0 5px 14px -4px rgb(74 51 32 / 0.12);
  }
  50% {
    border-color: #cf9e3e;
    box-shadow: inset 0 1px 0 #ffffff, 0 8px 22px -2px rgb(180 132 42 / 0.26);
  }
}
.card-parent-actions .parent-discover.ready {
  background: linear-gradient(160deg, #fff8e4 0%, #f3dca0 58%, #e6c473 100%);
  border: 2px solid #8c3b2a;
  box-shadow:
    inset 0 1px 0 #fffdf7,
    0 10px 24px -4px rgb(140 59 42 / 0.28),
    0 0 0 3px rgb(214 174 80 / 0.35);
}
.card-parent-actions .parent-discover.harder-branch {
  background: linear-gradient(165deg, #331f14 0%, #24140c 100%);
  border: 1.8px solid #d89b3c;
  color: #fae8c4;
  box-shadow:
    inset 0 1px 0 rgb(255 226 168 / 0.22),
    0 8px 22px -4px rgb(36 20 12 / 0.45);
}
.card-parent-actions .parent-discover.harder-branch strong {
  color: #fde4af;
}
.card-parent-actions .parent-discover.harder-branch span {
  color: #ebd09e;
}
.card-parent-actions .parent-discover.harder-branch small {
  color: #f6bd58;
  font-weight: 700;
}
.card-parent-actions .parent-discover.harder-branch .invitation-ornament {
  stroke: #f6bd58;
}
.both-parents, .card-parent-actions .both-parents {
  background: linear-gradient(165deg, #efd086 0%, #d8ac4e 55%, #c49231 100%);
  border: 1.5px solid #785314;
  border-radius: 999px;
  color: #2f1e09;
  box-shadow:
    inset 0 1px 0 rgb(255 249 229 / 0.8),
    inset 0 -2px 0 rgb(110 74 16 / 0.25),
    0 6px 16px -3px rgb(74 51 32 / 0.26);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 200ms cubic-bezier(0.16, 1, 0.3, 1), filter 200ms ease;
}
.both-parents:hover, .card-parent-actions .both-parents:hover {
  background: linear-gradient(165deg, #f5da96 0%, #e0b65a 55%, #cc9b38 100%);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgb(255 252 240 / 0.9),
    0 10px 22px -4px rgb(74 51 32 / 0.34);
}
.both-parents:active, .card-parent-actions .both-parents:active {
  transform: translateY(1px) scale(0.98);
}
.deep-escalation-callout {
  margin: 18px 0;
  padding: 20px 22px;
  border: 1.5px solid #b57b28;
  border-radius: 10px;
  background: linear-gradient(165deg, #fbf0d4 0%, #f1dec0 100%);
  box-shadow: inset 0 1px 0 #fffdf8, 0 6px 18px -4px rgb(92 56 18 / 0.14);
}
.deep-escalation-callout h3 {
  color: #7c2d19;
  margin-bottom: 8px;
}
@media (prefers-reduced-motion: reduce) {
  .card-parent-actions .parent-discover.unexplored,
  .frontier-turn-pill.is-ready {
    animation: none;
  }
}

/* ==========================================================================
   COMPACT PERSON FOLIO HEADER, SLEEK PARENT STRIP & SPACIOUS READING PANE
   ========================================================================== */
.close-x {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  font-family: "Libre Caslon Text", Georgia, serif;
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.person-dialog .view {
  padding: 18px 26px 22px;
}
.person-header-band {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid rgb(184 159 109 / 0.5);
  margin-bottom: 6px;
}
.person-title-group {
  flex: 1;
  min-width: 220px;
}
.person-header-band h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}
.person-header-band .muted {
  margin: 3px 0 0;
  font-size: 15px;
}
.person-header-band .actions {
  margin: 0;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
}
.person-header-band .actions > a,
.person-header-band .actions > button:not(.close-x) {
  padding: 6px 12px;
  min-height: 34px;
  font-size: 14.5px;
  border-radius: 6px;
}

/* Compact Parent Discovery Strip inside Person Modal */
.person-dialog .parent-discoveries:not(.compact) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin: 4px 0 10px;
  align-items: stretch;
}
.person-dialog .parent-discoveries:not(.compact) .parent-discover {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 7px 11px;
  gap: 6px;
  min-height: 46px;
  border-radius: 6px;
  background: linear-gradient(165deg, #fffdf8 0%, #f3e6c8 100%);
  border: 1px dashed #9e762a;
}
.person-dialog .parent-discoveries:not(.compact) .parent-discover .known-parent {
  display: grid;
  grid-template-columns: 15px 1fr;
  column-gap: 7px;
  row-gap: 1px;
  align-items: center;
  justify-items: start;
  text-align: left;
  width: auto;
  flex: 1;
}
.person-dialog .parent-discoveries:not(.compact) .parent-discover .invitation-ornament {
  width: 15px;
  height: 15px;
  grid-row: 1 / 3;
}
.person-dialog .parent-discoveries:not(.compact) .parent-discover strong {
  font-size: 16px;
  line-height: 1.15;
}
.person-dialog .parent-discoveries:not(.compact) .parent-discover.unexplored span {
  display: none;
}
.person-dialog .parent-discoveries:not(.compact) .parent-discover small {
  font-size: 11.5px;
  line-height: 1.15;
  color: #76541d;
  white-space: nowrap;
}
.person-dialog .parent-discoveries:not(.compact) .parent-discover .parent-search-option {
  font-size: 11.5px;
  padding: 2px 0 2px 7px;
  margin-left: 2px;
  border-left: 1px solid rgb(166 128 50 / 0.35);
  white-space: nowrap;
  flex-shrink: 0;
}
.person-dialog .parent-discoveries:not(.compact) a.parent-discover {
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 8px;
  row-gap: 1px;
  align-items: center;
  text-align: left;
}
.person-dialog .parent-discoveries:not(.compact) a.parent-discover .discovery-seal {
  width: 26px;
  height: 26px;
  grid-row: 1 / 3;
}
.person-dialog .parent-discoveries:not(.compact) a.parent-discover strong {
  grid-column: 2;
  font-size: 15.5px;
  line-height: 1.15;
}
.person-dialog .parent-discoveries:not(.compact) a.parent-discover span:not(.discovery-seal) {
  grid-column: 2;
  font-size: 12px;
  line-height: 1.15;
}
.person-dialog .parent-discoveries:not(.compact) a.parent-discover small {
  grid-column: 3;
  grid-row: 1 / 3;
  font-size: 12px;
  white-space: nowrap;
}
.person-dialog .parent-discoveries:not(.compact) .both-parents {
  flex-basis: auto;
  width: 100%;
  height: auto;
  min-height: 46px;
  padding: 5px 12px;
  gap: 10px;
  border-radius: 6px;
  font-size: 16px;
}
.person-dialog .parent-discoveries:not(.compact) .both-parents .both-label small {
  font-size: 11.5px;
  margin-top: 1px;
}
.person-dialog .parent-discoveries:not(.compact) .both-parents .both-price {
  font-size: 19px;
  padding-left: 10px;
}
.person-dialog .parent-discoveries:not(.compact) .both-parents .both-price small {
  font-size: 12px;
}
.person-dialog .parent-discoveries:not(.compact) .both-parents .both-arrow {
  font-size: 14px;
}

/* Folio Tabs & Spacious Reading Sheet */
.person-dialog .tabs {
  margin: 4px 0 0;
  gap: 6px;
  border-bottom: 1.5px solid #bfa77a;
  padding: 0 4px;
  overflow-x: auto;
}
.person-dialog .tabs a {
  padding: 7px 16px;
  font-size: 17px;
  border-radius: 6px 6px 0 0;
  border: 1px solid transparent;
  border-bottom: 0;
  color: #6e5536;
  background: rgb(230 218 192 / 0.45);
}
.person-dialog .tabs a:hover {
  background: rgb(245 238 220 / 0.85);
  color: #3a2512;
}
.person-dialog .tabs a[aria-current="page"] {
  background: #fcf8ee;
  color: #3a2512;
  font-weight: 600;
  border-color: #bfa77a;
  box-shadow: 0 2px 0 #fcf8ee;
}
.person-dialog .profile-content {
  background: #fcf8ee;
  border: 1px solid #bfa77a;
  border-top: 0;
  border-radius: 0 0 6px 6px;
  padding: 16px 22px 24px;
}
.story-invitation-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgb(205 187 149 / 0.55);
}
.story-invitation,
.story-invitation-compact {
  padding: 0;
  margin: 0;
  font-size: 15px;
}
.story-invitation-compact {
  float: right;
  margin: 2px 0 8px 16px;
}
.person-dialog .profile-content > h2:first-of-type {
  margin-top: 0;
}
@media (max-width: 600px) {
  .person-dialog .view {
    padding: 14px;
  }
  .person-header-band h1 {
    font-size: 23px;
  }
  .person-dialog .profile-content {
    padding: 14px;
  }
  .story-invitation-compact {
    float: none;
    margin: 0 0 10px;
  }
}

/* ==========================================================================
   SURFACED STORIES, LINEAGE MASTERY MECHANICS & MCP BOT CONNECTOR HUB
   ========================================================================== */
.family-register .person-card .card-story-pill {
  margin-top: auto;
  align-self: flex-start;
  padding: 2px 9px;
  min-height: 22px;
  border-radius: 999px;
  border: 1px solid rgb(168 126 52 / 0.65);
  background: linear-gradient(145deg, #fbf1d6, #eedbb0);
  color: #5c3d14;
  font: italic 12.5px/1.2 "IM Fell English", Georgia, serif;
  box-shadow: inset 0 1px 0 #fffdf8, 0 1px 3px rgb(74 51 32 / 0.1);
  cursor: pointer;
}
.family-register .person-card .card-story-pill:hover {
  background: linear-gradient(145deg, #fff8e4, #f4e2b8);
  border-color: #8c3b2a;
  color: #4a2618;
}
.overview-scale .person-card .card-story-pill {
  visibility: hidden;
}
.overview-scale .card-parent-actions .parent-discover span:not(.discovery-seal),
.overview-scale .card-parent-actions .parent-discover small,
.overview-scale .card-parent-actions .parent-discover .parent-search-option,
.overview-scale .card-parent-actions .both-parents {
  display: none;
}
.overview-scale .card-parent-actions .parent-discover {
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.overview-scale .card-parent-actions .parent-discover strong {
  font-size: 28px;
  line-height: 1.15;
}
.overview-scale .card-parent-actions .parent-discover.unexplored {
  opacity: 0.62;
}
.overview-scale .card-parent-actions .parent-discover.ready {
  opacity: 1;
  border-width: 3px;
}

.lineage-mastery-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  min-height: 36px;
  border-radius: 999px;
  background: linear-gradient(145deg, #24382c, #17261e);
  border: 1px solid #8e7037;
  color: #ebd5a0;
  font: 600 12.5px/1.2 "Cinzel", Georgia, serif;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgb(255 248 220 / 0.16), 0 2px 6px rgb(9 16 12 / 0.25);
}
[data-theme="light"] .lineage-mastery-pill {
  background: linear-gradient(145deg, #fbf4e3, #eadbc0);
  border-color: #a88848;
  color: #4d3519;
}

.clue-bounty-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  min-height: 32px;
  border-radius: 999px;
  background: linear-gradient(145deg, #f8e7be, #e6c987);
  border: 1px solid #9c7223;
  color: #422a0d;
  font: italic 14px/1.15 "IM Fell English", Georgia, serif;
  text-decoration: none;
  box-shadow: inset 0 1px 0 #fffdf7;
}
.clue-bounty-pill:hover {
  background: linear-gradient(145deg, #fcf0d1, #edd396);
  border-color: #7c351e;
}

.story-spotlight-card {
  margin: 4px 0 18px;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid #c4a66a;
  background: linear-gradient(165deg, #fffdf7 0%, #f5ead1 100%);
  box-shadow: inset 0 1px 0 #ffffff, 0 4px 12px -3px rgb(74 51 32 / 0.1);
}
.story-spotlight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.story-spotlight-header .eyebrow {
  margin: 0;
  font: 700 11px/1.2 "Cinzel", Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8c3b2a;
}
.story-spotlight-header a {
  font-size: 14.5px;
  color: #6e4e1e;
}
.story-spotlight-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
}
.story-spotlight-card p {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.5;
}

/* MCP Connector & @bot Templates Hub */
.mcp-hero-card {
  margin: 18px 0 26px;
  padding: 20px 24px;
  border-radius: 10px;
  border: 1.5px solid var(--gold);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08), 0 8px 24px rgb(9 16 12 / 0.2);
}
.mcp-token-box {
  display: block;
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--raised);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.mcp-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
  margin: 16px 0 28px;
}
.mcp-template-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 10px;
}
.mcp-template-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.mcp-badge {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  font-size: 12px;
  color: var(--gold);
}
.mcp-template-card h3 {
  margin: 4px 0 8px;
  font-size: 21px;
}

/* Saved & Test Trees Directory in Tree Tools */
header .tree-picker {
  max-width: 265px;
}
.saved-trees-section {
  margin: 8px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #cdbb95;
}
.saved-trees-section h2 {
  margin: 0 0 8px;
  font-size: 20px;
}
.saved-trees-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}
.saved-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #c5b084;
  background: #fbf6e8;
}
.saved-tree-row.is-current {
  border-color: #8c3b2a;
  background: #f3e4be;
}
.saved-tree-row strong {
  display: block;
  font-size: 16.5px;
  line-height: 1.2;
}
.saved-tree-row span {
  display: block;
  font-size: 13.5px;
  color: #765e3d;
}
.saved-tree-row button {
  padding: 5px 12px;
  min-height: 32px;
  font-size: 14px;
  flex-shrink: 0;
}
