From a distance, Tuesday’s elections looked like another step in the great sorting that is locking America’s 50 states into a seemingly unbridgeable political divide.

Zoom in closer, though, and the unstable center that decides the balance of power remains.

Nationally, red states got redder as Republican voters ousted long-serving Democratic senators in North Dakota, Indiana and Missouri. At the same time, Democratic-majority blue states like New York cast off many of their few remaining Republican congressmen.

State legislatures followed the trend. New York’s vote to hand its state Senate to the Democrats left purple Minnesota as the only state in the union with a divided government. Now the Republicans have complete control of 31 state legislatures, while Democrats hold 18. They will oversee the once-a-decade redistricting slated to begin two years from now — and will strive to cement those majorities in place.

For Republicans in Congress, Tuesday’s results were a mixed bag: They increased their hold on the Senate but lost their majority in the House of Representatives.

Perversely, both outcomes had the effect of burning off the GOP’s Trump-doubting outliers, leaving behind a purified party less given to ideological squabbles and ready to unite behind the president.

Congressional Democrats got their dearest wish: control of the House — and the unfettered subpoena power that comes with its committee chairmanships.

To do it, they flipped at least 30 formerly Republican congressional districts in 19 states, many by razor-thin margins. They owed their success to a clutch of middle-of-the-road candidates, many of them former members of the military, who appealed to moderate, well-educated suburban voters allergic to Trump’s brash populism.

But these incoming freshmen ran on promises to oppose their own party’s progressive leadership. Unlike the firebrand democratic socialists headed to Congress from deep-blue districts, the new class of “blue dog” moderates will be the Democrats’ most vulnerable members in 2020.

With so much of the electorate firmly divided, both sides will be fighting for the hearts and minds of voters in the districts that switched allegiances Tuesday — while trying to keep their passionate purists in line.

House Democrats must build a functioning conference out of seemingly mismatched parts.

“Picking those moderate candidates paid off in the general-election campaign,” said Julian Zelizer, a professor of history and public affairs at Princeton University. “But now comes the time to govern.”

Their first major hurdle will come in January, when the whole House elects its new speaker.

Many freshman moderates — plus a dozen or more incumbents like Conor Lamb (D-Pa.), who won a special election in a formerly Republican district in April and was re-elected Tuesday — have pledged to reject House Minority Leader Nancy Pelosi’s bid to reclaim her old job.

“But right now no viable alternative candidate is amassing the votes necessary to mount a real challenge,” said Molly Reynolds, a fellow at the Brookings Institute.

“I would be seriously shocked if she met with anything more than superficial opposition,” said William Jacobson of Cornell Law School, publisher of the Legal Insurrection website.

The moderates “will be told in no uncertain terms” that unless they vote for Nancy Pelosi, any bill they want to champion will be blocked, Jacobson said.

Assuming she gets her old job back, Pelosi will have to rein in her progressive members’ burning desire to impeach President Trump immediately if not sooner.

The reason is pure party self-interest. “Pursuing impeachment would exacerbate polarization and could damage the social fabric in fairly serious ways,” said Andrew Coan, a University of Arizona law professor and author of an upcoming book on the history of special prosecutors. It could even sink the Democrats’ White House chances in 2020.

Instead, Pelosi has been talking up bipartisanship, even adopting Trump’s “drain the swamp” rhetoric in her victory speech Tuesday night.

Many doubt she means it.

“I don’t see Pelosi working with Senate leadership on any policies that will benefit the Trump administration,” said Tim Chapman of Heritage Action, a conservative advocacy group. “On that she is in 2020 mode already.”

‘The Republicans are going to call the bluff of those new Democratic moderates.’ - Tim Chapman, Heritage Action

As an alternative, she could use the House to persuade moderate voters into adopting progressive ideals. “They might propose something they know could never pass both houses just to get the ideas out there,” Zelizer said. “That’s a third path: issues-based but not necessarily bipartisan.”

