/* =====================================================================
   RCM English Academy - stylesheet (RTL first, light + dark)
   ===================================================================== */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #1c2033;
  --muted: #646b84;
  --border: #e3e6ef;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-soft: #eef0ff;
  --success: #12a150;
  --success-soft: #e7f8ee;
  --danger: #dc3545;
  --danger-soft: #fdecee;
  --warn: #b7791f;
  --warn-soft: #fff6e5;
  --info-soft: #e8f3ff;
  --gold: #f5b301;
  --wa: #25d366;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 50, .06), 0 8px 24px rgba(20, 24, 50, .06);
  --shadow-lg: 0 12px 40px rgba(79, 70, 229, .18);
  --font-ar: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1222;
    --surface: #171b30;
    --surface-2: #1f2440;
    --text: #e8eaf6;
    --muted: #9aa1bf;
    --border: #2a3052;
    --primary: #818cf8;
    --primary-2: #a78bfa;
    --primary-soft: #23284a;
    --success: #34d17a;
    --success-soft: #133325;
    --danger: #f2687a;
    --danger-soft: #3a1d26;
    --warn: #f0b85a;
    --warn-soft: #3a2f17;
    --info-soft: #1a2a45;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.75rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.en { font-family: var(--font-en); unicode-bidi: isolate; }
