.lx-family-tree-page { overflow-x: hidden; }

.lx-family-tree {
  max-width: 70rem;
  padding: clamp(.75rem, 2vh, 1.5rem) 0;
}

.lx-family-tree__header {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1rem;
  align-items: baseline;
  margin-bottom: clamp(.6rem, 1.5vh, 1rem);
}

.lx-family-tree__header h1 {
  grid-column: 1 / -1;
  margin: .1rem 0;
  font-size: clamp(2.35rem, 5vh, 4rem);
  line-height: .95;
}

.lx-family-tree__header > p:last-child {
  grid-column: 1 / -1;
  margin: .35rem 0 0;
  font-size: clamp(.92rem, 1.8vh, 1.08rem);
  line-height: 1.35;
}

.lx-family-tree__back { color: var(--explore-moss); font-weight: 750; }
.lx-family-tree__header .lx-explore-kicker { margin: 0; }
.lx-family-tree__header > * { min-width: 0; }

.lx-family-tree__game {
  padding: clamp(.65rem, 1.8vw, 1.1rem);
  border: 1px solid rgba(23, 51, 45, .18);
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 1.2rem 3rem rgba(42, 67, 53, .1);
}

.lx-family-tree__diagram {
  position: relative;
  height: clamp(12rem, 29vh, 16rem);
  min-height: 12rem;
}

.lx-family-tree__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.lx-family-tree__lines path {
  fill: none;
  stroke: var(--explore-line);
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.lx-family-tree__slot,
.lx-family-tree__card,
.lx-family-tree__check,
.lx-family-tree__another {
  min-height: 2.8rem;
  border: 1px solid var(--explore-line);
  border-radius: 999px;
  font: inherit;
}

.lx-family-tree__slot {
  z-index: 2;
  min-width: 0;
  padding: .5rem .7rem;
  border-style: dashed;
  background: rgba(251, 247, 233, .96);
  color: #63746d;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.lx-family-tree__slot.is-filled {
  border-style: solid;
  border-color: var(--explore-moss);
  background: #e7efe2;
  color: var(--explore-ink);
  font-weight: 750;
  cursor: pointer;
}

.lx-family-tree__ancestor {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(15rem, 31%);
  transform: translateX(-50%);
}

.lx-family-tree__ancestor.is-filled {
  background: var(--explore-ink);
  color: white;
}

.lx-family-tree__branch-label {
  position: absolute;
  z-index: 2;
  top: 40%;
  width: min(13rem, 29%);
  padding: .38rem .6rem;
  transform: translateX(-50%);
  border: 1px solid var(--explore-line);
  border-radius: 999px;
  background: #f7f5eb;
  color: var(--explore-moss);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-align: center;
  text-transform: uppercase;
}

.lx-family-tree__branch-label--1 { left: 25%; }
.lx-family-tree__branch-label--2 { left: 75%; }
.lx-family-tree__branch-label.is-revealed {
  border-color: var(--explore-sun);
  background: var(--explore-sun);
  color: var(--explore-ink);
  letter-spacing: 0;
  text-transform: none;
}

.lx-family-tree__leaf-slots {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.35rem, 1vw, .7rem);
}

.lx-family-tree__cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(.35rem, 1vw, .65rem);
  margin: .7rem 0;
}

.lx-family-tree__cards > p { grid-column: 1 / -1; margin: .7rem; text-align: center; }

.lx-family-tree__card {
  min-width: 0;
  padding: .55rem .65rem;
  border-radius: .7rem;
  background: var(--explore-paper);
  color: var(--explore-ink);
  font-weight: 800;
  overflow-wrap: anywhere;
  cursor: grab;
}

.lx-family-tree__card:hover:not(:disabled),
.lx-family-tree__card:focus-visible { border-color: var(--explore-moss); box-shadow: 0 0 0 3px rgba(46, 106, 85, .15); }
.lx-family-tree__card.is-placed { opacity: .3; }

.lx-family-tree__actions { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }
.lx-family-tree__check,
.lx-family-tree__another {
  padding: .55rem 1rem;
  border-color: var(--explore-ink);
  background: var(--explore-ink);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
.lx-family-tree__check:disabled { cursor: not-allowed; opacity: .45; }
.lx-family-tree__mistakes { margin-left: auto; color: #53645e; font-size: .86rem; }
.lx-family-tree__status { min-height: 1.25rem; margin: .55rem 0 0; font-size: .92rem; font-weight: 700; }
.lx-family-tree__status:focus { outline: none; }
.lx-family-tree__reveal-source { margin: .25rem 0 0; color: #65736e; font-size: .75rem; }
.lx-family-tree__source { margin: .55rem 0 0; color: #65736e; font-size: .75rem; }

@media (max-width: 44rem) {
  .lx-family-tree { width: min(100% - 1rem, 70rem); padding: .5rem 0; }
  .lx-family-tree__header { grid-template-columns: 1fr; column-gap: 0; margin-bottom: .45rem; }
  .lx-family-tree__header .lx-explore-kicker { display: none; }
  .lx-family-tree__header h1 { font-size: clamp(2rem, 8vw, 2.7rem); }
  .lx-family-tree__header > p:last-child { font-size: .85rem; }
  .lx-family-tree__game { padding: .55rem; border-radius: 1rem; }
  .lx-family-tree__diagram { height: clamp(10.5rem, 27vh, 12.5rem); min-height: 10.5rem; }
  .lx-family-tree__slot { min-height: 2.4rem; padding: .35rem .2rem; border-radius: .65rem; font-size: clamp(.62rem, 2.5vw, .78rem); }
  .lx-family-tree__ancestor { width: 42%; }
  .lx-family-tree__branch-label { top: 39%; width: 38%; padding: .28rem .2rem; font-size: .58rem; }
  .lx-family-tree__leaf-slots { gap: .25rem; }
  .lx-family-tree__cards { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: .5rem 0; }
  .lx-family-tree__card { min-height: 2.35rem; padding: .35rem .3rem; font-size: .75rem; }
  .lx-family-tree__check,
  .lx-family-tree__another { min-height: 2.4rem; padding: .4rem .75rem; }
  .lx-family-tree__status { margin-top: .35rem; font-size: .82rem; }
  .lx-family-tree__source { display: none; }
}

@media (max-height: 46rem) and (min-width: 45rem) {
  .lx-family-tree__diagram { height: 12rem; }
  .lx-family-tree__header > p:last-child { margin-top: .2rem; }
}
