You have lipstick on your collar -- or is that blood?

For the first few minutes of Shane Black’s “Kiss Kiss Bang Bang,” the film’s prospects hang tediously over the precipice of wonky self-reflexivity by a thread. Robert Downey Jr.’s Harry Lockhart, acting as our guide and narrator, repeatedly makes it known that we are watching a movie, he’s our narrator, and he’s off to a bad start telling his story.

This is dangerous, “Adaptation” territory. A movie beginning like this could be a portent of bad things to come. After all, how in-your-face will this narration be? And how often will some reference to movies and watching them be made?

Thankfully, all trepidations are assuaged when the film kicks into its cruising speed, that of a clever updating/throwback to the detective stories ofChandler, Hammett, and Spillane. In fact,Downey’s Lockhart could easily pass for a modern day Philip Marlowe.

But, first, Lockhart is playing William Holden playing Joe Gillis in “Sunset Blvd.”

Standing at a pool, illuminated green from under the water and coated with an ethereal vapor, Lockhart, a New York transplant/thief thought to be a Method actor when he stumbles into a screen-test for a cop movie while running from the police, is being a bit anti-social at a posh Hollywood party, talking to the audience about how he got to this gathering, who is at the party, and how this is the set-up for things to come. He’s not floating lifeless in the pool the way Gillis is in “Sunset Blvd.,” but he’s just as dead inside around this group of phony starlets, producers, and other movie-types. One of the best jokes in “Kiss Kiss Bang Bang” is uttered during this scene. Lockhart, deflecting the attentions of a blonde airhead, responds to her asking what he does by quipping, “I’m retired. When I was a kid I invented dice.”

As the opening progresses, in grand detective fiction fashion, we meet the detective, “Gay” Perry (Val Kilmer), the girl, Harmony (Michelle Monaghan), and the supporting cast (Larry Miller as the producer that discovers Lockhart and Corbin Bernsen as the old movie tycoon with questionable motives are chief among them), and we get their backstories. The way Black orchestrates all this without getting in over his head and never losing focus would makeChandlerproud.

The film then proceeds on its course, a mystery revolving around a murder, the body that keeps reappearing, the crooks out to kill poor Harry and his reluctant friend Gay Perry, fathers, daughters, molestation, the fantasy of Hollywood, the lust for power and money, and all the mystery standards: romance, intrigue, twists, turns, red herrings, grammar humor, and severed digits. Of course, to reveal any plot points would be a major spoiler since everything is important in the film. But this much can be said for it — it’s one of the most enjoyable films to come to theaters in a long time.

The way Black unfurls his story is part of the film’s charm. “Kiss Kiss Bang Bang” can be a bit daunting and muddied; at times Black seems more concerned with giving his characters punchy, witty things to say and, in the process, loses control of the wily threads of the film. But he never lets them go entirely, and thankfully is able to pull everything together at the end. There are slight allusions toChandler, Hammett, and Spillane throughout the film. The inter-titles, for instance, are allChandlernovel titles.

Downey, similarly, playing Lockhart could easily step into Eliot Gould’s shoes in “The Long Goodbye” without missing a beat. Like Marlowe, Lockhart’s a reluctant hero, although he does dive headfirst into the mystery that quickly engulfs Harry and Perry. But unlike Marlowe, Lockhart isn’t a private eye by trade. This doesn’t stop him from having an antagonistic relationship with authorities and criminals alike, and when Lockhart is finally forced to use a gun, the anguish and disgust he feels about using the weapon — and his anger towards those who forced him to violence — is palpable. Compare this scene with the conclusion of “The Long Goodbye” and you’ll find more than a couple parallels.

The biggest similarity, though, is that, like Gould in “The Long Goodbye,”Downeydelivers one of his best performances here, and it’s nice to see him in a role that allows him to play to his range. He’s not handcuffed by the film belonging to one genre or another, and as a result gives depth and gravity to Harry Lockhart, a character that could easily have become a parody of the detective characters he’s meant to emulate. (For a nice companion piece to “Kiss Kiss Bang Bang,” go rent the little-seen “The Singing Detective.” In it,Downeyplays a writer horribly scarred that retreats into his pulp detective fiction for solace and comfort. It’s an amazing film, and it was criminal how it was ignored upon its release a couple years ago.)

“Kiss Kiss Bang Bang” is not just a film for mystery aficionados; there is enough comedy, both straight and black, drama, and action to satisfy every taste. The film has a lot of buzz behind it since its premiere on the festival circuit. Luckily, it ably lives up to it with a deft plot, wry sense of humor, excellent performances, and smart direction. If you’ll excuse the Gene Shalit-ism, don’t “Kiss Kiss” off this film, it’ll deliver a lot of “Bang Bang” for your buck.