The difference between the greatest and least values of the function $f(x)=\sin 2 x-x$ on $\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]$ is
(a) $\pi$
(b) $\left(\frac{\sqrt{3}}{2}+\frac{\pi}{3}\right)$
(c) $\left(\frac{\sqrt{3}+\sqrt{2}}{2}+\frac{\pi}{6}\right)$
(d) $\left(\frac{\sqrt{2}+\sqrt{3}}{2}\right)$