.panel-help-control {
  position: relative;
  display: inline-grid;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  place-items: center;
  align-self: flex-start;
  border: 1px solid rgba(93, 108, 132, .28);
  border-radius: 50%;
  background: rgba(255, 255, 255, .66);
  color: rgba(74, 89, 112, .58);
  font: 750 .72rem/1 var(--font-sans, "Inter", sans-serif);
  cursor: help;
  opacity: .72;
  transition: border-color .16s ease, background .16s ease, color .16s ease, opacity .16s ease, transform .16s ease;
}

.panel-help-control:hover,
.panel-help-control:focus-visible,
.panel-help-control[aria-expanded="true"] {
  border-color: rgba(39, 88, 143, .52);
  background: #f6f9fd;
  color: #24578f;
  opacity: 1;
  transform: translateY(-1px);
  outline: none;
}

.panel-help-control:focus-visible {
  box-shadow: 0 0 0 3px rgba(63, 103, 176, .15);
}

.panel-help-tooltip {
  position: fixed;
  z-index: 1095;
  width: min(300px, calc(100vw - 24px));
  padding: 11px 13px;
  border: 1px solid rgba(151, 165, 188, .48);
  border-radius: 9px;
  background: rgba(12, 27, 48, .97);
  box-shadow: 0 14px 34px rgba(5, 15, 34, .2);
  color: #f8fbff;
  font-family: var(--font-sans, "Inter", sans-serif);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease;
}

.panel-help-tooltip.is-visible { opacity: 1; transform: translateY(0); }
.panel-help-tooltip[hidden] { display: none !important; }
.panel-help-tooltip strong { display: block; margin-bottom: 3px; font-size: .78rem; font-weight: 800; letter-spacing: .01em; }
.panel-help-tooltip span { display: block; color: #dce5f1; font-size: .78rem; line-height: 1.45; }
.panel-help-tooltip::before {
  position: absolute;
  top: -5px;
  right: var(--panel-help-arrow-right, 18px);
  width: 9px;
  height: 9px;
  border-top: 1px solid rgba(151, 165, 188, .48);
  border-left: 1px solid rgba(151, 165, 188, .48);
  background: #0c1b30;
  content: "";
  transform: rotate(45deg);
}

.panel-help-tooltip.is-above::before {
  top: auto;
  bottom: -5px;
  border: 0;
  border-right: 1px solid rgba(151, 165, 188, .48);
  border-bottom: 1px solid rgba(151, 165, 188, .48);
}

/* Header layouts already use flex/grid. This keeps the help affordance quiet and
   prevents it from stretching in panels with sparse content. */
.panel-help-host > .panel-help-control,
.panel-help-host > header > .panel-help-control,
.panel-help-host > .data-panel-header > .panel-help-control,
.panel-help-host > summary > .panel-help-control {
  flex: 0 0 22px;
}

.panel-help-host > summary > .panel-help-control { margin-left: auto; margin-right: 3px; }
.panel-help-compact { position: relative; }
.panel-help-compact > .panel-help-control { position: absolute; top: 9px; right: 9px; z-index: 2; }
.panel-help-compact > .panel-help-control ~ *:first-of-type { padding-right: 18px; }

@media (max-width: 680px) {
  .panel-help-control { width: 25px; height: 25px; min-width: 25px; opacity: .82; }
  .panel-help-tooltip { width: min(290px, calc(100vw - 20px)); }
}

@media (prefers-reduced-motion: reduce) {
  .panel-help-control,
  .panel-help-tooltip { transition: none; }
}
