.rie-widget {
    --rie-accent: var(--didgat-primary-700-c, #6d28d9);
    position: fixed;
    /* بالاترین مقدارِ معتبرِ z-index (سقفِ عددِ صحیحِ ۳۲بیتی) — تا مطمئن
       باشیم این ویجت همیشه، صرف‌نظر از اینکه z-index نوارِ پایینِ سایت
       (پلاگینِ جداگانهٔ didgat-bottom-nav، که مقدارش از تنظیماتِ ادمین
       می‌آید و از اینجا قابل‌پیش‌بینی نیست) چه عددی باشد، رویِ آن می‌ماند. */
    z-index: 2147483000;
    font-family: "Vazirmatn", "Tahoma", sans-serif;
}

/* قفل کامل اسکرول پس‌زمینه وقتی گفتگو باز است — html و body هر دو،
   چون بسته به مرورگر ممکن است هرکدام اسکرول را در دست بگیرد. بدون
   این، تلاش کاربر برای «صاف‌کردن» صفحه با اسکرول، صفحهٔ زیرین را هم
   حرکت می‌دهد و باعث می‌شود ارتفاع محاسبه‌شده مدام عوض شود. */
html.rie-scroll-lock,
body.rie-scroll-lock {
    overflow: hidden !important;
    height: 100% !important;
    overscroll-behavior: none;
}
body.rie-scroll-lock {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
}

.rie-pos-bottom-left { left: 20px; bottom: 38px; }
.rie-pos-bottom-right { right: 20px; bottom: 38px; }

/* --- دکمه شناور: فقط آیکون ربات، اندازه ثابت، با کمی حس سه‌بعدی --- */
.rie-bubble {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    box-shadow: 0 10px 26px rgba(31,38,135,0.4), inset 0 -3px 6px rgba(0,0,0,0.15), inset 0 3px 4px rgba(255,255,255,0.25);
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--rie-accent) 70%, #fff 30%), var(--rie-accent) 65%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .25s ease, box-shadow .25s ease;
    animation: rie-float 2s ease-in-out infinite;
    padding: 0;
}
.rie-bubble:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 14px 34px rgba(31,38,135,0.5); }

@keyframes rie-float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-8px) rotate(-4deg); } }

/* --- انیمیشن‌های ریز داخل آیکون ربات (چشمک زدن، آنتن، گوش‌ها) --- */
.rie-bot-eyes { animation: rie-bot-blink 3s ease-in-out infinite; transform-origin: center; }
@keyframes rie-bot-blink {
    0%, 88%, 100% { transform: scaleY(1); }
    92% { transform: scaleY(0.15); }
}
.rie-bot-antenna { animation: rie-bot-antenna-sway 1.6s ease-in-out infinite; transform-origin: 20px 11px; }
@keyframes rie-bot-antenna-sway {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(12deg); }
}
.rie-bot-ear { animation: rie-bot-ear-pulse 1.2s ease-in-out infinite; transform-origin: center; }
.rie-bot-ear-r { animation-delay: .2s; }
@keyframes rie-bot-ear-pulse {
    0%, 100% { opacity: 1; } 50% { opacity: .55; }
}
.rie-bot-mouth { animation: rie-bot-mouth-talk 2.2s ease-in-out infinite; transform-origin: center; }
@keyframes rie-bot-mouth-talk {
    0%, 80%, 100% { transform: scaleX(1) scaleY(1); } 40% { transform: scaleX(1.1) scaleY(1.15); }
}
.rie-bot-cheeks { animation: rie-bot-cheeks-pulse 2s ease-in-out infinite; transform-origin: center; }
@keyframes rie-bot-cheeks-pulse {
    0%, 100% { opacity: 0.45; } 50% { opacity: 0.7; }
}

/* --- حباب تیزر (پاپ‌آپ ریز کنار دکمه، نه بالای آن — برای اینکه متن جادار و
   مرتب نمایش داده شود) --- */
