:root {
    --primary: #4834d4;
    --bg-sky: #e3f2fd; 
    --white: #ffffff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }

html, body { 
    overscroll-behavior-y: contain; /* منع التحديث عند السحب */
    background-color: var(--bg-sky); 
    margin: 0; direction: rtl; font-family: 'Segoe UI', Tahoma, sans-serif;
}

.container { max-width: 500px; margin: 0 auto; padding: 15px; min-height: 100vh; }

.top-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.nav-title { font-size: 1.2rem; font-weight: 800; color: var(--primary); flex: 1; text-align: center; }

/* بطاقات المواد */
.subject-card {
    padding: 20px; border-radius: 18px; margin-bottom: 12px; 
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1); color: white; cursor: pointer;
}
.sub-edit-btn { background: rgba(255,255,255,0.25); padding: 8px; border-radius: 10px; }

/* شبكة الأسئلة 4x4 */
.questions-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.q-box {
    aspect-ratio: 1/1; background: var(--white); border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 800; position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05); border-bottom: 4px solid #dfe6e9;
}

/* تنسيق الخيارات داخل إضافة سؤال */
.option-group { background: white; padding: 10px; border-radius: 15px; margin-bottom: 10px; border: 1px solid #d1e9ff; }
.option-label { display: block; font-size: 0.8rem; font-weight: bold; color: #555; margin-bottom: 5px; }
.chips { display: flex; gap: 5px; }
.chip-item { flex: 1; text-align: center; padding: 10px 2px; background: #f0f7ff; border-radius: 10px; font-size: 0.8rem; cursor: pointer; border: 1px solid #bee3f8; }
input[type="radio"]:checked + .chip-item { background: var(--primary); color: white; border-color: var(--primary); }

.quiz-container { background: var(--white); padding: 20px; border-radius: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.quiz-text { line-height: 2.2; font-size: 1.1rem; white-space: pre-wrap; color: #000; }
.gap { display: inline-flex; align-items: center; justify-content: center; min-width: 50px; height: 1.4em; background: #f0f0f0; border-bottom: 2px solid #bbb; margin: 0 3px; vertical-align: middle; border-radius: 4px; }
.gap.correct { color: #000 !important; background: transparent; border-bottom-color: #2ecc71; font-weight: bold; }

input, textarea { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid #ddd; margin-bottom: 10px; }
.main-btn { background: var(--primary); color: white; border: none; padding: 15px; border-radius: 15px; width: 100%; font-weight: bold; cursor: pointer; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal-content { background: var(--bg-sky); padding: 20px; border-radius: 20px; width: 85%; }
.fab { position: fixed; bottom: 20px; left: 20px; width: 55px; height: 55px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; border: none; z-index: 100; }
.hidden { display: none !important; }
