The “American Idol” producers knew the Season 18 finale, upended by the novel coronavirus pandemic, was going to be a challenge: Not only did it involve the contestants performing from their homes and the entire crew working remotely, but producers also had to coordinate a live announcement of the show’s winner in the final moments of the episode. “That’s going to be interesting,” showrunner Trish Kinane said last month. “Let’s hope the Internet gods are with us.”

The prayers to the Internet gods worked. But the conclusion of Sunday night’s show on ABC still ended in mild chaos with a shocking result, as Samantha Diaz (stage name: Just Sam), a 21-year-old subway singer from Harlem, triumphed over Dibesh Pokharel (stage name: Arthur Gunn), a 22-year-old Nepalese singer-songwriter and the front-runner of the competition.

At first, everything was fairly predictable: Gunn and Just Sam were named in the Top 5, along with piano teacher Jonny West, college student Francisco Martin and construction worker Dillon James. Each finalist performed two songs and viewers voted live for their favorites. Judges Luke Bryan and Katy Perry sang their latest singles, while Cynthia Erivo joined the Top 11 contestants for an Aretha Franklin tribute; Erivo stars as Franklin in the upcoming National Geographic Channel series, “Genius: Aretha.”

Then, with about 12 minutes left, host Ryan Seacrest came back on screen. As he read a plug for the Nat Geo series, his speech briefly became noticeably slower and a bit slurred — unusual for the longtime host who has handled hundreds of live TV moments. His right eye also suddenly looked swollen, which prompted a flood of concerned viewers on social media to ask if he was okay. Representatives for ABC and Fremantle, the production company, did not return a request for comment; Seacrest was also absent from “Live With Kelly and Ryan” on Monday, where Ripa said he had the morning off after a late night working on “Idol."

(Seacrest’s representative released a statement later Monday to People, which read in part: “Ryan did not have any kind of stroke last night. Like many people right now, Ryan is adjusting to the new normal and finding work-home balance, with the added stress of having to put on live shows from home.”)

But in the moment, Seacrest continued: “We have the final two results. Who will be your next American Idol? Normally I’d say ‘Dim the lights, here we go,’ but … we can’t,” he said, smiling as he looked around his room.

He first announced Gunn as one of the finalists, and the sound on the broadcast immediately went out. It returned as cameras showed Gunn’s family at their house in Wichita screaming and jumping up and down and celebrating so excitedly that it seemed like they thought he won. Someone also shot off a confetti cannon, which producers had sent each contestant in case they were crowned the champion. “Arthur! Arthur! Arthur! Arthur!” Seacrest called out, trying to get his attention, which did not work.

Seacrest moved on to the next finalist: Just Sam, who looked the most stunned of anyone. The young singer was by herself in Los Angeles — when “Idol” filming shut down in March, she couldn’t travel back to Harlem because she lives with her grandmother and didn’t want to risk getting her sick. Just Sam had to absorb the news alone, as judge Lionel Richie’s jaw literally dropped and the other judges applauded.

“We say goodbye to Francisco, Dillon and J.W. Guys, thank you so much for a great season, we’re gonna miss you. Well done,” Seacrest said, leading to an awkward silence as he watched the TV screen with the other three finalists waving farewell.

All signs pointed to Gunn as the winner — particularly with the elimination of West, who had picked up serious momentum in the final episodes, and Martin, whom Bryan confidently predicted as the winner as far back as his first audition. While the judges adored Just Sam, referring to her as “our little girl” and complimenting her vocal skills (“You’re never going to go back to singing on the subway unless you want to go and just, like, do it for fun,” Perry told her), they especially heaped praise on Gunn.

“Way to nail every aspect of ‘Idol.’ You have checked every ‘American Idol’ box that you need to check in my opinion. I mean, you’re a star,” Bryan gushed, continuing the show’s fixation on Gunn moving from Nepal to America to pursue his singing dreams. “If there are any more like you in Kathmandu, please get on the phone and call them and tell them to come out next year.”

And then, Seacrest announced the winner: “The next American Idol for 2020 is: Just Sam!”

The classic “Idol” theme music kicked in as Just Sam once again looked absolutely floored. “WHAT?!” she screamed over and over, as she clutched an iPad that showed video of her grandmother, who was also screaming. This was contrasted with the sweet yet slightly confusing scene of Gunn’s family, still dancing and holding up champagne bottles as if he had been named the victor.

Just Sam continued to hold the iPad and shook her head in disbelief, and the audio went out once more. It kicked back in as she was still in shock: “Oh, my God. Oh, my God,” she repeated. “Sam, is your grandma there?” Seacrest asked, but her grandmother was too excited to speak. This led to brief shots of the judges, which showed Richie giving a standing ovation; Perry laughing while starting to disconnect her microphone pack; and Bryan slowly clapping while looking off-screen.

“Can I thank America now?” Just Sam asked as the camera turned back to her and Seacrest.

She was at a loss for words as she tried to process her victory. During the season, she talked about growing up in the projects and how her grandmother didn’t “believe that people like us can have our dreams come true.” And now, they had: “Thank you so much, America, I would have never, ever, ever expected this,” she said. “Thank you, thank you, thank you for voting.”

“Sam, congratulations,” Seacrest said. Her celebration abruptly ended, as it was time to move on to Richie’s special performance of “We Are the World.”

Read more: