Let's say I have a smooth irreducible subvariety $X$ of $\mathbb{CP}^n$ with some fixed Hilbert polynomial. What are the best bounds known for the sum of the Betti numbers of $X$? That such a bound exists follows from the boundedness of (a component of) the Hilbert scheme.

I imagine that one could get a reasonable bound by writing down a suitable Morse function and doing some intersection-theoretic calculation for the number of critical points. Or perhaps more simply, just doing some inductive argument using Lefschetz pencils. I'm unsure what the best way of doing this would be though, and it would be nice if there was already a reference in the literature for this.