/* The scroll thumb follows the workspace foreground; its track stays clear. */
:root {
  --workspace-scroll-thumb: color-mix(in srgb, var(--ui-secondary, #e1e1e8) 48%, transparent);
  --workspace-scroll-hover: color-mix(in srgb, var(--ui-secondary, #e1e1e8) 72%, transparent);
}

:is(dialog, .floating-panel, .inspector, .research-note, textarea,
    #musicPanel, #musicList, #boardBuilder, #boardSelection,
    #proposalCanvas, #travelMessages, #assistantPanel) {
  scrollbar-width: thin;
  scrollbar-color: var(--workspace-scroll-thumb) transparent;
  scrollbar-gutter: stable;
}

/* Use the custom track in Chromium, including when Windows shows scroll buttons. */
@supports selector(::-webkit-scrollbar) {
  :is(dialog, .floating-panel, .inspector, .research-note, textarea,
      #musicPanel, #musicList, #boardBuilder, #boardSelection,
      #proposalCanvas, #travelMessages, #assistantPanel) {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }

  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
    margin: 14px 0;
  }

  ::-webkit-scrollbar-thumb {
    min-height: 36px;
    border: 2px solid transparent;
    border-radius: 999px;
    background-color: var(--workspace-scroll-thumb);
    background-clip: padding-box;
  }

  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--workspace-scroll-hover);
  }

  ::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
  }

  ::-webkit-scrollbar-corner {
    background: transparent;
  }

  .inspector::-webkit-scrollbar-thumb {
    background-color: var(--workspace-scroll-thumb);
  }

  .inspector::-webkit-scrollbar-thumb:hover {
    background-color: var(--workspace-scroll-hover);
  }
}

@media (forced-colors: active) {
  :root {
    --workspace-scroll-thumb: CanvasText;
    --workspace-scroll-hover: Highlight;
  }
}
