     (when (= (:mode @state) :playing)
       (swap! state #(-> % move-phase! collision-phase! score-phase!)))
     (draw-phase! state ctx))
-  ;; (set! (.-innerHTML (by-id "debug"))
-  ;;       (apply str (for [[k v] @state]
-  ;;                    (str k ": " (pr-str v) "<br/>"))))
   (.requestAnimationFrame js/window (partial animate-loop! state ctx)))
 
 ;;-----------------------------------------------------------------------------

(defn resize!
  [state ctx]
  (let [w (- (.-innerWidth js/window) 40)
        h (- (int (/ (* w 9) 16)) 40)]
    (-> (by-id "canvas")
        (attr! "width" w)
        (attr! "height" h))
    (.scale ctx (/ w SCALE-W) (/ h SCALE-H))
    (draw-phase! state ctx)))


(defn by-id
  [id]
  (.getElementById js/document id))

(defn listen!
  [el type fn]
