Separate out common CSS

I wasn't able to test it, so it might have errors.