Three groups: (A, B, C)
style="..."): 1,0,0#main): 0,1,0 each.btn, :hover, [type]): 0,0,1 eachdiv, ::before): 0,0,1, counted separately#nav .item a:hover → (0,1,2) /* ID + class + pseudo-class */
.btn.btn-primary → (0,0,2)
button → (0,0,1)
/* The first rule wins */
!important overrides any specificity. Avoid it — makes CSS unpredictable. Only justified for utilities (.hidden { display: none !important; }).
The rule declared later in the CSS wins.