/* ملف styles.css المحسن بشكل مودرن */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #3f51b5;
    --primary-dark: #303f9f;
    --primary-light: #c5cae9;
    --accent-color: #ff4081;
    --accent-dark: #f50057;
    --accent-light: #ff80ab;
    --text-color: #212121;
    --text-light: #757575;
    --background: #fafafa;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    --special-cell: #ffca28;
    --elimination-cell: #ff5252;
    --correct-cell: #66bb6a;
    --wrong-cell: #ef5350;
    --grid-border: #e0e0e0;
    --transition: all 0.15s ease; /* تقليل مدة الانتقال أكثر */
    --border-radius: 12px;
    
    /* تحسينات الأداء */
    --transform-duration: 0.1s; /* تقليل المدة أكثر */
    --hover-duration: 0.05s; /* تقليل مدة التحويم */
}

body {
    font-family: 'Tajawal', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text-color);
    direction: rtl;
    overflow-x: hidden;
}

.container {
    max-width: 1280px;
    min-width: 280px;
    margin: 24px auto;
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

/* --- Header --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 18px 28px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.header::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    pointer-events: none;
    z-index: -1;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: headerShine 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes headerShine {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0.3;
    }
    50% {
        transform: translate(20px, 20px);
        opacity: 0.6;
    }
}

.header-title {
    font-size: 38px;
    font-weight: 700;
    text-align: center;
    width: 100%;
    padding: 8px 0;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 5;
    letter-spacing: 1px;
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* تحسين تنسيق حاوية عناصر التحكم في الترويسة */
.header-controls {
    display: flex;
    gap: 14px;
    align-items: center;
    position: relative;
    z-index: 10;
}

.header-controls > * {
    position: relative;
    z-index: 10;
}

.settings-wrapper {
    position: relative;
    display: inline-block;
}
/* تنسيق زر التحكم بالصوت في الترويسة */
.header-controls .sound-control {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.25);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    backdrop-filter: blur(10px);
}

.header-controls .sound-control:hover {
    background-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.header-controls .sound-on {
    color: #4caf50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.header-controls .sound-off {
    color: #ff5252;
    text-shadow: 0 0 10px rgba(255, 82, 82, 0.5);
}

.btn {
    padding: 12px 18px;
    border: none;
    border-radius: 50px;
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background-color: var(--accent-dark);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

#settingsMenuBtn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#settingsMenuBtn:hover {
    background-color: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg) scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.settings-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 10px;
    min-width: 180px;
    display: none;
}

.settings-menu.show {
    display: block;
}

.menu-btn {
    display: block;
    width: 100%;
    text-align: right;
    margin-bottom: 8px;
    background-color: transparent;
    color: var(--text-color);
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
}

.menu-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    padding-right: 20px;
}

/* --- Grid --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
    margin-bottom: 32px;
    perspective: 1000px;
}

.cell {
    aspect-ratio: 1;
    border: 2px solid var(--grid-border);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px; /* حجم خط مناسب ومقروء */
    font-weight: 700;
    cursor: pointer;
    background-color: var(--card-bg);
    position: relative;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03); /* تقليل الظلال */
    transition: transform var(--hover-duration) ease, 
                box-shadow var(--hover-duration) ease,
                border-color var(--hover-duration) ease; /* تحسين الانتقالات */
    overflow: hidden;
    will-change: transform; /* تحسين الأداء */
    contain: layout style paint; /* تحسين عملية الرسم */
}

