Jaouadart commited on
Commit
8d0fd24
·
verified ·
1 Parent(s): c9fc22a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +1303 -145
index.html CHANGED
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
2
  <html lang="ar" dir="rtl">
3
  <head>
4
  <meta charset="UTF-8">
@@ -16,14 +16,13 @@
16
 
17
  body {
18
  font-family: 'Tajawal', sans-serif;
19
- background-color: #81C784;
20
  min-height: 100vh;
21
  display: flex;
22
  flex-direction: column;
23
  align-items: center;
24
  padding: 0;
25
  touch-action: pan-x pan-y;
26
- overflow-y: auto;
27
  }
28
  .container {
29
  max-width: 100%;
@@ -32,10 +31,10 @@
32
  flex-direction: column;
33
  }
34
  .header {
35
- background-color: #3F51B5;
36
  color: white;
37
  padding: 1rem;
38
- border-radius: 0.75rem;
39
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
40
  display: flex;
41
  align-items: center;
@@ -44,52 +43,53 @@
44
  margin: 0;
45
  }
46
  .grid-container {
47
- flex-grow: 1;
48
  display: grid;
49
  grid-template-columns: repeat(2, 1fr);
50
- gap: 1rem;
51
- padding: 1rem;
52
  justify-items: center;
 
53
  }
54
  .card {
55
- padding: 1.5rem;
56
  border-radius: 1.5rem;
57
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
58
- transition: transform 0.2s;
59
  cursor: pointer;
60
  display: flex;
61
  flex-direction: column;
62
  align-items: center;
63
  text-align: center;
64
- aspect-ratio: 1 / 1;
65
  position: relative;
66
- width: 95%; /* تم التكبير قليلاً */
67
- max-width: 170px; /* تم التكبير قليلاً */
 
 
 
 
 
68
  }
69
  .card:hover {
70
  transform: scale(1.05);
71
- }
72
- .card-image {
73
- width: 70%;
74
- height: 70%;
75
- object-fit: contain;
76
- position: absolute;
77
- top: 50%;
78
- left: 50%;
79
- transform: translate(-50%, -60%);
80
  }
81
  .card-text {
82
  font-size: 1rem;
83
  font-weight: bold;
84
- color: #333;
85
  position: absolute;
86
  bottom: 1rem;
87
  left: 50%;
88
  transform: translateX(-50%);
 
 
 
 
 
 
89
  }
90
- .alphabet-card {
91
- background-color: white;
92
- padding: 1rem;
93
  border-radius: 1.5rem;
94
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
95
  display: flex;
@@ -98,36 +98,31 @@
98
  justify-content: center;
99
  cursor: pointer;
100
  aspect-ratio: 1 / 1;
101
- width: 95%; /* تم التكبير قليلاً */
102
- max-width: 170px; /* تم التكبير قليلاً */
 
 
103
  }
104
- .alphabet-card .tifinagh-letter {
105
- font-family: 'Tifinagh', sans-serif;
106
- font-size: 4rem;
107
- color: red;
108
  font-weight: bold;
109
- }
110
- .alphabet-card .card-image-small {
111
- width: 90px; /* تم التكبير قليلاً */
112
- height: 90px; /* تم التكبير قليلاً */
113
- object-fit: contain;
114
  margin-top: 0.5rem;
115
- }
116
- .alphabet-card .word {
117
- font-family: 'Tifinagh', sans-serif;
118
- font-size: 1.2rem;
119
- margin-top: 1rem;
120
- direction: ltr;
121
  }
122
  .red-letter {
123
- color: red;
124
  }
