For a brief, shining moment last year, it was good to be a Republican. Yes, an erratic, reality-star boor had laid siege to the West Wing, but for the first time in more than a decade, the G.O.P. had complete control over all branches of Congress, was poised to place an ideological ally on the Supreme Court, and could basically pass any right-wing agenda it wanted. “Welcome to the dawn of a new unified Republican government,” declared a triumphant Paul Ryan at a press conference, shortly after Donald Trump was elected. Of course, things didn’t quite turn out that way. While the Republican majority has been successful in stuffing the judiciary with fellow travelers, and was ultimately able to overhaul the tax code, returning billions of dollars to their corporate patrons, practically everything else fell apart. A failed effort to repeal and replace Obamacare left the party divided and unloved; a scuttled attempt to fix the immigration system has resulted in hundreds of thousands of Dreamers in limbo; the president’s promise to push a trillion-dollar infrastructure plan has fallen by the wayside; and the administration is consumed, day in and day out, with corruption scandals that have obscured any positive press from Trump’s tax cuts. Outside the safe space of the Fox newsroom, Republican voters are demoralized and Democratic activism is surging.

The result is a perfect storm for Republicans as they look down the barrel of the 2018 midterm elections. On Tuesday, party operatives received the latest evidence of what strategists predict will be a ‘blue wave’ in November: a massive 16-point swing in Arizona’s 8th Congressional district, where Republican Debbie Lesko eked out a narrow 5-point victory over her Democratic challenger in a district that went for Trump by 21 points in 2016. Despite pouring over a million dollars into the race (and a Trump tweet or two), the G.O.P. came dangerously close to losing an election that should have been a blowout. As FiveThirtyEight’s Nate Silver points out, AZ-8 is a completely “generic” district that ran two generic candidates. There were sex scandals or other skeletons to excuse a double-digit swing.

Within some redoubts of the far right, Lesko’s win was still a victory. “On Tuesday, the blue wave fizzled in Arizona,” Breitbart News assured readers, predicting that “the Democratic Party and the mainstream media will soon forget the outcome in Arizona’s 8th Congressional District and turn to the next bit of evidence to support the idea of momentum for the Democrats.” But inside Washington, the writing is on the wall. Four Senate Republicans and 25 House Republicans—including House Speaker Paul Ryan—have already said they will not run for re-election this fall, making the lower chamber all but certain to change hands in November. According to the renowned Cook Political Report, 50 Republican seats are considered competitive, compared to just five for Democrats.

Some Republican operatives fear the Senate, too, could be in play. “Everyone just universally assumed it would be status quo or Republicans would win a seat or two,” a Republican lobbyist with ties to the Senate told Axios. “And now it feels like Republicans are at a risk of losing one, which would be a 50-50 Senate or two, which would be a Democratic Senate.” The possibility has further energized Democrat Senate candidates, already running off the high of successfully taking the ruby-red Alabama last December, leading to spectacular results: Beto O’Rourke, for instance, out-raised Ted Cruz in Texas, two-for-one, last quarter. “[W]e do have more defensive terrain to hold than when the cycle started,” said Steven Law, who runs the Mitch McConnell-aligned American Crossroads PAC.

For now, most Republicans are nowhere near full-on panic mode. They may hold on to seats—no matter how narrowly—if they run strong candidates in pro-Trump districts in danger of swinging. (The candidates in their highest-profile losses to date—the unnervingly creepy Roy Moore in Alabama and the apathetic Rick Saccone in Pennsylvania’s 8th—arguably sabotaged their own chances.) And while losing the House would be crippling, it wouldn’t be fatal. President Trump would be a lame duck, legislatively, forced to compromise with Democrats to enact any part of his platform. But as any political statistician will attest, divided government is to be expected in the first midterm election after the presidency changes parties.

Losing the Senate would be another matter entirely. While a Republican Senate could continue to confirm conservative judges and political appointees, a complete Democratic takeover would put the Trump agenda on ice. The prospect of impeachment, dependent on the conclusions of the Mueller probe, could become an inevitability.