SPOILER ALERT: This interview contains spoilers from Episodes 1 and 2 of “Velma.”

Months ago, fans celebrated the win of Velma Dinkley being written as a lesbian in the Warner Bros. Animation movie “Trick or Treat Scooby-Doo!” For years, there had been discussions among fans about the character’s coded queerness, and creatives like James Gunn and Tony Cervone had spoken up about trying — and failing — to explore that in their “Scooby-Doo” projects. So when the marketing for HBO Max’s adult animated series “Velma” didn’t indicate that the title character might be gay — and even revealed that she had a crush on Fred — there was backlash. If “Scooby-Doo” studio is apparently on board now, why wouldn’t Velma like girls?

The answer is that she does. And so does Daphne. After decades of “friendship” across the plethora of “Scooby-Doo” cartoons, live-action movies and spinoffs, tension breaks and the two kiss at the end of Episode 2.

“The character is so iconic, and there’s been so much speculation about her sexuality,” says Mindy Kaling, who voices Velma and executive produces the series. “I work on a couple other shows about young women, and it just felt like this gift to explore that, knowing that there’s all these expectations for the character. It was one of the reasons why it really felt worthy to do an origin story of her.”

“We faced no resistance. We came in and said, ‘This is what we want to do, and this is how we want to do it,'” creator Charlie Grandy adds. But, he says, in a story about teenagers solving mysteries mid-puberty, there had to be some drama, as well as some discomfort, involved: “How do we get to that answer in a way that is satisfying, and we don’t just have someone say how they’re feeling? It takes some work to get there.”

In this take on Mystery Inc., Velma and Daphne (Constance Wu) are former best friends, having become rivals as Daphne ascended into popularity while Velma was reeling over the disappearance of her mother. The loss is so visceral that Velma begins to have life-threatening hallucinations any time she works too hard on solving a mystery, and in an attempt to snap Velma out of out of one such spell, Daphne wraps her into a kiss. The distraction proves effective. Velma’s demons melt away and the two teens are left holding each other.

“That kiss was going to be something big, so how can it also serve this larger story?” Grandy says of the connection between the kiss and Velma’s hallucinations. And, of course, the two will face roadblocks as the series moves forward — “You don’t want Jim and Pam getting together in the second episode!” Grandy says — but it will never be homophobia that keeps them apart. On the will-they-won’t-they to come, he explains that the priority was “stories where the obstacles in their relationship are their own personal issues. I didn’t really want it to be an external thing of ‘You can’t date each other.’ It’s much more interesting, especially from a comedic standpoint. These are two young, very strong-willed, opinionated, smart characters, and they just keep bumping heads on various issues.”

“We’ve seen a lot of really successful shows where homophobia, or fear of that, has been the reason two characters can’t be together, but I feel like they have a lot of other differences,” Kaling says, expanding on Grandy’s point. “Daphne’s popular. There’s socioeconomic differences between the two of them. There’s a lot of other reasons why it would be challenging for the two of them to be together, and them maturing and realizing what their priorities are is what’s fun about the show.”

Other complications in Velma and Daphne’s love story arise thanks to the men in their lives. Daphne has just broken up with Fred (Glenn Howerton), who Velma is also crushing on, despite that he seems to be guilty of murdering two girls at Crystal Cove High and may also be connected to her mother’s disappearance.

And perhaps the series biggest departure from other “Scooby-Doo” projects is Norville (Sam Richardson), a straight-laced band nerd, the son of a school principal and a school counselor, who will eventually grow up to become the stoner-coded Shaggy. (He’s also hopelessly in love with Velma, who is barely interested in his friendship but welcomes the mystery-solving assistance he offers her.)

“It really started with the idea of it being an origin story,” Grandy says. “You know where we end up, so let’s go as far away from that as possible. How does Norville become Shaggy? That was the story.”

Of course, on the topic of revamping the canon, one of “Velma’s” most obvious changes is that three fourths of the group that becomes Mystery Inc. are now people of color, with their races matching those of the actors playing them. Velma is South Asian, Daphne is East Asian and Norville is Black.

“It started with Mindy saying, ‘I’m voicing Velma; what makes the most sense?'” Grandy says of those choices, which Velma and Daphne offhandedly reference in the pilot with a debate about “race-blind casting.” “What Mindy was attracted to in the character, and what I loved, was that the smartest of the gang that solved the mysteries got no credit. Going from that, why not just expand the diversity of the cast?”

For Kaling, it was a matter of bringing these characters to the 21st century. “The original ‘Scooby-Doo,’ which we’re such a fan of, is also really rooted in another era and reflective of the cultural landscape of the ’60s and the ’70s and what people traditionally put on TV,” she says. “It just felt like, if we can have the characters be anything, why not do something new?”