44< head >
55 < meta charset ="UTF-8 " />
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7- < meta name ="description " content ="2048 — A beautiful, feature-rich tile puzzle game. " />
7+ < meta name ="description " content ="2048 — A beautiful, feature-rich tile puzzle game. Slide tiles, merge numbers, and reach the 2048 tile! " />
88 < title > 2048</ title >
99 < link rel ="preconnect " href ="https://fonts.googleapis.com " />
1010 < link href ="https://fonts.googleapis.com/css2?family=Nunito:wght@700;800;900&display=swap " rel ="stylesheet " />
1111 < link rel ="stylesheet " href ="style.css " />
12+ < style id ="theme-style "> </ style >
1213</ head >
1314
1415< body class ="light ">
15- < a href =" / " class =" project-back-button " style =" position:fixed;left:18px;top:18px;padding:8px 16px;border-radius:8px;background:#1e293b;color:#3b82f6;border:1px solid #3b82f6;text-decoration:none;z-index:9999;font-weight:700;font-family:Inter, system-ui, sans-serif;transition:all 0.2s ease; " onmouseover =" this.style.background='#3b82f6';this.style.color='#fff' " onmouseout =" this.style.background='#1e293b';this.style.color='#3b82f6' " > ← Back to Home </ a >
16+
1617
1718
1819 < div id ="g ">
@@ -49,19 +50,31 @@ <h1 class="logo" aria-label="2048">2048</h1>
4950 < div class ="btns ">
5051 < button class ="btn " id ="nb " aria-label ="New Game "> New Game</ button >
5152 < button class ="btn sm " id ="ub " aria-label ="Undo last move "> ↩ Undo</ button >
53+ < button class ="btn sm " id ="pausebtn " aria-label ="Pause game " style ="display:none "> ⏸ Pause</ button >
54+ < button class ="btn sm " id ="hintbtn " aria-label ="Hint "> 💡 Hint</ button >
5255 </ div >
5356 < div class ="top-icons ">
5457 < button class ="icon-btn " id ="stbtn " title ="View Stats " aria-label ="View Stats "> 📊</ button >
5558 < button class ="icon-btn " id ="sdbtn " title ="Toggle Sound " aria-label ="Toggle Sound "> 🔊</ button >
5659 < button class ="icon-btn " id ="tb " title ="Toggle Theme " aria-label ="Toggle Theme "> ☀</ button >
60+ < button class ="icon-btn " id ="howto-btn " title ="How to Play " aria-label ="How to Play "> ❓</ button >
5761 </ div >
5862 </ div >
5963
6064 <!-- Mode selector -->
6165 < div class ="mode-row " role ="group " aria-label ="Game mode ">
62- < button class ="mode-btn active " data-mode ="classic "> Classic</ button >
63- < button class ="mode-btn " data-mode ="timed "> ⏱ 60s</ button >
64- < button class ="mode-btn " data-mode ="zen "> Zen 5×5</ button >
66+ < div class ="theme-row " role ="group " aria-label ="Tile theme ">
67+ < span class ="theme-label "> Theme:</ span >
68+ < button class ="theme-btn active " data-theme ="classic "> Classic</ button >
69+ < button class ="theme-btn " data-theme ="ocean "> 🌊 Ocean</ button >
70+ < button class ="theme-btn " data-theme ="neon "> ⚡ Neon</ button >
71+ < button class ="theme-btn " data-theme ="retro "> 🎮 Retro</ button >
72+ </ div >
73+ < div class ="mode-btns-row ">
74+ < button class ="mode-btn active " data-mode ="classic "> Classic</ button >
75+ < button class ="mode-btn " data-mode ="timed "> ⏱ 60s</ button >
76+ < button class ="mode-btn " data-mode ="zen "> Zen 5×5</ button >
77+ </ div >
6578</ div >
6679
6780 <!-- Timer bar (timed mode only) -->
@@ -86,14 +99,7 @@ <h1 class="logo" aria-label="2048">2048</h1>
8699 < div class ="tiles-layer " id ="tl " aria-hidden ="true "> </ div >
87100
88101 <!-- Game-over / win overlay -->
89- < div
90- id ="ov "
91- class ="ov "
92- style ="display:none "
93- role ="dialog "
94- aria-modal ="true "
95- aria-label ="Game result ">
96- </ div >
102+ < div id ="ov " style ="display:none " role ="dialog " aria-modal ="true " aria-label ="Game result "> </ div >
97103
98104 <!-- Achievement pop-up -->
99105 < div class ="achievement " id ="ach " role ="alert ">
@@ -117,6 +123,11 @@ <h2 class="stats-title">Your Stats</h2>
117123 < div class ="stat-card "> < div class ="lbl "> Best Tile</ div > < div class ="val " id ="st-tile "> 2</ div > </ div >
118124 </ div >
119125
126+ < div class ="graph-section ">
127+ < div class ="ach-list-title "> Last 10 Games</ div >
128+ < canvas id ="score-graph " style ="width:100%;height:80px; "> </ canvas >
129+ </ div >
130+
120131 < div class ="ach-list ">
121132 < div class ="ach-list-title "> Achievements</ div >
122133 < div id ="ach-badges "> </ div >
@@ -128,9 +139,111 @@ <h2 class="stats-title">Your Stats</h2>
128139
129140</ div > <!-- /.wrap -->
130141
142+ < p class ="hint "> Arrow keys · WASD · Swipe to play · < button id ="howto-inline-btn " class ="hint-link-btn " aria-label ="How to Play "> How to Play ❓</ button > </ p >
131143 </ div > <!-- /#inner -->
132144 </ div > <!-- /#g -->
133145
146+ <!-- ===== How to Play Modal ===== -->
147+ < div id ="howto-modal " class ="howto-overlay " role ="dialog " aria-modal ="true " aria-labelledby ="howto-title " style ="display:none ">
148+ < div class ="howto-card ">
149+ < button class ="howto-close " id ="howto-close " aria-label ="Close How to Play "> ✕</ button >
150+
151+ < div class ="howto-header ">
152+ < span class ="howto-icon "> 🎮</ span >
153+ < h2 class ="howto-title " id ="howto-title "> How to Play 2048</ h2 >
154+ </ div >
155+
156+ <!-- Goal -->
157+ < div class ="howto-section ">
158+ < h3 class ="howto-section-title "> 🏆 Goal</ h3 >
159+ < p class ="howto-text ">
160+ Slide the tiles on the grid. When two tiles with the < strong > same number</ strong > collide,
161+ they < strong > merge into one</ strong > . Reach the < strong class ="howto-highlight "> 2048</ strong > tile to win!
162+ </ p >
163+ </ div >
164+
165+ <!-- Controls -->
166+ < div class ="howto-section ">
167+ < h3 class ="howto-section-title "> 🕹️ Controls</ h3 >
168+
169+ < div class ="howto-controls-grid ">
170+ <!-- Keyboard -->
171+ < div class ="howto-control-block ">
172+ < p class ="howto-control-label "> ⌨️ Keyboard</ p >
173+ < div class ="howto-keys ">
174+ < div class ="key-row ">
175+ < kbd class ="key "> ↑</ kbd >
176+ </ div >
177+ < div class ="key-row ">
178+ < kbd class ="key "> ←</ kbd >
179+ < kbd class ="key "> ↓</ kbd >
180+ < kbd class ="key "> →</ kbd >
181+ </ div >
182+ < p class ="key-note "> Arrow Keys or WASD</ p >
183+ </ div >
184+ </ div >
185+
186+ <!-- Swipe -->
187+ < div class ="howto-control-block ">
188+ < p class ="howto-control-label "> 📱 Mobile</ p >
189+ < div class ="howto-swipe ">
190+ < div class ="swipe-icon " aria-hidden ="true ">
191+ < svg width ="52 " height ="52 " viewBox ="0 0 48 48 " fill ="none " xmlns ="http://www.w3.org/2000/svg ">
192+ < circle cx ="24 " cy ="24 " r ="10 " stroke ="rgba(255,255,255,0.6) " stroke-width ="2 " fill ="none "/>
193+ < line x1 ="24 " y1 ="4 " x2 ="24 " y2 ="14 " stroke ="rgba(255,255,255,0.8) " stroke-width ="2.5 " stroke-linecap ="round "/>
194+ < line x1 ="24 " y1 ="34 " x2 ="24 " y2 ="44 " stroke ="rgba(255,255,255,0.8) " stroke-width ="2.5 " stroke-linecap ="round "/>
195+ < line x1 ="4 " y1 ="24 " x2 ="14 " y2 ="24 " stroke ="rgba(255,255,255,0.8) " stroke-width ="2.5 " stroke-linecap ="round "/>
196+ < line x1 ="34 " y1 ="24 " x2 ="44 " y2 ="24 " stroke ="rgba(255,255,255,0.8) " stroke-width ="2.5 " stroke-linecap ="round "/>
197+ < polygon points ="24,4 21,10 27,10 " fill ="rgba(255,255,255,0.8) "/>
198+ < polygon points ="24,44 21,38 27,38 " fill ="rgba(255,255,255,0.8) "/>
199+ < polygon points ="4,24 10,21 10,27 " fill ="rgba(255,255,255,0.8) "/>
200+ < polygon points ="44,24 38,21 38,27 " fill ="rgba(255,255,255,0.8) "/>
201+ </ svg >
202+ </ div >
203+ < p class ="key-note "> Swipe in any direction</ p >
204+ </ div >
205+ </ div >
206+ </ div >
207+ </ div >
208+
209+ <!-- Pro Tips -->
210+ < div class ="howto-section ">
211+ < h3 class ="howto-section-title "> 💡 Pro Tips</ h3 >
212+ < ul class ="howto-tips ">
213+ < li > Keep your < strong > highest tile</ strong > in a corner.</ li >
214+ < li > Build a < strong > snake chain</ strong > of descending values.</ li >
215+ < li > Use < strong > ↩ Undo</ strong > to recover from a bad move.</ li >
216+ < li > Try < strong > 💡 Hint</ strong > when you are stuck!</ li >
217+ </ ul >
218+ </ div >
219+
220+ <!-- Game Modes -->
221+ < div class ="howto-section ">
222+ < h3 class ="howto-section-title "> ⚙️ Game Modes</ h3 >
223+ < div class ="howto-modes ">
224+ < div class ="howto-mode-card ">
225+ < span class ="mode-emoji "> 🎯</ span >
226+ < strong > Classic</ strong >
227+ < span > 4×4 grid, no time limit</ span >
228+ </ div >
229+ < div class ="howto-mode-card ">
230+ < span class ="mode-emoji "> ⏱️</ span >
231+ < strong > Timed 60s</ strong >
232+ < span > Race against the clock</ span >
233+ </ div >
234+ < div class ="howto-mode-card ">
235+ < span class ="mode-emoji "> 🧘</ span >
236+ < strong > Zen 5×5</ strong >
237+ < span > Bigger grid, relaxed play</ span >
238+ </ div >
239+ </ div >
240+ </ div >
241+
242+ < button class ="btn howto-start-btn " id ="howto-close2 "> Got it — Let's Play! 🚀</ button >
243+ </ div >
244+ </ div >
245+ <!-- ===== / How to Play Modal ===== -->
246+
134247 < script src ="script.js "> </ script >
135248</ body >
136249
0 commit comments