4. In the cube $A B C D-A_{1} B_{1} C_{1} D_{1}$, there is a moving point $M$ on the base $A_{1} B_{1} C_{1} D_{1}$, and $B M / /$ plane $A D_{1} C$. Then the maximum value of $\tan \angle D_{1} M D$ is $\qquad$ .
As shown in the figure, note that plane $A_{1} B C_{1} / /$ plane $A D_{1} C$, then $B M / /$ plane $A D_{1} C \Rightarrow M \in A_{1} C_{1}$.
Since $\tan \angle D_{1} M D=\frac{D_{1} D}{D_{1} M}$, when $\tan \angle D_{1} M D$ reaches its maximum value, $D_{1} M$ is minimized, at which point $D_{1} M=\frac{\sqrt{2}}{2} D_{1} D$. Therefore, the maximum value of $\tan \angle D_{1} M D$ is $\sqrt{2}$.