Symfony has a CssSelector component which can be used to convert a CSS selector to an XPath expression. This in theory could be used to do evaluate a given selector against the document to determine whether it applies. This could shake quite a bit of CSS that we currently don't consider, for example selectors with multiple class names. Special care would be needed to account for selectors that interact with elements in an AMP document that are dynamically modified at runtime.