.muted { color: var(--muted); }
.center { text-align: center; }
.noscript { padding: 2rem; text-align: center; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.section { padding-top: 28px; padding-bottom: 48px; }
.narrow { max-width: 720px; }

.shell { display: flex; flex-direction: column; min-height: 100vh; }
.page { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .65em 1.3em; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  background: var(--surface-2); color: var(--text);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: var(--shadow-lg); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-light { background: #fff; color: #3b2fd0; }
.btn-small { padding: .35em .95em; font-size: .9rem; }
.btn-large { padding: .8em 1.7em; font-size: 1.05rem; }
.btn-block { width: 100%; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }

.chip { display: inline-flex; align-items: center; gap: .3em; padding: .2em .75em; border-radius: 999px; background: var(--surface-2); font-size: .88rem; font-weight: 600; }
.chip-xp { background: #fff4cc; color: #8a6400; }
.chip-streak { background: #ffe6dc; color: #b23c00; }
@media (prefers-color-scheme: dark) { .chip-xp { background: #3b3214; color: #ffd76a; } .chip-streak { background: #3e2216; color: #ffad85; } }
.badge { display: inline-block; padding: .2em .8em; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .85rem; }
.badge-gold { background: #fff4cc; color: #8a6400; font-size: 1rem; padding: .4em 1em; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius-sm); margin: 14px 0; font-weight: 600; }
.alert ul { margin: 0; padding-inline-start: 1.2em; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Spinner & progress ---------- */
.spinner-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 80px 16px; color: var(--muted); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary-2), var(--primary)); transition: width .4s ease; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font: 800 1.3rem var(--font-en); box-shadow: var(--shadow-lg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav-link { padding: .4em .9em; border-radius: 999px; color: var(--text); font-weight: 600; text-decoration: none !important; }
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.menu-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 10px; width: 42px; height: 42px; font-size: 1.2rem; cursor: pointer; }

@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; inset-inline: 12px; top: 70px; flex-direction: column; align-items: stretch; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav .chip { justify-content: center; }
}

/* ---------- Footer ---------- */
.site-footer { margin-top: 40px; background: #12142a; color: #c9cce0; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; padding-top: 32px; padding-bottom: 24px; }
.footer-about { max-width: 520px; }
.footer-about strong { color: #fff; font-size: 1.1rem; }
.footer-about p { margin-top: 6px; color: #a5a9c4; }
.footer-wa { display: inline-flex; align-items: center; gap: 8px; padding: .5em 1.1em; border-radius: 999px; background: rgba(37, 211, 102, .12); color: #5ee08f; font-weight: 700; text-decoration: none !important; }
.footer-wa:hover { background: rgba(37, 211, 102, .2); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); padding: 16px 0; text-align: center; }
.footer-bottom p { margin: 0; }
.credit { color: #e9eaf5; font-weight: 600; }
.credit strong { color: #fff; letter-spacing: .5px; }
.heart { color: #ff4d6d; display: inline-block; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } }
.copyright { font-size: .85rem; color: #8b8fab; }

/* ---------- WhatsApp floating button ---------- */
.wa-float {
  position: fixed; bottom: 22px; left: 22px; z-index: 60;
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%;
  background: var(--wa); box-shadow: 0 8px 24px rgba(37, 211, 102, .45);
  transition: transform .2s ease, box-shadow .2s ease;
  text-decoration: none !important;
}
.wa-float::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--wa); opacity: .5; animation: ping 2.2s cubic-bezier(0, 0, .2, 1) infinite; z-index: -1; }
.wa-float img { width: 36px; height: 36px; }
.wa-float:hover { transform: scale(1.08); box-shadow: 0 12px 30px rgba(37, 211, 102, .55); }
.wa-tip { position: absolute; left: 70px; white-space: nowrap; background: #12142a; color: #fff; padding: .3em .8em; border-radius: 8px; font-size: .85rem; font-weight: 700; opacity: 0; transform: translateX(-6px); transition: .2s; pointer-events: none; }
.wa-float:hover .wa-tip, .wa-float:focus-visible .wa-tip { opacity: 1; transform: none; }
@keyframes ping { 75%, 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .wa-float::before, .heart { animation: none; } * { scroll-behavior: auto !important; } }

/* ---------- Home ---------- */
.hero { padding: 56px 0 40px; background: radial-gradient(1200px 400px at 80% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent), radial-gradient(800px 300px at 0% 0%, color-mix(in srgb, var(--primary-2) 14%, transparent), transparent); }
.hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: .4em 0; }
.grad { background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 24px; box-shadow: var(--shadow-lg); transform: rotate(-1.5deg); }
.demo-q small { color: var(--primary); font-weight: 700; }
.demo-en { font-size: 1.6rem; font-weight: 700; margin: .2em 0; }
.demo-opts { display: flex; gap: 10px; margin-top: 12px; }
.opt { flex: 1; text-align: center; padding: .6em; border-radius: 12px; border: 1.5px solid var(--border); text-decoration: line-through; color: var(--muted); }
.opt-ok { border-color: var(--success); background: var(--success-soft); color: var(--success); text-decoration: none; font-weight: 700; }
.section-title { text-align: center; margin-top: 56px; }
.section-title.start { text-align: start; margin-top: 36px; }
.section-sub { text-align: center; color: var(--muted); margin-top: -8px; margin-bottom: 24px; }
.feature { transition: transform .2s ease; }
.feature:hover { transform: translateY(-4px); }
.feature-icon { font-size: 2rem; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-soft); margin-bottom: 10px; }
.levels-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.level-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.level-head h3 { margin: 0; }
.level-code { display: inline-grid; place-items: center; min-width: 52px; height: 52px; padding: 0 8px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font: 800 1.1rem var(--font-en); flex-shrink: 0; }
.level-code.small { min-width: 40px; height: 30px; border-radius: 8px; font-size: .9rem; }
.level-lessons { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.level-lessons li { padding: .15em .7em; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .85rem; }
.cta { margin-top: 56px; }
.cta-box { text-align: center; padding: 44px 20px; border-radius: 28px; color: #fff; background: linear-gradient(135deg, #4338ca, #7c3aed); box-shadow: var(--shadow-lg); }
.cta-box p { opacity: .9; }
@media (max-width: 860px) { .hero-inner { grid-template-columns: 1fr; } .hero-card { transform: none; } }

/* ---------- Auth ---------- */
.auth-wrap { display: flex; justify-content: center; padding-top: 40px; padding-bottom: 40px; }
.auth-card { width: 100%; max-width: 440px; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; }
.field input, .text-answer {
  width: 100%; padding: .75em 1em; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .text-answer:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.hint { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.auth-switch { text-align: center; margin-top: 16px; }

/* ---------- Dashboard ---------- */
.welcome { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.stats { margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 18px; }
.stat-icon { font-size: 1.6rem; }
.stat-value { font-size: 1.6rem; font-family: var(--font-en); }
.stat-label { color: var(--muted); font-size: .9rem; }
.overall { margin-bottom: 8px; }
.overall-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 700; }
.levels { display: flex; flex-direction: column; gap: 14px; }
.level { padding: 0; overflow: hidden; }
.level.locked { opacity: .75; }
.level-toggle { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: none; border: 0; cursor: pointer; text-align: start; }
.level-info { display: flex; flex-direction: column; line-height: 1.4; flex: 1; }
.level-info small { color: var(--muted); }
.level-bar { width: 160px; }
.chev { color: var(--muted); font-size: .8rem; }
.level-body { padding: 0 18px 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.lesson-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lesson-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none !important; transition: background .2s, border-color .2s, transform .15s; }
a.lesson-link:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateX(-3px); }
.lesson-row.is-next .lesson-link { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.lesson-row.is-locked .lesson-link { cursor: not-allowed; color: var(--muted); background: var(--surface-2); }
.lesson-icon { font-size: 1.3rem; }
.lesson-text { display: flex; flex-direction: column; line-height: 1.4; flex: 1; }
.lesson-text small { color: var(--muted); }
.score { font: 700 .95rem var(--font-en); color: var(--success); }
@media (max-width: 600px) { .level-bar { display: none; } }

/* ---------- Lesson ---------- */
.lesson-head { margin-bottom: 18px; }
.lesson-head h1 { margin: .3em 0 0; }
.lesson-en { font-size: 1.1rem; color: var(--primary); font-weight: 600; margin-bottom: .3em; }
.back { display: inline-block; margin-bottom: 8px; font-weight: 700; margin-inline-end: 10px; }
.stepper { display: flex; gap: 8px; margin-bottom: 22px; overflow-x: auto; padding-bottom: 4px; }
.step { flex: 1; min-width: max-content; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--muted); }
.step.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.step.done .step-num { background: var(--success); color: #fff; }
.step-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); font-size: .85rem; }

.sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.sec p:last-child { margin-bottom: 0; }
.sec-title { display: flex; align-items: center; gap: 8px; }
.sec-icon { font-size: 1.2rem; }
.sec-text { font-size: 1.08rem; }
.sec-rule { border-inline-start: 5px solid var(--primary); }
.formula { font: 700 1.15rem/1.6 var(--font-en); background: var(--primary-soft); color: var(--primary); padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; text-align: left; overflow-wrap: anywhere; }
.sec-compare { background: linear-gradient(135deg, color-mix(in srgb, var(--primary-2) 10%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--primary-2) 35%, var(--border)); }
.sec-tip { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.examples, .mistakes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.example { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.ex-line { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; direction: ltr; text-align: left; }
.ex-line .en { font-size: 1.12rem; font-weight: 600; flex: 1; }
.ex-ar { margin: 4px 0 0; color: var(--muted); }
.ex-note { display: inline-block; margin-top: 4px; color: var(--primary); font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 420px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: start; }
th { background: var(--surface-2); font-weight: 800; }
tbody tr:hover { background: var(--surface-2); }
td .en { font-weight: 600; }
.mistakes li { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.mistake-pair { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.wrong { color: var(--danger); text-decoration: line-through; }
.right { color: var(--success); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-bottom: 8px; }
.letter-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; transition: transform .15s, border-color .15s; }
.letter-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.letter { font: 800 1.9rem var(--font-en); color: var(--primary); }
.letter-name { font-size: .85rem; color: var(--muted); }
.letter-word { font: 600 .95rem var(--font-en); }
.letter-word-ar { font-size: .8rem; color: var(--muted); }
.dialogue { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); }
.bubble.a { align-self: flex-start; border-start-start-radius: 4px; }
.bubble.b { align-self: flex-end; background: var(--primary-soft); border-start-end-radius: 4px; }
.who { font-size: .85rem; color: var(--primary); }
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.vocab-card, .word-card { padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.word-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; direction: ltr; }
.word-title { font-size: 1.2rem; font-weight: 700; }
.meaning { font-weight: 700; margin: 6px 0 2px; }
.pron { color: var(--primary); display: block; }
.vocab-ex { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.vocab-ex .en { font-size: .98rem !important; font-weight: 500 !important; }
.step-actions { display: flex; justify-content: center; margin-top: 24px; }

.speak { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: .95rem; flex-shrink: 0; transition: transform .15s, background .15s; }
.speak:hover { transform: scale(1.1); background: var(--primary-soft); }
.speak-big { width: 64px; height: 64px; font-size: 1.6rem; background: var(--primary-soft); }

/* ---------- Exercises ---------- */
.practice-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font-weight: 700; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; }
.dot-btn { width: 14px; height: 14px; border-radius: 50%; border: 0; background: var(--border); cursor: pointer; padding: 0; }
.dot-btn.solved { background: var(--success); }
.dot-btn.current { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 45%, transparent); }
.exercise-card { margin-top: 16px; min-height: 260px; }
.ex-prompt { font-size: 1.15rem; font-weight: 700; }
.ar-sentence { font-size: 1.3rem; font-weight: 700; padding: 12px 16px; background: var(--surface-2); border-radius: 12px; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.options-row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.option { padding: 14px 16px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 1.05rem; transition: border-color .15s, background .15s, transform .12s; }
.option:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-2px); }
.option:disabled { cursor: default; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option.correct { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.option.wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); animation: shake .35s; }
.option.dim { opacity: .55; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.listen-box { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 12px; }
.fill-sentence { font: 600 1.4rem/2 var(--font-en); text-align: center; padding: 16px; background: var(--surface-2); border-radius: 14px; margin: 10px 0; }
.blank { display: inline-block; min-width: 90px; padding: 0 10px; margin: 0 6px; border-bottom: 3px dashed var(--primary); color: var(--muted); }
.blank.filled { color: var(--primary); border-bottom-style: solid; }
.answer-row { display: flex; gap: 10px; margin-top: 12px; }
.answer-row .text-answer { flex: 1; }
.order-line { min-height: 64px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 2px dashed var(--border); border-radius: 14px; margin: 12px 0; }
.order-line.correct { border-color: var(--success); background: var(--success-soft); }
.order-line.wrong { border-color: var(--danger); background: var(--danger-soft); }
.placeholder { color: var(--muted); width: 100%; text-align: center; font-family: var(--font-ar); }
.word-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.word-chip { font: 600 1.05rem var(--font-en); padding: .45em 1em; border-radius: 12px; border: 2px solid var(--border); border-bottom-width: 4px; background: var(--surface); cursor: pointer; transition: transform .12s; }
.word-chip:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--primary); }
.word-chip.picked { background: var(--primary-soft); border-color: var(--primary); }
.word-chip.used { visibility: hidden; }
.text-answer { font-family: var(--font-en); font-size: 1.1rem; resize: vertical; margin-top: 10px; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item { padding: 12px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 1.02rem; transition: border-color .15s, background .15s; }
.match-item:hover:not(:disabled) { border-color: var(--primary); }
.match-item:disabled { cursor: default; }
.match-item.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.match-item.paired { color: #fff; border-color: transparent; }
.pair-0 { background: #6366f1 !important; } .pair-1 { background: #0ea5e9 !important; } .pair-2 { background: #f59e0b !important; }
.pair-3 { background: #ec4899 !important; } .pair-4 { background: #10b981 !important; } .pair-5 { background: #8b5cf6 !important; }
.feedback { margin-top: 18px; padding: 16px 18px; border-radius: 14px; animation: pop .25s ease; }
.feedback.ok { background: var(--success-soft); border: 1.5px solid var(--success); }
.feedback.ok > strong { color: var(--success); font-size: 1.15rem; }
.feedback.bad { background: var(--danger-soft); border: 1.5px solid var(--danger); }
.feedback.bad > strong { color: var(--danger); font-size: 1.15rem; }
.correct-answer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; font-weight: 700; }
.explain { margin: 6px 0 0; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.done-box, .result-card { padding: 36px 22px; }
.big-emoji { font-size: 3.4rem; line-height: 1.2; margin-bottom: 8px; }

/* ---------- Task ---------- */
.task-card h2 { margin-bottom: .3em; }
.task-prompt { font-size: 1.1rem; }
.task-steps { padding-inline-start: 1.3em; color: var(--muted); }
.task-reqs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip-en { background: var(--primary-soft); color: var(--primary); }
.task-example { margin: 10px 0; padding: 10px 14px; background: var(--surface-2); border-radius: 12px; }
.task-example summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.task-example .ex-line { margin: 8px 0 4px; }
.task-input { min-height: 150px; }
.task-meta { display: flex; justify-content: flex-end; margin-top: 6px; font-weight: 600; }
.ok-text { color: var(--success); }
.finish-card { margin-top: 16px; text-align: center; }
.score-ring { display: inline-grid; place-items: center; width: 130px; height: 130px; border-radius: 50%; font: 800 2.2rem var(--font-en); margin: 10px auto; border: 10px solid var(--success); color: var(--success); }
.score-ring.bad { border-color: var(--warn); color: var(--warn); }
.xp-gain { font-size: 1.25rem; font-weight: 800; color: #b98500; }

/* ---------- Review & words ---------- */
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.flashcard { margin-top: 18px; text-align: center; padding: 32px 22px; }
.flash-word { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 22px; }
.word-big { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; }
.flash-back { animation: pop .25s ease; margin-bottom: 8px; }
.flash-back .meaning { font-size: 1.6rem; }
.flash-back .example { margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.empty { text-align: center; padding: 40px 22px; }
.words-grid { margin-top: 14px; }
.strength { display: flex; gap: 4px; margin-top: 8px; direction: ltr; }
.dot { width: 22px; height: 6px; border-radius: 3px; background: var(--border); }
.dot.on { background: var(--success); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .card, .sec { padding: 16px; }
  .match-grid { gap: 8px; }
  .match-item { padding: 10px 8px; font-size: .95rem; }
  .fill-sentence { font-size: 1.15rem; }
  .wa-float { width: 54px; height: 54px; bottom: 16px; left: 16px; }
  .answer-row { flex-direction: column; }
}

/* =====================================================================
   v2: speaking, placement, certificates, admin
   ===================================================================== */
.grow { flex: 1; min-width: 0; }
.row-actions.start { justify-content: flex-start; }
.row-actions.spread { justify-content: space-between; }
.big-emoji.small { font-size: 2.2rem; margin: 0; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .9rem; margin-top: 10px; }
.link-btn:hover { color: var(--primary); }

/* ---------- Speaking ---------- */
.speak-ex { display: flex; flex-direction: column; align-items: center; text-align: center; }
.speak-target { width: 100%; padding: 16px; background: var(--surface-2); border-radius: 14px; margin-bottom: 18px; }
.speak-sentence { font-size: 1.45rem !important; font-weight: 700; }
.mic { width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer; font-size: 2.4rem; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: var(--shadow-lg); transition: transform .15s; position: relative; }
.mic:hover:not(:disabled) { transform: scale(1.06); }
.mic:disabled { opacity: .5; cursor: default; }
.mic.listening { background: linear-gradient(135deg, #ef4444, #f97316); animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); } 50% { box-shadow: 0 0 0 18px rgba(239, 68, 68, 0); } }
.mic-label { margin-top: 12px; font-weight: 700; color: var(--muted); }
.heard { padding: 8px 14px; border-radius: 10px; background: var(--primary-soft); }

/* ---------- Placement ---------- */
.placement-offer { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 16px 0; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: linear-gradient(135deg, var(--primary-soft), var(--surface)); }
.placement-offer p { margin: 0; }
.placement-q { font-size: 1.3rem; margin-top: 10px; }
.intro-list { text-align: start; display: inline-block; color: var(--muted); }
.placed { display: inline-flex; align-items: center; gap: 12px; font-size: 1.5rem; margin: 8px 0 18px; }
.placement-bars { display: flex; flex-direction: column; gap: 8px; max-width: 420px; margin: 0 auto 16px; }
.pbar { display: flex; align-items: center; gap: 10px; }
.pbar-code { font: 700 .9rem var(--font-en); width: 32px; }
.pbar-track { flex: 1; }
.pbar-score { font: 600 .9rem var(--font-en); width: 34px; color: var(--muted); }

/* ---------- Certificates ---------- */
.cert-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cert-code { display: block; margin-bottom: 12px; color: var(--muted); }
.cert-earned { margin: 18px auto; padding: 18px; border-radius: 16px; background: #fff8dd; color: #6b4e00; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 520px; }
@media (prefers-color-scheme: dark) { .cert-earned { background: #3b3214; color: #ffe08a; } }
.verified { text-align: center; color: var(--success); font-weight: 700; margin-bottom: 14px; }
.certificate { max-width: 980px; margin: 0 auto; background: #fffdf7; color: #1d1b16; border-radius: 10px; padding: 18px; box-shadow: var(--shadow-lg); }
.cert-border { border: 3px double #b8912f; outline: 1px solid #e5cf8f; outline-offset: -12px; border-radius: 6px; padding: 40px 36px 28px; text-align: center;
  background: radial-gradient(circle at 50% 40%, rgba(184, 145, 47, .08), transparent 60%); }
.cert-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; }
.cert-head div { display: flex; flex-direction: column; text-align: start; line-height: 1.3; }
.cert-head small { color: #7a6a45; }
.cert-title { font-size: 2.3rem; font-weight: 800; color: #8a6a1c; margin: 0; }
.cert-title-en { font: 600 1.15rem var(--font-en); letter-spacing: 3px; text-transform: uppercase; color: #a0884e; margin: 0 0 18px; }
.cert-text { font-size: 1.1rem; margin: 6px 0; color: #4a4434; }
.cert-name { font-size: 2.4rem; font-weight: 800; color: #1d1b16; margin: 8px auto; padding: 0 30px 6px; border-bottom: 2px solid #d9c38a; display: inline-block; }
.cert-level { font-size: 1.35rem; font-weight: 700; margin: 10px 0; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.cert-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; gap: 16px; }
.cert-foot > div { display: flex; flex-direction: column; min-width: 160px; }
.cert-foot small { color: #7a6a45; }
.cert-seal { font-size: 3.4rem; }
.cert-verify { margin: 22px 0 0; font-size: .82rem; color: #7a6a45; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .cert-border { padding: 26px 14px 18px; }
  .cert-title { font-size: 1.6rem; } .cert-name { font-size: 1.7rem; padding: 0 8px 6px; }
  .cert-foot { flex-direction: column; } .cert-foot > div { min-width: 0; }
}

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 8px; margin: 10px 0 20px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab { padding: .5em 1.1em; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--muted); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.admin-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.text-input { width: 100%; padding: .6em .9em; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); }
.text-input:focus, .json-input:focus { outline: none; border-color: var(--primary); }
.admin-toolbar .text-input { flex: 1; min-width: 200px; }
.admin-two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-top: 18px; }
.rank { padding-inline-start: 1.3em; margin: 0; }
.rank li { margin-bottom: 6px; }
.table-card { padding: 0; overflow: hidden; }
.admin-table { min-width: 760px; font-size: .93rem; }
.admin-table td { vertical-align: middle; }
.admin-table.compact { min-width: 0; margin-top: 10px; }
.admin-table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.mini-progress { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.admin-level { margin-bottom: 14px; }
.admin-level-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-form { margin-top: 14px; padding: 16px; background: var(--surface-2); border-radius: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.admin-editor .field { margin-bottom: 14px; }
.json-head { display: flex; justify-content: space-between; align-items: center; }
.json-input { width: 100%; font: 13px/1.55 ui-monospace, Consolas, monospace; padding: 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; tab-size: 2; }
.field-error { color: var(--danger); font-weight: 600; display: block; margin-top: 4px; }

/* ---------- Print (certificate) ---------- */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff !important; }
  .site-header, .site-footer, .wa-float, .no-print { display: none !important; }
  .section { padding: 0 !important; }
  .certificate { box-shadow: none; max-width: none; padding: 0; }
  .cert-border { min-height: 180mm; display: flex; flex-direction: column; justify-content: center; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =====================================================================
   v3: mind map, colour-coded grammar, help panel, question lab, effects
   ===================================================================== */
:root {
  --r-subject: #2563eb; --r-subject-bg: #e8efff;
  --r-helper: #ea580c;  --r-helper-bg: #fff0e6;
  --r-verb: #15803d;    --r-verb-bg: #e6f7ec;
  --r-question: #9333ea; --r-question-bg: #f4e8ff;
  --r-object: #0e7490;  --r-object-bg: #e2f6fa;
  --r-other: #475569;   --r-other-bg: #eef2f7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --r-subject: #8fb2ff; --r-subject-bg: #1c2a4d;
    --r-helper: #ffad7a;  --r-helper-bg: #3d2416;
    --r-verb: #6ee7a0;    --r-verb-bg: #15301f;
    --r-question: #d3a6ff; --r-question-bg: #2f1d45;
    --r-object: #67d8ee;  --r-object-bg: #12303a;
    --r-other: #b8c2d3;   --r-other-bg: #262c40;
  }
}

/* Gentle entrance for cards */
.card, .sec, .mindmap-wrap { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card, .sec, .mindmap-wrap, .mm-node { animation: none !important; } }

/* ---------- Colour-coded formula ---------- */
.formula-chips { margin-bottom: 12px; }
.formula-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; justify-content: flex-start; }
.f-chip { font: 700 1.02rem var(--font-en); padding: .3em .75em; border-radius: 10px; border: 2px solid transparent; }
.f-plus { font: 800 1.1rem var(--font-en); color: var(--muted); }
.r-subject, .slot-subject { color: var(--r-subject); background: var(--r-subject-bg); border-color: color-mix(in srgb, var(--r-subject) 35%, transparent); }
.r-helper, .slot-aux { color: var(--r-helper); background: var(--r-helper-bg); border-color: color-mix(in srgb, var(--r-helper) 35%, transparent); }
.r-verb, .slot-main { color: var(--r-verb); background: var(--r-verb-bg); border-color: color-mix(in srgb, var(--r-verb) 35%, transparent); }
.r-question, .slot-wh { color: var(--r-question); background: var(--r-question-bg); border-color: color-mix(in srgb, var(--r-question) 35%, transparent); }
.r-object, .slot-rest { color: var(--r-object); background: var(--r-object-bg); border-color: color-mix(in srgb, var(--r-object) 35%, transparent); }
.r-other { color: var(--r-other); background: var(--r-other-bg); }
.slot-q { font: 800 1.6rem var(--font-en); color: var(--muted); padding: 0 4px; align-self: center; }
.f-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.f-key { font-size: .78rem; font-weight: 700; padding: .1em .6em; border-radius: 999px; }

/* ---------- Mind map ---------- */
.mindmap-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.mindmap-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.mindmap { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 380px; margin-top: 6px;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 55%); border-radius: 18px; }
.mm-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mm-line { fill: none; stroke: color-mix(in srgb, var(--primary) 35%, var(--border)); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-dasharray: 6 6; animation: dash 1.2s linear forwards; }
.mm-line.active { stroke: var(--primary); stroke-width: 4; stroke-dasharray: none; }
.mm-line.k-practice { stroke: color-mix(in srgb, var(--success) 50%, var(--border)); }
.mm-line.k-task { stroke: color-mix(in srgb, var(--warn) 55%, var(--border)); }
@keyframes dash { from { stroke-dashoffset: 120; } to { stroke-dashoffset: 0; } }
.mm-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; text-align: center; max-width: 30%;
  padding: 16px 20px; border-radius: 22px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: var(--shadow-lg); }
.mm-center strong { display: block; font-size: 1.1rem; line-height: 1.4; }
.mm-center-en { display: block; font-size: .85rem; opacity: .85; }
.mm-node { position: absolute; transform: translate(-50%, -50%); z-index: 3; display: flex; align-items: center; gap: 6px; max-width: 24%;
  padding: 8px 12px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; font-size: .92rem;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s, box-shadow .15s; animation: mmPop .45s ease both; }
@keyframes mmPop { from { opacity: 0; transform: translate(-50%, -50%) scale(.5); } to { opacity: 1; transform: translate(-50%, -50%); } }
.mm-node:hover { transform: translate(-50%, -50%) scale(1.06); border-color: var(--primary); }
.mm-node.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent); }
.mm-node.k-practice { border-color: color-mix(in srgb, var(--success) 50%, var(--border)); }
.mm-node.k-task { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); }
.mm-icon { font-size: 1.2rem; }
.mm-icon.big { font-size: 1.6rem; }
.mm-label { line-height: 1.3; text-align: start; }
.mm-detail { margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border-inline-start: 5px solid var(--primary); animation: pop .25s ease; }
.mm-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mm-detail-head strong { flex: 1; font-size: 1.05rem; }
.mm-close { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.mm-preview { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mm-preview li { display: flex; align-items: center; gap: 8px; justify-content: space-between; direction: ltr; padding: 6px 10px; background: var(--surface); border-radius: 10px; }
@media (max-width: 760px) {
  .mindmap { aspect-ratio: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 0; background: none; }
  .mm-lines { display: none; }
  .mm-center, .mm-node { position: static; transform: none; max-width: none; }
  .mm-center { margin-bottom: 6px; }
  .mm-node { margin-inline-start: 18px; position: relative; left: auto !important; top: auto !important; align-self: stretch; justify-content: flex-start; }
  .mm-node::before { content: ''; position: absolute; inset-inline-start: -14px; top: 50%; width: 12px; border-top: 2px dashed var(--border); }
  .mm-node:hover { transform: none; }
  .mm-node { animation: fadeUp .35s ease both; }
}

/* ---------- Card-by-card learning ---------- */
.learn-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 10px; scroll-margin-top: 80px; }
.learn-count { font-weight: 800; color: var(--primary); }
.learn-card { margin-top: 14px; animation: slideIn .3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.card-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.card-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

/* ---------- Help panel ---------- */
.ex-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ex-top .ex-prompt { flex: 1; margin-bottom: .4em; }
.help-toggle { flex-shrink: 0; padding: .35em .9em; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--warn) 45%, var(--border)); background: var(--warn-soft); color: var(--warn); font-weight: 700; cursor: pointer; }
.help-toggle.open { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.help-panel { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 6px 0 14px; padding: 12px; border-radius: 14px; background: var(--surface-2); animation: pop .2s ease; }
.help-block { background: var(--surface); border-radius: 12px; padding: 10px 12px; }
.help-block > strong { display: block; margin-bottom: 4px; }
.help-block p { margin: 0 0 6px; font-size: .95rem; }
.help-block .formula-row { margin: 4px 0; }
.help-block .f-chip { font-size: .88rem; }
.hint-text { color: var(--warn); font-weight: 700; }
.option.eliminated { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.match-item.locked { outline: 3px dashed rgba(255, 255, 255, .7); outline-offset: -5px; }

/* ---------- Tools on dashboard ---------- */
.tools { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 18px 0 6px; }
.tool-card { display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none !important; transition: transform .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.tool-icon { font-size: 1.8rem; }
.icon-btn { background: none; border: 1px solid var(--border); border-radius: 999px; width: 34px; height: 34px; cursor: pointer; }

/* ---------- Question lab ---------- */
.lab-hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.lab-hero p { max-width: 560px; }
.lab-formula { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.lab-formula .f-chip { font: 700 .82rem var(--font-ar); }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
.slot-board { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.slot { flex: 1 1 84px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px; min-height: 70px; border-radius: 14px; border: 2px dashed; cursor: pointer; opacity: .75; transition: transform .12s, opacity .12s; }
.slot.filled { border-style: solid; opacity: 1; }
.slot.active { opacity: 1; transform: translateY(-3px); box-shadow: 0 6px 16px color-mix(in srgb, currentColor 25%, transparent); }
.slot-label { font: 700 .75rem var(--font-ar); }
.slot-value { font: 800 1.15rem var(--font-en); }
.picker { margin-top: 14px; }
.picker-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.picker-head .row-actions { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip { display: flex; flex-direction: column; align-items: center; padding: 8px 14px; border-radius: 14px; border: 2px solid; border-bottom-width: 4px; cursor: pointer; transition: transform .12s; }
.qchip:hover { transform: translateY(-2px); }
.qchip.picked { box-shadow: 0 0 0 3px currentColor; }
.qchip-en { font-weight: 800; font-size: 1.05rem; }
.qchip small { font-size: .72rem; color: var(--muted); }
.lab-result { padding: 16px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); box-shadow: var(--shadow); animation: pop .2s ease; }
.lab-result.ok { border-color: var(--success); background: color-mix(in srgb, var(--success) 7%, var(--surface)); }
.lab-result.bad { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.lab-sentence { display: flex; align-items: center; gap: 8px; direction: ltr; justify-content: space-between; }
.lab-sentence-en { font-size: 1.45rem; font-weight: 800; }
.lab-meaning { margin: 6px 0; color: var(--primary); font-weight: 700; }
.lab-errors { margin: 8px 0 0; padding-inline-start: 1.2em; color: var(--danger); font-weight: 600; }
.lab-errors li { margin-bottom: 6px; }
.lab-tips { list-style: none; margin: 8px 0 0; padding: 0; color: var(--muted); }
.lab-empty p { margin-bottom: 6px; }
.lab-golden { font: 700 1rem var(--font-en); color: var(--primary); }
.lab-score { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.lab-score strong { font: 800 1.5rem var(--font-en); color: var(--success); }
.challenge-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.challenge-answer { padding: 14px; border-radius: 14px; background: var(--primary-soft); margin-bottom: 14px; }
.challenge-goal { margin: 6px 0 0; font-weight: 800; color: var(--primary); }
.try-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.chip-btn { padding: .25em .8em; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: .9rem; }
.chip-btn:hover { border-color: var(--primary); }
.suggestion { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--success-soft); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------- Confetti ---------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti { position: absolute; left: 50%; top: 18%; width: 10px; height: 14px; border-radius: 3px; opacity: 0;
  animation: confetti 1.8s cubic-bezier(.2, .7, .3, 1) var(--delay) forwards; }
@keyframes confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
}