.cell:hover {
    transform: translateY(-2px); /* تقليل المسافة */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.cell.special {
    background: linear-gradient(135deg, var(--special-cell), #ffd54f);
    color: #5d4037;
    font-size: 22px; /* تكبير خط خلايا التعجيز */
}

.cell.elimination {
    background: linear-gradient(135deg, var(--elimination-cell), #ff8a80);
    color: white;
    font-size: 22px; /* تكبير خط خلايا الطرد */
}

.cell.answered-correct {
    background: linear-gradient(135deg, var(--correct-cell), #a5d6a7);
    color: #1b5e20;
    box-shadow: 0 4px 12px rgba(102, 187, 106, 0.3);
    pointer-events: none;
    cursor: default;
}

.cell.answered-wrong {
    background: linear-gradient(135deg, var(--wrong-cell), #ef9a9a);
    color: #b71c1c;
    opacity: 0.8;
    box-shadow: 0 4px 12px rgba(239, 83, 80, 0.3);
    pointer-events: none;
    cursor: default;
}



/* شارة الفريق على الخلية المُجابة */
.cell-team-badge {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 10px;
    padding: 2px 10px;
    font-size: 10px;
    font-weight: 800;
    color: white;
    z-index: 3;
    white-space: nowrap;
    max-width: 90%;
    line-height: 1.6;
    box-shadow: 0 1px 5px rgba(0,0,0,0.3);
    font-family: 'Tajawal', sans-serif;
    letter-spacing: 0.3px;
    pointer-events: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* تقليل الشفافية */
    z-index: 1000;
    /* إزالة backdrop-filter لتحسين الأداء */
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); /* تقليل الظلال */
    animation: modalFadeIn 0.25s ease-out; /* تقليل مدة الرسومية */
    scroll-behavior: smooth;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 16px;
}

.modal-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* تنسيق حاوية عناصر التحكم في المودال */
.modal-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-right: 20px;
}

/* تنسيق زر التحكم بالصوت مع تحسينات إضافية */
.sound-control {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sound-control:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ══════════════════════════════════
   بنوك الأسئلة
   ══════════════════════════════════ */
.banks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}

.bank-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 2px solid #e8eaf6;
    background: #fafbff;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.bank-card:hover {
    border-color: #9fa8da;
    background: #f0f2ff;
}

.bank-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f2ff, #e8ebff);
    box-shadow: 0 2px 10px rgba(102,126,234,0.18);
}

.bank-card.active-bank .bank-card-name::after {
    content: ' ✓ نشط';
    color: #43a047;
    font-size: 11px;
    font-weight: 700;
}

.bank-card-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}

.bank-card-info {
    flex: 1;
    min-width: 0;
}

.bank-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bank-card-desc {
    font-size: 12px;
    color: #8e99a4;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apply-bank-btn {
    width: 100% !important;
    margin-top: 10px !important;
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    border: none !important;
    justify-content: center;
}

.apply-bank-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.banks-loading {
    text-align: center;
    color: #8e99a4;
    padding: 14px;
    font-size: 13px;
}

/* ═══════════════════════════════════════
   Footer
   ═══════════════════════════════════════ */
.game-footer {
    text-align: center;
    padding: 22px 24px 20px;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: rgba(10, 14, 30, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.footer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 24px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.25s ease;
    min-width: 130px;
    border: none;
}

.footer-btn-donate {
    background: linear-gradient(135deg, #ff6b6b, #e53935);
    color: white;
    box-shadow: 0 4px 14px rgba(229,57,53,0.4);
}

.footer-btn-donate:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(229,57,53,0.55);
    color: white;
}

.footer-btn-twitter {
    background: linear-gradient(135deg, #2c3e6b, #1a2545);
    color: white;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.footer-btn-twitter:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #3a5080, #263460);
    box-shadow: 0 7px 20px rgba(0,0,0,0.45);
    color: white;
}

.footer-copy {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.3px;
}

.footer-copy a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-weight: 700;
}

.footer-copy a:hover {
    color: white;
    text-decoration: underline;
}

.sound-on {
    color: #66bb6a;
}

.sound-off {
    color: #ef5350;
}

/* تعديل على هيكل رأس المودال لتوزيع العناصر بشكل أفضل */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 16px;
}

.modal-title {
    flex: 1;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.close-modal {
    font-size: 32px;
    margin-right: 0;
    z-index: 1;
}

.close-modal:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}

.timer {
    font-size: 56px;
    margin: 24px 0;
    color: var(--accent-color);
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border-radius: 16px;
    padding: 16px;
    border: 2px solid #ffe082;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.15);
}

.question-container {
    margin-bottom: 24px;
    background-color: rgba(197, 202, 233, 0.2);
    padding: 20px;
    border-radius: 12px;
}

.question-text {
    font-size: 28px;
    margin-bottom: 24px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    font-weight: 500;
}

/* تحديد حجم أقصى للصورة وضمان التمرير */
.question-image {
    max-height: 300px;
    max-width: 100%;
    object-fit: contain;
    margin: 16px auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    padding: 20px;
    border: 2px solid var(--primary-light);
    border-radius: 12px;
    cursor: pointer;
    font-size: 20px;
    margin-bottom: 12px;
    text-align: center;
    transition: var(--transition);
    background-color: var(--card-bg);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.option:hover {
    background-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.option.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 6px 12px rgba(63, 81, 181, 0.3);
}

.answer-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--primary-light);
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 20px;
    text-align: center;
    font-family: 'Tajawal', sans-serif;
    transition: var(--transition);
}

.answer-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.2);
    outline: none;
}

.answer-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 36px;
}

.answer-buttons .btn {
    padding: 16px 32px;
    font-size: 20px;
    min-width: 200px;
}

.correct-answer {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 12px;
    display: none;
    font-size: 22px;
    text-align: center;
    border: 2px solid #a5d6a7;
    color: #2e7d32;
    box-shadow: 0 4px 12px rgba(102, 187, 106, 0.2);
    animation: fadeIn 0.5s ease;
}

