/* =========================================================
   Diplomacia Assistant — Interface Stylesheet (v3)
   ---------------------------------------------------------
   يستبدل هذا الملف ملف style.css القديم بالكامل.
   كل أسماء الكلاسات القديمة محفوظة كما هي (لا شيء في
   script.js يحتاج تعديلاً بسببه).
   ========================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
    /* الأسطح */
    --bg: #0D1220;
    --bg-deep: #080C16;
    --panel: #161D2E;
    --panel-2: #1C2438;
    --raised: #212C44;
    --hairline: rgba(255, 255, 255, .07);
    --hairline-strong: rgba(255, 255, 255, .13);

    /* النصوص */
    --text: #EEF2FA;
    --text-sub: #8E9BB5;
    --text-dim: #64708A;

    /* الألوان الدلالية (نفس عائلة الألوان الموجودة في السكربت) */
    --accent-blue: #3B8CFF;
    --accent-green: #30D158;
    --accent-amber: #FFC53D;
    --accent-red: #FF453A;
    --accent-violet: #BF5AF2;
    --accent-yellow: #FFD60A;

    /* ألوان تصنيف الوحدات العسكرية — مطابقة لألوان اللعبة الأصلية:
       🟩 مشاة | 🟨 دبابات | 🟪 سفن حربية | 🟦 طيران | 🟥 صواريخ */
    --unit-inf: var(--accent-green);
    --unit-tnk: var(--accent-yellow);
    --unit-war: var(--accent-violet);
    --unit-air: var(--accent-blue);
    --unit-mis: var(--accent-red);

    /* مقاييس */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-pill: 999px;

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 22px;

    --shadow-1: 0 2px 10px rgba(0, 0, 0, .35);
    --shadow-2: 0 14px 40px rgba(0, 0, 0, .55);

    /* ارتفاعات الأشرطة الثابتة */
    --header-h: 62px;
    --accbar-h: 92px;
    --nav-h: 66px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- 2. Base ---------- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overscroll-behavior: none;
}

body {
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
        Roboto, "Noto Sans", "Noto Naskh Arabic", "Segoe UI Historic", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    overflow: hidden;
    /* لا padding هنا بعد الآن — .app-shell أدناه هو من يحجز المساحات */
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}

/* ---------- 2.1 App shell ----------
   [إصلاح تخطيطي]: بدل الاعتماد على position:fixed للشريط العلوي/السفلي
   مع padding محسوب يدوياً على body (وهو ما فشل داخل WebView تيليجرام
   على بعض الأجهزة وسبّب تغطية شريط الأقسام لآخر سطرين من المحتوى) —
   الآن body لا يمرّر إطلاقاً؛ .app-shell مثبّت على حواف الشاشة الفعلية
   (inset:0) ويقسّم نفسه بالفليكس: رأس + شريط حسابات بارتفاعهما
   الطبيعي، ثم .content-area تأخذ كل المساحة المتبقية وتُمرّر بنفسها
   (overflow-y:auto)، ثم شريط الأقسام بارتفاعه الطبيعي في الأسفل.
   هذا يضمن هندسياً عدم تداخل أي عنصر مع آخر، بغضّ النظر عن دقة أي
   حساب لـ vh أو safe-area داخل أي WebView. */
.app-shell {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1100px 520px at 50% -160px, #1B2742 0%, rgba(27, 39, 66, 0) 62%),
        var(--bg);
    overflow: hidden;
}

h2,
h3,
h4 {
    letter-spacing: -.01em;
    font-weight: 700;
}

h3 {
    font-size: 17px;
}

h4 {
    font-size: 14px;
}

b,
strong {
    font-weight: 650;
}

hr {
    border: 0 !important;
    border-top: 1px solid var(--hairline) !important;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--hairline-strong);
    border-radius: var(--r-pill);
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------- 3. Header ---------- */
.header {
    flex: none;
    /* كان position:fixed — الآن عنصر فليكس عادي داخل .app-shell */
    height: calc(var(--header-h) + var(--safe-top));
    padding: var(--safe-top) 12px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(13, 18, 32, .82);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-bottom: 1px solid var(--hairline);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 0 1 auto;
}

.header img#tgAvatar {
    width: 38px;
    height: 38px;
    border-radius: var(--r-pill);
    object-fit: cover;
    background: var(--raised);
    border: 1px solid var(--hairline-strong);
    flex: none;
}

