.family-modal, .rc-family-tree {
  --family-surface: var(--card, #18191e);
  --family-inset: var(--card2, #22232a);
  --family-ink: var(--text, #f1eef4);
  --family-muted: var(--muted, #b0aab7);
  --family-line: var(--line2, #464351);
  --family-accent: var(--gold-text, #f5cb72);
}
.family-modal {
  width: min(860px, calc(100% - 28px));
  max-height: min(88dvh, 880px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--family-line);
  border-radius: 16px;
  color: var(--family-ink);
  background: var(--family-surface);
}
.family-modal::backdrop { background: rgb(12 12 18 / .72); }
.family-shell { display: flex; flex-direction: column; max-height: min(88dvh, 880px); min-width: 0; }
.family-shell header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--family-line); }
.family-shell header h2 { margin: 0; font-size: 1.38rem; }
.family-shell header .btn { min-width: 44px; }
.family-body { overflow: auto; overscroll-behavior: contain; padding: 16px 22px 24px; display: grid; gap: 13px; }
.family-status { margin: 0; color: var(--family-accent); font-size: .9rem; }
.family-status:not(:empty) { padding: 11px 22px 0; }
.family-modal :is(button,select,textarea):focus-visible { outline: 2px solid var(--family-accent); outline-offset: 2px; }
.family-modal .btn { min-height: 44px; white-space: normal; }
.family-modal .btn.ghost { color: var(--family-ink); }
.family-tree {
  --family-edge: #85858e;
  box-sizing: border-box;
  block-size: 220px;
  flex: none;
  min-inline-size: 0;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
  padding: 10px 12px;
  border: 1px solid var(--family-line);
  background: var(--family-inset);
  border-radius: 13px;
}
.family-tree:has(.family-side > .family-subtree:nth-child(3)) { block-size: min(36dvh, 280px); }
.family-tree:has(.family-descendants, .family-side > .family-subtree:nth-child(5)) { block-size: min(52dvh, 430px); }
.family-diagram {
  --family-arm: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(68px, 24%) minmax(0, 1fr);
  align-items: center;
  min-block-size: 100%;
  position: relative;
}
.family-wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.family-diagram > .family-root {
  grid-area: 1 / 2;
  z-index: 1;
  width: 100%;
  max-inline-size: 172px;
  justify-self: center;
  justify-content: center;
  padding-block: 10px;
  text-align: center;
}
.family-side {
  list-style: none;
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  position: relative;
}
.family-side-left { grid-area: 1 / 1; padding-inline-end: var(--family-arm); }
.family-side-right { grid-area: 1 / 3; padding-inline-start: var(--family-arm); }
.family-subtree { min-width: 0; }
.family-subtree > :is(.family-relative, .family-branch) { min-block-size: 44px; inline-size: 100%; }
.family-descendants {
  display: grid;
  gap: 5px;
  position: relative;
  margin: 0;
  padding: 5px 0 0 var(--family-nest, 14px);
  min-width: 0;
  list-style: none;
}
.family-relative, .family-branch) { inline-size: 100%; position: relative; z-index: 1; }
.family-side > .family-subtree:has(> .family-descendants) {
  margin-block: 3px;
  border-block-start: 1px solid transparent;
  border-block-end: 1px solid transparent;
}
.family-side > .family-subtree:has(> .family-descendants)::before { inset-block-start: -4px; inset-block-end: -4px; }
.family-side > .family-subtree:first-child::before { inset-block-start: 50%; }
.family-side > .family-subtree:last-child::before { inset-block-end: 50%; }
.family-descendants {
  --family-nest: 13px;
  display: grid;
  gap: 5px;
  position: relative;
  margin: 0;
  padding: 5px 0 0 var(--family-nest);
  min-width: 0;
  list-style: none;
}
.family-descendants::before {
  inset-block: 0 22px;
  inset-inline-start: 4px;
  border-inline-start: 1px solid var(--family-edge);
}
.family-descendants > .family-subtree { position: relative; min-width: 0; }
.family-descendants > .family-subtree::after {
  inset-block-start: 22px;
  inset-inline-start: calc(4px - var(--family-nest));
  inline-size: calc(var(--family-nest) - 4px);
  border-block-start: 1px solid var(--family-edge);
}
.family-subtree > :is(.family-relative, .family-branch) { min-block-size: 44px; }
.family-tree .family-root:only-child { grid-area: 1 / 2; }
.family-relative, .family-branch { display: flex; align-items: center; gap: 9px; text-align: start; min-width: 0; max-width: 100%; }
.family-relative {
  width: fit-content;
  min-height: 52px;
  box-sizing: border-box;
  padding: 5px 9px;
  background: var(--family-surface);
  border: 1px solid var(--family-line);
  border-radius: 10px;
}
.family-root { border-color: var(--family-accent); }
.family-tree .family-face { width: 40px; height: 40px; border-radius: 8px; }
.family-relative > div, .family-branch > span:not(.family-face) { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.family-relative small, .family-branch small { color: var(--family-muted); font-size: .76rem; }
.family-face { position: relative; flex: none; display: grid; place-items: center; width: 56px; height: 56px; overflow: hidden; border-radius: 11px; background: var(--family-surface); color: var(--family-accent); font-weight: 800; }
.family-face-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.family-face .av-px { align-self: end; }
.family-branch { min-block-size: 52px; box-sizing: border-box; padding: 5px 9px 5px 5px; color: inherit; background: var(--family-surface); border: 1px solid var(--family-line); border-radius: 10px; cursor: pointer; font-family: inherit; }
.family-branch[aria-pressed="true"] { border-color: var(--family-accent); }
.family-expecting { margin: 10px 0 0; text-align: center; font-size: .88rem; }
.family-expecting b { color: var(--family-accent); display: inline-block; }
.family-profile { display: grid; grid-template-columns: 112px minmax(0,1fr) minmax(185px,.86fr); gap: 14px; align-items: center; }
.family-portrait { width: 112px; height: 112px; border: 1px solid var(--family-line); border-radius: 14px; object-fit: cover; }
.family-bio { display: grid; gap: 5px; min-width: 0; }
.family-bio p { margin: 0; color: var(--family-muted); font-size: .87rem; overflow-wrap: anywhere; }
.family-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px; }
.family-name h3 { margin: 0; font-size: 1.24rem; }
.family-name span { color: var(--family-accent); font-size: .92rem; font-weight: 700; }
.family-scores { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px 13px; }
.family-meter { display: grid; grid-template-columns: 1fr 24px; align-items: center; gap: 2px 4px; font-size: .75rem; }
.family-meter span { color: var(--family-muted); }
.family-meter b { grid-row: 1; grid-column: 2; text-align: right; font-variant-numeric: tabular-nums; }
.family-meter meter { grid-column: 1/-1; width: 100%; height: 9px; }
.family-meter meter::-webkit-meter-optimum-value { background: var(--family-accent); }
.family-grudge meter::-webkit-meter-optimum-value { background: #bc655f; }
.family-tabs,.family-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.family-tabs .btn[aria-pressed="true"] { border-color: var(--family-accent); color: var(--family-accent); }
.family-section { display: grid; gap: 9px; min-width: 0; }
.family-section p { margin: 0; }
.family-campus { padding: 12px; border: 1px solid var(--family-line); border-radius: 10px; background: var(--family-inset); }
.family-campus .btn, .family-message .btn { justify-self: start; }
.family-muted { color: var(--family-muted); line-height: 1.55; font-size: .86rem; }
.family-empty { padding: 4px 0 20px; }
.family-last,.family-message,.family-event { padding: 11px 12px; border: 1px solid var(--family-line); border-radius: 10px; background: var(--family-inset); line-height: 1.5; overflow-wrap: anywhere; margin: 0; }
.family-last > b,.family-message > strong { color: var(--family-accent); }
.family-message,.family-event { display: grid; gap: 5px; }
.family-message small,.family-event time { color: var(--family-muted); font-size: .76rem; }
.family-event div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px; }
.family-field { display: grid; gap: 5px; min-width: 0; font-size: .88rem; }
.family-field small { color: var(--family-muted); }
.family-field :is(select,textarea) { width: 100%; min-height: 44px; box-sizing: border-box; border: 1px solid var(--family-line); border-radius: 8px; padding: 7px 9px; color: inherit; background: var(--family-inset); font: inherit; }
.family-field textarea { resize: vertical; }
.family-choice { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; }
.family-harsh { border-color: #bc655f; }
[data-family-count] { color: var(--gold-text); font-weight: 700; margin-inline-start: .16em; }
@media (max-width: 580px) {
  .family-body { padding: 12px; }
  .family-tree { padding-inline: 10px; }
  .family-tree :is(.family-relative, .family-branch) { gap: 4px; padding-inline: 4px; font-size: .83rem; }
  .family-tree .family-face, .family-tree .rc-family-person img { width: 28px; height: 28px; }
  .family-diagram > .family-root { flex-direction: column; }
  .family-diagram { --family-arm: 8px; }
  .family-descendants { --family-nest: 10px; }
  .family-descendants :is(.family-relative, .family-branch) { flex-wrap: wrap; }
  .family-root small, .family-subtree small { font-size: .72rem; }
  .family-shell header { padding: 8px 12px; }
  .family-profile { grid-template-columns: 74px minmax(0,1fr); gap: 9px; }
  .family-portrait { width: 74px; height: 74px; }
  .family-scores { grid-column: 1/-1; }
}

.family-incident-list,.pr-youth-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.family-incident-list li,.pr-youth-card { padding: 9px 11px; border: 1px solid var(--line2); border-radius: 9px; }
.family-incident-list small { color: var(--gold-text); margin-inline-start: 4px; }
.family-incident-list p,.pr-youth-card p { color: var(--muted); font-size: .86rem; margin: .25rem 0 0; }
.pr-youth-entry { margin: 10px 0; }
.pr-youth .btn { min-height: 44px; }
.pr-youth-list { margin: 12px 0; }
/* ── 💍 배우자 메뉴 · 📱 연락하기 · 💔 이혼 ── */
.family-spouse { color: inherit; background: var(--family-surface); border: 1px solid var(--family-line); border-radius: 10px; cursor: pointer; font-family: inherit; transition: border-color .15s, transform .15s; }
.family-spouse:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--family-accent) 60%, var(--family-line)); }
.family-spouse[aria-pressed="true"] { border-color: var(--family-accent); box-shadow: 0 0 0 1px var(--family-accent) inset; }
.family-wife { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 14px; align-items: center; width: 100%; padding: 12px; border: 1px solid var(--family-accent); border-radius: 13px; background: var(--family-surface); animation: familyWife .22s ease-out; }
.family-wife h3 { margin: 0 0 4px; font-size: 1.12rem; }
.family-wife h3 small { color: var(--family-muted); font-size: .78rem; font-weight: 500; }
.family-wife p { margin: 0 0 6px; }
.family-wife .family-face { width: 120px; height: 120px; }
.family-wife .family-actions .btn { min-height: 44px; }
.family-divorce { border-color: #bc655f; }
.family-divorce b { color: #f0a29b; }
@keyframes familyWife { from { opacity: 0; transform: translateY(-4px); } }
@media (max-width: 560px) {
  .family-wife { grid-template-columns: 84px minmax(0,1fr); }
  .family-wife .family-face { width: 84px; height: 84px; }
}
.pr-youth-card { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.pr-youth-card img { border-radius: 8px; }
.pr-youth-card div { flex: 1 1 140px; min-width: 0; }
.pr-youth-card small { color: var(--muted); }

.family-heading-actions, .network-heading, .network-section-heading {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.network-section-heading { justify-content: space-between; margin-block-end: 9px; }
.family-heading-actions .btn, .network-section-heading .btn { min-height: 44px; }
.family-network-modal { width: min(760px, calc(100% - 24px)); }
.family-network-modal [hidden] { display: none; }
.family-network-modal .family-shell { min-height: min(460px, 78dvh); }
.network-controls { padding: 12px 22px; border-block-end: 1px solid var(--family-line); }
.network-controls form { display: grid; gap: 5px; }
.network-controls label { font-size: .84rem; font-weight: 700; }
.network-search-line { display: flex; align-items: center; gap: 6px; }
.network-search-line input {
  min-width: 0; flex: 1 1 130px; box-sizing: border-box; min-height: 44px;
  color: var(--family-ink); background: var(--family-inset); border: 1px solid var(--family-line);
  border-radius: 9px; padding: 5px 10px; font: inherit;
}
.network-search-line input:focus-visible { outline: 2px solid var(--family-accent); outline-offset: 2px; }
.network-search-line input::placeholder { color: var(--family-muted); }
.network-search-line .btn { flex: none; }
.network-feedback { margin: 0; color: var(--family-muted); font-size: .86rem; }
.network-feedback:not(:empty) { margin-block-start: 8px; }
.network-body { display: grid; align-content: start; gap: 13px; min-height: 0; }
.network-identity { display: flex; gap: 12px; align-items: center; }
.network-identity .family-face { border: 1px solid var(--family-line); background: var(--family-inset); }
.network-identity h3 { margin: 0; font-size: 1.3rem; line-height: 1.25; overflow-wrap: anywhere; }
.network-empty { margin: 0; padding: 12px; border: 1px solid var(--family-line); border-radius: 9px; color: var(--family-muted); line-height: 1.5; background: var(--family-inset); }
.network-tree .family-root h3 { margin: 0; font-size: 1rem; line-height: 1.2; }
.network-tree .family-relative { color: var(--family-ink); }
.network-tree .family-network-link { font: inherit; cursor: pointer; }
.network-tree .family-network-link:hover { border-color: var(--family-accent); }
.network-tree .family-network-link strong::after { content: ' ›'; color: var(--family-accent); }
.network-tree ul { padding-inline-end: 0; }
.network-connections { display: grid; gap: 7px; }
.network-connections > h3 { margin: 0; font-size: 1rem; }
.network-contact-grid, .network-contact-roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.network-contact-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr)); }
.network-contact {
  min-width: 0; display: flex; gap: 10px; align-items: start; padding: 10px;
  border: 1px solid var(--family-line); border-radius: 10px; background: var(--family-inset);
}
.network-contact .family-face { width: 40px; height: 40px; border-radius: 8px; }
.network-contact-info { flex: 1; min-width: 0; display: grid; gap: 4px; }
.network-contact-name { min-width: 0; width: fit-content; color: var(--family-ink); overflow-wrap: anywhere; }
button.network-contact-name {
  display: flex; align-items: center; gap: 5px; padding: 0 3px; min-height: 44px;
  color: var(--family-ink); background: transparent; border: 0; border-radius: 6px; font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}
.network-contact-name span { color: var(--family-accent); }
.network-contact-roles > li { min-width: 0; }
.network-contact-roles > li + li { padding-block-start: 7px; border-block-start: 1px solid var(--family-line); }
.network-role { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; font-size: .83rem; }
.network-role strong { overflow-wrap: anywhere; }
.network-contact small, .network-score { color: var(--family-muted); font-size: .79rem; overflow-wrap: anywhere; }
.network-score b { color: var(--family-ink); font-variant-numeric: tabular-nums; }
.network-stats { margin: 6px 0 0; display: flex; gap: 5px 8px; flex-wrap: wrap; font-size: .78rem; }
.network-stats div { display: flex; gap: 4px; }
.network-stats dt { color: var(--family-muted); }
.network-stats dd { color: var(--family-ink); margin: 0; font-weight: 700; }
.network-login { justify-self: start; }
@media (max-width: 580px) {
  .network-controls { padding: 9px 12px; }
  .network-tree .family-relative { padding-inline: 6px; }
  .network-tree .family-face { width: 31px; height: 31px; }
  .family-heading-actions { gap: 5px; }
}
.ff-modal { width: min(35rem, calc(100% - 1rem)); }
.ff-body { min-width: 0; }
.ff-body [data-ff-content], .ff-form, .ff-record { display: grid; gap: .7rem; }
.ff-form, .ff-entry { padding: .7rem; border: 1px solid #64543a; border-radius: .6rem; background: #211a18; color: #fff1da; }
.ff-form label { display: grid; gap: .3rem; min-width: 0; }
.ff-form :is(select, input) { width: 100%; min-height: 44px; box-sizing: border-box; font: inherit;
  padding: .45rem; background: #12121a; color: #fff1da; border: 1px solid #8d7852; border-radius: .4rem; }
.ff-form :is(select, input):focus-visible, .ff-modal button:focus-visible { outline: 2px solid #f9d77c; outline-offset: 2px; }
.ff-modal button { min-height: 44px; }
.ff-note, .ff-entry small { margin: 0; font-size: .85rem; color: #e3cbb1; }
.ff-feedback { color: #ffda8d; margin: 0 0 .5rem; }
.ff-feedback:empty { margin: 0; }
.ff-record > div { display: flex; gap: .5rem; align-items: center; justify-content: space-between; }
.ff-record h3 { margin: 0; font-size: 1.05rem; }
.ff-entry { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: .5rem; overflow-wrap: anywhere; }
.ff-entry > div { display: grid; gap: .22rem; min-width: 0; }
.ff-entry > div:nth-child(2) { text-align: end; }
.ff-entry .ff-actions { display: flex; flex-wrap: wrap; grid-column: 1 / -1; gap: .45rem; }
.ff-actions button { flex: 1 1 6rem; white-space: normal; }

.network-bridge-list, .network-bridge-matches { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.network-bridge {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--family-line);
  border-radius: 10px;
  background: var(--family-inset);
}
.network-bridge-head { display: flex; align-items: center; gap: 8px; }
.network-bridge-head .family-face { width: 36px; height: 36px; border-radius: 8px; }
.network-bridge-head .btn { flex: none; padding-inline: 10px; font-size: .84rem; }
.network-bridge-head small { color: var(--family-muted); }
.network-bridge-matches li {
  min-width: 0; border-top: 1px solid var(--family-line); padding-top: 8px;
  font-size: .84rem; overflow-wrap: anywhere;
}
.network-bridge-matches strong { color: var(--family-accent); line-height: 1.4; }
.network-bridge-matches strong span { color: var(--family-muted); margin-inline-start: 5px; font-weight: 500; }
.network-bridge-matches p { display: flex; align-items: center; gap: 6px; margin: 5px 0 0; }
.network-bridge-wire { flex: 0 0 clamp(10px, 4vw, 30px); border-top: 1px solid var(--family-muted); }
.network-bridge > .btn { justify-self: start; }
