Having read through the spec, I think it would be easier to understand if the dynamic UA style rules were somehow factored out of the depths of the algorithm. (I've got some vague ideas of how to do this, so I think it's possible to do it nicely.) Filing this (non-blocking) issue to track the idea.