// curriculum.jsx — Chopstick lesson content.
//
// Levels & units:
//   Unit 1 (pinyin)   — sounds first, no characters
//   Unit 2 (survival) — greetings, numbers, intro (chars + pinyin)
//   Unit 3 (daily)    — food, family, time, colors
//   Unit 4 (HSK 1-2)  — common verbs, particles, simple sentences
//   Unit 5 (HSK 3)    — comparisons, complements, longer sentences
//
// Exercise kinds:
//   intro          — story card (no input)
//   tone           — pick correct tone mark
//   pick-listen    — hear, pick pinyin
//   pick-initial   — pick word starting with initial
//   pick-final     — pick word ending with final
//   match-tone     — show 4-row meaning chart (no input)
//   match-meaning  — CN/pinyin → pick English meaning
//   pick-cn        — English → pick CN
//   type-pinyin    — hear/see CN, type the pinyin
//   speak          — TTS playback + speak placeholder
//   ai-translate   — translate EN→CN, AI grades
//   true-false     — same initial?

const TONE_MARKS = ['ā','á','ǎ','à'];
const TONE_NAMES = ['high & flat','rising','dip & rise','falling'];
const TONE_DESCS = [
  '1st tone — like singing one steady note',
  '2nd tone — voice rises, like asking "huh?"',
  '3rd tone — dips down then up',
  '4th tone — sharp drop, sounds annoyed',
];

