Fix stuff with keyframe and media rules
Refactor front end. Support media rules.