This was one that the Republicans really should have won.

Given the weak economy, American voters were open to firing President Barack Obama. In Europe, in similar circumstances, one government after another lost re-election. And, at the beginning of this year, it looked as if the Republicans might win control of the U.S. Senate as well.

Yet it wasn't the Democrats who won so much as the Republicans who lost -- at a most basic level, because of demography. A coalition of aging white men is a recipe for failure in a nation that increasingly looks like a rainbow.

Schadenfreude may excuse Democrats' smiles for a few days, but these trends portend a potential disaster not just for the Republican Party but for the health of our political system. America needs a plausible center-right opposition party to hold Obama's feet to the fire, not just a collection of tea party cranks.

So liberals as well as conservatives should be rooting for the Republican Party to feel sufficiently shaken that it shifts to the center. One hopeful sign is that political parties usually care more about winning than about purism. Thus the Democratic Party embraced the pragmatic center-left Bill Clinton in 1992 after three consecutive losses in presidential elections.

That was painful for many liberals, who cringed when Clinton interrupted campaigning in the 1992 primary to burnish his law-and-order credentials by overseeing the execution of a mentally impaired murderer. But it was, on balance, less painful than losing again.

You would expect the Republican Party to make a similar lurch to the center. But many Republican leaders still inhabit a bubble. It was stunning how many, from Karl Rove to Newt Gingrich, seemed to expect a Mitt Romney victory. And some of the right-wing postmortems are suggesting that Romney lost because he was too liberal -- which constitutes a definition of delusional.

Imagine what would have happened if the Republican nominee had been Gingrich or Rick Santorum. We surely would have seen a Democratic landslide.

On the other hand, if the Republicans had nominated Jon Huntsman Jr., they might have been the ones celebrating right now. But he had no chance in Republican primaries because primary voters are their party's worst enemy.

Part of the problem, I think, is the profusion of right-wing radio and television programs. Democrats complain furiously that Rush Limbaugh, Glenn Beck and Sean Hannity smear the left, but I wonder if the bigger loser isn't the Republican Party itself. Those shows whip up a frenzy in their audience, torpedoing Republican moderates and instilling paranoia on issues like immigration.

All this sound and fury enmeshes the Republican Party in an ideological cocoon and impedes it from reaching out to swing-state centrists, or even understanding them. The vortex spins ever faster and risks becoming an ideological black hole.

In 2002, a book was published called "The Emerging Democratic Majority." It argued that Democrats would gain because of their strength in expanding demographics such as Latinos, Asian-Americans and working women. It seemed persuasive until Republicans clobbered Democrats in the next couple of elections.

But perhaps that book was ahead of its time. This was the first election in which Latino voters made up a double-digit share of the electorate, according to CNN exit polls -- 10 percent, doubled from 1996 -- and more than 7 out of 10 Latino voters supported Obama.

That wasn't inevitable. In 2004, exit polls suggested that President George W. Bush received 44 percent of the Latino vote. But Republicans became obstructionist on immigration and then veered into offensive demagogy in opposing the nomination of Sonia Sotomayor to the Supreme Court. The Latino vote tumbled by increasing numbers into the Democrats' laps.

Then there are women. The paternalistic comments about rape by a few male Republican candidates resonated so broadly because they reflected the perception of the GOP as a conclave of out-of-touch men.

As Rep. Todd Akin of Missouri might put it, when a candidate emerges with offensive views about rape, "the female body has ways to try to shut that whole thing down." Namely, they vote Democratic.

America is changing. After this election, a record 20 senators will be women, almost all of them Democrats. Opposition to same-sex marriage used to be a way for Republicans to trumpet their morality; now it's seen as highlighting their bigotry.

An astonishing 45 percent of Obama voters were members of minority groups, according to The New York Times' Nate Silver. Many others were women or young people. That's the future of America, and if the Republican Party remains a purist cohort built around grumpy old white men, it is committing suicide. That's bad not just for conservatives but for our entire country.

Nicholas D. Kristof is a New York Times columnist. Contact him at Facebook.com/Kristof or Twitter.com/NickKristof.