.rie-teaser {
    position: absolute;
    top: 50%;
    width: max-content;
    max-width: min(260px, calc(100vw - 110px));
    box-sizing: border-box;
    background: #fff;
    color: var(--didgat-primary-800-w1, #4c1d95);
    padding: 10px 30px 10px 14px;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.7;
    word-break: break-word;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    animation: rie-teaser-in .3s ease;
}
/* دکمه سمت چپ پایین است → پاپ‌آپ به سمت راست دکمه باز می‌شود (فضای بیشتر، دورتر از لبهٔ صفحه) */
.rie-pos-bottom-left .rie-teaser { left: 76px; }
/* دکمه سمت راست پایین است → برای همان دلیل، پاپ‌آپ به سمت چپ دکمه باز می‌شود */
.rie-pos-bottom-right .rie-teaser { right: 76px; }
.rie-teaser[hidden] { display: none; }
@keyframes rie-teaser-in {
    from { opacity: 0; transform: translateY(-50%) translateX(-6px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

.rie-teaser-tail {
    position: absolute;
    top: 50%;
    width: 14px; height: 14px;
    background: #fff;
    transform: translateY(-50%) rotate(45deg);
}
.rie-pos-bottom-left .rie-teaser-tail { left: -6px; }
.rie-pos-bottom-right .rie-teaser-tail { right: -6px; }

.rie-teaser-close {
    position: absolute;
    top: 2px;
    right: 4px;
    background: none;
    border: none;
    color: #9291a8;
    font-size: 11px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

/* --- کادر گفتگو ---
   معماریِ تازه: مودال دیگر یک فرزندِ فلکسی نیست که «داخلِ» یک overlayِ
   fixed وسط‌چین شود — خودش مستقیماً position:fixed است. علتش: روی
   Android Chrome، وقتی کیبورد باز می‌شود، رفتارِ overlayِ inset:0 در
   دنبال‌کردنِ ویوپورتِ واقعی (نه کلِ صفحه) ناپایدار است؛ اگر مودال برای
   جای‌گیری‌اش به‌درستیِ آن overlay وابسته باشد، با باز شدنِ کیبورد جابه‌جا/
   پرش می‌کند. با مستقل‌کردنِ خودِ مودال (fixed + dvh)، این وابستگی کاملاً
   حذف می‌شود و overlay فقط یک پس‌زمینهٔ تزئینی است، بدون هیچ مسئولیتِ چیدمانی. */
.rie-overlay {
    position: fixed; inset: 0;
    background: rgba(var(--didgat-primary-950-r6-rgb, 20, 9, 34), 0.55);
    backdrop-filter: blur(6px);
    z-index: 2147483001;
    animation: rie-fade-in .25s ease;
}
.rie-overlay[hidden] { display: none; }
@keyframes rie-fade-in { from { opacity: 0; } to { opacity: 1; } }

.rie-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 32px));
    /* زنجیرهٔ ترجیحیِ ارتفاع: vh (پایه، همه‌جا کار می‌کند) → svh (بهتر) →
       dvh (بهترین؛ خودِ مرورگر با باز/بسته‌شدنِ کیبورد آن را هم‌زمان و
       روان تغییر می‌دهد، بدون نیاز به جاوااسکریپت). هر مرورگری که یک خط
       را نفهمد، نادیده‌اش می‌گیرد و مقدارِ قبلی می‌ماند. */
    height: min(720px, 88vh);
    height: min(720px, 88svh);
    height: min(720px, 88dvh);
    max-height: calc(100vh - 32px);
    max-height: calc(100svh - 32px);
    max-height: calc(100dvh - 32px);
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(var(--didgat-primary-950-r4-rgb, 36, 16, 58), 0.97), rgba(var(--didgat-primary-950-r7-rgb, 13, 6, 23), 0.98));
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 25px 80px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; overflow: hidden;
    overscroll-behavior: contain;
    z-index: 2147483002;
    animation: rie-pop-in-center .3s cubic-bezier(.2,.9,.3,1.2);
}
/* دو انیمیشنِ جدا برای حالتِ وسط‌چین (دسکتاپ) و تمام‌صفحه (موبایل) — چون
   حالتِ وسط‌چین به transform:translate(-50%,-50%) نیاز دارد و حالتِ
   تمام‌صفحه نه؛ اگر یک keyframe مشترک با این transform استفاده می‌شد، در
   حالتِ موبایل حینِ انیمیشنِ ورودی یک پرشِ بصریِ کوتاه پیش می‌آمد. */
@keyframes rie-pop-in-center {
    from { transform: translate(-50%, -50%) scale(.92) translateY(20px); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1) translateY(0); opacity: 1; }
}
@keyframes rie-pop-in-full {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.rie-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); color: #fff;
    flex-shrink: 0;
}
.rie-modal-title-group { display: flex; align-items: center; gap: 10px; }
.rie-modal-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: var(--rie-accent);
    display: flex; align-items: center; justify-content: center;
}
.rie-modal-title { font-weight: 700; font-size: 14.5px; }
.rie-modal-subtitle { font-size: 11px; color: rgba(255,255,255,0.55); }
.rie-close-btn {
    background: rgba(255,255,255,0.08); border: none; color: #fff;
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer; flex-shrink: 0;
    box-sizing: border-box; padding: 0; margin: 0;
    display: flex; align-items: center; justify-content: center;
    line-height: 0;
}
.rie-close-btn:hover { background: rgba(255,255,255,0.18); }