/* ═══════════════════════════════════
   واجهة السؤال للمتسابقين (Question Modal)
   ═══════════════════════════════════ */

/* المودال الخارجي */
.qmodal-content {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 20px !important;
    max-width: 680px !important;
    gap: 0;
}

/* ── رأس المودال ── */
.qmodal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-bottom: 0;
    border-bottom: none;
}

.qmodal-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qmodal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.qmodal-close:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.1);
}

/* ── المؤقت ── */
.qmodal-timer-wrap {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0 24px 20px;
}

.qmodal-timer {
    background: rgba(255,255,255,0.15) !important;
    border: 2px solid rgba(255,255,255,0.3) !important;
    border-radius: 16px !important;
    font-size: 52px !important;
    padding: 12px !important;
    margin: 0 !important;
    color: white !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

/* ── بطاقة السؤال ── */
.qmodal-question-card {
    margin: 20px 20px 8px !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(102,126,234,0.12) !important;
    border: 1px solid #e8eaf6 !important;
    padding: 24px !important;
}

.qmodal-question-card .question-text {
    font-size: 24px !important;
    margin-bottom: 0 !important;
    line-height: 1.7;
    color: #212121;
    text-align: center;
    font-weight: 600;
}

/* ── خيارات صح/خطأ ── */
.qmodal-truefalse {
    flex-direction: row !important;
    gap: 16px !important;
    margin: 8px 20px 0 !important;
}

.qmodal-tf-btn {
    flex: 1;
    padding: 18px 12px !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    border-radius: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    border: 2px solid !important;
    margin-bottom: 0 !important;
}

.qmodal-tf-true {
    border-color: #66bb6a !important;
    color: #2e7d32 !important;
    background: rgba(102,187,106,0.08) !important;
}

.qmodal-tf-true:hover, .qmodal-tf-true.selected {
    background: #66bb6a !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(102,187,106,0.4) !important;
    transform: translateY(-3px) !important;
}

.qmodal-tf-false {
    border-color: #ef5350 !important;
    color: #c62828 !important;
    background: rgba(239,83,80,0.08) !important;
}

.qmodal-tf-false:hover, .qmodal-tf-false.selected {
    background: #ef5350 !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(239,83,80,0.4) !important;
    transform: translateY(-3px) !important;
}

/* ── خيارات الاختيار المتعدد ── */
.qmodal-choices {
    flex-direction: column !important;
    gap: 10px !important;
    margin: 8px 20px 0 !important;
}

.qmodal-choices .option {
    border-radius: 12px !important;
    font-size: 18px !important;
    padding: 14px 16px !important;
    margin-bottom: 0 !important;
    border: 2px solid #e8eaf6 !important;
    background: white !important;
    text-align: right !important;
    transition: all 0.15s ease !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.qmodal-choices .option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(63,81,181,0.1);
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.qmodal-choices .option-text {
    flex: 1;
}

.qmodal-choices .option.selected .option-label {
    background: rgba(255,255,255,0.25);
    color: white;
}

.qmodal-choices .option:hover {
    border-color: var(--primary-color) !important;
    background: rgba(63,81,181,0.05) !important;
    transform: translateX(-4px) !important;
    box-shadow: 0 4px 12px rgba(63,81,181,0.12) !important;
}

.qmodal-choices .option.selected {
    border-color: var(--primary-color) !important;
    background: var(--primary-color) !important;
    color: white !important;
    box-shadow: 0 6px 18px rgba(63,81,181,0.35) !important;
    transform: none !important;
}

/* ── حقل الإجابة المباشرة ── */
.qmodal-direct {
    margin: 8px 20px 0 !important;
}

.qmodal-answer-input {
    border-radius: 14px !important;
    font-size: 20px !important;
    padding: 16px 20px !important;
    border: 2px solid #e8eaf6 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
    margin-bottom: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.qmodal-answer-input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(63,81,181,0.12) !important;
}

/* ── قسم تقييم المقدم ── */
.qmodal-moderator {
    margin: 8px 20px 0 !important;
}

.qmodal-moderator-inner {
    background: white;
    border: 1px solid #e8eaf6;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.qmodal-moderator-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: center;
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1px dashed #c5cae9;
}

.qmodal-show-answer-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.qmodal-show-answer-btn {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2) !important;
    box-shadow: 0 4px 14px rgba(156,39,176,0.3) !important;
    font-weight: 700 !important;
    min-width: 200px;
    border-radius: 12px !important;
}

.qmodal-correct-answer-reveal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border: 2px solid #a5d6a7;
    border-radius: 12px;
    color: #2e7d32;
    font-weight: 700;
    font-size: 16px;
    animation: fadeIn 0.3s ease;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
}

