Lionel Messi has played his final match for Argentina, ending an era that reshaped the nation's football fortunes and his own legacy.