After the success of “Juno,” Diablo Cody suffered from the sophomore jinx with her second script “Jennifer’s Body,” an attempted send-up of the teen horror genre that didn’t manage to transcend its target. But she recovers splendidly with “Young Adult,” a bracing comedy-drama that’s a sharp gender-bending dissection of the Peter Pan syndrome. And she’s fortunate that the director who’s chosen to take on the execution is Jason Reitman, her partner on “Juno.” who brings the same refusal to sugarcoat this material that he did to “Up in the Air.”

And both are lucky to have Charlize Theron headline the movie as Mavis Gary, a bitter, alcohol-soaked ghost-writer for a failing series of “young adult” books who’s moved by the announcement that her old high-school boyfriend Buddy (Patrick Wilson) has been visited with a blessed event to decamp her Minneapolis digs for her home town of Mercury, Minnesota. Her purpose? To renew her relationship with Buddy, which of course means stealing him from his wife and child.

It’s clear from the get-go that Mavis is an intensely unhappy person who fantasizes about her school days as a lost paradise. She’s the very model of arrested development, the prom queen and all-around mean girl who hasn’t really moved on though everyone else has. And she’ll have a rude awakening in Mercury, when she finds that Buddy is more than content with what life has meted out to him and finds her proposal that he ditch his family ridiculous and appalling. The only person who understands her is another, though better adjusted, misfit—Matt Freehauf (Patton Oswalt), an outcast classmate who still suffers a limp from a beating by thugs who thought he was gay. He and Mavis actually strike up an unlikely friendship, and he advises her that her attempt to turn back the clock is wacky. But she careens on anyway, until her crazy dream implodes in a very public breakdown.

There are plenty of moments of dark humor in “Young Adult,” but they go hand-in-hand with others that are sharply dramatic, and an aura of tragedy suffuses the film to the very last scene, which thwarts conventional happy-ending expectations. The picture offers an portrait of a young woman who can’t overcome adolescence despite the advancing years, with self-destructive results—and one that’s drawn in pungent strokes by Cody and presented uncompromisingly by Reitman and Theron. Wilson makes an agreeably befuddled object of Mavis’ desire, and the rest of the supporting cast—Elizabeth Reaser as his wife, Collette Wolfe as Matt’s sister Sandra (who pines for the “freedom” Mavis represents for her), Jill Eikenberry and Richard Bekins as Mavis’ down-to-earth parents—fit perfectly into the picture’s portrait of pallid small-town mid-America, captured without italics in Kevin Thompson’s production design, Michael Ahern’s art direction, Carrie Stewart’s set decoration, David Robinson’s costumes and Eric Steelberg’s cinematography.

But it’s Theron and Oswalt who are the film’s soul. She gives a ferocious, fearless performance, never softening Mavis’ cruelty and utter self-centeredness. And he complements her beautifully with a turn that makes Matt seem wise despite his nerdiness, and poignantly resigned to the circumstances life has dealt him—something Mavis resists to the bitter end.

“Young Adult” is a peculiar holiday release, and many viewers will be nonplussed to find that the bright comedy they anticipate is instead a very dark one. But at a time when society seems to encourage people to remain men-and-women-children indefinitely, it’s a salutary reminder of how pathetic that condition really is.