Using PHP in a Stylesheet (possibly a “.htaccess” problem?)

Suggest you move your desired functionality to javascript; you are so badly attempting to overload the purpose of these constructs…even if you get it to work you are going to have a very fragile and difficult to maintain system on your hands.

Note that the idea of inlining style may work — but future Content Security Policy may kill that idea…inline CSS is a weak spot; see this OWASP explanation for more information.