Excited-state thermodynamics