/* ============================================================
   جمله — استایل‌ها (RTL، موبایل‌اول، تم روشن/تاریک)
   ============================================================ */
:root {
  --brand: #0fb5a8;
  --brand-d: #077a72;
  /* رنگ دکمه‌ها و نوار بالا: تضاد کافی با متن (WCAG AA) */
  --btn: #087a71; --btn-d: #055a54; --btn-ink: #ffffff;
  --ok-ink: #0b6a42; --bad-ink: #a3191f;
  --w: 640px;
  --brand-soft: #d9f4f1;
  --bg: #f4fbfa;
  --card: #ffffff;
  --ink: #12302e;
  --muted: #5d7a78;
  --line: #d6e6e4;
  --gold: #f5b942;
  --ok: #22a06b; --ok-bg: #dcf6e9;
  --bad: #e5484d; --bad-bg: #fde4e4;
  --der: #2f7ff0; --die: #e5484d; --das: #22a06b;
  --shadow: 0 2px 0 rgba(10, 80, 75, .08), 0 8px 24px rgba(10, 80, 75, .08);
  --radius: 18px;
  --font: Vazirmatn, "Segoe UI", Tahoma, system-ui, -apple-system, "Noto Sans Arabic", sans-serif;
  --font-de: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
:root[data-theme="dark"] {
  --btn: #2dd4c4; --btn-d: #14a698; --btn-ink: #04201d; --ok-ink: #3ecf8e; --bad-ink: #ff7276;
  --brand: #2dd4c4; --brand-d: #14b8a6; --brand-soft: #123a3a;
  --bg: #0d1a1c; --card: #14272a; --ink: #e6f4f2; --muted: #8fb0ad; --line: #24403f;
  --ok: #3ecf8e; --ok-bg: #12382b; --bad: #ff7276; --bad-bg: #3d1d20;
  --der: #6aa6ff; --die: #ff7276; --das: #3ecf8e;
  --shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --btn: #2dd4c4; --btn-d: #14a698; --btn-ink: #04201d; --ok-ink: #3ecf8e; --bad-ink: #ff7276;
    --brand: #2dd4c4; --brand-d: #14b8a6; --brand-soft: #123a3a;
    --bg: #0d1a1c; --card: #14272a; --ink: #e6f4f2; --muted: #8fb0ad; --line: #24403f;
    --ok: #3ecf8e; --ok-bg: #12382b; --bad: #ff7276; --bad-bg: #3d1d20;
    --der: #6aa6ff; --die: #ff7276; --das: #3ecf8e;
    --shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.75;
  min-height: 100vh; min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .5em; }
h3 { font-size: 1.2rem; } h4 { font-size: 1rem; margin-top: 1.2em; color: var(--brand-d); }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); font-size: .9rem; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

/* متن آلمانی (چپ‌به‌راست) داخل صفحهٔ راست‌به‌چپ */
.de { direction: ltr; unicode-bidi: isolate; font-family: var(--font-de); display: inline-block; }
td.de, th.de { display: table-cell; text-align: left; }

