Voters in Scotland cast their ballots as millions of Britons begin voting in a knife-edge referendum on EU membership after weeks of often bitter campaigning.