/* V190: expose the existing scroll areas. Never create scrolling on the board,
   its frame, or its decorations. Native thumb colors inherit every UI theme. */
@media screen {
  body {
    --scroll-track: var(--ui-control-paper, var(--paper));
    --scroll-thumb: color-mix(in oklab, var(--ui-control-ink, var(--ink)) 68%, var(--scroll-track));
  }
  body :is(#formula-category-tabs, .right-pane-tabs, .tool-library-tabs,
    .tab-list, .statistics-tabs, .biology-reference-tabs, .biology-studio-footer,
    .lewis-palette, .skeletal-palette, .trend-legend-steps,
    .tool-library, .help-body, .help-search-results, .command-results,
    .formula-view, .periodic-view, .scientific-calculator, .calc-rows,
    .science-studio-content, .science-table-wrap, .science-input-grid,
    .statistics-workspace-body, .statistics-table-scroll, .biology-studio-editor,
    .biology-preview-shell, .biology-experiment-group-table, .sticker-library-body,
    .settings-body, .saved-list, .ptable-scroll) {
    scrollbar-width: auto;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  }
  body :is(#formula-category-tabs, .workspace-toolbar, .right-pane-tabs, .tool-library-tabs,
    .tab-list, .statistics-tabs, .biology-reference-tabs, .biology-studio-footer,
    .lewis-palette, .skeletal-palette, .trend-legend-steps,
    .tool-library, .help-body, .help-search-results, .command-results,
    .formula-view, .periodic-view, .scientific-calculator, .calc-rows,
    .science-studio-content, .science-table-wrap, .science-input-grid,
    .statistics-workspace-body, .statistics-table-scroll, .biology-studio-editor,
    .biology-preview-shell, .biology-experiment-group-table, .sticker-library-body,
    .settings-body, .saved-list, .ptable-scroll)::-webkit-scrollbar {
    display: block;
    width: 14px;
    height: 14px;
  }
  body :is(#formula-category-tabs, .workspace-toolbar, .right-pane-tabs, .tool-library-tabs,
    .tab-list, .statistics-tabs, .biology-reference-tabs, .biology-studio-footer,
    .lewis-palette, .skeletal-palette, .trend-legend-steps,
    .tool-library, .help-body, .help-search-results, .command-results,
    .formula-view, .periodic-view, .scientific-calculator, .calc-rows,
    .science-studio-content, .science-table-wrap, .science-input-grid,
    .statistics-workspace-body, .statistics-table-scroll, .biology-studio-editor,
    .biology-preview-shell, .biology-experiment-group-table, .sticker-library-body,
    .settings-body, .saved-list, .ptable-scroll)::-webkit-scrollbar-thumb {
    min-width: 30px;
    min-height: 30px;
    background: var(--scroll-thumb);
    border: 3px solid var(--scroll-track);
    border-radius: 8px;
  }
  body :is(#formula-category-tabs, .workspace-toolbar, .right-pane-tabs, .tool-library-tabs,
    .tab-list, .statistics-tabs, .biology-reference-tabs, .biology-studio-footer,
    .lewis-palette, .skeletal-palette, .trend-legend-steps,
    .tool-library, .help-body, .help-search-results, .command-results,
    .formula-view, .periodic-view, .scientific-calculator, .calc-rows,
    .science-studio-content, .science-table-wrap, .science-input-grid,
    .statistics-workspace-body, .statistics-table-scroll, .biology-studio-editor,
    .biology-preview-shell, .biology-experiment-group-table, .sticker-library-body,
    .settings-body, .saved-list, .ptable-scroll)::-webkit-scrollbar-track {
    background: var(--scroll-track);
    border-radius: 8px;
  }

  /* The toolbar's own horizontal scrollbar rides right under the chips, so it
     stays slim rather than matching the other, more spacious scroll rails. */
  body .workspace-toolbar { scrollbar-width: thin; scrollbar-color: var(--n84) transparent; }
  body .workspace-toolbar::-webkit-scrollbar { height: 3px; }
  body .workspace-toolbar::-webkit-scrollbar-thumb { min-width: 0; min-height: 0; background: var(--n84); border: 0; border-radius: 3px; }
  body .workspace-toolbar::-webkit-scrollbar-track { background: transparent; }

  body #formula-category-tabs {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 3px 7px;
    scroll-padding-inline: 4px;
    overscroll-behavior-inline: contain;
  }
  body #formula-category-tabs > button { flex: 0 0 auto; scroll-snap-align: start; }
  body :is(.right-pane-tabs, .statistics-tabs, .biology-reference-tabs, .tab-list) {
    min-width: 0;
    max-width: 100%;
    scroll-padding-inline: 4px;
    overscroll-behavior-inline: contain;
  }
  body .right-pane-tabs { overflow-x: auto; }
  body :is(.science-table-wrap, .science-input-grid, .statistics-table-scroll, .ptable-scroll) {
    min-width: 0;
    max-width: 100%;
    overflow: auto;
    overscroll-behavior-inline: contain;
  }
  body :is(.tool-library, .help-body, .sticker-library-body) { scrollbar-gutter: stable; }
  body .scroll-access-region:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
  body[data-readability="high"] .scroll-access-region:focus-visible { outline-width: 4px; }
}
@media screen and (forced-colors: active) {
  body { --scroll-thumb: ButtonText; --scroll-track: Canvas; }
}
