.tree-viewport {
  --tree-grid: 22px;
  --tree-grid-x: 0px;
  --tree-grid-y: 0px;
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 260px;
  box-sizing: border-box;
  overflow: clip;
  background-color: #f7f5ef;
  background-image: radial-gradient(circle, #d3cabc 0.85px, transparent 1.35px);
  background-position: var(--tree-grid-x) var(--tree-grid-y);
  background-size: var(--tree-grid) var(--tree-grid);
  color: #222b24;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.tree-viewport:focus {
  outline: none;
}

.tree-viewport:focus-visible {
  outline: 3px solid #467456;
  outline-offset: -3px;
}

.tree-viewport.is-dragging,
.tree-viewport.is-dragging .tree-card-open {
  cursor: grabbing;
}

.tree-stage {
  position: absolute;
  inset: 0;
  transform-origin: top left;
  pointer-events: none;
}

.tree-cards,
.tree-connectors {
  position: absolute;
  inset: 0 auto auto 0;
  overflow: visible;
}

.tree-connector {
  fill: none;
  stroke-linecap: round;
}

.tree-connector-parent {
  stroke: #78917c;
  stroke-width: 2;
}

.tree-connector-partner {
  stroke: #a96538;
  stroke-width: 2.5;
  stroke-dasharray: 5 5;
}

.tree-connector-sibling {
  stroke: #6d608c;
  stroke-width: 2.5;
  stroke-dasharray: 1 6;
}

.tree-card {
  position: absolute;
  isolation: isolate;
  box-sizing: border-box;
  width: 232px;
  height: 112px;
  border: 1px solid #dad8cb;
  border-radius: 15px;
  background-color: #fffefa;
  box-shadow: 0 2px 4px #39472c12, 0 9px 22px #39472c0d;
  color: #222b24;
  pointer-events: auto;
}

.tree-card:hover,
.tree-card:focus-within,
.tree-card.is-selected {
  z-index: 2;
  border-color: #477559;
  box-shadow: 0 0 0 2px #47755926, 0 9px 22px #39472c19;
}

.tree-card.is-selected {
  background-color: #f7f9f2;
}

.tree-card.is-muted:not(:hover, :focus-within, .is-selected) {
  opacity: 0.3;
}

.tree-card-open {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 12px 40px 12px 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  touch-action: none;
}

.tree-card-open:focus-visible,
.tree-card-relate:focus-visible,
.tree-empty-action:focus-visible {
  outline: 3px solid #467456;
  outline-offset: 2px;
}

.tree-portrait {
  position: relative;
  display: grid;
  flex: 0 0 46px;
  place-items: center;
  width: 46px;
  height: 46px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #cbd7c8;
  border-radius: 12px;
  background: #e5ece0;
  color: #345643;
  pointer-events: none;
}

.tree-initials {
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: 0.04em;
}

.tree-portrait-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tree-card-label {
  display: grid;
  gap: 4px;
  min-width: 0;
  pointer-events: none;
}

.tree-card-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.18;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.tree-card-years {
  overflow: hidden;
  color: #565f52;
  font-size: 0.875rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-card-relate {
  position: absolute;
  top: 30px;
  right: -9px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid #c9d8c9;
  border-radius: 50%;
  background: #f3f7ef;
  color: #244d39;
  box-shadow: 0 2px 5px #244d391c;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.tree-card-relate:hover {
  border-color: #244d39;
  background: #244d39;
  color: #fffefa;
}

.tree-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  pointer-events: none;
}

.tree-empty[hidden] {
  display: none;
}

.tree-empty-ornament {
  width: clamp(50px, 10vmin, 72px);
  height: auto;
  margin-bottom: 11px;
  padding: 8px;
  border: 1px solid #ccd6c7;
  border-radius: 22px;
  background: #e7eee1;
  fill: none;
  stroke: #355d48;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tree-empty-title {
  margin: 0;
  color: #26372a;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.65rem, 3.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
}

.tree-empty-description {
  max-width: 29rem;
  margin: 9px 0 20px;
  color: #576053;
  font-size: 1rem;
  line-height: 1.45;
}

.tree-empty-action {
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid #244d39;
  border-radius: 10px;
  background: #244d39;
  color: #fffefa;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  pointer-events: auto;
}

.tree-empty-action:hover {
  background: #1d3f2e;
}
