تحدي الذاكرة بالإيموجي body { font-family: Arial, sans-serif; text-align: center; } h1 { font-size: 28px; margin-top: 20px; } #emoji { font-size: 140px; width: 180px; height: 180px; line-height: 180px; margin: 20px auto; border-radius: 15px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); display: flex; justify-content: center; align-items: center; } .option { display: block; width: 80%; max-width: 300px; margin: 10px auto; padding: 15px; font-size: 40px; background-color: #1e73be; color: #fff; border: none; border-radius: 10px; cursor: pointer; } .option:hover { opacity: 0.9; } #message { margin-top: 15px; font-size: 18px; font-weight: bold; } #score { font-size: 20px; margin: 10px 0; } #next-btn, #restart-btn, #start-btn { margin-top: 20px; padding: 10px 20px; font-size: 18px; border: none; border-radius: 10px; cursor: pointer; background-color: #444; color: white; } #next-btn, #restart-btn, .option, #emoji { display: none; } #start-btn { display: inline-block; } تحدي الذاكرة بالإيموجي 😊 الإجابات الصحيحة: 0/0 السؤال التالي البداية ابدأ اللعبة const emojis = ["😊","😢","😠","😂","😍","😎","🤔","😲","😯","😴","🥰","😆","😳","😜","😏","😌","😄","😩","😨","😭","🤯","😰","🤪","☺️"]; let currentEmoji = ""; let score = 0; let attempts = 0; const emojiDiv = document.getElementById("emoji"); const option1 = document.getElementById("option1"); const option2 = document.getElementById("option2"); const message = document.getElementById("message"); const nextBtn = document.getElementById("next-btn"); const restartBtn = document.getElementById("restart-btn"); const startBtn = document.getElementById("start-btn"); const scoreDiv = document.getElementById("score"); function updateScore() { scoreDiv.textContent = `الإجابات الصحيحة: ${score}/${attempts}`; } function showGameElements() { emojiDiv.style.display = "flex"; option1.style.display = "block"; option2.style.display = "block"; nextBtn.style.display = "none"; restartBtn.style.display = "inline-block"; startBtn.style.display = "none"; } function newQuestion() { message.textContent = ""; nextBtn.style.display = "none"; option1.style.display = "none"; option2.style.display = "none"; currentEmoji = emojis[Math.floor(Math.random() * emojis.length)]; emojiDiv.textContent = currentEmoji; setTimeout(() => { emojiDiv.textContent = "❓"; let wrongEmoji; do { wrongEmoji = emojis[Math.floor(Math.random() * emojis.length)]; } while (wrongEmoji === currentEmoji); const options = [currentEmoji, wrongEmoji].sort(() => Math.random() - 0.5); option1.textContent = options[0]; option1.dataset.emoji = options[0]; option2.textContent = options[1]; option2.dataset.emoji = options[1]; option1.style.display = "block"; option2.style.display = "block"; }, 1000); } function checkAnswer(selectedEmoji) { attempts++; if (selectedEmoji === currentEmoji) { score++; message.textContent = "إجابتك صحيحة ✅"; nextBtn.style.display = "inline-block"; } else { message.textContent = "❌ حاول ثانية"; } updateScore(); } option1.onclick = () => checkAnswer(option1.dataset.emoji); option2.onclick = () => checkAnswer(option2.dataset.emoji); nextBtn.onclick = newQuestion; restartBtn.onclick = () => { score = 0; attempts = 0; updateScore(); newQuestion(); }; // زر البداية startBtn.onclick = () => { showGameElements(); updateScore(); newQuestion(); };