You can't, really ... because the user can also disable JS, and the only way you can tell what they're using is by what they tell you. And IE even calls itself Mozilla, though there's an 'MSIE' tucked away in there, too ...
Besides, different browser versions have different ways of mangling CSS rules, anyway ... so I decided a while ago to just give up on trying to hand out different stylesheets based on browsers - because even though it takes a bit (ok, maybe a lot) more time to compose a cross-browser stylesheet, it has made my life infinitely easier, freed me of a lot of worries, and dramatically improved my CSS skills, and I still have most of my hair, too. 🆒 It'll be tough, but this might actually be your easiest option.