Hmmm, as far as I know, CSS variables can't be changed? (I took a quick glance at https://drafts.csswg.org/css-variables/)
Maybe it's possible via JS, but I haven't played with it yet, so I'm not sure.
Performance wise: it will all depend on what properties you want to change on all these objects, but you will probably notice it when you're altering 100s of HTML elements ;)