@font-face {
  font-family: "Architects Daughter";
  src: url("assets/architects-daughter.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fffdf8;
  --surface: #ffffff;
  --surface-soft: #f3ede8;
  --ink: #24211e;
  --muted: #6d6662;
  --line: #e5d9cf;
  --amber: #c06f3e;
  --sage: #4a3138;
  --blue: #718899;
  --rose: #9b5e5a;
  --plum: #4a3138;
  --copper: #c06f3e;
  --smoke: #718899;
  --cream: #fffdf8;
  --ember-soft: #fff0e3;
  --shadow: 0 16px 42px rgba(36, 33, 30, 0.12);
  --small-shadow: 0 6px 18px rgba(36, 33, 30, 0.08);
  --radius: 8px;
  --app-font: "Architects Daughter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--app-font);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(192, 111, 62, 0.18), transparent 34%),
    radial-gradient(ellipse at 82% 14%, rgba(155, 94, 90, 0.12), transparent 36%),
    linear-gradient(180deg, #fffdf8 0%, #fff7ee 52%, #f4eee6 100%);
  color: var(--ink);
  min-width: 320px;
  font-family: var(--app-font);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 18%, rgba(192, 111, 62, 0.18), transparent 32%),
    radial-gradient(ellipse at 52% 12%, rgba(234, 163, 109, 0.16), transparent 28%),
    radial-gradient(ellipse at 82% 30%, rgba(74, 49, 56, 0.09), transparent 34%);
  filter: blur(18px);
  transform: translateZ(0);
}

body::after {
  content: "";
  position: fixed;
  inset: 74px 0 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg width='1440' height='900' viewBox='0 0 1440 900' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M90 780 C230 610 200 410 340 260 C455 138 610 120 690 18' stroke='%23C06F3E' stroke-opacity='.16' stroke-width='2.2'/%3E%3Cpath d='M290 860 C480 675 425 470 570 320 C705 178 850 178 930 52' stroke='%239B5E5A' stroke-opacity='.12' stroke-width='2'/%3E%3Cpath d='M665 900 C830 735 780 510 925 350 C1040 224 1190 186 1305 70' stroke='%23EAA36D' stroke-opacity='.18' stroke-width='2.4'/%3E%3Cpath d='M1130 860 C1248 710 1195 535 1320 390 C1370 332 1400 290 1435 210' stroke='%234A3138' stroke-opacity='.08' stroke-width='2'/%3E%3Cpath d='M20 470 C150 380 190 235 310 145 C408 72 520 66 604 28' stroke='%23C06F3E' stroke-opacity='.1' stroke-width='1.6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-position: center top;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 20;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius);
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 14px clamp(18px, 4vw, 54px);
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid rgba(229, 217, 207, 0.86);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-mark {
  flex: 0 0 auto;
  display: block;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: var(--cream);
  object-fit: contain;
  box-shadow: 0 7px 16px rgba(36, 33, 30, 0.16);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.primary-nav,
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.primary-nav {
  justify-content: center;
  flex-wrap: wrap;
}

.nav-link,
.account-panel button,
.ghost-button,
.secondary-button,
.primary-button,
.filter-chip,
.tool-button,
.small-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  padding: 9px 13px;
}

.nav-link:hover,
.nav-link:focus-visible,
.account-panel button:hover,
.ghost-button:hover,
.tool-button:hover,
.filter-chip:hover {
  background: var(--surface-soft);
}

.nav-link.is-active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--small-shadow);
}

body.public-mode [data-protected] {
  display: none !important;
}

.nav-upload {
  color: #fff;
  background: linear-gradient(135deg, var(--plum), var(--ink));
}

.nav-upload:hover,
.nav-upload:focus-visible {
  background: linear-gradient(135deg, #5b3a43, var(--ink));
}

.header-actions {
  justify-content: end;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  width: min(290px, 26vw);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.search-wrap span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button,
.account-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--small-shadow);
}

.icon-button {
  width: 42px;
  font-weight: 750;
}

.account-button {
  gap: 9px;
  padding: 5px 12px 5px 6px;
}

.avatar,
.mini-avatar {
  display: grid;
  place-items: center;
  background: var(--ember-soft);
  color: var(--plum);
  font-weight: 750;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.78rem;
}

.mini-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
}

.account-panel {
  position: fixed;
  right: clamp(18px, 4vw, 54px);
  top: 72px;
  z-index: 30;
  display: grid;
  gap: 4px;
  width: 260px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-panel[hidden] {
  display: none;
}

.account-panel button {
  text-align: left;
}

.account-panel #sign-out {
  margin-top: 4px;
  color: #fff;
  background: linear-gradient(135deg, var(--plum), var(--ink));
  font-weight: 750;
}

