\n \n \n \n \n \n \n ',Z.isGameStarted=!0,u=0,y=3,o.textContent=u,n.textContent=y,M=!1,f=!1,h=!1,Z.dinoPosition=50,Z.dinoBottom=0,e.style.left=Z.dinoPosition+"px",e.style.bottom=Z.dinoBottom+"px",k(),document.querySelectorAll(".egg, .star").forEach((t=>{t.remove()})),Z.eggs=[],Z.stars=[],Z.groundEggs=[],r=setInterval(b,20),m=setInterval(I,3500),g=setInterval(W,5e3),p=setInterval(C,3e3),c=setInterval((()=>{M||(u++,o.textContent=u,u%100==0&&(v*=1.1,console.log("Speed increased to: "+v)))}),100),document.addEventListener("keydown",B)}function B(t){"Space"===t.code&&Z.isGameStarted&&!M&&(f?h&&P():E())}function E(){f=!0,h=!0;let t=0;const o=2*Z.dinoWidth/15;a&&clearInterval(a),a=setInterval((()=>{if(t<15){Z.dinoBottom+=20,Z.dinoPosition+=o;const t=Z.gameWidth/3;Z.dinoPosition>t&&(Z.dinoPosition=t),e.style.left=Z.dinoPosition+"px",e.style.bottom=Z.dinoBottom+"px"}else if(t>=15&&Z.dinoBottom>0){Z.dinoBottom-=20,Z.dinoPosition+=o;const t=Z.gameWidth/3;Z.dinoPosition>t&&(Z.dinoPosition=t),e.style.left=Z.dinoPosition+"px",e.style.bottom=Z.dinoBottom+"px"}Z.dinoBottom<=0&&(clearInterval(a),f=!1,h=!1,Z.dinoBottom=0,e.style.bottom="0px"),t++}),20)}function P(){h=!1,clearInterval(a);let t=0;const o=2*Z.dinoWidth/15,n=Z.dinoBottom;a=setInterval((()=>{if(t<15){Z.dinoBottom=n+t/3*20,Z.dinoPosition+=o;const L=Z.gameWidth/3;Z.dinoPosition>L&&(Z.dinoPosition=L),e.style.left=Z.dinoPosition+"px",e.style.bottom=Z.dinoBottom+"px"}else{Z.dinoBottom-=20,Z.dinoBottom<0&&(Z.dinoBottom=0),Z.dinoPosition+=o;const t=Z.gameWidth/3;Z.dinoPosition>t&&(Z.dinoPosition=t),e.style.left=Z.dinoPosition+"px",e.style.bottom=Z.dinoBottom+"px"}Z.dinoBottom<=0&&(clearInterval(a),f=!1,Z.dinoBottom=0,e.style.bottom="0px"),t++}),20)}function I(){if(!M&&Math.random()>.3){const e=document.createElement("div");e.classList.add("egg"),t.appendChild(e);const o=Z.gameWidth+50*Math.random();e.style.left=o+"px",e.style.top="0px",Z.eggs.push({element:e,left:o,top:0,speed:v+2*Math.random()})}}function C(){if(M)return;const e=document.createElement("div");e.classList.add("egg"),t.appendChild(e);const o=Z.gameWidth;e.style.left=o+"px",e.style.bottom="0px",Z.groundEggs.push({element:e,left:o})}function W(){if(M)return;const e=document.createElement("div");e.classList.add("star"),e.innerHTML="★",t.appendChild(e);const o=Z.gameWidth,n=50+100*Math.random();e.style.left=o+"px",e.style.bottom=n+"px",Z.stars.push({element:e,left:o,bottom:n})}function b(){if(M)return;Z.dinoPosition+=.5*v;const o=Z.gameWidth/3;Z.dinoPosition>o&&(Z.dinoPosition=o),e.style.left=Z.dinoPosition+"px";for(let o=0;oZ.gameHeight-32?(L.top=Z.gameHeight-32,L.element.style.top=L.top+"px",Z.groundEggs.push({element:L.element,left:L.left}),Z.eggs.splice(o,1),o--):L.left<-24?(t.removeChild(L.element),Z.eggs.splice(o,1),o--):H(L.left,L.top,24,32,Z.dinoPosition,Z.dinoBottom,Z.dinoWidth,Z.dinoHeight)&&(t.removeChild(L.element),Z.eggs.splice(o,1),o--,y--,n.textContent=y,y<=0?w():(e.style.opacity="0.5",setTimeout((()=>{e.style.opacity="1"}),300)))}for(let o=0;o{e.style.opacity="1"}),300)))}for(let e=0;e{n.style.color="#333"}),300))}}function H(t,e,o,n,L,i,s,l){const d=Z.gameHeight-i-l;let a=0;if(tL){const e=Math.max(t,L);a=(Math.min(t+o,L+s)-e)/s*100}return ed&&a>10}function w(){M=!0,i.style.display="flex",s.textContent=`Your score: ${u}`,k(),document.removeEventListener("keydown",B),v=3}function k(){clearInterval(r),clearInterval(m),clearInterval(g),clearInterval(c),clearInterval(p)}l.addEventListener("click",x),l.addEventListener("touchend",(t=>{t.preventDefault(),x()}),{passive:!1}),d.addEventListener("click",(()=>{i.style.display="none",x()})),d.addEventListener("touchend",(t=>{t.preventDefault(),i.style.display="none",x()}),{passive:!1}),t.addEventListener("touchstart",(t=>{t.preventDefault(),Z.isGameStarted&&!M&&(f?h&&P():E())}),{passive:!1}),window.addEventListener("resize",(()=>{Z.gameWidth=t.offsetWidth,Z.gameHeight=t.offsetHeight}))}))