There is much to love in Her, and there is a little bit to be hugely frustrated by, though on the whole the concept and world-building is beguiling enough that getting through the rough patches en route to the terrific stuff is no real chore. But there is a flaw so obvious and basic that I'm puzzled nobody seems to have brought it up yet, which is that the film ends three times. That is to say, three times the editing and the blocking are cue us for a cut to black as the lovely Arcade Fire score plays out in its tentative, romantic, melancholy way. And twice, more movie happens - which is good the first time, since it would have left a dismally unfulfilled movie in its wake. But still, maybe don't structure a scene that way if there's 40 minutes of movie left. The second time, though is a different story, because that's when the film enters its last phase, and the last phase of the movie is really darn ill-advised.

Basically, Her is a fable, of life and relationships in a heavily computerised world. Sometime in the future in Los Angeles, Theodore Twombly (Joaquin Phoenix), in the last stages of a divorce, invests in one of the new OS1 programs that use the world's first artificially intelligent operating system. The AI that is installed on his home computer, a female voice naming itself Samantha (Scarlett Johansson), begins to evolve and learn, just the way it's supposed to, and then to develop a personality and will, just the way it's supposed to, and then it - she - Her - and Theodore fall in love.

In case you missed the bit where this is a metaphor for the detached, dehumanised relationships that people form over things like social media, where people strike up real, deep, meaningful connections with people they only know as a voice or even just text, Theodore's job is writing richly emotional letters for people too busy to do it themselves. He's too brittle to feel his own feelings, but he's the best in the business at faking other people's feelings, so they don't have to feel them. Do you get it? Her will take its time establishing and lingering over this in case you don't get it.

In the grand tradition of sci-fi, Her is clearly about the time it was made, not the time it takes place, and the fact that so damn much of the film can be so gallingly contrived if you take it seriously - the handwritten note website is probably the most clear-cut "love it or hate it" point on this front - only further encourages us to think of it as a feature-length metaphor. And then along comes the final 20 minutes, making it all literal. Good breeding forbids me from revealing the details of what happens, but suffice it to say that, having spent the opening act of the film wondering all sorts of practical questions about what life in a world with intelligent operating systems in every home would look like, and then having concluded that since the film is working at a more abstracted, fabulistic level, it doesn't need that kind of sustained story logic, it's shocking and upsetting when, in the final lap, the film decides that, what the hell, it's going to go right ahead and explore the very plausible and realistic ramifications of a scenario which has actively and purposefully shunned plausibility and realism. Inevitably, this involves some conclusions that really don't feel like they follow naturally, and the final moments try, hard, to shift back to symbolism in a way that the film can't, at that point, earn back.

Thankfully, outside of this (to my mind) wholly unacceptable finale, Her mostly hits the most exquisite sweet spot between exploring its concept and using its concept for emotional resonance. Spike Jonze - earning his first writing credit for a film he also directed - has found a way to rejuvenate the miserably overworked post-divorce love romantic dramedy by abstracting it, and by explicitly making it about very modern ways of being in love instead of aiming for something universal and timeless. The results feel fresher than they perhaps are: if Samantha was a human woman from a different class or race, and the film took place in a real time period, Her would require very little re-writing, and would undoubtedly feel like a boring parade of trite observations. It's exactly because of the "weirding" that happens with the very visually precise and gratifyingly low-fuss vision of the near future that the film is able to make these well-worn tropes seem bright and new, and to tap into emotional currents that a more traditional setting would have to sacrifice due to overfamiliarity.

And it is an immensely well-built world at that, with Jonze, costume designer Casey Storm, and production designer K.K. Barrett attempting, not to wow us in the fashion of so many cinematic futurists, but to inveigle us with a world that very deliberately, effectively, and elegantly seeks to depict a wholly reasonable extension of the way things are right now. The onscreen interface of the OS1 is precisely what we've been heading towards ever since tablets became a thing; the physical world is sleek and clean, trimmed in soft primary colors, perfectly evoking a society that has grown so invested in shiny computers of the post-Apple era that it's not comfortable with square lines and grottiness. The unifying pinkness of everything, particularly the clothing, suggests a friendly but also slightly infantilised world.

And against this cheery but somewhat drab and uniform setting, the human element plays out sharply and with tremendously rich acting. Phoenix is a miracle, evolving the foggy disarticulation of The Master into something that's more immediate and humane, but every bit as internally confused and blank; I'd certainly call it the best performance of his career, and at any rate it's almost objectively the most appealing and recognisable. Johansson's warm, comforting voice work is awfully good, but to my mind the most striking woman in the cast is Amy Adams as Theodore's friend Amy, probably the most lived-in, relaxed performance she's ever given, one of the many dour women in Spike Jonze pictures, but the first one for whom her dourness is a real plus, giving her depth and truth and a range of everyday feelings to draw from (and actually, my favorite supporting character is a peevish video game avatar played by Jonze himself, but that's just some good, high-spirited comic relief).

This is every kind of clichΓ©, but Her is such a rich, warm story about people, it hurts. There's a whole lot of shagginess, of the sort that will happen when a director is too invested and fond of his characters to cut random moments of them just inhabiting their world. It also boasts a fairly musty and ancient message (it's hard to trust people after you've had love ripped away, but it's even harder to keep yourself locked away from feeling messy, uncontrollable human emotions), though it's the kind of ancient message that has lasted through as many iterations as it has because it's so worthwhile. Her is baggy and imbalanced and it does, absolutely, tap into the genial quirkiness that makes Jonze and his whole breed of lilting indie artistry such a hard sell for many people - it's "twee", there, I said it, though the only place the tweeness bothered me was a cutesy-pie Karen O song. Anyway, twee or not, Her is a hugely pleasant and intimate showcase for human feelings, expressed by wonderful actors in a vivid setting, and the fuzziness that creeps in throughout is, for the most part, inseparable from the clarity and accuracy of the very best parts.