People keep saying 'unelected bureaucracy', but this is a meme spread by the tabloid media. There is the council of ministers which is made up of representatives appointed by each country's democratically elected government. The council directs EU civil servants to draw up legislation. Every one of these representatives to the council has a veto over legislation that is proposed by it and control over how they are represented in the EU bureaucracy. There is then the EU parliament which is elected under a proportional representation system and has the ability to veto and propose amendments to decisions made by the council of ministers. Finally, EU directives are not 'laws' they are more like overarching goals that each country then passes into local laws to implement in detail, which is a further opportunity to kick back unwelcome legislation to the EU. Further, the EU employs civil servants at a ratio of civil servants to citizens of ~1/10000, compared to the UK ratio which is ~1/150. So it's not even particularly bureaucratic. If the council of ministers is making unpopular decisions it is because of a failure of democratically elected national governments to brief their representatives properly and engage with the process.

But the fact is that plenty of people don't have a clue how the EU works. On the streets of Britain, public services have been run down by underinvestment, house prices are out of control due a reluctance to reign in property speculation and good blue collar jobs with decent pensions are being lost to globalisation, automation and 'Uberisation' of the labour market. So a bunch of older poorer people in villages and small towns across England and Wales (not Scotland), read in the right wing tabloids that immigrants are to blame, they take this at face value and fall for it hook line and sinker and will ironically end up with an even more right wing government that no-one has voted for under Boris Johnson. What's more, it was clear that the vote was entirely down to fear of immigration not actual experience of immigration as the brexit vote was strongest in areas with the least immigrants. Places where people have never met a brown person voted most strongly for out based purely on fear stoked by tabloids peddling a racist agenda. Indeed some of UKIP's campaign posters were almost facsimiles of 1930's NAZI imagery.

There is a real democratic deficit in our system though. This referendum was proposed by the prime minister as part of a tactical gamble to control the right wing of his political party. This is a government which was only voted for by 1/3 of the electorate, and scraped through with a tiny majority of 6 MPs. The real wasteful bureaucracy with a strong dose of unelected elites is the UK parliament with the unelected House of Lords and the inefficient Houses of Parliament which is effectively a 'bistable' two party system due to the first past the post voting system. They waste unbelievable amounts of money changing things the previous government set up just in time for it all to be undone when they are voted out 10 years later. Political discourse amongst the populace seems like it is mostly dead in small town England and Wales, but it is striking to note however that political discourse is definitely not dead in Scotland and you can see the results as all of Scotland voted to remain. As an Englishman living in Scotland, and I speak for a lot of other English people I know up here too, I will definitely be voting to leave the UK and stay in the EU if the chance arises. There is plenty that is wrong with the EU, I think the council of ministers should be replaced, but it is at least as democratic as the UK parliament is now and more importantly it is a forward looking institution which is much more likely to evolve into something better than the UK parliament, especially after a vote like this.