/* كلمتين | KILMATAIN — الأنماط الأساسية
   الألوان مستخرجة من ملف الشعار: الأخضر #1F8A5B، الأصفر #F5C518، الحبر #14321F */
:root {
  --ink: #14321F;
  --green-900: #12301F;
  --green: #1F8A5B;
  --green-700: #1A7550;
  --green-300: #3FBF7F;
  --green-100: #D7EDE2;
  --green-50: #EDF6F1;
  --yellow: #F5C518;
  --yellow-600: #C99A00;
  --yellow-100: #FDEFB4;
  --yellow-50: #FEF8E0;
  --bg: #F7F8F4;
  --surface: #FFFFFF;
  --muted: #4A5D51;
  --muted-2: #6B7C70;
  --line: #E2E8E1;
  --danger: #B93A26;
  --danger-50: #FCEDE9;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(20, 50, 31, .05), 0 8px 24px rgba(20, 50, 31, .06);
  --shadow-lg: 0 18px 50px rgba(20, 50, 31, .14);
  --font-ar: 'Tajawal', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-en: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --fs: 16px;
  --tap: 44px;
  --topbar: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ar);
  font-size: var(--fs);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body[data-age="kids"] { --fs: 19px; --tap: 56px; --radius: 26px; }
body[data-age="junior"] { --fs: 17.5px; --tap: 50px; --radius: 24px; }
body[data-age="teen"] { --fs: 16.5px; }

h1, h2, h3 { line-height: 1.3; margin: 0 0 .4em; font-weight: 800; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--green-700); }
a:hover { color: var(--ink); }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

.en, [lang="en"] { font-family: var(--font-en); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted-2); }
.center { text-align: center; }
.strong { font-weight: 800; }
.lead { font-size: 1.08em; color: var(--muted); }
.eyebrow { font-size: .85rem; font-weight: 700; color: var(--green); margin: 0 0 4px; letter-spacing: .2px; }
.eyebrow--light { color: var(--yellow); }
.link { font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }
.ic { display: inline-flex; flex: none; line-height: 0; }

.skip { position: absolute; top: -60px; right: 12px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; }
.skip:focus { top: 10px; }