That’s exactly what GOP strategists are hoping the Democrats will do.

“The Republicans are going to call the bluff of those new Democratic moderates,” Chapman said — first by highlighting their speakership votes, then by putting them on the defensive about their party’s policy proposals.

“If they push things like Bernie Sanders’ Medicare-for-All, what are the Conor Lambs of the world going to do?” Chapman asked. “Can they stay true to what they said to the voters who put them in office, or do they cave to the pressure of the party?”

The GOP minority will use parliamentary maneuvers to force the moderates into votes on broadly popular issues like tax cuts and border security “that they know are poison to the Democratic base,” Chapman said. “Just to try to drive that wedge deeper.”

On the Senate side, conservatives are exulting in flips and holds that not only expand their majority but make it much more Trump-friendly.

“A lot of the opposition he had within the Republican Senate is now gone,” Jacobson said. “It gives him a lot more leeway in selecting judicial nominees” — especially if a recount fight in Arizona and a runoff in Mississippi leave the GOP with a firm 53-seat majority.

“With 53 votes, the Senate is no longer held hostage” to Sens. Susan Collins of Maine and Lisa Murkowski of Alaska, Jacobson said — the two Republicans who nearly scotched Brett Kavanaugh’s Supreme Court nomination.

“And of course a Republican Senate is a backstop to any legislative excesses from the House,” Chapman said.

House Republicans, meanwhile, will try to use every last bit of their investigatory powers during the lame-duck congressional session that starts Tuesday.

“I expect that there will be some meaningful declassification of documents before the end of year,” Jacobson said. “But the clock is ticking.”

Rep. Devin Nunes (R-Calif.) and others have been pushing the White House to declassify documents that they say will reveal the Trump-Russia collusion narrative to have been a mirage all along.

Nunes may have an ally in Matthew Whitaker, the newly named Acting Attorney General, who has reportedly been a behind-the-scenes declassification advocate within the Department of Justice.

At the same time, once the new Democratic majority is sworn in, “You will see a lot of fury and theatrics at the committee level,” Jacobson said, as they launch investigative efforts meant to hobble the Trump administration — and to hold off the left wing’s impeachment demands.

“They’ll push forward some things that are easy for voters to understand, like Trump’s tax returns,” Reynolds said. “Other presidents have released theirs, and Trump hasn’t. As a first move, that has some value.”

But the general electorate is likely to shrug off the outcome. “I don’t think the release of his taxes will have any effect on voters,” Jacobson said. “Unless we see a 1099 form from Vladimir Putin in there, it will be a whole lot of nothing.”

New York Democrat Jerrold Nadler, who will soon take the reins of the House Judiciary Committee, is reportedly planning to pursue multiple anti­-Trump investigations, including a probe of Kavanaugh for alleged perjury during his confirmation hearings.

“Democrats are going to overreach,” Chapman said. “They owe their victory to the energy of their base, and their base was animated mainly by vitriolic distaste of this president.”

Hanging over both parties is the ongoing investigation by special counsel Robert Mueller. Democrats hope his 16-month probe into Trump and his presidential campaign’s alleged ties to Russia will uncover the Holy Grail: evidence of impeachable offenses.

“The present political environment is especially ominous for the Mueller investigation and for special prosecutors in general,” Coan said. “The extreme polarization of the parties makes it significantly less likely for members of a president’s own party to abandon him, even in the face of serious allegations.”

“My best estimate is that Trump will allow the Mueller investigation to play itself out,” Jacobson said. “I can’t believe that Nancy Pelosi will allow them to actually move forward on impeachment, unless the probe was to reveal something dramatic. Based on all that is public now, it will not.”

“It benefits Republicans if the other party is pursuing a revenge agenda,” Chapman said. “Voters are trying to figure out what can get done in Washington, if anything. It’s not a good look if nothing can get done while the Democrats are in charge of the House.”

For the Democrats, it’s a risky tightrope walk — and their narrow majority means there’s not much net below them as they tiptoe toward 2020.