.qmodal-correct-answer-value {
    font-size: 18px;
    font-weight: 800;
}

.qmodal-judge-row {
    display: flex;
    gap: 12px;
}

.qmodal-judge-btn {
    flex: 1;
    padding: 14px 8px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    border: 2px solid !important;
    margin-bottom: 0 !important;
}

.qmodal-judge-correct {
    border-color: #66bb6a !important;
    color: #2e7d32 !important;
    background: rgba(102,187,106,0.08) !important;
}

.qmodal-judge-correct:hover, .qmodal-judge-correct.selected {
    background: #66bb6a !important;
    color: white !important;
    box-shadow: 0 6px 18px rgba(102,187,106,0.4) !important;
    transform: translateY(-2px) !important;
}

.qmodal-judge-wrong {
    border-color: #ef5350 !important;
    color: #c62828 !important;
    background: rgba(239,83,80,0.08) !important;
}

.qmodal-judge-wrong:hover, .qmodal-judge-wrong.selected {
    background: #ef5350 !important;
    color: white !important;
    box-shadow: 0 6px 18px rgba(239,83,80,0.4) !important;
    transform: translateY(-2px) !important;
}

/* ── زر التقديم ── */
.qmodal-submit-row {
    margin: 16px 20px 20px !important;
    padding: 0 !important;
}

.qmodal-submit-btn {
    flex: 1;
    width: 100% !important;
    justify-content: center !important;
    padding: 16px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-dark)) !important;
    box-shadow: 0 6px 20px rgba(255,64,129,0.4) !important;
    letter-spacing: 0.5px;
}

.qmodal-submit-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(255,64,129,0.5) !important;
}

/* ── نتيجة الإجابة (result overlay) ── */
.qmodal-result-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.qmodal-result-card {
    background: white;
    border-radius: 24px;
    padding: 36px 32px 28px;
    max-width: 400px;
    width: 88%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: resultCardPop 0.35s cubic-bezier(0.175,0.885,0.32,1.275) both;
}

@keyframes resultCardPop {
    from { transform: scale(0.65); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.qmodal-result-icon-wrap {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: white;
}

.qmodal-result-overlay.correct-result .qmodal-result-icon-wrap {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    box-shadow: 0 10px 28px rgba(102,187,106,0.5);
}

.qmodal-result-overlay.wrong-result .qmodal-result-icon-wrap {
    background: linear-gradient(135deg, #ef5350, #e53935);
    box-shadow: 0 10px 28px rgba(239,83,80,0.5);
}

.qmodal-result-title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.qmodal-result-overlay.correct-result .qmodal-result-title { color: #2e7d32; }
.qmodal-result-overlay.wrong-result  .qmodal-result-title { color: #c62828; }

.qmodal-result-answer-box {
    background: #f3f4ff;
    border: 2px solid #e8eaf6;
    border-radius: 14px;
    padding: 14px 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-sizing: border-box;
}

.qmodal-result-answer-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
}

.qmodal-result-answer-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-dark);
}

.qmodal-result-close-btn {
    margin-top: 4px;
    padding: 13px 44px;
    border: none;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.22s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    letter-spacing: 0.3px;
}

.qmodal-result-overlay.correct-result .qmodal-result-close-btn {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    box-shadow: 0 6px 18px rgba(102,187,106,0.4);
}

.qmodal-result-overlay.wrong-result .qmodal-result-close-btn {
    background: linear-gradient(135deg, #ef5350, #e53935);
    box-shadow: 0 6px 18px rgba(239,83,80,0.4);
}

.qmodal-result-close-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Settings Panel */
.settings-panel {
    display: none;
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: var(--border-radius);
    margin-top: 24px;
    box-shadow: var(--card-shadow);
    animation: fadeIn 0.4s ease;
}

.settings-group {
    margin-bottom: 24px;
    padding: 16px;
    background-color: rgba(197, 202, 233, 0.1);
    border-radius: 12px;
    border: 1px solid var(--primary-light);
}

.settings-title {
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary-dark);
    font-size: 18px;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.color-picker label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.color-picker input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
}

/* Admin Panel */
.admin-panel {
    display: none;
    margin-top: 24px;
    animation: fadeIn 0.4s ease;
}

.admin-section {
    margin-bottom: 12px;
    padding: 14px 16px;
    background: #fafbff;
    border-radius: 10px;
    border: 1px solid #e8eaf6;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px dashed #c5cae9;
    padding-bottom: 8px;
    margin-bottom: 2px;
}

/* أزرار حجم الشبكة */
.grid-size-options {
    display: flex;
    gap: 0;
    background: #e8eaf6;
    border-radius: 10px;
    padding: 4px;
}

.grid-size-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-light);
    font-size: 15px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

.grid-size-btn:hover {
    background: rgba(255,255,255,0.7);
    color: var(--primary-dark);
}

.grid-size-btn.active,
.grid-size-btn[class*="active"] {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(63,81,181,0.18);
}

/* شبكة الإعدادات */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.setting-card {
    background: white;
    border: 1px solid #e8eaf6;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: var(--transition);
}

.setting-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.setting-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 5px;
}

