One idea
Every element is a box. The box has content, padding, border, and margin.
Use box-sizing: border-box for predictable sizing. Then the width you set is the visible box width, not just the content width.
What width means
In the standard CSS box model, width and height apply only to the content area. Padding and border are added after that.
So a card with width: 300px, padding: 20px, and a 2px border becomes wider than 300px. This is a common reason pages overflow on phones.