125
  .message-box {
126
  position: fixed;
127
  top: 50%;
128
  left: 50%;
129
  transform: translate(-50%, -50%);
130
- background-color: #3F51B5;
131
  color: white;
132
  padding: 2rem;
133
  border-radius: 1.5rem;
@@ -145,95 +140,612 @@
145
  margin-top: 1rem;
146
  cursor: pointer;
147
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  </style>
149
  </head>
150
- <body class="bg-[#81C784]">
151
- <div id="app-container"></div>
 
 
 
152
  <div id="message-box" class="message-box">
153
- <p id="message-text">لا توجد صفحة متاحة لهذه الفئة حالياً. سنضيف المزيد من المحتوى قريباً!</p>
154
  <button onclick="closeMessage()">موافق</button>
155
  </div>
 
 
 
 
156
 
157
  <script>
 
 
 
 
 
158
  const tifinaghData = [
159
- { letter: 'ⵓ', word: 'ⴰⴳⴰⵍ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🧱' },
160
- { letter: 'ⵔ', word: 'ⴰⵔⴳⴰⵣ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🚶' },
161
- { letter: 'ⴱ', word: 'ⴰⴱⵔⴱⵉ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🦋' },
162
- { letter: 'ⵖ', word: 'ⴰⵖⴰⵔⴰⵙ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🌍' },
163
- { letter: 'ⵛ', word: 'ⴰⵛⴰ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🍇' },
164
- { letter: 'ⴷ', word: 'ⴰⴷⵔⴰⵔ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=⛰️' },
165
- { letter: 'ⴼ', word: 'ⴰⴼⵓⵏⴰⵙ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🔥' },
166
- { letter: 'ⴽ', word: 'ⴰⴽⵍ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🛡️' },
167
- { letter: 'ⵍ', word: 'ⴰⵍⵍ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🌳' },
168
- { letter: 'ⵚ', word: 'ⵚⵓⵙ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🧀' },
169
- { letter: 'ⵎ', word: 'ⴰⵎⴰⵏ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=💧' },
170
- { letter: 'ⵏ', word: 'ⴰⵏⵣⴰ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🌧️' },
171
- { letter: 'ⵣ', word: 'ⴰⵣⴰ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🪰' },
172
- { letter: 'ⵉ', word: 'ⵉⵍ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🐑' },
173
- { letter: 'ⵙ', word: 'ⴰⵙⵙ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🥪' },
174
- { letter: 'ⵡ', word: 'ⴰⵡ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🕳️' },
175
- { letter: 'ⵟ', word: 'ⴰⵟⴰⵙ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🐪' },
176
- { letter: 'ⵠ', word: 'ⴰⵠⵉⵍ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🪶' },
177
- { letter: 'ⴹ', word: 'ⴹⵓ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=☀️' },
178
- { letter: 'ⵄ', word: 'ⵄⴰ', image: 'https://placehold.co/150x150/F57C00/FFFFFF?text=🌱' },
179
- { letter: 'ⴳ', word: 'ⴳⴰ', image: 'https://placehold.co/100x100/388E3C/FFFFFF?text=🐓' },
180
- { letter: 'ⵗ', word: 'ⵗⵔⴰ', image: 'https://placehold.co/100x100/388E3C/FFFFFF?text=🌵' },
181
- { letter: 'ⵕ', word: 'ⵕⴰ', image: 'https://placehold.co/100x100/388E3C/FFFFFF?text=🥖' },
182
- { letter: 'ⵣ', word: 'ⵣⵉ', image: 'https://placehold.co/100x100/388E3C/FFFFFF?text=🌕' },
183
- { letter: 'ⵣ', word: 'ⵣⴰ', image: 'https://placehold.co/100x100/388E3C/FFFFFF?text=🪵' },
184
- { letter: 'ⴱ', word: 'ⴱⴰ', image: 'https://placehold.co/100x100/388E3C/FFFFFF?text=🧅' }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  ];
186
 
187
- function createAlphabetPage() {
188
- let content = `
189
- <div class="container">
190
- <header class="header">
191
- <svg onclick="showPage('main')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
192
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
193
- </svg>
194
- <div class="text-xl font-bold">حروف و كلمات</div>
195
- <div class="w-6"></div>
196
- </header>
197
- <main class="grid-container mt-4">
198
- `;
199
- tifinaghData.forEach(item => {
200
- const highlightedWord = `<span class="red-letter">${item.word[0]}</span>${item.word.slice(1)}`;
201
- content += `
202
- <div class="alphabet-card" onclick="speak('${item.letter}', '${item.word}')">
203
- <div class="tifinagh-letter">${item.letter}</div>
204
- <img src="${item.image}" alt="${item.word}" class="card-image-small">
205
- <div class="word text-xl mt-2">${highlightedWord}</div>
206
- </div>
207
- `;
208
- });
209
- content += `
210
- </main>
211
- </div>
212
- `;
213
- return content;
214
- }
215
 
216
- function speak(letter, word) {
217
- if ('speechSynthesis' in window) {
218
- const message = new SpeechSynthesisUtterance(`${letter} ${word}`);
219
- message.lang = 'ar-MA';
220
- window.speechSynthesis.speak(message);
221
- } else {
222
- showMessage("متصفحك لا يدعم خاصية النطق الصوتي.");
223
- }
224
- }
 
 
 
225
 
226
- function showPage(pageName) {
227
- const appContainer = document.getElementById('app-container');
228
- if (pageName === 'main') {
229
- appContainer.innerHTML = createMainPage();
230
- } else if (pageName === 'alphabet') {
231
- appContainer.innerHTML = createAlphabetPage();
232
- } else {
233
- showMessage('هذه الفئة غير متاحة حالياً.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  }
235
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
 
 
237
  function createMainPage() {
238
  return `
239
  <div class="container">
@@ -247,44 +759,40 @@
247
  </svg>
248
  </header>
249
  <main class="grid-container">
250
- <a href="#" onclick="showPage('other')" class="card bg-orange-200">
251
- <img src="https://placehold.co/150x150/F57C00/FFFFFF?text=🎒" alt="أدوات مدرسية" class="card-image">
252
  <span class="card-text">أدوات مدرسية</span>
253
  </a>
254
- <a href="#" onclick="showPage('alphabet')" class="card bg-green-200">
255
- <img src="https://placehold.co/150x150/388E3C/FFFFFF?text=🅰️" alt="حروف و كلمات" class="card-image">
256
  <span class="card-text">حروف و كلمات</span>
257
  </a>
258
- <a href="#" onclick="showPage('other')" class="card bg-orange-200">
259
- <img src="https://placehold.co/150x150/F57C00/FFFFFF?text=🍂" alt="فصول السنة" class="card-image">
260
  <span class="card-text">فصول السنة</span>
261
  </a>
262
- <a href="#" onclick="showPage('other')" class="card bg-green-200">
263
- <img src="https://placehold.co/150x150/388E3C/FFFFFF?text=🔢" alt="الأرقام" class="card-image">
264
  <span class="card-text">الأرقام</span>
265
  </a>
266
- <a href="#" onclick="showPage('other')" class="card bg-blue-200">
267
- <img src="https://placehold.co/150x150/00ACC1/FFFFFF?text=🍎" alt="خضر وفواكه" class="card-image">
268
  <span class="card-text">خضر وفواكه</span>
269
  </a>
270
- <a href="#" onclick="showPage('other')" class="card bg-orange-200">
271
- <img src="https://placehold.co/150x150/F57C00/FFFFFF?text=🦁" alt="حيوانات" class="card-image">
272
  <span class="card-text">حيوانات</span>
273
  </a>
274
- <a href="#" onclick="showPage('other')" class="card bg-green-200">
275
- <img src="https://placehold.co/150x150/388E3C/FFFFFF?text=👨‍👩‍👧‍👦" alt="العائلة" class="card-image">
276
  <span class="card-text">العائلة</span>
277
  </a>
278
- <a href="#" onclick="showPage('other')" class="card bg-blue-200">
279
- <img src="https://placehold.co/150x150/00ACC1/FFFFFF?text=🗓️" alt="أشهر السنة" class="card-image">
280
  <span class="card-text">أشهر السنة</span>
281
  </a>
282
- <a href="#" onclick="showPage('other')" class="card bg-orange-200">
283
- <img src="https://placehold.co/150x150/F57C00/FFFFFF?text=🧍" alt="أعضاء" class="card-image">
284
- <span class="card-text">أعضاء</span>
285
  </a>
286
- <a href="#" onclick="showPage('other')" class="card bg-green-200">
287
- <img src="https://placehold.co/150x150/388E3C/FFFFFF?text=🎮" alt="ألعاب تعليمية" class="card-image">
 
 
 
 
 
288
  <span class="card-text">ألعاب تعليمية</span>
289
  </a>
290
  </main>
@@ -292,11 +800,661 @@
292
  `;
293
  }
294
 
295
- function showMessage(msg) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  const messageBox = document.getElementById('message-box');
297
- document.getElementById('message-text').innerText = msg;
 
 
 
 
 
 
 
 
 
 
 
298
  messageBox.style.display = 'block';
299
  }
 
300
  function closeMessage() {
301
  document.getElementById('message-box').style.display = 'none';
302
  }
@@ -306,4 +1464,4 @@
306
  });
307
  </script>
308
  </body>
309
- </html>
 
1
+ <!DOCTYPE html>
2
  <html lang="ar" dir="rtl">
3
  <head>
4
  <meta charset="UTF-8">
 
16
 
17
  body {
18
  font-family: 'Tajawal', sans-serif;
19
+ background-color: #F0F4C3;
20
  min-height: 100vh;
21
  display: flex;
22
  flex-direction: column;
23
  align-items: center;
24
  padding: 0;
25
  touch-action: pan-x pan-y;
 
26
  }
27
  .container {
28
  max-width: 100%;
 
31
  flex-direction: column;
32
  }
33
  .header {
34
+ background-color: #263238;
35
  color: white;
36
  padding: 1rem;
37
+ border-radius: 0 0 1rem 1rem;
38
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
39
  display: flex;
40
  align-items: center;
 
43
  margin: 0;
44
  }
45
  .grid-container {
 
46
  display: grid;
47
  grid-template-columns: repeat(2, 1fr);
48
+ gap: 1.5rem;
49
+ padding: 1.5rem;
50
  justify-items: center;
51
+ align-content: start;
52
  }
53
  .card {
54
+ background-color: white;
55
  border-radius: 1.5rem;
56
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
57
+ transition: transform 0.2s, box-shadow 0.2s;
58
  cursor: pointer;
59
  display: flex;
60
  flex-direction: column;
61
  align-items: center;
62
  text-align: center;
 
63
  position: relative;
64
+ width: 100%;
65
+ max-width: 200px;
66
+ aspect-ratio: 1 / 1;
67
+ background-size: cover;
68
+ background-position: center;
69
+ overflow: hidden;
70
+ text-decoration: none;
71
  }
72
  .card:hover {
73
  transform: scale(1.05);
74
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
 
 
 
 
 
 
 
 
75
  }
76
  .card-text {
77
  font-size: 1rem;
78
  font-weight: bold;
79
+ color: white;
80
  position: absolute;
81
  bottom: 1rem;
82
  left: 50%;
83
  transform: translateX(-50%);
84
+ white-space: nowrap;
85
+ overflow: hidden;
86
+ text-overflow: ellipsis;
87
+ padding: 0.25rem 0.5rem;
88
+ border-radius: 0.5rem;
89
+ text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
90
  }
91
+ .interactive-card {
92
+ background-color: #263238;
 
93
  border-radius: 1.5rem;
94
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
95
  display: flex;
 
98
  justify-content: center;
99
  cursor: pointer;
100
  aspect-ratio: 1 / 1;
101
+ width: 100%;
102
+ max-width: 150px;
103
+ position: relative;
104
+ overflow: hidden;
105
  }
106
+ .interactive-card .word-label {
107
+ font-family: 'Tajawal', sans-serif;
108
+ font-size: 1rem;
 
109
  font-weight: bold;
 
 
 
 
 
110
  margin-top: 0.5rem;
111
+ direction: rtl;
112
+ color: white;
113
+ position: relative;
114
+ z-index: 10;
115
+ text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
 
116
  }
117
  .red-letter {
118
+ color: #FFB74D;
119
  }
120
  .message-box {
121
  position: fixed;
122
  top: 50%;
123
  left: 50%;
124
  transform: translate(-50%, -50%);
125
+ background-color: #263238;
126
  color: white;
127
  padding: 2rem;
128
  border-radius: 1.5rem;
 
140
  margin-top: 1rem;
141
  cursor: pointer;
142
  }
143
+ .number-badge, .letter-badge {
144
+ position: absolute;
145
+ top: 0.5rem;
146
+ left: 0.5rem;
147
+ background-color: #FFB74D;
148
+ color: #263238;
149
+ font-size: 1.25rem;
150
+ font-weight: bold;
151
+ padding: 0.25rem 0.5rem;
152
+ border-radius: 0.5rem;
153
+ z-index: 15;
154
+ text-shadow: none;
155
+ }
156
+ .letter-badge {
157
+ font-family: 'Tifinagh', sans-serif;
158
+ font-size: 1.5rem;
159
+ }
160
+ .word-image {
161
+ width: 100%;
162
+ height: 100%;
163
+ object-fit: cover;
164
+ position: absolute;
165
+ top: 0;
166
+ left: 0;
167
+ z-index: 5;
168
+ border-radius: 1.5rem;
169
+ }
170
+ /* Game specific styles */
171
+ #game-container {
172
+ display: flex;
173
+ flex-direction: column;
174
+ align-items: center;
175
+ justify-content: center;
176
+ background-color: #F8F9FA;
177
+ padding: 2rem;
178
+ border-radius: 1rem;
179
+ box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
180
+ width: 100%;
181
+ max-width: 600px;
182
+ margin-top: 2rem;
183
+ }
184
+ #game-board {
185
+ display: grid;
186
+ grid-template-columns: repeat(4, 1fr);
187
+ gap: 0.75rem; /* Reduced gap for smaller squares */
188
+ perspective: 1000px;
189
+ width: 100%;
190
+ justify-content: center;
191
+ }
192
+
193
+ .game-card {
194
+ width: 100%;
195
+ max-width: 90px; /* Smaller max width for cards */
196
+ aspect-ratio: 1 / 1;
197
+ background-color: #6C757D;
198
+ border-radius: 0.75rem;
199
+ position: relative;
200
+ transform-style: preserve-3d;
201
+ transition: transform 0.6s;
202
+ cursor: pointer;
203
+ box-shadow: 0 4px 8px rgba(0,0,0,0.2);
204
+ justify-self: center;
205
+ }
206
+
207
+ @media (min-width: 640px) {
208
+ .game-card {
209
+ max-width: 100px;
210
+ }
211
+ }
212
+
213
+ .game-card.flipped {
214
+ transform: rotateY(180deg);
215
+ }
216
+ .game-card.matched {
217
+ opacity: 0.5;
218
+ cursor: default;
219
+ }
220
+ .game-card-front, .game-card-back {
221
+ position: absolute;
222
+ width: 100%;
223
+ height: 100%;
224
+ backface-visibility: hidden;
225
+ border-radius: 0.75rem;
226
+ display: flex;
227
+ align-items: center;
228
+ justify-content: center;
229
+ }
230
+ .game-card-front {
231
+ transform: rotateY(180deg);
232
+ background-size: cover;
233
+ background-position: center;
234
+ }
235
+ .game-card-back {
236
+ background-color: #263238; /* Darker back color */
237
+ }
238
+ #game-info {
239
+ margin-top: 1rem;
240
+ text-align: center;
241
+ color: #263238;
242
+ font-size: 1.25rem;
243
+ font-weight: bold;
244
+ }
245
+ .game-button {
246
+ background-color: #263238;
247
+ color: white;
248
+ padding: 0.75rem 1.5rem;
249
+ border-radius: 9999px;
250
+ margin: 0.5rem;
251
+ font-weight: bold;
252
+ cursor: pointer;
253
+ transition: background-color 0.2s, transform 0.2s;
254
+ }
255
+ .game-button:hover {
256
+ background-color: #37474F;
257
+ transform: translateY(-2px);
258
+ }
259
+
260
+ /* Guessing Game specific styles */
261
+ .question-box {
262
+ background-color: white;
263
+ border-radius: 1rem;
264
+ padding: 1.5rem;
265
+ text-align: center;
266
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
267
+ margin-bottom: 1rem;
268
+ }
269
+ .question-image {
270
+ width: 100%;
271
+ max-width: 300px;
272
+ height: auto;
273
+ border-radius: 1rem;
274
+ margin-bottom: 1rem;
275
+ }
276
+ .options-grid {
277
+ display: grid;
278
+ grid-template-columns: repeat(2, 1fr);
279
+ gap: 1rem;
280
+ width: 100%;
281
+ max-width: 400px;
282
+ }
283
+ .option-button {
284
+ background-color: #FFB74D;
285
+ color: #263238;
286
+ padding: 1rem;
287
+ border-radius: 0.75rem;
288
+ font-weight: bold;
289
+ transition: background-color 0.2s, transform 0.2s;
290
+ }
291
+ .option-button:hover {
292
+ background-color: #FFA726;
293
+ transform: scale(1.05);
294
+ }
295
+ .option-button.correct {
296
+ background-color: #4CAF50;
297
+ color: white;
298
+ }
299
+ .option-button.wrong {
300
+ background-color: #FF5252;
301
+ color: white;
302
+ }
303
+ .timer-display {
304
+ font-size: 1.5rem;
305
+ font-weight: bold;
306
+ color: #FF5252;
307
+ margin-bottom: 1rem;
308
+ text-align: center;
309
+ }
310
+
311
+ /* New Shadow Game Styles */
312
+ #shadow-game-container {
313
+ display: flex;
314
+ flex-direction: column;
315
+ align-items: center;
316
+ padding: 2rem;
317
+ background-color: #F8F9FA;
318
+ border-radius: 1rem;
319
+ box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
320
+ width: 100%;
321
+ max-width: 700px;
322
+ margin-top: 2rem;
323
+ }
324
+ #shadow-game-top {
325
+ display: grid;
326
+ grid-template-columns: repeat(4, 1fr);
327
+ gap: 1.5rem;
328
+ width: 100%;
329
+ justify-items: center;
330
+ margin-bottom: 2rem;
331
+ }
332
+ .shadow-box {
333
+ width: 100%;
334
+ aspect-ratio: 1 / 1;
335
+ background-color: transparent;
336
+ border: 2px dashed #6C757D;
337
+ border-radius: 1rem;
338
+ position: relative;
339
+ }
340
+ .shadow-image {
341
+ width: 100%;
342
+ height: 100%;
343
+ object-fit: contain;
344
+ filter: brightness(0); /* Makes the image black (shadow) */
345
+ opacity: 0.4;
346
+ }
347
+ #shadow-game-bottom {
348
+ display: grid;
349
+ grid-template-columns: repeat(4, 1fr);
350
+ gap: 1.5rem;
351
+ width: 100%;
352
+ justify-items: center;
353
+ }
354
+ .draggable-animal {
355
+ width: 100%;
356
+ aspect-ratio: 1 / 1;
357
+ cursor: grab;
358
+ background-size: cover;
359
+ background-position: center;
360
+ border-radius: 1rem;
361
+ box-shadow: 0 4px 8px rgba(0,0,0,0.2);
362
+ transition: transform 0.2s, box-shadow 0.2s;
363
+ }
364
+ .draggable-animal:active {
365
+ cursor: grabbing;
366
+ }
367
+ .draggable-animal.dragging {
368
+ opacity: 0.5;
369
+ box-shadow: 0 8px 16px rgba(0,0,0,0.3);
370
+ transform: scale(1.1);
371
+ }
372
+ .matched-correctly {
373
+ box-shadow: 0 0 10px 5px #4CAF50;
374
+ }
375
+
376
+ /* Story Page Styles */
377
+ .story-container {
378
+ padding: 2rem;
379
+ text-align: center;
380
+ }
381
+ .story-image {
382
+ width: 100%;
383
+ max-width: 400px;
384
+ border-radius: 1rem;
385
+ margin-bottom: 1.5rem;
386
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
387
+ }
388
+ .story-text {
389
+ font-size: 1.25rem;
390
+ line-height: 1.8;
391
+ color: #333;
392
+ text-align: justify;
393
+ }
394
+ .story-nav-buttons {
395
+ display: flex;
396
+ justify-content: center;
397
+ gap: 1rem;
398
+ margin-top: 1.5rem;
399
+ }
400
+
401
+ /* Colors Page Styles */
402
+ .color-card {
403
+ width: 100%;
404
+ max-width: 150px;
405
+ aspect-ratio: 1 / 1;
406
+ border-radius: 1rem;
407
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
408
+ display: flex;
409
+ align-items: center;
410
+ justify-content: center;
411
+ font-weight: bold;
412
+ color: white;
413
+ text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
414
+ cursor: pointer;
415
+ transition: transform 0.2s;
416
+ }
417
+ .color-card:hover {
418
+ transform: scale(1.05);
419
+ }
420
+
421
  </style>
422
  </head>
423
+ <body>
424
+ <!-- Main App Container -->
425
+ <div id="app-container" class="container"></div>
426
+
427
+ <!-- Custom Message Box -->
428
  <div id="message-box" class="message-box">
429
+ <p id="message-text"></p>
430
  <button onclick="closeMessage()">موافق</button>
431
  </div>
432
+
433
+ <!-- Audio player for stories -->
434
+ <audio id="story-audio" controls style="display:none;"></audio>
435
+
436
 
437
  <script>
438
+ // Global state to manage pages and games
439
+ let currentPage = 'main';
440
+ let currentGame = null;
441
+
442
+ // Data for different pages
443
  const tifinaghData = [
444
+ { letter: 'ⴰ', word: 'ⴰⵎⴰⵏ', image: 'https://source.unsplash.com/400x400/?water' },
445
+ { letter: 'ⴱ', word: 'ⴱⵔⴱⵉ', image: 'https://source.unsplash.com/400x400/?butterfly,insect' },
446
+ { letter: 'ⵛ', word: 'ⵛⴰ', image: 'https://source.unsplash.com/400x400/?tea' },
447
+ { letter: 'ⴷ', word: 'ⴷⴰⵔ', image: 'https://source.unsplash.com/400x400/?house' },
448
+ { letter: 'ⴹ', word: 'ⴹⴰⴹ', image: 'https://source.unsplash.com/400x400/?toy' },
449
+ { letter: 'ⴻ', word: 'ⴻⵎⴰ', image: 'https://source.unsplash.com/400x400/?mother' },
450
+ { letter: 'ⴼ', word: 'ⴼⵓⵍ', image: 'https://source.unsplash.com/400x400/?bean' },
451
+ { letter: 'ⴳ', word: 'ⴳⴰ', image: 'https://source.unsplash.com/400x400/?do,action' },
452
+ { letter: 'ⴳʷ', word: 'ⴳʷⴰ', image: 'https://source.unsplash.com/400x400/?say,speak' },
453
+ { letter: 'ⵄ', word: 'ⵄⴰⵍ', image: 'https://source.unsplash.com/400x400/?run,fast' },
454
+ { letter: 'ⵅ', word: 'ⵅⴰⵏ', image: 'https://source.unsplash.com/400x400/?eat,food' },
455
+ { letter: 'ⵃ', word: 'ⵃⴰ', image: 'https://source.unsplash.com/400x400/?go,move' },
456
+ { letter: 'ⵉ', word: 'ⵉⵛ', image: 'https://source.unsplash.com/400x400/?fish' },
457
+ { letter: 'ⵊ', word: 'ⵊⴰⵏ', image: 'https://source.unsplash.com/400x400/?boy' },
458
+ { letter: 'ⴽ', word: 'ⴽⴰ', image: 'https://source.unsplash.com/400x400/?cook,food' },
459
+ { letter: 'ⴽʷ', word: 'ⴽʷⴰ', image: 'https://source.unsplash.com/400x400/?drink,juice' },
460
+ { letter: 'ⵍ', word: 'ⵍⴰ', image: 'https://source.unsplash.com/400x400/?play,game' },
461
+ { letter: 'ⵎ', word: 'ⵎⴰ', image: 'https://source.unsplash.com/400x400/?mother,woman' },
462
+ { letter: 'ⵏ', word: 'ⵏⴰ', image: 'https://source.unsplash.com/400x400/?sleep,nap' },
463
+ { letter: 'ⵄ', word: 'ⵄⴰⵍ', image: 'https://source.unsplash.com/400x400/?run' },
464
+ { letter: 'ⵇ', word: 'ⵇⴰ', image: 'https://source.unsplash.com/400x400/?look' },
465
+ { letter: 'ⵔ', word: 'ⵔⴰ', image: 'https://source.unsplash.com/400x400/?see' },
466
+ { letter: 'ⵕ', word: 'ⵕⴰ', image: 'https://source.unsplash.com/400x400/?cold' },
467
+ { letter: 'ⵙ', word: 'ⵙⴰ', image: 'https://source.unsplash.com/400x400/?know' },
468
+ { letter: 'ⵚ', word: 'ⵚⴰ', image: 'https://source.unsplash.com/400x400/?clean' },
469
+ { letter: 'ⵜ', word: 'ⵜⴰ', image: 'https://source.unsplash.com/400x400/?write' },
470
+ { letter: 'ⵜⵛ', word: 'ⵜⵛⴰ', image: 'https://source.unsplash.com/400x400/?food' },
471
+ { letter: 'ⵜⵣ', word: 'ⵜⵣⴰ', image: 'https://source.unsplash.com/400x400/?dance' },
472
+ { letter: 'ⵡ', word: 'ⵡⴰ', image: 'https://source.unsplash.com/400x400/?listen' },
473
+ { letter: 'ⵢ', word: 'ⵢⴰ', image: 'https://source.unsplash.com/400x400/?read' },
474
+ { letter: 'ⵣ', word: 'ⵣⴰ', image: 'https://source.unsplash.com/400x400/?be' },
475
+ { letter: 'ⵥ', word: 'ⵥⴰ', image: 'https://source.unsplash.com/400x400/?hear' },
476
+ { letter: 'ⵀ', word: 'ⵀⴰ', image: 'https://source.unsplash.com/400x400/?speak' },
477
+ ];
478
+
479
+ const animalsData = [
480
+ { word: 'قطة', image: 'https://source.unsplash.com/400x400/?cat' },
481
+ { word: 'كلب', image: 'https://source.unsplash.com/400x400/?dog' },
482
+ { word: 'أسد', image: 'https://source.unsplash.com/400x400/?lion' },
483
+ { word: 'فيل', image: 'https://source.unsplash.com/400x400/?elephant' },
484
+ { word: 'قرد', image: 'https://source.unsplash.com/400x400/?monkey' },
485
+ { word: 'زرافة', image: 'https://source.unsplash.com/400x400/?giraffe' },
486
+ { word: 'نمر', image: 'https://source.unsplash.com/400x400/?tiger' },
487
+ { word: 'دب', image: 'https://source.unsplash.com/400x400/?bear' },
488
+ { word: 'سمكة', image: 'https://source.unsplash.com/400x400/?fish' },
489
+ { word: 'طائر', image: 'https://source.unsplash.com/400x400/?bird' },
490
+ { word: 'أرنب', image: 'https://source.unsplash.com/400x400/?rabbit' },
491
+ { word: 'خروف', image: 'https://source.unsplash.com/400x400/?sheep' },
492
+ { word: 'حصان', image: 'https://source.unsplash.com/400x400/?horse' },
493
+ { word: 'ثعلب', image: 'https://source.unsplash.com/400x400/?fox' },
494
+ { word: 'بومة', image: 'https://source.unsplash.com/400x400/?owl' },
495
+ { word: 'ذئب', image: 'https://source.unsplash.com/400x400/?wolf' },
496
+ { word: 'بطة', image: 'https://source.unsplash.com/400x400/?duck' },
497
+ { word: 'غزال', image: 'https://source.unsplash.com/400x400/?deer' },
498
+ { word: 'جمل', image: 'https://source.unsplash.com/400x400/?camel' },
499
+ { word: 'فراشة', image: 'https://source.unsplash.com/400x400/?butterfly' }
500
+ ];
501
+
502
+ const numbersData = [
503
+ { number: '1', word: 'واحد', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=1%20🍎' },
504
+ { number: '2', word: 'اثنان', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=2%20🍎🍎' },
505
+ { number: '3', word: 'ثلاثة', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=3%20🍎🍎🍎' },
506
+ { number: '4', word: 'أربعة', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=4%20🍎🍎🍎🍎' },
507
+ { number: '5', word: 'خمسة', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=5%20🍎🍎🍎🍎🍎' },
508
+ { number: '6', word: 'ستة', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=6%20⭐' },
509
+ { number: '7', word: 'سبعة', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=7%20⭐' },
510
+ { number: '8', word: 'ثمانية', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=8%20⭐' },
511
+ { number: '9', word: 'تسعة', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=9%20⭐' },
512
+ { number: '10', word: 'عشرة', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=10%20⭐' },
513
+ { number: '11', word: 'أحد عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=11%20⭐' },
514
+ { number: '12', word: 'اثنا عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=12%20⭐' },
515
+ { number: '13', word: 'ثلاثة عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=13%20⭐' },
516
+ { number: '14', word: 'أربعة عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=14%20⭐' },
517
+ { number: '15', word: 'خمسة عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=15%20⭐' },
518
+ { number: '16', word: 'ستة عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=16%20⭐' },
519
+ { number: '17', word: 'سبعة عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=17%20⭐' },
520
+ { number: '18', word: 'ثمانية عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=18%20⭐' },
521
+ { number: '19', word: 'تسعة عشر', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=19%20⭐' },
522
+ { number: '20', word: 'عشرون', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=20%20⭐' },
523
+ { number: '30', word: 'ثلاثون', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=30%20⭐' },
524
+ { number: '40', word: 'أربعون', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=40%20⭐' },
525
+ { number: '50', word: 'خمسون', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=50%20⭐' },
526
+ { number: '60', word: 'ستون', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=60%20⭐' },
527
+ { number: '70', word: 'سبعون', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=70%20⭐' },
528
+ { number: '80', word: 'ثمانون', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=80%20⭐' },
529
+ { number: '90', word: 'تسعون', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=90%20⭐' },
530
+ { number: '100', word: 'مئة', image: 'https://placehold.co/400x400/2196F3/FFFFFF?text=100%20⭐' },
531
+ ];
532
+
533
+ const schoolSuppliesData = [
534
+ { word: 'قلم رصاص', image: 'https://source.unsplash.com/400x400/?pencil' },
535
+ { word: 'كتاب', image: 'https://source.unsplash.com/400x400/?book' },
536
+ { word: 'ممحاة', image: 'https://source.unsplash.com/400x400/?eraser' },
537
+ { word: 'مسطرة', image: 'https://source.unsplash.com/400x400/?ruler' },
538
+ { word: 'حقيبة مدرسية', image: 'https://source.unsplash.com/400x400/?backpack,school' },
539
+ { word: 'قلم حبر', image: 'https://source.unsplash.com/400x400/?pen' },
540
+ { word: 'دفتر', image: 'https://source.unsplash.com/400x400/?notebook' },
541
+ { word: 'ألوان', image: 'https://source.unsplash.com/400x400/?paint,colors' },
542
+ { word: 'مقص', image: 'https://source.unsplash.com/400x400/?scissors' },
543
+ { word: 'صمغ', image: 'https://source.unsplash.com/400x400/?glue' }
544
  ];
545
 
546
+ const seasonsData = [
547
+ { word: 'الشتاء', image: 'https://source.unsplash.com/400x400/?winter,snow,cold' },
548
+ { word: 'الربيع', image: 'https://source.unsplash.com/400x400/?spring,flowers,bloom' },
549
+ { word: 'الصيف', image: 'https://source.unsplash.com/400x400/?summer,sun,beach' },
550
+ { word: 'الخريف', image: 'https://source.unsplash.com/400x400/?autumn,fall,leaves' }
551
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
 
553
+ const fruitsData = [
554
+ { word: 'تفاح', image: 'https://source.unsplash.com/400x400/?apple' },
555
+ { word: 'موز', image: 'https://source.unsplash.com/400x400/?banana' },
556
+ { word: 'برتقال', image: 'https://source.unsplash.com/400x400/?orange' },
557
+ { word: 'فراولة', image: 'https://source.unsplash.com/400x400/?strawberry' },
558
+ { word: 'عنب', image: 'https://source.unsplash.com/400x400/?grapes' },
559
+ { word: 'رمان', image: 'https://source.unsplash.com/400x400/?pomegranate' },
560
+ { word: 'بطيخ', image: 'https://source.unsplash.com/400x400/?watermelon' },
561
+ { word: 'مانجو', image: 'https://source.unsplash.com/400x400/?mango' },
562
+ { word: 'أناناس', image: 'https://source.unsplash.com/400x400/?pineapple' },
563
+ { word: 'ليمون', image: 'https://source.unsplash.com/400x400/?lemon' }
564
+ ];
565
 
566
+ const vegetablesData = [
567
+ { word: 'طماطم', image: 'https://source.unsplash.com/400x400/?tomato' },
568
+ { word: 'خيار', image: 'https://source.unsplash.com/400x400/?cucumber' },
569
+ { word: 'جزر', image: 'https://source.unsplash.com/400x400/?carrot' },
570
+ { word: 'بصل', image: 'https://source.unsplash.com/400x400/?onion' },
571
+ { word: 'ثوم', image: 'https://source.unsplash.com/400x400/?garlic' },
572
+ { word: 'فلفل', image: 'https://source.unsplash.com/400x400/?bell,pepper' },
573
+ { word: 'بطاطا', image: 'https://source.unsplash.com/400x400/?potato' },
574
+ { word: 'خس', image: 'https://source.unsplash.com/400x400/?lettuce' },
575
+ { word: 'باذنجان', image: 'https://source.unsplash.com/400x400/?eggplant' },
576
+ { word: 'قرنبيط', image: 'https://source.unsplash.com/400x400/?cauliflower' }
577
+ ];
578
+
579
+ const monthsData = [
580
+ { word: 'يناير', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=يناير' },
581
+ { word: 'فبراير', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=فبراير' },
582
+ { word: 'مارس', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=مارس' },
583
+ { word: 'أبريل', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=أبريل' },
584
+ { word: 'مايو', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=مايو' },
585
+ { word: 'يونيو', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=يونيو' },
586
+ { word: 'يوليو', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=يوليو' },
587
+ { word: 'أغسطس', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=أغسطس' },
588
+ { word: 'سبتمبر', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=سبتمبر' },
589
+ { word: 'أكتوبر', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=أكتوبر' },
590
+ { word: 'نوفمبر', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=نوفمبر' },
591
+ { word: 'ديسمبر', image: 'https://placehold.co/400x400/FFB74D/FFFFFF?text=ديسمبر' }
592
+ ];
593
+
594
+ const familyData = [
595
+ { word: 'أمي', image: 'https://source.unsplash.com/400x400/?mother,woman' },
596
+ { word: 'أبي', image: 'https://source.unsplash.com/400x400/?father,man' },
597
+ { word: 'أخي', image: 'https://source.unsplash.com/400x400/?brother,boy' },
598
+ { word: 'أختي', image: 'https://source.unsplash.com/400x400/?sister,girl' },
599
+ { word: 'جدي', image: 'https://source.unsplash.com/400x400/?grandfather,old,man' },
600
+ { word: 'جدتي', image: 'https://source.unsplash.com/400x400/?grandmother,old,woman' },
601
+ { word: 'عمي', image: 'https://source.unsplash.com/400x400/?uncle' },
602
+ { word: 'عمتي', image: 'https://source.unsplash.com/400x400/?aunt' },
603
+ { word: 'خالي', image: 'https://source.unsplash.com/400x400/?uncle' },
604
+ { word: 'خالتي', image: 'https://source.unsplash.com/400x400/?aunt' }
605
+ ];
606
+
607
+ const bodyPartsData = [
608
+ { word: 'الرأس', image: 'https://source.unsplash.com/400x400/?human,head' },
609
+ { word: 'اليد', image: 'https://source.unsplash.com/400x400/?human,hand' },
610
+ { word: 'القدم', image: 'https://source.unsplash.com/400x400/?human,foot' },
611
+ { word: 'العين', image: 'https://source.unsplash.com/400x400/?human,eye' },
612
+ { word: 'الأنف', image: 'https://source.unsplash.com/400x400/?human,nose' },
613
+ { word: 'الفم', image: 'https://source.unsplash.com/400x400/?human,mouth' },
614
+ { word: 'الأذن', image: 'https://source.unsplash.com/400x400/?human,ear' },
615
+ { word: 'الذراع', image: 'https://source.unsplash.com/400x400/?human,arm' },
616
+ { word: 'الساق', image: 'https://source.unsplash.com/400x400/?human,leg' },
617
+ { word: 'الشعر', image: 'https://source.unsplash.com/400x400/?human,hair' },
618
+ { word: 'الظهر', image: 'https://source.unsplash.com/400x400/?human,back' },
619
+ { word: 'الصدر', image: 'https://source.unsplash.com/400x400/?human,chest' },
620
+ { word: 'البطن', image: 'https://source.unsplash.com/400x400/?human,belly' },
621
+ { word: 'الكتف', image: 'https://source.unsplash.com/400x400/?shoulder' },
622
+ { word: 'الركبة', image: 'https://source.unsplash.com/400x400/?knee' },
623
+ { word: 'الأسنان', image: 'https://source.unsplash.com/400x400/?teeth' },
624
+ { word: 'اللسان', image: 'https://source.unsplash.com/400x400/?tongue' },
625
+ { word: 'الأصابع', image: 'https://source.unsplash.com/400x400/?fingers' },
626
+ { word: 'الرقبة', image: 'https://source.unsplash.com/400x400/?neck' },
627
+ { word: 'القلب', image: 'https://source.unsplash.com/400x400/?heart' }
628
+ ];
629
+
630
+ // Data for memory game images
631
+ const memoryGameImages = [
632
+ 'https://source.unsplash.com/400x400/?cat', // قطة
633
+ 'https://source.unsplash.com/400x400/?dog', // كلب
634
+ 'https://source.unsplash.com/400x400/?lion', // أسد
635
+ 'https://source.unsplash.com/400x400/?elephant', // فيل
636
+ 'https://source.unsplash.com/400x400/?monkey', // قرد
637
+ 'https://source.unsplash.com/400x400/?giraffe', // زرافة
638
+ 'https://source.unsplash.com/400x400/?tiger', // نمر
639
+ 'https://source.unsplash.com/400x400/?bear', // دب
640
+ 'https://source.unsplash.com/400x400/?fish', // سمكة
641
+ 'https://source.unsplash.com/400x400/?bird', // طائر
642
+ 'https://source.unsplash.com/400x400/?rabbit', // أرنب
643
+ 'https://source.unsplash.com/400x400/?sheep' // خروف
644
+ ];
645
+
646
+ // Memory game levels with image pairs
647
+ // كل مستوى يحدد عدد أزواج الصور، وسيتم اختيار الصور عشوائياً من القائمة أعلاه
648
+ const memoryGameLevels = [
649
+ { pairs: 8, grid: 'repeat(4, 1fr)' }, // Level 1: 16 cards (4x4)
650
+ { pairs: 10, grid: 'repeat(5, 1fr)' }, // Level 2: 20 cards (5x4)
651
+ { pairs: 12, grid: 'repeat(6, 1fr)' } // Level 3: 24 cards (6x4)
652
+ ];
653
+
654
+ const guessingGameData = [
655
+ { word: 'قطة', image: 'https://source.unsplash.com/400x400/?cat', options: ['قطة', 'كلب', 'أسد', 'طائر'] },
656
+ { word: 'تفاح', image: 'https://source.unsplash.com/400x400/?apple', options: ['برتقال', 'موز', 'تفاح', 'فراولة'] },
657
+ { word: 'كتاب', image: 'https://source.unsplash.com/400x400/?book', options: ['قلم', 'دفتر', 'كتاب', 'ممحاة'] },
658
+ { word: 'شمس', image: 'https://source.unsplash.com/400x400/?sun', options: ['قمر', 'نجمة', 'سحابة', 'شمس'] }
659
+ ];
660
+
661
+ // Data for the new shadow matching game
662
+ const shadowGameData = [
663
+ { animal: 'دب', image: 'https://source.unsplash.com/400x400/?bear', shadow: 'https://placehold.co/400x400/000000/000000?text=bear-shadow' },
664
+ { animal: 'أرنب', image: 'https://source.unsplash.com/400x400/?rabbit', shadow: 'https://placehold.co/400x400/000000/000000?text=rabbit-shadow' },
665
+ { animal: 'ثعلب', image: 'https://source.unsplash.com/400x400/?fox', shadow: 'https://placehold.co/400x400/000000/000000?text=fox-shadow' },
666
+ { animal: 'غزال', image: 'https://source.unsplash.com/400x400/?deer', shadow: 'https://placehold.co/400x400/000000/000000?text=deer-shadow' },
667
+ { animal: 'بومة', image: 'https://source.unsplash.com/400x400/?owl', shadow: 'https://placehold.co/400x400/000000/000000?text=owl-shadow' },
668
+ { animal: 'نمر', image: 'https://source.unsplash.com/400x400/?tiger', shadow: 'https://placehold.co/400x400/000000/000000?text=tiger-shadow' },
669
+ { animal: 'ذئب', image: 'https://source.unsplash.com/400x400/?wolf', shadow: 'https://placehold.co/400x400/000000/000000?text=wolf-shadow' },
670
+ { animal: 'خنزير', image: 'https://source.unsplash.com/400x400/?boar', shadow: 'https://placehold.co/400x400/000000/000000?text=boar-shadow' },
671
+ { animal: 'سنجاب', image: 'https://source.unsplash.com/400x400/?squirrel', shadow: 'https://placehold.co/400x400/000000/000000?text=squirrel-shadow' },
672
+ ];
673
+
674
+ const numberGameData = numbersData.slice(0, 6);
675
+ const letterGameData = tifinaghData.slice(0, 6);
676
+
677
+ const colorsData = [
678
+ { word: 'أحمر', color: '#EF5350' },
679
+ { word: 'أزرق', color: '#42A5F5' },
680
+ { word: 'أصفر', color: '#FFEE58' },
681
+ { word: 'أخضر', color: '#66BB6A' },
682
+ { word: 'برتقالي', color: '#FFA726' },
683
+ { word: 'بنفسجي', color: '#AB47BC' },
684
+ { word: 'وردي', color: '#EC407A' },
685
+ { word: 'بني', color: '#8D6E63' },
686
+ { word: 'أسود', color: '#263238' },
687
+ { word: 'أبيض', color: '#E0E0E0', textColor: '#263238' }
688
+ ];
689
+
690
+ const storiesData = [
691
+ {
692
+ title: 'الأرنب السريع',
693
+ pages: [
694
+ {
695
+ text: 'كان هناك أرنب صغير يدعى "فلاش" يحب الركض في الغابة. كان فلاش أسرع أرنب على الإطلاق، لكنه كان مغروراً بعض الشيء.',
696
+ image: 'https://source.unsplash.com/400x400/?rabbit,forest',
697
+ audio: 'https://cdn.jsdelivr.net/gh/google-samples/media/text-to-speech/ar-MA/الأرنب-السريع-1.mp3'
698
+ },
699
+ {
700
+ text: 'في أحد الأيام، تحدى فلاش السلحفاة "سلو" في سباق. ضحك فلاش وقال: "أنا سأفوز بالتأكيد!"',
701
+ image: 'https://source.unsplash.com/400x400/?rabbit,turtle,race',
702
+ audio: 'https://cdn.jsdelivr.net/gh/google-samples/media/text-to-speech/ar-MA/الأرنب-السريع-2.mp3'
703
+ },
704
+ {
705
+ text: 'بدأ السباق، وركض فلاش بسرعة كبيرة. رأى شجرة تفاح لذيذة وقرر أن يأخذ قسطاً من الراحة ويتناول بعض التفاح. نام فلاش تحت الشجرة.',
706
+ image: 'https://source.unsplash.com/400x400/?apple,tree,sleep',
707
+ audio: 'https://cdn.jsdelivr.net/gh/google-samples/media/text-to-speech/ar-MA/الأرنب-السريع-3.mp3'
708
+ },
709
+ {
710
+ text: 'استمرت السلحفاة سلو في المشي ببطء وثبات، ولم تتوقف أبداً. مرت بجانب فلاش النائم ووصلت إلى خط النهاية أولاً.',
711
+ image: 'https://source.unsplash.com/400x400/?turtle,finish,line',
712
+ audio: 'https://cdn.jsdelivr.net/gh/google-samples/media/text-to-speech/ar-MA/الأرنب-السريع-4.mp3'
713
+ },
714
+ {
715
+ text: 'استيقظ فلاش متأخراً وركض بأقصى سرعة، لكنه وجد سلو تنتظره عند خط النهاية. تعلم فلاش درساً مهماً: "البطء والثبات يفوزان بالسباق".',
716
+ image: 'https://source.unsplash.com/400x400/?rabbit,sad',
717
+ audio: 'https://cdn.jsdelivr.net/gh/google-samples/media/text-to-speech/ar-MA/الأرنب-السريع-5.mp3'
718
+ }
719
+ ]
720
  }
721
+ ];
722
+
723
+ let storyState = {
724
+ currentStory: null,
725
+ currentPage: 0
726
+ };
727
+
728
+
729
+ // Store HTML content for each page to avoid re-rendering
730
+ const pages = {
731
+ 'main': createMainPage(),
732
+ 'alphabet': createContentPage('حروف و كلمات', tifinaghData, true, 'main'),
733
+ 'numbers': createContentPage('الأرقام', numbersData, false, 'main'),
734
+ 'schoolSupplies': createContentPage('أدوات مدرسية', schoolSuppliesData, false, 'main'),
735
+ 'seasons': createContentPage('فصول السنة', seasonsData, false, 'main'),
736
+ 'animals': createContentPage('حيوانات', animalsData, false, 'main'),
737
+ 'fruitsAndVegetables': createFruitsAndVegetablesPage(),
738
+ 'fruits': createContentPage('الفواكه', fruitsData, false, 'fruitsAndVegetables'),
739
+ 'vegetables': createContentPage('الخضروات', vegetablesData, false, 'fruitsAndVegetables'),
740
+ 'months': createContentPage('أشهر السنة', monthsData, false, 'main'),
741
+ 'family': createContentPage('العائلة', familyData, false, 'main'),
742
+ 'bodyParts': createContentPage('أعضاء الجسم', bodyPartsData, false, 'main'),
743
+ 'colors': createColorsPage(),
744
+ 'stories': createStoriesListPage(),
745
+ 'games': createGamesPage()
746
+ };
747
 
748
+ // Function to create main page HTML
749
  function createMainPage() {
750
  return `
751
  <div class="container">
 
759
  </svg>
760
  </header>
761
  <main class="grid-container">
762
+ <a href="#" onclick="handleCardClick(event)" data-page="schoolSupplies" data-text="أدوات مدرسية" class="card" style="background-image: url('https://source.unsplash.com/400x400/?school,supplies');">
 
763
  <span class="card-text">أدوات مدرسية</span>
764
  </a>
765
+ <a href="#" onclick="handleCardClick(event)" data-page="alphabet" data-text="حروف و كلمات" class="card" style="background-image: url('https://source.unsplash.com/400x400/?alphabet,letters');">
 
766
  <span class="card-text">حروف و كلمات</span>
767
  </a>
768
+ <a href="#" onclick="handleCardClick(event)" data-page="seasons" data-text="فصول السنة" class="card" style="background-image: url('https://source.unsplash.com/400x400/?seasons');">
 
769
  <span class="card-text">فصول السنة</span>
770
  </a>
771
+ <a href="#" onclick="handleCardClick(event)" data-page="numbers" data-text="الأرقام" class="card" style="background-image: url('https://source.unsplash.com/400x400/?numbers,math');">
 
772
  <span class="card-text">الأرقام</span>
773
  </a>
774
+ <a href="#" onclick="handleCardClick(event)" data-page="fruitsAndVegetables" data-text="خضر وفواكه" class="card" style="background-image: url('https://source.unsplash.com/400x400/?fruits,vegetables');">
 
775
  <span class="card-text">خضر وفواكه</span>
776
  </a>
777
+ <a href="#" onclick="handleCardClick(event)" data-page="animals" data-text="حيوانات" class="card" style="background-image: url('https://source.unsplash.com/400x400/?animals');">
 
778
  <span class="card-text">حيوانات</span>
779
  </a>
780
+ <a href="#" onclick="handleCardClick(event)" data-page="family" data-text="العائلة" class="card" style="background-image: url('https://source.unsplash.com/400x400/?family');">
 
781
  <span class="card-text">العائلة</span>
782
  </a>
783
+ <a href="#" onclick="handleCardClick(event)" data-page="months" data-text="أشهر السنة" class="card" style="background-image: url('https://source.unsplash.com/400x400/?calendar');">
 
784
  <span class="card-text">أشهر السنة</span>
785
  </a>
786
+ <a href="#" onclick="handleCardClick(event)" data-page="bodyParts" data-text="أعضاء الجسم" class="card" style="background-image: url('https://source.unsplash.com/400x400/?human,body');">
787
+ <span class="card-text">أعضاء الجسم</span>
 
788
  </a>
789
+ <a href="#" onclick="handleCardClick(event)" data-page="colors" data-text="الألوان" class="card" style="background-image: url('https://source.unsplash.com/400x400/?colors,paint');">
790
+ <span class="card-text">الألوان</span>
791
+ </a>
792
+ <a href="#" onclick="handleCardClick(event)" data-page="stories" data-text="قصص" class="card" style="background-image: url('https://source.unsplash.com/400x400/?storybook,children');">
793
+ <span class="card-text">قصص</span>
794
+ </a>
795
+ <a href="#" onclick="handleCardClick(event)" data-page="games" data-text="ألعاب تعليمية" class="card" style="background-image: url('https://source.unsplash.com/400x400/?toys,kids,education');">
796
  <span class="card-text">ألعاب تعليمية</span>
797
  </a>
798
  </main>
 
800
  `;
801
  }
802
 
803
+ // Function to create a generic content page
804
+ function createContentPage(title, data, isAlphabet, backPage) {
805
+ let content = `
806
+ <div class="container">
807
+ <header class="header">
808
+ <svg onclick="handleBackClick('${backPage}')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
809
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
810
+ </svg>
811
+ <div class="text-xl font-bold">${title}</div>
812
+ <div class="w-6"></div>
813
+ </header>
814
+ <main class="grid-container">
815
+ `;
816
+ data.forEach(item => {
817
+ const badge = isAlphabet ? `<span class="letter-badge">${item.letter}</span>` : '';
818
+ const image = `<img src="${item.image}" alt="${item.word}" class="word-image">`;
819
+ const wordLabel = `<div class="word-label text-xl">${item.word}</div>`;
820
+ content += `
821
+ <div class="interactive-card" onclick="speak('${item.word}')">
822
+ ${isAlphabet ? badge : ''}
823
+ ${item.image ? image : ''}
824
+ ${wordLabel}
825
+ </div>
826
+ `;
827
+ });
828
+ content += `
829
+ </main>
830
+ </div>
831
+ `;
832
+ return content;
833
+ }
834
+
835
+ // Function to create fruits and vegetables sub-page
836
+ function createFruitsAndVegetablesPage() {
837
+ return `
838
+ <div class="container">
839
+ <header class="header">
840
+ <svg onclick="handleBackClick('main')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
841
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
842
+ </svg>
843
+ <div class="text-xl font-bold">خضر وفواكه</div>
844
+ <div class="w-6"></div>
845
+ </header>
846
+ <main class="grid-container">
847
+ <a href="#" onclick="handleCardClick(event)" data-page="vegetables" data-text="الخضر" class="card" style="background-image: url('https://source.unsplash.com/400x400/?vegetables,carrots,broccoli');">
848
+ <span class="card-text">الخضر</span>
849
+ </a>
850
+ <a href="#" onclick="handleCardClick(event)" data-page="fruits" data-text="الفواكه" class="card" style="background-image: url('https://source.unsplash.com/400x400/?fruits,apples,oranges');">
851
+ <span class="card-text">الفواكه</span>
852
+ </a>
853
+ </main>
854
+ </div>
855
+ `;
856
+ }
857
+
858
+ // Function to create games selection page
859
+ function createGamesPage() {
860
+ return `
861
+ <div class="container">
862
+ <header class="header">
863
+ <svg onclick="handleBackClick('games')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
864
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
865
+ </svg>
866
+ <div class="text-xl font-bold">ألعاب تعليمية</div>
867
+ <div class="w-6"></div>
868
+ </header>
869
+ <main class="grid-container">
870
+ <a href="#" onclick="startGame('memory')" class="card" style="background-image: url('https://source.unsplash.com/400x400/?memory,brain');">
871
+ <span class="card-text">لعبة الذاكرة</span>
872
+ </a>
873
+ <a href="#" onclick="startGame('guessing')" class="card" style="background-image: url('https://source.unsplash.com/400x400/?guess,question');">
874
+ <span class="card-text">لعبة التخمين</span>
875
+ </a>
876
+ <a href="#" onclick="startGame('shadow')" class="card" style="background-image: url('https://source.unsplash.com/400x400/?shadow,animals');">
877
+ <span class="card-text">لعبة الظل</span>
878
+ </a>
879
+ <a href="#" onclick="startGame('letters')" class="card" style="background-image: url('https://source.unsplash.com/400x400/?abc,letters');">
880
+ <span class="card-text">لعبة الحروف</span>
881
+ </a>
882
+ </main>
883
+ </div>
884
+ `;
885
+ }
886
+
887
+ // Function to create colors page
888
+ function createColorsPage() {
889
+ let content = `
890
+ <div class="container">
891
+ <header class="header">
892
+ <svg onclick="handleBackClick('main')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
893
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
894
+ </svg>
895
+ <div class="text-xl font-bold">الألوان</div>
896
+ <div class="w-6"></div>
897
+ </header>
898
+ <main class="grid-container">
899
+ `;
900
+ colorsData.forEach(color => {
901
+ const textColor = color.textColor || 'white';
902
+ content += `
903
+ <div class="color-card" onclick="speakColor('${color.word}')" style="background-color: ${color.color}; color: ${textColor};">
904
+ <span class="text-xl">${color.word}</span>
905
+ </div>
906
+ `;
907
+ });
908
+ content += `
909
+ </main>
910
+ </div>
911
+ `;
912
+ return content;
913
+ }
914
+
915
+ function speakColor(colorName) {
916
+ const utterance = new SpeechSynthesisUtterance(colorName);
917
+ utterance.lang = 'ar-MA';
918
+ window.speechSynthesis.speak(utterance);
919
+ }
920
+
921
+ // Function to create stories list page
922
+ function createStoriesListPage() {
923
+ let content = `
924
+ <div class="container">
925
+ <header class="header">
926
+ <svg onclick="handleBackClick('main')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
927
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
928
+ </svg>
929
+ <div class="text-xl font-bold">قصص</div>
930
+ <div class="w-6"></div>
931
+ </header>
932
+ <main class="grid-container">
933
+ `;
934
+ storiesData.forEach((story, index) => {
935
+ content += `
936
+ <a href="#" onclick="readStory(${index})" class="card" style="background-image: url('${story.pages[0].image}');">
937
+ <span class="card-text">${story.title}</span>
938
+ </a>
939
+ `;
940
+ });
941
+ content += `
942
+ </main>
943
+ </div>
944
+ `;
945
+ return content;
946
+ }
947
+
948
+ function readStory(storyIndex) {
949
+ storyState.currentStory = storiesData[storyIndex];
950
+ storyState.currentPage = 0;
951
+ showStoryPage();
952
+ }
953
+
954
+ function showStoryPage() {
955
+ const story = storyState.currentStory;
956
+ const page = story.pages[storyState.currentPage];
957
+ const appContainer = document.getElementById('app-container');
958
+ const storyAudio = document.getElementById('story-audio');
959
+
960
+ appContainer.innerHTML = `
961
+ <div class="container">
962
+ <header class="header">
963
+ <svg onclick="handleBackClick('stories')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
964
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
965
+ </svg>
966
+ <div class="text-xl font-bold">${story.title}</div>
967
+ <div class="w-6"></div>
968
+ </header>
969
+ <main class="story-container">
970
+ <img src="${page.image}" alt="Story image" class="story-image">
971
+ <p class="story-text">${page.text}</p>
972
+ <div class="story-nav-buttons">
973
+ <button onclick="previousStoryPage()" class="game-button">السابق</button>
974
+ <button onclick="nextStoryPage()" class="game-button">التالي</button>
975
+ </div>
976
+ </main>
977
+ </div>
978
+ `;
979
+
980
+ if (page.audio) {
981
+ storyAudio.src = page.audio;
982
+ storyAudio.play();
983
+ }
984
+ }
985
+
986
+ function nextStoryPage() {
987
+ const storyAudio = document.getElementById('story-audio');
988
+ storyAudio.pause();
989
+ if (storyState.currentPage < storyState.currentStory.pages.length - 1) {
990
+ storyState.currentPage++;
991
+ showStoryPage();
992
+ } else {
993
+ showMessage('نهاية القصة!');
994
+ }
995
+ }
996
+
997
+ function previousStoryPage() {
998
+ const storyAudio = document.getElementById('story-audio');
999
+ storyAudio.pause();
1000
+ if (storyState.currentPage > 0) {
1001
+ storyState.currentPage--;
1002
+ showStoryPage();
1003
+ } else {
1004
+ showMessage('هذه هي الصفحة الأولى من القصة.');
1005
+ }
1006
+ }
1007
+
1008
+ // Function to start a specific game
1009
+ function startGame(gameName) {
1010
+ currentPage = `game-${gameName}`;
1011
+ const appContainer = document.getElementById('app-container');
1012
+ if (gameName === 'memory') {
1013
+ appContainer.innerHTML = createMemoryGamePage();
1014
+ initMemoryGame();
1015
+ } else if (gameName === 'guessing') {
1016
+ appContainer.innerHTML = createGuessingGamePage();
1017
+ initGuessingGame();
1018
+ } else if (gameName === 'shadow') {
1019
+ appContainer.innerHTML = createShadowGamePage();
1020
+ initShadowGame();
1021
+ } else if (gameName === 'letters') {
1022
+ appContainer.innerHTML = createLetterGamePage();
1023
+ initLetterGame();
1024
+ }
1025
+ }
1026
+
1027
+ // Memory Game logic
1028
+ let memoryGame = {
1029
+ level: 0,
1030
+ cards: [],
1031
+ flippedCards: [],
1032
+ matchesFound: 0,
1033
+ canFlip: true,
1034
+ timer: null,
1035
+ timeRemaining: 119
1036
+ };
1037
+
1038
+ function createMemoryGamePage() {
1039
+ return `
1040
+ <div class="container">
1041
+ <header class="header">
1042
+ <svg onclick="handleBackClick('games')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1043
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
1044
+ </svg>
1045
+ <div class="text-xl font-bold">لعبة الذاكرة</div>
1046
+ <div class="w-6"></div>
1047
+ </header>
1048
+ <main class="flex flex-col items-center p-4">
1049
+ <div id="game-info">
1050
+ <div class="timer-display" id="timer-display">01:59</div>
1051
+ <div class="text-center font-bold">المستوى: <span id="level-display">1</span></div>
1052
+ </div>
1053
+ <div id="game-board" class="grid gap-3"></div>
1054
+ </main>
1055
+ </div>
1056
+ `;
1057
+ }
1058
+
1059
+ function initMemoryGame() {
1060
+ memoryGame.level = 0;
1061
+ loadMemoryLevel();
1062
+ }
1063
+
1064
+ function startTimer() {
1065
+ clearInterval(memoryGame.timer);
1066
+ memoryGame.timeRemaining = 119;
1067
+ const timerDisplay = document.getElementById('timer-display');
1068
+ timerDisplay.style.color = '#263238'; // Reset color
1069
+
1070
+ memoryGame.timer = setInterval(() => {
1071
+ memoryGame.timeRemaining--;
1072
+ const minutes = Math.floor(memoryGame.timeRemaining / 60);
1073
+ const seconds = memoryGame.timeRemaining % 60;
1074
+ timerDisplay.innerText = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
1075
+
1076
+ if (memoryGame.timeRemaining <= 10) {
1077
+ timerDisplay.style.color = '#FF5252';
1078
+ }
1079
+
1080
+ if (memoryGame.timeRemaining <= 0) {
1081
+ clearInterval(memoryGame.timer);
1082
+ showMessage('انتهى الوقت! لقد فشلت في هذا المستوى.', () => {
1083
+ // Add a replay button on failure
1084
+ const messageBox = document.getElementById('message-box');
1085
+ let replayButton = document.createElement('button');
1086
+ replayButton.innerText = 'إعادة المحاولة';
1087
+ replayButton.onclick = () => {
1088
+ closeMessage();
1089
+ loadMemoryLevel();
1090
+ };
1091
+ messageBox.appendChild(replayButton);
1092
+ });
1093
+ }
1094
+ }, 1000);
1095
+ }
1096
+
1097
+ function loadMemoryLevel() {
1098
+ if (memoryGame.level >= memoryGameLevels.length) {
1099
+ showMessage('لقد أكملت جميع المستويات! أحسنت!');
1100
+ clearInterval(memoryGame.timer);
1101
+ return;
1102
+ }
1103
+
1104
+ const levelData = memoryGameLevels[memoryGame.level];
1105
+ const selectedImages = memoryGameImages.slice(0, levelData.pairs);
1106
+ let cardsData = selectedImages.concat(selectedImages);
1107
+ cardsData.sort(() => Math.random() - 0.5);
1108
+
1109
+ memoryGame.cards = cardsData;
1110
+ memoryGame.flippedCards = [];
1111
+ memoryGame.matchesFound = 0;
1112
+ memoryGame.canFlip = true;
1113
+
1114
+ const board = document.getElementById('game-board');
1115
+ board.innerHTML = '';
1116
+ board.style.gridTemplateColumns = levelData.grid; // Set grid layout
1117
+
1118
+ document.getElementById('level-display').innerText = memoryGame.level + 1;
1119
+
1120
+ cardsData.forEach((image, index) => {
1121
+ const cardElement = document.createElement('div');
1122
+ cardElement.classList.add('game-card');
1123
+ cardElement.dataset.index = index;
1124
+
1125
+ // Front and back of the card
1126
+ cardElement.innerHTML = `
1127
+ <div class="game-card-front" style="background-image: url('${image}');"></div>
1128
+ <div class="game-card-back"></div>
1129
+ `;
1130
+
1131
+ cardElement.addEventListener('click', () => flipCard(cardElement, image));
1132
+ board.appendChild(cardElement);
1133
+ });
1134
+
1135
+ startTimer();
1136
+ }
1137
+
1138
+ function flipCard(cardElement, image) {
1139
+ if (!memoryGame.canFlip || cardElement.classList.contains('flipped') || cardElement.classList.contains('matched')) {
1140
+ return;
1141
+ }
1142
+
1143
+ cardElement.classList.add('flipped');
1144
+ memoryGame.flippedCards.push({ element: cardElement, image: image });
1145
+
1146
+ if (memoryGame.flippedCards.length === 2) {
1147
+ memoryGame.canFlip = false;
1148
+ const [card1, card2] = memoryGame.flippedCards;
1149
+ if (card1.image === card2.image) {
1150
+ // Match found
1151
+ card1.element.classList.add('matched');
1152
+ card2.element.classList.add('matched');
1153
+ memoryGame.matchesFound++;
1154
+ speak('أحسنت!');
1155
+ memoryGame.flippedCards = [];
1156
+ memoryGame.canFlip = true;
1157
+ if (memoryGame.matchesFound === memoryGame.cards.length / 2) {
1158
+ clearInterval(memoryGame.timer);
1159
+ setTimeout(() => {
1160
+ memoryGame.level++;
1161
+ if (memoryGame.level < memoryGameLevels.length) {
1162
+ showMessage(`أحسنت! لقد أكملت المستوى ${memoryGame.level}. لننتقل إلى المستوى التالي.`);
1163
+ setTimeout(loadMemoryLevel, 2000);
1164
+ } else {
1165
+ showMessage('لقد أكملت جميع المستويات! أحسنت!');
1166
+ }
1167
+ }, 500);
1168
+ }
1169
+ } else {
1170
+ // No match
1171
+ setTimeout(() => {
1172
+ card1.element.classList.remove('flipped');
1173
+ card2.element.classList.remove('flipped');
1174
+ memoryGame.flippedCards = [];
1175
+ memoryGame.canFlip = true;
1176
+ }, 1000);
1177
+ }
1178
+ }
1179
+ }
1180
+
1181
+ // Guessing Game logic
1182
+ let guessingGame = {
1183
+ currentQuestion: {},
1184
+ score: 0
1185
+ };
1186
+
1187
+ function createGuessingGamePage() {
1188
+ return `
1189
+ <div class="container">
1190
+ <header class="header">
1191
+ <svg onclick="handleBackClick('games')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1192
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
1193
+ </svg>
1194
+ <div class="text-xl font-bold">لعبة التخمين</div>
1195
+ <div class="w-6"></div>
1196
+ </header>
1197
+ <main class="flex flex-col items-center p-4">
1198
+ <div id="game-container" class="flex flex-col items-center">
1199
+ <div id="question-box" class="question-box">
1200
+ <img id="question-image" class="question-image" src="" alt="Question Image">
1201
+ <p class="text-2xl font-bold">ما هذه الكلمة؟</p>
1202
+ </div>
1203
+ <div id="options-grid" class="options-grid"></div>
1204
+ <div id="guessing-result" class="text-2xl font-bold mt-4"></div>
1205
+ </div>
1206
+ </main>
1207
+ </div>
1208
+ `;
1209
+ }
1210
+
1211
+ function initGuessingGame() {
1212
+ guessingGame.score = 0;
1213
+ document.getElementById('guessing-result').innerText = '';
1214
+ loadGuessingQuestion();
1215
+ }
1216
+
1217
+ function loadGuessingQuestion() {
1218
+ const randomIndex = Math.floor(Math.random() * guessingGameData.length);
1219
+ guessingGame.currentQuestion = guessingGameData[randomIndex];
1220
+
1221
+ document.getElementById('question-image').src = guessingGame.currentQuestion.image;
1222
+ const optionsGrid = document.getElementById('options-grid');
1223
+ optionsGrid.innerHTML = '';
1224
+
1225
+ const shuffledOptions = [...guessingGame.currentQuestion.options].sort(() => Math.random() - 0.5);
1226
+
1227
+ shuffledOptions.forEach(option => {
1228
+ const button = document.createElement('button');
1229
+ button.classList.add('option-button');
1230
+ button.innerText = option;
1231
+ button.onclick = () => checkGuess(option);
1232
+ optionsGrid.appendChild(button);
1233
+ });
1234
+ }
1235
+
1236
+ function checkGuess(guess) {
1237
+ const resultDiv = document.getElementById('guessing-result');
1238
+ if (guess === guessingGame.currentQuestion.word) {
1239
+ resultDiv.innerText = 'صحيح! أحسنت.';
1240
+ resultDiv.style.color = '#4CAF50';
1241
+ speak('صحيح! أحسنت.');
1242
+ setTimeout(loadGuessingQuestion, 1500);
1243
+ } else {
1244
+ resultDiv.innerText = 'خطأ. حاول مرة أخرى.';
1245
+ resultDiv.style.color = '#FF5252';
1246
+ speak('خطأ. حاول مرة أخرى.');
1247
+ }
1248
+ }
1249
+
1250
+ // Shadow Game Logic
1251
+ let shadowGame = {
1252
+ currentAnimals: [],
1253
+ matchedPairs: 0
1254
+ };
1255
+
1256
+ function createShadowGamePage() {
1257
+ return `
1258
+ <div class="container">
1259
+ <header class="header">
1260
+ <svg onclick="handleBackClick('games')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1261
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
1262
+ </svg>
1263
+ <div class="text-xl font-bold">لعبة الظل</div>
1264
+ <div class="w-6"></div>
1265
+ </header>
1266
+ <main class="flex flex-col items-center p-4">
1267
+ <div id="shadow-game-container">
1268
+ <p class="text-2xl font-bold mb-4">اسحب الحيوان إلى ظله الصحيح!</p>
1269
+ <div id="shadow-game-top"></div>
1270
+ <div id="shadow-game-bottom"></div>
1271
+ <button id="reset-button" class="game-button mt-4" onclick="initShadowGame()">إعادة اللعب</button>
1272
+ </div>
1273
+ </main>
1274
+ </div>
1275
+ `;
1276
+ }
1277
+
1278
+ function initShadowGame() {
1279
+ shadowGame.matchedPairs = 0;
1280
+ const shuffledAnimals = [...shadowGameData].sort(() => 0.5 - Math.random()).slice(0, 4);
1281
+ shadowGame.currentAnimals = shuffledAnimals;
1282
+
1283
+ const topContainer = document.getElementById('shadow-game-top');
1284
+ const bottomContainer = document.getElementById('shadow-game-bottom');
1285
+
1286
+ topContainer.innerHTML = '';
1287
+ bottomContainer.innerHTML = '';
1288
+
1289
+ const shuffledShadows = [...shuffledAnimals].sort(() => 0.5 - Math.random());
1290
+
1291
+ shuffledShadows.forEach(animal => {
1292
+ const shadowBox = document.createElement('div');
1293
+ shadowBox.classList.add('shadow-box');
1294
+ shadowBox.dataset.animal = animal.animal;
1295
+ shadowBox.innerHTML = `<img src="${animal.image}" class="shadow-image" alt="Shadow of ${animal.animal}">`;
1296
+ topContainer.appendChild(shadowBox);
1297
+ });
1298
+
1299
+ shuffledAnimals.forEach(animal => {
1300
+ const animalImage = document.createElement('div');
1301
+ animalImage.classList.add('draggable-animal');
1302
+ animalImage.dataset.animal = animal.animal;
1303
+ animalImage.style.backgroundImage = `url('${animal.image}')`;
1304
+ animalImage.draggable = true;
1305
+
1306
+ animalImage.addEventListener('dragstart', (e) => {
1307
+ e.dataTransfer.setData('text/plain', e.target.dataset.animal);
1308
+ e.target.classList.add('dragging');
1309
+ });
1310
+ animalImage.addEventListener('dragend', (e) => {
1311
+ e.target.classList.remove('dragging');
1312
+ });
1313
+
1314
+ bottomContainer.appendChild(animalImage);
1315
+ });
1316
+
1317
+ document.querySelectorAll('.shadow-box').forEach(box => {
1318
+ box.addEventListener('dragover', (e) => e.preventDefault());
1319
+ box.addEventListener('drop', (e) => {
1320
+ e.preventDefault();
1321
+ const draggedAnimal = e.dataTransfer.getData('text/plain');
1322
+ if (draggedAnimal === e.target.closest('.shadow-box').dataset.animal) {
1323
+ e.target.closest('.shadow-box').classList.add('matched-correctly');
1324
+ e.target.closest('.shadow-box').querySelector('.shadow-image').style.filter = 'none'; // Revert to color image
1325
+ const animalElement = document.querySelector(`.draggable-animal[data-animal="${draggedAnimal}"]`);
1326
+ if (animalElement) {
1327
+ animalElement.style.display = 'none';
1328
+ }
1329
+ speak('أحسنت!');
1330
+ shadowGame.matchedPairs++;
1331
+ if (shadowGame.matchedPairs === shadowGame.currentAnimals.length) {
1332
+ setTimeout(() => showMessage('أحسنت! لقد أكملت هذا المستوى.', () => initShadowGame()), 1000);
1333
+ }
1334
+ } else {
1335
+ speak('خطأ، حاول مرة أخرى.');
1336
+ }
1337
+ });
1338
+ });
1339
+ }
1340
+
1341
+ // Letter Game logic
1342
+ let letterGame = {
1343
+ currentIndex: 0
1344
+ };
1345
+
1346
+ function createLetterGamePage() {
1347
+ return `
1348
+ <div class="container">
1349
+ <header class="header">
1350
+ <svg onclick="handleBackClick('games')" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white cursor-pointer" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1351
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
1352
+ </svg>
1353
+ <div class="text-xl font-bold">لعبة الحروف</div>
1354
+ <div class="w-6"></div>
1355
+ </header>
1356
+ <main class="flex flex-col items-center p-4">
1357
+ <div id="game-container" class="flex flex-col items-center">
1358
+ <div class="interactive-card my-8 w-48 h-48" onclick="speakCurrentLetter()">
1359
+ <div id="letter-display" class="word-label text-4xl" style="font-family: 'Tifinagh', sans-serif;"></div>
1360
+ </div>
1361
+ <div class="flex space-x-4">
1362
+ <button onclick="previousLetter()" class="game-button">السابق</button>
1363
+ <button onclick="nextLetter()" class="game-button">التالي</button>
1364
+ </div>
1365
+ </div>
1366
+ </main>
1367
+ </div>
1368
+ `;
1369
+ }
1370
+
1371
+ function initLetterGame() {
1372
+ letterGame.currentIndex = 0;
1373
+ updateLetterDisplay();
1374
+ }
1375
+
1376
+ function updateLetterDisplay() {
1377
+ const currentItem = letterGameData[letterGame.currentIndex];
1378
+ document.getElementById('letter-display').innerText = currentItem.letter;
1379
+ speakCurrentLetter();
1380
+ }
1381
+
1382
+ function speakCurrentLetter() {
1383
+ const currentItem = letterGameData[letterGame.currentIndex];
1384
+ if (currentItem) {
1385
+ speak(currentItem.word);
1386
+ }
1387
+ }
1388
+
1389
+ function nextLetter() {
1390
+ letterGame.currentIndex = (letterGame.currentIndex + 1) % letterGameData.length;
1391
+ updateLetterDisplay();
1392
+ }
1393
+
1394
+ function previousLetter() {
1395
+ letterGame.currentIndex = (letterGame.currentIndex - 1 + letterGameData.length) % letterGameData.length;
1396
+ updateLetterDisplay();
1397
+ }
1398
+
1399
+
1400
+ // Global functions for navigation and speech
1401
+ function speak(text) {
1402
+ if ('speechSynthesis' in window) {
1403
+ const message = new SpeechSynthesisUtterance(text);
1404
+ message.lang = 'ar-MA';
1405
+ window.speechSynthesis.speak(message);
1406
+ } else {
1407
+ showMessage("متصفحك لا يدعم خاصية النطق الصوتي.");
1408
+ }
1409
+ }
1410
+
1411
+ function handleCardClick(event) {
1412
+ event.preventDefault();
1413
+ const card = event.currentTarget;
1414
+ const pageName = card.getAttribute('data-page');
1415
+ const textToSpeak = card.getAttribute('data-text');
1416
+ if (textToSpeak) {
1417
+ speak(textToSpeak);
1418
+ }
1419
+ showPage(pageName);
1420
+ }
1421
+
1422
+ function handleBackClick(pageName) {
1423
+ // Play "رجوع" sound before going back
1424
+ speak('رجوع');
1425
+ setTimeout(() => {
1426
+ showPage(pageName);
1427
+ }, 500); // Small delay to allow audio to start
1428
+ }
1429
+
1430
+ function showPage(pageName) {
1431
+ currentPage = pageName;
1432
+ const appContainer = document.getElementById('app-container');
1433
+ const pageContent = pages[pageName];
1434
+ if (pageContent) {
1435
+ appContainer.innerHTML = pageContent;
1436
+ } else {
1437
+ showMessage('هذه الفئة غير متاحة حالياً.');
1438
+ }
1439
+ }
1440
+
1441
+ function showMessage(msg, onOk) {
1442
  const messageBox = document.getElementById('message-box');
1443
+ const messageText = document.getElementById('message-text');
1444
+ const okButton = messageBox.querySelector('button');
1445
+
1446
+ // Remove previous event listener
1447
+ const newOkButton = okButton.cloneNode(true);
1448
+ okButton.parentNode.replaceChild(newOkButton, okButton);
1449
+
1450
+ messageText.innerText = msg;
1451
+ newOkButton.onclick = () => {
1452
+ closeMessage();
1453
+ if (onOk) onOk();
1454
+ };
1455
  messageBox.style.display = 'block';
1456
  }
1457
+
1458
  function closeMessage() {
1459
  document.getElementById('message-box').style.display = 'none';
1460
  }
 
1464
  });
1465
  </script>
1466
  </body>
1467
+ </html>