Lepidoptera
Phylogeny

Lepidoptera and Trichoptera (caddisflies) are sister groups, sharing many similarities that are lacking in others; for example the females of both orders are heterogametic, meaning they have two different sex chromosomes, whereas in most species the males are heterogametic and the females have two identical sex chromosomes. The adults in both orders display a particular wing venation pattern on their forewings. The larvae in the two orders have mouth structures and glands with which they make and manipulate silk. Willi Hennig grouped the two orders into the superorder Amphiesmenoptera; together they are sister to the extinct order Tarachoptera. Lepidoptera descend from a diurnal moth-like common ancestor that either fed on dead or living plants.

The cladogram, based on molecular analysis, shows the order as a clade, sister to the Trichoptera, and more distantly related to the Diptera (true flies) and Mecoptera (scorpionflies).

Micropterigidae, Agathiphagidae and Heterobathmiidae are the oldest and most basal lineages of Lepidoptera. The adults of these families do not have the curled tongue or proboscis, that are found in most members of the order, but instead have chewing mandibles adapted for a special diet. Micropterigidae larvae feed on leaves, fungi, or liverworts (much like the Trichoptera). Adult Micropterigidae chew the pollen or spores of ferns. In the Agathiphagidae, larvae live inside kauri pines and feed on seeds. In Heterobathmiidae the larvae feed on the leaves of Nothofagus, the southern beech tree. These families also have mandibles in the pupal stage, which help the pupa emerge from the seed or cocoon after metamorphosis.

The Eriocraniidae have a short coiled proboscis in the adult stage, and though they retain their pupal mandibles with which they escaped the cocoon, their mandibles are non-functional thereafter. Most of these non-ditrysian families, are primarily leaf miners in the larval stage. In addition to the proboscis, there is a change in the scales among these basal lineages, with later lineages showing more complex perforated scales.

With the evolution of the Ditrysia in the mid-Cretaceous, there was a major reproductive change. The Ditrysia, which comprise 98% of the Lepidoptera, have two separate openings for reproduction in the females (as well as a third opening for excretion), one for mating, and one for laying eggs. The two are linked internally by a seminal duct. (In more basal lineages there is one cloaca, or later, two openings and an external sperm canal.) Of the early lineages of Ditrysia, Gracillarioidea and Gelechioidea are mostly leaf miners, but more recent lineages feed externally. In the Tineoidea, most species feed on plant and animal detritus and fungi, and build shelters in the larval stage.

The Yponomeutoidea is the first group to have significant numbers of species whose larvae feed on herbaceous plants, as opposed to woody plants. They evolved about the time that flowering plants underwent an expansive adaptive radiation in the mid- Cretaceous, and the Gelechioidea that evolved at this time also have great diversity. Whether the processes involved coevolution or sequential evolution, the diversity of the Lepidoptera and the angiosperms increased together.

In the so-called " macrolepidoptera ", which constitutes about 60% of lepidopteran species, there was a general increase in size, better flying ability (via changes in wing shape and linkage of the forewings and hindwings), reduction in the adult mandibles, and a change in the arrangement of the crochets (hooks) on the larval prolegs, perhaps to improve the grip on the host plant. Many also have tympanal organs, that allow them to hear. These organs evolved eight times, at least, because they occur on different body parts and have structural differences. The main lineages in the macrolepidoptera are the Noctuoidea, Bombycoidea, Lasiocampidae, Mimallonoidea, Geometroidea and Rhopalocera. Bombycoidea plus Lasiocampidae plus Mimallonoidea may be a monophyletic group. The Rhopalocera, comprising the Papilionoidea (butterflies), Hesperioidea (skippers), and the Hedyloidea (moth-butterflies), are the most recently evolved. There is quite a good fossil record for this group, with the oldest skipper dating from 56 million years ago.
length_constraints:number_sentences[6], change_case:english_capital