Election 2017: What does it all mean in Scotland?
Scotland's seventh trip to the polls in just over three years is in the books, and it's been another thrill-ride.
There have been gains and losses the length and breadth of the country, and a massive question mark hangs over what happens next at Westminster.
Alistair Carmichael summed it up during his victory speech in Orkney and Shetland: "The people have spoken, but it's not yet exactly clear what they've said."
So what do the results mean for the big issues in Scotland?
The UK government
The UK is heading into a hung parliament, with no clear winner of the election.
The Conservatives are the largest party, with Labour a bit behind them. Both have increased their cohort north of the border - the Tories particularly so, with their best showing since 1983. All of those new MPs are important; whoever ends up forming a government is going to need every vote they can get.
Theresa May has indicated she will take first crack at getting a Queen's Speech through parliament; it seems likely that without the 12 seats she picked up north of the border, it would have proved an impossibility.
And despite losing more than 20 seats, the SNP are still comfortably the third largest party in the UK - and could end up playing a major role. They could potentially even be king-makers, should Mrs May's attempts to form a government fall apart.
Talk of formal coalitions was scotched in the latter days of the campaign, but Nicola Sturgeon has expressed an interest in her party working with Jeremy Corbyn's Labour on an "issue by issue basis".
Expect chaotic days to come, but the SNP are well placed to potentially play a pivotal role.
The SNP have won a majority of seats in Scotland. Despite a frequently painful night, they have won the election.
Their manifesto says this gives them a "triple lock" mandate to hold a second independence referendum. But will they want to, at this point?
Avowedly unionist parties have won more than 60% of the vote. While the dethroned Alex Salmond reckons a lot of Yes voters backed Jeremy Corbyn's Labour, indyref2 is going to be a pretty tough sell in the immediate future.
Ruth Davidson, who had as good a night as any leader in the country, has proclaimed it "dead" - although she, of course, would.
Nicola Sturgeon says she will reflect, but that triple lock is in truth on her as much as anyone else. She doesn't want to hold a referendum until she thinks she can win, but has she now painted herself into a corner with her party's base?
For that matter, could indyref2 end up playing a part in any potential agreement with a prospective UK government?
Nicola Sturgeon insists this is still a win for the SNP, despite the painful loss of Angus Robertson, her depute leader, and Alex Salmond, her mentor.
To start with, her leadership is not in doubt. A few sleep-deprived souls may have speculated wildly in the dead of the night as strongholds were toppled, but Ms Sturgeon remains unassailable at the top of the party.
But who will lead the troops at Westminster, now Mr Robertson is gone?
He was an increasingly impressive figure during the term cut short by the snap election, turning in polished performances at the weekly sessions of PMQs. His are rather large shoes to fill.
And with a lot of the more convincing candidates for the role also getting the boot, who is left?
Pete Wishart is now the party's longest-serving and most experienced MP, albeit a fairly divisive figure. Tommy Sheppard is popular with the grass roots, and Patrick Grady has had some standout moments. Joanna Cherry is often put forward to represent the party - could she be a possibility?
Stephen Gethins, an impressive performer in his two years as an MP so far, was a late addition to that list after he scraped home by almost the slimmest possible margin.
It's a discussion the party will really wish they didn't have to be having.
Ruth Davidson ended the night as the most successful Conservative leader in the UK.
Theresa May's gamble failed. Even the Daily Mail, perhaps the biggest Tory cheerleader in the Scottish press, are calling it "a night of humiliation". To contrast, it was a night of triumph for Ms Davidson's troops.
In all, the Tories made gains in 20 seats across the UK - 12 of them were in Scotland. In a parliament of paper-thin margins, those seats could make a huge difference.
The Tories have had their best result north of the border since 1983. They overturned some enormous SNP majorities, and knocked off some leading nationalists.
Ms Davidson has turned the party from electoral whipping boys into the second force in Scotland, and has now racked up a hat-trick of successes - at Holyrood, in local elections and now at Westminster.
And even in the aftermath, the Scottish party leader outshone her boss.
As Theresa May grimaced outside Downing Street while scarcely mentioning the election, Ms Davidson was rallying the troops, admitting the party "fell short of expectations" and pledging to build consensus.
She also made what seemed like an open policy intervention, calling for an "open Brexit, not a closed one", and tweeted a subtle dig at the DUP, her party's proposed Westminster partners.
It appears Ms Davidson has elected to roll up her sleeves and get involved. The party would dearly love to have her among the new cohort of MPs heading to Westminster.
It's been a good night for Scottish Labour. They came in with few expectations, but have reclaimed seats in many of their old heartlands in Fife and Glasgow.
Yes, they are in third place in Scotland, behind the Tories - a fairly unimaginable position as recently as 2014. But they are still hailing a "remarkable" result, given the hammering they took in 2015.
The party are hoping they are now emerging into the light at the end of a particularly dark tunnel.
But, some might ask, is this revival more down to Kez, or Jez? (That's Kezia Dugdale and Jeremy Corbyn to you).
Mr Corbyn's future seems assured. You would broadly expect the same to be true of Ms Dugdale, but it's worth remembering that she was at best a late convert to the Corbyn cause. Some of the UK leader's allies in the Scottish party have not forgotten her endorsement of his leadership rival Owen Smith.
But assuming all remains rosy in the Labour garden, will Ms Dugdale now have a chance to press through her plans for a federal UK?
The Scottish Lib Dems have rather propped the party up - three of their eight gains came north of the border.
It was a mixed night for the party overall, with Vince Cable returning to parliament, but Nick Clegg leaving.
Jo Swinson is another returning heavyweight, having reclaimed her old East Dunbartonshire seat from the SNP. Some have even speculated that she might be a future party leader.
There are some other experienced figures among the new Scottish cohort - Christine Jardine was an advisor in the coalition government, and Jamie Stone has now held more or less every elected position there is, from local councillor to MSP to MP.
They also produced perhaps the most dramatic moment of the night, when they missed out on North East Fife by two votes after a triple-recount. We might not have heard the end of that - the party is taking legal advice.
Even leaving indyref2 to one side, there are all sorts of constitutional questions looming.
Labour had a good night in Wales, winning 28 of the 40 seats. And Welsh Labour leader Carwyn Jones has called for the Barnett formula which underpins the financial side of devolution, to be scrapped. The other bits of Labour are opposed to that, but are calling for a "constitutional convention" to seek a more federal UK. Even if Labour doesn't end up in government the Welsh wing has undoubtedly strengthened its voice.
There's also the matter of English Votes for English Laws. We don't know for certain exactly who's going to end up in government at this stage, but with margins razor-thin the party in power will need their Scottish cohort in many parliamentary votes.
And what about Brexit? The big issue which was supposedly the catalyst for this election?
Whoever ends up leading the government will end up leading the Brexit negotiations, which start in a mere ten days. But the loss of so many seats may have damaged Nicola Sturgeon's claims for influence. If she was unable to exert much influence over the process with 56 (or 54) MPs, how will she fare with 34?
The answer is again rooted in who ends up in Downing Street, and how approachable they prove. Could Ms Sturgeon demand a place at the negotiating table, in exchange for her MPs propping up the government?
Sorry, your browser cannot display this content.
Find your result
Enter a postcode or seat name