In $\triangle A B C$, it is known that $A B=2$, $A C=1$, and
$$
\cos 2 A+2 \sin ^{2} \frac{B+C}{2}=1 \text {. }
$$
(1) Find the size of $\angle A$ and the length of side $B C$;
(2) If point $P$ moves within $\triangle A B C$ (including the boundary), and the sum of the distances from $P$ to the three sides is $d$, let the distances from $P$ to sides $B C$ and $C A$ be $x$ and $y$ respectively, express $d$ in terms of $x$ and $y$, and find the range of $d$.
(1) From
$$
\begin{array}{l}
\cos 2 A+2 \sin ^{2} \frac{B+C}{2}=1 \\
\Rightarrow \cos 2 A-\cos (B+C)=0 \\
\Rightarrow 2 \cos ^{2} A+\cos A-1=0 \\
\Rightarrow \cos A=\frac{1}{2} \text { or } \cos A=-1 .
\end{array}
$$

Since $\angle A \in(0, \pi)$, then $\angle A=\frac{\pi}{3}$.
By the cosine rule,
$$
B C=\sqrt{A B^{2}+A C^{2}-2 A B \cdot A C \cos A}=\sqrt{3} \text {. }
$$
(2) Solution 1: Let the distance from point $P$ to side $A B$ be $z$. Then
$$
\begin{array}{l}
S_{\triangle A B C}=S_{\triangle P B C}+S_{\triangle P C A}+S_{\triangle P A B} \\
=\frac{1}{2}(\sqrt{3} x+y+2 z) . \\
\text { Also, } S_{\triangle A B C}=\frac{1}{2} B C \cdot C A=\frac{\sqrt{3}}{2} \\
\Rightarrow \frac{1}{2}(\sqrt{3} x+y+2 z)=\frac{\sqrt{3}}{2} \\
\Rightarrow z=\frac{1}{2}(\sqrt{3}-\sqrt{3} x-y) .
\end{array}
$$

Thus, $d=x+y+z=\frac{1}{2}[(2-\sqrt{3}) x+y+\sqrt{3}]$.
And $x, y$ satisfy
$$
\left\{\begin{array}{l}
x \geqslant 0, \\
y \geqslant 0, \\
\frac{1}{2}(\sqrt{3}-\sqrt{3} x-y) \geqslant 0 .
\end{array}\right.
$$

Therefore, the range of $d$ is $\left[\frac{\sqrt{3}}{2}, \sqrt{3}\right]$.
Solution 2: From (1), we know that $\triangle A B C$ is a right triangle. Establish a right-angled coordinate system as shown in Figure 4. Then
$$
l_{A B}: \sqrt{3} x+y-\sqrt{3}=0 .
$$

The distance from point $P(x, y)$ to line
$A C$ is
$$
z=\frac{\sqrt{3}-\sqrt{3} x-y}{2} .
$$

The rest is the same as Solution 1.