:root {
    --primary: #4834d4;
    --accent: #686de0;
    --success: #2ecc71;
    --error: #e74c3c;
    --bg: #f0f2f5;
    --text: #2d3436;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--bg);
    margin: 0; padding: 0; transition: background 0.3s ease;
    overflow-x: hidden; touch-action: manipulation; direction: rtl;
}

/* تفاعل الألوان */
body.correct-flash { background-color: #d1f2eb !important; }
body.error-flash { background-color: #fadbd8 !important; }

.container { max-width: 550px; margin: 0 auto; min-height: 100vh; padding: 20px; box-sizing: border-box; }

/* الهيدر */
.top-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; animation: fadeIn 0.3s; }
.back-circle-btn { width: 40px; height: 40px; border-radius: 50%; border: none; background: #fff; color: var(--primary); box-shadow: 0 4px 10px rgba(0,0,0,0.1); cursor: pointer; }
.score-badge { background: var(--primary); color: #fff; padding: 5px 15px; border-radius: 20px; font-weight: bold; }

/* واجهة الإضافة المحسنة */
.glass-card { background: #ffffff; border-radius: 24px; padding: 25px; box-shadow: 0 15px 35px rgba(0,0,0,0.05); animation: slideUp 0.4s ease; }
.input-header { text-align: center; margin-bottom: 20px; }
.icon-box { width: 50px; height: 50px; background: var(--bg); color: var(--primary); display: flex; align-items: center; justify-content: center; border-radius: 15px; margin: 0 auto 10px; font-size: 1.2rem; }
.input-group { margin-bottom: 18px; }
.input-group label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; color: var(--primary); font-size: 0.9rem; }
input, textarea { width: 100%; padding: 14px; border: 2px solid #f0f0f0; border-radius: 12px; font-size: 1rem; background: #fafafa; transition: 0.3s; box-sizing: border-box; font-family: inherit; }
input:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 5px 15px rgba(72,52,212,0.1); }
.input-tip { font-size: 0.75rem; color: #aaa; margin-top: 5px; }

/* المكتبة */
.questions-grid { display: grid; gap: 12px; }
.question-item { 
    background: #fff; padding: 18px; border-radius: 15px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.03); cursor: pointer;
    border-right: 5px solid var(--primary); user-select: none;
}

/* واجهة التمرين */
.interactive-text { background: #fff; padding: 20px; border-radius: 20px; line-height: 2.6; font-size: 1.15rem; text-align: justify; box-shadow: 0 5px 20px rgba(0,0,0,0.05); }
.word-gap { display: inline-block; min-width: 50px; border-bottom: 2px solid #ddd; margin: 0 4px; color: transparent; }
.word-gap.active-gap { border-bottom: 3px solid var(--primary); background: #f0efff; }
.word-gap.filled { color: var(--primary); border-bottom-color: var(--success); font-weight: bold; }

.floating-words { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 25px; }
.word-card { padding: 10px 18px; background: #fff; border: 2px solid var(--primary); border-radius: 10px; cursor: pointer; font-weight: bold; transition: 0.2s; }

.primary-btn { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 12px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fab-btn { position: fixed; bottom: 25px; left: 25px; width: 60px; height: 60px; border-radius: 50%; background: var(--primary); color: #fff; border: none; font-size: 1.4rem; box-shadow: 0 5px 15px rgba(72,52,212,0.4); }

.difficulty-picker { background: #fff; padding: 10px 15px; border-radius: 12px; margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; }
#difficulty-level { border: none; color: var(--primary); font-weight: bold; outline: none; background: none; cursor: pointer; }

@keyframes slideUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }
