A brain-monitoring device may one day take the guesswork out of anesthesia