Firefox has weird kerning under KDE caused by the font-family specified for the message-box style being empty


I used to have MATE installed, and Firefox worked pretty well. Now, even after I set the GTK theme under Application Style, Firefox’s UI looks like the first image I’ve uploaded.

Yes, the screenshots are from Waterfox, but the same issue appears in Firefox.

And yes, I have valid fonts specified in KDE Plasma’s font settings. The title bar shows the correct font.