/* Family cards: generous tree canvas, readable records and distinct personal worlds. */
@media screen {
  #person.profile-parity {
    --profile-inset: clamp(1.15rem, 3.8vw, 2.5rem);
    --profile-round: 1rem;
    --profile-rule: color-mix(in srgb, var(--accent) 24%, var(--border));
    width: min(1200px, calc(100vw - 32px));
    max-height: calc(100svh - 32px);
    max-height: calc(100dvh - 32px);
    border: 1px solid var(--profile-rule);
    border-radius: 24px;
    background: var(--paper);
    box-shadow: 0 32px 100px #0918115c, 0 3px 12px #09181126;
    scrollbar-width: thin;
    scrollbar-color: var(--panel-border) transparent;
    scroll-padding-block: 6.5rem 2rem;
  }

  #person.profile-parity::backdrop {
    background: #101b19c9;
    backdrop-filter: blur(10px);
  }

  #person.profile-parity .profile-hero {
    isolation: isolate;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "photo identity close";
    align-items: center;
    gap: clamp(1rem, 3vw, 2rem);
    min-height: 190px;
    padding: 2rem var(--profile-inset);
    overflow: clip;
    border-bottom: 1px solid var(--profile-rule);
    background:
      radial-gradient(ellipse at 95% 0%, color-mix(in srgb, var(--gold) 15%, transparent), transparent 55%),
      linear-gradient(120deg, var(--surface), var(--panel));
    text-align: start;
  }

  #person.profile-parity .profile-hero:not(:has(.profile-photo-slot)) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "identity close";
    min-height: 165px;
  }

  #person.profile-parity .profile-identity {
    grid-area: identity;
    position: relative;
    z-index: 1;
    min-width: 0;
  }

  #person.profile-parity .profile-identity .kicker {
    gap: .65rem;
    margin-bottom: .8rem;
    font: 750 .65rem/1.4 var(--sans);
    letter-spacing: .19em;
  }

  #person.profile-parity .profile-identity :is(h2, h3) {
    max-width: 24ch;
    margin: 0;
    font: 400 clamp(1.9rem, 3.7vw, 3.35rem)/1.07 var(--serif);
    letter-spacing: -.04em;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }

  #person.profile-parity .profile-identity p:not(.kicker) {
    max-width: 66ch;
    margin-top: .8rem;
    font-size: .9rem;
    line-height: 1.6;
  }

  #person.profile-parity .profile-photo-slot {
    grid-area: photo;
    z-index: 1;
    margin: 0;
  }

  #person.profile-parity .profile-photo-slot .profile-avatar {
    width: clamp(84px, 10vw, 126px);
    border: 5px solid color-mix(in srgb, var(--surface) 88%, transparent);
    outline: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
    box-shadow: 0 8px 28px #10261b1a;
    font-size: 2rem;
  }

  #person.profile-parity .profile-close {
    grid-area: close;
    align-self: start;
    justify-self: end;
    width: 44px;
    height: 44px;
    margin: 0;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    transition: background .15s, border-color .15s;
  }

  #person.profile-parity .profile-close:hover { background: var(--panel); }

  #person.profile-parity .profile-actions {
    position: sticky;
    z-index: 8;
    top: 0;
    align-items: center;
    gap: .5rem;
    padding: .75rem var(--profile-inset);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 5px 16px #0c20100a;
  }

  #person.profile-parity .profile-actions :is(.person-link, .button-link, .profile-tools > summary) {
    min-height: 44px;
    padding: .65rem .9rem;
    border-radius: .65rem;
    font-size: .8rem;
  }

  #person.profile-parity .profile-actions .profile-dismiss-action { margin-inline-start: auto; }
  #person.profile-parity .profile-tools { margin-inline-start: auto; }
  #person.profile-parity .profile-tools > :not(summary) { z-index: 10; min-width: 235px; }
  #person.profile-parity .profile-tools > :not(summary) :is(a, button) { min-height: 44px; }
  #person.profile-parity .profile-action-status:not(:empty) {
    padding: .65rem .9rem;
    border: 1px solid var(--border);
    border-radius: .65rem;
    background: var(--surface);
  }

  #person.profile-parity .profile-content,
  #person.profile-parity[data-world] .profile-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin: 1.5rem var(--profile-inset) 2rem;
  }

  #person.profile-parity .profile-family-summary,
  #person.profile-parity .profile-panels {
    min-width: 0;
    border: 1px solid var(--profile-rule);
    border-radius: var(--profile-round);
    background: var(--surface);
    box-shadow: 0 3px 14px #13251a05;
  }

  #person.profile-parity .profile-family-summary { padding: clamp(.9rem, 2vw, 1.35rem); }
  #person.profile-parity .profile-family-summary > h3 {
    margin: 0 0 1rem;
    font: 400 clamp(1.5rem, 2.5vw, 2rem)/1.2 var(--serif);
    letter-spacing: -.03em;
  }

  #person.profile-parity .profile-tree-modes {
    display: inline-flex;
    gap: .3rem;
    padding: .3rem;
    margin: 0 0 1rem;
    border: 1px solid var(--border);
    border-radius: .85rem;
    background: var(--paper);
  }

  #person.profile-parity .profile-tree-modes button {
    min-height: 44px;
    padding: .65rem 1rem;
    border: 1px solid transparent;
    border-radius: .6rem;
    font-size: .85rem;
  }

  #person.profile-parity .profile-tree-modes button[aria-pressed="true"] {
    box-shadow: 0 2px 6px #1423181a;
  }

  #person.profile-parity .profile-tree-controls {
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem;
  }

  #person.profile-parity .profile-tree-controls :is(a, button, select) {
    min-height: 44px;
    border-radius: .6rem;
    font-size: .8rem;
  }

  #person.profile-parity .profile-tree-controls .field {
    min-width: 10rem;
    gap: .3rem;
    font-size: .7rem;
  }

  #person.profile-parity .profile-classic-zoom { margin-inline-start: auto; }
  #person.profile-parity .profile-tree-controls output { font-size: .8rem; font-variant-numeric: tabular-nums; }

  #person.profile-parity .profile-family-summary .profile-pedigree,
  #person.profile-parity .profile-fan-viewport {
    height: clamp(21rem, 55svh, 31rem);
    min-height: 21rem;
    max-height: none;
    border: 1px solid var(--profile-rule);
    border-radius: .75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--panel-border) transparent;
  }

  #person.profile-parity .profile-fan-viewport { background: var(--paper); }
  #person.profile-parity .profile-fan-canvas { padding: 1rem; }
  #person.profile-parity .profile-family-summary > .profile-tree-controls:last-child {
    gap: .4rem;
    margin: .9rem 0 0;
  }
  #person.profile-parity .profile-family-summary > .profile-tree-controls:last-child a {
    padding: .55rem .8rem;
    font-size: .75rem;
  }

  #person.profile-parity .profile-tabs {
    gap: .4rem;
    margin: 0;
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--border);
    border-radius: var(--profile-round) var(--profile-round) 0 0;
    background: var(--paper);
  }

  #person.profile-parity .profile-tabs button {
    flex: 1;
    justify-content: center;
    padding: .65rem 1rem;
    border-radius: .65rem;
    font-size: .85rem;
    font-weight: 700;
  }

  #person.profile-parity .profile-tabs button[aria-selected="true"] {
    margin: 0;
    border-color: var(--border);
    background: var(--surface);
    box-shadow: 0 2px 6px #13251a08;
  }

  #person.profile-parity .profile-panels .profile-panel {
    padding: clamp(1.1rem, 3vw, 2rem);
    font-size: .92rem;
    line-height: 1.75;
  }

  #person.profile-parity .profile-panel :is(h3, h4) {
    margin-top: 1.75rem;
    margin-bottom: 1rem;
    font: 400 1.55rem/1.25 var(--serif);
    letter-spacing: -.025em;
  }
  #person.profile-parity .profile-panel > :first-child { margin-top: 0; }

  #person.profile-parity .profile-panel dl.profile-timeline {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    gap: .75rem;
    margin: 0 0 1.75rem;
  }

  #person.profile-parity .profile-panel dl.profile-timeline > div {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: .45rem;
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: .75rem;
    background: var(--paper);
  }

  #person.profile-parity .profile-panel dl.profile-timeline dt {
    color: var(--muted);
    font: 650 .71rem/1.4 var(--sans);
  }

  #person.profile-parity .profile-panel dl.profile-timeline dd {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  #person.profile-parity .profile-notes { gap: .85rem; margin: 0 0 1.75rem; }
  #person.profile-parity .profile-notes li {
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--accent);
    border-radius: .3rem .8rem .8rem .3rem;
    background: var(--surface);
    font-size: .91rem;
    line-height: 1.75;
  }
  #person.profile-parity .profile-notes li:has([data-status="open"]) {
    border-inline-start-style: dashed;
    border-inline-start-color: var(--gold);
    background: color-mix(in srgb, var(--gold) 4%, var(--surface));
  }
  #person.profile-parity .profile-notes li > div { justify-content: space-between; gap: .4rem 1rem; }
  #person.profile-parity .profile-notes li strong { font-size: .95rem; line-height: 1.45; }
  #person.profile-parity .profile-notes li p { max-width: 88ch; margin-top: .65rem; }
  #person.profile-parity .profile-note-status { padding: .15rem .6rem; font-size: .67rem; white-space: nowrap; }
  #person.profile-parity .profile-note-status[data-status="confirmed"] {
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    color: var(--accent);
  }

  #person.profile-parity .profile-relatives {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: .65rem;
  }
  #person.profile-parity .profile-relative {
    gap: .9rem;
    min-height: 88px;
    padding: .9rem;
    border-radius: .8rem;
    transition: border-color .15s, background .15s;
  }
  #person.profile-parity .profile-relative .compact-portrait { width: 45px; height: 45px; }
  #person.profile-parity .profile-relative strong { font-size: .9rem; line-height: 1.35; }
  #person.profile-parity .profile-relative small { font-size: .72rem; }
  #person.profile-parity .profile-research-links { gap: .6rem; }
  #person.profile-parity .profile-research-links li {
    gap: .3rem;
    padding: .8rem 0;
    border-bottom: 1px solid var(--border);
  }
  #person.profile-parity .profile-research-links .person-link { min-height: 44px; max-width: 100%; }
  #person.profile-parity .profile-research-body { max-width: 920px; margin-inline: auto; padding: 2rem var(--profile-inset); }
  #person.profile-parity .profile-footer { background: var(--surface); padding-block: 1rem; }
  #person.profile-parity .profile-footer button { min-height: 44px; }
  #person.profile-parity :is(button, a, summary, select):focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
  }

  /* Velvet: a cloth-bound album, gold spine and a portrait on the outer edge. */
  #person.profile-parity[data-world="velvet"] .profile-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, .35fr) auto auto;
    grid-template-areas: "identity art photo close";
    gap: 1.5rem;
    min-height: 220px;
  }
  #person.profile-parity[data-world="velvet"] .profile-world-art { width: 100%; max-width: 12rem; opacity: .8; }
  #person.profile-parity[data-world="velvet"] .profile-photo-slot .profile-avatar { border-radius: 45% 45% 12% 12%; }
  #person.profile-parity[data-world="velvet"] .profile-family-summary { border-inline-start: 4px double var(--gold); }
  #person.profile-parity[data-world="velvet"] .profile-panels { border-inline-start: 4px double var(--gold); }
  #person.profile-parity[data-world="velvet"] .profile-panel dl.profile-timeline > div {
    border-width: 0 0 1px;
    border-radius: 0;
    background: transparent;
  }

  /* Gothic: portrait arch and engraved headings, with a clear reading column. */
  #person.profile-parity[data-world="gothic"] { --profile-round: .35rem; border-radius: 1.8rem 1.8rem .5rem .5rem; }
  #person.profile-parity[data-world="gothic"] .profile-hero {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "photo identity close";
    justify-items: start;
    gap: 1.75rem;
    min-height: 220px;
    padding-block: 2rem;
    text-align: start;
  }
  #person.profile-parity[data-world="gothic"] .profile-photo-slot .profile-avatar {
    width: 112px;
    height: 136px;
    aspect-ratio: auto;
    border-radius: 50% 50% 8px 8px;
    outline: 2px solid #c28ba9;
    outline-offset: 5px;
  }
  #person.profile-parity[data-world="gothic"] .profile-world-art {
    position: absolute;
    z-index: -1;
    inset: 0 4rem 0 auto;
    width: 22rem;
    max-width: 60%;
    opacity: .17;
  }
  #person.profile-parity[data-world="gothic"] .profile-family-summary { border: 3px double var(--profile-rule); border-radius: .35rem; }
  #person.profile-parity[data-world="gothic"] .profile-family-summary > h3 { text-align: start; }
  #person.profile-parity[data-world="gothic"] .profile-panel dl.profile-timeline { grid-template-columns: minmax(0, 1fr); }
  #person.profile-parity[data-world="gothic"] .profile-panel dl.profile-timeline > div {
    grid-template-columns: minmax(8rem, .35fr) minmax(0, 1fr);
    padding-inline-start: 1.4rem;
    border-width: 0 0 1px 2px;
    border-radius: 0;
    background: transparent;
  }

  /* K-pop: a stage pass, graphic rails and bright, compact fact tiles. */
  #person.profile-parity[data-world="kpop"] { --profile-round: 1.15rem; }
  #person.profile-parity[data-world="kpop"] .profile-hero {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "photo identity close";
    border-bottom: 3px solid #ba8eff;
  }
  #person.profile-parity[data-world="kpop"] .profile-hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -4rem 18% -4rem 48%;
    transform: skew(-19deg);
    border-inline: 1px solid #e1bcff61;
    background: #dba0ff0d;
    pointer-events: none;
  }
  #person.profile-parity[data-world="kpop"] .profile-world-art {
    position: absolute;
    z-index: -1;
    inset: 1rem 10% 0 auto;
    width: 18rem;
    opacity: .16;
  }
  #person.profile-parity[data-world="kpop"] .profile-identity h2 { font: 800 clamp(1.9rem, 3.6vw, 3.3rem)/1.05 var(--sans); }
  #person.profile-parity[data-world="kpop"] .profile-photo-slot .profile-avatar { border-radius: 1.25rem; transform: rotate(-3deg); }
  #person.profile-parity[data-world="kpop"] .profile-family-summary { border: 1px solid var(--profile-rule); border-block-start: 4px solid var(--accent); }
  #person.profile-parity[data-world="kpop"] .profile-family-summary > h3 { font-family: var(--sans); font-weight: 800; }
  #person.profile-parity[data-world="kpop"] .profile-tabs { border-radius: 1.1rem 1.1rem 0 0; }
  #person.profile-parity[data-world="kpop"] .profile-notes li { border-radius: 1rem; border-inline-start-width: 1px; border-block-start: 3px solid var(--accent); }

  /* Dungeon: a map board and squared inventory, without pixelating the records. */
  #person.profile-parity[data-world="dungeon"] { --profile-round: .25rem; border-radius: .4rem; }
  #person.profile-parity[data-world="dungeon"] .profile-hero {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, .3fr) auto;
    grid-template-areas: "identity photo art close";
  }
  #person.profile-parity[data-world="dungeon"] .profile-world-art { width: 100%; max-width: 11rem; }
  #person.profile-parity[data-world="dungeon"] .profile-photo-slot .profile-avatar { border-radius: .25rem; border-width: 4px; }
  #person.profile-parity[data-world="dungeon"] :is(.profile-tree-modes, .profile-tree-modes button, .profile-tabs, .profile-tabs button, .profile-panel dl.profile-timeline > div, .profile-notes li, .profile-relative) { border-radius: .25rem; }
  #person.profile-parity[data-world="dungeon"] .profile-family-summary { border-width: 2px; box-shadow: 4px 4px 0 var(--border); }
  #person.profile-parity[data-world="dungeon"] .profile-panel dl.profile-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--border); background: var(--border); }
  #person.profile-parity[data-world="dungeon"] .profile-panel dl.profile-timeline > div { border: 0; background: var(--surface); }
  #person.profile-parity[data-world="dungeon"] .profile-panel dl.profile-timeline dt { font-family: "Cascadia Mono", Consolas, monospace; }

  /* Pets: a soft scrapbook, rounded fact stickers and dotted family frames. */
  #person.profile-parity[data-world="pets"] { --profile-round: 1.4rem; border-radius: 1.8rem; }
  #person.profile-parity[data-world="pets"] .profile-hero {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "photo identity close";
    min-height: 210px;
  }
  #person.profile-parity[data-world="pets"] .profile-world-art {
    position: absolute;
    z-index: -1;
    right: 8%;
    bottom: -2rem;
    width: 18rem;
    opacity: .2;
  }
  #person.profile-parity[data-world="pets"] .profile-photo-slot .profile-avatar { border-radius: 35% 35% 25% 25%; transform: rotate(-4deg); }
  #person.profile-parity[data-world="pets"] .profile-identity h2 { font-family: "Arial Rounded MT Bold", "Trebuchet MS", var(--sans); font-weight: 700; }
  #person.profile-parity[data-world="pets"] .profile-family-summary { border: 2px dashed var(--profile-rule); }
  #person.profile-parity[data-world="pets"] .profile-panel dl.profile-timeline > div { border-radius: 1.2rem 1.2rem 1.2rem .3rem; }
  #person.profile-parity[data-world="pets"] .profile-relative { border-style: dashed; }

  @media (max-width: 760px) {
    #person.profile-parity {
      --profile-inset: 1rem;
      width: calc(100vw - 16px);
      max-height: calc(100svh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
      max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
      border-radius: 1.2rem;
      font-size: 14px;
      scroll-padding-top: 8rem;
    }
    #person.profile-parity .profile-hero,
    #person.profile-parity[data-world] .profile-hero {
      grid-template-columns: auto minmax(0, 1fr) 44px;
      grid-template-areas: "photo identity close";
      align-items: center;
      justify-items: stretch;
      gap: .9rem;
      min-height: 155px;
      padding: 1.25rem var(--profile-inset);
      text-align: start;
    }
    #person.profile-parity .profile-hero:not(:has(.profile-photo-slot)) {
      grid-template-columns: minmax(0, 1fr) 44px;
      grid-template-areas: "identity close";
      min-height: 140px;
    }
    #person.profile-parity .profile-identity :is(h2, h3),
    #person.profile-parity[data-world] .profile-identity h2 {
      font-size: clamp(1.45rem, 5.6vw, 2.1rem);
      line-height: 1.1;
    }
    #person.profile-parity .profile-identity .kicker { margin-bottom: .6rem; font-size: .58rem; letter-spacing: .12em; }
    #person.profile-parity .profile-identity p:not(.kicker) { margin-top: .6rem; font-size: .76rem; }
    #person.profile-parity .profile-photo-slot .profile-avatar { width: 72px; border-width: 3px; font-size: 1.45rem; }
    #person.profile-parity[data-world="gothic"] .profile-photo-slot .profile-avatar { width: 70px; height: 90px; outline-offset: 2px; }
    #person.profile-parity .profile-close { position: static; width: 44px; height: 44px; min-height: 44px; padding: 0; }
    #person.profile-parity[data-world] .profile-world-art { position: absolute; inset: auto .8rem -1rem auto; width: 9rem; max-width: 40%; opacity: .12; }
    #person.profile-parity .profile-actions { padding: .6rem var(--profile-inset); gap: .45rem; }
    #person.profile-parity .profile-actions :is(.person-link, .button-link, .profile-tools > summary) { padding: .6rem .7rem; font-size: .73rem; }
    #person.profile-parity .profile-content { gap: 1rem; margin-block: 1rem 1.5rem; }
    #person.profile-parity .profile-family-summary { padding: .85rem; }
    #person.profile-parity .profile-family-summary > h3 { font-size: 1.5rem; }
    #person.profile-parity .profile-tree-controls { gap: .4rem; }
    #person.profile-parity .profile-tree-controls .field { width: 100%; min-width: 0; }
    #person.profile-parity .profile-tree-controls .field select { width: 100%; }
    #person.profile-parity .profile-classic-zoom { margin-inline-start: 0; }
    #person.profile-parity .profile-tree-controls :is(a, button) { font-size: .75rem; }
    #person.profile-parity .profile-tree-modes { display: flex; }
    #person.profile-parity .profile-tree-modes button { flex: 1; padding-inline: .55rem; font-size: .78rem; }
    #person.profile-parity .profile-family-summary .profile-pedigree,
    #person.profile-parity .profile-fan-viewport { height: clamp(19rem, 52svh, 26rem); min-height: 19rem; border-radius: .6rem; }
    #person.profile-parity .profile-fan-canvas { padding: .5rem; }
    #person.profile-parity .profile-family-summary > .profile-tree-controls:last-child { display: grid; grid-template-columns: minmax(0, 1fr); }
    #person.profile-parity .profile-family-summary > .profile-tree-controls:last-child a { justify-content: center; padding-inline: .6rem; text-align: center; }
    #person.profile-parity .profile-panels .profile-panel { padding: 1rem; font-size: .87rem; }
    #person.profile-parity .profile-panel :is(h3, h4) { font-size: 1.35rem; }
    #person.profile-parity .profile-notes li { padding: 1rem; font-size: .86rem; }
    #person.profile-parity .profile-notes li > div { justify-content: flex-start; }
    #person.profile-parity .profile-note-status { margin-inline-start: auto; }
    #person.profile-parity .profile-panel dl.profile-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
    #person.profile-parity .profile-panel dl.profile-timeline > div { padding: .85rem; }
    #person.profile-parity .profile-panel dl.profile-timeline dd { font-size: .9rem; }
    #person.profile-parity[data-world="gothic"] .profile-panel dl.profile-timeline { grid-template-columns: minmax(0, 1fr); }
    #person.profile-parity[data-world="gothic"] .profile-panel dl.profile-timeline > div { grid-template-columns: minmax(0, 1fr); padding-inline-start: .9rem; }
    #person.profile-parity .profile-research-body { padding: 1.25rem var(--profile-inset); }
    #person.profile-parity .profile-relatives { grid-template-columns: minmax(0, 1fr); }
  }

  @media (max-width: 480px) {
    #person.profile-parity { --profile-inset: .8rem; }
    #person.profile-parity .profile-actions {
      position: sticky;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #person.profile-parity .profile-actions > :is(a, button) { width: 100%; justify-content: center; }
    #person.profile-parity .profile-tools { min-width: 0; margin: 0; }
    #person.profile-parity .profile-tools > summary { width: 100%; }
    #person.profile-parity .profile-tools > :not(summary) { right: .8rem; min-width: min(260px, calc(100vw - 3rem)); }
    #person.profile-parity .profile-actions .profile-dismiss-action { margin: 0; }
    #person.profile-parity .profile-hero,
    #person.profile-parity[data-world] .profile-hero { gap: .7rem; grid-template-columns: 58px minmax(0, 1fr) 44px; }
    #person.profile-parity .profile-photo-slot .profile-avatar { width: 58px; }
    #person.profile-parity[data-world="gothic"] .profile-photo-slot .profile-avatar { width: 54px; height: 74px; }
    #person.profile-parity .profile-identity .kicker::before { width: .75rem; }
    #person.profile-parity .profile-panel dl.profile-timeline { grid-template-columns: minmax(0, 1fr); }
    #person.profile-parity[data-world="dungeon"] .profile-panel dl.profile-timeline { grid-template-columns: minmax(0, 1fr); }
    #person.profile-parity .profile-tabs { padding: .4rem; gap: .15rem; }
    #person.profile-parity .profile-tabs button { padding-inline: .4rem; font-size: .78rem; }
  }

  @media (prefers-reduced-motion: reduce) {
    #person.profile-parity :is(.profile-close, .profile-relative) { transition: none; }
  }
}

