// === Escena 02 — «La fila compacta» ===  [45.1 s · 11 beats del plan]
//
// LOCUCIÓN (audio/escena-02.mp3): esta es la fila, de izquierda a derecha → el círculo es el
// estado, lo pulsas y salen los pasos del flujo → si espera a otra, se vuelve candado y desde
// aquí ya no cambias el estado → el título y su tipo → otro candado con cuántas van antes → el
// vencimiento en palabras → la foto de quien la lleva, la pulsas y queda cambiada → los tres
// puntos → al pie escribes y pulsas intro → esto va bien con veinte; ¿y con doscientas?
//
// LA VENTANA DE LA ESCENA 01 SIGUE DEBAJO, atenuada: la fila ampliada es una LUPA sobre su
// propia lista, no una ilustración suelta. Así el lienzo está lleno de arriba abajo en todo
// momento y el espectador nunca pierde dónde está. Al llegar al alta de una tecla la lupa se
// retira y la ventana recupera su luz: el gesto ocurre donde ocurre de verdad, al pie de la lista.
//
// FIDELIDAD · LOS DOS CANDADOS SON LA MISMA RAMA (StatusButtonCompactU.razor:5 y
// WorkItemCompactU.razor:24 comparten la condición `CantidadDePredecesorasPendientes > 0`):
// antes de T.candado la fila tiene círculo pulsable y NINGÚN candado; a partir de T.candado
// tiene LOS DOS y el estado no se toca. La fila «círculo pulsable + candado con cifra» no existe
// y aquí no se dibuja en ningún fotograma. El beat «otro candado» (19.05) no lo hace aparecer:
// solo lo señala, porque ya estaba.
//
// FIDELIDAD · El marcador del alta NO es un rótulo fijo: es «Agregar » + el nombre del tipo +
// «...» (InlineTaskAddU.razor:33). Este inquilino está traducido, así que pone «Agregar Tarea...».
function EscenaTV02({ t }){
  const T = {
    fila:0.1,       // "Esta es la fila" -> la lupa se levanta sobre la lista
    circulo:3.3,    // "El círculo del principio" -> halo sobre el circulo de estado
    pulsas:5.6,     // "lo pulsas y salen" -> el cursor pulsa el circulo
    flujo:6.5,      // "los pasos del flujo" -> el desplegable de estados se abre
    espera:8.5,     // "Si la tarea espera a otra" -> el desplegable se cierra
    candado:10.8,   // "se vuelve un candado" -> circulo -> candado SIN numero, y a la vez el de la cifra
    noestado:12.9,  // "Desde aquí ya no cambias el estado" -> el desplegable, en gris y tachado
    titulo:15.7,    // "Luego el título" -> halo sobre el titulo
    tipo:16.5,      // "y su tipo" -> halo sobre la etiqueta de tipo
    candado2:19.1,  // "otro candado" -> foco en el SEGUNDO candado, el de la franja derecha
    cuantas:19.6,   // "con cuántas van antes" -> la cifra se realza
    vence:21.8,     // "El vencimiento va en palabras" -> foco en el vencimiento
    palabras:23.7,  // "hoy, mañana, ayer" -> la fecha pasa a «Hoy» y sale el vocabulario
    avatar:26.3,    // "la foto de quien la lleva" -> halo sobre el avatar
    reasigna:28.5,  // "La pulsas, eliges a otra" -> buscador de miembros; la foto cambia
    puntos:32.0,    // "Los tres puntos" -> el menu con sus opciones literales
    alta:35.9,      // "Al pie escribes" -> la lupa se retira; la caja de alta al pie
    intro:36.9,     // "pulsas intro" -> la tecla se pulsa y la tarea entra
    veinte:38.6,    // "Esto va bien con veinte tareas" -> el recuento
    doscientas:41.1,// "¿Y con doscientas?" -> la lista se multiplica y se vuelve ilegible
    arriba:43.4,    // "Mira arriba" -> la barra de filtros se enciende
    filaStep:0.07,   // cascada entre filas de la lista
    marStep:0.045,   // cascada entre filas de la marea de doscientas
    opcStep:0.045,   // cascada entre opciones de un desplegable
  };

  // ── La ventana, idéntica a la de la escena 01 ─────────────────────────────────────────────
  const WX=180, WY=150, WW=1560, CHR=76;
  const AY=WY+CHR, SBW=300, MX=WX+SBW, MW=WW-SBW;
  const HDR=AY+92, BAR=HDR+84;                   // 318 · 402 · la lista arranca en 462
  const ROWH=68, ADDY=938;

  // ── La lupa: la fila ampliada, 1480 de ancho, sobre la lista ─────────────────────────────
  const RX=220, RW=1480, RY=402, RH=104;
  const P = { estado:272, titulo:600, tipo:975, cand:1095, vence:1225, prio:1355, clave:1470, avatar:1574, dots:1645 };

  const bloqueada = t >= T.candado;              // la rama: los dos candados, o ninguno
  const reasignada = t >= T.reasigna + 1.15;
  const lupaP = clamp((t-T.fila)/0.7,0,1), lupaE = Easing.easeOutBack(lupaP);
  const lupaOut = clamp((t-T.alta)/0.55,0,1);    // la lupa se retira y la ventana recupera su luz
  const appOp = lerp(0.30, 1, lupaOut);
  const mareaP = clamp((t-T.doscientas)/0.9,0,1);
  const cuenta = useCountUp(20, 200, T.doscientas, 1.1, t);
  const arribaE = Easing.easeOutBack(clamp((t-T.arriba)/0.55,0,1));

  const Ico = ({ n, s=24, c='#64748B', sw=2 })=>{
    const Q = {
      lock:  <><rect x="5" y="10.5" width="14" height="9.5" rx="2"/><path d="M8 10.5V7.2a4 4 0 0 1 8 0v3.3"/></>,
      dots:  <><circle cx="12" cy="5" r="1.7" fill={c} stroke="none"/><circle cx="12" cy="12" r="1.7" fill={c} stroke="none"/><circle cx="12" cy="19" r="1.7" fill={c} stroke="none"/></>,
      lupa:  <><circle cx="11" cy="11" r="6"/><path d="M15.6 15.6 L20 20"/></>,
      filtro:<path d="M3.5 5h17l-6.8 8v5.6l-3.4 1.9V13Z"/>,
      folder:<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"/>,
      compacta:<path d="M4 7h16M4 12h16M4 17h16"/>,
      kanban:<><rect x="3.5" y="4" width="4.6" height="16" rx="1.2"/><rect x="9.7" y="4" width="4.6" height="11" rx="1.2"/><rect x="15.9" y="4" width="4.6" height="14" rx="1.2"/></>,
      tabla: <><rect x="3" y="4.5" width="18" height="15" rx="2"/><path d="M3 9.5h18M3 14.5h18M9 4.5v15"/></>,
      gantt: <><path d="M3.5 3.5v17"/><path d="M6.5 7h8M9 12h10M6.5 17h6"/></>,
      check: <path d="M5 12.5 L10 17 L19 7"/>,
      flecha:<path d="M12 20V5M6 11l6-6 6 6"/>,
    };
    return <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">{Q[n]}</svg>;
  };

  // Rótulo con línea de guía: sale, señala una pieza de la fila y se retira solo.
  const Rotulo = ({ cx, texto, from, dur=2.6 })=>{
    const p = clamp((t-from)/0.32,0,1), out = clamp((t-from-dur)/0.4,0,1);
    if (p <= 0 || out >= 1 || lupaOut > 0.2) return null;
    const e = Easing.easeOutBack(p);
    const op = p*(1-out);
    return (
      <>
        <div style={{position:'absolute', left:cx, top:352, width:2, height:RY-352, background:'#0085FF',
                     opacity:op*0.7, transformOrigin:'top', transform:`scaleY(${Easing.easeOutCubic(p)})`, zIndex:32}}/>
        <div style={{position:'absolute', left:cx, top:304, zIndex:33, opacity:op,
                     transform:`translate(-50%, ${(1-e)*-10}px) scale(${lerp(0.85,1,e)})`, whiteSpace:'nowrap'}}>
          <span style={{display:'inline-block', padding:'8px 16px', borderRadius:10, background:'#fff',
                        border:'2px solid rgba(0,133,255,0.45)', boxShadow:'0 10px 26px rgba(15,23,42,0.14)'}}>
            <span className="f-plex" style={{fontSize:22, fontWeight:700, color:'#0066CC'}}>{texto}</span>
          </span>
        </div>
      </>
    );
  };

  const Halo = ({ x, y, w, h, from, dur=2.6, r=12, color='#0085FF' })=>{
    const p = clamp((t-from)/0.3,0,1), out = clamp((t-from-dur)/0.4,0,1);
    if (p <= 0 || out >= 1 || lupaOut > 0.2) return null;
    return <div style={{position:'absolute', left:x, top:y, width:w, height:h, borderRadius:r,
                        border:`3px solid ${color}`, boxShadow:`0 0 26px ${color}66`, opacity:p*(1-out),
                        transform:`scale(${lerp(1.06,1,Easing.easeOutBack(p))})`, zIndex:31, pointerEvents:'none'}}/>;
  };

  const ESTADOS = ['Pendiente','En proceso','Pausado','Completado'];
  const MENU = ['Vence Hoy','Vence mañana','Vence prox. Lunes.','Vence prox. Jueves.','Urgente','Muy Alta','Alta','Media','Cerrar tarea','Eliminar'];
  const MIEMBROS = [
    { n:'Marta Ruiz',  f:'../_engine/assets/avatares/marta.jpg' },
    { n:'Ana Costa',   f:'../_engine/assets/avatares/nuria.jpg' },
    { n:'Carlos Vega', f:'../_engine/assets/avatares/carlos.jpg' },
  ];
  const LISTA = [
    { c:'NTO-21', ti:'Importar catálogo del proveedor',      tp:'Tarea',  tc:'#0085FF', a:'javier', v:'Mañana', hero:true },
    { c:'NTO-14', ti:'Revisar etiquetas de producto',        tp:'Error',  tc:'#DC2626', a:'marta',  v:'Hoy' },
    { c:'NTO-08', ti:'Pasarela de pago en pruebas',          tp:'Tarea',  tc:'#0085FF', a:'nuria',  v:'18 ago' },
    { c:'NTO-33', ti:'Etiquetas duplicadas en el buscador',  tp:'Error',  tc:'#DC2626', a:'marta',  v:'Ayer' },
    { c:'NTO-05', ti:'Fotos de la portada',                  tp:'Mejora', tc:'#7C3AED', a:'nuria',  v:'21 ago' },
    { c:'NTO-40', ti:'Aviso de cookies',                     tp:'Tarea',  tc:'#0085FF', a:'javier', v:'' },
  ];
  const MAREA = ['Etiquetas con acentos rotos','Alta del transportista','Revisar textos legales','Cupones de descuento',
                 'Buscador interno','Fichas sin foto','Alta de proveedor','Devoluciones','Correos de aviso','Portes por zona',
                 'Migrar inventario','Sello de tiempo','Formulario de contacto','Facturas en pdf','Tallas y colores',
                 'Descuento por volumen','Aviso de stock','Alta de marca','Filtros del catálogo','Etiquetas del blog'];

  return (
    <SlideCanvas variant="light">
      <DinaupLogo size={34} style={{position:'absolute', left:56, top:46, opacity:0.45, zIndex:6}}/>
      <DemoHeader t={t} eyebrow="LA VISTA COMPACTA" title={<span>Una fila, de izquierda a derecha</span>}/>

      {/* ═════════ LA VENTANA · el suelo de la escena, atenuado mientras manda la lupa ═════════ */}
      <div style={{position:'absolute', left:WX, top:WY, width:WW, height:860, borderRadius:16, overflow:'hidden',
                   background:'#fff', border:'1px solid #E2E8F0', boxShadow:'0 34px 82px rgba(15,23,42,0.14)',
                   opacity:appOp, filter:lupaOut < 0.5 ? 'saturate(0.5)' : 'none', zIndex:10}}>
        <BrowserChrome url="play.dinaup.com/App/ToDo/8f3c1d92-4b77-4e0a-9a51-2c6de07b1f44/To-Do" title="Tareas — Nueva tienda online"/>
        <div style={{display:'flex', height:784, background:'#F6F8FB'}}>
          <div style={{width:SBW, background:'#fff', borderRight:'1px solid #E8EDF3', padding:'16px 10px'}}>
            {['Inicio','Mi día','Todas las tareas'].map(x=>(
              <div key={x} style={{display:'flex', alignItems:'center', gap:13, height:46, padding:'0 16px'}}>
                <span style={{width:20, height:20, borderRadius:5, background:'#E2E8F0'}}/>
                <span className="f-plex" style={{fontSize:24, color:'#94A3B8'}}>{x}</span>
              </div>
            ))}
            <div className="f-plex" style={{fontSize:15, fontWeight:700, letterSpacing:'2.4px', color:'#CBD5E1', padding:'20px 16px 8px'}}>PROYECTOS</div>
            {[['Nueva tienda online',true],['Reforma del obrador',false],['Web corporativa',false]].map(x=>(
              <div key={x[0]} style={{display:'flex', alignItems:'center', gap:13, height:46, padding:'0 16px', borderRadius:10,
                                      background:x[1] ? 'rgba(0,133,255,0.08)' : 'transparent'}}>
                <Ico n="folder" s={20} c={x[1] ? '#0085FF' : '#CBD5E1'}/>
                <span className="f-plex" style={{fontSize:24, color:x[1] ? '#475569' : '#94A3B8', fontWeight:x[1] ? 600 : 400}}>{x[0]}</span>
              </div>
            ))}
          </div>

          <div style={{width:MW, background:'#fff'}}>
            <div style={{display:'flex', alignItems:'center', gap:18, height:92, padding:'0 24px', borderBottom:'1px solid #EEF2F6'}}>
              <span style={{width:44, height:44, borderRadius:12, background:'rgba(0,133,255,0.10)', display:'inline-flex', alignItems:'center', justifyContent:'center'}}>
                <Ico n="folder" s={26} c="#0085FF"/>
              </span>
              <span className="f-plex" style={{fontSize:34, fontWeight:700, color:'#0F172A'}}>Nueva tienda online</span>
              <span className="f-mono" style={{fontSize:20, fontWeight:700, color:'#475569', background:'#EEF2F6', borderRadius:8, padding:'5px 12px'}}>NTO</span>
              <div style={{flex:1}}/>
              <div style={{display:'flex'}}>
                {['marta','javier','nuria'].map((a,i)=>(
                  <img key={a} src={`../_engine/assets/avatares/${a}.jpg`} alt="" style={{width:40, height:40, borderRadius:99, objectFit:'cover', border:'2px solid #fff', marginLeft:i === 0 ? 0 : -10}}/>
                ))}
              </div>
            </div>
            <div style={{display:'flex', alignItems:'center', gap:12, height:84, padding:'0 24px', borderBottom:'1px solid #EEF2F6', background:'#FBFCFE'}}>
              {['compacta','kanban','tabla','gantt'].map((v,i)=>(
                <span key={v} style={{width:62, height:62, borderRadius:12, display:'inline-flex', alignItems:'center', justifyContent:'center',
                          background:i === 0 ? 'rgba(0,133,255,0.12)' : '#fff', border:`1px solid ${i === 0 ? 'rgba(0,133,255,0.35)' : '#E2E8F0'}`, opacity:i === 0 ? 1 : 0.55}}>
                  <Ico n={v} s={34} c={i === 0 ? '#0085FF' : '#94A3B8'} sw={1.9}/>
                </span>
              ))}
              <span style={{width:1, height:40, background:'#E2E8F0', margin:'0 8px'}}/>
              <span style={{display:'inline-flex', alignItems:'center', gap:9, height:52, padding:'0 18px', borderRadius:10, border:'1px solid #E2E8F0'}}>
                <Ico n="filtro" s={22} c="#64748B"/>
                <span className="f-plex" style={{fontSize:20, fontWeight:600, color:'#334155'}}>Filtros</span>
              </span>
              <span style={{flex:1, display:'inline-flex', alignItems:'center', gap:10, height:52, padding:'0 16px', borderRadius:10, border:'1px solid #E2E8F0'}}>
                <Ico n="lupa" s={22} c="#94A3B8"/>
                <span className="f-plex" style={{fontSize:19, color:'#94A3B8'}}>Buscar… (escribe nat: @ tipo: estado: o abiertas)</span>
              </span>
            </div>
            <div style={{display:'flex', alignItems:'center', gap:10, height:60, padding:'0 24px', borderBottom:'1px solid #F1F5F9'}}>
              <span style={{display:'inline-flex', alignItems:'center', gap:8, height:40, padding:'0 16px', borderRadius:20, background:'#DCFCE7'}}>
                <span className="f-plex" style={{fontSize:18, fontWeight:600, color:'#15803D'}}>Abiertas</span>
                <span className="f-plex" style={{fontSize:17, color:'#15803D', opacity:0.55}}>✕</span>
              </span>
            </div>

            {/* La lista: siete huecos de 68 y la caja de alta clavada al pie */}
            <div style={{position:'relative', height:548}}>
              {LISTA.map((f,i)=>{
                const e = Easing.easeOutCubic(clamp((t-0.3-i*T.filaStep)/0.45,0,1));
                const esHero = f.hero && lupaOut < 1;      // la fila que la lupa está ampliando
                return (
                  <div key={f.c} style={{position:'absolute', left:0, right:0, top:i*ROWH, display:'flex', alignItems:'center', gap:16,
                               height:ROWH, padding:'0 24px', borderBottom:'1px solid #EEF2F6',
                               opacity:e*(1-mareaP)*(esHero ? 0.25 : 1)}}>
                    <span style={{width:26, height:26, borderRadius:99, border:'3px solid #94A3B8'}}/>
                    <span className="f-plex" style={{flex:1, fontSize:21, color:'#0F172A'}}>{f.ti}</span>
                    <span className="f-plex" style={{fontSize:16, fontWeight:600, color:f.tc, background:`${f.tc}1A`, borderRadius:7, padding:'4px 10px'}}>{f.tp}</span>
                    <span className="f-plex" style={{width:100, textAlign:'right', fontSize:17, color:'#94A3B8'}}>{f.v}</span>
                    <span className="f-mono" style={{width:86, textAlign:'right', fontSize:17, color:'#94A3B8'}}>{f.c}</span>
                    <img src={`../_engine/assets/avatares/${f.a}.jpg`} alt="" style={{width:34, height:34, borderRadius:99, objectFit:'cover'}}/>
                  </div>
                );
              })}

              {/* La tarea escrita al pie entra en verde cuando se pulsa intro */}
              {t >= T.intro && (
                <div style={{position:'absolute', left:0, right:0, top:6*ROWH, display:'flex', alignItems:'center', gap:16,
                             height:ROWH, padding:'0 24px', background:'rgba(16,185,129,0.10)', borderBottom:'1px solid #EEF2F6',
                             opacity:clamp((t-T.intro)/0.35,0,1)*(1-mareaP),
                             transform:`translateY(${(1-Easing.easeOutBack(clamp((t-T.intro)/0.5,0,1)))*-16}px)`}}>
                  <span style={{width:26, height:26, borderRadius:99, border:'3px solid #94A3B8'}}/>
                  <span className="f-plex" style={{flex:1, fontSize:21, fontWeight:600, color:'#0F172A'}}>Fotos de las cajas de envío</span>
                  <span className="f-plex" style={{fontSize:16, fontWeight:600, color:'#0085FF', background:'rgba(0,133,255,0.10)', borderRadius:7, padding:'4px 10px'}}>Tarea</span>
                  <span className="f-mono" style={{width:86, textAlign:'right', fontSize:17, color:'#94A3B8'}}>NTO-41</span>
                </div>
              )}

              {/* La marea: filas finas, apretadas, ilegibles */}
              {mareaP > 0 && (
                <div style={{position:'absolute', left:0, right:0, top:0, height:548, overflow:'hidden', opacity:mareaP,
                             maskImage:'linear-gradient(180deg,#000 0%,#000 66%,transparent 100%)',
                             WebkitMaskImage:'linear-gradient(180deg,#000 0%,#000 66%,transparent 100%)'}}>
                  {Array.from({length:20}).map((_,i)=>(
                    <div key={i} style={{display:'flex', alignItems:'center', gap:14, height:28, padding:'0 24px',
                                 borderBottom:'1px solid #F1F5F9', opacity:clamp((t-T.doscientas-i*T.marStep)/0.3,0,1)}}>
                      <span style={{width:12, height:12, borderRadius:99, border:'2px solid #CBD5E1'}}/>
                      <span className="f-plex" style={{flex:1, fontSize:15, color:'#475569'}}>{MAREA[i % MAREA.length]}</span>
                      <span className="f-mono" style={{fontSize:13, color:'#CBD5E1'}}>NTO-{100+i}</span>
                    </div>
                  ))}
                </div>
              )}
            </div>
          </div>
        </div>
      </div>

      {/* La caja de alta, clavada al pie de la lista (coordenadas del lienzo). Está desde el
          primer fotograma, como en la app: lo que cambia en T.alta es quién manda en la escena. */}
      <div style={{position:'absolute', left:MX, top:ADDY, width:MW, height:72, display:'flex', alignItems:'center', gap:18,
                   padding:'0 24px', background:'#FBFCFE', borderTop:'1px solid #E2E8F0', borderRadius:'0 0 16px 0',
                   zIndex:26, opacity:lerp(appOp, 1, lupaOut)*(1-mareaP*0.55)}}>
        <span style={{width:26, height:26, borderRadius:99, border:'2px dashed #CBD5E1'}}/>
        <span className="f-plex" style={{flex:1, fontSize:22, color:(t >= T.alta+0.35 && t < T.intro) ? '#0F172A' : '#94A3B8'}}>
          {(t >= T.alta+0.35 && t < T.intro)
            ? <Typewriter text="Fotos de las cajas de envío" start={T.alta+0.35} cps={44} t={t} caret/>
            : 'Agregar Tarea...'}
        </span>
        {t >= T.alta && <KeyCap t={t} label="Intro" start={T.alta+0.2} pressT={T.intro} size={48}/>}
      </div>

      {/* ═════════ LA LUPA · la fila ampliada sobre su propia lista ═════════ */}
      {lupaOut < 1 && (
        <div style={{position:'absolute', left:RX, top:RY, width:RW, height:RH, borderRadius:16,
                     background:'#fff', border:'2px solid #DCE6F2', boxShadow:'0 26px 62px rgba(15,23,42,0.22)',
                     transform:`scale(${lerp(0.96,1,lupaE)*lerp(1,0.94,lupaOut)}) translateY(${lupaOut*-26}px)`,
                     opacity:clamp(lupaP*1.2,0,1)*(1-lupaOut), zIndex:24}}>
          {/* estado: círculo pulsable HASTA que la tarea queda bloqueada; después, candado sin número */}
          <div style={{position:'absolute', left:P.estado-RX-22, top:30, width:44, height:44,
                       display:'flex', alignItems:'center', justifyContent:'center'}}>
            {bloqueada
              ? <span style={{opacity:clamp((t-T.candado)/0.35,0,1), transform:`scale(${lerp(0.6,1,Easing.easeOutBack(clamp((t-T.candado)/0.4,0,1)))})`}}>
                  <Ico n="lock" s={30} c="#94A3B8" sw={2.1}/>
                </span>
              : <span style={{width:34, height:34, borderRadius:99, border:'4px solid #0085FF'}}/>}
          </div>
          <span className="f-plex" style={{position:'absolute', left:P.titulo-RX-280, top:34, width:560, fontSize:30,
                       fontWeight:600, color:'#0F172A', whiteSpace:'nowrap', overflow:'hidden', textOverflow:'ellipsis'}}>
            Importar catálogo del proveedor
          </span>
          <span className="f-plex" style={{position:'absolute', left:P.tipo-RX-52, top:38, fontSize:19, fontWeight:700,
                       color:'#0085FF', background:'rgba(0,133,255,0.10)', borderRadius:8, padding:'6px 14px'}}>Tarea</span>
          {/* segundo candado: MISMA rama, entra a la vez (+0.12 s para que se lea como un gesto) */}
          {bloqueada && (
            <span style={{position:'absolute', left:P.cand-RX-32, top:36, display:'inline-flex', alignItems:'center', gap:6,
                          opacity:clamp((t-T.candado-0.12)/0.35,0,1),
                          transform:`scale(${lerp(0.6,1,Easing.easeOutBack(clamp((t-T.candado-0.12)/0.4,0,1)))})`}}>
              <Ico n="lock" s={26} c="#B45309" sw={2.1}/>
              <span className="f-mono" style={{fontSize:26, fontWeight:800, color:'#B45309',
                       textShadow:(t >= T.cuantas && t < T.cuantas+1.3) ? `0 0 ${Math.sin((t-T.cuantas)/1.3*Math.PI)*20}px rgba(180,83,9,0.85)` : 'none'}}>2</span>
            </span>
          )}
          <span className="f-plex" style={{position:'absolute', left:P.vence-RX-58, top:40, width:116, textAlign:'center',
                       fontSize:21, fontWeight:t >= T.palabras ? 700 : 500,
                       color:t >= T.palabras ? '#B45309' : '#64748B'}}>{t >= T.palabras ? 'Hoy' : 'Mañana'}</span>
          <span className="f-plex" style={{position:'absolute', left:P.prio-RX-40, top:41, width:80, textAlign:'center',
                       fontSize:19, fontWeight:700, color:'#B42318'}}>Alta</span>
          <span className="f-mono" style={{position:'absolute', left:P.clave-RX-44, top:42, width:88, textAlign:'center',
                       fontSize:19, color:'#94A3B8'}}>NTO-21</span>
          <img src={reasignada ? '../_engine/assets/avatares/nuria.jpg' : '../_engine/assets/avatares/javier.jpg'} alt=""
               style={{position:'absolute', left:P.avatar-RX-24, top:28, width:48, height:48, borderRadius:99,
                       objectFit:'cover', border:'2px solid #fff', boxShadow:'0 2px 8px rgba(15,23,42,0.18)'}}/>
          <span style={{position:'absolute', left:P.dots-RX-12, top:40}}><Ico n="dots" s={24} c="#94A3B8"/></span>
        </div>
      )}

      {/* Rótulos del recorrido: uno por beat */}
      <Rotulo cx={P.estado} texto="estado · se pulsa"        from={T.circulo} dur={3.0}/>
      <Rotulo cx={P.estado} texto="espera a otra tarea"      from={T.candado} dur={3.6}/>
      <Rotulo cx={P.titulo} texto="título"                   from={T.titulo}  dur={2.2}/>
      <Rotulo cx={P.tipo}   texto="tipo"                     from={T.tipo}    dur={2.2}/>
      <Rotulo cx={P.cand}   texto="cuántas van antes"        from={T.candado2} dur={2.2}/>
      <Rotulo cx={P.vence}  texto="vencimiento, en palabras" from={T.vence}   dur={3.4}/>
      <Rotulo cx={P.avatar} texto="quién la lleva"           from={T.avatar}  dur={2.0}/>
      <Rotulo cx={P.dots-100} texto="el mismo menú que el botón derecho" from={T.puntos} dur={3.2}/>

      <Halo from={T.circulo}  x={P.estado-32}  y={RY+22} w={64}  h={60} r={16}/>
      <Halo from={T.titulo}   x={P.titulo-296} y={RY+24} w={592} h={56} dur={2.0}/>
      <Halo from={T.tipo}     x={P.tipo-70}    y={RY+28} w={140} h={48} dur={2.0}/>
      <Halo from={T.candado2} x={P.cand-52}    y={RY+26} w={104} h={52} dur={2.4} color="#D97706"/>
      <Halo from={T.vence}    x={P.vence-70}   y={RY+28} w={140} h={48} dur={3.2}/>
      <Halo from={T.avatar}   x={P.avatar-34}  y={RY+20} w={68}  h={64} r={99} dur={2.0}/>

      {/* ── El desplegable de estados: se abre al pulsar el círculo y se cierra al bloquearse ── */}
      {(()=>{
        const p = clamp((t-T.flujo)/0.4,0,1), out = clamp((t-T.espera)/0.4,0,1);
        if (p <= 0 || out >= 1) return null;
        const e = Easing.easeOutBack(p);
        return (
          <div style={{position:'absolute', left:P.estado-26, top:RY+RH+12, width:300, zIndex:36,
                       opacity:p*(1-out), transform:`translateY(${(1-e)*-12}px) scale(${lerp(0.9,1,e)})`, transformOrigin:'top left'}}>
            <div style={{background:'#fff', borderRadius:14, border:'1px solid #E2E8F0', boxShadow:'0 22px 52px rgba(15,23,42,0.22)', padding:'10px 0'}}>
              {ESTADOS.map((s,i)=>(
                <div key={s} style={{display:'flex', alignItems:'center', gap:12, padding:'11px 20px',
                             opacity:clamp((t-T.flujo-i*T.opcStep)/0.25,0,1)}}>
                  <span style={{width:16, height:16, borderRadius:99, background:['#94A3B8','#0085FF','#F59E0B','#10B981'][i]}}/>
                  <span className="f-plex" style={{fontSize:22, color:'#334155', fontWeight:i === 0 ? 700 : 500}}>{s}</span>
                </div>
              ))}
            </div>
          </div>
        );
      })()}

      {/* «Desde aquí ya no cambias el estado»: el mismo desplegable, en gris y tachado */}
      {(()=>{
        const p = clamp((t-T.noestado)/0.4,0,1), out = clamp((t-T.noestado-2.4)/0.4,0,1);
        if (p <= 0 || out >= 1) return null;
        const tacha = Easing.easeInOutCubic(clamp((t-T.noestado-0.3)/0.55,0,1));
        return (
          <div style={{position:'absolute', left:P.estado-26, top:RY+RH+12, width:300, zIndex:36, opacity:p*(1-out)}}>
            <div style={{position:'relative', background:'#F8FAFC', borderRadius:14, border:'1px dashed #CBD5E1', padding:'10px 0'}}>
              {ESTADOS.map(s=>(
                <div key={s} style={{padding:'11px 20px'}}>
                  <span className="f-plex" style={{fontSize:22, color:'#CBD5E1'}}>{s}</span>
                </div>
              ))}
              <span style={{position:'absolute', left:16, right:16, top:'50%', height:4, borderRadius:2, background:'#EF4444',
                            transformOrigin:'left', transform:`scaleX(${tacha})`}}/>
            </div>
            <div className="f-plex" style={{fontSize:22, fontWeight:700, color:'#B42318', marginTop:14}}>ni se abre</div>
          </div>
        );
      })()}

      {/* «hoy, mañana, ayer»: el vocabulario de las fechas cercanas */}
      {(()=>{
        const p = clamp((t-T.palabras)/0.4,0,1), out = clamp((t-T.palabras-2.4)/0.4,0,1);
        if (p <= 0 || out >= 1) return null;
        return (
          <div style={{position:'absolute', left:P.vence-160, top:RY+RH+22, width:320, display:'flex', gap:10,
                       justifyContent:'center', zIndex:34, opacity:p*(1-out)}}>
            {['Hoy','Mañana','Ayer'].map((w,i)=>(
              <span key={w} style={{padding:'9px 18px', borderRadius:20, background:'#FEF3C7',
                        opacity:clamp((t-T.palabras-i*0.14)/0.25,0,1),
                        transform:`translateY(${(1-Easing.easeOutBack(clamp((t-T.palabras-i*0.14)/0.35,0,1)))*10}px)`}}>
                <span className="f-plex" style={{fontSize:22, fontWeight:700, color:'#B45309'}}>{w}</span>
              </span>
            ))}
          </div>
        );
      })()}

      {/* «La pulsas, eliges a otra»: el buscador de miembros, sin abrir la tarea */}
      {(()=>{
        const p = clamp((t-T.reasigna)/0.4,0,1), out = clamp((t-T.reasigna-2.9)/0.4,0,1);
        if (p <= 0 || out >= 1) return null;
        const e = Easing.easeOutBack(p);
        return (
          <div style={{position:'absolute', left:P.avatar-190, top:RY+RH+14, width:320, zIndex:36,
                       opacity:p*(1-out), transform:`translateY(${(1-e)*-12}px) scale(${lerp(0.92,1,e)})`, transformOrigin:'top right'}}>
            <div style={{background:'#fff', borderRadius:14, border:'1px solid #E2E8F0', boxShadow:'0 22px 52px rgba(15,23,42,0.22)', padding:12}}>
              <div style={{display:'flex', alignItems:'center', gap:10, height:44, padding:'0 12px', borderRadius:9, background:'#F1F5F9'}}>
                <Ico n="lupa" s={19} c="#94A3B8"/>
                <span className="f-plex" style={{fontSize:19, color:'#94A3B8'}}>Buscar miembro…</span>
              </div>
              {MIEMBROS.map((m,i)=>{
                const elegida = i === 1 && t >= T.reasigna+0.95;
                return (
                  <div key={m.n} style={{display:'flex', alignItems:'center', gap:12, padding:'10px 12px', borderRadius:9, marginTop:4,
                               background:elegida ? 'rgba(16,185,129,0.12)' : 'transparent',
                               opacity:clamp((t-T.reasigna-0.12-i*0.08)/0.25,0,1)}}>
                    <img src={m.f} alt="" style={{width:34, height:34, borderRadius:99, objectFit:'cover'}}/>
                    <span className="f-plex" style={{flex:1, fontSize:21, color:'#334155', fontWeight:elegida ? 700 : 500}}>{m.n}</span>
                    {elegida && <Ico n="check" s={22} c="#059669" sw={2.6}/>}
                  </div>
                );
              })}
            </div>
          </div>
        );
      })()}

      {/* «Los tres puntos»: el mismo menú que el botón derecho, con sus opciones literales */}
      {(()=>{
        const p = clamp((t-T.puntos)/0.4,0,1), out = clamp((t-T.puntos-3.1)/0.4,0,1);
        if (p <= 0 || out >= 1) return null;
        const e = Easing.easeOutBack(p);
        return (
          <div style={{position:'absolute', left:P.dots-292, top:RY+RH+14, width:320, zIndex:36,
                       opacity:p*(1-out), transform:`translateY(${(1-e)*-12}px) scale(${lerp(0.92,1,e)})`, transformOrigin:'top right'}}>
            <div style={{background:'#fff', borderRadius:14, border:'1px solid #E2E8F0', boxShadow:'0 22px 52px rgba(15,23,42,0.22)', padding:'8px 0'}}>
              {MENU.map((m,i)=>(
                <div key={m} style={{padding:'9px 20px', opacity:clamp((t-T.puntos-i*T.opcStep)/0.22,0,1)}}>
                  <span className="f-plex" style={{fontSize:20, color:m === 'Eliminar' ? '#B42318' : '#334155'}}>{m}</span>
                </div>
              ))}
            </div>
          </div>
        );
      })()}

      {/* El recuento: veinte -> doscientas */}
      {t >= T.veinte && t < T.arriba+0.9 && (
        <div style={{position:'absolute', left:0, right:0, top:236, textAlign:'center', zIndex:44,
                     opacity:clamp((t-T.veinte)/0.4,0,1)*clamp((T.arriba+0.9-t)/0.5,0,1)}}>
          <span style={{display:'inline-flex', alignItems:'baseline', gap:16, padding:'16px 34px', borderRadius:18,
                        background:'#fff', border:'1px solid #E2E8F0', boxShadow:'0 20px 48px rgba(15,23,42,0.20)'}}>
            <span className="f-plex" style={{fontSize:76, fontWeight:800, lineHeight:1,
                     color:mareaP > 0.3 ? '#B42318' : '#0085FF'}}>{cuenta}</span>
            <span className="f-plex" style={{fontSize:30, fontWeight:600, color:'#334155'}}>tareas en la lista</span>
          </span>
        </div>
      )}

      {/* «Mira arriba»: la barra de filtros se enciende — puente a la escena 3 */}
      {t >= T.arriba && (
        <div style={{position:'absolute', left:MX-6, top:HDR-6, width:MW+12, height:96, borderRadius:14, zIndex:46,
                     border:'3px solid #0085FF', boxShadow:'0 0 48px rgba(0,133,255,0.45)', pointerEvents:'none',
                     opacity:clamp((t-T.arriba)/0.35,0,1), transform:`scale(${lerp(1.04,1,arribaE)})`}}>
          <span style={{position:'absolute', left:'50%', top:-64, transform:'translateX(-50%)'}}>
            <Ico n="flecha" s={44} c="#0085FF" sw={2.6}/>
          </span>
        </div>
      )}

      <ScriptedCursor t={t} clickTimes={[T.pulsas, T.reasigna, T.puntos]} frames={[
        { t:0,             x:1830, y:1050 },
        { t:T.circulo-0.4, x:1830, y:1050 },
        { t:T.pulsas,      x:P.estado, y:RY+52 },
        { t:T.espera,      x:P.estado, y:RY+52 },
        { t:T.avatar,      x:P.avatar, y:RY+52 },
        { t:T.reasigna,    x:P.avatar, y:RY+52 },
        { t:T.puntos,      x:P.dots,   y:RY+52 },
        { t:T.alta,        x:P.dots,   y:RY+52 },
        { t:T.alta+0.7,    x:MX+300,   y:ADDY+36 },
        { t:T.veinte,      x:MX+300,   y:ADDY+36 },
        { t:T.veinte+0.8,  x:1830, y:1050 },
      ]}/>
    </SlideCanvas>
  );
}
Object.assign(window, { EscenaTV02 });
