ProCreations commited on
Commit
f0f0ff2
Β·
verified Β·
1 Parent(s): b048355

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +1439 -18
index.html CHANGED
@@ -1,19 +1,1440 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8"/>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
+ <title>AI Basics Learning Hub - Interactive Learning Platform</title>
7
+ <style>
8
+ /* ============ CSS Variables & Reset ============ */
9
+ :root {
10
+ --primary: #6366f1;
11
+ --primary-dark: #4f46e5;
12
+ --secondary: #8b5cf6;
13
+ --accent: #14b8a6;
14
+ --success: #10b981;
15
+ --error: #ef4444;
16
+ --warning: #f59e0b;
17
+ --text-primary: #1f2937;
18
+ --text-secondary: #6b7280;
19
+ --bg-primary: #ffffff;
20
+ --bg-secondary: #f9fafb;
21
+ --bg-tertiary: #f3f4f6;
22
+ --border: #e5e7eb;
23
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
24
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
25
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
26
+ --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
27
+ --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
28
+ --radius: 12px;
29
+ --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
30
+ }
31
+
32
+ /* Dark mode variables */
33
+ body.dark-mode {
34
+ --text-primary: #f9fafb;
35
+ --text-secondary: #d1d5db;
36
+ --bg-primary: #111827;
37
+ --bg-secondary: #1f2937;
38
+ --bg-tertiary: #374151;
39
+ --border: #4b5563;
40
+ --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
41
+ }
42
+
43
+ * {
44
+ margin: 0;
45
+ padding: 0;
46
+ box-sizing: border-box;
47
+ }
48
+
49
+ /* ============ Base Styles ============ */
50
+ body {
51
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
52
+ background: var(--bg-secondary);
53
+ color: var(--text-primary);
54
+ line-height: 1.6;
55
+ transition: var(--transition);
56
+ overflow-x: hidden;
57
+ }
58
+
59
+ /* Animated background pattern */
60
+ body::before {
61
+ content: '';
62
+ position: fixed;
63
+ top: 0;
64
+ left: 0;
65
+ right: 0;
66
+ bottom: 0;
67
+ background-image:
68
+ radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
69
+ radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
70
+ radial-gradient(circle at 40% 20%, rgba(20, 184, 166, 0.1) 0%, transparent 50%);
71
+ z-index: -1;
72
+ animation: backgroundShift 20s ease-in-out infinite;
73
+ }
74
+
75
+ @keyframes backgroundShift {
76
+ 0%, 100% { transform: translate(0, 0) scale(1); }
77
+ 25% { transform: translate(-20px, -20px) scale(1.1); }
78
+ 50% { transform: translate(20px, -10px) scale(0.95); }
79
+ 75% { transform: translate(-10px, 20px) scale(1.05); }
80
+ }
81
+
82
+ .container {
83
+ max-width: 1200px;
84
+ margin: 0 auto;
85
+ padding: 20px;
86
+ }
87
+
88
+ /* ============ Header Styles ============ */
89
+ header {
90
+ text-align: center;
91
+ margin-bottom: 40px;
92
+ padding: 40px 30px;
93
+ background: var(--bg-primary);
94
+ border-radius: 24px;
95
+ box-shadow: var(--shadow-lg);
96
+ position: relative;
97
+ overflow: hidden;
98
+ }
99
+
100
+ header::before {
101
+ content: '';
102
+ position: absolute;
103
+ top: -50%;
104
+ right: -50%;
105
+ width: 200%;
106
+ height: 200%;
107
+ background: var(--gradient);
108
+ opacity: 0.05;
109
+ transform: rotate(45deg);
110
+ animation: headerGradient 15s ease-in-out infinite;
111
+ }
112
+
113
+ @keyframes headerGradient {
114
+ 0%, 100% { transform: rotate(45deg) translateY(0); }
115
+ 50% { transform: rotate(45deg) translateY(-20px); }
116
+ }
117
+
118
+ h1 {
119
+ font-size: 2.5rem;
120
+ font-weight: 800;
121
+ background: var(--gradient);
122
+ -webkit-background-clip: text;
123
+ -webkit-text-fill-color: transparent;
124
+ background-clip: text;
125
+ margin-bottom: 10px;
126
+ position: relative;
127
+ }
128
+
129
+ .subtitle {
130
+ font-size: 1.1rem;
131
+ color: var(--text-secondary);
132
+ font-weight: 500;
133
+ }
134
+
135
+ /* ============ Navigation Tabs ============ */
136
+ .main-tabs {
137
+ display: flex;
138
+ justify-content: center;
139
+ align-items: center;
140
+ flex-wrap: wrap;
141
+ gap: 15px;
142
+ margin: 30px 0;
143
+ padding: 20px;
144
+ background: var(--bg-primary);
145
+ border-radius: 16px;
146
+ box-shadow: var(--shadow-md);
147
+ }
148
+
149
+ .main-tab {
150
+ padding: 12px 24px;
151
+ border: 2px solid transparent;
152
+ border-radius: 12px;
153
+ background: var(--bg-tertiary);
154
+ cursor: pointer;
155
+ font-weight: 600;
156
+ font-size: 1rem;
157
+ transition: var(--transition);
158
+ position: relative;
159
+ overflow: hidden;
160
+ }
161
+
162
+ .main-tab::before {
163
+ content: '';
164
+ position: absolute;
165
+ top: 50%;
166
+ left: 50%;
167
+ width: 0;
168
+ height: 0;
169
+ background: var(--gradient);
170
+ border-radius: 50%;
171
+ transform: translate(-50%, -50%);
172
+ transition: width 0.6s, height 0.6s;
173
+ }
174
+
175
+ .main-tab:hover {
176
+ transform: translateY(-2px);
177
+ box-shadow: var(--shadow-md);
178
+ }
179
+
180
+ .main-tab.active {
181
+ color: white;
182
+ background: var(--gradient);
183
+ box-shadow: var(--shadow-lg);
184
+ }
185
+
186
+ /* Dark mode toggle */
187
+ .dark-toggle {
188
+ margin-left: auto;
189
+ display: flex;
190
+ align-items: center;
191
+ gap: 10px;
192
+ padding: 8px 16px;
193
+ background: var(--bg-tertiary);
194
+ border-radius: 50px;
195
+ cursor: pointer;
196
+ transition: var(--transition);
197
+ }
198
+
199
+ .dark-toggle:hover {
200
+ background: var(--bg-secondary);
201
+ }
202
+
203
+ .toggle-switch {
204
+ position: relative;
205
+ width: 50px;
206
+ height: 26px;
207
+ }
208
+
209
+ .toggle-switch input {
210
+ opacity: 0;
211
+ width: 0;
212
+ height: 0;
213
+ }
214
+
215
+ .slider {
216
+ position: absolute;
217
+ cursor: pointer;
218
+ top: 0;
219
+ left: 0;
220
+ right: 0;
221
+ bottom: 0;
222
+ background: var(--border);
223
+ transition: 0.4s;
224
+ border-radius: 26px;
225
+ }
226
+
227
+ .slider:before {
228
+ position: absolute;
229
+ content: "";
230
+ height: 18px;
231
+ width: 18px;
232
+ left: 4px;
233
+ bottom: 4px;
234
+ background: white;
235
+ transition: 0.4s;
236
+ border-radius: 50%;
237
+ }
238
+
239
+ input:checked + .slider {
240
+ background: var(--primary);
241
+ }
242
+
243
+ input:checked + .slider:before {
244
+ transform: translateX(24px);
245
+ }
246
+
247
+ /* ============ Section Management ============ */
248
+ .section {
249
+ display: none;
250
+ opacity: 0;
251
+ transform: translateY(20px);
252
+ transition: opacity 0.3s, transform 0.3s;
253
+ }
254
+
255
+ .section.active {
256
+ display: block;
257
+ opacity: 1;
258
+ transform: translateY(0);
259
+ }
260
+
261
+ /* ============ Flashcards Section ============ */
262
+ .category-tabs {
263
+ display: flex;
264
+ justify-content: center;
265
+ flex-wrap: wrap;
266
+ gap: 12px;
267
+ margin-bottom: 30px;
268
+ padding: 20px;
269
+ background: var(--bg-primary);
270
+ border-radius: 16px;
271
+ box-shadow: var(--shadow-sm);
272
+ }
273
+
274
+ .category-tab {
275
+ padding: 10px 20px;
276
+ background: var(--bg-tertiary);
277
+ border: 2px solid transparent;
278
+ border-radius: 10px;
279
+ cursor: pointer;
280
+ font-weight: 600;
281
+ transition: var(--transition);
282
+ position: relative;
283
+ }
284
+
285
+ .category-tab:hover {
286
+ transform: translateY(-2px);
287
+ border-color: var(--primary);
288
+ }
289
+
290
+ .category-tab.active {
291
+ background: var(--primary);
292
+ color: white;
293
+ box-shadow: var(--shadow-md);
294
+ }
295
+
296
+ /* Progress indicator */
297
+ .progress-container {
298
+ margin-bottom: 25px;
299
+ background: var(--bg-primary);
300
+ padding: 20px;
301
+ border-radius: 16px;
302
+ box-shadow: var(--shadow-sm);
303
+ }
304
+
305
+ .progress {
306
+ height: 8px;
307
+ background: var(--bg-tertiary);
308
+ border-radius: 10px;
309
+ overflow: hidden;
310
+ margin-bottom: 15px;
311
+ }
312
+
313
+ .progress-bar {
314
+ height: 100%;
315
+ background: var(--gradient);
316
+ border-radius: 10px;
317
+ transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
318
+ position: relative;
319
+ overflow: hidden;
320
+ }
321
+
322
+ .progress-bar::after {
323
+ content: '';
324
+ position: absolute;
325
+ top: 0;
326
+ left: 0;
327
+ bottom: 0;
328
+ right: 0;
329
+ background: linear-gradient(
330
+ 90deg,
331
+ transparent,
332
+ rgba(255, 255, 255, 0.3),
333
+ transparent
334
+ );
335
+ animation: shimmer 2s infinite;
336
+ }
337
+
338
+ @keyframes shimmer {
339
+ 0% { transform: translateX(-100%); }
340
+ 100% { transform: translateX(100%); }
341
+ }
342
+
343
+ .card-counter {
344
+ text-align: center;
345
+ font-weight: 600;
346
+ font-size: 1.1rem;
347
+ color: var(--text-secondary);
348
+ }
349
+
350
+ /* Flashcard styles */
351
+ .flashcard-container {
352
+ perspective: 1000px;
353
+ height: 400px;
354
+ margin-bottom: 30px;
355
+ }
356
+
357
+ .flashcard {
358
+ position: relative;
359
+ width: 100%;
360
+ height: 100%;
361
+ cursor: pointer;
362
+ transform-style: preserve-3d;
363
+ transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
364
+ }
365
+
366
+ .flashcard.flipped {
367
+ transform: rotateY(180deg);
368
+ }
369
+
370
+ .flashcard-front,
371
+ .flashcard-back {
372
+ position: absolute;
373
+ width: 100%;
374
+ height: 100%;
375
+ backface-visibility: hidden;
376
+ display: flex;
377
+ align-items: center;
378
+ justify-content: center;
379
+ padding: 40px;
380
+ border-radius: 20px;
381
+ box-shadow: var(--shadow-xl);
382
+ text-align: center;
383
+ }
384
+
385
+ .flashcard-front {
386
+ background: var(--bg-primary);
387
+ border: 3px solid var(--border);
388
+ }
389
+
390
+ .flashcard-front p {
391
+ font-size: 1.5rem;
392
+ font-weight: 700;
393
+ line-height: 1.4;
394
+ }
395
+
396
+ .flashcard-back {
397
+ background: var(--gradient);
398
+ color: white;
399
+ transform: rotateY(180deg);
400
+ }
401
+
402
+ .flashcard-back p {
403
+ font-size: 1.2rem;
404
+ line-height: 1.6;
405
+ font-weight: 500;
406
+ }
407
+
408
+ /* Controls */
409
+ .controls {
410
+ display: flex;
411
+ justify-content: center;
412
+ flex-wrap: wrap;
413
+ gap: 15px;
414
+ margin: 20px 0;
415
+ }
416
+
417
+ button {
418
+ padding: 12px 28px;
419
+ border: none;
420
+ background: var(--primary);
421
+ color: white;
422
+ border-radius: 10px;
423
+ cursor: pointer;
424
+ font-weight: 600;
425
+ font-size: 1rem;
426
+ transition: var(--transition);
427
+ box-shadow: var(--shadow-md);
428
+ position: relative;
429
+ overflow: hidden;
430
+ }
431
+
432
+ button::before {
433
+ content: '';
434
+ position: absolute;
435
+ top: 50%;
436
+ left: 50%;
437
+ width: 0;
438
+ height: 0;
439
+ background: rgba(255, 255, 255, 0.2);
440
+ border-radius: 50%;
441
+ transform: translate(-50%, -50%);
442
+ transition: width 0.6s, height 0.6s;
443
+ }
444
+
445
+ button:hover {
446
+ background: var(--primary-dark);
447
+ transform: translateY(-2px);
448
+ box-shadow: var(--shadow-lg);
449
+ }
450
+
451
+ button:hover::before {
452
+ width: 300px;
453
+ height: 300px;
454
+ }
455
+
456
+ button:active {
457
+ transform: translateY(0);
458
+ }
459
+
460
+ button:disabled {
461
+ background: var(--text-secondary);
462
+ cursor: not-allowed;
463
+ transform: none;
464
+ box-shadow: none;
465
+ opacity: 0.6;
466
+ }
467
+
468
+ /* ============ Playground Section ============ */
469
+ .play-task {
470
+ margin-bottom: 30px;
471
+ padding: 30px;
472
+ background: var(--bg-primary);
473
+ border-radius: 20px;
474
+ box-shadow: var(--shadow-lg);
475
+ border: 1px solid var(--border);
476
+ }
477
+
478
+ .play-task h3 {
479
+ font-size: 1.4rem;
480
+ margin-bottom: 15px;
481
+ color: var(--primary);
482
+ display: flex;
483
+ align-items: center;
484
+ gap: 10px;
485
+ }
486
+
487
+ .task-badge {
488
+ display: inline-flex;
489
+ align-items: center;
490
+ padding: 4px 12px;
491
+ background: var(--bg-tertiary);
492
+ border-radius: 20px;
493
+ font-size: 0.9rem;
494
+ font-weight: 600;
495
+ color: var(--text-secondary);
496
+ }
497
+
498
+ .play-task p {
499
+ margin-bottom: 20px;
500
+ color: var(--text-secondary);
501
+ line-height: 1.6;
502
+ }
503
+
504
+ .play-task code {
505
+ background: var(--bg-tertiary);
506
+ padding: 2px 8px;
507
+ border-radius: 6px;
508
+ font-family: 'Consolas', 'Monaco', monospace;
509
+ font-size: 0.95rem;
510
+ color: var(--primary);
511
+ }
512
+
513
+ .code-editor {
514
+ position: relative;
515
+ margin-bottom: 20px;
516
+ }
517
+
518
+ .code-editor textarea {
519
+ width: 100%;
520
+ min-height: 200px;
521
+ padding: 20px;
522
+ border: 2px solid var(--border);
523
+ border-radius: 12px;
524
+ font-family: 'Consolas', 'Monaco', monospace;
525
+ font-size: 14px;
526
+ line-height: 1.5;
527
+ background: var(--bg-secondary);
528
+ color: var(--text-primary);
529
+ resize: vertical;
530
+ transition: var(--transition);
531
+ }
532
+
533
+ .code-editor textarea:focus {
534
+ outline: none;
535
+ border-color: var(--primary);
536
+ box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
537
+ }
538
+
539
+ body.dark-mode .code-editor textarea {
540
+ background: var(--bg-tertiary);
541
+ }
542
+
543
+ .play-output {
544
+ margin-top: 20px;
545
+ padding: 15px 20px;
546
+ border-radius: 10px;
547
+ font-family: monospace;
548
+ font-size: 1rem;
549
+ line-height: 1.5;
550
+ white-space: pre-wrap;
551
+ transition: var(--transition);
552
+ }
553
+
554
+ .play-success {
555
+ background: rgba(16, 185, 129, 0.1);
556
+ color: var(--success);
557
+ border: 2px solid var(--success);
558
+ }
559
+
560
+ .play-error {
561
+ background: rgba(239, 68, 68, 0.1);
562
+ color: var(--error);
563
+ border: 2px solid var(--error);
564
+ }
565
+
566
+ /* ============ Test Section ============ */
567
+ .quiz-card {
568
+ background: var(--bg-primary);
569
+ padding: 35px;
570
+ border-radius: 20px;
571
+ box-shadow: var(--shadow-lg);
572
+ border: 1px solid var(--border);
573
+ margin-bottom: 30px;
574
+ }
575
+
576
+ .quiz-card h3 {
577
+ font-size: 1.5rem;
578
+ margin-bottom: 20px;
579
+ color: var(--primary);
580
+ }
581
+
582
+ .quiz-card p {
583
+ font-size: 1.1rem;
584
+ margin-bottom: 25px;
585
+ line-height: 1.6;
586
+ }
587
+
588
+ .quiz-option {
589
+ display: block;
590
+ margin: 10px 0;
591
+ padding: 15px 20px;
592
+ border: 2px solid var(--border);
593
+ border-radius: 12px;
594
+ cursor: pointer;
595
+ transition: var(--transition);
596
+ background: var(--bg-secondary);
597
+ font-weight: 500;
598
+ }
599
+
600
+ .quiz-option:hover {
601
+ border-color: var(--primary);
602
+ transform: translateX(5px);
603
+ box-shadow: var(--shadow-md);
604
+ }
605
+
606
+ .quiz-option.selected {
607
+ background: var(--primary);
608
+ color: white;
609
+ border-color: var(--primary);
610
+ box-shadow: var(--shadow-lg);
611
+ }
612
+
613
+ .quiz-score {
614
+ font-size: 2rem;
615
+ font-weight: 700;
616
+ text-align: center;
617
+ margin-top: 30px;
618
+ background: var(--gradient);
619
+ -webkit-background-clip: text;
620
+ -webkit-text-fill-color: transparent;
621
+ background-clip: text;
622
+ }
623
+
624
+ /* ============ Help Section ============ */
625
+ .help-button {
626
+ position: fixed;
627
+ bottom: 30px;
628
+ right: 30px;
629
+ width: 60px;
630
+ height: 60px;
631
+ border-radius: 50%;
632
+ background: var(--gradient);
633
+ color: white;
634
+ border: none;
635
+ cursor: pointer;
636
+ box-shadow: var(--shadow-xl);
637
+ font-size: 1.5rem;
638
+ display: flex;
639
+ align-items: center;
640
+ justify-content: center;
641
+ transition: var(--transition);
642
+ z-index: 1000;
643
+ }
644
+
645
+ .help-button:hover {
646
+ transform: scale(1.1);
647
+ }
648
+
649
+ .help-modal {
650
+ position: fixed;
651
+ top: 0;
652
+ left: 0;
653
+ right: 0;
654
+ bottom: 0;
655
+ background: rgba(0, 0, 0, 0.5);
656
+ display: none;
657
+ align-items: center;
658
+ justify-content: center;
659
+ z-index: 2000;
660
+ backdrop-filter: blur(5px);
661
+ }
662
+
663
+ .help-modal.active {
664
+ display: flex;
665
+ }
666
+
667
+ .help-content {
668
+ background: var(--bg-primary);
669
+ padding: 40px;
670
+ border-radius: 20px;
671
+ max-width: 600px;
672
+ max-height: 80vh;
673
+ overflow-y: auto;
674
+ box-shadow: var(--shadow-xl);
675
+ position: relative;
676
+ animation: modalSlideIn 0.3s ease;
677
+ }
678
+
679
+ @keyframes modalSlideIn {
680
+ from {
681
+ opacity: 0;
682
+ transform: translateY(-50px);
683
+ }
684
+ to {
685
+ opacity: 1;
686
+ transform: translateY(0);
687
+ }
688
+ }
689
+
690
+ .help-content h2 {
691
+ margin-bottom: 20px;
692
+ color: var(--primary);
693
+ }
694
+
695
+ .help-content h3 {
696
+ margin-top: 20px;
697
+ margin-bottom: 10px;
698
+ color: var(--primary);
699
+ }
700
+
701
+ .help-content p {
702
+ margin-bottom: 15px;
703
+ line-height: 1.6;
704
+ }
705
+
706
+ .close-help {
707
+ position: absolute;
708
+ top: 20px;
709
+ right: 20px;
710
+ background: none;
711
+ border: none;
712
+ font-size: 1.5rem;
713
+ cursor: pointer;
714
+ color: var(--text-secondary);
715
+ padding: 5px;
716
+ }
717
+
718
+ /* ============ Footer ============ */
719
+ footer {
720
+ text-align: center;
721
+ margin-top: 60px;
722
+ padding: 30px;
723
+ background: var(--bg-primary);
724
+ border-radius: 20px;
725
+ box-shadow: var(--shadow-md);
726
+ }
727
+
728
+ footer p {
729
+ color: var(--text-secondary);
730
+ font-size: 1rem;
731
+ }
732
+
733
+ footer a {
734
+ color: var(--primary);
735
+ text-decoration: none;
736
+ font-weight: 600;
737
+ transition: var(--transition);
738
+ }
739
+
740
+ footer a:hover {
741
+ text-decoration: underline;
742
+ }
743
+
744
+ /* ============ Responsive Design ============ */
745
+ @media (max-width: 768px) {
746
+ h1 {
747
+ font-size: 2rem;
748
+ }
749
+
750
+ .main-tabs {
751
+ padding: 15px;
752
+ }
753
+
754
+ .flashcard-container {
755
+ height: 350px;
756
+ }
757
+
758
+ .flashcard-front p {
759
+ font-size: 1.2rem;
760
+ }
761
+
762
+ .flashcard-back p {
763
+ font-size: 1rem;
764
+ }
765
+
766
+ .play-task {
767
+ padding: 20px;
768
+ }
769
+
770
+ .quiz-card {
771
+ padding: 25px;
772
+ }
773
+
774
+ .help-content {
775
+ padding: 30px;
776
+ margin: 20px;
777
+ }
778
+ }
779
+
780
+ /* ============ Loading Animation ============ */
781
+ .loading {
782
+ display: inline-block;
783
+ width: 20px;
784
+ height: 20px;
785
+ border: 3px solid var(--border);
786
+ border-radius: 50%;
787
+ border-top-color: var(--primary);
788
+ animation: spin 1s ease-in-out infinite;
789
+ }
790
+
791
+ @keyframes spin {
792
+ to { transform: rotate(360deg); }
793
+ }
794
+
795
+ /* ============ Tooltips ============ */
796
+ .tooltip {
797
+ position: relative;
798
+ display: inline-block;
799
+ cursor: help;
800
+ }
801
+
802
+ .tooltip .tooltiptext {
803
+ visibility: hidden;
804
+ width: 200px;
805
+ background: var(--bg-tertiary);
806
+ color: var(--text-primary);
807
+ text-align: center;
808
+ border-radius: 8px;
809
+ padding: 10px;
810
+ position: absolute;
811
+ z-index: 1;
812
+ bottom: 125%;
813
+ left: 50%;
814
+ margin-left: -100px;
815
+ opacity: 0;
816
+ transition: opacity 0.3s;
817
+ box-shadow: var(--shadow-lg);
818
+ font-size: 0.9rem;
819
+ }
820
+
821
+ .tooltip:hover .tooltiptext {
822
+ visibility: visible;
823
+ opacity: 1;
824
+ }
825
+ </style>
826
+ </head>
827
+ <body>
828
+ <div class="container">
829
+ <!-- Header Section -->
830
+ <header>
831
+ <h1>AI Basics Learning Hub</h1>
832
+ <p class="subtitle">Master AI fundamentals through interactive flashcards, hands-on coding, and comprehensive testing</p>
833
+ </header>
834
+
835
+ <!-- Navigation -->
836
+ <nav class="main-tabs">
837
+ <button class="main-tab active" data-section="flashcards">πŸ“š Flashcards</button>
838
+ <button class="main-tab" data-section="playground">πŸ’» Playground</button>
839
+ <button class="main-tab" data-section="test">πŸ“ Test</button>
840
+ <label class="dark-toggle">
841
+ <span>πŸŒ™ Dark Mode</span>
842
+ <div class="toggle-switch">
843
+ <input type="checkbox" id="darkToggle"/>
844
+ <span class="slider"></span>
845
+ </div>
846
+ </label>
847
+ </nav>
848
+
849
+ <!-- Flashcards Section -->
850
+ <section id="flashcards" class="section active">
851
+ <div class="category-tabs">
852
+ <div class="category-tab active" data-category="core">Core Concepts</div>
853
+ <div class="category-tab" data-category="terms">Key Terms</div>
854
+ <div class="category-tab" data-category="applications">AI Applications</div>
855
+ <div class="category-tab" data-category="ethics">Ethics & Challenges</div>
856
+ </div>
857
+
858
+ <div class="progress-container">
859
+ <div class="progress">
860
+ <div class="progress-bar" style="width: 0%"></div>
861
+ </div>
862
+ <div class="card-counter">Card 1 of 10</div>
863
+ </div>
864
+
865
+ <div class="flashcard-container">
866
+ <div class="flashcard">
867
+ <div class="flashcard-front">
868
+ <p></p>
869
+ </div>
870
+ <div class="flashcard-back">
871
+ <p></p>
872
+ </div>
873
+ </div>
874
+ </div>
875
+
876
+ <div class="controls">
877
+ <button id="prev" disabled>← Previous</button>
878
+ <button id="flip">πŸ”„ Flip Card</button>
879
+ <button id="next">Next β†’</button>
880
+ <button id="shuffle">πŸ”€ Shuffle</button>
881
+ </div>
882
+ </section>
883
+
884
+ <!-- Playground Section -->
885
+ <section id="playground" class="section"></section>
886
+
887
+ <!-- Test Section -->
888
+ <section id="test" class="section"></section>
889
+
890
+ <!-- Footer -->
891
+ <footer>
892
+ <p>πŸš€ Enhance your AI knowledge β€’ Created with ❀️ β€’ More resources at <a href="https://huggingface.co/ProCreations" target="_blank">ProCreations on Hugging Face</a></p>
893
+ </footer>
894
+ </div>
895
+
896
+ <!-- Help Button & Modal -->
897
+ <button class="help-button" onclick="toggleHelp()">?</button>
898
+ <div class="help-modal" id="helpModal" onclick="closeHelpOnClick(event)">
899
+ <div class="help-content">
900
+ <button class="close-help" onclick="toggleHelp()">βœ•</button>
901
+ <h2>πŸ“– How to Use This Learning Hub</h2>
902
+
903
+ <h3>πŸ“š Flashcards</h3>
904
+ <p>Study AI concepts with interactive flashcards. Click on a card or use the "Flip" button to reveal the answer. Navigate through cards using Previous/Next buttons, and shuffle for random practice.</p>
905
+
906
+ <h3>πŸ’» Playground</h3>
907
+ <p>Practice coding with AI-related exercises. Write your solution in the code editor and click "Run" to test it. Each task includes clear instructions and automatic validation.</p>
908
+
909
+ <h3>πŸ“ Test</h3>
910
+ <p>Assess your knowledge with multiple-choice questions. Select your answer and submit to move to the next question. Your score is displayed at the end.</p>
911
+
912
+ <h3>πŸŒ™ Dark Mode</h3>
913
+ <p>Toggle dark mode for comfortable studying in low-light environments. Your preference is saved automatically.</p>
914
+
915
+ <h3>πŸ’‘ Tips</h3>
916
+ <p>β€’ Review flashcards regularly for better retention<br>
917
+ β€’ Try solving playground tasks without looking at solutions<br>
918
+ β€’ Take the test multiple times to track your progress<br>
919
+ β€’ Use keyboard shortcuts: Space to flip cards, arrow keys to navigate</p>
920
+ </div>
921
+ </div>
922
+
923
+ <script>
924
+ /**
925
+ * AI Basics Learning Hub - Enhanced Version
926
+ * Interactive learning platform for AI fundamentals
927
+ * Features: Flashcards, Coding Playground, Quiz System
928
+ */
929
+
930
+ // ==================== Flashcards Data ====================
931
+ const flashcards = {
932
+ core: [
933
+ {q: "What is Artificial Intelligence (AI)?", a: "A field of computer science focused on creating systems that perform tasks that typically require human intelligence."},
934
+ {q: "What's the difference between Narrow AI and General AI?", a: "Narrow AI is specialised for specific tasks (like chess or image recognition), while General AI would match human intelligence broadly across all domains."},
935
+ {q: "What is Machine Learning?", a: "A subset of AI where systems learn patterns from data rather than following explicit programming instructions."},
936
+ {q: "What is Deep Learning?", a: "A subset of ML using multi-layer neural networks to learn hierarchical representations of data automatically."},
937
+ {q: "What are Neural Networks?", a: "Collections of interconnected nodes (neurons) inspired by biological brains that learn to recognize patterns through training."},
938
+ {q: "What is Gradient Descent?", a: "An optimization algorithm that iteratively adjusts model parameters to minimize a loss function by following the steepest descent."},
939
+ {q: "What is a Loss Function?", a: "A mathematical function that measures how far a model's predictions deviate from the actual target values."},
940
+ {q: "What is Backpropagation?", a: "An algorithm that efficiently computes gradients of the loss with respect to each weight in a neural network using the chain rule."},
941
+ {q: "What is a Dataset?", a: "A structured collection of data examples used to train, validate, or test machine learning models."},
942
+ {q: "What is Feature Engineering?", a: "The process of selecting, transforming, and creating input variables to improve model performance."}
943
+ ],
944
+ terms: [
945
+ {q: "What is Supervised Learning?", a: "Learning from labeled data where the model learns to map inputs to known outputs (e.g., classification, regression)."},
946
+ {q: "What is Unsupervised Learning?", a: "Finding hidden patterns in unlabeled data without predefined outputs (e.g., clustering, dimensionality reduction)."},
947
+ {q: "What is Reinforcement Learning?", a: "Learning through interaction with an environment, receiving rewards or penalties for actions taken."},
948
+ {q: "What are Training, Validation, and Test Sets?", a: "Data splits: Training for learning patterns, Validation for tuning hyperparameters, Test for final unbiased evaluation."},
949
+ {q: "What is Overfitting?", a: "When a model memorizes training data too well, performing poorly on new, unseen data due to high variance."},
950
+ {q: "What is Underfitting?", a: "When a model is too simple to capture underlying patterns, resulting in poor performance due to high bias."},
951
+ {q: "What is Regularization?", a: "Techniques that constrain model complexity to prevent overfitting (e.g., L1/L2 penalties, dropout, early stopping)."},
952
+ {q: "What is a Hyperparameter?", a: "Configuration values set before training that control the learning process (e.g., learning rate, batch size)."},
953
+ {q: "What is a Confusion Matrix?", a: "A table showing classification results: true positives, true negatives, false positives, and false negatives."},
954
+ {q: "What are Precision and Recall?", a: "Classification metrics: Precision = TP/(TP+FP) measures accuracy of positive predictions; Recall = TP/(TP+FN) measures coverage of actual positives."}
955
+ ],
956
+ applications: [
957
+ {q: "What is Natural Language Processing (NLP)?", a: "AI techniques for understanding, interpreting, and generating human language in text or speech form."},
958
+ {q: "What is Computer Vision?", a: "AI field that enables computers to derive meaningful information from visual inputs like images and videos."},
959
+ {q: "What are Large Language Models (LLMs)?", a: "Massive neural networks trained on vast text data to understand and generate human-like text (e.g., GPT, Claude)."},
960
+ {q: "What are Generative AI systems?", a: "Models that create new content (text, images, audio, video) by learning patterns from training data."},
961
+ {q: "What is Transfer Learning?", a: "Reusing a pre-trained model's learned features as a starting point for a related task, saving time and data."},
962
+ {q: "What is Speech Recognition?", a: "Converting spoken language into text using AI models trained on audio-text pairs."},
963
+ {q: "What is Robotics?", a: "Field combining AI, sensors, and mechanical systems to create machines that can perceive and act autonomously."},
964
+ {q: "What is a Recommendation System?", a: "Algorithms that predict user preferences and suggest relevant items based on past behavior and similarities."},
965
+ {q: "What is Autonomous Driving?", a: "Using AI for perception, planning, and control to enable vehicles to navigate without human input."},
966
+ {q: "What is Fraud Detection?", a: "AI systems that identify unusual patterns or anomalies in transactions to prevent fraudulent activities."}
967
+ ],
968
+ ethics: [
969
+ {q: "What is Bias in AI?", a: "Systematic errors or unfair prejudices in AI systems arising from biased training data or algorithm design."},
970
+ {q: "What is Explainable AI (XAI)?", a: "Making AI decision-making processes transparent and understandable to humans for trust and accountability."},
971
+ {q: "What is the AI Alignment Problem?", a: "The challenge of ensuring AI systems pursue goals that align with human values and intentions."},
972
+ {q: "What are AI Hallucinations?", a: "When AI models generate plausible-sounding but factually incorrect or nonsensical information."},
973
+ {q: "What is Prompt Engineering?", a: "The art of crafting effective inputs to guide AI models toward desired outputs and behaviors."},
974
+ {q: "What is Data Privacy in AI?", a: "Protecting personal information used in AI systems through techniques like anonymization and secure processing."},
975
+ {q: "What is Fairness in AI?", a: "Ensuring AI systems don't discriminate against individuals or groups based on protected characteristics."},
976
+ {q: "What are Deepfakes?", a: "AI-generated synthetic media where a person's likeness is convincingly replaced or manipulated in images/videos."},
977
+ {q: "What is AI Governance?", a: "Frameworks, policies, and regulations for responsible development and deployment of AI systems."},
978
+ {q: "What is Model Transparency?", a: "The degree to which an AI model's inner workings and decision processes can be understood and audited."}
979
+ ]
980
+ };
981
+
982
+ // ==================== DOM Elements ====================
983
+ const categoryTabs = document.querySelectorAll('.category-tab');
984
+ const flashcardEl = document.querySelector('.flashcard');
985
+ const frontEl = document.querySelector('.flashcard-front p');
986
+ const backEl = document.querySelector('.flashcard-back p');
987
+ const prevBtn = document.getElementById('prev');
988
+ const nextBtn = document.getElementById('next');
989
+ const flipBtn = document.getElementById('flip');
990
+ const shuffleBtn = document.getElementById('shuffle');
991
+ const progressBar = document.querySelector('.progress-bar');
992
+ const cardCounter = document.querySelector('.card-counter');
993
+
994
+ // ==================== State Management ====================
995
+ let currentCategory = 'core';
996
+ let currentCardIndex = 0;
997
+ let isFlipped = false;
998
+
999
+ // Load saved progress
1000
+ function loadSavedProgress() {
1001
+ const saved = localStorage.getItem(`${currentCategory}-index`);
1002
+ if (saved !== null) {
1003
+ currentCardIndex = Math.min(parseInt(saved), flashcards[currentCategory].length - 1);
1004
+ }
1005
+ }
1006
+
1007
+ // ==================== Flashcard Functions ====================
1008
+ function updateCard() {
1009
+ const cards = flashcards[currentCategory];
1010
+ const card = cards[currentCardIndex];
1011
+
1012
+ // Update card content
1013
+ frontEl.textContent = card.q;
1014
+ backEl.textContent = card.a;
1015
+
1016
+ // Update progress
1017
+ const progress = ((currentCardIndex + 1) / cards.length) * 100;
1018
+ progressBar.style.width = `${progress}%`;
1019
+ cardCounter.textContent = `Card ${currentCardIndex + 1} of ${cards.length}`;
1020
+
1021
+ // Update button states
1022
+ prevBtn.disabled = currentCardIndex === 0;
1023
+ nextBtn.disabled = currentCardIndex === cards.length - 1;
1024
+
1025
+ // Save progress
1026
+ localStorage.setItem(`${currentCategory}-index`, currentCardIndex);
1027
+ }
1028
+
1029
+ function toggleFlip() {
1030
+ isFlipped = !isFlipped;
1031
+ flashcardEl.classList.toggle('flipped');
1032
+ }
1033
+
1034
+ function prevCard() {
1035
+ if (currentCardIndex > 0) {
1036
+ currentCardIndex--;
1037
+ resetCard();
1038
+ }
1039
+ }
1040
+
1041
+ function nextCard() {
1042
+ if (currentCardIndex < flashcards[currentCategory].length - 1) {
1043
+ currentCardIndex++;
1044
+ resetCard();
1045
+ }
1046
+ }
1047
+
1048
+ function shuffleCards() {
1049
+ flashcards[currentCategory] = flashcards[currentCategory].sort(() => Math.random() - 0.5);
1050
+ currentCardIndex = 0;
1051
+ resetCard();
1052
+ }
1053
+
1054
+ function resetCard() {
1055
+ isFlipped = false;
1056
+ flashcardEl.classList.remove('flipped');
1057
+ updateCard();
1058
+ }
1059
+
1060
+ // ==================== Event Listeners ====================
1061
+ flashcardEl.addEventListener('click', toggleFlip);
1062
+ flipBtn.addEventListener('click', toggleFlip);
1063
+ prevBtn.addEventListener('click', prevCard);
1064
+ nextBtn.addEventListener('click', nextCard);
1065
+ shuffleBtn.addEventListener('click', shuffleCards);
1066
+
1067
+ // Category switching
1068
+ categoryTabs.forEach(tab => {
1069
+ tab.addEventListener('click', () => {
1070
+ categoryTabs.forEach(t => t.classList.remove('active'));
1071
+ tab.classList.add('active');
1072
+ currentCategory = tab.dataset.category;
1073
+ currentCardIndex = 0;
1074
+ isFlipped = false;
1075
+ flashcardEl.classList.remove('flipped');
1076
+ loadSavedProgress();
1077
+ updateCard();
1078
+ });
1079
+ });
1080
+
1081
+ // Keyboard navigation
1082
+ document.addEventListener('keydown', (e) => {
1083
+ if (document.getElementById('flashcards').classList.contains('active')) {
1084
+ switch(e.key) {
1085
+ case ' ':
1086
+ e.preventDefault();
1087
+ toggleFlip();
1088
+ break;
1089
+ case 'ArrowLeft':
1090
+ prevCard();
1091
+ break;
1092
+ case 'ArrowRight':
1093
+ nextCard();
1094
+ break;
1095
+ }
1096
+ }
1097
+ });
1098
+
1099
+ // ==================== Dark Mode ====================
1100
+ const darkToggle = document.getElementById('darkToggle');
1101
+ darkToggle.addEventListener('change', (e) => {
1102
+ document.body.classList.toggle('dark-mode', e.target.checked);
1103
+ localStorage.setItem('dark-mode', e.target.checked);
1104
+ });
1105
+
1106
+ // Load dark mode preference
1107
+ if (localStorage.getItem('dark-mode') === 'true') {
1108
+ darkToggle.checked = true;
1109
+ document.body.classList.add('dark-mode');
1110
+ }
1111
+
1112
+ // ==================== Navigation ====================
1113
+ const mainTabs = document.querySelectorAll('.main-tab');
1114
+ mainTabs.forEach(btn => {
1115
+ btn.addEventListener('click', () => {
1116
+ mainTabs.forEach(b => b.classList.remove('active'));
1117
+ btn.classList.add('active');
1118
+
1119
+ document.querySelectorAll('.section').forEach(s => {
1120
+ s.classList.remove('active');
1121
+ });
1122
+
1123
+ const targetSection = document.getElementById(btn.dataset.section);
1124
+ setTimeout(() => {
1125
+ targetSection.classList.add('active');
1126
+ }, 10);
1127
+ });
1128
+ });
1129
+
1130
+ // ==================== Playground Section ====================
1131
+ const playgroundSection = document.getElementById('playground');
1132
+ const tasks = [
1133
+ {
1134
+ title: 'Sum of Two Numbers',
1135
+ desc: 'Write a function <code>add(a, b)</code> that returns the sum of two numbers.',
1136
+ hint: 'Use the + operator to add the numbers',
1137
+ test: code => {
1138
+ try {
1139
+ const func = new Function(code + '; return add(2, 3);');
1140
+ return func() === 5;
1141
+ } catch (e) {
1142
+ throw e;
1143
+ }
1144
+ }
1145
+ },
1146
+ {
1147
+ title: 'Even Number Checker',
1148
+ desc: 'Write a function <code>isEven(n)</code> that returns <code>true</code> if a number is even, <code>false</code> otherwise.',
1149
+ hint: 'Use the modulo operator (%) to check divisibility by 2',
1150
+ test: code => {
1151
+ try {
1152
+ const func = new Function(code + '; return isEven(4) && !isEven(5) && isEven(0);');
1153
+ return func();
1154
+ } catch (e) {
1155
+ throw e;
1156
+ }
1157
+ }
1158
+ },
1159
+ {
1160
+ title: 'String Reversal',
1161
+ desc: 'Write a function <code>reverseString(s)</code> that returns the reversed version of a string.',
1162
+ hint: 'You can split the string into an array, reverse it, and join it back',
1163
+ test: code => {
1164
+ try {
1165
+ const func = new Function(code + '; return reverseString("hello") === "olleh" && reverseString("AI") === "IA";');
1166
+ return func();
1167
+ } catch (e) {
1168
+ throw e;
1169
+ }
1170
+ }
1171
+ },
1172
+ {
1173
+ title: 'Find Maximum in Array',
1174
+ desc: 'Write a function <code>maxArray(arr)</code> that returns the largest number in an array.',
1175
+ hint: 'Use Math.max() with the spread operator or iterate through the array',
1176
+ test: code => {
1177
+ try {
1178
+ const func = new Function(code + '; return maxArray([1, 8, 3, 7]) === 8 && maxArray([-5, -1, -10]) === -1;');
1179
+ return func();
1180
+ } catch (e) {
1181
+ throw e;
1182
+ }
1183
+ }
1184
+ },
1185
+ {
1186
+ title: 'Factorial Calculator',
1187
+ desc: 'Write a function <code>factorial(n)</code> that returns the factorial of n (n!).',
1188
+ hint: 'Remember: 5! = 5 Γ— 4 Γ— 3 Γ— 2 Γ— 1 = 120',
1189
+ test: code => {
1190
+ try {
1191
+ const func = new Function(code + '; return factorial(5) === 120 && factorial(0) === 1 && factorial(3) === 6;');
1192
+ return func();
1193
+ } catch (e) {
1194
+ throw e;
1195
+ }
1196
+ }
1197
+ }
1198
+ ];
1199
+
1200
+ let taskIndex = 0;
1201
+
1202
+ function renderTask() {
1203
+ const task = tasks[taskIndex];
1204
+ playgroundSection.innerHTML = `
1205
+ <div class="play-task">
1206
+ <h3>
1207
+ <span class="task-badge">Task ${taskIndex + 1}/${tasks.length}</span>
1208
+ ${task.title}
1209
+ </h3>
1210
+ <p>${task.desc}</p>
1211
+ <div class="tooltip">
1212
+ πŸ’‘ <span class="tooltiptext">${task.hint}</span>
1213
+ </div>
1214
+ <div class="code-editor">
1215
+ <textarea id="codeArea" spellcheck="false" placeholder="// Write your solution here
1216
+ function functionName(parameters) {
1217
+ // Your code
1218
+ }"></textarea>
1219
+ </div>
1220
+ <button id="runCode">β–Ά Run Code</button>
1221
+ <div id="output" class="play-output" style="display: none;"></div>
1222
+ <div class="controls" style="margin-top: 20px;">
1223
+ <button id="prevTask" ${taskIndex === 0 ? 'disabled' : ''}>← Previous</button>
1224
+ <button id="nextTask" ${taskIndex === tasks.length - 1 ? 'disabled' : ''}>Next β†’</button>
1225
+ </div>
1226
+ </div>
1227
+ `;
1228
+
1229
+ // Add event listeners
1230
+ document.getElementById('runCode').onclick = runCode;
1231
+ document.getElementById('prevTask').onclick = () => {
1232
+ taskIndex--;
1233
+ renderTask();
1234
+ };
1235
+ document.getElementById('nextTask').onclick = () => {
1236
+ taskIndex++;
1237
+ renderTask();
1238
+ };
1239
+
1240
+ // Load saved code if exists
1241
+ const savedCode = localStorage.getItem(`task-${taskIndex}-code`);
1242
+ if (savedCode) {
1243
+ document.getElementById('codeArea').value = savedCode;
1244
+ }
1245
+ }
1246
+
1247
+ function runCode() {
1248
+ const code = document.getElementById('codeArea').value;
1249
+ const output = document.getElementById('output');
1250
+ const task = tasks[taskIndex];
1251
+
1252
+ // Save code
1253
+ localStorage.setItem(`task-${taskIndex}-code`, code);
1254
+
1255
+ try {
1256
+ const passed = task.test(code);
1257
+ output.textContent = passed ? 'βœ… Excellent! All tests passed!' : '❌ Not quite right. Check your solution and try again.';
1258
+ output.className = 'play-output ' + (passed ? 'play-success' : 'play-error');
1259
+ output.style.display = 'block';
1260
+
1261
+ // Mark task as completed if passed
1262
+ if (passed) {
1263
+ localStorage.setItem(`task-${taskIndex}-completed`, 'true');
1264
+ }
1265
+ } catch (err) {
1266
+ output.textContent = `⚠️ Error: ${err.message}`;
1267
+ output.className = 'play-output play-error';
1268
+ output.style.display = 'block';
1269
+ }
1270
+ }
1271
+
1272
+ // ==================== Test Section ====================
1273
+ const testSection = document.getElementById('test');
1274
+ const quizQuestions = [
1275
+ {
1276
+ q: 'Which algorithm is commonly used to minimize a loss function in neural networks?',
1277
+ opts: ['K-means clustering', 'Gradient Descent', 'Apriori algorithm', 'Breadth-first search'],
1278
+ ans: 1,
1279
+ explanation: 'Gradient Descent iteratively adjusts parameters to minimize the loss function.'
1280
+ },
1281
+ {
1282
+ q: 'Overfitting is primarily an example of which type of error?',
1283
+ opts: ['High bias', 'High variance', 'Syntax error', 'Runtime error'],
1284
+ ans: 1,
1285
+ explanation: 'Overfitting occurs when a model has high variance, fitting too closely to training data.'
1286
+ },
1287
+ {
1288
+ q: 'Which field of AI focuses on understanding and processing images?',
1289
+ opts: ['Natural Language Processing', 'Speech Recognition', 'Computer Vision', 'Game Theory'],
1290
+ ans: 2,
1291
+ explanation: 'Computer Vision deals with extracting information from visual inputs.'
1292
+ },
1293
+ {
1294
+ q: 'In classification metrics, which metric is calculated as TP/(TP+FP)?',
1295
+ opts: ['Recall', 'Accuracy', 'F1-Score', 'Precision'],
1296
+ ans: 3,
1297
+ explanation: 'Precision measures the accuracy of positive predictions.'
1298
+ },
1299
+ {
1300
+ q: 'What does XAI stand for in the context of AI?',
1301
+ opts: ['eXternal AI', 'Explainable AI', 'Extreme AI', 'Experimental AI'],
1302
+ ans: 1,
1303
+ explanation: 'Explainable AI focuses on making AI decisions transparent and understandable.'
1304
+ },
1305
+ {
1306
+ q: 'Transfer learning is particularly useful when:',
1307
+ opts: ['Data is abundant', 'Training from scratch is costly', 'Models are tiny', 'Labels are perfect'],
1308
+ ans: 1,
1309
+ explanation: 'Transfer learning saves time and resources by reusing pre-trained models.'
1310
+ },
1311
+ {
1312
+ q: 'The AI alignment problem primarily concerns:',
1313
+ opts: ['Model efficiency', 'Matching AI goals with human values', 'Hardware scaling', 'Syntax errors'],
1314
+ ans: 1,
1315
+ explanation: 'AI alignment ensures AI systems pursue goals aligned with human values.'
1316
+ },
1317
+ {
1318
+ q: 'Which learning paradigm uses rewards and penalties?',
1319
+ opts: ['Supervised Learning', 'Unsupervised Learning', 'Reinforcement Learning', 'Self-supervised Learning'],
1320
+ ans: 2,
1321
+ explanation: 'Reinforcement Learning uses rewards and penalties to guide learning.'
1322
+ },
1323
+ {
1324
+ q: 'Bias in AI systems often originates from:',
1325
+ opts: ['Noisy sensors', 'Biased training data', 'GPU memory limitations', 'Slow CPUs'],
1326
+ ans: 1,
1327
+ explanation: 'Biased training data is a primary source of bias in AI systems.'
1328
+ },
1329
+ {
1330
+ q: 'In the context of AI, LLM stands for:',
1331
+ opts: ['Large Logic Model', 'Long-Lived Model', 'Large Language Model', 'Layered Learning Method'],
1332
+ ans: 2,
1333
+ explanation: 'Large Language Models are trained on vast text data for language tasks.'
1334
+ }
1335
+ ];
1336
+
1337
+ let quizIndex = 0;
1338
+ let score = 0;
1339
+
1340
+ function renderQuiz() {
1341
+ if (quizIndex >= quizQuestions.length) {
1342
+ testSection.innerHTML = `
1343
+ <div class="quiz-card">
1344
+ <h3>πŸŽ‰ Test Complete!</h3>
1345
+ <p class="quiz-score">You scored ${score} out of ${quizQuestions.length}</p>
1346
+ <p style="text-align: center; margin-top: 20px;">
1347
+ ${score >= 8 ? '🌟 Excellent work!' : score >= 6 ? 'πŸ‘ Good job!' : 'πŸ“š Keep studying!'}
1348
+ </p>
1349
+ <div style="text-align: center; margin-top: 30px;">
1350
+ <button onclick="restartQuiz()">πŸ”„ Retake Test</button>
1351
+ </div>
1352
+ </div>
1353
+ `;
1354
+ return;
1355
+ }
1356
+
1357
+ const q = quizQuestions[quizIndex];
1358
+ let optionsHTML = '';
1359
+ q.opts.forEach((opt, i) => {
1360
+ optionsHTML += `
1361
+ <label class="quiz-option">
1362
+ <input type="radio" name="opt" value="${i}" style="display: none;">
1363
+ ${opt}
1364
+ </label>
1365
+ `;
1366
+ });
1367
+
1368
+ testSection.innerHTML = `
1369
+ <div class="quiz-card">
1370
+ <h3>Question ${quizIndex + 1} of ${quizQuestions.length}</h3>
1371
+ <p>${q.q}</p>
1372
+ ${optionsHTML}
1373
+ <div style="text-align: center; margin-top: 25px;">
1374
+ <button id="submitAns">Submit Answer</button>
1375
+ </div>
1376
+ </div>
1377
+ `;
1378
+
1379
+ // Add event listeners
1380
+ document.querySelectorAll('.quiz-option').forEach(label => {
1381
+ label.addEventListener('click', () => {
1382
+ document.querySelectorAll('.quiz-option').forEach(o => o.classList.remove('selected'));
1383
+ label.classList.add('selected');
1384
+ label.querySelector('input').checked = true;
1385
+ });
1386
+ });
1387
+
1388
+ document.getElementById('submitAns').onclick = () => {
1389
+ const selected = document.querySelector('input[name="opt"]:checked');
1390
+ if (!selected) {
1391
+ alert('Please select an answer!');
1392
+ return;
1393
+ }
1394
+
1395
+ const answer = parseInt(selected.value);
1396
+ if (answer === q.ans) {
1397
+ score++;
1398
+ }
1399
+
1400
+ quizIndex++;
1401
+ renderQuiz();
1402
+ };
1403
+ }
1404
+
1405
+ function restartQuiz() {
1406
+ quizIndex = 0;
1407
+ score = 0;
1408
+ renderQuiz();
1409
+ }
1410
+
1411
+ // ==================== Help System ====================
1412
+ function toggleHelp() {
1413
+ document.getElementById('helpModal').classList.toggle('active');
1414
+ }
1415
+
1416
+ function closeHelpOnClick(event) {
1417
+ if (event.target.id === 'helpModal') {
1418
+ toggleHelp();
1419
+ }
1420
+ }
1421
+
1422
+ // ==================== Initialize ====================
1423
+ loadSavedProgress();
1424
+ updateCard();
1425
+ renderTask();
1426
+ renderQuiz();
1427
+
1428
+ // Add smooth section transitions
1429
+ document.addEventListener('DOMContentLoaded', () => {
1430
+ const activeSection = document.querySelector('.section.active');
1431
+ if (activeSection) {
1432
+ setTimeout(() => {
1433
+ activeSection.style.opacity = '1';
1434
+ activeSection.style.transform = 'translateY(0)';
1435
+ }, 100);
1436
+ }
1437
+ });
1438
+ </script>
1439
+ </body>
1440
  </html>