.rie-header-actions { display: flex; align-items: center; gap: 8px; }

/* دکمهٔ راهنما: همون حسِ سه‌بعدیِ دکمهٔ اصلیِ ربات (گرادیانِ شعاعی + سایهٔ
   داخلی/بیرونی) ولی کوچیک‌تر، برای جا گرفتن تو هدرِ گفتگو. یه تپشِ آرام هم
   داره تا کاربر متوجهٔ وجودش بشه، بدون اینکه مزاحم باشه. */
.rie-help-btn {
    width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--rie-accent) 55%, #fff 45%), var(--rie-accent) 70%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.35), inset 0 -2px 3px rgba(0,0,0,0.2), inset 0 2px 2px rgba(255,255,255,0.35);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; padding: 0; margin: 0;
    animation: rie-help-pulse 2.6s ease-in-out infinite;
    transition: transform .2s ease;
}
.rie-help-btn:hover { transform: scale(1.12) translateY(-1px); }
@keyframes rie-help-pulse {
    0%, 100% { box-shadow: 0 4px 10px rgba(0,0,0,0.35), inset 0 -2px 3px rgba(0,0,0,0.2), inset 0 2px 2px rgba(255,255,255,0.35), 0 0 0 0 rgba(255,255,255,0.3); }
    50%      { box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 -2px 3px rgba(0,0,0,0.2), inset 0 2px 2px rgba(255,255,255,0.4), 0 0 0 6px rgba(255,255,255,0.05); }
}

.rie-help-avatar { font-size: 18px; }

/* مودالِ راهنما دقیقاً روی مودالِ گفتگو باز می‌شود (نه به‌جایش) — با یک
   z-index بالاتر — تا بستنش دوباره برگردد سرِ همون گفتگو، نه اینکه گفتگو
   از دست برود. */
#rie-help-overlay { z-index: 2147483003; }
.rie-help-modal { z-index: 2147483004; }

