:root {
  color-scheme: light;
  --ink: #182127;
  --muted: #687177;
  --line: #d9dfdf;
  --paper: #ffffff;
  --page: #f4f6f5;
  --green: #233c2b;
  --green-2: #2f6348;
  --red: #b4332d;
  --gold: #b88a42;
  --soft-green: #eef4ef;
  --soft-gold: #f6f0e5;
  --shadow: 0 12px 30px rgba(24, 33, 39, 0.08);
}

* { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body.app-body { background: #eef1f0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
img { max-width: 100%; }
[hidden], .is-hidden { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.app-body:not(.is-authenticated) [data-auth-required] { display: none; }
.app-body.is-authenticated [data-auth-entry] { display: none; }
.app-body.is-authenticated:not(.show-workspace) [data-auth-required] { display: none; }
.app-body.show-workspace [data-guest-only] { display: none; }
.section, .content-band, .service-grid article, .steps-grid article, .price-card, .addon-grid article {
  content-visibility: auto;
  contain-intrinsic-size: 1px 520px;
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  padding: 10px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}
.brand { order: 1; display: block; flex: 0 0 auto; }
.brand-logo { display: block; width: 56px; height: 56px; object-fit: contain; }
.nav { order: 4; display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav a, .nav button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  color: #4c565b;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--red); background: #fff2f0; }
.nav .nav-action { color: #fff; background: var(--green); }
.nav .nav-action:hover { color: #fff; background: var(--green-2); }
.nav-logout { border: 1px solid var(--line) !important; }
.utility-link { color: var(--muted) !important; font-size: 13px !important; }

.site-hero {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  min-height: min(440px, calc(100vh - 68px));
  display: flex;
  align-items: center;
  margin: 18px auto 0;
  padding: clamp(30px, 5vw, 58px) clamp(20px, 7vw, 100px);
  overflow: hidden;
  background: var(--green);
}
.site-hero::before {
  display: none;
}
.site-hero::after {
  content: "";
  position: absolute;
  left: clamp(20px, 7vw, 100px);
  bottom: clamp(24px, 4vw, 42px);
  width: min(420px, 42vw);
  height: 1px;
  background: linear-gradient(90deg, rgba(211, 178, 103, .9), rgba(211, 178, 103, 0));
}
.site-hero-copy {
  position: relative;
  width: min(620px, 100%);
  margin-top: 42px;
  color: #fff;
  z-index: 1;
}
.site-hero h1 {
  margin: 0 0 18px;
  max-width: 620px;
  color: rgba(255, 255, 255, .96);
  font-size: clamp(34px, 3.8vw, 48px);
  line-height: 1.12;
  letter-spacing: 0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .36);
}
.site-hero h1 span {
  display: block;
  white-space: nowrap;
}
.hero-lines {
  display: grid;
  gap: 8px;
  margin: 0;
  color: rgba(255, 255, 255, .90);
  font-size: clamp(17px, 1.72vw, 21px);
  font-weight: 700;
  line-height: 1.55;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .38);
}
.hero-lines span {
  display: block;
  white-space: nowrap;
}
.site-hero-copy > p:not(.eyebrow) { max-width: 680px; margin: 0; font-size: 19px; line-height: 1.8; color: rgba(255,255,255,.88); }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 13px; font-weight: 800; }
.site-hero .eyebrow { color: #f1c879; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.site-hero .button {
  min-height: 42px;
  padding: 0 22px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}
.site-hero .button.primary {
  border-color: rgba(190, 42, 37, .92);
  background: rgba(190, 42, 37, .92);
}
.site-hero .button.secondary {
  border-color: rgba(255, 255, 255, .72);
  background: rgba(255, 255, 255, .90);
  color: var(--green);
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
}
.button.primary { color: #fff; background: var(--red); }
.button.secondary { color: var(--green); background: #fff; border-color: var(--line); }
.button.ghost { color: var(--green); background: transparent; border-color: #cbd4d0; }
.button.full { width: 100%; }

.section { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 72px 0; }
.section-heading { max-width: 760px; margin-bottom: 28px; }
.section-heading.compact { margin-bottom: 18px; }
.section-heading h1, .section-heading h2, .section-heading h3 { margin: 0; line-height: 1.2; letter-spacing: 0; }
.section-heading h2 { font-size: clamp(30px, 4vw, 46px); }
.section-heading h3 { font-size: 25px; }
.section-heading p:not(.eyebrow) { margin: 14px 0 0; color: var(--muted); line-height: 1.8; }
.content-band { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.service-grid, .steps-grid, .about-grid, .price-grid, .addon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.service-card, .step-card, .about-card, .price-card, .addon-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.service-card:hover { border-color: #afbbb6; box-shadow: var(--shadow); }
.service-card strong, .step-card > span { color: var(--red); font-size: 13px; }
.service-card h3, .step-card h3, .about-card h3, .price-card h3, .addon-card h3 { margin: 12px 0 8px; font-size: 22px; }
.service-card p, .step-card p, .about-card p, .price-card p, .addon-card p { margin: 0; color: var(--muted); line-height: 1.7; }
.site-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}
.site-stats div {
  min-width: 170px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.site-stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.site-stats strong {
  color: var(--red);
  font-size: 28px;
  line-height: 1;
}
.site-stats em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}
.section > .site-stats { display: none; }
.topbar-slogan {
  order: 2;
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.topbar-stats {
  order: 3;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0;
}
.topbar-stats div {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: auto;
  padding: 7px 10px;
  border-color: #e7ddcf;
  background: #fffaf3;
}
.topbar-stats span, .topbar-stats em { font-size: 12px; }
.topbar-stats strong { font-size: 20px; }
.topbar-stats i {
  display: block;
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: #e7ddcf;
}
.language-switch {
  order: 5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
}
.language-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.language-switch a:hover,
.language-switch a[aria-current="true"] {
  color: #fff;
  background: var(--green);
}
.steps-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.platform-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border-left: 4px solid var(--gold);
  background: var(--soft-gold);
}
.platform-note h2 { margin: 0 0 8px; font-size: 28px; }
.platform-note p { margin: 0; color: var(--muted); line-height: 1.7; }

.guestbook-section { padding-top: 20px; }
.guestbook-layout {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.guestbook-form,
.guestbook-item,
.guestbook-empty {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
.guestbook-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px;
}
.guestbook-form label { display: grid; gap: 7px; }
.guestbook-form span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.guestbook-full,
.guestbook-actions { grid-column: 1 / -1; }
.guestbook-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.guestbook-actions .form-status { margin: 0; }
.guestbook-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.guestbook-item {
  padding: 18px;
  min-height: 132px;
}
.guestbook-item p {
  margin: 0;
  color: var(--ink);
  line-height: 1.8;
}
.guestbook-reply {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--green-2);
  background: var(--soft-green);
}
.guestbook-reply strong {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
  font-size: 13px;
}
.guestbook-reply p {
  color: #34423a;
  font-size: 14px;
}
.guestbook-reply span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.guestbook-item footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}
.guestbook-item strong { color: var(--green); }
.guestbook-empty {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.surname-hero,
.surname-detail-hero {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 28px;
}
.surname-hero h1,
.surname-detail-hero h1 {
  margin: 0;
  font-size: clamp(40px, 5.2vw, 66px);
  line-height: 1.08;
  letter-spacing: 0;
}
.surname-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
}
.surname-title-row h1 {
  flex: 0 1 auto;
}
.surname-detail-title {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: baseline;
}
.surname-hero > p,
.surname-detail-hero > p {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}
.surname-count {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 18px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}
.surname-count strong {
  color: var(--green);
  font-size: 28px;
  line-height: 1;
}
.surname-count-inline {
  margin-top: 0;
  padding: 7px 12px;
  white-space: nowrap;
}
.surname-count-inline strong {
  font-size: 25px;
}
.surname-ranking-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  border: 1px solid rgba(200, 22, 29, .18);
  border-radius: 999px;
  background: #fff2f0;
  color: var(--red);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}
.surname-ranking-link:hover {
  color: #fff;
  background: var(--red);
}
.surname-search {
  max-width: 720px;
  margin-top: 24px;
}
.surname-search input {
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}
.surname-search input:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(47, 99, 72, .12);
}
.surname-search-hint {
  min-height: 22px;
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 14px;
}
.surname-search-results {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}
.surname-ranking {
  width: min(960px, 100%);
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.surname-ranking-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
}
.surname-ranking-head h2 {
  margin: 0 0 6px;
  font-size: 26px;
}
.surname-ranking-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.surname-ranking-head a {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
}
.surname-ranking-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.surname-ranking-list a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: baseline;
  padding: 10px 12px;
  border: 1px solid rgba(31, 23, 16, .08);
  border-radius: 8px;
  background: #fbfaf7;
  color: var(--ink);
}
.surname-ranking-list a:hover {
  border-color: rgba(200, 22, 29, .26);
  background: #fff7f2;
}
.surname-ranking-rank {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}
.surname-ranking-list strong {
  color: var(--red);
  font-size: 21px;
}
.surname-ranking-list em {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}
.surname-ranking-list small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.surname-database-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.surname-database-tabs a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}
.surname-database-tabs a:hover,
.surname-database-tabs a[aria-current="page"] {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.surname-quick-panel {
  padding-top: 8px;
}
.surname-quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.surname-quick-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--soft-gold);
  color: var(--ink);
}
.surname-quick-list strong {
  color: var(--red);
  font-size: 20px;
  line-height: 1;
}
.surname-quick-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.surname-region-entry {
  padding-top: 28px;
}
.surname-region-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.surname-region-grid a {
  min-width: 0;
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.surname-region-grid a:hover {
  border-color: #cdb8a3;
  box-shadow: var(--shadow);
}
.surname-region-grid strong {
  color: var(--green);
  font-size: 19px;
  line-height: 1.35;
}
.surname-region-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.surname-region-grid span,
.surname-region-more a {
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
}
.surname-region-more {
  margin-top: 14px;
}
.surname-library {
  padding-top: 22px;
}
.surname-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.surname-letter-nav,
.surname-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.surname-letter-nav {
  align-items: center;
  padding: 14px 16px;
  margin: 0 0 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}
.surname-pagination {
  justify-content: center;
  padding-top: 26px;
  margin: 34px 0 0;
  border-top: 1px solid var(--line);
}
.surname-letter-nav a,
.surname-pagination a {
  min-width: 36px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.surname-letter-nav a:hover,
.surname-letter-nav a[aria-current="page"],
.surname-pagination a:hover,
.surname-pagination a[aria-current="page"] {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}
.surname-card {
  min-height: 160px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.surname-card:hover {
  border-color: #afbbb6;
  box-shadow: var(--shadow);
}
.surname-card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.surname-card strong {
  color: var(--red);
  font-size: 42px;
  line-height: 1;
}
.surname-card-title b {
  color: var(--red);
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
}
.surname-card span {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}
.surname-card em {
  color: var(--ink);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}
.surname-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.surname-back {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 800;
}
.surname-detail-stats {
  display: inline-flex;
  margin-top: 0;
  color: var(--green);
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 800;
  line-height: 1.25;
}
.surname-profile {
  padding-top: 8px;
  padding-bottom: 0;
}
.surname-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.surname-profile-grid div {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.surname-profile-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.surname-profile-grid strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
}
.surname-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-top: 20px;
}
.surname-detail article {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.surname-detail h2 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.25;
}
.surname-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.85;
}
.surname-material-article {
  grid-column: 1 / -1;
  display: grid;
  gap: 18px;
  padding: 28px !important;
  background:
    linear-gradient(135deg, rgba(238, 244, 239, .9), rgba(246, 240, 229, .62)),
    #fff !important;
}
.surname-material-article > h2 {
  margin-bottom: 0;
  color: var(--green);
  font-size: clamp(30px, 4vw, 42px);
}
.surname-material-article > p {
  max-width: 920px;
  font-size: 17px;
}
.surname-service {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 22px;
  align-items: center;
  border-left: 4px solid var(--gold) !important;
  background: var(--soft-gold) !important;
}
.surname-service h2,
.surname-service p {
  grid-column: 1;
}
.surname-service .button {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 38px;
  align-self: center;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
}
.surname-related {
  padding-top: 8px;
}
.surname-related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.surname-related-grid a {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}
.surname-related-grid a:hover {
  border-color: var(--green);
  box-shadow: var(--shadow);
}

.pedigree-promo {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 72px;
}
.pedigree-promo-copy {
  width: 100%;
  max-width: 100%;
  margin-bottom: 34px;
}
.pedigree-promo-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.15;
  letter-spacing: 0;
}
.pedigree-promo-copy p {
  max-width: 920px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.85;
}
.pedigree-promo-list {
  display: grid;
  gap: 34px;
}
.pedigree-promo-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.pedigree-promo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  background: #eef1f0;
}
.pedigree-promo-text {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 22px 26px 26px;
}
.pedigree-promo-index {
  color: var(--red);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
}
.pedigree-promo-text h2 {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}
.pedigree-promo-text p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}
.pedigree-seo {
  padding-top: 32px;
}
.pedigree-feature-grid,
.pedigree-process,
.pedigree-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.pedigree-feature-grid article,
.pedigree-process article,
.pedigree-service-list article,
.pedigree-faq details {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.pedigree-feature-grid h3,
.pedigree-process h3 {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 22px;
  line-height: 1.25;
}
.pedigree-feature-grid p,
.pedigree-process p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}
.pedigree-service-list {
  display: grid;
  gap: 10px;
}
.pedigree-service-list article {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.pedigree-service-list strong,
.pedigree-process span {
  color: var(--red);
  font-weight: 900;
}
.pedigree-service-list span {
  color: var(--muted);
  line-height: 1.7;
}
.pedigree-audience-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.pedigree-audience-grid span,
.pedigree-topic-grid a {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.45;
}
.pedigree-process {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.pedigree-process article {
  padding: 18px;
}
.pedigree-process h3 {
  margin-top: 8px;
  font-size: 19px;
}
.pedigree-faq {
  display: grid;
  gap: 10px;
}
.pedigree-faq summary {
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.pedigree-faq p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
}
.pedigree-faq-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}
.pedigree-faq-pager button {
  min-width: 92px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--green);
  font-weight: 900;
}
.pedigree-faq-pager button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.pedigree-faq-pager span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.pedigree-topic-grid a:hover {
  color: var(--red);
  border-color: #cdb8a3;
  box-shadow: var(--shadow);
}

