:root {
    --primary: #4834d4;
    --accent: #686de0;
    --bg: #f0f2f7;
    --white: #ffffff;
    --text: #2d3436;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none; /* منع تحديد النصوص المزعج */
    -webkit-user-select: none;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    margin: 0;
    direction: rtl;
    color: var(--text);
    overflow-x: hidden;
}

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

/* الهيدر */
.top-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.nav-title { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.back-btn { 
    width: 45px; height: 45px; border-radius: 15px; border: none; 
    background: var(--white); box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    color: var(--primary); cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* بطاقات المواد */
.subject-card {
    background: var(--white); padding: 20px; border-radius: 25px;
    margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.03); border-right: 8px solid;
    transition: transform 0.2s; position: relative;
}
.subject-card:active { transform: scale(0.98); }
.subject-info { font-size: 1.2rem; font-weight: bold; }

/* مربعات الأسئلة الرقمية */
.questions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.q-box {
    aspect-ratio: 1/1; background: var(--white); border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 800; position: relative;
    box-shadow: 0 8px 15px rgba(0,0,0,0.04); border-bottom: 5px solid #dfe6e9;
}
.q-edit-btn {
    position: absolute; top: 8px; left: 8px; font-size: 0.8rem;
    background: #f1f2f6; color: var(--primary); padding: 5px; border-radius: 8px;
}

/* ألوان الحالة */
.status-green { border-color: #2ecc71 !important; }
.status-yellow { border-color: #f1c40f !important; }
.status-red { border-color: #e74c3c !important; }

/* خيارات الاختيار (Chips) */
.choice-group { margin-bottom: 20px; }
.choice-label { display: block; margin-bottom: 8px; font-weight: bold; font-size: 0.9rem; color: #636e72; }
.chips-flex { display: flex; gap: 8px; }
.chip {
    flex: 1; text-align: center; padding: 12px 5px; background: var(--white);
    border: 2px solid #eee; border-radius: 15px; cursor: pointer; font-weight: bold;
    transition: 0.3s; font-size: 0.85rem;
}
input[type="radio"] { display: none; }
input[type="radio"]:checked + .chip {
    background: var(--primary); color: var(--white); border-color: var(--primary);
    box-shadow: 0 5px 12px rgba(72, 52, 212, 0.3); transform: translateY(-2px);
}

/* منطقة التمرين */
.quiz-container { background: var(--white); padding: 25px; border-radius: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.quiz-text { 
    line-height: 2.8; font-size: 1.3rem; white-space: pre-wrap; /* للحفاظ على الأسطر */
}
.gap {
    display: inline-block; min-width: 60px; height: 30px; background: #f1f2f6;
    border-bottom: 3px solid #ccc; margin: 0 5px; vertical-align: middle; border-radius: 6px;
}
.gap.correct { background: transparent; border-bottom-color: #2ecc71; color: var(--primary); font-weight: bold; text-align: center; }

/* أزرار الإدخال */
input[type="text"], input[type="number"], textarea {
    width: 100%; padding: 15px; border-radius: 18px; border: 2px solid #eee;
    font-family: inherit; font-size: 1rem; user-select: text !important;
}
.main-btn {
    background: var(--primary); color: var(--white); border: none; padding: 18px;
    border-radius: 20px; width: 100%; font-weight: bold; font-size: 1.1rem;
    margin-top: 20px; box-shadow: 0 8px 20px rgba(72, 52, 212, 0.2); cursor: pointer;
}

.fab {
    position: fixed; bottom: 30px; left: 30px; width: 65px; height: 65px;
    background: var(--primary); color: var(--white); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
    box-shadow: 0 10px 25px rgba(72, 52, 212, 0.3); border: none; cursor: pointer; z-index: 100;
}

.hidden { display: none !important; }
