3 way switch confusion
Rather than melt your brain with white, black, red blah blah, let's call travelers yellow.    Here's how a 3-way circuit actually works.

Golly, that's simple. Align the two switches onto the same yellow wire, light lights.  Easy peasy.
But of course, they don't make cables in yellow-yellow-white.  They only make them in black-white-red; and; depending on the other needs of the circuit, the two travelers might be any combination of colors. That's what colored electrical tape is for.  $5 will get you a 5-pack of 5 colors.
Identify the travelers.  Travelers are

always in the same cable (so might the third wire, but it won't be that way on both ends).
On the brass switch screws if the circuit is wired correctly

Assuming your lower switch is untouched, black and red are your travelers in this circuit.  I would remark them with yellow on both ends.
Then, it's dog simple: yellow wires to brass screws, remaining wire to remaining screw and Bob's your uncle.
3-way switches don't take neutral wires, so the white wire in the blue box is definitely not a neutral.  It must be re-marked a color.  (any color but gray or green, but it's preferable to mark it for its function: black always-hot, red switched-hot).