Self-similar viscous gravity currents: phase-plane formalism