logic.py — robust question generation and autopilot helpers.