Why does the second color rule override the first even though both target the same class?
Because in CSS cascade, when selectors have equal specificity, the rule that comes later in the stylesheet wins, so the second color (red) is applied.
💡 Later rules with same specificity override earlier ones.
What if one rule uses an ID selector and another uses a class selector?
The ID selector is more specific, so its styles override the class selector regardless of order.
💡 More specific selectors beat less specific ones.
Why doesn't my style apply even though I wrote it last?
Your selector might be less specific or another rule might use !important, which overrides normal cascade order.
💡 !important beats normal cascade; specificity matters.