:root {
    --primary: #4834d4;
    --accent: #686de0;
    --bg: #f4f7fa;
    --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', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    margin: 0;
    direction: rtl;
    color: var(--text);
}

.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: 25px; height: 50px; }
.nav-title { font-size: 1.3rem; font-weight: 800; color: var(--primary); flex: 1; text-align: center; }
.back-btn { 
    width: 40px; height: 40px; border-radius: 12px; border: none; 
    background: var(--white); box-shadow: 0 4px 10px 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: 22px; border-radius: 20px;
    margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 8px 15px rgba(0,0,0,0.03); border-right: 6px solid;
    transition: 0.2s; position: relative; cursor: pointer;
}
.subject-card:active { transform: scale(0.97); }

/* مربعات الأسئلة الرقمية */
.questions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.q-box {
    aspect-ratio: 1/1; background: var(--white); border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 800; position: relative;
    box-shadow: 0 6px 12px rgba(0,0,0,0.04); border-bottom: 4px solid #dfe6e9;
}
.q-edit-btn {
    position: absolute; top: 8px; left: 8px; font-size: 0.75rem;
    background: #f1f2f6; color: var(--primary); padding: 6px; 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: 18px; }
.choice-label { display: block; margin-bottom: 6px; font-weight: bold; font-size: 0.85rem; color: #636e72; }
.chips-flex { display: flex; gap: 6px; }
.chip {
    flex: 1; text-align: center; padding: 12px 2px; background: var(--white);
    border: 2px solid #eee; border-radius: 12px; cursor: pointer; font-weight: bold;
    transition: 0.2s; font-size: 0.8rem;
}
input[type="radio"] { display: none; }
input[type="radio"]:checked + .chip {
    background: var(--primary); color: var(--white); border-color: var(--primary);
}

/* منطقة التمرين */
.quiz-container { background: var(--white); padding: 25px; border-radius: 25px; box-shadow: 0 8px 25px rgba(0,0,0,0.04); }
.quiz-text { line-height: 2.8; font-size: 1.25rem; white-space: pre-wrap; }
.gap {
    display: inline-block; min-width: 60px; height: 28px; background: #f1f2f6;
    border-bottom: 2px solid #ccc; margin: 0 4px; vertical-align: middle; border-radius: 5px;
}
.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: 14px; border-radius: 15px; border: 2px solid #eee;
    font-family: inherit; font-size: 1rem; user-select: text !important; -webkit-user-select: text !important;
}

.main-btn {
    background: var(--primary); color: var(--white); border: none; padding: 16px;
    border-radius: 18px; width: 100%; font-weight: bold; font-size: 1rem;
    margin-top: 15px; cursor: pointer;
}

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

.hidden { display: none !important; }
