#relationships { scroll-margin-top: 1.4rem; }
.rel-heading h2 { margin: 0; font: 400 clamp(2.25rem,4.4vw,3.55rem)/1.08 var(--serif); letter-spacing: -.055em; }
.rel-heading p { margin: .45rem 0 0; color: var(--muted); }
.rel-pairs {
  display: inline-grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  max-width: 100%;
  min-width: 0;
  padding: 3px;
  margin: 1.15rem 0 .8rem;
  gap: 2px;
  border: 1px solid #cbd0bf;
  border-radius: 11px;
  background: linear-gradient(180deg,#eaece0,#f4f3e8);
  box-shadow: inset 0 1px 2px #32493812;
}
.rel-pairs label { position: relative; min-width: 0; cursor: pointer; }
.rel-pairs input { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.rel-pairs span {
  display: grid; place-items: center; min-height: 40px; padding: .4rem .95rem;
  border: 1px solid transparent; border-radius: 8px; color: #465948;
  font-size: .85rem; line-height: 1.25; font-weight: 650; white-space: nowrap;
}
.rel-pairs input:checked + span {
  color: #fffdf1; border-color: #345843;
  background: linear-gradient(165deg,#477054,#284d39);
  box-shadow: inset 0 1px #bed3ad40,0 1px 3px #263d2738;
}
.rel-pairs input:focus-visible + span,.rel-card select:focus-visible { outline: 3px solid #996831; outline-offset: 3px; }
.rel-pairs label:hover input:not(:checked) + span { color: #274b35; background: #fffdf389; }
.rel-card { display: grid; grid-template-columns: minmax(0,1.16fr) minmax(0,1fr); background: var(--porcelain); border: 1px solid #c8cdbe; border-radius: 15px; overflow: hidden; }
.rel-controls,.rel-result { min-width: 0; padding: clamp(1.25rem,2.6vw,2rem); }
.rel-controls h3 { font: 400 clamp(1.6rem,2.55vw,2.1rem)/1.1 var(--serif); color: var(--ink); letter-spacing: -.04em; margin: 0 0 1.05rem; }
.rel-control { --tone: var(--jade); --track: #adc29c; }
.rel-label,.rel-ends { display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.rel-label label,.rel-select label { font-size: .9rem; font-weight: 650; }
.rel-label output { background: #eaf0df; color: #29583c; border-radius: 5px; padding: .2rem .55rem; white-space: nowrap; font-size: .88rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.rel-ends { color: var(--muted); font-size: .76rem; }
.rel-select { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .65rem; margin-top: 1rem; }
.rel-select select {
  appearance: none; min-height: 42px; max-width: 100%; font: 550 .85rem/1.35 var(--sans);
  color: #314c39; border: 1px solid #bfc9b5; border-radius: 7px;
  padding: .46rem 2.15rem .46rem .7rem; cursor: pointer;
  background-color: #fafaf1;
  background-image: linear-gradient(45deg,transparent 45%,#526c52 48% 65%,transparent 68%),
                    linear-gradient(-45deg,transparent 45%,#526c52 48% 65%,transparent 68%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 7px;
  background-repeat: no-repeat;
  box-shadow: inset 0 1px #fffef7;
}
.rel-select select:hover { border-color: #8c9e83; }
#rel-setting { margin-top: .65rem; font-size: .86rem; color: var(--muted); line-height: 1.47; }
.rel-result { background: #e9efe2; border-left: 1px solid #d0d9c7; display: flex; flex-direction: column; justify-content: center; }
.rel-caption { color: #4d684f; text-transform: uppercase; font-size: .68rem; font-weight: 700; letter-spacing: .13em; }
.rel-readings { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: .5rem; margin: .85rem 0 .65rem; }
.rel-readings div { min-width: 0; }
.rel-readings div span { display: block; color: #466449; font-size: .75rem; font-weight: 650; letter-spacing: .07em; }
.rel-readings strong { display: block; color: #224932; font: 400 clamp(1.95rem,3vw,2.8rem)/1.2 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.055em; white-space: nowrap; }
.rel-readings div:last-child { text-align: right; }
.rel-link-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid #bccab4; color: #687f5a; }
.rel-link-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
#rel-evidence,#rel-reading { color: #3e5442; font-size: .88rem; line-height: 1.5; }
#rel-reading { border-top: 1px solid #c6d2be; margin-top: .75rem; padding-top: .65rem; }
@media(max-width:700px) {
  .rel-card { grid-template-columns: minmax(0,1fr); }
  .rel-result { border-left: 0; border-top: 1px solid #d0d9c7; }
  .rel-controls,.rel-result { padding: 1.05rem 1.18rem; }
  .rel-pairs { display: grid; width: 100%; }
  .rel-pairs span { min-height: 44px; padding: .35rem .16rem; font-size: .76rem; }
  .rel-readings { max-width: 24rem; width: 100%; }
  .rel-select { gap: .35rem .55rem; }
}
@media(forced-colors:active) {
  .rel-pairs input:checked + span { border: 2px solid Highlight; }
  .rel-pairs input:focus-visible + span { outline-color: CanvasText; }
  .rel-select select { appearance: auto; background-image: none; padding-right: .6rem; }
}
