/* Shared foreground layer for explanatory data-help overlays.
   Rich Inventory and Bank item panels intentionally keep their own renderer. */
#vespera-help-overlay-root {
  position: fixed;
  top: var(--vespera-desktop-titlebar-height, 0px);
  right: auto;
  bottom: auto;
  left: 0;
  width: var(--vespera-viewport-width, calc(100vw / var(--vespera-ui-scale, 1)));
  height: calc(100vh / var(--vespera-ui-scale, 1));
  height: var(--vespera-game-viewport-height, calc(100dvh / var(--vespera-ui-scale, 1)));
  z-index: 2147483646;
  pointer-events: none;
  overflow: visible;
}

.vespera-help-overlay {
  position: fixed;
  width: max-content;
  max-width: min(380px, calc((100vw / var(--vespera-ui-scale, 1)) - 24px));
  max-height: calc((100vh / var(--vespera-ui-scale, 1)) - 24px);
  max-height: calc((100dvh / var(--vespera-ui-scale, 1)) - 24px);
  overflow: auto;
  padding: 11px 13px 12px;
  border: 1px solid rgba(214, 169, 79, 0.66);
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent, rgba(214, 169, 79, 0.56), transparent) top / 82% 1px no-repeat,
    radial-gradient(circle at 18% 0%, rgba(41, 98, 150, 0.2), transparent 48%),
    linear-gradient(180deg, rgba(7, 17, 31, 0.99), rgba(2, 7, 15, 0.995));
  color: rgba(248, 238, 218, 0.97);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(117, 184, 235, 0.1) inset,
    0 0 24px rgba(33, 106, 164, 0.12);
  font-family: var(--font-ui, var(--font-body, serif));
  font-size: clamp(11px, 0.74vw, 13px);
  font-weight: 650;
  line-height: 1.45;
  letter-spacing: 0.005em;
  text-align: left;
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  opacity: 0;
  visibility: hidden;
  transform: translateY(2px) scale(0.985);
  transform-origin: center;
  transition:
    opacity 90ms ease-out,
    transform 90ms ease-out,
    visibility 0s linear 90ms;
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 169, 79, 0.46) rgba(3, 8, 17, 0.7);
}

.vespera-help-overlay[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

/* Legacy pseudo-element help messages are panel descendants and can be clipped.
   All plain help copy now renders through the body-level host above. */
[data-help]::before,
[data-help]::after,
.frontier-help-tooltip {
  content: none !important;
  display: none !important;
}

html.tooltips-disabled #vespera-help-overlay-root {
  display: none !important;
}

@media (max-width: 720px) {
  .vespera-help-overlay {
    max-width: min(320px, calc((100vw / var(--vespera-ui-scale, 1)) - 20px));
    max-height: calc((100vh / var(--vespera-ui-scale, 1)) - 20px);
    max-height: calc((100dvh / var(--vespera-ui-scale, 1)) - 20px);
    padding: 10px 11px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vespera-help-overlay {
    transition: none;
  }
}
