Fixed the issue with Firefox.
(Technical details ahead, feel free to skip.)
Turns out it was not an issue with Firefox, but with installing the custom CSS as a user-script. I've discovered that using Stylish extension to apply the custom style gives different results than using the custom style as a user-script, but only to rules with the same specificity
as the rules from the page. For rules with the same specificity, the later rules override the earlier ones. When using Stylish, the custom CSS is added after all other document rules. When using as user-script, the opposite happens.
(Double-post to trigger notification to people watching this topic.)