First the sunroof always "leaks" by design.
If water is entering the car then the drain pipes are most likely blocked
and you need to clear them.
Concerning the sunroof not responding: it is flaky and can gets itself confused
as to which position it is in. When this happens it goes into failsafe mode and will not
move at all.
Normally this needs to be reset (dealer always did this for me.)
but I was able to get it going again sometimes by playing with the control dial:
Putting it to fully open, pressing it, putting it to fully shut, pressing it,
putting it to fully tilted, pressing it and/or pressing it repeatedly in 1 position.
Generally jiggling the control.
Eventually it would start working again.
Once you get it working again, the trick to stop it failing is never
turn off the ignition unless the roof is fully opened or fully closed and not
to use the key remote to open/close it.