:root {
  color-scheme: dark;
  --ink: #edf5fb;
  --muted: #a9becd;
  --quiet: #81a0b3;
  --ground: #081522;
  --panel: #0b1c2a;
  --panel-raised: #102737;
  --stroke: #2e485a;
  --stroke-soft: #20394a;
  --cyan: #4bd6ef;
  --cyan-dark: #092331;
  --pink: #ee80b4;
  --radius: 11px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--ground);
}
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 280px; scrollbar-color: #37596c #0b1c29; scrollbar-width: thin; }
body { margin: 0; min-height: 100vh; background: linear-gradient(145deg, #0d1f2d, var(--ground) 48%); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: wait; opacity: .6; }
button, input, select, textarea, a { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--cyan); }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
main:focus { outline: none; }
.icon { display: inline-block; flex: 0 0 auto; width: 21px; height: 21px; vertical-align: middle; }
.skip-link { position: fixed; z-index: 10; top: 9px; left: 9px; transform: translateY(-175%); padding: 9px 14px; background: var(--cyan); color: #071521; border-radius: 6px; }
.skip-link:focus { transform: none; }

.site-header {
  display: grid; grid-template-columns: minmax(340px, 1fr) auto minmax(184px, .8fr);
  gap: 12px; align-items: center; min-height: 61px; padding: 0 20px 0 28px;
  background: linear-gradient(110deg, #0c202d, #091722 64%); border-bottom: 1px solid #2d4556;
}
.brand { display: flex; align-items: center; min-width: 0; gap: 11px; width: fit-content; }
.brand-mark { display: block; width: 56px; height: 57px; background: url('/static/mark.svg') center / 98% no-repeat; flex: 0 0 auto; }
.brand-copy { min-width: 0; display: grid; gap: 1px; }
.brand-name { font-size: 23px; font-weight: 800; letter-spacing: .018em; line-height: 1.07; white-space: nowrap; }
.brand-name strong { color: var(--cyan); }
.brand-caption { color: #cfdee7; font-size: 12px; line-height: 1.3; }
.site-nav { display: flex; align-items: stretch; height: 60px; white-space: nowrap; }
.site-nav a, .site-nav button {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 3px;
  flex: 1 0 auto; padding: 3px 13px 5px; min-width: 76px; border: 0;
  border-bottom: 3px solid transparent; border-radius: 0; color: #dceaf2; background: transparent; font-size: 13px;
}
.site-nav .icon { width: 22px; height: 22px; }
.site-nav a:hover, .site-nav button:hover { background: #133044; color: #fff; }
.site-nav a.active { color: var(--cyan); border-color: var(--cyan); background: linear-gradient(transparent, #123040); }
.account-button { justify-self: end; white-space: nowrap; font-weight: 750; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px;
  padding: 6px 12px; border: 1px solid #39556a; border-radius: 9px; color: var(--ink);
  background: linear-gradient(#122b3c, #0b1c2a); font-size: 13.5px; line-height: 1.25;
}
.button .icon { width: 19px; height: 19px; }
.button:hover { border-color: #5e839a; background: #173447; }
.button-accent, .button-accent:hover { color: #062332; border-color: #6de1f3; background: linear-gradient(#54ddf5, #2cbadf); }
.button-accent:hover { filter: brightness(1.09); }
.button-muted { background: #112737; }
.button-active { border-color: #54c6e1; color: var(--cyan); }
.button-active .icon { fill: #246073; }
.button-small { min-height: 32px; padding: 5px 9px; font-size: 12.5px; }
.icon-button { min-width: 36px; padding: 5px 7px; }
.icon-button .icon { width: 18px; height: 18px; }

.profile-heading {
  display: flex; justify-content: space-between; gap: 12px 20px; padding: 10px 16px 10px 22px;
  align-items: center; border-bottom: 1px solid var(--stroke-soft);
}
.profile-title { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; column-gap: 16px; row-gap: 5px; }
.profile-title h1 { font-size: clamp(21px, 2.25vw, 32px); line-height: 1.05; letter-spacing: .008em; overflow-wrap: anywhere; }
.profile-description { flex: 1 0 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 5px 9px; color: #d8e5ec; font-size: 13.5px; }
.demo-label { padding: 2px 7px; font-size: 10px; font-weight: 700; letter-spacing: .025em; color: #b5cddd; border-radius: 5px; background: #163044; border: 1px solid #294a60; }
.id-button { min-height: 31px; color: #dcf6ff; white-space: nowrap; }
.id-button .icon { width: 16px; height: 16px; }
.profile-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.profile-actions .button { white-space: nowrap; }
.profile-tabs {
  display: flex; gap: 0; padding: 3px 16px 4px 22px; overflow: auto;
  border-bottom: 1px solid #4b879d; background: #0b1d2a; scrollbar-width: thin;
}
.profile-tabs a {
  flex: 1 0 auto; min-height: 37px; display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  padding: 5px 13px; color: #e1edf3; font-size: 13px; border-right: 1px solid #1e3747;
  white-space: nowrap;
}
.profile-tabs a:last-child { border-right: 0; }
.profile-tabs a:hover { background: #173344; }
.profile-tabs a.active { font-weight: 700; color: #062638; border: 1px solid #65def1; border-radius: 9px; background: linear-gradient(#48d8f3, #2aadde); }
.profile-tabs .icon { width: 21px; height: 21px; }

.profile-body {
  margin: 0 auto; padding: 11px 11px 12px 8px; display: grid; align-items: start;
  grid-template-columns: clamp(222px, 20.3vw, 276px) minmax(0, 1fr); gap: 12px;
}
.profile-sidebar { display: grid; gap: 9px; min-width: 0; }
.surface { border: 1px solid var(--stroke); border-radius: var(--radius); background: linear-gradient(149deg, #102738, #0c1d2b 75%); }
.portrait-box { position: relative; padding: 8px; min-width: 0; }
.portrait-photo { width: 100%; aspect-ratio: 248 / 222; border: 1px solid #4a7487; border-radius: 8px; }
.portrait-box .expand-photo {
  position: absolute; top: 13px; right: 13px; min-width: 27px; min-height: 27px;
  color: white; padding: 3px; border-color: #446477; background: #0c2433;
}
.expand-photo .icon { width: 17px; height: 17px; }
.picture { display: block; position: relative; background-color: #163445; background-repeat: no-repeat; overflow: hidden; }
.picture img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.picture img.broken { display: none; }
.picture-demo { background-image: url('/static/demo-photo-board.jpg'); background-size: var(--photo-size); background-position: var(--photo-pos); }
.picture-empty { background: radial-gradient(ellipse at 35% 30%, #22475b, #102737 74%); }
.picture-empty > .icon { position: absolute; width: 37%; height: 37%; top: 31.5%; left: 31.5%; opacity: .54; color: #9ab9c9; }
.sidebar-facts { margin: 0; padding: 0; overflow: hidden; font-size: 12.5px; }
.sidebar-facts div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); min-height: 31px; }
.sidebar-facts div + div { border-top: 1px solid #2b4558; }
.sidebar-facts dt, .sidebar-facts dd { margin: 0; padding: 6px 10px; align-content: center; overflow-wrap: anywhere; }
.sidebar-facts dt { color: #bdd1df; }
.sidebar-facts dd { border-left: 1px solid #2b4558; color: #f1f7fc; font-weight: 550; }
.sidebar-facts a:hover { color: var(--cyan); text-decoration: underline; }
.flag-ru { width: 16px; height: 10px; display: inline-block; border-radius: 3px; margin-right: 5px; background: linear-gradient(#fff 0 33.3%, #2859a5 33.3% 66.6%, #e25861 66.6%); }
.sex { display: inline-block; font-size: 1.24em; line-height: .8; vertical-align: baseline; white-space: nowrap; font-weight: 750; }
.sex-m { color: #52d9ee; }
.sex-f { color: var(--pink); }
.genetic-box { padding: 9px 10px 10px; }
.genetic-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.genetic-title h2 { font-size: 15px; line-height: 1.2; }
.info-button { display: inline-grid; place-items: center; padding: 2px; color: #c1d5e0; border: 0; background: transparent; }
.info-button .icon { width: 16px; height: 16px; }
.info-button:hover { color: var(--cyan); }
.genetic-values { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.genetic-value { display: grid; gap: 3px; min-width: 0; padding: 8px 8px 7px; background: linear-gradient(#112b3c, #0d2130); border: 1px solid #3b5669; border-radius: 8px; }
.genetic-value small { color: #c1d4e0; font-size: 11.5px; white-space: nowrap; }
.genetic-value strong { display: block; font-size: clamp(18px, 1.9vw, 25px); color: var(--cyan); font-variant-numeric: tabular-nums; white-space: nowrap; }

.pedigree-panel { min-width: 0; }
.tree-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 36px; gap: 8px 14px; margin-bottom: 7px; }
.tree-toolbar h2 { font-size: clamp(17px, 1.68vw, 23px); line-height: 1.16; padding-left: 4px; }
.tree-toolbar h2 span { white-space: nowrap; }
.tree-controls { display: flex; gap: 9px; align-items: center; flex: 0 0 auto; }
.zoom-group { display: inline-flex; align-items: center; background: #0b1e2c; border: 1px solid #3d586c; border-radius: 9px; }
.zoom-group .button { min-height: 31px; min-width: 36px; margin: -1px; }
.zoom-label { height: 30px; padding: 0 8px; min-width: 57px; font-size: 12.5px; color: #ecf9ff; font-weight: 700; background: transparent; border: 0; }
.zoom-label:hover { color: var(--cyan); }
.fullscreen-button { min-height: 33px; }
.generation-select { display: inline-flex; align-items: center; gap: 4px; padding: 0 9px; color: #e9f4fb; border: 1px solid #3b5669; border-radius: 9px; background: #0f2637; font-size: 12.5px; white-space: nowrap; }
.generation-select .icon { width: 15px; height: 15px; pointer-events: none; }
.generation-select select { appearance: none; height: 31px; min-width: 24px; background: none; color: inherit; border: 0; text-align: center; padding: 0 2px; cursor: pointer; }
.generation-select option { background: #102737; }
.tree-scroll { min-width: 0; position: relative; overflow: auto; overscroll-behavior: contain; max-height: min(70vh, 820px); border: 1px solid #355567; border-radius: 11px; background: #0a1c2a; scrollbar-color: #3c7185 #0a1b28; scrollbar-width: thin; }
.tree-stage { min-width: 100%; position: relative; width: calc(var(--canvas-width) * var(--zoom)); height: calc(var(--canvas-height) * var(--zoom)); overflow: hidden; }
.tree-inner { width: var(--canvas-width); position: absolute; left: 0; top: 0; transform: scale(var(--zoom)); transform-origin: top left; }
.generation-heads, .tree-grid { display: grid; }
.generation-heads { height: 48px; border-bottom: 1px solid #37576a; background: linear-gradient(#142f40, #0f2535); }
.generation-heads > div { display: grid; place-content: center; justify-items: center; gap: 2px; font-size: 12px; text-align: center; }
.generation-heads > div + div, .tree-grid > div + div { border-left: 1px solid #263f52; }
.generation-heads > div:first-child { background: #0e2332; }
.generation-heads small { color: #c5d6e0; font-size: 11px; line-height: 1.1; }
.tree-field { position: relative; background: radial-gradient(ellipse at 8% 56%, #102d3d, transparent 51%), #0a1c2a; }
.tree-grid, .tree-branches { position: absolute; inset: 0; pointer-events: none; }
.tree-grid > div:nth-child(2n) { background: rgba(18, 47, 65, .24); }
.tree-branches { overflow: visible; }
.branch { fill: none; stroke: #57d8ed; stroke-width: 2.6; stroke-linecap: round; }
.branch-3 { stroke-width: 2.1; }
.branch-4 { stroke-width: 1.5; stroke: #5db7cb; }
.tree-node { position: absolute; transform: translateY(-50%); }
.tree-dog, .tree-unknown, .tree-pair { border: 1px solid #547488; border-radius: 9px; background: linear-gradient(135deg, #153445, #0c2030 82%); }
.tree-dog { min-height: 41px; display: flex; align-items: center; gap: 7px; padding: 3px 5px; }
.tree-dog:where(a):hover, .tree-pair:hover { border-color: #64d9ee; background: #174156; }
.tree-dog-repeat { border-color: #4e8fa4; }
.tree-picture { flex: 0 0 39px; width: 39px; height: 33px; border-radius: 5px; border: 1px solid #486879; }
.tree-dog-copy { min-width: 0; display: grid; align-content: center; }
.tree-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-weight: 760; font-size: 11.3px; line-height: 1.13; overflow-wrap: anywhere; }
.tree-level-1 .tree-name { font-size: 13.7px; line-height: 1.22; }
.tree-level-2 .tree-name { font-size: 12.7px; }
.tree-level-1, .tree-level-2 { padding: 5px 6px; }
.tree-level-1 { min-height: 83px; }
.tree-level-2 { min-height: 64px; }
.tree-level-1 .tree-picture { flex-basis: 62px; width: 62px; height: 70px; }
.tree-level-2 .tree-picture { flex-basis: 49px; width: 49px; height: 50px; }
.tree-level-0 { display: grid; gap: 5px; border: 0; background: none; padding: 0; }
.tree-level-0 .tree-picture { width: 100%; height: auto; aspect-ratio: 1.17; border-radius: 8px; }
.tree-level-0 .tree-dog-copy { padding: 0 5px; gap: 4px; }
.tree-level-0 .tree-name { font-size: 14px; line-height: 1.13; }
.tree-birth { font-size: 11.5px; color: #c9dce6; }
.tree-unknown { padding: 6px 8px; min-height: 36px; display: flex; align-items: center; gap: 7px; color: #d0dce4; font-size: 10.7px; border-color: #3e6174; }
.tree-unknown > span { padding: 0 6px 2px; font-weight: bold; background: #264559; border-radius: 5px; color: #eff8ff; font-size: 15px; }
.tree-pair { display: grid; padding: 3px 6px; min-height: 36px; gap: 2px; font-size: 10px; }
.tree-pair a { display: flex; gap: 5px; align-items: center; min-width: 0; }
.tree-pair a:hover { color: var(--cyan); text-decoration: underline; }
.tree-pair a span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-pair .pair-empty { color: var(--muted); }
.tree-foot { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin: 7px 4px 0; color: var(--muted); font-size: 11px; }
.tree-foot > span { display: inline-flex; align-items: center; gap: 6px; }
.tree-key { display: inline-block; width: 15px; height: 2px; background: #57d8ed; }
.tree-key-repeated { width: 10px; height: 8px; background: transparent; border: 1px solid #69b7cb; border-radius: 2px; }
.tree-coverage { margin-left: auto; }
.pedigree-panel:fullscreen, .pedigree-panel.is-expanded { padding: 14px; background: var(--ground); }
.pedigree-panel:fullscreen .tree-scroll, .pedigree-panel.is-expanded .tree-scroll { max-height: calc(100dvh - 108px); }
.pedigree-panel.is-expanded { position: fixed; inset: 0; z-index: 8; overflow: auto; }

.page { width: min(1194px, 100%); margin: 0 auto; padding: 29px 22px 50px; }
.page-header { display: flex; justify-content: space-between; align-items: start; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header h1 { font-size: clamp(27px, 3vw, 39px); line-height: 1.14; }
.page-header p { margin-top: 6px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.page-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.search-form { display: flex; gap: 8px; margin-bottom: 15px; }
.search-form label { flex: 1; min-width: 0; }
.field, .search-field { width: 100%; padding: 8px 11px; min-height: 38px; border: 1px solid #3a5669; border-radius: 7px; color: var(--ink); background: #0a1c2b; }
.sex-filter { width: auto; max-width: 126px; flex: 0 1 126px; }
input::placeholder, textarea::placeholder { color: #94adbe; opacity: 1; }
.catalog-count { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dog-list-item { min-width: 0; display: grid; align-items: center; grid-template-columns: 58px minmax(0, 1fr) 15px; gap: 11px; padding: 8px; border: 1px solid var(--stroke); background: linear-gradient(125deg, #112b3c, #0d2030); border-radius: 9px; }
.dog-list-item:hover { border-color: #4d9ab5; background: #15344a; }
.dog-list-item strong, .dog-list-item small { display: block; overflow-wrap: anywhere; }
.dog-list-item strong { font-size: 13px; line-height: 1.27; }
.dog-list-item small { margin-top: 3px; color: #b6cbd9; font-size: 11px; }
.list-picture { width: 58px; height: 55px; border: 1px solid #46667a; border-radius: 6px; }
.list-arrow { color: #81aabb; }
.list-arrow .icon { width: 15px; height: 15px; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 22px 0; }
.pagination > span { color: var(--muted); font-size: 13px; }
.directory-table, .content-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table-box { overflow-x: auto; border: 1px solid var(--stroke); border-radius: var(--radius); background: #0c1e2c; }
.directory-table caption, .content-table caption { text-align: left; padding: 10px 12px; color: var(--muted); }
.directory-table th, .directory-table td, .content-table th, .content-table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--stroke-soft); }
.directory-table thead, .content-table thead { background: #143042; color: #d5e5ee; }
.directory-table tr:last-child td, .content-table tr:last-child td { border-bottom: 0; }
.directory-table a, .content-table a { color: #75e0f5; }
.directory-table a:hover, .content-table a:hover { text-decoration: underline; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 17px; }
.stat { border: 1px solid var(--stroke); border-radius: var(--radius); background: linear-gradient(155deg, #153345, #0c1f2d 75%); padding: 13px; display: grid; gap: 4px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { color: var(--cyan); font-size: 29px; font-weight: 750; font-variant-numeric: tabular-nums; }

.tab-content { min-width: 0; padding: 5px 2px 20px; }
.tab-content h2 { font-size: 23px; margin-bottom: 12px; }
.tab-content h3 { font-size: 17px; margin: 16px 0 8px; }
.tab-content p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.tab-content .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-details { display: grid; grid-template-columns: minmax(120px, .9fr) 1.3fr; margin: 0 0 15px; overflow: hidden; }
.card-details dt, .card-details dd { margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--stroke); overflow-wrap: anywhere; font-size: 14px; }
.card-details dt { color: var(--muted); }
.card-details dd a { color: var(--cyan); }
.card-details dd a:hover { text-decoration: underline; }
.record-note { margin: 7px 0 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tab-portrait { width: min(100%, 410px); aspect-ratio: 1.12; border-radius: 10px; border: 1px solid var(--stroke); }
.genetic-detail { max-width: 340px; }
.initial-letter { color: var(--cyan); }
.bar-track { width: min(34vw, 170px); height: 6px; border-radius: 10px; display: inline-block; overflow: hidden; vertical-align: middle; background: #192f40; margin-right: 6px; }
.bar-track > span { display: block; height: 100%; background: #4bcfea; }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-list li { border-bottom: 1px solid var(--stroke); padding: 10px 4px; }
.history-list time { color: #a6bdce; font-size: 12px; margin-right: 10px; }
.loading-state, .empty-state { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); }
.empty-state h2 { font-size: 18px; line-height: 1.25; margin: 8px 0 4px; color: var(--ink); }
.empty-state p { font-size: 13px; }
.empty-state .button { margin-top: 11px; }
.empty-icon { display: grid; place-items: center; width: 38px; height: 38px; background: #16374a; color: #82cfe1; border-radius: 9px; }
.empty-icon .icon { width: 22px; height: 22px; }

.modal { width: min(calc(100% - 22px), 560px); max-height: calc(100dvh - 24px); overflow: auto; margin: auto; background: #102637; color: var(--ink); border: 1px solid #4d7188; border-radius: 13px; padding: 0; box-shadow: 0 16px 55px #0008; }
.modal::backdrop { background: #030a11c9; }
.modal-inner { padding: 16px; }
.modal-heading { display: flex; gap: 14px; justify-content: space-between; align-items: start; margin-bottom: 13px; }
.modal-heading h2 { font-size: 22px; line-height: 1.17; }
.modal-heading > .button { min-height: 31px; }
.modal-inner p { color: var(--muted); line-height: 1.5; font-size: 14px; }
.modal-inner p + p { margin-top: 10px; }
.modal-inner .search-form { margin-top: 9px; margin-bottom: 8px; }
.modal-portrait { width: 100%; aspect-ratio: 1.12; border-radius: 8px; }
.modal-form { display: grid; gap: 10px; }
.modal-field { display: grid; gap: 4px; font-size: 13px; color: #d5e3eb; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.form-status { min-height: 16px; color: #ffb4bd; font-size: 13px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.account-actions { margin-top: 10px; }
.auth-switch { display: flex; gap: 6px; padding-bottom: 9px; }
.search-results { display: grid; gap: 6px; margin-top: 9px; }
.search-results .dog-list-item { grid-template-columns: 37px minmax(0, 1fr) 15px; padding: 5px; }
.search-results .list-picture { width: 37px; height: 34px; }
.compare-choice { justify-content: flex-start; text-align: left; width: 100%; }
.compare-choice > span:nth-child(2) { flex: 1; overflow-wrap: anywhere; }
.compare-results { margin-top: 14px; }
.compare-results h3 { font-size: 15px; margin: 13px 0 8px; }
.compare-results .stat strong { font-size: 20px; }
.compare-results .stats-grid { grid-template-columns: 1fr 1fr; }
.field-help { color: var(--muted); font-size: 11px; }
.toast { position: fixed; z-index: 9; bottom: 15px; right: 15px; max-width: min(350px, calc(100% - 30px)); padding: 10px 14px; background: #17394a; border: 1px solid #59a7bd; border-radius: 8px; color: #f3faff; box-shadow: 0 8px 22px #0005; font-size: 13.5px; }

@media (max-width: 1070px) {
  .site-header { grid-template-columns: minmax(260px, 1fr) auto minmax(148px, auto); gap: 6px; padding: 0 12px; }
  .site-nav a, .site-nav button { min-width: 62px; padding-inline: 8px; }
  .brand-mark { width: 46px; }
  .brand-caption { font-size: 11px; }
  .profile-actions .button { font-size: 12px; padding-inline: 8px; }
  .profile-tabs a { padding-inline: 10px; }
  .tree-level-1 .tree-picture { flex-basis: 51px; width: 51px; height: 64px; }
  .tree-level-1 .tree-name { font-size: 12px; }
}
@media (max-width: 930px) {
  .site-header { grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; }
  .site-nav { grid-row: 2; grid-column: 1 / -1; height: 48px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
  .site-nav a, .site-nav button { flex: 1 0 auto; }
  .site-nav .icon { width: 17px; height: 17px; }
  .account-button { grid-column: 2; grid-row: 1; white-space: normal; }
  .profile-heading { align-items: start; flex-direction: column; gap: 8px; padding: 10px 12px; }
  .profile-actions { justify-content: flex-start; }
  .profile-tabs { padding-left: 8px; }
  .profile-body { grid-template-columns: 204px minmax(0, 1fr); }
  .tree-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .tree-controls { margin-left: auto; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .site-header { padding: 0 7px; }
  .brand { gap: 4px; }
  .brand-mark { width: 37px; height: 51px; }
  .brand-name { font-size: 17px; }
  .brand-caption { font-size: 9.5px; line-height: 1.15; max-width: 174px; }
  .account-button { padding: 4px 7px; font-size: 10.5px; max-width: 125px; }
  .account-button .icon { width: 15px; height: 15px; }
  .site-nav a, .site-nav button { padding: 3px 4px; min-width: 55px; font-size: 11px; }
  .profile-title { column-gap: 8px; }
  .profile-title h1 { font-size: 21px; }
  .profile-body { display: flex; flex-direction: column; padding: 8px 7px 14px; gap: 9px; }
  .profile-sidebar { width: 100%; display: grid; grid-template-columns: minmax(100px, .62fr) 1fr; gap: 6px; }
  .portrait-box { padding: 5px; display: grid; align-content: center; }
  .portrait-box .expand-photo { top: 8px; right: 8px; }
  .sidebar-facts { align-self: stretch; display: grid; align-items: stretch; font-size: 11px; }
  .sidebar-facts div { min-height: 26px; }
  .sidebar-facts dt, .sidebar-facts dd { padding: 4px 5px; }
  .genetic-box { display: flex; align-items: center; gap: 7px; grid-column: 1 / -1; padding: 5px 7px; justify-content: space-between; }
  .genetic-title { margin-bottom: 0; }
  .genetic-title h2 { font-size: 12px; }
  .genetic-values { gap: 5px; }
  .genetic-value { padding: 3px 6px; gap: 2px; }
  .genetic-value small { font-size: 9px; }
  .genetic-value strong { font-size: 16px; }
  .pedigree-panel, .tab-content { width: 100%; }
  .tree-toolbar h2 { font-size: 17px; margin-top: 3px; padding-left: 1px; }
  .tree-controls { margin-left: 0; gap: 6px; }
  .tree-level-1 .tree-picture { flex-basis: 49px; width: 49px; height: 62px; }
  .tree-level-1 .tree-name { font-size: 12.5px; }
  .tree-scroll { max-height: 65dvh; border-radius: 8px; }
  .tree-foot { gap: 7px; }
  .tree-coverage { margin-left: 0; }
  .page { padding: 17px 10px 35px; }
  .results-grid, .tab-content .results-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .directory-table th, .directory-table td, .content-table th, .content-table td { padding: 7px 8px; font-size: 12px; }
  .form-grid { gap: 7px; }
}
@media (max-width: 365px) {
  .sex-filter { max-width: 99px; font-size: 11px; }
  .search-form .button { padding-inline: 7px; }
  .genetic-title h2 { max-width: 95px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
@media print {
  @page { size: landscape; margin: 9mm; }
  :root, body { color: #172737; background: #fff; color-scheme: light; }
  .site-header, .profile-actions, .profile-tabs, .id-button, .tree-controls, .info-button, .expand-photo, .dialog, .toast, .skip-link { display: none !important; }
  .profile-heading { border: 0; }
  .profile-heading h1, .profile-description, .tree-toolbar h2, .tree-name, .tree-birth { color: #152637; }
  .profile-body { display: block; padding: 4px; }
  .profile-sidebar { display: none; }
  .tree-scroll { max-height: none; overflow: visible; border-color: #8296a6; }
  .tree-stage { min-width: 0; height: calc(var(--canvas-height) * var(--print-scale, .84)); width: calc(var(--canvas-width) * var(--print-scale, .84)); }
  .tree-inner { transform: scale(var(--print-scale, .84)); }
  .tree-field, .generation-heads, .generation-heads > div:first-child, .tree-dog, .tree-unknown, .tree-pair, .tree-grid > div:nth-child(2n) { color: #172737; background: #fff; }
  .tree-dog, .tree-unknown, .tree-pair { border-color: #91a8b8; }
  .tree-level-0 { border: 0; }
  .generation-heads small, .tree-foot { color: #445a6c; }
  .picture { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
