Conclusion
Shinichi, Heiji and Masumi tell the killer his plan failed, and reveal him to be Riki Agata. The three teenagers say they solved the code: Dekuri's symbol was actually to be considered as a compass, and according to it, and to the code's kanji characters' position, and to the fact that these characters were extracted from some of Kyoto's streets' and districts' names corresponding to the position, the code can be understood as a succession of kanji characters who correspond to the first or second syllables of the streets' or districts' names they originate, for instance "kon" for "kontaka", etc., from left to right. The first lines of each code then read "koro sunoha", which means "I'm about to kill". Heiji says the reversed "saki" kanji means its corresponding character, "pon", is to be reversed to "npo", then "n". The first code accordingly means "I'm going to kill three people, the first one being the screenwriter". The second reads "I'm going to kill two more people, the next one being the leading role". And the third is "I'm going to kill one more person, then I'll jump off the balcony". In fact, Agata wanted to kill Mayama and pretend he was the murderer and committed suicide after he failed to kill Agata.
Agata had beforehand booked all of the hotel's smoking rooms and checked one out for Nishiki just as the latter was phoning the hotel. In this room, Agata had previously painted the ceiling red with fake blood splatters and footprints. He then stuck magnetic post-its (similar to Nishiki's ones) over the whole ceiling in order to conceal it, the post-its being of the same color as the ceiling. After killing Nishiki, Agata unstuck all post-its and threw them away on the floor, mixing them up with Nishiki's own ones. He then opened the window and sprayed some of Nishiki's blood with a syringe on the fake blood traces, to pretend he had indeed been murdered on the ceiling by a tengu. Agata, a plastic art expert, also made a fake tengu out of guncotton and used alcohol-ink marker pens to draw on it. He then pasted the very light piece of artwork on his room's ceiling, screamed, pretending to be assaulted by a monster, and threw the ashtray with his lit cigarette in it to the tengu's face to have it explode, burn and vanish into thin air, as this is how guncotton reacts to fire. He had lit his cigarette not long ago to do so, explaining the only 3-centimeter burn patterns left by his cigarette on the floor, that should have been longer if he'd been smoking for a longer period of time.
Agata had also prepared the restaurant's inuyarai by previously painting it red with the usual traces, but covering it with another inuyarai. After he killed Ihaya, he removed the cover inuyarai, threw his bloody glove, dagger and coat into it and put it over another restaurant's inuyarai. He hadn't left any fingerprints on the bloody things for the police still to believe Mayama was the murderer. Shinichi had noticed the dust gap around the first inuyarai, implying it had been covered by something that protected it from dust. Lastly, to frighten Mayama into pinning himself against the railing, Agata used a directional loudspeaker only Mayama could hear, with Dekuri's voice, and had previously painted transparent sheets with red footprints and stuck them on the balcony's floor, covering each of them with another sheet of the same color as the floor, to conceal them. He would then tie fishing lines to each of these same-color sheets and pull them away one after the other in order to fool Mayama into believing Dekuri was walking in his direction, and speaking to him. Agata left his fingerprints on the sheets as he was certain Mayama would die and everybody would rush to the railing, leaving him time and space enough to retrieve all sheets and discarding them later.
Agata tries to run away but gets surrounded by the police who were disguised as visitors. Agata finally confesses to being the serial killer, giving two bumps to his victims just like the tengu does to Kobutori Tale's evil old man who tries to imitate the good Kobutori, just like Nishiki, Ihaya and Mayama stole Dekuri's work and pretended his name would feature in the movie's credits while it was eventually not the case. Agata asked them for an explanation, saying Dekuri cried unceasingly, and the three men replied they were so happy their plan had worked perfectly, thus implying they wanted to humiliate their depressed friend and never had the intention to put his name in the movie. But Keiko and Mayama turn up and say that the producers had modified some very important typology spaces in the credits, preventing the name "Michio Dekuri" from appearing. As actually the name was supposed to appear across the five people's vertical names, which is why everyone changed names and spaces. Dekuri's name was supposed to appear at the same time, and it didn't beacuse of the producers, who didn't want to clear up the mistake afterwards for financial reasons. Agata wasn't told about it as their friends wanted Dekuri and him to discover the surprise while watching the movie together, as they were really close friends. Agata howls in regrets for what he did to his friends.
Aftermath
After the case is solved, Ran talks about a nice place that Okita had told her about and as Sonoko and Masumi start going ahead, Shinichi holds Ran back and asks her how she feels about him. Shinichi mentions Ran's meeting with Okita the previous and wonders if she has forgotten about his confession in London. In response, Ran pulls him closer by grabbing his tie and kisses him on the cheek.
Shinichi moves to kiss Ran on the lips, but the antidote begins to wear off, and he flees.
Masumi gives chase, only to run into Heiji. She realizes that the rucksack Heiji is wearing has the shrunken Shinichi inside it, but doesn't directly confront the two about it. Shinichi and Heiji therefore understand that Masumi knows about Shinichi being Conan.
A teacher of Teitan High School tells students Shinichi has to leave due to an emergency, and tells them not to say a word about Shinichi's coming and presence to Kyoto, as specially asked for by Shinichi himself.
Ran tells Sonoko she actually took Okita aside to give him back his talisman he had dropped during the Kendo Case. She apologised to Okita because she and her father unwittingly opened the talisman, and found a piece of wood and a picture showing Moroha Kurogane, Okita's secret love and a skilled high school kendo practitioner as well. Okita says Moroha is actually his rival Yaiba Kurogane's little sister, and he will date Moroha as soon as he defeats Yaiba at kendo. Okita accepts Ran's excuse but just asks her not to tell a word of this to Momiji, probably because he loves her as well.
As Shinichi and Ran exchange texts about what the kiss means for their relationship, both of them being mutually satisfied with each other's declaration, Masumi speaks with Mary. Mary orders her to obtain the "medicine" that will return her to her true age, so that they can stop running, and counter-attack.
Heiji gives Conan a motorbike ride back to Tokyo, and Ran texts Shinichi to ask him if they're officially dating each other now. Conan thinks about the last antidote Haibara gave him but which he couldn't take as the timing made it impossible: the class was leaving Kyoto and Shinichi still needed to wait for another 8 hours before taking it... Heiji secretly envies Shinichi who not only "stole" his second favourite place in Japan to confess his love to Kazuha, but also as Shinichi is his rival, he now sets the bar high and Heiji has from here on to go further in his relationship with Kazuha as well.
Yukiko and Yusaku are watching the Kyoto Case on TV, in Los Angeles, and are puzzled over the case being so much broadcasted, even worldwide, and hitting the headlines. Yusaku replies it has to do with the victims' and culprit's fame. As Yukiko feels moved to hear the crime motive was Kyoko's boyfriend's death, Yusaku explains he knew about Michio Dekuri's full name as he had seen the movie's poster online and noticed the rearrangement of names and spaces, exactly the same as for the movie's credits, showing the boyfriend's name across his other friends' names, which is why Kyoko/Keiko changed her name. He then comments on the fact Dekuri would have probably not killed himself if he had seen the poster earlier. He also talks about a more burning issue: has Shinichi been spotted by media or else while he was solving the case since Shinichi is considered dead for most people, including the Black Organisation.
After that, Shinichi sends Ran a mail and saying, "Of course we are dating". Ran collapses onto her bed in a fit of giggles and giddiness.