/* Интерактивный слой: тренажёры, эксплорер, карточка узла, квиз. */

.tsection { padding: 90px 0 40px; border-top: 1px solid var(--line); }
.sim-card {
  max-width: 920px; margin: 0 auto; padding: 24px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}

/* эксплорер */
.explore-bar { max-width: 920px; margin: 0 auto; padding: 0 24px; position: relative; }
.explore-bar input[type="search"] {
  width: 100%; padding: 12px 16px;
  font-family: var(--mono); font-size: 14px; color: var(--fg);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.15s;
}
.explore-bar input[type="search"]:focus { border-color: var(--muted); }
/* A11y 2.4.7: убран outline:none — у фокуса есть видимое кольцо, а не только 1px-граница */
.explore-bar input[type="search"]:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }
.explore-hints { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.hint-chip { cursor: pointer; }
.explore-results { margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.explore-result {
  text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; color: var(--fg); font-family: var(--sans);
  transition: border-color 0.15s;
}
.explore-result:hover { border-color: var(--muted); }
.explore-result .er-title { font-size: 13.5px; font-weight: 600; }
.explore-result .er-meta { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.explore-result .er-short { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* карточка узла */
#node-card {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 110;
  width: min(430px, 92vw);
  background: var(--bg); border-left: 1px solid var(--line);
  padding: 26px 26px 90px; overflow-y: auto;
  transform: translateX(105%);
  /* visibility:hidden у закрытой (QA wave-3): сдвинутая за край карточка оставалась
     фокусируемой и кликабельной невидимо — клавиатура «сама» открывала/закрывала её */
  visibility: hidden;
  transition: transform 0.28s ease, visibility 0s 0.28s;
}
#node-card.open { transform: none; visibility: visible; transition: transform 0.28s ease; }
#node-card .nc-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font-family: var(--mono); font-size: 12px;
  padding: 4px 10px; cursor: pointer;
}
#node-card .nc-close:hover { color: var(--fg); }
#node-card .nc-layer { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 8px; display: inline-block; }
#node-card h3 { font-size: 19px; margin-bottom: 10px; }
#node-card .nc-country { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 14px; }
#node-card .nc-block { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
#node-card .nc-block .mode-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 6px;
}
#node-card .nc-block p { color: var(--fg); font-size: 13.5px; }
#node-card .nc-law { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 10px; }
#node-card .nc-links { margin-top: 18px; }
#node-card .nc-links h4 {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
#node-card .nc-link {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-left: 2px solid var(--line); color: var(--fg); font-size: 12.5px; padding: 5px 0 5px 10px;
  cursor: pointer; transition: border-color 0.15s;
}
#node-card .nc-link:hover { border-left-color: var(--muted); }
#node-card .nc-link .l-dir { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-right: 6px; }

