The Pen System
The pen is how the player accuses a document of a flaw. It reads mouse input, detects which element it's interacting with, and sends hover, click, and selection messages to that element's own state machine. Crucially, the pen itself tracks nothing; it only sends messages. The element and the document own the state. To find what's currently selected, the document simply asks each leaf's state machine.
Only leaf elements have colliders, containers are invisible to the pen, so deep nesting never complicates targeting. Smaller colliders sort on top of larger ones, and hover always picks the topmost collider under the cursor. This keeps pointer behaviour predictable no matter how deeply the document tree nests.
As you hover, the pen draws a grey circle dynamically sized to fit the targeted field. Click and the circle is committed to the page and the element is marked selected, turning red. If something is already circled, clicking again draws a scribble over it and cancels the selection. The circle and scribble are part of the page now; they travel with the document into the scanner.
Each leaf runs a small state machine the pen feeds: NoSelection, Hover (grey), Selected (red), and ScrubbledOut (cancelled). The highlight sprites are pre-baked in edit mode to fit each collider via a button on the element, so at runtime the element just shows the right sprite for its current state.