.setting-input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--grid-border);
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    font-family: 'Tajawal', sans-serif;
    color: var(--primary-color);
    transition: var(--transition);
    box-sizing: border-box;
}

.setting-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(63,81,181,0.1);
}

/* قسم التصدير/الاستيراد */
.export-desc {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
    line-height: 1.6;
}

.btn-export {
    background: linear-gradient(135deg, #26a69a, #00897b);
    box-shadow: 0 4px 12px rgba(38,166,154,0.3);
    font-weight: 700;
    width: 100%;
    justify-content: center;
    border-radius: 10px;
}

.btn-export:hover {
    box-shadow: 0 6px 16px rgba(38,166,154,0.4);
}

.import-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.import-file-input {
    flex: 1;
    padding: 8px 12px !important;
    border: 2px dashed var(--grid-border) !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    background: #f8f9ff;
    cursor: pointer;
    min-width: 0;
}

.import-file-input:focus {
    border-color: var(--primary-color) !important;
    outline: none;
}

.btn-import {
    background: linear-gradient(135deg, #5c6bc0, var(--primary-dark));
    box-shadow: 0 4px 12px rgba(92,107,192,0.3);
    font-weight: 700;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-import:hover {
    box-shadow: 0 6px 16px rgba(92,107,192,0.4);
}

/* زر حفظ وعودة للعبة */
.btn-save-admin {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    background: linear-gradient(135deg, #66bb6a, #43a047);
    box-shadow: 0 4px 14px rgba(102,187,106,0.35);
    letter-spacing: 0.5px;
    margin-top: 8px;
}

.btn-save-admin:hover {
    background: linear-gradient(135deg, #43a047, #66bb6a);
    box-shadow: 0 6px 18px rgba(102,187,106,0.45);
    transform: translateY(-2px);
}

.question-list {
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding: 0 8px;
}

.question-item {
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    border: 1px solid var(--grid-border);
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.question-item:hover {
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.question-item-elimination {
    border-right: 4px solid #ff5252;
    background-color: rgba(255, 82, 82, 0.07);
}

.question-item-special {
    border-right: 4px solid #ffca28;
    background-color: rgba(255, 202, 40, 0.1);
}

/* شريط البحث والفلتر */
.questions-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.questions-toolbar .questions-filter {
    margin-bottom: 0;
}

.questions-toolbar .question-search-wrapper {
    margin-bottom: 0;
    min-width: 160px;
    flex: 1;
}

/* مربع البحث */
.question-search-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.question-search-wrapper i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
    pointer-events: none;
}

.question-search-input {
    width: 100%;
    padding: 9px 36px 9px 12px;
    border: 2px solid var(--grid-border);
    border-radius: 20px;
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
    background-color: white;
    transition: var(--transition);
    box-sizing: border-box;
    color: var(--text-color);
}

.question-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.1);
}

.question-search-input::placeholder {
    color: var(--text-light);
}

.question-item-content {
    flex: 1;
    min-width: 0;
}

.question-item-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 8px;
}

.question-item-type {
    font-weight: bold;
    margin-right: 10px;
    color: #3f51b5;
}

/* badge لنوع السؤال */
.type-badge {
    display: inline-block;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin-left: 6px;
    white-space: nowrap;
}

.type-badge-truefalse {
    background-color: #26a69a;
}

.type-badge-multiplechoice {
    background-color: #5c6bc0;
}

.type-badge-directanswer {
    background-color: #8d6e63;
}

.type-badge-moderator {
    background-color: #ab47bc;
}

.question-item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.special-badge {
    display: inline-block;
    background-color: #ff9800;
    color: white;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    margin-right: 8px;
}

.elimination-badge {
    display: inline-block;
    background-color: #ff5252;
    color: white;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    margin-right: 8px;
}

.question-item-text {
    color: #555;
    font-size: 14px;
    max-height: 3em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.question-item-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    font-size: 13px;
}

.edit-btn {
    background-color: #2196f3;
}

.delete-btn {
    background-color: #f44336;
}

.action-btn:hover {
    transform: scale(1.1);
}

html[dir="ltr"] .question-item-elimination {
    border-right: none;
    border-left: 4px solid #ff5252;
}

html[dir="ltr"] .question-item-type {
    margin-right: 0;
    margin-left: 10px;
}

html[dir="ltr"] .special-badge,
html[dir="ltr"] .elimination-badge {
    margin-right: 0;
    margin-left: 8px;
}

.add-question-form {
    background-color: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* أقسام النموذج */
.form-section {
    border: 1px solid #e8eaf6;
    border-radius: 10px;
    padding: 14px 16px;
    background: #fafbff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-section-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px dashed #c5cae9;
    padding-bottom: 8px;
    margin-bottom: 2px;
}

.form-section-label i {
    color: var(--primary-color);
    font-size: 13px;
}

.optional-tag {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-light);
    background: #ede7f6;
    border-radius: 10px;
    padding: 1px 7px;
    margin-right: auto;
}

.form-inner-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

.mb-0 {
    margin-bottom: 0 !important;
}

/* صف أزرار صح/خطأ */
.truefalse-row {
    display: flex;
    gap: 12px;
}

.truefalse-row .truefalse-answer {
    flex: 1;
    text-align: center;
    padding: 12px;
    font-size: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
}

/* حالة غير محددة */
.truefalse-true {
    border: 2px solid #66bb6a !important;
    color: #2e7d32 !important;
    background-color: rgba(102, 187, 106, 0.07) !important;
}

.truefalse-false {
    border: 2px solid #ef5350 !important;
    color: #c62828 !important;
    background-color: rgba(239, 83, 80, 0.07) !important;
}

/* حالة محددة - تمييز قوي */
.truefalse-true.selected {
    background-color: #66bb6a !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(102, 187, 106, 0.5) !important;
    transform: translateY(-2px) !important;
    border-color: #43a047 !important;
    font-weight: 700 !important;
}

.truefalse-false.selected {
    background-color: #ef5350 !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(239, 83, 80, 0.5) !important;
    transform: translateY(-2px) !important;
    border-color: #e53935 !important;
    font-weight: 700 !important;
}

/* تعتيم الخيار غير المحدد عندما يوجد تحديد */
.truefalse-row:has(.selected) .truefalse-answer:not(.selected) {
    opacity: 0.4;
    transform: scale(0.97);
}

/* شارة ✓ على الزر المحدد */
.truefalse-row .truefalse-answer.selected::after {
    content: "✓";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    line-height: 18px;
    text-align: center;
}

.truefalse-true.selected::after {
    color: #43a047;
}

.truefalse-false.selected::after {
    color: #e53935;
}

/* اختيار نوع الوسائط */
.media-type-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.media-type-option {
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
}

.media-type-option input[type="radio"] {
    display: none;
}

.media-type-option span {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
}

.media-type-option input[type="radio"]:checked + span {
    border-color: var(--primary-color);
    background-color: rgba(63, 81, 181, 0.08);
    color: var(--primary-dark);
}

.media-type-option span i {
    font-size: 12px;
}

/* حذف الوسائط */
.remove-media-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #d32f2f;
    font-weight: 500;
    margin-top: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
    width: fit-content;
}

.remove-media-label:hover {
    background-color: rgba(211, 47, 47, 0.07);
}

.remove-media-label input[type="checkbox"] {
    width: auto !important;
    margin: 0 !important;
    cursor: pointer;
    accent-color: #d32f2f;
}

/* صف تصنيف السؤال (تعجيزي / طرد) */
.question-flags-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.flag-option {
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
    flex: 1;
}

.flag-option input[type="checkbox"] {
    display: none;
}

.flag-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
}

.flag-special input[type="checkbox"]:checked + span {
    border-color: #ffca28;
    background-color: rgba(255, 202, 40, 0.12);
    color: #795548;
}

.flag-elimination input[type="checkbox"]:checked + span {
    border-color: #ff5252;
    background-color: rgba(255, 82, 82, 0.10);
    color: #c62828;
}

.flag-option:hover span {
    border-color: var(--primary-light);
    background-color: rgba(63, 81, 181, 0.04);
}

/* زر إضافة السؤال */
.btn-add-question {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
    box-shadow: 0 4px 14px rgba(255, 64, 129, 0.35);
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.btn-add-question:hover {
    box-shadow: 0 6px 18px rgba(255, 64, 129, 0.45);
    transform: translateY(-2px);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--grid-border);
    border-radius: 8px;
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-left: 8px;
}

.tab-container {
    margin-bottom: 20px;
}

.tab-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    padding: 6px;
    background: rgba(63, 81, 181, 0.06);
    border-radius: 14px;
    border: none;
}

