Actual verse:
कृते सम्भाषणादेवत्रेतायां स्पर्शनेन च
द्वापरे त्वन्नमादायकलौ पतति कर्मणा २६
This is the verse. The word is कर्मणा (by Karma).
What is Karma? क is the body/self/aatmaa/ahamkaara. र् is the partial Agni Bija which denotes transformation. म is the Akaasha tattva denotation of ending म् followed by the अ which is creation. So, Karma is any and all things that require transformation of the body to end something and create a new, lasting (That's the Visarga in कर्मः) state. (This sort of derivation can be done in Samskrta as it's a divine and self existent language, not made by humans)
ANY and ALL transformations of the body/mind/self etc, anything related inherently to you, that produces a result (doesn't need to be physical) that is lasting is Karma. Your thoughts produce a lasting result (memories/sub-conscious) via a transformation of yourself, so they count. Not only thoughts, your words, things you write, you walking, you turning your head etc all counts as Karma.
We don't care about you dancing on your bed, as that doesn't count in Paapa or Punya. We care about Karma in relation to the Phala it produces. Specifically, in relation to the Phala it produces that is not easily understood by the mind. In other words, Karma Phala that seems unrelated to the Karma (you getting your arm chopped seems unrelated to the one time you ate an animal 15 years ago). This form of Karma can only be produced via interaction with other creatures. You can hurt or help another person by hitting/helping his mental or physical state. Right? There's not really another method to hurt someone. These are the only ways to produce good or bad karma (for the purposes of this answer, anyways). As long as you don't produce bad effects to another person or creature's mind or body, you will not get get Paapa, and similarly, you will not get Punya. These 'creatures' include Devas and Pitrs among others, as well. Paapa and Punya is also defined by your Dharma. If you're a dog, your dharma is not to do Shraaddha and DevaPuja, so you don't get any bad Karma from the suffering of Devas or Pitrs from your lack of appropriate action.
hari har bhedi narakgami
That's not an actual sin, it's just a interesting phrasing to make a point. Do you think all Christians automatically go to hell because they think Shiva is Satan or whatever? If you think so, you're sorely mistaken.
Means if I do any bad thing in thoughts, it is not a sin
It is bad since it produces bad Samskaaras. Samskaaras are impressions of the mind, a habit, of sorts (that persists in future lives). If you continuously think of murdering people, eventually, in one life you're reach a situation where you can murder (without many bad consequences), and you will do it, which will obviously create bad Karma on another creature which will naturally create Paapa which will naturally lead to you reaching a painful loka.
2)viewing someone lustfully is sin or not.
It is a sin, as it produces negative Karma Phala via the means of Samskaaras which make you more likely to act out on those thoughts in current or next life (where you may not be aware of Dharma).
Also what's consequence of adultery in thoughts is applicable in kaliyug or not(like adultery in thoughts destroys husband's or wife's dharma)
Bad Samskaara, only a person who commits adultery in thoughts, can commit adultery in action. If you commit adultery in action... well it will hurt your wife (or husband) and that is obviously bad Karma.
3)If motives of prayer are wrong.
Suppose you pray to kill someone, suppose that BECAUSE of your prayer (done in your mind), some entity that can see your mind ends up killing a guy, you WILL get the negative karma of that, certainly. If not, it just ends up being a bad Samskaara which will eventually lead to fueling your future liklihood of you actually killing someone (which of course, creates bad Karma, eventually).
Worry about reducing bad Samskaara instead of Sin or Hell.
Besides Samskaaras, there's another level to this as well, which gets very subtle and complicated, so I'd rather not go into it. I'd just like to hint it here. Samskaaras should be be enough to convince you not to do those bad Karmas though, hopefully.
Have you ever wondered, what the source of intrusive/suicidal thoughts are?