/* ============================================================
   منصة الألعاب التعليمية — نظام تصميم بسيط ونظيف
   الخط العريض: Baloo Bhaijaan 2 (عناوين ودّية تناسب بيئة تعليمية)
   خط النص: Tajawal (نص واضح وسهل القراءة بالعربية)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+Bhaijaan+2:wght@500;700;800&family=Tajawal:wght@400;500;700&display=swap');

:root {
    --ink:        #1E2438;   /* نص أساسي */
    --ink-soft:   #5B6178;   /* نص ثانوي */
    --bg:         #F6F7FB;   /* خلفية الصفحة */
    --surface:    #FFFFFF;   /* بطاقات */
    --border:     #E4E7F1;

    --primary:    #3D4FE0;   /* أزرق بنفسجي — ثقة وتعلّم */
    --primary-dk: #2E3BB0;
    --primary-bg: #EEF0FD;

    --accent:     #FFB020;   /* أصفر برتقالي — مرح الألعاب */
    --accent-dk:  #E89600;

    --success:    #1FAA6B;
    --success-bg: #E7F8F0;
    --danger:     #E5484D;
    --danger-bg:  #FDEBEC;

    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 2px 10px rgba(30, 36, 56, 0.06);
    --shadow-lg: 0 12px 32px rgba(30, 36, 56, 0.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Tajawal', sans-serif;
    line-height: 1.6;
}

h1, h2, h3, h4, .brand {
    font-family: 'Baloo Bhaijaan 2', 'Tajawal', sans-serif;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 .4em;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-inline-end: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar .brand {
    font-size: 1.3rem;
    color: var(--primary);
    padding: 0 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-weight: 500;
}
.nav-link:hover { background: var(--primary-bg); color: var(--primary); text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }

.nav-row { display: flex; align-items: center; gap: 4px; }
.nav-row .nav-link { flex: 1; min-width: 0; }
.nav-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}
.nav-add-btn:hover { background: var(--primary-bg); color: var(--primary); text-decoration: none; }

.main {
    flex: 1;
    padding: 28px 36px;
    max-width: 1180px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.role-badge {
    display: inline-block;
    font-size: .75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--primary-bg);
    color: var(--primary-dk);
}
.role-badge.accent { background: #FFF4DE; color: var(--accent-dk); }

/* ---------- Avatars ---------- */
.avatar-img {
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}
.avatar-circle {
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7A8CFF);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: 'Baloo Bhaijaan 2';
    flex-shrink: 0;
}
.profile-topbar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}
.profile-topbar-link:hover { opacity: .85; text-decoration: none; }
.avatar-upload-row { display: flex; align-items: center; gap: 18px; margin-bottom: 10px; }

.lang-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--ink-soft);
}
.lang-switch a { color: var(--ink-soft); }
.lang-switch a.active { color: var(--primary); }
.lang-switch span { color: var(--border); }
.lang-switch select {
    width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-soft);
    font-weight: 700;
    font-size: .82rem;
    cursor: pointer;
}

/* ---------- Cards & tables ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.game-card, .lesson-card { 
    padding: 0; 
    overflow: hidden; 
    transition: transform 0.25s cubic-bezier(0.17, 0.67, 0.83, 0.67), box-shadow 0.25s ease;
}
.game-card:hover, .lesson-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(61, 79, 224, 0.12);
    border-color: #C0C8E0;
}

.game-card .thumb, .lesson-card .thumb {
    height: 130px;
    background: linear-gradient(135deg, var(--primary), #7A8CFF);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 2rem; font-family: 'Baloo Bhaijaan 2';
}
.game-card .thumb-img, .lesson-card .thumb-img {
    height: 130px;
    width: 100%;
    object-fit: contain;   /* لا يقتطع أي جزء من الصورة، فقط يصغّرها لتناسب الإطار */
    background: var(--primary-bg);
    display: block;
}
.game-card .body, .lesson-card .body { padding: 16px; }
.game-card h4, .lesson-card h4 { margin-bottom: 6px; }
.game-card p, .lesson-card p { color: var(--ink-soft); font-size: .9rem; margin: 0 0 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 12px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--ink-soft); font-weight: 700; font-size: .85rem; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 500; margin-bottom: 6px; font-size: .92rem; }
.form-group { margin-bottom: 18px; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], textarea, select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .95rem;
    background: #fff;
    color: var(--ink);
    transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}
