  We introduce a class of variational states to study ground state properties
and real-time dynamics in (2+1)-dimensional compact QED. These are based on
complex Gaussian states which are made periodic in order to account for the
compact nature of the $U(1)$ gauge field. Since the evaluation of expectation
values involves infinite sums, we present an approximation scheme for the whole
variational manifold. We calculate the ground state energy density for lattice
sizes up to $20 \times 20$ and extrapolate to the thermodynamic limit for the
whole coupling region. Additionally, we study the string tension both by
fitting the potential between two static charges and by fitting the exponential
decay of spatial Wilson loops. As the ansatz does not require a truncation in
the local Hilbert spaces, we analyze truncation effects which are present in
other approaches. The variational states are benchmarked against exact
solutions known for the one plaquette case and exact diagonalization results
for a $\mathbb{Z}_3$ lattice gauge theory. Using the time-dependent variational
principle, we study real-time dynamics after various global quenches, e.g. the
time evolution of a strongly confined electric field between two charges after
a quench to the weak-coupling regime. Up to the points where finite size
effects start to play a role, we observe equilibrating behavior.
