File size: 24,220 Bytes
6c131e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Meme Typing Speed Test</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap');
        
        body {
            font-family: 'Comic Neue', cursive;
            transition: background-image 0.5s ease-in-out;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            min-height: 100vh;
        }
        
        .bg-overlay {
            background-color: rgba(0, 0, 0, 0.6);
        }
        
        .text-display {
            font-size: 1.2rem;
            line-height: 1.8;
            letter-spacing: 0.05em;
        }
        
        .correct {
            color: #4ade80;
        }
        
        .incorrect {
            color: #f87171;
            text-decoration: underline;
        }
        
        .current {
            background-color: rgba(74, 222, 128, 0.3);
            border-left: 2px solid #4ade80;
        }
        
        .fade-in {
            animation: fadeIn 0.5s;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        .meme-caption {
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
            animation: bounce 1s infinite alternate;
        }
        
        @keyframes bounce {
            from { transform: translateY(0); }
            to { transform: translateY(-5px); }
        }
        
        .result-card {
            backdrop-filter: blur(10px);
            background-color: rgba(255, 255, 255, 0.15);
        }
    </style>
</head>
<body class="bg-gray-900 text-white" id="app">
    <div class="bg-overlay min-h-screen flex flex-col items-center justify-center p-4 md:p-8">
        <div class="w-full max-w-4xl mx-auto">
            <!-- Header -->
            <header class="text-center mb-8 fade-in">
                <h1 class="text-4xl md:text-5xl font-bold mb-2 text-yellow-300">Meme Typing Speed Test</h1>
                <p class="text-lg md:text-xl text-gray-300">Type fast, get roasted, enjoy the memes!</p>
            </header>
            
            <!-- Stats Display -->
            <div class="flex justify-between mb-6 bg-gray-800 rounded-lg p-4 shadow-lg">
                <div class="text-center">
                    <p class="text-sm text-gray-400">Speed</p>
                    <p class="text-2xl font-bold" id="wpm">0</p>
                    <p class="text-xs">WPM</p>
                </div>
                <div class="text-center">
                    <p class="text-sm text-gray-400">Accuracy</p>
                    <p class="text-2xl font-bold" id="accuracy">100</p>
                    <p class="text-xs">%</p>
                </div>
                <div class="text-center">
                    <p class="text-sm text-gray-400">Time</p>
                    <p class="text-2xl font-bold" id="time">60</p>
                    <p class="text-xs">seconds</p>
                </div>
            </div>
            
            <!-- Meme Caption -->
            <div class="text-center mb-6">
                <p class="text-xl md:text-2xl font-bold meme-caption text-yellow-300" id="meme-caption">Ready to get roasted by your typing speed?</p>
            </div>
            
            <!-- Typing Test Area -->
            <div id="test-container" class="fade-in">
                <div class="mb-6 p-4 bg-gray-800 rounded-lg shadow-lg">
                    <div id="text-display" class="text-display mb-4 h-24 overflow-y-auto"></div>
                    <input 
                        type="text" 
                        id="input-field" 
                        class="w-full p-3 bg-gray-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-yellow-400" 
                        placeholder="Click here to start typing..." 
                        autocomplete="off"
                        autocorrect="off"
                        autocapitalize="off"
                        spellcheck="false"
                    >
                </div>
                
                <div class="text-center">
                    <button id="start-btn" class="px-6 py-3 bg-yellow-400 hover:bg-yellow-500 text-gray-900 font-bold rounded-lg transition duration-200">
                        Start Test
                    </button>
                </div>
            </div>
            
            <!-- Results (Hidden Initially) -->
            <div id="results-container" class="hidden fade-in">
                <div class="result-card rounded-lg p-6 mb-6 shadow-xl border border-gray-700">
                    <h2 class="text-3xl font-bold text-center mb-4 text-yellow-300">Your Results</h2>
                    
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
                        <div class="bg-gray-800 p-4 rounded-lg">
                            <p class="text-sm text-gray-400">Final Speed</p>
                            <p class="text-3xl font-bold" id="final-wpm">0</p>
                            <p class="text-xs">Words Per Minute</p>
                        </div>
                        <div class="bg-gray-800 p-4 rounded-lg">
                            <p class="text-sm text-gray-400">Accuracy</p>
                            <p class="text-3xl font-bold" id="final-accuracy">100</p>
                            <p class="text-xs">% Correct</p>
                        </div>
                        <div class="bg-gray-800 p-4 rounded-lg">
                            <p class="text-sm text-gray-400">Meme Level</p>
                            <p class="text-3xl font-bold" id="meme-level">Snail</p>
                            <p class="text-xs">Speed Tier</p>
                        </div>
                    </div>
                    
                    <div class="text-center mb-6">
                        <p class="text-xl font-bold" id="final-caption">You type like a sloth on a lazy Sunday!</p>
                    </div>
                    
                    <div class="flex flex-col md:flex-row justify-center gap-4">
                        <button id="restart-btn" class="px-6 py-3 bg-yellow-400 hover:bg-yellow-500 text-gray-900 font-bold rounded-lg transition duration-200">
                            Try Again
                        </button>
                        <button id="share-btn" class="px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white font-bold rounded-lg transition duration-200">
                            Share Results
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Sample texts for typing test
        const sampleTexts = [
            "The quick brown fox jumps over the lazy dog. Pack my box with five dozen liquor jugs. How vexingly quick daft zebras jump!",
            "Crazy Fredrick bought many very exquisite opal jewels. The five boxing wizards jump quickly. My girl wove six dozen plaid jackets before she quit.",
            "Jinxed wizards pluck ivy from the big quilt. Crazy Fredrick bought many very exquisite opal jewels. Sphinx of black quartz, judge my vow.",
            "The quick onyx goblin jumps over the lazy dwarf. Pack my red box with five dozen quality jugs. How quickly daft jumping zebras vex!",
            "Bright vixens jump; dozy fowl quack. Quick wafting zephyrs vex bold Jim. Two driven jocks help fax my big quiz. Five quacking zephyrs jolt my wax bed."
        ];
        
        // Meme GIFs for different speed tiers
        const memeGifs = {
            slow: "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExcGJhZ2J0dG9uY2J0d3F4dGJ5d3R6Z2V4eXJ2bGJ5b2VtZ2J5eW1rZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3o7TKTD1P5JCDoQxKU/giphy.gif",
            medium: "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExb2V4dG5oZ2R4dW5tZ2J5eW1rZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/l0HU20BZ6LbSEITza/giphy.gif",
            fast: "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExb2V4dG5oZ2R4dW5tZ2J5eW1rZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3o7aCTPPm4OHfRLSH6/giphy.gif",
            ultra: "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExb2V4dG5oZ2R4dW5tZ2J5eW1rZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xT5LMHxhOfscxPfIfm/giphy.gif"
        };
        
        // Meme captions for different speed tiers
        const memeCaptions = {
            slow: [
                "Your grandma types faster than this.",
                "Are you typing with your nose?",
                "I've seen sloths move faster.",
                "Is your keyboard made of molasses?",
                "At this rate, you'll finish by next Christmas."
            ],
            medium: [
                "Not bad... for a turtle.",
                "You're trying, and that's what counts.",
                "Speed: Average. Meme potential: High.",
                "You type like a middle manager.",
                "Could be worse... could be better."
            ],
            fast: [
                "WOOOSH! You're going places!",
                "Someone's been practicing!",
                "Now we're cooking with gas!",
                "Look at you go, speed demon!",
                "The keyboard is on fire!"
            ],
            ultra: [
                "HOLY MOLY! Are you a robot?",
                "The Flash called, he wants his speed back.",
                "You type faster than light travels.",
                "Did you sell your soul for typing powers?",
                "NASA wants to study your fingers."
            ]
        };
        
        // Final result captions
        const resultCaptions = {
            slow: [
                "You type like a sloth on a lazy Sunday.",
                "Your fingers move at geological speeds.",
                "At least you're consistent... consistently slow.",
                "Maybe try voice typing next time?",
                "The good news: You can only improve from here!"
            ],
            medium: [
                "You're the typing equivalent of vanilla ice cream.",
                "Not too hot, not too cold... just right.",
                "You type like a reliable Honda Civic.",
                "Perfectly adequate in every way.",
                "You're the human equivalent of 60 WPM."
            ],
            fast: [
                "Look at you, you speedy little typist!",
                "Your fingers dance across the keyboard!",
                "You type like a caffeinated secretary.",
                "The keyboard trembles at your approach!",
                "You've clearly spent too much time online."
            ],
            ultra: [
                "ARE YOU EVEN HUMAN? This is insane!",
                "Your fingers are a blur of typing fury!",
                "The keyboard can't keep up with you!",
                "You type faster than most people think!",
                "Warning: Typing at this speed may cause spontaneous combustion."
            ]
        };
        
        // DOM elements
        const textDisplay = document.getElementById('text-display');
        const inputField = document.getElementById('input-field');
        const startBtn = document.getElementById('start-btn');
        const wpmDisplay = document.getElementById('wpm');
        const accuracyDisplay = document.getElementById('accuracy');
        const timeDisplay = document.getElementById('time');
        const memeCaption = document.getElementById('meme-caption');
        const testContainer = document.getElementById('test-container');
        const resultsContainer = document.getElementById('results-container');
        const finalWpm = document.getElementById('final-wpm');
        const finalAccuracy = document.getElementById('final-accuracy');
        const memeLevel = document.getElementById('meme-level');
        const finalCaption = document.getElementById('final-caption');
        const restartBtn = document.getElementById('restart-btn');
        const shareBtn = document.getElementById('share-btn');
        
        // Test variables
        let currentText = '';
        let timer;
        let timeLeft = 60;
        let isTyping = false;
        let correctChars = 0;
        let incorrectChars = 0;
        let totalTyped = 0;
        let wpm = 0;
        let accuracy = 100;
        let speedInterval;
        let lastUpdateTime = 0;
        let correctKeystrokes = 0;
        let totalKeystrokes = 0;
        
        // Initialize the app
        function init() {
            // Preload all GIFs
            preloadGifs();
            
            // Set up event listeners
            startBtn.addEventListener('click', startTest);
            inputField.addEventListener('input', checkTyping);
            inputField.addEventListener('keydown', (e) => {
                if (e.key === 'Enter') {
                    e.preventDefault();
                }
            });
            restartBtn.addEventListener('click', resetTest);
            shareBtn.addEventListener('click', shareResults);
            
            // Display a random text sample
            displaySampleText();
        }
        
        // Preload all GIFs to avoid loading delays
        function preloadGifs() {
            Object.values(memeGifs).forEach(url => {
                const img = new Image();
                img.src = url;
            });
        }
        
        // Display a random sample text
        function displaySampleText() {
            currentText = sampleTexts[Math.floor(Math.random() * sampleTexts.length)];
            textDisplay.innerHTML = '';
            
            currentText.split('').forEach(char => {
                const span = document.createElement('span');
                span.textContent = char;
                textDisplay.appendChild(span);
            });
        }
        
        // Start the typing test
        function startTest() {
            if (isTyping) return;
            
            isTyping = true;
            timeLeft = 60;
            correctChars = 0;
            incorrectChars = 0;
            totalTyped = 0;
            wpm = 0;
            accuracy = 100;
            correctKeystrokes = 0;
            totalKeystrokes = 0;
            
            // Update UI
            startBtn.classList.add('hidden');
            inputField.value = '';
            inputField.focus();
            timeDisplay.textContent = timeLeft;
            
            // Start timer
            timer = setInterval(updateTimer, 1000);
            
            // Start WPM calculation
            lastUpdateTime = Date.now();
            speedInterval = setInterval(calculateSpeed, 2000);
            
            // Set initial meme
            updateMeme();
        }
        
        // Update the timer
        function updateTimer() {
            timeLeft--;
            timeDisplay.textContent = timeLeft;
            
            if (timeLeft <= 0) {
                finishTest();
            }
        }
        
        // Calculate typing speed (WPM)
        function calculateSpeed() {
            const now = Date.now();
            const timeElapsed = (now - lastUpdateTime) / 1000 / 60; // in minutes
            const charsTyped = totalTyped;
            
            if (timeElapsed > 0) {
                // WPM = (correct characters / 5) / minutes
                wpm = Math.round((correctChars / 5) / timeElapsed);
                accuracy = totalTyped > 0 ? Math.round((correctKeystrokes / totalKeystrokes) * 100) : 100;
                
                wpmDisplay.textContent = wpm;
                accuracyDisplay.textContent = accuracy;
                
                updateMeme();
            }
            
            lastUpdateTime = now;
            correctChars = 0;
            totalTyped = 0;
        }
        
        // Check typing against sample text
        function checkTyping() {
            if (!isTyping) return;
            
            const inputText = inputField.value;
            const currentChar = inputText[inputText.length - 1];
            const expectedChar = currentText[inputText.length - 1];
            
            totalTyped++;
            totalKeystrokes++;
            
            // Check if the character is correct
            if (currentChar === expectedChar) {
                correctChars++;
                correctKeystrokes++;
            } else {
                incorrectChars++;
            }
            
            // Update the text display with correct/incorrect styling
            updateTextDisplay(inputText);
        }
        
        // Update the text display with coloring
        function updateTextDisplay(inputText) {
            const textSpans = textDisplay.querySelectorAll('span');
            
            textSpans.forEach((span, index) => {
                // Reset classes
                span.className = '';
                
                // Already typed characters
                if (index < inputText.length) {
                    if (inputText[index] === currentText[index]) {
                        span.classList.add('correct');
                    } else {
                        span.classList.add('incorrect');
                    }
                }
                
                // Current character
                if (index === inputText.length) {
                    span.classList.add('current');
                }
            });
            
            // Scroll to keep current character in view
            const currentSpan = textDisplay.querySelector('.current');
            if (currentSpan) {
                currentSpan.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
            }
        }
        
        // Update the meme based on current WPM
        function updateMeme() {
            let speedTier, randomCaption;
            
            if (wpm <= 20) {
                speedTier = 'slow';
                randomCaption = memeCaptions.slow[Math.floor(Math.random() * memeCaptions.slow.length)];
            } else if (wpm <= 50) {
                speedTier = 'medium';
                randomCaption = memeCaptions.medium[Math.floor(Math.random() * memeCaptions.medium.length)];
            } else if (wpm <= 80) {
                speedTier = 'fast';
                randomCaption = memeCaptions.fast[Math.floor(Math.random() * memeCaptions.fast.length)];
            } else {
                speedTier = 'ultra';
                randomCaption = memeCaptions.ultra[Math.floor(Math.random() * memeCaptions.ultra.length)];
            }
            
            // Update background
            document.body.style.backgroundImage = `url(${memeGifs[speedTier]})`;
            
            // Update caption
            memeCaption.textContent = randomCaption;
        }
        
        // Finish the test and show results
        function finishTest() {
            clearInterval(timer);
            clearInterval(speedInterval);
            isTyping = false;
            
            // Calculate final WPM and accuracy
            const finalWpmValue = Math.max(0, wpm);
            const finalAccuracyValue = Math.max(0, Math.min(100, accuracy));
            
            // Determine speed tier
            let speedTier, levelName, randomResultCaption;
            
            if (finalWpmValue <= 20) {
                speedTier = 'slow';
                levelName = 'Snail';
                randomResultCaption = resultCaptions.slow[Math.floor(Math.random() * resultCaptions.slow.length)];
            } else if (finalWpmValue <= 50) {
                speedTier = 'medium';
                levelName = 'Average Joe';
                randomResultCaption = resultCaptions.medium[Math.floor(Math.random() * resultCaptions.medium.length)];
            } else if (finalWpmValue <= 80) {
                speedTier = 'fast';
                levelName = 'Speed Demon';
                randomResultCaption = resultCaptions.fast[Math.floor(Math.random() * resultCaptions.fast.length)];
            } else {
                speedTier = 'ultra';
                levelName = 'GOD MODE';
                randomResultCaption = resultCaptions.ultra[Math.floor(Math.random() * resultCaptions.ultra.length)];
            }
            
            // Update final results
            finalWpm.textContent = finalWpmValue;
            finalAccuracy.textContent = finalAccuracyValue;
            memeLevel.textContent = levelName;
            finalCaption.textContent = randomResultCaption;
            
            // Set final meme
            document.body.style.backgroundImage = `url(${memeGifs[speedTier]})`;
            
            // Show results container
            testContainer.classList.add('hidden');
            resultsContainer.classList.remove('hidden');
        }
        
        // Reset the test
        function resetTest() {
            clearInterval(timer);
            clearInterval(speedInterval);
            
            isTyping = false;
            inputField.value = '';
            
            // Reset displays
            wpmDisplay.textContent = '0';
            accuracyDisplay.textContent = '100';
            timeDisplay.textContent = '60';
            
            // Show test container
            testContainer.classList.remove('hidden');
            resultsContainer.classList.add('hidden');
            
            // Reset start button
            startBtn.classList.remove('hidden');
            
            // Get new sample text
            displaySampleText();
            
            // Reset meme
            memeCaption.textContent = "Ready to get roasted by your typing speed?";
            document.body.style.backgroundImage = '';
        }
        
        // Share results
        function shareResults() {
            const finalWpmValue = finalWpm.textContent;
            const finalAccuracyValue = finalAccuracy.textContent;
            const levelName = memeLevel.textContent;
            const caption = finalCaption.textContent;
            
            const shareText = `I just scored ${finalWpmValue} WPM (${finalAccuracyValue}% accuracy) on the Meme Typing Speed Test! ${caption} Try it yourself!`;
            
            if (navigator.share) {
                navigator.share({
                    title: 'My Typing Speed Results',
                    text: shareText,
                    url: window.location.href
                }).catch(err => {
                    console.log('Error sharing:', err);
                    fallbackShare(shareText);
                });
            } else {
                fallbackShare(shareText);
            }
        }
        
        // Fallback for browsers that don't support Web Share API
        function fallbackShare(text) {
            // Copy to clipboard
            navigator.clipboard.writeText(text).then(() => {
                alert('Results copied to clipboard! Paste it anywhere to share.');
            }).catch(err => {
                console.log('Could not copy text: ', err);
                prompt('Copy this to share:', text);
            });
        }
        
        // Initialize the app when the DOM is loaded
        document.addEventListener('DOMContentLoaded', init);
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=GameDev102/meme-typing-speed-test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>