Based on a manga by the same name it's also loosely based off of the classic book "Alice in Wonderland" by Lewis Carroll.
Manga author Jun Mochizuki is a big admirer of Yuki Kajiura and stated to her that she was very excited to find out she was going to be composing the music for the anime adaptation. Kajiura likewise was an avid reader of the manga.
Takao Kato wanted a song to be sung and asked Yuki Kajiura to come up with one around one of the pieces. Kajiura suggested "Melody" because of how often it reoccurs.