.vocab-logic {
  --logic-ink: #263831;
  --logic-paper: #f1eee4;
  --logic-wire: #b1b9ad;
  margin-block: 24px;
  padding: clamp(15px, 3vw, 25px);
  border: 1px solid #c8cbc1;
  background: var(--logic-paper);
  color: var(--logic-ink);
}

.vocab-logic-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #d0d3c8;
}

.vocab-logic-heading h4 {
  margin: 0;
  font-size: clamp(20px, 3vw, 25px);
  letter-spacing: -.035em;
  line-height: 1.3;
}

.vocab-difficulty-wrap {
  min-width: 0;
}

.vocab-difficulty {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #bdcbbd;
  background: #e6ece0;
  color: #354b3c;
  font-size: 11px;
  white-space: nowrap;
}

.vocab-difficulty--medium {
  border-color: #cec2a9;
  background: #eee6d4;
  color: #624b28;
}

.vocab-difficulty--hard {
  border-color: #d5b7ac;
  background: #f3e2dc;
  color: #7a3c30;
}

.vocab-difficulty strong { font-size: 12px; }
.vocab-difficulty .vocab-difficulty-estimate {
  border-left: 1px solid currentColor;
  margin-left: 2px;
  padding-left: 6px;
}
.vocab-difficulty-reason {
  margin: 6px 0 0;
  color: #4c5850;
  font-size: 12px;
  text-wrap: pretty;
}
.vocab-logic-reason {
  max-width: 32ch;
  margin: 0;
  color: #4c5850;
  font-size: 12px;
  text-wrap: pretty;
}

.vocab-logic-graph {
  display: grid;
  grid-template-columns: minmax(125px, .75fr) minmax(0, 1.25fr);
  align-items: center;
  column-gap: 22px;
  padding-top: 16px;
}

.vocab-logic-anchor {
  position: relative;
  min-width: 0;
  padding: 14px 15px;
  background: #273b33;
  color: #faf6e9;
}

.vocab-logic-anchor::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 22px;
  border-top: 1px solid var(--logic-wire);
}

.vocab-logic-anchor > span {
  display: block;
  margin-bottom: 4px;
  color: #d9e0d2;
  font-size: 11px;
}

.vocab-logic-anchor > strong {
  display: block;
  font-size: clamp(14px, 2.3vw, 17px);
  overflow-wrap: anywhere;
}

.vocab-logic-edges {
  position: relative;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 1px solid var(--logic-wire);
  list-style: none;
}

.vocab-logic-edges > li {
  position: relative;
  min-width: 0;
}

.vocab-logic-edges > li::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  width: 16px;
  border-top: 1px solid var(--logic-wire);
}

.vocab-logic-edges > li::after {
  content: "";
  position: absolute;
  top: calc(50% - 2px);
  right: calc(100% + 14px);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #77887a;
}

.vocab-logic-edge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid #c8cbc1;
  background: #faf8f0;
  color: var(--logic-ink);
  text-align: left;
}

.vocab-logic-edge:hover {
  border-color: #8c9d8c;
  background: #e6ede1;
}

.vocab-logic-edge-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.vocab-logic-edge-copy > strong { font-size: 13px; }
.vocab-logic-relation { color: #4e5d53; font-size: 11px; }
.vocab-logic-arrow { color: #617568; }
.vocab-logic-empty { margin: 0; color: #4c5850; font-size: 13px; }
.vocab-logic-graph--empty .vocab-logic-anchor::after { display: none; }

@media (max-width: 630px) {
  .vocab-logic-graph { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .vocab-logic-anchor::after {
    top: 100%;
    left: 16px;
    width: 0;
    height: 9px;
    border-top: none;
    border-left: 1px solid var(--logic-wire);
  }
  .vocab-logic-edges { margin: 9px 0 0 16px; }
  .vocab-logic-empty { margin-top: 10px; }
}

html[data-w2-theme="dark"] .vocab-logic {
  --logic-ink: var(--v-ink, #f5f2eb);
  --logic-paper: #1f2927;
  --logic-wire: #788f80;
  border-color: #52645b;
}

html[data-w2-theme="dark"] .vocab-logic-heading { border-color: #52645b; }
html[data-w2-theme="dark"] :is(.vocab-difficulty-reason, .vocab-logic-reason, .vocab-logic-relation,
  .vocab-logic-arrow, .vocab-logic-empty) { color: #bbcfc0; }

html[data-w2-theme="dark"] .vocab-difficulty {
  color: #c9e5c6;
  background: #25352b;
  border-color: #647f6b;
}

html[data-w2-theme="dark"] .vocab-difficulty--medium {
  color: #f6cf92;
  background: #392d20;
  border-color: #967b50;
}

html[data-w2-theme="dark"] .vocab-difficulty--hard {
  color: #ffc0ae;
  background: #422b28;
  border-color: #a1776a;
}

html[data-w2-theme="dark"] .vocab-logic-anchor {
  background: #34473d;
  color: var(--logic-ink);
}

html[data-w2-theme="dark"] .vocab-logic-edges > li::after { background: var(--logic-wire); }
html[data-w2-theme="dark"] .vocab-logic-edge { background: #26332e; border-color: #74897a; }
html[data-w2-theme="dark"] .vocab-logic-edge:hover { background: #34473d; border-color: #8aa594; }
