Avoid being affected by website’s default CSS or JS

I use Tampermonkey to write a JS script in a website.

It should be on the right of the website’s page like this.Correct style

And it’s correct in one path of the website. But when I use the same script on another path of the website. It has a wrong style like this.Wrong style

The elements added by my script isCode

I’ve tried to put it in Shadow DOM. But it doesn’t work.

My tampermonkey script just contain createElement and some style, so I may not show it.

Can anyone help me with this problem please?

Expecting the problem could be solved.