const LESSONS = [
  // ─── UNIT 1 — PINYIN FOUNDATIONS ────────────────────────────
  {
    id: 'tones-101',
    unit: 1, unitName: 'PINYIN BASICS',
    title: 'Four Tones',
    subtitle: 'mā má mǎ mà — your first superpower',
    icon: 'tone', color: 'primary',
    xp: 20, coins: 15,
    exercises: [
      { kind: 'intro', title: 'Mandarin has FOUR tones', body: 'Same sound, four different meanings. Tap each one to hear it.', tones: TONE_MARKS, names: TONE_NAMES },
      { kind: 'tone', prompt: 'Tap the one that’s FLAT and HIGH', answer: 0, options: TONE_MARKS, audio: 'mā' },
      { kind: 'tone', prompt: 'Which one is RISING?', answer: 1, options: TONE_MARKS, audio: 'má' },
      { kind: 'tone', prompt: 'Which one DIPS then rises?', answer: 2, options: TONE_MARKS, audio: 'mǎ' },
      { kind: 'tone', prompt: 'Which one FALLS sharply?', answer: 3, options: TONE_MARKS, audio: 'mà' },
      { kind: 'pick-listen', prompt: 'You heard:', heard: 'má', options: ['mā','má','mǎ','mà'], answer: 1 },
      { kind: 'pick-listen', prompt: 'You heard:', heard: 'mà', options: ['mā','má','mǎ','mà'], answer: 3 },
      { kind: 'match-tone', prompt: 'Each tone, a different word', pairs: [
        { word: 'mā', meaning: 'mom (妈)' },
        { word: 'má', meaning: 'hemp (麻)' },
        { word: 'mǎ', meaning: 'horse (马)' },
        { word: 'mà', meaning: 'scold (骂)' },
      ]},
    ],
  },
  {
    id: 'initials-bpmf',
    unit: 1, unitName: 'PINYIN BASICS',
    title: 'b p m f',
    subtitle: 'The lip-poppers',
    icon: 'initial', color: 'cyan',
    xp: 18, coins: 12,
    exercises: [
      { kind: 'intro', title: 'Four initials, all from the lips', body: 'b like "spy" (unaspirated), p like "pie" (puff of air), m like "mom", f like "four".' },
      { kind: 'pick-initial', prompt: 'Which starts with "b"?', initial: 'b', options: ['bāo','pāo','māo','fāo'], answer: 0, audio: 'bāo' },
      { kind: 'pick-initial', prompt: 'Which starts with "p"?', initial: 'p', options: ['bí','pí','mí','fí'], answer: 1, audio: 'pí' },
      { kind: 'pick-initial', prompt: 'Which starts with "m"?', initial: 'm', options: ['bà','pà','mà','fà'], answer: 2, audio: 'mà' },
      { kind: 'pick-initial', prompt: 'Which starts with "f"?', initial: 'f', options: ['bēng','pēng','mēng','fēng'], answer: 3, audio: 'fēng' },
      { kind: 'pick-listen', prompt: 'You heard:', heard: 'pí', options: ['bí','pí','mí','fí'], answer: 1 },
      { kind: 'true-false', prompt: 'Same initial?', a: 'mā', b: 'mǐ', same: true },
      { kind: 'true-false', prompt: 'Same initial?', a: 'bāo', b: 'pāo', same: false },
    ],
  },
  {
    id: 'initials-dtnl',
    unit: 1, unitName: 'PINYIN BASICS',
    title: 'd t n l',
    subtitle: 'Tongue at the teeth',
    icon: 'initial', color: 'yellow',
    xp: 18, coins: 12,
    exercises: [
      { kind: 'intro', title: 'Tongue-tip initials', body: 'd like "stop" (unaspirated), t like "top" (with puff), n like "no", l like "low".' },
      { kind: 'pick-initial', prompt: 'Which starts with "d"?', initial: 'd', options: ['dà','tà','nà','là'], answer: 0, audio: 'dà' },
      { kind: 'pick-initial', prompt: 'Which starts with "t"?', initial: 't', options: ['dī','tī','nī','lī'], answer: 1, audio: 'tī' },
      { kind: 'pick-initial', prompt: 'Which starts with "n"?', initial: 'n', options: ['dǐ','tǐ','nǐ','lǐ'], answer: 2, audio: 'nǐ' },
      { kind: 'pick-initial', prompt: 'Which starts with "l"?', initial: 'l', options: ['dǎo','tǎo','nǎo','lǎo'], answer: 3, audio: 'lǎo' },
      { kind: 'pick-listen', prompt: 'You heard:', heard: 'nǐ', options: ['nǐ','lǐ','tǐ','dǐ'], answer: 0 },
    ],
  },
  {
    id: 'tricky-zhchsh',
    unit: 1, unitName: 'PINYIN BASICS',
    title: 'zh ch sh r',
    subtitle: 'Curl your tongue',
    icon: 'initial', color: 'primary',
    xp: 25, coins: 18,
    exercises: [
      { kind: 'intro', title: 'Retroflex — tongue tip curls back', body: 'zh ≈ "j" with curled tongue, ch ≈ "ch" with curl, sh ≈ "sh" with curl, r ≈ between English "r" and "j".' },
      { kind: 'pick-initial', prompt: 'Which starts with "sh"?', initial: 'sh', options: ['zhāo','chāo','shāo','rāo'], answer: 2, audio: 'shāo' },
      { kind: 'pick-initial', prompt: 'Which starts with "ch"?', initial: 'ch', options: ['zhī','chī','shī','rī'], answer: 1, audio: 'chī' },
      { kind: 'pick-initial', prompt: 'Which starts with "r"?', initial: 'r', options: ['zhén','chén','shén','rén'], answer: 3, audio: 'rén' },
      { kind: 'pick-listen', prompt: 'You heard:', heard: 'shì', options: ['zhì','chì','shì','rì'], answer: 2 },
      { kind: 'true-false', prompt: 'Same initial?', a: 'shī', b: 'sī', same: false },
    ],
  },
  {
    id: 'finals-aoeiu',
    unit: 1, unitName: 'PINYIN BASICS',
    title: 'a o e i u ü',
    subtitle: 'The six vowels',
    icon: 'final', color: 'cyan',
    xp: 20, coins: 14,
    exercises: [
      { kind: 'intro', title: 'Vowels', body: 'a "ah", o "or", e "uh", i "ee", u "oo", ü round your lips to say "ee".' },
      { kind: 'pick-final', prompt: 'Which ends with "a"?', final: 'a', options: ['mā','mō','mē','mū'], answer: 0, audio: 'mā' },
      { kind: 'pick-final', prompt: 'Which ends with "i"?', final: 'i', options: ['bā','bō','bī','bū'], answer: 2, audio: 'bī' },
      { kind: 'pick-final', prompt: 'Which ends with "u"?', final: 'u', options: ['nā','nō','nī','nū'], answer: 3, audio: 'nū' },
      { kind: 'pick-listen', prompt: 'You heard:', heard: 'pō', options: ['pā','pō','pē','pū'], answer: 1 },
      { kind: 'speak', prompt: 'Say it out loud:', word: 'mā', tone: 0 },
    ],
  },

  // ─── UNIT 2 — SURVIVAL MANDARIN ─────────────────────────────
  {
    id: 'greetings',
    unit: 2, unitName: 'SURVIVAL',
    title: 'Hello & Goodbye',
    subtitle: '你好 · 再见 · 谢谢',
    icon: 'chat', color: 'primary',
    xp: 30, coins: 20,
    exercises: [
      { kind: 'intro', title: 'Greetings', body: 'Three phrases get you through your first day in Beijing. Tap each card to hear it.', cards: [
        { cn: '你好',   py: 'nǐ hǎo',     en: 'hello'      },
        { cn: '再见',   py: 'zài jiàn',   en: 'goodbye'    },
        { cn: '谢谢',   py: 'xiè xie',    en: 'thank you'  },
        { cn: '不客气', py: 'bú kè qi',   en: "you're welcome" },
      ]},
      { kind: 'match-meaning', prompt: 'What does this mean?', cn: '你好', py: 'nǐ hǎo', options: ['hello','goodbye','sorry','thanks'], answer: 0 },
      { kind: 'match-meaning', prompt: 'What does this mean?', cn: '谢谢', py: 'xiè xie', options: ['goodbye','sorry','thank you','yes'], answer: 2 },
      { kind: 'match-meaning', prompt: 'What does this mean?', cn: '再见', py: 'zài jiàn', options: ['hi','see you','sorry','please'], answer: 1 },
      { kind: 'pick-cn', prompt: 'How do you say "hello"?', en: 'hello', options: [
        { cn: '你好', py: 'nǐ hǎo' }, { cn: '谢谢', py: 'xiè xie' },
        { cn: '再见', py: 'zài jiàn' }, { cn: '对不起', py: 'duì bu qǐ' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: 'How do you say "thanks"?', en: 'thanks', options: [
        { cn: '你好', py: 'nǐ hǎo' }, { cn: '谢谢', py: 'xiè xie' },
        { cn: '再见', py: 'zài jiàn' }, { cn: '请', py: 'qǐng' },
      ], answer: 1 },
      { kind: 'type-pinyin', prompt: 'Type the pinyin (no tones OK):', cn: '你好', answer: 'nihao', alts: ['nǐhǎo','ni hao','nǐ hǎo'] },
      { kind: 'speak', prompt: 'Say it:', word: '你好', py: 'nǐ hǎo', tone: 2 },
    ],
  },
  {
    id: 'numbers-0-10',
    unit: 2, unitName: 'SURVIVAL',
    title: 'Numbers 0–10',
    subtitle: '零一二三四五六七八九十',
    icon: 'num', color: 'yellow',
    xp: 30, coins: 20,
    exercises: [
      { kind: 'intro', title: 'Count to ten', body: 'Tap each number to hear it. 十一 = 11, 二十 = 20 — the pattern is brutally simple.', cards: [
        { cn: '零', py: 'líng', en: '0' }, { cn: '一', py: 'yī', en: '1' },
        { cn: '二', py: 'èr',  en: '2' }, { cn: '三', py: 'sān', en: '3' },
        { cn: '四', py: 'sì',  en: '4' }, { cn: '五', py: 'wǔ',  en: '5' },
        { cn: '六', py: 'liù', en: '6' }, { cn: '七', py: 'qī',  en: '7' },
        { cn: '八', py: 'bā',  en: '8' }, { cn: '九', py: 'jiǔ', en: '9' },
        { cn: '十', py: 'shí', en: '10' },
      ]},
      { kind: 'match-meaning', prompt: 'What number?', cn: '三', py: 'sān', options: ['1','2','3','4'], answer: 2 },
      { kind: 'match-meaning', prompt: 'What number?', cn: '七', py: 'qī',  options: ['5','6','7','8'], answer: 2 },
      { kind: 'pick-cn',       prompt: 'How do you say "5"?', en: '5', options: [
        { cn: '四', py: 'sì' }, { cn: '五', py: 'wǔ' }, { cn: '六', py: 'liù' }, { cn: '七', py: 'qī' },
      ], answer: 1 },
      { kind: 'pick-cn',       prompt: 'How do you say "10"?', en: '10', options: [
        { cn: '九', py: 'jiǔ' }, { cn: '一', py: 'yī' }, { cn: '十', py: 'shí' }, { cn: '百', py: 'bǎi' },
      ], answer: 2 },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '八', answer: 'ba', alts: ['bā'] },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '二', answer: 'er', alts: ['èr'] },
    ],
  },
  {
    id: 'family',
    unit: 3, unitName: 'DAILY LIFE',
    title: 'Family',
    subtitle: '爸爸 妈妈 哥哥 妹妹',
    icon: 'people', color: 'primary',
    xp: 30, coins: 20,
    exercises: [
      { kind: 'intro', title: 'Your people', body: 'Mandarin distinguishes older/younger siblings. Don’t mix them up.', cards: [
        { cn: '爸爸', py: 'bà ba',   en: 'dad'           },
        { cn: '妈妈', py: 'mā ma',   en: 'mom'           },
        { cn: '哥哥', py: 'gē ge',   en: 'older brother' },
        { cn: '弟弟', py: 'dì di',   en: 'younger brother' },
        { cn: '姐姐', py: 'jiě jie', en: 'older sister'  },
        { cn: '妹妹', py: 'mèi mei', en: 'younger sister' },
      ]},
      { kind: 'match-meaning', prompt: 'Who?', cn: '妈妈', py: 'mā ma',   options: ['dad','mom','older sister','aunt'], answer: 1 },
      { kind: 'match-meaning', prompt: 'Who?', cn: '哥哥', py: 'gē ge',   options: ['younger brother','older brother','dad','uncle'], answer: 1 },
      { kind: 'match-meaning', prompt: 'Who?', cn: '妹妹', py: 'mèi mei', options: ['older sister','younger sister','cousin','niece'], answer: 1 },
      { kind: 'pick-cn',       prompt: '"dad"?', en: 'dad', options: [
        { cn: '爸爸', py: 'bà ba' }, { cn: '妈妈', py: 'mā ma' },
        { cn: '哥哥', py: 'gē ge' }, { cn: '叔叔', py: 'shū shu' },
      ], answer: 0 },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '妈妈', answer: 'mama', alts: ['māma','mā ma'] },
    ],
  },
  {
    id: 'food',
    unit: 3, unitName: 'DAILY LIFE',
    title: 'Food & Drink',
    subtitle: '米饭 面条 茶 水',
    icon: 'food', color: 'yellow',
    xp: 32, coins: 22,
    exercises: [
      { kind: 'intro', title: 'Eat first, learn later', body: 'These five words will keep you alive in any restaurant.', cards: [
        { cn: '米饭', py: 'mǐ fàn',  en: 'rice'    },
        { cn: '面条', py: 'miàn tiáo', en: 'noodles' },
        { cn: '茶',   py: 'chá',     en: 'tea'     },
        { cn: '水',   py: 'shuǐ',    en: 'water'   },
        { cn: '咖啡', py: 'kā fēi',  en: 'coffee'  },
      ]},
      { kind: 'match-meaning', prompt: 'What is it?', cn: '茶',   py: 'chá',     options: ['coffee','tea','milk','juice'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What is it?', cn: '米饭', py: 'mǐ fàn',  options: ['noodles','rice','bread','soup'], answer: 1 },
      { kind: 'pick-cn',       prompt: '"water"?', en: 'water', options: [
        { cn: '水', py: 'shuǐ' }, { cn: '茶', py: 'chá' },
        { cn: '酒', py: 'jiǔ' }, { cn: '汤', py: 'tāng' },
      ], answer: 0 },
      { kind: 'pick-cn',       prompt: '"I want noodles." (informal)', en: 'I want noodles', options: [
        { cn: '我要面条', py: 'wǒ yào miàn tiáo' },
        { cn: '我吃米饭', py: 'wǒ chī mǐ fàn' },
        { cn: '我喝水',   py: 'wǒ hē shuǐ' },
        { cn: '我有茶',   py: 'wǒ yǒu chá' },
      ], answer: 0 },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '茶', answer: 'cha', alts: ['chá'] },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'I want tea.' },
    ],
  },
  {
    id: 'colors',
    unit: 3, unitName: 'DAILY LIFE',
    title: 'Colors',
    subtitle: '红 黄 蓝 绿 黑 白',
    icon: 'color', color: 'cyan',
    xp: 28, coins: 18,
    exercises: [
      { kind: 'intro', title: 'Six colors', body: 'Add 色 (sè, "color") for the noun: 红色 (hóngsè) = "red".', cards: [
        { cn: '红', py: 'hóng', en: 'red' },
        { cn: '黄', py: 'huáng', en: 'yellow' },
        { cn: '蓝', py: 'lán',  en: 'blue' },
        { cn: '绿', py: 'lǜ',   en: 'green' },
        { cn: '黑', py: 'hēi',  en: 'black' },
        { cn: '白', py: 'bái',  en: 'white' },
      ]},
      { kind: 'match-meaning', prompt: 'Which color?', cn: '红', py: 'hóng', options: ['red','yellow','blue','green'], answer: 0 },
      { kind: 'match-meaning', prompt: 'Which color?', cn: '蓝', py: 'lán',  options: ['red','yellow','blue','green'], answer: 2 },
      { kind: 'pick-cn',       prompt: '"black"?', en: 'black', options: [
        { cn: '白', py: 'bái' }, { cn: '黑', py: 'hēi' }, { cn: '红', py: 'hóng' }, { cn: '蓝', py: 'lán' },
      ], answer: 1 },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '绿', answer: 'lv', alts: ['lü','lǜ','lu'] },
    ],
  },

  // ─── UNIT 4 — HSK 1-2 ──────────────────────────────────────
  {
    id: 'verbs-core',
    unit: 4, unitName: 'HSK 1–2',
    title: 'Core Verbs',
    subtitle: '吃 喝 看 听 说 去 来',
    icon: 'verb', color: 'primary',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'intro', title: 'Seven verbs do a lot of work', body: 'No conjugation — same verb for I/you/she. Tense from context.', cards: [
        { cn: '吃', py: 'chī', en: 'to eat'   },
        { cn: '喝', py: 'hē',  en: 'to drink' },
        { cn: '看', py: 'kàn', en: 'to look / read / watch' },
        { cn: '听', py: 'tīng', en: 'to listen' },
        { cn: '说', py: 'shuō', en: 'to speak' },
        { cn: '去', py: 'qù',  en: 'to go'    },
        { cn: '来', py: 'lái', en: 'to come'  },
      ]},
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '吃', py: 'chī', options: ['drink','eat','sleep','run'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '听', py: 'tīng', options: ['speak','see','listen','read'], answer: 2 },
      { kind: 'pick-cn',       prompt: '"to drink"?', en: 'to drink', options: [
        { cn: '吃', py: 'chī' }, { cn: '喝', py: 'hē' }, { cn: '看', py: 'kàn' }, { cn: '去', py: 'qù' },
      ], answer: 1 },
      { kind: 'pick-cn',       prompt: '"I drink tea."', en: 'I drink tea', options: [
        { cn: '我喝茶',   py: 'wǒ hē chá'   },
        { cn: '我吃茶',   py: 'wǒ chī chá'  },
        { cn: '我看茶',   py: 'wǒ kàn chá'  },
        { cn: '我有茶',   py: 'wǒ yǒu chá'  },
      ], answer: 0 },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'She listens to music.' },
    ],
  },
  {
    id: 'questions-ma',
    unit: 4, unitName: 'HSK 1–2',
    title: 'Yes/No Questions',
    subtitle: 'add 吗 to make any sentence a question',
    icon: 'qm', color: 'cyan',
    xp: 35, coins: 22,
    exercises: [
      { kind: 'intro', title: 'The magic particle 吗 (ma)', body: '"You are good." → "You are good MA?" = "Are you good?" That’s it. Just slap 吗 on the end.', cards: [
        { cn: '你好吗？',     py: 'nǐ hǎo ma?',     en: 'How are you?' },
        { cn: '你吃米饭吗？', py: 'nǐ chī mǐ fàn ma?', en: 'Do you eat rice?' },
        { cn: '他来吗？',     py: 'tā lái ma?',     en: 'Is he coming?' },
      ]},
      { kind: 'pick-cn', prompt: '"Are you Chinese?"', en: 'Are you Chinese?', options: [
        { cn: '你是中国人吗？', py: 'nǐ shì zhōng guó rén ma?' },
        { cn: '你中国人是吗？', py: '—' },
        { cn: '你是中国人？',   py: 'nǐ shì zhōng guó rén?' },
        { cn: '中国人你是吗？', py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'Do you drink coffee?' },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'Is she your older sister?' },
    ],
  },
  {
    id: 'review-1',
    unit: 4, unitName: 'HSK 1–2',
    title: 'Speed Quiz',
    subtitle: 'Mixed drill — beat your high score',
    icon: 'star', color: 'red',
    xp: 50, coins: 35,
    exercises: [
      { kind: 'match-meaning', prompt: 'Quick — what is it?', cn: '水',   py: 'shuǐ',     options: ['tea','water','coffee','rice'], answer: 1 },
      { kind: 'match-meaning', prompt: 'Quick — what is it?', cn: '哥哥', py: 'gē ge',    options: ['mom','dad','older brother','older sister'], answer: 2 },
      { kind: 'pick-cn',       prompt: '"thank you"?', en: 'thank you', options: [
        { cn: '你好', py: 'nǐ hǎo' }, { cn: '谢谢', py: 'xiè xie' },
        { cn: '再见', py: 'zài jiàn' }, { cn: '不客气', py: 'bú kè qi' },
      ], answer: 1 },
      { kind: 'pick-cn',       prompt: '"red"?', en: 'red', options: [
        { cn: '黑', py: 'hēi' }, { cn: '红', py: 'hóng' },
        { cn: '蓝', py: 'lán' }, { cn: '黄', py: 'huáng' },
      ], answer: 1 },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '茶',     answer: 'cha', alts: ['chá'] },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '谢谢',   answer: 'xiexie', alts: ['xièxie','xie xie'] },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'My mom drinks tea.' },
    ],
  },

  // ─── UNIT 5 — CLASSROOM & CONNECT ───────────────────────────
  {
    id: 'classroom',
    unit: 5, unitName: 'CLASSROOM',
    title: 'In Class',
    subtitle: '老师 · 同学 · 上课',
    icon: 'chat', color: 'cyan',
    xp: 30, coins: 20,
    exercises: [
      { kind: 'intro', title: 'What you’ll hear at every lesson', body: 'Classroom phrases — the survival kit for sitting through a real Mandarin class.', cards: [
        { cn: '老师',     py: 'lǎo shī',       en: 'teacher' },
        { cn: '学生',     py: 'xué shēng',     en: 'student' },
        { cn: '同学',     py: 'tóng xué',      en: 'classmate' },
        { cn: '上课',     py: 'shàng kè',      en: 'class (lesson)' },
        { cn: '下课',     py: 'xià kè',        en: 'class ends' },
        { cn: '休息',     py: 'xiū xí',        en: 'break / rest' },
        { cn: '问题',     py: 'wèn tí',        en: 'question / problem' },
        { cn: '高兴',     py: 'gāo xìng',      en: 'happy / glad' },
      ]},
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '老师', py: 'lǎo shī',    options: ['student','classmate','teacher','class'], answer: 2 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '休息', py: 'xiū xí',     options: ['lesson','break','question','homework'], answer: 1 },
      { kind: 'pick-cn',       prompt: '"This is my teacher."', en: 'This is my teacher', options: [
        { cn: '这是我老师',   py: 'zhè shì wǒ lǎo shī' },
        { cn: '这是我学生',   py: 'zhè shì wǒ xué shēng' },
        { cn: '我是老师',     py: 'wǒ shì lǎo shī' },
        { cn: '老师是我',     py: 'lǎo shī shì wǒ' },
      ], answer: 0 },
      { kind: 'pick-cn',       prompt: '"What is this?"', en: 'What is this?', options: [
        { cn: '这是什么？', py: 'zhè shì shén me?' },
        { cn: '这是谁？',   py: 'zhè shì shéi?' },
        { cn: '什么是这？', py: '—' },
        { cn: '你是什么？', py: 'nǐ shì shén me?' },
      ], answer: 0 },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '同学', answer: 'tongxue', alts: ['tóngxué','tong xue'] },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'My classmates are very happy.' },
    ],
  },
  {
    id: 'age',
    unit: 5, unitName: 'CLASSROOM',
    title: 'Asking Age',
    subtitle: '请问你几岁?',
    icon: 'num', color: 'yellow',
    xp: 28, coins: 18,
    exercises: [
      { kind: 'intro', title: 'Two ways to ask "how old?"', body: '请问你几岁? for kids (or casual). 请问你年纪多大了? polite for adults. Reply with: 我今年__岁.', cards: [
        { cn: '请问',     py: 'qǐng wèn',     en: 'may I ask' },
        { cn: '几岁',     py: 'jǐ suì',       en: 'how old (for kids)' },
        { cn: '多大',     py: 'duō dà',       en: 'how big / how old' },
        { cn: '年纪',     py: 'nián jì',      en: 'age' },
        { cn: '今年',     py: 'jīn nián',     en: 'this year' },
        { cn: '岁',       py: 'suì',          en: 'years old' },
      ]},
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '今年', py: 'jīn nián', options: ['last year','next year','this year','every year'], answer: 2 },
      { kind: 'pick-cn',       prompt: '"How old are you?" (to a kid)', en: 'How old are you? (kid)', options: [
        { cn: '请问你几岁？',         py: 'qǐng wèn nǐ jǐ suì?' },
        { cn: '请问你年纪多大了？',   py: 'qǐng wèn nǐ nián jì duō dà le?' },
        { cn: '你叫什么？',           py: 'nǐ jiào shén me?' },
        { cn: '你住在哪里？',         py: 'nǐ zhù zài nǎ lǐ?' },
      ], answer: 0 },
      { kind: 'pick-cn',       prompt: '"I am 30 this year."', en: 'I am 30 this year', options: [
        { cn: '我今年三十岁。', py: 'wǒ jīn nián sān shí suì' },
        { cn: '我三十今年岁。', py: '—' },
        { cn: '今年三十我岁。', py: '—' },
        { cn: '我是三十岁。',   py: 'wǒ shì sān shí suì' },
      ], answer: 0 },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'My daughter is 5 years old this year.' },
    ],
  },
  {
    id: 'animals',
    unit: 5, unitName: 'CLASSROOM',
    title: 'Animals',
    subtitle: '狗 猫 鸡 猪 兔子',
    icon: 'food', color: 'primary',
    xp: 28, coins: 20,
    exercises: [
      { kind: 'intro', title: 'Pets & farm animals', body: 'A few you’ll meet in stories and zodiac signs.', cards: [
        { cn: '狗',     py: 'gǒu',          en: 'dog' },
        { cn: '猫',     py: 'māo',          en: 'cat' },
        { cn: '鸡',     py: 'jī',           en: 'chicken' },
        { cn: '猪',     py: 'zhū',          en: 'pig' },
        { cn: '兔子',   py: 'tù zi',        en: 'rabbit' },
        { cn: '小老鼠', py: 'xiǎo lǎo shǔ', en: 'little mouse' },
      ]},
      { kind: 'match-meaning', prompt: 'Which animal?', cn: '狗',   py: 'gǒu',   options: ['dog','cat','pig','chicken'], answer: 0 },
      { kind: 'match-meaning', prompt: 'Which animal?', cn: '兔子', py: 'tù zi', options: ['mouse','rabbit','pig','cat'], answer: 1 },
      { kind: 'pick-cn',       prompt: '"I have a cat."', en: 'I have a cat', options: [
        { cn: '我有一只猫。', py: 'wǒ yǒu yī zhī māo' },
        { cn: '我是一只猫。', py: 'wǒ shì yī zhī māo' },
        { cn: '我喜欢猫。',   py: 'wǒ xǐ huān māo' },
        { cn: '我看猫。',     py: 'wǒ kàn māo' },
      ], answer: 0 },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '猫', answer: 'mao', alts: ['māo'] },
    ],
  },

  // ─── UNIT 6 — IDENTITY & POSSESSION ─────────────────────────
  {
    id: 'shi-bushi',
    unit: 6, unitName: 'IDENTITY',
    title: '是 / 不是',
    subtitle: 'to be / am not — the spine of every sentence',
    icon: 'verb', color: 'primary',
    xp: 35, coins: 25,
    exercises: [
      { kind: 'intro', title: '是 + noun = "am / is / are"', body: '我是学生 = I am a student. To negate: 不是. Add 也 (also) or 只 (only) in front: 也是, 只是, 也不是.', cards: [
        { cn: '是',       py: 'shì',        en: 'to be (am/is/are)' },
        { cn: '不是',     py: 'bú shì',     en: 'am not / isn’t' },
        { cn: '也',       py: 'yě',         en: 'also' },
        { cn: '只',       py: 'zhǐ',        en: 'only' },
        { cn: '也是',     py: 'yě shì',     en: 'also am / also is' },
        { cn: '也不是',   py: 'yě bú shì',  en: 'also am not' },
        { cn: '只是',     py: 'zhǐ shì',    en: 'only (just) am' },
        { cn: '独生子',   py: 'dú shēng zǐ', en: 'only child (male)' },
        { cn: '独生女',   py: 'dú shēng nǚ', en: 'only child (female)' },
      ]},
      { kind: 'pick-cn', prompt: '"I am a student."', en: 'I am a student', options: [
        { cn: '我是学生。',   py: 'wǒ shì xué shēng' },
        { cn: '我学生是。',   py: '—' },
        { cn: '学生我是。',   py: '—' },
        { cn: '我有学生。',   py: 'wǒ yǒu xué shēng' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"She is not my teacher."', en: 'She is not my teacher', options: [
        { cn: '她不是我老师。', py: 'tā bú shì wǒ lǎo shī' },
        { cn: '她是我老师不。', py: '—' },
        { cn: '她也是老师。',   py: 'tā yě shì lǎo shī' },
        { cn: '她不老师是。',   py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I am also a student."', en: 'I am also a student', options: [
        { cn: '我也是学生。', py: 'wǒ yě shì xué shēng' },
        { cn: '我只是学生。', py: 'wǒ zhǐ shì xué shēng' },
        { cn: '我不是学生。', py: 'wǒ bú shì xué shēng' },
        { cn: '我也学生。',   py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'My brother is also a student. He is an only child.' },
    ],
  },
  {
    id: 'you-meiyou',
    unit: 6, unitName: 'IDENTITY',
    title: '有 / 没有',
    subtitle: 'have / don’t have — and the A-not-A question',
    icon: 'qm', color: 'cyan',
    xp: 35, coins: 25,
    exercises: [
      { kind: 'intro', title: '有 = have. To ask, sandwich it: 有没有?', body: '"Do you have a computer?" 你有没有电脑？That’s the A-not-A pattern — much more common than using 吗 with 有.', cards: [
        { cn: '有',         py: 'yǒu',        en: 'to have' },
        { cn: '没有',       py: 'méi yǒu',    en: 'don’t have / haven’t' },
        { cn: '一个',       py: 'yí ge',      en: 'one (general counter)' },
        { cn: '电脑',       py: 'diàn nǎo',   en: 'computer' },
        { cn: '手机',       py: 'shǒu jī',    en: 'cell phone' },
        { cn: '女朋友',     py: 'nǚ péng yǒu', en: 'girlfriend' },
        { cn: '男朋友',     py: 'nán péng yǒu', en: 'boyfriend' },
      ]},
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '没有', py: 'méi yǒu', options: ['have','don’t have','want','don’t want'], answer: 1 },
      { kind: 'pick-cn', prompt: '"I have a younger brother."', en: 'I have a younger brother', options: [
        { cn: '我有一个弟弟。',   py: 'wǒ yǒu yí ge dì di' },
        { cn: '我是一个弟弟。',   py: 'wǒ shì yí ge dì di' },
        { cn: '我没有弟弟。',     py: 'wǒ méi yǒu dì di' },
        { cn: '弟弟有我。',       py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"Do you have a cell phone?" (A-not-A)', en: 'Do you have a cell phone?', options: [
        { cn: '你有没有手机？', py: 'nǐ yǒu méi yǒu shǒu jī?' },
        { cn: '你有手机吗？',   py: 'nǐ yǒu shǒu jī ma?' },
        { cn: '你没手机吗？',   py: '—' },
        { cn: '你是手机？',     py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese (use 有没有):', en: 'Does his girlfriend have a computer?' },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'Everyone has a cell phone.' },
    ],
  },

  // ─── UNIT 7 — TIME ──────────────────────────────────────────
  {
    id: 'days-week',
    unit: 7, unitName: 'TIME',
    title: 'Days of the Week',
    subtitle: '星期一 · 星期二 · 星期天',
    icon: 'num', color: 'yellow',
    xp: 32, coins: 22,
    exercises: [
      { kind: 'intro', title: 'Stick a number after 星期', body: '星期 = week. 星期一 = Monday (week-one). Sunday is the odd one out: 星期天 or 星期日. 今天 = today, 明天 = tomorrow, 昨天 = yesterday.', cards: [
        { cn: '星期一',   py: 'xīng qī yī',    en: 'Monday' },
        { cn: '星期二',   py: 'xīng qī èr',    en: 'Tuesday' },
        { cn: '星期三',   py: 'xīng qī sān',   en: 'Wednesday' },
        { cn: '星期四',   py: 'xīng qī sì',    en: 'Thursday' },
        { cn: '星期五',   py: 'xīng qī wǔ',    en: 'Friday' },
        { cn: '星期六',   py: 'xīng qī liù',   en: 'Saturday' },
        { cn: '星期天',   py: 'xīng qī tiān',  en: 'Sunday' },
        { cn: '今天',     py: 'jīn tiān',      en: 'today' },
        { cn: '明天',     py: 'míng tiān',     en: 'tomorrow' },
        { cn: '昨天',     py: 'zuó tiān',      en: 'yesterday' },
        { cn: '周末',     py: 'zhōu mò',       en: 'weekend' },
      ]},
      { kind: 'match-meaning', prompt: 'Which day?', cn: '星期三', py: 'xīng qī sān', options: ['Monday','Tuesday','Wednesday','Thursday'], answer: 2 },
      { kind: 'match-meaning', prompt: 'Which day?', cn: '星期天', py: 'xīng qī tiān', options: ['Saturday','Sunday','Monday','Friday'], answer: 1 },
      { kind: 'pick-cn',       prompt: '"Today is Thursday."', en: 'Today is Thursday', options: [
        { cn: '今天是星期四。', py: 'jīn tiān shì xīng qī sì' },
        { cn: '今天星期四是。', py: '—' },
        { cn: '今天是星期六。', py: 'jīn tiān shì xīng qī liù' },
        { cn: '明天是星期四。', py: 'míng tiān shì xīng qī sì' },
      ], answer: 0 },
      { kind: 'type-pinyin',   prompt: 'Type the pinyin:', cn: '星期五', answer: 'xingqiwu', alts: ['xīngqīwǔ','xing qi wu'] },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'Tomorrow is Saturday. I am on vacation.' },
    ],
  },
  {
    id: 'time-of-day',
    unit: 7, unitName: 'TIME',
    title: 'Time of Day',
    subtitle: '早上 · 中午 · 下午 · 晚上',
    icon: 'tone', color: 'cyan',
    xp: 28, coins: 18,
    exercises: [
      { kind: 'intro', title: 'Six slices of a day', body: 'These come BEFORE the verb in a sentence. "I read in the morning" = 我早上看书 (literally: I morning read).', cards: [
        { cn: '早上',     py: 'zǎo shàng',  en: 'morning' },
        { cn: '中午',     py: 'zhōng wǔ',   en: 'noon' },
        { cn: '下午',     py: 'xià wǔ',     en: 'afternoon' },
        { cn: '傍晚',     py: 'bàng wǎn',   en: 'evening (dusk)' },
        { cn: '晚上',     py: 'wǎn shàng',  en: 'night' },
        { cn: '半夜',     py: 'bàn yè',     en: 'midnight' },
        { cn: '现在',     py: 'xiàn zài',   en: 'now' },
        { cn: '点',       py: 'diǎn',       en: "o'clock" },
      ]},
      { kind: 'match-meaning', prompt: 'Which time?', cn: '晚上', py: 'wǎn shàng', options: ['morning','noon','afternoon','night'], answer: 3 },
      { kind: 'match-meaning', prompt: 'Which time?', cn: '中午', py: 'zhōng wǔ',  options: ['morning','noon','afternoon','night'], answer: 1 },
      { kind: 'pick-cn',       prompt: '"It’s 5 o’clock now."', en: "It's 5 o'clock now", options: [
        { cn: '现在是五点。', py: 'xiàn zài shì wǔ diǎn' },
        { cn: '五点是现在。', py: '—' },
        { cn: '现在五是点。', py: '—' },
        { cn: '现在是星期五。', py: 'xiàn zài shì xīng qī wǔ' },
      ], answer: 0 },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'I read books in the morning. I sleep at night.' },
    ],
  },
  {
    id: 'frequency',
    unit: 7, unitName: 'TIME',
    title: 'How Often?',
    subtitle: '总是 · 平常 · 经常 · 有时候 · 从不',
    icon: 'tone', color: 'primary',
    xp: 36, coins: 26,
    exercises: [
      { kind: 'intro', title: 'Frequency adverbs go before the verb', body: '"I usually work" = 我平常工作. "He often comes" = 他经常来. "Never" = 从不 (no 不 again — it already contains it).', cards: [
        { cn: '总是',         py: 'zǒng shì',          en: 'always' },
        { cn: '平常',         py: 'píng cháng',        en: 'usually / normally' },
        { cn: '经常',         py: 'jīng cháng',        en: 'often' },
        { cn: '时常',         py: 'shí cháng',         en: 'often (synonym)' },
        { cn: '有时候',       py: 'yǒu shí hòu',       en: 'sometimes' },
        { cn: '很少',         py: 'hěn shǎo',          en: 'seldom' },
        { cn: '从不',         py: 'cóng bù',           en: 'never' },
        { cn: '从来没有',     py: 'cóng lái méi yǒu',  en: 'have never (with past)' },
      ]},
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '平常', py: 'píng cháng', options: ['always','usually','sometimes','never'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '从不', py: 'cóng bù',    options: ['always','often','sometimes','never'], answer: 3 },
      { kind: 'pick-cn',       prompt: '"I usually don’t get busy at work."', en: "I usually am not busy at work", options: [
        { cn: '我平常工作不忙。',   py: 'wǒ píng cháng gōng zuò bù máng' },
        { cn: '我工作平常不忙。',   py: '—' },
        { cn: '我不平常忙工作。',   py: '—' },
        { cn: '我从不工作。',       py: 'wǒ cóng bù gōng zuò' },
      ], answer: 0 },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'He often has class on Thursday.' },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese (use 平常):', en: 'I usually drink coffee in the morning.' },
    ],
  },

  // ─── UNIT 8 — GETTING AROUND ────────────────────────────────
  {
    id: 'zhu-zai',
    unit: 8, unitName: 'GETTING AROUND',
    title: 'Where Do You Live?',
    subtitle: '你住在哪里？',
    icon: 'chat', color: 'cyan',
    xp: 36, coins: 24,
    exercises: [
      { kind: 'intro', title: '住 = live. 在 = at/in', body: 'Together: 住在 + place. "Where" is 哪里 (formal) or 哪儿 (Beijing). Country names: 国 = country, so 美国 = beautiful-country = USA.', cards: [
        { cn: '住',       py: 'zhù',        en: 'to live (reside)' },
        { cn: '在',       py: 'zài',        en: 'at / in / on' },
        { cn: '哪里',     py: 'nǎ lǐ',      en: 'where (formal)' },
        { cn: '哪儿',     py: 'nǎr',        en: 'where (Beijing)' },
        { cn: '美国',     py: 'měi guó',    en: 'USA' },
        { cn: '中国',     py: 'zhōng guó',  en: 'China' },
        { cn: '台湾',     py: 'tái wān',    en: 'Taiwan' },
        { cn: '加拿大',   py: 'jiā ná dà',  en: 'Canada' },
        { cn: '英国',     py: 'yīng guó',   en: 'UK' },
        { cn: '日本',     py: 'rì běn',     en: 'Japan' },
      ]},
      { kind: 'pick-cn', prompt: '"Where does Mary live?"', en: 'Where does Mary live?', options: [
        { cn: 'Mary 住在哪里？',   py: 'Mary zhù zài nǎ lǐ?' },
        { cn: 'Mary 是哪里的？',   py: 'Mary shì nǎ lǐ de?' },
        { cn: 'Mary 哪里住在？',   py: '—' },
        { cn: 'Mary 喜欢哪里？',   py: 'Mary xǐ huān nǎ lǐ?' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"Mary lives in America."', en: 'Mary lives in America', options: [
        { cn: 'Mary 住在美国。',   py: 'Mary zhù zài měi guó' },
        { cn: 'Mary 美国住在。',   py: '—' },
        { cn: 'Mary 在美国住。',   py: 'Mary zài měi guó zhù' },
        { cn: 'Mary 是美国。',     py: 'Mary shì měi guó' },
      ], answer: 0 },
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '台湾', answer: 'taiwan', alts: ['táiwān','tai wan'] },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'Where do Mary and her husband live? They live in Canada.' },
    ],
  },
  {
    id: 'xiang-want',
    unit: 8, unitName: 'GETTING AROUND',
    title: 'I Want To…',
    subtitle: '想 + verb',
    icon: 'star', color: 'yellow',
    xp: 32, coins: 22,
    exercises: [
      { kind: 'intro', title: '想 (xiǎng) = want to / think', body: 'Stick 想 in front of a verb: 我想去 = I want to go. 你想吃什么? = What do you want to eat? 想 also means "miss" — 我想你 = I miss you.', cards: [
        { cn: '想',       py: 'xiǎng',    en: 'want to / miss' },
        { cn: '想去',     py: 'xiǎng qù', en: 'want to go' },
        { cn: '玩',       py: 'wán',      en: 'play / hang out' },
        { cn: '吃',       py: 'chī',      en: 'eat' },
        { cn: '喝',       py: 'hē',       en: 'drink' },
        { cn: '迪斯尼乐园', py: 'dí sī ní lè yuán', en: 'Disneyland' },
        { cn: '国家公园',   py: 'guó jiā gōng yuán', en: 'national park' },
      ]},
      { kind: 'pick-cn', prompt: '"I want to go to Japan."', en: 'I want to go to Japan', options: [
        { cn: '我想去日本。',   py: 'wǒ xiǎng qù rì běn' },
        { cn: '我去想日本。',   py: '—' },
        { cn: '我日本去想。',   py: '—' },
        { cn: '我在日本想。',   py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"What do you want to eat?"', en: 'What do you want to eat?', options: [
        { cn: '你想吃什么？',   py: 'nǐ xiǎng chī shén me?' },
        { cn: '你什么吃想？',   py: '—' },
        { cn: '你吃什么想？',   py: '—' },
        { cn: '你想是什么？',   py: 'nǐ xiǎng shì shén me?' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'I want to go to Disneyland. I also want to go to the national parks.' },
    ],
  },
  {
    id: 'come-go',
    unit: 8, unitName: 'GETTING AROUND',
    title: 'Come & Go',
    subtitle: '来 · 去 · 回来',
    icon: 'verb', color: 'primary',
    xp: 30, coins: 20,
    exercises: [
      { kind: 'intro', title: 'Come here, go there', body: 'Direction is built in: 来 = come toward speaker, 去 = go away from speaker, 回 = return. Pair with a place: 来美国 = come to USA.', cards: [
        { cn: '来',     py: 'lái',      en: 'to come' },
        { cn: '去',     py: 'qù',       en: 'to go' },
        { cn: '回',     py: 'huí',      en: 'to return' },
        { cn: '回来',   py: 'huí lái',  en: 'come back' },
        { cn: '回去',   py: 'huí qù',   en: 'go back' },
        { cn: '上班',   py: 'shàng bān', en: 'go to work' },
        { cn: '下班',   py: 'xià bān',   en: 'get off work' },
        { cn: '放假',   py: 'fàng jià',  en: 'on vacation' },
      ]},
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '回来', py: 'huí lái', options: ['come back','go back','go up','come down'], answer: 0 },
      { kind: 'pick-cn',       prompt: '"I don’t go to work, I’m on vacation today."', en: "I don't work today, I'm on vacation", options: [
        { cn: '我不上班，我今天放假。',   py: 'wǒ bù shàng bān, wǒ jīn tiān fàng jià' },
        { cn: '我上班，我今天放假。',     py: 'wǒ shàng bān, wǒ jīn tiān fàng jià' },
        { cn: '我下班，我明天上课。',     py: 'wǒ xià bān, wǒ míng tiān shàng kè' },
        { cn: '我去上班，我累。',         py: 'wǒ qù shàng bān, wǒ lèi' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'School is on break now. I came to America to play.' },
    ],
  },

  // ─── UNIT 9 — LIKES & HOBBIES ───────────────────────────────
  {
    id: 'like-degrees',
    unit: 9, unitName: 'LIKES & HOBBIES',
    title: 'Shades of 喜欢',
    subtitle: '好 · 很 · 太 · 不 · 也',
    icon: 'star', color: 'primary',
    xp: 32, coins: 22,
    exercises: [
      { kind: 'intro', title: 'Stack a modifier in front of 喜欢', body: '很 (very) is the default — 我很喜欢 doesn’t literally mean "very much", it’s how Chinese says plain "I like". 太 (too) usually means "love it!". 也 (also) shows you agree.', cards: [
        { cn: '我很喜欢',   py: 'wǒ hěn xǐ huān',  en: 'I like (default)' },
        { cn: '我好喜欢',   py: 'wǒ hǎo xǐ huān',  en: 'I really like (casual)' },
        { cn: '我太喜欢',   py: 'wǒ tài xǐ huān',  en: 'I love it!' },
        { cn: '我不喜欢',   py: 'wǒ bù xǐ huān',   en: 'I don’t like' },
        { cn: '我也喜欢',   py: 'wǒ yě xǐ huān',   en: 'I also like' },
        { cn: '认识',       py: 'rèn shi',         en: 'to know (a person)' },
        { cn: '学中文',     py: 'xué zhōng wén',   en: 'study Chinese' },
      ]},
      { kind: 'pick-cn', prompt: '"Nice to meet you too." (Mark is replying)', en: '"Nice to meet you too" (reply)', options: [
        { cn: '我也很高兴认识你。',   py: 'wǒ yě hěn gāo xìng rèn shi nǐ' },
        { cn: '我太高兴认识你。',     py: 'wǒ tài gāo xìng rèn shi nǐ' },
        { cn: '我不认识你。',         py: 'wǒ bú rèn shi nǐ' },
        { cn: '认识你我不。',         py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'I love studying Chinese, but my Chinese is bad.' },
      { kind: 'ai-translate', prompt: 'Translate to Chinese (use 也):', en: 'I also like cats. I don’t like dogs.' },
    ],
  },
  {
    id: 'hobbies',
    unit: 9, unitName: 'LIKES & HOBBIES',
    title: 'Hobbies',
    subtitle: '踢足球 · 游泳 · 听音乐',
    icon: 'star', color: 'cyan',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'intro', title: 'What do you like to do?', body: 'In Mandarin, "play ball" verbs are specific: 踢 (kick) for soccer, 打 (hit) for basketball/tennis/baseball, 骑 (ride) for bikes/horses.', cards: [
        { cn: '踢足球',     py: 'tī zú qiú',       en: 'play soccer' },
        { cn: '打篮球',     py: 'dǎ lán qiú',      en: 'play basketball' },
        { cn: '游泳',       py: 'yóu yǒng',        en: 'swim' },
        { cn: '跑步',       py: 'pǎo bù',          en: 'run / jogging' },
        { cn: '健行',       py: 'jiàn xíng',       en: 'hiking' },
        { cn: '爬山',       py: 'pá shān',         en: 'mountain climbing' },
        { cn: '骑脚踏车',   py: 'qí jiǎo tà chē',  en: 'ride a bicycle' },
        { cn: '旅行',       py: 'lǚ xíng',         en: 'travel' },
        { cn: '听音乐',     py: 'tīng yīn yuè',    en: 'listen to music' },
        { cn: '看电视',     py: 'kàn diàn shì',    en: 'watch TV' },
        { cn: '睡觉',       py: 'shuì jiào',       en: 'sleep' },
        { cn: '露营',       py: 'lù yíng',         en: 'camping' },
      ]},
      { kind: 'match-meaning', prompt: 'What is it?', cn: '游泳',     py: 'yóu yǒng',     options: ['swim','run','hike','bike'], answer: 0 },
      { kind: 'match-meaning', prompt: 'What is it?', cn: '听音乐',   py: 'tīng yīn yuè', options: ['watch tv','listen to music','play music','sleep'], answer: 1 },
      { kind: 'pick-cn',       prompt: '"I like to play soccer."', en: 'I like to play soccer', options: [
        { cn: '我喜欢踢足球。',     py: 'wǒ xǐ huān tī zú qiú' },
        { cn: '我喜欢打足球。',     py: 'wǒ xǐ huān dǎ zú qiú' },
        { cn: '我踢喜欢足球。',     py: '—' },
        { cn: '我足球喜欢踢。',     py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'What do you like to do on the weekend?' },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'I usually go hiking on Sundays. I also like to ride bicycles.' },
    ],
  },
  {
    id: 'connectors',
    unit: 9, unitName: 'LIKES & HOBBIES',
    title: 'Connectors',
    subtitle: '和 · 还 · 还是 · 但是 · 可是',
    icon: 'qm', color: 'yellow',
    xp: 36, coins: 24,
    exercises: [
      { kind: 'intro', title: 'Glue your sentences together', body: '和 (and) joins nouns only. 还 (also/still) adds another item. 还是 = "or" (in questions). 可是 / 但是 = "but" (interchangeable). 因为 = because.', cards: [
        { cn: '和',     py: 'hé / hàn', en: 'and (joins nouns)' },
        { cn: '还',     py: 'hái',      en: 'also / still / more' },
        { cn: '还是',   py: 'hái shì',  en: 'or (in questions)' },
        { cn: '可是',   py: 'kě shì',   en: 'but' },
        { cn: '但是',   py: 'dàn shì',  en: 'but (more formal)' },
        { cn: '因为',   py: 'yīn wèi',  en: 'because' },
        { cn: '所以',   py: 'suǒ yǐ',   en: 'so / therefore' },
      ]},
      { kind: 'pick-cn', prompt: '"Me and you" (joining nouns)', en: 'me and you', options: [
        { cn: '我和你',   py: 'wǒ hé nǐ' },
        { cn: '我还你',   py: 'wǒ hái nǐ' },
        { cn: '我但是你', py: '—' },
        { cn: '我可是你', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"Do you want tea or coffee?"', en: 'Do you want tea or coffee?', options: [
        { cn: '你想喝茶还是咖啡？',   py: 'nǐ xiǎng hē chá hái shì kā fēi?' },
        { cn: '你想喝茶和咖啡？',     py: 'nǐ xiǎng hē chá hé kā fēi?' },
        { cn: '你想喝茶可是咖啡？',   py: '—' },
        { cn: '你想茶或咖啡喝？',     py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"My Chinese is bad, but theirs is worse."', en: 'My Chinese is bad, but theirs is worse', options: [
        { cn: '我的中文不好，但是他们更烂。',   py: 'wǒ de zhōng wén bù hǎo, dàn shì tā men gèng làn' },
        { cn: '我的中文不好，和他们更烂。',     py: '—' },
        { cn: '我的中文不好，还他们更烂。',     py: '—' },
        { cn: '我中文不好但是他们好。',         py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'I have an older sister, also an older brother, and a younger sister.' },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: "I'm tired because I didn't sleep last night." },
    ],
  },

  // ─── UNIT 10 — PUTTING IT TOGETHER ──────────────────────────
  {
    id: 'right-now',
    unit: 10, unitName: 'IN CONTEXT',
    title: 'Right Now',
    subtitle: '现在 + 在 + V · 正在',
    icon: 'verb', color: 'cyan',
    xp: 36, coins: 24,
    exercises: [
      { kind: 'intro', title: 'Continuous action — "is doing"', body: 'Put 在 in front of a verb: 我在工作 = I am working. Add 现在 for emphasis. 正在 is "just now (this moment)". 着 (zhe) is a different beast — stays for later.', cards: [
        { cn: '现在',     py: 'xiàn zài',  en: 'now' },
        { cn: '在工作',   py: 'zài gōng zuò', en: 'is working' },
        { cn: '正在',     py: 'zhèng zài', en: 'right now (this moment)' },
        { cn: '念书',     py: 'niàn shū',  en: 'study (read books)' },
        { cn: '开车',     py: 'kāi chē',   en: 'drive' },
        { cn: '做饭',     py: 'zuò fàn',   en: 'cook' },
      ]},
      { kind: 'pick-cn', prompt: '"He is working now."', en: 'He is working now', options: [
        { cn: '现在他在工作。', py: 'xiàn zài tā zài gōng zuò' },
        { cn: '现在他工作在。', py: '—' },
        { cn: '他在工作现在。', py: '—' },
        { cn: '他现在工作。',   py: 'tā xiàn zài gōng zuò' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese (use 正在):', en: 'I am studying Chinese right now.' },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'My son is sleeping. My wife is cooking.' },
    ],
  },
  {
    id: 'long-time',
    unit: 10, unitName: 'IN CONTEXT',
    title: 'Long Time No See',
    subtitle: 'meeting old & new friends',
    icon: 'chat', color: 'primary',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'intro', title: 'Standard introduction dialogue', body: 'A real exchange in three moves: greeting, introduce a person, "nice to meet you" both ways.', cards: [
        { cn: '好久不见。',         py: 'hǎo jiǔ bú jiàn',         en: 'Long time no see.' },
        { cn: '这是我朋友 Gloria。', py: 'zhè shì wǒ péng yǒu Gloria', en: 'This is my friend Gloria.' },
        { cn: '认识你很高兴。',     py: 'rèn shi nǐ hěn gāo xìng', en: 'Nice to meet you.' },
        { cn: '我也很高兴认识你。', py: 'wǒ yě hěn gāo xìng rèn shi nǐ', en: 'Nice to meet you too.' },
        { cn: '欢迎你来美国。',     py: 'huān yíng nǐ lái měi guó', en: 'Welcome to America.' },
      ]},
      { kind: 'pick-cn', prompt: 'Gloria says hi. What is the standard reply?', en: '(reply to "long time no see")', options: [
        { cn: '你好，好久不见。',   py: 'nǐ hǎo, hǎo jiǔ bú jiàn' },
        { cn: '我不认识你。',       py: 'wǒ bú rèn shi nǐ' },
        { cn: '再见。',             py: 'zài jiàn' },
        { cn: '我很累。',           py: 'wǒ hěn lèi' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: 'Someone says 认识你很高兴。What do you say back?', en: '(reply to "nice to meet you")', options: [
        { cn: '我也很高兴认识你。', py: 'wǒ yě hěn gāo xìng rèn shi nǐ' },
        { cn: '我也是。',           py: 'wǒ yě shì' },
        { cn: '不客气。',           py: 'bú kè qi' },
        { cn: '没关系。',           py: 'méi guān xi' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Introduce someone (translate):', en: 'This is my younger brother Jiawen. He came to America to play.' },
    ],
  },
  {
    id: 'gei-give',
    unit: 10, unitName: 'IN CONTEXT',
    title: '给 — Give / For / To',
    subtitle: 'one tiny word, three big jobs',
    icon: 'verb', color: 'yellow',
    xp: 38, coins: 26,
    exercises: [
      { kind: 'intro', title: '给 (gěi) is everywhere', body: '1) "To give" — 我给你一本书 = I give you a book. 2) "For/to" (preposition) — 这是给你的 = This is for you. 3) "Call X" — 我打电话给他 = I make a phone call to him.', cards: [
        { cn: '给',         py: 'gěi',          en: 'give / for / to' },
        { cn: '一本书',     py: 'yì běn shū',   en: 'one book' },
        { cn: '打电话',     py: 'dǎ diàn huà',  en: 'make a phone call' },
        { cn: '手机',       py: 'shǒu jī',      en: 'cell phone' },
        { cn: '号码',       py: 'hào mǎ',       en: 'number (e.g. phone)' },
        { cn: '给我看看',   py: 'gěi wǒ kàn kàn', en: 'let me have a look' },
      ]},
      { kind: 'pick-cn', prompt: '"This is for you."', en: 'This is for you', options: [
        { cn: '这是给你的。', py: 'zhè shì gěi nǐ de' },
        { cn: '这是你的给。', py: '—' },
        { cn: '你的这给是。', py: '—' },
        { cn: '我给你这是。', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I’ll call him."', en: "I'll call him", options: [
        { cn: '我打电话给他。', py: 'wǒ dǎ diàn huà gěi tā' },
        { cn: '我给他打电话。', py: 'wǒ gěi tā dǎ diàn huà' },   // also acceptable
        { cn: '我电话打他给。', py: '—' },
        { cn: '我给电话他打。', py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'Give me your phone number, please.' },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'I want to give my mom a book.' },
    ],
  },
  {
    id: 'reading-1',
    unit: 10, unitName: 'IN CONTEXT',
    title: 'Reading: Old Friends',
    subtitle: 'a short dialogue — read it through',
    icon: 'chat', color: 'red',
    xp: 60, coins: 40,
    exercises: [
      { kind: 'intro', title: 'A: Gloria runs into a friend', body: 'Each line plays when you tap it. Read top to bottom, then take the quiz.', cards: [
        { cn: 'A：Gloria，好久不见。', py: 'A: Gloria, hǎo jiǔ bú jiàn', en: 'A: Gloria, long time no see.' },
        { cn: 'B：你好，好久不见。', py: 'B: nǐ hǎo, hǎo jiǔ bú jiàn', en: 'B: Hi, long time no see.' },
        { cn: 'A：这是我弟弟家文。',   py: 'A: zhè shì wǒ dì di Jiā wén', en: "A: This is my younger brother Jiawen." },
        { cn: '家文，这是我朋友 Gloria。', py: 'Jiā wén, zhè shì wǒ péng yǒu Gloria', en: 'Jiawen, this is my friend Gloria.' },
        { cn: 'B：你好，家文，认识你很高兴。', py: 'B: nǐ hǎo Jiā wén, rèn shi nǐ hěn gāo xìng', en: 'B: Hi Jiawen, nice to meet you.' },
        { cn: 'C：Gloria，我也很高兴认识你。', py: 'C: Gloria, wǒ yě hěn gāo xìng rèn shi nǐ', en: 'C: Gloria, nice to meet you too.' },
        { cn: 'A：家文，你也在美国念书吗？', py: 'A: Jiā wén, nǐ yě zài měi guó niàn shū ma?', en: 'A: Jiawen, do you also study in America?' },
        { cn: 'C：不是，我平常住在台湾。',     py: 'C: bú shì, wǒ píng cháng zhù zài tái wān', en: 'C: No, I usually live in Taiwan.' },
        { cn: '现在学校放假，我来美国玩。',     py: 'xiàn zài xué xiào fàng jià, wǒ lái měi guó wán', en: 'School is on break now, I came to America to play.' },
        { cn: 'B：欢迎你来美国，你想去哪里玩？', py: 'B: huān yíng nǐ lái měi guó, nǐ xiǎng qù nǎ lǐ wán?', en: 'B: Welcome to America. Where do you want to go?' },
        { cn: 'C：我想去迪斯尼乐园玩，也想去国家公园玩。', py: 'C: wǒ xiǎng qù dí sī ní lè yuán wán, yě xiǎng qù guó jiā gōng yuán wán', en: 'C: I want to go to Disneyland, and also national parks.' },
      ]},
      { kind: 'match-meaning', prompt: 'Where does Jiawen usually live?', cn: '台湾', py: 'tái wān', options: ['America','Taiwan','Japan','China'], answer: 1 },
      { kind: 'pick-cn',       prompt: 'Why is Jiawen in America?', en: 'why is he in America?', options: [
        { cn: '他来美国玩。',     py: 'tā lái měi guó wán' },
        { cn: '他来美国工作。',   py: 'tā lái měi guó gōng zuò' },
        { cn: '他来美国念书。',   py: 'tā lái měi guó niàn shū' },
        { cn: '他不在美国。',     py: 'tā bú zài měi guó' },
      ], answer: 0 },
      { kind: 'pick-cn',       prompt: 'How does Jiawen relate to A?', en: "Jiawen is A's…", options: [
        { cn: '他是 A 的弟弟。',   py: 'tā shì A de dì di' },
        { cn: '他是 A 的哥哥。',   py: 'tā shì A de gē ge' },
        { cn: '他是 A 的爸爸。',   py: 'tā shì A de bà ba' },
        { cn: '他是 A 的同学。',   py: 'tā shì A de tóng xué' },
      ], answer: 0 },
      { kind: 'ai-translate',  prompt: 'Translate to Chinese:', en: 'I have a younger brother. He usually lives in Taiwan, but now he is in America.' },
    ],
  },

  // ─── UNIT 11 — DIALOGUE PRACTICE ────────────────────────────
  {
    id: 'dialogue-restaurant',
    unit: 11, unitName: 'DIALOGUE PRACTICE',
    title: 'Ordering Food',
    subtitle: 'pick what comes next + reply for yourself',
    icon: 'food', color: 'primary',
    xp: 50, coins: 35,
    exercises: [
      { kind: 'intro', title: 'A short noodle-shop dialogue', body: 'Read the lines, then pick what the customer (you) would say next.', cards: [
        { cn: '欢迎光临',   py: 'huān yíng guāng lín', en: 'welcome (formal greeting)' },
        { cn: '请坐',       py: 'qǐng zuò',            en: 'please sit' },
        { cn: '点菜',       py: 'diǎn cài',            en: 'order food' },
        { cn: '一碗',       py: 'yì wǎn',              en: 'one bowl of' },
        { cn: '牛肉面',     py: 'niú ròu miàn',        en: 'beef noodles' },
        { cn: '多少钱',     py: 'duō shao qián',       en: 'how much money?' },
        { cn: '块',         py: 'kuài',                en: 'dollar (informal yuan)' },
      ]},
      { kind: 'dialogue-complete',
        prompt: 'You walked in. The server greets you. What do you say?',
        en: '(reply to greeting)',
        context: [
          { speaker: '店员', cn: '欢迎光临！请坐。',         py: 'huān yíng guāng lín! qǐng zuò',         en: 'Welcome! Please sit.' },
        ],
        options: [
          { cn: '你好。',           py: 'nǐ hǎo' },
          { cn: '再见。',           py: 'zài jiàn' },
          { cn: '我不认识你。',     py: 'wǒ bú rèn shi nǐ' },
          { cn: '我累。',           py: 'wǒ lèi' },
        ],
        answer: 0,
      },
      { kind: 'dialogue-complete',
        prompt: 'You sat down. The server asks what you want. What do you order?',
        en: 'order beef noodles',
        context: [
          { speaker: '店员', cn: '你想吃什么？',           py: 'nǐ xiǎng chī shén me?',      en: 'What do you want to eat?' },
        ],
        options: [
          { cn: '我想吃牛肉面。',   py: 'wǒ xiǎng chī niú ròu miàn' },
          { cn: '我也吃牛肉面。',   py: 'wǒ yě chī niú ròu miàn' },
          { cn: '我不喜欢牛肉。',   py: 'wǒ bù xǐ huān niú ròu' },
          { cn: '我想去日本。',     py: 'wǒ xiǎng qù rì běn' },
        ],
        answer: 0,
      },
      { kind: 'dialogue-complete',
        prompt: 'You want to know the price. Ask.',
        en: 'ask the price',
        context: [
          { speaker: '店员', cn: '好的，一碗牛肉面。',     py: 'hǎo de, yì wǎn niú ròu miàn',  en: 'OK, one bowl of beef noodles.' },
        ],
        options: [
          { cn: '多少钱？',         py: 'duō shao qián?' },
          { cn: '几岁？',           py: 'jǐ suì?' },
          { cn: '几点？',           py: 'jǐ diǎn?' },
          { cn: '你是谁？',         py: 'nǐ shì shéi?' },
        ],
        answer: 0,
      },
      { kind: 'ai-respond',
        prompt: 'Reply naturally in Chinese:',
        cn: '你喜欢喝什么？',
        py: 'nǐ xǐ huān hē shén me?',
        en: 'What do you like to drink?',
      },
      { kind: 'ai-respond',
        prompt: 'Reply naturally:',
        cn: '你想吃什么？今天的特别菜是牛肉面。',
        py: 'nǐ xiǎng chī shén me? jīn tiān de tè bié cài shì niú ròu miàn',
        en: 'What do you want to eat? Today’s special is beef noodles.',
      },
    ],
  },
  {
    id: 'dialogue-meet-someone',
    unit: 11, unitName: 'DIALOGUE PRACTICE',
    title: 'Meet a Stranger',
    subtitle: 'someone says hi — keep the chat going',
    icon: 'chat', color: 'cyan',
    xp: 50, coins: 35,
    exercises: [
      { kind: 'intro', title: 'The opening five questions', body: 'When meeting someone, you’ll hear: name → where from → what you do → where you live → what you like. Practice each.', cards: [
        { cn: '你叫什么名字？',       py: 'nǐ jiào shén me míng zi?',     en: 'What’s your name?' },
        { cn: '你是哪国人？',         py: 'nǐ shì nǎ guó rén?',           en: 'Where are you from?' },
        { cn: '你做什么工作？',       py: 'nǐ zuò shén me gōng zuò?',     en: 'What do you do?' },
        { cn: '你住在哪里？',         py: 'nǐ zhù zài nǎ lǐ?',            en: 'Where do you live?' },
        { cn: '你喜欢做什么？',       py: 'nǐ xǐ huān zuò shén me?',      en: 'What do you like to do?' },
      ]},
      { kind: 'ai-respond', prompt: 'They ask your name. Reply:',
        cn: '你好！你叫什么名字？', py: 'nǐ hǎo! nǐ jiào shén me míng zi?', en: 'Hi! What\'s your name?' },
      { kind: 'ai-respond', prompt: 'They ask where you’re from:',
        cn: '你是哪国人？', py: 'nǐ shì nǎ guó rén?', en: 'Where are you from?' },
      { kind: 'ai-respond', prompt: 'They ask your job:',
        cn: '你做什么工作？', py: 'nǐ zuò shén me gōng zuò?', en: 'What do you do?' },
      { kind: 'ai-respond', prompt: 'They ask where you live:',
        cn: '你住在哪里？', py: 'nǐ zhù zài nǎ lǐ?', en: 'Where do you live?' },
      { kind: 'ai-respond', prompt: 'They ask your hobbies:',
        cn: '周末你喜欢做什么？', py: 'zhōu mò nǐ xǐ huān zuò shén me?', en: 'What do you like to do on weekends?' },
    ],
  },

  // ─── UNIT 12 — GRAMMAR DEEP DIVES ───────────────────────────
  {
    id: 'grammar-le',
    unit: 12, unitName: 'GRAMMAR',
    title: '了 — the two faces',
    subtitle: 'completed action AND change of state',
    icon: 'verb', color: 'yellow',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'intro', title: '了 (le) does two jobs', body: '① After a verb = "did" / "finished". 我吃了 = I ate.\n② At the end of a sentence = "now (changed)". 我饿了 = I’m hungry (NOW). With both 了s: 我吃了 + 饭了 = I ate (and now the meal’s done).', cards: [
        { cn: '我吃了',         py: 'wǒ chī le',         en: 'I ate / I have eaten' },
        { cn: '他来了',         py: 'tā lái le',         en: 'he came / he\'s here now' },
        { cn: '我饿了',         py: 'wǒ è le',           en: 'I\'m hungry now' },
        { cn: '我累了',         py: 'wǒ lèi le',         en: 'I\'m tired now' },
        { cn: '太好了！',       py: 'tài hǎo le!',       en: 'great! (lit. "too good now")' },
        { cn: '我毕业了',       py: 'wǒ bì yè le',       en: 'I graduated (and that\'s where I am now)' },
        { cn: '结婚了',         py: 'jié hūn le',        en: 'married' },
      ]},
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '我饿了', py: 'wǒ è le',
        options: ['I will be hungry','I\'m hungry now','I was hungry','I\'m not hungry'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '他来了', py: 'tā lái le',
        options: ['he wants to come','he\'s coming','he\'s here / he came','he won\'t come'], answer: 2 },
      { kind: 'pick-cn', prompt: '"I ate already."', en: 'I ate already', options: [
        { cn: '我吃了。',     py: 'wǒ chī le' },
        { cn: '我吃。',       py: 'wǒ chī' },
        { cn: '我要吃。',     py: 'wǒ yào chī' },
        { cn: '我不吃。',     py: 'wǒ bù chī' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"My older sister got married." (change of state)', en: 'my older sister got married', options: [
        { cn: '我姐姐结婚了。',     py: 'wǒ jiě jie jié hūn le' },
        { cn: '我姐姐结婚。',       py: 'wǒ jiě jie jié hūn' },
        { cn: '我姐姐想结婚。',     py: 'wǒ jiě jie xiǎng jié hūn' },
        { cn: '我姐姐没有结婚。',   py: 'wǒ jiě jie méi yǒu jié hūn' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate (use 了):', en: 'I\'m too tired. I want to sleep.' },
    ],
  },
  {
    id: 'grammar-de',
    unit: 12, unitName: 'GRAMMAR',
    title: '的 — the all-purpose glue',
    subtitle: 'possession · adjective · "the one that..."',
    icon: 'verb', color: 'cyan',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'intro', title: '的 (de) does three things', body: '① Possessive: 我的书 = my book.\n② Adjective glue: 红的车 = a red car.\n③ Nominalizer "the one that": 那本是我的 = that one (book) is mine.\n\nWith close relations you can DROP 的: 我妈妈 (not 我的妈妈).', cards: [
        { cn: '我的书',         py: 'wǒ de shū',         en: 'my book' },
        { cn: '老师的电脑',     py: 'lǎo shī de diàn nǎo', en: 'teacher\'s computer' },
        { cn: '红的车',         py: 'hóng de chē',       en: 'a red car' },
        { cn: '好吃的',         py: 'hǎo chī de',        en: 'a tasty one' },
        { cn: '这是我的',       py: 'zhè shì wǒ de',     en: 'this is mine' },
        { cn: '我妈妈',         py: 'wǒ mā ma',          en: 'my mom (no 的)' },
      ]},
      { kind: 'pick-cn', prompt: '"This is mine."', en: 'this is mine', options: [
        { cn: '这是我的。',   py: 'zhè shì wǒ de' },
        { cn: '这是我。',     py: 'zhè shì wǒ' },
        { cn: '我是这的。',   py: '—' },
        { cn: '这我的是。',   py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"the teacher\'s book"', en: "the teacher's book", options: [
        { cn: '老师的书',   py: 'lǎo shī de shū' },
        { cn: '老师书的',   py: '—' },
        { cn: '书老师的',   py: '—' },
        { cn: '我的老师书', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"my mom" (with the right form)', en: 'my mom', options: [
        { cn: '我妈妈',     py: 'wǒ mā ma' },          // close relation, 的 drops
        { cn: '我的妈妈',   py: 'wǒ de mā ma' },       // grammatical but unusual
        { cn: '妈妈我',     py: '—' },
        { cn: '妈妈的我',   py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'This is my teacher\'s computer.' },
    ],
  },
  {
    id: 'grammar-measure-words',
    unit: 12, unitName: 'GRAMMAR',
    title: 'Measure Words',
    subtitle: '个 · 只 · 本 · 张 · 口',
    icon: 'num', color: 'primary',
    xp: 42, coins: 30,
    exercises: [
      { kind: 'intro', title: 'You can\'t just say "one X" — pick a counter', body: 'English barely has these (a sheet of paper, a head of cattle). Chinese has dozens.\n\n个 = generic, for people and most nouns.\n只 = for animals & one of a pair.\n本 = for bound things (books, magazines).\n张 = for flat things (paper, tickets, beds).\n口 = for "mouths" — counting people in a family.', cards: [
        { cn: '一个人',       py: 'yí ge rén',         en: 'one person' },
        { cn: '一个朋友',     py: 'yí ge péng yǒu',    en: 'one friend' },
        { cn: '两只狗',       py: 'liǎng zhī gǒu',     en: 'two dogs' },
        { cn: '三本书',       py: 'sān běn shū',       en: 'three books' },
        { cn: '一张纸',       py: 'yì zhāng zhǐ',      en: 'one piece of paper' },
        { cn: '我家有五口人', py: 'wǒ jiā yǒu wǔ kǒu rén', en: 'my family has 5 people' },
      ]},
      { kind: 'pick-cn', prompt: '"one dog"', en: 'one dog', options: [
        { cn: '一只狗',   py: 'yì zhī gǒu' },
        { cn: '一本狗',   py: '—' },
        { cn: '一张狗',   py: '—' },
        { cn: '一狗',     py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"two books"', en: 'two books', options: [
        { cn: '两本书',   py: 'liǎng běn shū' },
        { cn: '两个书',   py: '—' },
        { cn: '两只书',   py: '—' },
        { cn: '二本书',   py: '—' },  // 二 vs 两 — 两 is used for "2 of" counting
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"My family has four people."', en: 'My family has four people', options: [
        { cn: '我家有四口人。',   py: 'wǒ jiā yǒu sì kǒu rén' },
        { cn: '我家有四个人。',   py: 'wǒ jiā yǒu sì ge rén' },     // also acceptable but 口 is the textbook form for family
        { cn: '我有四家人。',     py: '—' },
        { cn: '我四口家人。',     py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate to Chinese:', en: 'I have three cats and two dogs.' },
    ],
  },

  // ════════════════════════════════════════════════════════════
  // UNIT 13 — 來學華語 BOOK 1 (adapted)
  // 30 lessons mapped to the 10 chapters of the OCAC textbook.
  // Each chapter → 2–3 bite-size lessons (vocab → pattern → dialogue).
  // ════════════════════════════════════════════════════════════

  // ─── CHAPTER 1 — 您好 Hello! ────────────────────────────────
  {
    id: 'b1-c1a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch1 · Names & Hi',
    subtitle: '您好 · 您贵姓 · 我叫…',
    icon: 'chat', color: 'primary',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'intro', title: 'Chapter 1 vocab', body: 'The polite 您 (nín) instead of 你 (nǐ). Use it for elders, teachers, customers.', cards: [
        { cn: '您',     py: 'nín',     en: 'you (polite)' },
        { cn: '好',     py: 'hǎo',     en: 'good / fine' },
        { cn: '我',     py: 'wǒ',      en: 'I, me' },
        { cn: '姓',     py: 'xìng',    en: 'to be surnamed' },
        { cn: '叫',     py: 'jiào',    en: 'to be called' },
        { cn: '什么',   py: 'shén me', en: 'what' },
        { cn: '名字',   py: 'míng zi', en: 'name (given name)' },
        { cn: '是',     py: 'shì',     en: 'to be (am/is/are)' },
        { cn: '人',     py: 'rén',     en: 'person' },
        { cn: '请问',   py: 'qǐng wèn', en: 'may I ask' },
        { cn: '您贵姓', py: 'nín guì xìng', en: 'what is your surname? (polite)' },
        { cn: '您呢',   py: 'nín ne',  en: 'and you?' },
      ]},
      // Recognition drill — chase each word's meaning
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '您贵姓', py: 'nín guì xìng',
        options: ['what is your name?','what is your surname? (polite)','where are you from?','how old are you?'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '请问', py: 'qǐng wèn',
        options: ['hello','goodbye','may I ask','please come'], answer: 2 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '名字', py: 'míng zi',
        options: ['surname','given name','title','nickname'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '您呢', py: 'nín ne',
        options: ['who are you?','and you?','where are you?','who is he?'], answer: 1 },
      // Production: pick the right Chinese
      { kind: 'pick-cn', prompt: '"My surname is Wang, my given name is Mingwen."', en: 'I am Wang Mingwen', options: [
        { cn: '我姓王，叫明文。', py: 'wǒ xìng Wáng, jiào Míngwén' },
        { cn: '我叫王，姓明文。', py: '—' },
        { cn: '我王叫明文是。',   py: '—' },
        { cn: '王是我姓的明文。', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"Hello, my name is Lee."', en: 'Hello, my name is Lee', options: [
        { cn: '您好，我姓Lee。',     py: 'nín hǎo, wǒ xìng Lee' },
        { cn: '您好Lee，姓我。',     py: '—' },
        { cn: '我Lee姓您好。',       py: '—' },
        { cn: '我您好Lee是姓。',     py: '—' },
      ], answer: 0 },
      // Word-order drill — textbook style!
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My surname is Wang.',
        words: ['我', '姓', '王'], scrambled: ['姓', '王', '我'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I am called Mingwen.',
        words: ['我', '叫', '明文'], scrambled: ['明文', '叫', '我'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My surname is Lee, I am called Gloria.',
        words: ['我', '姓', 'Lee', '叫', 'Gloria'], scrambled: ['Lee', '我', 'Gloria', '叫', '姓'] },
      // Production drill
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '请问', answer: 'qingwen', alts: ['qǐngwèn','qing wen'] },
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '名字', answer: 'mingzi', alts: ['míngzi','ming zi'] },
      // Speaking
      { kind: 'speak', prompt: 'Say it out loud:', word: '您好', py: 'nín hǎo', tone: 2 },
      // Free production
      { kind: 'ai-translate', prompt: 'Translate to Chinese (polite):', en: 'Hello, may I ask your surname?' },
      { kind: 'ai-respond', prompt: 'Reply naturally:', cn: '您好！请问您贵姓？',
        py: 'nín hǎo! qǐng wèn nín guì xìng?', en: 'Hello! May I ask your surname?' },
    ],
  },
  {
    id: 'b1-c1b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch1 · Where are you from?',
    subtitle: '哪国人 · 我是台湾人',
    icon: 'qm', color: 'cyan',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'intro', title: 'Asking nationality', body: '哪国人 = "which-country person". Reply: 我是 + COUNTRY + 人. 美国 (USA), 台湾 (Taiwan), 中国 (China), 加拿大 (Canada), 英国 (UK), 法国 (France), 日本 (Japan).', cards: [
        { cn: '哪国人',   py: 'nǎ guó rén', en: 'what nationality?' },
        { cn: '美国人',   py: 'měi guó rén', en: 'American' },
        { cn: '台湾人',   py: 'tái wān rén', en: 'Taiwanese' },
        { cn: '中国人',   py: 'zhōng guó rén', en: 'Chinese' },
        { cn: '加拿大人', py: 'jiā ná dà rén', en: 'Canadian' },
        { cn: '英国人',   py: 'yīng guó rén', en: 'British' },
        { cn: '日本人',   py: 'rì běn rén', en: 'Japanese' },
        { cn: '法国人',   py: 'fǎ guó rén',  en: 'French' },
      ]},
      // Country recognition drills
      { kind: 'match-meaning', prompt: 'Where from?', cn: '美国人', py: 'měi guó rén',
        options: ['Chinese','Taiwanese','American','British'], answer: 2 },
      { kind: 'match-meaning', prompt: 'Where from?', cn: '日本人', py: 'rì běn rén',
        options: ['Japanese','Korean','Chinese','Taiwanese'], answer: 0 },
      { kind: 'match-meaning', prompt: 'Where from?', cn: '加拿大人', py: 'jiā ná dà rén',
        options: ['American','Mexican','Australian','Canadian'], answer: 3 },
      // Production
      { kind: 'pick-cn', prompt: '"Are you American?"', en: 'Are you American?', options: [
        { cn: '你是美国人吗？', py: 'nǐ shì měi guó rén ma?' },
        { cn: '你美国是人吗？', py: '—' },
        { cn: '美国你是人？',   py: '—' },
        { cn: '你是美国吗？',   py: 'nǐ shì měi guó ma?' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I am Taiwanese."', en: 'I am Taiwanese', options: [
        { cn: '我是台湾人。', py: 'wǒ shì tái wān rén' },
        { cn: '我台湾是。',   py: '—' },
        { cn: '我是台湾。',   py: 'wǒ shì tái wān' },
        { cn: '我人台湾。',   py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"He is Chinese, I am American."', en: 'He is Chinese, I am American', options: [
        { cn: '他是中国人，我是美国人。', py: 'tā shì zhōng guó rén, wǒ shì měi guó rén' },
        { cn: '他中国人我美国人是。',     py: '—' },
        { cn: '我他中国是美国人。',       py: '—' },
        { cn: '他美国，我中国人是。',     py: '—' },
      ], answer: 0 },
      // Word-order drill
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I am Taiwanese.',
        words: ['我', '是', '台湾人'], scrambled: ['台湾人', '是', '我'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Are you American?',
        words: ['你', '是', '美国人', '吗'], scrambled: ['美国人', '吗', '你', '是'] },
      // Production drill
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '美国', answer: 'meiguo', alts: ['měiguó','mei guo'] },
      // Speaking
      { kind: 'speak', prompt: 'Say it out loud:', word: '我是美国人', py: 'wǒ shì měi guó rén', tone: 2 },
      // Free production
      { kind: 'ai-respond', prompt: 'Reply:', cn: '请问您是哪国人？', py: 'qǐng wèn nín shì nǎ guó rén?', en: 'May I ask your nationality?' },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '您贵姓？您叫什么名字？', py: 'nín guì xìng? nín jiào shén me míng zi?', en: 'Your surname? Your given name?' },
      { kind: 'ai-respond', prompt: 'Bounce it back:', cn: '我是美国人，您呢？', py: 'wǒ shì měi guó rén, nín ne?', en: "I'm American, and you?" },
    ],
  },

  // ─── CHAPTER 2 — 我有两个弟弟 I Have Two Younger Brothers ───
  {
    id: 'b1-c2a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch2 · Siblings',
    subtitle: '哥哥 姐姐 弟弟 妹妹',
    icon: 'people', color: 'yellow',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'intro', title: 'Older vs younger matters', body: 'Mandarin always distinguishes older (哥/姐) from younger (弟/妹). 兄弟姊妹 = siblings (lit. older-brothers younger-brothers older-sisters younger-sisters).', cards: [
        { cn: '哥哥',   py: 'gē ge',   en: 'older brother' },
        { cn: '弟弟',   py: 'dì di',   en: 'younger brother' },
        { cn: '姐姐',   py: 'jiě jie', en: 'older sister' },
        { cn: '妹妹',   py: 'mèi mei', en: 'younger sister' },
        { cn: '兄弟姐妹', py: 'xiōng dì jiě mèi', en: 'siblings' },
        { cn: '两',     py: 'liǎng',   en: 'two (for counting)' },
        { cn: '个',     py: 'ge',      en: 'measure word (generic)' },
        { cn: '有',     py: 'yǒu',     en: 'to have' },
        { cn: '没',     py: 'méi',     en: 'not (for 有)' },
        { cn: '只',     py: 'zhǐ',     en: 'only' },
        { cn: '也',     py: 'yě',      en: 'also' },
        { cn: '吗',     py: 'ma',      en: 'question particle' },
      ]},
      // Recognition drills — all four sibling types
      { kind: 'match-meaning', prompt: 'Which?', cn: '弟弟', py: 'dì di', options: ['older brother','younger brother','older sister','younger sister'], answer: 1 },
      { kind: 'match-meaning', prompt: 'Which?', cn: '姐姐', py: 'jiě jie', options: ['older brother','younger brother','older sister','younger sister'], answer: 2 },
      { kind: 'match-meaning', prompt: 'Which?', cn: '哥哥', py: 'gē ge', options: ['older brother','younger brother','older sister','younger sister'], answer: 0 },
      { kind: 'match-meaning', prompt: 'Which?', cn: '妹妹', py: 'mèi mei', options: ['older brother','younger brother','older sister','younger sister'], answer: 3 },
      // Pick the right Chinese
      { kind: 'pick-cn', prompt: '"older sister"', en: 'older sister', options: [
        { cn: '姐姐', py: 'jiě jie' }, { cn: '妹妹', py: 'mèi mei' },
        { cn: '哥哥', py: 'gē ge' },   { cn: '弟弟', py: 'dì di' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"younger brother"', en: 'younger brother', options: [
        { cn: '姐姐', py: 'jiě jie' }, { cn: '妹妹', py: 'mèi mei' },
        { cn: '哥哥', py: 'gē ge' },   { cn: '弟弟', py: 'dì di' },
      ], answer: 3 },
      // Function words
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '也', py: 'yě', options: ['only','also','not','two'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '只', py: 'zhǐ', options: ['only','also','not','two'], answer: 0 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '两', py: 'liǎng', options: ['one','two','three','four'], answer: 1 },
      // Type
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '兄弟姐妹', answer: 'xiongdijiemei', alts: ['xiōngdìjiěmèi','xiong di jie mei'] },
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '弟弟', answer: 'didi', alts: ['dìdi','di di'] },
      // Speak
      { kind: 'speak', prompt: 'Say it:', word: '哥哥', py: 'gē ge', tone: 0 },
    ],
  },
  {
    id: 'b1-c2b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch2 · I have two…',
    subtitle: '我有两个… · 没有 · 只有',
    icon: 'num', color: 'primary',
    xp: 42, coins: 30,
    exercises: [
      { kind: 'intro', title: 'Counting with 个', body: 'Pattern: 我有 + NUMBER + 个 + NOUN. For "2 of" use 两 not 二 (二 is only when counting "one, two, three…"). To negate 有: use 没有, not 不有.', cards: [
        { cn: '我有一个哥哥',       py: 'wǒ yǒu yí ge gē ge',       en: 'I have one older brother' },
        { cn: '我有两个弟弟',       py: 'wǒ yǒu liǎng ge dì di',    en: 'I have two younger brothers' },
        { cn: '我没有姐姐',         py: 'wǒ méi yǒu jiě jie',       en: 'I don\'t have an older sister' },
        { cn: '我只有一个妹妹',     py: 'wǒ zhǐ yǒu yí ge mèi mei', en: 'I only have one younger sister' },
        { cn: '我也有两个哥哥',     py: 'wǒ yě yǒu liǎng ge gē ge', en: 'I also have two older brothers' },
      ]},
      // Production drills
      { kind: 'pick-cn', prompt: '"I have one older brother."', en: 'I have one older brother', options: [
        { cn: '我有一个哥哥。', py: 'wǒ yǒu yí ge gē ge' },
        { cn: '我有一哥哥。',   py: '—' },
        { cn: '我一个哥哥。',   py: '—' },
        { cn: '哥哥我一个。',   py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I have two younger sisters."', en: 'I have two younger sisters', options: [
        { cn: '我有两个妹妹。', py: 'wǒ yǒu liǎng ge mèi mei' },
        { cn: '我有二个妹妹。', py: '—' },   // 二 instead of 两 — common mistake
        { cn: '我两妹妹有。',   py: '—' },
        { cn: '两个我妹妹有。', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I don\'t have an older sister."', en: "I don't have an older sister", options: [
        { cn: '我没有姐姐。', py: 'wǒ méi yǒu jiě jie' },
        { cn: '我不有姐姐。', py: '—' },
        { cn: '我没姐姐有。', py: '—' },
        { cn: '我有不姐姐。', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I only have two younger brothers."', en: 'I only have two younger brothers', options: [
        { cn: '我只有两个弟弟。', py: 'wǒ zhǐ yǒu liǎng ge dì di' },
        { cn: '我有只两个弟弟。', py: '—' },
        { cn: '只我有两个弟弟。', py: '—' },
        { cn: '我两个只弟弟有。', py: '—' },
      ], answer: 0 },
      // Arrange — direct from textbook style
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I have one older brother.',
        words: ['我', '有', '一个', '哥哥'], scrambled: ['哥哥', '一个', '我', '有'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I have two younger sisters.',
        words: ['我', '有', '两个', '妹妹'], scrambled: ['两个', '妹妹', '我', '有'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: "I don't have an older sister.",
        words: ['我', '没有', '姐姐'], scrambled: ['姐姐', '没有', '我'] },
      // True/False — same initial / pattern detection
      { kind: 'true-false', prompt: 'Same pattern (有/没有)?', a: 'wǒ yǒu', b: 'wǒ méi yǒu', same: false },
      // Speak
      { kind: 'speak', prompt: 'Say it:', word: '我有两个弟弟', py: 'wǒ yǒu liǎng ge dì di', tone: 2 },
      // Free production
      { kind: 'ai-respond', prompt: 'Reply naturally:', cn: '你有兄弟姐妹吗？', py: 'nǐ yǒu xiōng dì jiě mèi ma?', en: 'Do you have siblings?' },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你有几个哥哥？', py: 'nǐ yǒu jǐ ge gē ge?', en: 'How many older brothers do you have?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'I also have two older brothers and one younger sister.' },
      { kind: 'ai-translate', prompt: 'Translate:', en: "I don't have a younger brother, I only have an older sister." },
    ],
  },

  // ─── CHAPTER 3 — 她是学生 She Is a Student ──────────────────
  {
    id: 'b1-c3a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch3 · School & work',
    subtitle: '学生 · 大学 · 公司 · 银行',
    icon: 'verb', color: 'cyan',
    xp: 34, coins: 24,
    exercises: [
      { kind: 'intro', title: 'Where people go', body: 'Pair with 在 (at) for location: 我在大学念书 = I study at university. 我在公司工作 = I work at a company.', cards: [
        { cn: '学生',   py: 'xué shēng', en: 'student' },
        { cn: '大学',   py: 'dà xué',    en: 'university' },
        { cn: '小学',   py: 'xiǎo xué',  en: 'elementary school' },
        { cn: '工作',   py: 'gōng zuò',  en: 'work / to work' },
        { cn: '公司',   py: 'gōng sī',   en: 'company' },
        { cn: '银行',   py: 'yín háng',  en: 'bank' },
        { cn: '电脑',   py: 'diàn nǎo',  en: 'computer' },
        { cn: '在',     py: 'zài',       en: 'at / in' },
        { cn: '哪里',   py: 'nǎ lǐ',     en: 'where' },
        { cn: '都',     py: 'dōu',       en: 'both / all' },
      ]},
      { kind: 'pick-cn', prompt: '"My older brother works at a bank."', en: 'My older brother works at a bank', options: [
        { cn: '我哥哥在银行工作。', py: 'wǒ gē ge zài yín háng gōng zuò' },
        { cn: '我哥哥工作在银行。', py: '—' },
        { cn: '我哥哥银行工作在。', py: '—' },
        { cn: '银行我哥哥工作。',   py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"They are both students."', en: 'They are both students', options: [
        { cn: '他们都是学生。', py: 'tā men dōu shì xué shēng' },
        { cn: '他们是都学生。', py: '—' },
        { cn: '他们学生都是。', py: '—' },
        { cn: '都他们是学生。', py: '—' },
      ], answer: 0 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My older brother works at a bank.',
        words: ['我', '哥哥', '在', '银行', '工作'], scrambled: ['工作', '银行', '哥哥', '在', '我'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Where do you work?',
        words: ['你', '在', '哪里', '工作'], scrambled: ['哪里', '工作', '你', '在'] },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '工作', py: 'gōng zuò', options: ['school','work','company','university'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '都', py: 'dōu', options: ['only','all/both','some','none'], answer: 1 },
      { kind: 'speak', prompt: 'Say it:', word: '我在银行工作', py: 'wǒ zài yín háng gōng zuò', tone: 2 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你在哪里工作？', py: 'nǐ zài nǎ lǐ gōng zuò?', en: 'Where do you work?' },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你在哪个大学念书？', py: 'nǐ zài nǎ ge dà xué niàn shū?', en: 'Which university do you study at?' },
    ],
  },
  {
    id: 'b1-c3b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch3 · The family',
    subtitle: '先生 太太 儿子 女儿 孩子',
    icon: 'people', color: 'primary',
    xp: 30, coins: 20,
    exercises: [
      { kind: 'intro', title: 'Extended family', body: '先生 = "Mr." / husband. 太太 = "Mrs." / wife. 孩子 = child (generic). 儿子/女儿 = son/daughter specifically.', cards: [
        { cn: '先生', py: 'xiān shēng', en: 'Mr. / husband' },
        { cn: '太太', py: 'tài tài',    en: 'Mrs. / wife' },
        { cn: '孩子', py: 'hái zi',     en: 'child' },
        { cn: '小孩', py: 'xiǎo hái',   en: 'kid / children' },
        { cn: '儿子', py: 'ér zi',      en: 'son' },
        { cn: '女儿', py: 'nǚ ér',      en: 'daughter' },
      ]},
      { kind: 'match-meaning', prompt: 'Who?', cn: '太太', py: 'tài tài', options: ['husband','wife','daughter','grandma'], answer: 1 },
      { kind: 'match-meaning', prompt: 'Who?', cn: '先生', py: 'xiān shēng', options: ['husband','wife','son','grandpa'], answer: 0 },
      { kind: 'match-meaning', prompt: 'Who?', cn: '儿子', py: 'ér zi', options: ['daughter','son','child','grandson'], answer: 1 },
      { kind: 'pick-cn', prompt: '"Wang\'s wife is a teacher."', en: "Wang's wife is a teacher", options: [
        { cn: '王先生的太太是老师。',   py: 'Wáng xiān shēng de tài tài shì lǎo shī' },
        { cn: '王太太的先生是老师。',   py: 'Wáng tài tài de xiān shēng shì lǎo shī' },  // valid Chinese but wrong meaning
        { cn: '王老师的太太是先生。',   py: '—' },
        { cn: '王先生太太老师是。',     py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"My son is a kid."', en: 'My son is a kid', options: [
        { cn: '我儿子是小孩。', py: 'wǒ ér zi shì xiǎo hái' },
        { cn: '我小孩儿子是。', py: '—' },
        { cn: '儿子小孩我是。', py: '—' },
        { cn: '我是儿子小孩。', py: '—' },
      ], answer: 0 },
      { kind: 'arrange', prompt: 'Arrange:', translation: "Wang's wife is a teacher.",
        words: ['王先生', '的', '太太', '是', '老师'], scrambled: ['老师', '太太', '王先生', '是', '的'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My daughter is a kid.',
        words: ['我', '女儿', '是', '小孩'], scrambled: ['小孩', '是', '我', '女儿'] },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你有几个孩子？', py: 'nǐ yǒu jǐ ge hái zi?', en: 'How many kids do you have?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'My son and daughter are both elementary school students.' },
    ],
  },

  // ─── CHAPTER 4 — 我父母在电脑公司工作 ────────────────────
  {
    id: 'b1-c4a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch4 · Parents & Jobs',
    subtitle: '爸爸 妈妈 老师 教书',
    icon: 'people', color: 'yellow',
    xp: 34, coins: 24,
    exercises: [
      { kind: 'intro', title: 'Parents & professions', body: '父母 (fùmǔ) is a more formal way to say "parents". 教书 (jiāo shū) = "teach books" = the job of teaching. Pair people with what they do.', cards: [
        { cn: '爸爸', py: 'bà ba',     en: 'dad' },
        { cn: '妈妈', py: 'mā ma',     en: 'mom' },
        { cn: '父母', py: 'fù mǔ',     en: 'parents (formal)' },
        { cn: '老师', py: 'lǎo shī',   en: 'teacher' },
        { cn: '教',   py: 'jiāo',      en: 'to teach' },
        { cn: '教书', py: 'jiāo shū',  en: 'be a teacher (lit. teach books)' },
        { cn: '说',   py: 'shuō',      en: 'to speak / say' },
        { cn: '法文', py: 'fǎ wén',    en: 'French (language)' },
        { cn: '今天', py: 'jīn tiān',  en: 'today' },
        { cn: '每天', py: 'měi tiān',  en: 'every day' },
      ]},
      { kind: 'pick-cn', prompt: '"My mom is a teacher."', en: 'My mom is a teacher', options: [
        { cn: '我妈妈是老师。',     py: 'wǒ mā ma shì lǎo shī' },
        { cn: '我妈妈在老师。',     py: '—' },
        { cn: '老师是我妈妈。',     py: 'lǎo shī shì wǒ mā ma' },   // valid but reverses focus
        { cn: '我妈妈老师是。',     py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"My parents both work at a computer company."', en: 'My parents both work at a computer company', options: [
        { cn: '我父母都在电脑公司工作。', py: 'wǒ fù mǔ dōu zài diàn nǎo gōng sī gōng zuò' },
        { cn: '我父母都电脑公司在工作。', py: '—' },
        { cn: '我父母在电脑都工作公司。', py: '—' },
        { cn: '电脑公司我父母都工作。',   py: '—' },
      ], answer: 0 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '父母', py: 'fù mǔ', options: ['mom only','dad only','parents','grandparents'], answer: 2 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '教书', py: 'jiāo shū', options: ['study','teach (job)','write','read'], answer: 1 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My mom teaches kids.',
        words: ['我', '妈妈', '教', '小孩子'], scrambled: ['小孩子', '教', '我', '妈妈'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My father is a teacher today.',
        words: ['我', '爸爸', '今天', '是', '老师'], scrambled: ['老师', '今天', '我', '是', '爸爸'] },
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '老师', answer: 'laoshi', alts: ['lǎoshī','lao shi'] },
      { kind: 'speak', prompt: 'Say it:', word: '我爸爸是老师', py: 'wǒ bà ba shì lǎo shī', tone: 2 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你爸爸妈妈做什么工作？', py: 'nǐ bà ba mā ma zuò shén me gōng zuò?', en: 'What do your parents do?' },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你妈妈在哪里工作？', py: 'nǐ mā ma zài nǎ lǐ gōng zuò?', en: 'Where does your mom work?' },
    ],
  },
  {
    id: 'b1-c4b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch4 · I\'m tired',
    subtitle: '很忙 · 很累 · 喜欢',
    icon: 'verb', color: 'red',
    xp: 32, coins: 22,
    exercises: [
      { kind: 'intro', title: '"Stative verbs" — no 是 needed', body: 'In English: "I AM tired." In Chinese: "I tired." (我累了). For permanent traits, drop 了 and add 很 (very) as a default filler: 我很忙 = "I\'m busy". Without 很 it sounds comparative.', cards: [
        { cn: '忙',     py: 'máng',    en: 'busy' },
        { cn: '累',     py: 'lèi',     en: 'tired' },
        { cn: '很',     py: 'hěn',     en: 'very / (default filler)' },
        { cn: '很忙',   py: 'hěn máng', en: 'busy (statement)' },
        { cn: '很累',   py: 'hěn lèi',  en: 'tired (statement)' },
        { cn: '不忙',   py: 'bù máng',  en: 'not busy' },
        { cn: '喜欢',   py: 'xǐ huān',  en: 'to like' },
        { cn: '小孩子', py: 'xiǎo hái zi', en: 'kids' },
      ]},
      { kind: 'pick-cn', prompt: '"My dad is busy every day."', en: 'My dad is busy every day', options: [
        { cn: '我爸爸每天很忙。', py: 'wǒ bà ba měi tiān hěn máng' },
        { cn: '我爸爸忙很每天。', py: '—' },
        { cn: '每天我爸爸是忙。', py: '—' },
        { cn: '我爸爸是每天忙。', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I\'m tired. I don\'t like working."', en: "I'm tired. I don't like working", options: [
        { cn: '我很累，不喜欢工作。', py: 'wǒ hěn lèi, bù xǐ huān gōng zuò' },
        { cn: '我累很，工作不喜欢。', py: '—' },
        { cn: '工作我不喜欢，累。',   py: '—' },
        { cn: '不喜欢我工作累。',     py: '—' },
      ], answer: 0 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '累', py: 'lèi', options: ['busy','tired','happy','sad'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '忙', py: 'máng', options: ['busy','tired','happy','sad'], answer: 0 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '喜欢', py: 'xǐ huān', options: ['hate','like','want','need'], answer: 1 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I am very tired.',
        words: ['我', '很', '累'], scrambled: ['累', '很', '我'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My dad is busy every day.',
        words: ['我', '爸爸', '每天', '很', '忙'], scrambled: ['忙', '每天', '很', '我', '爸爸'] },
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '喜欢', answer: 'xihuan', alts: ['xǐhuān','xi huan'] },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你今天累不累？', py: 'nǐ jīn tiān lèi bú lèi?', en: 'Are you tired today?' },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你喜欢工作吗？', py: 'nǐ xǐ huān gōng zuò ma?', en: 'Do you like work?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: "I am busy every day, but I'm not tired." },
    ],
  },

  // ─── CHAPTER 5 — 欢迎您 Welcome! ────────────────────────────
  {
    id: 'b1-c5a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch5 · Meeting people',
    subtitle: '朋友 认识 高兴 欢迎',
    icon: 'chat', color: 'primary',
    xp: 32, coins: 22,
    exercises: [
      { kind: 'intro', title: 'The "nice to meet you" set', body: '认识 (rènshi) = to know/recognize (people). 高兴 = happy/glad. 欢迎 = welcome.', cards: [
        { cn: '朋友',     py: 'péng yǒu',  en: 'friend' },
        { cn: '认识',     py: 'rèn shi',   en: 'to know (people)' },
        { cn: '高兴',     py: 'gāo xìng',  en: 'happy / glad' },
        { cn: '欢迎',     py: 'huān yíng', en: 'welcome' },
        { cn: '这',       py: 'zhè',       en: 'this' },
        { cn: '认识你很高兴', py: 'rèn shi nǐ hěn gāo xìng', en: 'nice to meet you' },
        { cn: '我也是',   py: 'wǒ yě shì', en: 'me too' },
      ]},
      { kind: 'dialogue-complete',
        prompt: 'You\'re being introduced. They say:',
        en: '(reply to "nice to meet you")',
        context: [
          { speaker: '友', cn: '认识你很高兴。', py: 'rèn shi nǐ hěn gāo xìng', en: 'Nice to meet you.' },
        ],
        options: [
          { cn: '我也很高兴认识你。', py: 'wǒ yě hěn gāo xìng rèn shi nǐ' },
          { cn: '我不认识你。',       py: 'wǒ bú rèn shi nǐ' },
          { cn: '我很累。',           py: 'wǒ hěn lèi' },
          { cn: '我是台湾人。',       py: 'wǒ shì tái wān rén' },
        ],
        answer: 0,
      },
      { kind: 'pick-cn', prompt: '"This is my friend Mingwen."', en: 'This is my friend Mingwen', options: [
        { cn: '这是我朋友明文。',   py: 'zhè shì wǒ péng yǒu Míngwén' },
        { cn: '这我朋友是明文。',   py: '—' },
        { cn: '我朋友是这明文。',   py: '—' },
        { cn: '明文我是朋友这。',   py: '—' },
      ], answer: 0 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '认识', py: 'rèn shi', options: ['to like','to know (a person)','to want','to greet'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '高兴', py: 'gāo xìng', options: ['busy','tired','happy/glad','sad'], answer: 2 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Nice to meet you.',
        words: ['认识', '你', '很', '高兴'], scrambled: ['高兴', '认识', '很', '你'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'This is my friend Mingwen.',
        words: ['这', '是', '我', '朋友', '明文'], scrambled: ['朋友', '明文', '这', '我', '是'] },
      { kind: 'speak', prompt: 'Say it:', word: '认识你很高兴', py: 'rèn shi nǐ hěn gāo xìng', tone: 2 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '欢迎你！你叫什么名字？', py: 'huān yíng nǐ! nǐ jiào shén me míng zi?', en: 'Welcome! What is your name?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'Welcome! This is my older brother. Nice to meet you.' },
    ],
  },
  {
    id: 'b1-c5b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch5 · Want to go play',
    subtitle: '想去 · 玩 · 国家公园',
    icon: 'verb', color: 'yellow',
    xp: 30, coins: 20,
    exercises: [
      { kind: 'intro', title: 'Plans & wishes', body: '想 (xiǎng) + verb = "want to ___". 玩 (wán) is "play / hang out" — used for vacation activities even by adults. 放假 = on break/vacation.', cards: [
        { cn: '想',         py: 'xiǎng',      en: 'want to' },
        { cn: '去',         py: 'qù',         en: 'to go' },
        { cn: '玩',         py: 'wán',        en: 'play / have fun' },
        { cn: '来',         py: 'lái',        en: 'to come' },
        { cn: '放假',       py: 'fàng jià',   en: 'on vacation' },
        { cn: '现在',       py: 'xiàn zài',   en: 'now' },
        { cn: '平常',       py: 'píng cháng', en: 'usually' },
        { cn: '住在',       py: 'zhù zài',    en: 'live at/in' },
        { cn: '学校',       py: 'xué xiào',   en: 'school' },
        { cn: '国家公园',   py: 'guó jiā gōng yuán', en: 'national park' },
      ]},
      { kind: 'pick-cn', prompt: '"Where do you want to go to play?"', en: 'Where do you want to go to play?', options: [
        { cn: '你想去哪里玩？', py: 'nǐ xiǎng qù nǎ lǐ wán?' },
        { cn: '你哪里去想玩？', py: '—' },
        { cn: '你玩想哪里去？', py: '—' },
        { cn: '你去玩哪里想？', py: '—' },
      ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '现在学校放假，你想去哪里玩？', py: 'xiàn zài xué xiào fàng jià, nǐ xiǎng qù nǎ lǐ wán?', en: 'School is on break. Where do you want to go?' },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '放假', py: 'fàng jià', options: ['attend class','work','vacation','exam'], answer: 2 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '想', py: 'xiǎng', options: ['must','want to','will','can'], answer: 1 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I want to go to the national park.',
        words: ['我', '想', '去', '国家公园'], scrambled: ['国家公园', '去', '想', '我'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I usually live in Taiwan.',
        words: ['我', '平常', '住在', '台湾'], scrambled: ['台湾', '住在', '平常', '我'] },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你想去哪个国家玩？', py: 'nǐ xiǎng qù nǎ ge guó jiā wán?', en: 'Which country do you want to visit?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'I usually live in Taiwan. Now I came to America to play.' },
      { kind: 'ai-translate', prompt: 'Translate:', en: "I'm on vacation now. I want to go to Disneyland." },
    ],
  },

  // ─── CHAPTER 6 — 你平常喜欢做什么 What Do You Like to Do ───
  {
    id: 'b1-c6a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch6 · Hobbies & sports',
    subtitle: '运动 · 打网球 · 听音乐',
    icon: 'star', color: 'cyan',
    xp: 36, coins: 26,
    exercises: [
      { kind: 'intro', title: 'Verb + activity', body: '打 (dǎ) "hit" goes with ball sports (tennis, basketball). 踢 (tī) "kick" only with soccer. 听 (tīng) "listen" with music. 看 (kàn) "look" with TV/movies/books.', cards: [
        { cn: '运动',     py: 'yùn dòng',  en: 'exercise / sports' },
        { cn: '做',       py: 'zuò',       en: 'to do' },
        { cn: '打网球',   py: 'dǎ wǎng qiú', en: 'play tennis' },
        { cn: '听音乐',   py: 'tīng yīn yuè', en: 'listen to music' },
        { cn: '看电视',   py: 'kàn diàn shì', en: 'watch TV' },
        { cn: '周末',     py: 'zhōu mò',   en: 'weekend' },
        { cn: '晚上',     py: 'wǎn shàng', en: 'night / in the evening' },
        { cn: '家',       py: 'jiā',       en: 'home / family' },
        { cn: '常常',     py: 'cháng cháng', en: 'often' },
      ]},
      { kind: 'pick-cn', prompt: '"I like to play tennis on weekends."', en: 'I like to play tennis on weekends', options: [
        { cn: '我周末喜欢打网球。', py: 'wǒ zhōu mò xǐ huān dǎ wǎng qiú' },
        { cn: '我喜欢周末打网球。', py: 'wǒ xǐ huān zhōu mò dǎ wǎng qiú' },  // also valid in casual speech
        { cn: '我周末打网球喜欢。', py: '—' },
        { cn: '网球周末我打喜欢。', py: '—' },
      ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你周末喜欢做什么？', py: 'nǐ zhōu mò xǐ huān zuò shén me?', en: 'What do you like to do on the weekend?' },
      { kind: 'match-meaning', prompt: 'What is 听音乐?', cn: '听音乐', py: 'tīng yīn yuè',
        options: ['watch TV','listen to music','play music','make music'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What is 周末?', cn: '周末', py: 'zhōu mò',
        options: ['weekday','weekend','this week','next week'], answer: 1 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I like to play tennis on weekends.',
        words: ['我', '周末', '喜欢', '打', '网球'], scrambled: ['网球', '打', '周末', '我', '喜欢'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I often watch TV at night.',
        words: ['我', '晚上', '常常', '看', '电视'], scrambled: ['电视', '看', '常常', '晚上', '我'] },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你晚上喜欢做什么？', py: 'nǐ wǎn shàng xǐ huān zuò shén me?', en: 'What do you like to do at night?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'On weekends I like swimming and listening to music.' },
    ],
  },
  {
    id: 'b1-c6b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch6 · And / But / Also',
    subtitle: '和 · 可是 · 还',
    icon: 'qm', color: 'primary',
    xp: 30, coins: 20,
    exercises: [
      { kind: 'intro', title: 'Three glue words', body: '和 (hàn / hé) joins NOUNS only (我和你 = me and you). 可是 (kě shì) = but. 还 (hái) = also/in addition (more verbs/items).', cards: [
        { cn: '和',     py: 'hàn / hé', en: 'and (nouns)' },
        { cn: '可是',   py: 'kě shì',   en: 'but' },
        { cn: '还',     py: 'hái',      en: 'also / still / additionally' },
        { cn: '哥哥和弟弟', py: 'gē ge hàn dì di', en: 'older brother AND younger brother' },
        { cn: '我喜欢，可是…', py: 'wǒ xǐ huān, kě shì…', en: 'I like it, but…' },
        { cn: '还想去日本',  py: 'hái xiǎng qù rì běn', en: 'also want to go to Japan' },
      ]},
      { kind: 'pick-cn', prompt: '"I like tennis, but I don\'t like soccer."', en: "I like tennis, but I don't like soccer", options: [
        { cn: '我喜欢网球，可是不喜欢足球。', py: 'wǒ xǐ huān wǎng qiú, kě shì bù xǐ huān zú qiú' },
        { cn: '我喜欢网球和不喜欢足球。',     py: '—' },
        { cn: '我和网球，可是足球。',         py: '—' },
        { cn: '可是我喜欢网球还足球。',       py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I want to go to France, and I also want to go to Japan."', en: 'I want to go to France, and also Japan', options: [
        { cn: '我想去法国，还想去日本。', py: 'wǒ xiǎng qù fǎ guó, hái xiǎng qù rì běn' },
        { cn: '我想去法国和日本想去。',   py: '—' },
        { cn: '法国还日本我想去。',       py: '—' },
        { cn: '我和法国想去日本。',       py: '—' },
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'I like watching TV at night, but I don\'t like playing tennis.' },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '可是', py: 'kě shì', options: ['and','but','also','because'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '还是', py: 'hái shì', options: ['and','or (in question)','still','also'], answer: 1 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I like dogs and cats too.',
        words: ['我', '喜欢', '狗', '还', '喜欢', '猫'], scrambled: ['狗', '猫', '还', '我', '喜欢', '喜欢'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Do you want tea or coffee?',
        words: ['你', '想', '喝', '茶', '还是', '咖啡'], scrambled: ['茶', '咖啡', '想', '还是', '喝', '你'] },
      { kind: 'ai-respond', prompt: 'Reply (using 但是):', cn: '你喜欢运动吗？', py: 'nǐ xǐ huān yùn dòng ma?', en: 'Do you like sports?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'I have a younger brother and an older sister too.' },
    ],
  },

  // ─── CHAPTER 7 — 我可以问哪位 May I Ask Who This Is ──────
  {
    id: 'b1-c7a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch7 · On the phone',
    subtitle: '喂 · 哪位 · 给…电话',
    icon: 'chat', color: 'yellow',
    xp: 34, coins: 24,
    exercises: [
      { kind: 'intro', title: 'Picking up a call in Chinese', body: '喂 (wéi) — only used on the phone, like English "hello?". 哪位 (nǎ wèi) — "which person?" but polite — "who\'s calling?". 麻烦 (má fán) = "trouble" — use as a polite prefix.', cards: [
        { cn: '喂',         py: 'wéi',       en: 'hello? (phone only)' },
        { cn: '哪位',       py: 'nǎ wèi',    en: 'who\'s speaking? (polite)' },
        { cn: '位',         py: 'wèi',       en: 'polite measure word for people' },
        { cn: '小姐',       py: 'xiǎo jiě',  en: 'Ms. / Miss' },
        { cn: '办公室',     py: 'bàn gōng shì', en: 'office' },
        { cn: '回来',       py: 'huí lái',   en: 'come back' },
        { cn: '下午',       py: 'xià wǔ',    en: 'afternoon' },
        { cn: '以后',       py: 'yǐ hòu',    en: 'after / later' },
        { cn: '给',         py: 'gěi',       en: 'give / to (someone)' },
        { cn: '电话',       py: 'diàn huà',  en: 'phone' },
        { cn: '麻烦',       py: 'má fán',    en: 'trouble / "if it\'s not too much trouble"' },
      ]},
      { kind: 'dialogue-complete',
        prompt: 'The phone rings. You pick up:',
        en: '(phone greeting)',
        context: [
          { speaker: '☎', cn: '（电话响）', py: '(diàn huà xiǎng)', en: '(phone rings)' },
        ],
        options: [
          { cn: '喂，您好。', py: 'wéi, nín hǎo' },
          { cn: '再见。',     py: 'zài jiàn' },
          { cn: '我累了。',   py: 'wǒ lèi le' },
          { cn: '请坐。',     py: 'qǐng zuò' },
        ],
        answer: 0,
      },
      { kind: 'dialogue-complete',
        prompt: 'A stranger calls. They didn\'t say who they are. Ask politely:',
        en: '(ask who is calling)',
        context: [
          { speaker: '☎', cn: '喂，您好，请问王先生在吗？', py: 'wéi, nín hǎo, qǐng wèn Wáng xiān sheng zài ma?', en: 'Hello, may I ask, is Mr. Wang there?' },
        ],
        options: [
          { cn: '请问您是哪位？',   py: 'qǐng wèn nín shì nǎ wèi?' },
          { cn: '你是谁？',         py: 'nǐ shì shéi?' },   // too casual / rude on phone
          { cn: '王先生在哪里？',   py: 'Wáng xiān sheng zài nǎ lǐ?' },
          { cn: '请你回来。',       py: 'qǐng nǐ huí lái' },
        ],
        answer: 0,
      },
      { kind: 'pick-cn', prompt: '"Could you call me later?"', en: 'Could you call me later?', options: [
        { cn: '麻烦您以后给我电话。', py: 'má fán nín yǐ hòu gěi wǒ diàn huà' },
        { cn: '请你电话给以后。',     py: '—' },
        { cn: '电话麻烦你给我。',     py: '—' },
        { cn: '我以后给你电话。',     py: 'wǒ yǐ hòu gěi nǐ diàn huà' },  // valid but different speaker
      ], answer: 0 },
      // Split into two shorter translates — the original combined sentence was too jumpy.
      // Pro tip for learners: tap 🎧 HEAR IN CHINESE if you're stuck.
      { kind: 'ai-translate', prompt: 'Translate:', en: 'Hello, is Ms. Lin there?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'I will call back this afternoon.' },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '喂', py: 'wéi', options: ['hello (in person)','hello (phone)','goodbye','feed'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '哪位', py: 'nǎ wèi', options: ['where?','who? (polite)','what?','when?'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '麻烦', py: 'má fán', options: ['easy','trouble (polite)','important','quick'], answer: 1 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Hello, may I ask, who is calling?',
        words: ['喂', '您好', '请问', '您', '是', '哪位'], scrambled: ['请问', '哪位', '您', '是', '喂', '您好'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Ms. Lin will be back this afternoon.',
        words: ['林', '小姐', '下午', '回来'], scrambled: ['回来', '下午', '林', '小姐'] },
      { kind: 'speak', prompt: 'Say it:', word: '请问您是哪位', py: 'qǐng wèn nín shì nǎ wèi', tone: 3 },
      { kind: 'ai-respond', prompt: 'Reply (you answer the phone):', cn: '请问王先生在吗？', py: 'qǐng wèn Wáng xiān sheng zài ma?', en: 'May I ask, is Mr. Wang there?' },
    ],
  },

  // ─── CHAPTER 8 — 祝你生日快乐 Happy Birthday ────────────────
  {
    id: 'b1-c8a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch8 · Dates & Months',
    subtitle: 'N月N号 · 几月几号',
    icon: 'num', color: 'cyan',
    xp: 34, coins: 24,
    exercises: [
      { kind: 'intro', title: 'Dates the easy way', body: 'NUMBER + 月 = month, NUMBER + 号 = day. 一月一号 = January 1st. To ask "what date?", use 几月几号 (jǐ yuè jǐ hào).', cards: [
        { cn: '月',     py: 'yuè',       en: 'month' },
        { cn: '号',     py: 'hào',       en: 'day of the month' },
        { cn: '生日',   py: 'shēng rì',  en: 'birthday' },
        { cn: '快乐',   py: 'kuài lè',   en: 'happy' },
        { cn: '祝',     py: 'zhù',       en: 'to wish' },
        { cn: '岁',     py: 'suì',       en: 'year of age' },
        { cn: '明天',   py: 'míng tiān', en: 'tomorrow' },
        { cn: '一月一号', py: 'yī yuè yī hào', en: 'January 1' },
        { cn: '十二月二十五号', py: 'shí èr yuè èr shí wǔ hào', en: 'December 25' },
      ]},
      { kind: 'pick-cn', prompt: '"What is the date today?"', en: 'What is the date today?', options: [
        { cn: '今天几月几号？', py: 'jīn tiān jǐ yuè jǐ hào?' },
        { cn: '今天是星期几？', py: 'jīn tiān shì xīng qī jǐ?' },
        { cn: '今天几个月几？', py: '—' },
        { cn: '号月几月今天？', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"My birthday is October 5."', en: 'My birthday is October 5', options: [
        { cn: '我的生日是十月五号。', py: 'wǒ de shēng rì shì shí yuè wǔ hào' },
        { cn: '我十月五号是生日。',   py: '—' },
        { cn: '生日十月五号是我的。', py: '—' },
        { cn: '五号十月我生日。',     py: '—' },
      ], answer: 0 },
      { kind: 'type-pinyin', prompt: 'Type the pinyin:', cn: '生日快乐', answer: 'shengrikuaile', alts: ['shēngrìkuàilè','sheng ri kuai le'] },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '岁', py: 'suì', options: ['month','day','years old','year'], answer: 2 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '号', py: 'hào', options: ['month','day of month','time','phone number'], answer: 1 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My birthday is October 5.',
        words: ['我的', '生日', '是', '十月', '五号'], scrambled: ['五号', '十月', '生日', '是', '我的'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Today is December 25.',
        words: ['今天', '是', '十二月', '二十五号'], scrambled: ['十二月', '二十五号', '是', '今天'] },
      { kind: 'speak', prompt: 'Say it:', word: '生日快乐', py: 'shēng rì kuài lè', tone: 0 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你的生日是几月几号？', py: 'nǐ de shēng rì shì jǐ yuè jǐ hào?', en: 'When is your birthday?' },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '今天几月几号？', py: 'jīn tiān jǐ yuè jǐ hào?', en: 'What date is today?' },
    ],
  },
  {
    id: 'b1-c8b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch8 · Invitations & gifts',
    subtitle: '请…吃大餐 · 没问题',
    icon: 'food', color: 'red',
    xp: 36, coins: 26,
    exercises: [
      { kind: 'intro', title: '"I\'m treating you"', body: '请 (qǐng) as a verb = "to invite / to treat". 请我吃 = "treat me to eat". 没问题 = "no problem". 礼物 = gift.', cards: [
        { cn: '请',       py: 'qǐng',     en: 'invite / treat (as verb)' },
        { cn: '吃',       py: 'chī',      en: 'eat' },
        { cn: '大餐',     py: 'dà cān',   en: 'big meal' },
        { cn: '好不好',   py: 'hǎo bù hǎo', en: 'OK? (suggestion)' },
        { cn: '没问题',   py: 'méi wèn tí', en: 'no problem' },
        { cn: '要',       py: 'yào',      en: 'to want / need' },
        { cn: '礼物',     py: 'lǐ wù',    en: 'gift' },
        { cn: '一双',     py: 'yì shuāng', en: 'a pair of' },
      ]},
      { kind: 'dialogue-complete',
        prompt: 'You\'re asking your brother out. What\'s the natural reply?',
        en: '(reply to invitation)',
        context: [
          { speaker: '你', cn: '明天我请你去吃大餐，好不好？', py: 'míng tiān wǒ qǐng nǐ qù chī dà cān, hǎo bù hǎo?', en: "Tomorrow I'll treat you to a big meal, OK?" },
        ],
        options: [
          { cn: '好，没问题。谢谢！', py: 'hǎo, méi wèn tí. xiè xie!' },
          { cn: '我累了。',           py: 'wǒ lèi le' },
          { cn: '不认识你。',         py: 'bú rèn shi nǐ' },
          { cn: '我不是。',           py: 'wǒ bú shì' },
        ],
        answer: 0,
      },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'Happy birthday! I want to give you a gift.' },
      { kind: 'arrange', prompt: 'Arrange:', translation: "Tomorrow I'll treat you to a big meal.",
        words: ['明天', '我', '请', '你', '吃', '大餐'], scrambled: ['吃', '大餐', '请', '明天', '我', '你'] },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '没问题', py: 'méi wèn tí', options: ['big problem','no problem','no time','no idea'], answer: 1 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '明天是我的生日，请你吃饭，好不好？', py: 'míng tiān shì wǒ de shēng rì, qǐng nǐ chī fàn, hǎo bù hǎo?', en: 'Tomorrow is my birthday, want to grab dinner?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'My older brother wants a gift for his birthday.' },
    ],
  },

  // ─── CHAPTER 9 — 你星期五有空吗 Are You Free on Friday ────
  {
    id: 'b1-c9a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch9 · Clock time',
    subtitle: 'N点N分 · 半 · 一刻',
    icon: 'num', color: 'primary',
    xp: 34, coins: 24,
    exercises: [
      { kind: 'intro', title: 'Telling time', body: '点 (diǎn) = "o\'clock". 半 (bàn) = half (so 六点半 = 6:30). 一刻 (yí kè) = quarter-hour. 现在几点 = "what time is it now?"', cards: [
        { cn: '点',       py: 'diǎn',     en: "o'clock" },
        { cn: '半',       py: 'bàn',      en: 'half' },
        { cn: '分',       py: 'fēn',      en: 'minute' },
        { cn: '一刻',     py: 'yí kè',    en: 'a quarter (15 min)' },
        { cn: '六点',     py: 'liù diǎn', en: '6:00' },
        { cn: '六点半',   py: 'liù diǎn bàn', en: '6:30' },
        { cn: '现在几点', py: 'xiàn zài jǐ diǎn', en: 'what time is it?' },
      ]},
      { kind: 'pick-cn', prompt: '"What time is it now?"', en: 'What time is it now?', options: [
        { cn: '现在几点？',   py: 'xiàn zài jǐ diǎn?' },
        { cn: '几点现在是？', py: '—' },
        { cn: '现在几号？',   py: 'xiàn zài jǐ hào?' },  // wrong, asks for day not time
        { cn: '现在是分？',   py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"It is 6:30 now."', en: 'It is 6:30 now', options: [
        { cn: '现在是六点半。', py: 'xiàn zài shì liù diǎn bàn' },
        { cn: '现在六半点。',   py: '—' },
        { cn: '半六点现在。',   py: '—' },
        { cn: '六点是半现在。', py: '—' },
      ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '请问现在几点？', py: 'qǐng wèn xiàn zài jǐ diǎn?', en: 'May I ask, what time is it?' },
      { kind: 'arrange', prompt: 'Arrange:', translation: "It is 6:30 now.",
        words: ['现在', '是', '六点', '半'], scrambled: ['半', '现在', '六点', '是'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: "What time is it now?",
        words: ['现在', '几', '点'], scrambled: ['几', '点', '现在'] },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '半', py: 'bàn', options: ['quarter','half','whole','full'], answer: 1 },
      { kind: 'speak', prompt: 'Say it:', word: '现在七点半', py: 'xiàn zài qī diǎn bàn', tone: 3 },
      { kind: 'ai-translate', prompt: 'Translate:', en: "It's 9:30 in the morning now." },
    ],
  },
  {
    id: 'b1-c9b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch9 · Asking someone out',
    subtitle: '有空吗? · 跟…一起',
    icon: 'chat', color: 'cyan',
    xp: 36, coins: 26,
    exercises: [
      { kind: 'intro', title: 'Making plans', body: '有空 (yǒu kòng) = "have free time". 跟…一起 (gēn … yī qǐ) = "together with…". The shape: 你 + 时间 + 有空吗? 跟我一起 + 动词 + 好吗?', cards: [
        { cn: '有空',       py: 'yǒu kòng',  en: 'have free time' },
        { cn: '时间',       py: 'shí jiān',  en: 'time' },
        { cn: '同事',       py: 'tóng shì',  en: 'coworker' },
        { cn: '餐厅',       py: 'cān tīng',  en: 'restaurant' },
        { cn: '跟',         py: 'gēn',       en: 'with / and' },
        { cn: '一起',       py: 'yì qǐ',     en: 'together' },
        { cn: '行',         py: 'xíng',      en: 'ok / works' },
        { cn: '下课',       py: 'xià kè',    en: 'class ends' },
        { cn: '星期五',     py: 'xīng qī wǔ', en: 'Friday' },
        { cn: '星期六',     py: 'xīng qī liù', en: 'Saturday' },
      ]},
      { kind: 'pick-cn', prompt: '"Are you free on Friday?"', en: 'Are you free on Friday?', options: [
        { cn: '你星期五有空吗？', py: 'nǐ xīng qī wǔ yǒu kòng ma?' },
        { cn: '你有空星期五吗？', py: '—' },
        { cn: '星期五你空吗？',   py: '—' },
        { cn: '你星期五吗有空？', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"Have dinner with me, OK?"', en: 'Have dinner with me, OK?', options: [
        { cn: '跟我一起吃饭，好吗？', py: 'gēn wǒ yì qǐ chī fàn, hǎo ma?' },
        { cn: '我跟一起你吃饭好吗？', py: '—' },
        { cn: '你一起跟我吃，好吗？', py: '—' },
        { cn: '一起我跟好饭？',       py: '—' },
      ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你星期五下课以后有空吗？跟我一起去吃饭，好吗？', py: 'nǐ xīng qī wǔ xià kè yǐ hòu yǒu kòng ma? gēn wǒ yì qǐ qù chī fàn, hǎo ma?', en: 'Are you free after class on Friday? Have dinner with me?' },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Are you free on Friday?',
        words: ['你', '星期五', '有空', '吗'], scrambled: ['有空', '吗', '星期五', '你'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Eat with me, OK?',
        words: ['跟', '我', '一起', '吃饭', '好吗'], scrambled: ['好吗', '吃饭', '一起', '跟', '我'] },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '有空', py: 'yǒu kòng', options: ['have time / be free','have money','have plans','have work'], answer: 0 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '一起', py: 'yì qǐ', options: ['alone','together','first','again'], answer: 1 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '星期六晚上你有空吗？', py: 'xīng qī liù wǎn shàng nǐ yǒu kòng ma?', en: 'Are you free Saturday night?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'Want to have lunch together on Friday?' },
    ],
  },

  // ─── CHAPTER 10 — 学中文难不难 Is It Hard to Learn Mandarin ─
  {
    id: 'b1-c10a',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch10 · Studying Chinese',
    subtitle: '学华语 · 难 · 容易',
    icon: 'star', color: 'primary',
    xp: 36, coins: 26,
    exercises: [
      { kind: 'intro', title: 'The "A-not-A" question', body: '难不难? = "hard or not hard?". This is a polite, neutral way to ask any yes/no question without 吗. Works with any 1-syllable adjective: 好不好? 累不累? 忙不忙?', cards: [
        { cn: '学',         py: 'xué',        en: 'to learn' },
        { cn: '华语',       py: 'huá yǔ',     en: 'Mandarin (Taiwanese term)' },
        { cn: '中文',       py: 'zhōng wén',  en: 'Chinese (language)' },
        { cn: '难',         py: 'nán',        en: 'hard / difficult' },
        { cn: '容易',       py: 'róng yì',    en: 'easy' },
        { cn: '难不难',     py: 'nán bù nán', en: 'is it hard?' },
        { cn: '觉得',       py: 'jué de',     en: 'to think / feel' },
        { cn: '自己',       py: 'zì jǐ',      en: 'self / oneself' },
      ]},
      { kind: 'pick-cn', prompt: '"Is Chinese hard?"', en: 'Is Chinese hard?', options: [
        { cn: '中文难不难？', py: 'zhōng wén nán bù nán?' },
        { cn: '中文难吗？',   py: 'zhōng wén nán ma?' },     // also valid, more casual
        { cn: '难不中文难？', py: '—' },
        { cn: '中文不难难？', py: '—' },
      ], answer: 0 },
      { kind: 'pick-cn', prompt: '"I think Chinese is not hard."', en: "I think Chinese isn't hard", options: [
        { cn: '我觉得中文不难。', py: 'wǒ jué de zhōng wén bù nán' },
        { cn: '我中文觉得不难。', py: '—' },
        { cn: '中文我不难觉得。', py: '—' },
        { cn: '不我觉得中文难。', py: '—' },
      ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply honestly:', cn: '你觉得中文难不难？', py: 'nǐ jué de zhōng wén nán bú nán?', en: 'Do you think Chinese is hard?' },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I think Chinese is not hard.',
        words: ['我', '觉得', '中文', '不', '难'], scrambled: ['难', '不', '中文', '觉得', '我'] },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Is Chinese hard?',
        words: ['中文', '难', '不', '难'], scrambled: ['难', '难', '不', '中文'] },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '觉得', py: 'jué de', options: ['know','think / feel','want','have'], answer: 1 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '自己', py: 'zì jǐ', options: ['friend','self','family','myself only (formal)'], answer: 1 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你常常练习说中文吗？', py: 'nǐ cháng cháng liàn xí shuō zhōng wén ma?', en: 'Do you often practice speaking Chinese?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'I think English is hard, but Chinese is harder.' },
    ],
  },
  {
    id: 'b1-c10b',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch10 · Take a break',
    subtitle: '休息一下 · 喝杯咖啡',
    icon: 'food', color: 'yellow',
    xp: 32, coins: 22,
    exercises: [
      { kind: 'intro', title: '"…一下" = "do it for a bit"', body: 'Stick 一下 after a verb to soften it — 休息一下 = "rest for a bit". 看一下 = "have a look". Sounds friendlier than the bare verb.', cards: [
        { cn: '休息',     py: 'xiū xí',   en: 'to rest / take a break' },
        { cn: '休息一下', py: 'xiū xí yī xià', en: 'take a (little) break' },
        { cn: '一下',     py: 'yī xià',   en: 'for a moment / briefly' },
        { cn: '喝',       py: 'hē',       en: 'to drink' },
        { cn: '杯',       py: 'bēi',      en: 'cup / glass (measure)' },
        { cn: '一杯',     py: 'yī bēi',   en: 'one cup' },
        { cn: '咖啡',     py: 'kā fēi',   en: 'coffee' },
        { cn: '吧',       py: 'ba',       en: '(soft suggestion particle)' },
      ]},
      { kind: 'pick-cn', prompt: '"Let\'s take a break and have a cup of coffee."', en: "Let's take a break and have a coffee", options: [
        { cn: '我们休息一下，喝杯咖啡吧。', py: 'wǒ men xiū xí yī xià, hē bēi kā fēi ba' },
        { cn: '我们咖啡杯休息一下。',         py: '—' },
        { cn: '一下咖啡喝休息我们吧。',       py: '—' },
        { cn: '休息一下喝咖啡吗？',           py: 'xiū xí yī xià hē kā fēi ma?' },  // valid but a question, not a suggestion
      ], answer: 0 },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'I\'m tired. Let me rest for a bit and drink a cup of water.' },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '我们休息一下，去喝杯咖啡，好吗？', py: 'wǒ men xiū xí yī xià, qù hē bēi kā fēi, hǎo ma?', en: "Let's take a break and go for a coffee, OK?" },
      { kind: 'arrange', prompt: 'Arrange:', translation: "Let's drink a cup of coffee.",
        words: ['我们', '喝', '一杯', '咖啡', '吧'], scrambled: ['咖啡', '一杯', '吧', '喝', '我们'] },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '一下', py: 'yí xià', options: ['for a bit / briefly','once','first','again'], answer: 0 },
      { kind: 'match-meaning', prompt: 'What does it mean?', cn: '休息', py: 'xiū xí', options: ['work','take a break','sleep','exercise'], answer: 1 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你想喝什么？茶还是咖啡？', py: 'nǐ xiǎng hē shén me? chá hái shì kā fēi?', en: 'What do you want to drink? Tea or coffee?' },
      { kind: 'ai-translate', prompt: 'Translate:', en: "I'm tired. Let's take a break and drink some water." },
    ],
  },

  // ─── BOOK 1 DIALOGUE PRACTICE — one per chapter ─────────────
  {
    id: 'b1-c1-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch1 · Full intro dialogue',
    subtitle: 'put it all together',
    icon: 'chat', color: 'cyan',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'A stranger greets you politely. Reply:',
        en: '(reply)',
        context: [{ speaker: '她', cn: '您好！请问您贵姓？', py: 'nín hǎo! qǐng wèn nín guì xìng?', en: 'Hello! May I ask your surname?' }],
        options: [
          { cn: '您好，我姓Wang。',   py: 'nín hǎo, wǒ xìng Wang' },
          { cn: '您贵姓？',           py: 'nín guì xìng?' },
          { cn: '我累了。',           py: 'wǒ lèi le' },
          { cn: '再见。',             py: 'zài jiàn' },
        ], answer: 0 },
      { kind: 'dialogue-complete',
        prompt: 'They ask for your name. Reply:',
        en: '(reply)',
        context: [
          { speaker: '她', cn: '您好，我姓Wang。', py: 'nín hǎo, wǒ xìng Wang', en: '…' },
          { speaker: '她', cn: '您叫什么名字？',    py: 'nín jiào shén me míng zi?', en: 'What is your given name?' },
        ],
        options: [
          { cn: '我叫…（你的名字）。', py: 'wǒ jiào … (your name)' },
          { cn: '我是…叫的。',         py: '—' },
          { cn: '我姓什么名字。',     py: '—' },
          { cn: '我是中国人。',       py: 'wǒ shì zhōng guó rén' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'They ask your nationality. Reply:',
        cn: '请问您是哪国人？', py: 'qǐng wèn nín shì nǎ guó rén?', en: 'May I ask your nationality?' },
      { kind: 'ai-respond', prompt: 'Bounce the question back politely:',
        cn: '我是美国人。您呢？', py: 'wǒ shì měi guó rén. nín ne?', en: "I'm American. How about you?" },
      { kind: 'dialogue-complete',
        prompt: 'You say goodbye. Pick a polite reply.',
        en: '(reply to goodbye)',
        context: [
          { speaker: '她', cn: '认识你很高兴。再见！', py: 'rèn shi nǐ hěn gāo xìng. zài jiàn!', en: 'Nice to meet you. Goodbye!' },
        ],
        options: [
          { cn: '我也很高兴，再见！', py: 'wǒ yě hěn gāo xìng, zài jiàn' },
          { cn: '我不认识你。',       py: 'wǒ bú rèn shi nǐ' },
          { cn: '我是台湾人。',       py: 'wǒ shì tái wān rén' },
          { cn: '请坐。',             py: 'qǐng zuò' },
        ], answer: 0 },
      { kind: 'arrange', prompt: 'Arrange:', translation: "I'm American. And you?",
        words: ['我', '是', '美国人', '您呢'], scrambled: ['您呢', '美国人', '是', '我'] },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'Hello! My surname is Lee, my given name is Anton. Nice to meet you.' },
    ],
  },
  {
    id: 'b1-c2-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch2 · Talk about siblings',
    subtitle: 'use 有 · 没 · 只 · 也',
    icon: 'people', color: 'primary',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'A friend asks about your family. Pick a natural reply:',
        en: '(reply)',
        context: [{ speaker: '友', cn: '你有兄弟姐妹吗？', py: 'nǐ yǒu xiōng dì jiě mèi ma?', en: 'Do you have siblings?' }],
        options: [
          { cn: '有，我有两个哥哥。', py: 'yǒu, wǒ yǒu liǎng ge gē ge' },
          { cn: '没有兄弟姐妹有。',   py: '—' },
          { cn: '我两个哥哥有。',     py: '—' },
          { cn: '我兄弟姐妹有两个吗？', py: '—' },
        ], answer: 0 },
      { kind: 'dialogue-complete',
        prompt: 'They follow up:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '你有姐姐吗？', py: 'nǐ yǒu jiě jie ma?', en: 'Do you have an older sister?' },
        ],
        options: [
          { cn: '没有，我只有哥哥。',     py: 'méi yǒu, wǒ zhǐ yǒu gē ge' },
          { cn: '我也没有哥哥。',         py: 'wǒ yě méi yǒu gē ge' },
          { cn: '是，我哥哥是姐姐。',     py: '—' },
          { cn: '我有，姐姐没有。',       py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Describe your siblings:',
        cn: '你家有几个人？', py: 'nǐ jiā yǒu jǐ ge rén?', en: 'How many people in your family?' },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '我有一个弟弟，你呢？', py: 'wǒ yǒu yí ge dì di, nǐ ne?', en: 'I have one younger brother. And you?' },
      { kind: 'dialogue-complete',
        prompt: 'They ask about your sister specifically:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '你妹妹也是学生吗？', py: 'nǐ mèi mei yě shì xué shēng ma?', en: 'Is your younger sister also a student?' },
        ],
        options: [
          { cn: '是的，她也是学生。',     py: 'shì de, tā yě shì xué shēng' },
          { cn: '她妹妹是学生也。',       py: '—' },
          { cn: '不学生她妹妹。',         py: '—' },
          { cn: '是，他是学生。',         py: 'shì, tā shì xué shēng' },   // valid but wrong gender — distractor
        ], answer: 0 },
      { kind: 'arrange', prompt: 'Arrange:', translation: "I also have an older sister.",
        words: ['我', '也', '有', '一个', '姐姐'], scrambled: ['姐姐', '有', '一个', '也', '我'] },
      { kind: 'ai-translate', prompt: 'Translate:', en: 'I have two younger sisters but no older brothers.' },
    ],
  },
  {
    id: 'b1-c3-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch3 · Talk about work',
    subtitle: '在哪里 · 都是 · 也在',
    icon: 'verb', color: 'yellow',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'They ask where you work. Reply:',
        en: '(reply)',
        context: [{ speaker: '友', cn: '你在哪里工作？', py: 'nǐ zài nǎ lǐ gōng zuò?', en: 'Where do you work?' }],
        options: [
          { cn: '我在电脑公司工作。', py: 'wǒ zài diàn nǎo gōng sī gōng zuò' },
          { cn: '我电脑公司在工作。', py: '—' },
          { cn: '我工作公司电脑。',   py: '—' },
          { cn: '我在工作电脑公司。', py: '—' },
        ], answer: 0 },
      { kind: 'dialogue-complete',
        prompt: 'They ask about your husband. Reply:',
        en: '(reply)',
        context: [{ speaker: '友', cn: '你先生呢？他也在电脑公司工作吗？', py: 'nǐ xiān sheng ne? tā yě zài diàn nǎo gōng sī gōng zuò ma?', en: 'And your husband? Does he also work at a computer company?' }],
        options: [
          { cn: '不，他在银行工作。', py: 'bù, tā zài yín háng gōng zuò' },
          { cn: '他银行在工作不。',   py: '—' },
          { cn: '他工作银行不在。',   py: '—' },
          { cn: '不是，他银行。',     py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '你的孩子是学生吗？', py: 'nǐ de hái zi shì xué shēng ma?', en: 'Are your kids students?' },
      { kind: 'ai-translate', prompt: 'Translate:',
        en: 'My son and daughter are both elementary school students.' },
      { kind: 'dialogue-complete',
        prompt: 'They follow up about the kids:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '你的小孩在哪里念书？', py: 'nǐ de xiǎo hái zài nǎ lǐ niàn shū?', en: 'Where do your kids study?' },
        ],
        options: [
          { cn: '他们在小学念书。',   py: 'tā men zài xiǎo xué niàn shū' },
          { cn: '小学他们念书在。',   py: '—' },
          { cn: '他们念书在小学不。', py: '—' },
          { cn: '在小学念书的小孩。', py: '—' },
        ], answer: 0 },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My wife also works at the bank.',
        words: ['我', '太太', '也', '在', '银行', '工作'], scrambled: ['银行', '工作', '太太', '也', '在', '我'] },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你的孩子几岁？', py: 'nǐ de hái zi jǐ suì?', en: 'How old are your kids?' },
    ],
  },
  {
    id: 'b1-c4-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch4 · Talk about parents',
    subtitle: '父母做什么 · 累不累',
    icon: 'chat', color: 'red',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'They ask about your parents:',
        en: '(reply)',
        context: [{ speaker: '友', cn: '你爸爸妈妈做什么工作？', py: 'nǐ bà ba mā ma zuò shén me gōng zuò?', en: 'What do your parents do?' }],
        options: [
          { cn: '我爸爸是老师，妈妈在银行工作。', py: 'wǒ bà ba shì lǎo shī, mā ma zài yín háng gōng zuò' },
          { cn: '我爸爸妈妈做老师银行。',         py: '—' },
          { cn: '我爸爸银行妈妈老师。',           py: '—' },
          { cn: '我父母不工作做。',               py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '你爸爸每天累吗？', py: 'nǐ bà ba měi tiān lèi ma?', en: 'Is your dad tired every day?' },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '你妈妈喜欢教书吗？', py: 'nǐ mā ma xǐ huān jiāo shū ma?', en: 'Does your mom like teaching?' },
      { kind: 'ai-translate', prompt: 'Translate:',
        en: 'My mom is a teacher. She likes teaching kids. But she is very busy.' },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'My dad is very tired every day.',
        words: ['我', '爸爸', '每天', '都', '很', '累'], scrambled: ['累', '都', '每天', '很', '我', '爸爸'] },
      { kind: 'dialogue-complete',
        prompt: 'They follow up about your dad:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '你爸爸忙不忙？', py: 'nǐ bà ba máng bù máng?', en: 'Is your dad busy?' },
        ],
        options: [
          { cn: '他每天都很忙。',         py: 'tā měi tiān dōu hěn máng' },
          { cn: '他不忙每天。',           py: '—' },
          { cn: '忙不爸爸每天。',         py: '—' },
          { cn: '是，他工作。',           py: 'shì, tā gōng zuò' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你父母累吗？', py: 'nǐ fù mǔ lèi ma?', en: 'Are your parents tired?' },
    ],
  },
  {
    id: 'b1-c5-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch5 · Welcoming a visitor',
    subtitle: '认识 · 想去玩 · 国家公园',
    icon: 'chat', color: 'primary',
    xp: 42, coins: 30,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'You\'re introduced to a visitor:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '这是我的朋友家文。', py: 'zhè shì wǒ de péng yǒu Jiā wén', en: 'This is my friend Jiawen.' },
          { speaker: '家文', cn: '你好，认识你很高兴。', py: 'nǐ hǎo, rèn shi nǐ hěn gāo xìng', en: 'Hi, nice to meet you.' },
        ],
        options: [
          { cn: '我也很高兴认识你。', py: 'wǒ yě hěn gāo xìng rèn shi nǐ' },
          { cn: '我不认识你。',       py: 'wǒ bú rèn shi nǐ' },
          { cn: '再见！',             py: 'zài jiàn' },
          { cn: '我是美国人。',       py: 'wǒ shì měi guó rén' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '欢迎你来美国！你想去哪里玩？', py: 'huān yíng nǐ lái měi guó! nǐ xiǎng qù nǎ lǐ wán?', en: 'Welcome to America! Where do you want to go?' },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '你住在哪里？', py: 'nǐ zhù zài nǎ lǐ?', en: 'Where do you live?' },
      { kind: 'ai-translate', prompt: 'Translate:',
        en: 'I want to go to a national park, and I also want to go to Disneyland.' },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'I want to go play in Japan.',
        words: ['我', '想', '去', '日本', '玩'], scrambled: ['玩', '日本', '想', '去', '我'] },
      { kind: 'dialogue-complete',
        prompt: 'They invite you to a national park:',
        en: '(reply — agree)',
        context: [
          { speaker: '友', cn: '我们一起去国家公园玩，好吗？', py: 'wǒ men yì qǐ qù guó jiā gōng yuán wán, hǎo ma?', en: "Let's go to the national park together, OK?" },
        ],
        options: [
          { cn: '好啊，我也想去。',     py: 'hǎo a, wǒ yě xiǎng qù' },
          { cn: '不去玩国家公园。',     py: '—' },
          { cn: '我国家公园不想。',     py: '—' },
          { cn: '不，我累。',           py: 'bù, wǒ lèi' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你来美国多久了？', py: 'nǐ lái měi guó duō jiǔ le?', en: "How long have you been in America?" },
    ],
  },
  {
    id: 'b1-c6-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch6 · Hobbies chat',
    subtitle: '常常 · 喜欢 · 还',
    icon: 'star', color: 'cyan',
    xp: 40, coins: 28,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'A coworker asks about your weekend:',
        en: '(reply)',
        context: [{ speaker: '同事', cn: '你周末喜欢做什么？', py: 'nǐ zhōu mò xǐ huān zuò shén me?', en: 'What do you like to do on the weekend?' }],
        options: [
          { cn: '我喜欢打网球和听音乐。', py: 'wǒ xǐ huān dǎ wǎng qiú hàn tīng yīn yuè' },
          { cn: '周末打网球我喜欢和听音乐。', py: '—' },
          { cn: '我和打网球听音乐喜欢。',     py: '—' },
          { cn: '喜欢我周末做什么。',         py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '你常常去运动吗？', py: 'nǐ cháng cháng qù yùn dòng ma?', en: 'Do you often exercise?' },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '晚上你喜欢看电视，还是听音乐？', py: 'wǎn shàng nǐ xǐ huān kàn diàn shì, hái shì tīng yīn yuè?', en: 'At night, do you like watching TV or listening to music?' },
      { kind: 'ai-translate', prompt: 'Translate:',
        en: 'I often play tennis on weekends, but I also like watching TV at night.' },
      { kind: 'arrange', prompt: 'Arrange:', translation: "I like to swim and listen to music.",
        words: ['我', '喜欢', '游泳', '和', '听音乐'], scrambled: ['听音乐', '和', '游泳', '喜欢', '我'] },
      { kind: 'dialogue-complete',
        prompt: 'They ask which hobby you prefer:',
        en: '(pick the natural reply)',
        context: [
          { speaker: '友', cn: '你喜欢运动还是看书？', py: 'nǐ xǐ huān yùn dòng hái shì kàn shū?', en: 'Do you like exercise or reading?' },
        ],
        options: [
          { cn: '我喜欢运动，不喜欢看书。', py: 'wǒ xǐ huān yùn dòng, bù xǐ huān kàn shū' },
          { cn: '运动看书都喜欢我。',       py: '—' },
          { cn: '我喜欢运动看书。',         py: 'wǒ xǐ huān yùn dòng kàn shū' },
          { cn: '我书运动喜欢。',           py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:', cn: '你常常去运动吗？多久一次？', py: 'nǐ cháng cháng qù yùn dòng ma? duō jiǔ yí cì?', en: "Do you exercise often? How often?" },
    ],
  },
  {
    id: 'b1-c7-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch7 · Full phone call',
    subtitle: 'taking a message',
    icon: 'chat', color: 'yellow',
    xp: 44, coins: 32,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'You answer the phone at an office:',
        en: '(start the call)',
        context: [{ speaker: '☎', cn: '（电话响了）', py: '(diàn huà xiǎng le)', en: '(phone rings)' }],
        options: [
          { cn: '喂，您好，林小姐的办公室。', py: 'wéi, nín hǎo, Lín xiǎo jiě de bàn gōng shì' },
          { cn: '林小姐在不在？',               py: 'Lín xiǎo jiě zài bu zài?' },
          { cn: '请问哪位？',                   py: 'qǐng wèn nǎ wèi?' },
          { cn: '我累了。',                     py: 'wǒ lèi le' },
        ], answer: 0 },
      { kind: 'dialogue-complete',
        prompt: 'The caller asks for Ms. Lin. She\'s out. Tell them:',
        en: '(reply)',
        context: [
          { speaker: '☎', cn: '请问林小姐在吗？', py: 'qǐng wèn Lín xiǎo jiě zài ma?', en: 'Is Ms. Lin there?' },
        ],
        options: [
          { cn: '不在，她下午回来。',     py: 'bú zài, tā xià wǔ huí lái' },
          { cn: '林小姐不下午。',         py: '—' },
          { cn: '回来不在下午。',         py: '—' },
          { cn: '在小姐林。',             py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Offer to take a message:',
        cn: '你能麻烦她回来给我电话吗？', py: 'nǐ néng má fán tā huí lái gěi wǒ diàn huà ma?', en: 'Could you ask her to call me back?' },
      { kind: 'ai-translate', prompt: 'Translate:',
        en: 'Hello, may I ask, is Mr. Wang there? Please ask him to call me this afternoon.' },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'May I ask, who is this calling?',
        words: ['请问', '您', '是', '哪位'], scrambled: ['哪位', '是', '您', '请问'] },
      { kind: 'dialogue-complete',
        prompt: 'They ask when she\'ll be back:',
        en: '(reply)',
        context: [
          { speaker: '☎', cn: '林小姐什么时候回来？', py: 'Lín xiǎo jiě shén me shí hòu huí lái?', en: 'When will Ms. Lin be back?' },
        ],
        options: [
          { cn: '她下午回来。',     py: 'tā xià wǔ huí lái' },
          { cn: '回来下午她。',     py: '—' },
          { cn: '林小姐下午是。',   py: '—' },
          { cn: '她不回来下午。',   py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply (you\'re the receptionist):',
        cn: '请问王先生在办公室吗？', py: 'qǐng wèn Wáng xiān sheng zài bàn gōng shì ma?', en: 'Is Mr. Wang in the office?' },
    ],
  },
  {
    id: 'b1-c8-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch8 · Birthday plans',
    subtitle: '生日 · 请客 · 礼物',
    icon: 'food', color: 'primary',
    xp: 42, coins: 30,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'Your friend hints at their birthday:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '明天是我的生日。', py: 'míng tiān shì wǒ de shēng rì', en: 'Tomorrow is my birthday.' },
        ],
        options: [
          { cn: '生日快乐！我请你吃大餐。',     py: 'shēng rì kuài lè! wǒ qǐng nǐ chī dà cān' },
          { cn: '我累了，明天没空。',           py: 'wǒ lèi le, míng tiān méi kòng' },
          { cn: '生日明天我没有。',             py: '—' },
          { cn: '没问题，我不想去。',           py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '你要什么生日礼物？', py: 'nǐ yào shén me shēng rì lǐ wù?', en: 'What do you want for a birthday gift?' },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '你明年几岁？', py: 'nǐ míng nián jǐ suì?', en: 'How old will you be next year?' },
      { kind: 'ai-translate', prompt: 'Translate:',
        en: "Tomorrow is my older brother's birthday. I want to give him a gift." },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Tomorrow is my birthday.',
        words: ['明天', '是', '我的', '生日'], scrambled: ['生日', '我的', '明天', '是'] },
      { kind: 'dialogue-complete',
        prompt: 'They ask what gift you want:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '你想要什么生日礼物？', py: 'nǐ xiǎng yào shén me shēng rì lǐ wù?', en: 'What birthday gift do you want?' },
        ],
        options: [
          { cn: '我想要一双新鞋。',     py: 'wǒ xiǎng yào yī shuāng xīn xié' },
          { cn: '我礼物想要新鞋。',     py: '—' },
          { cn: '一双新鞋礼物想。',     py: '—' },
          { cn: '想我要鞋一双。',       py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '我请你吃大餐，好不好？', py: 'wǒ qǐng nǐ chī dà cān, hǎo bù hǎo?', en: "I'll treat you to a big meal, OK?" },
    ],
  },
  {
    id: 'b1-c9-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch9 · Making a Friday plan',
    subtitle: 'invite · agree · set time',
    icon: 'chat', color: 'cyan',
    xp: 44, coins: 32,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'A coworker wants to grab dinner. Reply:',
        en: '(reply)',
        context: [
          { speaker: '同事', cn: '你星期五下课以后有空吗？', py: 'nǐ xīng qī wǔ xià kè yǐ hòu yǒu kòng ma?', en: 'Are you free after class on Friday?' },
        ],
        options: [
          { cn: '有空。怎么了？', py: 'yǒu kòng. zěn me le?' },
          { cn: '没空有。',       py: '—' },
          { cn: '我空有星期五。', py: '—' },
          { cn: '没什么。',       py: 'méi shén me' },
        ], answer: 0 },
      { kind: 'dialogue-complete',
        prompt: 'They suggest a time. Pick the matching agreement:',
        en: '(agree)',
        context: [
          { speaker: '同事', cn: '我们星期五晚上六点半在餐厅见，行吗？', py: 'wǒ men xīng qī wǔ wǎn shàng liù diǎn bàn zài cān tīng jiàn, xíng ma?', en: "Let's meet at the restaurant Friday at 6:30. OK?" },
        ],
        options: [
          { cn: '行！我们星期五见。', py: 'xíng! wǒ men xīng qī wǔ jiàn' },
          { cn: '星期六我见你。',     py: 'xīng qī liù wǒ jiàn nǐ' },
          { cn: '不行没见。',         py: '—' },
          { cn: '六点半再见。',       py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '我们几点见？', py: 'wǒ men jǐ diǎn jiàn?', en: 'What time should we meet?' },
      { kind: 'ai-translate', prompt: 'Translate:',
        en: 'Are you free Saturday night? Have dinner with me, OK?' },
      { kind: 'arrange', prompt: 'Arrange:', translation: 'Friday after class, let\'s eat together.',
        words: ['星期五', '下课', '以后', '我们', '一起', '吃饭'], scrambled: ['吃饭', '下课', '以后', '一起', '我们', '星期五'] },
      { kind: 'dialogue-complete',
        prompt: 'They ask where to meet:',
        en: '(reply)',
        context: [
          { speaker: '同事', cn: '我们在哪里见面？', py: 'wǒ men zài nǎ lǐ jiàn miàn?', en: 'Where should we meet?' },
        ],
        options: [
          { cn: '在餐厅见面。',   py: 'zài cān tīng jiàn miàn' },
          { cn: '餐厅见面在。',   py: '—' },
          { cn: '见面餐厅。',     py: '—' },
          { cn: '我们见在哪里。', py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Make a plan:',
        cn: '这个星期六晚上我们去吃饭，怎么样？', py: 'zhè ge xīng qī liù wǎn shàng wǒ men qù chī fàn, zěn me yàng?', en: 'How about we go out for dinner this Saturday night?' },
    ],
  },
  {
    id: 'b1-c10-dia',
    unit: 13, unitName: 'BOOK 1 · 來學華語',
    title: 'Ch10 · Study struggle',
    subtitle: '难不难 · 觉得 · 一下',
    icon: 'star', color: 'red',
    xp: 44, coins: 32,
    exercises: [
      { kind: 'dialogue-complete',
        prompt: 'A friend asks how Mandarin study is going. Reply:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '你觉得学中文难不难？', py: 'nǐ jué de xué zhōng wén nán bù nán?', en: 'Do you think Chinese is hard?' },
        ],
        options: [
          { cn: '我觉得有一点儿难，可是很有意思。', py: 'wǒ jué de yǒu yī diǎnr nán, kě shì hěn yǒu yì si' },
          { cn: '中文我难觉得意思。',                 py: '—' },
          { cn: '难不难学中文我觉得。',               py: '—' },
          { cn: '是觉得有意思一点儿。',               py: '—' },
        ], answer: 0 },
      { kind: 'dialogue-complete',
        prompt: 'They suggest a coffee break. Reply:',
        en: '(reply)',
        context: [
          { speaker: '友', cn: '我们去喝杯咖啡，休息一下，好吗？', py: 'wǒ men qù hē bēi kā fēi, xiū xí yī xià, hǎo ma?', en: "Let's go grab a coffee and rest a bit, OK?" },
        ],
        options: [
          { cn: '好啊，我也累了。', py: 'hǎo a, wǒ yě lèi le' },
          { cn: '不咖啡休息。',     py: '—' },
          { cn: '我们咖啡不一下。', py: '—' },
          { cn: '咖啡不好吗？',     py: 'kā fēi bù hǎo ma?' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '你常常练习说话吗？', py: 'nǐ cháng cháng liàn xí shuō huà ma?', en: 'Do you often practice speaking?' },
      { kind: 'ai-translate', prompt: 'Translate:',
        en: 'I think Chinese is not too hard, but I need to practice speaking more.' },
      { kind: 'arrange', prompt: 'Arrange:', translation: "Let's take a break and have a coffee.",
        words: ['我们', '休息', '一下', '喝', '杯', '咖啡'], scrambled: ['咖啡', '杯', '一下', '休息', '喝', '我们'] },
      { kind: 'dialogue-complete',
        prompt: "They ask how long you've been learning:",
        en: '(reply)',
        context: [
          { speaker: '友', cn: '你学中文多久了？', py: 'nǐ xué zhōng wén duō jiǔ le?', en: 'How long have you been learning Chinese?' },
        ],
        options: [
          { cn: '我学了一年了。',     py: 'wǒ xué le yì nián le' },
          { cn: '中文学一年了我。',   py: '—' },
          { cn: '一年我学了中文。',   py: 'yì nián wǒ xué le zhōng wén' },
          { cn: '我学一年中文。',     py: '—' },
        ], answer: 0 },
      { kind: 'ai-respond', prompt: 'Reply:',
        cn: '为什么你想学中文？', py: 'wèi shén me nǐ xiǎng xué zhōng wén?', en: 'Why do you want to learn Chinese?' },
    ],
  },
];

// User progress.
const DEFAULT_PROGRESS = {
  onboarded: false,
  xp: 0, coins: 0, streak: 0, highScore: 0,
  completedLessons: [],
  lessonStars: {},
  lastPlayed: null,         // lesson id, used for "Resume" pill
  lastActiveDate: null,     // YYYY-MM-DD, used for streak math
};

const SEEDED_PROGRESS = {
  onboarded: true,
  xp: 145, coins: 88, streak: 4, highScore: 1240,
  completedLessons: ['tones-101'],
  lessonStars: { 'tones-101': 3 },
  lastPlayed: 'initials-bpmf',
};

// Persistence.
const PROGRESS_STORE = 'chopstick.progress';
const SETTINGS_STORE = 'chopstick.settings';

function loadProgress() {
  try {
    const raw = localStorage.getItem(PROGRESS_STORE);
    if (!raw) return null;
    const parsed = JSON.parse(raw);
    // Migration: detect the old "lived-in" SEEDED_PROGRESS values and reset them.
    // Anyone using the app before this fix will get a clean slate exactly once.
    if (parsed.xp === 145 && parsed.coins === 88 && parsed.streak === 4 &&
        parsed.highScore === 1240 &&
        Array.isArray(parsed.completedLessons) && parsed.completedLessons.length === 1 &&
        parsed.completedLessons[0] === 'tones-101' &&
        parsed.lastPlayed === 'initials-bpmf') {
      const fresh = { ...DEFAULT_PROGRESS, onboarded: parsed.onboarded || true };
      saveProgress(fresh);
      return fresh;
    }
    return { ...DEFAULT_PROGRESS, ...parsed };
  } catch { return null; }
}
function saveProgress(p) {
  try { localStorage.setItem(PROGRESS_STORE, JSON.stringify(p)); } catch {}
}

// Local-date helpers for streak logic. We use the user's wall-clock date
// (YYYY-MM-DD) so timezones don't break streaks across midnight.
function todayISO() {
  const d = new Date();
  const pad = (n) => String(n).padStart(2, '0');
  return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
}
function daysBetween(aISO, bISO) {
  if (!aISO || !bISO) return Infinity;
  const a = new Date(aISO + 'T00:00:00');
  const b = new Date(bISO + 'T00:00:00');
  return Math.round((b - a) / 86400000);
}
function loadSettings() {
  try {
    const raw = localStorage.getItem(SETTINGS_STORE);
    if (!raw) return null;
    return JSON.parse(raw);
  } catch { return null; }
}
function saveSettings(s) {
  try { localStorage.setItem(SETTINGS_STORE, JSON.stringify(s)); } catch {}
}

// Group lessons by unit for the home screen.
function lessonsByUnit() {
  const groups = new Map();
  for (const l of LESSONS) {
    if (!groups.has(l.unit)) groups.set(l.unit, { unit: l.unit, name: l.unitName, lessons: [] });
    groups.get(l.unit).lessons.push(l);
  }
  return [...groups.values()];
}

// Find the next lesson the user hasn't completed. If `from` is given, start
// search after that lesson's index. Returns null if everything is done or
// remaining is locked.
function nextLesson(progress, fromId = null) {
  const completed = new Set(progress.completedLessons || []);
  const startIdx = fromId ? LESSONS.findIndex((l) => l.id === fromId) + 1 : 0;
  for (let i = startIdx; i < LESSONS.length; i++) {
    const l = LESSONS[i];
    if (l.locked) continue;
    if (!completed.has(l.id)) return l;
  }
  // Fallback: first uncompleted from the top.
  for (const l of LESSONS) {
    if (l.locked) continue;
    if (!completed.has(l.id)) return l;
  }
  return null;
}

// Bump streak based on today's date vs lastActiveDate. Returns new {streak, lastActiveDate}.
//   same day  → no change
//   1 day     → +1
//   >1 day    → reset to 1
//   never     → set to 1
function bumpStreak(progress) {
  const today = todayISO();
  const last = progress.lastActiveDate;
  if (last === today) return { streak: progress.streak, lastActiveDate: today };
  const gap = daysBetween(last, today);
  if (gap === 1) return { streak: (progress.streak || 0) + 1, lastActiveDate: today };
  return { streak: 1, lastActiveDate: today };
}

Object.assign(window, {
  LESSONS, DEFAULT_PROGRESS, SEEDED_PROGRESS,
  TONE_MARKS, TONE_NAMES, TONE_DESCS,
  loadProgress, saveProgress, loadSettings, saveSettings,
  lessonsByUnit, nextLesson, bumpStreak, todayISO, daysBetween,
});
