:root {
  --black: #070807;
  --panel: #10110f;
  --panel-soft: #171815;
  --gold: #d6a23a;
  --gold-light: #f1d27f;
  --paper: #e8e0d2;
  --muted: #a69f91;
  --pine: #1d2a20;
  --line: rgba(214, 162, 58, .38);
  --serif: Iowan Old Style, Baskerville, Georgia, serif;
  --sans: Inter, Avenir Next, Avenir, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  background: var(--black);
  font-family: var(--sans);
  overflow-x: hidden;
  padding-bottom: 86px;
}
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 10px clamp(18px, 3vw, 48px);
  background: rgba(7, 8, 7, .9);
  border-bottom: 1px solid rgba(232, 224, 210, .12);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-tree { display: grid; place-items: center; width: 44px; height: 44px; color: var(--black); background: var(--gold); border-radius: 50% 50% 48% 52%; font-size: 25px; transform: rotate(180deg); }
.brand span:last-child { display: grid; }
.brand small { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.brand strong { font-family: var(--serif); font-size: 22px; font-weight: 500; }
.main-nav { display: flex; gap: 5px; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.nav-item, .profile-button {
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
}
.nav-item:hover, .nav-item:focus-visible { color: var(--paper); border-color: rgba(232,224,210,.18); }
.nav-item.active { color: var(--paper); background: rgba(214,162,58,.17); border-color: rgba(214,162,58,.52); }
.top-actions { display: flex; justify-content: end; gap: 8px; }
.search-box { position: relative; width: min(300px, 22vw); display: flex; align-items: center; gap: 9px; padding: 9px 14px; color: var(--muted); background: rgba(255,255,255,.035); border: 1px solid rgba(232,224,210,.14); border-radius: 999px; }
.search-box input { width: 100%; min-width: 0; color: var(--paper); background: transparent; border: 0; outline: 0; }
.search-box input::placeholder { color: #817b70; }
.profile-button { color: var(--gold-light); border-color: rgba(214,162,58,.3); white-space: nowrap; }

.family-stage {
  position: relative;
  min-height: calc(100vh - 76px);
  padding: 28px clamp(18px, 3.4vw, 60px) 128px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 36%, rgba(214,162,58,.10), transparent 36%),
    linear-gradient(180deg, rgba(7,8,7,.1), rgba(7,8,7,.9)),
    linear-gradient(135deg, #080a08 0%, #10140e 55%, #090a08 100%);
}
.family-stage::before, .family-stage::after {
  content: "";
  position: absolute;
  pointer-events: none;
  width: 560px;
  height: 800px;
  opacity: .24;
  filter: blur(2px);
  background: radial-gradient(ellipse at 50% 40%, transparent 0 20%, #182117 21% 28%, transparent 29% 34%, #101a11 35% 48%, transparent 49%);
}
.family-stage::before { left: -290px; top: 70px; transform: rotate(18deg); }
.family-stage::after { right: -300px; top: 10px; transform: rotate(-15deg); }
.forest-glow { position: absolute; left: 0; right: 0; bottom: 0; height: 160px; background: radial-gradient(ellipse at 88% 100%, rgba(214,162,58,.31), transparent 38%); opacity: .7; }
.stage-heading { position: relative; z-index: 2; max-width: 1500px; margin: 0 auto 14px; display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.stage-heading h1, .panel-copy h2, .identity-dialog h2 { margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: -.025em; }
.stage-heading h1 { font-size: clamp(34px, 4vw, 58px); }
.stage-note { max-width: 430px; margin: 0; color: var(--muted); line-height: 1.55; }

.family-map {
  position: relative;
  z-index: 2;
  width: min(1500px, 100%);
  min-height: 846px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(230px, .72fr) minmax(650px, 1.9fr) minmax(230px, .72fr);
  grid-template-rows: 136px 550px 136px;
  grid-template-areas:
    "parentLeft . parentRight"
    "siblingLeft focus spouseRight"
    ". childrenRow .";
  gap: 6px clamp(20px, 5vw, 90px);
  align-items: center;
}
.relative-slot { position: relative; z-index: 3; }
.parent-left { grid-area: parentLeft; justify-self: end; align-self: end; }
.parent-right { grid-area: parentRight; justify-self: start; align-self: end; }
.sibling-left { grid-area: siblingLeft; justify-self: end; }
.spouse-right { grid-area: spouseRight; justify-self: start; }
.children-row { grid-area: childrenRow; justify-self: stretch; align-self: start; }
.focus-card { grid-area: focus; position: relative; z-index: 4; align-self: stretch; min-width: 0; height: 550px; min-height: 550px; display: grid; grid-template-columns: minmax(230px, .75fr) minmax(390px, 1.25fr); gap: 22px; padding: 18px; color: var(--paper); background: linear-gradient(145deg, rgba(30,31,27,.98), rgba(12,13,12,.98)); border: 1px solid var(--gold); border-radius: 28px; box-shadow: 0 0 0 3px rgba(214,162,58,.08), 0 0 38px rgba(214,162,58,.24), 0 30px 90px rgba(0,0,0,.54); overflow: hidden; }
.focus-card::after { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(232,224,210,.06); border-radius: 20px; pointer-events: none; }
.portrait-panel { min-height: 0; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: 16px; border-radius: 20px; background: radial-gradient(circle at 50% 32%, rgba(232,224,210,.14), transparent 45%), linear-gradient(155deg, #5d5445, #171916 68%); overflow: hidden; }
.portrait-image { width: 100%; height: 100%; min-height: 0; object-fit: cover; object-position: center 25%; border-radius: 12px; box-shadow: 0 16px 35px rgba(0,0,0,.35); filter: sepia(.18) contrast(.96); }
.monogram { place-self: center; display: grid; place-items: center; width: 145px; height: 180px; color: #201d17; background: linear-gradient(145deg, #d8c8a8, #8d816b); border-radius: 49% 49% 44% 44%; font-family: var(--serif); font-size: 52px; box-shadow: inset 0 0 40px rgba(0,0,0,.22), 0 16px 35px rgba(0,0,0,.35); filter: sepia(.35); }
.portrait-note { margin: 10px 0 0; color: rgba(232,224,210,.65); font-size: 12px; text-align: center; }
.focus-copy { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; padding: 7px 6px 2px 0; }
.focus-kicker { margin: 0 0 7px; color: var(--gold-light); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.focus-copy h2 { margin: 0; max-width: 16ch; font-family: var(--serif); font-size: clamp(36px, 2.45vw, 49px); font-weight: 400; line-height: .95; letter-spacing: -.035em; }
.focus-copy h2.long-name { max-width: 18ch; font-size: clamp(33px, 2.15vw, 44px); line-height: .97; }
.life-years { margin: 10px 0 13px; display: flex; align-items: baseline; gap: 10px; }
.life-years span { color: var(--muted); font-size: 12px; }
.life-years strong { color: var(--gold-light); font-family: var(--serif); font-size: 22px; font-weight: 400; letter-spacing: .025em; }
.fact-list { display: grid; gap: 5px; margin: 0; }
.fact { display: grid; grid-template-columns: 20px 1fr; gap: 7px; color: #cdc6b8; font-size: 13px; line-height: 1.32; }
.fact b { color: var(--paper); font-weight: 650; }
.story-short { margin: 11px 0 0; color: #d4ccbd; font-family: var(--serif); font-size: 16px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.focus-fact { margin-top: 10px; padding: 9px 11px; background: rgba(214,162,58,.075); border-left: 2px solid var(--gold); overflow: hidden; }
.focus-fact span { color: var(--gold-light); font-size: 10px; font-weight: 750; letter-spacing: .06em; }
.focus-fact p { margin: 3px 0 0; color: #d9d1c3; font-size: 12px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.focus-actions { margin-top: auto; padding-top: 11px; display: flex; align-items: end; justify-content: space-between; gap: 13px; }
.focus-buttons { display: flex; align-items: center; gap: 13px; }
.open-card-button { min-height: 44px; padding: 0 18px; color: #1b160d; background: var(--gold-light); border: 1px solid var(--gold-light); border-radius: 999px; font-weight: 750; }
.open-card-button:hover, .open-card-button:focus-visible { background: #f7dea0; outline: 3px solid rgba(241,210,127,.18); outline-offset: 3px; }
.play-button { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-light); background: transparent; border: 0; padding: 0; }
.play-icon { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid var(--gold); border-radius: 50%; }
.media-thumbs { display: flex; justify-content: end; gap: 7px; min-width: 0; }
.media-thumb { width: 58px; height: 48px; padding: 0; overflow: hidden; border: 1px solid rgba(232,224,210,.18); border-radius: 9px; background: #262720; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.35) contrast(.9); }
.media-more { display: grid; place-items: center; color: var(--paper); font-size: 11px; }

.relative-card { width: min(330px, 23vw); min-height: 145px; display: grid; grid-template-columns: 88px 1fr 18px; align-items: center; gap: 14px; padding: 13px; color: var(--paper); text-align: left; background: rgba(18,19,17,.96); border: 1px solid rgba(214,162,58,.58); border-radius: 19px; box-shadow: 0 14px 34px rgba(0,0,0,.35); transition: transform .24s ease, border-color .24s ease, background .24s ease; }
.relative-card:hover, .relative-card:focus-visible { transform: translateY(-4px); border-color: var(--gold-light); background: #1a1b18; outline: 0; }
.relative-avatar { display: grid; place-items: center; width: 88px; height: 106px; color: #2c271e; background: linear-gradient(145deg, #ceb98f, #726753); border-radius: 13px; font-family: var(--serif); font-size: 30px; filter: sepia(.3); }
.relative-avatar.has-photo { overflow: hidden; background: #2a261f; filter: none; }
.relative-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 24%; filter: sepia(.16) contrast(.96); }
.relative-copy { min-width: 0; }
.relation-label { display: inline-block; margin-bottom: 6px; color: var(--gold-light); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.relative-copy strong { display: block; font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1.06; }
.relative-copy small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.relative-copy .relative-years { color: var(--gold-light); font-family: var(--serif); font-size: 14px; letter-spacing: .025em; }
.relative-copy .relative-place { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.relative-arrow { color: var(--gold); font-size: 22px; }
.empty-relation { width: min(250px, 20vw); color: rgba(166,159,145,.55); font-size: 12px; text-align: center; }
.empty-relation:empty { visibility: hidden; }
.relative-group { width: 100%; }
.relative-group h3 { margin: 0 0 9px; color: #5c6c63; font-family: var(--serif); font-size: 16px; font-weight: 700; text-align: center; }
.relative-group-cards { display: grid; gap: 10px; }
.side-family-stack .relative-group-cards { max-height: 460px; overflow-y: auto; scrollbar-width: thin; }
.side-family-stack .relative-card { width: 100%; min-height: 112px; grid-template-columns: 62px 1fr 12px; gap: 10px; padding: 10px; }
.side-family-stack .relative-avatar { width: 62px; height: 82px; }
.side-family-stack .relative-copy strong { font-size: 16px; }
.children-family-row .relative-group-cards { display: flex; justify-content: center; gap: 12px; padding: 0 4px 12px; overflow-x: auto; }
.children-family-row .relative-card { flex: 0 0 250px; width: 250px; min-height: 116px; grid-template-columns: 66px 1fr 12px; }
.children-family-row .relative-avatar { width: 66px; height: 86px; }
.children-family-row .relative-copy strong { font-size: 17px; }

.family-connectors { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.family-connectors path { fill: none; stroke: rgba(214,162,58,.58); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.family-connectors circle { fill: var(--gold-light); filter: drop-shadow(0 0 6px rgba(214,162,58,.72)); }
.mobile-relatives { display: none; }

.panel-view { min-height: calc(100vh - 76px); padding: 70px clamp(20px, 7vw, 110px) 100px; background: radial-gradient(circle at 18% 8%, rgba(214,162,58,.09), transparent 30%), var(--black); }
.panel-copy { max-width: 850px; margin-bottom: 42px; }
.panel-copy h2 { font-size: clamp(46px, 7vw, 88px); }
.panel-copy > p:not(.eyebrow):not(.family-index-line) { max-width: 690px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.family-index-line { margin: 24px 0 0; max-width: 780px; color: #c4bcad; font-family: var(--serif); font-size: 18px; line-height: 1.55; }
.family-index-line strong { color: var(--gold-light); font-size: 30px; font-weight: 400; }
.family-index-line span { padding: 0 7px; color: rgba(214,162,58,.55); }
.tree-shell { max-width: 1600px; overflow: hidden; background: #0d0f0c; border: 1px solid rgba(214,162,58,.34); border-radius: 24px; box-shadow: 0 30px 100px rgba(0,0,0,.36); }
.tree-toolbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 16px 12px 22px; background: rgba(21,23,19,.94); border-bottom: 1px solid rgba(232,224,210,.1); }
.tree-selected-copy { min-width: 0; display: grid; gap: 3px; }
.tree-selected-copy span { color: var(--muted); font-size: 11px; }
.tree-selected-copy strong { overflow: hidden; color: var(--paper); font-family: var(--serif); font-size: 19px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.tree-selected-copy small { display: block; margin-top: 3px; color: var(--gold-light); font-size: 10px; }
.tree-controls { display: flex; align-items: center; gap: 7px; }
.tree-controls button { min-width: 38px; height: 38px; color: var(--paper); background: rgba(255,255,255,.035); border: 1px solid rgba(232,224,210,.15); border-radius: 11px; font-size: 20px; }
.tree-controls button:hover, .tree-controls button:focus-visible { border-color: var(--gold); outline: 0; }
.tree-controls output { width: 52px; color: var(--gold-light); font-size: 12px; text-align: center; }
.tree-controls .tree-fit { width: auto; padding: 0 13px; font-size: 12px; }
.tree-viewport { position: relative; height: min(72vh, 760px); min-height: 540px; overflow: hidden; touch-action: none; cursor: grab; background: radial-gradient(circle at 50% 50%, rgba(214,162,58,.06), transparent 38%), linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px), #080a08; background-size: auto, 36px 36px, 36px 36px, auto; }
.tree-viewport:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
.tree-viewport.dragging { cursor: grabbing; }
.tree-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.tree-edges, .tree-nodes { position: absolute; inset: 0; width: 100%; height: 100%; }
.tree-edges { overflow: visible; pointer-events: none; }
.tree-edges path { fill: none; stroke: rgba(214,162,58,.55); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tree-edges .edge-spouse-of, .tree-edges .edge-cousin-of { stroke-dasharray: 6 5; stroke: rgba(241,210,127,.45); }
.tree-edges .edge-unconfirmed { stroke-dasharray: 5 4; opacity: .58; }
.tree-edges.has-edge-focus path { opacity: .34; transition: opacity .15s ease, stroke-width .15s ease; }
.tree-edges.has-edge-focus path.edge-unconfirmed { opacity: .24; }
.tree-edges.has-edge-focus path.edge-lineage { opacity: .96; stroke: rgba(231,188,101,.92); stroke-width: 2.6; }
.tree-edges.has-edge-focus path.edge-emphasized { opacity: 1; stroke: #e7bc65; stroke-width: 3; filter: drop-shadow(0 0 4px rgba(214,162,58,.5)); }
.tree-node { position: absolute; width: 220px; height: 96px; }
.tree-node > button { width: 100%; height: 100%; display: grid; grid-template-columns: 60px 1fr; gap: 11px; align-items: center; padding: 9px; color: var(--paper); text-align: left; background: rgba(23,25,21,.97); border: 1px solid rgba(232,224,210,.18); border-radius: 16px; box-shadow: 0 14px 32px rgba(0,0,0,.34); }
.tree-node > button:hover, .tree-node > button:focus-visible { border-color: var(--gold-light); outline: 0; }
.tree-node.selected > button { background: #211d14; border-color: var(--gold-light); box-shadow: 0 0 0 3px rgba(214,162,58,.13), 0 18px 42px rgba(0,0,0,.5); }
.tree-node.family-focus-node:not(.selected) > button { border-color: rgba(214,162,58,.48); }
.tree-node-avatar { display: grid; place-items: center; width: 60px; height: 74px; overflow: hidden; color: #2c271e; background: linear-gradient(145deg, #ceb98f, #726753); border-radius: 11px; font-family: var(--serif); font-size: 20px; }
.tree-node-avatar img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.17); }
.tree-node > button > span:last-child { min-width: 0; display: grid; gap: 4px; }
.tree-node small { color: var(--gold-light); font-size: 9px; letter-spacing: .04em; }
.tree-node strong { display: -webkit-box; overflow: hidden; font-family: var(--serif); font-size: 16px; font-weight: 400; line-height: 1.04; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tree-node em { color: var(--muted); font-size: 10px; font-style: normal; }
.tree-branch-divider { position: absolute; left: 50%; width: max-content; max-width: 720px; margin: 0; padding: 10px 16px; color: rgba(232,224,210,.76); background: rgba(20,22,18,.94); border: 1px solid rgba(214,162,58,.28); border-radius: 999px; font-size: 11px; text-align: center; transform: translateX(-50%); }

@media (min-width: 981px) {
  #treeView { padding-left: clamp(22px,3vw,52px); padding-right: clamp(22px,3vw,52px); }
  .tree-shell { max-width: none; border-radius: 14px; }
  .tree-viewport { height: min(82vh,920px); min-height: 760px; }
}
.tree-gesture-hint { position: absolute; left: 50%; bottom: 16px; margin: 0; padding: 8px 12px; color: rgba(232,224,210,.72); background: rgba(7,8,7,.72); border: 1px solid rgba(232,224,210,.1); border-radius: 999px; font-size: 11px; transform: translateX(-50%); pointer-events: none; }
.family-directory { max-width: 1600px; margin-top: 18px; padding: 0; background: rgba(255,255,255,.018); border: 1px solid rgba(232,224,210,.1); border-radius: 18px; }
.family-directory summary { padding: 18px 20px; color: var(--gold-light); cursor: pointer; }
.family-directory .people-grid { padding: 0 14px 14px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 13px; }
.person-tile { min-height: 154px; display: grid; grid-template-columns: 62px 1fr; gap: 15px; align-items: start; padding: 20px; color: var(--paper); text-align: left; background: var(--panel); border: 1px solid rgba(232,224,210,.12); border-radius: 16px; transition: border-color .2s ease, transform .2s ease; }
.person-tile:hover { transform: translateY(-3px); border-color: var(--gold); }
.tile-avatar { display: grid; place-items: center; width: 62px; height: 70px; overflow: hidden; color: #262116; background: #b19b72; border-radius: 12px; font-family: var(--serif); font-size: 22px; }
.tile-avatar img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.15); }
.person-tile strong { display: block; font-family: var(--serif); font-size: 21px; font-weight: 400; line-height: 1.1; }
.person-tile span { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.source-badge { color: var(--gold-light) !important; font-size: 11px !important; text-transform: uppercase; letter-spacing: .06em; }
.lineage-list { max-width: 920px; margin: 0; padding: 0; list-style: none; }
.lineage-list li { display: grid; grid-template-columns: 110px 1fr; gap: 30px; padding: 22px 0; border-top: 1px solid rgba(232,224,210,.12); }
.lineage-list em { color: var(--gold); font-style: normal; font-size: 13px; }
.lineage-list button { color: var(--paper); background: transparent; border: 0; padding: 0; text-align: left; font-family: var(--serif); font-size: 27px; }
.lineage-list small { display: block; margin-top: 6px; color: var(--muted); font-family: var(--sans); font-size: 13px; }
.place-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.place-chip { padding: 14px 18px; color: var(--paper); background: var(--panel); border: 1px solid rgba(214,162,58,.35); border-radius: 999px; }
.place-chip b { color: var(--gold-light); }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.archive-card { min-height: 330px; display: grid; grid-template-rows: 240px auto; padding: 0; color: var(--paper); text-align: left; overflow: hidden; background: var(--panel); border: 1px solid rgba(232,224,210,.12); border-radius: 15px; }
.archive-card img { width: 100%; height: 240px; object-fit: cover; filter: sepia(.28) contrast(.9); transition: transform .35s ease; }
.archive-card:hover img { transform: scale(1.025); }
.archive-card > span { display: grid; gap: 5px; padding: 15px; }
.archive-card small { color: var(--muted); }

.search-results { position: fixed; z-index: 60; top: 68px; right: 28px; width: min(430px, calc(100vw - 30px)); max-height: 65vh; overflow: auto; padding: 9px; background: #151613; border: 1px solid rgba(214,162,58,.45); border-radius: 14px; box-shadow: 0 22px 70px rgba(0,0,0,.65); }
.search-result { width: 100%; display: grid; gap: 4px; padding: 13px; color: var(--paper); text-align: left; background: transparent; border: 0; border-radius: 9px; }
.search-result:hover { background: rgba(214,162,58,.11); }
.search-result small { color: var(--muted); }
.no-result { margin: 10px; color: var(--muted); }

dialog { color: var(--paper); background: #11120f; border: 1px solid rgba(214,162,58,.5); box-shadow: 0 30px 120px rgba(0,0,0,.8); }
dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(10px); }
.identity-dialog { width: min(620px, calc(100vw - 28px)); padding: 0; border-radius: 22px; }
.identity-dialog form { position: relative; display: grid; gap: 21px; padding: clamp(30px, 5vw, 56px); }
.identity-dialog h2 { font-size: clamp(36px, 6vw, 62px); line-height: 1; }
.identity-dialog label { display: grid; gap: 8px; }
.identity-dialog label span { color: #c9c0af; font-size: 14px; }
.identity-dialog input { width: 100%; padding: 14px 0; color: var(--paper); background: transparent; border: 0; border-bottom: 1px solid #686153; outline: 0; }
.identity-dialog input:focus { border-bottom-color: var(--gold); }
.dialog-close, .document-close { position: absolute; z-index: 2; top: 12px; right: 12px; display: grid; place-items: center; width: 40px; height: 40px; color: var(--paper); background: rgba(0,0,0,.5); border: 1px solid rgba(232,224,210,.22); border-radius: 50%; font-size: 24px; }
.gold-button { justify-self: start; padding: 13px 18px; color: #18140d; background: var(--gold); border: 0; border-radius: 999px; font-weight: 750; }
.privacy-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.person-dialog { width: min(1120px, calc(100vw - 28px)); max-height: 92vh; padding: 0; overflow: auto; border-radius: 28px; }
.person-dialog-close { position: fixed; top: max(20px, calc(4vh + 8px)); right: max(20px, calc((100vw - min(1120px, 100vw - 28px)) / 2 + 16px)); }
.person-dialog-content { min-height: 620px; }
.person-sheet { display: grid; grid-template-columns: minmax(270px, .78fr) minmax(430px, 1.22fr); gap: 0; background: radial-gradient(circle at 20% 12%, rgba(214,162,58,.12), transparent 28%), #10110f; }
.person-sheet-portrait { min-height: 500px; display: grid; grid-template-rows: 1fr auto; gap: 16px; padding: clamp(28px, 4vw, 48px); background: linear-gradient(160deg, rgba(112,99,74,.42), rgba(13,15,12,.95) 72%); border-right: 1px solid rgba(214,162,58,.24); }
.person-dialog-image { width: 100%; height: 100%; min-height: 370px; object-fit: cover; object-position: center 24%; border-radius: 18px; filter: sepia(.16) contrast(.96); }
.person-dialog-monogram { place-self: center; display: grid; place-items: center; width: min(220px, 80%); aspect-ratio: .82; color: #241f17; background: linear-gradient(145deg, #d8c8a8, #8d816b); border-radius: 49% 49% 44% 44%; font-family: var(--serif); font-size: 76px; box-shadow: inset 0 0 50px rgba(0,0,0,.2), 0 24px 60px rgba(0,0,0,.35); }
.person-sheet-portrait p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.person-sheet-main { padding: clamp(40px, 5vw, 68px) clamp(34px, 5vw, 70px) 48px; }
.person-sheet-status { margin: 0 0 14px; color: var(--gold-light); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.person-sheet-main h2 { max-width: 13ch; margin: 0; font-family: var(--serif); font-size: clamp(44px, 5.5vw, 72px); font-weight: 400; line-height: .93; letter-spacing: -.04em; }
.person-sheet-years { margin: 20px 0 28px; color: var(--gold-light); font-family: var(--serif); font-size: 30px; letter-spacing: .03em; }
.person-card-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 28px; }
.person-card-tabs a { padding: 7px 10px; color: #cbc3b5; text-decoration: none; background: rgba(255,255,255,.03); border: 1px solid rgba(232,224,210,.12); border-radius: 999px; font-size: 11px; }
.person-card-tabs a:hover, .person-card-tabs a:focus-visible { color: var(--gold-light); border-color: var(--gold); outline: 0; }
.person-sheet-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 30px; }
.person-sheet-facts p { min-width: 0; margin: 0; padding: 13px 0; border-top: 1px solid rgba(232,224,210,.16); }
.person-sheet-facts span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.person-sheet-facts strong { display: block; color: var(--paper); font-size: 14px; line-height: 1.45; }
.person-story h3, .person-sheet-section h3 { margin: 0 0 12px; color: var(--gold-light); font-family: var(--serif); font-size: 25px; font-weight: 400; }
.person-story p { max-width: 66ch; margin: 0; color: #d4ccbd; font-family: var(--serif); font-size: 19px; line-height: 1.65; }
.dialog-play-story { margin-top: 24px; display: inline-flex; align-items: center; gap: 9px; padding: 10px 13px; color: var(--gold-light); background: transparent; border: 1px solid rgba(214,162,58,.44); border-radius: 999px; }
.dialog-play-story span { display: grid; place-items: center; width: 25px; height: 25px; color: #1d180f; background: var(--gold-light); border-radius: 50%; font-size: 10px; }
.dialog-play-story small { color: var(--muted); }
.person-sheet-section { grid-column: 1 / -1; padding: 34px clamp(28px, 5vw, 68px) 40px; border-top: 1px solid rgba(232,224,210,.12); }
.person-sheet-section > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.person-detail-grid p { min-height: 92px; display: grid; align-content: center; gap: 6px; margin: 0; padding: 16px 18px; background: rgba(255,255,255,.024); border: 1px solid rgba(232,224,210,.1); border-radius: 13px; }
.person-detail-grid span { color: var(--gold-light); font-size: 10px; }
.person-detail-grid strong { color: var(--paper); font-size: 14px; font-weight: 500; line-height: 1.45; }
.person-interesting > div { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.interesting-fact { min-height: 150px; display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-content: start; margin: 0; padding: 19px; background: linear-gradient(140deg, rgba(214,162,58,.09), rgba(255,255,255,.018)); border: 1px solid rgba(214,162,58,.24); border-radius: 16px; }
.interesting-fact span { color: var(--gold); font-family: var(--serif); font-size: 24px; }
.interesting-fact p { margin: 3px 0 0; color: #ddd5c7; font-family: var(--serif); font-size: 17px; line-height: 1.48; }
.person-relations button { min-height: 112px; display: grid; align-content: center; gap: 5px; padding: 17px; color: var(--paper); text-align: left; background: rgba(255,255,255,.025); border: 1px solid rgba(214,162,58,.28); border-radius: 14px; }
.person-relations button:hover, .person-relations button:focus-visible { border-color: var(--gold); outline: 0; }
.person-relations button span { color: var(--gold-light); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.person-relations button strong { font-family: var(--serif); font-size: 19px; font-weight: 400; line-height: 1.12; }
.person-relations button small { color: var(--muted); }
.person-document { min-height: 94px; display: grid; grid-template-columns: 76px 1fr; gap: 13px; align-items: center; padding: 9px; color: var(--paper); text-align: left; background: rgba(255,255,255,.025); border: 1px solid rgba(232,224,210,.12); border-radius: 12px; }
.person-document img { width: 76px; height: 74px; object-fit: cover; border-radius: 8px; filter: sepia(.24); }
.person-document span { display: grid; gap: 5px; }
.person-document small, .person-dialog-empty { color: var(--muted); line-height: 1.45; }
.document-dialog { width: min(1150px, calc(100vw - 24px)); max-height: 94vh; padding: 0; border-radius: 12px; }
.document-dialog img { display: block; width: 100%; max-height: 80vh; object-fit: contain; background: #060706; }
.document-caption { display: grid; gap: 5px; padding: 16px 20px 20px; }
.document-caption span { color: var(--muted); }
.family-assistant { position: fixed; z-index: 80; left: 50%; bottom: 14px; width: min(760px, calc(100vw - 28px)); transform: translateX(-50%); }
.assistant-panel { margin-bottom: 10px; overflow: hidden; background: rgba(15,16,14,.98); border: 1px solid rgba(214,162,58,.55); border-radius: 22px; box-shadow: 0 28px 90px rgba(0,0,0,.72); backdrop-filter: blur(20px); }
.assistant-panel header { min-height: 66px; display: grid; grid-template-columns: 42px 1fr 34px; align-items: center; gap: 11px; padding: 10px 14px; border-bottom: 1px solid rgba(232,224,210,.1); }
.assistant-panel header div { display: grid; gap: 2px; }
.assistant-panel header strong { font-family: var(--serif); font-size: 19px; font-weight: 400; }
.assistant-panel header small { color: var(--muted); font-size: 11px; }
.assistant-panel header button { width: 34px; height: 34px; color: var(--muted); background: transparent; border: 0; border-radius: 50%; font-size: 22px; }
.assistant-avatar { display: grid; place-items: center; width: 42px; height: 42px; color: #211b11; background: linear-gradient(145deg, var(--gold-light), #9b7130); border-radius: 50%; font-family: var(--serif); font-size: 22px; box-shadow: inset 0 0 14px rgba(255,255,255,.16); }
.assistant-messages { max-height: min(360px, 50vh); display: flex; flex-direction: column; gap: 9px; overflow-y: auto; padding: 15px; }
.assistant-message { width: fit-content; max-width: min(620px, 88%); padding: 11px 13px; border-radius: 15px; font-size: 14px; line-height: 1.48; white-space: pre-wrap; }
.assistant-message-oleg { align-self: flex-start; color: #ded6c8; background: rgba(255,255,255,.055); border: 1px solid rgba(232,224,210,.09); border-bottom-left-radius: 5px; }
.assistant-message-user { align-self: flex-end; color: #1d180f; background: var(--gold-light); border-bottom-right-radius: 5px; }
.assistant-message button { display: block; margin-top: 9px; padding: 8px 11px; color: var(--gold-light); background: transparent; border: 1px solid rgba(214,162,58,.5); border-radius: 999px; font-size: 12px; }
.assistant-bar { min-height: 62px; display: grid; grid-template-columns: 42px auto 1fr auto; align-items: center; gap: 11px; padding: 9px 10px; background: rgba(13,14,12,.96); border: 1px solid rgba(214,162,58,.62); border-radius: 999px; box-shadow: 0 18px 60px rgba(0,0,0,.68), 0 0 28px rgba(214,162,58,.08); backdrop-filter: blur(18px); }
.assistant-bar label { color: var(--gold-light); font-family: var(--serif); font-size: 16px; white-space: nowrap; }
.assistant-bar input { width: 100%; min-width: 0; padding: 9px 4px; color: var(--paper); background: transparent; border: 0; outline: 0; }
.assistant-bar input::placeholder { color: #777064; }
.assistant-bar button { min-height: 42px; padding: 0 17px; color: #1b160d; background: var(--gold-light); border: 0; border-radius: 999px; font-weight: 750; }
.mobile-family-switcher { display: none; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: 96px; max-width: calc(100vw - 32px); padding: 11px 16px; color: var(--black); background: var(--gold-light); border-radius: 999px; opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 210px 1fr; }
  .main-nav { justify-content: end; }
  .top-actions { grid-column: 1 / -1; padding-bottom: 4px; }
  .search-box { width: min(520px, 100%); }
  .family-map { grid-template-columns: minmax(180px,.72fr) minmax(520px,1.8fr) minmax(180px,.72fr); column-gap: 25px; }
  .relative-card { width: 230px; grid-template-columns: 64px 1fr 12px; }
  .relative-avatar { width: 64px; height: 78px; }
}
@media (max-width: 1280px) {
  .topbar { position: relative; grid-template-columns: 1fr auto; min-height: 68px; }
  .main-nav { grid-column: 1 / -1; overflow-x: auto; justify-content: start; padding-bottom: 5px; }
  .top-actions { grid-column: 1 / -1; }
  .family-stage { min-height: auto; padding-top: 30px; }
  .stage-heading { align-items: start; flex-direction: column; }
  .family-map { min-height: 0; display: block; }
  .focus-card { height: auto; min-height: 500px; overflow: visible; }
  .relative-slot, .family-connectors { display: none; }
  .mobile-relatives { position: relative; z-index: 2; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 76vw); gap: 10px; margin: 20px -18px 0; padding: 0 18px 12px; overflow-x: auto; scroll-snap-type: x proximity; }
  .mobile-relatives .relative-card { width: 100%; scroll-snap-align: start; }
}
@media (max-width: 620px) {
  .topbar { padding: 10px 14px; }
  .brand small { display: none; }
  .brand strong { font-size: 18px; }
  .brand-tree { width: 38px; height: 38px; }
  .profile-button { font-size: 12px; }
  .nav-item { padding: 8px 11px; font-size: 13px; }
  .search-box { width: 100%; }
  .family-stage { padding-left: 14px; padding-right: 14px; }
  .stage-heading h1 { font-size: 38px; }
  .focus-card { height: auto; min-height: 0; grid-template-columns: 1fr; gap: 14px; padding: 13px; border-radius: 21px; overflow: visible; }
  .focus-copy { order: -1; }
  .portrait-panel { min-height: 180px; grid-template-rows: 1fr auto; }
  .monogram { width: 110px; height: 130px; font-size: 40px; }
  .focus-copy { padding: 5px 4px 7px; }
  .focus-copy h2, .focus-copy h2.long-name { max-width: 100%; font-size: 36px; }
  .story-short { -webkit-line-clamp: 4; }
  .focus-actions { margin-top: 20px; align-items: center; }
  .focus-buttons { flex-wrap: wrap; }
  .media-thumb { width: 48px; height: 42px; }
  .mobile-relatives { margin-left: -14px; margin-right: -14px; padding-left: 14px; }
  .panel-view { padding-top: 44px; }
  .panel-copy h2 { font-size: 46px; }
  .tree-shell { margin-left: -12px; margin-right: -12px; border-radius: 0; }
  .tree-toolbar { min-height: 64px; padding: 9px 10px 9px 14px; }
  .tree-selected-copy strong { max-width: 135px; font-size: 15px; }
  .tree-controls { gap: 4px; }
  .tree-controls button { min-width: 34px; height: 34px; }
  .tree-controls output { width: 42px; font-size: 10px; }
  .tree-controls .tree-fit { padding: 0 9px; font-size: 10px; }
  .tree-viewport { height: 64vh; min-height: 470px; }
  .tree-gesture-hint { width: max-content; max-width: calc(100% - 24px); text-align: center; }
  .lineage-list li { grid-template-columns: 72px 1fr; gap: 15px; }
  .person-dialog { width: calc(100vw - 16px); max-height: 96vh; border-radius: 18px; }
  .person-dialog-close { top: 14px; right: 14px; }
  .person-sheet { grid-template-columns: 1fr; }
  .person-sheet-portrait { min-height: 320px; padding: 42px 26px 28px; border-right: 0; border-bottom: 1px solid rgba(214,162,58,.24); }
  .person-dialog-image { min-height: 260px; max-height: 58vh; }
  .person-dialog-monogram { width: 150px; font-size: 52px; }
  .person-sheet-main { padding: 34px 24px 38px; }
  .person-sheet-main h2 { font-size: 46px; }
  .person-sheet-facts { grid-template-columns: 1fr; }
  .person-sheet-section { padding: 28px 22px 34px; }
  body { padding-bottom: 146px; }
  .family-assistant { bottom: 8px; width: calc(100vw - 16px); }
  .assistant-bar { min-height: 58px; grid-template-columns: 38px 1fr auto; gap: 8px; padding: 8px; }
  .assistant-bar .assistant-avatar { width: 38px; height: 38px; font-size: 19px; }
  .assistant-bar label { display: none; }
  .assistant-bar button { min-height: 38px; padding: 0 13px; font-size: 12px; }
  .assistant-message { max-width: 92%; }
  .mobile-family-switcher { position: fixed; z-index: 79; left: 8px; right: 8px; bottom: 74px; display: block; }
  .mobile-family-trigger { width: 100%; min-height: 58px; display: grid; grid-template-columns: 1fr 34px; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; color: var(--paper); text-align: left; background: rgba(24,25,21,.97); border: 1px solid rgba(214,162,58,.45); border-radius: 16px; box-shadow: 0 14px 38px rgba(0,0,0,.58); backdrop-filter: blur(16px); }
  .mobile-family-trigger span { min-width: 0; display: grid; gap: 2px; }
  .mobile-family-trigger small { color: var(--muted); font-size: 10px; }
  .mobile-family-trigger strong { overflow: hidden; font-family: var(--serif); font-size: 15px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-family-trigger b { display: grid; place-items: center; width: 34px; height: 34px; color: #1e180f; background: var(--gold-light); border-radius: 50%; font-size: 12px; }
  .mobile-family-sheet { position: absolute; left: 0; right: 0; bottom: 65px; max-height: min(62vh, 540px); overflow: hidden; background: rgba(15,16,14,.99); border: 1px solid rgba(214,162,58,.58); border-radius: 22px; box-shadow: 0 24px 90px rgba(0,0,0,.78); }
  .mobile-family-sheet header { min-height: 62px; display: grid; grid-template-columns: 1fr 38px; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid rgba(232,224,210,.1); }
  .mobile-family-sheet header div { min-width: 0; display: grid; gap: 2px; }
  .mobile-family-sheet header small { color: var(--gold-light); font-size: 10px; }
  .mobile-family-sheet header strong { overflow: hidden; font-family: var(--serif); font-size: 17px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-family-sheet header button { width: 38px; height: 38px; color: var(--paper); background: transparent; border: 1px solid rgba(232,224,210,.14); border-radius: 50%; font-size: 22px; }
  .mobile-family-list { max-height: calc(min(62vh, 540px) - 62px); display: grid; gap: 8px; overflow-y: auto; padding: 10px; }
  .mobile-family-list .relative-card { width: 100%; min-height: 112px; grid-template-columns: 68px 1fr 18px; }
  .mobile-family-list .relative-avatar { width: 68px; height: 86px; }
  .mobile-family-list .empty-relation { width: 100%; padding: 28px; }
  .mobile-sheet-open::after { content: ""; position: fixed; z-index: 78; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
  .toast { bottom: 146px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 2026-11-26: family photo-album direction */
:root {
  --album-paper: #eee8dc;
  --album-paper-deep: #ddd4c4;
  --album-ink: #1a211e;
  --album-green: #20382f;
  --album-rust: #a64f3a;
  --album-blue: #34586b;
}

.topbar {
  min-height: 66px;
  color: var(--album-ink);
  background: rgba(238, 232, 220, .96);
  border-bottom-color: rgba(26, 33, 30, .16);
  box-shadow: 0 8px 28px rgba(20, 25, 22, .08);
}
.brand-tree { color: var(--album-paper); background: var(--album-green); border-radius: 12px 12px 4px 12px; transform: none; }
.brand small, .nav-item, .search-box { color: #675f55; }
.brand strong { color: var(--album-ink); }
.nav-item:hover, .nav-item:focus-visible { color: var(--album-ink); border-color: rgba(26,33,30,.2); }
.nav-item.active { color: var(--album-paper); background: var(--album-green); border-color: var(--album-green); }
.search-box { background: rgba(255,255,255,.48); border-color: rgba(26,33,30,.18); border-radius: 10px; }
.search-box input { color: var(--album-ink); }
.search-box input::placeholder { color: #81796d; }
.profile-button { color: var(--album-rust); border-color: rgba(166,79,58,.34); border-radius: 10px; }

.family-stage {
  min-height: calc(100vh - 66px);
  padding-top: 18px;
  background:
    linear-gradient(rgba(32,56,47,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32,56,47,.045) 1px, transparent 1px),
    var(--album-paper);
  background-size: 32px 32px, 32px 32px, auto;
}
.family-stage::before, .family-stage::after, .forest-glow { display: none; }
.stage-heading { margin-bottom: 8px; align-items: center; }
.stage-heading h1 { color: var(--album-ink); font-size: clamp(31px, 3.2vw, 48px); letter-spacing: -.035em; }
.eyebrow { margin-bottom: 5px; color: var(--album-rust); font-size: 10px; letter-spacing: .09em; }
.stage-summary { max-width: 460px; display: grid; gap: 4px; padding-left: 18px; border-left: 3px solid var(--album-rust); }
.stage-summary strong { color: var(--album-green); font-size: 13px; }
.stage-note { color: #6e675d; font-size: 13px; line-height: 1.4; }

.family-map { min-height: 790px; grid-template-rows: 122px 520px 122px; gap: 6px clamp(16px, 3.2vw, 54px); }
.focus-card {
  height: 520px;
  min-height: 520px;
  grid-template-columns: minmax(255px, .88fr) minmax(380px, 1.12fr);
  padding: 14px;
  background: var(--album-green);
  border: 0;
  border-radius: 8px 28px 28px 8px;
  box-shadow: 0 20px 48px rgba(29,36,32,.28), 13px 13px 0 rgba(166,79,58,.16);
}
.focus-card::before { content: ""; position: absolute; z-index: 5; left: -8px; top: 38px; width: 22px; height: 104px; background: repeating-linear-gradient(180deg, #95866f 0 7px, #c7baa5 7px 13px); border-radius: 4px; box-shadow: 0 215px 0 #9d8b72; }
.focus-card::after { inset: 10px; border-color: rgba(238,232,220,.13); border-radius: 4px 20px 20px 4px; }
.portrait-panel { padding: 12px; background: #d4cab9; border-radius: 3px; transform: rotate(-.6deg); box-shadow: 0 12px 28px rgba(0,0,0,.25); }
.portrait-image { border-radius: 2px; filter: sepia(.13) contrast(1.02); }
.portrait-note { color: #4e4a43; }
.monogram { border-radius: 2px; background: #b7aa93; box-shadow: none; }
.focus-copy { padding: 13px 16px 8px 12px; }
.focus-kicker { color: #e3bda9; text-transform: none; letter-spacing: .02em; }
.focus-copy h2 { max-width: 15ch; color: #f5eee2; font-size: clamp(38px, 2.75vw, 53px); line-height: .94; }
.life-years strong { color: #efc98b; }
.life-years span, .fact, .story-short { color: #d7d4c8; }
.focus-fact { background: rgba(238,232,220,.08); border-left-color: #d77a5f; }
.focus-fact span { color: #efc98b; }
.open-card-button { color: #f8f1e5; background: var(--album-rust); border-color: var(--album-rust); border-radius: 8px; }
.open-card-button:hover, .open-card-button:focus-visible { background: #bd614b; }
.play-button { color: #f1d8b2; }
.play-icon { border-color: rgba(241,216,178,.6); }

.relative-card {
  width: 252px;
  min-height: 118px;
  grid-template-columns: 72px 1fr 14px;
  gap: 12px;
  padding: 10px;
  color: var(--album-ink);
  background: rgba(250,247,240,.94);
  border: 1px solid rgba(32,56,47,.22);
  border-radius: 5px;
  box-shadow: 0 10px 25px rgba(31,39,35,.12);
}
.relative-card:hover, .relative-card:focus-visible { transform: translateY(-2px) rotate(-.3deg); border-color: var(--album-rust); background: #fffaf0; }
.relative-avatar { width: 72px; height: 92px; border-radius: 2px; filter: sepia(.2); }
.relative-copy strong { color: var(--album-ink); font-size: 18px; }
.relation-label { color: var(--album-rust); text-transform: none; letter-spacing: .02em; }
.relative-copy .relative-years { color: var(--album-blue); }
.relative-copy .relative-place { color: #726a5f; }
.relative-arrow { color: var(--album-rust); }
.empty-relation { color: #8b8174; }
.family-connectors path { stroke: rgba(32,56,47,.5); }
.family-connectors circle { fill: var(--album-rust); filter: none; }

.family-assistant { left: auto; right: 22px; bottom: 18px; width: min(340px, calc(100vw - 28px)); transform: none; }
.assistant-panel { background: rgba(27,43,37,.985); border-color: rgba(238,232,220,.28); border-radius: 16px; box-shadow: 0 24px 56px rgba(20,27,24,.35); }
.assistant-bar { min-height: 56px; grid-template-columns: 38px 1fr auto; gap: 8px; padding: 8px; background: var(--album-green); border: 0; border-radius: 14px; box-shadow: 0 14px 36px rgba(20,27,24,.3); }
.assistant-bar label { display: none; }
.assistant-avatar { width: 38px; height: 38px; color: #fff6e9; background: var(--album-rust); border-radius: 9px; box-shadow: none; }
.assistant-bar button { min-height: 38px; color: #fff8ed; background: var(--album-rust); border-radius: 8px; }
.assistant-message-user { color: #fff8ed; background: var(--album-rust); }

.archive-inbox { max-width: 1600px; margin: 0 0 34px; padding: 20px; background: rgba(166,79,58,.08); border: 1px solid rgba(166,79,58,.28); border-radius: 18px; }
.archive-inbox > header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.archive-inbox > header div { display: grid; gap: 3px; }
.archive-inbox > header small { color: var(--gold-light); }
.archive-inbox > header strong { font-family: var(--serif); font-size: 27px; font-weight: 400; }
.archive-inbox > header span { color: var(--muted); font-size: 12px; }
.incoming-card { border-color: rgba(166,79,58,.35); }

.archive-view {
  color: var(--album-ink);
  background:
    linear-gradient(rgba(32,56,47,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32,56,47,.045) 1px, transparent 1px),
    var(--album-paper);
  background-size: 32px 32px, 32px 32px, auto;
}
.archive-view .panel-copy { max-width: 900px; }
.archive-view .panel-copy h2 { color: var(--album-ink); font-size: clamp(42px, 5vw, 70px); line-height: 1; }
.archive-view .panel-copy p:last-child { max-width: 760px; color: #6e675d; }
.archive-view .archive-inbox { background: rgba(166,79,58,.08); border-color: rgba(166,79,58,.28); }
.archive-view .archive-inbox > header small,
.archive-view .archive-inbox > header span { color: var(--album-rust); }
.archive-view .archive-inbox > header strong { color: var(--album-ink); }
.archive-view .archive-card {
  color: var(--album-ink);
  background: rgba(255,252,245,.95);
  border-color: rgba(32,56,47,.18);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(31,39,35,.1);
}
.archive-view .archive-card img { filter: sepia(.12) contrast(.98); }
.archive-view .archive-card small { color: #70685d; }

.identity-dialog {
  width: min(940px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  color: var(--album-ink);
  background: var(--album-paper);
  border: 1px solid rgba(238,232,220,.7);
  border-radius: 8px 28px 28px 8px;
  box-shadow: 0 38px 120px rgba(8,19,15,.55);
}
.identity-dialog::backdrop,
.family-loader::backdrop {
  background: rgba(14,29,23,.84);
  backdrop-filter: blur(13px) saturate(.75);
}
.identity-dialog form {
  min-height: 570px;
  display: grid;
  grid-template-columns: minmax(285px,.78fr) minmax(430px,1.22fr);
  gap: 0;
  padding: 0;
}
.identity-intro {
  position: relative;
  display: grid;
  align-content: end;
  gap: 14px;
  padding: 48px 40px;
  overflow: hidden;
  color: #f5eee2;
  background:
    radial-gradient(circle at 35% 18%, rgba(239,201,139,.18), transparent 24%),
    linear-gradient(155deg, #29483c, #172c24 72%);
}
.identity-intro::before {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(245,238,226,.18);
  border-radius: 50% 50% 8px 8px;
  transform: rotate(-5deg);
}
.identity-mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 104px;
  aspect-ratio: 1;
  margin-bottom: auto;
  color: #213b31;
  background: #e7d6b7;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 58px;
  box-shadow: 0 14px 30px rgba(0,0,0,.2);
}
.identity-intro p,
.identity-intro strong { position: relative; z-index: 1; margin: 0; }
.identity-intro p { color: #d9cdbb; font-size: 13px; }
.identity-intro strong { max-width: 12ch; font-family: var(--serif); font-size: 38px; font-weight: 400; line-height: 1.04; }
.identity-fields {
  display: grid;
  align-content: center;
  gap: 22px;
  padding: clamp(42px,6vw,72px);
}
.identity-fields .eyebrow { margin: 0; }
.identity-fields h2 {
  max-width: 11ch;
  margin: 0;
  color: var(--album-ink);
  font-size: clamp(48px,6vw,72px);
  line-height: .9;
  letter-spacing: -.045em;
}
.identity-lead { max-width: 48ch; margin: 0; color: #655e54; font-size: 15px; line-height: 1.55; }
.identity-fields label { display: grid; gap: 9px; }
.identity-fields label span { color: var(--album-green); font-size: 13px; font-weight: 750; }
.identity-dialog .identity-fields input {
  width: 100%;
  padding: 15px 0 12px;
  color: var(--album-ink);
  background: transparent;
  border: 0;
  border-bottom: 2px solid rgba(32,56,47,.28);
  border-radius: 0;
  outline: 0;
  font-family: var(--serif);
  font-size: clamp(20px,2.2vw,28px);
}
.identity-dialog .identity-fields input:focus { border-bottom-color: var(--album-rust); }
.identity-dialog .identity-fields input::placeholder { color: #a59c8d; }
.identity-dialog .gold-button {
  justify-self: start;
  padding: 13px 18px;
  color: #fff8ed;
  background: var(--album-rust);
  border-radius: 7px;
}
.identity-error { margin: -10px 0 0; color: #9b392b; font-size: 13px; line-height: 1.45; }
.identity-fields .privacy-note { max-width: 52ch; color: #7b7368; }

.family-loader {
  width: min(930px, calc(100vw - 32px));
  padding: 14px;
  overflow: hidden;
  color: #f5eee2;
  background: #1d382e;
  border: 1px solid rgba(239,201,139,.24);
  border-radius: 8px 28px 28px 8px;
  box-shadow: 0 38px 120px rgba(8,19,15,.62);
}
.family-loader[open] { display: grid; grid-template-columns: minmax(280px,.78fr) minmax(420px,1.22fr); gap: 0; }
.loader-portrait {
  min-height: 520px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #cfc3b0 center / cover no-repeat;
  border-radius: 3px;
  box-shadow: inset 0 0 0 10px rgba(247,241,230,.5);
}
.loader-portrait.has-photo span { display: none; }
.loader-portrait span { color: #2b3933; font-family: var(--serif); font-size: 94px; }
.loader-copy {
  display: grid;
  align-content: center;
  gap: 20px;
  padding: clamp(36px,5vw,66px);
}
.loader-copy .eyebrow { margin: 0; color: #e5bda4; }
.loader-copy h2 { max-width: 11ch; margin: 0; color: #fff8eb; font-size: clamp(42px,5.3vw,66px); line-height: .93; letter-spacing: -.04em; }
.loader-status { margin: 0; color: #d7cfc0; font-size: 13px; }
.loader-copy blockquote {
  min-height: 92px;
  margin: 4px 0 0;
  padding: 18px 0 0 22px;
  color: #f2dfbd;
  border-left: 3px solid var(--album-rust);
  font-family: var(--serif);
  font-size: clamp(20px,2.2vw,28px);
  line-height: 1.35;
}
.loader-progress { height: 6px; overflow: hidden; background: rgba(255,255,255,.12); border-radius: 999px; }
.loader-progress span { display: block; width: 0; height: 100%; background: #d6785e; border-radius: inherit; }
.family-entry-loading .loader-progress span { animation: family-entry-progress 12s linear forwards; }
.loader-time { margin: 0; color: #aeb8b0; font-size: 11px; line-height: 1.5; }
@keyframes family-entry-progress { to { width: 100%; } }

@media (max-width: 720px) {
  .identity-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); border-radius: 6px 20px 20px 6px; }
  .identity-dialog form { min-height: 0; grid-template-columns: 1fr; }
  .identity-intro { min-height: 148px; align-content: end; padding: 24px; }
  .identity-intro::before { inset: 16px; }
  .identity-mark { position: absolute; top: 20px; right: 22px; width: 58px; font-size: 31px; }
  .identity-intro strong { max-width: 16ch; font-size: 28px; }
  .identity-fields { gap: 15px; padding: 28px 24px 30px; }
  .identity-fields h2 { font-size: 43px; }
  .identity-lead { font-size: 13px; }
  .identity-dialog .identity-fields input { font-size: 20px; }
  .family-loader { width: calc(100vw - 20px); max-height: calc(100vh - 20px); padding: 9px; border-radius: 6px 20px 20px 6px; }
  .family-loader[open] { grid-template-columns: 1fr; }
  .loader-portrait { min-height: 210px; max-height: 30vh; background-position: center 24%; }
  .loader-copy { gap: 13px; padding: 25px 22px 28px; }
  .loader-copy h2 { font-size: 40px; }
  .loader-copy blockquote { min-height: 72px; font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .family-entry-loading .loader-progress span { animation-timing-function: steps(4,end); }
}

@media (min-width: 981px) and (max-width: 1280px) {
  .topbar { position: sticky; grid-template-columns: 190px 1fr minmax(280px, 340px); gap: 12px; }
  .main-nav { grid-column: auto; justify-content: center; padding: 0; }
  .top-actions { grid-column: auto; padding: 0; }
  .search-box { width: 100%; }
  .family-stage { min-height: calc(100vh - 66px); padding-top: 12px; }
  .stage-heading { align-items: center; flex-direction: row; }
  .stage-heading h1 { font-size: 36px; }
  .family-map { min-height: 625px; margin-top: 22px; display: grid; grid-template-columns: 195px minmax(510px, 1fr) 195px; grid-template-rows: 112px 415px 76px; column-gap: 20px; }
  .focus-card { height: 415px; min-height: 415px; grid-template-columns: minmax(210px,.78fr) minmax(340px,1.22fr); overflow: hidden; }
  .relative-slot, .family-connectors { display: block; }
  .mobile-relatives { display: none; }
  .relative-card { width: 210px; min-height: 104px; grid-template-columns: 58px 1fr 10px; }
  .relative-avatar { width: 58px; height: 76px; }
  .relative-copy strong { font-size: 15px; }
  .focus-copy { padding-top: 8px; }
  .focus-copy h2, .focus-copy h2.long-name { font-size: 36px; }
  .life-years { margin: 7px 0 9px; }
  .story-short { margin-top: 8px; font-size: 14px; }
  .focus-fact { margin-top: 7px; padding: 7px 9px; }
  .focus-actions { padding-top: 8px; }
  .portrait-panel { padding: 9px; }
  .family-assistant { width: min(300px, calc(100vw - 28px)); }
  .assistant-panel { width: min(380px, calc(100vw - 28px)); margin-left: min(-80px, calc(100vw - 380px)); }
  .assistant-bar input::placeholder { color: #aaa396; }
}

@media (max-width: 980px) {
  .topbar { position: relative; grid-template-columns: 1fr auto; }
  .main-nav { grid-column: 1 / -1; overflow-x: auto; justify-content: start; }
  .top-actions { grid-column: 1 / -1; }
  .stage-heading { align-items: start; flex-direction: column; }
  .stage-summary { padding-left: 12px; }
  .family-map { min-height: 0; display: block; }
  .focus-card { height: auto; min-height: 500px; overflow: visible; }
  .relative-slot, .family-connectors { display: none; }
  .mobile-relatives { position: relative; z-index: 2; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 76vw); gap: 10px; margin: 20px -18px 0; padding: 0 18px 12px; overflow-x: auto; }
}

@media (max-width: 620px) {
  .family-stage { padding-top: 16px; }
  .stage-heading h1 { font-size: 34px; }
  .stage-summary { border-left-width: 2px; }
  .focus-card { min-height: 0; grid-template-columns: 1fr; border-radius: 6px 20px 20px 6px; }
  .focus-card::before { display: none; }
  .focus-copy { order: -1; }
  .family-assistant { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .archive-inbox { margin-left: -8px; margin-right: -8px; padding: 14px; }
  .archive-inbox > header { align-items: start; flex-direction: column; gap: 5px; }
}

/* Читаемый семейный треугольник: папа и мама сверху, выбранный ребёнок по центру. */
.focus-relation-badge {
  position: absolute;
  z-index: 8;
  top: 14px;
  left: 50%;
  min-width: 116px;
  padding: 8px 18px;
  color: #20382f;
  text-align: center;
  background: #f4e8d1;
  border: 2px solid #20382f;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(10,24,19,.22);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  transform: translateX(-50%);
}
.relative-card.relation-father,
.relative-card.relation-mother {
  border-width: 2px;
  box-shadow: 0 16px 34px rgba(31,39,35,.16);
}
.relative-card.relation-father .relation-label,
.relative-card.relation-mother .relation-label {
  margin-bottom: 8px;
  padding: 5px 10px;
  color: #fffaf1;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}
.relative-card.relation-father .relation-label { background: #315f6c; }
.relative-card.relation-mother .relation-label { background: #a64f3a; }
.family-connectors path {
  stroke: #a64f3a;
  stroke-width: 3.2;
  filter: drop-shadow(0 3px 4px rgba(166,79,58,.22));
}
.family-connectors circle { fill: #20382f; filter: none; }

@media (min-width: 1401px) {
  .family-map {
    width: min(1320px, 100%);
    min-height: 900px;
    margin-top: 12px;
    grid-template-columns: minmax(0,1fr) minmax(220px,300px) 86px minmax(220px,300px) minmax(0,1fr);
    grid-template-rows: 156px 500px minmax(150px,auto);
    grid-template-areas:
      ". parentLeft . parentRight ."
      "siblingLeft focus focus focus spouseRight"
      ". childrenRow childrenRow childrenRow .";
    column-gap: 18px;
    row-gap: 34px;
  }
  .parent-left { justify-self: stretch; align-self: end; }
  .parent-right { justify-self: stretch; align-self: end; }
  .parent-left .relative-card,
  .parent-right .relative-card { width: 100%; min-height: 142px; }
  .focus-card {
    width: min(790px,100%);
    height: 500px;
    min-height: 500px;
    justify-self: center;
    align-self: start;
    grid-template-columns: minmax(240px,.78fr) minmax(360px,1.22fr);
    padding-top: 54px;
    overflow: visible;
  }
  .focus-card::after { top: 44px; }
  .focus-card::before { top: 70px; }
  .sibling-left,
  .spouse-right { display: block; width: 100%; align-self: center; }
  .sibling-left { justify-self: end; padding-right: 16px; }
  .spouse-right { justify-self: start; padding-left: 16px; }
  .children-row { display: block; width: 100%; padding-top: 20px; }
  .relative-slot.parent-left,
  .relative-slot.parent-right,
  .family-connectors { display: block; }
}

@media (min-width: 1401px) and (max-width: 1600px) {
  .family-stage { padding-top: 12px; }
  .family-map {
    min-height: 810px;
    grid-template-columns: minmax(0,1fr) minmax(210px,270px) 70px minmax(210px,270px) minmax(0,1fr);
    grid-template-rows: 132px 450px minmax(135px,auto);
    row-gap: 28px;
  }
  .parent-left .relative-card,
  .parent-right .relative-card {
    min-height: 122px;
    grid-template-columns: 64px 1fr 10px;
  }
  .parent-left .relative-avatar,
  .parent-right .relative-avatar { width: 64px; height: 88px; }
  .parent-left .relative-copy strong,
  .parent-right .relative-copy strong { font-size: 17px; }
  .focus-card {
    width: min(720px,100%);
    height: 450px;
    min-height: 450px;
    grid-template-columns: minmax(210px,.75fr) minmax(330px,1.25fr);
  }
  .side-family-stack .relative-card { grid-template-columns: 54px 1fr 9px; }
  .side-family-stack .relative-avatar { width: 54px; height: 72px; }
  .side-family-stack .relative-copy strong { font-size: 14px; }
}

@media (max-width: 1080px) {
  .family-map { min-height: 0; display: block; }
  .relative-slot, .family-connectors { display: none; }
  .focus-card { height: auto; min-height: 500px; overflow: hidden; }
  .focus-relation-badge { position: static; order: -2; grid-column: 1 / -1; justify-self: center; margin-bottom: -28px; transform: none; }
  .mobile-relatives {
    position: relative;
    z-index: 2;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px,76vw);
    gap: 10px;
    margin: 20px -18px 0;
    padding: 0 18px 12px;
    overflow-x: auto;
  }
}

@media (max-width: 620px) {
  .focus-relation-badge { grid-column: 1; margin-bottom: -8px; font-size: 15px; }
}

/* Family geography: a paper atlas, not a generic dashboard map. */
.memory-map-view {
  min-height: calc(100vh - 66px);
  padding: 54px clamp(18px,4vw,68px) 170px;
  color: var(--album-ink);
  background:
    linear-gradient(rgba(32,56,47,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32,56,47,.045) 1px, transparent 1px),
    var(--album-paper);
  background-size: 32px 32px, 32px 32px, auto;
}
.memory-map-view .panel-copy { max-width: 1040px; margin: 0 auto 30px; }
.memory-map-view .panel-copy h2 { color: var(--album-ink); font-size: clamp(48px,6vw,82px); line-height: .98; }
.memory-map-view .panel-copy > p:not(.eyebrow) { max-width: 780px; color: #665f55; font-size: 16px; line-height: 1.55; }
.memory-map-shell {
  width: min(1600px,100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0,1.7fr) minmax(320px,.63fr);
  min-height: 660px;
  overflow: hidden;
  background: #f5f0e6;
  border: 1px solid rgba(32,56,47,.24);
  border-radius: 8px 28px 28px 8px;
  box-shadow: 0 28px 70px rgba(31,39,35,.18), 12px 12px 0 rgba(166,79,58,.12);
}
.memory-map-canvas-wrap { position: relative; min-width: 0; min-height: 660px; overflow: hidden; background: #d2d8d2; }
.memory-map-canvas { width: 100%; height: 100%; min-height: 660px; background: #d2d8d2; }
.memory-map-legend {
  position: absolute;
  z-index: 500;
  top: 14px;
  left: 14px;
  max-width: calc(100% - 90px);
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  padding: 10px 12px;
  color: #34463f;
  background: rgba(248,244,235,.94);
  border: 1px solid rgba(32,56,47,.18);
  border-radius: 5px;
  box-shadow: 0 8px 24px rgba(25,37,32,.16);
  font-size: 10px;
  pointer-events: none;
}
.memory-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,.72); }
.legend-dot.is-confirmed { background: var(--album-rust); }
.legend-dot.is-hypothesis { background: #b6842f; }
.legend-dot.is-research { background: var(--album-green); }
.memory-map-caption {
  position: absolute;
  z-index: 500;
  left: 16px;
  bottom: 14px;
  max-width: min(610px,calc(100% - 32px));
  margin: 0;
  padding: 9px 11px;
  color: #514b43;
  background: rgba(248,244,235,.94);
  border-left: 3px solid var(--album-rust);
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(25,37,32,.14);
  font-size: 10px;
  line-height: 1.45;
}
.map-place-panel {
  min-width: 0;
  max-height: 660px;
  overflow-y: auto;
  padding: 28px 24px 34px;
  color: #f6efe3;
  background: var(--album-green);
  border-left: 1px solid rgba(238,232,220,.16);
  scrollbar-color: rgba(239,201,139,.6) transparent;
}
.map-place-header { display: grid; grid-template-columns: 66px 1fr; gap: 14px; align-items: center; }
.map-place-seal { display: grid; place-items: center; width: 62px; height: 70px; background: var(--album-rust); border: 1px solid rgba(255,255,255,.34); border-radius: 50% 50% 46% 46%; font-family: var(--serif); font-size: 28px; box-shadow: inset 0 0 0 5px rgba(255,255,255,.08); }
.map-place-seal.is-hypothesis { background: #9a6f25; }
.map-place-seal.is-research { color: var(--album-green); background: #e5cf9c; }
.map-place-header p { margin: 0 0 3px; color: #efc98b; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.map-place-header h3 { margin: 0; color: #fff8ed; font-family: var(--serif); font-size: clamp(27px,2.2vw,37px); font-weight: 400; line-height: .98; }
.map-place-header small { display: block; margin-top: 7px; color: #bfc8c1; line-height: 1.35; }
.map-place-status { margin: 22px 0 0; padding: 10px 12px; color: #f5dec0; background: rgba(238,232,220,.08); border-left: 3px solid #d77a5f; font-size: 11px; line-height: 1.45; }
.map-place-panel[data-status="hypothesis"] .map-place-status { border-left-color: #e4b95d; }
.map-place-panel[data-status="research"] .map-place-status { border-left-color: #d8c69e; }
.map-place-note { margin: 16px 0 24px; color: #d7d4c8; font-family: var(--serif); font-size: 17px; line-height: 1.52; }
.map-people-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; border-top: 1px solid rgba(238,232,220,.16); color: #d8cdbd; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.map-people-heading b { display: grid; place-items: center; min-width: 27px; height: 27px; padding: 0 7px; color: #233a31; background: #e7d6b7; border-radius: 50%; font-size: 11px; }
.map-people-list { display: grid; gap: 8px; margin-top: 11px; }
.map-person-row { width: 100%; display: grid; grid-template-columns: 42px 1fr 16px; gap: 10px; align-items: center; padding: 9px; color: #fff8ed; text-align: left; background: rgba(255,255,255,.045); border: 1px solid rgba(238,232,220,.14); border-radius: 4px 12px 12px 4px; }
.map-person-row:hover, .map-person-row:focus-visible { background: rgba(255,255,255,.09); border-color: rgba(239,201,139,.74); outline: 0; transform: translateX(2px); }
.map-person-monogram { display: grid; place-items: center; width: 42px; height: 50px; color: #2a382f; background: #cdbb99; border-radius: 2px; font-family: var(--serif); font-size: 16px; }
.map-person-row > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.map-person-row strong { font-family: var(--serif); font-size: 16px; font-weight: 400; line-height: 1.08; }
.map-person-row small { overflow: hidden; color: #b8c0ba; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.map-person-row i { color: #efc98b; font-style: normal; }
.map-empty-people { color: #c7cfc9; font-size: 12px; }
.map-place-directory { width: min(1600px,100%); margin: 26px auto 0; display: grid; grid-template-columns: minmax(210px,.3fr) 1fr; gap: 26px; align-items: start; }
.map-place-directory h3 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 400; }
.place-cloud { display: flex; flex-wrap: wrap; gap: 9px; }
.place-chip { min-height: 46px; display: inline-flex; align-items: center; gap: 9px; padding: 9px 9px 9px 14px; color: var(--album-ink); background: rgba(250,247,240,.82); border: 1px solid rgba(32,56,47,.22); border-radius: 5px 14px 14px 5px; box-shadow: 0 6px 15px rgba(31,39,35,.07); }
.place-chip:hover, .place-chip:focus-visible, .place-chip.active { color: #fff7ea; background: var(--album-green); border-color: var(--album-green); outline: 0; }
.place-chip.is-hypothesis { border-style: dashed; border-color: rgba(154,111,37,.7); }
.place-chip.is-research { border-color: rgba(32,56,47,.55); }
.place-chip b { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; color: #fff8ed; background: var(--album-rust); border-radius: 50%; font-size: 11px; }
.place-chip.is-hypothesis b { background: #9a6f25; }
.place-chip.is-research b { color: var(--album-green); background: #e5cf9c; }
.unmapped-places { width: min(1600px,100%); margin: 24px auto 0; padding: 0; color: #5e574e; background: rgba(250,247,240,.55); border: 1px solid rgba(32,56,47,.16); border-radius: 5px; }
.unmapped-places summary { padding: 16px 18px; color: var(--album-green); font-weight: 750; cursor: pointer; }
.unmapped-places > p { max-width: 850px; margin: 0; padding: 0 18px; font-size: 12px; line-height: 1.5; }
.unmapped-places > div { display: flex; flex-wrap: wrap; gap: 7px; padding: 15px 18px 19px; }
.unmapped-places span { padding: 7px 10px; color: #645d53; background: #e6ded0; border-radius: 3px; font-size: 11px; }
.unmapped-places b { color: var(--album-rust); }
.map-load-error { display: grid; place-items: center; min-height: 220px; margin: 0; padding: 30px; color: #60584d; text-align: center; }

.family-place-marker-wrap { background: transparent; border: 0; }
.family-place-marker { position: relative; display: grid; place-items: center; width: 46px; height: 46px; color: #fff8ed; background: var(--album-rust); border: 3px solid #fff6e8; border-radius: 50% 50% 50% 8px; box-shadow: 0 8px 22px rgba(34,47,41,.38), 0 0 0 4px rgba(166,79,58,.22); transform: rotate(-45deg); }
.family-place-marker::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(255,255,255,.28); border-radius: inherit; }
.family-place-marker b { position: relative; z-index: 1; font-family: var(--serif); font-size: 18px; font-weight: 400; transform: rotate(45deg); }
.family-place-marker.is-hypothesis { background: #9a6f25; box-shadow: 0 8px 22px rgba(34,47,41,.38), 0 0 0 4px rgba(154,111,37,.24); }
.family-place-marker.is-research { color: var(--album-green); background: #e5cf9c; box-shadow: 0 8px 22px rgba(34,47,41,.38), 0 0 0 4px rgba(32,56,47,.18); }
.leaflet-container { font-family: var(--sans); }
.leaflet-control-zoom a { color: var(--album-green); background: rgba(248,244,235,.96); border-bottom-color: rgba(32,56,47,.16); }
.leaflet-control-attribution { color: #514b43; background: rgba(248,244,235,.9) !important; font-size: 9px; }
.leaflet-control-attribution a { color: #315f50; }
.leaflet-popup-content-wrapper { color: var(--album-ink); background: #f8f4eb; border: 1px solid rgba(32,56,47,.2); border-radius: 5px 16px 16px 5px; box-shadow: 0 12px 36px rgba(25,37,32,.25); }
.leaflet-popup-tip { background: #f8f4eb; }
.family-map-popup { display: grid; gap: 4px; min-width: 170px; }
.family-map-popup-status { color: var(--album-rust); font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.family-map-popup-status.is-hypothesis { color: #8a621f; }
.family-map-popup-status.is-research { color: var(--album-green); }
.family-map-popup strong { font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1.05; }
.family-map-popup small { color: #6a6257; }

@media (max-width: 980px) {
  .memory-map-view { padding-top: 36px; }
  .memory-map-shell { grid-template-columns: 1fr; border-radius: 6px 22px 22px 6px; }
  .memory-map-canvas-wrap, .memory-map-canvas { min-height: 56vh; height: 56vh; }
  .map-place-panel { max-height: none; border-left: 0; border-top: 1px solid rgba(238,232,220,.16); }
  .map-place-directory { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 620px) {
  .memory-map-view { padding: 28px 10px 178px; }
  .memory-map-view .panel-copy { padding: 0 8px; margin-bottom: 22px; }
  .memory-map-view .panel-copy h2 { font-size: 48px; }
  .memory-map-view .panel-copy > p:not(.eyebrow) { font-size: 13px; }
  .memory-map-shell { box-shadow: 0 18px 44px rgba(31,39,35,.15), 5px 7px 0 rgba(166,79,58,.11); }
  .memory-map-canvas-wrap, .memory-map-canvas { min-height: 500px; height: 500px; }
  .memory-map-legend { right: 54px; max-width: none; display: grid; gap: 5px; }
  .memory-map-caption { right: 10px; left: 10px; max-width: none; }
  .map-place-panel { padding: 24px 18px 30px; }
  .map-place-header { grid-template-columns: 55px 1fr; }
  .map-place-seal { width: 52px; height: 59px; font-size: 23px; }
  .map-place-header h3 { font-size: 30px; }
  .map-place-note { font-size: 16px; }
  .map-place-directory { padding: 0 4px; }
  .place-cloud { display: grid; grid-template-columns: 1fr 1fr; }
  .place-chip { width: 100%; min-width: 0; justify-content: space-between; padding-left: 10px; font-size: 11px; }
  .place-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .unmapped-places { width: calc(100% - 8px); }
}

/* Семейный конверт: пополнение фототеки и папина проверка. */
.archive-heading {
  width: min(1600px, 100%);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 34px;
}
.archive-heading .panel-copy { margin: 0; }
.archive-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 10px; padding-bottom: 3px; }
.archive-add-button,
.archive-papa-button {
  min-height: 46px;
  padding: 11px 17px;
  border-radius: 4px 14px 14px 4px;
  font-weight: 750;
}
.archive-add-button { color: #fff8ed; background: var(--album-rust); border: 1px solid var(--album-rust); box-shadow: 5px 6px 0 rgba(32,56,47,.14); }
.archive-add-button:hover, .archive-add-button:focus-visible { background: #8f3f2f; outline: 3px solid rgba(166,79,58,.2); outline-offset: 2px; }
.archive-papa-button { color: var(--album-green); background: rgba(255,252,245,.7); border: 1px solid rgba(32,56,47,.35); }
.archive-papa-button:hover, .archive-papa-button:focus-visible { background: #fffdf8; border-color: var(--album-green); outline: 3px solid rgba(32,56,47,.12); outline-offset: 2px; }

.archive-tag-index {
  width: min(1600px, 100%);
  margin: -8px 0 30px;
  padding: 18px 20px 16px;
  background: rgba(255,252,245,.72);
  border: 1px solid rgba(32,56,47,.18);
  border-left: 5px solid var(--album-green);
  border-radius: 3px 16px 16px 3px;
  box-shadow: 0 10px 26px rgba(31,39,35,.07);
}
.archive-tag-index > header { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.archive-tag-index > header div { display: grid; gap: 2px; }
.archive-tag-index > header small { color: #756c60; font-size: 10px; }
.archive-tag-index > header strong { color: var(--album-ink); font-family: var(--serif); font-size: 24px; font-weight: 400; }
.archive-tag-index > header button { padding: 7px 10px; color: var(--album-rust); background: transparent; border: 1px solid rgba(166,79,58,.35); border-radius: 3px 10px 10px 3px; font-size: 11px; font-weight: 750; }
.archive-tag-index > header button:hover, .archive-tag-index > header button:focus-visible { color: #fff8ed; background: var(--album-rust); outline: 2px solid rgba(166,79,58,.18); outline-offset: 2px; }
.archive-tag-row { display: flex; align-items: center; gap: 7px; padding: 5px 0; overflow-x: auto; scrollbar-width: thin; }
.archive-tag-row button { flex: 0 0 auto; min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: var(--album-green); background: #eef0e7; border: 1px solid rgba(32,56,47,.2); border-radius: 3px 12px 12px 3px; font-size: 11px; }
.archive-tag-row button b { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; color: #fff8ed; background: var(--album-green); border-radius: 50%; font-size: 9px; }
.archive-place-tags button { color: #785318; background: #f3ead4; border-color: rgba(154,111,37,.3); }
.archive-place-tags button b { background: #9a6f25; }
.archive-tag-row button:hover, .archive-tag-row button:focus-visible, .archive-tag-row button.active { color: #fff8ed; background: var(--album-green); border-color: var(--album-green); outline: 0; }
.archive-place-tags button:hover, .archive-place-tags button:focus-visible, .archive-place-tags button.active { background: #9a6f25; border-color: #9a6f25; }
.archive-tag-kind { flex: 0 0 auto; width: 38px; color: #6e665b; font-size: 10px; font-weight: 800; }
.archive-tag-empty { color: #8a8175; font-size: 11px; }
.archive-filter-result { min-height: 16px; margin: 9px 0 0 45px; color: #766d61; font-size: 10px; }
.archive-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; font-style: normal; }
.archive-card .archive-card-tags span { display: inline-flex; align-items: center; width: auto; padding: 4px 6px; color: #f8f3e9; background: var(--album-green); border-radius: 2px 7px 7px 2px; font-size: 8px; line-height: 1.2; }
.archive-card .archive-card-tags .archive-card-place-tag { color: #fff8e9; background: #9a6f25; }
.archive-card .archive-card-tags .archive-card-date-tag { color: #fff8e9; background: #8b493b; }
.archive-card .archive-card-tags .archive-card-more-tag { color: #5f574d; background: #e2dacb; }

.photo-upload-dialog,
.papa-archive-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(900px, calc(100vh - 28px));
  padding: 0;
  overflow: auto;
  color: var(--album-ink);
  background:
    linear-gradient(rgba(32,56,47,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32,56,47,.035) 1px, transparent 1px),
    #f4ede0;
  background-size: 28px 28px, 28px 28px, auto;
  border: 1px solid rgba(32,56,47,.25);
  border-radius: 6px 26px 26px 6px;
  box-shadow: 0 36px 100px rgba(11,27,21,.48), 9px 10px 0 rgba(166,79,58,.18);
}
.papa-archive-dialog { width: min(1180px, calc(100vw - 28px)); }
.photo-upload-dialog::backdrop,
.papa-archive-dialog::backdrop { background: rgba(14,29,23,.84); backdrop-filter: blur(10px); }
.photo-dialog-close { z-index: 5; top: 14px; right: 16px; color: var(--album-green); background: rgba(255,252,245,.92); border-color: rgba(32,56,47,.3); }
.photo-upload-dialog > form,
.papa-login,
.papa-workspace { padding: clamp(24px, 5vw, 52px); }
.photo-dialog-heading { max-width: 690px; margin-bottom: 24px; }
.photo-dialog-heading h2,
.papa-login h2,
.papa-workspace h2 { margin: 5px 0 10px; font-family: var(--serif); font-size: clamp(38px, 5vw, 58px); font-weight: 400; line-height: .98; }
.photo-dialog-heading > p:last-child,
.papa-login > p { max-width: 670px; color: #625b51; line-height: 1.55; }

.photo-dropzone {
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  margin-bottom: 18px;
  padding: 26px;
  color: var(--album-green);
  text-align: center;
  background: rgba(255,252,245,.72);
  border: 2px dashed rgba(32,56,47,.38);
  border-radius: 4px 20px 20px 4px;
  cursor: pointer;
}
.photo-dropzone.is-dragging { color: #fff8ed; background: var(--album-green); border-color: #efc98b; }
.photo-dropzone input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.photo-drop-mark { display: grid; place-items: center; width: 54px; height: 62px; color: #fff8ed; background: var(--album-rust); border-radius: 50% 50% 6px 6px; font-size: 32px; box-shadow: inset 0 0 0 5px rgba(255,255,255,.08); }
.photo-dropzone strong { font-family: var(--serif); font-size: 26px; font-weight: 400; }
.photo-dropzone small { color: #756d61; font-size: 11px; }
.photo-dropzone.is-dragging small { color: #d6d8d2; }
.photo-file-preview { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 8px; margin-bottom: 20px; }
.photo-file-preview:empty { display: none; }
.photo-preview-item { min-width: 0; display: grid; gap: 5px; }
.photo-preview-item img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #ddd2bf; border: 1px solid rgba(32,56,47,.18); border-radius: 3px 11px 11px 3px; }
.photo-preview-item small { overflow: hidden; color: #6c6459; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.photo-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.photo-form-grid label,
.papa-login label,
.papa-review-fields label { display: grid; gap: 7px; color: #665f55; font-size: 11px; font-weight: 750; }
.person-picker-field { position: relative; display: grid; gap: 7px; color: #665f55; font-size: 11px; font-weight: 750; }
.person-picker-label { display: block; }
.person-picker { position: relative; min-width: 0; }
.person-picker-trigger {
  width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 9px 11px 9px 13px; color: var(--album-ink); text-align: left; background: rgba(255,253,248,.92);
  border: 1px solid rgba(32,56,47,.28); border-radius: 3px 12px 12px 3px;
}
.person-picker-trigger:hover, .person-picker-trigger:focus-visible, .person-picker-trigger[aria-expanded="true"] { border-color: var(--album-rust); outline: 3px solid rgba(166,79,58,.12); }
.person-picker-trigger-copy { min-width: 0; display: grid; gap: 2px; }
.person-picker-trigger-copy small { color: #867b6d; font-size: 9px; font-weight: 650; }
.person-picker-trigger-copy strong { overflow: hidden; font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.person-picker-trigger-mark { flex: 0 0 auto; display: grid; place-items: center; width: 31px; height: 31px; color: #fff8ed; background: var(--album-green); border-radius: 50%; font-size: 20px; font-weight: 400; }
.person-picker-panel {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; right: 0; min-width: min(480px, 82vw); overflow: hidden;
  color: var(--album-ink); background: #fffaf0; border: 1px solid rgba(32,56,47,.3); border-radius: 4px 18px 18px 4px;
  box-shadow: 0 24px 70px rgba(23,43,35,.26), 6px 7px 0 rgba(166,79,58,.12);
}
.person-picker-panel[hidden] { display: none; }
.person-picker-panel > header { display: grid; gap: 2px; padding: 16px 16px 10px; }
.person-picker-panel > header strong { font-family: var(--serif); font-size: 24px; font-weight: 400; }
.person-picker-panel > header small { color: #776e62; font-size: 10px; font-weight: 600; }
.person-picker-search { display: block !important; padding: 0 12px 10px; }
.person-picker-search input { padding: 11px 12px 11px 36px !important; background: #fffdf8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23665f55' stroke-width='1.7'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='m10.5 10.5 4 4'/%3E%3C/svg%3E") no-repeat 12px center !important; }
.person-picker-options { max-height: 330px; display: grid; gap: 4px; padding: 3px 9px 10px; overflow-y: auto; scrollbar-width: thin; }
.person-picker-option { width: 100%; display: grid; grid-template-columns: 38px 1fr 28px; align-items: center; gap: 9px; padding: 7px 8px; color: var(--album-ink); text-align: left; background: transparent; border: 1px solid transparent; border-radius: 3px 10px 10px 3px; }
.person-picker-option:hover, .person-picker-option:focus-visible { background: #f0eadc; border-color: rgba(32,56,47,.18); outline: 0; }
.person-picker-option.selected { background: #e3ebe3; border-color: rgba(32,56,47,.26); }
.person-picker-monogram { display: grid; place-items: center; width: 36px; height: 36px; color: #fff8ed; background: var(--album-green); border-radius: 2px 10px 10px 2px; font-family: var(--serif); font-size: 14px; font-weight: 400; }
.person-picker-option > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.person-picker-option strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.person-picker-option small { color: #7b7266; font-size: 9px; font-weight: 600; }
.person-picker-option > b { display: grid; place-items: center; width: 25px; height: 25px; color: var(--album-green); border: 1px solid rgba(32,56,47,.28); border-radius: 50%; }
.person-picker-option.selected > b { color: #fff8ed; background: var(--album-green); }
.person-picker-empty { padding: 30px 12px; color: #786f63; text-align: center; font-size: 11px; }
.person-picker-panel > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; background: #eee6d8; border-top: 1px solid rgba(32,56,47,.14); }
.person-picker-panel > footer span { color: #6d655a; font-size: 10px; }
.person-picker-panel > footer button { min-height: 36px; padding: 7px 14px; color: #fff8ed; background: var(--album-green); border-radius: 3px 10px 10px 3px; font-weight: 750; }
.person-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.person-picker-chips:empty { display: none; }
.person-picker-chips button { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 5px 7px 5px 9px; color: var(--album-green); background: #e5ebdf; border: 1px solid rgba(32,56,47,.2); border-radius: 3px 12px 12px 3px; font-size: 9px; font-weight: 750; }
.person-picker-chips button b { font-size: 15px; line-height: 1; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.photo-form-grid input,
.photo-form-grid textarea,
.papa-login input,
.papa-review-fields input,
.papa-review-fields textarea {
  width: 100%;
  padding: 12px 13px;
  color: var(--album-ink);
  background: rgba(255,253,248,.88);
  border: 1px solid rgba(32,56,47,.28);
  border-radius: 3px 10px 10px 3px;
  font: inherit;
  font-size: 14px;
}
.photo-form-grid textarea,
.papa-review-fields textarea { resize: vertical; line-height: 1.45; }
.photo-form-grid input:focus,
.photo-form-grid textarea:focus,
.papa-login input:focus,
.papa-review-fields input:focus,
.papa-review-fields textarea:focus { border-color: var(--album-rust); outline: 3px solid rgba(166,79,58,.12); }
.photo-wide-field { grid-column: 1 / -1; }
.photo-agreement { display: flex; align-items: start; gap: 9px; margin-top: 18px; color: #5d564d; font-size: 11px; line-height: 1.45; }
.photo-agreement input { margin-top: 2px; accent-color: var(--album-rust); }
.photo-form-status { min-height: 22px; margin: 14px 0 0; color: var(--album-rust); font-size: 12px; font-weight: 700; }
.photo-form-status.is-success { color: #2d684d; }
.photo-dialog-footer { display: flex; justify-content: end; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(32,56,47,.15); }

.papa-login { max-width: 720px; min-height: 520px; display: grid; align-content: center; }
.papa-login form { max-width: 440px; display: grid; gap: 14px; margin-top: 18px; }
.papa-workspace-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.papa-workspace-header h2 { margin-bottom: 0; }
.papa-tabs { display: flex; gap: 7px; margin: 24px 0 14px; overflow-x: auto; }
.papa-tabs button { flex: 0 0 auto; min-height: 40px; padding: 8px 14px; color: #655d52; background: rgba(255,252,245,.72); border: 1px solid rgba(32,56,47,.22); border-radius: 999px; }
.papa-tabs button.active { color: #fff8ed; background: var(--album-green); border-color: var(--album-green); }
.papa-queue-status { min-height: 20px; color: #6a6258; font-size: 11px; }
.papa-review-list { display: grid; gap: 18px; margin-top: 12px; }
.papa-review-card { display: grid; grid-template-columns: minmax(260px,.8fr) minmax(340px,1.2fr); overflow: hidden; background: rgba(255,252,245,.94); border: 1px solid rgba(32,56,47,.22); border-radius: 5px 20px 20px 5px; box-shadow: 0 14px 30px rgba(31,39,35,.1); }
.papa-review-photo { min-height: 360px; position: relative; background: #d8cebb; }
.papa-review-photo img { width: 100%; height: 100%; min-height: 360px; object-fit: contain; background: #263c33; }
.papa-review-photo span { position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px); padding: 7px 9px; overflow: hidden; color: #fff8ed; background: rgba(23,43,35,.86); border-radius: 3px; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.papa-review-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; padding: 22px; }
.papa-review-fields .wide { grid-column: 1 / -1; }
.papa-review-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 12px; color: #756d62; font-size: 10px; }
.papa-review-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; }
.papa-review-actions button,
.papa-review-actions a { min-height: 39px; padding: 8px 12px; border-radius: 3px 10px 10px 3px; font-weight: 750; }
.papa-download { display: inline-flex; align-items: center; color: var(--album-green); background: #fffdf8; border: 1px solid rgba(32,56,47,.28); text-decoration: none; }
.papa-download:hover, .papa-download:focus-visible { border-color: var(--album-green); outline: 3px solid rgba(32,56,47,.12); outline-offset: 2px; }
.papa-save { color: var(--album-green); background: #eee4d2; border: 1px solid rgba(32,56,47,.3); }
.papa-publish { color: #fff8ed; background: var(--album-green); border: 1px solid var(--album-green); }
.papa-reject { color: #8e3d2d; background: #f5e1d8; border: 1px solid rgba(166,79,58,.35); }
.papa-empty { padding: 44px 20px; color: #686055; text-align: center; background: rgba(255,252,245,.55); border: 1px dashed rgba(32,56,47,.25); border-radius: 4px; }

@media (max-width: 820px) {
  .archive-heading { align-items: start; flex-direction: column; }
  .archive-actions { justify-content: start; }
  .photo-file-preview { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .papa-review-card { grid-template-columns: 1fr; }
  .papa-review-photo, .papa-review-photo img { min-height: 300px; max-height: 520px; }
}

@media (max-width: 560px) {
  .archive-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .archive-actions button { width: 100%; }
  .archive-tag-index { margin-top: 0; padding: 15px 13px 13px; }
  .archive-tag-index > header { align-items: start; }
  .archive-tag-index > header strong { font-size: 21px; }
  .archive-tag-row { margin-right: -13px; padding-right: 13px; }
  .archive-tag-kind { width: 31px; }
  .archive-filter-result { margin-left: 38px; }
  .photo-upload-dialog,
  .papa-archive-dialog { width: calc(100vw - 12px); max-height: calc(100vh - 12px); border-radius: 4px 18px 18px 4px; }
  .photo-upload-dialog > form,
  .papa-login,
  .papa-workspace { padding: 50px 16px 22px; }
  .photo-form-grid,
  .papa-review-fields { grid-template-columns: 1fr; }
  .photo-wide-field,
  .papa-review-fields .wide,
  .papa-review-meta,
  .papa-review-actions { grid-column: 1; }
  .photo-dialog-footer { display: grid; grid-template-columns: 1fr; }
  .photo-dialog-footer button { width: 100%; }
  .papa-workspace-header { align-items: start; flex-direction: column; }
  .papa-review-fields { padding: 16px; }
  .person-picker-panel { position: fixed; z-index: 100; top: auto; right: 6px; bottom: 6px; left: 6px; min-width: 0; max-height: calc(100vh - 24px); border-radius: 4px 20px 20px 4px; }
  .person-picker-options { max-height: min(55vh, 460px); }
  .person-picker-panel > header { padding-top: 20px; }
}
