.titlebar-buttonbox-container {
  /** 控制按钮边距 */
  padding-inline-end: var(--contorl-padding-start-end, 0px);
  @include Option("userChromeJS.Sidra.ControlButton.ShowOnLeft") {
    padding-inline: var(--contorl-padding-start-end, 0px) 0px;
  }
  /** 强制控制按钮与标签栏和导航栏对其 */
  :is(#nav-bar, #TabsToolbar) > & > .titlebar-buttonbox {
    height: 100%;
  }
}
@include OS($win) {
  .titlebar-min {
    list-style-image: url("./images/icons/win11-minimize.svg") !important;

    @media (resolution > 1.25dppx) {
      list-style-image: url("./images/icons/win11-minimize.svg#high-dpi") !important;
    }
  }
  .titlebar-max {
    list-style-image: url("./images/icons/win11-maximize.svg") !important;
  }

  .titlebar-restore {
    list-style-image: url("./images/icons/win11-restore.svg") !important;
  }

  .titlebar-close {
    list-style-image: url("./images/icons/win11-close.svg") !important;

    /* Alternative icon that uses a thicker stroke, making it easier to see when
       * displayed on a dark background, only needed at 100% UI scale.
       */
    @media (resolution = 1dppx) {
      toolbar[brighttext] &,
      &:hover {
        list-style-image: url("./images/icons/win11-close-dark.svg") !important;
      }
    }
  }
}

@include Option("userChromeJS.Sidra.ControlButton.ShowOnLeft") {
  :is(#toolbar-menubar, #nav-bar, #TabsToolbar) {
    &
      > *:not(#private-mask):not(#private-browsing-indicator-with-label):not(
        .titlebar-buttonbox-container
      ) {
      @include BoxOrder(3);
    }

    & > #private-mask,
    & > #private-browsing-indicator-with-label {
      @include BoxOrder(2);
    }

    & > .titlebar-buttonbox-container {
      @include BoxOrder(1, true);
    }
  }
  @include ControlStyle("default") {
    .titlebar-close,
    .uc-titlebar-close {
      @include BoxOrder(0, true);
    }
    .titlebar-max,
    .uc-titlebar-max,
    .titlebar-restore,
    .uc-titlebar-restore {
      @include BoxOrder(2);
    }

    .titlebar-min,
    .uc-titlebar-min {
      @include BoxOrder(3);
    }
  }
}

@include Option("userChromeJS.Sidra.Tabs.TabsOnBottom.Enabled") {
  #navigator-toolbox {
    position: relative;
  }

  @include TabStyle("default,2,3,5,6,7,8,9,10,11,12,13") {
    @include Option("userChromeJS.Sidra.ControlButton.ShowOnLeft") {
      .titlebar-buttonbox-container {
        left: 0;
        right: auto;
      }
    }
  }
}
