Lightweight environment detection.