Cristiano Ronaldo scored twice and set a new goalscoring record, but his Portugal side could only draw with Hungary to miss a chance to qualify for the 2026 World Cup.