/* Числовые домики, связки, семейства примеров, таблица состава */
.nb-f[hidden] { display: none !important; }
.nb-grid { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr);
  gap: 6mm 8mm; font-variant-numeric: tabular-nums; color: #222; }
.nb-cell { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; container-type: size; }

/* домик: крыша + этажи; размер шрифта — от высоты клетки (cqh) и числа этажей */
.nb-houses { container-type: size; grid-template-rows: repeat(var(--rows), auto); align-content: center; }
.nb-houses .nb-cell { container-type: normal; align-items: flex-end; }
/* единица — высота этажа, одна на весь лист (по самому высокому домику), чтобы этажи были ровными;
   считается от размеров всей сетки: и по высоте ряда, и по ширине колонки */
.nb-house { --u: min(calc((100cqh - (var(--rows) - 1) * 6mm) / var(--rows) / (var(--m) + 1.7)), calc((100cqw - (var(--cols) - 1) * 8mm) / var(--cols) / 4.6), 22mm);
  height: calc(var(--u) * (var(--n) + 1.7)); width: min(100%, max(calc(var(--u) * 4.6), 55mm)); display: flex; flex-direction: column; }
.nb-roof { position: relative; height: calc(var(--u) * 1.7); flex: none; }
.nb-roof svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.nb-roof span { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; font: 600 calc(var(--u) * .78)/1 var(--head); color: var(--brand-dark); }
.nb-floors { flex: 1; display: grid; grid-template-rows: repeat(var(--n), 1fr); border: 1.6px solid #333; border-top: 0; margin: 0 5%; }
.nb-fl { display: grid; grid-template-columns: 1fr 1fr; border-top: 1.6px solid #333; }
.nb-w { display: flex; align-items: center; justify-content: center; font: 600 calc(var(--u) * .6)/1 var(--head); }
.nb-w + .nb-w { border-left: 1.6px solid #333; }
.nb-w b, .nb-b b { color: var(--teal); }

/* связка из трёх кружков */
.nb-bond { width: 100%; height: 100%; max-width: 95mm; }
.nb-bond .lines line { stroke: #333; stroke-width: 1.6; }
.nb-bond circle { fill: #fff; stroke: #333; stroke-width: 1.6; }
.nb-bond circle.whole { fill: #fff1e3; }
.nb-bond text { font: 600 19px var(--head); text-anchor: middle; fill: #222; }
.nb-bond text.ans { fill: var(--teal); }

/* домик семейства примеров */
.nb-fact { height: 100%; width: min(100%, 78mm); display: flex; flex-direction: column; }
.nb-froof { position: relative; height: 30%; flex: none; }
.nb-froof svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.nb-froof span { position: absolute; font: 600 13pt/1 var(--head); width: 10mm; height: 10mm; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1.4px solid #333; border-radius: 50%; }
.nb-froof .t { left: calc(50% - 5mm); top: 22%; color: var(--brand-dark); }
.nb-froof .l { left: 22%; bottom: 8%; }
.nb-froof .r { right: 22%; bottom: 8%; }
.nb-fbody { flex: 1; border: 1.6px solid #333; border-top: 0; margin: 0 5%; display: grid; grid-template-rows: repeat(4, 1fr); padding: 1mm 3mm; }
.nb-eq { display: flex; align-items: center; justify-content: center; gap: 1.5mm; font: 600 16pt/1 var(--head); }
.nb-eq + .nb-eq { border-top: 1px dashed #ccc; }
.nb-eq i { font-style: normal; width: 4mm; text-align: center; }
.nb-b { width: 12mm; height: 10mm; border: 1.3px solid #888; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.nb-facts.nb-grid { gap: 5mm 10mm; }

/* таблица состава */
.nb-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; font: 600 min(20pt, calc(200mm / var(--rows) * .4), calc(170mm / var(--cols) / 3.4))/1 var(--head); font-variant-numeric: tabular-nums; }
.nb-table th, .nb-table td { border: 1.3px solid #555; text-align: center; white-space: nowrap; }
.nb-table th { width: 13mm; background: #fff1e3; color: var(--brand-dark); font-size: 1.2em; }
.nb-table td i { font-style: normal; color: #999; margin: 0 .2em; }
.nb-table td.e { border: 0; }
