stylesheet ?scope ?flatten_nesting ?lossless ?enforce_spec ss optimizes an entire stylesheet while preserving cascade semantics for any DOM (with closed_world off, the default). When @supports blocks are present alongside top-level rules, optimization is limited because the stylesheet structure separates rules from @supports blocks, losing their relative ordering.
When flatten_nesting is true (default false) nested rules are desugared into flat rules: child selectors with & have the parent selector substituted in, child selectors without & are joined to the parent with the descendant combinator, and at-rules nested inside a rule are emitted at the top level with the parent selector applied to their inner rules.
scope (default `Fragment) gates partial-coverage shorthand synthesis; see the scope doc.
lossless disables colour approximation while keeping exact colour canonicalisation.
When enforce_spec is false (default) the optimizer may treat baseline feature queries as known facts and elide @supports guards whose condition is satisfied in maintained evergreen browsers; true keeps every feature query and applies only CSS-text-and-spec-provable rewrites.
When closed_world is true (default false) the optimizer assumes the caller knows the exact HTML and that no element ever matches two clashing selectors, so it may merge rules it would otherwise keep apart. Unsafe: the page can render wrong if such an element appears, including one a script adds at runtime. This is about the HTML, separate from scope (how much of the CSS you control). The default is safe for any page; see Ctx.closed_world.
When prune_unused_custom_props is true (default false) custom-property bindings referenced by no var() anywhere are dropped. This is opt-in because it assumes a complete stylesheet with no out-of-band reader (another stylesheet, or getComputedStyle) - the same closed-world assumption as Css.inline_vars.
stats records what this run did; read it back with Stats.snapshot. Without it the run counts into a recorder of its own that nobody reads.