Why does the box size change when I resize the browser window?
Viewport units (vw, vh) depend on the size of the browser window. When you resize, the viewport changes, so the box resizes accordingly (see render_steps 2 and 3).
💡 Viewport units always scale with the visible browser area.
Why doesn't 100vw always equal the full width of the screen?
100vw is the width of the viewport, which excludes browser UI like scrollbars. So if a vertical scrollbar appears, 100vw might be slightly wider than the visible content area.
💡 Viewport units measure the visible browser area, not the entire screen.
Why does text inside the box stay centered vertically and horizontally?
Because display:flex with align-items:center and justify-content:center centers content inside the box (see render_step 5).
💡 Flexbox is a simple way to center content inside containers.