.account-panel p {
  margin: 8px 4px 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.account-summary {
  padding: 8px 4px 6px;
  border-bottom: 1px solid var(--line);
}

main {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: clamp(24px, 5vw, 64px);
}

main::before {
  content: "";
  position: fixed;
  inset: 72px 0 auto;
  height: 34vh;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 28% 35%, rgba(255, 240, 227, 0.5), transparent 44%),
    radial-gradient(ellipse at 72% 18%, rgba(192, 111, 62, 0.08), transparent 38%);
}

.page {
  max-width: 1220px;
  margin: 0 auto;
}

.page-narrow {
  max-width: 980px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--amber);
  font-size: 0.79rem;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.2rem, 5vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin: 54px 0 18px;
}

.section-head p {
  max-width: 640px;
  margin-bottom: 0;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(340px, 0.84fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: start;
  min-height: 68vh;
}

.hero-home {
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
}

.hero-stacked {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.guest-welcome {
  display: grid;
  gap: 18px;
  justify-items: center;
  align-content: center;
  min-height: calc(100vh - 116px);
}

.guest-welcome img {
  width: min(100%, 1440px);
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.guest-welcome p {
  max-width: 980px;
  margin: 0;
  color: var(--plum);
  font-size: clamp(1rem, 1.7vw, 1.28rem);
  font-weight: 740;
  line-height: 1.45;
  text-align: center;
}

.guest-welcome a {
  color: var(--plum);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -18px -18px auto auto;
  width: min(46vw, 520px);
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(74, 49, 56, 0.42), rgba(192, 111, 62, 0.58), rgba(255, 176, 91, 0.32));
  filter: blur(10px);
  opacity: 0.78;
}

.hero-media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(74, 49, 56, 0.16), rgba(192, 111, 62, 0.12)),
    var(--surface-soft);
  box-shadow: var(--shadow);
}

.hero-home .hero-media {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.hero-media img {
  width: 100%;
  height: clamp(390px, 60vh, 680px);
  object-fit: contain;
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(255, 240, 227, 0.76));
}

.hero-home .hero-media img {
  background: transparent;
}

.working-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 240, 227, 0.88);
  color: var(--plum);
  font-weight: 760;
}

.working-note::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--copper);
  box-shadow: 0 0 0 6px rgba(192, 111, 62, 0.12);
}

.hero-stacked .hero-media img {
  height: clamp(360px, 52vh, 620px);
}

.hero-badge {
  position: absolute;
  left: 18px;
  bottom: 18px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-weight: 720;
  box-shadow: var(--small-shadow);
}

.empty-hero {
  border: 1px solid rgba(192, 111, 62, 0.22);
  background:
    linear-gradient(135deg, rgba(74, 49, 56, 0.12), transparent 34%),
    linear-gradient(45deg, transparent 0 38%, rgba(192, 111, 62, 0.13) 38% 48%, transparent 48% 100%),
    linear-gradient(180deg, #fffdf8, #eef3f6);
}

.hero-copy {
  position: relative;
  max-width: 560px;
  padding: clamp(18px, 3vw, 28px);
  border-left: 4px solid var(--copper);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.82), rgba(255, 240, 227, 0.58));
  box-shadow: 0 18px 48px rgba(36, 33, 30, 0.08);
}

.hero-stacked .hero-copy {
  max-width: none;
}

.hero-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding: 10px 14px 10px 10px;
  border: 1px solid rgba(74, 49, 56, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--small-shadow);
}

.hero-brand-lockup img {
  width: 77px;
  height: 77px;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(74, 49, 56, 0.2);
}

.hero-brand-lockup strong,
.hero-brand-lockup span {
  display: block;
}

.hero-brand-lockup strong {
  font-size: 1.28rem;
}

.hero-brand-lockup span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.88rem;
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0;
}

.meta-tile,
.stat-tile,
.health-tile {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, #fff8f0);
  padding: 14px;
  box-shadow: var(--small-shadow);
}

.meta-tile span,
.stat-tile span,
.health-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.meta-tile strong,
.stat-tile strong,
.health-tile strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  line-height: 1.18;
}

.hero-actions,
.button-row,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 720;
}

.primary-button {
  background: linear-gradient(135deg, var(--plum), var(--ink));
  color: #fff;
  border-color: var(--plum);
}

.primary-button:hover {
  background: linear-gradient(135deg, #5b3a43, var(--ink));
}

.primary-button:disabled,
.secondary-button:disabled,
.primary-button.is-working {
  cursor: wait;
  opacity: 0.76;
}

.primary-button.is-working::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--small-shadow);
}

