The default value for flex-wrap is nowrap. That means if objects can't shrink anymore inside the container, they overflow outside of it.
flex-wrap
nowrap
Make sure to pick nowrap.