  In this paper we solve an open problem concerning the characterization of
those measurable sets $\Omega\subset \mathbb{R}^{2d}$ that, among all sets
having a prescribed Lebesgue measure, can trap the largest possible energy
fraction in time-frequency space, where the energy density of a generic
function $f\in L^2(\mathbb{R}^d)$ is defined in terms of its Short-time Fourier
transform (STFT) $\mathcal{V} f(x,\omega)$, with Gaussian window. More
precisely, given a measurable set $\Omega\subset\mathbb{R}^{2d}$ having measure
$s> 0$, we prove that the quantity \[
\Phi_\Omega=\max\Big\{\int_\Omega|\mathcal{V} f(x,\omega)|^2\,dxd\omega: f\in
L^2(\mathbb{R}^d),\ \|f\|_{L^2}=1\Big\}, \] is largest possible if and only if
$\Omega$ is equivalent, up to a negligible set, to a ball of measure $s$, and
in this case we characterize all functions $f$ that achieve equality. This
result leads to a sharp uncertainty principle for the "essential support" of
the STFT (when $d=1$, this can be summarized by the optimal bound
$\Phi_\Omega\leq 1-e^{-|\Omega|}$, with equality if and only if $\Omega$ is a
ball). Our approach, using techniques from measure theory after suitably
rephrasing the problem in the Fock space, also leads to a local version of
Lieb's uncertainty inequality for the STFT in $L^p$ when $p\in [2,\infty)$, as
well as to $L^p$-concentration estimates when $p\in [1,\infty)$, thus proving a
related conjecture. In all cases we identify the corresponding extremals.
