Supporters of John Cox hope he can pull off an unprecedented upset in the governor's race come November.

With primary-election ballots still being tallied across the state, things are looking good for the California Republican Party … that is, not catastrophically bad.

It may be as close to good as the state’s second-biggest political party can hope for in California in 2018.

Assuming preliminary results hold, Democrats and Republicans fought to a virtual standstill on Election Day, avoiding the nightmare scenarios that political insiders had been fretting about for months.

Republicans made it into the top two spots in some of the most important contests for statewide office. That includes a decisive second-place finish by San Diego businessman John Cox, who will go on to face Democratic Lt. Gov. Gavin Newsom in the race for governor. That could prop up conservative turnout in November even as Newsom tries to rally his base against the candidate he calls a “foot soldier” of President Trump.

But Republicans failed to make it into the November race for U.S. Senate (which was largely expected), lieutenant governor (not quite as expected) and insurance commissioner (though a former Republican with no current party affiliation came in first).

Republicans did not manage to shut Democrats out of any competitive congressional races—despite the Democrats’ own worries about that—boosting the latter’s hopes of regaining control of the House in November.

Republican turnout was not suppressed by Trump, his low statewide approval ratings notwithstanding. So now what for the California GOP?

“They’re looking to charge up the base in seven key congressional districts,” said Mike Madrid, referring to seven Republican-held districts in which a majority of voters supported Democratic presidential candidate Hillary Clinton in 2016. “In California Republican politics, that’s about all you can consider a victory at this point.”

Madrid is a Republican political consultant who worked for Antonio Villaraigosa’s gubernatorial campaign and is sharply critical of the party under Trump.

A California Republican hasn’t been elected to any of the statewide constitutional offices or the U.S. Senate since 2006. Party registration has been sliding ever since, dipping below the share of voters without a party affiliation.

Republicans may have placed second in a number of statewide races this time, but if recent trends continue, that merely forestalls defeat in November. At last count, the various Democratic candidates for governor cobbled together more than 60 percent of the vote, compared to less than 40 percent for the Republicans.

In the attorney general’s race, where Republicans also managed to avoid a shutout, incumbent Xavier Becerra leads retired judge Steven Bailey, who placed second, by 20 percentage points.

One right-of-center candidate may have scored a first-place victory, though he isn’t listed as a Republican. Steve Poizner, who served as the state’s Republican insurance commissioner from 2007 through 2011, ran for his old job without a stated political party preference. The lack of an “R” next to his name may have helped.

“We understand that we’re the underdogs,” said state party chairman Jim Brulte. For months, he has argued that the party’s way forward is to consistently remind voters that Democrats have controlled every lever of power in Sacramento for eight years—and are therefore responsible for any problems facing the state.

“They own it; they broke it, and we’re the fix,” he said. “Their strategic reason for wanting to mention Donald Trump inevery other sentence is because even though they’re in charge, they don’t want to take credit for California.”

Democrats get it.

“It’s going to be Trump, Trumpism and the Resistance,” said Newsom spokesman Nathan Click while describing the campaign ahead. In his speech on election night, Newsom described Cox as “a foot soldier in Trump’s war on California.”

Cox responded in his own speech the same night: “It wasn’t Donald Trump who made us the highest tax state in the country. It was Gavin Newsom and the Democrats.”

Hammering Democrats on taxes, particularly on the recent increase in the state’s gas tax, will be a central talking point for Republicans in the coming months.

In one unequivocally good piece of news for the state’s GOP in this election, voters overwhelmingly opted to fire Josh Newman from his state Senate seat in Orange County. The successful recall campaign strips Democrats of their supermajority control of the state Senate, although they hope to win it back in the fall. It also provides Republicans with a political game plan for the months ahead.

“People who supported the gas tax (increase) are going to have a lot of explaining to do,” said Brulte.

Pete Peterson, a Republican who ran for California secretary of state in 2014 and who is now the dean of Pepperdine University’s School of Public Policy, said he hopes the party thinks a bit bigger than the gas tax. By overwhelming backing a left-leaning candidate like Newsom over a relative moderate like Villaraigosa, the Democrats have left the Republican Party an opening in California, he said.

The premise of the Villaraigosa campaign was to tack toward the center of California’s political spectrum, embracing targeted government assistance and a liberal immigration policy, while pumping the brakes on expensive programs like a proposed single-payer health-care system, enthusiastically supporting charter schools and occasionally wading into conservative rhetorical territory about red tape and bureaucratic excess.

With Villaraigosa’s loss, “there’s a significant part of the Democratic Party that is not going to be represented in this governor’s race,” said Peterson, who supports Cox. “So the question I have for Republicans is: Do you see that as an opportunity?”

Madrid says it’s too late. Cox embraced the support of President Donald Trump and spoke in favor of his immigration policies.

“To think that somehow moderates, centrist Democrats are going to move over and vote for a Trump supporter because they’re paying some extra money at the pump completely fails to grasp what is happening in this country and this state,” Madrid said.

CALmatters.org is a nonprofit, nonpartisan media venture explaining California policies and politics.