11. Territory capture

A simulated runner emits GPS positions; LoopDetector notices when the path closes, TerritoryStore merges the claim and takes the overlap off the rivals, and TerritoryLayer draws it. Click any territory to ask who holds it.

The dashed leg on the trail is the part the runner has not run — the shape it closes is what the lap would be worth from here.