.danger-button {
  color: #7d2525;
  border-color: rgba(125, 37, 37, 0.24);
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #fff0ec;
}

.ghost-button {
  border-color: var(--line);
  color: var(--ink);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid + .form-panel,
.event-photo-grid + .form-panel,
.timeline-row + .form-panel {
  margin-top: 42px;
}

.card,
.memory-card,
.person-card,
.event-card,
.help-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fff8f0);
  box-shadow: var(--small-shadow);
}

.help-card {
  padding: 18px;
}

.help-card h2 {
  margin-bottom: 8px;
}

.help-purpose-panel {
  position: relative;
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(192, 111, 62, 0.28);
  border-left: 6px solid var(--copper);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 176, 91, 0.28), transparent 34%),
    linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(255, 240, 227, 0.9));
  box-shadow: 0 18px 46px rgba(74, 49, 56, 0.1);
}

.help-purpose-panel p {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  font-weight: 620;
  line-height: 1.72;
}

.help-purpose-panel strong {
  color: var(--plum);
  font-weight: 840;
}

.memory-card,
.person-card,
.event-card {
  text-align: left;
  padding: 0;
}

.memory-card img,
.event-card img,
.person-card img {
  width: 100%;
  height: 190px;
  object-fit: contain;
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(255, 240, 227, 0.72));
}

.memory-card .content,
.event-card .content,
.person-card .content,
.card .content {
  padding: 16px;
}

.event-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.event-thread-panel {
  margin: 18px 0 28px;
  padding: 18px;
  border: 1px solid rgba(92, 58, 46, 0.16);
  background: linear-gradient(135deg, rgba(255, 248, 238, 0.92), rgba(244, 232, 218, 0.72));
}

.pdf-card {
  border-color: rgba(188, 82, 39, 0.28);
  background: linear-gradient(135deg, rgba(255, 250, 242, 0.96), rgba(242, 225, 207, 0.82));
}

.pdf-create-button {
  min-height: 50px;
  padding-inline: 20px;
  background: linear-gradient(135deg, var(--copper), var(--plum));
  box-shadow: 0 14px 30px rgba(192, 111, 62, 0.22);
}

.pdf-create-button::before {
  content: "";
  width: 12px;
  height: 18px;
  border-radius: 10px 10px 12px 12px;
  background: linear-gradient(180deg, #fff3df, #eaa36d 42%, #c06f3e);
}

.book-working {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(192, 111, 62, 0.28);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 176, 91, 0.26), transparent 34%),
    linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(255, 240, 227, 0.86));
  box-shadow: var(--small-shadow);
}

.book-working strong,
.book-working p {
  display: block;
  margin: 0;
}

.book-working p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.book-spinner {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 4px solid rgba(192, 111, 62, 0.2);
  border-top-color: var(--copper);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.small-note {
  color: var(--muted);
  font-size: 0.84rem;
}

.event-photo-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fff8f0);
  box-shadow: var(--small-shadow);
}

.event-photo-open {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.event-photo-open img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(255, 240, 227, 0.72));
}

.event-photo-card .content {
  padding: 16px;
}

.event-photo-title {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.compact-head {
  margin-top: 22px;
  margin-bottom: 12px;
}

.generated-feed {
  margin: 26px 0;
}

.needs-story-list {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.needs-story-card {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 18px;
  padding: 14px;
  border: 1px solid rgba(192, 111, 62, 0.2);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(255, 240, 227, 0.68));
  box-shadow: var(--small-shadow);
}

.needs-story-card img {
  width: 100%;
  height: 190px;
  object-fit: contain;
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.84);
}

.needs-story-card h2 {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

.memory-prompts-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin: 24px 0 18px;
  padding: 18px;
  border: 1px solid rgba(192, 111, 62, 0.22);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 176, 91, 0.2), transparent 34%),
    linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(255, 240, 227, 0.7));
  box-shadow: var(--small-shadow);
}

.prompt-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prompt-chip {
  min-height: 40px;
  border: 1px solid rgba(192, 111, 62, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--plum);
  padding: 9px 13px;
  font-weight: 740;
}

.prompt-chip:hover,
.prompt-chip:focus-visible {
  background: var(--ember-soft);
}

.feed-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fffdf8, #eef3f6);
  box-shadow: var(--small-shadow);
}

.feed-card h3 {
  margin-top: 10px;
}

.story-inbox,
.builder-steps,
.person-profile-hero,
.person-timeline {
  margin: 28px 0;
}

.story-inbox {
  padding: 18px;
  border: 1px solid rgba(192, 111, 62, 0.2);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.88), rgba(255, 240, 227, 0.62));
  box-shadow: var(--small-shadow);
}