/* ---------- العلامة ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand__mark { display: inline-flex; }
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__ar { font-weight: 800; font-size: 1.35rem; letter-spacing: -.3px; }
.brand__en { font-family: var(--font-en); font-weight: 800; font-size: .62rem; letter-spacing: 2.6px; color: var(--green); margin-top: 3px; }
.brand--light { color: #fff; }
.brand--light .brand__en { color: var(--yellow); }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px; border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-700); }
.btn--primary:hover { background: var(--green-700); color: #fff; }
.btn--accent { background: var(--yellow); color: var(--ink); box-shadow: 0 3px 0 var(--yellow-600); }
.btn--accent:hover { background: #FFD43B; color: var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface); border-color: var(--green-100); color: var(--ink); }
.btn--soft { background: var(--green-50); color: var(--green-700); }
.btn--soft:hover { background: var(--green-100); color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #962d1d; color: #fff; }
.btn--lg { min-height: calc(var(--tap) + 8px); padding: 12px 26px; font-size: 1.05em; }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: .9em; }
.btn--block { width: 100%; }
.btn .ic svg { width: 18px; height: 18px; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: var(--tap); height: var(--tap); padding: 0 10px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; flex: none;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn-icon:hover { border-color: var(--green-100); background: var(--green-50); }
.btn-icon[disabled] { opacity: .4; cursor: not-allowed; }
.btn-icon--big { height: 64px; min-width: 64px; padding: 0 22px; font-weight: 700; }
.btn-speak { color: var(--green-700); }
.btn-speak.is-playing { background: var(--green); color: #fff; border-color: var(--green); }
.btn-speak--slow { color: var(--muted); }
.btn-fav.is-on { color: #D2475B; border-color: #F5C7CF; background: #FFF1F3; }
.btn-fav.is-on svg path { fill: currentColor; }
.btn-mic.is-listening, .btn.is-listening { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- البطاقات العامة ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card--soft { background: var(--green-50); box-shadow: none; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card__head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.card__head h2 .ic { color: var(--green); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row--center { justify-content: center; }
.row--between { justify-content: space-between; }
.section-title { margin: 28px 0 12px; }
.page-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .lead { margin: 0; }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--green-50); color: var(--green-700); white-space: nowrap; }
.tag--accent { background: var(--yellow); color: var(--ink); }
.tag--done { background: var(--green); color: #fff; }
.tag--warn { background: var(--yellow-100); color: #7A5A00; }
.tag--soft { background: var(--bg); color: var(--muted); margin-inline-start: 8px; }
.tag .ic svg { width: 14px; height: 14px; }

.bar { height: 10px; background: var(--green-100); border-radius: 999px; overflow: hidden; flex: 1 1 auto; min-width: 60px; }
.bar__fill { height: 100%; background: linear-gradient(90deg, var(--green-300), var(--green)); border-radius: inherit; transition: width .4s ease; }
[dir="rtl"] .bar__fill { background: linear-gradient(270deg, var(--green-300), var(--green)); }

.mastery { display: inline-flex; gap: 3px; vertical-align: middle; }
.mastery__dot { width: 9px; height: 9px; border-radius: 3px; background: var(--line); }
.mastery__dot.is-on { background: var(--yellow); box-shadow: inset 0 0 0 1.5px var(--yellow-600); }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .92em; }
.chip .en { font-weight: 700; color: var(--green-700); }

.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list__item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list__item:last-child { border-bottom: 0; }
.list__item > div { flex: 1; }

.notice { display: flex; gap: 8px; align-items: flex-start; background: var(--yellow-50); border: 1px solid var(--yellow-100); padding: 12px 14px; border-radius: var(--radius-sm); }

/* ---------- المدخلات ---------- */
.input { width: 100%; min-height: var(--tap); padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 4px var(--green-50); }
.input--en { font-family: var(--font-en); font-size: 1.1em; text-align: left; }
.input.is-correct { border-color: var(--green); background: var(--green-50); }
.input.is-wrong, .input--error { border-color: var(--danger); background: var(--danger-50); }
.select { appearance: auto; }
textarea.input { resize: vertical; min-height: 80px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 700; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range { flex: 1; accent-color: var(--green); }
.form-error { color: var(--danger); font-weight: 700; min-height: 1.2em; margin: 8px 0; }

/* ---------- الهيكل ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; background: rgba(247, 248, 244, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__chips { display: flex; gap: 8px; }
.chip-stat { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 800; text-decoration: none; color: var(--ink); font-family: var(--font-en); font-size: .95rem; }
.chip-stat .ic { color: #E8710A; }
.chip-stat--xp .ic { color: var(--yellow-600); }
.chip-stat--lvl { background: var(--green); color: #fff; border-color: var(--green); font-family: var(--font-ar); }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - var(--topbar)); }
.sidenav { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); padding: 18px 14px; border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; overflow-y: auto; scrollbar-width: thin; }
.sidenav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sidenav__link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--muted); font-weight: 700; text-decoration: none; }
.sidenav__link:hover { background: var(--surface); color: var(--ink); }
.sidenav__link.is-active { background: var(--green-50); color: var(--green-700); }
.sidenav__link.is-active .ic { color: var(--green); }
.sidenav__foot { display: grid; gap: 2px; padding-top: 16px; border-top: 1px solid var(--line); }
.sidenav__sub { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--muted-2); text-decoration: none; font-size: .92rem; border-radius: 10px; }
.sidenav__sub:hover { color: var(--ink); background: var(--surface); }

.view { padding: 28px clamp(16px, 4vw, 44px) 60px; max-width: 1080px; width: 100%; outline: none; }
.bottomnav { display: none; }

body.is-bare .topbar, body.is-bare .sidenav, body.is-bare .bottomnav { display: none; }
body.is-bare .layout { display: block; }
body.is-bare .view { margin: 0 auto; max-width: 760px; }
body.is-focus .sidenav { display: none; }
body.is-focus .layout { grid-template-columns: 1fr; }
body.is-focus .view { margin: 0 auto; max-width: 780px; }

/* ---------- الشخصية ---------- */
.mascot { display: inline-flex; flex: none; }
.mascot svg { overflow: visible; }

/* ---------- الرئيسية ---------- */
.dash { display: grid; gap: 18px; }
.hero-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: var(--green-900); color: #fff; border-radius: calc(var(--radius) + 6px); padding: 28px 30px;
}
.hero-card::after { content: ''; position: absolute; inset-inline-start: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 60px; background: var(--green); opacity: .35; transform: rotate(-14deg); pointer-events: none; }
.hero-card__text { position: relative; z-index: 1; max-width: 520px; }
.hero-card h1 { font-size: 2rem; color: #fff; }
.hero-card p { color: #D4E6DB; }
.hero-card .mascot { position: relative; z-index: 1; }
.hero-card__next { font-size: .92rem; margin: 12px 0 0; }

.stats { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 12px; }
.stat-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; align-items: center; gap: 12px; }
.stat-card--wide { flex-direction: column; align-items: stretch; justify-content: center; }
.stat-card__row { display: flex; align-items: center; gap: 12px; }
.stat-card strong { display: block; font-size: 1.25rem; font-family: var(--font-en); line-height: 1.2; }
.stat-card--wide strong { font-family: var(--font-ar); }
.stat-card span { color: var(--muted-2); font-size: .88rem; }
.stat-card__icon { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--green-50); color: var(--green); flex: none; }
.stat-card__icon--flame { background: #FFF0E3; color: #E8710A; }
.stat-card__icon--xp { background: var(--yellow-50); color: var(--yellow-600); }

.dash__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.daily-mini { background: linear-gradient(160deg, var(--yellow-50), var(--surface) 60%); border: 2px solid var(--yellow-100); }
.daily-mini__phrase { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.daily-mini__en { font-family: var(--font-en); font-size: 1.55rem; font-weight: 800; margin: 6px 0; text-align: left; flex: 1; }
.daily-mini__ar { font-size: 1.1rem; color: var(--muted); }

.missions { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mission { display: flex; align-items: center; gap: 12px; }
.mission__icon { width: 38px; height: 38px; border-radius: 12px; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.mission.is-done .mission__icon { background: var(--green); color: #fff; }
.mission__body { flex: 1; display: grid; gap: 6px; font-weight: 700; font-size: .95rem; }
.mission__count { font-family: var(--font-en); font-weight: 800; color: var(--muted-2); font-size: .9rem; min-width: 34px; text-align: center; }
.mission.is-done .mission__count { color: var(--green); font-family: var(--font-ar); }

.ach-mini { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ach-mini li { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.ach-mini__icon { width: 36px; height: 36px; border-radius: 12px; background: var(--yellow-50); color: var(--yellow-600); display: inline-flex; align-items: center; justify-content: center; }

.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.quick__item, .feature-link { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-decoration: none; color: var(--ink); border: 2px solid transparent; transition: border-color .15s, transform .15s; }
.quick__item:hover, .feature-link:hover { border-color: var(--green-100); color: var(--ink); }
.quick__item strong, .feature-link strong { display: block; }
.quick__item small, .feature-link small { color: var(--muted-2); display: block; }
.quick__icon { width: 46px; height: 46px; border-radius: 14px; background: var(--green-50); color: var(--green); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.feature-link { margin-bottom: 18px; }
.feature-link > span:nth-child(2) { flex: 1; }

/* ---------- قوائم الدروس والمسار ---------- */
.lesson-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg); text-decoration: none; color: var(--ink); border: 2px solid transparent; transition: border-color .15s, background .15s; }
.lesson-row:hover { border-color: var(--green-100); background: var(--surface); color: var(--ink); }
.lesson-row__icon { width: 38px; height: 38px; border-radius: 12px; background: var(--surface); color: var(--green); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.lesson-row.is-done .lesson-row__icon { background: var(--green); color: #fff; }
.lesson-row__body { flex: 1; min-width: 0; }
.lesson-row__body strong { display: block; }
.lesson-row__body small { color: var(--muted-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-row__meta { font-size: .82rem; color: var(--muted-2); white-space: nowrap; }
.lesson-row .tag--accent { margin-inline-start: 4px; }

.zone { margin-bottom: 18px; }
.zone__head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.zone__head > div { flex: 1; }
.zone__head h2 { margin-bottom: 2px; }
.zone__head p { margin: 0; }
.zone__num { width: 48px; height: 58px; border-radius: 14px; background: var(--yellow); color: var(--ink); font-family: var(--font-en); font-weight: 800; font-size: 1.4rem; display: inline-flex; align-items: center; justify-content: center; transform: rotate(6deg); box-shadow: -6px 4px 0 var(--green); flex: none; margin-inline-start: 6px; }
.zone__pct { font-family: var(--font-en); font-weight: 800; color: var(--muted-2); }

/* ---------- بطاقة العبارة ---------- */
.pcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: grid; gap: 10px; }
.pcard--big { padding: 28px; border-top: 6px solid var(--yellow); }
.pcard--compact { box-shadow: none; padding: 12px 0; }
.pcard__meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pcard__main { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.pcard__en { font-family: var(--font-en); font-size: 1.7rem; margin: 0; text-align: left; flex: 1 1 260px; }
.pcard--big .pcard__en { font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
.pcard__audio { display: flex; gap: 8px; }
.pcard__ar { font-size: 1.3rem; font-weight: 700; color: var(--green-700); margin: 0; }
.pcard__pron { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; background: var(--bg); padding: 8px 12px; border-radius: 12px; margin: 0; }
.pcard__pron small { color: var(--muted-2); font-size: .8rem; }
.pcard__label { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 800; color: var(--muted-2); }
.pcard__block { border-top: 1px dashed var(--line); padding-top: 10px; }
.pcard__block p { margin: 4px 0 0; }
.pcard__block--reply .en { font-weight: 800; font-size: 1.1rem; }
.pcard__reply { color: var(--ink); }
.pcard__words { border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 8px; }

/* ---------- الدرس ---------- */
.lesson-intro { display: flex; gap: 24px; align-items: center; }
.learn { display: grid; gap: 18px; }
.learn__top, .quiz__top { display: flex; align-items: center; gap: 14px; }
.quiz__count { font-family: var(--font-en); font-weight: 800; color: var(--muted-2); min-width: 54px; text-align: center; }
.learn__nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.learn__nav .btn--primary { flex: 1; }

/* ---------- التدريب ---------- */
.quiz { display: grid; gap: 18px; }
.quiz__body { display: grid; gap: 16px; }
.quiz__instr { font-size: 1.3rem; font-weight: 800; margin: 0; outline: none; }
.quiz__prompt { display: flex; align-items: center; gap: 14px; justify-content: space-between; background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.quiz__en { font-size: 1.7rem; font-weight: 800; flex: 1; text-align: left; }
.quiz__prompt--listen { justify-content: center; padding: 30px; }
.quiz__prompt--situation { justify-content: flex-start; align-items: flex-start; background: var(--yellow-50); box-shadow: none; border: 2px solid var(--yellow-100); }
.quiz__prompt--situation p { margin: 0; font-size: 1.12rem; font-weight: 700; }
.quiz__prompt--situation .ic { color: var(--yellow-600); margin-top: 3px; }
.quiz__sub { color: var(--muted); margin: -4px 0 0; }
.quiz__sub--lead { font-size: 1.1rem; margin: 0; }
.quiz__heard { color: var(--muted); font-size: .92rem; min-height: 1.4em; margin: 8px 0; }
.blank { display: inline-block; min-width: 70px; border-bottom: 3px solid var(--yellow); color: transparent; margin: 0 4px; }

.options { display: grid; gap: 10px; }
.options--inline { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: calc(var(--tap) + 8px);
  padding: 12px 16px; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px;
  cursor: pointer; text-align: start; font-weight: 700; transition: border-color .15s, background .15s, transform .1s;
}
.options--en .option { font-family: var(--font-en); font-size: 1.08rem; }
.option:hover:not([disabled]) { border-color: var(--green-300); background: var(--green-50); }
.option:active:not([disabled]) { transform: translateY(2px); border-bottom-width: 2px; }
.option[disabled] { cursor: default; }
.option__key { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; color: var(--muted-2); flex: none; font-family: var(--font-en); }
.option__text { flex: 1; }
.option__hint { display: block; font-family: var(--font-ar); font-weight: 500; font-size: .85rem; color: var(--muted-2); margin-top: 2px; }
.option.is-correct { border-color: var(--green); background: var(--green-50); color: var(--ink); }
.option.is-correct .ic { color: var(--green); }
.option.is-wrong { border-color: var(--danger); background: var(--danger-50); }
.option.is-wrong .ic { color: var(--danger); }
.option[disabled]:not(.is-correct):not(.is-wrong) { opacity: .55; }

.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 56px; }
.tiles--answer { background: var(--surface); border: 2px dashed var(--line); border-radius: 16px; padding: 12px; align-items: center; justify-content: flex-start; min-height: 72px; }
.tiles--answer.is-correct { border-color: var(--green); border-style: solid; background: var(--green-50); }
.tiles--answer.is-wrong { border-color: var(--danger); border-style: solid; background: var(--danger-50); }
.tiles__hint { color: var(--muted-2); font-family: var(--font-ar); font-size: .92rem; }
.tile { font-family: var(--font-en); font-weight: 800; font-size: 1.05rem; padding: 10px 16px; min-height: var(--tap); background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; cursor: pointer; }
.tile:hover:not([disabled]) { border-color: var(--green-300); }
.tile[disabled] { cursor: default; }

.type-row { display: flex; gap: 10px; }
.type-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.quiz__feedback { display: none; border-radius: var(--radius); padding: 18px 20px; gap: 10px; }
.quiz__feedback.is-shown { display: grid; }
.quiz__feedback.is-ok { background: var(--green-50); border: 2px solid var(--green-100); }
.quiz__feedback.is-bad { background: var(--yellow-50); border: 2px solid var(--yellow-100); }
.fb__head { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.fb__badge { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--green); }
.is-bad .fb__badge { background: var(--yellow-600); }
.fb__text { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fb__text .en { font-weight: 800; }
.fb__note { margin: 0; color: var(--muted); font-size: .92rem; }
.fb-ok, .fb-bad { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 8px 0; }
.fb-ok { color: var(--green-700); }
.fb-bad { color: #8A5A00; }

/* الأطفال: خيارات أكبر ونصوص أقل */
.quiz--kids .quiz__instr { font-size: 1.5rem; }
.quiz--kids .option { min-height: 72px; font-size: 1.2rem; }
.quiz--kids .option__key { display: none; }

/* ---------- النتيجة ---------- */
.result { text-align: center; display: grid; justify-items: center; gap: 6px; padding: 32px 24px; }
.result__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 520px; margin: 12px 0; }
.result__stats:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 360px; }
.stat { background: var(--bg); border-radius: 16px; padding: 14px 8px; display: grid; justify-items: center; gap: 2px; }
.stat .ic { color: var(--green); }
.stat strong { font-family: var(--font-en); font-size: 1.35rem; }
.stat span { font-size: .85rem; color: var(--muted-2); }
.result__mistakes { width: 100%; max-width: 560px; text-align: start; margin-top: 10px; }

/* ---------- المحادثات ---------- */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.story-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; text-decoration: none; color: var(--ink); display: grid; gap: 6px; align-content: start; border: 2px solid transparent; transition: border-color .15s; }
.story-card:hover { border-color: var(--green-100); color: var(--ink); }
.story-card h2 { margin: 4px 0 0; }
.story-card p { color: var(--muted); margin: 0; font-size: .95rem; }
.story-card .tag { justify-self: start; }
.story-card__foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--green); }

.story, .practice { display: grid; gap: 16px; }
.story__head { display: flex; align-items: center; gap: 12px; }
.story__head > div { flex: 1; }
.story__head h1 { margin: 0; font-size: 1.45rem; }
.story__situation { display: flex; gap: 8px; align-items: flex-start; background: var(--yellow-50); border: 2px solid var(--yellow-100); padding: 12px 16px; border-radius: 16px; margin: 0; font-weight: 700; }
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bubble { position: relative; background: var(--surface); box-shadow: var(--shadow); border-radius: 20px; border-start-start-radius: 6px; padding: 14px 16px 14px 64px; max-width: 86%; justify-self: start; }
.bubble--me { background: var(--green); color: #fff; justify-self: end; border-radius: 20px; border-start-end-radius: 6px; }
.bubble--me .bubble__who, .bubble--me .bubble__ar { color: #D4EEDF; }
.bubble--me .btn-speak { background: rgba(255,255,255,.15); color: #fff; border-color: transparent; }
.bubble__who { font-size: .78rem; font-weight: 800; color: var(--green); font-family: var(--font-en); }
.bubble__en { font-family: var(--font-en); font-size: 1.15rem; font-weight: 700; margin: 2px 0; text-align: left; }
.bubble__ar { margin: 0; color: var(--muted); font-size: .95rem; }
.bubble .btn-speak { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); }
.bubble--big { max-width: 100%; padding: 22px 22px 22px 70px; }
.hide-ar .bubble__ar { display: none; }
.story__actions { display: grid; gap: 10px; scroll-margin-bottom: 90px; }
.story__prompt { font-weight: 800; margin: 6px 0 0; }
.story__done { display: flex; gap: 18px; align-items: flex-start; }
.story__done > div { flex: 1; }
.practice__form { display: grid; gap: 4px; }
.practice__status { min-height: 1.5em; }

/* ---------- القاموس ---------- */
.toolbar { display: grid; grid-template-columns: 1fr 220px; gap: 10px; margin-bottom: 6px; }
.dict { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dict__item { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 8px 10px 8px 8px; }
.dict__row { display: flex; align-items: center; gap: 8px; }
.dict__toggle { flex: 1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 14px; background: none; border: 0; padding: 8px; text-align: start; cursor: pointer; border-radius: 10px; }
.dict__toggle:hover { background: var(--bg); }
.dict__en { font-family: var(--font-en); font-weight: 800; font-size: 1.08rem; }
.dict__ar { color: var(--muted); }
.dict__details { padding: 6px 4px 8px; }
.dict__details .pcard { box-shadow: none; background: var(--bg); }

/* ---------- الإنجازات ---------- */
.ach-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.ach { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 6px; justify-items: start; border: 2px dashed var(--line); }
.ach span { color: var(--muted-2); font-size: .9rem; }
.ach__icon { width: 52px; height: 52px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted-2) !important; }
.ach.is-on { border: 2px solid var(--yellow-100); }
.ach.is-on .ach__icon { background: var(--yellow); color: var(--ink) !important; }
.ach .tag--done { color: #fff; }

/* ---------- القواعد والقراءة ---------- */
.points { padding-inline-start: 22px; margin: 0; display: grid; gap: 6px; }
.mcq { padding: 14px 0; border-bottom: 1px solid var(--line); }
.mcq:last-of-type { border-bottom: 0; }
.mcq__q { font-weight: 700; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.mcq__q .en { font-size: 1.1rem; }
.mcq__n { color: var(--green); font-family: var(--font-en); }
.mcq__fb { margin: 8px 0 0; min-height: 1.2em; }
.mcq__done { margin-top: 14px; padding: 14px; background: var(--green-50); border-radius: 14px; display: grid; gap: 10px; }
.reading { display: grid; gap: 10px; margin-bottom: 18px; }
.reading h2 { margin: 0; }
.reading__text { font-size: 1.2rem; line-height: 1.9; text-align: left; margin: 0; background: var(--bg); padding: 16px 18px; border-radius: 14px; }
.reading__ar { color: var(--muted); border-inline-start: 4px solid var(--yellow); padding-inline-start: 12px; margin: 0; }
.prose h2 { margin-top: 18px; }
.prose h2:first-child { margin-top: 0; }

/* ---------- الإعدادات ---------- */
.settings-block { margin-bottom: 18px; }
.settings-block h2 { display: flex; align-items: center; gap: 8px; }
.settings-block h2 .ic { color: var(--green); }
.settings-block h3 { margin-top: 14px; }
.switch { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; cursor: pointer; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 48px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .2s; margin-top: 2px; }
.switch__track::after { content: ''; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch__input:checked + .switch__track { background: var(--green); }
.switch__input:checked + .switch__track::after { transform: translateX(-20px); }
.switch__input:focus-visible + .switch__track { outline: 3px solid var(--yellow); outline-offset: 2px; }
.switch__text strong { display: block; }
.switch__text small { color: var(--muted-2); }

/* ---------- خيارات البداية ---------- */
.choices { border: 0; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.choice { display: block; cursor: pointer; }
.choice__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice__box { display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 64px; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; transition: border-color .15s, background .15s; }
.choice:hover .choice__box { border-color: var(--green-300); }
.choice__icon { width: 40px; height: 40px; border-radius: 12px; background: var(--green-50); color: var(--green); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.choice__text { flex: 1; text-align: start; }
.choice__text strong { display: block; }
.choice__text small { color: var(--muted-2); display: block; }
.choice__check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: transparent; flex: none; }
.choice__input:checked + .choice__box { border-color: var(--green); background: var(--green-50); }
.choice__input:checked + .choice__box .choice__check { background: var(--green); border-color: var(--green); color: #fff; }
.choice__input:focus-visible + .choice__box { outline: 3px solid var(--yellow); outline-offset: 2px; }

.onb { display: grid; gap: 16px; padding-top: 8px; }
.onb__top { display: flex; justify-content: space-between; align-items: center; }
.onb__step { font-weight: 700; color: var(--muted-2); }
.onb__card { display: grid; justify-items: center; text-align: center; padding: 28px; }
.onb__card h1 { font-size: 1.9rem; }
.onb__form { width: 100%; display: grid; gap: 6px; margin-top: 8px; }
.onb__actions { display: flex; flex-direction: row-reverse; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.onb__actions .btn--primary { flex: 1 1 220px; }
.onb__points { list-style: none; padding: 0; margin: 4px 0 14px; display: grid; gap: 8px; }
.onb__points li { display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 700; color: var(--muted); }
.onb__points .ic { color: var(--green); }

/* ---------- صفحات أخرى ---------- */
.future-grid { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.future { display: grid; gap: 8px; justify-items: start; opacity: .92; }
.future p { margin: 0; color: var(--muted); }
.more-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.more-item { display: grid; justify-items: center; gap: 8px; padding: 18px 10px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); font-weight: 700; text-align: center; }
.more-item .ic { color: var(--green); }
.empty { text-align: center; display: grid; justify-items: center; gap: 6px; padding: 40px 16px; }
.empty p { color: var(--muted); max-width: 420px; }
.boot-error { max-width: 560px; margin: 60px auto; text-align: center; }

/* ---------- التنبيهات والنوافذ ---------- */
.toasts { position: fixed; z-index: 80; top: 76px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-weight: 700; pointer-events: auto; }
.toast--error { background: var(--danger); }
.toast--xp { background: var(--yellow); color: var(--ink); }
.toast--award { background: var(--green-900); border: 2px solid var(--yellow); }
.toast--award .ic { color: var(--yellow); }
.overlay { position: fixed; inset: 0; background: rgba(18, 48, 31, .45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; width: min(100%, 440px); display: grid; gap: 10px; }
.dialog__title { margin: 0; }
.dialog__msg { color: var(--muted); margin: 0; }
.dialog__hint { margin: 0; }
.dialog__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- تحميل ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; text-align: center; color: var(--muted); }
.boot__mark { width: 84px; height: 84px; margin: 0 auto 12px; }

/* ارتفاع سطر أصغر للعبارات الإنجليزية الكبيرة */
.pcard__en, .quiz__en, .daily-mini__en, .bubble__en, .l-preview__en { line-height: 1.3; }
.lesson-list > li, .dash > *, .dash__grid > *, .stats > *, .quick > * { min-width: 0; }
.page-404 { min-height: 100vh; align-content: center; }
