Phase-space analysis of k-essence cosmology