Without looking much into your code: there is one non quite obvious trick:
Consider you have some block element. If you apply center style to it, its content will center, but you need to leave content as it is, but provide equal empty margins on left and right. This is how:
margin-left: auto;
margin-right: auto;
Hope it will help you,
—SA