This is a hard question to answer and I've found the answers to be very personal, so there really isn't any correct answer to this. I love this one: “A science fiction story is a story built around human beings, with a human problem and a human solution, which would not have happened at all without its scientific content.” ― Theodore Sturgeon I would say that the same applies for fantasy, just replace the word "scientific" with "supernatural". Time setting is irrelevant, technology level is irrelevant. The thing that causes the most headaches are things that mix the scientific and supernatural components. Superheroes do this all the time. Star Wars does to some extent, but it has a basis in many of the stories from the pulp era. You can try and pin down science fiction to being grounded in real science, but throughout so much of the history of the genre, it has been filled with touches of the supernatural. I recently read C.L. Moore's Northwest Smith stories, written in the 1930's, and they were filled with the sort of semi mythological nonsense I associated with Lost in Space, Star Trek, Flash Gordon, and Buck Rogers. So in my opinion, there really isn't a clear dividing line. I would say that the dividing line is when you can't pretend it isn't fantasy. I'd say we have Hard SF, Soft SF, and Fantasy and the lines between each are not that clear.