The MEGA project: Science goals and hardware development