Teams with cadaver dogs began a grim search Thursday for more dead in parts of California wine country devastated by wildfires, resorting in some cases to serial numbers stamped on medical implants to identify remains that turned up in the charred ruins.

Many of the flames still burned out of control in fires that spanned more than 300 square miles (777 square kilometers), an area equivalent to the size of New York City's five boroughs.

Sonoma and Napa counties endured a fourth day of choking smoke while many residents fled to shelters or camped out on beaches to await word on their homes and loved ones.

A forecast for gusty winds and dry air threatened to fan the fires, which claimed their 29th victim and are fast becoming the deadliest and most destructive in California history.

Some of the state's most historic tourist sites, including Sonoma city and Calistoga in Napa Valley, were ghost towns as firefighters tried to stop the advancing infernos.

Calistoga, known for wine tastings and hot springs, was deserted Thursday except for dozens of firefighters staged at street corners as ash rained down on them and a thick haze covered the ground. Mayor Chris Canning warned that fires were drawing closer and all of the city's 5,000 residents needed to heed an evacuation order.

"This is a mandatory evacuation. Your presence in Calistoga is not welcome if you are not a first responder," Canning said during a news briefing, explaining that firefighters needed to focus on the blazes and had no time to save people.

A few residents left behind cookies for fire crews with signs reading, "Please save our home!"

Sonoma County Sheriff Robert Giordano said officials were still investigating hundreds of reports of missing people and that recovery teams would begin conducting "targeted searches" for specific residents at their last known addresses.

"We have found bodies almost completely intact, and we have found bodies that were nothing more than ash and bones," the sheriff said.

Some remains have been identified using medical devices that turned up in the scorched heaps that were once homes. Metal implants, such as artificial hips, have ID numbers that helped identify victims, he said.

Firefighters had reported modest gains, but containment of the flames seemed nowhere in sight.

"We are not out of this emergency. We are not even close to being out of this emergency," Emergency Operations Director Mark Ghilarducci told a news conference.

More than 8,000 firefighters were battling the blazes, and more manpower and equipment was pouring in from across the country and from as far as Australia and Canada, officials said.

Since igniting Sunday in spots across eight counties, the fires have transformed many neighborhoods into wastelands. At least 3,500 homes and businesses have been destroyed and an estimated 25,000 people forced to flee their homes.

The wildfires continued to grow in size. A total count of 22 fires on Wednesday fell to 21 on Thursday because two large fires had merged together, said state Fire Chief Ken Pimlott.

Hundreds of evacuees fled to beaches far to the north of the fires, some sleeping on the sand on the first night of the blazes.

Since then, authorities have brought tents and sleeping bags and opened public buildings and restaurants to house people seeking refuge in the safety and clean air of the coastal community of Bodega Bay.

Local charities and residents went to Costco to buy supplies for the fleeing families. California Highway Patrol Officer Quintin Shawk took relatives and other evacuees into his home and office, as did many others.

"It's like a refugee camp," at his office, Shawn said.

Community members fed breakfast to some 200 people on the beach alone, and Patricia Ginochio, who owns a restaurant, opened the eatery for 300 more to sleep, she said. The evacuees' arrival was heralded by a long line of headlights heading to beaches.

"The kids were scared," Ginochio said, adding that temperatures by the beach dropped dramatically at night. "They were shivering and freezing."

The challenge of fighting the fires has been compounded by a need for more help and growing fatigue of firefighters who have been working for days.

"We have people that have been on that fire for three days who don't want to leave," said Cal Fire's deputy incident commander in Napa, Barry Biermann. "At some point, you hit a road block."

Fire officials are investigating whether downed power lines or other utility failures could have sparked the fires. It's unclear if downed lines and live wires resulted from the fires or started them, said Janet Upton, a spokeswoman for the California Department of Forestry and Fire Protection.