textarea { resize: vertical; min-height: 90px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.checkbox-row input { width: auto; }

/* ============================================================
   نافذة منبثقة صغيرة (Modal)
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 30, .5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    z-index: 1000;
}
.modal-box {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    width: 100%;
    max-width: 460px;
    margin: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}
.modal-close:hover { color: var(--danger); background: var(--danger-bg); }

@media (max-width: 560px) {
    .modal-overlay { padding: 16px; }
    .modal-box { padding: 16px; }
}

/* ============================================================
   محرر تنسيق محتوى الدرس (Quill)
   ============================================================ */
#lessonContentEditor { background: #fff; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
#lessonContentEditor .ql-editor { min-height: 220px; font-size: 1rem; line-height: 1.8; }
.ql-toolbar.ql-snow { border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--primary-bg); }
.ql-container.ql-snow { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

.lesson-content { line-height: 1.9; }
.lesson-content p { margin: 0 0 14px; }
.lesson-content h1, .lesson-content h2, .lesson-content h3 { margin: 22px 0 10px; }
.lesson-content ul, .lesson-content ol { margin: 0 0 14px; padding-inline-start: 26px; }
.lesson-content blockquote {
    margin: 0 0 14px;
    padding: 8px 16px;
    border-inline-start: 4px solid var(--primary);
    background: var(--primary-bg);
    color: var(--ink-soft);
}
.lesson-content img { max-width: 100%; border-radius: var(--radius-sm); }
.lesson-content a { color: var(--primary); text-decoration: underline; }
.lesson-content table { border-collapse: collapse; width: 100%; margin: 0 0 14px; }
.lesson-content table td, .lesson-content table th { border: 1px solid var(--border); padding: 8px 10px; text-align: start; }
.lesson-content table th { background: var(--primary-bg); font-weight: 700; }
.lesson-cover-img { width: 100%; max-height: 320px; object-fit: contain; background: var(--primary-bg); border-radius: var(--radius); margin-bottom: 16px; }

.ql-editor table { border-collapse: collapse; width: 100%; margin-bottom: 10px; }
.ql-editor table td { border: 1px solid var(--border); padding: 6px 8px; min-width: 40px; }
.lesson-video-row input { min-width: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: .92rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-accent { background: var(--accent); color: #3A2900; }
.btn-accent:hover { background: var(--accent-dk); }
.btn-outline { background: #fff; border: 1.5px solid var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }

/* ---------- Alerts ---------- */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-weight: 500;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger  { background: var(--danger-bg); color: var(--danger); }

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 15% 20%, #7A8CFF33, transparent 40%),
        radial-gradient(circle at 85% 80%, #FFB02033, transparent 40%),
        var(--bg);
    padding: 20px;
}
.auth-card {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
}
.auth-card .brand { text-align: center; font-size: 1.6rem; margin-bottom: 4px; }
.auth-card .subtitle { text-align: center; color: var(--ink-soft); margin-bottom: 26px; font-size: .9rem; }

.google-btn { gap: 10px; font-weight: 700; }
.or-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--ink-soft);
    font-size: .82rem;
    margin: 4px 0 18px;
}
.or-divider::before, .or-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}
.or-divider span { padding: 0 12px; }

/* ---------- Permission matrix ---------- */
.perm-matrix td, .perm-matrix th { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: start; }

@media (max-width: 780px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
    .main { padding: 18px; }
}

/* ============================================================
   الموقع العام — قائمة علوية عصرية (Modern Glass Header)
   ============================================================ */
.site-header {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(228, 231, 241, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(30, 36, 56, 0.03);
    transition: all 0.3s ease;
}

.site-header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* الشعار — إبراز لطيف */
.site-header .brand { 
    font-size: 1.45rem; 
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, #7A8CFF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.site-header-top-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(228, 231, 241, 0.6);
}

/* روابط التنقل بنمط الكبسولات (Pill Navigation) */
.site-header-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.site-nav { 
    display: flex; 
    gap: 6px; 
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
}

.site-nav a {
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 0.93rem;
    padding: 7px 14px;
    border-radius: 999px;
    transition: all 0.2s ease;
}

.site-nav a:hover, .site-nav a.active {
    color: var(--primary);
    background: var(--primary-bg);
    text-decoration: none;
    transform: translateY(-1px);
}

/* شريط بحث ديناميكي وأنيق */
.nav-search {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    padding: 3px 3px 3px 16px;
    transition: all 0.25s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.nav-search:focus-within {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.nav-search input {
    border: none;
    background: transparent;
    font-size: .88rem;
    width: 150px;
    outline: none;
    color: var(--ink);
    transition: width 0.3s ease;
}

.nav-search input:focus {
    width: 210px;
}

.nav-search button {
    border: none;
    background: var(--primary);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.15s;
}

.nav-search button:hover {
    background: var(--primary-dk);
    transform: scale(1.06);
}

.site-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.site-footer {
    text-align: center;
    padding: 26px;
    color: var(--ink-soft);
    font-size: .85rem;
    border-top: 1px solid var(--border);
}

/* ============================================================
   قسم الترحيب الجذاب (Glowing Hero Section)
   ============================================================ */
.hero {
    text-align: center;
    padding: 70px 20px 60px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 0%, rgba(61, 79, 224, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 80% 100%, rgba(255, 176, 32, 0.12) 0%, transparent 45%);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(30, 36, 56, 0.02);
}
.hero h1 { font-size: 2.8rem; margin-bottom: 14px; font-weight: 800; color: var(--primary-dk); }
.hero p { color: var(--ink-soft); font-size: 1.15rem; max-width: 600px; margin: 0 auto 28px; line-height: 1.8; }
.hero .btn { margin: 0 8px 12px; }

/* شارات الثقة (Trust Badges) */
.hero-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 24px;
    flex-wrap: wrap;
}
.hero-trust span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-soft);
    background: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.hero-search {
    display: flex;
    gap: 8px;
    max-width: 480px;
    margin: 0 auto 22px;
}
.hero-search input {
    flex: 1;
    padding: 13px 18px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    font-size: .95rem;
}
.hero-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-bg); }
.hero-search button { border-radius: 999px; padding: 12px 22px; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 30px 0 10px;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--ink);
    font-weight: 600;
    font-size: .88rem;
}
.page-link:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-dots { color: var(--ink-soft); padding: 0 4px; }

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 16px;
}
.section-title h3 { margin: 0; }

@media (max-width: 780px) {
    .site-header-inner { padding: 12px 16px; gap: 10px; }
    .site-header-top-actions { gap: 8px; }
    .site-header-bottom { flex-wrap: wrap; gap: 12px; }
    .site-nav { width: 100%; overflow-x: auto; gap: 6px; }
    .nav-search { width: 100%; }
    .nav-search input { flex: 1; width: auto; }
    .nav-search input:focus { width: auto; }
}

/* ============================================================
   واجهة لعبة "ترتيب حروف الكلمة" (word_scramble)
   ============================================================ */
.ws-progress {
    text-align: center;
    color: var(--ink-soft);
    font-weight: 700;
    margin-bottom: 14px;
    font-size: 1.05rem;
}

.timers-panel {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid var(--line, #e6e8ef);
    border-radius: 12px 0 0 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
    line-height: 1.15;
}
[dir="rtl"] .timers-panel {
    right: auto;
    left: 0;
    border-radius: 0 12px 12px 0;
}
.game-timer-badge {
    display: block;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: .9rem;
    font-weight: 800;
    color: var(--primary-dk);
    white-space: nowrap;
}
.question-timer-badge {
    display: block;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent);
    color: #3A2900;
    font-weight: 800;
    font-size: .75rem;
    white-space: nowrap;
}
.question-timer-badge:empty { display: none; }

#gamePlayArea:fullscreen,
#gamePlayArea:-webkit-full-screen {
    background: #fff;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
#gamePlayArea.gpa-fullscreen .card {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}
.ws-wrap { text-align: center; padding: 10px 0 4px; }
.ws-image {
    max-height: 260px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 16px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
    background: #fff;
}
.ws-description {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 22px;
}

