/* Knowledge Base + Interactive Tour — CSP-safe, no inline styles required in JS beyond measured positions. */

.btn-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  flex-shrink: 0;
}
.btn-help .help-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--cyan);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.btn-help:hover {
  border-color: var(--cyan);
  color: #fff;
  background: rgba(42, 209, 214, 0.1);
}

.toolbar-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Help / Knowledge Base modal ---- */
.help-backdrop {
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 6, 12, 0.72);
}
.help-backdrop[hidden] { display: none !important; }

.help-modal {
  width: min(980px, 100%);
  height: min(82vh, 740px);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  background: #0e141d;
  border: 1px solid rgba(42, 209, 214, 0.28);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  color: var(--text);
}
.help-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.help-modal-head h2 {
  margin: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 30px;
  letter-spacing: 0.06em;
  color: #fff;
}
.help-modal-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.help-search-wrap {
  padding: 12px 18px 8px;
  flex-shrink: 0;
}
.help-search-wrap label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 6px;
}
#help-search {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(42, 209, 214, 0.35);
  background: #0a0f16;
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}
#help-search:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(42, 209, 214, 0.18);
}
.help-search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
#help-match-count { color: var(--cyan); font-weight: 650; }

.help-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 18px 10px;
  flex-shrink: 0;
}
.help-chip {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}
.help-chip:hover,
.help-chip.is-active {
  border-color: var(--cyan);
  color: #7eecef;
  background: rgba(42, 209, 214, 0.12);
}

.help-tour-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 18px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(42, 209, 214, 0.4);
  background: linear-gradient(90deg, rgba(42, 209, 214, 0.16), rgba(42, 209, 214, 0.05));
  flex-shrink: 0;
}
.help-tour-cta strong {
  display: block;
  font-size: 15px;
  color: #fff;
}
.help-tour-cta span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
#btn-start-tour {
  flex-shrink: 0;
  background: var(--cyan);
  color: #06252a;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
#btn-start-tour:hover { filter: brightness(1.08); }

.help-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  border-top: 1px solid var(--line);
}
.help-sidebar {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #0b1018;
  padding: 10px 8px 16px;
}
.help-cat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 8px 4px;
}
.help-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.help-nav-btn:hover { background: rgba(255, 255, 255, 0.04); }
.help-nav-btn.is-active {
  background: rgba(42, 209, 214, 0.14);
  color: #7eecef;
}
.help-nav-btn[hidden] { display: none !important; }
.help-empty {
  padding: 10px;
  font-size: 13px;
  color: var(--muted);
}
.help-article {
  min-width: 0;
  overflow: auto;
  padding: 18px 22px 28px;
  font-size: 14.5px;
  line-height: 1.55;
  color: #d5dee5;
}
.help-article h3 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: 0.01em;
  color: #fff;
}
.help-article h4 {
  margin: 18px 0 6px;
  font-size: 14px;
  color: var(--cyan);
}
.help-article p { margin: 0 0 10px; }
.help-article ul, .help-article ol { margin: 0 0 12px; padding-left: 1.2em; }
.help-article li { margin: 0 0 6px; }
.help-article code, .help-article kbd {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  font-size: 0.9em;
  background: rgba(42, 209, 214, 0.12);
  color: #7eecef;
  border-radius: 5px;
  padding: 1px 5px;
}
.help-article kbd {
  border: 1px solid rgba(42, 209, 214, 0.3);
  font-weight: 700;
}
.help-mobile-nav { display: none; }

@media (max-width: 720px) {
  .help-modal { height: min(92dvh, 860px); }
  .help-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .help-sidebar { display: none; }
  .help-mobile-nav {
    display: block;
    padding: 10px 18px 0;
    flex-shrink: 0;
  }
  .help-mobile-nav select {
    width: 100%;
    border: 1px solid var(--line);
    background: #0a0f16;
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
  }
  .help-tour-cta { flex-wrap: wrap; }
  .help-article { padding: 14px 16px 22px; }
}

/* ---- Interactive tour ---- */
#tour-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}
#tour-root:not([hidden]) { display: block; }
#tour-root[hidden] { display: none !important; }

.tour-dim {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.62);
  pointer-events: auto;
}
.tour-spot {
  position: absolute;
  box-sizing: border-box;
  border-radius: 12px;
  border: 2px solid rgba(42, 209, 214, 0.95);
  box-shadow:
    0 0 0 2px rgba(42, 209, 214, 0.25),
    0 0 22px rgba(42, 209, 214, 0.45),
    0 0 0 9999px rgba(3, 6, 12, 0.62);
  pointer-events: none;
  transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease;
}
.tour-card {
  position: absolute;
  width: min(360px, calc(100vw - 24px));
  pointer-events: auto;
  background: #121922;
  color: var(--text);
  border: 1px solid rgba(42, 209, 214, 0.4);
  border-radius: 14px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
  padding: 14px 14px 12px;
}
.tour-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.tour-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(42, 209, 214, 0.16);
  color: #7eecef;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.tour-dots { display: flex; gap: 5px; flex: 1; justify-content: center; }
.tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
.tour-dot.is-done { background: rgba(42, 209, 214, 0.45); }
.tour-dot.is-active { background: var(--cyan); }
.tour-skip {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.tour-skip:hover { color: #fff; }
.tour-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #fff;
}
.tour-card p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #c5d0d8;
}
.tour-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.tour-actions .btn { padding: 6px 12px; font-size: 13px; }
.tour-next {
  background: var(--cyan);
  color: #06252a;
  border-color: transparent;
  font-weight: 800;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.tour-dim { background: transparent; }