.sub-hero {
  padding: 64px max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.sub-hero h1 { margin: 6px 0 12px; font-size: clamp(36px, 5vw, 58px); letter-spacing: 0; }
.sub-hero p:not(.eyebrow) { max-width: 720px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.8; }

.genealogy-hero {
  background:
    linear-gradient(90deg, rgba(249, 247, 239, .96), rgba(249, 247, 239, .78)),
    radial-gradient(circle at right top, rgba(179, 40, 36, .08), transparent 38%);
}
.genealogy-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.genealogy-category-grid a {
  min-width: 0;
  min-height: 188px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.genealogy-category-grid a:hover,
.genealogy-list a:hover {
  border-color: #cdb8a3;
  box-shadow: var(--shadow);
}
.genealogy-category-grid strong {
  color: var(--green);
  font-size: 24px;
  line-height: 1.25;
}
.genealogy-category-grid span {
  color: var(--red);
  font-weight: 900;
}
.genealogy-category-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}
.genealogy-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.genealogy-list a {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.genealogy-list strong {
  min-width: 0;
  font-size: 17px;
  line-height: 1.45;
}
.genealogy-list span {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}
.genealogy-article {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.genealogy-article article,
.genealogy-cta {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.genealogy-article h2,
.genealogy-cta h2 {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 24px;
  line-height: 1.3;
}
.genealogy-article p,
.genealogy-cta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.85;
}
.genealogy-cta {
  grid-column: 1 / -1;
  background: var(--soft-gold);
}
.genealogy-cta .button {
  margin-top: 18px;
}

.growth-hero {
  background:
    linear-gradient(135deg, rgba(238, 244, 239, .95), rgba(246, 240, 229, .82)),
    var(--paper);
}
.growth-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.growth-card,
.growth-article article,
.growth-cta {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.growth-card strong,
.growth-article h2,
.growth-cta h2 {
  margin: 0;
  color: var(--green);
  font-size: 20px;
  line-height: 1.35;
}
.growth-card p,
.growth-article p,
.growth-cta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}
.growth-card span {
  color: var(--red);
  font-weight: 800;
}
.growth-article {
  display: grid;
  gap: 16px;
}
.growth-cta {
  background: var(--soft-gold);
}
.growth-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.growth-link-row a {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--green);
  font-weight: 800;
}
.region-research-hero h1 {
  max-width: 880px;
}
.region-data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.region-data-card {
  display: grid;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.region-data-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.region-data-card strong {
  color: var(--red);
  font-size: 28px;
}
.region-data-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}
.region-research .region-rank-table-wrap {
  overflow-x: auto;
}
.region-rank-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.region-rank-table th,
.region-rank-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}
.region-rank-table th {
  color: var(--green);
  background: var(--soft-green);
}
.region-rank-table td:first-child {
  color: var(--red);
  font-weight: 900;
}
.region-rank-table td:nth-child(2) {
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
}
.region-route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.region-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.region-timeline div {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.region-timeline span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft-gold);
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}
.region-timeline strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 18px;
}
.region-timeline p {
  margin: 0;
}
.region-route-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.region-route-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
}
.region-culture-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.region-culture-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, var(--soft-green));
}
.region-culture-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
}
.region-culture-grid p {
  margin: 0;
}
.region-check-list,
.region-source-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.85;
}
.region-check-list strong {
  color: var(--green);
}
.region-keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.region-keyword-cloud span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  font-weight: 800;
}
.region-source-list a {
  color: var(--green);
  font-weight: 800;
}
.region-topic-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.region-topic-links a {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.region-topic-links strong {
  color: var(--green);
}
.region-topic-links span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.surname-research-hero h1 {
  font-size: clamp(44px, 8vw, 86px);
}
.surname-research-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.surname-research-grid article {
  display: grid;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.surname-research-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.surname-research-grid strong {
  color: var(--red);
  font-size: 25px;
}
.surname-research-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}
.surname-longform article {
  gap: 12px;
}
.surname-info-table-wrap {
  overflow-x: auto;
}
.surname-info-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}
.surname-info-table th,
.surname-info-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}
.surname-info-table th {
  color: var(--green);
  background: var(--soft-green);
}
.surname-info-table td:first-child {
  color: var(--red);
  font-weight: 900;
}
.surname-route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.surname-route-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.surname-route-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
}
.surname-check-list,
.surname-source-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.85;
}
.surname-check-list strong {
  color: var(--green);
}
.surname-keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.surname-keyword-cloud span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  font-weight: 800;
}
.surname-source-list a {
  color: var(--green);
  font-weight: 800;
}
.surname-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.surname-mini-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.surname-mini-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
}
.surname-mini-grid p {
  margin: 0;
}
.surname-material-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.surname-material-list-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.surname-material-list section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.surname-material-list-wide section {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 240px;
  padding: 20px;
  border-color: #d8d0bf;
}
.surname-material-list-wide section:last-child {
  grid-column: 1 / -1;
  min-height: 0;
  background: #fffdf8;
}
.surname-material-list h3 {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 17px;
}
.surname-material-list-wide h3 {
  position: relative;
  margin: 0;
  padding-bottom: 10px;
  font-size: 20px;
  line-height: 1.3;
}
.surname-material-list-wide h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 42px;
  height: 2px;
  background: var(--gold);
}
.surname-material-list ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.75;
}
.surname-material-list-wide li + li {
  margin-top: 8px;
}
.surname-material-list a {
  color: var(--green);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.surname-material-list-wide section:last-child ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  padding-left: 0;
  list-style: none;
}
.surname-material-list-wide section:last-child li {
  margin: 0;
}
.surname-cross-links .surname-related-grid a {
  display: grid;
  gap: 5px;
  align-content: center;
}
.surname-cross-links .surname-related-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.footer {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(20px, 5vw, 72px);
  border-top: 1px solid var(--line);
  background: #fff;
}
.footer-logo { width: 64px; }
.footer-copy { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; color: var(--muted); font-size: 13px; }
.icp-link:hover { color: var(--red); }

