The best high school films make you remember what it was like to be there, how every aspect of your teenage life seemed like a matter of life or death. “Brick” achieves this by transplanting the world of film noir detective stories to a modern high school, making the life-or-death struggles literal rather than figurative. These kids take everything so seriously, but that’s because it IS serious.

Paradoxically, the effect of all this seriousness is that we are amused, and writer/director Rian Johnson works this to his advantage. Bringing “Maltese Falcon” dialogue into a high school setting is inherently funny — not always in the laugh-out-loud sense, but consistently in the this-dialogue-is-interesting-to-listen-to sense. Seeing how the archetypes translate is eye-opening, too. We have a reluctant anti-hero, informants, femmes fatale, ’30s slang and plenty of shady characters, all to be found in the microcosm of high school — and you know what? It’s not much of a stretch. Think about it: What’s more shady than dealing drugs? And what better place to find a drug-dealer than an American high school?

Brendan (Joseph Gordon-Levitt) is an outsider at his Southern California school, not because he lacks good looks or athletic ability, but because he has chosen to remain aloof. He is forced into action when he receives a panicky phone call from his ex-girlfriend Emily (Emilie DeRavin) and subsequently finds her dead in an irrigation canal. The mystery of her death unfolds as a complicated, twisty story that involves the school’s toughest thugs and their hired goons, and Brendan trudges from one thorny situation to another in his quest for the truth. In the grand tradition of these films, we are in the dark, too, learning the truth only as quickly as he does.

The femme fatale comes in the form of Kara (Meagan Good), a drama queen who in this case actually IS a drama student. She points Brendan toward a party being held by the wealthy Laura (Nora Zehetner), and the clues begin to emerge from there, ultimately leading to The Pin (Lukas Haas), the school’s central crime figure.

Johnson’s smartest move is that the kids don’t seem to “know” that they’re in a Dashiell Hammett-style detective story. They’re not talking this way on purpose; it’s just how they talk. There is no winking self-awareness, and so the gimmick feels entirely natural after a while. And it’s not just the kids who live in this world, but the entire school, adults included. (The vice principal fills the role of the police chief, who lets the private dick work outside the law as long as he gets results.) The one adult we see who is not part of it is the mother of one character, who interrupts a tense discussion of gang warfare and murder to ask if anyone wants milk and cookies. That is the film’s sole acknowledgment that this is all just a gimmick — not to the characters, of course, but to us.

The young actors, many of them with very brief film resumes, generally do a fine job carrying out Johnson’s vision, though there are a few for whom it seems to have gone over their heads. The underrated and underused Joseph Gordon-Levitt, however, is among those who get it exactly right, playing the cynical, world-weary outsider so that he is both a tribute to the Humphrey Bogart prototype and a modern improvement on it. He has real emotions, for one thing, which detective Sam Spade never did. His disconsolate mood over Emily’s death, matched by the film’s frequently overcast skies and gray scenery, is palpable.

Johnson has not just set out to re-create the 1940s film noir, though. In fact, the movie most commonly referenced here is “Chinatown,” the Jack Nicholson film that, while certainly noirish, was shot in color and released in 1974. “Brick” is in color, too, and while it maintains the old-school style of profanity-free dialogue, it does feature one instance of violence that is far more graphic than anything Bogart ever starred in — a reminder, maybe, that the real world is more startling than the romanticized movie versions of murder and intrigue would suggest.

B (1 hr., 59 min.; R, brief strong violence, mild adult themes, a lot of fistfights.)