Harry heard the hat shout the last word to the whole hall. He took off the hat and walked shakily toward the Gryffindor table. He was so relieved to have been chosen and not put in Slytherin, he hardly noticed that he was getting the loudest cheer yet. Percy the Prefect got up and shook his hand vigorously, while the Weasley twins yelled, "We got Potter! We got Potter!" Harry sat down opposite the ghost in the ruff he'd seen earlier. The ghost patted his arm, giving Harry the sudden, horrible feeling he'd just plunged it into a bucket of ice-cold water.
(Harry Potter and the Sorcerer's Stone)
I don’t get where the ghost is, because not knowing what ‘opposite’ means. The word gives me the impression that the ghost is across the table, so it seems not possible for him to pat Harry. What does the word, opposite, mean in the example?