/* Pedigree application */
.auth-shell {
  width: min(1040px, calc(100% - 40px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 48px;
  align-items: center;
  margin: 0 auto;
  padding: 72px 0;
}
.login-topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.login-topbar img { display: block; width: 130px; height: 46px; object-fit: contain; }
.login-topbar > a:last-child { color: var(--muted); font-size: 14px; font-weight: 800; }
.login-main { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 32px 18px; background: #eef1f0; }
.login-only-card { width: min(420px, 100%); }
.login-card-head { margin-bottom: 20px; }
.login-card-head h1 { margin: 4px 0 8px; font-size: 30px; letter-spacing: 0; }
.login-card-head p:not(.eyebrow) { margin: 0; color: var(--muted); }
.auth-copy h1 { margin: 8px 0 16px; font-size: clamp(38px, 5vw, 58px); letter-spacing: 0; }
.auth-copy p:not(.eyebrow) { color: var(--muted); font-size: 18px; line-height: 1.8; }
.auth-list { display: grid; gap: 12px; margin-top: 26px; }
.auth-list span { padding-left: 18px; position: relative; color: #465157; }
.auth-list span::before { content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 7px; background: var(--gold); }
.account-form {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 20px; padding: 4px; background: #eef1ef; }
.auth-tabs button { min-height: 40px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-weight: 800; }
.auth-tabs button.is-active { color: #fff; background: var(--green); }
.account-form[data-mode="login"] .auth-register-only { display: none; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-grid .span-2 { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #364046; font-size: 13px; font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #ccd4d3;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}
textarea { resize: vertical; }
.select-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.auth-hint, .form-status { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.form-status[data-type="error"] { color: #a92e27; }
.form-status[data-type="success"] { color: #236446; }

.workspace-shell { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.workspace-sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: #fff;
}
.workspace-family { padding: 0 8px 20px; }
.workspace-family span { display: block; color: var(--muted); font-size: 12px; }
.workspace-family strong { display: block; margin-top: 5px; font-size: 18px; }
.workspace-nav { display: grid; gap: 5px; }
.workspace-nav button {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #536066;
  background: transparent;
  text-align: left;
  font-weight: 800;
}
.workspace-nav button.is-active { color: #fff; background: var(--green); }
.workspace-user { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--line); }
.workspace-user strong, .workspace-user span { display: block; }
.workspace-user span { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.workspace-main { min-width: 0; padding: 24px; }
.workspace-view { display: none; }
.workspace-view.is-active { display: block; }
.workspace-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2, .panel-head h3 { margin: 0; letter-spacing: 0; }
.panel-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.tree-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.tree-workspace:has(#addRelativePanel.is-hidden) { grid-template-columns: minmax(0, 1fr); }
.tree-panel { min-width: 0; }
.tree-scroll {
  overflow: auto;
  max-height: calc(100vh - 230px);
  min-height: 520px;
  padding: 14px;
  border: 1px solid #e3e7e5;
  background: #fbfcfb;
  cursor: grab;
  user-select: none;
  overscroll-behavior: contain;
  touch-action: none;
}
.tree-scroll.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}
.tree-scroll .person-node,
.tree-scroll button,
.tree-scroll input,
.tree-scroll select,
.tree-scroll textarea {
  user-select: auto;
}
.genealogy-canvas {
  position: relative;
  --tree-columns: 5;
  --tree-width: 860px;
  --tree-height: 620px;
  min-width: max(860px, var(--tree-width));
  min-height: 620px;
  display: grid;
  gap: 38px;
  align-content: start;
  padding: 92px 42px 46px;
  border: 6px double #a97625;
  background:
    linear-gradient(90deg, rgba(140, 83, 24, .08) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(#fff8bd, #fff5ae 58%, #fff1a0);
  box-shadow: inset 0 0 0 2px #f4c34c, inset 0 0 0 7px rgba(255,255,255,.72);
}
#familyTreeCanvas {
  width: var(--tree-width);
  min-width: var(--tree-width);
  min-height: var(--tree-height);
  display: block;
}
#familyTreeCanvas .tree-absolute-label {
  position: absolute;
  left: 34px;
  z-index: 2;
}
#familyTreeCanvas .tree-node {
  position: absolute;
  z-index: 2;
}
.tree-lines { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.tree-lines path { fill: none; stroke: #3e2b17; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .88; }
.tree-lines path.parent-spouse-line { stroke-width: 1.5; opacity: .72; }
.pedigree-title {
  position: absolute;
  top: 22px;
  left: 34px;
  right: 34px;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #17100a;
  pointer-events: none;
}
.pedigree-title strong {
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 10px;
}
.pedigree-title span { color: #a5241c; font-size: 13px; font-weight: 800; letter-spacing: 1px; }
.tree-symbol-legend {
  position: absolute;
  top: 68px;
  left: 34px;
  right: 34px;
  z-index: 2;
  display: grid;
  justify-content: center;
  gap: 5px;
  color: #6d5a44;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}
.family-network-canvas > .tree-symbol-legend {
  top: 12px;
  left: 22px;
  right: 22px;
  justify-content: flex-start;
}
.tree-symbol-legend .legend-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}
.family-network-canvas > .tree-symbol-legend .legend-row {
  justify-content: flex-start;
}
.tree-symbol-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tree-symbol-legend i {
  width: 13px;
  height: 13px;
  display: inline-block;
  background: #7a3f1d;
}
.tree-symbol-legend .male { border-radius: 2px; }
.tree-symbol-legend .female { border-radius: 999px; }
.tree-symbol-legend .unknown { border-radius: 2px; background: #d9d5cd; }
.tree-symbol-legend b { font-style: normal; font-weight: 900; }
.tree-symbol-legend .living { color: #16120c; }
.tree-symbol-legend .deceased-text { color: #c92a20; }
.generation-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 18px;
  min-width: max-content;
}
.generation-label {
  min-width: 58px;
  padding: 5px 8px;
  border: 1px solid rgba(22,18,12,.5);
  color: #4f3518;
  background: rgba(255,255,255,.38);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
.generation-people {
  display: grid;
  grid-template-columns: repeat(var(--tree-columns), 168px);
  justify-content: start;
  justify-items: center;
  gap: 16px;
  min-width: calc(var(--tree-columns) * 168px + (var(--tree-columns) - 1) * 16px);
}
.tree-generation-people {
  position: relative;
  display: block;
  width: calc(var(--tree-width) * 1px - 156px);
  min-width: calc(var(--tree-width) * 1px - 156px);
  height: 86px;
}
.tree-person-group {
  display: flex;
  align-items: center;
  justify-content: center;
}
.tree-generation-people .tree-person-group {
  position: absolute;
  left: var(--tree-x);
  top: 0;
  transform: translateX(-50%);
}
.tree-person-group.spouse-group {
  gap: 6px;
}
.tree-person-group.spouse-group .person-node {
  width: 108px;
}
.person-node {
  position: relative;
  width: 112px;
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 7px 9px;
  border: 1px solid #1f1710;
  border-radius: 0;
  color: var(--ink);
  background: rgba(255, 254, 220, .9);
  text-align: center;
  box-shadow: inset 0 0 0 2px rgba(138,87,30,.12);
}
.node-actions {
  position: absolute;
  top: 3px;
  right: 3px;
  display: flex;
  gap: 2px;
}
.node-actions button {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(31, 23, 16, .45);
  border-radius: 2px;
  color: #23170d;
  background: rgba(255, 248, 199, .96);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.node-actions button:hover {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}
.relative-manage-tools {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(31, 23, 16, .18);
  background: rgba(255, 248, 221, .72);
}
.relative-manage-title {
  margin-bottom: 8px;
  color: #3a2a18;
  font-size: 13px;
  font-weight: 900;
}
.relative-manage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.relative-manage-grid .merge-field {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  color: #5f4b2f;
  font-size: 12px;
}
.relative-manage-grid select {
  min-height: 36px;
  border: 1px solid rgba(31, 23, 16, .24);
  background: #fffef2;
}
.button.danger {
  color: #fff;
  border-color: #b3261e;
  background: #b3261e;
}
.button.danger:hover {
  background: #8f1f19;
}
.person-node strong { color: #16120c; font-family: "STKaiti", "KaiTi", "Songti SC", serif; font-size: 17px; line-height: 1.12; }
.person-node span { color: #5f4b2f; font-size: 11px; line-height: 1.35; }
.person-node.is-deceased strong { color: #c92a20; }
.person-node.is-self { color: #16120c; border-width: 2px; border-color: #0c4731; background: #fff8c7; }
.person-node.is-self span { color: #3d4a36; }
.person-node.is-selected {
  border-color: #c8161d;
  outline: 2px solid rgba(200, 22, 29, .28);
  outline-offset: 3px;
  box-shadow: 0 0 0 1px rgba(200, 22, 29, .16), 0 8px 18px rgba(89, 26, 18, .12);
}
.person-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.person-detail-modal.is-hidden { display: none; }
.person-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 15, 10, .46);
}
.person-detail-card {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid rgba(64, 44, 24, .28);
  background: #fffaf0;
  box-shadow: 0 22px 60px rgba(33, 20, 9, .28);
}
.person-detail-close {
  position: sticky;
  top: 12px;
  float: right;
  z-index: 2;
  width: 34px;
  height: 34px;
  margin: 12px 12px 0 0;
  border: 1px solid rgba(52, 38, 24, .28);
  background: rgba(255, 250, 240, .94);
  color: #26180d;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.person-detail-content {
  display: grid;
  gap: 18px;
  padding: 28px;
}
.site-relation-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(64, 44, 24, .22);
  background: #fff4c9;
}
.site-relation-card .card-kicker {
  margin: 0 0 6px;
  color: #8e5c1c;
  font-size: 13px;
  font-weight: 900;
}
.site-relation-card h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 32px;
  color: #17100a;
}
.site-relation-card p:last-child {
  margin: 6px 0 0;
  color: #6d5a44;
  font-weight: 800;
}
.site-relation-graph {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(64, 44, 24, .18);
  background: #fbfcf7;
}
.site-relation-graph .graph-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 12px;
}
.site-relation-graph .graph-node {
  min-height: 62px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(12, 71, 49, .28);
  background: #fffdf2;
  color: #163b2a;
  font-weight: 900;
  text-align: center;
}
.site-relation-graph .focus {
  color: #16120c;
  border-color: #a97625;
  background: #fff2b5;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 21px;
}
.site-relation-graph span {
  display: block;
  color: #7b6a56;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}
.site-linked-relatives,
.site-pedigree-detail {
  display: grid;
  gap: 12px;
}
.detail-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.detail-section-head h3 {
  margin: 0;
  color: #17100a;
  font-size: 19px;
}
.detail-section-head span {
  color: #7b6a56;
  font-size: 13px;
  font-weight: 800;
}
.site-linked-relatives button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(64, 44, 24, .16);
  background: #fffdf8;
  color: #17100a;
  cursor: pointer;
}
.site-linked-relatives button span {
  color: #7b6a56;
  font-size: 12px;
}
.detail-empty {
  margin: 0;
  padding: 14px;
  background: #fbfcf7;
  color: #7b6a56;
}
.pedigree-cover-block {
  display: grid;
  gap: 7px;
  padding: 26px 22px;
  border: 6px double #a97625;
  background: linear-gradient(#fff7bd, #fff1a0);
  text-align: center;
}
.pedigree-cover-block p {
  margin: 0;
  color: #a5241c;
  font-weight: 900;
}
.pedigree-cover-block h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 34px;
  letter-spacing: 4px;
}
.pedigree-cover-block span {
  color: #6d5a44;
  font-weight: 800;
}
.pedigree-record-block {
  display: grid;
  gap: 0;
  border: 1px solid rgba(64, 44, 24, .18);
  background: #fffdf8;
}
.pedigree-record-block .detail-section-head {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(64, 44, 24, .14);
}
.pedigree-record-block > div:not(.detail-section-head) {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(64, 44, 24, .1);
}
.pedigree-record-block > div:last-child { border-bottom: 0; }
.pedigree-record-block span { color: #7b6a56; }
.pedigree-record-block strong { color: #17100a; }
.classic-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.classic-tabs div {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: #fbfcf7;
  border: 1px solid rgba(64, 44, 24, .14);
}
.classic-tabs span {
  color: #7b6a56;
  font-size: 13px;
  line-height: 1.55;
}
.inscription {
  margin: 0;
  padding: 16px;
  color: #6d4b24;
  background: #fff5d6;
  border-left: 4px solid #a97625;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 18px;
}
.family-network-canvas {
  position: relative;
  --network-width: 920px;
  --network-height: 560px;
  width: var(--network-width);
  min-width: var(--network-width);
  min-height: var(--network-height);
  padding: 46px 32px 38px;
}
.network-generation-label {
  position: absolute;
  left: 20px;
  z-index: 1;
  transform: translateY(-50%);
}
.network-person-node {
  position: absolute;
  z-index: 5;
  pointer-events: auto;
  width: 142px;
  min-height: 112px;
  gap: 5px;
  padding: 12px;
  border: 1px solid #ccd5d1;
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}
.network-person-node {
  cursor: pointer;
}
.network-person-node:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 22px rgba(92, 58, 21, 0.12);
}
.network-person-node strong { font-family: inherit; font-size: 17px; color: var(--ink); }
.network-person-node span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.network-person-node.is-self { color: #fff; border-color: var(--green); background: var(--green); }
.network-person-node.is-self span { color: rgba(255,255,255,.76); }
.network-person-node em { color: var(--gold); font-size: 11px; font-style: normal; font-weight: 800; }
.family-network-canvas .tree-lines path { stroke: #1f7f8f; stroke-width: 1.7; opacity: .68; }
.family-network-canvas .tree-lines path.network-spouse-link {
  stroke: #8a5a18;
  stroke-width: 1.8;
  opacity: .72;
}
.family-network-canvas .tree-lines path.network-sibling-link {
  stroke: #6e6254;
  stroke-width: 1.7;
  opacity: .68;
}
.family-network-canvas .tree-lines path.is-selected-link {
  stroke: #c8161d !important;
  stroke-width: 2.4 !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 2px rgba(200, 22, 29, .38));
}
.family-network-canvas .tree-lines path.is-dimmed-link {
  opacity: .22 !important;
}
.family-network-canvas .network-person-node.is-related {
  border-color: rgba(200, 22, 29, .75);
  box-shadow: 0 0 0 2px rgba(200, 22, 29, .12);
}

.empty-tree { margin: auto; color: var(--muted); text-align: center; }
.relative-form { display: grid; gap: 12px; }
.relative-form .field-grid { grid-template-columns: 1fr 1fr; }
.relative-form .optional-fields { display: none; }
.relative-form.is-expanded .optional-fields { display: grid; }
.text-button { min-height: 36px; border: 0; color: var(--green-2); background: transparent; font-weight: 800; }

.account-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.account-stats span { padding: 14px; border: 1px solid var(--line); background: #fbfcfb; color: var(--muted); font-size: 12px; }
.account-stats strong { display: block; color: var(--green); font-size: 24px; }
.account-profile-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(31, 23, 16, .14);
}
.account-profile-form .field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.account-profile-form label {
  min-width: 0;
}
.account-profile-form .select-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.member-list { display: grid; gap: 8px; }
.member-button { width: 100%; min-height: 66px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; text-align: left; }
.member-button.is-active { border-color: var(--green-2); background: var(--soft-green); }
.member-button > span:nth-child(2) { display: grid; gap: 3px; }
.member-button span span, .member-button .status { color: var(--muted); font-size: 12px; }
.share-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.share-card { padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; }
.share-card h3 { margin: 6px 0; }
.share-card p { color: var(--muted); }
.label { margin: 0; color: var(--red) !important; font-size: 12px; font-weight: 800; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* Legacy */
.legacy-summary { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; align-items: start; }
.legacy-visual { min-height: 320px; background: url("assets/legacy-hero-memory.webp") center / cover no-repeat; border: 1px solid var(--line); }
.process-row { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: #fff; }
.process-row article { padding: 22px; border-right: 1px solid var(--line); }
.process-row article:last-child { border-right: 0; }
.process-row span { color: var(--red); font-weight: 800; }
.process-row h3 { margin: 10px 0 7px; }
.process-row p { margin: 0; color: var(--muted); line-height: 1.6; }
.price-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.price-card { padding: 20px; }
.price-card.featured { border-top: 4px solid var(--red); }
.price-card .price { display: block; margin: 12px 0; color: var(--red); font-size: 25px; }
.price-card ul { margin: 16px 0 0; padding-left: 18px; color: #4e5a60; line-height: 1.8; font-size: 13px; }
.addon-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.addon-card strong { display: block; margin-top: 9px; color: var(--red); }

/* Admin data */
.admin-body { background: #f4f6f3; }
.admin-shell { width: min(100% - 36px, 1440px); margin: 0 auto; padding: 28px 0 56px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.admin-head h1 { margin: 4px 0 8px; font-size: 34px; }
.admin-head p { margin: 0; color: var(--muted); }
.admin-login, .admin-table-card, .admin-toolbar, .admin-stat-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.admin-login { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(360px, 1fr); gap: 18px; align-items: end; padding: 20px; }
.admin-login h2, .admin-toolbar h2, .admin-table-head h2 { margin: 0 0 6px; }
.admin-login p, .admin-toolbar p, .admin-table-head p { margin: 0; color: var(--muted); }
.admin-login-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.admin-login-form label, .admin-table-tools { display: grid; gap: 6px; }
.admin-login-form span { color: var(--muted); font-size: 13px; font-weight: 700; }
.admin-login-form input, .admin-table-tools input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: #fbfcfb;
  font: inherit;
}
.admin-message { grid-column: 1 / -1; color: var(--red) !important; font-weight: 800; }
.admin-dashboard { display: grid; gap: 16px; }
.admin-toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 18px; }
.admin-toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 10px; }
.admin-stat-grid article { padding: 15px; }
.admin-stat-grid span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.admin-stat-grid strong { display: block; margin-top: 8px; color: var(--green); font-size: 28px; }
.admin-table-card { overflow: hidden; }
.admin-search-submit {
  display: grid;
  gap: 14px;
  padding: 18px;
}
.admin-search-submit-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}
.admin-search-submit-summary article,
.admin-search-submit-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 13px;
}
.admin-search-submit-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.admin-search-submit-summary strong {
  display: block;
  margin-top: 7px;
  color: var(--green);
  font-size: 18px;
  overflow-wrap: anywhere;
}
.admin-search-submit-summary strong.is-ok { color: var(--green-2); }
.admin-search-submit-summary strong.is-error { color: var(--red); }
.admin-search-submit-log {
  min-width: 320px;
  color: #3e4b43;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: normal;
}
.admin-search-submit-empty {
  color: var(--muted);
  font-weight: 800;
}
.admin-table-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 18px; border-bottom: 1px solid var(--line); }
.admin-table-tools { grid-template-columns: minmax(220px, 1fr) auto; align-items: center; }
.admin-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-row-actions .button { min-height: 30px; padding: 0 10px; font-size: 12px; }
.admin-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.admin-status-badge.is-approved {
  border-color: var(--green-2);
  color: #fff;
  background: var(--green-2);
}
.admin-status-badge.is-rejected,
.admin-status-badge.is-deleted {
  border-color: #d8cbc7;
  color: var(--red);
  background: #fff2f0;
}
.admin-row-actions .button.secondary.is-approved,
.admin-row-actions .button.is-approved {
  border-color: var(--green-2);
  color: #fff !important;
  background: var(--green-2) !important;
  box-shadow: 0 0 0 2px rgba(47, 99, 72, .12);
}
.admin-message-content {
  display: grid;
  gap: 8px;
  min-width: 260px;
  white-space: normal;
}
.admin-message-reply-view {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-left: 3px solid var(--green-2);
  background: var(--soft-green);
  color: #34423a;
}
.admin-message-reply-view strong {
  color: var(--green);
}
.admin-message-reply-view span {
  color: var(--muted);
  font-size: 12px;
}
.admin-message-reply {
  display: grid;
  gap: 7px;
  min-width: 240px;
  margin-top: 8px;
}
.admin-message-reply textarea {
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  resize: vertical;
}
.admin-message-reply .admin-reply-confirm {
  min-height: 34px;
  padding: 0 12px;
  border-color: var(--green);
  color: #fff;
  background: var(--green);
  font-size: 12px;
  justify-self: start;
}
.admin-visit-layout { display: grid; grid-template-columns: 1.35fr .85fr; gap: 0; }
.admin-site-visit-table { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
.admin-site-visit-table .admin-table { min-width: 760px; }
.admin-visit-layout .admin-visit-table + .admin-visit-table { border-left: 1px solid var(--line); }
.admin-visit-table { max-height: 420px; }
.admin-visit-table .admin-table { min-width: 420px; }
.admin-table-wrap { overflow: auto; max-height: 580px; }
.admin-table { width: 100%; min-width: 1180px; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.admin-table th { position: sticky; top: 0; z-index: 1; background: #eef4ef; color: var(--green); font-size: 12px; }
.admin-table tr:hover td { background: #fbfcfb; }
.admin-empty { color: var(--muted); text-align: center !important; }

@media (max-width: 980px) {
  .nav { overflow-x: auto; max-width: 72vw; }
  .service-grid, .about-grid { grid-template-columns: 1fr 1fr; }
  .steps-grid, .process-row, .price-grid, .addon-grid { grid-template-columns: 1fr 1fr; }
  .process-row article { border-bottom: 1px solid var(--line); }
  .auth-shell, .tree-workspace, .share-layout, .legacy-summary { grid-template-columns: 1fr; }
  .admin-login, .admin-login-form { grid-template-columns: 1fr; }
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-table-head, .admin-toolbar, .admin-head { display: grid; }
  .admin-table-tools { grid-template-columns: 1fr; }
  .admin-visit-layout { grid-template-columns: 1fr; }
  .admin-visit-layout .admin-table-wrap + .admin-table-wrap { border-left: 0; border-top: 1px solid var(--line); }
  .surname-profile-grid, .surname-related-grid, .surname-material-list-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .genealogy-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pedigree-feature-grid, .pedigree-process, .pedigree-topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pedigree-audience-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-shell { grid-template-columns: 1fr; }
  .workspace-sidebar { position: static; height: auto; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace-family { padding: 0; }
  .workspace-nav { display: flex; overflow-x: auto; }
  .workspace-user { display: none; }
}

@media (max-width: 680px) {
  .topbar {
    min-height: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 8px 12px 10px;
  }
  .brand-logo { width: 42px; height: 42px; }
  .topbar-slogan { flex: 1 1 auto; min-width: 0; font-size: 12px; }
  .topbar-stats { order: 3; transform: scale(.9); transform-origin: right center; margin-left: auto; }
  .nav {
    order: 5;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    padding-bottom: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .nav button { min-height: 34px; padding: 0 9px; font-size: 12px; white-space: nowrap; }
  .utility-link { display: none !important; }
  .person-detail-modal { padding: 0; place-items: stretch; }
  .person-detail-card { width: 100%; max-height: 100vh; }
  .person-detail-content { padding: 18px 14px 22px; }
  .site-relation-card { display: grid; }
  .site-relation-card h2 { font-size: 28px; }
  .site-relation-graph .graph-row, .classic-tabs { grid-template-columns: 1fr; }
  .pedigree-record-block > div:not(.detail-section-head) { grid-template-columns: 86px 1fr; }
  .site-hero {
    width: min(100% - 28px, 1180px);
    min-height: min(374px, calc(100svh - 96px));
    margin-top: 14px;
    padding: 28px 16px 34px;
    align-items: flex-end;
    background-position: 58% top;
  }
  .site-hero::after { width: min(320px, calc(100% - 32px)); left: 16px; bottom: 26px; }
  .site-hero-copy { margin-top: 84px; }
  .site-hero h1 { font-size: 34px; line-height: 1.12; }
  .site-hero h1 span { white-space: normal; }
  .hero-lines { gap: 6px; font-size: 17px; line-height: 1.45; }
  .hero-lines span { white-space: normal; }
  .site-hero-copy > p:not(.eyebrow) { font-size: 16px; }
  .section { width: min(100% - 28px, 1180px); padding: 48px 0; }
  .pedigree-promo { width: min(100% - 28px, 1080px); padding: 42px 0 54px; }
  .pedigree-promo-copy h1 { font-size: 34px; }
  .pedigree-promo-copy p { font-size: 16px; }
  .pedigree-promo-list { gap: 24px; }
  .pedigree-promo-card img { aspect-ratio: 4 / 3; }
  .pedigree-promo-text { grid-template-columns: 1fr; gap: 8px; padding: 18px; }
  .pedigree-promo-index, .pedigree-promo-text h2 { font-size: 25px; }
  .pedigree-feature-grid, .pedigree-process, .pedigree-topic-grid, .pedigree-audience-grid { grid-template-columns: 1fr; }
  .pedigree-service-list article { grid-template-columns: 1fr; gap: 8px; }
  .genealogy-category-grid,
  .genealogy-list,
  .genealogy-article {
    grid-template-columns: 1fr;
  }
  .genealogy-category-grid a {
    min-height: 0;
    padding: 20px;
  }
  .genealogy-list a {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .genealogy-article article,
  .genealogy-cta {
    padding: 20px;
  }
  .surname-hero, .surname-detail-hero { width: min(100% - 28px, 1080px); padding: 42px 0 20px; }
  .surname-hero h1, .surname-detail-hero h1 { font-size: 38px; }
  .surname-title-row { gap: 10px; }
  .surname-count-inline strong { font-size: 22px; }
  .surname-ranking-link { min-height: 34px; padding: 0 12px; font-size: 13px; }
  .surname-ranking-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .surname-ranking-head { display: grid; }
  .surname-database-tabs a { flex: 1 1 calc(50% - 10px); justify-content: center; }
  .surname-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .surname-detail, .surname-profile-grid, .surname-related-grid, .surname-material-list, .surname-material-list-wide, .surname-material-list-wide section:last-child ul { grid-template-columns: 1fr; }
  .surname-service {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .surname-service h2,
  .surname-service p,
  .surname-service .button {
    grid-column: auto;
    grid-row: auto;
  }
  .surname-service .button {
    justify-self: flex-start;
  }
  .surname-material-article { padding: 20px !important; }
  .surname-material-list-wide section { min-height: 0; padding: 18px; }
  .service-grid, .steps-grid, .about-grid, .price-grid, .addon-grid, .process-row, .settings-grid { grid-template-columns: 1fr; }
  .platform-note { grid-template-columns: 1fr; }
  .guestbook-layout,
  .guestbook-form,
  .guestbook-list { grid-template-columns: 1fr; }
  .guestbook-actions { display: grid; justify-content: stretch; }
  .footer { align-items: flex-start; flex-direction: column; }
  .footer-copy { justify-content: flex-start; }
  .auth-shell { width: min(100% - 28px, 1040px); padding: 42px 0; gap: 24px; }
  .auth-copy h1 { font-size: 38px; }
  .field-grid, .relative-form .field-grid { grid-template-columns: 1fr; }
  .field-grid .span-2 { grid-column: auto; }
  .select-row { grid-template-columns: 1fr; }
  .workspace-sidebar { grid-template-columns: 1fr; padding: 12px; }
  .workspace-family { display: none; }
  .workspace-nav button { white-space: nowrap; }
  .workspace-main { padding: 12px; }
  .workspace-panel { padding: 14px; }
  .panel-head { display: grid; gap: 10px; }
  .account-stats { grid-template-columns: 1fr 1fr 1fr; }
  .tree-scroll {
    min-height: calc(100svh - 220px);
    max-height: calc(100svh - 180px);
    padding: 4px;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }
  .genealogy-canvas {
    min-width: 640px;
    min-height: 560px;
    gap: 32px;
    padding: 82px 24px 34px;
  }
  .family-network-canvas {
    min-width: 720px;
    padding: 44px 20px 30px;
  }
}

@media (max-width: 420px) {
  .topbar { gap: 6px 10px; }
  .brand-logo { width: 38px; height: 38px; }
  .topbar-slogan { font-size: 11px; }
  .topbar-stats { display: none; }
  .site-hero { min-height: min(346px, calc(100svh - 92px)); }
  .site-hero h1 { font-size: 30px; }
  .hero-lines { font-size: 16px; }
  .hero-actions .button { flex: 1 1 100%; }
  .sub-hero { padding-top: 42px; padding-bottom: 42px; }
  .sub-hero h1 { font-size: 34px; }
  .genealogy-category-grid strong,
  .genealogy-article h2,
  .genealogy-cta h2 {
    font-size: 22px;
  }
  .surname-grid { grid-template-columns: 1fr; }
  .surname-card { min-height: 132px; }
}