.user-name {
    font-size: 13.5px !important;
    font-weight: 650;
    line-height: 1.15;
    max-width: 96px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tgUsername {
    font-size: 11px !important;
    color: var(--text-dim) !important;
    max-width: 96px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* شريط الأرصدة: قطعة واحدة مقسّمة بدل بطاقات متفرقة */
.balances-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-inline: auto 0;
    flex: 1 1 auto;
    align-items: flex-end;
    min-width: 0;
}

.balances-row {
    display: flex;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    font-size: 12.5px;
    font-weight: 650;
    border-radius: var(--r-pill);
    background: var(--panel-2);
    border: 1px solid var(--hairline);
    color: var(--text);
    white-space: nowrap;
    line-height: 1.5;
}

#bankBalance {
    border-color: rgba(255, 197, 61, .32);
    background: rgba(255, 197, 61, .10);
    color: var(--accent-amber);
}

#workBalance {
    border-color: rgba(48, 209, 88, .32);
    background: rgba(48, 209, 88, .10);
    color: var(--accent-green) !important;
}

.header-actions {
    display: flex;
    gap: 6px;
    flex: none;
}

.bank-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    font-size: 16px;
    border: 1px solid var(--hairline-strong);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    transition: transform .12s ease, background .15s ease;
}

.bank-btn:active {
    transform: scale(.92);
    background: var(--raised);
}

.bank-btn.is-add {
    background: linear-gradient(160deg, #35D96A, #1FA84A);
    border-color: transparent;
    color: #05230F;
    font-weight: 800;
}

.bank-btn.is-lang {
    font-size: 15px;
}

/* ---------- 4. Accounts strip (العنصر البطل) ---------- */
.accounts-bar {
    flex: none;
    /* كان position:fixed — الآن عنصر فليكس عادي داخل .app-shell */
    height: var(--accbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    background: linear-gradient(180deg, rgba(13, 18, 32, .96), rgba(13, 18, 32, .78));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hairline);
}

.accounts-bar::-webkit-scrollbar {
    display: none;
}

.account-avatar {
    position: relative;
    flex: none;
    width: 54px;
    height: 54px;
    border-radius: var(--r-pill);
    background-size: cover;
    background-position: center;
    background-color: var(--raised);
    cursor: pointer;
    scroll-snap-align: center;
    box-shadow: 0 0 0 2px var(--hairline-strong);
    transition: box-shadow .18s ease, transform .18s ease, opacity .18s ease;
    opacity: .62;
}

.account-avatar:active {
    transform: scale(.94);
}

.account-avatar.active {
    opacity: 1;
    transform: scale(1.06);
    box-shadow:
        0 0 0 2px var(--bg),
        0 0 0 4px var(--accent-blue),
        0 6px 18px rgba(59, 140, 255, .38);
}

/* حلقة حمراء متقطعة للحساب منتهي الصلاحية */
.account-avatar.expired::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: var(--r-pill);
    border: 2px dashed var(--accent-red);
    animation: pulse-ring 2.2s ease-in-out infinite;
}

.account-avatar.expired::before {
    content: "!";
    position: absolute;
    inset-block-start: -4px;
    inset-inline-end: -4px;
    width: 18px;
    height: 18px;
    border-radius: var(--r-pill);
    background: var(--accent-red);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid var(--bg);
}

@keyframes pulse-ring {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .35;
    }
}

.add-account-btn {
    flex: none;
    width: 54px;
    height: 54px;
    border-radius: var(--r-pill);
    display: grid;
    place-items: center;
    font-size: 26px;
    font-weight: 300;
    color: var(--accent-blue);
    background: rgba(59, 140, 255, .08);
    border: 1.5px dashed rgba(59, 140, 255, .45);
    cursor: pointer;
    transition: transform .12s ease, background .15s ease;
}

.add-account-btn:active {
    transform: scale(.92);
    background: rgba(59, 140, 255, .18);
}

/* ---------- 5. Content area ---------- */
.content-area {
    /* هي الآن منطقة التمرير الوحيدة في التطبيق (انظر .app-shell) —
       flex:1 يجعلها تأخذ كل المساحة المتبقية بعد الرأس/الحسابات/الأقسام،
       min-height:0 ضروري حتى يعمل overflow-y داخل عمود فليكس */
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 18px 14px calc(22px + var(--safe-bottom));
    max-width: 640px;
    margin: 0 auto;
    box-sizing: border-box;
}

.content-area h2 {
    margin: 0;
    font-size: 24px;
}

