ELI5: Why are beds so uncomfortable when you're trying to get to sleep but so comfortable when you need to wake up?

[removed]