My name is Stephen and I am part of the problem.

I work in the media, earn a reasonable(ish) salary, live in a big city, mosey around with a diverse group of friends, and wouldn't think twice about spending a tidy sum on a nice bottle of wine at the weekend.

I believe and loudly proclaim that immigration is an unalloyed good. To me, freedom of movement is city breaks in Milan and lifelong friends made at university and six different kinds of kiełbasa in the supermarket.

Sovereignty is the stuff of international fishing disputes and tribes suing New Mexico. Borders are necessary for security but don't delineate national characteristics. "All people become brothers/Where your gentle wing abides."

That outlook has been rejected by the voters of Britain. Rejected narrowly but rejected all the same. They reckon borders are meaningful and, actually, sovereignty does matter. Polish sausage? Delicious, but Polish competition for scant jobs? Not as tasty, mate.

Those of us whose worldview has been shattered today could respond with a venom all too prevalent in this caustic and unpleasant campaign. We could resurrect Pauline Kael on the 1972 US presidential election: "I only know one person who voted for Nixon. Where they are I don't know. They're outside my ken. But sometimes when I'm in a theatre I can feel them."

It would be pointless, though. Leave won, Remain lost, deal with it.

And learn from it.

A good democrat accepts the outcome of free and fair elections, even if the result distresses or repels them. A great democrat tries to understand why the country voted as it did. It's easy to tolerate the sturdy reality of numbers. It's more difficult to tolerate troubling ideas and those who hold them.

Don't be a sore loser, be a smart one.

When I was a student, I spake as a student.

November, 2004. George W Bush pummelled John Kerry to win another four years in the White House. The world became fixed by a map depicting the result: A continental sweep of crimson, slithers of cobalt clinging to the coasts and the unionised Mid West. Poor, uneducated whites in the heartlands had voted for God, guns and no gay marriage while college graduates and minorities in New York and California wanted more healthcare, fewer emissions, and a less belligerent foreign policy.

At the time, I tut-tutted at the gullibility of Bush-backers; how easily led they were, shucked into voting against their economic interests by silly wedge issues rehashed from Leviticus. "Their red necks burned through their blue collars," I quipped in an essay a few weeks after the election. I was terribly proud of my bitchy little antithesis.

Eventually, I put away studentish things. I came to see that Dubya's voters weren't crude caricatures -- the gun-totin', Coulter-dotin', Fox-quotin' hillbillies of liberal lore. They were hard-pressed lower and middle income families living paycheck to paycheck; fearful of change because "change" usually meant them getting screwed; helpless as immigration changed their communities and the culture upended old certainties about right and wrong. They were afraid of terrorism, afraid of bolshy unions costing them their job, afraid of electing a weak leader at a time of acute global danger.

The same is true of the Brexit majority. They are not stupid, most are not racist (though some undoubtedly are), and they are not hated-filled provincials. They are our brothers and sisters, our neighbours, the school chums we muted on Facebook a few weeks back because they kept posting that £350m a week claim. We have our prejudices and they have theirs. They are good people, if a little PRONE TO USING ALL CAPS TO MAKE THEIR POINT, and want what's best for their country. They are patriots, our countrymen and women, and we all have to get along after today.

The priority is to heal the wounds inflicted by this referendum. That will be mostly about tone and comportment. It means national unity, not incendiary talk about only one side representing "real people". The winners are entitled to their celebrations, a glass of something bubbly or six, but humility is a virtue. Half of Britain is hurting today. They are confused; they are scared; they need to be told things will work out -- that we're all in this together, as a former future prime minister once put it.

Soon the bubbly will fizz out and harsh realities will intrude on the red, white and blue jubilations. Soon Project Fear will start to look more like Project Fact.

The economic fallout from Brexit is going to be brutal. Jobs will be lost. Businesses destroyed. Those lustful for a breakaway from Brussels bureaucracy are about to learn just how much of our political and economic life is underpinned by that bureaucracy. This isn't the line for Sovereigntyfest 2016. This is the dole queue.

When the time comes to swallow the bitter medicine, Remainers should not gloat. The country must feel confident in its decision. The economy cannot be rebuilt and prosperity achieved in a climate of doubt and regret. Criticise the shortfall between the rhetoric and the reality of Leave by all means but "I told you so" is not an argument -- it's a tantrum.

We're British, after all. Stiff upper lip and all that.

After bringing the country together and stabilising the economy, we will have to convene a national conversation on immigration. It's not going to be pretty. The referendum exposed the chasm between public perception and the facts of immigration. Compromise will be essential from both sides. The Brexiteers, many of whom appear to have been motivated by migration fears, will have to accept that Fortress Britain isn't going to happen. Our economy, to say nothing of the NHS, is too reliant on skilled migrants. Closing the door on them means shuttering businesses and public services across the UK.

And immigration liberals will finally have to confront public opinion and recognise that we are in the minority. There is little appetite out there for free movement of people. The voters want strictly controlled borders, enforcement, caps on numbers, and swift deportations of illegal immigrants. Grimly, we had better get used to the phrase "Australian-style points system". We shouldn't abandon the cause of free movement and a flexible immigration system but we will now have to win the arguments for it, rather than imposing it on a hostile public from the top.

This is before we even get to negotiations for secession, scheduled to last two years. Securing the best deal for Britain will not be easy. Berlin won't wish to "punish" Britain but nor can it be seen to be doing us any favours. If the UK walks out and gets to keep the Blu-Ray collection, it could encourage nationalist parties on the Continent to push for a referendum. It is in the interests of the other 27 member states to give us as little as possible. Government and business will have to work closely and cannily to forge new trading relationships and attract fresh investment.

These and many other hurdles lie ahead. Some will seem insurmountable but when it comes to it, we'll jump the ones we can jump and work our way around the ones we can't. It will be hard, it will be painful, and many, perhaps in the coming months and years a majority, will deem it doleful and unnecessary. The UK might lose Scotland or see Ukip in a coalition government or be forced to reorient its economy. But Britain has been through worse and survived, indeed prospered, and in the end it'll do so again.

Making the best of a bad situation -- you can't get more British than that.

Comment by Stephen Daisley, STV's digital politics and comment editor. You can contact him at stephen.daisley@stv.tv.