In the vast and lucrative business of superhero movies, Marvel still reigns supreme. With “Wonder Woman,”Aquaman” and now “Shazam,” though, DC is finally hitting the mark with stories that lean in the direction of emboldening, empowering and uplifting, a contrast to too many past projects. In the case of “Shazam,” directed by “Lights Out” helmer David F. Sandberg with a screenplay by Henry Gayden, the filmmakers manage to meld age-changing “Big” hijinks with a sugary sweet heart and stellar lead performances to create something that almost puts it in the category of top-tier superhero fare.

Following Billy Batson (Asher Angel) through his latest stint in a foster home, the film kicks into high gear the moment he comes across The Wizard Shazam (Djimon Hounsou), who has been trying to find his successor to stop the Seven Deadly Sins that have been released on the world with the help of human vessel Dr. Sivana (Mark Strong). With the help of his new friend Freddy (Jack Dylan Grazer) and buff, cape-adorned alter ego Shazam (Zachary Levi), Billy must put a stop to the latest take on the super villain attempting to corrupt the world. A deep sense of lunacy is built into the core of the origin story, but it is balanced by the gravitas of familial relationships; Billy is having a blast discovering his new powers, yes, but he’s also working through the trauma of perpetual displacement as he learns to trust his newest guardians and family members.

The film doesn’t push boundaries so much as nudge at the margins of the now traditional superhero mold. “Shazam,” like it’s leading hero, wants to be stronger, bigger and braver than it actually is, but unlike 14-year-old Billy  it can’t quite take that last heroic step into allowing the freefall of the unknown to be part of the fun. The convention remains, despite a story that’s less interested in being a typical hero origin story than it is in probing the consequences of handing over superpowers to a teenager, as well as the effects of denying that same gift to another teen in their formative years by declaring them “unworthy.” The powers, ranging from from flight and super speed to lightning that shoots from our hero’s fingertips, are on full display, but the film isn’t so much about power as it is about those who use it, why they do so and their willingness to put oneself naively on the line for loved ones. That chaotic, childlike enthusiasm for telling a story with real lessons on responsibility and maturity allows for the familiarity of the villain’s trajectory and some awkward action sequences and weak fight choreography to be less of a deterrent than they would be in a film with less investment in its emotional core.

For all of the cotton candy magnetism of the picture – from the vibrant colors to the exploration of what it means to be a hero without the trauma that seems a prerequisite for most DC heroes – the story is never glib. These characters are still dealing with the fallout of abandonment and stigmas that cling to them from forces outside their control, and the film really drives home the theme of nature vs. nurture, giving the villain’s story enough shading to be a good counterpoint to Billy’s. The kid isn’t necessarily pure of heart, but he has the potential to get there despite a world that might’ve crushed the hope or empathy out of him. He wants to goof off, sneakily drink beer and run away momentarily when faced with actual danger – as any 14-year-old would – but in the end he also wants to share power, be good to his found family and protect innocent lives with his gifts. There’s a Dr. Thaddeus who was also just a bespectacled tween when coming across the The Wizard Shazam, but compelled and corrupted to darkness. He grew up being picked up on his father and brother, while Billy grew up in foster care, looking desperately for a mother who didn’t seem intent on finding him. They both had other paths to take.

It’s a poignant touchstone on the family that you make, and what allows “Shazam” to elevate beyond its sometimes rudimentary humor (resulting in one too many gags about our characters gaining entry to a strip club). When it works, the humor is a highlight, with Levi embodying the awkwardness and ill-suited confidence of a teenager as he gamely struts, dances and hams it up for the camera, and he and Grazer make for a spectacular comedy duo. Unfortunately, Levi often comes across too strong, trying to play what he thinks a 14-year-old should be while Angel, an actual teen, simply embodies it. The dissonance between the versions of the character is jarring; what helps is the idea that perhaps Levi was aiming for the cartoonish take on being a teenager to help match the ridiculously overdrawn biceps and garish coloring of his suit – to be the type of superhero a 14-year-old would necessarily be, but dreamt up.

Grazer, as he was in “It” (2017),  is the standout, with a natural, mischievous snarl adorning his face and a high kilter energy that makes him both the heart of the film and its comedic center. The cast as a whole shares palpable chemistry and, if there is to be a sequel, it will be fun to see where they take these characters next.

For all that is does well – and it’s quite a bit – “Shazam” never quite lives up to its best moments; in pieces a delight, it needs a greater sense of coherence. Regardless, it’s a welcome reprieve from the dreariness superhero films can bring, and what it lacks in consistency it more than makes up for in the final, emotional wallops.