Kind of an odd, random question that popped into my head. Tidal energy - earth's ocean movement, volcanism on some of Jupiter's moons, etc. - obviously comes from the gravitational interaction between large bodies. On earth the interactions with the moon are pulling water around the surface, creating some amount of heat due to friction, etc.
My question is, where does that energy come from exactly? More specifically, what potential energy source is getting depleted to do that work? Is the earth minutely slowing down in its spin - or are the orbits of earth and the moon subtly altered over time by the counteractive movement and friction of liquids and gasses?