13. Given the function $f(x)=2 \sin ^{2}\left(\frac{\pi}{4}+x\right)-\sqrt{3} \cos 2 x-1, x \in\left[\frac{\pi}{4}, \frac{\pi}{2}\right]$.
(1) Find the interval where $f(x)$ is monotonically increasing;
(2) If the inequality $|f(x)-m|<2$ holds for all $x \in\left[\frac{\pi}{4}, \frac{\pi}{2}\right]$, find the range of the real number $m$.
(1) $f(x)=-\cos \left(\frac{\pi}{2}+2 x\right)-\sqrt{3} \cos 2 x=\sin 2 x-\sqrt{3} \cos 2 x=2 \sin \left(2 x-\frac{\pi}{3}\right)$,

Let $2 k \pi-\frac{\pi}{2} \leqslant 2 x-\frac{\pi}{3} \leqslant 2 k \pi+\frac{\pi}{2} \Rightarrow 2 k \pi-\frac{\pi}{6} \leqslant 2 x \leqslant 2 k \pi+\frac{5 \pi}{6}$
$\Rightarrow k \pi-\frac{\pi}{12} \leqslant x \leqslant k \pi+\frac{5 \pi}{12}(k \in \mathbf{Z})$, so the monotonic increasing interval of $f(x)$ is $\left[\frac{\pi}{4}, \frac{5 \pi}{12}\right]$.
（2）From (1), we know $f(x)_{\min }=\min \left\{f\left(\frac{\pi}{4}\right), f\left(\frac{\pi}{2}\right)\right\}=1, f(x)_{\max }=f\left(\frac{5 \pi}{12}\right)=2$.
$|f(x)-m|f(x)\end{array}\right.$ holds for $x \in\left[\frac{\pi}{4}, \frac{\pi}{2}\right]$,
then $\left\{\begin{array}{l}m-22\end{array} \Rightarrow 0<m<3\right.$. Therefore, the range of $m$ is $(0,3)$.