Styled the pause button as a tertiary/ghost button -- no background, just text-muted-foreground that brightens to text-foreground on hover, with font-medium instead of font-bold. It sits right next to the Reset button and stays visually subtle while still being accessible.
Now let me look at the track drawing function to understand how the track boundaries are rendered:
Now I also need to check the finish screen and game canvas to handle the disqualified state properly:
Now I have full context. Here's my plan:
disqualified field to Boat interfacedistanceToTrack() utility function that calculates the shortest distance from a point to the track center lineupdateGame, check each boat's distance to the track and disqualify if too farLet me implement:
Now add the distanceToTrackCenterLine utility function before the updateGame function:
Now add the disqualification check inside the boat update loop, right after the boundary clamping and before obstacle collisions:
Now add the disqualification check after boundary clamping:
Now update the HUD rendering to show a "DISQUALIFIED" warning. Let me find the drawHUD function:
Now I'll add "DQ" labels in the mini positions panel, a DQ warning banner in the HUD, and update the drawBoat to render disqualified boats as faded. First, update the mini positions panel to show DQ:
Now update the mini panel to show "DQ" next to disqualified boats:
Now add a DQ warning banner. Let me update the drawBoat function to render DQ boats faded. First find it:
Now let me make disqualified boats render faded and with a red "X" overlay:
Now update the name tag area and add a DQ marker:
Now update the finish screen to handle disqualified players:
Now update the result display to show disqualification:
Now update the stats section to show "DQ" for position when disqualified:
Finally, update the leaderboard rows to show DQ status:
Here's a summary of everything added:
Game Engine -- Added a distanceToTrackCenter() function that calculates the shortest distance from any point to the closed-loop track centerline using point-to-segment projection. Every frame, each active boat is checked: if its distance exceeds the track half-width plus a 30px grace margin, it gets disqualified = true, its speed zeroes out, and it stops updating. If the player is disqualified, the race ends immediately. Disqualified boats render faded (35% opacity) with a red "X" overlay and a red "DQ" name tag, and sort to the bottom of the positions panel.
Finish Screen -- Now detects disqualification and shows a red "DISQUALIFIED" title with an XCircle icon, the message "You left the track boundaries!", "DQ" instead of a position number, and "DQ" labels in the leaderboard for any disqualified boat.
You can send messages while the preview loads