Gauge variation of the charged-particle Lagrangian
= Gauge variation of the charged-particle Lagrangian
Under $\phi\mapsto\phi-\partial_tf$ and $A\mapsto A+\nabla f$, the charged-particle Lagrangian changes by
$$
L' - L=q\bigl(\partial_tf+\dot r\cdot\nabla f\bigr)
=q\frac{df(r(t),t)}{dt}.
$$
It therefore has unchanged equations of motion by total-time-derivative invariance.