Use Math.hypot for hypotenuse calculations.