/* ستايل مصنع الكلمات العملاق (الشاحنات والمحركات) */
:root {
    --bg-color: #f1f5f9;      /* رمادي فاتح جداً (خلفية المخطط) */
    --primary: #ea580c;       /* برتقالي إنشائي (Construction Orange) */
    --secondary: #eab308;     /* أصفر المعدات (Heavy Yellow) */
    --accent: #1e293b;        /* رمادي داكن للتباين القوي (Dark Slate) */
    --success: #22c55e;       /* أخضر واضح للنجاح */
    --danger: #64748b;        /* رمادي للإجابات الخاطئة */
    --text: #0f172a;          /* لون نص قوي داكن جداً */
    --text-muted: #475569;    
    --white: #ffffff;
    --shadow: 0 10px 20px rgba(0,0,0,0.15);
    --diacritic: #2563eb;     /* أزرق هندسي للحركات */
}

body {
    margin: 0;
    font-family: 'Tajawal', 'Changa', sans-serif;
    background: var(--bg-color);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    /* خلفية مخطط هندسي (Blueprint Grid) */
    background-image: 
        linear-gradient(rgba(148, 163, 184, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.2) 1px, transparent 1px),
        linear-gradient(rgba(148, 163, 184, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.1) 1px, transparent 1px);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
    background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
}

/* خلفية حيوية خفيفة */
.animated-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
}

.floating-items {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    margin: 0; padding: 0;
    list-style: none;
}

.floating-items li {
    position: absolute;
    display: block;
    font-size: 2.5rem;
    animation: floatUp 15s linear infinite;
    bottom: -100px;
    opacity: 0.5;
}

.floating-items li:nth-child(1) { left: 10%; animation-duration: 12s; font-size: 3rem; }
.floating-items li:nth-child(2) { left: 25%; animation-duration: 9s; animation-delay: 2s; }
.floating-items li:nth-child(3) { left: 40%; animation-duration: 18s; animation-delay: 5s; }
.floating-items li:nth-child(4) { left: 60%; animation-duration: 10s; font-size: 4rem; }
.floating-items li:nth-child(5) { left: 80%; animation-duration: 14s; animation-delay: 1s; }
.floating-items li:nth-child(6) { left: 15%; animation-duration: 16s; animation-delay: 6s; }
.floating-items li:nth-child(7) { left: 75%; animation-duration: 13s; animation-delay: 3s; font-size: 2.5rem; }
.floating-items li:nth-child(8) { left: 50%; animation-duration: 17s; animation-delay: 7s; }

@keyframes floatUp {
    0% { transform: translateY(0) rotate(0); opacity: 0.5; }
    100% { transform: translateY(-1200px) rotate(720deg); opacity: 0; }
}

/* تحكم بالواجهات */
.view { display: none; animation: popIn 0.4s ease-out forwards; }
.view.active-view { display: block; }
@keyframes popIn { 
    from { opacity: 0; transform: scale(0.95); } 
    to { opacity: 1; transform: scale(1); } 
}

/* الهيدر */
.app-header {
    text-align: center;
    padding: 3rem 1rem 1rem;
    color: var(--primary);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 20px;
}

.header-titles {
    text-align: right;
    flex: 1;
}

.home-btn {
    background: var(--white);
    color: var(--primary);
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    border: 3px solid var(--secondary);
}

.home-btn:hover {
    background: var(--secondary);
    color: var(--white);
    transform: scale(1.05);
}

.avatar-selector {
    position: relative;
    display: inline-block;
    margin-right: 20px;
}

.current-avatar {
    font-size: 3rem;
    cursor: pointer;
    background: var(--white);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(244, 114, 182, 0.3);
    border: 3px solid var(--primary);
    transition: transform 0.3s;
    user-select: none;
}

.current-avatar:hover {
    transform: scale(1.1) rotate(10deg);
}

.avatar-options {
    display: none;
    position: absolute;
    top: 80px;
    right: 0;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 10px;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    border: 2px solid var(--secondary);
}

.avatar-options.show {
    display: flex;
    animation: popIn 0.3s ease-out forwards;
}

.avatar-options div {
    font-size: 2.5rem;
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
    text-align: center;
}

.avatar-options div:hover {
    transform: scale(1.2);
}

