American Idol aired the final episode of Hollywood Week on Monday night (March 23), and contestants took the stage to perform solo songs. One contestant, Makayla Brownlee, delivered a rendition of Kacey Musgraves' "Rainbow," and an unexpected medical emergency interrupted her performance. However, as the song's lyrics say, "It'll all be alright."

"I chose this song because no matter what happens, there's always gonna be that 'Rainbow,'" Brownlee said with a smile as she stepped up for her turn at the mic.

But as the band began to play the opening chords to the song, the contestant's anxiety levels visibly started to rise, and she soon rushed off the stage. The camera caught glimpses of Brownlee lying on her back backstage, her legs elevated, as a crowd of people gathered around her and someone said she was having a seizure.

The judges -- Luke Bryan, Lionel Richie and Katy Perry -- were clearly alarmed, and Bryan rushed backstage to check on the young singer, with Richie following suit. "You okay, baby?" Bryan said, as the footage cut to a clip of an ambulance's arrival.

Meanwhile, Brownlee's father, Mark, was on hand to help -- and his response was much calmer. "Makayla has a condition that's pretty rare," he explained. "... She's embarrassed, but physically, she's 100-percent alright. This opportunity is so important to her. I'd hate to see it in any way inhibited, because she's such a good singer. She works so hard at it."

"In seventh grade, I was diagnosed with vasovagal syncope. It's a heart condition that causes me to react to stress differently than other people, and it can cause a seizure," the singer explained in a voiceover.

After recovering and being checked out by a doctor, Brownlee returned to the Idol stage, receiving a standing ovation from the judges. Perry winked at her in encouragement as she launched once again into "Rainbow," this time delivering a pitch-perfect and faithful interpretation of Musgraves' placid, comforting ballad.

"The stress this week has definitely been a lot harder on me than anything that I've ever gone through," Brownlee reflected after her performance. "There's nothing I can do to prevent a seizure. When I'm stressed out, my body just reacts differently. It's tough, but I made it this far."

The judges were clearly moved by the experience, too: Perry was misty-eyed throughout the performance, and broke down in tears after Brownlee left the stage. "Oh my God. Perspective, right?" she said to Richie and Bryan.

Ultimately, Brownlee triumphed over her condition this week on Idol: Not only did she deliver a stellar performance, but she made it to the next phase of the singing competition, which will take place in Hawaii.

Elsewhere in the solo performances round, the country-leaning contestants opted for earthier selections and relative deep cuts. "Spiritual cowboy" Dillon James performed an Americana-inflected original, and contestant Lauren Spencer-Smith delivered a performance of Brandi Carlile's "The Joke." Devon Alexander dipped into Patty Griffin's catalogue with a rendition of "Up to the Mountain," and Jovin Webb took on Chris Stapleton's "Parachute."

At the end of the episode, the contestant pool was narrowed down to the Top 40. Zack Dobbins, the West Virginia native who turned heads earlier in March when he drove his muddy 1993 Ford F-150 to his audition, was eliminated on Sunday night (March 22) after the duets round of Hollywood Week.

American Idol's final pre-taped episodes, a Hawaii-based showcase, will air on March 29 and 30 on ABC. The TV singing competition has shut down production due to the COVID-19 coronavirus pandemic, so the fate of its live shows has yet to be determined.

Luke Bryan's "Focus Face" Is Scaring American Idol Contestants

These Country Stars Were Rejected by American Idol: