I think all you need is to define a maximum width on the li...
#mega-menu-wrap-primary .mega-sub-menu li { list-style: none; width: max-content; }