You’ll want to use CSS Grids here.
Something like:
.category-list .subcategories {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(125px, min-content));
}
If you want the columns to be perfectly equal size, you can change min-content to 1fr.