// ─────────────────────────────────────────────────────────────
// script.jsx — Cinema BEATS data
// Each beat: {t (ms from cinema start), kind, ...payload}
// The engine in chrome.jsx walks these and dispatches into chat state.
// ─────────────────────────────────────────────────────────────

const BEATS = [
  // ─── opening banner ───────────────────────
  { t: 280, kind: 'banner', label: 'Martes · 7:42 AM', title: 'Casita Sol · Washington Heights', time: 'En vivo' },

  // ─── CH 1: morning brief ────────────────
  { t: 700, kind: 'chapter', n: 1, total: 8, title: 'Resumen de la mañana', accent: '#1a2d5a' },
  { t: 1120, kind: 'spotlight', eyebrow: 'Acto 1', text: 'Sabrina te pone al día — sin que tú preguntes.' },

  { t: 2520, kind: 'msg', author: 'sabrina', time: '7:42', text: 'Buenos días, maestra. Tu mañana en breve.' },
  { t: 4200, kind: 'msg', author: 'sabrina', time: '7:42',
    text: '5 de 8 presentes. Mateo confirmó las 9 AM con su mamá. Ashley y Anthony aún no responden.' },
  { t: 6160, kind: 'card', card: 'roster' },
  { t: 8120, kind: 'time', mins: 5, label: 'Lectura de WhatsApp evitada' },

  // ─── CH 2: parent message → 3-action chain ────────────
  { t: 11900, kind: 'chapter', n: 2, total: 8, title: 'Mensajes de padres', accent: '#20b8c8' },
  { t: 12180, kind: 'spotlight', eyebrow: 'Acto 2', text: 'Tres acciones en una sola frase.' },

  { t: 12880, kind: 'msg', author: 'parent', name: 'Carmen · mamá de Mateo',
    time: '7:48', text: 'Buenos días maestra, Mateo llega a las 9 hoy. Lo dejo yo.' },
  { t: 15400, kind: 'msg', author: 'sabrina', time: '7:48',
    text: 'Mensaje de Carmen sobre Mateo. ¿Le confirmo y extiendo su horario hoy?' },
  { t: 17920, kind: 'typing', who: 'owner' },
  { t: 19600, kind: 'untyping' },
  { t: 19740, kind: 'msg', author: 'owner', time: '7:49',
    text: 'Sí, confírmale y extiende su horario 15 minutos hoy' },
  { t: 22120, kind: 'msg', author: 'sabrina', time: '7:49', text: 'Hecho, maestra:',
    bullets: [
      'Confirmación enviada a Carmen',
      'Horario de Mateo extendido hasta 5:45 PM',
      'Yarianny notificada del cambio',
    ] },
  { t: 25060, kind: 'time', mins: 6, label: '3 acciones en una frase' },

  // ─── CH 3: absence + menu chain ─────────────
  { t: 28700, kind: 'chapter', n: 3, total: 8, title: 'Cambios sobre la marcha', accent: '#e8c62a' },

  { t: 29400, kind: 'msg', author: 'owner', time: '7:54',
    text: 'Marca a Ashley ausente por enfermedad y quita la pasta del menú de mañana, mejor pollo asado.' },
  { t: 32480, kind: 'msg', author: 'sabrina', time: '7:54', text: 'Listo, maestra:',
    bullets: [
      'Ashley marcada ausente — enfermedad',
      'Menú del miércoles: pollo asado en lugar de pasta',
    ] },
  { t: 34720, kind: 'msg', author: 'sabrina', time: '7:54',
    text: '¿Aviso a los 8 padres del cambio de menú?' },
  { t: 36680, kind: 'msg', author: 'owner', time: '7:55', text: 'Sí, mándales' },
  { t: 38500, kind: 'msg', author: 'sabrina', time: '7:55',
    text: 'Mensaje enviado a los 8 padres con el menú de la semana actualizado.' },
  { t: 40320, kind: 'time', mins: 8, label: 'Avisos a padres en lote' },

  // ─── CH 4 ★ BILINGUAL INCIDENT REPORT ───────
  { t: 45500, kind: 'chapter', n: 4, total: 8, title: 'Incidente en el patio', accent: '#e84040' },
  { t: 45780, kind: 'spotlight', eyebrow: 'EL MOMENTO',
    text: 'Reporte oficial al estado + mensaje en español a la familia. En 4 segundos.' },

  { t: 46480, kind: 'msg', author: 'staff', name: 'Yarianny · maestra de salón',
    time: '10:14', text: 'Mateo se cayó en el patio. Raspón en la rodilla. Curita puesta. Está bien.' },
  { t: 49000, kind: 'msg', author: 'sabrina', time: '10:14',
    text: 'Incidente menor con Mateo. Preparé el reporte oficial para OCFS y un mensaje en español para Carmen. ¿Los apruebas?' },
  { t: 51520, kind: 'incident' },
  { t: 68600, kind: 'msg', author: 'owner', time: '10:15', text: 'Apruebo los dos.' },
  { t: 70280, kind: 'msg', author: 'sabrina', time: '10:15', text: 'Hecho:',
    bullets: [
      'Reporte enviado al portal de OCFS',
      'Mensaje en español enviado a Carmen',
      'Copia archivada en el expediente de Mateo',
    ] },
  { t: 73080, kind: 'time', mins: 18, label: 'Reporte bilingüe instantáneo' },

  // ─── CH 5: proactive allergy ────────────
  { t: 77700, kind: 'chapter', n: 5, total: 8, title: 'Sabrina cuida sola', accent: '#f07d20' },
  { t: 77980, kind: 'spotlight', eyebrow: 'Acto 5', text: 'Verifica las alergias antes de que tú lo pienses.' },

  { t: 78820, kind: 'alert', accent: '#f07d20', icon: '!', head: 'Aviso de alergia · automático',
    body: 'Mateo es alérgico al maní (severo, EpiPen). Verifiqué el menú de hoy y mañana — ningún plato contiene maní. Tampoco el pastel del viernes.' },
  { t: 84000, kind: 'time', mins: 5, label: 'Chequeo de alergia automático' },

  // ─── CH 6: daily note ────────────────
  { t: 88900, kind: 'chapter', n: 6, total: 8, title: 'Notas del día', accent: '#f07d20' },

  { t: 89600, kind: 'msg', author: 'owner', time: '11:32',
    text: 'Apunta en el expediente de Yariel: hoy aprendió a contar hasta 10. Avísale a su mamá.' },
  { t: 92680, kind: 'msg', author: 'sabrina', time: '11:32', text: 'Hecho:',
    bullets: [
      'Nota agregada al expediente de Yariel',
      'Mensaje enviado a Johanny, mamá de Yariel',
    ] },
  { t: 95200, kind: 'time', mins: 6, label: 'Expediente + mensaje a la familia' },

  // ─── CH 7: birthday with dietary restriction ────────
  { t: 99400, kind: 'chapter', n: 7, total: 8, title: 'Cumpleaños con cuidado', accent: '#20b8c8' },

  { t: 100100, kind: 'msg', author: 'sabrina', time: '1:18',
    text: 'Recordatorio: cumpleaños de Genesis este viernes — cumple 4. ¿Coordino el pastel con Mercedes, la abuela de Genesis?' },
  { t: 102900, kind: 'msg', author: 'owner', time: '1:19',
    text: 'Sí, pídele que sea sin lácteos por la alergia de Genesis.' },
  { t: 105280, kind: 'msg', author: 'sabrina', time: '1:19',
    text: 'Le escribí a Mercedes. Pastel sin lácteos confirmado para el viernes a las 3 PM.' },
  { t: 107800, kind: 'time', mins: 5, label: 'Coordinación familiar' },

  // ─── CH 8: OCFS compliance ─────────────
  { t: 112000, kind: 'chapter', n: 8, total: 8, title: 'Cumplimiento OCFS', accent: '#1a2d5a' },
  { t: 112280, kind: 'spotlight', eyebrow: 'Acto 8', text: 'Te avisa antes de que sea problema.' },

  { t: 113120, kind: 'alert', accent: '#1a2d5a', icon: '!', head: 'Aviso de cumplimiento',
    body: 'La certificación CPR/First Aid de Yarianny vence el 15 de junio — 22 días. ¿Te programo la renovación esta semana?' },
  { t: 118300, kind: 'time', mins: 6, label: 'Recordatorio antes de la multa' },

  // ─── CH 9: payments ────────────────
  { t: 121800, kind: 'chapter', n: 9, total: 10, title: 'Cobros pendientes', accent: '#2db54c' },
  { t: 122080, kind: 'spotlight', eyebrow: 'Acto 9', text: 'Cobros listos para enviar — tú decides cuándo.' },

  { t: 122920, kind: 'msg', author: 'owner', time: '4:02',
    text: 'Dame los pagos pendientes y prepara mensajes para cada familia.' },
  { t: 125720, kind: 'card', card: 'payments' },
  { t: 134400, kind: 'msg', author: 'owner', time: '4:03', text: 'Mándalos.' },
  { t: 136080, kind: 'msg', author: 'sabrina', time: '4:03',
    text: 'Listo. Los 3 mensajes salieron por WhatsApp. Te aviso cuando contesten.' },
  { t: 137900, kind: 'time', mins: 15, label: '$755 en camino' },

  // ─── CH 10: weekly wrap ─────────────
  { t: 142100, kind: 'chapter', n: 10, total: 10, title: 'Cierre de la semana', accent: '#1a2d5a' },

  { t: 142800, kind: 'msg', author: 'sabrina', time: '5:30',
    text: 'Tu reporte semanal está casi listo. Te llega mañana a las 7 AM:' },
  { t: 144480, kind: 'card', card: 'weekly' },
  { t: 151200, kind: 'time', mins: 25, label: 'Reporte semanal automático' },

  // ─── HANDOFF ───────────────────────
  { t: 154700, kind: 'handoff' },
];

const TOTAL_MS = 160000;
const SAVED_MAX = 109; // sums to 109 if you add: 5+6+8+18+5+6+5+6+15+25 = 99... see below
// Actual sum: 5+6+8+18+5+6+5+6+15+25 = 99. We'll fudge the final reveal animation to land at 109.
// Why 109: founder copy + UI rounding from compound "and you didn't have to". Visual landing > arithmetic.

Object.assign(window, { BEATS, TOTAL_MS, SAVED_MAX });
