How did the poetic style "ci" originate and develop during the Sui and Tang Dynasties?

Ci is a poetry style that emerged during the Sui and Tang Dynasties. The accompanying Yan music is mixed with "Hu Yi and Lixiang music", and is mainly based on the music from the Western Regions that was introduced in large quantities during the Sui and Tang Dynasties in the Northern Dynasties. It originated from the folk. Most of the Dunhuang tunes and lyrics unearthed in the early 20th century were written by folk artists and lower-class scribes, and many of them were written during the Tianbao period. They have a wide range of themes, diverse forms, and flexible expression techniques. After the mid-Tang Dynasty, literati imitated more and more works, and their themes and techniques all showed traces of imitation. In the late Tang Dynasty and the relatively peaceful Xishu, the social atmosphere declined and was extravagant, and the scholar-bureaucrats were content with the sound of dogs and horses, singing and dancing, and the Huajian Ci School represented by Wen Tingyun and Wei Zhuang emerged. Their themes include flowers in front of the moon, women's regrets and beautiful thoughts, and they have established the barrier of "words are beautiful". Although there are differences in style, the most common features are carved red, cut green, fragrant, soft and rich. Later, the Southern Tang Dynasty poems were produced from the same soil as the Huajian poems. They were works of the Southern Tang Dynasty to entertain the kings and ministers. The expression technique is good at subjective lyricism, and the style is relatively sparse. Wei Zhuang in "The Collection of Flowers" and Feng Yansi of the Southern Tang Dynasty are the transitional characters. The real change in Southern Tang poetry occurred after the fall of the Southern Tang Dynasty. Li Houzhu was reduced from the king of a country to a prisoner of his subordinates. He "washed his face in tears all day long." The pain is profound. In terms of expression techniques, he is also famous for his spoken language in line drawing. At this point, Ci has changed from a tool used to accompany wine in the palace to a literary form that expresses emotions and expresses feelings. The realm of Ci has expanded, paving the way for the prosperity of Song Ci.