.inbox-card,
.builder-step,
.person-timeline-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--small-shadow);
}

.inbox-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.inbox-card h3,
.builder-step h3 {
  margin: 10px 0 6px;
}

.inbox-card small {
  color: var(--muted);
}

.builder-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.builder-step {
  padding: 18px;
}

.builder-step > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ember-soft);
  color: var(--plum);
  font-weight: 800;
}

.builder-checklist {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.builder-checklist span {
  color: var(--muted);
  font-size: 0.88rem;
}

.builder-checklist span::before {
  content: "○ ";
}

.builder-checklist .is-done {
  color: var(--plum);
  font-weight: 720;
}

.builder-checklist .is-done::before {
  content: "✓ ";
}

.person-profile-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(340px, 1.08fr);
  gap: clamp(18px, 3vw, 32px);
  align-items: start;
  padding: 18px;
  border: 1px solid rgba(74, 49, 56, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.9), rgba(238, 243, 246, 0.72));
  box-shadow: var(--shadow);
}

.person-profile-hero > img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--small-shadow);
}

.person-profile-hero > .button-row {
  grid-column: 2;
  justify-content: flex-start;
}

.person-profile-hero .meta-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.person-profile-hero .meta-tile {
  min-height: 94px;
}

.person-profile-hero .meta-tile strong {
  font-size: clamp(0.98rem, 1.2vw, 1.16rem);
}

.person-story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  gap: 18px;
  margin: 22px 0;
}

.related-people-list {
  display: grid;
  gap: 10px;
}

.mini-person-link {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.82);
  color: var(--ink);
  text-align: left;
}

.mini-person-link img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  object-fit: cover;
}

.mini-person-link strong,
.mini-person-link small {
  display: block;
}

.mini-person-link small {
  margin-top: 3px;
  color: var(--muted);
}

.person-timeline {
  display: grid;
  gap: 12px;
}

.person-timeline-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
}

.person-timeline-row > span {
  color: var(--plum);
  font-weight: 800;
}

.mini-event-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  width: 100%;
}

.mini-event-card img {
  height: 100%;
  min-height: 96px;
}

.timeline-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.timeline-column {
  position: relative;
  grid-template-columns: 1fr;
  max-width: 920px;
  margin: 0 auto 24px;
  overflow: visible;
  padding: 18px 0 18px 56px;
}

.timeline-column::before {
  content: "";
  position: absolute;
  top: 30px;
  bottom: 30px;
  left: 18px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(192, 111, 62, 0.9), rgba(122, 63, 47, 0.36), rgba(74, 49, 56, 0.18));
  box-shadow: 0 0 0 8px rgba(255, 240, 227, 0.58), 0 18px 34px rgba(192, 111, 62, 0.12);
}

.timeline-row:not(.timeline-column) .timeline-item {
  min-height: auto;
}

.timeline-row:not(.timeline-column) .timeline-item::before,
.timeline-row:not(.timeline-column) .timeline-dot {
  display: none;
}

.timeline-row:not(.timeline-column) .timeline-panel {
  margin-left: 0;
}

.timeline-item {
  position: relative;
  min-height: 184px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--plum), var(--copper));
}

.timeline-dot {
  position: absolute;
  left: -44px;
  top: 54px;
  width: 14px;
  height: 14px;
  border: 3px solid #fff8f0;
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 1px rgba(122, 63, 47, 0.28), 0 8px 18px rgba(192, 111, 62, 0.25);
  z-index: 2;
}

.timeline-panel {
  margin-left: 44px;
}

.timeline-column .timeline-item {
  min-height: 184px;
}

.timeline-column .timeline-item::before {
  display: none;
}

.timeline-column .timeline-dot {
  left: -44px;
  top: 54px;
}

.timeline-column .timeline-panel {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 174px;
  margin-left: 0;
  border-color: rgba(192, 111, 62, 0.22);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(255, 240, 227, 0.84));
  box-shadow: 0 16px 38px rgba(74, 49, 56, 0.1);
}

.timeline-column .timeline-panel:hover,
.timeline-column .timeline-panel:focus-visible {
  border-color: rgba(192, 111, 62, 0.45);
  transform: translateY(-2px);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 20px 44px rgba(74, 49, 56, 0.14);
}

.timeline-column .timeline-panel img {
  width: 100%;
  height: 100%;
  min-height: 174px;
  object-fit: contain;
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(255, 240, 227, 0.72));
}

.callout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: center;
  margin-top: 54px;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff8f0, #f3ede8);
}

