/* ── GENERAL ─────────────────────────────────────────────────────── */
.ml-wrap { font-family: 'Segoe UI', Arial, sans-serif; direction: rtl; max-width: 900px; margin: 0 auto; padding: 20px; }

/* ── HEADER ──────────────────────────────────────────────────────── */
.ml-header { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg,#4f46e5,#7c3aed); color: #fff; padding: 20px 28px; border-radius: 14px; margin-bottom: 28px; }
.ml-header h2 { margin: 0; font-size: 1.4rem; }
.ml-total-pts { background: rgba(255,255,255,0.2); padding: 8px 18px; border-radius: 30px; font-size: 1.1rem; font-weight: 700; }
.ml-total-pts-big { text-align: center; font-size: 1.5rem; font-weight: 700; color: #4f46e5; margin-bottom: 24px; }

/* ── CHAPTERS GRID ───────────────────────────────────────────────── */
.ml-chapters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 18px; }
.ml-chapter-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: box-shadow .2s; }
.ml-chapter-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.1); }
.ml-chapter-card.ml-locked { opacity: .55; pointer-events: none; }
.ml-chapter-title { font-size: 1.15rem; font-weight: 700; color: #1e1b4b; margin-bottom: 14px; }

/* ── LEVELS ──────────────────────────────────────────────────────── */
.ml-levels { display: flex; flex-direction: column; gap: 10px; }
.ml-level { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: #f9fafb; }
.ml-level.ml-passed   { background: #f0fdf4; }
.ml-level.ml-available{ background: #eff6ff; }
.ml-level.ml-locked-level { opacity: .5; }
.ml-level-name { flex: 1; font-weight: 600; color: #374151; }
.ml-score { font-size: .85rem; color: #6b7280; }
.ml-lock-icon { color: #9ca3af; }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.ml-btn { display: inline-block; padding: 7px 18px; border-radius: 8px; font-weight: 600; font-size: .9rem; text-decoration: none; border: none; cursor: pointer; transition: opacity .15s; }
.ml-btn:hover { opacity: .88; }
.ml-btn-primary { background: #4f46e5; color: #fff; }
.ml-btn-success { background: #16a34a; color: #fff; }
.ml-btn-outline { background: transparent; color: #4f46e5; border: 2px solid #4f46e5; }

.ml-progress-link { text-align: center; margin-top: 28px; }

/* ── QUIZ ────────────────────────────────────────────────────────── */
.ml-quiz-wrap { max-width: 680px; }
.ml-quiz-header { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 22px; margin-bottom: 22px; }
.ml-quiz-header h2 { margin: 0 0 10px; color: #1e1b4b; }
.ml-quiz-meta { display: flex; gap: 20px; font-size: .9rem; color: #6b7280; margin-bottom: 10px; }
.ml-progress-bar-wrap { background: #e5e7eb; border-radius: 99px; height: 8px; }
.ml-progress-bar { background: linear-gradient(90deg,#4f46e5,#7c3aed); height: 8px; border-radius: 99px; transition: width .4s ease; }

.ml-question { display: none; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 28px; }
.ml-question.ml-q-active { display: block; }
.ml-q-text { font-size: 1.3rem; font-weight: 600; color: #1e1b4b; margin: 0 0 20px; }
.ml-answer-area { display: flex; gap: 12px; align-items: center; }
.ml-answer-input { flex: 1; padding: 10px 16px; border: 2px solid #d1d5db; border-radius: 8px; font-size: 1.1rem; direction: ltr; text-align: center; outline: none; transition: border-color .2s; }
.ml-answer-input:focus { border-color: #4f46e5; }
.ml-check-btn { padding: 10px 22px; }
.ml-feedback { margin-top: 14px; font-size: 1rem; font-weight: 600; }
.ml-ok   { color: #16a34a; }
.ml-wrong{ color: #dc2626; }

/* ── RESULTS ─────────────────────────────────────────────────────── */
.ml-results-box { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 36px; text-align: center; }
.ml-results-box h3 { font-size: 1.6rem; color: #1e1b4b; margin-bottom: 14px; }
.ml-result-score { font-size: 1.1rem; color: #374151; margin-bottom: 10px; }
.ml-result-pts   { font-size: 1.1rem; color: #4f46e5; font-weight: 700; margin-bottom: 24px; }
.ml-result-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ── PROGRESS PAGE ───────────────────────────────────────────────── */
.ml-chapter-progress { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 22px; margin-bottom: 22px; }
.ml-chapter-progress h3 { color: #1e1b4b; margin-top: 0; }
.ml-level-progress { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #f3f4f6; }
.ml-level-progress h4 { color: #374151; margin-bottom: 10px; }
.ml-attempts-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .9rem; }
.ml-attempts-table th, .ml-attempts-table td { padding: 7px 12px; border: 1px solid #e5e7eb; text-align: right; }
.ml-attempts-table th { background: #f9fafb; font-weight: 600; }
.ml-green { color: #16a34a; font-weight: 700; }
.ml-red   { color: #dc2626; font-weight: 700; }

/* ── ERROR BOX ───────────────────────────────────────────────────── */
.ml-box { padding: 14px 20px; border-radius: 10px; margin: 16px 0; }
.ml-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media(max-width:600px){
    .ml-header { flex-direction: column; gap: 10px; text-align: center; }
    .ml-chapters-grid { grid-template-columns: 1fr; }
    .ml-answer-area { flex-direction: column; }
    .ml-answer-input { width: 100%; }
}
