Using the Lagrangian Method to Solve Bead on Rotating Rod The following problem appeared on the Princeton University Physics Competition in 2017:

A bead of mass $m$ is free to slide along a thin rod of length $L$ tilted at angle $\phi$ to the
  vertical. The rod has a base point fixed to the ground and is spinning at constant angular
  velocity $\omega$ about the vertical. Gravity acts in the downwards vertical
  direction. If the rod rotates faster than a certain $\omega_c$ the bead will start to fly off.
  What is $\omega_c$? Suppose that the bead is at length $q_0>0$ along the rod from the base
  point. Express your answer in terms of $g, m, q_0, \phi$.

I have been trying to solve this problem using Lagrangian mechanics, however I keep getting a different answer to what appears on the answer key. The following is my attempt:
Let $T$ be the kinetic energy of the system and let $V$ be the potential energy of the system. Then, $$T=\frac{1}{2}m(q^2\dot{\phi}^2 + \dot{q}^2)$$
$$V = mg q\cos \phi.$$
Hence, the Lagrangian of the system is $$\mathcal{L} =\frac{1}{2}m(q^2\dot{\phi}^2 + \dot{q}^2) - mg q\cos \phi.$$ 
Thus, one of the Euler-Lagrange equations is 
$$m\ddot{q} = mq\dot{\phi}^2 - mg \cos \phi \implies \ddot{q} = q\dot{\phi}^2 - g \cos \phi.$$
At the critical value for $\omega$, we have $q=q_0$ and $\dot{q} = \ddot{q} = 0$. Hence, $$0=q_0\omega_c^2 - g \cos \phi \implies \omega_c^2 = \frac{g\cos\phi}{q_0} $$.
The answer that the answer key gets (using $F=ma$) is $w_c^2 = \frac{g}{q_0 \tan \phi}$. I'm not sure where I have gone wrong. Any help would be greatly appreciated. The following are links to the question paper and answer key:
Question Paper:
http://pupc.princeton.edu/archive/PUPC2017OnsiteExam.pdf 
Answer Key:
https://pupc.princeton.edu/archive/PUPC2017OnsiteSolutions.pdf
 A: It looks like the links in the question both lead to the problem description.  The answers can be found here.
The answer in the solution manual is incorrect.  You can see the mistake when looking at lines (1) and (3) of the solution to this problem:
\begin{equation}
m\ddot{q}=F_{c}\sin\phi - mg\cos\phi \\
F_{c}=m\omega^{2}R_{0} = m\omega^{2}q_{0}\sin\phi.
\end{equation}
In the first equation the $\sin\phi$ is because we want to know the force along the rod away from the anchor point of the rod.  In the last equation they've just used geometry to convert the distance from the axis of rotation $R_{0}$ to $q_{0}$.  The problem with the answer is when they substitute the second result into the first, they lose track of a $\sin\phi$.  The bead will start to fly off when the force due to angular motion away from the anchor point and the force due to gravity towards the anchor point are equal, $m\ddot{q}=0$:
\begin{equation}
m\omega_c^{2}q_{0}sin^{2}\phi = mg\cos\phi \\
\to \omega_c^2 = \frac{g}{q_{0}\sin\phi\tan\phi}.
\end{equation}
For the Lagrangian formalism:
\begin{equation}
T = \frac{1}{2}mv^{2} = \frac{1}{2}m (r^2\omega^2 + \dot{q}^2)=\frac{1}{2}m (\omega^{2}q^2\sin^2\phi + \dot{q}^2) \\
U = mgq\cos\phi.
\end{equation}
The Lagrangian is now
\begin{equation}
\mathcal{L} = \frac{1}{2}m(\omega^{2}q^2\sin^2\phi + \dot{q}^2) - mgq\cos\phi.
\end{equation}
The Euler-Lagrange equation is,
\begin{equation}
m\ddot{q} = m\omega^2q\sin^2\phi - mg\cos\phi = 0\\
\to \omega_c^2 = \frac{g}{q_{0}\sin\phi\tan\phi}.
\end{equation}
In the last line I used the substitutions you've already stated.
With all that said, I'm not sure your equation T makes sense, I don't see why $\phi$ would be changing.