.ws-answer {
    direction: inherit;
    unicode-bidi: plaintext;
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    border: 3px dashed var(--border);
    border-radius: 16px;
    background: var(--primary-bg);
    padding: 10px 18px;
    margin: 0 auto 22px;
    max-width: 92%;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.ws-answer:hover { border-color: var(--primary); }
.ws-answer.correct { border-style: solid; border-color: var(--success); background: var(--success-bg); }
.ws-answer.shake { border-color: var(--danger); animation: ws-shake .4s; }
@keyframes ws-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}
.ws-answer-text {
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-dk);
    line-height: 1.1;
    letter-spacing: 0;
}
.ws-answer-blanks {
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    color: var(--border);
    letter-spacing: 8px;
}

.ws-pool {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.ws-letter {
    width: 74px;
    height: 80px;
    border-radius: 14px;
    border: none;
    background: var(--accent);
    color: #3A2900;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--accent-dk);
    transition: transform .1s;
}
.ws-letter:hover:not(:disabled) { transform: translateY(-3px); }
.ws-letter:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--accent-dk); }
.ws-letter:disabled { background: var(--border); box-shadow: none; cursor: default; }

.ws-feedback { min-height: 30px; font-weight: 800; font-size: 1.15rem; margin-bottom: 14px; }
.ws-feedback.correct { color: var(--success); }
.ws-feedback.incorrect { color: var(--danger); }
.ws-final-score { font-size: 1.6rem; font-weight: 800; color: var(--primary); text-align: center; }