.app-header h1 { font-size: 3.5rem; margin: 0; font-family: 'Changa', sans-serif; color: var(--primary);}
.app-header p { font-size: 1.5rem; font-weight: bold; color: var(--text-muted);}

/* خريطة الدروس بطريقة الرفوف الخشبية 3D */
.lessons-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 100px;
    row-gap: 90px;
    max-width: 1200px;
    margin: 3rem auto;
    padding: 20px 40px;
}

.lesson-card {
    background: #f8fafc;
    width: 160px;
    height: 150px;
    text-align: center;
    cursor: pointer;
    position: relative;
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 15px 15px 5px 5px;
    border: 4px solid var(--primary);
    border-bottom: 20px solid var(--accent); /* المصد */
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    transition: transform 0.3s;
}

/* أضواء الشاحنة */
.lesson-card::before {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 10px;
    width: 20px;
    height: 10px;
    background: #fef08a; 
    border-radius: 5px;
    box-shadow: 110px 0 0 #fef08a; /* الضوء الثاني على اليمين */
}

/* العجلات */
.lesson-card::after {
    content: '';
    position: absolute;
    bottom: -25px;
    left: 5px;
    width: 25px;
    height: 35px;
    background: #0f172a; 
    border-radius: 5px;
    box-shadow: 115px 0 0 #0f172a; /* العجلة الثانية */
    z-index: -1;
}

.lesson-card:nth-child(even) {
    border-color: var(--secondary);
}

.lesson-card:nth-child(3n) {
    border-color: #3b82f6; 
}

@keyframes engineVibrate {
    0% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

.lesson-card:hover {
    transform: translateY(-10px) scale(1.05) !important;
    box-shadow: 0 20px 30px rgba(0,0,0,0.2);
}

.lesson-number {
    position: absolute; 
    top: -5px; 
    right: 5px;
    background: var(--accent); 
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900; 
    font-size: 1.5rem;
    border: 4px solid var(--white);
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    z-index: 10;
}

.lesson-icon { 
    font-size: 5.5rem; 
    margin: 10px 0; 
    display: block; 
    filter: drop-shadow(0 15px 10px rgba(0,0,0,0.4)); /* 3D Drop Shadow */
    transition: transform 0.3s;
    z-index: 5;
    position: relative;
}

.lesson-card:hover .lesson-icon {
    /* تأثير الحركة (Animation) عند المرور */
    animation: wiggle 0.5s ease-in-out infinite alternate;
}

@keyframes wiggle {
    0% { transform: rotate(-8deg) scale(1.1) translateY(-10px); }
    100% { transform: rotate(8deg) scale(1.1) translateY(-10px); }
}

.lesson-name { 
    font-size: 1.3rem; 
    font-weight: bold; 
    color: var(--primary); 
    margin-top: 15px;
    background: rgba(255,255,255,0.9);
    padding: 8px 15px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 170px; /* نفس عرض الجزيرة تقريباً ليقوم بلف النص بدلاً من التمدد */
    box-sizing: border-box;
    z-index: 5;
    line-height: 1.4;
}

/* الدرس الداخلي (شكل كتاب مفتوح) */
#lesson-view { 
    max-width: 1000px; 
    margin: 2rem auto; 
    background: #fff; 
    padding: 3rem; 
    border-radius: 20px; 
    box-shadow: 
        inset 0 0 50px rgba(0,0,0,0.05),
        0 20px 40px rgba(0,0,0,0.1),
        0 0 0 10px var(--secondary); /* غلاف الكتاب */
    position: relative;
}
/* خط منتصف الكتاب */
#lesson-view::before {
    content: ''; position: absolute; left: 50%; top: 0; height: 100%; width: 2px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.1), transparent);
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
}

.back-btn { 
    background: var(--secondary); color: var(--white); border: none; 
    padding: 10px 25px; border-radius: 30px; font-size: 1.1rem; cursor: pointer; 
    font-family: inherit; margin-bottom: 20px; font-weight: bold; transition: 0.3s;
    box-shadow: 0 5px 10px rgba(139, 90, 43, 0.3);
}
.back-btn:hover { background: var(--primary); transform: translateY(-3px); }

