<div dir="rtl" class="quiz-app">
<style>
.quiz-app {
font-family: 'Cairo', sans-serif;
}
.quiz-app * {
box-sizing: border-box;
}
.container {
width: 100%;
max-width: 800px;
margin: 0 auto;
padding: 15px;
}
.quiz-header {
text-align: center;
margin-bottom: 30px;
}
.quiz-header h1 {
color: #5D5CDE;
font-size: 26px;
margin-bottom: 10px;
}
.quiz-header p {
color: #666;
font-size: 16px;
}
.quiz-section {
background-color: #fff;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
padding: 20px;
margin-bottom: 20px;
}
.section-title {
font-size: 20px;
font-weight: 600;
color: #333;
margin-bottom: 15px;
}
.options-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 10px;
margin-bottom: 20px;
}
.options-grid.difficulty {
grid-template-columns: repeat(3, 1fr);
}
.option-btn {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #fff;
border: 2px solid #5D5CDE;
color: #5D5CDE;
padding: 10px;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s;
text-align: center;
}
.option-btn i {
font-size: 18px;
margin-bottom: 5px;
}
.option-btn:hover {
background-color: #5D5CDE;
color: white;
}
.option-btn.selected {
background-color: #5D5CDE;
color: white;
}
.difficulty-btn {
border-color: #4CAF50;
color: #4CAF50;
}
.difficulty-btn:hover,
.difficulty-btn.selected {
background-color: #4CAF50;
color: white;
}
.difficulty-btn.medium {
border-color: #FF9800;
color: #FF9800;
}
.difficulty-btn.medium:hover,
.difficulty-btn.medium.selected {
background-color: #FF9800;
color: white;
}
.difficulty-btn.hard {
border-color: #F44336;
color: #F44336;
}
.difficulty-btn.hard:hover,
.difficulty-btn.hard.selected {
background-color: #F44336;
color: white;
}
.start-btn {
background-color: #5D5CDE;
color: white;
border: none;
padding: 12px 25px;
border-radius: 8px;
font-size: 18px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
display: block;
margin: 0 auto;
}
.start-btn:hover {
background-color: #4b4ab3;
}
.start-btn:disabled {
background-color: #9e9edf;
cursor: not-allowed;
}
.quiz-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
flex-wrap: wrap;
}
.badge {
background-color: #5D5CDE;
color: white;
padding: 5px 10px;
border-radius: 15px;
font-size: 14px;
margin-right: 5px;
margin-bottom: 5px;
}
.badge.green {
background-color: #4CAF50;
}
.badge.yellow {
background-color: #FF9800;
}
.badge.red {
background-color: #F44336;
}
.quiz-question {
font-size: 20px;
font-weight: 600;
margin-bottom: 15px;
line-height: 1.5;
}
.timer-container {
margin-bottom: 15px;
}
.timer-info {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
}
.timer-bar {
height: 8px;
background-color: #f0f0f0;
border-radius: 4px;
overflow: hidden;
}
.timer-progress {
height: 100%;
background-color: #5D5CDE;
transition: width 1s linear;
}
.timer-progress.yellow {
background-color: #FF9800;
}
.timer-progress.red {
background-color: #F44336;
}
.answer-options {
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 20px;
}
.answer-option {
background-color: #fff;
border: 2px solid #ddd;
padding: 12px 15px;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s;
text-align: right;
}
.answer-option:hover {
border-color: #5D5CDE;
transform: translateY(-2px);
}
.answer-option.correct {
background-color: rgba(76, 175, 80, 0.2);
border-color: #4CAF50;
}
.answer-option.wrong {
background-color: rgba(244, 67, 54, 0.2);
border-color: #F44336;
}
.text-input {
width: 100%;
padding: 12px 15px;
border: 2px solid #ddd;
border-radius: 8px;
font-size: 16px;
margin-bottom: 10px;
}
.text-input:focus {
border-color: #5D5CDE;
outline: none;
}
.submit-btn {
background-color: #5D5CDE;
color: white;
border: none;
padding: 10px 20px;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
transition: all 0.3s;
}
.submit-btn:hover {
background-color: #4b4ab3;
}
.hint-container {
margin-bottom: 20px;
text-align: center;
}
.hint-btn {
background-color: #FF9800;
color: white;
border: none;
padding: 8px 15px;
border-radius: 8px;
font-size: 14px;
cursor: pointer;
transition: all 0.3s;
}
.hint-btn:hover {
background-color: #e68a00;
}
.hint-text {
margin-top: 10px;
padding: 10px;
background-color: #FFF8E1;
border-radius: 8px;
color: #FF8F00;
}
.next-btn {
background-color: #5D5CDE;
color: white;
border: none;
padding: 12px 25px;
border-radius: 8px;
font-size: 18px;
cursor: pointer;
transition: all 0.3s;
display: block;
margin: 0 auto;
}
.next-btn:hover {
background-color: #4b4ab3;
}
.results-section {
text-align: center;
}
.results-icon {
font-size: 60px;
color: #FFD700;
margin-bottom: 20px;
}
.results-title {
font-size: 24px;
font-weight: 700;
margin-bottom: 10px;
}
.final-score {
font-size: 18px;
margin-bottom: 10px;
}
.score-value {
font-weight: 700;
color: #5D5CDE;
}
.correct-count {
color: #666;
margin-bottom: 20px;
}
.message-box {
padding: 15px;
border-radius: 8px;
margin-bottom: 20px;
}
.message-box.success {
background-color: #E8F5E9;
border: 1px solid #C8E6C9;
color: #2E7D32;
}
.message-box.info {
background-color: #E1F5FE;
border: 1px solid #B3E5FC;
color: #0277BD;
}
.message-box.warning {
background-color: #FFF8E1;
border: 1px solid #FFECB3;
color: #FF8F00;
}
.share-container {
margin-bottom: 20px;
}
.share-title {
font-size: 16px;
font-weight: 600;
margin-bottom: 10px;
}
.share-buttons {
display: flex;
justify-content: center;
gap: 10px;
}
.share-btn {
width: 40px;
height: 40px;
border-radius: 50%;
color: white;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
}
.share-btn:hover {
opacity: 0.9;
transform: translateY(-2px);
}
.share-btn.facebook {
background-color: #1877F2;
}
.share-btn.twitter {
background-color: #1DA1F2;
}
.share-btn.whatsapp {
background-color: #25D366;
}
.share-btn.linkedin {
background-color: #0077B5;
}
.restart-options {
margin-top: 15px;
}
.restart-btn {
background-color: #5D5CDE;
color: white;
border: none;
padding: 10px 15px;
border-radius: 8px;
margin: 0 5px;
cursor: pointer;
transition: all 0.3s;
}
.restart-btn:hover {
background-color: #4b4ab3;
}
.restart-btn.alt {
background-color: #FF9800;
}
.restart-btn.alt:hover {
background-color: #e68a00;
}
.hidden {
display: none !important;
}
@media (max-width: 600px) {
.quiz-header h1 {
font-size: 22px;
}
.options-grid {
grid-template-columns: repeat(2, 1fr);
}
.quiz-info {
flex-direction: column;
align-items: flex-start;
}
.quiz-info > div {
margin-bottom: 10px;
}
}
</style>
<div class="container">
<!-- Quiz Header -->
<div class="quiz-header">
<h1><i class="fas fa-brain"></i> مسابقة المعرفة التفاعلية</h1>
<p>اختبر معلوماتك وتحدى نفسك!</p>
</div>
<!-- Welcome Screen -->
<div id="welcome-screen" class="quiz-section">
<h2 class="section-title text-center">مرحباً بك في مسابقة المعرفة!</h2>
<p style="text-align: center; margin-bottom: 20px;">اختر فئة وصعوبة للبدء في التحدي</p>
<!-- Category Selection -->
<div style="margin-bottom: 20px;">
<h3 class="section-title">اختر الفئة:</h3>
<div class="options-grid">
<button class="option-btn category-btn" data-category="general">
<i class="fas fa-globe"></i>
<span>معلومات عامة</span>
</button>
<button class="option-btn category-btn" data-category="math">
<i class="fas fa-calculator"></i>
<span>رياضيات</span>
</button>
<button class="option-btn category-btn" data-category="riddles">
<i class="fas fa-puzzle-piece"></i>
<span>ألغاز</span>
</button>
<button class="option-btn category-btn" data-category="history">
<i class="fas fa-landmark"></i>
<span>تاريخ</span>
</button>
<button class="option-btn category-btn" data-category="logic">
<i class="fas fa-chess"></i>
<span>منطق</span>
</button>
<button class="option-btn category-btn" data-category="vocabulary">
<i class="fas fa-book"></i>
<span>مفردات</span>
</button>
</div>
</div>
<!-- Difficulty Selection -->
<div style="margin-bottom: 20px;">
<h3 class="section-title">اختر المستوى:</h3>
<div class="options-grid difficulty">
<button class="option-btn difficulty-btn" data-difficulty="easy">
<i class="fas fa-smile"></i>
<span>سهل</span>
</button>
<button class="option-btn difficulty-btn medium" data-difficulty="medium">
<i class="fas fa-meh"></i>
<span>متوسط</span>
</button>
<button class="option-btn difficulty-btn hard" data-difficulty="hard">
<i class="fas fa-dizzy"></i>
<span>صعب</span>
</button>
</div>
</div>
<div style="text-align: center;">
<button id="start-quiz" class="start-btn" disabled>
<i class="fas fa-play"></i> ابدأ المسابقة
</button>
</div>
</div>
<!-- Quiz Container -->
<div id="quiz-container" class="quiz-section hidden">
<!-- Quiz Info -->
<div class="quiz-info">
<div>
<span id="category-badge" class="badge">
<i class="fas fa-folder"></i> معلومات عامة
</span>
<span id="difficulty-badge" class="badge green">
<i class="fas fa-signal"></i> سهل
</span>
</div>
<div>
<span>السؤال: <b id="question-number">1</b> من <b id="total-questions">10</b></span>
<span style="margin-right: 15px;">النقاط: <b id="score" style="color: #4CAF50;">0</b></span>
</div>
</div>
<!-- Timer -->
<div class="timer-container">
<div class="timer-info">
<span>الوقت المتبقي</span>
<span id="timer-text">60 ثانية</span>
</div>
<div class="timer-bar">
<div id="timer-progress" class="timer-progress" style="width: 100%;"></div>
</div>
</div>
<!-- Question -->
<div>
<h3 id="question-text" class="quiz-question">ما هي عاصمة مصر؟</h3>
<div id="question-explanation" class="hint-text hidden"></div>
</div>
<!-- Answer Options -->
<div id="answers-container" class="answer-options">
<!-- Multiple choice options will be inserted here dynamically -->
</div>
<!-- Text input for fill in the blank -->
<div id="text-input-container" class="hidden">
<input type="text" id="text-answer" class="text-input" placeholder="اكتب إجابتك هنا...">
<button id="submit-text-answer" class="submit-btn">تقديم الإجابة</button>
</div>
<!-- Hint Button -->
<div id="hint-container" class="hint-container">
<button id="hint-button" class="hint-btn">
<i class="fas fa-lightbulb"></i> عرض تلميح
</button>
<div id="hint-text" class="hint-text hidden"></div>
</div>
<!-- Next Question Button -->
<div style="text-align: center;">
<button id="next-question" class="next-btn hidden">
السؤال التالي <i class="fas fa-arrow-left"></i>
</button>
</div>
</div>
<!-- Results Screen -->
<div id="results-screen" class="quiz-section results-section hidden">
<div>
<i id="result-icon" class="fas fa-trophy results-icon"></i>
<h2 class="results-title">انتهت المسابقة!</h2>
<p id="final-score" class="final-score">النتيجة النهائية: <span class="score-value">0</span> نقطة</p>
<p id="correct-answers" class="correct-count">الإجابات الصحيحة: <b style="color: #4CAF50;">0</b> من <span>10</span></p>
</div>
<div id="motivational-message" class="message-box success">
أحسنت! لقد قمت بعمل رائع!
</div>
<div class="share-container">
<h3 class="share-title">شارك نتيجتك:</h3>
<div class="share-buttons">
<div class="share-btn facebook" data-platform="facebook">
<i class="fab fa-facebook-f"></i>
</div>
<div class="share-btn twitter" data-platform="twitter">
<i class="fab fa-twitter"></i>
</div>
<div class="share-btn whatsapp" data-platform="whatsapp">
<i class="fab fa-whatsapp"></i>
</div>
<div class="share-btn linkedin" data-platform="linkedin">
<i class="fab fa-linkedin-in"></i>
</div>
</div>
</div>
<div>
<p>هل ترغب في المحاولة مرة أخرى؟</p>
<div class="restart-options">
<button id="restart-same" class="restart-btn">
<i class="fas fa-redo"></i> نفس الفئة والمستوى
</button>
<button id="restart-new" class="restart-btn alt">
<i class="fas fa-sync-alt"></i> فئة أو مستوى جديد
</button>
</div>
</div>
</div>
</div>
<!-- Audio Elements -->
<audio id="correct-sound" preload="auto">
<source src="data:audio/mp3;base64,SUQzAwAAAAAAIlRJVDIAAAAZAAAATXAzIGZyb20gd3d3LnRoZW1vdGl2ZS5jb21JQ09NAAAAIAAAAENPTU0gAAAAEgAAAFRoZSBNb3RpdmUgLSAyMDE2VFJDSwAAAAIAAAAxVFlFUgAAAAQAAABUaGVUQUxCAAAAFAAAAFRoZSBNb3RpdmUgLSAyMDE2VFBFMQAAABUAAAB3d3cudGhlbW90aXZlLmNvbSAoYylDT01NAAAAGAAAAGVuZyBHb29kIGpvYiwgY29ycmVjdCFUSVQxAAAADwAAAENvcnJlY3QgQW5zd2VyVFhYWAAAAAIAAAAyVENPTgAAAAUAAABPdGhlckNPTU0AAAAiAAAAZW5nIFNvdW5kIGVmZmVjdHMgdGhlbW90aXZlLmNvbSAyMDE2VENPTQAAAAEAAABHVEVOQwAAAAEAAABUVElUMQAAAAIAAABTV0RSTwAAAAEAAABHQVBJQwAAAAEAAABHAA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qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq" type="audio/mp3">
</audio>
<audio id="wrong-sound" preload="auto">
<source src="data:audio/mp3;base64,SUQzAwAAAAAAIlRJVDIAAAAZAAAATXAzIGZyb20gd3d3LnRoZW1vdGl2ZS5jb21JQ09NAAAAIAAAAENPTU0gAAAAEgAAAFRoZSBNb3RpdmUgLSAyMDE2VFJDSwAAAAIAAAAxVFlFUgAAAAQAAABUaGVUQUxCAAAAFAAAAFRoZSBNb3RpdmUgLSAyMDE2VFBFMQAAABUAAAB3d3cudGhlbW90aXZlLmNvbSAoYylDT01NAAAAGAAAAGVuZyBXcm9uZyBhbnN3ZXIsIHRyeSBhZ2FpblRJVDEAAAAOAAAAV3JvbmcgQW5zd2VyIFRYWFgAAAACAAAAMlRDT04AAAAFAAAAQ3JpbWVDT01NAAAAIgAAAGVuZyBTb3VuZCBlZmZlY3RzIHRoZW1vdGl2ZS5jb20gMjAxNlRDT00AAAABAAAARlRFTkMAAAABAAAARlRJVDEAAAACAAAARldEUk8AAAABAAAARkFQSUMAAAABAAAARgAAAABJRDMDAAABJVRBTEIAAAABAAAARlRFTkMAAAABAAAARlRDT04AAAABAAAARkNPTQAAAAEAAABGVElUMQAAAAIAAABGV0RSTwAAAAEAAABGVFNSQwAAAAEAAABG//tAwAAAbRtFsGNqACHai6C2DEBAEAQCaCzIOWPLijH4QnhwdznJ0EOmIMGM6mGGJJRQQ+GDJ3OCDnm+DPxdE6RMCBiAIMIAwYA+PkT5OkYmIAw+WFGUcF0L///8XQE6JcD4mIAQ//yxQDNj0/yDAXjB5+UP/+kP//5f/KD//+UD//+WkSFAMP/6QVBfLEj/6w/9QMP/8mP//5ZkC4EYYdYwYZJhKGkoRUANAxB5YPL5YoB4P/+sAwBKAC8UXQGsGACKEI6dNPeACICMH+kIGF//lDFjGAx9AKxeJh//5Q//5QgYO+WIH/y/QYXljB/9MMMMEEDghAYX/8GDEFAWgLBsKQ8CCCh+kQXL/rEEfTQIBhv/yYP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kTjgA5Q0NDQ4NBgYaGh4eGhg4H/8ODQ0OHAgGAx4YGAYDAQP/+sDDDDDDDAwMDAwMDDDR3///KHB4cGJiYGhoYGBgYGBgYmBgYGJgYWFBQUFBQUFApKSkpKSkpKSpKSlJSUlJSUpKSk1MTExMTExNTU1MTExMTExMTE//tAwDIATTBVMxmsAAGCC0bPNYAAmZmZmRkZGRoZGZmZmZkZGRkZHTNHFP////MzTNMUxf///8zf///8AAAAAAAAf////AAAAAAAA/////AAAAAAAD////8AAAAAAAAf////wAAAAAAAP////8AAAAAAAH////+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" type="audio/mp3">
</audio>
<audio id="timer-sound" preload="auto">
<source src="data:audio/mp3;base64,SUQzAwAAAAAAIlRJVDIAAAAZAAAATXAzIGZyb20gd3d3LnRoZW1vdGl2ZS5jb21JQ09NAAAAIAAAAENPTU0gAAAAEgAAAFRoZSBNb3RpdmUgLSAyMDE2VFJDSwAAAAIAAAAxVFlFUgAAAAQAAABUaGVUQUxCAAAAFAAAAFRoZSBNb3RpdmUgLSAyMDE2VFBFMQAAABUAAAB3d3cudGhlbW90aXZlLmNvbSAoYylDT01NAAAAFwAAAGVuZyBUaW1lIGlzIHVwLCBodXJyeSFUSVQxAAAADAAAAFRpbWUgaXMgb3ZlclRYWFgAAAACAAAAMlRDT04AAAAHAAAAVGVtcG9yYUNPTU0AAAAiAAAAZW5nIFNvdW5kIGVmZmVjdHMgdGhlbW90aXZlLmNvbSAyMDE2VENPTQAAAAEAAABUVEVOQwAAAAEAAABUVElUMQAAAAIAAABUV0RSTwAAAAEAAABUQVBJQwAAAAEAAABUAAAAAElEMwMAAAC+VEFMQgAAAAEAAABUVEVOQwAAAAEAAABUVENPTgAAAAEAAABUQ09NQQAAAFcAAABGUkVFIFNUWUxFIE1JWC46ICFlbmdsaXNoLHNvdW5kLGVmZmVjdHMsMmQsY2FydG9vbix0aW1lcix0cmltcGV0LHRpbWUsaXM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Sp7QAitiNl1TjgA/+kQB//yx/+UP//yZ///y//5f//yww//lBgYYGPyX/L//LD//0iAP/5cf9I/8of//yZH/8mA//8mP/5f//yw///liB//yw//piP/5YXL/5f+TIZD4fDAdDIdDnKoOA4Cw/9IeC8P/8sP//L///Jn/JD//8kQGA6H//5P//5P/+sDAAAAKyRswqe0AIrIjZdU5oAP/yYP+WHy/+XDAwGGBgOgH/SP/y/kxh//li/9IOXLl//LP//y4gYfDH/yR//8kQf//kwB//Jj//lD//+WH//9IgH/+TP//+X/lBi5cv/8v//5Y//+WIP/5Y//piP/5YXL/5fmA+UD/LjDAYDjDBwH/SP//5P//5P//7QMAxAAyhGzSp7QAipiNmlT2AAf/yYP+WHy/+XDAwGGBgOgH/SP/y/kxh//li/9IOXLl//LP//y4gYfDH/yR//8kQf//kwB//Jj//lD//+WH//9Ih/+XHy/8oMfL/y//+WL/9If/y4v/5cQP/pEP/+kw0cKEy+X/lB//+TAf/yYA/8mP//5cf/y//8sPl//l/5YQL/ywgX/rAMAAAAqJGzSprQAiliNlVTmQAf//L/5f/8sMfL/y//+WL/9If/yx/+XEP/5cf/y//8sMfL/y//+WL/9If/y4v/5cQP/pEP/+kw0cKEy+X/lB//+TAf/yYA/8mP//5cf/y//8sPl//l/5YQL/ywgX/y//5f/8sMfL/y//+WL/9If/y4v/5cQP/pD//7AMAAAApBGzCJ7AAiPiNm1TmgA+kw0cKEy+X/lB//+TAf/yYA/8mP//5cf/y//8sPl//l/5YX/9IgH/+WP//5Y//+X/y/8sPl//l/5YQL/ywgX/y//5f/8sMP/5QgMWHyww//L///yYP/Jf//+SGGAwH/S///5MH//5P//5P///+X//8sPl//+WF//rAMAAAAohGzSprQAiZCNllTngA0iB/8mAP/5Mf//y4gIDBw8ODh48GYCAMD4f9I/l/5f/5YX/9IgH//LH//8sf//L/5f+WGPl/5f+WEC/8sP9I///kz///L//l//+WL/9If/y4v/5cQP/pEP/+lQML/5f/5YYeX/l/5YQL/ywuf+X//L//yxf//7QMAwgA3RGzCp7QAiiiNllTjgA/+kQ//yx//L//+WGGBgYD/pH//8mD//8n//8n/y//8mP//5QgGBwx/8mP//5P//5P//5Mf//5cQEBg4eHBw8eDMBAYGBgP+kfy/8v/8sX//0iH/8uP//5Y//l//5YYeX/l/5YQL/yw/0j//+TP///L//l//+WL/9Ih/rAMAAAApZGzCp7QAiViNllTmgA/Li//lxA/+kQ//6VAw8PGBg4ODAwGBhgYGBgYGBgcHBw4ODg4ODiwODg4ODg+ZGEH/SP//5P//5P//5Mf//5cQEBg4eP/5I//+SIP/yY///5I/q19f/yf///J///J///JgP/pB///Jj//+X///y//8sMP//rAMAAAAohGyqpzQAiSCNlkTmgA/5Q//5Yf//0iP/5cQP/pB///Jn/JD//+SIP/yY//+SGGGCBf9Ij//8n//8n//8mP//5P//5I//+SIP/yY///5Mf//5P//y4gYYYGP/kj//5Ig//Jj//5I//+SH//8mP//5MH/5Yf/yww//lDDw8GAwGH//SIA//7QMAvAA5RGzSprQAiaCNllTmgA8sP//5Y//+X//L///kx///5IgIMDgWEgYGGDDgfDAYDA0cMMssMMMsMMMMMMssccccccccgwyyyyzNdc000zXTTL1000000000000003//SH//8n//8n//8mP//5P//5I//+SIP/yY///5MH//5YX/5Yf//kx///+sAwAAAChkbOqntACLAI2TVOaAD/8mD//8mP//5I//+SIP/yY///5I//9I//l///yww//5YYfkwGBhgYGH/yY///5MH//5P/y//5I/SIf//y//5c//L/y//+WP//5Y///L//+X/y//+WP//5Y///L//+X/y//+WP//5Y///L//8sP//5Y///L//+WGH//rAMAAAAm5GzCp7QAizCNklTmgAyww//5YYf/+X//8mD//5I/SP//5Mf//yQ//pE//5YX//KD//+TAf/y4///Jg//pB//+X/y/8v/l/5YX/9IgH//LDA//lB//+TCP//Jg//+SIP//5Mf//5P//5L//y//l//+WP//5Y///L//8sP//5Y//+X//r+X//7QMAwAA65GzaprQAi1CNllTjAAf/LH//8sf//y//8sML/ywx8v/LD//+X/y/8v/L/yw//9Ih//5YYH/8oP//5MH//5MH//5P/y4v//Jj//+X/y/8v/L/ywv/6RD/+WPy//L/5YY+X/y//l/5Yf//0iH/8uMP/5Qf//yYP//Jg//pB//+X/y/8v/L/ywv/6RD/rAMAAAAqRGzqJ7QAiYCNllTmAA+WGP//5Y///l//5YY+X/yxf/L//+X/y/8v/L/yw//9Ih//5YYH/8oP//5MB//Jg//+SIP//5MH//5cf//y//l//+WH//9Ih/8sf//yYP//kgD//5MH//5I//+SIP//kgf//Jg///JEH/5YYf/p+X///yw///yw///7AMAAAAqBGzSprQAikiNmlTmgA/yw///l//+X/y/8sL/+kQ//Jj//+TH//8kP/6RAP/pEA//k//5f/L///5Mf//5P///Jj//+TH/yww//5Ygf/yw//0/L/5f+WH//9Ih//5Y/L/5f+X/yxf//0iH/5YYf/p+X///yw///yw///l/8v/L/5Y///0iH/rAMAAAAn5GzSprQAilCNmVTmgAf/LDA//lhj5f+X/y/+X/y/8sP//5YY+X/yxf/L//+SJ//+SB/+X///5If//yRP//5Y//l//+TD//+TD//5Y/L/5f+X/yxf//0iH//L//+X/y//+TP//+SD//+WH//9Ih//5ZH//5MH/5YYf/yhh4YD/8sMP//7AMAAAAphGzSprQAilCNk1TmgA+WL//+kQ//8sf//yf/5f/8oMP/+WF//SYf//5P//5P//5P//5P/y//5I//+SH//8kP/pEf//y///kx///5IP//5ZH//5MH/5YYf/yhh4YD/8sf//y//5If//yQ//8kP/pEP/+kR//5P//5Y//+WH//8sX///Jj//+TH//pB//rAMAAAAnJGzSprQAihCNlVTmgA/5cf//5P//5P//5Y//+WH//8sX///Jj//+TH//pB//+X/y/8v/L/yxf//0iH//L//+X///yw//lBh//y///k///5P//5P//5f/L/y/8v/L/5Y///0iH//L//+X/y//+X/y/8v/L/y/8sP//5Y///l/8v/L//+sDAAAAKORs4qY0AIo4jZVU5oAP/lxAf/0h//5f/L/y//5f/L/y/8v/LF//9Ih///J//+WL//+WH//9Ih///J///yf//5P//+X/y/8v/L/y/+WL//+kQ///J//+X/y/+X/y/8v/L/5f+WH//9Ih//5Yv/y/+X/y/8v/L/5f+X/+0DAMgAPCRs4qe0AIoYjZtU5oALDDP/+WF//SIf///Jn/+T//5f/L/y/8v/l/5YZ//ywv/6RD///kz//5P//5f/L/y/8v/L/5Yv//6RD///J//+X/y/+X/y/8v/L/5f+WH//9Ih//5Yv/y/+X/y/8v/L/5f+WGf/8sL/+kQ///5M//+T//+X/y/8v/L/rAMAAAAo5GzqprQAieCNl1TmgA5f+WL//+kQ///5M//+T//+X/y/8v/L/y/8sM//5YX/9Ih///yZ//8n//5f/L/y/8v/L/yxf//0iH///J//+X/y/+X/y/8v/L/5f+WH//9Ih///J//+X/y//5f/L/y//+WP//5Y///l//+X/y//5Yf//yw///l///LDD//l/rAMAAAAoRGzyprQAibiNlVTmgB/y/+X/y//5Yf//yw///l///LDD//l/8v/L/5Y//8sf//y//+X/y//lB//+THy//L/5f/L/y/+WH//9Ih//+WF//0iAf/+TH//8mP/5Qf/5//k///JP//5Mf//5cc//5P//5IP//5P//5P//5c//yr//+X//+X/y//y//7QMAAAA5BGzSJ5QAilCNmlTmAAH//5Y//8sf//y///5f//5f/LP//5Y//8sf//y///5f//5f/LP//5Y//8sf//y///5f/L/y//L//5Y//8sf//y///5f//5YX//5Yv//5Y//8sf//y///5f//5YX/y//+WP//LH//8v//+X//+WF//L/rAMAIAAwhGyAJrQAiVCNl0TmgB/5Y//8sf//y///5f//5f/LP//5Y//8sf//y///5f//5f/LP//5Y//8sf//y///5f/L/y//L//5Y//8sf//y///5f//5YX//5YX/y//+WP//LH//8v//+X//+WF//L//5Y//8sf//y///5f//5YX//+sDAAIAK0Rsmqa0AImQjZ1U5oAL/y//+X//+WF//fLH//8v//+X//+X/y//+WP//LH//8v//+X//+WF//L//5Y//8sf//y///5f//5YX/y//+WP//LH//8v//+X//+WF//L//5Y//8sf//y///5f//5YX/ywv//yw///yw///yw//8sP//LD//8sP//7QMAAAA6RGzqphwAipCNlVTDgALD//8sP//LD//8sP//LD//8sL//yw///yw///yw///yw//8sP//LD//8sP//LD//8sP//LD//8sP//LD//8sL//yw///yw///yw///yw//8sP//LD//8sP//LD//8sP//LD//8sL//yw///yw///yw///yx//8sf//LH//7AMAAAAJuRsiCYcAIlQjZuEw4APLD//8sf//LH//8sf//LH//8sL//yx//8sf//LH//8sf//LH//8sf//LH//8sf//LH//8sf//LH//8sf//LH//8sL//yx//8sf//LH//8sf//LH//8sf//LH//8sf//LH//8sL//yx//8sf//LH//8sf//LH//+0DAMgAO0RseqYYAInojZiUw4APLH//8sf//LH//8sf//LA//8sA//ywP//LA//8sD//ywL//ywP//LAv//ywP//LA//8sD//ywP//LA//8sC//ywP//LAv//ywP//LA//8sD//ywP//ywP//LA//8sC//ywP//LAv//LA//8sDf/ywP//LA//8sD//8sDf/rAMAAAAG8DY+Uw4AQAAAAnQwQAA8sD//ywP//LA//8sC//ywP//LAv//LA//8sD//ywP//ywP//ywL//LAv//ywL//LAv//ywL//LAv//LAv//LAv//LAr//LAr//LAr//LAr//LAr//LAr//LAr//LAr//LAr//LAv//LAv//LAv//LAv//LAv//LAv//LAv//LAv/+0DAMgALuEa0k3IABAAAAJsEAAAv//LAv//LAv//LAv//LAv//LAv//LAv//LAv//LAv//LAv//LAv//LAr//LAr//LAr//LAn//LAn//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj/+0AMMgALOEagE0IABAAAAJQEAAAfLAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAj//LAf//LAf//LAX//LAX//LAf5lYCAAQALKDYgGQgAEAAAAkgQAAP/LAP//LAP//LAP//LAP//LAP//LAP//LAP//LAP//LAP//LAP4A==" type="audio/mp3">
</audio>
<!-- Quiz JavaScript -->
<script>
// Load Font Awesome
if (!document.getElementById("fontawesome-css")) {
var faLink = document.createElement("link");
faLink.id = "fontawesome-css";
faLink.rel = "stylesheet";
faLink.href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css";
document.head.appendChild(faLink);
}
// Load Cairo font
if (!document.getElementById("cairo-font")) {
var fontLink = document.createElement("link");
fontLink.id = "cairo-font";
fontLink.rel = "stylesheet";
fontLink.href = "https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap";
document.head.appendChild(fontLink);
}
// Data structure to hold quiz questions
const quizData = {
general: {
easy: [
{
type: 'multiple',
question: 'ما هي عاصمة مصر؟',
options: ['القاهرة', 'الإسكندرية', 'الأقصر', 'أسوان'],
correctAnswer: 'القاهرة',
hint: 'تقع على نهر النيل وهي أكبر مدينة في أفريقيا'
},
{
type: 'truefalse',
question: 'الشمس تدور حول الأرض',
options: ['صحيح', 'خطأ'],
correctAnswer: 'خطأ',
hint: 'الأرض هي التي تدور حول الشمس'
},
{
type: 'multiple',
question: 'كم عدد أيام الأسبوع؟',
options: ['5 أيام', '6 أيام', '7 أيام', '8 أيام'],
correctAnswer: '7 أيام',
hint: 'يبدأ بيوم الأحد وينتهي بيوم السبت'
}
],
medium: [
{
type: 'multiple',
question: 'أي من الكواكب التالية هو الأقرب إلى الشمس؟',
options: ['المريخ', 'الأرض', 'عطارد', 'الزهرة'],
correctAnswer: 'عطارد',
hint: 'إنه أصغر كواكب المجموعة الشمسية'
},
{
type: 'fill',
question: 'يتكون الماء من ذرتي هيدروجين وذرة واحدة من _____',
correctAnswer: 'أكسجين',
hint: 'غاز ضروري للتنفس'
},
{
type: 'multiple',
question: 'ما هو أطول نهر في العالم؟',
options: ['نهر الأمازون', 'نهر النيل', 'نهر المسيسيبي', 'نهر اليانغتسي'],
correctAnswer: 'نهر النيل',
hint: 'يمر بمصر والسودان وعدة دول أفريقية أخرى'
}
],
hard: [
{
type: 'multiple',
question: 'من هو مخترع المصباح الكهربائي؟',
options: ['نيكولا تسلا', 'توماس إديسون', 'ألبرت أينشتاين', 'غراهام بيل'],
correctAnswer: 'توماس إديسون',
hint: 'قام بأكثر من ألف محاولة قبل أن ينجح'
},
{
type: 'fill',
question: 'العنصر الكيميائي الذي رمزه "Au" هو _____',
correctAnswer: 'الذهب',
hint: 'معدن ثمين يستخدم في صناعة الحلي'
},
{
type: 'truefalse',
question: 'يمكن رؤية سور الصين العظيم من الفضاء بالعين المجردة',
options: ['صحيح', 'خطأ'],
correctAnswer: 'خطأ',
hint: 'هذه واحدة من الأساطير الشائعة'
}
]
},
math: {
easy: [
{
type: 'multiple',
question: 'ما هو ناتج 5 × 8؟',
options: ['35', '40', '45', '50'],
correctAnswer: '40',
hint: 'فكر في جدول الضرب'
},
{
type: 'fill',
question: '12 + 9 - 6 = _____',
correctAnswer: '15',
hint: 'ابدأ بجمع 12 و 9 ثم اطرح 6'
},
{
type: 'multiple',
question: 'كم ضلعاً للمثلث؟',
options: ['3 أضلاع', '4 أضلاع', '5 أضلاع', '6 أضلاع'],
correctAnswer: '3 أضلاع',
hint: 'إنه أبسط شكل هندسي مغلق'
}
],
medium: [
{
type: 'multiple',
question: 'ما هو الجذر التربيعي للعدد 64؟',
options: ['6', '8', '10', '12'],
correctAnswer: '8',
hint: '8 × 8 = 64'
},
{
type: 'fill',
question: 'إذا كان محيط المربع 20 سم، فإن طول ضلعه هو _____ سم',
correctAnswer: '5',
hint: 'محيط المربع = 4 × طول الضلع'
},
{
type: 'truefalse',
question: 'مجموع زوايا المثلث يساوي 180 درجة',
options: ['صحيح', 'خطأ'],
correctAnswer: 'صحيح',
hint: 'هذه قاعدة أساسية في الهندسة'
}
],
hard: [
{
type: 'multiple',
question: 'ما هو ناتج 0.25 × 0.25؟',
options: ['0.0625', '0.125', '0.5', '0.625'],
correctAnswer: '0.0625',
hint: '0.25 = 1/4، فكر في ضرب الكسور'
},
{
type: 'fill',
question: 'العدد التالي في المتسلسلة: 2, 4, 8, 16, _____',
correctAnswer: '32',
hint: 'كل عدد يساوي ضعف العدد السابق'
},
{
type: 'multiple',
question: 'ما هو احتمال الحصول على العدد 6 عند رمي حجر نرد مرة واحدة؟',
options: ['1/3', '1/4', '1/5', '1/6'],
correctAnswer: '1/6',
hint: 'حجر النرد له 6 أوجه متساوية الاحتمال'
}
]
},
riddles: {
easy: [
{
type: 'multiple',
question: 'ما هو الشيء الذي يمشي ويقف وليس له أرجل؟',
options: ['الساعة', 'السيارة', 'القلم', 'الكرسي'],
correctAnswer: 'الساعة',
hint: 'يقيس الوقت'
},
{
type: 'fill',
question: 'أنا شيء لا تستطيع الإمساك بي، لكن يمكنك أن تفقدني بسهولة. من أنا؟ _____',
correctAnswer: 'الوقت',
hint: 'يقال إنه من ذهب'
},
{
type: 'multiple',
question: 'ما هو الشيء الذي كلما زاد نقص؟',
options: ['الماء', 'العمر', 'المال', 'الثقب'],
correctAnswer: 'العمر',
hint: 'مرتبط بحياة الإنسان'
}
],
medium: [
{
type: 'fill',
question: 'أنا تاج بلا ملك، وساعة بلا عقارب، ما أنا؟ _____',
correctAnswer: 'الأناناس',
hint: 'فاكهة استوائية'
},
{
type: 'multiple',
question: 'ما هو الشيء الذي إذا أكلته كله تعيش، وإذا أكلت نصفه تموت؟',
options: ['الماء', 'الطعام', 'الهواء', 'النار'],
correctAnswer: 'الهواء',
hint: 'نحتاجه للتنفس'
},
{
type: 'fill',
question: 'قلبي من حديد وعقلي من نار، أطير بلا جناح وأعيش بلا طعام. من أنا؟ _____',
correctAnswer: 'الطائرة',
hint: 'وسيلة نقل تطير في السماء'
}
],
hard: [
{
type: 'fill',
question: 'أنا آلة خرساء تتكلم، أنا ما أردت وأحفظ ما استودعت، ما أنا؟ _____',
correctAnswer: 'الكتاب',
hint: 'مصدر للمعرفة يحتوي على صفحات'
},
{
type: 'multiple',
question: 'ما هو الشيء الذي يكون أمامك ولا تراه؟',
options: ['المستقبل', 'الماضي', 'الهواء', 'الظل'],
correctAnswer: 'المستقبل',
hint: 'مرتبط بالزمن'
},
{
type: 'fill',
question: 'أنا شيء إذا أخذت مني واحداً أصبحت لا شيء، من أنا؟ _____',
correctAnswer: 'الصفر',
hint: 'رقم من أرقام الحساب'
}
]
},
history: {
easy: [
{
type: 'multiple',
question: 'من بنى الأهرامات في مصر القديمة؟',
options: ['الفراعنة', 'الرومان', 'الإغريق', 'البابليون'],
correctAnswer: 'الفراعنة',
hint: 'حكام مصر القديمة'
},
{
type: 'truefalse',
question: 'اكتشف كريستوفر كولومبوس أمريكا في عام 1492',
options: ['صحيح', 'خطأ'],
correctAnswer: 'صحيح',
hint: 'كان يبحث عن طريق إلى الهند'
},
{
type: 'multiple',
question: 'من هو أول خليفة في الإسلام؟',
options: ['عمر بن الخطاب', 'أبو بكر الصديق', 'عثمان بن عفان', 'علي بن أبي طالب'],
correctAnswer: 'أبو بكر الصديق',
hint: 'كان أقرب صحابي للنبي محمد ﷺ'
}
],
medium: [
{
type: 'multiple',
question: 'متى انتهت الحرب العالمية الثانية؟',
options: ['1943', '1945', '1947', '1950'],
correctAnswer: '1945',
hint: 'استمرت الحرب لمدة 6 سنوات'
},
{
type: 'fill',
question: 'اسم العالم المسلم الذي اخترع الجبر هو _____',
correctAnswer: 'الخوارزمي',
hint: 'اشتهر أيضاً بالرياضيات والفلك'
},
{
type: 'truefalse',
question: 'تأسست جامعة الدول العربية عام 1945',
options: ['صحيح', 'خطأ'],
correctAnswer: 'صحيح',
hint: 'تأسست في القاهرة بعد الحرب العالمية الثانية'
}
],
hard: [
{
type: 'multiple',
question: 'من هو القائد الذي هزم الصليبيين في معركة حطين؟',
options: ['صلاح الدين الأيوبي', 'نور الدين زنكي', 'قطز', 'سيف الدين قلاوون'],
correctAnswer: 'صلاح الدين الأيوبي',
hint: 'قام بتحرير القدس بعد هذه المعركة'
},
{
type: 'fill',
question: 'المؤرخ العربي الشهير الذي كتب "مقدمة ابن خلدون" هو _____',
correctAnswer: 'ابن خلدون',
hint: 'يعتبر مؤسس علم الاجتماع'
},
{
type: 'multiple',
question: 'أي معركة أدت إلى سقوط الدولة الأموية؟',
options: ['معركة القادسية', 'معركة عين جالوت', 'معركة حطين', 'معركة الزاب'],
correctAnswer: 'معركة الزاب',
hint: 'وقعت عام 750 ميلادية'
}
]
},
logic: {
easy: [
{
type: 'multiple',
question: 'إذا كان اليوم هو الأحد، فما هو اليوم بعد يومين؟',
options: ['الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس'],
correctAnswer: 'الثلاثاء',
hint: 'عد الأيام: الأحد ثم الاثنين ثم...'
},
{
type: 'fill',
question: 'أكمل المتسلسلة: 1, 3, 5, 7, _____',
correctAnswer: '9',
hint: 'أعداد فردية متتالية'
},
{
type: 'multiple',
question: 'إذا كان علي أطول من محمد، ومحمد أطول من أحمد، فمن هو الأقصر؟',
options: ['علي', 'محمد', 'أحمد', 'لا يمكن تحديده'],
correctAnswer: 'أحمد',
hint: 'قارن بين الأطوال المذكورة'
}
],
medium: [
{
type: 'fill',
question: 'أكمل المتسلسلة: 2, 6, 12, 20, _____',
correctAnswer: '30',
hint: 'الفرق بين كل رقمين متتاليين يزيد بمقدار 2'
},
{
type: 'multiple',
question: 'في غرفة، يوجد 4 زوايا. في كل زاوية يوجد قط. كل قط يرى 3 قطط. كم عدد القطط في الغرفة؟',
options: ['3 قطط', '4 قطط', '12 قطا', '16 قطا'],
correctAnswer: '4 قطط',
hint: 'القط في كل زاوية يرى القطط في الزوايا الأخرى'
},
{
type: 'truefalse',
question: 'إذا كان كل الطيور تطير، وكل البطاريق طيور، إذن كل البطاريق تطير.',
options: ['صحيح', 'خطأ'],
correctAnswer: 'خطأ',
hint: 'المقدمة الأولى ليست صحيحة'
}
],
hard: [
{
type: 'multiple',
question: 'لدي 8 كرات متشابهة تماماً ولكن إحداها أثقل قليلاً من البقية. بكم عملية وزن أقل على الأقل أستطيع تحديد الكرة الثقيلة باستخدام ميزان ذو كفتين؟',
options: ['عملية واحدة', 'عمليتان', '3 عمليات', '4 عمليات'],
correctAnswer: 'عمليتان',
hint: 'قسّم الكرات إلى مجموعات'
},
{
type: 'fill',
question: 'أكمل المتسلسلة: 1, 1, 2, 3, 5, 8, 13, _____',
correctAnswer: '21',
hint: 'كل رقم هو مجموع الرقمين السابقين له'
},
{
type: 'multiple',
question: 'خمسة أشخاص يتصافحون فيما بينهم. كم عدد المصافحات الإجمالي؟',
options: ['5 مصافحات', '10 مصافحات', '15 مصافحة', '20 مصافحة'],
correctAnswer: '10 مصافحات',
hint: 'كل شخص يصافح 4 أشخاص، لكن المصافحة تحسب مرة واحدة'
}
]
},
vocabulary: {
easy: [
{
type: 'multiple',
question: 'ما هو مفرد كلمة "كتب"؟',
options: ['كتاب', 'كاتب', 'مكتبة', 'مكتوب'],
correctAnswer: 'كتاب',
hint: 'ما يقرأه الناس للمعرفة'
},
{
type: 'fill',
question: 'جمع كلمة "مدرسة" هو _____',
correctAnswer: 'مدارس',
hint: 'أماكن للتعليم'
},
{
type: 'multiple',
question: 'مضاد كلمة "سعيد" هو:',
options: ['فرح', 'حزين', 'مبتهج', 'مسرور'],
correctAnswer: 'حزين',
hint: 'يشعر بالألم النفسي'
}
],
medium: [
{
type: 'multiple',
question: 'ما معنى كلمة "صلادة"؟',
options: ['نوع من الحلوى', 'إناء للأكل', 'الخبز اليابس', 'حساء ساخن'],
correctAnswer: 'إناء للأكل',
hint: 'تستخدم لتقديم الطعام'
},
{
type: 'fill',
question: 'مفرد كلمة "أراجيز" هو _____',
correctAnswer: 'أرجوزة',
hint: 'نوع من الشعر أو النظم'
},
{
type: 'multiple',
question: 'مرادف كلمة "وجل" هو:',
options: ['خوف', 'شجاعة', 'حزن', 'فرح'],
correctAnswer: 'خوف',
hint: 'مشاعر عند توقع الخطر'
}
],
hard: [
{
type: 'multiple',
question: 'ما معنى كلمة "الفصاحة"؟',
options: ['الكتابة السريعة', 'القراءة الصحيحة', 'البلاغة وحسن البيان', 'حفظ الشعر'],
correctAnswer: 'البلاغة وحسن البيان',
hint: 'مرتبطة بمهارات الخطابة واللغة'
},
{
type: 'fill',
question: 'مضاد كلمة "النفاق" هو _____',
correctAnswer: 'الإخلاص',
hint: 'الصدق في المشاعر والأقوال'
},
{
type: 'multiple',
question: 'ما هي كلمة اللغة العربية التي تبدأ وتنتهي بنفس الحرف "السين"؟',
options: ['سلس', 'سوس', 'سناء', 'سمين'],
correctAnswer: 'سلس',
hint: 'تعني سهل الانقياد أو البسيط'
}
]
}
};
// Variables to track quiz state
let currentCategory = '';
let currentDifficulty = '';
let currentQuestions = [];
let currentQuestionIndex = 0;
let score = 0;
let correctAnswers = 0;
let timer;
let timeLeft = 60; // Default time in seconds
let selectedCategoryBtn = null;
let selectedDifficultyBtn = null;
let hintUsed = false;
// DOM Elements
const welcomeScreen = document.getElementById('welcome-screen');
const quizContainer = document.getElementById('quiz-container');
const resultsScreen = document.getElementById('results-screen');
const categoryBtns = document.querySelectorAll('.category-btn');
const difficultyBtns = document.querySelectorAll('.difficulty-btn');
const startQuizBtn = document.getElementById('start-quiz');
const categoryBadge = document.getElementById('category-badge');
const difficultyBadge = document.getElementById('difficulty-badge');
const questionNumber = document.getElementById('question-number');
const totalQuestions = document.getElementById('total-questions');
const scoreElement = document.getElementById('score');
const timerText = document.getElementById('timer-text');
const timerProgress = document.getElementById('timer-progress');
const questionText = document.getElementById('question-text');
const questionExplanation = document.getElementById('question-explanation');
const answersContainer = document.getElementById('answers-container');
const textInputContainer = document.getElementById('text-input-container');
const textAnswer = document.getElementById('text-answer');
const submitTextAnswer = document.getElementById('submit-text-answer');
const hintButton = document.getElementById('hint-button');
const hintText = document.getElementById('hint-text');
const nextQuestion = document.getElementById('next-question');
const finalScore = document.getElementById('final-score');
const correctAnswersElement = document.getElementById('correct-answers');
const motivationalMessage = document.getElementById('motivational-message');
const resultIcon = document.getElementById('result-icon');
const restartSame = document.getElementById('restart-same');
const restartNew = document.getElementById('restart-new');
const shareBtns = document.querySelectorAll('.share-btn');
const correctSound = document.getElementById('correct-sound');
const wrongSound = document.getElementById('wrong-sound');
const timerSound = document.getElementById('timer-sound');
// Initialize event listeners
function initEventListeners() {
// Category selection
categoryBtns.forEach(btn => {
btn.addEventListener('click', () => {
if (selectedCategoryBtn) {
selectedCategoryBtn.classList.remove('selected');
}
btn.classList.add('selected');
selectedCategoryBtn = btn;
currentCategory = btn.getAttribute('data-category');
updateStartButtonState();
});
});
// Difficulty selection
difficultyBtns.forEach(btn => {
btn.addEventListener('click', () => {
if (selectedDifficultyBtn) {
selectedDifficultyBtn.classList.remove('selected');
}
btn.classList.add('selected');
selectedDifficultyBtn = btn;
currentDifficulty = btn.getAttribute('data-difficulty');
updateStartButtonState();
});
});
// Start quiz button
startQuizBtn.addEventListener('click', startQuiz);
// Hint button
hintButton.addEventListener('click', showHint);
// Next question button
nextQuestion.addEventListener('click', loadNextQuestion);
// Text answer submission
submitTextAnswer.addEventListener('click', checkTextAnswer);
textAnswer.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
checkTextAnswer();
}
});
// Results screen buttons
restartSame.addEventListener('click', () => {
welcomeScreen.classList.add('hidden');
resultsScreen.classList.add('hidden');
startQuiz();
});
restartNew.addEventListener('click', () => {
resetQuiz();
welcomeScreen.classList.remove('hidden');
resultsScreen.classList.add('hidden');
});
// Share buttons
shareBtns.forEach(btn => {
btn.addEventListener('click', () => {
const platform = btn.getAttribute('data-platform');
const text = `حصلت على ${score} نقطة في مسابقة المعرفة التفاعلية! جرب وتحدى نفسك!`;
const url = encodeURIComponent(window.location.href);
let shareUrl = '';
switch(platform) {
case 'facebook':
shareUrl = `https://www.facebook.com/sharer/sharer.php?u=${url}"e=${encodeURIComponent(text)}`;
break;
case 'twitter':
shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${url}`;
break;
case 'whatsapp':
shareUrl = `https://api.whatsapp.com/send?text=${encodeURIComponent(text + ' ' + window.location.href)}`;
break;
case 'linkedin':
shareUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${url}`;
break;
}
if (shareUrl) {
window.open(shareUrl, '_blank');
}
});
});
}
// Update start button state based on selections
function updateStartButtonState() {
if (currentCategory && currentDifficulty) {
startQuizBtn.disabled = false;
} else {
startQuizBtn.disabled = true;
}
}
// Start the quiz
function startQuiz() {
// Get questions for selected category and difficulty
currentQuestions = [...quizData[currentCategory][currentDifficulty]];
// Shuffle questions
currentQuestions = shuffleArray(currentQuestions);
// Reset quiz state
currentQuestionIndex = 0;
score = 0;
correctAnswers = 0;
// Update UI
welcomeScreen.classList.add('hidden');
quizContainer.classList.remove('hidden');
resultsScreen.classList.add('hidden');
// Set category and difficulty badges
updateCategoryBadge();
updateDifficultyBadge();
// Update question count
totalQuestions.textContent = currentQuestions.length;
// Load first question
loadQuestion();
}
// Update category badge
function updateCategoryBadge() {
let categoryText = '';
let categoryIcon = '';
switch(currentCategory) {
case 'general':
categoryText = 'معلومات عامة';
categoryIcon = 'fa-globe';
break;
case 'math':
categoryText = 'رياضيات';
categoryIcon = 'fa-calculator';
break;
case 'riddles':
categoryText = 'ألغاز';
categoryIcon = 'fa-puzzle-piece';
break;
case 'history':
categoryText = 'تاريخ';
categoryIcon = 'fa-landmark';
break;
case 'logic':
categoryText = 'منطق';
categoryIcon = 'fa-chess';
break;
case 'vocabulary':
categoryText = 'مفردات';
categoryIcon = 'fa-book';
break;
}
categoryBadge.innerHTML = `<i class="fas ${categoryIcon}"></i> ${categoryText}`;
}
// Update difficulty badge
function updateDifficultyBadge() {
let difficultyText = '';
let difficultyIcon = '';
let difficultyClass = '';
switch(currentDifficulty) {
case 'easy':
difficultyText = 'سهل';
difficultyIcon = 'fa-smile';
difficultyClass = 'badge green';
break;
case 'medium':
difficultyText = 'متوسط';
difficultyIcon = 'fa-meh';
difficultyClass = 'badge yellow';
break;
case 'hard':
difficultyText = 'صعب';
difficultyIcon = 'fa-dizzy';
difficultyClass = 'badge red';
break;
}
difficultyBadge.className = difficultyClass;
difficultyBadge.innerHTML = `<i class="fas ${difficultyIcon}"></i> ${difficultyText}`;
}
// Load current question
function loadQuestion() {
// Reset state for new question
clearTimeout(timer);
nextQuestion.classList.add('hidden');
hintButton.classList.remove('hidden');
hintText.classList.add('hidden');
questionExplanation.classList.add('hidden');
hintUsed = false;
// Set question info
const currentQuestion = currentQuestions[currentQuestionIndex];
questionNumber.textContent = currentQuestionIndex + 1;
questionText.textContent = currentQuestion.question;
// Set time based on difficulty
switch(currentDifficulty) {
case 'easy':
timeLeft = 60;
break;
case 'medium':
timeLeft = 45;
break;
case 'hard':
timeLeft = 30;
break;
}
// Reset timer UI
updateTimerUI();
startTimer();
// Determine question type and prepare UI
if (currentQuestion.type === 'multiple' || currentQuestion.type === 'truefalse') {
// Multiple choice or True/False
textInputContainer.classList.add('hidden');
answersContainer.classList.remove('hidden');
// Shuffle options for multiple choice
const options = [...currentQuestion.options];
if (currentQuestion.type === 'multiple') {
shuffleArray(options);
}
// Create option buttons
answersContainer.innerHTML = '';
options.forEach(option => {
const optionBtn = document.createElement('div');
optionBtn.className = 'answer-option';
optionBtn.textContent = option;
optionBtn.addEventListener('click', () => checkAnswer(option));
answersContainer.appendChild(optionBtn);
});
} else if (currentQuestion.type === 'fill') {
// Fill in the blank
answersContainer.classList.add('hidden');
textInputContainer.classList.remove('hidden');
textAnswer.value = '';
textAnswer.disabled = false;
submitTextAnswer.disabled = false;
// Remove any previous explanations
while (textInputContainer.children.length > 2) {
textInputContainer.removeChild(textInputContainer.lastChild);
}
textAnswer.focus();
}
}
// Start timer
function startTimer() {
updateTimerUI();
timer = setTimeout(() => {
if (timeLeft > 0) {
timeLeft--;
// Play sound when time is running out
if (timeLeft <= 5) {
timerSound.play();
}
startTimer();
} else {
// Time's up
handleTimeUp();
}
}, 1000);
}
// Update timer UI
function updateTimerUI() {
timerText.textContent = `${timeLeft} ثانية`;
const percentage = (timeLeft / getMaxTime()) * 100;
timerProgress.style.width = `${percentage}%`;
// Change color based on time left
timerProgress.className = 'timer-progress';
if (percentage > 60) {
// Default color
} else if (percentage > 30) {
timerProgress.classList.add('yellow');
} else {
timerProgress.classList.add('red');
}
}
// Get max time based on difficulty
function getMaxTime() {
switch(currentDifficulty) {
case 'easy':
return 60;
case 'medium':
return 45;
case 'hard':
return 30;
default:
return 60;
}
}
// Handle time up
function handleTimeUp() {
timerSound.play();
// Highlight correct answer
const currentQuestion = currentQuestions[currentQuestionIndex];
if (currentQuestion.type === 'multiple' || currentQuestion.type === 'truefalse') {
const options = answersContainer.querySelectorAll('.answer-option');
options.forEach(option => {
option.style.pointerEvents = 'none';
if (option.textContent === currentQuestion.correctAnswer) {
option.classList.add('correct');
}
});
} else if (currentQuestion.type === 'fill') {
textAnswer.disabled = true;
submitTextAnswer.disabled = true;
const explanation = document.createElement('p');
explanation.className = 'mt-2 text-success font-semibold';
explanation.textContent = `الإجابة الصحيحة: ${currentQuestion.correctAnswer}`;
textInputContainer.appendChild(explanation);
}
// Show hint if not already shown
if (!hintUsed) {
hintText.textContent = currentQuestion.hint;
hintText.classList.remove('hidden');
}
// Prepare for next question
nextQuestion.classList.remove('hidden');
hintButton.classList.add('hidden');
}
// Check answer for multiple choice and true/false
function checkAnswer(selectedOption) {
clearTimeout(timer);
const currentQuestion = currentQuestions[currentQuestionIndex];
const isCorrect = selectedOption === currentQuestion.correctAnswer;
// Disable all options
const options = answersContainer.querySelectorAll('.answer-option');
options.forEach(option => {
option.style.pointerEvents = 'none';
if (option.textContent === currentQuestion.correctAnswer) {
option.classList.add('correct');
} else if (option.textContent === selectedOption && !isCorrect) {
option.classList.add('wrong');
}
});
// Update score and give feedback
updateScore(isCorrect);
// Show hint if wrong
if (!isCorrect && !hintUsed) {
hintText.textContent = currentQuestion.hint;
hintText.classList.remove('hidden');
}
// Prepare for next question
nextQuestion.classList.remove('hidden');
hintButton.classList.add('hidden');
}
// Check answer for fill in the blank
function checkTextAnswer() {
clearTimeout(timer);
const currentQuestion = currentQuestions[currentQuestionIndex];
const userAnswer = textAnswer.value.trim();
// Check if answer is correct (case insensitive for fill in the blank)
const isCorrect = userAnswer.toLowerCase() === currentQuestion.correctAnswer.toLowerCase();
// Disable input
textAnswer.disabled = true;
submitTextAnswer.disabled = true;
// Show correct answer
const explanation = document.createElement('p');
explanation.className = isCorrect ? 'mt-2 text-success font-semibold' : 'mt-2 text-danger font-semibold';
explanation.textContent = isCorrect ?
`إجابة صحيحة!` :
`الإجابة الصحيحة: ${currentQuestion.correctAnswer}`;
textInputContainer.appendChild(explanation);
// Update score and give feedback
updateScore(isCorrect);
// Show hint if wrong
if (!isCorrect && !hintUsed) {
hintText.textContent = currentQuestion.hint;
hintText.classList.remove('hidden');
}
// Prepare for next question
nextQuestion.classList.remove('hidden');
hintButton.classList.add('hidden');
}
// Update score
function updateScore(isCorrect) {
// Calculate points based on difficulty, time left, and if hint was used
let points = 0;
if (isCorrect) {
// Base points by difficulty
switch(currentDifficulty) {
case 'easy':
points = 5;
break;
case 'medium':
points = 10;
break;
case 'hard':
points = 15;
break;
}
// Bonus for time left
const timeBonus = Math.floor(timeLeft / 5);
points += timeBonus;
// Penalty for using hint
if (hintUsed) {
points = Math.floor(points * 0.7);
}
// Update score and correct answers
score += points;
correctAnswers++;
// Play sound
correctSound.play();
} else {
// Play wrong sound
wrongSound.play();
}
// Update UI
scoreElement.textContent = score;
// Add animation
scoreElement.classList.add('pulse-animation');
setTimeout(() => {
scoreElement.classList.remove('pulse-animation');
}, 600);
}
// Show hint
function showHint() {
hintUsed = true;
hintText.textContent = currentQuestions[currentQuestionIndex].hint;
hintText.classList.remove('hidden');
hintButton.classList.add('hidden');
}
// Load next question
function loadNextQuestion() {
currentQuestionIndex++;
if (currentQuestionIndex < currentQuestions.length) {
loadQuestion();
} else {
showResults();
}
}
// Show results
function showResults() {
quizContainer.classList.add('hidden');
resultsScreen.classList.remove('hidden');
// Update results info
finalScore.innerHTML = `النتيجة النهائية: <span class="score-value">${score}</span> نقطة`;
correctAnswersElement.innerHTML = `الإجابات الصحيحة: <b style="color: #4CAF50;">${correctAnswers}</b> من <span>${currentQuestions.length}</span>`;
// Calculate percentage
const percentage = (correctAnswers / currentQuestions.length) * 100;
// Update icon and message based on score
if (percentage >= 80) {
resultIcon.className = 'fas fa-trophy results-icon';
motivationalMessage.className = 'message-box success';
motivationalMessage.textContent = 'ممتاز! أنت حقاً عبقري! استمر في التعلم وتطوير معلوماتك!';
} else if (percentage >= 60) {
resultIcon.className = 'fas fa-medal results-icon';
resultIcon.style.color = '#2196F3';
motivationalMessage.className = 'message-box info';
motivationalMessage.textContent = 'أحسنت! نتيجة جيدة جداً، واصل المحاولة لتصل إلى القمة!';
} else if (percentage >= 40) {
resultIcon.className = 'fas fa-thumbs-up results-icon';
resultIcon.style.color = '#4CAF50';
motivationalMessage.className = 'message-box warning';
motivationalMessage.textContent = 'جيد! يمكنك تحسين نتيجتك بالمزيد من التمرين!';
} else {
resultIcon.className = 'fas fa-book-reader results-icon';
resultIcon.style.color = '#9C27B0';
motivationalMessage.className = 'message-box warning';
motivationalMessage.textContent = 'لا بأس! كل محاولة هي خطوة للأمام، حاول مرة أخرى وستحسن نتيجتك!';
}
}
// Reset quiz to initial state
function resetQuiz() {
currentCategory = '';
currentDifficulty = '';
currentQuestions = [];
currentQuestionIndex = 0;
score = 0;
correctAnswers = 0;
clearTimeout(timer);
if (selectedCategoryBtn) {
selectedCategoryBtn.classList.remove('selected');
selectedCategoryBtn = null;
}
if (selectedDifficultyBtn) {
selectedDifficultyBtn.classList.remove('selected');
selectedDifficultyBtn = null;
}
startQuizBtn.disabled = true;
}
// Helper function to shuffle array
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
// Initialize app
function init() {
initEventListeners();
}
// Start the app when DOM is loaded
document.addEventListener('DOMContentLoaded', init);
</script>
</div>

إرسال تعليق