// strings.jsx — EN/FA copy
const STRINGS = {
  en: {
    dir: "ltr",
    brand: "Get Call Home",
    tagline: "Living abroad? Call home for less, even when the internet there is gone.",
    // landing
    landing_h1_a: "Living abroad? Need to call home?",
    landing_h1_em: "We make it easy, and cheaper.",
    landing_sub: "Can't get through, or tired of what carriers charge? We ring your family on a local line and connect you. Your phone rings normally. You talk. Sign up and your first 2 minutes are free.",
    how_steps: [
      { n: "1", html: "<b>Give us</b> your family's number." },
      { n: "2", html: "A local line <b>calls them.</b>" },
      { n: "3", html: "Both phones ring. <b>You talk.</b>" }
    ],
    cta_signup: "Get started — 2 minutes free",
    cta_signin: "I already have an account",
    foot: "Made by a son who couldn't reach home.",
    // signup
    signup_h: "Two things and you're in.",
    signup_sub: "Create your account in seconds.",
    signup_phone: "Your phone number *",
    signup_email: "Email *",
    signup_password: "Password *",
    signup_name: "Name",
    signup_username: "Username",
    optional: "Optional",
    legal: "By continuing you agree to our terms. Calls are bridged through a server in Canada; no audio is recorded.",
    signup_cta: "Create my account",
    signup_trial_note: "You'll get 2 free minutes right away — no card needed.",
    have_account_q: "Have an account?",
    sign_in: "Sign in",
    no_account_q: "New here?",
    create_account: "Create an account",
    signin_h: "Welcome back.",
    signin_sub: "Enter your credentials to sign in.",
    signin_phone_or_email: "Phone or email *",
    signin_password: "Password *",
    signin_cta: "Sign in",
    signin_err: "Couldn't sign in. Check your phone, email, or password.",
    signup_err: "Couldn't create your account. That phone or email may already be in use.",
    network_err: "Can't reach the server. Try again in a moment.",
    // top bar
    minutes: "min",
    days_left: (n) => `${n} days left`,
    day_left: "1 day left",
    expired: "expired",
    buy_time: "Buy time",
    // tabs
    tab_keypad: "Keypad",
    tab_contacts: "Family",
    tab_recents: "Recents",
    // contacts
    family: "Family",
    search_placeholder: "Search family",
    add_contact: "Add someone",
    last_called: (when) => `Last called ${when}`,
    no_contacts_h: "Your family lives here.",
    no_contacts_p: "Add the people you want to reach. Their number, their name — that's it.",
    add_first: "Add your first contact",
    // contact form
    new_contact: "New contact",
    edit_contact: "Edit contact",
    photo_optional: "Add photo (optional)",
    first_name: "Name",
    relationship: "Relationship",
    relationship_ph: "e.g. Mom, Dadash, Khaleh",
    home_number: "Their phone number",
    home_number_hint: "Include the area code. We'll handle the +98.",
    notes: "Notes",
    notes_ph: "Best time to call, etc.",
    save: "Save contact",
    delete_contact: "Delete contact",
    cancel: "Cancel",
    // keypad
    kp_letters: ["", "", "ABC", "DEF", "GHI", "JKL", "MNO", "PQRS", "TUV", "WXYZ"],
    kp_hint_empty: "Paste or pick a number to call home",
    kp_hint_typing: "+98 will be added automatically",
    kp_paste: "Paste from clipboard",
    kp_pick: "Choose from contacts",
    kp_paste_err: "Couldn't read clipboard — copy the number first",
    kp_paste_empty: "Clipboard's empty — copy a number first",
    kp_pick_unavailable: "Contact picker isn't available on this browser",
    kp_pick_ios_hint: "Tap the contact icon above the keyboard to autofill",
    kp_hint_mobile: "Mobile · ready to call",
    kp_hint_capital: "Landline · ready to call",
    kp_hint_landline: "Landline · ready to call",
    kp_err_short: "Numbers are 10 digits after +98.",
    kp_err_long: "Too long — numbers are 10 digits after +98.",
    kp_err_unknown: "We can't call this number yet. Check it and try again.",
    kp_schedule: "Schedule",
    call: "Call",
    save_to_contacts: "Save to contacts",
    // recents
    recents: "Recents",
    today: "Today",
    yesterday: "Yesterday",
    earlier: "Earlier this week",
    queued: "queued",
    connecting: "connecting…",
    "in-progress": "in progress",
    completed: "completed",
    cancelled: "cancelled",
    missed: "missed",
    no_recents_h: "No calls yet.",
    no_recents_p: "Your first call will appear here, with how long it lasted and how it went.",

    // ── Notification pill (active call status) ──────────────
    notify_queued_title: (name) => `Calling ${name}`,
    notify_queued_sub: "Your phone will ring in a minute if they pick up.",
    notify_queued_retry_sub: "We'll keep trying for 5 minutes if they don't pick up.",
    notify_queued_expire_sub: (m) => `Your phone will ring if they pick up. We keep trying for up to ${m} minutes.`,
    notify_retrying_title: "Trying another line…",
    notify_retrying_sub: "The first line didn't connect. Hang tight.",
    notify_inprogress_sub: "Connecting your call…",
    notify_failed_title: (name) => `Call to ${name} failed`,
    notify_no_charge: "No minutes were charged.",
    fail_a_busy: "The number you called was busy",
    fail_a_no_answer: "No answer from the number you called",
    fail_b_busy: "Your phone was busy",
    fail_b_no_answer: "Your phone did not answer",
    fail_connect: "The call could not be connected. Please try again",
    fail_expired: "No line was available. Please try again in a few minutes",
    fail_timeout: "The call ended without a report; nothing was charged",
    fail_unknown: "The call failed. Please try again",
    failed: "failed",
    fail_short_a_busy: "busy", fail_short_a_no_answer: "no answer",
    fail_short_b_busy: "your phone busy", fail_short_b_no_answer: "your phone no answer",
    fail_short_connect: "not connected", fail_short_expired: "no line", fail_short_timeout: "no report",
    err_active_call: "You already have a call in progress. Wait for it to finish.",
    err_no_minutes: "You have no minutes left. Please buy a pack.",
    err_offline: "Cannot reach the server. Check your connection.",
    err_generic: "Failed to place the call. Please try again.",
    notify_scheduled_title: (name) => `Scheduled · ${name}`,
    notify_scheduled_sub: (when) => `We'll call your phone ${when} if they pick up.`,
    notify_completed_title: (name) => `Talked with ${name}`,
    notify_completed_sub: (dur) => `Call lasted ${dur}`,
    notify_missed_title: (name) => `${name} didn't pick up`,
    notify_missed_sub: "Try again now or schedule for later.",
    notify_cancel: "Cancel",
    notify_dismiss: "Dismiss",
    notify_retry: "Try again",

    // ── Schedule sheet ───────────────────────────────────────
    schedule_h: "Schedule a call",
    schedule_sub: "Pick a time in the next 24 hours. Your phone will ring when they pick up.",
    schedule_who: "Call",
    schedule_when: "When",
    schedule_now: "Now",
    schedule_30m: "In 30 min",
    schedule_1h: "In 1 hour",
    schedule_2h: "In 2 hours",
    schedule_tonight: "Tonight 8 PM",
    schedule_tomorrow_morning: "Tomorrow 8 AM",
    schedule_custom: "Pick a time…",
    schedule_retry_label: "If they don't pick up",
    schedule_retry_once: "Try once",
    schedule_retry_keep: "Keep trying 5 min",
    schedule_cta: "Schedule call",
    schedule_now_cta: "Call now",
    schedule_24h_limit: "Up to 24 hours from now",
    schedule_pick_contact: "Pick someone to call",
    schedule_hours: "Hours",
    schedule_minutes: "Min",
    schedule_in_h: (h, m) => m === 0 ? `in ${h} ${h === 1 ? 'hour' : 'hours'}` : `in ${h} ${h === 1 ? 'hr' : 'hrs'} ${m} min`,
    schedule_in_m: (m) => `in ${m} min`,
    schedule_will_call: "Will call",

    // ── Upcoming section ────────────────────────────────────
    upcoming_h: "Upcoming",
    upcoming_in: (mins) => mins < 60 ? `in ${mins} min` : (mins < 120 ? `in 1 hr ${mins - 60} min` : `in ${Math.round(mins/60)} hrs`),
    upcoming_at: (time) => `at ${time}`,
    upcoming_tomorrow: (time) => `tomorrow at ${time}`,
    upcoming_cancel: "Cancel",

    // schedule action sheet shown when tapping a contact
    action_sheet_call_now: "Call now",
    action_sheet_schedule: "Schedule for later",
    action_sheet_edit: "Edit contact",
    // buy
    buy_h: "Add minutes",
    buy_h_empty: "You're out of minutes",
    buy_sub_empty: "Pick a plan to call your family",
    buy_anchor: {
      usd: "Regular international calls often don't connect. Even when they do, carriers charge $0.70–$6.00 per minute. We connect you for $0.33.",
      eur: "Regular international calls often don't connect. Even when they do, carriers charge €0.60–€5.00 per minute. We connect you for €0.33.",
      gbp: "Regular international calls often don't connect. Even when they do, carriers charge £0.60–£5.00 per minute. We connect you for £0.30.",
    },
    plan_icons: { starter: "⚡", standard: "👨‍👩‍👧", premium: "⭐" },
    plan_subs: {
      starter:  "A quick hello",
      standard: "A good catch-up",
      premium:  "Talk as long as you need"
    },
    plan_tag_best: "Most popular",
    currency_sym: { usd: "$", eur: "€", gbp: "£" },
    price_fmt: (p, sym) => `${sym || "$"}${p}`,
    mins_fmt: (n) => `${n} min`,
    plan_detail: (mins, days) => `${mins} min · Valid for ${days} days`,
    per_min_fmt: (rate, sym) => `${sym || "$"}${rate}/min`,
    expires_in: (d) => `Expires in ${d} days`,
    pkg_trial_note: "🎁 Your first 2 minutes are on the house — they were added when you signed up.",
    urgency_banner: (timeLeft, days) => `${timeLeft} left — expires in ${days} day${days === 1 ? "" : "s"}. Use them or top up.`,
    total: "Total",
    pay_with: "Pay",
    secure: "🔒 Secured by Paddle · no audio recorded",
    // call screen
    call_status_queued: "In queue — we'll dial when ready",
    call_status_reaching: (name) => `Reaching ${name}…`,
    call_status_connecting: "Connecting both phones…",
    call_status_connected: "Connected",
    call_end_call: "End call",
    call_mute: "Mute",
    call_speaker: "Speaker",
    call_keypad: "Keypad",
    call_hold: "Hold",
    call_add: "Add",
    leg_you: "You — Toronto",
    leg_them: "Home",
    talked_for: "Talked for",
    // empty state for first call
    first_call_h: "Ready to make the first call?",
    first_call_p: "Tap a name in Family, or punch in a number on the Keypad. Your 2 free minutes start counting only when both phones connect.",
    // low / empty
    low_time_banner: (timeLeft) => `Only ${timeLeft} min left. Not enough for a real conversation. Top up now.`,
    expiry_2days_banner: "2 days before your minutes disappear. Call or top up.",
    expiry_1day_banner: "Tomorrow your minutes are gone. Don't lose them.",
    expiry_today_banner: "Last chance — your minutes vanish at midnight.",
    empty_banner: "You're out of minutes. Buy time to make your next call.",
    zero_state_h: "Your family is a phone call away.",
    zero_state_p: "Pick a plan.",
    top_up: "Top up"
  },
  fa: {
    dir: "rtl",
    brand: "تماس با خانه",
    tagline: "حتی وقتی اینترنت آنجا قطع است، می‌توانی با خانواده‌ات حرف بزنی.",
    landing_h1_a: "وقتی اینترنت تاریک می‌شود،",
    landing_h1_em: "گوشی‌شان هنوز زنگ می‌خورد.",
    landing_sub: "تماس با خانه به شیوهٔ قدیمی — از طریق خط ثابت یا موبایل — به خانواده‌ات می‌رسد. قطعی اینترنت نمی‌تواند جدای‌تان کند.",
    how_steps: [
      { n: "۱", html: "<b>شمارهٔ خانواده‌ات را</b> یک بار ذخیره کن." },
      { n: "۲", html: "<b>روی اسمش بزن.</b> ما هر دو خط را وصل می‌کنیم." },
      { n: "۳", html: "<b>صحبت کن.</b> فقط برای دقیقه‌هایی که حرف زدی پول می‌دهی." }
    ],
    cta_signup: "شروع کن — ۲ دقیقهٔ رایگان",
    cta_signin: "حساب دارم",
    foot: "ساخته شده توسط پسری که نمی‌توانست به خانه زنگ بزند.",
    signup_h: "فقط دو چیز و تمام.",
    signup_sub: "در چند ثانیه حساب بسازید.",
    signup_phone: "شمارهٔ تماس تو *",
    signup_email: "ایمیل *",
    signup_password: "رمز عبور *",
    signup_name: "نام",
    signup_username: "نام کاربری",
    optional: "اختیاری",
    legal: "با ادامه دادن شرایط ما را می‌پذیری. تماس‌ها از طریق سروری در کانادا برقرار می‌شوند؛ صدایی ضبط نمی‌شود.",
    signup_cta: "حسابم را بساز",
    signup_trial_note: "همین حالا ۲ دقیقهٔ رایگان می‌گیری — بدون کارت.",
    have_account_q: "حساب داری؟",
    sign_in: "ورود",
    no_account_q: "تازه آمدی؟",
    create_account: "ساخت حساب",
    signin_h: "خوش برگشتی.",
    signin_sub: "اطلاعات ورود خود را وارد کنید.",
    signin_phone_or_email: "شماره یا ایمیل *",
    signin_password: "رمز عبور *",
    signin_cta: "ورود",
    signin_err: "ورود ممکن نشد. شماره، ایمیل یا رمز را بررسی کن.",
    signup_err: "ساخت حساب ممکن نشد. این شماره یا ایمیل قبلاً ثبت شده.",
    network_err: "ارتباط با سرور برقرار نشد. کمی بعد دوباره امتحان کن.",
    minutes: "دقیقه",
    days_left: (n) => `${toFa(n)} روز مانده`,
    day_left: "۱ روز مانده",
    expired: "تمام شد",
    buy_time: "خرید دقیقه",
    tab_keypad: "صفحه‌کلید",
    tab_contacts: "خانواده",
    tab_recents: "اخیر",
    family: "خانواده",
    search_placeholder: "جستجوی خانواده",
    add_contact: "افزودن کسی",
    last_called: (when) => `آخرین تماس ${when}`,
    no_contacts_h: "خانواده‌ات اینجا زندگی می‌کند.",
    no_contacts_p: "کسانی را که می‌خواهی به آن‌ها زنگ بزنی اضافه کن. فقط یک اسم و یک شماره.",
    add_first: "اولین مخاطب را اضافه کن",
    new_contact: "مخاطب تازه",
    edit_contact: "ویرایش مخاطب",
    photo_optional: "افزودن عکس (اختیاری)",
    first_name: "نام",
    relationship: "نسبت",
    relationship_ph: "مثلاً مامان، داداش، خاله",
    home_number: "شمارهٔ او",
    home_number_hint: "کد شهر را بنویس. ‎+۹۸ را ما اضافه می‌کنیم.",
    notes: "یادداشت",
    notes_ph: "بهترین زمان تماس و…",
    save: "ذخیرهٔ مخاطب",
    delete_contact: "حذف مخاطب",
    cancel: "انصراف",
    kp_letters: ["", "", "ABC", "DEF", "GHI", "JKL", "MNO", "PQRS", "TUV", "WXYZ"],
    kp_hint_empty: "شماره را پیست کنید یا از مخاطبین انتخاب کنید",
    kp_hint_typing: "‎+۹۸ خودکار اضافه می‌شود",
    kp_paste: "پیست از کلیپ‌بورد",
    kp_pick: "انتخاب از مخاطبین",
    kp_paste_err: "کلیپ‌بورد خوانده نشد — اول شماره را کپی کنید",
    kp_paste_empty: "کلیپ‌بورد خالیه — اول یه شماره کپی کنید",
    kp_pick_unavailable: "انتخاب مخاطب در این مرورگر پشتیبانی نمی‌شود",
    kp_pick_ios_hint: "روی آیکون مخاطبین بالای کیبورد بزنید",
    kp_hint_mobile: "موبایل · آماده",
    kp_hint_capital: "تلفن ثابت · آماده",
    kp_hint_landline: "تلفن ثابت · آماده",
    kp_err_short: "شماره بعد از ‎+۹۸ باید ۱۰ رقم باشد.",
    kp_err_long: "خیلی طولانی است. شماره بعد از ‎+۹۸ باید ۱۰ رقم باشد.",
    kp_err_unknown: "فعلاً نمی‌توانیم با این شماره تماس بگیریم. شماره را بررسی کن.",
    kp_schedule: "زمان‌بندی",
    call: "تماس",
    save_to_contacts: "ذخیره در مخاطب‌ها",
    recents: "تماس‌های اخیر",
    today: "امروز",
    yesterday: "دیروز",
    earlier: "اوایل این هفته",
    queued: "در صف",
    connecting: "در حال وصل…",
    "in-progress": "در حال انجام",
    completed: "انجام شد",
    cancelled: "لغو شد",
    missed: "از دست رفت",
    no_recents_h: "هنوز تماسی نگرفته‌ای.",
    no_recents_p: "اولین تماست اینجا ظاهر می‌شود، با مدت و وضعیتش.",

    notify_queued_title: (name) => `در حال تماس با ${name}`,
    notify_queued_sub: "اگر او پاسخ دهد، در کمتر از یک دقیقه گوشی تو زنگ می‌خورد.",
    notify_queued_retry_sub: "تا ۵ دقیقه دوباره تلاش می‌کنیم اگر پاسخ نداد.",
    notify_queued_expire_sub: (m) => `اگر او پاسخ دهد گوشی تو زنگ می‌خورد. تا ${m} دقیقه تلاش می‌کنیم.`,
    notify_retrying_title: "در حال امتحان خط دیگر…",
    notify_retrying_sub: "خط اول وصل نشد. کمی صبر کن.",
    notify_inprogress_sub: "در حال وصل کردن تماس…",
    notify_failed_title: (name) => `تماس با ${name} ناموفق بود`,
    notify_no_charge: "هیچ دقیقه‌ای کم نشد.",
    fail_a_busy: "شماره‌ی مقصد مشغول بود",
    fail_a_no_answer: "شماره‌ی مقصد پاسخ نداد",
    fail_b_busy: "گوشی تو مشغول بود",
    fail_b_no_answer: "گوشی تو پاسخ نداد",
    fail_connect: "تماس وصل نشد. لطفاً دوباره امتحان کن",
    fail_expired: "خط آزاد پیدا نشد. چند دقیقه‌ی دیگر دوباره امتحان کن",
    fail_timeout: "تماس بدون گزارش تمام شد؛ چیزی کم نشد",
    fail_unknown: "تماس ناموفق بود. دوباره امتحان کن",
    failed: "ناموفق",
    fail_short_a_busy: "مشغول", fail_short_a_no_answer: "بی‌پاسخ",
    fail_short_b_busy: "گوشی تو مشغول", fail_short_b_no_answer: "گوشی تو بی‌پاسخ",
    fail_short_connect: "وصل نشد", fail_short_expired: "خط نبود", fail_short_timeout: "بدون گزارش",
    err_active_call: "یک تماس در جریان داری. صبر کن تمام شود.",
    err_no_minutes: "دقیقه‌ای نداری. لطفاً بسته بخر.",
    err_offline: "اتصال به سرور برقرار نشد. اینترنتت را بررسی کن.",
    err_generic: "برقراری تماس ناموفق بود. دوباره امتحان کن.",
    notify_scheduled_title: (name) => `زمان‌بندی شد · ${name}`,
    notify_scheduled_sub: (when) => `${when} به گوشی تو زنگ می‌زنیم.`,
    notify_completed_title: (name) => `گفت‌وگو با ${name}`,
    notify_completed_sub: (dur) => `مدت تماس ${dur}`,
    notify_missed_title: (name) => `${name} پاسخ نداد`,
    notify_missed_sub: "دوباره امتحان کن یا برای بعد زمان‌بندی کن.",
    notify_cancel: "لغو",
    notify_dismiss: "بستن",
    notify_retry: "تلاش دوباره",

    schedule_h: "زمان‌بندی تماس",
    schedule_sub: "زمانی در ۲۴ ساعت آینده انتخاب کن. وقتی پاسخ دهد، گوشی تو زنگ می‌خورد.",
    schedule_who: "تماس با",
    schedule_when: "چه زمانی",
    schedule_now: "الان",
    schedule_30m: "تا ۳۰ دقیقه دیگر",
    schedule_1h: "تا یک ساعت دیگر",
    schedule_2h: "تا ۲ ساعت دیگر",
    schedule_tonight: "امشب ۸ شب",
    schedule_tomorrow_morning: "فردا ۸ صبح",
    schedule_custom: "انتخاب زمان…",
    schedule_retry_label: "اگر پاسخ ندادند",
    schedule_retry_once: "یک‌بار امتحان",
    schedule_retry_keep: "تا ۵ دقیقه تلاش",
    schedule_cta: "زمان‌بندی تماس",
    schedule_now_cta: "تماس گرفتن",
    schedule_24h_limit: "حداکثر تا ۲۴ ساعت بعد",
    schedule_pick_contact: "انتخاب مخاطب",
    schedule_hours: "ساعت",
    schedule_minutes: "دقیقه",
    schedule_in_h: (h, m) => m === 0 ? `تا ${toFa(h)} ساعت` : `تا ${toFa(h)} ساعت و ${toFa(m)} دقیقه`,
    schedule_in_m: (m) => `تا ${toFa(m)} دقیقه`,
    schedule_will_call: "زمان تماس",

    upcoming_h: "برنامه‌ریزی شده",
    upcoming_in: (mins) => mins < 60 ? `تا ${toFa(mins)} دقیقه` : (mins < 120 ? `تا یک ساعت و ${toFa(mins - 60)} دقیقه` : `تا ${toFa(Math.round(mins/60))} ساعت`),
    upcoming_at: (time) => `ساعت ${time}`,
    upcoming_tomorrow: (time) => `فردا ساعت ${time}`,
    upcoming_cancel: "لغو",

    action_sheet_call_now: "تماس گرفتن",
    action_sheet_schedule: "زمان‌بندی برای بعد",
    action_sheet_edit: "ویرایش مخاطب",
    buy_h: "افزودن دقیقه",
    buy_h_empty: "دقیقه‌ای نمانده",
    buy_sub_empty: "یک بسته انتخاب کن تا با خانواده‌ات صحبت کنی",
    buy_anchor: {
      usd: "تماس بین‌المللی معمولی اغلب وصل نمی‌شود. حتی وقتی وصل شود، اپراتورها دقیقه‌ای ۰٫۷۰ تا ۶ دلار می‌گیرند. ما دقیقه‌ای ۰٫۳۳ دلار وصل می‌کنیم.",
      eur: "تماس بین‌المللی معمولی اغلب وصل نمی‌شود. حتی وقتی وصل شود، اپراتورها دقیقه‌ای ۰٫۶۰ تا ۵ یورو می‌گیرند. ما دقیقه‌ای ۰٫۳۳ یورو وصل می‌کنیم.",
      gbp: "تماس بین‌المللی معمولی اغلب وصل نمی‌شود. حتی وقتی وصل شود، اپراتورها دقیقه‌ای ۰٫۶۰ تا ۵ پوند می‌گیرند. ما دقیقه‌ای ۰٫۳۰ پوند وصل می‌کنیم.",
    },
    plan_icons: { starter: "⚡", standard: "👨‍👩‍👧", premium: "⭐" },
    plan_subs: {
      starter:  "یک سلام سریع",
      standard: "یک احوال‌پرسی خوب",
      premium:  "تا دلت بخواهد حرف بزن"
    },
    plan_tag_best: "محبوب‌ترین",
    currency_sym: { usd: "$", eur: "€", gbp: "£" },
    price_fmt: (p, sym) => `${sym || "$"}${toFa(p)}`,
    mins_fmt: (n) => `${toFa(n)} دقیقه`,
    plan_detail: (mins, days) => `${toFa(mins)} دقیقه · اعتبار ${toFa(days)} روز`,
    per_min_fmt: (rate, sym) => `دقیقه‌ای ${sym || "$"}${toFa(rate)}`,
    expires_in: (d) => `اعتبار ${toFa(d)} روز`,
    pkg_trial_note: "🎁 ۲ دقیقهٔ اولت مهمان ماست — هنگام ثبت‌نام اضافه شد.",
    urgency_banner: (timeLeft, days) => `${timeLeft} مانده — اعتبار ${toFa(days)} روز دیگر تمام می‌شود. استفاده کن یا شارژ کن.`,
    total: "جمع",
    pay_with: "پرداخت",
    secure: "🔒 امن با Paddle · صدا ضبط نمی‌شود",
    call_status_queued: "در صف — به‌محض آماده شدن زنگ می‌زنیم",
    call_status_reaching: (name) => `${name} را می‌گیریم…`,
    call_status_connecting: "وصل کردن هر دو خط…",
    call_status_connected: "متصل شد",
    call_end_call: "پایان تماس",
    call_mute: "بی‌صدا",
    call_speaker: "بلندگو",
    call_keypad: "صفحه‌کلید",
    call_hold: "نگه‌داری",
    call_add: "افزودن",
    leg_you: "تو — تورنتو",
    leg_them: "خانه",
    talked_for: "مدت گفتگو",
    first_call_h: "آماده‌ای اولین تماس را بگیری؟",
    first_call_p: "روی یک اسم در خانواده بزن یا یک شماره روی صفحه‌کلید وارد کن. ۲ دقیقهٔ رایگانت فقط وقتی شروع می‌شود که هر دو خط وصل شدند.",
    low_time_banner: (timeLeft) => `فقط ${timeLeft} دقیقه مانده. برای یک مکالمهٔ واقعی کافی نیست. همین الان شارژ کن.`,
    expiry_2days_banner: "۲ روز تا از بین رفتن دقیقه‌هات. زنگ بزن یا شارژ کن.",
    expiry_1day_banner: "فردا دقیقه‌هات تمام می‌شود. از دستشان نده.",
    expiry_today_banner: "آخرین فرصت — دقیقه‌هات نیمه‌شب از بین می‌روند.",
    empty_banner: "دقیقه‌ای نمانده. برای تماس بعدی شارژ کن.",
    zero_state_h: "خانواده‌ات یک تماس با تو فاصله دارند.",
    zero_state_p: "یک بسته انتخاب کن.",
    top_up: "شارژ"
  }
};

