This may be a very simple question, yet I cannot find an answer that satisfies me. I have read (and please correct me if I am wrong) that the shape of the universe depends on its density. If it has too much matter it would be a sphere, and the sum of the angles inside a triangle would be more than 180º; if it has a small amount of matter it would be like a saddle, and the sum of the angles inside a triangle would be less than 180º. Yet it looks like it has just enough to be flat.
So this is my question: if the universe is expanding, does that not mean that its density gets lower? And if it does, does that means its shape will change?
I have been doing some thinking and this is the conclusion I reached this far: Considering the amount of dark energy increases together with the universe, then the total density would not change. In case this is wrong (and I think it is), I would appreciate if someone could explain to me why.
Sorry for the long question, and thank you for your attention.