Normalize the input
UTF-8 BOMs, mixed line endings, zero-width characters, Unicode spaces, and smart quotes are all normalised before anything else touches the text.
Why: a paste from ChatGPT’s web UI carries invisible characters that break every downstream parser. Cleaning once, at the top, saves ten patches further down.