So I just came up to my room after eating dinner to find that my boy had died in the hour and a half or so since I'd last checked on him. He's been ill for a couple of weeks now, and I was mostly attributing his lethargy and fading color to constipation, as his gut was bloated. I tried the pea method, I fasted him for a week before that, finally did another pea AND an Epsom salt bath and he pooped where I could see it (the first time in five bettas that I've actually seen it...). But he was still bloated and most of the color had faded from his tail, so I went to Petsmart today to get a water test and buy some pH decreaser (our water is chronically alkaline) and some frozen daphnia. The guy who did the water test said the pH was a bit high, and the nitrates/nitrites were pretty noticeably high and that I should just do a water change and cleaning, that would probably take care of that pretty well. So I came home, put my boy in a smaller container with a bit of daphnia, and got busy cleaning. I ended up doing probably a 75% water change and siphoning lots of gross stuff out of the gravel. I put him back in after the water had time to heat up and settle and process the pH decreaser I put in, and he seemed even worse than before, just sitting at the bottom, sort of tilted to one side. I got a quarantine tank out (the kind that hooks over the side of the aquarium) and got him into it so it wouldn't be so far to the surface for him, and shaded part of it so the light wouldn't be banging in on him so hard, and went down to dinner. When I came up just now, he was flat out on his side and curved into a crescent shape (if he'd been upright, his head and tail would've been higher than his belly, if that helps). His belly was greyish, and I could see what I'm guessing was his stomach outlined through his scales.
tl;dr any ideas about what might've killed him, so I know if I need to treat the water more before I get a new fish to put in? :-( I'm hoping it wasn't just the stress of being moved around and then the new water, because then I'd feel really bad, and it does seem like an extreme thing when I thought he was just suffering from general stress (due to constipation or not).