.content-area>p {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--text-sub);
}

#currentAccount {
    font-weight: 650;
}

#mainContainer {
    margin-top: 16px !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
}

/* البطاقات */
.home-box {
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-1);
}

.home-box-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sub);
    letter-spacing: .02em;
}

.stat-label {
    font-size: 12.5px;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    text-align: center;
}

/* الأرقام الطويلة (12,450,000) يجب ألا تلتف داخل ثلاثة أعمدة */
.grid-3 .stat-value {
    font-size: clamp(12px, 3.6vw, 15px);
    white-space: nowrap;
    letter-spacing: -.02em;
}

/* أشرطة التقدم */
.progress-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, .08);
    border-radius: var(--r-pill);
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill-hp,
.progress-fill-xp,
.progress-segment {
    height: 100%;
    border-radius: var(--r-pill);
    transition: width .5s cubic-bezier(.22, .9, .3, 1);
}

.progress-fill-hp {
    background: linear-gradient(90deg, #FF6B5E, #FF453A);
}

.progress-fill-xp {
    background: linear-gradient(90deg, #5BA3FF, #3B8CFF);
}

.multi-progress {
    display: flex;
    width: 100%;
    height: 8px;
    border-radius: var(--r-pill);
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
}

.mp-segment {
    height: 100%;
    transition: width .5s ease;
}

.bg-inf,
.c-inf {
    background: var(--unit-inf);
}

.bg-tnk,
.c-tnk {
    background: var(--unit-tnk);
}

.bg-war,
.c-war {
    background: var(--unit-war);
}

.bg-air,
.c-air {
    background: var(--unit-air);
}

.bg-mis,
.c-mis {
    background: var(--unit-mis);
}

.c-inf,
.c-tnk,
.c-war,
.c-air,
.c-mis {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 3px;
    margin-inline-end: 5px;
}

/* [الجديد]: تلوين سطر أعداد الوحدات (Inf/Tnk/Air/War/Mis) أسفل كل
   جيش، بنفس ألوان شريط التكوين الملوّن الذي فوقه مباشرة — بدون أي
   تعديل على script.js. السطر هو الشقيق (sibling) التالي مباشرة
   لـ .multi-progress في كلا الجيشين (الرئيسي والاحتياط)، وترتيب
   الوحدات فيه ثابت دائماً: Inf, Tnk, Air, War, Mis */
.multi-progress+div>span:nth-child(1) {
    color: var(--unit-inf);
}

.multi-progress+div>span:nth-child(2) {
    color: var(--unit-tnk);
}

.multi-progress+div>span:nth-child(3) {
    color: var(--unit-air);
}

.multi-progress+div>span:nth-child(4) {
    color: var(--unit-war);
}

.multi-progress+div>span:nth-child(5) {
    color: var(--unit-mis);
}

/* ---------- 6. Buttons ---------- */
.modal-btn,
.settings-btn {
    display: block;
    width: 100%;
    padding: 13px 16px;
    margin-top: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--raised);
    color: var(--text);
    font-size: 14.5px;
    font-weight: 650;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: transform .12s ease, filter .15s ease, opacity .15s ease;
}

.settings-btn {
    margin-bottom: 2px;
}

.mini-btn {
    padding: 8px 12px;
    border: 1px solid var(--hairline-strong);
    border-radius: 10px;
    background: var(--raised);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 650;
    font-family: inherit;
    cursor: pointer;
    transition: transform .12s ease, filter .15s ease;
}

.modal-btn:active,
.settings-btn:active,
.mini-btn:active,
.nav-item:active {
    transform: scale(.975);
    filter: brightness(1.12);
}

.btn-blue {
    background: linear-gradient(165deg, #4E97FF, #2C7BF2) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.btn-red {
    background: linear-gradient(165deg, #FF5B52, #E5342B) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.btn-gray {
    background: var(--panel-2) !important;
    color: var(--text) !important;
    border-color: var(--hairline-strong) !important;
}

.close-btn {
    background: transparent !important;
    color: var(--text-sub) !important;
    border: 1px solid var(--hairline-strong) !important;
    font-weight: 600 !important;
}

.close-btn:active {
    background: var(--panel-2) !important;
}

/* ---------- 7. Form controls ---------- */
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px 13px;
    margin-top: 8px;
    background: var(--bg-deep);
    color: var(--text);
    border: 1px solid var(--hairline-strong);
    border-radius: 11px;
    font-size: 14.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

textarea {
    resize: vertical;
    min-height: 62px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 140, 255, .18);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-dim);
}

select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-sub) 50%),
        linear-gradient(135deg, var(--text-sub) 50%, transparent 50%);
    background-position:
        calc(100% - 17px) calc(50% + 1px),
        calc(100% - 12px) calc(50% + 1px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-inline-end: 32px;
}

