:root {
      --bg: #f3f0e8;
      --surface: #fffcf7;
      --text: #1f1a14;
      --muted: #746a5f;
      --line: #d8cfbf;
      --gold: #9a7a43;
      --gold-dark: #826536;
      --danger: #b4232f;
      --ok: #2c9b4b;
      --radius: 20px;
      --shadow: 0 16px 40px rgba(52, 38, 18, 0.12);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: "Manrope", "Helvetica Neue", Helvetica, Arial, sans-serif;
      color: var(--text);
      background:
        radial-gradient(circle at 10% 0%, #ffffff 0, #f4f1e9 42%),
        radial-gradient(circle at 90% 10%, #eee2ce 0, #f3f0e8 42%);
      min-height: 100vh;
    }

    .app {
      max-width: 980px;
      margin: 0 auto;
      padding: 18px;
    }

    .topbar-wrap {
      position: relative;
      z-index: 20;
      display: grid;
      gap: 6px;
    }

    .topbar-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-height: 36px;
    }

    .topbar-user {
      font-size: 12px;
      color: var(--muted);
      text-align: right;
      letter-spacing: 0.02em;
      padding-right: 6px;
      min-height: 14px;
      cursor: pointer;
      margin-left: auto;
      margin-top: 40px;
    }

    .topbar-brand {
      justify-self: start;
      text-align: left;
      padding-left: 6px;
      display: grid;
      gap: 1px;
      line-height: 1.05;
      margin-right: auto;
    }

    .topbar-brand-title {
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 32px;
      font-weight: 600;
      letter-spacing: -0.015em;
      color: #3b2d1d;
    }

    .topbar-brand-subtitle {
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 20px;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a684f;
    }

    .topbar-mobile-toggle {
      display: none;
      width: 40px;
      height: 40px;
      border: 1px solid #d8c29a;
      border-radius: 10px;
      background: #f6efdf;
      padding: 8px;
      cursor: pointer;
      align-items: center;
      justify-content: center;
      gap: 4px;
      flex-direction: column;
    }

    .topbar-mobile-toggle span {
      display: block;
      width: 18px;
      height: 2px;
      background: #6b5129;
      border-radius: 999px;
      transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .topbar-wrap.mobile-nav-open .topbar-mobile-toggle span:nth-child(1) {
      transform: translateY(6px) rotate(45deg);
    }

    .topbar-wrap.mobile-nav-open .topbar-mobile-toggle span:nth-child(2) {
      opacity: 0;
    }

    .topbar-wrap.mobile-nav-open .topbar-mobile-toggle span:nth-child(3) {
      transform: translateY(-6px) rotate(-45deg);
    }

    .user-menu {
      position: absolute;
      top: 59px;
      right: -6px;
      background: #ffffff;
      border: 1px solid rgba(0,0,0,0.08);
      border-radius: 12px;
      box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
      padding: 10px;
      min-width: 160px;
      z-index: 30;
    }

    .user-menu.hidden { display: none !important; }
    .user-menu-trees {
      display: grid;
      gap: 4px;
      margin-bottom: 8px;
      padding-bottom: 8px;
      border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .user-menu-tree-btn {
      border: 1px solid transparent;
      border-radius: 8px;
      background: transparent;
      color: var(--text);
      font-size: 13px;
      font-weight: 600;
      text-align: left;
      padding: 7px 8px;
      cursor: pointer;
      width: 100%;
    }

    .user-menu-tree-btn:hover {
      background: #f5f0e6;
      border-color: #e8dcc6;
    }

    .user-menu-tree-btn.active {
      background: #f6efdf;
      border-color: #d8c29a;
      color: #6b5129;
    }

    .topbar {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 8px;
      padding: 10px;
      border-radius: 16px;
      border: 1px solid rgba(174, 152, 114, 0.45);
      background: rgba(255, 252, 245, 0.86);
      backdrop-filter: blur(12px);
      box-shadow: var(--shadow);
    }

    .hidden { display: none !important; }

    .nav-btn {
      border: 1px solid transparent;
      border-radius: 12px;
      background: transparent;
      color: var(--text);
      font-size: 16px;
      font-weight: 650;
      min-height: 52px;
      cursor: pointer;
      padding: 8px;
    }

    .nav-btn.active {
      border-color: #d8c29a;
      background: #f6efdf;
      color: #6b5129;
    }

    .screen {
      display: none;
      margin-top: 16px;
      animation: fade 0.18s ease;
    }

    .screen.active { display: block; }

    .begin-screen {
      display: none;
      margin-top: 16px;
      padding-top: 22px;
      position: relative;
      animation: fade 0.18s ease;
    }

    .begin-screen.active { display: block; }

    .begin-screen.fade-out { opacity: 0; transition: opacity 0.45s ease; }
    .begin-screen.fade-in { animation: fade 0.45s ease; }

    .begin-screen.modal-screen {
      margin-top: 0;
      padding-top: 0;
      position: fixed;
      inset: 0;
      background: transparent;
      display: none;
      align-items: center;
      justify-content: center;
    }

    .begin-screen.modal-screen.active { display: flex; }

    .begin-screen.modal-screen .panel {
      width: min(760px, 92vw);
      min-height: 0;
    }

    @keyframes fade {
      from { opacity: 0; transform: translateY(6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .panel {
      background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(252,248,240,0.94));
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 24px;
      width: 100%;
      max-width: 100% !important;
    }

    h1, h2, h3 {
      margin: 0 0 12px;
      line-height: 1.1;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
    }

    h1 { font-size: 48px; }
    h2 { font-size: 38px; }
    h3 { font-size: 28px; }

    p {
      margin: 0 0 14px;
      color: var(--muted);
      font-size: 18px;
    }

    .hero {
      display: grid;
      grid-template-columns: 1.08fr 0.92fr;
      gap: 18px;
      align-items: center;
    }

    .begin-screen[data-screen="home"] .hero {
      align-items: start;
    }

    .begin-screen[data-screen="home"] .hero > div {
      display: flex;
      flex-direction: column;
      height: 100%;
      padding-top: 6px;
    }

    .begin-hero-cta {
      margin-top: 14px;
      margin-bottom: 18px;
    }

    .begin-hero-copy {
      margin-top: auto;
      margin-bottom: 0;
    }

    .book-art {
      aspect-ratio: 4 / 5;
      border-radius: 22px;
      border: 1px solid #cab58d;
      width: 100%;
      object-fit: cover;
      display: block;
      background: #f2e8d9;
      box-shadow: 0 18px 34px rgba(54, 40, 20, 0.22);
    }

    .stack { display: grid; gap: 12px; }

    .field { display: grid; gap: 8px; }
    .field.date-width { max-width: 50%; }

    label {
      font-size: 14px;
      color: var(--muted);
      font-weight: 600;
    }

    .field.invalid label { color: #b7434d; }

    input, select, textarea {
      width: 100%;
      min-height: 52px;
      border: 1px solid #cec4b2;
      border-radius: 12px;
      padding: 12px 14px;
      font-size: 18px;
      color: var(--text);
      background: #fffdfa;
      font-family: inherit;
    }

    textarea { min-height: 96px; resize: vertical; }

    .compact {
      width: 220px;
      max-width: 100%;
    }

    .date-picker {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 8px;
    }

    .begin-flow input,
    .begin-flow select {
      max-width: 50%;
      min-height: 52px;
      border: 1px solid #cec4b2;
      border-radius: 12px;
      padding: 12px 14px;
      font-size: 18px;
      color: var(--text);
      background: #fffdfa;
      font-family: inherit;
    }

    .begin-flow .panel {
      min-height: 520px;
      position: relative;
    }

    .begin-flow input::placeholder { color: #b9b0a2; }

    .begin-flow .field.invalid input,
    .begin-flow .field.invalid select {
      border-color: #d27982;
      background: #fff7f8;
      box-shadow: 0 0 0 3px rgba(183, 67, 77, 0.12);
    }

    .begin-flow .btn.primary.is-disabled {
      background: linear-gradient(180deg, #c9b086, #a88a5d);
      color: #fff;
      box-shadow: none;
      cursor: pointer;
      opacity: 0.9;
    }

    .begin-flow .auth-card { max-width: 760px; margin: 0 auto; }
    .begin-flow .auth-card input, .begin-flow .auth-card select { max-width: 100%; }
    #inviteFlow .invite-entry-head {
      display: grid;
      gap: 2px;
    }

    #inviteFlow .invite-entry-head h2 {
      margin: 0;
    }

    .begin-flow .date-picker {
      max-width: 50%;
    }

    .begin-flow .date-picker select {
      max-width: none;
    }

    .begin-flow .compact input,
    .begin-flow .compact select {
      max-width: 220px;
    }

    .btn {
      border: 1px solid transparent;
      border-radius: 12px;
      cursor: pointer;
      font-family: inherit;
    }

    .btn.primary {
      min-height: 56px;
      width: 100%;
      font-size: 19px;
      font-weight: 700;
      color: #fff;
      background: linear-gradient(180deg, #b08e56, #8f6f3e);
      box-shadow: 0 10px 22px rgba(126, 95, 48, 0.28);
    }

    .btn.primary:hover { background: linear-gradient(180deg, #9f804c, #7f6337); }

    .btn.secondary {
      min-height: 38px;
      font-size: 15px;
      font-weight: 600;
      color: #8a7c6a;
      background: transparent;
      border-color: transparent;
      text-align: left;
      padding: 6px 4px;
    }

    .btn.secondary:hover {
      color: var(--text);
      background: #f5f0e6;
      border-color: #e8dcc6;
    }

    .btn.secondary.is-disabled,
    .btn.secondary:disabled {
      color: #b3a796;
      background: transparent;
      border-color: transparent;
      cursor: not-allowed;
      opacity: 0.75;
    }

    .btn.secondary.big {
      font-size: 17px;
      min-height: 46px;
    }

    #siblingsSkipBtn {
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 36px;
      font-weight: 700;
      line-height: 1.1;
      min-height: 72px;
    }

    .top-link {
      position: absolute;
      right: 16px;
      top: -24px;
      font-size: 12px;
      color: #8a8072;
      text-decoration: none;
      z-index: 5;
    }

    .top-link:hover { color: var(--text); }

    .auth-error {
      display: none;
      padding: 10px 12px;
      border-radius: 10px;
      background: #fff3f4;
      color: #b7434d;
      font-size: 13px;
      font-weight: 600;
      border: 1px solid #f1c3c8;
    }

    .auth-error.show { display: block; }

    .password-wrap { position: relative; }

    .toggle {
      position: absolute;
      right: 12px;
      top: 50%;
      transform: translateY(-50%);
      border: none;
      background: transparent;
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
    }

    .life-toggle {
      display: flex;
      align-items: center;
      gap: 12px;
      font-weight: 600;
      color: var(--muted);
    }

    .life-toggle input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }

    .life-switch {
      position: relative;
      width: 64px;
      height: 34px;
      background: #efe7d6;
      border-radius: 999px;
      border: 1px solid rgba(0,0,0,0.08);
      transition: background 0.2s ease;
      box-shadow: inset 0 2px 4px rgba(0,0,0,0.08);
    }

    .life-switch::after {
      content: "";
      position: absolute;
      top: 3px;
      left: 3px;
      width: 26px;
      height: 26px;
      background: #ffffff;
      border-radius: 50%;
      box-shadow: 0 4px 8px rgba(0,0,0,0.12);
      transition: transform 0.2s ease;
    }

    .life-toggle input:not(:checked) + .life-switch {
      background: #d8eadc;
    }

    .life-toggle input:checked + .life-switch {
      background: #efe7d6;
    }

    .life-toggle input:checked + .life-switch::after {
      transform: translateX(30px);
    }

    .life-state {
      font-size: 14px;
      color: var(--text);
      font-weight: 600;
    }

    .life-toggle input:not(:checked) ~ .life-state {
      color: #2f6f3a;
    }

    .life-toggle input:checked ~ .life-state {
      color: #7a4b4b;
    }

    .result {
      border: 1px solid var(--line);
      border-radius: 12px;
      background: #fffcf8;
      padding: 12px;
      font-size: 14px;
      color: var(--muted);
    }

    .btn.danger {
      min-height: 40px;
      font-size: 14px;
      font-weight: 700;
      color: var(--danger);
      background: #fff1f3;
      border-color: #f5c5cc;
      padding: 6px 10px;
    }

    .card {
      border: 1px solid var(--line);
      border-radius: 14px;
      background: #fffcf8;
      padding: 14px;
      display: grid;
      gap: 8px;
    }

    .card.clickable {
      cursor: pointer;
      transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
    }

    .card.clickable:hover {
      border-color: #cfb88d;
      box-shadow: 0 10px 24px rgba(88, 66, 33, 0.12);
      transform: translateY(-1px);
    }

    .list { display: grid; gap: 10px; }

    .meta {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      font-size: 14px;
      color: var(--muted);
    }

    .people-row {
      display: grid;
      grid-template-columns: 28px 1fr 140px 160px;
      gap: 10px;
      align-items: center;
      padding: 10px 12px;
      border-bottom: 1px solid rgba(0,0,0,0.06);
      font-size: 16px;
      cursor: pointer;
    }

    .people-row:last-child {
      border-bottom: none;
    }

    .people-row:hover {
      background: #f7f2e7;
    }

    .people-icon {
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .people-name { font-weight: 650; }
    .people-years { color: var(--muted); }
    .people-relation { color: var(--muted); text-transform: capitalize; }

    .person-details h2 {
      margin: 0 0 10px;
      font-size: 32px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
    }

    .person-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 26px;
    }

    .person-header h2 {
      margin: 0;
      flex: 1 1 auto;
      min-width: 0;
    }

    .person-header-main {
      flex: 1 1 auto;
      min-width: 0;
    }

    .person-title-row {
      display: flex;
      align-items: baseline;
      justify-content: flex-start;
      gap: 12px;
      min-width: 0;
    }

    .person-title-row h2 {
      flex: 0 1 auto;
      min-width: 0;
      margin: 0;
    }

    .person-tree-cta {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 30px;
      line-height: 1.05;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      overflow: hidden;
      max-width: 30px;
    }

    .person-title-row:hover .person-tree-cta {
      opacity: 1;
      pointer-events: auto;
    }

    .person-tree-cta:hover {
      max-width: 260px;
    }

    .person-tree-cta:focus-visible {
      max-width: 260px;
      outline: none;
    }

    .person-tree-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
      width: 24px;
    }

    .person-tree-label {
      display: inline-block;
      max-width: 0;
      opacity: 0;
      overflow: hidden;
      white-space: nowrap;
      transition: opacity 0.14s ease-out;
    }

    .person-tree-cta:hover .person-tree-label,
    .person-tree-cta:focus-visible .person-tree-label {
      max-width: 220px;
      opacity: 1;
      text-decoration: underline;
    }

    .person-relation-inline {
      font-weight: 500;
      color: var(--muted);
    }

    .person-details .meta {
      font-size: 16px;
      line-height: 1.5;
      color: var(--text);
      display: grid;
      gap: 6px;
    }

    .photo-details h2 {
      margin: 0 0 10px;
      font-size: 32px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
    }

    .photo-details .meta {
      font-size: 16px;
      line-height: 1.5;
      color: var(--text);
      display: grid;
      gap: 6px;
    }

    .person-details .meta strong {
      font-weight: 700;
    }

    .person-link {
      display: inline-flex;
      gap: 6px;
      font-weight: 650;
      color: #7a5a2d;
      cursor: pointer;
    }

    .person-link:hover {
      text-decoration: underline;
    }

    .edit-person-family-row {
      display: flex;
      justify-content: flex-start;
      gap: 8px;
      align-items: baseline;
    }

    #editPersonFamilySection .person-family-title {
      font-family: "Manrope", "Helvetica Neue", Helvetica, Arial, sans-serif;
      font-size: 22px;
      font-weight: 700;
      letter-spacing: 0;
      margin: 0;
      color: var(--text);
    }

    #editPersonFamilySection {
      margin-bottom: 14px;
    }

    #editPersonFamilyList {
      display: grid;
      gap: 8px;
    }

    .edit-person-remove-link {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-size: 13px;
      font-weight: 700;
      color: #9f3a2a;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
    }

    .edit-person-family-row:hover .edit-person-remove-link {
      opacity: 1;
      pointer-events: auto;
    }

    .edit-person-remove-link:hover {
      text-decoration: underline;
    }

    .person-actions {
      display: grid;
      gap: 4px;
      align-items: start;
      justify-items: start;
      justify-self: end;
      text-align: right;
      flex: 0 0 auto;
      border: 1px solid #e0d4c0;
      border-radius: 12px;
      padding: 10px 12px;
      background: #fcf8f1;
    }

    .person-action-link {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font: inherit;
      font-size: 16px;
      font-weight: 600;
      color: #7a5a2d;
      text-align: right;
      cursor: pointer;
      line-height: 1.25;
    }

    .person-action-link:hover {
      text-decoration: underline;
    }

    .invite-bulb {
      display: inline-block;
      transform-origin: 50% 50%;
      animation: inviteBulbPulse 1.4s ease-in-out infinite;
      will-change: transform, filter;
      margin-left: 2px;
    }

    @keyframes inviteBulbPulse {
      0% {
        transform: scale(0.92);
        filter: drop-shadow(0 0 0 rgba(255, 205, 72, 0));
      }
      50% {
        transform: scale(1.28);
        filter: drop-shadow(0 0 9px rgba(255, 205, 72, 0.65));
      }
      100% {
        transform: scale(0.92);
        filter: drop-shadow(0 0 0 rgba(255, 205, 72, 0));
      }
    }

    .person-action-link.is-disabled,
    .person-action-link:disabled {
      color: #b3a796;
      text-decoration: none;
      cursor: not-allowed;
      opacity: 0.8;
    }

    #removePersonConfirmBtn {
      white-space: nowrap;
    }

    @media (max-width: 820px) {
      .person-header {
        display: grid;
        gap: 10px;
      }

      .person-header-main {
        display: contents;
      }

      .person-title-row {
        order: 1;
      }

      .person-header-main h2 {
        order: 1;
      }

      .person-title-row h2 {
        order: 0;
      }

      .person-title-row .person-tree-cta {
        order: 1;
      }

      .person-actions {
        order: 2;
      }

      .person-family-section {
        order: 3;
      }

      .person-actions {
        justify-self: start;
        text-align: left;
      }

      .person-action-link {
        text-align: left;
      }

      .photo-view-header {
        display: grid;
        gap: 10px;
      }

      .photo-actions {
        justify-self: start;
        text-align: left;
      }

      .photo-action-link {
        text-align: left;
      }

      .memory-add-cta {
        opacity: 1;
        pointer-events: auto;
      }

      .person-tree-cta {
        opacity: 1;
        pointer-events: auto;
        max-width: 260px;
      }

      .person-tree-label {
        max-width: 220px;
        opacity: 1;
      }

      .photo-add-cta {
        opacity: 1;
        pointer-events: auto;
      }

      .bio-write-cta {
        opacity: 1;
        pointer-events: auto;
      }

      .birth-add-cta {
        opacity: 1;
        pointer-events: auto;
      }

      .family-add-cta {
        opacity: 1;
        pointer-events: auto;
      }

      .memory-menu-trigger {
        opacity: 1;
        pointer-events: auto;
      }
    }

    @media (hover: none), (pointer: coarse) {
      .memory-add-cta {
        opacity: 1;
        pointer-events: auto;
      }

      .person-tree-cta {
        opacity: 1;
        pointer-events: auto;
        max-width: 260px;
      }

      .person-tree-label {
        max-width: 220px;
        opacity: 1;
      }

      .photo-add-cta {
        opacity: 1;
        pointer-events: auto;
      }

      .memory-menu-trigger {
        opacity: 1;
        pointer-events: auto;
      }
    }

    .memory-title {
      margin: 0;
      font-size: 40px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
    }

    .memory-subtitle {
      margin: -2px 0 8px;
      color: var(--muted);
      font-size: 16px;
    }

    .memory-edit-actions {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .relative-form-actions {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .relative-cancel-btn {
      min-height: 36px;
      padding: 6px 12px;
      font-size: 14px;
      font-weight: 600;
    }

    #bioEditText {
      min-height: 300px;
    }

    #memoryText {
      min-height: 144px;
    }

    .person-story-block + .person-story-block {
      margin-top: 26px;
    }

    .person-memories {
      display: grid;
      gap: 10px;
      margin-top: 0;
    }

    .person-memories-head {
      display: flex;
      align-items: baseline;
      justify-content: flex-start;
      gap: 12px;
    }

    .person-memories h3 {
      margin: 0;
      font-size: 34px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
      font-weight: 600;
    }

    .memory-kicker {
      margin: 0 0 6px;
      color: var(--muted);
      font-size: 15px;
    }

    .memory-add-cta {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 30px;
      line-height: 1.05;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
    }

    .person-memories:hover .memory-add-cta {
      opacity: 1;
      pointer-events: auto;
    }

    .memory-add-cta:hover {
      text-decoration: underline;
    }

    .memory-quote {
      display: grid;
      gap: 6px;
      padding: 16px 18px;
      background: #fbf7f0;
      border: 1px solid #e8decd;
      border-radius: 14px;
      position: relative;
    }

    .memory-menu-trigger {
      position: absolute;
      top: 8px;
      right: 10px;
      width: 26px;
      height: 26px;
      border: none;
      background: transparent;
      color: #8e826f;
      font-size: 18px;
      line-height: 1;
      border-radius: 8px;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.16s ease, background 0.16s ease;
    }

    .memory-quote:hover .memory-menu-trigger {
      opacity: 1;
      pointer-events: auto;
    }

    .memory-menu-trigger:hover {
      background: rgba(0,0,0,0.05);
    }

    .memory-menu {
      position: absolute;
      top: 34px;
      right: 10px;
      min-width: 112px;
      border: 1px solid #e0d4c0;
      border-radius: 10px;
      background: #fffdf8;
      box-shadow: 0 10px 18px rgba(0,0,0,0.08);
      padding: 4px;
      display: grid;
      gap: 2px;
      z-index: 3;
    }

    .memory-menu-item {
      border: none;
      background: transparent;
      text-align: left;
      padding: 7px 8px;
      border-radius: 8px;
      color: #4b3c22;
      font-size: 14px;
      cursor: pointer;
      text-transform: lowercase;
    }

    .memory-menu-item:hover {
      background: #f6efe3;
    }

    .memory-text {
      margin: 0;
      font-size: 24px;
      line-height: 1.5;
      font-family: "Cormorant Garamond", Georgia, serif;
      color: #2f251a;
      white-space: pre-line;
    }

    .memory-author {
      margin: 0;
      color: #756b5b;
      font-size: 15px;
      font-style: italic;
    }

    .person-photos-title {
      margin: 0;
      font-size: 34px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
      font-weight: 600;
      color: #2f251a;
    }

    .person-bio-title {
      margin: 0;
      font-size: 34px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
      font-weight: 600;
      color: #2f251a;
    }

    .person-birth-title {
      margin: 0;
      font-size: 34px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
      font-weight: 600;
      color: #2f251a;
    }

    .person-birth-section {
      margin-top: 0;
    }

    .person-birth-head {
      display: flex;
      align-items: baseline;
      justify-content: flex-start;
      gap: 12px;
    }

    .birth-add-cta {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 30px;
      line-height: 1.05;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
    }

    .person-birth-section:hover .birth-add-cta {
      opacity: 1;
      pointer-events: auto;
    }

    .birth-add-cta:hover {
      text-decoration: underline;
    }

    .person-birth-kicker {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 15px;
    }

    .person-family-title {
      margin: 18px 0 0;
      font-size: 34px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
      font-weight: 600;
      color: #2f251a;
    }

    .person-family-section {
      margin-top: 8px;
    }

    .person-family-head {
      display: flex;
      align-items: baseline;
      justify-content: flex-start;
      gap: 12px;
    }

    .family-add-cta {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 30px;
      line-height: 1.05;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
    }

    .person-family-section:hover .family-add-cta {
      opacity: 1;
      pointer-events: auto;
    }

    .family-add-cta:hover {
      text-decoration: underline;
    }

    .person-death-title {
      margin: 0;
      font-size: 34px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
      font-weight: 600;
      color: #2f251a;
    }

    .person-death-section {
      margin-top: 0;
    }

    .person-death-head {
      display: flex;
      align-items: baseline;
      justify-content: flex-start;
      gap: 12px;
    }

    .death-add-cta {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 30px;
      line-height: 1.05;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
    }

    .person-death-section:hover .death-add-cta {
      opacity: 1;
      pointer-events: auto;
    }

    .death-add-cta:hover {
      text-decoration: underline;
    }

    .person-bio-section {
      margin-top: 0;
    }

    .person-bio-head {
      display: flex;
      align-items: baseline;
      justify-content: flex-start;
      gap: 12px;
    }

    .bio-write-cta {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 30px;
      line-height: 1.05;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
    }

    .person-bio-section:hover .bio-write-cta {
      opacity: 1;
      pointer-events: auto;
    }

    .bio-write-cta:hover {
      text-decoration: underline;
    }

    .person-bio-kicker {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 15px;
    }

    .person-bio-section .body {
      white-space: pre-line;
    }

    .person-life-events-section {
      margin-top: 0;
    }

    .person-life-events-head {
      display: flex;
      align-items: baseline;
      justify-content: flex-start;
      gap: 12px;
    }

    .person-life-events-title {
      margin: 0;
      font-size: 34px;
      font-family: "Cormorant Garamond", Georgia, serif;
      letter-spacing: -0.01em;
      font-weight: 600;
      color: #2f251a;
    }

    .life-event-add-cta {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 30px;
      line-height: 1.05;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
    }

    .person-life-events-section:hover .life-event-add-cta {
      opacity: 1;
      pointer-events: auto;
    }

    .life-event-add-cta:hover {
      text-decoration: underline;
    }

    .life-events-list {
      display: grid;
      gap: 10px;
      margin-top: 10px;
    }

    .life-event-item {
      border: 1px solid #e6dccb;
      background: #fbf7ef;
      border-radius: 12px;
      padding: 10px 12px;
      display: grid;
      gap: 6px;
      position: relative;
    }

    .life-event-item:hover .memory-menu-trigger {
      opacity: 1;
      pointer-events: auto;
    }

    .life-event-item-title {
      margin: 0;
      font-size: 19px;
      line-height: 1.3;
      font-family: "Cormorant Garamond", Georgia, serif;
      color: #2d2418;
      font-weight: 600;
    }

    .life-event-item-meta {
      margin: 0;
      font-size: 13px;
      color: #7a715f;
    }

    .life-event-item-body {
      margin: 0;
      font-size: 15px;
      line-height: 1.5;
      color: #342b1f;
      white-space: pre-line;
    }

    .life-event-type-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .life-event-chip {
      border: 1px solid #dbcaa8;
      background: #fff9ed;
      color: #6d5230;
      border-radius: 999px;
      padding: 8px 12px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    }

    .life-event-chip:hover {
      background: #f7edd8;
      border-color: #ccb183;
    }

    .life-event-chip.is-selected {
      background: #f1e1bd;
      border-color: #b99354;
      color: #4d391b;
      transform: translateY(-1px);
    }

    .person-photos-section {
      margin-top: 0;
    }

    .person-photos-head {
      display: flex;
      align-items: baseline;
      justify-content: flex-start;
      gap: 12px;
    }

    .photo-add-cta {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 30px;
      line-height: 1.05;
      font-weight: 500;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.14s ease-out;
      white-space: nowrap;
    }

    .person-photos-section:hover .photo-add-cta {
      opacity: 1;
      pointer-events: auto;
    }

    .photo-add-cta:hover {
      text-decoration: underline;
    }

    .photo-person-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 12px;
    }

    .photo-person-grid .thumb img {
      height: 140px;
    }

    .rel-icon {
      color: var(--muted);
      opacity: 0.65;
    }

    .parent-limit {
      font-size: 20px;
      font-weight: 700;
      color: var(--text);
      margin-top: 8px;
    }

    .relative-duplicates {
      border: 1px solid rgba(122, 90, 45, 0.25);
      border-radius: 12px;
      padding: 12px;
      background: rgba(250, 245, 236, 0.75);
      display: grid;
      gap: 10px;
    }

    .screen[data-screen="add-relative"].duplicates-open .panel {
      position: relative;
    }

    .screen[data-screen="add-relative"].duplicates-open .panel::after {
      content: "";
      position: absolute;
      inset: 0;
      background: rgba(70, 60, 45, 0.36);
      border-radius: 16px;
      z-index: 15;
      pointer-events: auto;
    }

    .relative-duplicates.as-modal {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: min(92%, 720px);
      max-height: min(72vh, 640px);
      overflow: auto;
      z-index: 22;
      box-shadow: 0 18px 34px rgba(22, 18, 12, 0.25);
      background: #fffdfa;
    }

    .relative-duplicates-title {
      font-size: 14px;
      font-weight: 700;
      color: #5f4930;
      margin: 0;
    }

    .relative-duplicate-row {
      border: 1px solid rgba(122, 90, 45, 0.18);
      border-radius: 10px;
      background: #fff;
      padding: 10px;
      display: grid;
      gap: 8px;
    }

    .relative-duplicate-name {
      font-size: 16px;
      font-weight: 600;
      color: var(--text);
    }

    .relative-duplicate-hint-text {
      color: #958978;
      font-weight: 500;
    }

    .relative-duplicate-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .relative-duplicate-empty {
      font-size: 13px;
      color: var(--muted);
    }

    .relative-duplicate-badges {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .relative-duplicate-badge {
      display: inline-flex;
      align-items: center;
      padding: 3px 8px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 600;
      color: #7b5c2e;
      background: rgba(122, 90, 45, 0.12);
      border: 1px solid rgba(122, 90, 45, 0.24);
      white-space: nowrap;
    }

    .relative-duplicate-create-btn {
      justify-self: start;
      margin-top: 2px;
    }

    .relative-duplicate-or {
      margin-top: 6px;
      margin-bottom: 2px;
      font-size: 12px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #9b8f7f;
      font-weight: 700;
      text-align: center;
      width: 100%;
    }

    .relative-duplicate-continue-text {
      display: inline-block;
      margin-top: 2px;
      font-family: "Manrope", system-ui, sans-serif;
      font-size: 14px;
      line-height: 1.35;
      font-weight: 600;
      letter-spacing: 0;
      color: #7a5a2d;
    }

    .relative-duplicate-row.is-clickable {
      cursor: pointer;
      transition: border-color 0.14s ease-out, box-shadow 0.14s ease-out, background-color 0.14s ease-out;
    }

    .relative-duplicate-row.is-clickable:hover,
    .relative-duplicate-row.is-clickable:focus-visible {
      border-color: rgba(122, 90, 45, 0.5);
      box-shadow: 0 4px 14px rgba(122, 90, 45, 0.14);
      background: #fffdf8;
      outline: none;
    }

    .relative-duplicate-hint {
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 32px;
      line-height: 1.08;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      margin-top: 6px;
    }

    .relative-duplicate-view-link {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      font: inherit;
      color: #7a5a2d;
      cursor: pointer;
      text-decoration: underline;
      text-underline-offset: 3px;
    }

    .relative-existing-notice {
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 32px;
      line-height: 1.08;
      letter-spacing: -0.01em;
      color: #7a5a2d;
      margin-top: 6px;
      display: grid;
      gap: 2px;
    }

    #relFirst.is-locked,
    #relLast.is-locked {
      background: #f1eee8;
      color: #7f7466;
      border-color: #d7cdbc;
      cursor: not-allowed;
    }

    .edits-row {
      display: grid;
      grid-template-columns: 0.7fr 1.4fr 1.2fr 0.6fr;
      gap: 10px;
      align-items: center;
      padding: 10px 12px;
      border-bottom: 1px solid rgba(0,0,0,0.06);
      font-size: 16px;
    }

    .edits-row.header {
      background: #f7f2e7;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--muted);
      font-weight: 700;
      border-radius: 10px;
      margin-bottom: 6px;
    }

    .edits-row .link {
      color: #7a5a2d;
      font-weight: 650;
      cursor: pointer;
    }

    .edits-row .link:hover {
      text-decoration: underline;
    }

    .book-live-viewer {
      border: none;
      border-radius: 0;
      background: transparent;
      box-shadow: none;
      padding: 0;
      display: grid;
      gap: 12px;
      position: relative;
    }

    .book-live-spread {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      min-height: 0;
      touch-action: pan-y;
      -webkit-user-select: none;
      user-select: none;
    }

    .book-live-page {
      aspect-ratio: 210 / 297;
      border: 1px solid #d9ccb7;
      border-radius: 10px;
      overflow: hidden;
      background: #fffdfa;
      box-shadow: 0 10px 20px rgba(36, 24, 10, 0.12);
      position: relative;
      cursor: pointer;
    }

    .book-live-page iframe {
      width: 100%;
      height: 100%;
      border: none;
      background: #fffdfa;
      display: block;
      pointer-events: none;
    }

    .book-live-page-empty {
      display: grid;
      place-items: center;
      color: #8f8475;
      font-size: 14px;
    }

    .book-live-nav {
      display: grid;
      grid-template-columns: auto 1fr auto;
      grid-template-areas:
        "prev counter next"
        "order order order";
      gap: 10px;
      align-items: center;
    }

    #bookLivePrevBtn {
      grid-area: prev;
    }

    .book-live-counter {
      grid-area: counter;
      text-align: center;
      font-size: 14px;
      color: var(--muted);
      white-space: nowrap;
    }

    #bookLiveNextBtn {
      grid-area: next;
    }

    #bookOrderBtn {
      grid-area: order;
      width: 100%;
    }

    .book-order-modal {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 16px;
      background: rgba(246, 240, 230, 0.9);
      border-radius: 12px;
      z-index: 5;
    }

    .book-order-modal-inner {
      display: grid;
      gap: 14px;
      max-width: 640px;
      width: min(640px, 100%);
      border: 1px solid var(--line);
      border-radius: 14px;
      background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(251,246,237,0.98));
      box-shadow: 0 14px 26px rgba(35, 26, 14, 0.12);
      padding: 22px;
    }

    .book-order-title {
      margin: 0;
      font-family: "Cormorant Garamond", Georgia, serif;
      font-size: 40px;
      line-height: 1.04;
      color: #2f2418;
    }

    .book-order-text {
      margin: 0;
      font-size: 20px;
      line-height: 1.45;
      color: #5e5040;
    }

    .thumb-row {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 12px;
    }

    .upload-box {
      position: relative;
      border: 1px solid #e5e5e5;
      border-radius: 12px;
      background: #fafafa;
      padding: 24px;
      text-align: center;
      cursor: pointer;
      transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    }

    .upload-box:hover,
    .upload-box.drag {
      border-color: #bbb;
      background: #ffffff;
      box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    }

    .upload-box.is-uploading {
      pointer-events: none;
      opacity: 0.6;
      box-shadow: none;
      background: #f5f5f5;
    }

    .upload-box input[type="file"] {
      position: absolute;
      inset: 0;
      opacity: 0;
      width: 100%;
      height: 100%;
      cursor: pointer;
    }

    .upload-box-inner {
      display: grid;
      gap: 8px;
      place-items: center;
      color: var(--text);
    }

    .upload-icon {
      font-size: 28px;
    }

    .upload-title {
      font-size: 18px;
      font-weight: 700;
    }

    .upload-sub {
      font-size: 14px;
      color: var(--muted);
    }

    .photo-preview-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
    }

    .photo-preview {
      border: 1px solid var(--line);
      border-radius: 12px;
      overflow: hidden;
      background: #fff;
    }

    .photo-preview img {
      width: 100%;
      height: 120px;
      object-fit: cover;
      display: block;
    }

    .photo-preview .cap {
      padding: 8px 10px;
      font-size: 12px;
      color: var(--text);
      font-weight: 600;
    }

    #photosEmpty.card {
      border: none;
      box-shadow: none;
      background: transparent;
      padding: 0;
    }

    .photo-progress {
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 16px;
      display: grid;
      gap: 10px;
    }

    .photo-progress-top {
      display: flex;
      justify-content: space-between;
      font-weight: 600;
      color: var(--text);
    }

    .photo-progress-bar {
      height: 8px;
      background: #e9edf2;
      border-radius: 999px;
      overflow: hidden;
    }

    .photo-progress-fill {
      height: 100%;
      width: 0%;
      background: #2f7cf6;
      border-radius: 999px;
      transition: width 0.2s ease;
    }

    .photo-progress-count {
      font-size: 12px;
      color: var(--muted);
    }

    @media (max-width: 720px) {
      .photo-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    .thumb {
      border: 1px solid var(--line);
      border-radius: 12px;
      overflow: hidden;
      background: #fff;
      cursor: pointer;
      padding: 0;
      text-align: left;
      box-shadow: 0 8px 18px rgba(0,0,0,0.08);
      transition: box-shadow 0.2s ease, transform 0.2s ease;
    }

    .thumb:hover {
      box-shadow: 0 12px 24px rgba(0,0,0,0.12);
      transform: translateY(-1px);
    }

    .thumb img {
      width: 100%;
      height: 180px;
      object-fit: cover;
      display: block;
    }

    .photo-large {
      width: auto;
      max-width: 100%;
      max-height: min(560px, 62vh);
      height: auto;
      border-radius: 12px;
      border: 1px solid var(--line);
      box-shadow: 0 10px 20px rgba(0,0,0,0.08);
      display: block;
      margin: 0;
      align-self: flex-start;
    }

    .photo-edit-image {
      width: auto;
      max-width: 100%;
      max-height: min(560px, 62vh);
      height: auto;
      border-radius: 12px;
      border: 1px solid var(--line);
      box-shadow: 0 10px 20px rgba(0,0,0,0.08);
      display: block;
      margin: 0;
      align-self: flex-start;
    }

    .screen[data-screen="photo-edit"] #photoEditForm .field:first-child {
      margin-top: 14px;
    }

    .photo-view-panel .card {
      padding: 0;
      border: none;
      box-shadow: none;
      background: transparent;
    }

    .photo-view-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
    }

    .photo-view-header h2 {
      margin: 0;
      flex: 1 1 auto;
      min-width: 0;
    }

    .photo-actions {
      display: grid;
      gap: 4px;
      align-items: start;
      justify-items: start;
      justify-self: end;
      text-align: right;
      flex: 0 0 auto;
      border: 1px solid #e0d4c0;
      border-radius: 12px;
      padding: 10px 12px;
      background: #fcf8f1;
    }

    .photo-action-link {
      text-align: right;
    }

    .remove-photo-btn {
      align-self: flex-start;
      min-height: 46px;
      padding: 10px 16px;
      border-radius: 12px;
      background: linear-gradient(180deg, #ffe2e2, #ffcfcf);
      border: 1px solid #d66b6b;
      color: #7f1f1f;
      font-weight: 700;
      font-size: 16px;
      box-shadow: 0 8px 16px rgba(174, 62, 62, 0.2);
    }

    .remove-photo-btn:hover {
      background: linear-gradient(180deg, #ffd6d6, #ffbcbc);
      border-color: #c74f4f;
      color: #6f1717;
      box-shadow: 0 10px 18px rgba(174, 62, 62, 0.28);
    }

    .photo-remove-actions {
      display: flex;
      gap: 12px;
      justify-content: flex-end;
      align-items: center;
    }

    .photo-edit-actions {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .photo-cancel-btn {
      min-height: 36px;
      padding: 6px 12px;
      font-size: 14px;
      font-weight: 600;
    }

    .photo-remove-actions .btn.danger {
      min-height: 44px;
      padding: 8px 16px;
    }

    .photo-people-list {
      display: grid;
      gap: 8px;
      margin-bottom: 8px;
      min-height: 0;
    }

    .photo-people-list.is-empty {
      margin-bottom: 0;
    }

    .photo-people-row {
      display: grid;
      grid-template-columns: 28px 1fr 140px 160px auto;
      gap: 10px;
      align-items: center;
      padding: 10px 12px;
      border: none;
      border-radius: 0;
      background: transparent;
      font-size: 16px;
    }

    .photo-people-meta {
      display: grid;
      gap: 8px;
      margin-top: 12px;
    }

    .photo-people-meta .photo-people-row {
      grid-template-columns: 28px 1fr 160px;
      padding: 6px 0;
    }

    .photo-people-meta .people-name,
    .photo-people-meta .people-relation {
      color: var(--text);
    }

    .photo-person-delete {
      opacity: 0;
      border: none;
      background: transparent;
      color: var(--muted);
      font-size: 12px;
      cursor: pointer;
      transition: opacity 0.2s ease, color 0.2s ease;
      justify-self: end;
    }

    .photo-people-row:hover .photo-person-delete {
      opacity: 1;
      color: #b44a4a;
    }

    .photo-people-select {
      width: 100%;
    }

    .note { font-size: 14px; color: var(--muted); }

    .status-ok { color: var(--ok); font-weight: 700; }

    .family-tree-wrap {
      position: relative;
      width: 100%;
      height: 520px;
      border-radius: 20px;
      background: radial-gradient(circle at top, #ffffff 0%, #f7f3ed 55%);
      border: 1px solid rgba(0,0,0,0.05);
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
      overflow: hidden;
      touch-action: none;
      cursor: grab;
    }

    .family-tree-wrap.is-panning {
      cursor: grabbing;
    }

    .family-tree-wrap.is-panning,
    .family-tree-wrap.is-panning * {
      user-select: none;
      -webkit-user-select: none;
    }

    .family-tree-path {
      position: absolute;
      top: 12px;
      left: 16px;
      z-index: 3;
      font-size: 13px;
      color: var(--muted);
      background: rgba(255, 255, 255, 0.8);
      border: 1px solid rgba(0,0,0,0.06);
      border-radius: 10px;
      padding: 6px 10px;
      letter-spacing: 0.02em;
      display: flex;
      gap: 6px;
      align-items: center;
      flex-wrap: wrap;
    }

    .family-tree-path button {
      border: none;
      background: transparent;
      color: inherit;
      font: inherit;
      cursor: pointer;
      padding: 0;
    }

    .family-tree-lines {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      overflow: visible;
    }

    .family-tree-nodes {
      position: absolute;
      inset: 0;
      z-index: 2;
    }

    .ft-person {
      position: absolute;
      width: 150px;
      height: 58px;
      padding: 8px 12px;
      background: #ffffff;
      border-radius: 16px;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 16px;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
      border: 1px solid rgba(0,0,0,0.05);
      cursor: pointer;
      overflow: visible;
    }

    .ft-person:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    }

    .family-tree-wrap.no-motion .ft-person {
      transition: none !important;
    }

    .ft-person .hover-card {
      position: absolute;
      left: 0;
      right: 0;
      top: calc(100% + 6px);
      background: #ffffff;
      border-radius: 16px;
      border: 1px solid rgba(0,0,0,0.06);
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
      padding: 8px 10px;
      font-size: 13px;
      color: var(--text);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease 1.2s;
      z-index: 5;
      display: grid;
      align-content: center;
      gap: 4px;
      width: 100%;
      display: none;
    }

    .ft-person.menu-open .hover-card {
      display: grid;
      opacity: 1;
      pointer-events: auto;
      transition-delay: 0s;
    }

    .hover-title {
      font-weight: 700;
      margin-bottom: 6px;
    }

    .hover-title-btn {
      border: 1px solid rgba(122, 90, 45, 0.28);
      background: #f7f2e7;
      padding: 4px 8px;
      margin-bottom: 6px;
      font-weight: 700;
      font-size: 13px;
      color: var(--text);
      cursor: pointer;
      text-align: left;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: flex-start;
      width: fit-content;
      line-height: 1.2;
    }

    .hover-title-btn:hover {
      color: #7a5a2d;
      border-color: rgba(122, 90, 45, 0.45);
      background: #f3ebdc;
    }

    .hover-row {
      color: var(--muted);
      font-weight: 600;
    }

    .hover-row-btn {
      border: none;
      background: transparent;
      padding: 0;
      text-align: left;
      color: var(--muted);
      font-weight: 600;
      cursor: pointer;
    }

    .hover-row-btn:hover {
      color: var(--text);
    }

    .hover-row-btn.is-disabled,
    .hover-row-btn:disabled {
      color: #b3a796;
      opacity: 0.7;
      cursor: not-allowed;
      pointer-events: none;
    }

    .ft-person.is-center {
      border-color: rgba(0,0,0,0.05);
      box-shadow: 0 14px 26px rgba(143, 111, 62, 0.26);
      transform: translateY(-2px) scale(1.14);
      z-index: 4;
    }

    .ft-person.is-hidden {
      opacity: 0;
      pointer-events: none;
    }

    .ft-person .icon {
      font-size: 22px;
      width: 28px;
      text-align: center;
    }

    .ft-person .name {
      font-weight: 600;
      letter-spacing: 0.2px;
    }

    .tree-self-cta {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      z-index: 6;
      background: rgba(255, 255, 255, 0.95);
      border: 1px solid rgba(0, 0, 0, 0.08);
      border-radius: 16px;
      box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
      padding: 16px;
      width: min(340px, calc(100% - 24px));
      text-align: center;
      display: grid;
      gap: 10px;
    }

    @media (max-width: 900px) {
      .hero { grid-template-columns: 1fr; }
      .date-picker { grid-template-columns: 1fr; }
      .begin-flow input, .begin-flow select { max-width: 100%; }
      .begin-flow .date-picker { max-width: 100%; }
      h1 { font-size: 40px; }
      h2 { font-size: 32px; }
    }

    @media (max-width: 760px) {
      .person-title-row {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
        max-width: 100%;
      }

      .person-title-row h2 {
        margin: 0;
        min-width: 0;
      }

      .person-tree-cta {
        display: inline-flex !important;
        max-width: 30px !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        align-self: center;
        vertical-align: middle;
      }

      .person-tree-label {
        display: none !important;
      }

      .topbar-mobile-toggle {
        display: inline-flex;
      }

      .topbar {
        display: none;
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 8px;
      }

      .topbar-wrap.mobile-nav-open .topbar {
        display: grid;
      }

      .topbar-user {
        font-size: 13px;
      }

      .topbar-brand {
        padding-left: 2px;
        gap: 0;
      }

      .topbar-brand-title {
        font-size: 24px;
      }

      .topbar-brand-subtitle {
        font-size: 16px;
      }

      .nav-btn {
        min-height: 46px;
        text-align: left;
        font-size: 15px;
        padding: 10px 12px;
      }

      .book-live-spread {
        grid-template-columns: 1fr;
      }

      .book-live-nav {
        grid-template-columns: 1fr;
      }

      .book-live-counter {
        text-align: left;
      }

      .book-order-title {
        font-size: 34px;
      }

      .book-order-text {
        font-size: 18px;
      }

      .people-row {
        grid-template-columns: 28px minmax(0, 1fr);
        grid-template-areas:
          "icon name"
          "icon years"
          "icon relation";
        align-items: start;
        gap: 4px 10px;
        padding: 12px 10px;
      }

      .people-icon {
        grid-area: icon;
        align-self: start;
        padding-top: 2px;
      }

      .people-name {
        grid-area: name;
        min-width: 0;
      }

      .people-years,
      .people-relation {
        font-size: 14px;
      }

      .people-years {
        grid-area: years;
        display: block;
      }

      .people-relation {
        grid-area: relation;
        display: block;
      }

      .photo-people-row,
      .photo-people-meta .photo-people-row {
        grid-template-columns: 28px minmax(0, 1fr) auto;
        grid-template-areas:
          "icon name delete"
          ". relation delete"
          ". years delete";
        align-items: start;
        gap: 3px 10px;
        padding: 10px 8px;
      }

      .photo-people-row > :first-child {
        grid-area: icon;
        align-self: start;
        padding-top: 2px;
      }

      .photo-people-row .people-name {
        grid-area: name;
        min-width: 0;
        overflow-wrap: anywhere;
      }

      .photo-people-row .people-relation {
        grid-area: relation;
        min-width: 0;
        font-size: 13px;
        line-height: 1.25;
      }

      .photo-people-row .people-years {
        grid-area: years;
        min-width: 0;
        font-size: 13px;
        line-height: 1.2;
      }

      .photo-people-row .photo-person-delete {
        grid-area: delete;
        justify-self: end;
        align-self: start;
        opacity: 1;
        pointer-events: auto;
      }

      .edits-row.header {
        display: none;
      }

      .edits-row {
        grid-template-columns: 1fr;
        gap: 6px;
        align-items: start;
        padding: 12px;
        border: 1px solid rgba(0,0,0,0.06);
        border-radius: 12px;
        background: #fffcf8;
      }

      .edits-cell {
        min-width: 0;
      }

      .edits-what {
        font-weight: 400;
        color: var(--text);
      }

      .edits-who,
      .edits-date,
      .edits-cell[data-label="With"] {
        color: var(--muted);
        font-size: 14px;
      }

      .edits-who::before,
      .edits-date::before,
      .edits-cell[data-label="With"]::before {
        content: attr(data-label) ": ";
        color: var(--text);
        font-weight: 600;
      }

      .person-family-head,
      .person-birth-head,
      .person-death-head,
      .person-bio-head,
      .person-photos-head,
      .person-memories-head,
      .person-life-events-head {
        flex-wrap: wrap;
        gap: 6px 10px;
      }

      .person-family-title,
      .person-birth-title,
      .person-death-title,
      .person-bio-title,
      .person-photos-title,
      .person-life-events-title,
      .person-memories h3 {
        font-size: 28px;
      }

      .family-add-cta,
      .person-tree-cta,
      .birth-add-cta,
      .death-add-cta,
      .bio-write-cta,
      .photo-add-cta,
      .memory-add-cta,
      .life-event-add-cta {
        font-size: 24px;
        line-height: 1.1;
        white-space: normal;
      }
    }

    /* Keep CTA/meta controls always visible on touch devices (iPad/iPhone/Android). */
    @media (any-hover: none), (any-pointer: coarse) {
      .memory-add-cta,
      .life-event-add-cta,
      .person-tree-cta,
      .photo-add-cta,
      .bio-write-cta,
      .birth-add-cta,
      .death-add-cta,
      .family-add-cta,
      .memory-menu-trigger,
      .edit-person-remove-link {
        opacity: 1 !important;
        pointer-events: auto !important;
      }
    }
