A Philadelphia activist lawyer who represented Black Lives Matter defendants for free is the city's new chief prosecutor. Two Asian-American school board candidates in Edison, NJ won despite an ugly campaign in which voters were warned that "the Chinese and Indians are taking over our town!" A transgender woman in Virginia unseated a self-described "homophobe," while statewide, the Old Dominion elected its first African-American lieutenant governor - despite a white supremacist pushback against the removal of Confederate monuments.

If there was a lesson for Republicans hoping to remain in control of the House and Senate next year, it's that tapping fears about race, immigration, gender and public bathroom access for transgender people may not be a winning message. While Donald Trump won last year in part by pushing such culturally conservative talking points, the tactic failed Tuesday night, across the board.

"From the Erie County School Board to the Seattle mayor's office to the Virginia and New Jersey governors' mansions — voters across the country last night rejected Donald Trump's and Mike Pence's politics of hate and fear," says an ebullient JoDee Winterhof, senior vice president of the Human Rights Campaign, an LGBT rights organization. Erie County, Pa., elected a transgender man while Seattle voted in a lesbian mayor. "This is just the beginning of a wave of momentum that will take us to 2018, 2020 and beyond in the fight for full federal equality," Winterhof says.

Jessica Post, executive director of the Democratic Legislative Campaign Committee, which works to elect Democrats to statehouses, sees good things ahead for her party next year, based on results Tuesday and in earlier special elections. Democrats have flipped 33 state legislative districts from red to blue since Trump's election, while Republicans have taken away just one in contested races, according to Post.

"I think we're seeing trends that look like a brewing wave for Democrats in 2018," Post says. Not only does increased power in state legislatures build a farm team for congressional races, but the grassroots organization for local candidates boosts turnout that could put congressional and U.S. Senate candidates over the top, she says.

The most dramatic wins were in Virginia, where Democrats appeared poised to take control of the state House of Delegates by electing a record number of women to the chamber, including transgender candidate Danica Roem. Despite a fear-stoking campaign about the rise of Hispanic gangs in the state, Virginia also elected its first two Latinas to the House of Delegates. A candidate who fought for tighter gun laws after his TV news reporter fiancee was killed on camera won a delegate seat, beating an NRA-backed candidate.

"In their home state, [the] NRA is now officially toxic," the Coalition to Stop Gun Violence said in a statement, noting that the three statewide Democratic candidates had stood with gun control activists at NRA headquarters in Virginia during the campaign. Exit polls showed that 52 percent of Virginians own guns (and gun owners favored GOP gubernatorial contender Ed Gillespie by 61 percent to 37 percent), but Democratic winner Ralph Northam won no-gun household voters by a 73-26 percent margin.

Elsewhere, the culture wars favored Democrats as well. In Minneapolis, Andrea Jenkins, who is both African-American and transgender, won a city council seat. Women scored victories across the country, with a Washington state legislative win that flipped control of the state senate to Democrats and with city-wide races that elected women mayors for the first time in Manchester, NH and Framingham, Mass. Vi Lyles became Charlotte, N.C.'s first African-American female mayor. Hoboken, N.J. elected its first Sikh mayor.

Democrats were crowing about their victories, which they saw as a repudiation of Trump and a sign of big things to come in the mid-terms. "Hey, Republicans... how is the scapegoating of immigrants working for you tonight? What a mistake! Backfired. Democrats are running the table!" former Obama administration Housing and Urban Development Secretary Julian Castro tweeted gleefully. In another missive, he warned, "Mark my words - [Texas GOP Sen.] Ted Cruz has the jitters right now."

But the rejoicing could be premature. Next year, election metrics will be less favorable for Democrats. They need just three seats to wrest control of the U.S. Senate, for example, but 25 of the 34 seats up for election are held by Democrats, and many are in red states such as Indiana, Missouri, and North Dakota. Democrats would need to hang onto their seats in those states as well as make pickups in Nevada, Arizona and Tennessee, the latter two of which are open seats due to the retirements of sitting GOP lawmakers.

The House is viewed as more volatile that the Senate, but gerrymandering of congressional districts makes it tougher for any challenger to win, unless there is a wave election.

"I think what this year has highlighted across the board is that there is deep polarization in our country," says Amy Walter, an analysts with the nonpartisan Cook Political Report. For example, Northam did very well in urban and suburban areas, but did not make gains in rural areas, she notes.

But what should make Republicans nervous is the enthusiasm gap, Walter says. Democratic performance and turnout was unusually high for an off-year election (downticket Democrats tend to do better in presidential election years). "They basically were hitting 2016 levels in enthusiasm. This is not a midterm performance. This is more like a presidential performance," Walter says. "And that is a big challenge for Republicans going forward."

House Republicans may have that challenge in mind as they consider their own political futures. Two more GP House members announced their retirements this week, before Tuesday night's weak GOP showing. That brings the number of Republican House retirements to 27, compared to 7 for Democrats. And while four of the GOP crew left to join the Trump administration and 11 are seeking other office, every single one of the departing Democrats is running for higher office except one, Massachusetts Rep. Niki Tsongas.