.lesson-title { text-align: center; font-size: 2.8rem; color: var(--primary); margin-top: 0; border-bottom: 3px double var(--secondary); padding-bottom: 15px; }

/* التبويبات */
.lesson-tabs { display: flex; justify-content: center; gap: 15px; margin-bottom: 30px; flex-wrap: wrap; position: relative; z-index: 10;}
.tab-btn { 
    background: #f8fafc; border: 3px solid var(--secondary); padding: 15px 35px; 
    border-radius: 40px 10px 10px 10px; /* مقصورة الشاحنة في اليسار */
    font-size: 1.3rem; font-weight: bold; cursor: pointer; 
    color: var(--text); transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    font-family: inherit; display: flex; align-items: center; gap: 8px;
    box-shadow: 0 6px 0 var(--primary), 0 10px 10px rgba(0,0,0,0.1);
    position: relative;
    border-bottom: 8px solid var(--accent);
}
/* عجلات الشاحنة الجانبية */
.tab-btn::before, .tab-btn::after {
    content: '';
    position: absolute;
    bottom: -15px;
    width: 20px;
    height: 20px;
    background: #0f172a;
    border-radius: 50%;
    border: 3px solid #94a3b8;
    transition: 0.2s;
}
.tab-btn::before { right: 20px; } /* العجلة الخلفية */
.tab-btn::after { left: 30px; } /* العجلة الأمامية */

.tab-btn.active, .tab-btn:hover { 
    background: var(--accent); color: var(--white); border-color: var(--accent);
    transform: translateY(-3px); box-shadow: 0 9px 0 var(--primary), 0 15px 15px rgba(234, 88, 12, 0.3); 
}
.tab-btn.active::before, .tab-btn.active::after, .tab-btn:hover::before, .tab-btn:hover::after {
    border-color: var(--primary); /* إضاءة العجلات عند التفعيل */
}
.tab-btn:active, .tab-btn.active:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 var(--primary), 0 5px 5px rgba(234, 88, 12, 0.3);
}

.tab-content { display: none; text-align: center; padding: 2rem; background: transparent; min-height: 350px; position: relative; z-index: 10;}
.tab-content.active-tab { display: block; animation: fadeIn 0.4s; }
.instruction-text { font-size: 1.6rem; color: var(--primary); margin-bottom: 25px; display: inline-block; padding-bottom: 5px; border-bottom: 3px dashed var(--secondary);}

