/* Академия (docs/UI_PLAN.md §3 п. 15; js/screens/research.js): сетка ветвей карточками, дерево ветви шагом окна,
   карточка узла всплывающим окном, очередь внизу окна. Прежние правила .rs-* — в css/kod.css; этот файл грузится позже
   и перебивает их (вид — в обоих положениях, размеры стоя — под body.vertical). */

/* ——— окно-раздел: тело — колонка, очередь прилипает к низу ——— */
.modal.rs-modal > .modal-body { display: flex; flex-direction: column; }
.modal.rs-modal > .modal-body > * { flex-shrink: 0; }
.rs-view { display: flex; flex-direction: column; gap: 10px; }
.rs-sum { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--w-muted, var(--muted)); font-weight: 700; }

/* ——— сетка ветвей ——— */
.rs-branches { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.rs-br {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  min-height: 190px; padding: 14px 8px 10px; box-sizing: border-box; cursor: pointer; font: inherit; color: #fff;
  border: 0; border-radius: 12px; background: linear-gradient(#6e9bd0, #3d6493);
  box-shadow: 0 3px 0 #2b4a70, inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.rs-br:active { transform: translateY(2px); box-shadow: 0 1px 0 #2b4a70; }
.rs-br .ic { flex: 1; display: flex; align-items: center; justify-content: center; }
.rs-br .ic :is(svg, img) { width: 72px; height: 72px; }
.rs-br .pct { font: 700 26px/1 var(--sans); text-shadow: var(--t-outline); }
.rs-br .nm { width: 100%; padding: 4px 2px 0; border-top: 1px solid rgba(255, 255, 255, 0.3); text-align: center;
  font: 700 var(--fs-list)/1.15 var(--sans); text-shadow: var(--t-outline); overflow-wrap: anywhere; }
.rs-br.max { background: linear-gradient(#7cbf7a, #3f8f4f); box-shadow: 0 3px 0 #2a6436, inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.rs-br.run { box-shadow: 0 0 0 3px #ffd25e, 0 0 16px 4px rgba(255, 210, 94, 0.75), 0 3px 0 #2b4a70; }
.rs-rec {
  position: absolute; top: 8px; inset-inline: -6px; padding: 3px 6px; border-radius: 6px; text-align: center;
  background: linear-gradient(#ffd25e, #ec9a1e); color: #5a3000; font: 700 var(--fs-min, 12px)/1.1 var(--sans);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); overflow-wrap: anywhere;
}
.rs-flag {
  position: absolute; top: -6px; inset-inline-end: -6px; display: flex; align-items: center; gap: 2px; padding: 2px 8px 2px 4px;
  border-radius: 999px; background: #d63a34; border: 2px solid #fff; font: 700 var(--fs-min, 12px)/1 var(--sans);
}
.rs-br:has(.rs-rec) .ic { padding-top: 22px; }

/* ——— дерево ветви (research.js treeHtml; аудит 07.11 zamok-06, образец 048): полоса «изучено N %», узлы-шестиугольники
   рядами по цепочке требований, линии связи — SVG под узлами (выполнено — золотом, нет — серым пунктиром); на узле —
   «2/5»; изучен до конца — золотой, закрыт — серый с замком, идёт — светится и с отсчётом ——— */
.rs-prog { display: flex; align-items: center; gap: 12px; margin: 2px 0 10px; }
.rs-pbar { flex: 1; height: 14px; border-radius: 7px; background: rgba(0, 0, 0, 0.2); overflow: hidden; }
.rs-pbar i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, #3f8f4f, #8fd060); }
.rs-prog b { font: 700 24px/1 var(--sans); }
.rs-tree { position: relative; width: 100%; max-width: 760px; margin: 0 auto 12px; }
.rs-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.rs-links path { fill: none; stroke: #97a3b2; stroke-width: 5; stroke-dasharray: 10 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rs-links path.ok { stroke: #d9a640; stroke-width: 7; stroke-dasharray: none; }
.rs-node {
  position: absolute; z-index: 1; transform: translateX(-50%); width: min(180px, calc(100% / var(--n, 1) - 2px));
  display: flex; flex-direction: column; align-items: center; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: var(--text);
}
.rs-hex, .rs-hexi { clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.rs-hex { position: relative; flex: none; width: 132px; height: 150px; background: linear-gradient(#d8b46a, #7a5420); }
.rs-node.n4 .rs-hex { width: 120px; height: 138px; }
.rs-node.n5 .rs-hex { width: 112px; height: 128px; }
.rs-hexi {
  position: absolute; inset: 5px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 34%, #4f74a3, #1d2c45 76%);
}
.rs-hexi > :is(img, svg) { width: 62%; height: 62%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.rs-node:active .rs-hex { transform: scale(0.96); }
.rs-node.max .rs-hex { background: linear-gradient(#ffeaa8, #cf8618); }
.rs-node.max .rs-hexi { background: radial-gradient(circle at 50% 34%, #6aa84f, #22502a 76%); }
.rs-node.run .rs-hex { background: linear-gradient(#fff4c4, #ffae00); filter: drop-shadow(0 0 10px rgba(255, 196, 70, 0.95)); }
.rs-node.locked .rs-hex { background: linear-gradient(#aab0b9, #5d6470); }
.rs-node.locked .rs-hexi { background: radial-gradient(circle at 50% 34%, #646d79, #2b313a 76%); }
.rs-node.locked .rs-hexi > :is(img, svg) { filter: grayscale(1) brightness(0.8); }
.rs-lk {
  position: absolute; z-index: 2; top: 92px; left: calc(50% + 28px); width: 34px; height: 34px; border-radius: 17px; display: flex;
  align-items: center; justify-content: center; background: #566274; box-shadow: 0 0 0 3px #fff;
}
.rs-lk > :is(svg, img) { width: 20px; height: 20px; }
.rs-nlv {
  position: relative; z-index: 2; margin-top: -20px; min-width: 58px; padding: 2px 10px; box-sizing: border-box; border-radius: 999px;
  background: #34445e; border: 2px solid #fff; color: #fff; font: 700 20px/1.15 var(--sans); text-align: center; font-variant-numeric: tabular-nums;
}
.rs-node.max .rs-nlv { background: #3f8f4f; }
.rs-node.run .rs-nlv { background: #c27a10; }
.rs-nm {
  margin-top: 4px; max-width: 100%; font: 700 18px/1.15 var(--sans); text-align: center; overflow-wrap: anywhere; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.rs-ntm { margin-top: 4px; display: flex; align-items: center; gap: 4px; color: #a8650c; font: 700 18px/1.2 var(--sans); font-variant-numeric: tabular-nums; }

/* ——— очередь внизу окна ——— */
/* research.js переносит .rs-dock из тела окна в само окно: под прокруткой, у низа */
.rs-dock { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 10px; border-top: 1px solid rgba(42, 52, 66, 0.25); }
.rs-q {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 6px 10px; box-sizing: border-box; border-radius: 12px; text-align: start;
  background: var(--w-well, rgba(16, 20, 28, 0.5)); border: 0; font: inherit; color: inherit;
}
.rs-q-ic { position: relative; flex: none; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: rgba(255, 255, 255, 0.4); }
.rs-q-ic :is(svg, img) { max-width: 44px; max-height: 44px; }
.rs-q-n { position: absolute; top: -6px; inset-inline-start: -6px; min-width: 22px; height: 22px; border-radius: 11px; background: #3d6493; color: #fff;
  border: 2px solid #fff; font: 700 13px/18px var(--sans); text-align: center; font-style: normal; }
.rs-q-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rs-q-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-q.free .rs-q-t { color: var(--w-good, #2f7a3e); font-weight: 700; }
.rs-q.locked { cursor: pointer; color: var(--w-muted, var(--muted)); }
.rs-q.locked .rs-q-ic { background: rgba(86, 98, 116, 0.2); }
.rs-q-bar { position: relative; display: block; height: 22px; border-radius: 11px; overflow: hidden; background: #34445e; } /* белый отсчёт — на тёмной дорожке */
.rs-q-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, #3f8f4f, #8fd060); }
.rs-q-bar em { position: relative; display: block; text-align: center; font: 700 15px/22px var(--sans); color: #fff; font-style: normal;
  text-shadow: var(--t-outline); font-variant-numeric: tabular-nums; }
.rs-q .hn-line { font-size: var(--fs-sub); }
.rs-ff {
  flex: none; width: 52px; height: 52px; padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
  border-radius: 50%; border: 2px solid #9a5a08; background: radial-gradient(circle at 50% 35%, #ffd25e, #ec9a1e);
  box-shadow: inset 0 -3px 0 rgba(110, 56, 0, 0.35), 0 3px 0 rgba(0, 0, 0, 0.35);
}
.rs-ff:active { transform: translateY(2px); }

/* ——— карточка узла (всплывающее окно) ——— */
.rs-card-h .ic { flex: none; width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--w-well, rgba(16, 20, 28, 0.5)); }
.rs-card-h .ic :is(svg, img) { width: 72px; height: 72px; }
.rs-card-h b { font-size: var(--fs-list); }
.rs-card .done { padding: 12px; border-radius: 10px; background: var(--w-well, rgba(16, 20, 28, 0.5)); color: var(--w-good, #2f7a3e); font-weight: 700; }
.rs-was { padding: 10px 14px; border-radius: 10px; background: var(--w-well, rgba(16, 20, 28, 0.5)); font-weight: 700; }
.rs-was .nx { color: #2f8a3e; }
.rs-reqs { display: flex; flex-direction: column; gap: 6px; }
.rs-req { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; box-sizing: border-box; border-radius: 10px; background: var(--w-well, rgba(16, 20, 28, 0.5)); }
.rs-req .ic { flex: none; width: 40px; display: flex; justify-content: center; }
.rs-req .ic :is(svg, img) { max-width: 36px; max-height: 36px; }
.rs-req .t { flex: 1; min-width: 0; }
.rs-req b { flex: none; font-variant-numeric: tabular-nums; }
.rs-req b.lack { color: var(--w-bad, #c0221c); }
.ok-ic { flex: none; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.ok-ic.yes { background: #3f8f4f; }
.ok-ic.no { background: #c0221c; }
.ok-ic svg { width: 20px; height: 20px; }
.rs-req .rs-fix { flex: none; min-width: 0; padding-inline: 12px; } /* «Где взять» / «Перейти» вместо красного крестика */
.rs-busy { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--w-bad, #c0221c); font-weight: 700; }
.rs-card .act-bar { margin-top: 12px; }

/* ——— стоя: размеры по образцу (3 карточки ветвей в ряд, дерево узлов, строки требований 64–72) ——— */
body.vertical .rs-branches { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
body.vertical .rs-br { min-height: 280px; padding: 18px 8px 12px; }
body.vertical .rs-br .ic :is(svg, img) { width: 110px; height: 110px; }
body.vertical .rs-br .pct { font-size: 32px; }
body.vertical .rs-br .nm { font-size: 22px; }
body.vertical .rs-rec { font-size: 16px; }
body.vertical .rs-flag { font-size: 16px; padding: 3px 10px 3px 6px; }
body.vertical .rs-sum { font-size: var(--fs-sub); }
body.vertical .rs-prog b { font-size: var(--fs-num); }
body.vertical .rs-pbar { height: 18px; border-radius: 9px; }
body.vertical .rs-nm, body.vertical .rs-ntm { font-size: var(--fs-min); }
body.vertical .rs-node.n5 .rs-nm { font-size: 19px; } /* пять узлов в ряд: «Травничество» — в одну строку */
body.vertical .rs-nlv { font-size: 22px; }
body.vertical .rs-dock { padding: 0 10px 10px; gap: 10px; border-top: 0; }
body.vertical .rs-dock .rs-q { background: linear-gradient(#e6edf5, #c6d2e0); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
body.vertical .rs-q { min-height: 84px; padding: 8px 12px; gap: 14px; }
body.vertical .rs-q-ic { width: 64px; height: 64px; }
body.vertical .rs-q-ic :is(svg, img) { max-width: 56px; max-height: 56px; }
body.vertical .rs-q-t b { font-size: 20px; }
body.vertical .rs-q.locked { color: var(--w-hi, var(--text)); font-size: 20px; font-weight: 700; }
body.vertical .rs-q-n { font-size: 16px; line-height: 20px; min-width: 26px; height: 26px; }
body.vertical .rs-q-bar { height: 28px; border-radius: 14px; }
body.vertical .rs-q-bar em { font-size: 18px; line-height: 28px; }
body.vertical .rs-ff { width: 64px; height: 64px; }
body.vertical .rs-card-h .ic { width: 104px; height: 104px; }
body.vertical .rs-card-h .ic :is(svg, img) { width: 88px; height: 88px; }
body.vertical .rs-card-h b { font-size: 26px; }
body.vertical .rs-card-h .lv { font-size: var(--fs-sub); }
body.vertical .rs-was { font-size: 24px; }
body.vertical .rs-req { min-height: 68px; font-size: 20px; }
body.vertical .rs-req b { font-size: 22px; }
body.vertical .ok-ic { width: 36px; height: 36px; }
body.vertical .ok-ic svg { width: 24px; height: 24px; }
body.vertical .rs-req .rs-fix { min-width: 140px; }
body.vertical .modal.rs-node-win .pips i { width: 22px; height: 8px; }

/* ——— лёжа на телефоне (body.phone-land, js/ui.js fitStage: сцена мельче 3/4): имена узлов дерева и отсчёт — не мельче
   --fs-min, номер второй очереди, отсчёт и уровень в карточке узла — не мельче 16; на планшете и ПК — как было ——— */
body.phone-land .rs-nm, body.phone-land .rs-ntm { font-size: var(--fs-min); }
body.phone-land .rs-prog b { font-size: var(--fs-num); }
body.phone-land .rs-q-n { min-width: 26px; height: 26px; border-radius: 13px; font-size: 16px; line-height: 22px; }
body.phone-land .rs-q-bar { height: 26px; border-radius: 13px; }
body.phone-land .rs-q-bar em { font-size: var(--fs-sub); line-height: 26px; }
body.phone-land .rs-card-h .lv { font-size: var(--fs-sub); }
body.phone-land .rs-node-win .btn.two .sub { font-size: var(--fs-btn-s); }