/* симулятор инвестора */
.sim-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.sim-field { display: flex; flex-direction: column; gap: 8px; }
.sim-label { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.sim-label b { color: var(--fg); text-transform: none; letter-spacing: 0; }
.sim-field select, .sim-field input[type="range"] { accent-color: var(--muted); }
.sim-field select {
  font-family: var(--sans); font-size: 13.5px; color: var(--fg);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.sim-field input[type="range"] { width: 100%; }
.sim-verdict { margin-top: 20px; display: grid; gap: 10px; }
.verdict-row {
  display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg);
}
.verdict-row .v-key { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.verdict-row .v-val { font-size: 14px; }
.verdict-row.pass { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.verdict-row.fail { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.verdict-row.pass .v-key { color: var(--ok); }
.verdict-row.fail .v-key { color: var(--danger); }
.verdict-row .v-law { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* сделка */
.deal-track { display: flex; align-items: flex-start; gap: 0; margin: 6px 0 14px; position: relative; padding: 10px 4px; }
.deal-station { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; background: none; border: none; padding: 0; }
.deal-station .ds-dot {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg); color: var(--muted);
  font-family: var(--mono); font-size: 10.5px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  position: relative; z-index: 2;
}
.deal-station .ds-label { font-family: var(--mono); font-size: 9.5px; color: var(--muted); text-align: center; line-height: 1.25; max-width: 96px; }
.deal-station.is-done .ds-dot { background: var(--muted); border-color: var(--muted); color: var(--bg); }
.deal-station.is-active .ds-dot { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.deal-station.is-active .ds-label { color: var(--fg); }
.deal-line { position: absolute; top: 22px; left: 6%; right: 6%; height: 1px; background: var(--line); z-index: 0; }
.deal-line-fill { position: absolute; top: 22px; left: 6%; height: 1px; background: var(--fg); z-index: 1; transition: width 0.3s ease; }
.deal-controls { display: flex; gap: 8px; justify-content: center; margin: 8px 0 14px; }
.deal-info { border-top: 1px solid var(--line); padding-top: 14px; }
.deal-info .di-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.deal-info .di-text { color: var(--muted); font-size: 13.5px; }
.deal-info .di-doc { font-family: var(--mono); font-size: 11px; color: var(--fg); margin-top: 10px; }
.deal-info .di-law { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 6px; }

/* инцидент */
.incident-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.incident-tabs .chip { cursor: pointer; }
.incident-tabs .chip.is-on { border-color: var(--fg); }
.incident-matrix { display: flex; flex-direction: column; gap: 8px; }
.incident-row {
  display: grid; grid-template-columns: minmax(180px, 1.2fr) repeat(1, minmax(0, 2fr));
  gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
.incident-row .ir-source { font-size: 13px; font-weight: 600; }
.incident-row .ir-source small { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.incident-row .ir-verdict { font-size: 13px; color: var(--muted); }
.incident-row .ir-verdict .mark { font-weight: 700; margin-right: 6px; }
.incident-row .ir-verdict .mark.yes { color: var(--ok); }
.incident-row .ir-verdict .mark.part { color: var(--muted); }
.incident-row .ir-verdict .mark.no { color: var(--danger); }

/* квиз */
.quiz-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.quiz-progress .qp-bar { flex: 1; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.quiz-progress .qp-fill { height: 100%; background: var(--fg); width: 0%; transition: width 0.25s; }
.quiz-q { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.quiz-answers { display: flex; flex-direction: column; gap: 8px; }
.quiz-answer {
  text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--fg); font-size: 13.5px; padding: 11px 14px; cursor: pointer;
  transition: border-color 0.15s; font-family: var(--sans);
}
.quiz-answer:hover { border-color: var(--muted); }
.quiz-answer.is-right { border-color: var(--ok); }
.quiz-answer.is-wrong { border-color: var(--danger); }
.quiz-answer:disabled { cursor: default; }
.quiz-explain {
  margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); font-size: 13px; color: var(--muted);
}
/* A11y 2.1.1: qe-node теперь <button> — сброс юзер-агентских стилей, вид прежний */
.quiz-explain .qe-node {
  font-family: var(--mono); font-size: 10.5px; color: var(--fg); display: inline-block; margin-top: 8px; cursor: pointer;
  background: none; border: none; border-bottom: 1px dashed var(--muted); padding: 0 0 1px;
}
.quiz-next { margin-top: 14px; }
.quiz-score { text-align: center; padding: 30px 0 10px; }
.quiz-score .qs-big { font-family: var(--mono); font-size: 34px; font-weight: 600; }
.quiz-score p { color: var(--muted); font-size: 13.5px; margin-top: 8px; }

/* страны: разворачиваемые строки */
.country-row { cursor: pointer; }
.country-nodes { grid-column: 1 / -1; display: none; padding: 4px 0 8px; }
.country-row.is-open .country-nodes { display: block; }
.country-nodes .cn-item { padding: 7px 0; border-top: 1px dashed var(--line); }
.country-nodes .cn-item:first-child { border-top: none; }
/* A11y 2.1.1: cn-title теперь <button> — сброс юзер-агентских стилей, вид прежний */
.country-nodes .cn-title {
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: none; border: none; padding: 0; width: 100%;
  text-align: left; font-family: inherit; color: inherit;
}
.country-nodes .cn-title:hover { text-decoration: underline; }
.country-nodes .cn-short { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* топбар: прогресс обучения */
#learn-progress {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px;
}

@media (max-width: 860px) {
  .tsection { padding: 70px 0 30px; }
  .sim-card { padding: 18px 16px; margin-left: 20px; margin-right: 20px; }
  .explore-bar { padding: 0 20px; }
  .deal-station .ds-label { display: none; }
  .incident-row { grid-template-columns: 1fr; }
  .verdict-row { grid-template-columns: 1fr; }
  /* тач-эргономика: цели ≥40px (QA-находки) */
  .chip, .quiz-answer, .nc-close { min-height: 40px; }
  .sim-field select { min-height: 42px; font-size: 15px; }
  /* все слайдеры ≥40px по высоте: sim-amount/sim-rate и 5 портфельных (QA wave-3) */
  input[type="range"] { min-height: 40px; }
  .deal-station { min-height: 40px; justify-content: center; }
  .rail-tick { min-height: 40px; min-width: 40px; justify-content: center; }
  .rail-tick .t-n { width: 26px; height: 26px; font-size: 11px; }
}

/* плашка «локально»: не мешает чтению — через 6 секунд тускнеет */
#local-badge { animation: badge-fade 0.6s 6s forwards; }
@keyframes badge-fade { to { opacity: 0.18; } }
@media (prefers-reduced-motion: reduce) { #local-badge { animation: none; } }

/* квиз земли в конце главы */
.land-quiz {
  max-width: 920px; margin: 30px auto 0; padding: 22px 24px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  border-left: 3px solid var(--pc, var(--muted));
}
.land-quiz .lq-title { font-size: 15px; margin-bottom: 14px; }
.land-quiz .quiz-land-q + .quiz-land-q { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.land-quiz .quiz-q { font-size: 14.5px; margin-bottom: 10px; }
.land-quiz .quiz-answer { padding: 9px 13px; }
.land-quiz .quiz-explain { font-size: 12.5px; }
@media (max-width: 860px) { .land-quiz { margin-left: 20px; margin-right: 20px; padding: 16px; } }
