5. Given a cube $A B C D-A_{1} B_{1} C_{1} D_{1}$ with edge length 1, take point $M$ on the diagonal $A_{1} D$ and point $N$ on $C D_{1}$, such that line segment $M N$ is parallel to the diagonal face $A_{1} A C C_{1}$. Then the minimum value of $|M N|$ is
A. $\frac{\sqrt{3}}{3}$
B. 1
C. $\sqrt{2}$
D. $\frac{\sqrt{2}}{2}$
Given $D E=D F=x$, then $E F=\sqrt{2} x, M E=x, N F=1-x$, thus $M N^{2}=2 x^{2}+(1-2 x)^{2}$ $=6 x^{2}-4 x+1=6\left(x-\frac{1}{3}\right)^{2}+\frac{1}{3} \geqslant \frac{1}{3}$, equality holds when $x=\frac{1}{3}$. Therefore, the answer is $A$.