/**
 * Normalize an angle in degrees to the [0, 360) range.
 * Used for storage because the schema requires `rotation: z.number().min(0).max(360)`.
 */
export function normalizeAngleDegrees(deg: number): number {
  if (!Number.isFinite(deg)) return 0;
  const wrapped = deg % 360;
  return wrapped < 0 ? wrapped + 360 : wrapped;
}