/* التبويب 1: قراءة الدرس */
.reading-box {
    text-align: right; line-height: 2.5; font-size: 1.8rem; padding: 20px;
    background: transparent; border-radius: 0;
}
.reading-sentence {
    display: inline-block; padding: 10px 20px; margin: 8px; border-radius: 30px; cursor: pointer; transition: 0.3s;
    background: #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.05); border: 2px solid transparent;
}
.reading-sentence:hover { background: #fff8f0; color: var(--accent); transform: scale(1.05) translateY(-3px); box-shadow: 0 8px 15px rgba(230, 126, 34, 0.2); border-color: var(--accent);}
.reading-sentence.playing { background: var(--accent); color: var(--white); transform: scale(1.05); box-shadow: 0 8px 20px rgba(230, 126, 34, 0.4);}

.reading-word {
    display: inline-block;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    border-radius: 5px;
}
.reading-word.word-playing {
    background-color: var(--white);
    color: var(--accent);
    transform: scale(1.1);
    padding: 0 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* التبويب 2: المعاني */
.vocab-grid { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }
.vocab-card {
    background: white; border: none; border-radius: 25px; width: 220px; min-height: 140px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative;
    box-shadow: 0 8px 0 #e0d8c8, 0 15px 20px rgba(0,0,0,0.1); padding: 15px; text-align: center;
}
.vocab-card:hover { transform: translateY(-10px); box-shadow: 0 18px 0 #e0d8c8, 0 25px 30px rgba(0,0,0,0.15);}
.vocab-card:active { transform: translateY(8px); box-shadow: 0 0 0 #e0d8c8, 0 5px 10px rgba(0,0,0,0.1); }
.vocab-word { font-size: 2rem; font-weight: bold; color: var(--primary); }
.vocab-meaning { font-size: 1.3rem; color: var(--success); margin-top: 10px; display: none; font-weight: bold; animation: popIn 0.3s; }
.vocab-card.flipped .vocab-word { color: var(--text-muted); font-size: 1.2rem; margin-bottom: 5px;}
.vocab-card.flipped .vocab-meaning { display: block; }
.vocab-card.flipped { background: #fbf9f6; box-shadow: 0 8px 0 var(--success), 0 15px 20px rgba(39, 174, 96, 0.2); }
.vocab-card.flipped:active { box-shadow: 0 0 0 var(--success), 0 5px 10px rgba(39, 174, 96, 0.2); }

/* التبويب 3: الترتيب */
.order-drop-zone {
    display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px;
    padding: 30px; min-height: 100px; align-items: center; border: 4px dashed #bdc3c7; border-radius: 25px; background: rgba(236, 240, 241, 0.6); box-shadow: inset 0 5px 15px rgba(0,0,0,0.05);
}
.order-words-zone { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }
.word-pill {
    background: var(--success); color: var(--white); padding: 12px 25px; border-radius: 20px; font-size: 1.6rem;
    font-weight: bold; cursor: pointer; box-shadow: 0 6px 0 #1e8449, 0 10px 10px rgba(0,0,0,0.1); transition: 0.2s; user-select: none; border: 2px solid #2ecc71;
}
.word-pill:active { transform: translateY(6px); box-shadow: 0 0 0 #1e8449, 0 5px 5px rgba(0,0,0,0.1); }
.word-slot {
    min-width: 80px; height: 50px; border-bottom: 3px solid var(--primary); padding: 5px;
    display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: bold; color: var(--success);
}
.order-result-msg { font-size: 2rem; font-weight: bold; margin-top: 20px; color: var(--success); animation: popIn 0.5s; }

/* التبويب 4: الأسئلة */
.quiz-box { background: transparent; padding: 10px; border-radius: 20px; }
.quiz-q { font-size: 2.2rem; color: var(--primary); margin-bottom: 30px; font-weight: bold; }
.quiz-options { display: flex; flex-direction: column; gap: 20px; align-items: center; }
.quiz-opt {
    background: white; border: none; width: 80%; padding: 20px; border-radius: 50px;
    font-size: 1.5rem; cursor: pointer; transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); font-family: inherit; text-align: right; color: var(--text);
    box-shadow: 0 6px 0 #bdc3c7, 0 10px 15px rgba(0,0,0,0.05); font-weight: bold;
}
.quiz-opt:hover { background: #fdfbf7; transform: translateY(-5px); box-shadow: 0 11px 0 #bdc3c7, 0 15px 20px rgba(0,0,0,0.1); color: var(--accent);}
.quiz-opt:active { transform: translateY(6px); box-shadow: 0 0 0 #bdc3c7, 0 5px 5px rgba(0,0,0,0.1); }
.quiz-opt.correct { background: var(--success); color: white; box-shadow: 0 6px 0 #1e8449; animation: bouncy 0.6s; }
.quiz-opt.correct:active { box-shadow: 0 0 0 #1e8449; }
.quiz-opt.wrong { background: var(--danger); color: white; box-shadow: 0 6px 0 #6b7280; animation: fade-wrong 0.8s; }
.quiz-opt.wrong:active { box-shadow: 0 0 0 #6b7280; }

@keyframes fadeIn { from{ opacity:0; } to{ opacity:1; } }
@keyframes bouncy { 0%, 100%{ transform: translateY(0); } 50%{ transform: translateY(-8px); } }
@keyframes fade-wrong { 0%,100%{ transform: scale(1); } 50%{ transform: scale(0.97); background: #d1d5db; } }

/* التبويب 7: المصحح الصوتي */
.mic-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    font-size: 4rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 0 #2980b9, 0 15px 20px rgba(0,0,0,0.2);
    transition: 0.2s;
    position: relative;
}
.mic-btn:active {
    transform: translateY(10px);
    box-shadow: 0 0 0 #2980b9, 0 5px 10px rgba(0,0,0,0.2);
}
.mic-btn.listening {
    background: var(--accent);
    box-shadow: 0 10px 0 #c0392b, 0 15px 20px rgba(0,0,0,0.2);
    animation: micPulse 1.5s infinite;
}
@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7), 0 10px 0 #c0392b; }
    70% { box-shadow: 0 0 0 30px rgba(231, 76, 60, 0), 0 10px 0 #c0392b; }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0), 0 10px 0 #c0392b; }
}

/* التبويب 8: ألعاب الفهم والاستيعاب */
.comprehension-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}
.comp-question {
    font-size: 2.2rem;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    background: #fff;
    padding: 15px 30px;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border: 3px dashed var(--accent);
}
.comp-options-grid {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}
.comp-opt-card {
    background: white;
    border: none;
    border-radius: 25px;
    width: 200px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 0 #bdc3c7, 0 15px 20px rgba(0,0,0,0.1);
    padding: 20px;
}
.comp-opt-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 0 #bdc3c7, 0 20px 25px rgba(0,0,0,0.15);
}
.comp-opt-card:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #bdc3c7, 0 5px 5px rgba(0,0,0,0.1);
}
.comp-opt-img {
    font-size: 5rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.2));
}
.comp-opt-text {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--text);
}
/* تنسيقات صح وخطأ */
.tf-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}
.tf-btn {
    border: none;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    font-size: 4rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.tf-true {
    background: var(--success);
    box-shadow: 0 8px 0 #1e8449, 0 15px 20px rgba(0,0,0,0.2);
}
.tf-false {
    background: #e74c3c;
    box-shadow: 0 8px 0 #c0392b, 0 15px 20px rgba(0,0,0,0.2);
}
.tf-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 transparent, 0 5px 10px rgba(0,0,0,0.2);
}
/* حركات الإجابة */
.comp-correct {
    animation: comp-bounce 0.6s !important;
    background: #d4efdf !important;
    border: 3px solid var(--success);
}
.comp-wrong {
    animation: comp-shake 0.4s !important;
    background: #fadbd8 !important;
    border: 3px solid #e74c3c;
}

@keyframes comp-bounce { 0%, 100%{ transform: translateY(0) scale(1); } 50%{ transform: translateY(-15px) scale(1.05); } }
@keyframes comp-shake { 0%,100%{ transform: translateX(0); } 25%{ transform: translateX(-15px) rotate(-5deg); } 75%{ transform: translateX(15px) rotate(5deg); } }

/* الموبايل */
@media screen and (max-width: 768px) {
    .app-header h1 { font-size: 2.2rem; }
    .lesson-title { font-size: 2rem; }
    #lesson-view::before { display: none; }
    .tab-btn { flex: 1 1 45%; justify-content: center; font-size: 1rem; }
    .reading-box { font-size: 1.4rem; line-height: 2; padding: 15px; }
    .word-pill { font-size: 1.2rem; padding: 8px 15px; }
    .quiz-opt { width: 100%; font-size: 1.2rem; }
    .lessons-grid { column-gap: 15px; row-gap: 90px; padding: 20px 10px; }
    .lesson-card { width: 125px; height: 110px; }
    .lesson-icon { font-size: 3.5rem; }
    .lesson-name { font-size: 1rem; bottom: -65px; max-width: 135px; padding: 6px 10px; }
    
    .train-engine { font-size: 2.5rem; margin-left: 5px; }
    .train-car { width: 50px; height: 40px; font-size: 1.4rem; margin: 0 2px; border-width: 2px; border-radius: 6px; }
    .train-car::after, .train-car::before { width: 12px; height: 12px; bottom: -10px; }
    .train-car::after { left: 5px; }
    .train-car::before { right: 5px; }
}

/* --- ألعاب الفهم الجديدة --- */

/* 1. لعبة المطابقة (Memory Cards) */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.memory-card {
    background-color: var(--primary);
    color: white;
    font-size: 2rem;
    height: 100px;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.6s, background-color 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    user-select: none;
    position: relative;
}
.memory-card::before {
    content: '❓';
    position: absolute;
    font-size: 3rem;
    color: rgba(255,255,255,0.4);
}
.memory-card.flipped::before, .memory-card.matched::before {
    display: none;
}
.memory-card.flipped {
    background-color: var(--accent);
    transform: rotateY(180deg);
}
.memory-card.matched {
    background-color: var(--success);
    transform: rotateY(180deg) scale(0.95);
    opacity: 0.8;
    pointer-events: none;
}
.memory-card .content {
    transform: rotateY(180deg);
    display: none;
    font-size: 2.5rem;
}
.memory-card.flipped .content, .memory-card.matched .content {
    display: block;
}

/* 2. لعبة الميزان البصري (Visual Scale) */
.scale-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 40px;
    padding: 20px;
    background: #fdfbfb;
    border-radius: 20px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}
.scale-zone {
    width: 150px;
    height: 150px;
    border: 4px dashed #ccc;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    transition: all 0.3s;
}
.scale-zone.true-zone { border-color: var(--success); color: var(--success); background: rgba(46, 204, 113, 0.1); }
.scale-zone.false-zone { border-color: var(--danger); color: var(--danger); background: rgba(231, 76, 60, 0.1); }
.scale-zone.drag-over { transform: scale(1.1); background: #eee; }

.scale-item {
    font-size: 5rem;
    cursor: grab;
    user-select: none;
    transition: transform 0.2s;
    text-align: center;
}
.scale-item:active { cursor: grabbing; transform: scale(0.9); }
.scale-word {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text);
    margin-bottom: -10px;
}

/* 3. ملء الفراغ (Drag & Drop Blank) */
.fill-blank-sentence {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1.8;
    color: var(--primary);
    text-align: center;
    margin: 30px 0;
}
.blank-slot {
    display: inline-block;
    min-width: 100px;
    height: 50px;
    border-bottom: 4px dashed var(--accent);
    margin: 0 10px;
    vertical-align: bottom;
    transition: background 0.3s;
}
.blank-slot.drag-over { background: rgba(243, 156, 18, 0.2); }
.blank-slot.filled { border-bottom-style: solid; border-color: var(--success); color: var(--success); text-align: center; line-height: 50px; }

.drag-words-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}
.drag-word-btn {
    background: var(--bg-card);
    border: 3px solid var(--accent);
    border-radius: 15px;
    padding: 10px 25px;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: grab;
    box-shadow: 0 5px 0 var(--accent);
    transition: transform 0.1s;
}
.drag-word-btn:active { cursor: grabbing; transform: translateY(5px); box-shadow: none; }

/* 4. البحث عن الكلمة (Word Hunt Bubbles) */
.hunt-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: #e0f7fa;
    border-radius: 20px;
    overflow: hidden;
    margin-top: 20px;
    border: 3px solid #00acc1;
}
.hunt-target {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 5rem;
    background: rgba(255,255,255,0.8);
    padding: 10px 30px;
    border-radius: 30px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 10;
}
.hunt-bubble {
    position: absolute;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), rgba(0,172,193,0.6));
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #006064;
    cursor: pointer;
    box-shadow: inset 0 0 20px rgba(255,255,255,0.5), 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    user-select: none;
    width: 120px;
    height: 120px;
    text-align: center;
    white-space: pre-wrap;
    padding: 10px;
}
.hunt-bubble:hover { transform: scale(1.1); }
.hunt-bubble.pop { transform: scale(1.5); opacity: 0; transition: all 0.2s; }

/* 5. قطار الحروف (Train of Syllables) */
.train-container {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    flex-wrap: nowrap;
    margin-top: 40px;
    padding-bottom: 20px;
    border-bottom: 4px solid #7f8c8d;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.train-engine {
    font-size: 4rem;
    margin-left: 10px;
}
.train-car {
    min-width: 60px;
    min-height: 50px;
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    background: var(--accent);
    border: 3px solid #c0392b;
    border-radius: 10px;
    margin: 0 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: white;
    font-weight: bold;
    position: relative;
}
.train-car::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 10px;
    width: 20px;
    height: 20px;
    background: #2c3e50;
    border-radius: 50%;
}
.train-car::before {
    content: '';
    position: absolute;
    bottom: -15px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: #2c3e50;
    border-radius: 50%;
}
.train-car.drag-over { background: #f39c12; }

.train-letters-pool {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}
.train-letter {
    background: #fff;
    border: 3px solid var(--primary);
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    cursor: grab;
    box-shadow: 0 4px 0 var(--primary);
    flex-shrink: 0;
}
.train-letter:active { cursor: grabbing; transform: translateY(4px); box-shadow: none; }