// helper: latin → persian digits
function toFa(s) {
  return String(s).replace(/[0-9]/g, (d) => "۰۱۲۳۴۵۶۷۸۹"[d]);
}
function fromFa(s) {
  return String(s).replace(/[۰-۹]/g, (d) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(d)));
}

// strings.jsx helpers — the home country phone validator
// Returns one of:
//   { valid: true,  type: "mobile" | "home" | "landline", e164, national }
//   { valid: false, reason: "empty" | "short" | "long" | "unknown_prefix", national }
const IR_LANDLINE_PREFIXES = new Set([
  "11","13","17","21","23","24","25","26","28","31","34","35","38",
  "41","44","45","51","54","56","58","61","66","71","74","76","77",
  "81","83","84","86","87"
]);

function validateHomeNumber(input) {
  if (!input || !String(input).trim()) return { valid: false, reason: "empty" };
  let s = fromFa(String(input)).replace(/[^\d+]/g, "");
  // strip country code variants
  if (s.startsWith("+98")) s = s.slice(3);
  else if (s.startsWith("0098")) s = s.slice(4);
  else if (s.startsWith("98") && s.length > 10) s = s.slice(2);
  // strip leading 0 (national prefix)
  if (s.startsWith("0")) s = s.slice(1);

  if (s.length === 0) return { valid: false, reason: "empty" };
  if (s.length < 10)  return { valid: false, reason: "short", national: s };
  if (s.length > 10)  return { valid: false, reason: "long", national: s };

  const firstTwo = s.slice(0, 2);
  if (s[0] === "9") {
    return { valid: true, type: "mobile", e164: "+98" + s, national: s };
  }
  if (firstTwo === "21") {
    return { valid: true, type: "home", e164: "+98" + s, national: s };
  }
  if (IR_LANDLINE_PREFIXES.has(firstTwo)) {
    return { valid: true, type: "landline", e164: "+98" + s, national: s };
  }
  return { valid: false, reason: "unknown_prefix", national: s };
}

window.STRINGS = STRINGS;
window.toFa = toFa;
window.fromFa = fromFa;
window.validateHomeNumber = validateHomeNumber;
