I'm not a programmer, but I've got an acute feeling that this is probably an amazing job! Thank you so much.
Your "changed(2)" codes, together with some other mods, are used for my Vivaldi UI, which now looks as follows (minimize button hovered):
my_ui_final.jpg
By pure guesswork on my own, the codes are modified to display a red background for the CLOSE button.
It's noticed that the width of the CLOSE button in the maximized window is always 5px narrower than whatever the width value is set in the codes. But that's quite all right for me. Width is normal in a shrinked window, though.
To keep the dragging function of the header, the min-height property of the header is set to 1px.
Thank you again.
In order to move down the Vivaldi button and the window control buttons to the Address bar, one may wonder why I don't just select "Vivaldi Button" from the Settings. I can't because of a mod I use to place the Tab bar below the Bookmark bar. See https://forum.vivaldi.net/post/507175
That mod is intened to do the job when horizontal menu is used. If I select "Vivaldi Button", although the horizontal menu will disappear as expected, the Vivaldi button and the widow control buttons will remain on the still exsistent header (I mean the Menu bar)... above the Address bar. That's no good.
I'm really glad that your mod solves the problem.
By the way, there is another mod that moves the Tab bar below the Address bar to which it also moves both the Vivaldi button and the window control buttons. See https://forum.vivaldi.net/post/490714
But that mod has a drawback:"No pop-up from the Address bar can appear." For instance, when you click the Vivaldi 5.0 Download button or the "hide extension" toggle, nothing happens. So I don't use that mod.