  The production of $J/\psi$ mesons in heavy-ion collisions at the Large Hadron
Collider is believed to be dominated by the recombination of charm and
anti-charm quarks in a hot QCD medium. However, measurements of the elliptic
flow ($v_2$) of $J/\psi$ mesons in these reactions are not well described by
existing calculations of $J/\psi$ recombination for transverse momenta
$p_T\geq$4 GeV. Here, we revisit these calculations in two main aspects. By
employing the resonance recombination model, we implement distribution
functions of charm quarks transported through the quark-gluon plasma using
state-of-the-art Langevin simulations, and we account for the space-momentum
correlations of the diffusing charm and anti-charm quarks in the
hydrodynamically expanding fireball. These improvements extend the relevance of
the recombination processes to substantially larger momenta than before. In
addition, we revisit the suppression of the primordially produced $J/\psi$
mesons by propagating them through the same hydrodynamic medium, leading to a
marked increase of the $v_2$ of this component over previous estimates.
Combining these developments into a calculation of the $p_T$-dependent nuclear
modification factor and $v_2$ of inclusive $J/\psi$ production in semi-central
Pb-Pb collisions at the LHC, we find a good description of the experimental
results by the ALICE collaboration. Our results thus resolve the
above-mentioned $v_2$ puzzle and imply the relevance of recombination processes
for $p_T$'s of up to $\sim$8 GeV.
