:root {
  --accent: #cc6600;
  --accent-dark: #9f4e00;
  --former: #514b47;
  --ink: #211f1f;
  --muted: #625f5b;
  --line: #d9d3ca;
  --panel: rgba(255, 255, 255, 0.94);
  --blue: #1772d0;
  --red: #c92a2a;
  --indigo: #4c6ef5;
  --green: #2b8a3e;
  --shadow: 0 18px 50px rgba(28, 24, 19, 0.18);
  --control-panel-width: min(460px, calc(100vw - 28px));
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #f5f6f7;
  color: var(--ink);
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 36px;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  outline: none;
}

.genealogy-app {
  position: relative;
  min-height: 100vh;
}

.topbar {
  position: fixed;
  z-index: 30;
  top: 18px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  text-align: center;
}

.topbar.is-focused-title {
  right: auto;
  left: 50%;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  grid-template-columns: minmax(0, auto);
  justify-items: center;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  text-align: center;
}

.title-block {
  position: relative;
  grid-column: 2;
  min-width: 0;
  padding: 4px 12px 5px;
  pointer-events: auto;
}

.topbar.is-focused-title .title-block {
  grid-column: auto;
}

.title-block::before {
  position: absolute;
  z-index: -1;
  inset: -5px -10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  filter: blur(10px);
  content: "";
}

.topbar.is-focused-title .home-link {
  display: none;
}

.topbar.is-focused-title .title-block span {
  display: none;
}