.onboarding-panel {
  margin-bottom: 28px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fffdf8, #fff0e3);
  box-shadow: var(--small-shadow);
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.onboarding-step {
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.onboarding-step span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f6e4e0;
  color: var(--plum);
  font-size: 0.78rem;
  font-weight: 720;
}

.onboarding-step.is-done span {
  background: #eef3f6;
  color: #415d6d;
}

.explore-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  gap: 28px;
  align-items: start;
}

.detail-image {
  width: 100%;
  min-height: 430px;
  object-fit: contain;
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(255, 240, 227, 0.72));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.side-panel,
.form-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, #fff8f0);
  padding: 20px;
  box-shadow: var(--small-shadow);
}

.auth-card,
.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, #fff8f0);
  padding: 20px;
  box-shadow: var(--small-shadow);
}

.notice {
  margin: 18px 0;
  border-left: 4px solid var(--copper);
  background: linear-gradient(135deg, #fffdf8, #fff0e3);
}

.notice strong {
  display: block;
  margin-bottom: 4px;
}

.auth-card {
  max-width: 560px;
}

.auth-card form {
  display: grid;
  gap: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f6e4e0;
  color: var(--plum);
  font-size: 0.84rem;
  font-weight: 680;
}

button.status-pill {
  cursor: pointer;
}

.status-pill.warn {
  background: #fff0e3;
  color: #7a421f;
}

.status-pill.blue {
  background: #eef3f6;
  color: #415d6d;
}

.status-pill.rose {
  background: #f6e4e0;
  color: var(--plum);
}

.comments {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.comment {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.comment strong,
.comment span {
  display: inline-block;
  margin-right: 8px;
}

.comment span {
  color: var(--muted);
  font-size: 0.82rem;
}

.comment p {
  margin: 6px 0 0;
}

.comment-attachment {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 240, 227, 0.62);
}

.comment-attachment audio,
.comment-attachment video {
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius);
}

.face-review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(92, 58, 46, 0.14);
}

.face-review-row:first-of-type {
  border-top: 0;
}

.face-review-row p {
  margin: 0 0 4px;
}

.filters {
  margin: 16px 0 24px;
}

.filter-chip {
  border-color: var(--line);
  background: var(--surface);
}

.filter-chip.is-selected {
  color: #fff;
  background: var(--plum);
  border-color: var(--plum);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 680;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  padding: 11px 12px;
}

.field textarea {
  min-height: 116px;
  resize: vertical;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 242, 0.78);
  color: var(--ink);
}

.check-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--ember);
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 260px;
  margin-bottom: 18px;
  border: 2px dashed #c8bdad;
  border-radius: var(--radius);
  background: #fffdf8;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--copper);
  background: #fff0e3;
}

.drop-zone strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.2rem;
}

.upload-queue {
  display: grid;
  gap: 10px;
}

.queue-item,
.export-row,
.tree-row,
.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.upload-progress {
  overflow: hidden;
  height: 8px;
  max-width: 360px;
  margin-top: 8px;
  border-radius: 999px;
  background: #f3ede8;
}

.upload-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--copper), var(--plum));
  transition: width 180ms ease;
}

.upload-error {
  margin: 8px 0 0;
  color: var(--plum);
  font-weight: 680;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.health-score {
  display: grid;
  gap: 12px;
  align-content: center;
  min-height: 260px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.score-number {
  font-size: clamp(4rem, 10vw, 7rem);
  line-height: 0.95;
  color: var(--copper);
  font-weight: 760;
}

.progress {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--copper), var(--plum));
}

.export-structure {
  padding: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #24211e;
  color: #fffdf8;
  line-height: 1.5;
}

.tree-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.tree-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.family-chart {
  position: relative;
  overflow-x: auto;
  min-height: 720px;
  margin: 18px 0 24px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(74, 49, 56, 0.18);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 14%, rgba(96, 128, 81, 0.16), transparent 34%),
    radial-gradient(circle at 16% 28%, rgba(192, 111, 62, 0.13), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(113, 136, 153, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 248, 240, 0.93));
  box-shadow: var(--shadow);
}

.family-chart::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 92px;
  height: 64%;
  border-radius: 80px 80px 20px 20px;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.24), transparent 32%, rgba(36, 33, 30, 0.16) 70%),
    linear-gradient(180deg, rgba(138, 86, 68, 0.46), rgba(74, 49, 56, 0.42));
  opacity: 0.42;
  pointer-events: none;
}

.family-chart::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 46%;
  height: 180px;
  border-top: 18px solid rgba(74, 49, 56, 0.16);
  border-radius: 50% 50% 0 0;
  transform: rotate(-2deg);
  opacity: 0.75;
  pointer-events: none;
}

.family-chart-title {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  color: var(--plum);
  text-align: left;
}