.ws-details-panel { display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin-inline: auto; }
.ws-detail-row { border-inline-start: 4px solid var(--ink-soft); background: var(--surface, #fff); border-radius: 8px; padding: 10px 14px; text-align: start; }
.ws-detail-row.ws-detail-correct { border-inline-start-color: var(--success); }
.ws-detail-row.ws-detail-partial { border-inline-start-color: #d9a300; }
.ws-detail-row.ws-detail-incorrect { border-inline-start-color: var(--danger); }
.ws-detail-prompt { font-weight: 700; margin-bottom: 4px; }
.ws-detail-student, .ws-detail-answer { font-size: .9rem; color: var(--ink-soft); margin: 2px 0; }
.ws-detail-row.ws-detail-correct .ws-detail-answer { color: var(--success); }
.ws-detail-row.ws-detail-incorrect .ws-detail-student { color: var(--danger); }

/* ============================================================
   طريقة لعب بديلة: عجلة الأسئلة
   ============================================================ */
.mode-select-wrap { text-align: center; padding: 18px 0; }
.mode-select-title { margin: 0 0 16px; color: var(--ink); }
.mode-select-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.q-wheel-stage {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 18px auto 26px;
}
.q-wheel-pointer {
    position: absolute;
    top: -12px;
    left: 50%;
    width: 26px;
    height: 32px;
    transform: translateX(-50%);
    clip-path: polygon(50% 100%, 0 32%, 0 0, 100% 0, 100% 32%);
    background: linear-gradient(180deg, #FFD166 0%, var(--accent) 45%, var(--accent-dk) 100%);
    filter: drop-shadow(0 3px 5px rgba(30, 36, 56, .4));
    z-index: 4;
}
.q-wheel-canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.q-wheel-wrap {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    box-shadow:
        0 0 0 5px #fff,
        0 0 0 9px var(--accent),
        0 14px 30px rgba(30, 36, 56, .28);
    transition: transform 4s cubic-bezier(.17, .67, .12, .99);
}
.q-wheel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff, var(--accent) 55%, var(--accent-dk) 100%);
    box-shadow: 0 0 0 3px #fff, 0 3px 8px rgba(30, 36, 56, .4);
    z-index: 3;
}
.q-wheel-thumb {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.q-wheel-thumb-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(30, 36, 56, .45);
}
.q-wheel-thumb-text {
    max-width: 84px;
    padding: 5px 10px;
    background: rgba(30, 36, 56, .86);
    color: #fff;
    font-family: 'Baloo Bhaijaan 2', 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: .74rem;
    line-height: 1.3;
    text-align: center;
    border-radius: 999px;
    border: 1.5px solid rgba(255, 255, 255, .9);
    box-shadow: 0 2px 7px rgba(30, 36, 56, .35);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   واجهة الطالب: لعب قالب "رتب الآتي"
   ============================================================ */
.ord-wrap { text-align: center; padding: 10px 0 4px; }
.ord-instruction {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 20px;
}
.ord-slots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    min-height: 96px;
    border: 3px dashed var(--border);
    border-radius: 16px;
    background: var(--primary-bg);
    padding: 14px;
    margin: 0 auto 20px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.ord-slots:hover { border-color: var(--primary); }
.ord-slots.correct { border-style: solid; border-color: var(--success); background: var(--success-bg); }
.ord-slots.shake { border-color: var(--danger); animation: ws-shake .4s; }
.ord-slot {
    position: relative;
    min-width: 90px;
    min-height: 68px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 10px;
}
.ord-slot.filled { border-color: var(--primary); box-shadow: var(--shadow); }
.ord-slot-num {
    position: absolute;
    top: -10px;
    inset-inline-start: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #3A2900;
    font-weight: 800;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 3px #fff;
}
.ord-item-image { max-width: 100%; max-height: 60px; border-radius: 6px; object-fit: contain; }
.ord-item-text { font-weight: 700; font-size: .95rem; color: var(--ink); }

.ord-pool {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.ord-item-btn {
    min-width: 90px;
    max-width: 160px;
    border: none;
    border-radius: 14px;
    background: var(--accent);
    color: #3A2900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 12px;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--accent-dk);
    transition: transform .1s;
}
.ord-item-btn .ord-item-text { color: #3A2900; }
.ord-item-btn:hover:not(:disabled) { transform: translateY(-3px); }
.ord-item-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--accent-dk); }
.ord-item-btn:disabled, .ord-item-btn.used { background: var(--border); box-shadow: none; cursor: default; visibility: hidden; }

.ord-reveal { margin-top: 6px; text-align: center; }
.ord-reveal-label { font-weight: 800; color: var(--ink-soft); margin-bottom: 10px; }
.ord-reveal-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ord-reveal-item {
    position: relative;
    min-width: 90px;
    min-height: 68px;
    background: var(--success-bg);
    border: 2px solid var(--success);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 10px;
}
.ord-reveal-item .ord-slot-num { background: var(--success); color: #fff; }

@media (max-width: 640px) {
    .ord-slot, .ord-reveal-item { min-width: 74px; min-height: 58px; padding: 6px 8px; }
    .ord-item-btn { min-width: 74px; padding: 8px 10px; }
    .ord-item-image { max-height: 46px; }
    .ord-item-text { font-size: .8rem; }
}

/* ============================================================
   واجهة المعلم: وضع نقاط قالب "التوصيل على صورة"
   ============================================================ */
.il-builder-stage {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 14px;
    background: var(--bg);
}
.il-builder-stage.has-image { border-style: solid; cursor: crosshair; }
.il-builder-image { display: block; width: 100%; height: auto; user-select: none; }
.il-builder-marker {
    position: absolute;
    width: 30px;
    height: 30px;
    margin-left: -15px;
    margin-top: -15px;
    border-radius: 50%;
    background: var(--accent);
    color: #3A2900;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0,0,0,.3);
    pointer-events: none;
}
.il-builder-list { display: flex; flex-direction: column; gap: 8px; }
.il-builder-row { display: flex; align-items: center; gap: 8px; }
.il-builder-row-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary-dk);
    font-weight: 800;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.il-builder-row input[type=text] { flex: 1; }

/* ============================================================
   واجهة المعلم: صفوف اختيارات قالب "الاختيار من متعدد"
   ============================================================ */
.mc-choice-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mc-choice-row input[type=radio] { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--success); }
.mc-choice-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary-dk);
    font-weight: 800;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mc-choice-row input[type=text] { flex: 1; }
.mc-remove-choice { flex-shrink: 0; }

/* ============================================================
   واجهة المعلم: صفوف أزواج قالب "التوصيل"
   ============================================================ */
.match-pair-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.match-pair-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary-dk);
    font-weight: 800;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.match-pair-row > input[type=text] { flex: 1; min-width: 0; }
.match-pair-arrow { flex-shrink: 0; color: var(--ink-soft); font-weight: 800; }
.match-pair-b {
    flex: 1.4;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.match-pair-preview { height: 50px; border-radius: 6px; align-self: flex-start; }

/* ============================================================
   واجهة المعلم: صفوف عناصر قالب "رتب الآتي"
   ============================================================ */
.ord-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.ord-item-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary-dk);
    font-weight: 800;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ord-item-fields {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ord-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   واجهة الطالب: لعب قالب "التوصيل على صورة"
   ============================================================ */
.il-wrap { position: relative; text-align: center; }
.il-wrap .ws-feedback { min-height: 24px; font-size: 1rem; margin-bottom: 6px; }
.il-lines-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

.il-layout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: nowrap;
}
.il-image-stage {
    position: relative;
    display: inline-block;   
    max-width: 72%;          
    flex-shrink: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    line-height: 0;
}
.il-image {
    display: block;
    max-width: 100%;
    max-height: min(62vh, 700px);
    width: auto;
    height: auto;
}

/* النقاط (3D Button Effect) */
.il-point {
    position: absolute;
    width: 24px;
    height: 24px;
    margin-left: -12px;
    margin-top: -12px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--border);
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    transition: all 0.2s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}
.il-point.connected { 
    border-color: #fff; 
    background: var(--primary);
    box-shadow: 0 0 0 3px var(--primary), 0 4px 10px rgba(61, 79, 224, 0.4);
    transform: scale(1.15); 
}
.il-point.correct { border-color: #fff; background: var(--success); box-shadow: 0 0 0 3px var(--success); }
.il-point.incorrect { border-color: #fff; background: var(--danger); box-shadow: 0 0 0 3px var(--danger); }

/* حاوية الكلمات */
.il-words {
    flex: 1 1 auto;
    min-width: 0;
    max-height: min(62vh, 700px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(8px, 1.5vh, 14px);
    padding-right: 4px;
    align-items: center;
}

/* الكلمات (3D Button Effect + Fit Content) */
.il-word {
    width: fit-content;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(10px, 1.5vh, 16px) clamp(16px, 2vw, 24px);
    border-radius: 16px; 
    background: linear-gradient(180deg, #FFC843 0%, var(--accent) 100%); 
    border: 2px solid #E69500;
    color: #3A2900;
    font-weight: 800;
    font-size: clamp(.9rem, 1.7vh, 1.15rem);
    letter-spacing: .2px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    box-shadow: 0 5px 0 #D98E00, 0 8px 15px rgba(0,0,0,0.1); 
    transition: transform .15s, box-shadow .15s, background .15s;
}
.il-word:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 7px 0 #D98E00, 0 12px 20px rgba(0,0,0,0.12); 
}
.il-word:active { 
    cursor: grabbing; 
    transform: translateY(5px); 
    box-shadow: 0 0 0 #D98E00, 0 2px 5px rgba(0,0,0,0.1); 
}
.il-word-pending { 
    background: var(--primary-bg); 
    color: var(--primary-dk); 
    border: 2px solid var(--primary);
    box-shadow: 0 4px 0 var(--primary), 0 6px 10px rgba(61, 79, 224, 0.15); 
}
.il-word-correct { 
    background: linear-gradient(180deg, #43D88D 0%, var(--success) 100%); 
    color: #fff; 
    border: 2px solid #188F5A;
    box-shadow: 0 4px 0 #188F5A; 
    cursor: default; 
    transform: translateY(1px);
}
.il-word-incorrect-final { 
    background: linear-gradient(180deg, #FF6B70 0%, var(--danger) 100%); 
    color: #fff; 
    border: 2px solid #C0392B;
    box-shadow: 0 4px 0 #C0392B; 
    cursor: default; 
    transform: translateY(1px);
}

.il-line-pending { stroke: var(--primary); stroke-width: 3; }
.il-line-dragging { stroke: var(--primary); stroke-width: 3; stroke-dasharray: 6 4; }
.il-line-correct { stroke: var(--success); stroke-width: 3; }
.il-line-incorrect { stroke: var(--danger); stroke-width: 3; }
.il-line-reveal { stroke: var(--success); stroke-width: 2.5; stroke-dasharray: 5 5; }

/* ============================================================
   واجهة الطالب: لعب قالب "الاختيار من متعدد"
   ============================================================ */
.mc-wrap { text-align: center; }
.mc-question-text {
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 24px;
}
.mc-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 480px;
    margin: 0 auto 14px;
}
.mc-choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    text-align: start;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    transition: border-color .15s, background .15s;
}
.mc-choice-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-bg); }
.mc-choice-btn:disabled { cursor: default; }
.mc-choice-btn.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.mc-choice-btn.incorrect { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.mc-choice-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary-dk);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mc-choice-btn.correct .mc-choice-letter { background: var(--success); color: #fff; }
.mc-choice-btn.incorrect .mc-choice-letter { background: var(--danger); color: #fff; }
.mc-choice-text { flex: 1; }

/* ============================================================
   واجهة الطالب: لعب قالب "صح أو خطأ" (مستقل عن الاختيار من متعدد)
   ============================================================ */
.tf-wrap { text-align: center; }
.tf-question-text {
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 24px;
}
.tf-choices {
    display: flex;
    gap: 16px;
    max-width: 420px;
    margin: 0 auto 14px;
    justify-content: center;
}
.tf-choice-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 14px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ink);
    transition: border-color .15s, background .15s;
}
.tf-choice-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-bg); }
.tf-choice-btn:disabled { cursor: default; }
.tf-choice-btn.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.tf-choice-btn.incorrect { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.tf-choice-icon { font-size: 2rem; line-height: 1; }

/* ============================================================
   قالب: أكمل الكلمات الناقصة
   ============================================================ */
.ml-letters-stage { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; }
.ml-letter-toggle {
    width: 46px;
    height: 52px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: #fff;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--ink);
    cursor: pointer;
    transition: all .15s;
}
.ml-letter-toggle:hover { border-color: var(--primary); }
.ml-letter-toggle.ml-missing { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

.ml-wrap { text-align: center; padding: 10px 0 4px; }
.ml-word-row {
    direction: inherit;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 auto 22px;
    max-width: 92%;
}
.ml-letter-box {
    min-width: 50px;
    height: 58px;
    padding: 0 6px;
    border-radius: 12px;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-dk);
}
input.ml-letter-input {
    width: 50px;
    height: 58px;
    border-radius: 12px;
    border: 3px dashed var(--border);
    background: #fff;
    text-align: center;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-dk);
    padding: 0;
}
.ml-letter-input:focus { outline: none; border-color: var(--primary); border-style: solid; }
.ml-letter-input.correct { border-color: var(--success); border-style: solid; background: var(--success-bg); color: var(--success); }
.ml-letter-input.incorrect { border-color: var(--danger); border-style: solid; background: var(--danger-bg); color: var(--danger); animation: ws-shake .4s; }

