 renderMagic = (localScores) !->
 	Obs.observe !->
 		userCurrent = localScores.get('counters', App.userId())
-		if userCurrent >= MAGICNUMBER and userCurrent < MAGICNUMBER + 1000
+		if userCurrent >= FINALNUMBER and userCurrent < FINALNUMBER + 1000
 			Dom.div !->
 				Dom.animate
 						create:

		if started.get()
			renderScores localScores

renderButton = (buffer) !->
	buffering = Obs.create false
	Dom.div !->
		Dom.style _userSelect: 'none', textAlign: 'center', maxWidth: '700px', borderRadius: '10px', boxShadow: '0 0 10px #aaa', border: '4px solid '+Plugin.colors().highlight, padding: '10px 16px'
		Dom.div !->
			Dom.style textTransform: 'uppercase', fontWeight: 'bold', fontSize: '500%', color: Plugin.colors().highlight
			Dom.text "Click"

		Dom.onTap !->
			buffering.set true
			buffer.incr()

	Obs.observe !->
		return unless buffering.get()

		oldScore = Db.shared.get('counters', App.userId()) ? 0
		newScore = oldScore + buffer.get()
		return if newScore is 0

		localScores.set 'counters', App.userId(), newScore
		started.set true

	Ui.card !->
		Dom.style transition: 'background 6s ease'
		Obs.observe !->
			if finalReached.get()
				Dom.style background: '#333', color: '#ffd700'
		renderButton finalReached, Db.shared.ref('counters', App.userId()), buffer
		renderMagic localScores
		renderFunny()

