High-resolution spectroscopy of gamma-ray bursts