Electronic states and phases of KxC60 from photoemission and X-ray absorption spectroscopy