Ben,
This is an excellent question, and one which many people have wrestled with. The Bible tells us that Jesus’ death was a sacrifice for the sins of the whole world (1 John 2:2) and equally that the wrath of God remains on whoever rejects Jesus (John 3:36). When you put these two truths together your question becomes an obvious one!
But it is the first of these two truths I want to examine. What do we mean when we say that Jesus died for the sins of the whole world? If it means that everyone’s sin is personally atoned for, then we are left to conclude that either everyone is saved, irrespective of belief (universalism), or that God is unjust by demanding double payment.
Other passages give us some insight into solving this dilemma. There are many passages which declare that our response matters (John 3:16; Acts 10:43; Romans 10:9-10; Ephesians 1:13 etc) and also that God is just (Romans 3:25-26; 2 Thessalonians 1:5-6; 1 Peter 3:18; Revelation 16:7 etc). The resolution of this dilemma is seen when we recognise that Jesus’ atonement is not a ‘mathematical’ sum of the sins of the whole world. Romans 5 is a very helpful chapter in charting a way forward. It reminds us that the death of Jesus was a necessary part of the reconciling work of a loving God (Romans 5:6-11). Furthermore, it demonstrates that the cost to God in the person of Jesus is greater than just a mere addition of sins, the gift and grace of God abounding to the many (Romans 5:15-21).
In short then we can say that the death of Christ is more than sufficient to atone for every sin of all people throughout all history, that is Christ’s death was sufficient for the sins of the whole world. Yet the personal application of that forgiveness is only possible when God calls a person to himself and grants them grace and faith (Ephesians 2:8-9). Therefore when God punishes someone for their own sin it is a just response of a holy God for the sin which a person has wilfully committed in their sinful state. The scandal as a Christian is recognising that I am equally deserving of the same fate and saved only by the grace of God expressed to me in Jesus Christ.
I hope that helps you,