Nonlinear theory of large-mode-number ballooning modes in fully toroidal geometry