(1) (20 points) Let the function $f(x)=\cos x \cos (x-\theta)-\frac{1}{2} \cos \theta, x \in \mathbf{R}, 0<\theta<\pi$. It is known that when $x=\frac{\pi}{3}$, $f(x)$ attains its maximum value.
(1) Find the value of $\theta$;
(2) Let $g(x)=2 f\left(\frac{3}{2} x\right)$, find the minimum value of the function $g(x)$ on $\left[0, \frac{\pi}{3}\right]$.
(1) (1)
$$
\begin{aligned}
f(x) & =\cos x(\cos x \cos \theta+\sin x \sin \theta)-\frac{1}{2} \cos \theta \\
& =\frac{1+\cos 2 x}{2} \cos \theta+\frac{1}{2} \sin 2 x \sin \theta-\frac{1}{2} \cos \theta \\
& =\frac{1}{2} \cos (2 x-\theta)
\end{aligned}
$$

Given \( f(x)_{\max }=f\left(\frac{\pi}{3}\right)=\frac{1}{2} \), we have \(\frac{1}{2} \cos \left(\frac{2 \pi}{3}-\theta\right)=\frac{1}{2}\), which implies \(\cos \left(\frac{2 \pi}{3}-\theta\right)=1\).
Since \(0<\theta<\pi\), we get \(\theta=\frac{2 \pi}{3}\).
(2) From (1), we know \( f(x)=\frac{1}{2} \cos \left(2 x-\frac{2 \pi}{3}\right) \), thus
$$
g(x)=2 f\left(\frac{3}{2} x\right)=\cos \left(3 x-\frac{2 \pi}{3}\right)
$$

Since \(0 \leqslant x \leqslant \frac{\pi}{3}\), we have \(-\frac{2 \pi}{3} \leqslant 3 x-\frac{2 \pi}{3} \leqslant \frac{\pi}{3}\).
Therefore, when \(3 x-\frac{2 \pi}{3}=-\frac{2 \pi}{3}\), i.e., \(x=0\), \(g(x)_{\min }=-\frac{1}{2}\).