     (assoc state :ball (assoc ball :vx (* -1 (:vx ball))))
     state))
 
+(defn score-phase!
+  [{:keys [ball score-1 score-2] :as state}]
+  (if (<= 0 (:x ball) SCALE-W)
+    state
+    (let [{:keys [x vx radius]} ball
+          {score1 :score} score-1
+          {score2 :score} score-2
+          p1? (> x SCALE-W)
+          p2? (< x 0)
+          s1 (assoc score-1 :score (if p1? (inc score1) score1))
+          s2 (assoc score-2 :score (if p2? (inc score2) score2))
+          ball (cond
+                 p2? (assoc ball :x (- SCALE-W 25) :y (/ SCALE-H 2))
+                 p1? (assoc ball :x 25 :y (/ SCALE-H 2))
+                 :else ball)]
+      (assoc state :score-1 s1 :score-2 s2 :ball ball))))
+
 (defn animate-loop!
   [state ctx]
-  (swap! state #(-> % move-phase! collision-phase!))
+  ;; if start-mode:
+  ;; ...
+  ;; if play-mode:
+  (swap! state #(-> % move-phase! collision-phase! score-phase!))
+  ;; if win-mode:
+  ;; ...
   (draw-phase! state ctx)
   (.requestAnimationFrame js/window (partial animate-loop! state ctx)))
 

  (atom {:current-paddle :paddle-1
         ;; use div behind canvas
         :background (Rect. 0 0 SCALE-W SCALE-H "black")
          ;; use div behind canvas
         :border     (Frame. 0 0 SCALE-W SCALE-H "#333" 2)
         :paddle-1   (Paddle. 20 (- SCALE-H 120) 20 100 10 "dodgerblue")
         :paddle-2   (Paddle. (- SCALE-W 40) 20 20 100 10 "peru")
         :ball       (Ball. 400 225 13 3 2 "lime")}))

;;-----------------------------------------------------------------------------
;; Animation


(defprotocol IDrawable
  (draw! [_ ctx]))

(extend-type Score
  IDrawable
  (draw! [{:keys [score x y font color] :as Score} ctx]
    (aset ctx "font" font)
    (aset ctx "fillStyle" color)
    (aset ctx "textAlign" "center")
    (.fillText ctx (str score) x y)
    ctx))

(extend-type Paddle
  IDrawable