.family-chart-title img {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  box-shadow: 0 12px 26px rgba(74, 49, 56, 0.18);
}

.family-chart-title span,
.family-chart-title strong {
  display: block;
  text-transform: uppercase;
  line-height: 0.96;
}

.family-chart-title span {
  color: var(--copper);
  font-size: 0.88rem;
  font-weight: 800;
}

.family-chart-title strong {
  font-size: clamp(1.9rem, 4vw, 3rem);
}

.family-generation {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: clamp(16px, 3vw, 34px);
  min-width: 720px;
  margin: 0 auto 42px;
  padding-top: 28px;
}

.family-generation::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16%;
  right: 16%;
  height: 2px;
  background: rgba(74, 49, 56, 0.28);
}

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

.family-generation:not(:last-of-type)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -42px;
  width: 2px;
  height: 42px;
  background: rgba(74, 49, 56, 0.28);
}

.family-node {
  position: relative;
  display: grid;
  justify-items: center;
  width: 138px;
  text-align: center;
  padding: 8px 6px 10px;
  border-radius: 34px 10px 34px 10px;
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 10px 24px rgba(54, 45, 35, 0.08);
}

.family-node::before {
  content: "";
  position: absolute;
  top: -28px;
  left: 50%;
  width: 2px;
  height: 28px;
  background: rgba(74, 49, 56, 0.28);
}

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

.family-node-photo {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 96px;
  height: 96px;
  border: 7px solid rgba(218, 207, 154, 0.88);
  border-radius: 50%;
  background: #f6e4e0;
  color: var(--plum);
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(74, 49, 56, 0.14);
}

.family-node-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.family-node strong {
  margin-top: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.family-node span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.tree-forest {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 42px;
  min-width: 760px;
}

.tree-family-unit {
  position: relative;
  display: grid;
  gap: 34px;
  justify-items: center;
  padding: 22px 18px 14px;
  border-radius: 24px;
}

.tree-family-unit::before {
  content: "";
  position: absolute;
  top: 114px;
  left: 50%;
  width: 2px;
  height: 42px;
  background: rgba(74, 49, 56, 0.26);
  transform: translateX(-50%);
}

.tree-forest .family-node::before,
.tree-family-unit:has(.tree-children-row:empty)::before {
  display: none;
}

.tree-parent-row,
.tree-children-row,
.tree-standalone-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(16px, 3vw, 34px);
}

.tree-parent-row {
  position: relative;
  padding: 14px 26px 18px;
  border: 1px solid rgba(74, 49, 56, 0.2);
  border-radius: 58px 14px 58px 14px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.88), rgba(255, 240, 227, 0.76)),
    radial-gradient(circle at 18% 10%, rgba(96, 128, 81, 0.16), transparent 34%);
  box-shadow: 0 16px 34px rgba(54, 45, 35, 0.1);
}

.tree-parent-row::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: -28px;
  height: 7px;
  border-radius: 999px;
  background: rgba(92, 58, 45, 0.34);
}

.tree-children-row {
  position: relative;
  align-items: flex-start;
  width: 100%;
  padding-top: 22px;
}

.tree-children-row > .family-node,
.tree-child-family {
  position: relative;
}

.tree-children-row > .family-node::after,
.tree-child-family::before {
  content: "";
  position: absolute;
  top: -22px;
  left: 50%;
  width: 2px;
  height: 22px;
  background: rgba(74, 49, 56, 0.26);
  transform: translateX(-50%);
}

.tree-child-family {
  min-width: min(100%, 420px);
}

.tree-child-family .tree-family-unit {
  padding-top: 0;
}

.tree-standalone-grid {
  padding: 24px;
  border: 1px dashed rgba(192, 111, 62, 0.38);
  border-radius: 34px 12px 34px 12px;
  background: rgba(255, 255, 255, 0.68);
}

.family-tree-scene {
  position: relative;
  overflow: hidden;
  min-height: 720px;
  margin: 18px 0 24px;
  padding: clamp(22px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(238, 243, 246, 0.9) 0%, rgba(255, 248, 240, 0.88) 42%, rgba(255, 253, 248, 0.96) 100%),
    linear-gradient(115deg, rgba(74, 49, 56, 0.13), rgba(192, 111, 62, 0.1) 48%, rgba(113, 136, 153, 0.13));
  box-shadow: var(--shadow);
}

