Models of indirect reciprocity study how social norms promote cooperation. In these models, cooperative individuals build up a positive reputation, which in turn helps them in their future interactions. The exact reputational benefits of cooperation depend on the norm in place, which may change over time. Previous research focused on the stability of social norms. Much less is known about how social norms initially evolve when competing with many others. A comprehensive evolutionary analysis, however, has been difficult. Even among the comparably simple space of so-called third-order norms, there are thousands of possibilities, each one inducing its own reputation dynamics. To address this challenge, we use large-scale computer simulations. We study the reputation dynamics of each third-order norm and all evolutionary transitions between them. In contrast to established work with only a handful of norms, we find that cooperation is hard to maintain in well-mixed populations. However, within group-structured populations, cooperation can emerge. The most successful norm in our simulations is particularly simple. It regards cooperation as universally positive, and defection as usually negative-unless defection takes the form of justified punishment. This research sheds light on the complex interplay of social norms, their induced reputation dynamics, and population structure.