.math-widget-editor{display:block;width:100%;min-height:90px;border:2px solid #818cf8;border-radius:12px;padding:12px;font-size:25px;direction:ltr;background:var(--card-bg,#fff);color:var(--text,#172033)}
.math-widget-keys{display:grid;grid-template-columns:repeat(auto-fit,minmax(74px,1fr));gap:7px;margin:12px 0}
.math-widget-key{border:1px solid #c7d2fe;border-radius:9px;padding:10px;background:#eef2ff;color:#3730a3;cursor:pointer;font:700 13px inherit}
.math-widget-readonly,.math-widget-formula{display:inline-block;direction:ltr;max-width:100%;overflow-x:auto;overflow-y:hidden;vertical-align:middle;unicode-bidi:isolate;-webkit-overflow-scrolling:touch}
.math-widget-readonly.is-display,.math-widget-formula.is-display,.math-widget-formula[data-display="true"]{display:block;width:100%;text-align:center}
.math-widget-readonly-field{display:inline-block!important;max-width:100%;min-width:0!important;border:0!important;background:transparent!important;padding:0!important;color:inherit!important;direction:ltr!important;vertical-align:middle;pointer-events:auto!important;font-size:inherit}
.math-widget-readonly-field::part(virtual-keyboard-toggle){display:none!important}
.math-widget-readonly-field::part(container){direction:ltr;min-height:inherit;align-items:center;justify-content:flex-start}
.math-widget-question-parts{display:grid;width:100%;min-width:0;max-width:100%;gap:6px;box-sizing:border-box}
.math-widget-question-fa{display:block;width:100%;min-width:0;box-sizing:border-box;direction:rtl!important;text-align:right!important;unicode-bidi:plaintext;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
.math-widget-formula.math-widget-question-math,.math-widget-question-math{display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;margin:0!important;box-sizing:border-box!important;direction:ltr!important;text-align:left!important;unicode-bidi:isolate;overflow-x:auto!important;overflow-y:hidden!important;-webkit-overflow-scrolling:touch}
.math-widget-question-math .math-widget-question-math-field,.math-widget-question-math .math-widget-static-body{display:flex!important;align-items:center!important;justify-content:flex-start!important;width:max-content!important;min-width:100%!important;max-width:none!important;margin:0!important;box-sizing:border-box!important;direction:ltr!important;text-align:left!important;unicode-bidi:isolate}
.math-widget-question-math .ML__latex{direction:ltr!important;text-align:left!important}
.math-widget-answer-parts{display:grid;width:100%;min-width:0;max-width:100%;gap:6px;box-sizing:border-box}
.math-widget-answer-fa{display:block;width:100%;min-width:0;box-sizing:border-box;direction:rtl!important;text-align:right!important;unicode-bidi:plaintext;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
.math-widget-formula.math-widget-answer-math,.math-widget-answer-math{display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;margin:0!important;box-sizing:border-box!important;direction:ltr!important;text-align:left!important;unicode-bidi:isolate;overflow-x:auto!important;overflow-y:hidden!important;-webkit-overflow-scrolling:touch}
.math-widget-answer-math .math-widget-readonly-field,.math-widget-answer-math .math-widget-static-body,.math-widget-question-math .math-widget-question-math-field,.math-widget-question-math .math-widget-static-body{display:flex!important;align-items:center!important;justify-content:flex-start!important;width:max-content!important;min-width:100%!important;max-width:none!important;min-height:48px!important;margin:0!important;padding:10px 12px!important;box-sizing:border-box!important;line-height:1.35!important;direction:ltr!important;text-align:left!important;unicode-bidi:isolate!important;vertical-align:middle!important}
.math-widget-answer-math .ML__latex,.math-widget-question-math .ML__latex{display:inline-block!important;margin-block:auto!important;margin-inline:0!important;direction:ltr!important;text-align:left!important;vertical-align:middle!important}
.math-widget-teacher-guide{display:grid;width:100%;min-width:0;max-width:100%;gap:8px;align-content:center;box-sizing:border-box}
.math-widget-teacher-fa{display:flex!important;align-items:center;width:100%;min-width:0;min-height:48px;padding:10px 12px;box-sizing:border-box;direction:rtl!important;text-align:right!important;unicode-bidi:plaintext;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
.math-widget-formula.math-widget-teacher-math,.math-widget-teacher-math{display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;margin:0!important;box-sizing:border-box!important;direction:ltr!important;text-align:left!important;unicode-bidi:isolate;overflow-x:auto!important;overflow-y:hidden!important;-webkit-overflow-scrolling:touch}
.math-widget-teacher-math .math-widget-readonly-field,.math-widget-teacher-math .math-widget-static-body{display:flex!important;align-items:center!important;justify-content:flex-start!important;width:max-content!important;min-width:100%!important;max-width:none!important;min-height:48px!important;margin:0!important;padding:10px 12px!important;box-sizing:border-box!important;line-height:1.35!important;direction:ltr!important;text-align:left!important;unicode-bidi:isolate!important;vertical-align:middle!important}
.math-widget-teacher-math .ML__latex{display:inline-block!important;margin-block:auto!important;margin-inline:0!important;direction:ltr!important;text-align:left!important;vertical-align:middle!important}
@media(max-width:600px){.math-widget-answer-math .math-widget-readonly-field,.math-widget-answer-math .math-widget-static-body,.math-widget-question-math .math-widget-question-math-field,.math-widget-question-math .math-widget-static-body,.math-widget-teacher-math .math-widget-readonly-field,.math-widget-teacher-math .math-widget-static-body{min-height:44px!important;padding:8px 10px!important}.math-widget-teacher-fa{min-height:44px;padding:8px 10px}}
/* Every readonly formula uses the same horizontal and vertical alignment,
   including page-specific renderers for student answers, keys and guides. */
.math-widget-formula>.math-widget-readonly-field,.math-widget-formula>.math-widget-static-body{display:flex!important;align-items:center!important;justify-content:flex-start!important;box-sizing:border-box!important;direction:ltr!important;text-align:left!important;unicode-bidi:isolate!important;vertical-align:middle!important;line-height:1.35!important}
.math-widget-formula>.math-widget-readonly-field .ML__latex,.math-widget-formula>.math-widget-static-body .ML__latex{display:inline-block!important;margin-block:auto!important;margin-inline:0!important;direction:ltr!important;text-align:left!important;vertical-align:middle!important}
.math-widget-editable-field{--selection-background-color:rgba(99,102,241,.24);--caret-color:var(--primary,#4f46e5)}
html[data-theme="dark"] .math-widget-editable-field{--selection-background-color:rgba(129,140,248,.32);--caret-color:#a5b4fc}
html[data-theme="dark"] .math-widget-editor{background:#101b2b;color:#edf4fd;border-color:#6f8fef}
html[data-theme="dark"] .math-widget-key{background:#1d3153;color:#c8d7ff;border-color:#405b91}
/* تم مرکزی کیبورد MathLive؛ تمام صفحه‌هایی که ویجت ریاضی را دارند از همین
   متغیرها استفاده می‌کنند و با data-theme سایت هم‌زمان تغییر می‌کنند. */
html{
  --keyboard-zindex:10000;
  --keyboard-background:#d8dee8;
  --keyboard-border:#cbd5e1;
  --keyboard-accent-color:#4f46e5;
  --keyboard-toolbar-text:#334155;
  --keyboard-toolbar-text-active:#3730a3;
  --keyboard-toolbar-background-hover:#eef2ff;
  --keyboard-horizontal-rule:1px solid #f8fafc;
  --keycap-background:#f8fafc;
  --keycap-background-hover:#eef2ff;
  --keycap-border:#cbd5e1;
  --keycap-text:#0f172a;
  --keycap-primary-background:#4f46e5;
  --keycap-primary-text:#fff;
}
.ML__keyboard{
  background:transparent!important;
}
.ML__keyboard .MLK__plate,
.ML__keyboard .MLK__backdrop{width:100%!important;max-width:100vw!important;direction:ltr!important;box-sizing:border-box!important}
html.math-widget-keyboard-disabled .ML__keyboard{display:none!important}
/* MathLive 0.110 پهنا، فاصله و ارتفاع دکمه‌های کیبورد را با «container query» (واحد cqw و
   @container) می‌سازد. مرورگرهایی که این قابلیت را ندارند (Chrome و WebView اندروید پیش از
   نسخهٔ ۱۰۵، Samsung Internet پیش از ۲۰ و مرورگرهای داخلی هم‌دورهٔ آن‌ها) همهٔ آن قاعده‌ها را
   دور می‌ریزند؛ دکمه‌ها به پهنای متن خودشان جمع می‌شوند و باریک و چسبیده دیده می‌شوند.
   همان اندازه‌هایی که مرورگر جدید حساب می‌کند اینجا با پهنای صفحه (vw) ساخته می‌شود؛ کیبورد
   تمام پهنای صفحه است، پس پهنای ظرف کیبورد همان پهنای صفحه است. مرورگرهای جدید اصلاً وارد
   این بلوک نمی‌شوند و ظاهرشان هیچ تغییری نمی‌کند. */
@supports not (width:1cqw){
  .ML__keyboard{--_keycap-font-size:var(--keycap-font-size,clamp(16px,4vw,24px))}
  .ML__keyboard .MLK__rows{--_keycap-width:var(--keycap-width,min(var(--_keycap-max-width),calc((100vw - 2 * var(--_padding-horizontal,0px)) / 10)))}
  @media (max-width:414px){
    .ML__keyboard .MLK__toolbar>div>div{font-size:100%;margin-left:2px;margin-right:2px}
    .ML__keyboard .MLK__rows .shift,.ML__keyboard .MLK__rows .action{font-size:65%}
    .ML__keyboard .MLK__rows .warning svg.svg-glyph{width:14px;height:14px;min-height:14px}
  }
  @media (max-width:744px){
    .ML__keyboard .MLK__rows{--_keycap-gap:max(var(--keycap-gap,2px),2px);--_keycap-height:var(--keycap-height,52px);--_keycap-width:var(--keycap-width,min(var(--_keycap-max-width),calc((100vw - 2 * var(--_padding-horizontal,0px)) / 10),62px))}
    .ML__keyboard .MLK__toolbar>div>div{padding-left:0;padding-right:0}
    .ML__keyboard .MLK__tooltip::after{padding:8px 16px;font-size:16px}
    .ML__keyboard .MLK__rows>.MLK__row>div.fnbutton{font-size:16px}
    .ML__keyboard .MLK__rows>.MLK__row>div.bigfnbutton{font-size:calc(var(--_keycap-extra-small-font-size) / 1.55)}
    .ML__keyboard .MLK__rows>.MLK__row>div.small{font-size:13px}
    .ML__keyboard .MLK__rows>.MLK__row>div>aside{display:none}
    .ML__keyboard .MLK__shift{display:none}
  }
  @media (max-width:768px){
    .ML__keyboard .MLK__rows{--_keycap-height:var(--keycap-height,42px)}
    .ML__keyboard .MLK__rows>.MLK__row>div>small{font-size:14px}
  }
  @media (max-width:1444px){
    .ML__keyboard .MLK__rows .if-wide{display:none}
  }
}
html.math-widget-keyboard-disabled math-field:not([readonly])::part(virtual-keyboard-toggle){display:none!important}
html[data-theme="dark"]{
  color-scheme:dark;
  --keyboard-background:#0f172a;
  --keyboard-border:#334155;
  --keyboard-accent-color:#818cf8;
  --keyboard-toolbar-text:#cbd5e1;
  --keyboard-toolbar-text-active:#c4b5fd;
  --keyboard-toolbar-background-hover:#24324a;
  --keyboard-horizontal-rule:1px solid #334155;
  --keycap-background:#1e293b;
  --keycap-background-hover:#334155;
  --keycap-border:#475569;
  --keycap-text:#f8fafc;
  --keycap-primary-background:#6366f1;
  --keycap-primary-text:#fff;
}
html[data-theme="dark"] .ML__keyboard{
  color-scheme:dark!important;
  background:transparent!important;
  --_accent-color:#818cf8;
  --_background:#0f172a;
  --_border:#334155;
  --_toolbar-text:#cbd5e1;
  --_toolbar-background-hover:#24324a;
  --_horizontal-rule:1px solid #334155;
  --_keycap-background:#1e293b;
  --_keycap-background-hover:#334155;
  --_keycap-background-active:#4f46e5;
  --_keycap-background-pressed:#4338ca;
  --_keycap-border:#475569;
  --_keycap-border-bottom:#64748b;
  --_keycap-text:#f8fafc;
  --_keycap-text-hover:#fff;
  --_keycap-text-active:#fff;
  --_keycap-text-pressed:#fff;
  --_keycap-shift-text:#93c5fd;
  --_keycap-secondary-background:#334155;
  --_keycap-secondary-background-hover:#475569;
  --_keycap-secondary-text:#f8fafc;
}
html[data-theme="dark"] .ML__keyboard > .MLK__backdrop{background:#0f172a!important}
@media(max-width:600px){.math-widget-keys{grid-template-columns:repeat(4,1fr)}.math-widget-editor{font-size:21px}}

/* دکمه «بستن» که ویجت به نوار بالای کیبورد ریاضی اضافه می‌کند */
.math-widget-kb-close{display:flex;align-items:center;justify-content:center;cursor:pointer}
.math-widget-kb-close svg{width:19px;height:19px;display:block}

/* این اعلان مستقل از کد صفحه و عمداً با CSS ساده ساخته شده تا حتی WebViewی
   که JavaScript مدرن صفحهٔ آزمون را parse نمی‌کند، پیام قابل‌فهم ببیند. */
.math-widget-unsupported{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483600;display:flex;align-items:center;justify-content:center;padding:18px;background:rgba(15,23,42,.78);direction:rtl;font-family:Vazirmatn,Tahoma,sans-serif}
.math-widget-unsupported-card{width:92%;max-width:470px;box-sizing:border-box;padding:22px;border:1px solid #fecaca;border-radius:16px;background:#fff;color:#172033;text-align:center;box-shadow:0 18px 55px rgba(15,23,42,.35)}
.math-widget-unsupported-card strong{display:block;margin-bottom:10px;color:#b91c1c;font-size:18px}
.math-widget-unsupported-card p{margin:0 0 18px;line-height:2;font-size:14px}
.math-widget-unsupported-card div{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.math-widget-unsupported-card button{min-height:44px;padding:8px 18px;border:1px solid #cbd5e1;border-radius:9px;background:#f8fafc;color:#172033;font:700 13px inherit;cursor:pointer}
.math-widget-unsupported-card button:first-child{border-color:#2563eb;background:#2563eb;color:#fff}
/* کیبورد وسط کار باز نشد: پیام کوچک زیر کادر پاسخ با «تلاش مجدد». فقط در همین
   حالت نادر دیده می‌شود و کار دانش‌آموز قفل نمی‌شود. */
.math-widget-kb-help{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;max-width:100%;box-sizing:border-box;margin:8px 0;padding:7px 8px 7px 12px;border:1px solid #fcd34d;border-radius:12px;background:#fffbeb;color:#78350f;direction:rtl;text-align:right;font:700 13px/1.6 Vazirmatn,Tahoma,sans-serif}
.math-widget-kb-help span{flex:1 1 auto;min-width:0}
.math-widget-kb-help[hidden]{display:none!important}
.math-widget-kb-help button{flex:0 0 auto;min-height:40px;padding:6px 16px;border:0;border-radius:9px;background:#2563eb;color:#fff;font:700 13px Vazirmatn,Tahoma,sans-serif;cursor:pointer}
/* دریافت کتابخانهٔ کیبورد بیش از چند ثانیه طول کشید (اینترنت ضعیف). فقط اطلاع است؛ لمس از رویش رد می‌شود. */
.math-widget-load-status{position:fixed;left:50%;top:calc(10px + env(safe-area-inset-top,0px));transform:translateX(-50%);z-index:2147483400;display:flex;align-items:center;gap:8px;max-width:calc(100vw - 32px);box-sizing:border-box;padding:7px 14px;border:1px solid #bfdbfe;border-radius:999px;background:#eff6ff;color:#1e3a8a;direction:rtl;font:700 12.5px/1.6 Vazirmatn,Tahoma,sans-serif;box-shadow:0 8px 24px rgba(15,23,42,.14);pointer-events:none}
.math-widget-load-status[hidden]{display:none!important}
.math-widget-load-spin{flex:0 0 auto;width:14px;height:14px;border:2px solid #93c5fd;border-top-color:#2563eb;border-radius:50%;animation:math-widget-load-spin .9s linear infinite}
@keyframes math-widget-load-spin{to{transform:rotate(360deg)}}
/* ظاهر پیش‌فرض خود MathLive روی کادر (:host) قبل از بارگذاری کتابخانه وجود ندارد؛
   بنابراین کادری که صفحه برایش display/border تعیین نکرده، اول inline و بدون حاشیه
   است و بعد inline-block با حاشیهٔ ۱px می‌شود و جای رزروشده هم در حالت inline اثری
   ندارد. اینجا دقیقاً همان مقادیر :host کتابخانه با specificity صفر (:where) گذاشته
   می‌شود؛ هر قاعدهٔ خود صفحه مثل قبل بر آن غلبه می‌کند (همان‌طور که بر :host غلبه
   می‌کرد) و بعد از آماده شدن کادر این قاعده دیگر اعمال نمی‌شود. */
:where(math-field:not(:defined):not([hidden])){display:inline-block;border-width:1px;border-style:solid;border-color:#acacac;border-radius:2px}
/* رزرو جای کادر ریاضی قابل‌ویرایش تا وقتی MathLive هنوز بارگذاری نشده است.
   قبل از آماده شدن کتابخانه کادر فقط یک خط متن است (مثلاً ۳۱px) و بعد با
   دکمه‌های کیبورد/منو به اندازهٔ نهایی می‌رسد (مثلاً ۵۴px)؛ همین جهش، محتوای
   زیر کادر را تکان می‌داد. اینجا فقط ارتفاع داخلی نهایی MathLive رزرو می‌شود:
   دکمه‌های آن ۳۴px و در صفحهٔ لمسی ۶۰px هستند و بالا و پایینشان ۴px فاصله
   دارد (۴۲ و ۶۸). padding و border خود کادر دست نمی‌خورد، پس اندازهٔ رزروشده
   در هر صفحه همان اندازهٔ نهایی همان صفحه است.
   - به محض آماده شدن (:defined) این قاعده خودبه‌خود حذف می‌شود؛ ظاهر و رفتار
     نهایی هیچ تغییری نمی‌کند.
   - کادرهای فقط‌خواندنی و کادرهایی که دکمه‌هایشان پنهان است مستثنی‌اند.
   - اگر کتابخانه اصلاً نیامد، پس از ۱۰ ثانیه رزرو برداشته می‌شود تا کادر خراب
     بزرگ‌تر از قبل نماند. */
math-field:not(:defined):not([read-only]):not([readonly]):not(.readonly-mathlive):not(.math-widget-readonly-field):not(.math-live-static):not(.vector-column-input):not(.xy-answer-input):not(.congruence-condition-input)::before{content:"";display:inline-block;width:0;height:42px;vertical-align:top;animation:math-widget-reserve-release 0s linear 10s forwards}
@media (pointer:coarse){math-field:not(:defined):not([read-only]):not([readonly]):not(.readonly-mathlive):not(.math-widget-readonly-field):not(.math-live-static):not(.vector-column-input):not(.xy-answer-input):not(.congruence-condition-input)::before{height:68px}}
@keyframes math-widget-reserve-release{to{height:0}}
/* فقط وقتی کیبورد ریاضی باز است (math-widget.js): قفل ارتفاع یک‌صفحه‌ای پنل‌ها برداشته می‌شود تا فضایی که کیبورد پایین صفحه اضافه می‌کند واقعاً قابل اسکرول باشد و کادرهای پایین صفحه زیر کیبورد نمانند. min-height دست نمی‌خورد (صفحه‌های موبایل که از قبل height:auto دارند دقیقاً مثل قبل می‌مانند). */
html.math-widget-kb-open,html.math-widget-kb-open body{height:auto!important}