.tab-button {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid transparent;
    border-radius: 10px;
    background-color: transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
    color: var(--text-light);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.tab-button:hover {
    background-color: rgba(63, 81, 181, 0.08);
    color: var(--primary-dark);
}

.tab-button.active {
    background-color: white;
    color: var(--primary-color);
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(63, 81, 181, 0.15);
}

.tab-button i {
    font-size: 13px;
}

.tab-content {
    display: none;
    padding: 0;
    border: none;
    border-radius: 0;
    background-color: transparent;
    flex-direction: column;
    gap: 12px;
}

.tab-content.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        min-width: auto;
        padding: 16px;
        margin: 16px;
    }
    
    .header-title {
        font-size: 28px;
    }
    
    .grid-container {
        gap: 4px;
    }
    
    .cell {
        font-size: 16px;
        border-radius: 8px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-title {
        font-size: 24px;
    }
    
    .question-text {
        font-size: 20px;
    }
    
    .option {
        padding: 14px;
        font-size: 16px;
    }
    
    .timer {
        font-size: 40px;
    }
    /* تنسيقات محسنة لعرض نتيجة الإجابة */
    .answer-result {
        position: sticky;
        top: 10px;
        z-index: 100;
        margin: 0 auto 20px;
        width: 90%;
        max-width: 800px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        border-width: 3px;
        animation: pop-in 0.4s forwards;
        border-radius: 16px;
    }

    .result-text {
        font-size: 28px;
        font-weight: 700;
    }

    .result-text::before {
        font-family: 'Font Awesome 5 Free';
        font-size: 36px;
        font-weight: 900;
    }

    .result-text.correct {
        color: #2e7d32;
    }

    .result-text.correct::before {
        content: "\f058"; /* Font Awesome check-circle icon */
    }

    .result-text.wrong {
        color: #c62828;
    }

    .result-text.wrong::before {
        content: "\f057"; /* Font Awesome times-circle icon */
    }

    .correct-answer-text {
        font-size: 20px;
        font-weight: 500;
        background-color: rgba(255, 255, 255, 0.5);
        padding: 8px;
        border-radius: 8px;
    }

    /* تعديل خلفيات النتائج */
    .answer-result.correct-result {
        background: #e8f5e9;
        border-color: #66bb6a;
        color: #1b5e20;
    }

    .answer-result.wrong-result {
        background: #ffebee;
        border-color: #ef5350;
        color: #b71c1c;
    }

    /* تعديل أنماط moderatorContainer */
    #moderatorContainer .options-container {
        display: flex;
        gap: 20px;
        justify-content: center;
        margin-top: 20px;
    }

    #moderatorContainer .correct-btn {
        width: 180px;
        padding: 15px;
        font-size: 18px;
        text-align: center;
        transition: all 0.3s ease;
    }

    #moderatorContainer .correct-btn[data-value="true"] {
        border-color: #66bb6a;
    }

    #moderatorContainer .correct-btn[data-value="true"].selected {
        background-color: #66bb6a;
        color: white;
    }

    #moderatorContainer .correct-btn[data-value="false"] {
        border-color: #ef5350;
    }

    #moderatorContainer .correct-btn[data-value="false"].selected {
        background-color: #ef5350;
        color: white;
    }
    /* تأثير حركي لظهور النتيجة */
    @keyframes pop-in {
        0% {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.8);
        }
        100% {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }

    /* تنسيق زر الإغلاق */
    #closeQuestionBtn {
        margin-top: 20px;
        padding: 12px 30px;
        background: rgba(255, 255, 255, 0.3);
        border: none;
        border-radius: 50px;
        cursor: pointer;
        font-size: 18px;
        font-weight: bold;
        transition: all 0.3s ease;
    }

    /* تنسيق زر عرض الإجابة الصحيحة في قسم تقييم المقدم */
    #showCorrectAnswerBtn {
        background: linear-gradient(135deg, #9c27b0, #7b1fa2);
        transition: all 0.3s ease;
        min-width: 200px;
        position: relative;
        overflow: hidden;
    }

    #showCorrectAnswerBtn:hover {
        background: linear-gradient(135deg, #7b1fa2, #9c27b0);
        transform: translateY(-2px);
        box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
    }

    #showCorrectAnswerBtn:active {
        transform: translateY(1px);
    }

    /* تنسيق حاوية الإجابة الصحيحة */
    #moderatorCorrectAnswer {
        background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
        border: 2px solid #a5d6a7;
        animation: fadeIn 0.5s ease;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    /* تأثير ظهور الإجابة */
    @keyframes showAnswer {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    #moderatorCorrectAnswer[style*="block"] {
        animation: showAnswer 0.3s ease;
    }

    /* تحسين ظهور أزرار التقييم عند تحديدها */
    #moderatorContainer .correct-btn[data-value="true"]:hover {
        background-color: rgba(102, 187, 106, 0.3);
    }

    #moderatorContainer .correct-btn[data-value="false"]:hover {
        background-color: rgba(239, 83, 80, 0.3);
    }
    .form-group-special {
        background-color: rgba(255, 202, 40, 0.05);
        border-radius: 8px;
        padding: 10px;
        border: 1px solid rgba(255, 202, 40, 0.2);
    }

    .form-group-special:hover {
        background-color: rgba(255, 202, 40, 0.1);
    }

    .filter-buttons {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: 15px;
    }

    .filter-btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    .filter-btn.active {
        background-color: var(--primary-color);
        color: white;
    }

    /* شارات تمييز أنواع الأسئلة */
    .special-badge {
        display: inline-block;
        background-color: var(--special-cell);
        color: #5d4037;
        border-radius: 4px;
        padding: 2px 6px;
        font-size: 12px;
        margin-right: 8px;
        font-weight: bold;
    }
    /* *** أضف هذا الكود في نهاية الملف *** */
    /* أنماط لأزرار صح/خطأ */
    .truefalse-answer {
        padding: 10px 20px;
        background-color: rgba(255, 255, 255, 0.8);
        border: 2px solid #ddd;
        border-radius: 8px;
        cursor: pointer;
        font-size: 16px;
        font-weight: bold;
        transition: all 0.3s ease;
    }

    .truefalse-answer[data-value="true"] {
        color: #2e7d32;
        border-color: #2e7d32;
    }

    .truefalse-answer[data-value="false"] {
        color: #c62828;
        border-color: #c62828;
    }

    .truefalse-answer.selected[data-value="true"] {
        background-color: #66bb6a;
        color: white;
    }

    .truefalse-answer.selected[data-value="false"] {
        background-color: #ef5350;
        color: white;
    }
}

