/* ── Help mode: body state ───────────────────────────────────────── */
body.help-mode {
  cursor: help !important;
}

/* Subtle backdrop */
body.help-mode::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(102,126,234,0.04);
  pointer-events: none;
  z-index: 1028;
}

/* ── Highlighted data-help elements ─────────────────────────────── */
body.help-mode [data-help] {
  outline: 2px solid rgba(102,126,234,0.55);
  outline-offset: 3px;
  border-radius: 4px;
  cursor: help !important;
  transition: outline-color 0.15s, background-color 0.15s;
  position: relative;
  z-index: 1029;
}

body.help-mode [data-help]:hover {
  outline-color: #667eea;
  background-color: rgba(102,126,234,0.07);
}

/* ── Help mode toggle button state ──────────────────────────────── */
#help-mode-toggle.help-mode-active {
  background: rgba(102,126,234,0.2) !important;
  color: #8b9df7 !important;
  box-shadow: inset 0 0 0 1px rgba(102,126,234,0.45) !important;
}

/* ── Floating card ───────────────────────────────────────────────── */
.help-overlay-card {
  position: fixed;
  z-index: 1055;
  width: 400px;
  max-width: calc(100vw - 24px);
  background: var(--bs-body-bg, #fff);
  border: 1px solid rgba(102,126,234,0.25);
  border-left: 3px solid #667eea;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  display: none;
  animation: help-card-in 0.14s ease-out;
  overflow: hidden;
}

.help-overlay-card.visible {
  display: flex;
  flex-direction: column;
}

@keyframes help-card-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.help-overlay-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.65rem 1rem 0.5rem;
  border-bottom: 1px solid var(--bs-border-color, rgba(0,0,0,0.1));
  gap: 0.5rem;
  flex-shrink: 0;
}

.help-overlay-card-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--bs-body-color);
  line-height: 1.3;
}

.help-overlay-card-close {
  background: none;
  border: none;
  color: var(--bs-secondary-color);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s;
}

.help-overlay-card-close:hover {
  color: var(--bs-body-color);
}

/* ── Scrollable body ─────────────────────────────────────────────── */
.help-overlay-card-body {
  overflow-y: auto;
  max-height: 55vh;
  padding: 0.75rem 1rem;
}

/* Scoped content styles (inherits .help-md from help.css) */
.help-overlay-card-content {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--bs-body-color);
}

.help-overlay-card-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
}

.help-overlay-card-content p  { margin-bottom: 0.45rem; }
.help-overlay-card-content ul,
.help-overlay-card-content ol { padding-left: 1.25rem; margin-bottom: 0.45rem; }

.help-overlay-card-content .help-callout {
  font-size: 0.78rem;
  padding: 0.5rem 0.75rem;
}

.help-overlay-card-content .help-img-placeholder {
  padding: 0.75rem;
  font-size: 0.78rem;
  margin: 0.5rem 0;
}

/* ── Loading spinner ─────────────────────────────────────────────── */
.help-overlay-card-loading {
  display: flex;
  justify-content: center;
  padding: 1.25rem 0;
}

.help-overlay-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(102,126,234,0.25);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: help-spin 0.6s linear infinite;
}

@keyframes help-spin {
  to { transform: rotate(360deg); }
}

/* ── Error state ─────────────────────────────────────────────────── */
.help-overlay-card-error {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
  text-align: center;
  margin: 0;
  padding: 0.5rem 0;
}

/* ── Exit hint (bottom center) ───────────────────────────────────── */
.help-mode-hint {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1055;
  background: rgba(20,20,30,0.82);
  color: rgba(255,255,255,0.9);
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  font-size: 0.78rem;
  pointer-events: none;
  display: none;
  white-space: nowrap;
}

body.help-mode .help-mode-hint {
  display: block;
}
