Even in Will Smith’s most stressful onscreen moments, he’s chillin’ out, maxin’, relaxin’, all cool — there was a reason he once went by carefree nicknames like Fresh Prince and Big Willie Style.

But none of Smith’s characters ever really has bumped up against time, money, opportunity and goodwill — overwhelming enemies only when they’re nowhere to be found.

In The Pursuit of Happyness, Smith still projects the path of a sturdy, steady guy, but there is a frantic erosion of confidence in Chris Gardner — a grizzled, gray, desperate and frail man who, at one point, had only $21 to his name. At points like that, there’s no hyperbole in saying the status of a $14 debt from a buddy could break him and that the next bad decision is going to be the final say.

Smith’s acting earnestness, coupled with the mental hell of maintaining a time-and-money chain essential to survival, provides unique inspiration for this inspired-by-a-true-story tale set in the early 1980s.

Chris’s world becomes one where not going to the bathroom becomes a precious time saver, and wondering how close to the bottom Murphy’s Law will take him puts viewers dangling on the cliff with all his tension, nerves and hope.

Determination and optimism from Chris and his son, Christopher (played by Smith’s own son, Jaden Christopher Syre Smith) is compelling enough to keep on keeping on in this mostly two-character film. But Happyness annoyingly is kept from greatness by lame narration, an overbearing score that feels hijacked from an insufferable Penny Marshall movie and a Hollywood gloss over the entwinement of racism and class.

We know the black Gardners, trudging from one mode of San Francisco public transportation to another, are the have-nots. It’s garish for screenwriter Steve Conrad and director Gabriele Muccino to throw in wispy shots of WASP prosperity — at its worst, a convertible of laughing yuppies peeling around the same corner where a homeless-shelter line has stretched around the block.

Making it to that shelter for the night is just one unexpected low Chris encounters. Analytical, charming and quick on his feet, he’s still a guy who has taken too many wrong risks — mainly dumping his savings into portable bone-density scanners that he hawks at hospitals.

Conrad makes these inanimate objects characters unto themselves, and, at $250 a pop, Chris must sell two a month to cover rent and daycare. But lately, he’s lost more than he’s sold. The movie insists foot-chase scenes that, if they really happened to Gardner, certainly couldn’t have been as narratively convenient.

On the edge of economical elimination, Chris’s frazzled wife Linda (a de-glammed Thandie Newton) decides she’s had it with Chris’s well-meaning, but empty, promises. Packing it in for New York, she leaves Chris with Christopher, a sharp, observant kid stuck at a daycare where “happiness” is misspelled in a mural and The Love Boat passes for a naval history lesson.

At the same time, Chris puts his chips on an unpaid six-month stockbroker internship program with Dean Witter, where only 20 people are accepted and only one gets a job at its end. (Instead of seeing Chris’s real pitch, he gets his foot in the door because he can solve a Rubik’s Cube, and, in unresolved scenes, he’s later made to fetch coffee and play valet for middle-aged white managers.)

The possibly big payoff of the internship is a big “if.” And as bad as it gets with monumentally late rent, unpaid parking tickets, back taxes and trashed scanners, you know where this is going. Otherwise, there would be no feel-good holiday movie starring Will Smith.

Despite such a necessary outcome, the movie begins to grow into itself (as does Smith’s performance) once Chris enters the internship program. Although it shortchanges scenes of Smith working his stockbroker mojo, the movie balances Chris’s piled-on hardships with a sense of our own workday suspense in accomplishing personal and professional tasks.

Smith failing as a real-world character isn’t something we’ve seen since Six Degrees of Separation. Although his performance has his usual affectations, Smith’s fragility fuels the movie. Smith’s acting high point is Gardner’s low point. A night when mental resourcefulness and playtime imagination are his only assets creates the film’s signature moving moment.

Sure, Smith still broods with contemplation in the shower (as in I, Robot) and sprints down the street with his shirt dangling off his shoulder (as in every one of his action films), but Chris’s demons feel more demanding and his hustle more headlong with so many wolves at his door. We might know Chris will turn them away, but he doesn’t, and that makes this Pursuit a success.