Seattle, Washington to Emeryville, California on Amtrak’s Coast Starlight. It was in coach, although the seat was about the size of a first class airline seat. I forgot to bring a pillow though, and my neck was feeling it. Not sure of the distance, but it was slightly under 24 hours.
Years ago I rode on an overnight train from Sydney to Melbourne. That was an experience, especially in the middle of the Australian winter in an assigned car where the heater stopped working. We tried to get into another car (same class) with heat only to have the conductor tell us that we weren’t allowed outside our assigned seats and he didn’t care if we were cold. He was relieved in the middle of the night and his replacement started waking passengers telling them to go to a car with heat.