@JordiGH @11011110 That seems like a known issue with the Dark mode gadget:
https://en.wikipedia.org/wiki/Wikipedia:Dark_mode_(gadget)
Math works fine with the official dark mode (https://www.mediawiki.org/wiki/Manual:Dark_mode), although that one is only available for the skin "Vector (2022)".