It could be hard to know why it died even if we were there looking at it instead of across the internet. There are different things that could have happened.
Were there any injuries to the chick? Did one of the others peck it to death? I’ve had that happen before, a 2 week old just attack and kill its sibling. If this is the cause there should be bare spots with meat showing. It should be pretty obvious.
Had you heard any distress peeping? This is a very sad constant plaintive peep, very consistent, that chicks do when they are in distress. Once you hear it you recognize it, you just know something is wrong, it’s that sad. It can happen when a chick gets separated from the broody hen, when it gets cold, or if it gets hungry or thirsty so it could mean different things but it is a clear sign the chick was in distress.
One time I had a chick just standing in the brooder peeping. It was about a week old. Although I had dipped all their beaks in the water when I put them in the brooder, this one never learned to drink. Usually if one learns the others learn by watching it. Not this one. I dipped its beak in the water and it just stood there drinking for quite a while. A chick can live a long time off of the absorbed yolk at hatch, but some never learn to eat or maybe drink and eventually starve to death or die of thirst. You don’t always hear that plaintive peeping.
Sort of along with this, some chicks are just not right when they hatch. There might be something wrong with the heart, the digestive system, or some other organ or system. It doesn’t matter what you do, they are just not meant to make it. Most of these just die in the first week or two.
It’s possible a chick got caught on the bottom and was smothered or crushed, with living animals you can never say never, but it’s unlikely. Most of the time something like that happens it’s when you have a few dozen or more and something panics them. They all pile up at one end of the brooder. When they sleep in a group it’s not really piled on top of one another. They sleep together because they like the comfort of the group not because they are cold, but if one was having trouble breathing it should be able to wriggle around and solve its problem. It’s possible something you don’t know about panicked them and caused a pile-up, but it’s really not likely this was caused by them sleeping in a pile.
I assume your brooder is in the house where the temperature is fairly constant and they are not exposed to outside winds. Since they were acting as they were, I really doubt there was enough of a temperature variation, either hot or cold, to cause any problem. Too much heat is a big danger to chicks, especially in small tight brooders like aquariums. But your terrarium had an open side and you said the chicks were acting normal as far as signs of heat or cold go. How the chick act is your best indication of how hot or cold they are. I certainly agree the best brooders have one area warm enough and another area cool enough. This takes away any worries you have about keeping the brooder a perfect temperature. With a temperature range to choose from they self-regulate quite well.
LG and I usually agree on most things but I’ve raised 28 chicks to five weeks old in a brooder that was 3’ x 5’. That’s about a half a square foot per chick. Most of those were female. I raised 21 chicks, mostly male, in the same brooder to the same age. In both cases they were getting crowded but I did not have the behavioral problems you expect when they are over-crowded. I don’t believe in magic numbers for much of anything to do with chickens, there are just too many variables. No matter what magic number someone mentions somebody else can come up with an example where it just isn’t so. While I certainly agree that more room is better, from my experience you don’t need one square foot per chick the first week, let alone the second or third. The more chicks you have the less per square feet per chick is required. I don’t know how big your terrarium is, it could be pretty crowded with 13 chicks even at that age. It would be good to know how big that terrarium is, it may be too crowded now or you may soon be headed for trouble. It may or may not have contributed to the problem.
My guess is that there was just something wrong with the chick when it hatched, not something you did or did not do. The age is about right for something like that. If it doesn’t happen again don’t concern yourself. If it does happen again, then it might be something else. It’s just hard to say.