  We prove the one-dimensional almost sure invariance principle with
essentially optimal rates for slowly (polynomially) mixing deterministic
dynamical systems, such as Pomeau-Manneville intermittent maps, with H\"older
continuous observables. Our rates have form $o(n^\gamma L(n))$, where $L(n)$ is
a slowly varying function and $\gamma$ is determined by the speed of mixing. We
strongly improve previous results where the best available rates did not exceed
$O(n^{1/4})$. To break the $O(n^{1/4})$ barrier, we represent the dynamics as a
Young-tower-like Markov chain and adapt the methods of Berkes-Liu-Wu and
Cuny-Dedecker-Merlev\`ede on the Koml\'os-Major-Tusn\'ady approximation for
dependent processes.
