File size: 15,978 Bytes
e40da14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neon Math Explosion Quiz</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=Press+Start+2P&display=swap');
        
        body {
            font-family: 'Press Start 2P', cursive;
            background-color: #0a0a1a;
            color: #fff;
            overflow: hidden;
        }
        
        .neon-text {
            text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #ff00de, 0 0 30px #ff00de;
            color: white;
        }
        
        .neon-box {
            box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #00f7ff, 0 0 30px #00f7ff;
            border: 2px solid #00f7ff;
            background-color: rgba(0, 0, 20, 0.7);
        }
        
        .neon-button {
            transition: all 0.3s;
            box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #00ff88, 0 0 30px #00ff88;
            border: 2px solid #00ff88;
            background-color: rgba(0, 20, 10, 0.7);
        }
        
        .neon-button:hover {
            transform: scale(1.05);
            box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #00ff88, 0 0 40px #00ff88;
        }
        
        .option {
            transition: all 0.3s;
            box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #ffcc00, 0 0 30px #ffcc00;
            border: 2px solid #ffcc00;
            background-color: rgba(20, 15, 0, 0.7);
        }
        
        .option:hover {
            transform: scale(1.05);
            box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #ffcc00, 0 0 40px #ffcc00;
        }
        
        .correct {
            animation: correct 1s;
            box-shadow: 0 0 20px #00ff88, 0 0 40px #00ff88;
        }
        
        .wrong {
            animation: wrong 1s;
            box-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000;
        }
        
        @keyframes correct {
            0% { transform: scale(1); }
            50% { transform: scale(1.1); }
            100% { transform: scale(1); }
        }
        
        @keyframes wrong {
            0% { transform: scale(1); }
            50% { transform: scale(0.9); }
            100% { transform: scale(1); }
        }
        
        .explosion {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #ff0000;
            opacity: 0;
            z-index: 100;
            pointer-events: none;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 5rem;
            color: white;
            text-shadow: 0 0 10px black;
            animation: explosion 2s ease-out;
        }
        
        @keyframes explosion {
            0% { opacity: 0; transform: scale(0.1); }
            20% { opacity: 1; }
            100% { opacity: 0; transform: scale(2); }
        }
        
        .particle {
            position: absolute;
            background-color: #ff9900;
            border-radius: 50%;
            pointer-events: none;
        }
        
        .score-display {
            font-size: 2rem;
            text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #00ff88, 0 0 30px #00ff88;
        }
        
        .question {
            min-height: 100px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    </style>
</head>
<body class="min-h-screen flex flex-col items-center justify-center p-4">
    <div id="app" class="w-full max-w-2xl">
        <h1 class="text-4xl md:text-5xl text-center mb-8 neon-text">NEON MATH EXPLOSION</h1>
        
        <div class="neon-box rounded-lg p-6 mb-8">
            <div class="flex justify-between items-center mb-6">
                <div class="score-display">Score: <span id="score">0</span></div>
                <div class="text-xl">Question: <span id="question-number">1</span>/10</div>
            </div>
            
            <div class="question text-2xl mb-8 text-center" id="question">
                Loading question...
            </div>
            
            <div class="grid grid-cols-2 gap-4 mb-6" id="options">
                <!-- Options will be inserted here -->
            </div>
            
            <div class="flex justify-center">
                <button id="next-btn" class="neon-button py-3 px-6 rounded-lg text-lg hidden">
                    NEXT QUESTION <i class="fas fa-arrow-right ml-2"></i>
                </button>
            </div>
        </div>
        
        <div id="start-screen" class="neon-box rounded-lg p-8 text-center">
            <h2 class="text-2xl md:text-3xl mb-6 neon-text">READY FOR THE CHALLENGE?</h2>
            <p class="mb-8">Answer 10 math questions correctly... or face explosive consequences!</p>
            <button id="start-btn" class="neon-button py-3 px-8 rounded-lg text-xl">
                START QUIZ <i class="fas fa-bolt ml-2"></i>
            </button>
        </div>
    </div>
    
    <div id="explosion" class="explosion hidden">
        BOOM!
    </div>
    
    <div id="game-over" class="neon-box rounded-lg p-8 text-center hidden absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-50 w-4/5 max-w-md">
        <h2 class="text-3xl mb-6 neon-text">GAME OVER</h2>
        <p class="mb-4 text-xl">Your final score:</p>
        <p class="text-4xl mb-8 score-display" id="final-score">0</p>
        <button id="restart-btn" class="neon-button py-3 px-8 rounded-lg text-xl">
            PLAY AGAIN <i class="fas fa-redo ml-2"></i>
        </button>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', () => {
            // DOM elements
            const startScreen = document.getElementById('start-screen');
            const app = document.getElementById('app');
            const questionElement = document.getElementById('question');
            const optionsContainer = document.getElementById('options');
            const nextButton = document.getElementById('next-btn');
            const scoreElement = document.getElementById('score');
            const questionNumberElement = document.getElementById('question-number');
            const startButton = document.getElementById('start-btn');
            const explosionElement = document.getElementById('explosion');
            const gameOverScreen = document.getElementById('game-over');
            const finalScoreElement = document.getElementById('final-score');
            const restartButton = document.getElementById('restart-btn');
            
            // Quiz variables
            let currentQuestionIndex = 0;
            let score = 0;
            let questions = [];
            let selectedAnswer = null;
            let quizActive = false;
            
            // Generate questions
            function generateQuestions() {
                const operations = ['+', '-', '*', '/'];
                questions = [];
                
                for (let i = 0; i < 10; i++) {
                    const operation = operations[Math.floor(Math.random() * operations.length)];
                    let num1, num2, answer;
                    
                    switch(operation) {
                        case '+':
                            num1 = Math.floor(Math.random() * 50) + 10;
                            num2 = Math.floor(Math.random() * 50) + 10;
                            answer = num1 + num2;
                            break;
                        case '-':
                            num1 = Math.floor(Math.random() * 50) + 30;
                            num2 = Math.floor(Math.random() * num1) + 1;
                            answer = num1 - num2;
                            break;
                        case '*':
                            num1 = Math.floor(Math.random() * 12) + 1;
                            num2 = Math.floor(Math.random() * 12) + 1;
                            answer = num1 * num2;
                            break;
                        case '/':
                            num2 = Math.floor(Math.random() * 10) + 1;
                            answer = Math.floor(Math.random() * 10) + 1;
                            num1 = num2 * answer;
                            break;
                    }
                    
                    // Generate options
                    let options = [answer];
                    while (options.length < 4) {
                        let wrongAnswer;
                        if (operation === '/') {
                            wrongAnswer = Math.floor(Math.random() * 15) + 1;
                        } else {
                            wrongAnswer = answer + (Math.floor(Math.random() * 10) - 5);
                        }
                        
                        if (wrongAnswer !== answer && !options.includes(wrongAnswer) && wrongAnswer > 0) {
                            options.push(wrongAnswer);
                        }
                    }
                    
                    // Shuffle options
                    options = options.sort(() => Math.random() - 0.5);
                    
                    questions.push({
                        question: `${num1} ${operation} ${num2} = ?`,
                        answer: answer,
                        options: options
                    });
                }
            }
            
            // Start quiz
            function startQuiz() {
                generateQuestions();
                currentQuestionIndex = 0;
                score = 0;
                quizActive = true;
                scoreElement.textContent = score;
                questionNumberElement.textContent = 1;
                startScreen.classList.add('hidden');
                app.classList.remove('hidden');
                showQuestion();
            }
            
            // Show question
            function showQuestion() {
                const currentQuestion = questions[currentQuestionIndex];
                questionElement.textContent = currentQuestion.question;
                
                optionsContainer.innerHTML = '';
                currentQuestion.options.forEach((option, index) => {
                    const optionElement = document.createElement('div');
                    optionElement.className = 'option py-4 px-2 rounded-lg text-center cursor-pointer text-xl';
                    optionElement.textContent = option;
                    optionElement.dataset.option = option;
                    optionElement.addEventListener('click', selectAnswer);
                    optionsContainer.appendChild(optionElement);
                });
                
                nextButton.classList.add('hidden');
                selectedAnswer = null;
            }
            
            // Select answer
            function selectAnswer(e) {
                if (!quizActive || selectedAnswer !== null) return;
                
                const selectedOption = e.target;
                const currentQuestion = questions[currentQuestionIndex];
                selectedAnswer = selectedOption.dataset.option;
                
                // Disable all options
                const options = document.querySelectorAll('.option');
                options.forEach(option => {
                    option.style.pointerEvents = 'none';
                    if (option.dataset.option == currentQuestion.answer) {
                        option.classList.add('correct');
                    }
                });
                
                // Check if answer is correct
                if (selectedAnswer == currentQuestion.answer) {
                    selectedOption.classList.add('correct');
                    score += 10;
                    scoreElement.textContent = score;
                } else {
                    selectedOption.classList.add('wrong');
                    createExplosion();
                }
                
                nextButton.classList.remove('hidden');
            }
            
            // Next question
            function nextQuestion() {
                currentQuestionIndex++;
                questionNumberElement.textContent = currentQuestionIndex + 1;
                
                if (currentQuestionIndex < questions.length) {
                    showQuestion();
                } else {
                    endQuiz();
                }
            }
            
            // Create explosion effect
            function createExplosion() {
                explosionElement.classList.remove('hidden');
                
                // Create particles
                for (let i = 0; i < 50; i++) {
                    const particle = document.createElement('div');
                    particle.className = 'particle';
                    const size = Math.random() * 20 + 5;
                    particle.style.width = `${size}px`;
                    particle.style.height = `${size}px`;
                    particle.style.left = `${Math.random() * 100}%`;
                    particle.style.top = `${Math.random() * 100}%`;
                    document.body.appendChild(particle);
                    
                    // Animate particles
                    const angle = Math.random() * Math.PI * 2;
                    const distance = Math.random() * 300 + 100;
                    const duration = Math.random() * 2 + 1;
                    
                    particle.animate([
                        { transform: 'translate(0, 0)', opacity: 1 },
                        { transform: `translate(${Math.cos(angle) * distance}px, ${Math.sin(angle) * distance}px)`, opacity: 0 }
                    ], {
                        duration: duration * 1000,
                        easing: 'cubic-bezier(0.4, 0, 0.2, 1)'
                    });
                    
                    // Remove particle after animation
                    setTimeout(() => {
                        particle.remove();
                    }, duration * 1000);
                }
                
                // Hide explosion after animation
                setTimeout(() => {
                    explosionElement.classList.add('hidden');
                }, 2000);
            }
            
            // End quiz
            function endQuiz() {
                quizActive = false;
                finalScoreElement.textContent = score;
                gameOverScreen.classList.remove('hidden');
            }
            
            // Restart quiz
            function restartQuiz() {
                gameOverScreen.classList.add('hidden');
                startQuiz();
            }
            
            // Event listeners
            startButton.addEventListener('click', startQuiz);
            nextButton.addEventListener('click', nextQuestion);
            restartButton.addEventListener('click', restartQuiz);
        });
    </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=ghost613/math-quiz" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
</html>