.dictionary-graph {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--wash);
}

.dictionary-graph summary {
  min-height: 44px;
  padding: 11px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.dictionary-graph summary:hover {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.dictionary-graph-content {
  padding: 0 14px 14px;
}

.dictionary-graph-content h3 {
  margin: 2px 0 12px;
  font-size: 0.93rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  scroll-margin-top: 110px;
}

.dictionary-graph-chart {
  --graph-branch: clamp(0.65rem, 2vw, 1.25rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: calc(var(--graph-branch) * 2);
  align-items: center;
}

.dictionary-graph-origin,
.dictionary-graph-neighbors a {
  display: block;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  overflow-wrap: anywhere;
}

.dictionary-graph-origin {
  position: relative;
  border-color: var(--accent);
}

.dictionary-graph-marker,
.dictionary-graph-en {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.dictionary-graph-marker {
  margin-bottom: 4px;
}

.dictionary-graph-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
}

.dictionary-graph-neighbors {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dictionary-graph-neighbors li {
  position: relative;
  padding-block: 4px;
}

.dictionary-graph-neighbors a {
  min-height: 44px;
  color: var(--ink);
}

.dictionary-graph-neighbors a:hover,
.dictionary-graph-neighbors a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.dictionary-graph-origin::after,
.dictionary-graph-neighbors li::before,
.dictionary-graph-neighbors li::after {
  position: absolute;
  background: var(--muted);
  content: "";
}

.dictionary-graph-origin::after,
.dictionary-graph-neighbors li::before {
  inset-block-start: 50%;
  inline-size: var(--graph-branch);
  block-size: 1px;
}

.dictionary-graph-origin::after {
  inset-inline-start: 100%;
}

.dictionary-graph-neighbors li::before,
.dictionary-graph-neighbors li::after {
  inset-inline-start: calc(var(--graph-branch) * -1);
}

.dictionary-graph-neighbors li::after {
  inset-block: 0;
  inline-size: 1px;
}

.dictionary-graph-neighbors li:first-child::after {
  inset-block-start: 50%;
}

.dictionary-graph-neighbors li:last-child::after {
  inset-block-end: 50%;
}

@media (max-width: 760px) {
  .dictionary-graph-chart {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .dictionary-graph-origin::after {
    inset-block-start: 100%;
    inset-inline-start: var(--graph-branch);
    inline-size: 1px;
    block-size: 9px;
  }

  .dictionary-graph-neighbors {
    margin-inline-start: calc(var(--graph-branch) * 2);
  }

  .dictionary-graph-neighbors li:first-child::after {
    inset-block-start: 0;
  }
}
