Every brick tests as an AABB against the ball's bounding box. Overlap depth on X is compared with overlap depth on Y — the smaller penetration decides the axis, so a top hit flips dy and a side hit flips dx. The ball is pushed clear of the box on the same frame, so it can never be swallowed by a brick.
A perpendicular reflection makes Breakout unwinnable. Instead the contact point is normalised to -1…+1 across the paddle and mapped to a ±63° exit vector. Edge contact = steep angle, centre contact = near-vertical. Vertical lock is impossible because the angle is capped.
When the ball spans two bricks, only the nearest centre resolves; the second is handled next tick. The destroyed brick's id is locked out for a few frames, and speed is stored as a unit direction × magnitude, so a bounce never adds or bleeds energy.
Rendering follows requestAnimationFrame, physics runs on an accumulator at exactly 1000/60 ms with a 4-step catch-up cap. A 120 Hz phone gets twice the frames but the same ball speed — and a backgrounded tab doesn't teleport the ball through the wall.