Amplifying PRF Advantage
The general question is, "what is the probability that $T$ is significantly far from its mean?" This is a question about the "tail" of a distribution.

Your random variable $T$ can be written as a sum of indicator variables, $T = \sum_{i=1}^q T_i$, where $T_i=1$ if the $i$th query begins with 8 zeroes. Hence, $T$ follows a binomial distribution $B(q,1/256)$ in the ideal world and $B(q,1/128)$ in the real world.

The standard way to estimate tail probabilities for binomial distributions is through the Chernoff bound. For example, in the ideal world, $T$ has mean $q/256$:
\begin{align*}
\Pr[ T &gt; 3q/512 ] &amp;= \Pr[ T &gt; (1+0.5) q/256]
\end{align*}
So you can use the multiplicative Chernoff bound with $\delta=0.5$ to get:
\begin{align*}
\Pr[ T &gt; 3q/512 ] &amp;\le \left( \frac{ e^{0.5} }{ 1.5^{1.5} } \right)^{q/256} \approx (0.999577)^q
\end{align*}

You can do a similar computation to get a bound on $\Pr[ T &lt; 3q/512 ]$ in the real world, and from that get a lower bound on the advantage.