.cursor-buddy {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 100;
  width: max-content;
  height: max-content;
  margin: 0;
  border: 0;
  padding: 0;
  overflow: visible;
  color: var(--theme-tooltip-text);
  background: transparent;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  contain: layout style;
}

.cursor-buddy::backdrop { pointer-events: none; }

.cursor-buddy__shape {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-control);
  overflow: hidden;
  background: var(--theme-tooltip);
  transform-origin: center;
  will-change: transform;
}

.cursor-buddy__label {
  position: absolute;
  top: 2px;
  left: 8px;
  width: max-content;
  font: var(--text-support)/1.5 var(--font-body);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 80ms ease-out;
}

.cursor-buddy[data-expanded] .cursor-buddy__label {
  opacity: 1;
  transition-delay: 140ms;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  /* Only replace the native cursor after the overlay is available. */
  .cursor-buddy-active:has(.cursor-buddy:popover-open),
  .cursor-buddy-active:has(.cursor-buddy:popover-open) * { cursor: none !important; }
  /* Mux's public variable reaches its shadow buttons and range inputs. */
  .cursor-buddy-active mux-player { --media-cursor: none; }

  /* Keep pointer hints hidden through their exit fade, not just while claimed.
     Focused controls and native-only controls retain their anchored hints. */
  .cursor-buddy-ready [data-cursor-hint]:not(:disabled, [aria-disabled="true"], :focus-visible, :has(:focus-visible)) > .hover-hint,
  .cursor-buddy-active [data-cursor-hint]:not(:focus-visible, :has(:focus-visible)) > .hover-hint[data-cursor-buddy-hint] { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce), (hover: none), (pointer: coarse), (forced-colors: active) {
  .cursor-buddy { display: none; }
}