/* Clear navigation, a shorter reading path, and controls that fit a small screen. */
@media screen {
  #person.profile-parity {
    font-size: 16px;
    scroll-padding-block: 5rem 1.5rem;
  }

  #person.profile-parity .profile-identity .kicker {
    font-size: .75rem;
    letter-spacing: .09em;
  }
  #person.profile-parity .profile-identity p:not(.kicker) {
    font-size: .95rem;
    line-height: 1.6;
  }
  #person.profile-parity .profile-actions {
    gap: .55rem;
    padding-block: .75rem;
  }
  #person.profile-parity:has(.profile-section-nav) .profile-actions { position: sticky; }
  #person.profile-parity .profile-actions :is(.person-link, .button-link, .profile-tools > summary) {
    min-height: 46px;
    font-size: .87rem;
    line-height: 1.4;
  }
  #person.profile-parity .profile-actions > a { white-space: nowrap; }
  #person.profile-parity .profile-tools > summary { display: flex; align-items: center; justify-content: center; gap: .5rem; }
  #person.profile-parity .profile-tools > summary > span:last-child { font-size: 1.35rem; line-height: 1; }
  #person.profile-parity .profile-tools > :not(summary) {
    max-width: calc(100vw - 3rem);
    padding: .45rem;
    border-radius: .8rem;
    box-shadow: 0 12px 30px #071a2329;
  }
  #person.profile-parity .profile-tools > :not(summary) :is(a, button) {
    width: 100%;
    text-align: start;
  }
  #person.profile-parity .profile-tools input { width: 100%; min-width: 0; min-height: 44px; font-size: 1rem; }

  #person.profile-parity .profile-section-nav { display: none; }
  #person.profile-parity .profile-content,
  #person.profile-parity[data-world] .profile-content {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem;
    margin-block: 1.25rem 1.75rem;
  }
  #person.profile-parity .profile-tree-heading { margin-bottom: 1rem; }
  #person.profile-parity .profile-tree-heading > h3,
  #person.profile-parity .profile-family-summary > h3 {
    margin: 0 0 .5rem;
    font: 500 clamp(1.45rem, 2.3vw, 1.9rem)/1.25 var(--serif);
  }
  #person.profile-parity .profile-tree-hint {
    max-width: 55ch;
    margin: 0;
    color: var(--muted);
    font-size: .85rem;
    line-height: 1.6;
  }
  #person.profile-parity .profile-tree-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #person.profile-parity .profile-tree-modes button {
    min-height: 46px;
    padding: .7rem .55rem;
    font-size: .9rem;
    line-height: 1.35;
  }
  #person.profile-parity .profile-tree-modes button[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 2px 7px #0001;
  }
  #person.profile-parity .profile-tree-controls .field { font-size: .8rem; line-height: 1.45; }
  #person.profile-parity .profile-tree-controls select { font-size: 1rem; padding: .55rem .7rem; }
  #person.profile-parity .profile-tree-controls :is(a, button, select) { min-height: 46px; }
  #person.profile-parity .profile-classic-zoom {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: .35rem;
  }
  #person.profile-parity .profile-classic-zoom button { padding-inline: .7rem; min-width: 44px; }
  #person.profile-parity .profile-family-summary .profile-pedigree,
  #person.profile-parity .profile-fan-viewport {
    height: clamp(24rem, 60svh, 38rem);
    min-height: 24rem;
    max-height: none;
    background-color: var(--paper);
  }
  #person.profile-parity .profile-family-summary > .profile-tree-controls:last-child {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .45rem;
  }
  #person.profile-parity .profile-family-summary > .profile-tree-controls:last-child a {
    justify-content: space-between;
    padding: .7rem .8rem;
    font-size: .83rem;
    text-align: start;
  }
  #person.profile-parity .profile-panels .profile-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .25rem;
    padding: .4rem;
  }
  #person.profile-parity .profile-tabs button {
    min-width: 0;
    min-height: 46px;
    padding-inline: .4rem;
    font-size: .86rem;
  }
  #person.profile-parity .profile-tabs button[aria-selected="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
  }
  #person.profile-parity .profile-panels .profile-panel {
    padding: clamp(1rem, 2vw, 1.5rem);
    font-size: .95rem;
    line-height: 1.7;
  }
  #person.profile-parity .profile-panel :is(h3, h4) { font-size: 1.4rem; line-height: 1.3; }
  #person.profile-parity .profile-panel dl.profile-timeline { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  #person.profile-parity .profile-panel dl.profile-timeline dt { font-size: .8rem; }
  #person.profile-parity .profile-panel dl.profile-timeline dd { font-size: 1rem; line-height: 1.6; }
  #person.profile-parity .profile-notes { gap: .8rem; }
  #person.profile-parity .profile-notes li { padding: 1rem; font-size: .95rem; line-height: 1.7; }
  #person.profile-parity .profile-notes li > div { align-items: start; }
  #person.profile-parity .profile-note-status { font-size: .75rem; line-height: 1.45; white-space: normal; }
  #person.profile-parity .profile-relatives { grid-template-columns: minmax(0, 1fr); }
  #person.profile-parity .profile-relative {
    min-width: 0;
    min-height: 80px;
    gap: .85rem;
    padding: .85rem;
  }
  #person.profile-parity .profile-relative .compact-portrait { width: 46px; height: 46px; flex: none; }
  #person.profile-parity .profile-relative .pedigree-node-copy { min-width: 0; }
  #person.profile-parity .profile-relative strong { font-size: .98rem; line-height: 1.4; overflow-wrap: anywhere; }
  #person.profile-parity .profile-relative small { font-size: .8rem; line-height: 1.45; }
  #person.profile-parity .profile-research-links .person-link { font-size: .87rem; line-height: 1.5; }
  #person.profile-parity .profile-research-links li > :not(a) { font-size: .85rem; line-height: 1.6; }

  /* The motifs keep their silhouettes and materials while sharing predictable controls. */
  #person.profile-parity[data-world="velvet"] .profile-tree-heading { padding-inline-start: .75rem; border-inline-start: 2px solid var(--gold); }
  #person.profile-parity[data-world="gothic"] .profile-tree-heading { padding-bottom: .75rem; border-bottom: 3px double var(--profile-rule); }
  #person.profile-parity[data-world="kpop"] .profile-tree-heading > h3 { font-family: var(--sans); font-weight: 800; }
  #person.profile-parity[data-world="dungeon"] .profile-tree-heading > h3 { font-family: "Cascadia Mono", Consolas, monospace; font-size: 1.5rem; }
  #person.profile-parity[data-world="pets"] .profile-tree-heading { padding: .8rem; border: 1px dashed var(--profile-rule); border-radius: 1rem .4rem 1rem .4rem; background: var(--panel); }

  @media (max-width: 1199px) {
    #person.profile-parity:has(.profile-section-nav) .profile-actions { position: static; }
    #person.profile-parity .profile-content,
    #person.profile-parity[data-world] .profile-content { grid-template-columns: minmax(0, 1fr); }
    #person.profile-parity .profile-section-nav {
      position: sticky;
      z-index: 9;
      top: 0;
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr)) 44px;
      gap: .3rem;
      padding: .45rem var(--profile-inset);
      border-bottom: 1px solid var(--border);
      background: var(--surface);
      box-shadow: 0 4px 12px #071a230d;
    }
    #person.profile-parity .profile-section-nav > button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 0;
      min-height: 44px;
      padding: .6rem .3rem;
      border: 1px solid transparent;
      border-radius: .6rem;
      background: var(--paper);
      color: var(--text);
      font: 650 .85rem/1.35 var(--sans);
    }
    #person.profile-parity .profile-section-nav > button:hover,
    #person.profile-parity .profile-section-nav > button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
    #person.profile-parity .profile-section-nav > .profile-nav-close { width: 44px; font-size: 1.5rem; }
    #person.profile-parity .profile-family-summary,
    #person.profile-parity .profile-panels { scroll-margin-top: 0; }
    #person.profile-parity[data-profile-section="tree"] .profile-panels { display: none; }
    #person.profile-parity:is([data-profile-section="info"], [data-profile-section="family"], [data-profile-section="events"]) .profile-family-summary { display: none; }
    #person.profile-parity .profile-panels .profile-tabs { display: none; }
  }

  @media (max-width: 760px) {
    #person.profile-parity { --profile-inset: 1rem; border-radius: 1rem; }
    #person.profile-parity .profile-hero,
    #person.profile-parity[data-world] .profile-hero {
      min-height: 144px;
      padding-block: 1.1rem;
      grid-template-columns: 64px minmax(0, 1fr) 44px;
      gap: .8rem;
    }
    #person.profile-parity .profile-identity :is(h2, h3),
    #person.profile-parity[data-world] .profile-identity h2 { font-size: clamp(1.55rem, 5.2vw, 2rem); line-height: 1.15; }
    #person.profile-parity .profile-identity .kicker { font-size: .72rem; letter-spacing: .05em; }
    #person.profile-parity .profile-identity p:not(.kicker) { font-size: .88rem; line-height: 1.6; }
    #person.profile-parity .profile-photo-slot .profile-avatar { width: 64px; }
    #person.profile-parity[data-world="gothic"] .profile-photo-slot .profile-avatar { width: 60px; height: 80px; }
    #person.profile-parity .profile-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px; padding-block: .6rem; gap: .45rem; }
    #person.profile-parity .profile-actions > :is(a, button) { width: 100%; min-width: 0; padding: .6rem .4rem; white-space: normal; justify-content: center; text-align: center; font: 600 .8rem/1.35 var(--sans); }
    #person.profile-parity .profile-actions:not(:has(> .button-link)) > a { grid-column: 1 / 3; }
    #person.profile-parity .profile-tools { flex: 0 0 auto; margin-inline-start: auto; }
    #person.profile-parity .profile-tools { grid-column: 3; }
    #person.profile-parity .profile-tools > summary { padding: .65rem .75rem; font-size: .83rem; }
    #person.profile-parity .profile-tools > summary { min-width: 46px; padding-inline: .6rem; }
    #person.profile-parity .profile-tools-label { display: none; }
    #person.profile-parity .profile-action-arrow { display: none; }
    #person.profile-parity .profile-tools > :not(summary) { right: 0; }
    #person.profile-parity .profile-content { gap: 1rem; margin-block: 1rem 1.25rem; }
    #person.profile-parity .profile-family-summary { padding: 1rem; }
    #person.profile-parity .profile-tree-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
    #person.profile-parity .profile-tree-controls .field { width: 100%; font-size: .8rem; }
    #person.profile-parity .profile-tree-controls :is(a, button) { font-size: .83rem; }
    #person.profile-parity .profile-classic-zoom { flex-wrap: nowrap; margin: 0; }
    #person.profile-parity .profile-family-summary .profile-pedigree,
    #person.profile-parity .profile-fan-viewport { height: clamp(20rem, 55svh, 30rem); min-height: 20rem; }
    #person.profile-parity .profile-pedigree { --tree-scale: 1; }
    #person.profile-parity .pedigree-node-copy strong { font-size: 1rem; }
    #person.profile-parity .profile-panel dl.profile-timeline { grid-template-columns: minmax(0, 1fr); }
    #person.profile-parity .profile-notes li { padding: .95rem; font-size: .94rem; }
    #person.profile-parity .profile-note-status { margin-inline-start: 0; }
    #person.profile-parity .profile-tabs button { padding-inline: .3rem; font-size: .86rem; }
  }

  @media (max-width: 380px) {
    #person.profile-parity { --profile-inset: .75rem; }
    #person.profile-parity .profile-hero,
    #person.profile-parity[data-world] .profile-hero { grid-template-columns: 50px minmax(0, 1fr) 44px; gap: .6rem; }
    #person.profile-parity .profile-photo-slot .profile-avatar { width: 50px; }
    #person.profile-parity[data-world="gothic"] .profile-photo-slot .profile-avatar { width: 48px; height: 66px; }
    #person.profile-parity .profile-identity :is(h2, h3),
    #person.profile-parity[data-world] .profile-identity h2 { font-size: 1.5rem; }
    #person.profile-parity .profile-family-summary { padding: .75rem; }
    #person.profile-parity .profile-section-nav { gap: .2rem; padding-block: .4rem; }
    #person.profile-parity .profile-section-nav > button { font-size: .8rem; }
    #person.profile-parity .profile-actions > :is(a, button),
    #person.profile-parity .profile-tools > summary { font-size: .8rem; padding-inline: .55rem; }
  }
}
