import { useState, useEffect, useRef } from "react"; export default function SquirrelHome() { const [tick, setTick] = useState(0); const [night, setNight] = useState(false); const [recording, setRecording] = useState(true); const [alert, setAlert] = useState(false); const rafRef = useRef(); const startRef = useRef(Date.now()); useEffect(() => { const loop = () => { setTick(Math.floor((Date.now() - startRef.current) / 50)); rafRef.current = requestAnimationFrame(loop); }; rafRef.current = requestAnimationFrame(loop); return () => cancelAnimationFrame(rafRef.current); }, []); useEffect(() => { setAlert(tick % 200 > 60 && tick % 200 < 110); }, [tick]); const t = tick * 0.04; const leafBob = Math.sin(t * 1.1) * 1.8; const squirrelPeek = Math.sin(t * 0.5) * 5; const blinkOpen = tick % 80 > 3; const windSway = Math.sin(t * 0.7) * 2; const skyTop = night ? "#0b1426" : "#aee6ff"; const skyBot = night ? "#1a2a1a" : "#d4f0c0"; const leaf1 = night ? "#1e3d1a" : "#3a8c2a"; const leaf2 = night ? "#254d20" : "#4aaa35"; const wd = "#4a2e1a", wm = "#6b3f20", wl = "#8b5530"; return (