Pope Francis celebrated mass Sunday with over 2.5 million pilgrims in a vast sun-drenched field, wrapping up a emotionally charged trip to Poland which took him to Nazi concentration camp Auschwitz.
High-spirited teenagers, scouts, priests and families had camped under the stars in the vast "Campus Misericordiae" (Field of Mercy) near the city of Krakow ahead of the final mass of a week-long Catholic festival.
Francis whipped out technology metaphors for today's chat and app-happy pilgrims, telling them to "download the best link of all, that of a heart which sees and transmits goodness without growing weary".
He said they should be dreamers who believe "in a new humanity", one that "rejects hatred between peoples" and "refuses to see borders and barriers". They should use the gospel, he said, as their GPS.
Hundreds of thousands of people had streamed to the grassy site Saturday with folding chairs, sleeping bags, umbrellas and sun-hats, amid warnings hours in the baking July sun could be broken with a rainstorm.
"This is the trip of a lifetime, for me and my whole family," said 29-year old Mexican pilgrim Isaac Victoria, as volunteers handed out bottles of water to the thirsty crowds.
At the evening vigil on Saturday, Francis chastised "drowsy and dull kids who confuse happiness with a sofa", urging them to get out and live life rather than spend it glued to smartphones.
The final festivities were attended by "between 2.5 and 3.0 million people," 2016 World Youth Day spokesperson Anna Chmura told AFP. Polish police declined to give an estimate.
Latin America's first pontiff had faced stiff competition at the start of his five-day trip with the memory of immensely popular Polish pope and saint John Paul II, but quickly made the festivities his own.
As he visited the death camp in Auschwitz, he warned that the cruelty seen there "did not end" with World War II.
The "world is at war", Francis said, but the way to "overcome fear" was to welcome people fleeing conflicts and persecution -- a message with particular resonance in Poland, which has taken a hard line against refugees.
On Saturday he prayed for God to rid the world of the "devastating wave of terrorism".
"In these dangerous times, he is convincing people not to be afraid to open up," pilgrim Kasia Czajka, 40, said.
"While John Paul II was especially focused on the young, Francis is for all people in need".
The head of the world's 1.2 billion Roman Catholics cracked joke after joke with youngsters gathered nightly beneath his window, cranking up the party spirit at an event dubbed "the Catholic Woodstock".
The medieval centre of Krakow has been overrun all week by flag-waving groups from China to Samoa and Mexico, who were entertained between masses with concerts, break-dancing and football matches.
But Friday was a day of mourning as Francis walked silently through the notorious wrought-iron "Arbeit Macht Frei" (Work Sets You Free) gate at the Auschwitz-Birkenau camp, where 1.1 million people were murdered.
Freeing himself from the imposing security laid on for his visit, Francis sat on a bench among the trees and bowed his head in prayer before meeting Holocaust survivors and Catholics who had helped save Jews.
"Lord, have mercy on your people. Lord, forgive so much cruelty," the pope wrote in a memorial book.
In a heartfelt appeal to the world's young, he said it was up to them to fight xenophobia and "teach us how to live in diversity, in dialogue, to experience multiculturalism not as a threat, but an opportunity".