.tree-background {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tree-main-trunk {
  position: absolute;
  left: 50%;
  bottom: 72px;
  width: clamp(74px, 9vw, 118px);
  height: 56%;
  transform: translateX(-50%);
  border-radius: 54px 54px 16px 16px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.15), transparent 24%, rgba(0, 0, 0, 0.12) 68%, rgba(255, 255, 255, 0.12)),
    linear-gradient(180deg, #8a5644, #5d3337 54%, #24211e);
  box-shadow: inset 14px 0 0 rgba(255, 255, 255, 0.09), inset -14px 0 0 rgba(0, 0, 0, 0.12);
}

.tree-main-trunk::before,
.tree-main-trunk::after {
  content: "";
  position: absolute;
  left: 20%;
  width: 12px;
  height: 72%;
  border-radius: 999px;
  background: rgba(36, 33, 30, 0.22);
}

.tree-main-trunk::after {
  left: 64%;
  top: 8%;
  height: 58%;
  background: rgba(255, 255, 255, 0.13);
}

.branch {
  position: absolute;
  left: 50%;
  bottom: 46%;
  width: clamp(170px, 27vw, 360px);
  height: 46px;
  border-top: 22px solid #5d3337;
  border-radius: 100% 0 0 0;
  transform-origin: left center;
}

.branch-left {
  transform: rotate(-28deg) translateX(-96%);
}

.branch-right {
  transform: rotate(24deg);
}

.branch-top {
  bottom: 56%;
  width: clamp(120px, 19vw, 250px);
  transform: rotate(-88deg) translateX(-18%);
}

.root {
  position: absolute;
  left: 50%;
  bottom: 66px;
  width: clamp(150px, 23vw, 310px);
  height: 48px;
  border-bottom: 11px solid #4a3138;
  border-radius: 0 0 90% 90%;
  transform-origin: left center;
}

.root-a {
  transform: rotate(12deg);
}

.root-b {
  transform: rotate(165deg);
}

.root-c {
  width: clamp(120px, 18vw, 250px);
  transform: rotate(36deg);
}

.root-d {
  width: clamp(120px, 18vw, 250px);
  transform: rotate(143deg);
}

.tree-canopy,
.tree-people {
  display: grid;
  gap: 16px;
}

.tree-canopy {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  min-height: 560px;
}

.tree-branch {
  position: relative;
  padding: 18px;
  border: 1px solid rgba(74, 49, 56, 0.24);
  border-radius: 44px 8px 44px 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 240, 227, 0.78)),
    radial-gradient(circle at 28% 16%, rgba(192, 111, 62, 0.18), transparent 34%);
  box-shadow: 0 14px 34px rgba(54, 45, 35, 0.11);
  backdrop-filter: blur(8px);
}

.tree-branch::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -34px;
  width: 2px;
  height: 34px;
  background: rgba(74, 49, 56, 0.36);
}

.tree-branch.branch-1,
.tree-branch.branch-3 {
  margin-top: 78px;
}

.branch-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.branch-header h2 {
  margin-bottom: 4px;
  font-size: clamp(1.24rem, 2vw, 1.75rem);
}

.branch-header p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.branch-knot {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 5px solid #4a3138;
  border-radius: 50%;
  background: #c06f3e;
  box-shadow: inset 0 0 0 7px #8a5644;
}

