High-resolution single-shot spectral monitoring of hard x-ray free-electron laser radiation