/*
 * The "?" help panel, shared by every page that shows one.
 *
 * These rules were in bn_chat.css, which /generate-image does not load. That
 * page needed the same affordance for its NSFW and Random switches, and
 * ModeInfo — the component that renders it — hardcodes these class names, so
 * the choice was to duplicate them or move them. Duplicated CSS drifts, so
 * they live here and every page using ModeInfo links this file.
 *
 * Class names are unchanged (`rel-progress-tip`, `rel-tip-*`) because the
 * relationship-levels help and the mode help are deliberately the same thing
 * to look at; renaming them now would only churn the markup.
 */

/* position:fixed, placed by JS relative to the button.
   Fixed rather than absolute so it is entirely out of flow: it cannot shift
   the chat header, and no ancestor's overflow or stacking context can clip it.
   The trade-off is that it does not follow the page, so the script re-places
   it on scroll and resize. */
.rel-progress-tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: max-content;
  /* Narrower than before. At 300px the panel dwarfed the 14px button it
     belongs to and read as an unrelated overlay. */
  max-width: min(260px, calc(100vw - 16px));
  padding: 12px 14px;
  border: 1px solid var(--neutral-700);
  border-radius: 10px;
  background: var(--neutral-900, #1a1a1a);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  text-align: left;
  white-space: normal;
  cursor: default;
  animation: rel-tip-in 0.14s ease-out;
}

@keyframes rel-tip-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Caret tying the panel to the "?". Its x is set by script (--caret-x) rather
   than a fixed 50%, so it keeps pointing at the button even when the panel has
   been clamped against a viewport edge. */
.rel-progress-tip::after {
  content: '';
  position: absolute;
  left: var(--caret-x, 20px);
  width: 10px;
  height: 10px;
  background: var(--neutral-900, #1a1a1a);
  border-left: 1px solid var(--neutral-700);
  border-top: 1px solid var(--neutral-700);
  transform: translateX(-50%) rotate(45deg);
}

/* Panel below the button — caret on top, pointing up. */
.rel-progress-tip:not(.flip-above)::after {
  top: -6px;
}

/* Panel above the button — caret on the bottom, pointing down. */
.rel-progress-tip.flip-above::after {
  bottom: -6px;
  transform: translateX(-50%) rotate(225deg);
}

.rel-tip-title {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.rel-tip-body,
.rel-tip-foot {
  font-size: 11px;
  line-height: 16px;
  color: var(--neutral-400, #b0b0b0);
  margin: 0 0 10px;
}

.rel-tip-foot {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--neutral-800, #2a2a2a);
}

.rel-tip-levels {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rel-level;
}

.rel-tip-levels li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 15px;
}

.rel-tip-levels li span {
  color: var(--neutral-300, #d4d4d4);
  font-weight: 600;
  flex-shrink: 0;
}

.rel-tip-levels li em {
  color: var(--neutral-500);
  font-style: normal;
  font-size: 10px;
}

/* The level the user is currently on. */
.rel-tip-levels li.current {
  background: rgba(204, 149, 255, 0.12);
}
.rel-tip-levels li.current span { color: #cc95ff; }
.rel-tip-levels li.current em { color: var(--neutral-400, #b0b0b0); }

@media (prefers-reduced-motion: reduce) {
  .rel-progress-tip { animation: none; }
}
