@include not_lwtheme {
  /* Fix for windows's system default theme. Using --toolbar-bgcolor, --toolbar-bgimage fallback */
  --tab-selected-bgcolor: unset !important; /* Original: rgb(255,255,255); */
  --tab-selected-bgimage: unset !important; /* Above FF v101 */
}
#TabsToolbar #firefox-view-button[open] > .toolbarbutton-icon, .tab-background:is([selected], [multiselected]) {
  background-color: var(--tab-selected-bgcolor, var(--toolbar-bgcolor)) !important;
}

#pinned-tabs-container
  > .tabbrowser-tab
  > .tab-stack
  > .tab-background[selected],
#tabbrowser-tabs:not([movingtab])
  > #pinned-tabs-container
  > .tabbrowser-tab
  > .tab-stack
  > .tab-background[selected],
#pinned-tabs-container
  > tab-group
  > .tabbrowser-tab
  > .tab-stack
  > .tab-background[selected],
#tabbrowser-tabs[orient="horizontal"]:not([movingtab])
  > #pinned-tabs-container
  > tab-group
  > .tabbrowser-tab
  > .tab-stack
  > .tab-background[selected],
#tabbrowser-arrowscrollbox
  > .tabbrowser-tab
  > .tab-stack
  > .tab-background[selected],
#tabbrowser-tabs:not([movingtab])
  > #tabbrowser-arrowscrollbox
  > .tabbrowser-tab
  > .tab-stack
  > .tab-background[selected],
#tabbrowser-arrowscrollbox
  > tab-group
  > .tabbrowser-tab
  > .tab-stack
  > .tab-background[selected],
#tabbrowser-tabs[orient="horizontal"]:not([movingtab])
  > #tabbrowser-arrowscrollbox
  > tab-group
  > .tabbrowser-tab
  > .tab-stack
  > .tab-background[selected] {
  @include lwtheme(false) {
    /* Original: linear-gradient(var(--lwt-selected-tab-background-color, transparent), var(--lwt-selected-tab-background-color, transparent)), linear-gradient(var(--toolbar-bgcolor), var(--toolbar-bgcolor)), var(--lwt-header-image, none)
     */
    background-image: linear-gradient(transparent, transparent),
                      linear-gradient(var(--toolbar-bgcolor), var(--toolbar-bgcolor)), var(--lwt-header-image, none) !important;
    background-position: 0, 0, right top;
    background-attachment: scroll, scroll, fixed;
    background-repeat: repeat-x, repeat-x, no-repeat !important;
  }

  @include Option("userChrome.theme.transparent.frame") {
    :root:not([lwtheme-image])#{$lwtheme} & {
      background-image: linear-gradient(transparent, transparent),
                        linear-gradient(var(--toolbar-bgcolor), var(--toolbar-bgcolor)), var(--lwt-additional-images, none) !important;

      background-repeat: repeat-x, repeat-x, var(--lwt-background-tiling) !important;
      background-position: 0 0, 0 0, var(--lwt-background-alignment) !important;
    }
  }
}
