:root {
  color-scheme: light;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
  --ink: #14243f;
  --muted: #575366;
  --navy: #0d2c4d;
  --navy-hover: #193e63;
  --navy-edge: #081e35;
  --blue: #295986;
  --blue-deep: #1a4773;
  --blue-light: #e8edf5;
  --canvas: #faf4ea;
  --paper: #fffdf8;
  --surface-subtle: #f7efe3;
  --surface: #f2e7d7;
  --surface-hover: #ebddca;
  --line: #dfd0bc;
  --line-strong: #bda992;
  --button-line: #8395a7;
  --quiet-edge: #6c849c;
  --disabled-surface: #eee8dd;
  --disabled-text: #6c6258;
  --shadow: 0 5px 12px #4f3a2310;
  --page: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body { margin: 0; line-height: 1.5; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button[disabled] { cursor: default; }
input, textarea, select { min-width: 0; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
a { color: var(--blue-deep); }
a:hover { color: var(--blue); }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }
h1, h2, h3 { margin: 0; line-height: 1.08; letter-spacing: -0.035em; text-wrap: pretty; }
h1 { font-size: clamp(2.15rem, 4.1vw, 3.45rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.4vw, 2.1rem); font-weight: 780; }
h3 { font-size: clamp(1.18rem, 1.8vw, 1.45rem); font-weight: 750; }
ul, ol { margin: 0; padding: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
img { max-width: 100%; }
:target { scroll-margin-top: 110px; }
main:focus { outline: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 50;
  top: 0.5rem;
  left: 0.75rem;
  padding: 0.5rem 0.8rem;
  background: var(--paper);
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }
.muted { color: var(--muted); }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.icon { flex: 0 0 auto; width: 1.35rem; height: 1.35rem; vertical-align: middle; }
.actions, .inline-meta { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  padding: 0.48rem 0.85rem;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  color: var(--ink);
  background: transparent;
  font-weight: 620;
}
.button.primary {
  --button-edge: var(--navy-edge);
  color: #fff;
  border-color: var(--navy);
  background: var(--navy);
  font-weight: 720;
}
.button.primary:hover:not(:disabled) { background: var(--navy-hover); color: #fff; }
.button.quiet {
  --button-edge: var(--quiet-edge);
  border-color: var(--button-line);
  background: var(--paper);
}
.button.quiet:hover:not(:disabled) { border-color: var(--blue); background: var(--surface-subtle); }
.button:is(.primary, .quiet, .book-open-button, .book-cover-new) { box-shadow: 0 2px 0 var(--button-edge); }
.button:is(.primary, .quiet, .book-open-button, .book-cover-new):active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: none;
}
.button.danger { color: #91323b; }
.button:disabled {
  color: var(--disabled-text);
  border-color: var(--line);
  background: var(--disabled-surface);
  box-shadow: none;
}
.icon-button { width: 44px; min-width: 44px; padding: 0.35rem; }
.icon-button .icon { color: var(--blue); }
.button:disabled .icon { color: inherit; }

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: grid;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(0.7rem, 1.9vw, 2rem);
  width: min(var(--page), 100%);
  padding: 0.7rem clamp(1rem, 2.4vw, 2.6rem);
  margin: auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  justify-self: start;
  font-size: clamp(1.04rem, 1.56vw, 1.31rem);
  font-weight: 800;
  line-height: 1.01;
  letter-spacing: -0.035em;
  text-decoration: none;
  color: var(--ink);
}
.brand .icon { width: 2.55rem; height: 2.55rem; color: var(--blue); }
.brand:hover { color: var(--blue-deep); }
.top-nav { display: flex; flex-wrap: wrap; min-width: 0; gap: clamp(0.12rem, 1vw, 0.8rem); justify-content: center; }
.nav-link {
  padding: 0.55rem clamp(0.52rem, 1.15vw, 1rem);
  border-radius: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 690;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-link:hover { color: var(--blue-deep); background: var(--surface-subtle); }
.nav-link[aria-current="page"] { color: var(--navy); background: var(--surface); box-shadow: inset 0 -2px var(--blue); }
.family-names { max-width: 64rem; margin-inline: auto; padding-top: clamp(0.75rem, 2vw, 1.5rem); }
.family-names article {
  margin-top: 1.25rem;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface);
}
.family-names article section + section { margin-top: 1.35rem; }
.family-names article h2 { margin-bottom: 0.7rem; }
.family-names article p { margin: 0.35rem 0; max-width: 68ch; }
.surname-distribution {
  max-width: 39rem;
  margin: 0.9rem 0 0;
  padding: clamp(0.75rem, 2.5vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--paper);
}
.surname-distribution figcaption { margin-bottom: 0.7rem; }
.surname-distribution figcaption small { display: block; }
.surname-distribution ul { list-style: none; display: grid; gap: 0.35rem; margin-bottom: 0.75rem; }
.surname-distribution li { display: grid; grid-template-columns: 6.9rem minmax(1.1rem, 1fr) 4rem; align-items: center; gap: 0.45rem; font-size: 0.9rem; }
.surname-distribution li span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.surname-distribution meter { width: 100%; height: 0.85rem; }
.surname-distribution meter::-webkit-meter-bar { background: var(--surface); border-color: var(--line); border-radius: 1rem; }
.surname-distribution meter::-webkit-meter-optimum-value { background: var(--blue-deep); border-radius: 1rem; }
.surname-distribution meter::-moz-meter-bar { background: var(--blue-deep); }
.header-actions { display: flex; align-items: center; gap: 0.45rem; grid-column: 3; }
.header-messages { gap: 0.4rem; padding-inline: 0.65rem; }
.unread-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.45rem;
  min-height: 1.45rem;
  padding: 0 0.32rem;
  border-radius: 1rem;
  color: #fff;
  background: var(--blue-deep);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.private-tag {
  border: 1px solid var(--line);
  color: var(--blue-deep);
  border-radius: 0.7rem;
  padding: 0.42rem 0.6rem;
  background: var(--surface-subtle);
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 670;
}
.identity { display: inline-flex; align-items: center; gap: 0.38rem; }
.identity .icon { width: 1.03rem; height: 1.03rem; }
.header-exit { min-height: 38px; width: 38px; min-width: 38px; }
.header-book-action { flex: 0 0 44px; }
.book-action-results { list-style: none; max-height: min(16rem, 32svh); overflow: auto; margin-block: 0.35rem; }
.book-action-results .button { justify-content: flex-start; width: 100%; }
.book-action-selected:empty { display: none; }
.book-action-selected { margin-block: 0.6rem; font-weight: 700; overflow-wrap: anywhere; }
.shell { max-width: var(--page); margin: 0 auto; padding: 0.85rem clamp(0.9rem, 2.4vw, 2.6rem) 2.75rem; }
.loading, .empty, .load-error { margin: 1rem 0; color: var(--muted); }
.load-error { border: 1px solid var(--line); border-radius: 1rem; padding: 1.5rem; background: var(--paper); }
.load-error h1 { margin-bottom: 0.75rem; }
.toast {
  position: fixed;
  z-index: 35;
  right: 1rem;
  bottom: 1rem;
  max-width: min(420px, calc(100% - 2rem));
  background: var(--navy);
  color: #fff;
  border-radius: 0.75rem;
  padding: 0.8rem 1.05rem;
  box-shadow: 0 6px 22px #111f5740;
}
.breadcrumbs { font-size: 0.94rem; color: var(--muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.4rem 0.55rem; list-style: none; }
.breadcrumbs li { display: flex; align-items: center; gap: 0.55rem; overflow-wrap: anywhere; }
.breadcrumbs li + li::before { content: "/"; color: #68789a; }
.breadcrumbs [aria-current] { color: var(--ink); }
.page-heading { margin: 1.1rem 0 0.9rem; }
.page-heading p, .tree-heading p { margin: 0.42rem 0 0; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }

.search-wrapper { position: relative; min-width: 0; }
.search-field {
  display: flex;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 0.72rem;
  align-items: stretch;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: border-color 140ms ease, box-shadow 140ms ease;
  min-width: 0;
}
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px #29598642; }
.search-field input {
  flex: 1 1 0;
  width: 100%;
  border: 0;
  outline: none;
  border-radius: 0.72rem;
  background: transparent;
  padding: 0.45rem 0.5rem 0.45rem 0.12rem;
}
.search-field input:focus-visible { outline: 0; }
.search-field input::placeholder { color: #526180; opacity: 1; }
.search-label { display: flex; align-items: center; padding: 0 0.75rem; gap: 0.6rem; white-space: nowrap; }
.search-label .icon { color: var(--ink); }
.search-clear.button { --button-edge: transparent; border: none; min-height: 40px; align-self: center; margin-right: 0.22rem; }
.search-popup {
  position: absolute;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.72rem;
  box-shadow: 0 12px 30px #4f3a232b;
  z-index: 15;
  left: 0;
  right: 0;
  margin-top: 0.37rem;
  text-align: left;
  overflow: hidden;
}
.search-message { padding: 0.55rem 0.8rem; margin: 0; color: var(--muted); font-size: 0.9rem; }
.search-results { max-height: min(360px, 48vh); list-style: none; overflow: auto; overscroll-behavior: contain; }
.search-result {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.search-result:hover, .search-result[aria-selected="true"] { background: var(--surface); }
.search-result small { display: block; font-size: 0.85rem; }
.search-more { margin: 0.45rem; }

.home, .record-page { max-width: 73rem; margin-inline: auto; }
.home { display: grid; gap: clamp(1.1rem, 3vw, 2rem); padding-top: clamp(0.65rem, 2.9vw, 2.15rem); }
.home h1, .home h2, .profile h1, .profile h2, .family-names h1, .family-names h2,
.tree-heading h1, .family-map-title h1, .book-library-heading h1,
.news-page h1, .directory .page-heading h1, .selection-panel h2, .selection-relations h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.025em;
}
.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(0.85rem, 3vw, 2.4rem);
  align-items: center;
}
.home-intro h1 { font-size: clamp(2.15rem, 4.55vw, 3.7rem); overflow-wrap: anywhere; }
.home-lead { color: #485d77; font-size: clamp(0.98rem, 1.7vw, 1.17rem); margin: 0.56rem 0 0; }
.home-search { min-width: 0; }
.home-search-label { display: block; margin-bottom: 0.25rem; font-weight: 650; color: #203b5a; }
.home-search .search-field {
  min-height: 46px;
  border-color: var(--line-strong);
  border-radius: 0.48rem;
  background: var(--paper);
}
.home-search .search-field input { padding-inline-start: 0.68rem; }
.home-search-submit.button { flex: 0 0 44px; min-height: 44px; padding: 0; border: 0; color: #264d7e; }
.home-find {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.9rem, 4.5vw, 3.1rem);
  padding: clamp(1.25rem, 4.5vw, 3.35rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.48rem;
}
.home-find:not(:has(.home-find-figure)) { grid-template-columns: minmax(0, 1fr); }
.home-find-copy { display: grid; justify-items: start; gap: 0.72rem; min-width: 0; }
.home-find-copy > * { margin: 0; }
.home-find-copy h2 { font-size: clamp(2.25rem, 5.35vw, 4.5rem); white-space: pre-line; overflow-wrap: anywhere; }
.home-find-label { color: #264d7e; font-size: 0.86rem; font-weight: 700; }
.home-find-teaser { max-width: 47ch; color: #283c55; }
.home-find-actions { gap: 0.4rem 0.9rem; }
.home-profile-link { display: inline-flex; align-items: center; min-height: 44px; color: #244c81; text-underline-offset: 0.2em; }
.home-find-figure { margin: 0; min-width: 0; }
.home-find-figure a { display: block; }
.home-find-figure img { display: block; width: 100%; max-height: clamp(14rem, 35svh, 20rem); object-fit: contain; }
.home-find-credit { color: #425a73; margin-top: 0.5rem; font-size: 0.83rem; overflow-wrap: anywhere; text-align: center; }
.home-find-copy .home-find-credit { margin: 0; text-align: start; }
.home-shortcuts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.32rem clamp(0.8rem, 2.8vw, 2.2rem); }
.home-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.36rem;
  min-height: 44px;
  padding: 0 0.12rem;
  border: 0;
  background: transparent;
  color: #244c81;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.home-shortcut .icon { width: 1.14rem; height: 1.14rem; }
.home-shortcut:hover { color: var(--navy); }
.home-news {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  align-items: start;
  gap: clamp(0.85rem, 1.8vw, 1.5rem);
}
.news-panel {
  display: grid;
  gap: 0.64rem;
  padding: clamp(0.78rem, 1.6vw, 1.18rem);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--paper);
}
.news-panel h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); }
.news-panel p { margin: 0; }
.news-page { max-width: 52rem; margin-inline: auto; }
.directory { max-width: 73rem; margin-inline: auto; }
.view-lead { color: #485d77; }
.news-list { display: grid; list-style: none; }
.news-list:empty { display: none; }
.news-list li + li { border-top: 1px solid var(--line); }
.news-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.65rem;
  min-height: 44px;
  border-radius: 0.55rem;
  padding: 0.52rem 0.45rem;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.news-row:hover, .news-row:focus-visible { color: var(--blue-deep); background: var(--surface-subtle); }
.news-row:hover strong, .news-row:focus-visible strong { text-decoration: underline; }
.news-row-unread { background: var(--surface-subtle); }
.news-item-icon {
  display: grid;
  place-items: center;
  width: 2.05rem;
  height: 2.05rem;
  margin-top: 0.1rem;
  border-radius: 0.54rem;
  color: var(--blue-deep);
  background: var(--blue-light);
}
.news-item-icon .icon { width: 1.15rem; height: 1.15rem; }
.news-item-copy { display: grid; gap: 0.08rem; }
.news-item-copy strong { line-height: 1.3; }
.news-kind, .news-meta { color: var(--muted); font-size: 0.85rem; }
.news-kind { font-weight: 650; }
.news-invitation-line { font-size: 0.91rem; }
.news-unread {
  display: inline-block;
  margin-inline-start: 0.38rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.76rem;
  font-weight: 750;
  color: var(--blue-deep);
  background: var(--blue-light);
}
.news-more {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 44px;
  font-weight: 670;
  text-underline-offset: 0.18em;
}
.news-full-list .button { justify-self: start; }
.genealogy-activity h2 { scroll-margin-top: 120px; }
.genealogy-activity-list { display: grid; gap: 0.6rem; list-style: none; }
.genealogy-activity-item {
  display: grid;
  gap: 0.33rem;
  padding: 0.7rem 0.82rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--paper);
  overflow-wrap: anywhere;
}
.genealogy-activity-item p { margin: 0; }
.genealogy-activity-meta { font-size: 0.91rem; }
.genealogy-activity-links { gap: 0.35rem 0.8rem; }

.tree-heading {
  margin: 0.85rem 0 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(215px, 0.9fr) auto;
  gap: 0.75rem 0.9rem;
  align-items: center;
}
.tree-heading h1 { font-size: clamp(2rem, 3.3vw, 3.05rem); overflow-wrap: anywhere; }
.tree-heading p, .family-map-title p, .book-library-heading p { color: #485d77; }
.segment { display: flex; align-items: stretch; gap: 0.2rem; border-radius: 0.72rem; padding: 0.25rem; background: var(--surface); }
.segment .segment-button { flex: 1 1 0; border: 0; min-width: 0; justify-content: center; }
.segment-button:hover:not(:disabled) { background: var(--surface-subtle); }
.segment-button[aria-pressed="true"]:not(:disabled) { color: var(--navy); background: var(--paper); box-shadow: inset 0 -2px var(--blue); }
.tree-mode.segment { border: 1px solid var(--line); }
.tree-mode .segment-button { text-align: center; line-height: 1.2; }
.tree-orientation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.8rem;
  margin-bottom: 0.8rem;
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 0.56rem 0.72rem;
}
.selection-label { display: flex; align-items: center; gap: 0.46rem; flex: 1 1 auto; }
.selection-label .icon { color: var(--blue); }
.selection-confirmation { color: var(--blue-deep); font-size: 0.875rem; font-weight: 675; }
.tree-navigation { margin-left: auto; }
.tree-navigation select {
  appearance: none;
  padding: 0.4rem 2rem 0.4rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.67rem;
  background: var(--paper);
  background-image: linear-gradient(45deg,transparent 52%, #244492 52%), linear-gradient(135deg, #244492 52%,transparent 52%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  min-height: 44px;
}
.tree-relative-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 25rem), 1fr));
  align-items: start;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.8rem;
}
.tree-relative-group {
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 0.65rem;
  background: var(--surface-subtle);
}
.tree-relative-heading {
  display: block;
  margin-bottom: 0.28rem;
  color: #485d77;
  font-size: 0.86rem;
  font-weight: 700;
}
.tree-relative-buttons { display: flex; flex-wrap: wrap; gap: 0.35rem 0.45rem; }
.tree-relative-buttons .button {
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  text-align: left;
  overflow-wrap: anywhere;
}
.tree-relative-buttons .button span { min-width: 0; }
.tree-lineage {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.8rem;
}
.tree-lineage label { display: grid; gap: 0.2rem; min-width: 0; max-width: 100%; }
.tree-lineage select { max-width: 100%; }
.tree-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 31%); gap: 0.8rem; align-items: start; }
.tree-grid-overall { grid-template-columns: minmax(0, 1fr) minmax(270px, 27%); }
.graph-area { min-width: 0; }
.graph-board {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  height: clamp(530px, 68vh, 760px);
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: radial-gradient(ellipse at 42% 41%, var(--paper), var(--surface-subtle) 82%);
}
.graph-board-focused { height: clamp(505px, 65vh, 700px); }
.graph-hint { background: var(--surface); color: #21488c; border-radius: 99px; align-self: center; padding: 0.23rem 0.8rem; margin: 0.6rem 0.55rem 0; font-size: 0.88rem; text-align: center; }
.touch-hint { display: none; }
.graph-viewport {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  min-height: 220px;
  min-width: 0;
  cursor: grab;
  outline-offset: -3px !important;
}
.graph-viewport.is-panning, .graph-viewport.is-panning .graph-card { cursor: grabbing; }
.graph-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.graph-lines { position: absolute; inset: 0; display: block; overflow: visible; pointer-events: none; }
.connection { fill: none; stroke-width: 2.9; stroke-linecap: round; stroke-linejoin: round; stroke: #7c92bd; }
.connection-underlay { fill: none; stroke: var(--surface-subtle); stroke-width: 7px; stroke-linejoin: round; }
.edge-confirmed { stroke: #2755ef; color: #2755ef; }
.edge-supported { stroke: #b87400; color: #a36800; stroke-dasharray: 10 8; }
.edge-open { stroke: #64779c; color: #64779c; stroke-dasharray: 3 7; }
.edge-disputed { stroke: #ad3d4f; color: #ad3d4f; stroke-dasharray: 11 5 2 5; }
.edge-unknown { stroke: #7c92bd; color: #7c92bd; }
.family-stem { stroke: #526f9e; }
.family-junction { fill: #526f9e; stroke: var(--paper); stroke-width: 1.5px; }
.family-boundary { position: absolute; border: 2px solid var(--line); border-radius: 22px; background: #efe3d190; }
.family-label { position: absolute; top: 12px; left: 12px; white-space: nowrap; font-weight: 740; padding: 4px 11px; border-radius: 40px; color: #254480; background: var(--surface); font-size: 1rem; }
.graph-generation {
  position: absolute;
  display: flex;
  align-items: center;
  padding-inline-start: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8b0;
  color: #355486;
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
}
.graph-generation.is-reference { border-color: var(--line-strong); background: var(--surface); }
.graph-viewport[data-level="compact"] .graph-generation span { visibility: hidden; }
.partner-unit { position: absolute; border: 2px solid var(--line-strong); border-radius: 21px; background: var(--surface); pointer-events: none; }
.graph-card-position {
  position: absolute;
  width: 230px;
  height: 86px;
  isolation: isolate;
}
.graph-card-position-selected { z-index: 2; }
.graph-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  border: 2px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 5px 12px #4f3a2324;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 10px;
  overflow: hidden;
}
.graph-card:hover { border-color: var(--blue); background: var(--surface-subtle); }
.graph-card[aria-pressed="true"] { background: var(--blue-light); border-color: var(--blue-deep); box-shadow: 0 0 0 4px #29598640, 0 5px 13px #19355230; }
.graph-card-copy { min-width: 0; display: block; line-height: 1.1; }
.graph-card-copy strong {
  font-size: 17px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.graph-date { display: block; font-size: 14px; color: #2f4775; margin-top: 4px; }
.graph-repeat { display: block; font-size: 13px; font-weight: 700; color: #274b88; margin-top: 3px; }
.graph-card-repeat .graph-card-copy strong { -webkit-line-clamp: 2; }
.graph-card-repeat { border-style: dashed; }
.graph-card-generation-ref { border-color: #9c722e; }
.graph-card-mark { display: none; }
.graph-card-position .graph-portrait { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); }
.graph-viewport:not([data-level="full"]) .graph-portrait, .graph-portrait:not(:has(img)) { display: none; }
.graph-viewport[data-level="full"] .graph-card-position:has(.graph-portrait > img) .graph-card .avatar { visibility: hidden; }
.graph-viewport[data-level="summary"] .graph-card .avatar { width: 34px; height: 34px; font-size: 15px; }
.graph-viewport[data-level="summary"] .graph-card-copy strong { font-size: 20px; }
.graph-viewport[data-level="summary"] .graph-date { display: none; }
.graph-card-birth { padding-block: 3px; }
.graph-card-birth .graph-card-copy strong,
.graph-viewport[data-level="summary"] .graph-card-birth .graph-card-copy strong { font-size: 16px; -webkit-line-clamp: 2; }
.graph-birth-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--muted);
  margin-top: 1px;
}
.graph-card-birth .graph-date, .graph-card-birth .graph-repeat { margin-top: 1px; font-size: 12px; }
.graph-viewport[data-level="compact"] .graph-card { border-radius: 18px; border-width: 4px; padding: 10px 15px; box-shadow: none; gap: 15px; grid-template-columns: auto minmax(0, 1fr); }
.graph-viewport[data-level="compact"] .graph-card[aria-pressed="true"] { border-width: 9px; box-shadow: 0 0 0 9px #29598648; }
.graph-viewport[data-level="compact"] .graph-card .avatar { width: 52px; height: 52px; font-size: 29px; }
.graph-viewport[data-level="compact"] .graph-card-copy, .graph-viewport[data-level="compact"] .family-label { display: none; }
.graph-viewport[data-level="compact"] .graph-card-mark { display: block; height: 26px; border-top: 9px solid #af9e8a; border-bottom: 9px solid #ccbba5; border-radius: 3px; }
.graph-viewport[data-level="compact"] .partner-unit { border-width: 5px; }
.graph-viewport[data-level="compact"] .connection { stroke-width: 6; }
.graph-viewport[data-level="compact"] .connection-underlay { stroke-width: 13px; }
.graph-bottom {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  flex: 0 0 auto;
  gap: 0.6rem;
  padding: 0.65rem;
}
.graph-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.46rem; }
.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.7rem;
  min-height: 44px;
  padding: 0.1rem 0.12rem;
  background: var(--paper);
}
.zoom-controls .icon-button { min-height: 38px; min-width: 40px; width: 40px; }
.zoom-value { text-align: center; min-width: 52px; font-size: 0.92rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.minimap {
  width: min(190px, 25vw);
  padding: 0.38rem 0.48rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.65rem;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.2;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 700;
  display: grid;
  gap: 0.2rem;
}
.minimap svg { display: block; width: 100%; height: 70px; }
.minimap-group { fill: var(--surface-subtle); stroke: var(--line); stroke-width: 3px; }
.minimap-person { fill: #a08d77; }
.minimap-selected { fill: var(--blue-deep); }
.minimap-content .connection { stroke-width: 10px; opacity: 0.65; }
.minimap-box { fill: #29598624; stroke: var(--blue); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.tree-legend {
  display: flex;
  gap: 0.4rem 0.85rem;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface-subtle);
  border-radius: 0.64rem;
  padding: 0.55rem 0.72rem;
  margin-top: 0.6rem;
  font-size: 0.88rem;
}
.tree-legend > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-edge { width: 23px; border-top: 3px solid; }
.legend-edge.edge-open { border-top-style: dotted; }
.legend-edge.edge-supported, .legend-edge.edge-disputed { border-top-style: dashed; }
.legend-edge.edge-unknown { border-top-width: 2px; }

.ancestor-fan {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: radial-gradient(ellipse at 50% 78%, var(--paper), var(--surface-subtle) 80%);
  padding: clamp(0.18rem, 1vw, 0.75rem);
}
.ancestor-fan-chart { display: block; width: 100%; height: auto; }
.fan-depth { display: flex; align-items: center; gap: 0.5rem; }
.fan-back { text-align: left; overflow-wrap: anywhere; }
.ancestor-fan-chart foreignObject { pointer-events: none; }
.fan-wedge { fill: var(--surface); stroke: var(--paper); stroke-width: 2px; }
.fan-branch-second .fan-wedge { fill: #e3e7d7; }
.fan-hub .fan-wedge { fill: var(--paper); stroke: var(--line-strong); stroke-width: 2.5px; }
.fan-gap .fan-wedge { fill: var(--surface-subtle); stroke: var(--line-strong); stroke-width: 1.1px; stroke-dasharray: 4 5; }
.fan-status { fill: none; stroke-width: 1.65px; pointer-events: none; }
.fan-status.edge-supported, .fan-status.edge-open, .fan-status.edge-disputed { stroke-width: 3.1px; }
.fan-selectable { cursor: pointer; }
.fan-selectable:hover .fan-wedge { stroke: var(--blue); stroke-width: 2.5px; }
.fan-in-path .fan-wedge { fill: #e3eaf1; stroke: var(--blue); stroke-width: 2.5px; }
.fan-selected .fan-wedge { fill: #d1e0ee; stroke: var(--blue-deep); stroke-width: 3px; }
.fan-path-summary { padding: 0.55rem 0.7rem; margin-top: 0.5rem; border-left: 3px solid var(--blue); border-radius: 0.4rem; background: var(--surface-subtle); }
.fan-path-summary ol { display: flex; flex-wrap: wrap; column-gap: 0.5rem; list-style: none; }
.fan-path-summary li { display: flex; gap: 0.5rem; overflow-wrap: anywhere; }
.fan-path-summary [aria-current] { font-weight: 700; }
.fan-path-arrow { color: var(--blue-deep); }
.fan-label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  height: 100%;
  text-align: center;
  line-height: 1.11;
  color: var(--ink);
}
.fan-label strong, .fan-label small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.fan-label strong { font-size: 14px; }
.fan-label small { font-size: 11.5px; color: var(--muted); }
.fan-hub .fan-label strong { font-size: 17px; }
.fan-list { display: grid; gap: 0.7rem; margin-top: 1.2rem; }
.fan-list > .fan-person { justify-self: start; }
.fan-generation { display: grid; gap: 0.45rem; }
.fan-generation h3 { font-size: 1.15rem; }
.fan-pairs { display: grid; gap: 0.48rem; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.fan-pair { display: grid; gap: 0.32rem; align-content: start; padding: 0.45rem; border: 1px solid var(--line); border-radius: 0.65rem; }
.fan-lineage { font-size: 0.9rem; margin: 0 0 0.05rem; overflow-wrap: anywhere; }
.fan-person, .fan-gap-label { padding: 0.4rem 0.57rem; border-radius: 0.48rem; min-height: 44px; overflow-wrap: anywhere; }
.fan-person { display: grid; justify-items: start; text-align: left; border: 1px solid var(--line); background: var(--paper); }
.fan-person small { color: var(--muted); }
.fan-person small:empty { display: none; }
.fan-person:hover, .fan-person[aria-pressed="true"] { border-color: var(--blue); background: var(--surface); }
.fan-gap-label { margin: 0; border: 1px dashed var(--line); font-size: 0.9rem; }
.no-person { margin-top: 1rem; }
.no-person p { margin-top: 0.6rem; }
.no-person .button { margin-top: 0.4rem; }

.avatar {
  display: inline-grid;
  place-items: center;
  position: relative;
  flex: 0 0 auto;
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 50%;
  background: var(--surface);
  color: #1c386f;
  font-weight: 780;
  overflow: hidden;
}
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portrait-open { appearance: none; border: 0; padding: 0; cursor: zoom-in; }
.portrait-open:hover { box-shadow: 0 0 0 2px var(--blue); }
.portrait-original {
  width: min(52rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: clamp(0.8rem, 2vw, 1.3rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  background: var(--paper);
}
.portrait-original::backdrop { background: #142340b0; }
.portrait-original-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.portrait-original-heading h2 { overflow-wrap: anywhere; }
.portrait-original-heading p { margin: 0 0 0.2rem; }
.portrait-original-heading .button { flex-shrink: 0; }
.portrait-original-image {
  display: grid;
  place-items: center;
  margin-top: 0.85rem;
  padding: 0.45rem;
  border-radius: 0.6rem;
  background: var(--surface);
}
.portrait-original-image img { display: block; width: 100%; height: min(72dvh, 47rem); object-fit: contain; }
.avatar-profile { width: clamp(4.5rem, 7.5vw, 7.25rem); height: clamp(4.5rem, 7.5vw, 7.25rem); font-size: clamp(1.7rem, 3.4vw, 3.1rem); }
.avatar-graph { width: 40px; height: 40px; font-size: 16px; }
.avatar-small { width: 2.42rem; height: 2.42rem; font-size: 0.9rem; }

.directory-search { width: min(550px, 100%); }
.directory-results { margin-top: 0.95rem; }
.result-count { margin: 0.1rem 0 0.6rem; }
.directory-grid, .book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}
.directory-card, .book-card {
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--paper);
  box-shadow: var(--shadow);
  min-width: 0;
}
.directory-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.65rem; padding: 0.78rem; text-wrap: pretty; }
.directory-heading { display: flex; gap: 0.62rem; align-items: flex-start; }
.directory-context { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.person-link { font-weight: 740; font-size: 1.04rem; overflow-wrap: anywhere; }
.directory-tree { margin-top: auto; align-self: flex-start; }
.load-more { margin-top: 0.9rem; }

.record-page { padding-top: clamp(0.35rem, 1.5vw, 1.15rem); }
.record-top { display: flex; gap: 0.6rem 1rem; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: clamp(1.1rem, 2.5vw, 2rem); }
.record-top .search-wrapper { width: min(320px, 100%); }
.record-nav { display: flex; align-items: center; gap: 1.15rem; }
.record-grid { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 0.92rem; }
.record-grid.editor-open { grid-template-columns: minmax(0, 1fr) minmax(320px, 37%); }
.profile { min-width: 0; color: #182942; }
.profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem 1.25rem;
  align-items: center;
  margin-bottom: clamp(1.3rem, 3.2vw, 2.65rem);
}
.profile-hero .person-heading { align-items: flex-start; padding: 0; }
.profile-hero .person-heading-copy { border: 0; padding: 0; }
.profile-hero .person-heading h1 { font-size: clamp(2.2rem, 4.65vw, 3.85rem); margin-bottom: 0.28em; }
.profile-hero .avatar-profile:not(:has(img)) { display: none; }
.profile-hero .person-meta { color: #4b6079; font-size: clamp(1.02rem, 1.8vw, 1.25rem); }
.profile-hero .profile-story-action { justify-self: end; min-height: 3rem; padding: 0.65rem clamp(0.8rem, 2vw, 1.25rem); }
.profile-intro { max-width: 47ch; margin-top: 0.9rem; font-size: clamp(1.05rem, 2vw, 1.28rem); line-height: 1.52; text-wrap: pretty; }
.person-heading {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.35rem);
  padding: 0.35rem 0 0.9rem;
  min-width: 0;
}
.person-heading-copy { min-width: 0; border-left: 1px solid var(--line); padding-left: clamp(0.8rem, 2vw, 1.35rem); }
.person-heading h1 { font-size: clamp(2rem, 4.3vw, 3rem); margin-bottom: 0.5rem; overflow-wrap: anywhere; }
.person-name-variants { font-size: 0.9rem; margin-bottom: 0.5rem; overflow-wrap: anywhere; }
.person-meta { display: flex; align-items: center; gap: 0.42rem; color: #182f5d; margin: 0.12rem 0; }
.person-meta .icon { width: 1.15rem; height: 1.15rem; color: var(--blue); }
.profile-tree-actions { gap: 0.48rem 0.65rem; margin-top: 0.65rem; }
.profile-tree-actions .button { max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.profile-tree-actions .icon { width: 1.12rem; height: 1.12rem; color: var(--blue-deep); }
.profile-actions { margin: 0.45rem 0 1.15rem; padding-top: 1.05rem; border-top: 1px solid var(--line); }
.profile-edit-actions { margin-top: 0.75rem; }
.profile-record { container: profile-record / inline-size; }
.genealogy-original-value { display: block; }
.selection-panel, .editor-panel {
  border: 1px solid var(--line);
  border-radius: 0.88rem;
  background: var(--paper);
}
.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.12rem clamp(0.38rem, 1.75vw, 1.4rem);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: transparent;
}
.profile-tabs .segment-button {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #3d5674;
  font-size: clamp(0.97rem, 1.55vw, 1.12rem);
  font-weight: 550;
  min-height: 48px;
  padding-inline: clamp(0.58rem, 1.35vw, 1rem);
  white-space: normal;
}
.profile-tabs .segment-button[aria-pressed="true"]:not(:disabled) {
  border-bottom-color: var(--navy);
  background: transparent;
  color: #192f4d;
  box-shadow: none;
  font-weight: 720;
}
.profile-tabs .segment-button:disabled {
  color: var(--muted);
  background: transparent;
  opacity: 0.55;
  cursor: default;
}
.profile-tabs .segment-button .icon { width: 1.05em; height: 1.05em; }
.record-content { padding: clamp(0.88rem, 2.6vw, 1.62rem) 0; }
.record-content h2 { margin-bottom: 0.75rem; }
.profile-overview { padding-block: clamp(1.2rem, 3vw, 2.1rem); }
.profile-overview h2 { font-size: clamp(1.85rem, 3.4vw, 2.7rem); line-height: 1.12; }
.profile-milestones { display: grid; gap: 0.95rem; list-style: none; margin-top: 1.15rem; }
.profile-milestones li {
  display: grid;
  grid-template-columns: clamp(4.5rem, 10vw, 6.25rem) minmax(0, 1fr);
  gap: 0.72rem clamp(0.62rem, 2vw, 1.6rem);
  align-items: baseline;
  font-size: clamp(1.02rem, 1.7vw, 1.24rem);
  line-height: 1.4;
}
.profile-milestones small { display: block; font-size: 0.86em; }
.profile-milestones li > div { overflow-wrap: anywhere; }
.profile-milestone-date { color: #234b82; font-weight: 720; overflow-wrap: anywhere; }
.profile-overview-actions { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin-top: 0.9rem; }
.profile-text-action, .profile-text-action.button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  color: #234b82;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.22em;
  font-weight: 550;
}
.profile-text-action:hover { color: #122f58; }
.profile-parents ul { list-style: none; }
#profil-quellen, #profil-chronik, #profil-familienbuch { scroll-margin-top: 9rem; }
.profile-book .book-cover-stage { margin-top: 0.4rem; width: min(100%, var(--book-leaf-width)); }
.profile-book-related { margin-top: 1.35rem; }
.profile-book-related .book-library-grid { margin-top: 0.65rem; }
.profile-overview-details + .profile-stories { margin-top: 1.6rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.profile .profile-stories .section-heading { align-items: start; gap: 0.48rem; }
.profile .profile-stories h2 { margin-bottom: 0; }
@container profile-record (min-width: 44rem) {
  .profile-overview:has(> .profile-overview-details + .profile-stories :is(.story-summary-list, .section-heading > .button)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    column-gap: clamp(1.5rem, 4vw, 4rem);
  }
  .profile-overview-details + .profile-stories:has(.story-summary-list, .section-heading > .button) {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  .profile-overview .story-summary-list { grid-template-columns: minmax(0, 1fr); }
}
.timeline {
  list-style: none;
  padding-left: 1rem;
  margin: 0.7rem 0 1rem;
  display: flex;
  flex-direction: column;
  position: relative;
}
.timeline li:not(.source-list li) { position: relative; border-left: 2px solid var(--line); padding: 0 0 0.86rem 1.05rem; }
.timeline li:not(.source-list li)::before {
  content: "";
  position: absolute;
  top: 0.4rem;
  left: -0.39rem;
  width: 0.69rem;
  height: 0.69rem;
  border-radius: 50%;
  background: var(--blue);
}
.timeline li:not(.source-list li):last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline p { margin: 0.04rem 0; }
.timeline-details summary { color: var(--blue); cursor: pointer; width: fit-content; padding-block: 0.34rem; }
.timeline-actions { margin-top: 0.55rem; }
.event-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 0.32rem 0.5rem; }
.event-heading strong { font-size: 1.04rem; }
.event-photos { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.65rem 0; }
.event-photo { width: min(100%, 13rem); margin: 0; overflow-wrap: anywhere; }
.event-photo-link { display: block; width: fit-content; margin-bottom: 0.4rem; }
.event-photo-link img { display: block; max-width: 100%; max-height: 9rem; object-fit: contain; border-radius: 0.4rem; }
.event-photo figcaption { font-size: 0.88rem; }
.event-photo figcaption .actions { gap: 0.3rem; }
.source-list { list-style: none; display: grid; gap: 0.3rem; padding: 0.42rem 0 0.25rem; }
.source-list li { font-size: 0.92rem; overflow-wrap: anywhere; }
.source-list li small { display: block; color: var(--muted); white-space: pre-wrap; }
.source-reading { margin-block: .75rem; max-width: 70ch; }
.source-reading p { margin-block: .35rem 0; font-size: 1rem; line-height: 1.55; }
.source-list .status, .source-list .subtle-tag { margin-left: 0.38rem; }
.source-section { margin-top: 0.95rem; border-top: 1px solid var(--line); padding-top: 0.85rem; }
.research-list > li { padding: 0.6rem; border-radius: 0.65rem; background: var(--surface-subtle); }
.research-list p { margin: 0.3rem 0 0; }
.status, .subtle-tag {
  display: inline-block;
  padding: 0.08rem 0.5rem;
  color: #214486;
  border-radius: 0.45rem;
  line-height: 1.4;
  font-size: 0.82rem;
  font-weight: 690;
  background: var(--surface);
}
.status-confirmed { color: var(--blue-deep); background: var(--blue-light); }
.status-supported, .status-open { color: #7c4800; background: #fff0d0; }
.status-disputed { color: #942e45; background: #fce5eb; }
.soft-panel { background: var(--surface-subtle); border: 1px solid var(--line); padding: 0.78rem; border-radius: 0.8rem; min-width: 0; }
.soft-panel h3 { margin-bottom: 0.45rem; }
.relation-list, .media-list { list-style: none; display: grid; gap: 0.4rem; }
.relation-list > li, .media-list > li { border: 1px solid var(--line); border-radius: 0.65rem; background: var(--paper); overflow: hidden; }
.media-pdf { display: flex; flex-wrap: wrap; align-items: center; }
.media-pdf > .media-row { flex: 1 1 16rem; width: auto; min-width: 0; }
.media-pdf-download { margin-inline: 0.52rem; }
.relation-list > li > .inline-meta, .relation-list > li > .source-list { padding-left: 0.65rem; padding-right: 0.65rem; }
.relation-list > li > .inline-meta:not(:empty) { margin: 0.07rem 0 0.55rem; }
.relation-row, .media-row {
  border: 0;
  background: transparent;
  display: flex;
  gap: 0.55rem;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 0.45rem 0.52rem;
  text-decoration: none;
  color: var(--ink);
}
button.relation-row:hover, a.media-row:hover { background: var(--surface-subtle); }
button.relation-row:focus-visible, a.media-row:focus-visible { outline-offset: -3px; }
.relation-copy, .media-copy { min-width: 0; }
.relation-copy > *, .media-copy > * { display: block; }
.relation-copy strong, a.media-row strong { color: var(--blue-deep); overflow-wrap: anywhere; }
.relation-copy small, .media-copy small, .relation-copy .muted { color: var(--muted); font-size: 0.85rem; }
.media-copy strong { overflow-wrap: anywhere; }
.media-thumbnail, .media-icon { display: grid; place-items: center; flex: 0 0 auto; width: 3.1rem; height: 3.1rem; border-radius: 0.5rem; object-fit: cover; color: var(--blue); background: var(--surface); }
.soft-panel .button { margin-top: 0.55rem; }
.selection-panel {
  padding: clamp(0.8rem, 1.6vw, 1.2rem);
  border-color: var(--line);
  border-radius: 0.55rem;
  background: var(--paper);
}
.selection-panel .compact-heading {
  gap: 0.65rem;
  align-items: center;
  padding: 0.2rem 0 0.85rem;
}
.compact-heading .person-heading-copy { border: 0; padding-left: 0; }
.selection-panel .compact-heading .avatar-profile {
  width: clamp(3.7rem, 4.8vw, 4.9rem);
  height: clamp(3.7rem, 4.8vw, 4.9rem);
  border-radius: 0.55rem;
  background: var(--surface);
  color: #264e79;
  font: 400 clamp(1.3rem, 2.4vw, 1.9rem)/1 Georgia, serif;
}
.compact-heading h2 { font-size: clamp(1.45rem, 2.18vw, 1.95rem); overflow-wrap: anywhere; margin-bottom: 0.32rem; }
.compact-heading .person-meta { font-size: 0.85rem; color: #485d77; overflow-wrap: anywhere; }
.compact-heading .person-meta .icon { width: 0.94rem; height: 0.94rem; color: #375f88; }
.selection-panel .segment {
  margin: 0 0 0.7rem;
  padding: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.selection-panel .segment-button { border-bottom: 2px solid transparent; border-radius: 0; color: #365577; }
.selection-panel .segment-button[aria-pressed="true"]:not(:disabled) {
  border-bottom-color: var(--navy);
  background: var(--surface-subtle);
  color: #213b5c;
  box-shadow: none;
}
.selection-relations h3 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.selection-relations .relation-list > li { border-color: var(--line); border-radius: 0.42rem; background: var(--paper); }
.selection-relations .relation-row { gap: 0.56rem; padding: 0.55rem; }
.selection-relations .relation-copy strong { color: #244c81; }
.selection-relations .relation-row:hover { background: var(--surface-subtle); }
.selection-burial { display: grid; gap: 0.25rem; padding: 0.65rem; margin-bottom: 0.48rem; }
.selection-burial p { margin: 0; }
.selection-burial a { justify-self: start; }
.selection-buttons { display: grid; gap: 0.42rem; margin-top: 0.65rem; }
.selection-buttons .button { justify-content: center; }
.family-contributions { margin-top: 1.1rem; }
.family-contributions .section-heading { margin-bottom: 0.68rem; }
.portrait-settings { border: 1px solid var(--line); background: var(--paper); border-radius: 0.8rem; padding: 0.85rem; margin-top: 1.1rem; scroll-margin-top: 7rem; }
.portrait-form { display: flex; align-items: start; flex-wrap: wrap; gap: 0.8rem 1rem; margin-top: 0.75rem; }
.portrait-form .form-field { flex: 1 1 15rem; max-width: 28rem; }
.portrait-actions { margin-top: 0.3rem; }
.portrait-form .portrait-status, .portrait-form .form-error { flex: 1 1 100%; margin: 0; }
.portrait-status:empty { display: none; }
.portrait-status { color: #214486; font-weight: 650; }
.portrait-preview { display: flex; align-items: center; gap: 0.75rem; flex: 1 1 16rem; min-width: 0; }
.portrait-preview-copy { overflow-wrap: anywhere; }
.portrait-preview strong { display: block; color: var(--ink); }
.portrait-preview p { margin: 0.25rem 0 0; font-size: 0.92rem; }
.avatar-portrait { width: 3.8rem; height: 3.8rem; }
.portrait-drag {
  width: clamp(6.5rem, 13vw, 8.5rem);
  height: clamp(6.5rem, 13vw, 8.5rem);
  outline: 1px solid var(--line-strong);
  outline-offset: 2px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.portrait-drag.is-dragging { cursor: grabbing; }
.contribution-list { display: grid; gap: 0.72rem; }
.contribution { border: 1px solid var(--line); background: var(--paper); border-radius: 0.8rem; padding: 0.85rem; }
.contribution p { margin: 0.55rem 0; }
.contribution-byline { font-size: 0.91rem; }
.contribution-image-link { display: block; margin-top: 0.55rem; width: fit-content; }
.contribution-image-link img { display: block; max-height: 320px; object-fit: contain; border-radius: 0.55rem; }
.editor-slot { scroll-margin-top: 124px; }
.editor-panel { padding: clamp(0.76rem, 1.65vw, 1.15rem); }
.editor-panel .section-heading { flex-wrap: nowrap; }
.editor-person { margin: 0.2rem 0 0.85rem; }
.editor-panel .icon-button { border-color: transparent; }
.contribution-form, .login-form { display: grid; gap: 0.8rem; }
.form-field { display: grid; gap: 0.24rem; min-width: 0; }
.form-field label { font-weight: 680; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 0.57rem;
  background: var(--paper);
  min-height: 44px;
  padding: 0.5rem 0.68rem;
}
.form-field input[readonly] { background: var(--surface-subtle); color: #3b4b69; }
.form-field :is(input, select, textarea):disabled,
.tree-navigation select:disabled, .family-map-field select:disabled {
  color: var(--disabled-text);
  border-color: var(--line);
  background-color: var(--disabled-surface);
  cursor: default;
}
.form-field textarea { resize: vertical; }
.form-error { color: #91243e; background: #ffedf0; border: 1px solid #ebc0c9; border-radius: 0.55rem; padding: 0.5rem 0.65rem; }
.genealogy-actions { margin: 0.6rem 0 0.9rem; }
.genealogy-actions h2 { margin-bottom: 0.55rem; font-size: clamp(1.3rem, 2.2vw, 1.65rem); }
.genealogy-actions .button { text-align: left; }
.genealogy-facts p { margin: 0.35rem 0; }
.genealogy-facts small { display: block; }
.genealogy-dialog {
  width: min(35rem, calc(100% - 1.2rem));
  max-height: calc(100% - 1.2rem);
  padding: clamp(0.85rem, 3vw, 1.4rem);
  border: 1px solid var(--line-strong);
  border-radius: 0.85rem;
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}
.genealogy-dialog::backdrop { background: #14234070; }
.genealogy-dialog-person { margin: 0.45rem 0 0.85rem; overflow-wrap: anywhere; }
.genealogy-form, .genealogy-person-fields { display: grid; gap: 0.8rem; }
.genealogy-residence-dates, .genealogy-residence-period { display: grid; gap: 0.65rem; }
.genealogy-residence-period { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.genealogy-match-info { margin: 0; }
.genealogy-match-info:empty { display: none; }
.genealogy-confirm { display: flex; align-items: flex-start; gap: 0.58rem; padding: 0.52rem 0; cursor: pointer; }
.genealogy-confirm input { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; margin: 0.2rem 0 0; accent-color: var(--blue); }
.editor-actions { align-items: stretch; }
.editor-actions .primary { flex: 1; }
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
  padding: 1.35rem 0.72rem;
  min-height: 116px;
  border: 1px dashed var(--blue);
  border-radius: 0.7rem;
  background: var(--surface-subtle);
  color: var(--blue-deep);
  cursor: pointer;
  justify-content: center;
}
.upload-zone:hover, .upload-hover { background: var(--surface); }
.upload-zone .icon { width: 2.4rem; height: 2.4rem; }
.upload input:focus-visible + .upload-zone { outline: 3px solid var(--blue); outline-offset: 3px; }
.upload-file-name { overflow-wrap: anywhere; max-width: 100%; }

.book-card { display: flex; flex-direction: column; overflow: clip; }
.book-thumbnail { display: grid; place-items: center; width: 100%; height: 145px; object-fit: cover; background: var(--surface-subtle); }
.book-illustration { color: #2760df; background: radial-gradient(ellipse at 42% 41%, var(--surface-subtle), var(--surface) 90%); }
.book-illustration .icon { width: 3.4rem; height: 3.4rem; }
.book-card-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 0.5rem; padding: 0.85rem; overflow-wrap: anywhere; }
.book-card-body .actions { margin-top: auto; }
.book-card-body h2 { font-size: clamp(1.3rem, 2vw, 1.7rem); }
.book-card-body p { margin: 0; }
.book-people { padding-left: 1rem; }
.login-card { width: min(100%, 500px); margin: clamp(1.2rem, 8vh, 5rem) auto 0; padding: clamp(1rem, 4vw, 2rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); box-shadow: var(--shadow); }
.login-card h1 { font-size: clamp(1.9rem, 4vw, 2.55rem); margin: 0.76rem 0 0.45rem; }
.welcome-dialog {
  width: min(60rem, calc(100% - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  padding: clamp(0.85rem, 2.8vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.05rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}
.welcome-dialog::backdrop { background: #14234075; }
body:has(.welcome-dialog[open]) { overflow: hidden; }
.welcome-close-row { position: sticky; top: 0; z-index: 3; display: flex; justify-content: end; height: 0; padding-inline: 0.65rem; pointer-events: none; }
.welcome-close { flex: 0 0 44px; margin-top: 0.65rem; pointer-events: auto; }
.welcome-page { min-width: 0; }
.welcome-page p { line-height: 1.6; margin-block: 0.55rem 0.9rem; }
.welcome-cover {
  display: grid;
  align-items: center;
  gap: 1.4rem;
  min-height: clamp(24rem, 62vh, 36rem);
  padding: 3.8rem clamp(1.05rem, 4vw, 2.8rem) 2.3rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: linear-gradient(120deg, var(--paper), var(--surface));
}
.welcome-cover.has-photo { grid-template-columns: minmax(0, 1fr) minmax(10rem, 30%); }
.welcome-cover h1 { font: 500 clamp(2.3rem, 6vw, 4.5rem)/1.05 Georgia, serif; text-wrap: balance; }
.welcome-cover .welcome-greeting { font-weight: 700; margin: 1rem 0 0; }
.welcome-cover-photo { margin: 0; padding: clamp(0.35rem, 1vw, 0.65rem); border: 1px solid var(--line); border-radius: 0.3rem; background: var(--paper); box-shadow: var(--shadow); }
.welcome-cover-photo img { display: block; width: 100%; max-height: 19rem; object-fit: contain; border-radius: 0.18rem; }
.welcome-cover-photo figcaption { padding-top: 0.55rem; color: var(--muted); text-align: center; font-size: 0.88rem; }
.welcome-intro p, .welcome-memories p { max-width: 64ch; }
.welcome-actions { margin-top: 1.15rem; }
.welcome-windows { margin-top: 1.5rem; }
.welcome-window-hint { font-size: 0.9rem; }
.welcome-window-nav { display: flex; justify-content: space-between; align-items: center; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.welcome-window-selectors { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.26rem; }
.welcome-window-dot.button { width: 44px; min-height: 44px; padding: 0.25rem; border-color: transparent; box-shadow: none; background: transparent; }
.welcome-window-dot.button[aria-current="step"] { background: var(--surface); border-color: var(--line); color: var(--navy); }
.welcome-window-position { color: var(--muted); font-size: 0.87rem; padding-inline: 0.3rem; }
.welcome-window-track { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 100%; gap: 0.65rem; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; padding-bottom: 0.65rem; }
.welcome-window-track.is-dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.welcome-window-track > .welcome-section { scroll-snap-align: start; scroll-snap-stop: always; margin-top: 0; }
.welcome-section { min-width: 0; margin-top: 1.15rem; padding: clamp(0.75rem, 3vw, 1.65rem); border: 1px solid var(--line); border-radius: 0.85rem; background: var(--paper); }
.welcome-section h2 { font-size: clamp(1.65rem, 3.2vw, 2.45rem); }
.welcome-feature { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; align-items: center; }
.welcome-origins { margin-top: 0.8rem; align-items: start; }
.welcome-tree-preview { --tree-line: #718ba4; --node-gap: clamp(0.1rem, 1vw, 0.65rem); margin-block: 1rem; padding: clamp(0.35rem, 2vw, 1.15rem); border: 1px solid var(--line); border-radius: 0.8rem; background: var(--surface-subtle); }
.welcome-tree-preview ul { list-style: none; display: grid; padding: 0; position: relative; }
.welcome-tree-elder-row, .welcome-tree-parents, .welcome-tree-couple { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.welcome-tree-elder-row { margin-bottom: 1.2rem; }
.welcome-tree-parents::after { content: ""; position: absolute; left: 50%; top: 50%; bottom: -1.2rem; border-left: 1px solid var(--tree-line); }
.welcome-tree-parents::before, .welcome-tree-couple::before { content: ""; position: absolute; left: 25%; right: 25%; top: 50%; border-top: 1px solid var(--tree-line); }
.welcome-person { position: relative; z-index: 1; display: flex; align-items: center; flex-direction: column; gap: 0.18rem; margin-inline: var(--node-gap); text-align: center; line-height: 1.2; padding: clamp(0.28rem, 1vw, 0.65rem); border: 1px solid var(--line); border-radius: 0.55rem; background: var(--paper); overflow-wrap: anywhere; }
.welcome-person strong { font-size: clamp(0.73rem, 1.6vw, 1.02rem); }
.welcome-person small { font-size: clamp(0.64rem, 1.4vw, 0.86rem); }
.welcome-avatar { width: clamp(1.55rem, 5vw, 3.1rem); height: clamp(1.55rem, 5vw, 3.1rem); font-size: clamp(0.65rem, 2vw, 1rem); }
.welcome-fan-preview .ancestor-fan { min-height: 0; border-color: var(--line); background: var(--surface-subtle); }
.welcome-map-preview { margin: 0 0 0.75rem; }
.welcome-map-chart { display: block; width: 100%; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 0.65rem; }
.welcome-map-marker { fill: var(--navy); stroke: var(--paper); stroke-width: 2; }
.welcome-map-chart text { fill: var(--navy); font-size: 14px; font-weight: 700; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
.welcome-map-preview figcaption { margin-top: 0.45rem; font-size: 0.8rem; line-height: 1.55; }
.welcome-map-preview figcaption span { display: block; }
.welcome-name-preview, .welcome-memories { background: var(--surface-subtle); padding: clamp(0.85rem, 2.5vw, 1.65rem); border: 1px solid var(--line); border-radius: 0.8rem; }
.welcome-name-preview .welcome-surname { font: 1.95rem/1.2 Georgia, serif; }
.welcome-profile-preview { max-width: 35rem; margin: 1rem 0; padding: clamp(0.85rem, 2.5vw, 1.45rem); border: 1px solid var(--line); border-radius: 0.8rem; background: var(--surface-subtle); }
.welcome-profile-head { display: flex; align-items: center; gap: 1rem; }
.welcome-profile-head h3 { font: 500 clamp(1.42rem, 3.5vw, 2.4rem)/1.1 Georgia, serif; }
.welcome-profile-head p { margin: 0.18rem 0 0; }
.welcome-profile-avatar { width: clamp(3.3rem, 11vw, 6rem); height: clamp(3.3rem, 11vw, 6rem); font-size: 1.5rem; }
.welcome-profile-fact { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.welcome-memory-formats { display: flex; flex-wrap: wrap; gap: 0.55rem 1.25rem; list-style: none; padding: 0; margin: 1rem 0; }
.welcome-memory-formats li { display: inline-flex; align-items: center; gap: 0.4rem; }
@media (max-width: 640px) {
  .welcome-cover.has-photo { grid-template-columns: minmax(0, 1fr); }
  .welcome-cover-photo { width: min(100%, 12rem); }
  .welcome-feature { grid-template-columns: minmax(0, 1fr); }
  .welcome-window-selectors { order: -1; flex-basis: 100%; }
}
@media (orientation: landscape) and (any-pointer: coarse) {
  .welcome-cover { min-height: 0; gap: 0.9rem; padding-block: 1.5rem; }
  .welcome-cover.has-photo { grid-template-columns: minmax(0, 1fr) minmax(7rem, 21%); }
  .welcome-cover h1 { font-size: clamp(1.6rem, 4vw, 3rem); }
  .welcome-cover .welcome-greeting { margin-top: 0.55rem; }
  .welcome-cover-photo { width: auto; margin-inline-end: 2.25rem; }
  .welcome-cover-photo img { max-height: 8.5rem; }
  .welcome-actions { margin-top: 0.6rem; }
}
.app-footer { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; padding-block: 1rem 1.5rem; }
.app-footer[hidden] { display: none; }
.login-icon { display: grid; place-items: center; color: var(--blue); width: 3rem; height: 3rem; border-radius: 0.65rem; background: var(--surface); }
.login-form { margin-top: 1.05rem; }

@media (max-width: 1160px) {
  .tree-heading { grid-template-columns: minmax(0, 1fr) auto; }
  .tree-heading > div:first-child { grid-column: 1 / -1; }
  .tree-heading .search-wrapper { max-width: 530px; }
}
@media (max-width: 940px) {
  .header-inner { gap: 0.45rem; }
  .private-tag { font-size: 0.78rem; padding: 0.33rem 0.45rem; }
  .nav-link { font-size: 0.92rem; }
}
@media (min-width: 1431px) {
  .header-inner.has-messages { width: min(100%, 100rem); column-gap: 0.65rem; }
  .has-messages .top-nav { gap: 0.15rem; }
  .has-messages .nav-link { padding-inline: 0.39rem; font-size: 0.88rem; }
  .has-messages .header-actions { gap: 0.3rem; }
  .has-messages .private-tag { font-size: 0.77rem; padding-inline: 0.4rem; }
}
@media (max-width: 1430px) {
  .header-inner { grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem 0.58rem; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .top-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.25rem;
  }
  .nav-link {
    min-width: 0;
    min-height: 44px;
    padding: 0.36rem 0.14rem;
    border-radius: 0.48rem;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
@media (max-width: 899px) {
  .tree-grid, .tree-grid-overall, .record-grid.editor-open { grid-template-columns: minmax(0, 1fr); }
  .editor-slot { grid-row: 1; }
  .tree-grid .selection-slot { grid-row: 2; }
  .selection-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tree-nav { margin-left: 0; }
  .book-grid, .directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .header-inner { padding: 0.45rem 0.85rem 0.35rem; }
  .brand .icon { width: 2.05rem; height: 2.05rem; }
  .tree-heading h1 { font-size: clamp(2rem, 5.45vw, 2.55rem); }
}
@media (max-width: 670px) {
  .home-intro, .home-find { grid-template-columns: minmax(0, 1fr); }
  .home-find-copy h2 { white-space: normal; }
  .home-find-figure img { max-height: 14rem; }
  .profile-hero { grid-template-columns: minmax(0, 1fr); }
  .profile-tabs { gap: 0 0.24rem; }
}
@media (max-width: 570px) {
  .header-inner { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
  .brand > span { overflow-wrap: anywhere; }
  .header-actions { justify-content: end; min-width: 0; }
  .private-tag { white-space: normal; line-height: 1.15; min-width: 0; }
  .private-tag .identity { overflow-wrap: anywhere; }
  .has-messages .private-tag { display: none; }
  .header-exit { flex: 0 0 38px; }
  .home-intro { padding-top: 0.35rem; }
  .home { gap: 0.94rem; }
  .home-news, .directory-grid, .book-grid { grid-template-columns: minmax(0, 1fr); gap: 0.65rem; }
  .tree-heading { grid-template-columns: minmax(0, 1fr); }
  .tree-heading > div:first-child { grid-column: 1; }
  .tree-heading .search-wrapper { width: 100%; }
  .tree-mode { grid-row: 2; width: 100%; }
  .tree-navigation { margin-left: initial; }
  .tree-orientation { padding: 0.48rem; }
  .selection-confirmation { display: none; }
  .graph-board, .graph-board-focused { height: clamp(468px, 68svh, 610px); }
  .graph-bottom { padding: 0.46rem; align-items: start; }
  .graph-controls { flex: 1 1 auto; }
  .graph-controls .button { padding-inline: 0.6rem; }
  .minimap { width: 96px; flex: 0 0 96px; padding: 0.27rem; }
  .minimap svg { height: 47px; }
  .selection-buttons { grid-template-columns: minmax(0, 1fr); }
  .profile-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-tabs .segment-button { padding-inline: 0.4rem; }
  .person-heading .avatar-profile { width: 3.5rem; height: 3.5rem; }
  .record-top .search-wrapper { width: 100%; }
}
@media (max-width: 450px) {
  .header-inner { padding-inline: 0.65rem; }
  .brand { font-size: 0.92rem; gap: 0.38rem; }
  .brand .icon { width: 1.75rem; height: 1.75rem; }
  .private-tag { max-width: 7.2rem; }
  .private-tag .icon { display: none; }
  .top-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-link { overflow-wrap: normal; }
  .editor-slot { scroll-margin-top: 155px; }
  .genealogy-activity h2 { scroll-margin-top: 165px; }
}
@media (max-width: 365px) {
  .private-tag { font-size: 0.72rem; }
}
@media (hover: none), (pointer: coarse) {
  .mouse-hint { display: none; }
  .touch-hint { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
.relation-detail { padding: 0 0.65rem 0.4rem; color: var(--muted); font-size: 0.9rem; }

.family-map { display: grid; gap: 1.05rem; padding-top: 0.65rem; }
.family-map-title { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.65rem 1rem; }
.family-map-title p { margin: 0.35rem 0 0; }
.family-map-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 0.65rem 0.8rem; }
.family-map-field { display: grid; gap: 0.28rem; min-width: 0; }
.family-map-field > span { color: var(--muted); font-weight: 670; font-size: 0.88rem; }
.family-map-field select {
  width: 100%;
  min-height: 44px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 0.65rem;
  padding: 0.3rem 0.55rem;
}
.family-map-branch-note { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.88rem; }
.family-map-branch-note:empty { display: none; }
.family-map-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(237px, 29%); gap: 0.8rem; }
.family-map-card, .family-map-panel, .family-map-evidence {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.family-map-card { overflow: hidden; }
.family-map-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.55rem 0.65rem;
  gap: 0.45rem;
}
.family-map-zoom { display: flex; gap: 0.28rem; }
.family-map-extent { margin-inline-start: auto; color: var(--muted); font-size: 0.82rem; }
.family-map-board {
  position: relative;
  height: clamp(380px, 57svh, 590px);
  overflow: hidden;
  isolation: isolate;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background: #e9f0f1;
}
.family-map-board.is-demo { background: #edf3ee; }
.family-map-board:focus-visible { outline-offset: -4px; }
.family-map-board.is-panning { cursor: grabbing; }
.family-map-ground,
.family-map-heat,
.family-map-geography-labels,
.family-map-anchors,
.family-map-markers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.family-map-country {
  fill: #f1f0e8;
  stroke: #afbab3;
  stroke-width: 0.65px;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}
.family-map-halo, .family-map-geography-labels span, .family-map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
}
.family-map-halo {
  width: var(--diameter, 100px);
  height: var(--diameter, 100px);
  border-radius: 50%;
  background: radial-gradient(circle, #4679e5d0 0%, #6389dd83 38%, #83a6e646 56%, #91a8e600 73%);
}
.family-map-geography-labels span {
  white-space: nowrap;
  color: #52615d;
  font-size: 0.78rem;
  font-weight: 680;
  text-shadow: 0 0 3px #fff, 0 0 5px #fff;
}
.family-map-scale, .family-map-north {
  position: absolute;
  z-index: 2;
  color: #344953;
  background: #fffffff0;
  font-size: 0.72rem;
  font-weight: 680;
  text-align: center;
  pointer-events: none;
}
.family-map-scale {
  bottom: 0.45rem;
  left: 0.6rem;
  border: solid currentColor;
  border-width: 0 1px 2px;
  white-space: nowrap;
}
.family-map-north {
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.18rem 0.36rem;
  border: 1px solid #afbab3;
  border-radius: 0.25rem;
}
.family-map-anchors circle { fill: #23477f; stroke: #fff; stroke-width: 1px; }
.family-map-marker {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #163773;
  font-size: 0.89rem;
  font-weight: 760;
  isolation: isolate;
  pointer-events: auto;
}
.family-map-marker::before {
  position: absolute;
  z-index: -1;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: var(--marker-size, 38px);
  height: var(--marker-size, 38px);
  border: 1px solid #5675b4;
  border-radius: 50%;
  background: #fffffff5;
  box-shadow: 0 2px 5px #16315c25;
  content: "";
}
.family-map-marker:hover::before { background: #e5edff; }
.family-map-marker[aria-pressed="true"] { color: white; z-index: 1; }
.family-map-marker[aria-pressed="true"]::before { border-color: #1d4cd0; background: #1d4cd0; box-shadow: 0 0 0 3px #fff, 0 3px 7px #12307455; }
.family-map-marker-label {
  display: none;
  position: absolute;
  left: calc(100% + 5px);
  top: 50%;
  transform: translateY(-50%);
  padding: 0.2rem 0.42rem;
  border: 1px solid #839cd4;
  border-radius: 0.32rem;
  background: #fff;
  color: #163773;
  font-size: 0.78rem;
  text-align: left;
  width: max-content;
  max-width: min(8.5rem, 35vw);
  overflow-wrap: anywhere;
  pointer-events: none;
}
.family-map-marker-label::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 11px;
  border-top: 1px solid #5675b4;
}
.family-map-marker.label-left .family-map-marker-label { right: calc(100% + 5px); left: auto; }
.family-map-marker.label-left .family-map-marker-label::before { left: 100%; right: auto; }
.family-map-marker:is([aria-pressed="true"], :focus-visible) .family-map-marker-label { display: block; }
.family-map-caption {
  min-height: 47px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.family-map-key { display: inline-flex; align-items: center; gap: 0.35rem; }
.family-map-key i { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle, #4679e5, #6389dd00 75%); }
.family-map-attribution { margin: 0; font-size: 0.71rem; }
.family-map-attribution a { color: var(--blue-deep); text-decoration: underline; }
.family-map-panel {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  padding: 0.8rem;
  gap: 0.8rem;
}
.family-map-panel-head h2 { overflow-wrap: anywhere; font-size: clamp(1.28rem, 2.3vw, 1.75rem); }
.family-map-panel-summary { margin-top: 0.3rem; color: var(--muted); font-size: 0.89rem; }
.family-map-people {
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: clamp(260px, 44svh, 489px);
  border-top: 1px solid var(--line);
}
.family-map-person {
  display: flex;
  align-items: center;
  gap: 0.52rem;
  min-height: 54px;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.28;
}
.family-map-person:hover { background: var(--surface); }
.family-map-person:focus-visible { outline-offset: -3px; }
.family-map-person strong, .family-map-person small { display: block; overflow-wrap: anywhere; }
.family-map-person small { color: var(--muted); margin-top: 0.13rem; }
.family-map-evidence { padding: 0.8rem 0.95rem; }
.family-map-evidence h2 { margin-bottom: 0.4rem; font-size: 1.26rem; }
.family-map-evidence p { margin: 0 0 0.3rem; font-size: 0.9rem; }
.family-map-evidence p:last-child { margin-bottom: 0; }
.family-map-coverage { color: var(--ink); }
.record-map-return { margin-block: 0.28rem 0.75rem; }

@media (max-width: 690px) {
  .family-map-layout { grid-template-columns: minmax(0, 1fr); }
  .family-map-board { height: clamp(350px, 55svh, 450px); }
  .family-map-people { max-height: 400px; }
}

@media (max-width: 420px) {
  .family-map-filters > .family-map-field { flex: 1 1 44%; }
  .family-map-controls { gap: 0.35rem; }
  .family-map-controls .button { padding-inline: 0.49rem; }
  .family-map-extent { width: 100%; }
}

.story-collection { display: grid; gap: 0.75rem; margin-block: 1.2rem; }
.story-filters, .story-author-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
.story-field-label { font-weight: 680; }
.story-summary-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 0.65rem; list-style: none; }
.story-summary {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  align-items: baseline;
  gap: 0.15rem 0.55rem;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--paper);
  overflow-wrap: anywhere;
}
.story-summary-title { font-weight: 720; font-size: 1.08rem; text-decoration-thickness: 1px; text-underline-offset: 0.17rem; }
.story-summary small { flex: 1 1 100%; }
.story-draft {
  display: inline-block;
  border-radius: 0.4rem;
  background: var(--surface);
  color: #274781;
  padding: 0.04rem 0.45rem;
  font-size: 0.82rem;
  font-weight: 650;
}
.profile-stories .section-heading { margin-bottom: 0.65rem; }
.profile-stories .section-heading h2 { font-size: clamp(1.35rem, 2.2vw, 1.8rem); }

.story-page { max-width: 62rem; margin: 0 auto; }
.story-breadcrumbs { margin-bottom: 0.8rem; }
.story-compose {
  max-width: 62rem;
  padding: 0 clamp(0.75rem, 3vw, 1.75rem) clamp(0.75rem, 3vw, 1.5rem);
  padding-left: clamp(1.2rem, 4vw, 2.8rem);
  border: 1px solid var(--line);
  border-radius: 0.55rem 0.8rem 0.8rem 0.55rem;
  background: linear-gradient(90deg, #7b5b3a24, transparent 0.75rem, #fff9ecaa 0.88rem, transparent 1.15rem),
    var(--surface);
  box-shadow: var(--shadow);
}
.story-compose-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 1rem;
  flex-wrap: wrap;
  padding-block: 0.55rem;
}
.story-compose-book-link { font: 400 clamp(1.1rem, 2.5vw, 1.45rem)/1.2 Georgia, serif; color: var(--blue-deep); }
.story-compose-book-link:hover { color: var(--navy); }
.story-editor-intro {
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 0.7rem;
}
.story-editor-intro h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.4vw, 3rem);
  font-weight: 700;
}
.story-editor-intro p { margin: 0.37rem 0 0; color: #263753; font: italic 1.15rem/1.3 Georgia, serif; }
.story-fields { display: grid; gap: 0.8rem; border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.story-editor-body, .story-person-picker, .story-editor-meta, .story-sharing, .story-save-panel {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: clamp(0.75rem, 2.4vw, 1.3rem);
  background: var(--paper);
}
.story-editor-body, .story-edit-block, .story-editor-blocks, .story-add-blocks, .story-person-picker { display: grid; gap: 0.65rem; }
.story-editor-body {
  padding: clamp(0.9rem, 4vw, 2.65rem);
  border-color: var(--line);
  border-radius: 0.5rem;
  background: var(--book-paper);
  box-shadow: var(--shadow);
}
.story-editor-title-field .form-field {
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 0.4rem 1rem;
  font: 400 1.24rem/1.4 Georgia, serif;
}
.story-editor-title-field input {
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  font: inherit;
}
.story-editor-title-field > small { display: block; margin-top: 0.2rem; }
.story-author-name { margin: 0; }
.story-author-name strong { color: var(--ink); }
.story-author-fields { align-items: start; margin-top: 0.5rem; }
.story-person-picker { gap: 0.4rem; }
.story-person-label { font-size: 1.16rem; font-weight: 750; }
.story-person-control { position: relative; }
.story-person-search { grid-template-columns: minmax(0, 1fr) auto; gap: 0.42rem; }
.story-person-toggle::after {
  content: "";
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  width: 0.48rem;
  height: 0.48rem;
  transform: translateY(-0.12rem) rotate(45deg);
}
.story-person-toggle[aria-expanded="true"]::after { transform: translateY(0.12rem) rotate(225deg); }
.story-person-results {
  position: absolute;
  z-index: 4;
  inset: calc(100% + 0.28rem) 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 0.6rem;
  background: var(--paper);
  box-shadow: 0 7px 16px #4f3a2325;
}
.story-person-matches {
  max-height: min(14rem, 34vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
.story-person-choice.button {
  display: block;
  width: 100%;
  padding-inline: 0.72rem;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow-wrap: anywhere;
}
.story-person-choice:hover, .story-person-choice:focus-visible { background: var(--surface); }
.story-person-choice:focus-visible { outline-offset: -3px; }
.story-person-matches li + li { border-top: 1px solid var(--line); }
.story-person-empty { padding: 0.65rem; }
.story-person-selection { display: grid; gap: 0.24rem; margin-top: 0.18rem; }
.story-person-selection-title { color: var(--muted); font-size: 0.83rem; font-weight: 720; }
.story-selected-people, .story-collaborators { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.story-selected-people { list-style: none; }
.story-selected-people > li { min-width: 0; max-width: 100%; }
.story-person-matches:empty, .story-selected-people:empty, .story-person-picker small:empty,
.story-editor-blocks:empty, .story-recording-status:empty { display: none; }
.story-person-chip.button {
  max-width: 100%;
  padding-inline: 0.7rem;
  background: var(--surface);
  border-color: var(--line);
  color: #254581;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  text-align: left;
}
.story-editor-details summary, .story-questions summary, .story-sharing summary, .story-opening-contents summary, .story-history summary, .story-photo-details summary {
  cursor: pointer;
  color: #254581;
  font-weight: 690;
  padding-block: 0.38rem;
}
.story-questions ul { display: flex; flex-wrap: wrap; list-style: none; gap: 0.38rem; margin-top: 0.45rem; }
.story-questions .button { text-align: left; }
.story-edit-block {
  padding: clamp(0.65rem, 2vw, 0.9rem);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--paper);
}
.story-edit-block-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.35rem; }
.story-block-actions { flex-wrap: nowrap; gap: 0.32rem; }
.story-block-actions .button { font-size: 1.2rem; }
.story-edit-text { padding: 0; border: 0; background: transparent; gap: 0.2rem; }
.story-edit-text .story-block-actions { justify-self: end; }
.story-edit-text .story-block-actions .button:not(:hover) { border-color: transparent; }
.story-edit-text textarea {
  display: block;
  min-height: 10rem;
  background: #ffffff69;
  border-color: var(--line);
  padding: clamp(0.6rem, 2vw, 0.9rem);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 2.3vw, 1.24rem);
  line-height: 1.6;
}
.story-edit-block .story-media img { max-height: 14rem; margin-inline: 0; }
.story-media-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
.story-media-actions .button { font: 400 1.1rem/1.15 Georgia, serif; }
.story-drop { min-height: 3rem; padding: 0.45rem 0.5rem; }
.story-drop .icon { width: 1.65rem; height: 1.65rem; }
.story-recording-status { color: #174582; font-weight: 650; margin: 0; }
.story-sharing p { margin: 0.4rem 0; }
.story-collaborators { gap: 0.12rem 0.8rem; }
.story-collaborators label { display: flex; align-items: center; min-height: 44px; gap: 0.45rem; cursor: pointer; }
.story-collaborators input { width: 1.13rem; height: 1.13rem; margin: 0; accent-color: var(--blue); }
.story-save-panel { background: var(--surface-subtle); }
.story-compose > .form-error { margin-bottom: 0.85rem; scroll-margin-top: 120px; background: #fff4f3; }
.story-conflict .button { color: inherit; }

.book-page, .story-reader, .story-compose {
  --book-cloth: repeating-linear-gradient(0deg, #738caf39 0 0.45px, #07162c58 0.65px 1.1px, transparent 1.25px 2px),
    repeating-linear-gradient(90deg, #91acd43b 0 0.65px, #00102751 0.95px 1.3px, transparent 1.45px 2.5px),
    linear-gradient(135deg, #34537e, #142749 60%, #1e3659);
  --book-paper: repeating-linear-gradient(24deg, #79787909 0 0.45px, transparent 0.6px 3px),
    repeating-linear-gradient(112deg, #41495708 0 0.35px, transparent 0.6px 3.6px), var(--paper);
}
.book-page, .story-reader {
  --book-leaf-width: clamp(17rem, calc(78svh - 10.25rem), 29rem);
  --book-ratio: 4 / 5;
  max-width: 72rem;
  margin-inline: auto;
}
.book-library { max-width: 73rem; padding-top: 0.65rem; }
.book-original-actions { justify-content: center; }
.story-archive-sources summary { cursor: pointer; color: var(--blue); padding-block: 0.45rem; }
.story-archive-sources li { margin-block: 0.5rem; }
.story-archive-sources li > a { display: inline-block; margin-inline-start: 0.65rem; }
.book-library-heading { gap: 0.65rem 1.25rem; }
.book-library-heading p { margin: 0.38rem 0 0; }
.book-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 0.8rem;
  margin-block: 1rem;
  list-style: none;
}
.book-library-grid li { min-width: 0; }
.book-library-card {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr);
  align-items: center;
  gap: 0.85rem;
  height: 100%;
  padding: 0.7rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  text-decoration: none;
}
.book-library-card:hover { border-color: var(--blue); background: var(--surface-subtle); }
.book-library-cover {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  padding-left: 0.24rem;
  border-radius: 0.18rem 0.34rem 0.34rem 0.18rem;
  background: linear-gradient(90deg, #173157 0.34rem, #557ba4 0.42rem, transparent 0.52rem), var(--book-cloth);
  box-shadow: 0.1rem 0.17rem #b4c6e0;
  color: #edf4ff;
}
.book-library-cover .book-cover-art { width: 72%; box-shadow: none; }
.book-library-cover .book-cover-initials { font-size: 0.85rem; }
.book-library-archive .icon { width: 1.8rem; height: 1.8rem; }
.book-library-label { display: grid; gap: 0.18rem; overflow-wrap: anywhere; }
.book-library-label strong { font: 700 1.15rem/1.23 Georgia, "Times New Roman", serif; }
.book-library-label small { color: var(--muted); line-height: 1.32; }
.book-cover-stage {
  --binding: #162f5a;
  position: relative;
  width: min(100%, var(--book-leaf-width));
  margin: clamp(1.5rem, 4vw, 2.5rem) auto 3rem;
  isolation: isolate;
}
.book-cover-stage::before {
  content: "";
  position: absolute;
  inset: 0.55rem -0.48rem -0.55rem 0.2rem;
  z-index: -1;
  border: solid var(--binding);
  border-width: 0 0.22rem 0.22rem 0;
  border-radius: 0.5rem 0.76rem 0.76rem 0.5rem;
  background: repeating-linear-gradient(8deg, var(--paper) 0 2px, var(--line) 2px 3px);
  box-shadow: 0 0.8rem 1.6rem #1c335a32;
}
.book-cover {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: safe center;
  gap: clamp(0.65rem, 2vh, 1.45rem);
  aspect-ratio: var(--book-ratio);
  overflow-y: auto;
  padding: 1.35rem clamp(1.2rem, 5vw, 2.2rem) 1.35rem clamp(1.65rem, 6vw, 2.85rem);
  border: 1px solid #274b78;
  border-radius: 0.38rem 0.8rem 0.76rem 0.38rem;
  color: #f3f7ff;
  text-align: center;
  background:
    linear-gradient(90deg, #132c54 0, #2c4a73 0.8rem, #092144 1.02rem, #42638e 1.13rem, transparent 1.33rem),
    var(--book-cloth);
  box-shadow: inset 0 0 0.9rem #0a214c35, 0 0.4rem 1.2rem #10264f34;
}
.book-cover::before {
  content: "";
  position: absolute;
  inset: 0.65rem 0.62rem 0.65rem 1.55rem;
  border: 1px solid #92b3df55;
  border-radius: 0.16rem 0.46rem 0.46rem 0.16rem;
  pointer-events: none;
}
.book-cover-art {
  position: relative;
  display: grid;
  place-items: center;
  width: min(65%, 12.5rem, 24svh);
  aspect-ratio: 5 / 4;
  overflow: hidden;
  border: 1px solid #a5c3e5a8;
  border-radius: 7rem 7rem 0.28rem 0.28rem;
  background:
    radial-gradient(circle at 68% 30%, #e5eaf4 0 8%, transparent 8.7%),
    linear-gradient(168deg, #648bb7, #a0b8d5 62%, #466b99 62%);
  box-shadow: 0 0 0 0.25rem #a9c6eb17, 0 0.4rem 0.8rem #091a3a5c;
}
.book-cover-landscape, .book-cover-art img { position: absolute; inset: 0; width: 100%; height: 100%; }
.book-cover-landscape::before {
  content: "";
  position: absolute;
  inset: 37% 0 24%;
  background: linear-gradient(154deg, #7398bc, #31547d);
  clip-path: polygon(0 48%, 18% 32%, 33% 49%, 58% 15%, 82% 32%, 94% 5%, 100% 15%, 100% 70%, 68% 65%, 29% 96%, 0 91%);
}
.book-cover-landscape::after {
  content: "";
  position: absolute;
  inset: 70% 0 0;
  background: repeating-linear-gradient(175deg, #86a3c64d 0 1px, transparent 1px 7px);
}
.book-cover-initials {
  position: relative;
  margin-top: 18%;
  color: #fff;
  font: 400 clamp(1.75rem, 5vw, 2.7rem)/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0.07em;
  text-shadow: 0 1px 0.25rem #142b52, 0 2px 0.7rem #142b52, 0 2px 1rem #142b52;
}
.book-cover-art img { object-fit: cover; object-position: center 35%; }
.book-cover-caption { display: grid; justify-items: center; gap: 0.4rem; max-width: 100%; }
.book-cover-caption :is(h1, h2) { font: 400 clamp(1.55rem, 3.4vw, 2.65rem)/1.04 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; margin: 0; }
.book-cover-caption p { margin: 0; color: #dce8fa; }
.book-cover-series { font-size: 0.72rem; font-weight: 750; letter-spacing: 0.15em; text-transform: uppercase; }
.book-cover-related-name { font: italic 0.98rem/1.25 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; }
.book-cover-dates { font: 400 1rem/1.25 Georgia, "Times New Roman", serif; font-variant-numeric: tabular-nums; }
.book-cover .book-open-button { --button-edge: var(--quiet-edge); background: var(--paper); color: var(--navy); border-color: var(--button-line); }
.book-cover .book-open-button:hover { background: var(--surface-subtle); }
.book-cover-actions { justify-content: center; }
.book-cover .book-cover-new { --button-edge: var(--navy-edge); color: #fff; border-color: #acb9ce; background: var(--navy); }
.book-cover .book-cover-new:hover { background: var(--navy-hover); }
.book-cover :focus-visible { outline-color: #fff; }
.book-frame { width: min(100%, var(--book-leaf-width)); margin-inline: auto; }
.story-spread {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-radius: 0.36rem 0.7rem 0.7rem 0.36rem;
  box-shadow: 0 0.22rem #d4d1c8, 0 0.33rem #eeefed, 0 0.42rem #bdc1c5;
}
.story-spread::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.45rem -0.64rem -0.9rem;
  border: 1px solid #0b1a34;
  border-radius: 0.58rem 0.78rem 0.78rem 0.58rem;
  background: var(--book-cloth);
  box-shadow: inset 0 0 0 1px #859bb052, 0 0.62rem 1.3rem #19264341;
  pointer-events: none;
}
.story-book-art { display: none; }
.story-book-art img { display: block; width: 100%; height: 100%; max-width: none; object-fit: fill; }
.story-sheet {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  aspect-ratio: var(--book-ratio);
  min-width: 0;
  min-height: 0;
  border: 1px solid #d2d0cb;
  border-radius: 0.3rem 0.65rem 0.65rem 0.3rem;
  background: linear-gradient(90deg, #6c625431, transparent 1rem), var(--book-paper);
  padding: clamp(0.7rem, 2vw, 1.4rem);
  overflow: hidden;
}
.story-sheet-scroll {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 0.15rem 0.2rem;
}
.story-sheet-scroll:focus-visible { outline-offset: -3px; }
.story-flyleaf, .story-turn-leaf { display: none; }
.story-opening-index h1, .story-chapter-intro h1 { font: 700 clamp(1.44rem, 3vw, 2rem)/1.16 Georgia, "Times New Roman", serif; }
.story-opening-index h1 { margin-bottom: 0.15rem; }
.story-book-name { margin: 0; color: var(--muted); font-size: 0.88rem; font-weight: 650; overflow-wrap: anywhere; }
.story-contents-index { display: grid; gap: 0.55rem; }
.story-results { padding-inline: 0.1rem; }
.story-results:focus-visible, .story-results a:focus-visible { outline-offset: -3px; }
.story-contents-list { list-style: none; }
.story-contents-list li { border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.story-contents-list li:last-child { border-bottom: 1px solid var(--line); }
.story-contents-list > li > a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.58rem 0.4rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.04rem;
  line-height: 1.3;
  font-weight: 700;
  text-underline-offset: 0.17em;
}
.story-contents-list > li > a::after { content: "›" / ""; flex: none; font-weight: 400; font-size: 1.2em; }
.story-contents-list > li > a:hover { background: var(--surface-subtle); }
.story-contents-list small { display: block; margin: 0 0.4rem 0.35rem; }
.story-contents-list .story-draft { margin-bottom: 0.3rem; }
.story-subject-books { display: flex; flex-wrap: wrap; gap: 0 0.75rem; }
.story-subject-books a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--blue-deep);
  font-size: 0.86rem;
  text-underline-offset: 0.17em;
}
.story-book-actions, .story-reader-tools { gap: 0.42rem; margin-block: 0.5rem; }
.story-book-actions .button, .story-reader-tools .button { font-size: 0.88rem; }
.book-index-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.2rem 0.7rem;
  min-height: 3.1rem;
  margin-bottom: 0.36rem;
}
.book-index-header .story-breadcrumbs, .book-index-header .story-book-actions { margin: 0; }
.story-reader-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.3rem 0.55rem;
  min-height: 3.1rem;
  margin-bottom: 0.12rem;
}
.story-reader-book-title {
  margin: 0;
  color: #1d4375;
  font: 400 clamp(1.13rem, 2.65vw, 1.6rem)/1.12 Georgia, "Times New Roman", serif;
  overflow-wrap: anywhere;
}
.story-reader-heading .button { justify-self: start; font-size: 0.84rem; }
.story-reader-main-actions { gap: 0.35rem; }
.story-reader-main-actions .quiet { --button-edge: transparent; border-color: transparent; color: var(--blue-deep); background: transparent; text-decoration: underline; text-underline-offset: 0.2em; }
.story-reader-main-actions .quiet:hover { background: var(--surface-subtle); }
.story-chapter-intro { display: grid; gap: 0.35rem; margin-block: 0.18rem 0.45rem; }
.story-chapter-intro h1 { font-weight: 400; text-align: center; overflow-wrap: anywhere; }
.story-chapter-intro > .story-draft { justify-self: center; }
.story-byline { display: grid; justify-items: start; gap: 0.28rem; font-size: 0.9rem; }
.story-attribution { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; margin: 0; }
.story-attribution > div { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.12rem 0.4rem; min-width: 0; }
.story-attribution dt { font-weight: 700; }
.story-attribution dd { min-width: 0; margin: 0; }
.story-people { display: flex; flex-wrap: wrap; list-style: none; gap: 0.3rem; }
.story-people li { min-width: 0; }
.story-people a, .story-general {
  display: inline-block;
  border-radius: 0.38rem;
  background: var(--surface);
  padding: 0.12rem 0.44rem;
  font-size: 0.86rem;
}
.story-reading-sheet {
  grid-template-rows: minmax(0, 1fr) auto;
  padding: clamp(0.9rem, 2.45svh, 1.25rem) clamp(0.85rem, 2.55vw, 2.2rem) 0.78rem;
}
.story-reading-sheet .story-sheet-scroll { gap: 0.45rem; }
.story-page-probe { position: absolute; inset: 0 auto auto 0; visibility: hidden; pointer-events: none; }
.story-reading-sheet .story-byline { gap: 0.12rem; font-size: 0.82rem; line-height: 1.36; }
.story-reading-sheet .story-attribution { gap: 0.12rem 0.65rem; }
.story-reading-sheet .story-people a, .story-reading-sheet .story-general { font-size: inherit; padding-block: 0; }
.story-related-books { display: flex; flex-wrap: wrap; gap: 0.15rem 0.75rem; font-size: 0.82rem; }
.story-related-books a { display: inline-flex; align-items: center; min-height: 1.6rem; text-underline-offset: 0.15em; }
.story-folio {
  padding-top: 0.35rem;
  color: #373a40;
  font: 400 0.84rem/1 Georgia, "Times New Roman", serif;
  text-align: center;
}
.story-reading-spread { touch-action: pan-y pinch-zoom; }
.story-pagination {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: clamp(0.3rem, 2vw, 0.85rem);
  width: min(100%, 18rem);
  min-height: 44px;
  margin: 0.7rem auto 0;
}
.story-pagination .story-turn-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}
.story-turn-arrow { display: block; width: 22px; height: 22px; }
.story-page-count { font-size: 0.81rem; text-align: center; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.story-reader-tools { margin-top: 0.9rem; }

@media (min-width: 48rem) and (orientation: landscape) {
  .book-page, .story-reader {
    --book-headroom: 10.6rem;
    --book-leaf-max: 29rem;
    --book-leaf-width: clamp(16rem, calc(80svh - var(--book-headroom)), var(--book-leaf-max));
  }
  .book-cover-stage { width: min(50%, var(--book-leaf-width)); }
  .book-frame { width: min(100%, calc(var(--book-leaf-width) * 2)); }
  .story-spread { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-spread.has-book-art { box-shadow: none; }
  .story-spread.has-book-art::before { display: none; }
  .has-book-art > .story-book-art {
    position: absolute;
    display: block;
    z-index: -1;
    inset: -0.22rem -0.45rem -0.3rem;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 0.38rem 0.68rem #26344640);
  }
  .story-sheet {
    border-radius: 0.8rem 0.36rem 0.13rem 0.62rem / 0.82rem 0.32rem 0.12rem 0.37rem;
    background: linear-gradient(to left, #57493555, #aaa29324 0.4rem, transparent 1.55rem),
      repeating-linear-gradient(90deg, #6e65502b 0 0.55px, #fff8 0.8px 1.55px, #b9b8b330 1.7px 2.3px) left / 0.42rem 100% no-repeat,
      var(--book-paper);
  }
  .story-flyleaf { display: grid; }
  .story-right-sheet {
    border-radius: 0.36rem 0.85rem 0.62rem 0.13rem / 0.32rem 0.85rem 0.37rem 0.12rem;
    background: linear-gradient(to right, #57493555, #aaa29324 0.4rem, transparent 1.55rem),
      repeating-linear-gradient(90deg, #6e65502b 0 0.55px, #fff8 0.8px 1.55px, #b9b8b330 1.7px 2.3px) right / 0.42rem 100% no-repeat,
      var(--book-paper);
  }
  .has-book-art > .story-sheet { background: transparent; border-color: transparent; }
}

@media (min-width: 75rem) and (orientation: landscape) {
  .book-page, .story-reader { --book-leaf-max: 32.5rem; }
}

@media (min-width: 48rem) and (max-width: 920px) and (orientation: landscape) {
  .book-page, .story-reader { --book-headroom: 13.4rem; }
}

@media (max-width: 34rem) {
  .story-reader-heading { grid-template-columns: minmax(0, 1fr); }
  .story-editor-title-field .form-field { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  .book-cover-stage-closing .book-cover {
    transform-origin: left center;
    animation: story-cover-close 340ms cubic-bezier(0.24, 0.62, 0.28, 1) both;
  }
  @keyframes story-cover-close {
    from { opacity: 0.78; transform: perspective(55rem) rotateY(-62deg); }
    to { opacity: 1; transform: none; }
  }
  .story-spread { perspective: 76rem; }
  .story-turn-leaf[data-direction] {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 0.3rem 0.65rem 0.65rem 0.3rem;
    background: linear-gradient(90deg, #e6daca, var(--paper) 26%, var(--canvas));
    pointer-events: none;
    transform-origin: left center;
    animation: story-turn-forward 260ms ease-out both;
  }
  .story-turn-leaf[data-direction="opening"] {
    background: linear-gradient(90deg, #162f5a, #315884);
    animation-duration: 320ms;
  }
  .story-turn-leaf[data-direction="backward"] {
    transform-origin: right center;
    animation-name: story-turn-backward;
  }
  @media (min-width: 48rem) and (orientation: landscape) {
    .story-turn-leaf[data-direction] { left: 50%; }
    .story-turn-leaf[data-direction="backward"] { left: 0; right: 50%; }
  }
  @keyframes story-turn-forward {
    from { opacity: 0.72; transform: rotateY(-5deg); }
    to { opacity: 0; transform: rotateY(-112deg); }
  }
  @keyframes story-turn-backward {
    from { opacity: 0.72; transform: rotateY(5deg); }
    to { opacity: 0; transform: rotateY(112deg); }
  }
}

.story-prose {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 1.9vw, 1.25rem);
  line-height: 1.65;
  max-width: 64ch;
  width: 100%;
  margin-inline: auto;
}
.story-prose p { margin: 0; }
.story-reading-sheet .story-prose { color: #191b21; font-size: 0.875rem; line-height: 1.43; max-width: 71ch; hyphens: auto; }
.story-reading-sheet .story-prose p + p { margin-top: 0.53em; }
.story-media { margin: 0; display: grid; gap: 0.48rem; }
.story-reading-sheet .story-photo .story-image-view {
  --story-photo-height: clamp(6rem, 24svh, 15rem);
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--story-photo-height);
  overflow: hidden;
}
.story-reading-sheet .story-image-view img {
  min-width: 0;
  max-height: calc(var(--story-photo-height) - 0.2rem);
  border: 0.22rem solid #f9f9f7;
  border-radius: 0.12rem;
  box-shadow: 0 0.12rem 0.2rem #2c2b274f;
}
.story-reading-sheet .story-audio-size { height: 2.35rem; }
.story-reading-sheet .story-media figcaption { color: #424953; font: italic 0.86rem/1.38 Georgia, serif; }
.story-media img {
  display: block;
  max-height: 58svh;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-inline: auto;
  border-radius: 0.38rem;
}
.story-media audio { width: min(100%, 31rem); display: block; }
.story-photo figcaption { text-align: center; }
.story-media figcaption { font-size: 0.94rem; color: var(--muted); }
.story-photo-details { margin-top: 0.46rem; }
.story-photo-details summary { width: fit-content; }
.story-memories { max-width: 34rem; margin-block: 0.35rem; }
.story-comments { display: grid; gap: 0.36rem; list-style: none; margin-block: 0.48rem; }
.story-comments li { background: var(--surface-subtle); padding: 0.56rem 0.65rem; border-radius: 0.48rem; }
.story-comments p { margin: 0; }
.story-comment-form { display: grid; justify-items: start; gap: 0.5rem; }
.story-comment-form .form-field { width: 100%; }
.story-history { margin-block: 0.65rem; }
.story-history ul { margin-left: 1.2rem; color: var(--muted); font-size: 0.85rem; }
.story-print-only { display: none; }

@media (max-width: 580px) {
  .story-author-fields { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .story-summary-list { grid-template-columns: minmax(0, 1fr); }
  .story-save-panel .button { flex: 1 1 100%; }
}

@media (max-width: 440px) {
  .story-filters { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
}

@media print {
  body:has(.story-print-article) { background: #fff; color: #000; }
  body:has(.story-print-article) > :not(main), .story-reader-screen { display: none !important; }
  main:has(.story-print-article) { width: 100%; max-width: none; padding: 0; margin: 0; }
  .story-print-only { display: block; }
  .story-print-article h1 { font: bold 23pt/1.16 Georgia, "Times New Roman", serif; margin: 0 0 0.35rem; overflow-wrap: anywhere; }
  .story-print-article .story-byline { color: #000; }
  .story-print-article .story-attribution { display: grid; }
  .story-print-article .story-people a { color: #000; background: none; padding: 0; }
  .story-print-article .story-prose { font-size: 11.5pt; line-height: 1.55; max-width: none; margin-top: 0.7rem; orphans: 3; widows: 3; }
  .story-print-article .story-reader-media { margin-top: 0.8rem; break-inside: avoid; }
  .story-print-article .story-media img { max-height: 150mm; }
  .story-print-article .story-print-audio-note { font: italic 10pt/1.45 Georgia, "Times New Roman", serif; }
}