.app { max-width: var(--w); margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

/* ── نوار بالا ── */
.top {
  position: sticky; top: 0; z-index: 10; margin: 0 0 14px; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(135deg, var(--btn), var(--btn-d)); color: var(--btn-ink);
  box-shadow: 0 4px 16px rgba(10, 143, 134, .25);
}
.top-in { max-width: var(--w); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 800; font-size: 1.3rem; display: flex; align-items: center; gap: 8px; }
.brand small { font-weight: 500; font-size: .75rem; opacity: .85; }
.stats { display: flex; gap: 8px; }
.chip { background: rgba(0, 0, 0, .22); color: #fff; border-radius: 999px; padding: 2px 12px; font-weight: 700; font-size: .95rem; white-space: nowrap; }

/* ── کارت‌ها ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.goal { display: flex; flex-direction: column; gap: 8px; }
.goal-row { display: flex; justify-content: space-between; font-weight: 700; }
.bar { height: 12px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--gold)); border-radius: 99px; transition: width .35s ease; }

.hero { background: linear-gradient(135deg, var(--brand-soft), var(--card)); }
.hero h2 { font-size: 1.25rem; }
.hero .btn { margin: 6px 0 0 8px; }

/* ── مسیر یادگیری ── */
.level-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 6px; }
details.level > summary { list-style: none; cursor: pointer; }
details.level > summary::-webkit-details-marker { display: none; }
details.level > summary::after { content: '▾'; color: var(--muted); font-size: 1.1rem; transition: transform .15s; }
details.level:not([open]) > summary::after { transform: rotate(90deg); }
.level-badge { background: var(--btn); color: var(--btn-ink); font-weight: 800; border-radius: 12px; padding: 2px 12px; font-family: var(--font-de); }
.level-head .sub { color: var(--muted); font-size: .9rem; }
.unit-title { margin: 14px 4px 6px; font-weight: 800; font-size: 1.05rem; }
.lesson {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: right;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s;
}
.lesson:hover { transform: translateY(-2px); border-color: var(--brand); }
.lesson.next { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.l-ico { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; background: var(--brand-soft); color: var(--brand-d); font-weight: 800; }
.lesson.done .l-ico { background: var(--ok-bg); color: var(--ok); }
.l-txt { flex: 1; min-width: 0; }
.l-title { font-weight: 800; }
.l-desc { color: var(--muted); font-size: .85rem; direction: rtl; }
.l-tag { flex: none; font-size: .8rem; font-weight: 700; color: var(--brand-d); }

.soon-card { opacity: .85; border-style: dashed; }
.soon-card ul { margin: .5em 0 0; padding: 0 20px 0 0; color: var(--muted); font-size: .92rem; }

/* ── ناوبری پایین ── */
.nav {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 20; background: var(--card);
  border-top: 1px solid var(--line); display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-inner { display: flex; width: 100%; max-width: min(var(--w), 720px); }
.nav button { flex: 1; border: 0; background: none; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: .8rem; font-weight: 700; position: relative; }
.nav button .i { font-size: 1.4rem; line-height: 1; }
.nav button.on { color: var(--brand-d); }
:root[data-theme="dark"] .nav button.on { color: var(--brand); }
.badge { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 99px; font-size: .7rem; padding: 0 6px; min-width: 18px; line-height: 18px; }

/* ── دکمه‌ها ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 12px 22px; font-weight: 800; font-size: 1rem;
  background: var(--btn); color: var(--btn-ink); box-shadow: 0 4px 0 var(--btn-d); transition: transform .08s, box-shadow .08s;
  letter-spacing: .01em;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-d); }
.btn:disabled { background: var(--line); color: var(--ink); opacity: .75; box-shadow: none; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--brand-d); box-shadow: inset 0 0 0 2px var(--line); }
.btn.danger { background: var(--bad); box-shadow: 0 4px 0 #b3363a; }
.btn.small { padding: 6px 14px; font-size: .9rem; border-radius: 10px; box-shadow: none; }
.icon-btn { border: 0; background: none; font-size: 1.4rem; padding: 6px 10px; border-radius: 10px; color: var(--muted); }
.spk { border: 0; background: var(--brand-soft); color: var(--brand-d); border-radius: 50%; width: 42px; height: 42px; font-size: 1.15rem; flex: none; }
.spk.big { width: 84px; height: 84px; font-size: 2.2rem; }

/* ── محیط درس ── */
.lesson-wrap { max-width: min(var(--w), 820px); margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 16px; }
.lesson-top { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 0 12px; }
.lesson-top .bar { flex: 1; height: 14px; }
.lesson-body { flex: 1; padding: 8px 0 24px; }
.lesson-foot { position: sticky; bottom: 0; margin: 0 -16px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: transparent; }
.foot-row { display: flex; gap: 10px; }
.foot-row .btn { flex: 1; }
.foot-row .btn.ghost { flex: 0 0 auto; }
.fb { margin: -12px -16px 12px; padding: 14px 16px; }
.fb.ok { background: var(--ok-bg); color: var(--ok-ink); }
.fb.bad { background: var(--bad-bg); color: var(--bad-ink); }
.fb b { display: block; font-size: 1.1rem; }
.fb-t .de { display: inline-block; }
.fb .ans { color: var(--ink); margin-top: 2px; }
.fb .note { color: var(--ink); font-size: .92rem; margin-top: 4px; opacity: .9; }

.q-title { font-weight: 800; font-size: 1.15rem; margin-bottom: 14px; }
.q-fa { font-size: 1.1rem; margin-bottom: 14px; font-weight: 700; }
.sentence { font-size: 1.5rem; font-weight: 700; margin: 4px 0 18px; display: block; direction: ltr; text-align: left; line-height: 1.6; }
.blank { display: inline-block; min-width: 70px; border-bottom: 3px solid var(--brand); text-align: center; color: var(--brand-d); margin: 0 4px; }
.speak-row { display: flex; justify-content: center; margin: 14px 0 22px; }

.opts { display: grid; gap: 10px; }
.opt {
  text-align: start; background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 16px; font-weight: 700; box-shadow: 0 3px 0 var(--line); transition: transform .08s;
  display: flex; align-items: center; gap: 10px;
}
.opt.ltr { direction: ltr; justify-content: flex-start; font-family: var(--font-de); }
.opt .k { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; color: var(--muted); font-family: var(--font-de); }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 3px 0 var(--brand); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 3px 0 var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 3px 0 var(--bad); }
.opt:disabled { cursor: default; }

/* artikel */
.art { display: inline-block; font-family: var(--font-de); font-weight: 800; padding: 0 8px; border-radius: 8px; color: #fff; line-height: 1.5; direction: ltr; }
.art.der { background: var(--der); } .art.die { background: var(--die); } .art.das { background: var(--das); }
.art-der { color: var(--der); } .art-die { color: var(--die); } .art-das { color: var(--das); }
.opts.arts-3 { grid-template-columns: repeat(3, 1fr); }
.opt.artbtn { justify-content: center; font-size: 1.3rem; }
.opt.artbtn.der.sel, .opt.artbtn.der.right { color: var(--der); } .opt.artbtn.die.sel, .opt.artbtn.die.right { color: var(--die); } .opt.artbtn.das.sel, .opt.artbtn.das.right { color: var(--das); }
.big-word { font-size: 2.2rem; font-weight: 800; text-align: center; margin: 12px 0 22px; direction: ltr; }
.arts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 14px; }
.art-card { border-radius: 14px; padding: 12px 8px; text-align: center; color: #fff; display: flex; flex-direction: column; font-family: var(--font-de); }
.art-card b { font-size: 1.4rem; } .art-card span { font-family: var(--font); font-size: .85rem; opacity: .95; }
.art-card.der { background: var(--der); } .art-card.die { background: var(--die); } .art-card.das { background: var(--das); }

/* ترتیب جمله */
.order-area { direction: ltr; min-height: 64px; border-bottom: 2px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 12px; align-items: center; margin-bottom: 18px; }
.order-area .end { font-size: 1.4rem; font-weight: 800; color: var(--muted); }
.order-bank { direction: ltr; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tile { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 8px 16px; font-weight: 700; font-size: 1.1rem; box-shadow: 0 3px 0 var(--line); font-family: var(--font-de); }
.tile.ghost { visibility: hidden; }
.order-area .tile { border-color: var(--brand); }

/* تایپ */
.type-in { width: 100%; font: inherit; font-family: var(--font-de); font-size: 1.25rem; direction: ltr; text-align: left; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.type-in:focus { border-color: var(--brand); outline: none; }
.type-in.right { border-color: var(--ok); } .type-in.wrong { border-color: var(--bad); }
.chars { display: flex; gap: 8px; justify-content: center; margin-top: 12px; direction: ltr; }
.chars button { border: 2px solid var(--line); background: var(--card); border-radius: 10px; width: 48px; height: 44px; font-size: 1.2rem; font-weight: 700; font-family: var(--font-de); box-shadow: 0 3px 0 var(--line); }

/* جفت‌کردن */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.mbtn { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 8px; font-weight: 700; min-height: 54px; box-shadow: 0 3px 0 var(--line); font-size: .95rem; }
.mbtn.de { display: block; text-align: center; }
.mbtn.sel { border-color: var(--brand); background: var(--brand-soft); }
.mbtn.done { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); opacity: .6; pointer-events: none; }
.mbtn.shake { animation: shake .3s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(6px); } 75% { transform: translateX(-6px); } }

/* مقدمه و واژگان */
.intro { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.intro ul { padding: 0 20px 0 0; margin: 0 0 .8em; }
.intro li { margin-bottom: .4em; }
.list { list-style: none; padding: 0 !important; }
.list li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.tbl { width: 100%; border-collapse: collapse; margin: .6em 0 1em; font-size: .95rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 6px 10px; text-align: right; }
/* جدول‌های عریض روی صفحهٔ کوچک اسکرول افقی بگیرند، نه اینکه کل صفحه را بشکنند */
.tbl { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl > tbody, .tbl > thead { display: table; width: 100%; }
@media (max-width: 400px) { .tbl { font-size: .85rem; } .tbl th, .tbl td { padding: 5px 6px; } }
.tbl th { background: var(--brand-soft); }
.tip { background: var(--brand-soft); border-radius: 14px; padding: 12px 14px; margin: 12px 0 0; font-size: .95rem; }
.tip.warn { background: #fff4d6; color: #5a4300; }
:root[data-theme="dark"] .tip.warn { background: #3a3014; color: #ffe29a; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .tip.warn { background: #3a3014; color: #ffe29a; } }

.vocab { display: grid; gap: 8px; margin-bottom: 12px; }
.vrow { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; text-align: right; width: 100%; }
.vrow .w { flex: 1; min-width: 0; }
.vrow .w .de { font-weight: 800; font-size: 1.1rem; }
.vrow .w .p { color: var(--muted); font-size: .85rem; }
.vrow .m { color: var(--muted); font-size: .95rem; text-align: left; flex: 1; }

/* پایان درس */
.done-box { text-align: center; padding: 30px 0; }
.done-box .big { font-size: 4rem; }
.done-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 4px; }
.stat b { display: block; font-size: 1.5rem; color: var(--brand-d); }
:root[data-theme="dark"] .stat b { color: var(--brand); }

/* مرور (فلش‌کارت) */
.flash { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; cursor: pointer; }
.flash .front { font-size: 2rem; font-weight: 800; direction: ltr; }
.flash .back { font-size: 1.4rem; color: var(--brand-d); font-weight: 700; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade { border: 0; border-radius: 12px; padding: 10px 2px; color: #fff; font-weight: 800; font-size: .9rem; display: flex; flex-direction: column; gap: 2px; }
.grade small { font-weight: 500; opacity: .9; font-size: .72rem; }
.g0 { background: #e5484d; } .g1 { background: #f08a24; } .g2 { background: #22a06b; } .g3 { background: #2f7ff0; }

/* پروفایل */
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
select { font: inherit; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }

#toast { position: fixed; bottom: 90px; inset-inline: 16px; margin: 0 auto; max-width: 420px; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; text-align: center; font-weight: 700; opacity: 0; transform: translateY(10px); transition: all .25s; pointer-events: none; z-index: 50; }
#toast.show { opacity: 1; transform: none; }

/* ============================================================
   لایهٔ جذابیت: ماسکوت، انیمیشن‌ها، تصاویر، داستان، نمایش‌های گرامری
   ============================================================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } 60% { transform: translateY(-4px); } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(34, 160, 107, .5); } 100% { box-shadow: 0 0 0 14px rgba(34, 160, 107, 0); } }
@keyframes flame { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.18) rotate(-6deg); } }
@keyframes fall { to { transform: translate(var(--dx), 108vh) rotate(var(--r)); } }
@keyframes xpFloat { 0% { opacity: 0; transform: translateY(8px) scale(.8); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-34px) scale(1.15); } }
@keyframes tokEnter { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }
@keyframes tokChange { 0% { box-shadow: 0 0 0 0 var(--brand); } 100% { box-shadow: 0 0 0 12px rgba(15, 181, 168, 0); } }
@keyframes ballFly { 0% { left: 34px; bottom: 82px; transform: rotate(-12deg); } 45% { left: 110px; bottom: 124px; } 100% { left: 178px; bottom: 62px; transform: rotate(0); } }
@keyframes run { to { left: calc(100% - 54px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

.lesson-body { animation: fadeUp .3s ease; }
.opt.right { animation: pulseRing .6s ease-out; }
.chip.flame-on span.fl { display: inline-block; animation: flame 1.2s ease-in-out infinite; }

/* ماسکوت */
.mascot { width: 100%; height: 100%; display: block; overflow: visible; }
.fb { display: flex; align-items: flex-start; gap: 12px; position: relative; }
.fb-m { flex: none; width: 54px; height: 54px; animation: popIn .4s ease; }
.fb.bad .fb-m { animation: wiggle .5s ease 1; }
.fb-t { flex: 1; min-width: 0; }
.xp-pop { position: absolute; top: 8px; inset-inline-end: 14px; font-weight: 800; color: var(--ok); animation: xpFloat 1.2s ease-out forwards; pointer-events: none; }
.combo { position: absolute; bottom: 8px; inset-inline-end: 14px; background: #fff1d6; color: #8a4b00; border-radius: 99px; padding: 0 10px; font-size: .8rem; font-weight: 800; animation: popIn .4s ease; }
:root[data-theme="dark"] .combo { background: #3a2a10; color: #ffcf7a; }
.done-m { width: 130px; height: 130px; margin: 0 auto 6px; animation: bounce 1.1s ease 2; }
.done-msg { font-size: 1.1rem; font-weight: 800; color: var(--brand-d); }
:root[data-theme="dark"] .done-msg { color: var(--brand); }

/* تصاویر */
.pic-big { font-size: 5.2rem; line-height: 1.1; text-align: center; margin: 6px 0 20px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .15)); }
.pic-big.pop { animation: popIn .45s ease; }
.pic-sm { font-size: 1.25em; vertical-align: -.1em; }
.flash .pic-big { margin: 0; font-size: 4.4rem; }
.vem { flex: none; width: 2rem; text-align: center; font-size: 1.5rem; }
.vrow .w .de { max-width: 100%; overflow-wrap: anywhere; }
.vrow .w { flex: 2; }
@media (max-width: 380px) {
  .vrow { gap: 8px; padding: 8px; }
  .vrow .spk { width: 34px; height: 34px; font-size: 1rem; }
  .vem { width: 1.6rem; font-size: 1.25rem; }
  .vrow .w .de { font-size: 1rem; }
  .vrow .m { font-size: .85rem; }
}

/* جالب بدانیم */
.fun { display: flex; gap: 12px; align-items: flex-start; background: linear-gradient(135deg, #fff8e1, var(--card)); border: 1px solid #f3dd9a; border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; }
:root[data-theme="dark"] .fun { background: linear-gradient(135deg, #2e2812, var(--card)); border-color: #5b4d18; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .fun { background: linear-gradient(135deg, #2e2812, var(--card)); border-color: #5b4d18; } }
.fun p { margin: 4px 0 0; font-size: .95rem; }
.fun-m { flex: none; width: 54px; height: 54px; }

/* داستان */
.scene-line { background: var(--brand-soft); border-radius: 12px; padding: 8px 12px; font-size: .95rem; }
.story-ctl { display: flex; gap: 8px; margin: 10px 0 4px; }
.story { padding: 4px 0 20px; }
.bubble { display: flex; gap: 10px; margin: 12px 0; opacity: 0; animation: fadeUp .5s ease forwards; animation-delay: var(--d, 0s); cursor: pointer; }
.bubble.other { flex-direction: row-reverse; }
.bubble .av { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: var(--card); border: 2px solid var(--line); }
.bubble .bb { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px; max-width: 82%; box-shadow: var(--shadow); }
.bubble.me .bb { background: var(--brand-soft); }
.bubble .who { font-size: .78rem; color: var(--muted); font-family: var(--font-de); }
.bubble .bde { display: block; font-size: 1.05rem; font-weight: 700; text-align: left; margin-top: 2px; }
.bubble .btr { display: none; color: var(--muted); font-size: .9rem; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 6px; }
.bubble.open .btr, .story.all-tr .btr { display: block; }
.bubble.speaking .bb { box-shadow: 0 0 0 3px var(--brand); }

/* نمایش‌های متحرک گرامر */
.demo { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; box-shadow: var(--shadow); }
.demo h4 { margin: 0 0 8px; }
.demo-stage { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; min-height: 64px; padding: 10px 4px; border-radius: 12px; background: var(--bg); transition: background .3s; }
.demo-stage.is-bad { background: var(--bad-bg); }
.demo-stage.is-good { background: var(--ok-bg); }
.tok { font-family: var(--font-de); font-weight: 800; font-size: 1.1rem; padding: 6px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); display: inline-block; will-change: transform; }
.tok.s { border-color: #2f7ff0; background: rgba(47, 127, 240, .12); }
.tok.v { border-color: #e5484d; background: rgba(229, 72, 77, .12); }
.tok.o { border-color: #22a06b; background: rgba(34, 160, 107, .12); }
.tok.p { border-color: #f08a24; background: rgba(240, 138, 36, .15); }
.tok.c { border-color: #8b5cf6; background: rgba(139, 92, 246, .14); }
.tok.enter { animation: tokEnter .5s ease; }
.tok.changed { animation: tokChange .8s ease-out; }
.demo-stage.is-bad .tok.p { text-decoration: line-through; text-decoration-color: var(--bad); }
.demo-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin: 10px 0 6px; flex-wrap: wrap; }
.state-chip { background: var(--brand); color: #fff; font-weight: 800; border-radius: 99px; padding: 0 12px; font-size: .85rem; }
.demo-fa { color: var(--muted); font-size: .92rem; }
.demo-ctl { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-cap { text-align: center; font-weight: 700; margin: 8px 0; min-height: 1.6em; }
.demo-cap small { color: var(--muted); font-weight: 500; }
.scene-box { position: relative; width: 280px; max-width: 100%; height: 130px; margin: 0 auto; background: linear-gradient(#dff6f3, var(--card) 70%); border-radius: 14px; overflow: hidden; }
:root[data-theme="dark"] .scene-box { background: linear-gradient(#123a3a, var(--card) 70%); }
.sc-person { position: absolute; left: 10px; bottom: 16px; font-size: 2.4rem; }
.sc-table { position: absolute; left: 128px; bottom: 14px; width: 130px; height: 50px; border-top: 8px solid #b07a45; box-sizing: border-box; }
.sc-table::before, .sc-table::after { content: ''; position: absolute; top: 0; width: 8px; height: 42px; background: #8a5a2b; }
.sc-table::before { left: 8px; } .sc-table::after { right: 8px; }
.sc-obj { position: absolute; font-size: 1.7rem; left: 178px; bottom: 62px; }
.sc-obj.fly { animation: ballFly 1.4s ease-in-out forwards; }
.race { height: 108px; padding: 0; }
.race .lane { position: absolute; left: 0; right: 40px; height: 44px; border-bottom: 2px dashed var(--line); }
.race .lane:nth-child(1) { top: 4px; } .race .lane:nth-child(2) { top: 56px; }
.race .veh { position: absolute; left: 0; top: 2px; font-size: 2rem; }
.race .flag { position: absolute; right: 6px; top: 36px; font-size: 1.7rem; }
.race.go .train { animation: run 2s linear forwards; }
.race.go .bus { animation: run 4s linear forwards; }

/* کنفتی */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .bubble { opacity: 1; }
}

/* ============================================================
   صفحهٔ عریض (لپ‌تاپ و مانیتور)
   ============================================================ */
.unit-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
.unit-grid .lesson { margin-bottom: 0; }
.lesson-foot .btn.block { max-width: 460px; margin-inline: auto; display: flex; }
.lesson-foot .foot-row { max-width: 520px; margin-inline: auto; }
.lesson-foot { isolation: isolate; }
.lesson-foot::before { content: ''; position: absolute; z-index: -1; inset-block: 0; left: 50%; width: 100vw; transform: translateX(-50%); background: var(--bg); border-top: 1px solid var(--line); }
html { overflow-x: clip; }

@media (min-width: 900px) {
  :root { --w: 1000px; }
  body { font-size: 17px; }
  .app { padding-inline: 28px; }
  .top { padding-inline: 28px; }
  .top-in { }
  .brand { font-size: 1.5rem; }
  .card { padding: 22px 26px; }
  .hero { padding: 28px 32px; }
  .hero h2 { font-size: 1.6rem; }
  .app > .card:not(.goal):not(.hero):not(.soon-card) { max-width: 760px; margin-inline: auto; }
  .unit-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .lesson { padding: 14px 18px; }
  .lesson-top { padding-top: 20px; }
  .intro { padding: 28px 34px; font-size: 1.05rem; line-height: 1.9; }
  .vocab { grid-template-columns: 1fr 1fr; }
  .opts:not(.arts-3) { grid-template-columns: 1fr 1fr; }
  .sentence { font-size: 1.9rem; }
  .q-title { font-size: 1.3rem; }
  .big-word { font-size: 2.8rem; }
  .match { gap: 16px; }
  .tile { font-size: 1.25rem; padding: 10px 20px; }
  .done-box { padding: 56px 0; }
}
@media (min-width: 1280px) {
  :root { --w: 1160px; }
  .unit-grid { grid-template-columns: repeat(3, 1fr); }
}
/* ============================================================
   کتابخانه و قابلیت‌های تکمیلی
   ============================================================ */
.lib-grid { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 560px) { .lib-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .lib-grid { grid-template-columns: repeat(3, 1fr); } }
.lib-card { display: flex; flex-direction: column; gap: 2px; text-align: right; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.lib-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.lib-i { font-size: 1.8rem; line-height: 1.2; }
.lib-card b { font-size: 1.05rem; } .lib-card small { color: var(--muted); }
.back-btn { margin-bottom: 10px; }
.quests .q-head { display: flex; justify-content: space-between; align-items: center; }
.quests h3 { margin: 0 0 6px; }
.chip-s { background: var(--brand-soft); border-radius: 999px; padding: 0 10px; font-weight: 800; }
.q-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.q-row.ok { color: var(--ok-ink); } .q-row small { color: var(--muted); }
.wod { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wk { display: flex; align-items: flex-end; gap: 8px; height: 110px; margin: 8px 0 14px; }
.wk-c { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.wk-b { width: 100%; max-width: 34px; min-height: 4px; background: linear-gradient(180deg, var(--gold), var(--brand)); border-radius: 8px 8px 3px 3px; }
.wk-c small { color: var(--muted); }
.lv-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; } .lv-row .bar { flex: 1; } .lv-row small { color: var(--muted); min-width: 44px; text-align: left; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.badge-i { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 14px; opacity: .45; filter: grayscale(1); }
.badge-i.on { opacity: 1; filter: none; background: var(--brand-soft); border-color: var(--brand); }
.badge-i span { font-size: 1.6rem; } .badge-i b { font-size: .85rem; } .badge-i small { font-size: .72rem; color: var(--muted); line-height: 1.4; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; }
.d-list { display: grid; gap: 8px; margin-bottom: 12px; }
@media (min-width: 900px) { .d-list { grid-template-columns: 1fr 1fr; } }
.d-row { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.d-w { flex: 1; min-width: 0; } .d-w .de { font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; } .d-em { margin-inline-start: 6px; }
.fav-on { color: #e0a100; }
.gsec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow); }
.gsec > summary { cursor: pointer; padding: 12px 16px; font-weight: 800; list-style: none; display: flex; align-items: center; gap: 8px; }
.gsec > summary::-webkit-details-marker { display: none; }
.gsec > summary::after { content: '▾'; margin-inline-start: auto; color: var(--muted); }
.gsec[open] > summary::after { transform: rotate(180deg); }
.gsec > .intro, .gsec > .d-list { border: 0; box-shadow: none; padding: 4px 16px 16px; background: transparent; }
.gsec[hidden] { display: none; }
.vtable { overflow-x: auto; } .vt { display: table; width: 100%; } .vt td, .vt th { white-space: nowrap; }
.fa-s { font-size: .8rem; font-family: var(--font); direction: rtl; }
.spk.sm { width: 30px; height: 30px; font-size: .9rem; }
.m-row { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip-l { background: var(--brand-soft); color: var(--ink); border-radius: 999px; padding: 1px 10px; font-size: .85rem; text-decoration: none; }
.chip-l.done { background: var(--ok-bg); color: var(--ok-ink); } .chip-l.ref { background: transparent; border: 1px solid var(--line); }
.done-box .card { text-align: right; }
/* معلم هوشمند */
.tabs { margin: 8px 0; }
.tchat { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 2px; margin: 8px 0; }
.tb { display: flex; gap: 8px; align-items: flex-start; }
.tb.me { justify-content: flex-start; flex-direction: row-reverse; }
.tb-av { font-size: 1.6rem; }
.tb-c { max-width: 86%; }
.tb-t { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px; font-weight: 600; line-height: 1.6; }
.tb.me .tb-t { background: var(--brand-soft); }
.tb-tip { margin-top: 4px; background: #fff8e1; color: #5a4300; border-radius: 12px; padding: 6px 10px; font-size: .9rem; }
:root[data-theme="dark"] .tb-tip { background: #3a3014; color: #ffe29a; }
.trow { display: flex; gap: 8px; align-items: stretch; } .trow .type-in { flex: 1; }
.tout { white-space: pre-wrap; margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; line-height: 1.9; }
textarea.type-in { resize: vertical; }
.brand { color: inherit; text-decoration: none; cursor: pointer; }
.brand:hover { opacity: .9; }

/* اندازهٔ متن قابل تنظیم */
body { font-size: calc(16px * var(--fs, 1)); }
@media (min-width: 900px) { body { font-size: calc(17px * var(--fs, 1)); } }
.right { }

/* ============================================================
   لوسی، ربات دستیار
   ============================================================ */
.robo { display: block; overflow: visible; }
.robo .eye { transform-box: fill-box; transform-origin: center; animation: rb-blink 4.6s infinite; }
@keyframes rb-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
.robo .mouth-open { opacity: 0; }
.robo.talk .mouth { animation: rb-m1 .36s steps(1) infinite; }
.robo.talk .mouth-open { animation: rb-m2 .36s steps(1) infinite; }
@keyframes rb-m1 { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes rb-m2 { 0% { opacity: 0; } 50% { opacity: 1; } }
.robo .armL, .robo .armR, .robo .legL, .robo .legR, .robo .bod { transform-box: view-box; }
.robo .armR { transform-origin: 156px 116px; } .robo .armL { transform-origin: 44px 116px; }
.robo .legL { transform-origin: 79px 168px; } .robo .legR { transform-origin: 121px 168px; }
.robo .bod { transform-origin: 100px 170px; }
.robo.wave .armR { animation: rb-wave .5s ease-in-out infinite alternate; }
@keyframes rb-wave { from { transform: rotate(-30deg); } to { transform: rotate(-80deg); } }
.robo.walk .legL { animation: rb-step .42s ease-in-out infinite alternate; }
.robo.walk .legR { animation: rb-step .42s ease-in-out infinite alternate-reverse; }
@keyframes rb-step { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }
.robo.walk .armL { animation: rb-swing .42s ease-in-out infinite alternate; }
.robo.walk .armR { animation: rb-swing .42s ease-in-out infinite alternate-reverse; }
@keyframes rb-swing { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
.robo.walk .bod { animation: rb-bob .42s ease-in-out infinite alternate; }
@keyframes rb-bob { from { transform: translateY(0); } to { transform: translateY(-5px); } }
.robo.laugh .bod { animation: rb-shake .22s ease-in-out infinite alternate; }
@keyframes rb-shake { from { transform: rotate(-2.5deg) translateY(0); } to { transform: rotate(2.5deg) translateY(-4px); } }
.robo.laugh .eye { animation: none; transform: scaleY(.3); }
.robo.m-think .eye { transform: translateY(-5px); }
.robo-stage { position: relative; height: 190px; overflow: hidden; border-radius: 18px; margin: 10px 0; background: linear-gradient(180deg, var(--brand-soft), transparent 80%); }
.robo-stage::after { content: ''; position: absolute; left: 0; right: 0; bottom: 10px; height: 2px; background: var(--line); }
.robo-walker { position: absolute; bottom: 12px; left: calc(50% - 60px); }
.robo-stage.walking .robo-walker { animation: rb-go 9s linear infinite alternate; }
@keyframes rb-go { from { left: 4%; } to { left: calc(96% - 120px); } }
.robo-stage.walking .robo-flip { animation: rb-flip 18s steps(1) infinite; }
@keyframes rb-flip { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } }
.robo-ctl { flex-wrap: wrap; justify-content: center; margin-bottom: 8px; }
.tb-av svg { width: 30px; height: auto; }
@media (prefers-reduced-motion: reduce) { .robo *, .robo-walker, .robo-flip { animation: none !important; } }
/* ردیف‌ها و آیکون‌های قابل‌کلیک */
button.q-row { width: 100%; background: none; border: 0; border-bottom: 1px dashed var(--line); font: inherit; color: inherit; text-align: right; cursor: pointer; border-radius: 10px; padding: 8px 6px; transition: background .12s; }
button.q-row:hover, button.q-row:focus-visible { background: var(--brand-soft); }
button.q-row small { color: var(--brand-d); font-weight: 700; }
button.badge-i { font: inherit; color: inherit; cursor: pointer; }
button.badge-i:hover { transform: translateY(-2px); border-color: var(--brand); }
/* حساب کاربری */
.auth { max-width: 460px; margin-inline: auto; text-align: center; }
.auth .auth-logo img { border-radius: 16px; }
.auth form { text-align: right; }
.fld { display: block; margin: 12px 0; } .fld > span:first-child { display: block; font-weight: 700; margin-bottom: 4px; }
.pwrow { display: flex; align-items: center; gap: 6px; } .pwrow .type-in { flex: 1; }
.amsg { min-height: 1.4em; margin: 8px 0; font-weight: 700; } .amsg.bad { color: var(--bad-ink); } .amsg.ok { color: var(--ok-ink); }
.chip.acct { background: rgba(0,0,0,.22); color: #fff; text-decoration: none; }
.lesson.locked { opacity: .6; }
.or { text-align: center; color: var(--muted); margin: 14px 0 8px; }
.gbtn { text-decoration: none; }

/* لینک‌های صفحهٔ ورود/ثبت‌نام: خوانا در تم تیره */
.auth a, .auth .link { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.auth a:visited { color: var(--brand); }


/* لینک‌های داخل کارت‌ها و نکته‌ها: خوانا در تم تیره */
.tip a, .card a:not(.btn), .muted a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }


/* ============================================================
   لوسی: حالت‌ها و حرکت‌ها
   ============================================================ */
.robo { --lx: 0px; --ly: 0px; }
.robo .eyes { transform: translate(var(--lx), var(--ly)); transition: transform .14s ease-out; }
/* نفس کشیدن */
.robo .bod { animation: rb-breathe 4.2s ease-in-out infinite; }
@keyframes rb-breathe { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(1.5px) scale(1.012, .99); } }
/* موهای آنتن‌مانند */
.robo .hair path { transform-box: fill-box; transform-origin: 50% 100%; animation: rb-sway 3.6s ease-in-out infinite alternate; }
.robo .hair .h1 { animation-delay: -.6s; } .robo .hair .h2 { animation-delay: -1.8s; animation-duration: 4.2s; } .robo .hair .h3 { animation-delay: -1.2s; }
@keyframes rb-sway { from { transform: rotate(-5deg); } to { transform: rotate(6deg); } }
/* ابرو، لپ، قلب، خواب */
.robo .brows, .robo .hearts, .robo .zzz { opacity: 0; }
.robo .blush { opacity: 0; transition: opacity .3s; }
.robo.m-smile .blush { opacity: .28; }
.robo.m-laugh .blush, .robo.m-cheer .blush, .robo.m-love .blush { opacity: .6; }
.robo .brows path { transform-box: fill-box; transform-origin: center; transition: transform .25s; }
.robo.m-sad .brows { opacity: 1; } .robo.m-sad .bL { transform: rotate(-16deg) translateY(-2px); } .robo.m-sad .bR { transform: rotate(16deg) translateY(-2px); }
.robo.m-think .brows { opacity: 1; } .robo.m-think .bR { transform: translateY(-7px) rotate(-8deg); }
.robo.m-wow .brows { opacity: 1; } .robo.m-wow .bL, .robo.m-wow .bR { transform: translateY(-8px); }
.robo.m-love .eyes .eye, .robo.m-love .eyes .gl { opacity: 0; }
.robo.m-love .hearts { opacity: 1; transform-box: fill-box; transform-origin: center; animation: rb-beat .55s ease-in-out infinite alternate; }
@keyframes rb-beat { from { transform: scale(.92); } to { transform: scale(1.12); } }
.robo.sleep .eye, .robo.m-sleep .eye { animation: none; transform: scaleY(.1); } .robo.sleep .gl, .robo.m-sleep .gl { opacity: 0; }
.robo.sleep .zzz, .robo.m-sleep .zzz { opacity: 1; animation: rb-zzz 2.6s ease-in-out infinite; }
@keyframes rb-zzz { 0% { opacity: 0; transform: translate(-6px, 8px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -10px); } }
.robo.sleep .bod { animation: rb-breathe 3s ease-in-out infinite; }
/* پرش */
.robo.jump { animation: rb-jump .72s cubic-bezier(.3, 0, .3, 1) infinite; transform-origin: 50% 95%; }
@keyframes rb-jump { 0%, 100% { transform: translateY(0) scale(1.04, .94); } 18% { transform: translateY(0) scale(.96, 1.06); } 50% { transform: translateY(-16px) scale(.98, 1.03); } 82% { transform: translateY(0) scale(1.05, .93); } }
/* شادی: دست‌ها بالا */
.robo.cheer .armL { animation: rb-cheerL .45s ease-in-out infinite alternate; } .robo.cheer .armR { animation: rb-cheerR .45s ease-in-out infinite alternate; }
@keyframes rb-cheerL { from { transform: rotate(78deg); } to { transform: rotate(112deg); } }
@keyframes rb-cheerR { from { transform: rotate(-78deg); } to { transform: rotate(-112deg); } }
.robo.cheer .eye { transform: scaleY(.55); animation: none; }
/* رقص */
.robo.dance .bod { animation: rb-dance .5s ease-in-out infinite alternate; }
@keyframes rb-dance { from { transform: rotate(-6deg) translateY(0); } to { transform: rotate(6deg) translateY(-6px); } }
.robo.dance .legL { animation: rb-step .5s ease-in-out infinite alternate; } .robo.dance .legR { animation: rb-step .5s ease-in-out infinite alternate-reverse; }
.robo.dance .armL { animation: rb-swing .25s ease-in-out infinite alternate; } .robo.dance .armR { animation: rb-swing .25s ease-in-out infinite alternate-reverse; }
/* تکان‌دادن سر و چرخش */
.robo.nod .bod { animation: rb-nod .45s ease-in-out 2; }
@keyframes rb-nod { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(7px) scale(1.02, .96); } }
.robo.spin { animation: rb-spin .9s ease-in-out 1; }
@keyframes rb-spin { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1) translateY(-8px); } 100% { transform: scaleX(1); } }
/* آواتارهای صورت */
.fb-m svg, .done-m svg { width: 100%; height: 100%; }
.fb-m { animation: popIn .4s ease; }
.tb-av svg { width: 30px; height: auto; }

/* کارت لوسی در صفحهٔ اصلی */
.luci-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: linear-gradient(135deg, var(--brand-soft), transparent 70%); }
.luci-av { flex: none; width: 96px; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.luci-av svg { display: block; width: 96px; height: auto; margin-top: -6px; }
.luci-say { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px; flex: 1; min-width: 0; box-shadow: 0 4px 14px rgba(0, 0, 0, .08); animation: popIn .5s ease both; }
.luci-say::before { content: ''; position: absolute; top: 28px; inset-inline-start: -7px; width: 12px; height: 12px; background: var(--card); border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); transform: rotate(45deg); }.luci-say b { display: block; font-size: 1.05rem; }
.luci-say p { margin: 4px 0 0; font-size: .92rem; line-height: 1.7; }
.luci-wod { color: var(--muted); font-size: .85rem !important; }

/* همراه کوچک گوشهٔ صفحه */
#luci { position: fixed; left: 8px; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 35; width: 58px; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1), opacity .3s; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18)); }
#luci.off { transform: translateY(120px); opacity: 0; pointer-events: none; }
#luci svg { display: block; width: 58px; height: auto; }
.luci-bubble { position: absolute; bottom: calc(100% - 6px); left: 0; min-width: 120px; max-width: 220px; background: var(--card); color: var(--fg, inherit); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: .88rem; line-height: 1.6; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.luci-bubble::after { content: ''; position: absolute; bottom: -6px; left: 22px; width: 11px; height: 11px; background: var(--card); border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); transform: rotate(45deg); }
.luci-bubble.pop { animation: popIn .35s ease; }
.luci-bubble[hidden] { display: none; }

/* حرکت‌های صفحه */
#app.pg-in > * { animation: pgIn .32s ease both; }
@keyframes pgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.lesson { animation: fadeUp .45s ease both; animation-delay: calc(var(--i, 0) * 38ms); }
.chip-pop { animation: popIn .5s ease; }
.nav button:active, .lesson:active { transform: scale(.97); }
.lesson, .nav button { transition: transform .12s ease; }
@media (prefers-reduced-motion: reduce) {
  .robo, .robo *, #app.pg-in > *, .lesson, .luci-say, .luci-bubble { animation: none !important; }
  #luci { transition: none; }
}
/* موهای لوسی روی زمینهٔ تیره روشن می‌شوند تا دیده شوند */
:root[data-theme="dark"] .robo .hair { stroke: #cfe4f7; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .robo .hair { stroke: #cfe4f7; } }

.auth-logo svg { margin: 0 auto; display: block; }