/* ============================================================
   واجهة الطالب: قالب "أكمل الجملة"
   ============================================================ */
.fb-wrap { text-align: center; }
.fb-question-text {
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 24px;
}
.fb-input-row {
    display: flex;
    gap: 10px;
    max-width: 420px;
    margin: 0 auto 14px;
    justify-content: center;
}
.fb-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface);
    transition: border-color .15s, background .15s;
}
.fb-input:focus { outline: none; border-color: var(--primary); }
.fb-input.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.fb-input.incorrect { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); animation: ws-shake .4s; }
.fb-input:disabled { opacity: .8; }

/* ============================================================
   واجهة الطالب: لعب قالب "التوصيل" بين مجموعتين
   ============================================================ */
.match-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(6px, 1.1vh, 12px) clamp(20px, 6vw, 90px);
    align-items: center;
    justify-items: center;
    padding: 4px;
}
.match-col { display: contents; }
.match-col-a > * { grid-column: 1; }
.match-col-b > * { grid-column: 2; }
.match-col .il-word {
    font-size: clamp(.85rem, 1.7vh, 1.1rem);
    padding: clamp(7px, 1.2vh, 13px) clamp(10px, 1.4vw, 18px);
    text-align: center;
}

/* بطاقات التوصيل في العمود ب (3D Button Effect + Fit Content) */
.match-b-card {
    width: fit-content;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: clamp(8px, 1.2vh, 14px) clamp(10px, 1.5vw, 18px);
    border-radius: 18px; 
    border: 3px solid var(--border); 
    background: #ffffff;
    text-align: center;
    box-shadow: 0 4px 12px rgba(30, 36, 56, 0.04);
    transition: all 0.25s cubic-bezier(0.17, 0.67, 0.83, 0.67); 
}
.match-b-card:hover {
    border-color: #C0C8E0;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(30, 36, 56, 0.08);
}
.match-b-card.connected { 
    border-color: var(--primary); 
    background: var(--primary-bg);
    transform: scale(1.03); 
    box-shadow: 0 6px 15px rgba(61, 79, 224, 0.15);
}
.match-b-card.correct { 
    border-color: var(--success); 
    background: var(--success-bg); 
    box-shadow: 0 4px 12px rgba(31, 170, 107, 0.15);
}
.match-b-card.incorrect { 
    border-color: var(--danger); 
    background: var(--danger-bg); 
    box-shadow: 0 4px 12px rgba(229, 72, 77, 0.15);
}
.match-b-image { max-width: 100%; max-height: min(11vh, 90px); border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.match-b-word { font-weight: 800; font-size: clamp(.95rem, 1.8vh, 1.15rem); color: var(--ink); }

.game-check-btn {
    margin-top: 6px;
    min-width: 170px;
    padding: 11px 26px;
    font-size: 1rem;
    border-radius: 999px;
}
.game-check-btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 480px) {
    .match-layout { gap: 8px; }
    .match-col .il-word { font-size: .75rem; padding: 7px 8px; }
    .match-b-card { padding: 6px; }
    .match-b-image { max-height: 50px; }
    .match-b-word { font-size: .75rem; }
    
    .il-layout { gap: 8px; }
    .il-word { padding: 8px 10px; font-size: .8rem; }
    .il-point { width: 20px; height: 20px; margin-left: -10px; margin-top: -10px; }
}