.home-link {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(217, 211, 202, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 22px rgba(34, 30, 26, 0.08);
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  pointer-events: auto;
  text-decoration: none;
  backdrop-filter: blur(10px);
}

.home-link:hover,
.home-link:focus-visible {
  border-color: rgba(23, 114, 208, 0.25);
  background: rgba(237, 245, 255, 0.9);
  color: var(--blue);
  outline: none;
}

.title-block h1 {
  overflow: hidden;
  max-width: 100%;
  margin: 0;
  color: rgba(33, 31, 31, 0.92);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 2px 8px rgba(255, 255, 255, 0.96),
    0 12px 28px rgba(255, 255, 255, 0.78),
    0 1px 12px rgba(34, 30, 26, 0.14);
  white-space: nowrap;
}

.topbar.is-focused-title .title-block h1 {
  overflow: hidden;
  max-width: 100%;
  color: rgba(33, 31, 31, 0.92);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 2px 8px rgba(255, 255, 255, 0.96),
    0 12px 28px rgba(255, 255, 255, 0.78),
    0 1px 12px rgba(34, 30, 26, 0.14);
  white-space: nowrap;
}

.topbar.is-connection-title .title-block h1 {
  display: grid;
  gap: 1px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.connection-title-line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar.is-focused-title .title-block h1 a {
  color: inherit;
  font: inherit;
  text-decoration: none;
}

.topbar.is-focused-title .title-block h1 a:hover,
.topbar.is-focused-title .title-block h1 a:focus-visible {
  color: var(--blue);
  outline: none;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.title-block span {
  display: none;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 38px;
  padding: 3px;
  border: 1px solid rgba(217, 211, 202, 0.9);
  border-radius: 8px;
  background: rgba(245, 246, 247, 0.82);
  gap: 3px;
}

.mode-toggle button {
  min-width: 0;
  min-height: 30px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
}

.mode-toggle button.is-active {
  background: #fff;
  box-shadow: 0 4px 12px rgba(34, 30, 26, 0.08);
  color: var(--accent-dark);
}

.mode-panel[hidden] {
  display: none;
}

.explore-toggle,
.explore-close,
.mobile-connection-title {
  display: none;
}

.search-box {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 7px;
}

.search-label {
  color: #4f4b46;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-box input[type="search"] {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
}

.search-box input[type="search"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(204, 102, 0, 0.16);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  bottom: auto;
  left: 0;
  max-height: min(430px, calc(100vh - 112px));
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.search-results button {
  display: grid;
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  text-align: left;
}

.search-results button:hover,
.search-results button:focus-visible,
.search-results button.is-active {
  background: #fff5eb;
  color: var(--ink);
}

.result-name {
  font-size: 14px;
  font-weight: 700;
}

.result-meta {
  color: var(--muted);
  font-size: 12px;
}

.connection-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.connect-search-box .search-results {
  top: calc(100% + 6px);
  bottom: auto;
}

.connect-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.connect-actions button {
  min-width: 0;
  min-height: 32px;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 800;
}

.connection-strict-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  user-select: none;
}

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

.connection-strict-control {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 20px;
  border: 1px solid rgba(217, 211, 202, 0.95);
  border-radius: 999px;
  background: rgba(245, 246, 247, 0.92);
  transition: background 0.16s ease, border-color 0.16s ease;
}

.connection-strict-control::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(34, 30, 26, 0.16);
  content: "";
  transition: transform 0.16s ease;
}

.connection-strict-toggle input:checked + .connection-strict-control {
  border-color: rgba(159, 78, 0, 0.32);
  background: rgba(204, 102, 0, 0.22);
}

.connection-strict-toggle input:checked + .connection-strict-control::after {
  transform: translateX(16px);
}

.connection-strict-toggle:focus-within .connection-strict-control {
  box-shadow: 0 0 0 3px rgba(204, 102, 0, 0.16);
}

.connect-status {
  min-height: 18px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.control-group {
  display: inline-flex;
  min-height: 38px;
  padding: 3px;
  border: 1px solid rgba(217, 211, 202, 0.9);
  border-radius: 8px;
  background: rgba(245, 246, 247, 0.82);
  gap: 3px;
}

.view-group {
  flex: 1 1 220px;
}

.view-controls button {
  min-height: 32px;
  padding: 0 11px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.view-controls button:hover,
.view-controls button:focus-visible {
  background: #fff;
  box-shadow: 0 4px 12px rgba(34, 30, 26, 0.08);
}

.view-controls .icon-control {
  width: 34px;
  min-width: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.explore-panel {
  position: fixed;
  z-index: 24;
  top: 14px;
  right: 14px;
  bottom: auto;
  left: auto;
  display: grid;
  width: var(--control-panel-width);
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(217, 211, 202, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 36px rgba(34, 30, 26, 0.13);
  backdrop-filter: blur(12px);
}

.topbar.is-focused-title ~ .explore-panel {
  top: 64px;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    #f5f6f7;
  background-size: 36px 36px;
  cursor: grab;
  touch-action: none;
}

.stage.is-dragging {
  cursor: grabbing;
}

.edge-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.graph-host {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.map-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.node-layer {
  position: absolute;
  inset: 0;
}

.lineage-action {
  position: absolute;
  z-index: 9;
  transform: translateX(-50%) scale(var(--inverse-scale, 1));
  transform-origin: top center;
  min-height: 34px;
  padding: 6px 13px;
  border: 1px dashed rgba(76, 110, 245, 0.58);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(28, 24, 19, 0.12);
  color: var(--indigo);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.lineage-action:hover,
.lineage-action:focus-visible {
  border-color: var(--indigo);
  background: #f3f5ff;
  color: #324fc4;
  box-shadow: 0 10px 26px rgba(76, 110, 245, 0.18);
}

.lineage-action-full {
  border-style: solid;
}

.lineage-action[hidden] {
  display: none;
}

.person-node {
  position: absolute;
  display: grid;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px;
  width: 174px;
  height: 54px;
  min-height: 54px;
  padding: 6px 8px;
  border: 1px solid #aaa;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 5px rgba(28, 24, 19, 0.07);
  color: var(--ink);
  line-height: 1.12;
  text-align: left;
  cursor: pointer;
  transition:
    opacity 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.person-node:hover,
.person-node:focus-visible {
  z-index: 5;
  border-color: var(--accent);
  box-shadow: 0 7px 18px rgba(28, 24, 19, 0.17);
}

.person-node[data-role="current"] {
  border-color: var(--accent);
}

.person-node[data-role="former"] {
  border-color: var(--former);
}

.person-node[data-role="notable"] {
  border-color: #8a8ee8;
  background: #f1f2ff;
}

.node-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-detail-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-country-flag {
  display: none;
  position: absolute;
  top: 7px;
  right: 8px;
  z-index: 2;
  width: auto;
  height: auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 28px;
  font-style: normal;
  line-height: 1;
}

.node-thesis {
  display: none;
  overflow: hidden;
  color: #38322d;
  font-size: 12px;
  font-style: italic;
  line-height: 1.3;
}

.person-node.is-lineage-card {
  grid-template-rows: auto auto;
  align-content: start;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 7px 18px rgba(28, 24, 19, 0.12);
}

.person-node.is-lineage-card .node-name {
  padding-right: 44px;
  font-size: 15px;
  line-height: 1.12;
}

.person-node.is-lineage-card .node-detail {
  color: #6b6660;
  font-size: 12px;
  line-height: 1.15;
}

.person-node.is-lineage-card .node-country-flag {
  display: inline-flex;
}

.person-node.shows-thesis .node-thesis {
  display: -webkit-box;
  grid-row: 3;
  margin-top: 5px;
  padding-top: 7px;
  border-top: 1px solid rgba(217, 211, 202, 0.86);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.person-node.shows-thesis a.node-thesis {
  color: #145ca6;
  text-decoration: underline;
  text-decoration-color: rgba(20, 92, 166, 0.34);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.person-node.shows-thesis a.node-thesis:hover,
.person-node.shows-thesis a.node-thesis:focus-visible {
  color: #1772d0;
  text-decoration-color: currentColor;
}

.loading {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10;
  transform: translate(-50%, -50%);
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--muted);
}

.source-strip {
  position: fixed;
  z-index: 20;
  right: 14px;
  bottom: 14px;
  left: auto;
  width: var(--control-panel-width);
  padding: 8px 10px;
  border: 1px solid rgba(217, 211, 202, 0.9);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(34, 30, 26, 0.08);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.source-strip a {
  font-size: 12px;
  font-weight: 700;
}

.graph-host.has-selection .person-node {
  opacity: 0.14;
}

.graph-host.has-selection .person-node.is-selected,
.graph-host.has-selection .person-node.is-parent,
.graph-host.has-selection .person-node.is-descendant,
.graph-host.has-selection .person-node.is-lineage {
  opacity: 1;
}

.graph-host.has-selection .person-node.is-muted-lineage {
  opacity: 0.24;
}

.graph-host.has-selection .person-node.is-context {
  opacity: 0.18;
}

.graph-host.has-connection .person-node {
  opacity: 0.12;
}

.graph-host.has-connection .person-node.is-connection-source,
.graph-host.has-connection .person-node.is-connection-target,
.graph-host.has-connection .person-node.is-connection-path {
  opacity: 1;
}

.graph-host.has-search:not(.has-selection):not(.has-connection) .person-node {
  opacity: 0.14;
}

.graph-host.has-search:not(.has-selection) .person-node.is-search-match {
  opacity: 1;
}

.person-node.is-selected {
  z-index: 8;
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(201, 42, 42, 0.2), 0 12px 28px rgba(28, 24, 19, 0.18);
}

.person-node.is-search-match {
  z-index: 4;
  border-color: #f09228 !important;
  box-shadow: 0 0 0 3px rgba(240, 146, 40, 0.22), 0 8px 20px rgba(28, 24, 19, 0.14);
}

.person-node.is-parent {
  z-index: 6;
  border-color: var(--blue) !important;
}

.person-node.is-descendant {
  z-index: 6;
  border-color: var(--blue) !important;
}

.person-node.is-lineage {
  z-index: 5;
  border-color: var(--blue) !important;
}

.person-node.is-muted-lineage {
  z-index: 3;
  border-color: rgba(76, 110, 245, 0.45) !important;
  background: rgba(245, 247, 255, 0.72);
  box-shadow: none;
}

.person-node.is-context {
  z-index: 2;
  border-color: rgba(76, 110, 245, 0.26) !important;
  background: rgba(245, 247, 255, 0.54);
  box-shadow: none;
}

.person-node.is-connection-source {
  z-index: 8;
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(201, 42, 42, 0.18), 0 12px 28px rgba(28, 24, 19, 0.16);
}

.person-node.is-connection-target {
  z-index: 8;
  border-color: var(--green) !important;
  box-shadow: 0 0 0 3px rgba(43, 138, 62, 0.18), 0 12px 28px rgba(28, 24, 19, 0.16);
}

.person-node.is-connection-path {
  z-index: 6;
  border-color: var(--indigo) !important;
  background: #f6f8ff;
}

.graph-host.is-morphing .person-node {
  will-change: transform, opacity;
}

.graph-host.has-selection .person-node.is-morph-leaving,
.person-node.is-morph-leaving {
  pointer-events: none;
}

.person-node.is-hidden {
  display: none;
}

@media (max-width: 1240px) {
  .explore-panel {
    top: 64px;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  }

  .title-block {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .topbar {
    top: 7px;
    right: 8px;
    left: 8px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 8px;
  }

  .topbar.is-focused-title {
    top: 7px;
    max-width: calc(100vw - 16px);
  }

  .topbar.is-connection-title {
    display: none;
  }

  .genealogy-app.has-mobile-connection-title .mobile-connection-title {
    position: fixed;
    z-index: 33;
    top: 7px;
    right: 8px;
    left: 8px;
    display: grid;
    min-height: 38px;
    align-content: center;
    justify-items: center;
    gap: 1px;
    padding: 0;
    pointer-events: none;
    text-align: center;
  }

  .genealogy-app.has-mobile-connection-title .mobile-connection-title::before {
    position: absolute;
    z-index: -1;
    inset: -5px -10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    filter: blur(10px);
    content: "";
  }

  .home-link {
    display: none;
  }

  .title-block {
    grid-column: 1;
    max-width: calc(100vw - 32px);
    padding: 3px 10px 4px;
  }

  .title-block h1 {
    font-size: 16px;
  }

  .mobile-connection-people,
  .mobile-connection-label {
    display: block;
    overflow: hidden;
    max-width: 100%;
    color: rgba(33, 31, 31, 0.92);
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow:
      0 1px 0 rgba(255, 255, 255, 0.92),
      0 2px 8px rgba(255, 255, 255, 0.96),
      0 12px 28px rgba(255, 255, 255, 0.78),
      0 1px 12px rgba(34, 30, 26, 0.14);
  }

  .mobile-connection-people {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    width: 100%;
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
  }

  .mobile-connection-name {
    flex: 0 1 auto;
    overflow: hidden;
    min-width: 0;
    max-width: calc((100vw - 64px) / 2);
    text-overflow: ellipsis;
  }

  .mobile-connection-arrow {
    position: relative;
    flex: 0 0 16px;
    width: 16px;
    height: 7px;
    color: var(--muted);
    opacity: 0.72;
    background: linear-gradient(currentColor, currentColor) center / 10px 1.5px no-repeat;
  }

  .mobile-connection-arrow::before,
  .mobile-connection-arrow::after {
    position: absolute;
    top: 50%;
    width: 4px;
    height: 4px;
    border-color: currentColor;
    border-style: solid;
    content: "";
  }

  .mobile-connection-arrow::before {
    left: 2px;
    transform: translateY(-50%) rotate(45deg);
    border-width: 0 0 1.5px 1.5px;
  }

  .mobile-connection-arrow::after {
    right: 2px;
    transform: translateY(-50%) rotate(45deg);
    border-width: 1.5px 1.5px 0 0;
  }

  .mobile-connection-label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .explore-toggle {
    position: fixed;
    z-index: 34;
    top: 66px;
    right: 8px;
    display: inline-grid;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    place-items: center;
    padding: 0;
    border-color: rgba(217, 211, 202, 0.95);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 10px 24px rgba(34, 30, 26, 0.12);
    color: var(--ink);
    line-height: 1;
    backdrop-filter: blur(12px);
  }

  .genealogy-app.has-mobile-connection-title .explore-toggle {
    top: 66px;
    right: 8px;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    border-color: rgba(217, 211, 202, 0.96);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 24px rgba(34, 30, 26, 0.12);
  }

  .explore-toggle::before {
    color: var(--ink);
    content: "\2630";
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
  }

  .explore-toggle-label,
  .explore-toggle-detail {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .genealogy-app.is-controls-open .explore-toggle {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
  }

  .mode-toggle {
    min-height: 32px;
    padding: 2px;
    gap: 2px;
    border-radius: 7px;
  }

  .mode-toggle button {
    min-height: 26px;
    font-size: 13px;
  }

  .search-box {
    gap: 0;
  }

  .search-label {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .search-box input[type="search"] {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 16px;
  }

  .connection-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .connect-actions {
    gap: 5px;
    margin-top: 6px;
  }

  .connect-actions button {
    min-height: 28px;
    padding: 0 5px;
    font-size: 13px;
  }

  .connect-status {
    margin-top: 5px;
    font-size: 11px;
  }

  .view-controls {
    gap: 5px;
  }

  .control-group {
    min-height: 32px;
    padding: 2px;
    gap: 2px;
    border-radius: 7px;
  }

  .zoom-group {
    flex: 0 0 auto;
  }

  .view-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    flex: 1 1 230px;
    flex-wrap: wrap;
  }

  .view-controls .icon-control {
    width: 30px;
    min-width: 30px;
    font-size: 18px;
  }

  .view-controls button {
    min-height: 28px;
    font-size: 13px;
  }

  .view-group button {
    min-width: 0;
    padding: 0 5px;
  }

  .explore-panel {
    top: 78px;
    right: 8px;
    bottom: auto;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 136px);
    max-height: min(480px, calc(100svh - 136px));
    gap: 6px;
    padding: 7px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    visibility: hidden;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  }

  .genealogy-app.has-mobile-connection-title .explore-panel {
    top: 60px;
    max-height: calc(100vh - 118px);
    max-height: min(480px, calc(100svh - 118px));
  }

  .genealogy-app.is-controls-open .explore-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
  }

  .explore-close {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 2;
    display: inline-grid;
    width: 28px;
    min-width: 28px;
    min-height: 28px;
    place-items: center;
    padding: 0;
    border-color: transparent;
    background: rgba(255, 255, 255, 0.88);
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
  }

  .explore-panel .mode-toggle {
    margin-right: 34px;
  }

  .search-results {
    position: static;
    max-height: min(230px, 34vh);
    margin-top: 5px;
  }

  .source-strip {
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    overflow: hidden;
    padding: 5px 7px;
    font-size: 10px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .source-strip a {
    font-size: 10px;
  }

  .person-node.is-lineage-card {
    gap: 2px;
    padding: 8px 9px;
  }

  .person-node.is-lineage-card .node-name {
    padding-right: 38px;
    font-size: 20px;
    line-height: 1.06;
  }

  .person-node.is-lineage-card .node-detail {
    font-size: 14px;
    line-height: 1.08;
  }

  .person-node.is-lineage-card .node-country-flag {
    top: 6px;
    right: 7px;
    font-size: 24px;
  }

  .person-node.shows-thesis .node-thesis {
    margin-top: 4px;
    padding-top: 5px;
    font-size: 13px;
    line-height: 1.15;
    -webkit-line-clamp: 1;
  }
}
