Open up about:config and go to layout.css.prefers-color-scheme.content-override and set it to one of the following:
0 => Force a Dark background
1 => Force a Light background
2 => Follow the System theme (default in Firefox 94)
3 => Follow the Browser toolbar theme (default in Firefox 95+)
I think this is also in Settings under Language and Appearance, Website appearance, unless this is a stricter setting that ensures it works as desired.