.rie-help-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
    padding: 16px 18px 24px;
    color: #fff;
}
.rie-help-intro { font-size: 13px; line-height: 1.9; color: rgba(255,255,255,0.85); margin: 0 0 18px; }
.rie-help-section {
    background: linear-gradient(160deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.rie-help-section-title { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.rie-help-icon { font-size: 15px; }
.rie-help-section p { font-size: 12.5px; color: rgba(255,255,255,0.7); margin: 0 0 8px; }
.rie-help-example {
    background: rgba(var(--didgat-primary-200-w1-rgb, 221, 214, 254), 0.12); border: 1px solid rgba(var(--didgat-primary-200-w1-rgb, 221, 214, 254), 0.25);
    border-radius: 10px; padding: 8px 12px; font-size: 12.5px; color: var(--didgat-primary-100-w11, #ede9fe);
    margin-bottom: 6px;
}
.rie-help-example:last-child { margin-bottom: 0; }
.rie-help-tip {
    display: flex; align-items: flex-start; gap: 8px;
    background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.25);
    border-radius: 14px; padding: 12px 14px; font-size: 12.5px; line-height: 1.8; color: #fde68a;
}

/* نکته کلیدی برای ریسپانسیو بودن: min-height:0 لازم است وگرنه محتوای
   داخل flex-column بیشتر از ارتفاع مودال رشد می‌کند و کادر نوشتن را
   به بیرون از باکس هل می‌دهد. */
.rie-chat-thread {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 16px 14px;
    display: flex; flex-direction: column; gap: 14px;
}

/* =========================================================
   چینش پیام‌ها — به‌جای تکیه بر align-self (که در ترکیب
   flex-direction:column + dir=rtl در برخی مرورگرها رفتار غیرمنتظره
   دارد)، از margin فیزیکی صریح استفاده می‌شود که همیشه قابل‌پیش‌بینی
   است: پیام کاربر با margin-left:auto به راست چسبانده می‌شود، پیام
   دستیار با margin-right:auto به چپ.
   ========================================================= */
.rie-msg {
    display: flex;
    max-width: 88%;
    width: fit-content;
    /* جهت این ردیف را عمداً LTR می‌کنیم تا ترتیب آواتار/حباب کاملاً
       قابل‌پیش‌بینی باشد؛ جهت متن فارسی داخل حباب دوباره RTL می‌شود. */
    direction: ltr;
}
.rie-msg-user {
    margin-left: auto;
    margin-right: 0;
    flex-direction: row-reverse; /* آواتار (اولین فرزند در HTML) در سمت راست بلوک قرار می‌گیرد */
}
.rie-msg-assistant {
    margin-right: auto;
    margin-left: 0;
    flex-direction: row; /* آواتار (اولین فرزند در HTML) در سمت چپ بلوک قرار می‌گیرد */
}
@keyframes rie-slide-up { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.rie-msg { animation: rie-slide-up .25s ease; }

.rie-msg-avatar {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 13px;
    background: rgba(var(--didgat-primary-200-w1-rgb, 221, 214, 254), 0.2); margin: 0 6px;
}
.rie-msg-user .rie-msg-avatar { background: var(--rie-accent); }

.rie-bubble-content {
    display: flex; flex-direction: column; gap: 10px; min-width: 0;
    direction: rtl; /* بازگرداندن جهت درست برای متن و اعداد فارسی */
}
.rie-msg-user .rie-bubble-text-content {
    background: var(--rie-accent); color: #fff; padding: 10px 16px; border-radius: 16px 16px 16px 4px; font-size: 13.5px; line-height: 1.8; text-align: right;
}
.rie-msg-assistant .rie-bubble-text-content {
    background: rgba(255,255,255,0.07); color: #fff; padding: 12px 16px; border-radius: 16px 16px 4px 16px; font-size: 13.5px; line-height: 1.9; text-align: right;
    border: 1px solid rgba(255,255,255,0.06);
    white-space: pre-line; /* حفظ خطوط جدید (مثلاً خط منبع/امتیاز اطمینان زیر پاسخ اصلی) بدون شکستنِ خودکارِ اضافیِ کلمات */
}
.rie-bubble-text-content strong { color: var(--didgat-primary-200-w1, #ddd6fe); }

.rie-typing {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.07); padding: 12px 18px; border-radius: 16px 16px 4px 16px;
    border: 1px solid rgba(255,255,255,0.06);
}
.rie-typing span {
    width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.5);
    animation: rie-typing-bounce 1.2s infinite ease-in-out;
}
.rie-typing span:nth-child(2) { animation-delay: .15s; }
.rie-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes rie-typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.rie-cards-row { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.rie-result-card {
    /* حالتِ شیشه‌ای: پس‌زمینهٔ نیمه‌شفاف + بلور پشتِ کارت + یک خطِ نازکِ
       نورانی روی لبه، به‌جای یک صفحهٔ تخت و مات. */
    background: linear-gradient(160deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 14px;
    padding: 14px;
    color: #fff;
}
.rie-result-header { display: flex; align-items: center; gap: 10px; }
.rie-result-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: rgba(255,255,255,0.1); flex-shrink: 0; }
/* min-width:0 این‌جا حیاتی است: بدونش، یک فرزندِ فلکسیِ حاویِ متن هیچ‌وقت از
   عرضِ محتوای طبیعیِ خودش کوچک‌تر نمی‌شود و می‌تواند از کارت بیرون بزند —
   دقیقاً همان چیزی که باعثِ نصفه‌دیده‌شدنِ آخرین حرفِ اسم می‌شد. */
.rie-result-title-wrap { min-width: 0; flex: 1 1 auto; }
.rie-result-name {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    font-weight: 700; font-size: 13.5px; line-height: 1.6;
    overflow-wrap: break-word; word-break: break-word;
}
.rie-result-rating { color: #fbbf24; font-size: 12px; margin-top: 2px; }
.rie-score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(65px, 1fr)); gap: 6px; margin-top: 10px; }

.rie-info-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.rie-info-badge {
    font-size: 10.5px; padding: 3px 8px; border-radius: 999px;
    background: rgba(var(--didgat-primary-200-w1-rgb, 221, 214, 254), 0.14); backdrop-filter: blur(6px);
    color: var(--didgat-primary-100-w11, #ede9fe); border: 1px solid rgba(var(--didgat-primary-200-w1-rgb, 221, 214, 254), 0.25);
}
.rie-info-badge-claimed { background: rgba(34,197,94,0.15); color: #86efac; border-color: rgba(34,197,94,0.3); }
.rie-score-item {
    background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 6px; text-align: center; font-size: 10.5px;
}
/* رنگِ عددها عمداً از var(--rie-accent) (بنفشِ نسبتاً تیره) به یک بنفشِ روشن
   تغییر کرد — روی پس‌زمینهٔ تیرهٔ کارت، رنگِ قبلی کنتراستِ خیلی کمی داشت و
   خواندنِ عدد سخت بود؛ این رنگ هم روشن و خواناست، هم چشم را اذیت نمی‌کند. */
.rie-score-value { font-size: 13px; font-weight: 700; color: var(--didgat-primary-200-w1, #ddd6fe); }
.rie-result-link {
    display: inline-block; margin-top: 10px; color: var(--rie-accent); font-weight: 600; text-decoration: none; font-size: 12px;
}
.rie-result-link:hover { color: #fff; text-decoration: underline; }
.rie-source-tag { font-size: 9.5px; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }

.rie-composer {
    display: flex; gap: 8px; padding: 12px 14px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.rie-search-input {
    flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.15) !important;
    background: rgba(255,255,255,0.06) !important; color: #fff !important; font-size: 14px; outline: none !important; transition: border-color .2s ease;
    direction: rtl; text-align: right; box-shadow: none !important; -webkit-text-fill-color: #fff;
}
/* دفاعی: استایلِ عمومیِ input تمِ سایت (پس‌زمینهٔ روشن + متن تیره) روی این
   کادر اثر نگذارد — بدونش پس‌زمینه روشن می‌شود ولی متن همچنان سفید می‌ماند
   و هرچی تایپ شود اصلاً دیده نمی‌شود. */
.rie-search-input:focus { border-color: var(--rie-accent) !important; background: rgba(255,255,255,0.06) !important; color: #fff !important; }
.rie-search-input::placeholder { color: rgba(255,255,255,0.4) !important; }
.rie-send-btn {
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background-color: var(--rie-accent) !important; color: #fff;
    cursor: pointer; transition: filter .2s ease; flex-shrink: 0;
    box-sizing: border-box; padding: 0; margin: 0;
    display: flex; align-items: center; justify-content: center;
    line-height: 0;
}
.rie-send-btn:hover { filter: brightness(1.1); }

/* موبایل: تمام‌صفحه. مودال دیگر «وسط‌چین‌شده داخلِ overlay» نیست — خودش
   مستقیماً کل ویوپورتِ واقعی را می‌گیرد (fixed + inset:0 معادل)، مستقل از
   اینکه overlay چطور رفتار می‌کند. dvh منبعِ اصلیِ ارتفاع است (مرورگر خودش
   با باز/بسته‌شدنِ کیبورد آن را هماهنگ تغییر می‌دهد)؛ --rie-vh (جاوااسکریپت،
   از visualViewport) فقط برای مرورگرهایی که اصلاً dvh را نمی‌شناسند فعال
   می‌شود، نه برای بازنویسیِ آن در مرورگرهای مدرن. */
@media (max-width: 640px), (max-height: 760px) {
    .rie-modal {
        top: 0;
        left: 0;
        transform: none;
        width: 100vw;
        height: 100vh;
        height: 100svh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        animation: rie-pop-in-full .3s cubic-bezier(.2,.9,.3,1.2);
    }
    @supports not (height: 100dvh) {
        .rie-modal { height: var(--rie-vh, 100vh); }
    }
    .rie-modal-header { padding-top: max(14px, env(safe-area-inset-top)); }
}

/* حالتِ خیلی نادر: مرورگرِ خیلی قدیمی که نه dvh می‌شناسد نه svh — همان
   fallback همیشگیِ ۱۰۰vh را دارد (رفتارِ قابل‌قبول، نه خرابی). */