/* تصميم إشعار التراجع */
.undo-notification {
    position: fixed;
    top: 20px;
    right: 50%;
    transform: translateX(50%) translateY(-100px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 32px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.undo-notification.show {
    transform: translateX(50%) translateY(0);
    opacity: 1;
}

.undo-notification i {
    font-size: 24px;
    animation: checkPulse 0.6s ease;
}

@keyframes checkPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* تصميم نافذة التأكيد المخصصة */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.custom-confirm-overlay.show {
    opacity: 1;
}

.custom-confirm-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 500px;
    overflow: hidden;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.custom-confirm-overlay.show .custom-confirm-box {
    transform: scale(1);
}

.custom-confirm-header {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.custom-confirm-header i {
    font-size: 32px;
    animation: warningPulse 1.5s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.custom-confirm-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.custom-confirm-body {
    padding: 28px;
    color: #333;
}

.custom-confirm-body p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.custom-confirm-footer {
    padding: 20px 28px;
    background: #f8f9fa;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.custom-confirm-footer button {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
}

.custom-confirm-cancel {
    background: #e0e0e0;
    color: #555;
}

.custom-confirm-cancel:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.custom-confirm-ok {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.custom-confirm-ok:hover {
    background: linear-gradient(135deg, #ee5a6f, #ff6b6b);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
}

.custom-confirm-ok:active,
.custom-confirm-cancel:active {
    transform: translateY(0);
}
/* تنسيقات خاصية إضافة الوسائط (صورة أو فيديو يوتيوب) */
.form-group input[name="mediaType"] {
    width: auto;
    margin-left: 8px;
    margin-right: 8px;
    cursor: pointer;
}

.form-group label:has(input[name="mediaType"]) {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
    padding: 6px 12px;
    border-radius: 6px;
    transition: var(--transition);
}

.form-group label:has(input[name="mediaType"]):hover {
    background-color: rgba(63, 81, 181, 0.05);
}

.form-group input[type="file"]#questionImage,
.form-group input[type="text"]#questionImageURL {
    margin-top: 8px;
    transition: var(--transition);
}

.form-group input[type="text"]#questionImageURL {
    font-size: 14px;
    color: var(--text-color);
}

.form-group input[type="text"]#questionImageURL::placeholder {
    color: var(--text-light);
    font-size: 14px;
}

/* إحصائيات الأسئلة */
.questions-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px;
    background-color: rgba(63, 81, 181, 0.03);
    border-radius: 6px;
}

.stat-item {
    text-align: center;
    padding: 8px;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    border-right: 3px solid #3f51b5;
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-item.stat-total {
    border-right-color: #3f51b5;
}

.stat-item.stat-special {
    border-right-color: #ffca28;
}

.stat-item.stat-elimination {
    border-right-color: #ff5252;
}

.stat-item.stat-normal {
    border-right-color: #66bb6a;
}

.stat-label {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-color);
}

/* فلتر الأسئلة */
.questions-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background-color: white;
    color: var(--text-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(63, 81, 181, 0.05);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn:active {
    transform: scale(0.95);
}