[dir="rtl"] select {
    /* نفس السهم، لكن على اليسار */
    background-position: 17px calc(50% + 1px), 12px calc(50% + 1px);
}

select option,
select optgroup {
    background: var(--panel);
    color: var(--text);
}

input[type="checkbox"] {
    width: 19px;
    height: 19px;
    accent-color: var(--accent-blue);
    flex: none;
    cursor: pointer;
}

label {
    font-size: 12.5px;
    color: var(--text-sub);
}

/* ---------- 8. Modals ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(5, 8, 16, .68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    /* display:flex يُضبط من الجافاسكربت */
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    animation: overlay-in .18s ease;
}

.modal-content {
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 20px 18px calc(20px + var(--safe-bottom));
    background: var(--panel);
    border: 1px solid var(--hairline-strong);
    border-bottom: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: var(--shadow-2);
    animation: sheet-up .26s cubic-bezier(.2, .9, .25, 1);
}

/* مقبض صغير أعلى النافذة (إشارة أنها قابلة للسحب/الإغلاق) */
.modal-content::before {
    content: "";
    display: block;
    width: 38px;
    height: 4px;
    border-radius: var(--r-pill);
    background: var(--hairline-strong);
    margin: -6px auto 14px;
}

.modal-content h3 {
    margin: 0 0 6px !important;
    font-size: 18px;
}

.modal-content p {
    color: var(--text-sub);
    margin: 6px 0 12px;
}

@keyframes sheet-up {
    from {
        transform: translateY(26px);
        opacity: .4;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes overlay-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* شاشات أعرض: النافذة في المنتصف بدل القاع */
@media (min-width: 560px) {
    .modal-overlay {
        align-items: center;
        padding: 20px;
    }

    .modal-content {
        border-radius: var(--r-lg);
        border-bottom: 1px solid var(--hairline-strong);
        padding-bottom: 20px;
    }
}

/* توحيد الصناديق الداخلية المكتوبة بـ inline style داخل النوافذ
   (بدون تعديل أي سطر في index.html أو script.js) */
.modal-content [style*="background: #111"],
.modal-content [style*="background:#111"],
.modal-content [style*="background: #1e1e1e"],
.modal-content [style*="background:#1e1e1e"],
#mainContainer [style*="background: #111"],
#mainContainer [style*="background:#111"] {
    background: var(--panel-2) !important;
    border-radius: var(--r-md) !important;
}

.modal-content [style*="border: 1px solid #444"],
.modal-content [style*="border:1px solid #444"],
.modal-content [style*="border: 1px solid #333"],
.modal-content [style*="border:1px solid #333"] {
    border-color: var(--hairline-strong) !important;
}

/* ---------- 8.1 Input prompt (بديل window.prompt) ---------- */
.prompt-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    font-size: 24px;
    border-radius: var(--r-pill);
    background: rgba(59, 140, 255, .14);
    border: 1px solid rgba(59, 140, 255, .30);
}

#inputPromptModal .modal-content {
    text-align: center;
}

#inputPromptModal h3 {
    text-align: center;
}

#inputPromptModal p {
    text-align: center;
    white-space: pre-line;
}

#promptInputField {
    text-align: center;
    font-size: 16px;
    font-weight: 650;
}

.prompt-error {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 69, 58, .12);
    border: 1px solid rgba(255, 69, 58, .35);
    color: #FF8C85;
    font-size: 12.5px;
    text-align: start;
    animation: shake-in .28s ease;
}

@keyframes shake-in {
    0% {
        transform: translateX(0);
        opacity: 0;
    }

    30% {
        transform: translateX(-4px);
        opacity: 1;
    }

    60% {
        transform: translateX(3px);
    }

    100% {
        transform: translateX(0);
    }
}

#inputPromptModal .prompt-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

#inputPromptModal .prompt-actions .modal-btn {
    margin-top: 0;
    flex: 1;
}

