@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  font-family: 'Tajawal', sans-serif;
  color: #25223b;
  background: #f7f7fc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --purple: #5b4bce;
  --purple-dark: #4032aa;
  --purple-soft: #efedff;
  --orange: #ffb84d;
  --orange-soft: #fff0d8;
  --ink: #25223b;
  --muted: #77758b;
  --line: #e9e8f1;
  --paper: #fff;
  --green: #218768;
  --shadow: 0 14px 38px rgba(51, 44, 109, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: #f7f7fc; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.site-shell { max-width: 1480px; margin: 0 auto; padding: 0 42px; }
.topbar { min-height: 88px; display: flex; align-items: center; gap: 38px; border-bottom: 1px solid rgba(71, 66, 111, .09); }
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand img { width: 44px; height: 44px; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 21px; font-weight: 900; letter-spacing: -.04em; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }
.main-nav { display: flex; align-items: center; gap: 7px; flex: 1; }
.nav-link { border: 0; background: transparent; color: #77758b; border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 700; transition: .18s ease; white-space: nowrap; }
.nav-link:hover { color: var(--purple); background: #f0effa; }
.nav-link.is-active { color: var(--purple); background: var(--purple-soft); }
.topbar-tools { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.level-pill { background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 8px 12px; color: #55526b; font-size: 12px; font-weight: 800; }
.level-dot { display: inline-block; width: 7px; height: 7px; background: var(--orange); border-radius: 50%; margin-left: 5px; vertical-align: 1px; }
.sync-state { color: var(--muted); font-size: 11px; font-weight: 600; }
.account-button { border: 0; border-radius: 11px; padding: 9px 12px; color: white; background: var(--purple); font-size: 11px; font-weight: 800; white-space: nowrap; transition: .18s ease; }
.account-button:hover { background: var(--purple-dark); transform: translateY(-1px); }
.account-button:focus-visible { outline: 3px solid rgba(255,184,77,.9); outline-offset: 2px; }
.app-main { min-height: 76vh; padding: 32px 0 54px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 26px; align-items: start; }
.primary { min-width: 0; }
.right-rail { display: grid; gap: 17px; position: sticky; top: 20px; }
.page-heading { margin: 0 0 22px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--purple); font-size: 12px; font-weight: 800; letter-spacing: .015em; }
.eyebrow-mark { width: 7px; height: 7px; border-radius: 2px; background: var(--orange); transform: rotate(45deg); }
.page-heading h1 { margin: 8px 0 4px; font-size: clamp(28px, 3vw, 38px); letter-spacing: -.04em; line-height: 1.16; }
.page-heading p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.home-hero { min-height: 284px; padding: 31px 34px; background: var(--purple); border-radius: 25px; color: white; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(210px, .88fr); gap: 18px; position: relative; overflow: hidden; box-shadow: 0 18px 36px rgba(70, 55, 175, .19); }
.home-hero::after { content: ''; position: absolute; width: 380px; height: 380px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; left: -120px; bottom: -245px; box-shadow: 0 0 0 25px rgba(255,255,255,.035), 0 0 0 58px rgba(255,255,255,.03); pointer-events: none; }
.hero-copy { align-self: center; position: relative; z-index: 1; }
.hero-kicker { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.13); padding: 7px 11px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.hero-copy h1 { max-width: 520px; margin: 16px 0 9px; font-size: clamp(30px, 3.5vw, 43px); letter-spacing: -.035em; line-height: 1.17; }
.hero-copy p { max-width: 500px; margin: 0; color: rgba(255,255,255,.8); font-size: 15px; line-height: 1.8; }
.hero-actions { display: flex; align-items: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 13px; min-height: 43px; padding: 0 17px; font-size: 13px; font-weight: 800; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-2px); }
.button:focus-visible, .nav-link:focus-visible, .word-button:focus-visible, .choice-button:focus-visible { outline: 3px solid rgba(255,184,77,.9); outline-offset: 2px; }
.button-primary { background: var(--orange); color: #37275c; box-shadow: 0 7px 15px rgba(26, 16, 92, .15); }
.button-primary:hover { background: #ffc96f; }
.button-on-purple { background: #fff; color: var(--purple-dark); }
.button-quiet { color: #fff; background: transparent; padding-inline: 8px; }
.button-outline { color: var(--purple); background: white; border: 1px solid #dedbf5; }
.button-soft { color: var(--purple-dark); background: var(--purple-soft); }
.button-dark { color: white; background: var(--purple-dark); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.hero-art { min-height: 220px; position: relative; display: flex; align-items: center; justify-content: center; }
.letter-board { width: 225px; height: 194px; position: relative; transform: rotate(-4deg); }
.letter-tile { position: absolute; display: grid; place-items: center; width: 91px; height: 91px; border-radius: 23px; color: var(--ink); font-size: 48px; font-weight: 900; box-shadow: 0 12px 20px rgba(31, 21, 103, .16); }
.letter-tile.tile-one { top: 7px; right: 4px; background: #ffc35f; transform: rotate(7deg); }
.letter-tile.tile-two { top: 57px; left: 2px; background: #fff; transform: rotate(-9deg); }
.letter-tile.tile-three { right: 49px; bottom: 1px; width: 67px; height: 67px; border-radius: 18px; background: #ed9fc1; font-size: 36px; transform: rotate(8deg); }
.board-sticker { position: absolute; left: 10px; top: 6px; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 15px; color: white; font-size: 20px; transform: rotate(-13deg); }
.hero-spark { position: absolute; right: 9px; bottom: 7px; width: 19px; height: 19px; background: #8ee4ce; clip-path: polygon(50% 0, 61% 36%, 100% 50%, 61% 64%, 50% 100%, 39% 64%, 0 50%, 39% 36%); }
.hero-caption { position: absolute; bottom: -1px; right: 50%; color: rgba(255,255,255,.75); font-size: 11px; white-space: nowrap; transform: translateX(50%); }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-top: 18px; }
.stat-card { min-height: 86px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); display: flex; align-items: center; gap: 13px; }
.stat-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; flex: 0 0 auto; font-size: 18px; font-weight: 900; }
.stat-icon.purple { background: var(--purple-soft); color: var(--purple); }
.stat-icon.orange { background: var(--orange-soft); color: #a56814; }
.stat-icon.mint { background: #e2f6ef; color: var(--green); }
.stat-label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.stat-value { display: block; margin-top: 2px; color: var(--ink); font-size: 20px; font-weight: 900; line-height: 1; }
.section-block { margin-top: 28px; }
.section-top { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.section-title { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: -.025em; }
.section-note { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.text-link { border: 0; color: var(--purple); background: transparent; font-size: 12px; font-weight: 800; white-space: nowrap; }
.next-lesson-card { display: flex; align-items: center; gap: 17px; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 4px 14px rgba(51, 44, 109, .025); }
.lesson-art { flex: 0 0 auto; width: 62px; height: 62px; display: grid; place-items: center; border-radius: 19px; background: #fce9c8; color: #6047bc; font-size: 32px; font-weight: 900; transform: rotate(-4deg); }
.next-copy { min-width: 0; flex: 1; }
.next-copy small { color: var(--purple); font-size: 11px; font-weight: 800; }
.next-copy h3 { margin: 3px 0; font-size: 17px; font-weight: 900; }
.next-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.lesson-cta { flex: 0 0 auto; }
.path-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.path-card { min-height: 148px; position: relative; border: 1px solid var(--line); border-radius: 18px; padding: 17px; background: #fff; cursor: pointer; transition: .18s ease; overflow: hidden; }
.path-card:hover { border-color: #c9c4f4; transform: translateY(-3px); box-shadow: var(--shadow); }
.path-number { width: 33px; height: 33px; border-radius: 11px; background: var(--purple-soft); color: var(--purple); display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.path-card h3 { margin: 13px 0 4px; font-size: 15px; font-weight: 900; }
.path-card p { margin: 0; max-width: 210px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.path-arrow { position: absolute; bottom: 15px; left: 16px; color: #b1accb; font-size: 18px; }
.path-card.is-done .path-number { background: #e2f6ef; color: var(--green); }
.vocab-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.vocab-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.vocab-top { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.vocab-word { margin: 0; font-size: 23px; font-weight: 900; }
.vocab-meaning { margin: 2px 0 0; color: var(--muted); font: 500 12px 'DM Sans', sans-serif; direction: ltr; text-align: right; }
.vocab-example { margin: 13px 0 0; padding-top: 10px; border-top: 1px dashed #e8e6f0; color: #666278; font-size: 12px; line-height: 1.7; }
.listen-button { width: 31px; height: 31px; border: 0; border-radius: 10px; color: var(--purple); background: var(--purple-soft); font-size: 14px; }
.rail-card { padding: 19px; border: 1px solid var(--line); border-radius: 19px; background: white; }
.rail-card h3 { margin: 0; font-size: 16px; font-weight: 900; }
.rail-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.profile-card { background: #fffbf4; border-color: #f4e8d5; }
.profile-top { display: flex; align-items: center; gap: 12px; }
.profile-avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 15px; background: var(--orange); color: #694719; font-size: 22px; font-weight: 900; transform: rotate(-4deg); }
.profile-meta small { color: var(--muted); font-size: 11px; }
.profile-meta strong { display: block; font-size: 16px; font-weight: 900; }
.profile-progress { margin-top: 15px; }
.progress-label { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; font-weight: 700; }
.progress-track { width: 100%; height: 8px; margin-top: 7px; border-radius: 20px; background: #eeedf4; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--purple); transition: width .3s ease; }
.goal-card { position: relative; overflow: hidden; background: #eeecff; border-color: #e1defd; }
.goal-card::after { content: 'ا'; position: absolute; left: 12px; bottom: -32px; color: rgba(91,75,206,.09); font-size: 118px; font-weight: 900; line-height: 1; }
.goal-top { display: flex; justify-content: space-between; gap: 10px; align-items: start; position: relative; z-index: 1; }
.goal-count { border-radius: 10px; padding: 5px 8px; color: var(--purple); background: white; font-size: 11px; font-weight: 900; white-space: nowrap; }
.goal-card .progress-track { background: rgba(255,255,255,.7); position: relative; z-index: 1; }
.goal-card .progress-fill { background: var(--orange); }
.tip-card { border: 0; background: #24213b; color: white; }
.tip-card h3 { color: white; }
.tip-card p { color: rgba(255,255,255,.7); }
.tip-badge { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.tip-word { display: inline-block; margin-top: 11px; color: #fff; font-size: 26px; font-weight: 900; }
.tip-translation { display: inline-block; margin-right: 8px; color: #c9c5e3; font: 500 12px 'DM Sans', sans-serif; }
.tip-card .listen-button { background: rgba(255,255,255,.12); color: white; margin-right: 8px; }
.lesson-grid { display: grid; gap: 12px; }
.lesson-row { display: flex; align-items: center; gap: 15px; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.lesson-row .lesson-art { width: 51px; height: 51px; border-radius: 16px; font-size: 26px; }
.lesson-row-copy { flex: 1; min-width: 0; }
.lesson-row-copy small { color: var(--purple); font-size: 11px; font-weight: 800; }
.lesson-row-copy h3 { margin: 3px 0; font-size: 16px; font-weight: 900; }
.lesson-row-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.done-mark { color: var(--green); font-size: 12px; font-weight: 900; }
.lesson-body { padding: 23px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.lesson-body h2 { margin: 0 0 6px; font-size: 24px; }
.lesson-body > p { margin: 0; color: var(--muted); line-height: 1.8; }
.letter-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.letter-sample { min-width: 77px; padding: 12px 13px; border-radius: 15px; background: #f2f0ff; text-align: center; }
.letter-sample strong { display: block; font-size: 32px; font-weight: 900; color: var(--purple); }
.letter-sample span { color: var(--muted); font: 500 11px 'DM Sans', sans-serif; }
.example-list { display: grid; gap: 10px; margin: 19px 0 0; }
.example-line { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 14px; border-radius: 13px; background: #f8f7fb; }
.example-line strong { font-size: 18px; }
.example-line span { color: var(--muted); font: 500 12px 'DM Sans', sans-serif; direction: ltr; text-align: left; }
.lesson-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 23px; }
.vocabulary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.vocabulary-grid .vocab-card { min-height: 132px; padding: 17px; }
.vocab-tag { display: inline-block; margin-top: 12px; padding: 4px 8px; border-radius: 8px; color: #625e79; background: #f4f3f8; font-size: 10px; font-weight: 700; }
.practice-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.mode-switch { display: flex; flex-wrap: wrap; gap: 7px; }
.mode-button { border: 1px solid var(--line); border-radius: 11px; background: white; color: #76738a; padding: 8px 12px; font-size: 12px; font-weight: 800; }
.mode-button.active { color: var(--purple); border-color: #d9d5fc; background: var(--purple-soft); }
.exercise-card { padding: 25px; border: 1px solid var(--line); border-radius: 22px; background: white; }
.exercise-meta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 800; }
.exercise-meta strong { color: var(--purple); }
.question-prompt { margin: 20px 0 5px; font-size: 25px; font-weight: 900; line-height: 1.3; }
.question-hint { margin: 0 0 17px; color: var(--muted); font: 500 13px 'DM Sans', sans-serif; direction: ltr; text-align: right; }
.choice-list { display: grid; gap: 9px; margin: 18px 0; }
.choice-button { width: 100%; display: flex; align-items: center; justify-content: space-between; text-align: right; border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 12px 14px; color: var(--ink); font-size: 15px; font-weight: 700; }
.choice-button.selected { border-color: #a9a0f0; background: #f4f2ff; color: var(--purple-dark); }
.choice-button.correct { border-color: #95d7bd; background: #eaf8f2; color: #176d50; }
.choice-button.incorrect { border-color: #f3b3b5; background: #fff1f0; color: #ab4242; }
.choice-prefix { color: #aaa7b9; font: 700 12px 'DM Sans', sans-serif; }
.feedback-box { margin: 15px 0; padding: 13px 15px; border-radius: 13px; font-size: 13px; font-weight: 700; line-height: 1.7; }
.feedback-box.good { background: #eaf8f2; color: #176d50; }
.feedback-box.try { background: #fff4e4; color: #80571e; }
.exercise-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 19px; }
.match-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 19px 0; }
.match-column { display: grid; align-content: start; gap: 8px; }
.match-label { color: var(--muted); font-size: 10px; font-weight: 800; }
.match-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: white; text-align: center; font-size: 13px; font-weight: 800; }
.match-item.selected { color: var(--purple); border-color: #bdb6f5; background: var(--purple-soft); }
.match-item.matched { color: var(--green); border-color: #c9e9dc; background: #eef9f4; }
.match-item:disabled { cursor: default; }
.order-slots { min-height: 50px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border: 1px dashed #cbc7df; border-radius: 13px; margin: 18px 0 12px; }
.order-slots:empty::before { content: 'اضغط الكلمات لبناء الجملة'; color: #aaa7b8; font-size: 12px; }
.word-button { border: 1px solid #dedbf7; border-radius: 10px; padding: 8px 12px; color: var(--purple-dark); background: var(--purple-soft); font-size: 15px; font-weight: 800; }
.word-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.word-button.used { opacity: .4; text-decoration: line-through; }
.assistant-panel { min-height: 480px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 21px; background: white; }
.assistant-header { display: flex; align-items: center; gap: 12px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.assistant-avatar { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 15px; background: var(--purple); color: white; font-size: 21px; font-weight: 900; }
.assistant-header h2 { margin: 0; font-size: 16px; }
.assistant-header p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.assistant-dot { width: 8px; height: 8px; margin-right: auto; border-radius: 50%; background: #39bd8b; box-shadow: 0 0 0 4px #e5f7f0; }
.chat-messages { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 19px; min-height: 300px; max-height: 450px; overflow: auto; }
.chat-bubble { max-width: 84%; padding: 12px 14px; border-radius: 15px; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.chat-bubble.assistant { align-self: flex-start; border-top-right-radius: 5px; background: #f3f1ff; color: #383359; }
.chat-bubble.user { align-self: flex-end; border-top-left-radius: 5px; color: white; background: var(--purple); }
.chat-bubble.pending { color: var(--muted); font-style: italic; }
.suggestion-row { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 19px 13px; }
.suggestion-chip { border: 1px solid #e4e1f5; border-radius: 99px; padding: 7px 11px; background: white; color: var(--purple); font-size: 11px; font-weight: 700; }
.chat-compose { display: flex; align-items: end; gap: 9px; padding: 13px; border-top: 1px solid var(--line); background: #fcfcfe; }
.chat-compose textarea { flex: 1; min-height: 43px; max-height: 110px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; outline: none; color: var(--ink); background: white; font-size: 13px; }
.chat-compose textarea:focus { border-color: #aaa2ef; box-shadow: 0 0 0 3px rgba(91,75,206,.08); }
.chat-note { margin: 0; padding: 0 16px 12px; color: #9996a8; font-size: 10px; text-align: center; }
.empty-state { padding: 30px; border: 1px dashed #d8d5e6; border-radius: 17px; text-align: center; color: var(--muted); }
.toast { position: fixed; bottom: 22px; right: 50%; z-index: 10; padding: 11px 16px; border-radius: 12px; color: white; background: #25223b; box-shadow: var(--shadow); font-size: 13px; font-weight: 800; opacity: 0; transform: translate(50%, 12px); pointer-events: none; transition: .22s ease; }
.toast.visible { opacity: 1; transform: translate(50%, 0); }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 0 22px; border-top: 1px solid var(--line); color: #9794a7; font-size: 11px; }
.footer-contact-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-contact-link { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color: var(--purple); background: #fff; font-size: 11px; font-weight: 800; white-space: nowrap; transition: .18s ease; }
.contact-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.footer-contact-link:hover .contact-icon { transform: scale(1.08); }
.footer-contact-link:hover { transform: translateY(-1px); border-color: #c9c4f4; background: var(--purple-soft); }
.footer-contact-link:focus-visible { outline: 3px solid rgba(255,184,77,.9); outline-offset: 2px; }
.whatsapp-link { color: #167c4c; border-color: #d7f0e3; background: #f0faf5; }
.whatsapp-link:hover { border-color: #acdcbc; background: #e6f7ed; }
.footer-mark { color: var(--purple); font-size: 14px; font-weight: 900; }
.loading-page { padding: 65px 15px; text-align: center; color: var(--muted); }

@media (max-width: 1050px) {
  .site-shell { padding: 0 25px; }
  .topbar { gap: 20px; }
  .main-nav { gap: 1px; }
  .nav-link { padding-inline: 10px; }
  .layout { grid-template-columns: minmax(0, 1fr) 255px; gap: 17px; }
  .right-rail { gap: 12px; }
}
@media (max-width: 820px) {
  .site-shell { padding: 0 20px; }
  .topbar { min-height: auto; padding: 15px 0 10px; flex-wrap: wrap; gap: 12px; }
  .brand { margin-left: auto; }
  .topbar-tools { margin-right: 0; }
  .main-nav { order: 3; flex: 1 0 100%; overflow: auto; padding-bottom: 3px; }
  .nav-link { flex: 0 0 auto; }
  .layout { grid-template-columns: 1fr; }
  .right-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); position: static; }
  .tip-card { grid-column: 1 / -1; }
  .home-hero { grid-template-columns: minmax(0, 1fr) 220px; padding: 27px; }
}
@media (max-width: 600px) {
  .site-shell { padding: 0 14px; }
  .topbar { gap: 8px; }
  .brand img { width: 39px; height: 39px; }
  .brand-copy strong { font-size: 18px; }
  .brand-copy small { font-size: 10px; }
  .level-pill { padding: 7px 9px; font-size: 10px; }
  .sync-state { display: none; }
  .account-button { padding: 7px 9px; font-size: 10px; }
  .main-nav { margin-inline: -3px; gap: 0; }
  .nav-link { font-size: 12px; padding: 9px 11px; }
  .app-main { padding-top: 22px; }
  .home-hero { grid-template-columns: 1fr; min-height: 0; padding: 24px 21px; }
  .hero-copy { order: 1; }
  .hero-art { order: 0; min-height: 140px; }
  .letter-board { transform: scale(.75) rotate(-4deg); height: 145px; }
  .hero-caption { bottom: -5px; }
  .hero-copy h1 { font-size: 31px; }
  .hero-copy p { font-size: 13px; }
  .hero-actions { margin-top: 17px; }
  .stats-row { gap: 8px; }
  .stat-card { padding: 10px; min-height: 76px; gap: 8px; }
  .stat-icon { width: 32px; height: 32px; border-radius: 11px; font-size: 15px; }
  .stat-label { font-size: 9px; }
  .stat-value { font-size: 17px; }
  .section-title { font-size: 18px; }
  .section-note { font-size: 10px; }
  .next-lesson-card { flex-wrap: wrap; padding: 15px; gap: 12px; }
  .next-copy { flex-basis: calc(100% - 78px); }
  .lesson-cta { width: 100%; }
  .lesson-cta .button { width: 100%; }
  .path-grid, .vocab-preview { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .path-card { min-height: 137px; padding: 14px; }
  .path-card:last-child { grid-column: 1 / -1; }
  .vocabulary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .vocabulary-grid .vocab-card { padding: 13px; min-height: 125px; }
  .vocab-word { font-size: 20px; }
  .vocab-meaning { font-size: 10px; }
  .vocab-example { font-size: 11px; }
  .right-rail { grid-template-columns: 1fr 1fr; }
  .rail-card { padding: 15px; }
  .profile-card { grid-column: 1 / -1; }
  .lesson-row { padding: 12px; gap: 10px; }
  .lesson-row .lesson-art { width: 43px; height: 43px; font-size: 22px; }
  .lesson-row-copy h3 { font-size: 14px; }
  .lesson-row-copy p { font-size: 10px; }
  .lesson-row .button { padding-inline: 11px; min-height: 38px; font-size: 11px; }
  .lesson-body { padding: 17px; }
  .lesson-body h2 { font-size: 21px; }
  .example-line { align-items: start; }
  .example-line strong { font-size: 15px; }
  .example-line span { font-size: 10px; }
  .practice-top { align-items: start; flex-direction: column; }
  .exercise-card { padding: 18px 14px; }
  .question-prompt { font-size: 21px; }
  .match-columns { gap: 8px; }
  .match-item { font-size: 11px; padding: 10px 5px; }
  .assistant-panel { min-height: 560px; }
  .chat-bubble { max-width: 94%; }
  .site-footer { flex-wrap: wrap; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}


.language-button { border: 1px solid var(--line); border-radius: 11px; padding: 8px 11px; color: var(--purple); background: white; font-size: 11px; font-weight: 800; white-space: nowrap; transition: .18s ease; }
.language-button:hover { color: var(--purple-dark); border-color: #c9c4f4; background: var(--purple-soft); }
.language-button:focus-visible { outline: 3px solid rgba(255,184,77,.9); outline-offset: 2px; }
html[lang="en"] { font-family: 'DM Sans', 'Tajawal', sans-serif; }
html[dir="ltr"] .brand { margin-left: 0; margin-right: 0; }
html[dir="ltr"] .level-dot { margin-left: 0; margin-right: 5px; }
html[dir="ltr"] .path-arrow { left: auto; right: 16px; transform: scaleX(-1); }
html[dir="ltr"] .tip-translation { margin-right: 0; margin-left: 8px; }
html[dir="ltr"] .tip-card .listen-button { margin-right: 0; margin-left: 8px; }
html[dir="ltr"] .vocab-meaning { text-align: left; }
html[dir="ltr"] .question-hint { direction: ltr; text-align: left; }
html[dir="ltr"] .choice-button { text-align: left; }
html[dir="ltr"] .assistant-dot { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .chat-bubble.assistant { border-top-left-radius: 5px; border-top-right-radius: 15px; }
html[dir="ltr"] .chat-bubble.user { border-top-right-radius: 5px; border-top-left-radius: 15px; }
html[dir="ltr"] .hero-caption { right: auto; left: 50%; transform: translateX(-50%); }
html[dir="ltr"] .toast { right: auto; left: 50%; transform: translate(-50%, 12px); }
html[dir="ltr"] .toast.visible { transform: translate(-50%, 0); }
@media (max-width: 600px) {
  .language-button { padding: 7px 9px; font-size: 10px; }
}
@media (max-width: 820px) {
  html[dir="ltr"] .brand { margin-right: auto; }
}
.tip-translation-example { display: inline-block; margin-top: 4px; color: rgba(255,255,255,.7); font: 500 11px 'DM Sans', sans-serif; }
