It was a sort of video game first, though:
> https://en.wikipedia.org/wiki/Steins;Gate
To be more specific, it was a visual novel -- which is like a reading-heavy/gameplay-light RPG. Equal parts book and game. (The nearest mainstream western equivalent would be something like Planescape: Torment.)
The anime adaptation, while good, didn't come close to capturing everything.