// YomiAI i18n — Japanese / English dictionary + language detection
// Detection priority:
//   1. ?lang=en or ?lang=ja in URL
//   2. localStorage('yomi-lang')
//   3. navigator.language starts with 'ja' → ja, else → en
//   (Original <html lang="ja"> is just a default; browser preference wins.)

(function () {
  const DICT = {
    ja: {
      // ── HTML <head> ──
      docTitle: 'YomiAI — AIで読むRSSリーダー',
      docDescription: 'AIレコメンド・生体認証ロック・日本語完全対応を兼ね備えたRSSリーダー。iOS / Android対応。',

      // ── Nav ──
      navFeatures: '機能',
      navGallery: '画面',
      navPricing: '料金',
      navFaq: 'FAQ',
      navDownload: 'ダウンロード',
      navToggleThemeLight: 'ライトモード',
      navToggleThemeDark: 'ダークモード',
      navLangSwitch: 'EN',
      navLangSwitchTitle: 'Switch to English',

      // ── Hero ──
      heroEyebrow: 'v2.0 · デイリーダイジェスト・オンデバイス翻訳 新搭載',
      heroTitleLine1: 'AIが選ぶ',
      heroTitleLine2: 'あなただけの',
      heroTitleLine3: '情報空間',
      heroTitleLine3Suffix: '。',
      heroEn: 'AI-curated reader · for your own signal',
      heroLede:
        'YomiAIは、AIレコメンド・生体認証ロック・日本語完全対応の3つを兼ね備えたRSSリーダー。お気に入りのブログとニュースを、あなた好みの順番で毎朝届けます。',
      heroCtaPrimary: '無料で始める',
      heroCtaGhost: '機能を見る',
      heroMeta1: 'Free プランあり',
      heroMeta2: 'オフライン対応',
      heroMeta3: '広告なし',

      // ── Metrics ──
      metricSources: 'RSS sources',
      metricPicks: 'AI picks / day',
      metricJP: 'Japanese UI',
      metricLifetime: 'Lifetime buyout',
      metricAdFree: '広告ゼロ',

      // ── Features section ──
      featuresLabel: '§ Features',
      featuresTitle1: '情報収集を、',
      featuresTitle2: 'AIがもっとスマートに。',
      featuresLede:
        'AIレコメンド・生体認証ロック・日本語完全対応。既存のRSSリーダーにはない3要件の同時実現で、あなたの「読みたい」を最短で届けます。',

      // Feature 01 — AI Recommend
      f01Tag: '01 · AI RECOMMEND · PRO',
      f01Title: 'AIおすすめ記事 & フィード',
      f01Body:
        '先進のAIモデルを搭載。興味タグと閲覧履歴からあなたの興味プロファイルを自動構築し、ホーム画面には最大5件のおすすめ記事、おすすめフィード画面には最大10件の新しい購読候補を推薦理由付きで提案します。',
      f01TagsLabel: '興味タグ:',
      f01TagTech: 'テクノロジー',
      f01TagBiz: 'ビジネス',
      f01TagDesign: 'デザイン',
      f01Results: 'AI RECOMMENDATION',
      f01ResultsCount: '— 3 results',
      f01ItemsTech: ['SwiftUI 6 のNav改善', 'Rustでエッジ実装', '生成AI UXリサーチ'],
      f01ItemsBiz: ['2026半導体投資動向', 'BtoB SaaSの新PLG', 'リモート評価制度'],
      f01ItemsDesign: ['Apple HIG 2026 updates', 'Figma AutoLayout深掘り', 'Material 3 tokens'],

      // Feature 00 — Daily Digest (NEW · headline)
      fDigestTag: '00 · DAILY DIGEST · PRO',
      fDigestTitle: '毎朝、AIが要点だけまとめる',
      fDigestBody:
        '過去24時間に届いた購読フィード記事を、AIが3〜5トピックに集約。重要度ラベル付きで、忙しい朝でも要点だけを掴めます。毎朝6〜12時のローカル通知にも対応（Pro限定）。',
      fDigestKicker1: '本日のダイジェスト',
      fDigestKicker2: '4トピック · 18記事 · 過去24h',
      fDigestT1Label: '重要',
      fDigestT1Title: 'OpenAI、推論モデル「o3」を一般提供開始',
      fDigestT1Sub: '3記事 · ベンチマーク・料金・実測比較',
      fDigestT2Label: '注目',
      fDigestT2Title: 'Flutter 4.0 安定版リリース',
      fDigestT2Sub: '2記事 · Impeller v2 で描画 22% 改善',
      fDigestT3Label: '参考',
      fDigestT3Title: '2026年 SaaS 業界の M&A 動向',
      fDigestT3Sub: '1記事 · 前年比 1.7 倍',

      // Feature 08 — On-device Translation (NEW)
      fTranslationTag: '08 · ON-DEVICE TRANSLATION',
      fTranslationTitle1: '記事をその場で',
      fTranslationTitle2: '日本語に翻訳',
      fTranslationBody:
        'iOS 18+ の Translation API と Android ML Kit を使った完全オンデバイス翻訳。サーバー送信ゼロ・追加料金なしで、英語の技術記事もタップひとつで日本語に変わります。',
      fTranslationBefore: 'EN · original',
      fTranslationBeforeText: 'A new inference framework dramatically improves runtime efficiency.',
      fTranslationAfter: 'JA · 翻訳済み',
      fTranslationAfterText: '新しい推論フレームワークが実行効率を劇的に改善します。',
      fTranslationDevice: 'on-device · no cloud',

      // Feature 09 — Full-text Search (NEW)
      fSearchTag: '09 · FULL-TEXT SEARCH',
      fSearchTitle1: '読んだ記事を',
      fSearchTitle2: 'いつでも掘り出す',
      fSearchBody:
        'SQLite + bigram でローカル即時検索。日本語の部分一致にも対応し、ネットワーク不要。Free でも全機能利用可能です。',
      fSearchQuery: '半導体',
      fSearchResult1: '2026年の半導体投資動向',
      fSearchResult2: 'TSMC 3nm 量産計画の最新',
      fSearchResult3: 'メモリ価格回復 ― DRAM の動向',
      fSearchHits: '3件 / 127記事',

      // Feature 02 — Category Lock
      f02Tag: '02 · CATEGORY LOCK · PRO',
      f02Title1: '生体認証で',
      f02Title2: 'プライバシーを守る',
      f02Body:
        '見られたくないフィードはカテゴリー単位で Face ID / Touch ID / 指紋認証でロック。ロック状態はアプリを閉じるたびにリセット。',
      f02TryIt: 'TRY IT →',
      f02BtnLocked: '生体認証でロック解除',
      f02BtnUnlocked: 'ロック解除済み — タップで戻す',
      f02Hint1: 'プライベートなフィードはカテゴリーごとロック。',
      f02Hint2: 'アプリを再起動すると自動で再ロックします。',

      // Feature 03 — Offline
      f03Tag: '03 · OFFLINE FIRST',
      f03Title1: '電波がなくても',
      f03Title2: '読める',
      f03Body:
        '端末内のローカルDBに保存されるので、地下鉄でも機内でも保存済み記事をそのまま読めます。オフライン時の変更はキューに蓄積、復帰時に自動同期。',
      f03Offline: 'offline',
      f03Cached: '127 articles cached',
      f03CachedSub: 'local-first · offline-ready',

      // Feature 04 — Auto-category
      f04Tag: '04 · AUTO-CATEGORIZE · PRO',
      f04Title1: '未分類フィードを',
      f04Title2: 'AIが自動で分類',
      f04Body:
        'フィード管理画面の「自動カテゴリー分類」ボタンで、未分類フィードを既存カテゴリーへAIがまとめて振り分け。',
      f04Item1: 'Next.js 15 RC',
      f04Item2: 'SaaS指標KPI',
      f04Item3: 'Figma update',

      // Feature 05 — Widget
      f05Tag: '05 · HOME WIDGET',
      f05Title1: 'ホーム画面ウィジェットで',
      f05Title2: '開かずに最新記事',
      f05Body:
        'iOS / Android のホーム画面ウィジェットに対応。バックグラウンドで60分ごとに更新し、Proユーザーには AI おすすめ記事を優先表示します。',
      f05Pick: 'AI PICK',
      f05PickBody: 'LLMの実行効率を30%改善',
      f05Latest: 'LATEST · 3 articles',
      f05Latest1: 'SwiftUI 6 Nav改善',
      f05Latest2: 'Rustでエッジ実装',
      f05Latest3: '日経BP半導体',

      // Feature 06 — Material You
      f06Tag: '06 · MATERIAL YOU',
      f06Title1: 'Android 12+ で',
      f06Title2: '壁紙に調和するテーマ',
      f06Body:
        'Material You の Dynamic Color に対応。端末の壁紙から抽出されたパレットに、アプリの画面が自動で馴染みます。',

      // Feature 07 — Accessibility
      f07Tag: '07 · ACCESSIBILITY',
      f07Title1: 'フォントサイズと',
      f07Title2: 'ダークモードを自由に',
      f07Body:
        '本文の文字サイズを4段階で調整可能。ライト/ダーク/システム連動の3モードを搭載し、夜間や明るい屋外でも快適に読書できます。',
      f07Preview: 'AIが選んだ今日の一本を、あなたの読みやすさで。',

      // ── Gallery ──
      galleryLabel: '§ In-app',
      galleryTitle1: '実際の画面を',
      galleryTitle2: 'のぞいてみる',
      galleryLede:
        '主要 5 画面をピックアップ。Material 3 Expressive に準拠し、日本語の読みやすさを最優先にデザインしました。',
      galleryHome: 'Home · ホーム',
      galleryHomeSub: 'AI recommends',
      galleryDigest: 'Digest · ダイジェスト',
      galleryDigestSub: 'Daily AI summary',
      galleryCategories: 'Subscribed · 購読中',
      galleryCategoriesSub: 'Per-category biometric lock',
      galleryRecommend: 'Discover · おすすめ',
      galleryRecommendSub: 'AI feed recommendations',
      galleryReader: 'Reader · 記事',
      galleryReaderSub: 'AI summary & translation',

      // ── Pricing ──
      pricingLabel: '§ Pricing',
      pricingTitle1: '必要な分だけ、',
      pricingTitle2: 'シンプルな料金。',
      pricingMonthly: '月額',
      pricingAnnual: '年額 (約17%オフ)',

      planFree: 'Free',
      planFreePrice: '¥0',
      planFreePeriod: '/永久',
      planFreeDesc: 'まず試してみたい方に',
      planFreeFeatures: [
        'フィード登録 15件まで',
        'ブックマーク 30件',
        'カテゴリー 3件',
        '記事閲覧 / オフライン保存 無制限',
        'オンデバイス翻訳・全文検索',
        'ライト / ダークテーマ',
      ],
      planFreeCta: '無料で始める',

      planPro: 'Pro',
      planProPriceMonth: '¥200',
      planProPriceYear: '¥2,000',
      planProPeriodMonth: '/月',
      planProPeriodYear: '/年',
      planProDesc: '本気で情報収集する方に',
      planProFeatures: [
        'フィード・ブックマーク・カテゴリー 無制限',
        'デイリーダイジェスト + 毎朝のローカル通知',
        'AIレコメンド (おすすめフィード + 注目記事)',
        'AIによる自動カテゴリー分類',
        'カテゴリーロック (生体認証)',
        'ホーム画面ウィジェット',
      ],
      planProCta: 'Proを試す',
      planProRibbon: 'RECOMMENDED',

      planLifetime: 'Pro Lifetime',
      planLifetimePrice: '¥3,000',
      planLifetimePeriod: '/買い切り',
      planLifetimeDesc: '長く使う方へ。15ヶ月で元が取れます。',
      planLifetimeFeatures: [
        'Proの全機能を永久に利用',
        'デイリーダイジェスト + 毎朝のローカル通知',
        'AIレコメンド + 自動カテゴリー分類',
        'カテゴリーロック (生体認証)',
        'ホーム画面ウィジェット',
        '追加課金なし',
      ],
      planLifetimeCta: 'Lifetimeを購入',
      planLifetimeRibbon: 'BEST VALUE',

      // ── FAQ ──
      faqLabel: '§ FAQ',
      faqTitle: 'よくある質問',
      faqs: [
        { q: 'Free プランはいつまで使えますか?', a: 'Free プランに期限はありません。フィード15件・ブックマーク30件・カテゴリー3件の範囲内であれば、ずっと無料でお使いいただけます。' },
        { q: 'AIレコメンドはどう動きますか?', a: '興味タグとアプリ内の閲覧履歴を元に、AIがおすすめフィードと注目記事を提案します。閲覧データはAI学習には使われず、パーソナライズの推薦精度向上のみに使われます。' },
        { q: 'カテゴリーロックはどのくらい安全ですか?', a: 'ロックは端末の生体認証 (Face ID / Touch ID / 指紋認証) を使って開錠します。ロック状態はアプリ再起動時に自動復帰し、第三者がスマホを手にしても中身は見えません。' },
        { q: 'どんなRSS/Atomフィードに対応していますか?', a: 'RSS 2.0 / Atom 1.0 / JSON Feed 全てに対応。URLを貼り付けるだけで自動検出します。日本語サイトのフィードも正しく解析・表示できます。' },
        { q: '複数端末で同期できますか?', a: 'はい。アカウントでログインすることで、iPhone / iPad / Android 間でフィード購読・ブックマーク・既読状態がクラウド同期されます。' },
        { q: 'Pro Lifetime (買い切り) と月額/年額の違いは?', a: 'Pro Lifetime は ¥3,000 の一括購入で、以後すべてのPro機能を永久に利用できます。月額 (¥200) で約15ヶ月、年額 (¥2,000) で約1年半使う予定ならLifetimeが実質お得です。すでに月額/年額を購入中でも、Lifetime購入後は定期課金を解約いただけます。' },
        { q: 'いつでも解約できますか?', a: '可能です。App Store / Google Play の定期購読設定からいつでも解約できます。解約後も次の請求日まではProの機能をご利用いただけます。Lifetime は買い切りのため解約の概念はありません。' },
      ],

      // ── CTA ──
      ctaLabel: '§ Get YomiAI',
      ctaTitle1: '情報収集を、',
      ctaTitle2: '今日から変えよう。',
      ctaLede: '無料で始めて、必要になったら Pro へ。いつでも解約できます。',
      ctaAppStoreSmall: 'Download on the',
      ctaAppStoreBig: 'App Store',
      ctaPlaySmall: 'GET IT ON',
      ctaPlayBig: 'Google Play',
      ctaRequires: 'Requires iOS 16+ / Android 10+ · Japanese & English',

      // ── Footer ──
      footerTagline1: 'AIで読むRSSリーダー。',
      footerTagline2: 'あなただけの情報空間を守ります。',
      footerProduct: 'Product',
      footerSupport: 'Support',
      footerLegal: 'Legal',
      footerTerms: '利用規約',
      footerPrivacy: 'プライバシー',
      footerTermsEn: 'Terms (EN)',
      footerPrivacyEn: 'Privacy (EN)',
      footerCopyright: '© 2026 ZAWA SYSTEM · All rights reserved',
      footerMade: 'Made in Tokyo · for Japanese readers',
    },

    en: {
      docTitle: 'YomiAI — An AI-powered RSS reader',
      docDescription:
        'An RSS reader with AI recommendations, biometric category lock, and full Japanese support. iOS & Android.',

      navFeatures: 'Features',
      navGallery: 'Screens',
      navPricing: 'Pricing',
      navFaq: 'FAQ',
      navDownload: 'Download',
      navToggleThemeLight: 'Light mode',
      navToggleThemeDark: 'Dark mode',
      navLangSwitch: '日本語',
      navLangSwitchTitle: '日本語に切り替え',

      heroEyebrow: 'v2.0 · Daily Digest & on-device translation',
      heroTitleLine1: 'An information space',
      heroTitleLine2: 'curated by AI,',
      heroTitleLine3: 'just for you',
      heroTitleLine3Suffix: '.',
      heroEn: 'AI-curated reader · for your own signal',
      heroLede:
        'YomiAI is an RSS reader that combines AI recommendations, biometric category lock, and full Japanese support. Your favorite blogs and news, delivered every morning in the order you want.',
      heroCtaPrimary: 'Start for free',
      heroCtaGhost: 'See features',
      heroMeta1: 'Free plan available',
      heroMeta2: 'Works offline',
      heroMeta3: 'No ads',

      metricSources: 'RSS sources',
      metricPicks: 'AI picks / day',
      metricJP: 'Japanese UI',
      metricLifetime: 'Lifetime buyout',
      metricAdFree: 'Zero ads',

      featuresLabel: '§ Features',
      featuresTitle1: 'Smarter discovery,',
      featuresTitle2: 'powered by AI.',
      featuresLede:
        'AI recommendations, biometric category lock, and full Japanese support — three things no other RSS reader delivers together. The fastest path to what you actually want to read.',

      f01Tag: '01 · AI RECOMMEND · PRO',
      f01Title: 'AI-picked articles & feeds',
      f01Body:
        'Powered by a modern AI model. Your interest tags and reading history build a profile automatically — up to 5 recommended articles on the home screen and 10 new subscription candidates on the recommendations screen, each with a reason.',
      f01TagsLabel: 'Interests:',
      f01TagTech: 'Technology',
      f01TagBiz: 'Business',
      f01TagDesign: 'Design',
      f01Results: 'AI RECOMMENDATION',
      f01ResultsCount: '— 3 results',
      f01ItemsTech: ['SwiftUI 6 navigation updates', 'Rust at the edge', 'UX research for generative AI'],
      f01ItemsBiz: ['2026 semiconductor investment', 'The new PLG playbook for B2B SaaS', 'Remote performance reviews'],
      f01ItemsDesign: ['Apple HIG 2026 updates', 'Figma AutoLayout deep dive', 'Material 3 tokens'],

      // Feature 00 — Daily Digest (NEW · headline)
      fDigestTag: '00 · DAILY DIGEST · PRO',
      fDigestTitle: 'AI summarizes your morning in 5 topics',
      fDigestBody:
        'Every morning, AI clusters the past 24 hours of feed articles into 3–5 topics, each tagged by importance. Catch the gist in 30 seconds — even on a busy commute. Optional local notification between 6–12 AM (Pro only).',
      fDigestKicker1: 'Today\u2019s digest',
      fDigestKicker2: '4 topics · 18 articles · past 24h',
      fDigestT1Label: 'CRITICAL',
      fDigestT1Title: 'OpenAI launches general availability of "o3"',
      fDigestT1Sub: '3 articles · benchmarks, pricing, real-world tests',
      fDigestT2Label: 'NOTABLE',
      fDigestT2Title: 'Flutter 4.0 stable released',
      fDigestT2Sub: '2 articles · Impeller v2 draws 22% faster',
      fDigestT3Label: 'FYI',
      fDigestT3Title: '2026 SaaS industry M&A trends',
      fDigestT3Sub: '1 article · volume up 1.7x YoY',

      // Feature 08 — On-device Translation (NEW)
      fTranslationTag: '08 · ON-DEVICE TRANSLATION',
      fTranslationTitle1: 'Translate any article',
      fTranslationTitle2: 'on-device in a tap',
      fTranslationBody:
        'Fully on-device translation via iOS 18+ Translation API and Android ML Kit. Nothing leaves the device, no usage fees — English tech articles render in Japanese (and vice versa) with a single tap.',
      fTranslationBefore: 'EN · original',
      fTranslationBeforeText: 'A new inference framework dramatically improves runtime efficiency.',
      fTranslationAfter: 'JA · translated',
      fTranslationAfterText: '新しい推論フレームワークが実行効率を劇的に改善します。',
      fTranslationDevice: 'on-device · no cloud',

      // Feature 09 — Full-text Search (NEW)
      fSearchTag: '09 · FULL-TEXT SEARCH',
      fSearchTitle1: 'Find any article',
      fSearchTitle2: 'you\u2019ve ever read',
      fSearchBody:
        'Instant local search powered by SQLite + bigram. Japanese partial match works out of the box, no network needed. Included on every plan — Free too.',
      fSearchQuery: 'semiconductor',
      fSearchResult1: '2026 semiconductor investment trends',
      fSearchResult2: 'TSMC 3nm mass production plan — latest',
      fSearchResult3: 'Memory price recovery — DRAM trends',
      fSearchHits: '3 hits / 127 articles',

      f02Tag: '02 · CATEGORY LOCK · PRO',
      f02Title1: 'Biometric lock',
      f02Title2: 'for your privacy',
      f02Body:
        'Hide the feeds you don’t want seen — per-category lock with Face ID, Touch ID, or fingerprint. Unlock state resets every time the app closes.',
      f02TryIt: 'TRY IT →',
      f02BtnLocked: 'Unlock with biometrics',
      f02BtnUnlocked: 'Unlocked — tap to re-lock',
      f02Hint1: 'Private feeds stay locked at the category level.',
      f02Hint2: 'Restarting the app re-locks them automatically.',

      f03Tag: '03 · OFFLINE FIRST',
      f03Title1: 'Readable with',
      f03Title2: 'or without signal',
      f03Body:
        'Articles are stored in a local database on your device, so saved articles stay readable on the subway or in-flight. Offline changes queue up and sync automatically when you’re back online.',
      f03Offline: 'offline',
      f03Cached: '127 articles cached',
      f03CachedSub: 'local-first · offline-ready',

      f04Tag: '04 · AUTO-CATEGORIZE · PRO',
      f04Title1: 'Uncategorized feeds,',
      f04Title2: 'sorted by AI',
      f04Body:
        'Tap “Auto-categorize” on the feed management screen — AI sorts your uncategorized feeds into your existing categories in bulk.',
      f04Item1: 'Next.js 15 RC',
      f04Item2: 'SaaS KPI metrics',
      f04Item3: 'Figma update',

      f05Tag: '05 · HOME WIDGET',
      f05Title1: 'Home-screen widget —',
      f05Title2: 'latest articles at a glance',
      f05Body:
        'Home-screen widgets on iOS and Android. Updates in the background every 60 minutes, and shows AI-recommended articles first for Pro users.',
      f05Pick: 'AI PICK',
      f05PickBody: 'LLM runtime efficiency up 30%',
      f05Latest: 'LATEST · 3 articles',
      f05Latest1: 'SwiftUI 6 nav updates',
      f05Latest2: 'Rust at the edge',
      f05Latest3: 'Nikkei BP · semiconductors',

      f06Tag: '06 · MATERIAL YOU',
      f06Title1: 'A theme that matches',
      f06Title2: 'your wallpaper on Android 12+',
      f06Body:
        'Full Material You Dynamic Color support. The app adapts automatically to the palette extracted from your device wallpaper.',

      f07Tag: '07 · ACCESSIBILITY',
      f07Title1: 'Free choice of',
      f07Title2: 'font size and dark mode',
      f07Body:
        'Body text scales across 4 sizes. Three modes — light, dark, and system — so reading stays comfortable at night or in bright daylight.',
      f07Preview: 'Today’s one pick, sized for how you like to read.',

      galleryLabel: '§ In-app',
      galleryTitle1: 'A peek at the',
      galleryTitle2: 'actual screens',
      galleryLede:
        'Five key screens from the live app. Built on Material 3 Expressive with Japanese readability as the first priority.',
      galleryHome: 'Home',
      galleryHomeSub: 'AI recommends',
      galleryDigest: 'Digest',
      galleryDigestSub: 'Daily AI summary',
      galleryCategories: 'Subscribed feeds',
      galleryCategoriesSub: 'Per-category biometric lock',
      galleryRecommend: 'Discover',
      galleryRecommendSub: 'AI feed recommendations',
      galleryReader: 'Reader',
      galleryReaderSub: 'AI summary & translation',

      pricingLabel: '§ Pricing',
      pricingTitle1: 'Pay only for',
      pricingTitle2: 'what you need.',
      pricingMonthly: 'Monthly',
      pricingAnnual: 'Annual (~17% off)',

      planFree: 'Free',
      planFreePrice: '¥0',
      planFreePeriod: '/forever',
      planFreeDesc: 'For anyone who wants to try it',
      planFreeFeatures: [
        'Up to 15 feeds',
        '30 bookmarks',
        '3 categories',
        'Unlimited reading / offline saves',
        'On-device translation & full-text search',
        'Light / dark theme',
      ],
      planFreeCta: 'Start for free',

      planPro: 'Pro',
      planProPriceMonth: '¥200',
      planProPriceYear: '¥2,000',
      planProPeriodMonth: '/mo',
      planProPeriodYear: '/yr',
      planProDesc: 'For serious readers',
      planProFeatures: [
        'Unlimited feeds, bookmarks, categories',
        'Daily digest + morning local notification',
        'AI recommendations (feeds + articles)',
        'AI auto-categorization',
        'Biometric category lock',
        'Home-screen widget',
      ],
      planProCta: 'Try Pro',
      planProRibbon: 'RECOMMENDED',

      planLifetime: 'Pro Lifetime',
      planLifetimePrice: '¥3,000',
      planLifetimePeriod: '/one-time',
      planLifetimeDesc: 'For the long haul — pays for itself in 15 months.',
      planLifetimeFeatures: [
        'All Pro features, forever',
        'Daily digest + morning local notification',
        'AI recommendations + auto-categorize',
        'Biometric category lock',
        'Home-screen widget',
        'No further charges',
      ],
      planLifetimeCta: 'Buy Lifetime',
      planLifetimeRibbon: 'BEST VALUE',

      faqLabel: '§ FAQ',
      faqTitle: 'Frequently asked',
      faqs: [
        { q: 'How long can I use the Free plan?', a: 'The Free plan has no time limit. As long as you stay within 15 feeds, 30 bookmarks, and 3 categories, it stays free forever.' },
        { q: 'How do AI recommendations work?', a: 'AI recommends feeds and articles based on your interest tags and in-app reading history. Your reading data is never used for AI training — it only improves personalization accuracy.' },
        { q: 'How secure is the category lock?', a: 'The lock uses your device biometrics (Face ID / Touch ID / fingerprint) to unlock. Lock state automatically resumes when the app restarts, so nothing is visible if someone else picks up your phone.' },
        { q: 'Which RSS/Atom feeds are supported?', a: 'RSS 2.0, Atom 1.0, and JSON Feed — all supported. Paste a URL and it’s auto-detected. Japanese-language feeds parse and render correctly.' },
        { q: 'Can I sync across devices?', a: 'Yes. Sign in with an account and your subscriptions, bookmarks, and read state sync via the cloud across iPhone, iPad, and Android.' },
        { q: 'Pro Lifetime vs. monthly/annual?', a: 'Pro Lifetime is a one-time ¥3,000 purchase that unlocks all Pro features forever. If you plan to use Pro for ~15 months (monthly at ¥200) or ~1.5 years (annual at ¥2,000), Lifetime pays for itself. Already subscribed? You can cancel your subscription after buying Lifetime.' },
        { q: 'Can I cancel anytime?', a: 'Yes. Cancel anytime from the subscription settings in the App Store or Google Play. Pro features remain active until the next billing date. Lifetime is a one-time purchase, so cancellation doesn’t apply.' },
      ],

      ctaLabel: '§ Get YomiAI',
      ctaTitle1: 'Change how you',
      ctaTitle2: 'read the web, today.',
      ctaLede: 'Start free, upgrade to Pro when you need it. Cancel anytime.',
      ctaAppStoreSmall: 'Download on the',
      ctaAppStoreBig: 'App Store',
      ctaPlaySmall: 'GET IT ON',
      ctaPlayBig: 'Google Play',
      ctaRequires: 'Requires iOS 16+ / Android 10+ · Japanese & English',

      footerTagline1: 'An AI-powered RSS reader.',
      footerTagline2: 'We protect your information space.',
      footerProduct: 'Product',
      footerSupport: 'Support',
      footerLegal: 'Legal',
      footerTerms: 'Terms (JP)',
      footerPrivacy: 'Privacy (JP)',
      footerTermsEn: 'Terms (EN)',
      footerPrivacyEn: 'Privacy (EN)',
      footerCopyright: '© 2026 ZAWA SYSTEM · All rights reserved',
      footerMade: 'Made in Tokyo · for readers everywhere',
    },
  };

  // ─── Demo UI strings (Yomi app screens) ───
  const SCREENS = {
    ja: {
      // Home
      appBarTitle: 'YomiAI',
      appBarHome: 'ホーム',
      chipAll: 'すべて',
      chipTech: 'テクノロジー',
      chipBiz: 'ビジネス',
      chipDesign: 'デザイン',
      aiRecommendLabel: 'AIおすすめ記事',
      // Digest home card
      digestCardTitle: 'デイリーダイジェスト',
      digestCardSubtitle: '4トピック · 18記事 · 過去24時間',
      // AI items
      ai1Title: 'LLMの実行効率を30%改善する新しい推論フレームワーク',
      ai1Feed: 'TechCrunch JP',
      ai1Time: '2時間前',
      ai1Reason: 'AIトピックを頻繁に閲覧',
      ai2Title: 'Flutter 4.0で変わるパフォーマンスチューニングの勘所',
      ai2Feed: 'Zenn',
      ai2Time: '3時間前',
      ai2Reason: '「Flutter」タグに基づく',
      // Regular articles
      art1Title: 'SwiftUI 6のNavigationStack改善点まとめ',
      art1Feed: 'Qiita',
      art1Time: '15分前',
      art2Title: '生成AI時代のUXリサーチ手法 ― ユーザーの潜在ニーズを引き出す',
      art2Feed: 'note.com',
      art2Time: '1時間前',
      art3Title: 'Rustで作るエッジコンピューティングの実装パターン',
      art3Feed: 'Zenn',
      art3Time: '3時間前',
      art4Title: '2026年の半導体投資動向 ― メモリと先端ロジック',
      art4Feed: '日経XTECH',
      art4Time: '5時間前',

      // Digest screen
      digestTitle: 'ダイジェスト',
      digestSummaryDate: '11月18日(火) 7:00',
      digestSummaryCount: '4トピック · 18記事',
      digestRegenerate: '再生成',
      digestRelatedArticles: '関連記事',
      digestTopics: [
        {
          importance: 'critical',
          importanceLabel: '重要',
          title: 'OpenAI、推論モデル「o3」を一般提供開始',
          summary: 'OpenAI は 11月17日、推論専用モデル「o3」の一般提供を開始した。数学・コーディングで GPT-4 を大幅に上回るベンチマーク結果を示し、API 料金は GPT-4 比 30% 安に設定された。',
          articles: [
            { title: 'OpenAI o3 generally available — 推論性能で GPT-4 を上回る', feed: 'TechCrunch JP', time: '4時間前', hue: 30 },
            { title: 'o3 API 料金 30% 安、コーディング SWE-bench 71.7%', feed: 'ITmedia', time: '6時間前', hue: 200 },
            { title: '実測ベンチマーク — o3 vs Claude 4 vs Gemini 2.5', feed: 'Zenn', time: '8時間前', hue: 280 },
          ],
        },
        {
          importance: 'high',
          importanceLabel: '注目',
          title: 'Flutter 4.0 安定版リリース ― レンダリング刷新',
          summary: 'Google は Flutter 4.0 安定版を公開。新レンダリングエンジン「Impeller v2」により描画性能が iOS で平均 22%、Android で 18% 向上した。',
          articles: [
            { title: 'Flutter 4.0 リリースノート全文', feed: 'Flutter Blog', time: '12時間前', hue: 220 },
            { title: 'Impeller v2 ― なぜ描画が速くなったのか', feed: 'Zenn', time: '14時間前', hue: 160 },
          ],
        },
        {
          importance: 'normal',
          importanceLabel: '参考',
          title: '2026年 SaaS 業界の M&A 動向',
          summary: '上半期だけで前年比 1.7 倍の M&A 件数を記録。生成 AI 関連スタートアップの買収が全体の 4 割を占める。',
          articles: [
            { title: 'SaaS M&A 上半期レポート — 件数は前年比 1.7 倍', feed: '日経XTECH', time: '1日前', hue: 100 },
          ],
        },
      ],

      // Category screen (now 「購読中」 - subscribed feeds list)
      subscribedFeedsTitle: '購読中',
      allFeedsLabel: 'すべて',
      categoryTitle: 'カテゴリー管理',
      categoryInputPlaceholder: 'カテゴリー名',
      interestTagsLabel: '興味タグから追加',
      tagAI: 'AI・機械学習',
      tagFlutter: 'Flutter',
      tagDesign: 'デザイン',
      tagStartup: 'スタートアップ',
      cat1: 'テクノロジー',
      cat2: 'ビジネス',
      cat3: 'プライベート',
      cat4: 'サブカル',
      cat5: 'ニュース',

      // Biometric sheet
      bioTitle: '生体認証',
      bioBody: 'カテゴリーロックを解除します',
      bioCancel: 'キャンセル',

      // Article detail (Reader)
      articleHeroLabel: 'HERO IMAGE',
      articleCategoryLabel: 'TECHNOLOGY',
      articleTitle: 'LLMの実行効率を30%改善する新しい推論フレームワーク',
      articleFeed: 'TechCrunch JP',
      articleTime: '2時間前',
      articleOpenBrowser: 'ブラウザで開く',
      articleFullContent: '全文表示',
      articleSummaryTitle: 'AI 3行要約',
      articleSummaryBullets: [
        '新推論フレームワーク「Infer」GPU メモリ使用量を 30% 削減し、同一性能を低コストハードで実現。',
        'レイテンシはもとの推論同等、スループットは 1.4 倍に向上し、本番推論負荷をさばく。',
        'ウェイトは不要、既存 PyTorch モデルをそのまま差し替えて使えるのが最大の勝負ポイント。',
      ],
      articleRelatedLabel: '関連記事',
      articleRelated: [
        { title: 'Llama 3 と Infer を組み合わせたときの計測ベンチ', feed: 'Zenn', time: '4時間前', hue: 220 },
        { title: 'GPU 代わりに CPU だけで LLM を動かす 2026 年の状況', feed: '日経XTECH', time: '昨日', hue: 80 },
      ],

      // Recommend feeds
      recommendTitle: 'おすすめ',
      feed1Title: 'Hacker News Japan',
      feed1Url: 'news.ycombinator.com',
      feed1Reason: 'あなたの閲覧傾向にマッチ',
      feed2Title: 'Smashing Magazine',
      feed2Url: 'smashingmagazine.com',
      feed2Reason: '「デザイン」タグに関連',
      feed3Title: 'MIT Tech Review',
      feed3Url: 'technologyreview.com',
      feed3Reason: 'AI関連の記事を多く閲覧',
      recommendAdd: '追加',

      // Nav bar labels
      navHome: 'ホーム',
      navDigest: 'ダイジェスト',
      navRecommend: 'おすすめ',
      navBookmark: 'ブックマーク',
      navSettings: '設定',
    },
    en: {
      // Home
      appBarTitle: 'YomiAI',
      appBarHome: 'Home',
      chipAll: 'All',
      chipTech: 'Tech',
      chipBiz: 'Business',
      chipDesign: 'Design',
      aiRecommendLabel: 'AI recommendations',
      // Digest home card
      digestCardTitle: 'Daily digest',
      digestCardSubtitle: '4 topics · 18 articles · past 24h',
      ai1Title: 'New inference framework boosts LLM runtime efficiency by 30%',
      ai1Feed: 'TechCrunch',
      ai1Time: '2h ago',
      ai1Reason: 'You read AI topics often',
      ai2Title: 'Performance tuning tips for Flutter 4.0',
      ai2Feed: 'Dev.to',
      ai2Time: '3h ago',
      ai2Reason: 'Based on your "Flutter" tag',
      art1Title: 'SwiftUI 6: NavigationStack improvements at a glance',
      art1Feed: 'Swift Weekly',
      art1Time: '15 min ago',
      art2Title: 'UX research in the generative-AI era — surfacing latent needs',
      art2Feed: 'Medium',
      art2Time: '1h ago',
      art3Title: 'Edge computing patterns in Rust',
      art3Feed: 'Dev.to',
      art3Time: '3h ago',
      art4Title: '2026 semiconductor investment — memory and advanced logic',
      art4Feed: 'The Verge',
      art4Time: '5h ago',

      // Digest screen
      digestTitle: 'Digest',
      digestSummaryDate: 'Nov 18 (Tue) 7:00',
      digestSummaryCount: '4 topics · 18 articles',
      digestRegenerate: 'Regenerate',
      digestRelatedArticles: 'RELATED ARTICLES',
      digestTopics: [
        {
          importance: 'critical',
          importanceLabel: 'CRITICAL',
          title: 'OpenAI launches general availability of "o3" reasoning model',
          summary: 'OpenAI made its reasoning-focused model "o3" generally available on Nov 17. Benchmarks show large gains over GPT-4 on math and code, with API pricing set 30% below GPT-4.',
          articles: [
            { title: 'OpenAI o3 generally available — beats GPT-4 on reasoning', feed: 'TechCrunch', time: '4h ago', hue: 30 },
            { title: 'o3 API pricing 30% lower, SWE-bench coding at 71.7%', feed: 'The Verge', time: '6h ago', hue: 200 },
            { title: 'Real-world benchmarks — o3 vs Claude 4 vs Gemini 2.5', feed: 'Dev.to', time: '8h ago', hue: 280 },
          ],
        },
        {
          importance: 'high',
          importanceLabel: 'NOTABLE',
          title: 'Flutter 4.0 stable released — renderer overhauled',
          summary: 'Google shipped Flutter 4.0 stable. The new "Impeller v2" renderer improves draw perf by 22% on iOS and 18% on Android on average.',
          articles: [
            { title: 'Flutter 4.0 release notes — the full breakdown', feed: 'Flutter Blog', time: '12h ago', hue: 220 },
            { title: 'Impeller v2 — why rendering got faster', feed: 'Dev.to', time: '14h ago', hue: 160 },
          ],
        },
        {
          importance: 'normal',
          importanceLabel: 'FYI',
          title: '2026 SaaS industry M&A trends',
          summary: 'M&A volume in the first half jumped 1.7x year-over-year. Generative-AI startup acquisitions accounted for 40% of all deals.',
          articles: [
            { title: 'SaaS M&A H1 report — volume up 1.7x YoY', feed: 'The Information', time: '1d ago', hue: 100 },
          ],
        },
      ],

      // Subscribed feeds screen
      subscribedFeedsTitle: 'Subscribed',
      allFeedsLabel: 'All feeds',
      categoryTitle: 'Manage categories',
      categoryInputPlaceholder: 'Category name',
      interestTagsLabel: 'Add from interest tags',
      tagAI: 'AI / ML',
      tagFlutter: 'Flutter',
      tagDesign: 'Design',
      tagStartup: 'Startup',
      cat1: 'Technology',
      cat2: 'Business',
      cat3: 'Personal',
      cat4: 'Subculture',
      cat5: 'News',

      bioTitle: 'Biometric unlock',
      bioBody: 'Unlock your locked category',
      bioCancel: 'Cancel',

      // Article detail (Reader)
      articleHeroLabel: 'HERO IMAGE',
      articleCategoryLabel: 'TECHNOLOGY',
      articleTitle: 'New inference framework boosts LLM runtime efficiency by 30%',
      articleFeed: 'TechCrunch',
      articleTime: '2h ago',
      articleOpenBrowser: 'Open in browser',
      articleFullContent: 'Full-content loading',
      articleSummaryTitle: 'AI 3-LINE SUMMARY',
      articleSummaryBullets: [
        'New inference framework “Infer” cuts GPU memory usage by 30% — same speed, lower-cost hardware.',
        'Latency is on par with prior inference; throughput is 1.4× higher, easing production loads.',
        'No retraining required: drop in existing PyTorch models as-is. That’s the biggest win.',
      ],
      articleRelatedLabel: 'RELATED ARTICLES',
      articleRelated: [
        { title: 'Benchmarks: Llama 3 + Infer on commodity GPUs', feed: 'Dev.to', time: '4h ago', hue: 220 },
        { title: 'Running LLMs on CPU-only in 2026 — where we are', feed: 'The Verge', time: 'Yesterday', hue: 80 },
      ],

      recommendTitle: 'Recommended feeds',
      feed1Title: 'Hacker News',
      feed1Url: 'news.ycombinator.com',
      feed1Reason: 'Matches your reading habits',
      feed2Title: 'Smashing Magazine',
      feed2Url: 'smashingmagazine.com',
      feed2Reason: 'Related to your "Design" tag',
      feed3Title: 'MIT Tech Review',
      feed3Url: 'technologyreview.com',
      feed3Reason: 'You read lots of AI articles',
      recommendAdd: 'Add',

      navHome: 'Home',
      navDigest: 'Digest',
      navRecommend: 'Picks',
      navBookmark: 'Saved',
      navSettings: 'Settings',
    },
  };

  function detectLang() {
    try {
      const params = new URLSearchParams(window.location.search);
      const q = params.get('lang');
      if (q === 'en' || q === 'ja') {
        try { localStorage.setItem('yomi-lang', q); } catch (e) {}
        return q;
      }
      const stored = localStorage.getItem('yomi-lang');
      if (stored === 'en' || stored === 'ja') return stored;
      const nav = (navigator.language || navigator.userLanguage || 'en').toLowerCase();
      return nav.startsWith('ja') ? 'ja' : 'en';
    } catch (e) {
      return 'ja';
    }
  }

  const initialLang = detectLang();

  // Apply to <html lang> + <title> + meta description immediately
  try {
    document.documentElement.setAttribute('lang', initialLang);
    const d = DICT[initialLang];
    if (d) {
      document.title = d.docTitle;
      const meta = document.querySelector('meta[name="description"]');
      if (meta) meta.setAttribute('content', d.docDescription);
    }
  } catch (e) {}

  window.__YOMI_I18N__ = {
    DICT,
    SCREENS,
    initialLang,
    // called by React on lang change
    applyDocumentMeta(lang) {
      const d = DICT[lang];
      if (!d) return;
      document.documentElement.setAttribute('lang', lang);
      document.title = d.docTitle;
      const meta = document.querySelector('meta[name="description"]');
      if (meta) meta.setAttribute('content', d.docDescription);
      try { localStorage.setItem('yomi-lang', lang); } catch (e) {}
    },
  };
})();
