I have a Block which has a query loop on some term. To reproduce the problem:
Set CSS ID to something like my_term_{term_id}
Now in Custom CSS, type %root%[some_html_attr]
This is translated to the final CSS like this:
#my_term_ {
term_id}
[some_html_attr] {
/*Code*/
}