.tree-person {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  min-height: 152px;
  padding: 15px 15px 15px 12px;
  border: 1px solid rgba(74, 49, 56, 0.22);
  border-radius: 42px 8px 42px 8px;
  background: linear-gradient(135deg, #fff0e3, #ffffff 58%, #eef3f6);
  box-shadow: 0 9px 22px rgba(54, 45, 35, 0.09);
}

.tree-person.leaf-1 {
  border-radius: 8px 42px 8px 42px;
  background: linear-gradient(135deg, #f6e4e0, #ffffff 58%, #fff0e3);
}

.tree-person.leaf-2 {
  background: linear-gradient(135deg, #eef3f6, #ffffff 58%, #fff8f0);
}

.tree-person.leaf-3 {
  border-radius: 36px 8px 36px 8px;
  background: linear-gradient(135deg, #fff0e3, #ffffff 58%, #f6e4e0);
}

.tree-person.leaf-4 {
  background: linear-gradient(135deg, #f3ede8, #ffffff 58%, #eef3f6);
}

.tree-person h3 {
  margin-bottom: 2px;
}

.leaf-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(74, 49, 56, 0.24);
  border-radius: 50% 50% 50% 12px;
  background: linear-gradient(135deg, var(--plum), var(--copper));
  color: #fff;
  font-weight: 800;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.08);
}

.leaf-content {
  position: relative;
}

.leaf-vein {
  position: absolute;
  top: 4px;
  right: 0;
  width: 42%;
  height: 1px;
  background: rgba(74, 49, 56, 0.26);
  transform: rotate(-8deg);
}

.media-player {
  background: #1f1c18;
  object-fit: contain;
}

.tree-row {
  grid-template-columns: 190px 1fr;
}

.tree-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tree-link-badge,
.tree-link-empty {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(113, 136, 153, 0.14);
  color: #415d6d;
  font-size: 0.8rem;
  font-weight: 680;
}

.tree-link-empty {
  background: rgba(112, 107, 99, 0.1);
  color: var(--muted);
}

.tree-ground {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin: 28px auto 0;
  max-width: 720px;
  padding: 14px 18px;
  border: 1px solid rgba(74, 49, 56, 0.22);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.88);
}

.tree-ground span {
  color: var(--plum);
  font-weight: 800;
}

.tree-ground p {
  margin: 0;
}

.tree-empty-canopy {
  grid-column: 1 / -1;
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 90px auto;
  padding: 26px;
  border: 1px dashed rgba(192, 111, 62, 0.55);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  text-align: center;
}

.branch-line {
  min-height: 2px;
  background: var(--line);
}

.grandparent-mode {
  --paper: #fffdf8;
  font-size: 1.12rem;
}

.grandparent-mode .site-header {
  position: static;
}

.grandparent-mode .nav-link,
.grandparent-mode .primary-button,
.grandparent-mode .secondary-button,
.grandparent-mode .field input,
.grandparent-mode .field textarea,
.grandparent-mode .field select {
  min-height: 52px;
}

.empty-state {
  padding: 38px;
  border: 1px dashed #c8bdad;
  border-radius: var(--radius);
  text-align: center;
  background: #fffdf8;
}

@media (max-width: 1060px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .primary-nav,
  .header-actions {
    justify-content: start;
  }

  .search-wrap {
    width: min(100%, 520px);
  }

  .hero,
  .detail-layout,
  .builder-steps,
  .person-profile-hero,
  .person-story-grid,
  .memory-prompts-panel,
  .tree-intro {
    grid-template-columns: 1fr;
  }

  .event-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tree-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tree-canopy {
    grid-template-columns: 1fr;
  }

  .family-chart {
    padding: 20px 14px;
  }

  .family-generation {
    min-width: 660px;
  }

  .tree-forest {
    min-width: 680px;
  }

  .tree-branch.branch-1,
  .tree-branch.branch-3 {
    margin-top: 0;
  }

  .hero-media img {
    height: min(58vh, 560px);
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  main {
    padding: 20px;
  }

  .site-header {
    padding: 12px 16px;
    gap: 12px;
  }

  .primary-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .nav-link {
    min-width: 0;
    padding: 8px 5px;
    font-size: 0.92rem;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    width: 100%;
  }

  .account-button span:last-child {
    display: none;
  }

  .hero {
    min-height: auto;
  }

  .hero-media img,
  .detail-image {
    height: 330px;
    min-height: 0;
  }

  .meta-list,
  .grid-2,
  .grid-3,
  .grid-4,
  .event-photo-grid,
  .inbox-card,
  .person-timeline-row,
  .mini-event-card,
  .onboarding-steps,
  .form-grid,
  .callout {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: block;
  }

  .timeline-row {
    grid-template-columns: repeat(4, minmax(240px, 1fr));
  }

  .timeline-column {
    grid-template-columns: 1fr;
    padding-left: 46px;
  }

  .timeline-column::before {
    left: 20px;
  }

  .timeline-column .timeline-panel {
    grid-template-columns: 1fr;
  }

  .timeline-column .timeline-panel img {
    height: 190px;
    min-height: 0;
  }

  .timeline-column .timeline-dot {
    left: -32px;
    top: 48px;
  }

  .tree-row,
  .tree-intro,
  .tree-stats,
  .family-tree-scene,
  .tree-person,
  .needs-story-card,
  .queue-item,
  .export-row,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .family-tree-scene {
    min-height: auto;
    padding: 18px;
  }

  .family-chart-title {
    justify-content: start;
  }

  .family-generation {
    justify-content: start;
    min-width: 620px;
    gap: 14px;
  }

  .tree-forest {
    min-width: 620px;
    gap: 24px;
  }

  .tree-family-unit {
    padding-inline: 8px;
  }

  .tree-parent-row,
  .tree-children-row,
  .tree-standalone-grid {
    justify-content: flex-start;
    gap: 14px;
  }

  .family-node {
    width: 108px;
  }

  .family-node-photo {
    width: 78px;
    height: 78px;
    border-width: 7px;
  }

  .tree-background {
    opacity: 0.38;
  }

  .tree-main-trunk {
    height: 72%;
    width: 64px;
  }

  .branch,
  .root {
    display: none;
  }

  .tree-ground {
    display: block;
    border-radius: var(--radius);
  }
}
