12. (20 points) Given that the center of ellipse $C$ is at the origin, the foci are on the $x$-axis, the eccentricity is $\frac{\sqrt{3}}{2}$, and the area of the triangle formed by any three vertices of the ellipse $C$ is $\frac{1}{2}$.
(1) Find the equation of the ellipse $C$;
(2) If a line $l$ passing through the point $P(\lambda, 0)$ intersects the ellipse at two distinct points $A$ and $B$, and $\overrightarrow{A P}=2 \overrightarrow{P B}$, find the range of the real number $\lambda$.
12. (1) Let the semi-major axis of the ellipse be $a$, and the semi-minor axis be $b$. Then
$$
\begin{array}{l}
\frac{\sqrt{a^{2}-b^{2}}}{a}=\frac{\sqrt{3}}{2}, a b=\frac{1}{2} \\
\Rightarrow a=1, b=\frac{1}{2} .
\end{array}
$$

Thus, the equation of the ellipse $C$ is $x^{2}+4 y^{2}=1$.
(2) Let $l: x=m y+\lambda, A\left(x_{1}, y_{1}\right), B\left(x_{2}, y_{2}\right)$.

From $\overrightarrow{A P}=2 \overrightarrow{P B}$, we get
$$
y_{1}=-2 y_{2} \text {. }
$$

By combining the equations of the ellipse $C$ and the line $l$, we obtain
$$
\left(m^{2}+4\right) y^{2}+2 \lambda m y+\lambda^{2}-1=0 \text {. }
$$

Clearly, $y_{1} 、 y_{2}$ are two distinct real roots of equation (2), then
$$
\begin{array}{l}
(2 \lambda m)^{2}-4\left(\lambda^{2}-1\right)\left(m^{2}+4\right)>0 \\
\Rightarrow m^{2}>4\left(\lambda^{2}-1\right) .
\end{array}
$$

By Vieta's formulas, we have
$$
y_{1}+y_{2}=-\frac{2 \lambda m}{m^{2}+4}, y_{1} y_{2}=\frac{\lambda^{2}-1}{m^{2}+4} \text {. }
$$

Combining equation (1), we get
$$
\begin{array}{l}
2\left(\frac{2 \lambda m}{m^{2}+4}\right)^{2}+\frac{\lambda^{2}-1}{m^{2}+4}=0 \\
\Rightarrow m^{2}=\frac{4\left(1-\lambda^{2}\right)}{9 \lambda^{2}-1} .
\end{array}
$$

When $\lambda \neq \pm 1, \lambda \neq \pm \frac{1}{3}$, substituting equation (4) into equation (3), we get
$$
\begin{array}{l}
\frac{4\left(1-\lambda^{2}\right)}{9 \lambda^{2}-1}>4\left(\lambda^{2}-1\right) \\
\Rightarrow \frac{1}{9}<\lambda^{2}<1 \\
\Rightarrow \lambda \in\left(-1,-\frac{1}{3}\right) \cup\left(\frac{1}{3}, 1\right) .
\end{array}
$$

When $\lambda= \pm \frac{1}{3}$, it also satisfies the condition.
Thus, $\lambda \in\left(-1,-\frac{1}{3}\right] \cup\left[\frac{1}{3}, 1\right)$.