/* ============================================================
   واجهة الطالب: لعب قالب "التصنيف" (Classification)
   ============================================================ */
.cls-stage { display: flex; flex-direction: column; gap: 30px; padding: 10px 0; }
.cls-buckets { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.cls-bucket {
    flex: 1; min-width: 160px; max-width: 280px; min-height: 160px;
    background: var(--surface); border: 3px dashed var(--border); border-radius: var(--radius);
    display: flex; flex-direction: column; transition: all 0.2s ease; overflow: hidden;
}
.cls-bucket-title {
    background: var(--primary); color: #fff; padding: 10px; font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 1.2rem; margin: 0; text-align: center;
}
.cls-bucket-inner {
    flex: 1; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; justify-content: center;
    background: var(--bg);
}
.cls-bucket.drag-over { border-color: var(--primary); transform: scale(1.02); }
.cls-bucket.drag-over .cls-bucket-inner { background: var(--primary-bg); }

.cls-pool {
    min-height: 150px; padding: 20px; border: 2px solid var(--border); border-radius: var(--radius);
    background: #fff; display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; align-items: center;
}

.cls-card {
    width: 110px; min-height: 110px; padding: 10px;
    background: #fff; border: 2px solid var(--border); border-radius: 14px;
    box-shadow: 0 4px 10px rgba(30,36,56,0.1);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    cursor: grab; touch-action: none; user-select: none;
    transition: box-shadow 0.2s; z-index: 10;
}
.cls-card:active { cursor: grabbing; box-shadow: 0 2px 4px rgba(30,36,56,0.15); }
.cls-card.is-dragging { opacity: 0.9; z-index: 1000; pointer-events: none; }

.cls-card img { max-width: 100%; max-height: 60px; border-radius: 8px; object-fit: contain; pointer-events: none; }
.cls-card span { font-weight: 700; font-size: 0.95rem; color: var(--ink); pointer-events: none; text-align: center; line-height: 1.2; word-break: break-word; max-width: 100%; }

.cls-card.in-bucket {
    width: auto; min-height: unset; padding: 6px 10px; flex-direction: row;
    border: 1px solid var(--primary); box-shadow: none; cursor: default;
    animation: dropIn 0.3s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}
.cls-card.in-bucket img { max-height: 30px; width: auto; }
.cls-card.in-bucket span { font-size: 0.85rem; }

.cls-card.shake { border-color: var(--danger); animation: ws-shake 0.4s; }

@keyframes dropIn { 
    0% { transform: scale(1.5) translateY(-20px); opacity: 0; } 
    100% { transform: scale(1) translateY(0); opacity: 1; } 
}