Calm before a storm? Man, I just really want to know wtf is going on. If you liked the MC then ask him out, not his best friend!
They did foreshadow in previous chapters. Then again anime logic dictates that there's some underlying trauma, bundle that with some bizarre backward braindead rationale that led her to date Takt.
My guess was that she was frustrated with Riku's inaction to ask her out + Takt was the first to ask her out (and she accepted out of convenience's sake and FOMO). Perhaps she was aware she was going to leave the town, and so decided to accept Takt's confession, so she wouldn't become too attached to Riku and stay in the town. (Yes I'm aware this sounds stupid, but it's just my guess)
I also assume that Takt asked her out because he was aware that Riku was interested in her, and ofc he was jealous, had some inferiority complex and had to one-up him. Can't let others have good things, u gotta sweep it from under their feet. The idea of him stealing Riku's crush is a bi-product of her lack of integrity and loyalty. Yet Riku covets and values their friendship over his own happiness.