/* ---------- 9. Bottom navigation ---------- */
.bottom-nav {
    flex: none;
    /* كان position:fixed — الآن عنصر فليكس عادي داخل .app-shell، آخر
       عنصر في العمود، فلا يغطي أبداً نهاية .content-area مهما طال
       محتواها (هذا هو إصلاح مشكلة تغطية شريط الأقسام للمحتوى) */
    height: calc(var(--nav-h) + var(--safe-bottom));
    padding: 6px 8px calc(4px + var(--safe-bottom));
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(13, 18, 32, .9);
    backdrop-filter: saturate(160%) blur(20px);
    -webkit-backdrop-filter: saturate(160%) blur(20px);
    border-top: 1px solid var(--hairline);
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    flex: 1 0 66px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 12px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
}

.nav-item span {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-icon {
    font-size: 19px;
    line-height: 1.1;
    filter: grayscale(.55);
    transition: filter .15s ease, transform .15s ease;
}

.nav-item.active {
    color: var(--text);
    background: rgba(59, 140, 255, .14);
}

.nav-item.active .nav-icon {
    filter: none;
    transform: translateY(-1px);
}

/* ---------- 10. Language picker ---------- */
.lang-grid {
    display: grid;
    gap: 8px;
    margin-top: 6px;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--hairline-strong);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: start;
}

.lang-option .lang-flag {
    font-size: 21px;
    line-height: 1;
}

.lang-option .lang-native {
    flex: 1;
}

.lang-option .lang-latin {
    font-size: 11.5px;
    color: var(--text-dim);
    font-weight: 500;
}

.lang-option[aria-checked="true"] {
    border-color: var(--accent-blue);
    background: rgba(59, 140, 255, .14);
}

.lang-option[aria-checked="true"]::after {
    content: "✓";
    color: var(--accent-blue);
    font-weight: 800;
}

/* ---------- 11. Multi-account checkbox rows ---------- */
#multiRefillList label,
#multiTravelList label,
#globalMultiList label,
#adminUsersList label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 10px;
    font-size: 13.5px;
    color: var(--text);
}

#multiRefillList label:active,
#multiTravelList label:active,
#globalMultiList label:active {
    background: var(--raised);
}

/* ---------- 12. RTL ---------- */
[dir="rtl"] body {
    letter-spacing: 0;
}

/* قلب التنسيقات المكتوبة inline داخل الملفات الأصلية */
[dir="rtl"] [style*="text-align: left"],
[dir="rtl"] [style*="text-align:left"] {
    text-align: right !important;
}

[dir="rtl"] [style*="text-align: right"],
[dir="rtl"] [style*="text-align:right"] {
    text-align: left !important;
}

[dir="rtl"] [style*="margin-left: 10px"],
[dir="rtl"] [style*="margin-left:10px"] {
    margin-left: 0 !important;
    margin-right: 10px !important;
}

[dir="rtl"] [style*="border-left: 3px solid"],
[dir="rtl"] [style*="border-left:3px solid"] {
    border-left: 0 !important;
    border-right-width: 3px !important;
    border-right-style: solid !important;
    border-right-color: inherit;
}

[dir="rtl"] .modal-content,
[dir="rtl"] .content-area,
[dir="rtl"] .home-box {
    text-align: right;
}

[dir="rtl"] .modal-content[style*="text-align: center"],
[dir="rtl"] .modal-content[style*="text-align:center"] {
    text-align: center;
}

/* الأرقام والروابط تبقى LTR داخل النص العربي */
[dir="rtl"] .badge,
[dir="rtl"] .stat-value,
[dir="rtl"] input,
[dir="rtl"] #exactDepositAmount,
[dir="rtl"] #tgName,
[dir="rtl"] #tgUsername {
    direction: ltr;
    unicode-bidi: plaintext;
}

/* الأرقام والأوقات والروابط داخل النص العربي تبقى بترتيبها الصحيح */
[dir="rtl"] #mainContainer span,
[dir="rtl"] #mainContainer b,
[dir="rtl"] .modal-content b {
    unicode-bidi: plaintext;
}

[dir="rtl"] .badge {
    text-align: right;
}

/* ---------- 13. Accessibility & motion ---------- */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

/* ---------- 14. Small phones ---------- */
@media (max-width: 360px) {
    :root {
        --accbar-h: 84px;
    }

    .account-avatar,
    .add-account-btn {
        width: 48px;
        height: 48px;
    }

    .badge {
        font-size: 11.5px;
        padding: 2px 7px;
    }

    .user-name,
    #tgUsername {
        max-width: 74px;
    }
}
