Value distribution of long Dirichlet polynomials and applications to the Riemann zeta-function