The rain came down in torrents and the wind blew Sunday night at Levi’s Stadium. The Indianapolis Colts and the San Francisco 49ers had the unenviable task of trying to play a football game amid talk about an “atmospheric river” and a “bomb cyclone.”

The results were predictably perilous and appropriately sloppy. There were turnovers. There were dropped passes. There was a 79-yard punt by the Colts when 49ers returner Brandon Aiyuk muffed the rain-soaked football, then kicked it inadvertently backward into his own end zone for a fortuitous touchback. Referee Craig Wrolstad’s microphone malfunctioned during the second half.

The Colts didn’t win as much as they persevered and survived. They beat the 49ers, 30-18, in the trying and ever-soggier conditions in Santa Clara, Calif.

“It’s tough playing in that weather to begin with, just the mental toughness you have to have,” Niners quarterback Jimmy Garoppolo said. “But then when things are going wrong like that, it makes for a tough night. So it was very frustrating. But we’re going to stick together.”

The season is coming undone for the 49ers, with four straight losses following a 2-0 start.

“They did better in the rain,” Coach Kyle Shanahan said. “There’s not one answer for that. . . . They obviously handled the conditions better.”

Quarterback Carson Wentz threw two touchdown passes and had a touchdown run as the Colts improved to 3-4 with their second straight victory. Tailback Jonathan Taylor ran for 107 yards and a touchdown.

“It was a little different,” Wentz told NBC afterward. “Beautiful night here in the Bay. Let’s say that. I thought that’s what California had to offer was beautiful weather.”

Wentz managed a modest 150 passing yards, and he and Taylor lost fumbles. But that was good enough under the unusual circumstances.

“It was a big one for us,” Wentz said. “Guys were making plays. … It was huge for us to finish the way we did and come out victorious.”

The 49ers had four turnovers. Garoppolo, in his return to the lineup after missing one game with a calf injury, lost a fumble and threw two late interceptions. Wide receiver Deebo Samuel also lost a fumble.

“The weather played a little bit of a role,” Garoppolo said in his postgame news conference. “It started to pick up there a little bit. But we just didn’t execute. There [were] too many mistakes stacked up on top of each other. … You can’t do that and win football games consistently.”

Garoppolo threw for 181 yards and a touchdown, and rookie running back Elijah Mitchell ran for 107 yards and a touchdown. But the 49ers were outscored 30-9 after taking an early 9-0 lead.

“It’s tough,” Garoppolo said. “It’s very tough, especially how the losses have come. We got off to a good start tonight. We didn’t sustain it, though.”

The 49ers hurt themselves with pass interference penalties on defense and stumbled their way through the night on offense. Shanahan made an ill-advised instant replay challenge — wasting a timeout in the process — through a communication snafu when his headset failed, he said.

“Pretty down in there [in the locker room] right now, I mean, losing four games in a row,” Shanahan said during his postgame news conference. “It’s been a month, and that’s tough. … I told the guys we’ve got to be tough-minded. We’ve got to stick together. I think we’ve got guys with high character in there. I think we’ve got good enough football players. We’ve got to handle whatever we’re going to get and we’ve got to come back and play better versus Chicago.”

Shanahan said he accepts any criticism of him.

“Yeah,” he said, “you lose four games in a row — I’m the head coach of this team. I expect it and I deserve it.”

Rookie quarterback Trey Lance, chosen third overall in the NFL draft in April, was unavailable Sunday night. He suffered a knee injury in his first NFL start, a defeat at Arizona before the Niners’ bye week during which Garoppolo was sidelined.

“I’ve got a whole team to worry about,” Shanahan said. “I’m not just thinking about the quarterback situation right now. I have to evaluate everything, see where our team’s at, see what gives us the best chance to beat Chicago and see what our options are. … We had two quarterbacks who were hurting this week. … I’ve got a lot of things to figure out.”

The 49ers, with Garoppolo at quarterback, reached the Super Bowl after the 2019 season but have gone 8-14 since.

“The NFL is a crazy thing,” Garoppolo said. “One week, you’re on top. And one week, you’re at the bottom of it. It’s just every team has their ups and downs. We’re at a lower end… right now. But we can fight back.”

Continue reading for more game updates: