Is it a bad practice to use dynamically generated IDs for theming
It is better not to use the id.

You could use this module Block Class which allows you to add a class to the block and you can then style your css using that class.