Google's John Mueller said on Twitter that Google ignores keyword spam in CSS files. He said "we ignore that." "Use IDs & class names however you want. (I'm pretty sure this never had any effect on any search engine,)" he added.
Here are the tweets so you see the context:
Correct -- we ignore that. Use IDs & class names however you want. (I'm pretty sure this never had any effect on any search engine.)
— 🍌 John 🍌 (@JohnMu) March 2, 2019
We know Googlebot has issues crawling custom CSS properties - so maybe it is related to that or maybe they just choose to ignore keywords in CSS files. Either way, Google's John Mueller said this time of keyword stuff won't help or hurt you.
Forum discussion at Twitter.