/* PB upgrader v3: the REAL upgrader is the bonus button, not the store.
 * Load in <head> to establish final VISUAL order before JS moves the node.
 * V2 creates a hidden .pb-lucide span in this rail; draw the real Pixelarticon
 * as a CSS-masked pseudo element instead. No handlers or state are changed.
 */
body.pb-canvas-workspace #pb-game-tool-rail > [data-pb-game-action="palette"] {
  order: -101 !important;
}
/* During initial load the injected bonus/upgrader is the only button ABOVE
 * the palette; V2 marks it "Апгрейдер" after initialization. */
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn:first-child:not([data-pb-game-action="palette"]):not([data-pb-game-action="store"]),
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn[data-tooltip="Апгрейдер"],
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn[aria-label="Апгрейдер"] {
  order: -100 !important;
}
/* Keep tooltip ::after untouched. Always render ONE visible anvil ::before,
 * irrespective of whether V2 has already replaced the old arrow SVG. */
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn:first-child:not([data-pb-game-action="palette"]):not([data-pb-game-action="store"]) > :is(svg,img,.pb-ico,.pb-lucide,span[aria-hidden="true"]),
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn[data-tooltip="Апгрейдер"] > :is(svg,img,.pb-ico,.pb-lucide,span[aria-hidden="true"]),
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn[aria-label="Апгрейдер"] > :is(svg,img,.pb-ico,.pb-lucide,span[aria-hidden="true"]) {
  display: none !important;
}
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn:first-child:not([data-pb-game-action="palette"]):not([data-pb-game-action="store"])::before,
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn[data-tooltip="Апгрейдер"]::before,
body.pb-canvas-workspace #pb-game-tool-rail > :is(button,a).pb-game-rail-btn[aria-label="Апгрейдер"]::before {
  content: "" !important;
  position: static !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 20px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: currentColor !important;
  -webkit-mask: url('/assets/icons/trending-up.svg') center / contain no-repeat !important;
  mask: url('/assets/icons/trending-up.svg') center / contain no-repeat !important;
  pointer-events: none !important;
}
