Phase-matched coherent hard x-rays from relativistic high-order harmonic generation