Hearts will play in the Champions League qualifiers next season for the first time in 20 years as Celtic's win over Rangers guarantees a top-two Scottish Premiership finish.