I recommend that you use the flexbox properties. Your container can look like this:
.container{
display: flex;
flex-direction: column; /*necessary so that all your elements are in one column*/
justify-content: center;
align-items: center;
margin: 0 auto;
width: 500px;
background-color: white;
border-radius: 2rem;
padding: 2rem;
text-align: center;
box-shadow: 0 5px 10px gray;
}
For mobile screens I recommend changing the pixel width values to percentages, so the div will adapt to any device.
@media only screen and (max-width: 500px){
.container{
width: 90%;
}
}