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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cute Piglets Game</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap');
        
        body {
            font-family: 'Comic Neue', cursive;
            background-color: #FFF5F5;
            background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxkZWZzPjxwYXR0ZXJuIGlkPSJwYXR0ZXJuIiB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHBhdHRlcm5UcmFuc2Zvcm09InJvdGF0ZSg0NSkiPjxyZWN0IHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0icmdiYSgyNTUsMTkyLDIwMywwLjAzKSIvPjwvcGF0dGVybj48L2RlZnM+PHJlY3QgZmlsbD0idXJsKCNwYXR0ZXJuKSIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIvPjwvc3ZnPg==');
        }

        .piglet {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            position: relative;
            overflow: hidden;
        }

        .piglet::before {
            content: '';
            position: absolute;
            top: 30%;
            left: 30%;
            width: 40%;
            height: 40%;
            background-color: rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            transform: scale(0);
            transition: transform 0.3s ease;
        }

        .piglet:hover::before {
            transform: scale(1);
        }

        .piglet.hungry {
            animation: pulse 1.5s infinite;
        }

        .piglet.fed {
            transform: scale(1.05);
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }

        .progress-bar {
            height: 8px;
            border-radius: 4px;
            background-color: #F3F4F6;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            transition: width 0.5s ease;
        }

        .confetti {
            position: absolute;
            width: 10px;
            height: 10px;
            background-color: #F472B6;
            opacity: 0;
        }

        @keyframes confetti-fall {
            0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
            100% { transform: translateY(1000px) rotate(360deg); opacity: 0; }
        }

        .farm-bg {
            background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxkZWZzPjxwYXR0ZXJuIGlkPSJwYXR0ZXJuIiB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgcGF0dGVyblRyYW5zZm9ybT0icm90YXRlKDApIj48cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgZmlsbD0iI2ZmZjVmNSIvPjxwYXRoIGQ9Ik0gMCwwIEwgMCwxMDAgTCAxMDAsMTAwIEwgMTAwLDAgWiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJyZ2JhKDIxNCwxNjMsMTY3LDAuMSkiIHN0cm9rZS13aWR0aD0iMSIvPjwvcGF0dGVybj48L2RlZnM+PHJlY3QgZmlsbD0idXJsKCNwYXR0ZXJuKSIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIvPjwvc3ZnPg==');
            border-radius: 20px;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }

        .piglet-face {
            position: relative;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .piglet-eyes {
            display: flex;
            gap: 20px;
            margin-bottom: 10px;
        }

        .piglet-eye {
            width: 20px;
            height: 20px;
            background-color: #333;
            border-radius: 50%;
            position: relative;
        }

        .piglet-eye::after {
            content: '';
            position: absolute;
            width: 8px;
            height: 8px;
            background-color: white;
            border-radius: 50%;
            top: 4px;
            left: 4px;
        }

        .piglet-nose {
            width: 40px;
            height: 30px;
            background-color: #F472B6;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .piglet-nostrils {
            display: flex;
            gap: 8px;
        }

        .piglet-nostril {
            width: 8px;
            height: 8px;
            background-color: #333;
            border-radius: 50%;
        }

        .piglet-mouth {
            width: 30px;
            height: 15px;
            border-bottom: 3px solid #333;
            border-radius: 0 0 20px 20px;
            margin-top: 10px;
        }

        .piglet-mouth.happy {
            border-bottom: 3px solid #333;
            border-radius: 0 0 20px 20px;
            transform: scaleY(0.7);
        }

        .piglet-mouth.sad {
            border-top: 3px solid #333;
            border-radius: 20px 20px 0 0;
            border-bottom: none;
            transform: scaleY(0.7);
        }

        .tooltip {
            position: absolute;
            bottom: -40px;
            left: 50%;
            transform: translateX(-50%);
            background-color: #333;
            color: white;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
            white-space: nowrap;
        }

        .piglet:hover .tooltip {
            opacity: 1;
        }
    </style>
</head>
<body class="min-h-screen flex flex-col items-center justify-center p-4">
    <div class="max-w-4xl w-full">
        <div class="text-center mb-8">
            <h1 class="text-5xl font-bold text-pink-600 mb-2">Piggy Paradise</h1>
            <p class="text-xl text-pink-500">Feed all the hungry piglets before they get too cranky!</p>
        </div>

        <div class="farm-bg p-8 mb-8">
            <div class="flex justify-between items-center mb-6">
                <div class="flex items-center gap-4">
                    <div class="bg-pink-100 p-3 rounded-full">
                        <i class="fas fa-stopwatch text-pink-600 text-2xl"></i>
                    </div>
                    <div>
                        <p class="text-gray-600">Time played</p>
                        <p id="timer" class="text-2xl font-bold text-pink-600">00:00</p>
                    </div>
                </div>
                
                <div class="flex items-center gap-4">
                    <div class="bg-pink-100 p-3 rounded-full">
                        <i class="fas fa-trophy text-pink-600 text-2xl"></i>
                    </div>
                    <div>
                        <p class="text-gray-600">Score</p>
                        <p id="score" class="text-2xl font-bold text-pink-600">0</p>
                    </div>
                </div>
            </div>

            <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4 piglets-grid mb-6"></div>

            <div class="flex flex-col items-center game-status">
                <div class="bg-pink-100 rounded-full px-6 py-3 mb-4 shadow-md">
                    <p id="status-message" class="text-pink-700 font-bold text-lg">Click on piglets to feed them!</p>
                </div>
                <button id="restart-btn" class="hidden bg-pink-600 hover:bg-pink-700 text-white font-bold py-2 px-6 rounded-full transition-all transform hover:scale-105">
                    Play Again <i class="fas fa-redo ml-2"></i>
                </button>
            </div>
        </div>

        <div class="text-center text-gray-500">
            <p>Made with <i class="fas fa-heart text-pink-500"></i> for pig lovers everywhere</p>
        </div>
    </div>

    <script>
        // Game elements
        const pigletsGrid = document.querySelector('.piglets-grid');
        const statusMessage = document.getElementById('status-message');
        const timerElement = document.getElementById('timer');
        const scoreElement = document.getElementById('score');
        const restartBtn = document.getElementById('restart-btn');

        // Game variables
        let piglets = [];
        let gameOver = false;
        let score = 0;
        let seconds = 0;
        let timerInterval;
        let hungryCount = 0;

        // Initialize game
        function initGame() {
            // Reset game state
            pigletsGrid.innerHTML = '';
            piglets = [];
            gameOver = false;
            score = 0;
            seconds = 0;
            hungryCount = 0;
            scoreElement.textContent = score;
            timerElement.textContent = '00:00';
            statusMessage.textContent = 'Click on piglets to feed them!';
            restartBtn.classList.add('hidden');
            
            // Clear existing timer
            if (timerInterval) clearInterval(timerInterval);
            
            // Start timer
            timerInterval = setInterval(updateTimer, 1000);
            
            // Create piglets
            for (let i = 0; i < 8; i++) {
                createPiglet(i);
            }
        }

        // Create a piglet element
        function createPiglet(index) {
            const piglet = document.createElement('div');
            piglet.classList.add('piglet', 'relative', 'rounded-full', 'bg-pink-300', 'cursor-pointer', 'overflow-hidden');
            piglet.dataset.index = index;
            piglet.dataset.hunger = Math.floor(Math.random() * 40 + 60); // Start between 60-100
            piglet.dataset.lastFed = 0;
            
            // Create piglet face
            const pigletFace = document.createElement('div');
            pigletFace.classList.add('piglet-face');
            
            // Eyes
            const eyes = document.createElement('div');
            eyes.classList.add('piglet-eyes');
            
            const leftEye = document.createElement('div');
            leftEye.classList.add('piglet-eye');
            
            const rightEye = document.createElement('div');
            rightEye.classList.add('piglet-eye');
            
            eyes.appendChild(leftEye);
            eyes.appendChild(rightEye);
            
            // Nose
            const nose = document.createElement('div');
            nose.classList.add('piglet-nose');
            
            const nostrils = document.createElement('div');
            nostrils.classList.add('piglet-nostrils');
            
            const leftNostril = document.createElement('div');
            leftNostril.classList.add('piglet-nostril');
            
            const rightNostril = document.createElement('div');
            rightNostril.classList.add('piglet-nostril');
            
            nostrils.appendChild(leftNostril);
            nostrils.appendChild(rightNostril);
            nose.appendChild(nostrils);
            
            // Mouth
            const mouth = document.createElement('div');
            mouth.classList.add('piglet-mouth', 'happy');
            
            pigletFace.appendChild(eyes);
            pigletFace.appendChild(nose);
            pigletFace.appendChild(mouth);
            
            // Progress bar
            const progressContainer = document.createElement('div');
            progressContainer.classList.add('progress-bar', 'w-4/5', 'mt-2', 'mx-auto');
            
            const progressFill = document.createElement('div');
            progressFill.classList.add('progress-fill', 'bg-pink-500');
            progressFill.style.width = `${piglet.dataset.hunger}%`;
            
            progressContainer.appendChild(progressFill);
            
            // Tooltip
            const tooltip = document.createElement('div');
            tooltip.classList.add('tooltip');
            tooltip.textContent = `Hunger: ${piglet.dataset.hunger}%`;
            
            piglet.appendChild(pigletFace);
            piglet.appendChild(progressContainer);
            piglet.appendChild(tooltip);
            
            pigletsGrid.appendChild(piglet);
            piglets.push(piglet);
        }

        // Update timer
        function updateTimer() {
            if (!gameOver) {
                seconds++;
                const minutes = Math.floor(seconds / 60);
                const remainingSeconds = seconds % 60;
                timerElement.textContent = `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
            }
        }

        // Update piglet hunger levels
        setInterval(() => {
            if (!gameOver) {
                hungryCount = 0;
                
                piglets.forEach((piglet) => {
                    let hunger = parseInt(piglet.dataset.hunger);
                    hunger -= 1;
                    piglet.dataset.hunger = hunger;
                    piglet.dataset.lastFed = parseInt(piglet.dataset.lastFed) + 1;
                    
                    // Update progress bar
                    const progressFill = piglet.querySelector('.progress-fill');
                    progressFill.style.width = `${hunger}%`;
                    
                    // Update tooltip
                    const tooltip = piglet.querySelector('.tooltip');
                    tooltip.textContent = `Hunger: ${hunger}%`;
                    
                    // Update appearance based on hunger
                    const mouth = piglet.querySelector('.piglet-mouth');
                    
                    if (hunger <= 30) {
                        hungryCount++;
                        piglet.classList.add('hungry');
                        piglet.classList.remove('bg-pink-300', 'bg-green-200');
                        piglet.classList.add('bg-pink-500');
                        mouth.classList.remove('happy');
                        mouth.classList.add('sad');
                        progressFill.classList.remove('bg-pink-500', 'bg-green-400');
                        progressFill.classList.add('bg-red-500');
                    } else if (hunger >= 70) {
                        piglet.classList.remove('hungry', 'bg-pink-500');
                        piglet.classList.add('bg-pink-300');
                        mouth.classList.remove('sad');
                        mouth.classList.add('happy');
                        progressFill.classList.remove('bg-red-500', 'bg-green-400');
                        progressFill.classList.add('bg-pink-500');
                    }
                    
                    // If recently fed
                    if (parseInt(piglet.dataset.lastFed) < 5 && hunger > 30) {
                        piglet.classList.remove('bg-pink-300', 'bg-pink-500');
                        piglet.classList.add('bg-green-200');
                        progressFill.classList.remove('bg-pink-500', 'bg-red-500');
                        progressFill.classList.add('bg-green-400');
                    }
                });
                
                checkGameStatus();
            }
        }, 1000);

        // Feed piglet on click
        pigletsGrid.addEventListener('click', (e) => {
            let target = e.target;
            
            // Find the piglet element (might have clicked on child elements)
            while (target && !target.classList.contains('piglet') && target !== pigletsGrid) {
                target = target.parentElement;
            }
            
            if (target.classList.contains('piglet') && !gameOver) {
                const piglet = target;
                let hunger = parseInt(piglet.dataset.hunger);
                
                // Only feed if not already full
                if (hunger < 100) {
                    hunger += 30;
                    if (hunger > 100) hunger = 100;
                    piglet.dataset.hunger = hunger;
                    piglet.dataset.lastFed = 0;
                    
                    // Update progress bar
                    const progressFill = piglet.querySelector('.progress-fill');
                    progressFill.style.width = `${hunger}%`;
                    progressFill.classList.remove('bg-red-500');
                    progressFill.classList.add('bg-green-400');
                    
                    // Update tooltip
                    const tooltip = piglet.querySelector('.tooltip');
                    tooltip.textContent = `Hunger: ${hunger}%`;
                    
                    // Visual feedback
                    piglet.classList.remove('hungry', 'bg-pink-500');
                    piglet.classList.add('bg-green-200');
                    
                    const mouth = piglet.querySelector('.piglet-mouth');
                    mouth.classList.remove('sad');
                    mouth.classList.add('happy');
                    
                    // Add to score
                    score += 10;
                    scoreElement.textContent = score;
                    
                    // Create feed effect
                    createFeedEffect(piglet);
                }
            }
        });

        // Create feed effect (hearts animation)
        function createFeedEffect(piglet) {
            for (let i = 0; i < 5; i++) {
                const heart = document.createElement('div');
                heart.innerHTML = '<i class="fas fa-heart text-pink-500"></i>';
                heart.classList.add('absolute', 'text-xl', 'animate-bounce', 'opacity-70');
                heart.style.left = `${Math.random() * 60 + 20}%`;
                heart.style.top = `${Math.random() * 60 + 20}%`;
                heart.style.animationDuration = `${Math.random() * 0.5 + 0.5}s`;
                heart.style.animationDelay = `${i * 0.1}s`;
                
                piglet.appendChild(heart);
                
                // Remove after animation
                setTimeout(() => {
                    heart.remove();
                }, 1000);
            }
        }

        // Create confetti effect
        function createConfetti() {
            const container = document.querySelector('.farm-bg');
            
            for (let i = 0; i < 100; i++) {
                const confetti = document.createElement('div');
                confetti.classList.add('confetti');
                confetti.style.left = `${Math.random() * 100}%`;
                confetti.style.backgroundColor = `hsl(${Math.random() * 360}, 100%, 75%)`;
                confetti.style.width = `${Math.random() * 10 + 5}px`;
                confetti.style.height = `${Math.random() * 10 + 5}px`;
                confetti.style.animation = `confetti-fall ${Math.random() * 3 + 2}s linear forwards`;
                confetti.style.animationDelay = `${Math.random() * 0.5}s`;
                
                container.appendChild(confetti);
                
                // Remove after animation
                setTimeout(() => {
                    confetti.remove();
                }, 3000);
            }
        }

        // Check game status
        function checkGameStatus() {
            const allFed = piglets.every((piglet) => parseInt(piglet.dataset.hunger) >= 70);
            
            if (allFed) {
                gameOver = true;
                clearInterval(timerInterval);
                statusMessage.textContent = 'Congratulations! All piglets are happy and fed!';
                restartBtn.classList.remove('hidden');
                createConfetti();
                
                // Bonus points for time
                const timeBonus = Math.max(0, 500 - seconds * 2);
                score += timeBonus;
                scoreElement.textContent = score;
                
                if (timeBonus > 0) {
                    setTimeout(() => {
                        statusMessage.textContent = `Time bonus: +${timeBonus} points!`;
                    }, 2000);
                }
            } else {
                if (hungryCount === 0) {
                    statusMessage.textContent = 'All piglets are content! Keep feeding them!';
                } else if (hungryCount === 1) {
                    statusMessage.textContent = '1 piglet is hungry! Click to feed!';
                } else {
                    statusMessage.textContent = `${hungryCount} piglets are hungry! Feed them!`;
                }
            }
        }

        // Restart game
        restartBtn.addEventListener('click', initGame);

        // Start the game
        initGame();
    </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=porkz/piggy-paradise" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>