/* ══════════════════════════════════════════════════
   HELP TREE POPUP — исходная версия (CSS-дерево)
══════════════════════════════════════════════════ */

.km-ht-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 15, 0.78);
  z-index: 10050;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.km-ht-overlay.is-open {
  display: flex;
}
@media (prefers-reduced-motion: no-preference) {
  .km-ht-overlay.is-open .km-ht-modal {
    animation: kmHtSlideUp 0.2s ease-out;
  }
}

.km-ht-modal {
  background: #fff;
  border-radius: 20px;
  width: min(880px, 100%);
  max-height: min(760px, 94vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  contain: layout paint;
}
@keyframes kmHtSlideUp {
  from { transform: translateY(16px); opacity: 0.6; }
  to   { transform: translateY(0); opacity: 1; }
}

.km-ht-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #eef2ee;
}
.km-ht-title {
  font-size: 16px;
  font-weight: 700;
  color: #1b3a24;
  letter-spacing: -0.2px;
}
.km-ht-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f2f5f2;
  color: #4a6b52;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.km-ht-close:hover { background: #e0ebe0; }

.km-ht-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  overflow: hidden;
}

.km-ht-tree {
  background: #f7faf7;
  border-right: 1px solid #e6ede6;
  overflow-y: auto;
  padding: 20px 0 20px 20px;
  display: flex;
  flex-direction: column;
}

.km-ht-root {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0;
}
.km-ht-root-node {
  background: var(--km-primary);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 18px;
  border-radius: 22px;
  margin-left: 8px;
  box-shadow: 0 3px 12px rgba(var(--km-primary-rgb), 0.25);
  position: relative;
  z-index: 1;
}
.km-ht-trunk {
  width: 2px;
  height: 12px;
  background: #b5d4bc;
  margin-left: 30px;
}

.km-ht-branches {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.km-ht-branches::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 24px;
  width: 2px;
  background: linear-gradient(to bottom, #b5d4bc, #d5e8d8);
}

.km-ht-branch {
  display: flex;
  align-items: center;
  position: relative;
  padding: 3px 0;
}
.km-ht-branch-line {
  flex-shrink: 0;
  width: 24px;
  height: 2px;
  background: #b5d4bc;
  margin-left: 28px;
  position: relative;
  z-index: 1;
}
.km-ht-branch::before {
  content: "";
  position: absolute;
  left: 22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #5a9b6e;
  z-index: 2;
}

.km-ht-leaf {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: #fff;
  color: #2a4f35;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  font-family: inherit;
}
.km-ht-leaf:hover {
  background: #e8f4ea;
  border-color: #9fcfac;
}
.km-ht-leaf.is-active {
  background: var(--km-primary);
  color: #fff;
  border-color: var(--km-primary);
  box-shadow: 0 3px 12px rgba(var(--km-primary-rgb), 0.28);
}
.km-ht-leaf.is-active .km-ht-leaf-icon { filter: none; }
.km-ht-leaf-icon { font-size: 15px; line-height: 1; }

.km-ht-info {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}
.km-ht-info-default {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #8aab8f;
  text-align: center;
  gap: 12px;
}
.km-ht-info-icon { font-size: 48px; }
.km-ht-info-default p {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.km-ht-info-content {
  animation: none;
}
.km-ht-info-sect-icon { font-size: 40px; margin-bottom: 10px; }
.km-ht-info-sect-name {
  font-size: 22px;
  font-weight: 700;
  color: #1b3a24;
  margin: 0 0 12px;
}
.km-ht-info-sect-desc {
  font-size: 14px;
  line-height: 1.7;
  color: #3d5c45;
  margin: 0 0 20px;
}
.km-ht-info-sect-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--km-primary);
  color: #fff;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.km-ht-info-sect-link:hover {
  background: #24603c;
  color: #fff;
}

button.km-testmain__help-btn {
  font: inherit;
  cursor: pointer;
  border: none;
  appearance: none;
  -webkit-appearance: none;
}

html.km-ht-open .km-testmain::before,
html.km-ht-open .km-testmain [class*="pulse"] {
  animation-play-state: paused !important;
}

@media (max-width: 600px) {
  .km-ht-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .km-ht-tree {
    border-right: none;
    border-bottom: 1px solid #e6ede6;
    max-height: 220px;
    padding: 12px 0 12px 12px;
  }
  .km-ht-branches::before { left: 16px; }
  .km-ht-branch::before { left: 10px; }
  .km-ht-branch-line { margin-left: 16px; width: 16px; }
  .km-ht-modal {
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    width: 100%;
    max-height: 92vh;
  }
  .km-ht-overlay {
    align-items: flex-end;
    padding: 0;
  }
}
