To add :hover and :active styles to dynamically injected buttons in your Tampermonkey script, you need to inject CSS into the page, because element.style only supports inline styles and does not support pseudo-classes like :hover or :active.
Here’s how you can inject a tag into the page using JavaScript, and define your button styles there:
Add a unique class to your buttons, e.g. .my-tampermonkey-button. Inject a block with CSS rules, including :hover and :active.
https://code.livegap.com/?st=a50pc81142l
This way, your buttons will respond to :hover and :active, and you still get per-button styling via element.style if needed.