Quinton de Kock made a free-flowing century at No. 7 and equaled his career-best score as South Africa turned the screw on Pakistan on Sunday by setting the tourists 381 to win the final Test and avoid a series whitewash.
Pakistan's batsmen responded with signs of the fight that's been missing for most of a one-sided series so far, reaching 153/3 at stumps on the third day of the fast-moving third Test. That reduced the equation to 228 more runs needed with seven wickets in hand.
Asad Shafiq was 48 not out off 47 balls and approaching the daunting challenge with an attacking mindset.
Babar Azam, one of Pakistan's best batsmen this series, was settling in on 17 not out.
The scale of the challenge for Pakistan was still significant.
The tourists need to make the second-highest fourth-innings score ever at the Wanderers in Johannesburg to avoid losing the series 3-0. There have only been three fourth-innings totals of 300 or more in more than 60 years of test cricket at the Wanderers. South Africa holds the record with its 450-7 against India in December 2013 and Pakistan's would be the next best score should it chase successfully.
With two days of the test still to play, surviving for a draw is an unlikely proposition. It's all or nothing for Pakistan.
Openers Imam-ul-Haq (35) and Shan Masood (37) gave Pakistan a positive start with a 67-run partnership. Both fell to Dale Steyn in the space of four overs, though, a reminder that wickets have fallen in clutches on a swinging and seaming pitch and Pakistan is still a long way off victory.
Duanne Olivier then removed Azhar Ali with a brutish short ball that reared up at the batsman's head. Azhar gloved to wicketkeeper de Kock to give Olivier, Pakistan's main destroyer, his 22nd wicket of the series -- surely enough for the man of the series award.
Olivier's return is the second-best for a South African bowler ever in a three-Test series and three wickets off the record. He could still break that record with seven Pakistan wickets on offer in the final innings.
Olivier wasn't even meant to play this series but was given a place when Lungi Ngidi was injured.
Earlier, de Kock hit 129 from just 138 balls with 18 fours and a six as he and Hashim Amla (71) put on 102 and dug South Africa out of trouble in its second innings.
They were largely responsible for setting Pakistan the big target.
De Kock arrived with South Africa on 93/5 and in a precarious position and departed at 302/8 with his team in complete control. South Africa, which resumed the day on 135/5, was eventually all out for 303.
The wicketkeeper-batsman looked assured throughout, save for a few nervous moments when he was on 99 and couldn't find the single he needed for his fourth test century and first in two years.
After a couple of aborted runs with batting partner Kagiso Rabada, and one shot which hit Rabada and prevented runs, de Kock got one through for a boundary and was celebrating halfway down the pitch, on one knee and punching the air.
De Kock put on 79 with tailender Rabada following the century stand with Amla and eventually fell caught in the deep off leg-spinner Shadab Khan.
Pakistan's batsmen came out fighting, though, with Shafiq especially pugnacious to crack eight fours and combine in an unbroken 49-run stand with Babar.
They kept Pakistan's hopes of taking something from the series alive for at least one more day.