The life of Riley… Joy and Sadness (voiced by Amy Poehler and Phyllis Smith) navigate through Imagination in Inside Out. Photograph: Courtesy Ev/REX Shutterstock

The new Pixar animation Inside Out could easily have been called Out There. It’s as bizarre, imaginative and authentically psychedelic as anything produced in mainstream animation. At this point in the fortunes of the once-infallible creative powerhouse, you wouldn’t have bet on Pixar coming up with anything very outré. Bought by Disney in 2006, the studio hadn’t produced anything truly inspired that wasn’t a sequel since Up in 2009. Given the humdrum quality of Cars 2 and Monsters University and 2012’s well-intentioned but forgettable Brave, it seemed as if the studio had lost its penchant for exotic risk.

But Inside Out is in the top rank of Pixar productions with its combination of audacity, intelligence, wit and emotional reward. Directed and co-written by Pete Docter (Monsters, Inc and Up) and co-directed by Ronnie del Carmen, Inside Out starts from a boldly abstract premise: the narrative plays out within the psyche of a girl named Riley (voiced by Kaitlyn Dias) and the film’s characters are her feelings.

At the start, one of those feelings, Joy (Amy Poehler), asks: “Do you ever look at someone and wonder what is going on inside their head?” The next questions that arise are: what might such psychic events actually look like? And how might they generate a story that can be sustained for 102 minutes? Inside Out meets these challenges with an inventiveness that’s appropriately mind-boggling.

Formidably ingenious, Inside Out hits an elusive sweet spot in appealing to children and adults alike

The film starts in a dark cavern, the Plato’s cave of the unformed self. As baby Riley is born, Joy spontaneously appears – a shimmering, big-eyed Tinkerbell-like pixie – and observes Riley’s view of the world on a glowing, cloud-like surveillance screen. Joy is soon joined by other emotions – Sadness, Fear, Disgust and Anger, the latter characterised as a squat red sponge that bursts into flame when provoked. These five monitor Riley’s life and produce her responses by operating a console of levers and buttons, something between the USS Enterprise and PlayStation 4. Inside Out explores much the same premise – little people busy working in your head – as the Beano’s Numskulls strip, but it’s infinitely more sophisticated and distinctively female-skewed. The film’s real heroine is Joy, a pathologically upbeat micro-manager convinced that only positive feelings count – and Amy Poehler instils Joy with something of the obsessive girl guide eagerness of her Leslie Knope in the TV sitcom Parks and Recreation.

Then crisis comes as Riley, now 11, moves with her parents (Diane Lane, Kyle MacLachlan) from Minnesota to scary San Francisco, where a new school fills her with anguish and where, worst of all, pizzas come topped with broccoli. The ensuing narrative is set in the far reaches of Riley’s psychic landscape – and it is a landscape. Her trauma triggers the seismic collapse of the “personality islands” – literally, floating landmasses – that define who she is, devoted to such themes as family, friendship and hockey.

A control-room malfunction leaves Joy and Sadness wandering in a vast allegorical geography that includes such landmarks as imagination (a theme park) and the place where dreams are made: a movie studio, of course, where productions range from I’m Falling Down a Very Deep Pit to Fairy Dream Adventure Part 7. In the film’s wildest moment, the wanderers enter a zone of abstract thought, where they are zapped into a series of increasingly simplified geometric shapes, as they – and the film itself – dizzyingly self-deconstruct (“Oh no, we’re non-figurative!”).

Formidably ingenious, Inside Out hits an elusive sweet spot in terms of appealing to children and adults alike. It makes extraordinary use of knowing cuteness, for example. Take Bing Bong, Riley’s long-lost imaginary friend from early childhood, a cat-elephant hybrid made out of candyfloss. Here, the film seems to stray perilously into Jar Jar Binks territory – but while smaller children will warm to Bing Bong as a cuddly oddity, adults and older kids will see something quite troubling in a figure that’s manifestly a primitive creation of the infant mind, poignantly fated to extinction.

It’s in the way that the story depicts the fading of childhood’s mental furniture, and explores the mechanics of forgetting, that Inside Out achieves a universal significance. While specialists may bemoan the simplicity of the film’s mental model, inspired by the “psychoevolutionary” theory of Robert Plutchik, the eventual message – that sorrow is as valuable an emotion as happiness – is delivered with less piety than you might imagine.

As for the visual style, it’s dazzling, flouting CGI’s tendency to photorealism in favour of overt cartoonishness in a 1950s retro vein, together with a refined exploration of light: the emotions are composed of fibrous bundles of luminescence. The running gags are delicious (don’t miss the end credits), and in the best Pixar fashion, Inside Out expertly but uncynically tugs the heartstrings – and indeed, the film’s theme overtly shows you how it’s done. Don’t be afraid to come out of Inside Out wiping a tear from your eye: you can always say: “It was the little people in my head that did it.”