// === Escena 04 — "Quién construye el cuadro"  [CLÍMAX] ===
// Se abre el SEGUNDO documento: el que la factura incluye («Factura JSON», carpeta API,
// clase FacturaJSON__2C — DOCD\API\Factura JSON.vb:246). Barra de título «Editor documento
// dinámico» (rama de edición, TERM\FuncionAPIF.vb:420), pestaña «Código», leyenda literal del
// pie en :431. El patrón que se dibuja es el de :226-228 — el que rellena el campo que la
// escena 3 dejó vacío. NO se dibuja el de Factura - Dinaup (:453-464): ese escribe la imagen en
// el HTML y nunca toca resumen.VerifactuQR, así que desconectaría el clímax de su valle.
// Los cuatro argumentos reales NO son recuperables del repo (volcado roto): se pintan como
// marcadores con el nombre del PARÁMETRO, que sí está anclado (nif, numserie, fecha, importe —
// FN-ES\Funciones nombre ingles.vb:4530-4538). La URL es la de ValidarQR de la sede, con esos
// cuatro y ninguno más (FN-VB\c_Funciones_VB.vb:1283-1285); dos destinos, pruebas y producción
// (:1273-1287). «hash» y «firma» se rotulan «no van dentro del cuadro» — nunca «no existen»:
// existen fuera, en el servidor (VSRV\VerifactuService.vb:297, 310-314, 345-348).
function EscenaPL04({ t }){
  const T = {
    abrimos:0.1,      // "Abrimos ese otro documento"
    sube:2.6,         // "Sube el código"
    lineaFalta:3.9,   // "aparece la línea que faltaba"
    condicion:6.4,    // "Primero, una condición"
    cumplimiento:8.6, // "el sistema de cumplimiento"
    unaLinea:13.1,    // "una sola línea"
    cuatroDatos:15.3, // "cuatro datos, ni uno más"
    d1:17.9,          // "La identificación fiscal"
    d2:21.0,          // "El número de serie"
    d3:23.7,          // "La fecha."
    d4:25.2,          // "Y el importe."
    enlace:27.8,      // "se monta un enlace a la sede"
    dibuja:30.7,      // "el enlace se dibuja como cuadro"
    sello:33.8,       // "no hay ningún sello"
    firma:35.8,       // "No hay ninguna firma"
    entornos:39.7,    // "una para pruebas, otra para producción"
    ejecuta:42.8,     // "Se ejecuta."
    momento:44.6,     // "el cuadro aparece en la esquina"
    escribes:49.6,    // "La escribes tú."
    unica1:51.5,      // "El documento es una plantilla tuya"
    unica2:56.1,      // "no sale impreso"
    salida:60.5,      // "Ahora, en el navegador"
    urlSpeed:34,       // caracteres por segundo del enlace que se escribe
  };

  // ── Geometría ──
  const WX=60, WY=120, WW=1360, WH=920;
  const CX=96, CY=236, CW=1288, CH=404;   // visor del bloque de código
  const DY=656;                            // fila de los cuatro datos
  const PY=776, PH=224;                    // panel del enlace
  const RX=1460, RW=400;                   // la factura, en pequeño, a la derecha

  // ── Progresos ──
  const abP = clamp((t-T.abrimos)/0.8,0,1), abE = Easing.easeOutCubic(abP);
  const suP = clamp((t-T.sube)/0.9,0,1), suE = Easing.easeOutCubic(suP);
  const lfP = clamp((t-T.lineaFalta)/0.6,0,1);
  const cdOn = t >= T.condicion;
  const cuOn = t >= T.cumplimiento;
  const ulOn = t >= T.unaLinea;
  const c4P = clamp((t-T.cuatroDatos)/0.5,0,1), c4E = Easing.easeOutBack(c4P);
  const DATOS = [
    { t:T.d1, n:'nif' }, { t:T.d2, n:'numserie' }, { t:T.d3, n:'fecha' }, { t:T.d4, n:'importe' },
  ];
  const puestos = DATOS.filter(d => t >= d.t).length;

  const enP = clamp((t-T.enlace)/0.5,0,1), enE = Easing.easeOutCubic(enP);
  const diGlow = t >= T.dibuja && t < T.dibuja+1.4 ? Math.sin((t-T.dibuja)/1.4*Math.PI) : 0;
  const seP = clamp((t-T.sello)/0.5,0,1);
  const fiP = clamp((t-T.firma)/0.5,0,1);
  const etP = clamp((t-T.entornos)/0.55,0,1), etE = Easing.easeOutBack(etP);
  const prod = t >= T.entornos + 1.35;                 // se enciende la de producción

  // La factura vuelve en pequeño durante la calma, y el cuadro aterriza en su esquina
  const mfP = clamp((t-T.ejecuta)/0.6,0,1), mfE = Easing.easeOutCubic(mfP);
  const qrP = clamp((t-T.momento)/0.7,0,1), qrE = Easing.easeOutBack(qrP);
  const qrGlow = t >= T.momento && t < T.momento+1.6 ? Math.sin((t-T.momento)/1.6*Math.PI) : 0;

  // «La escribes tú»: la línea se queda encendida en azul y todo lo demás baja al 0,45
  const esP = clamp((t-T.escribes)/0.6,0,1);
  const atenuaEs = 1 - esP*0.55;

  // La Única Cosa · PRUEBA
  const veloIn  = clamp((t-T.unica1)/0.7,0,1);
  const veloOut = clamp((t-(T.salida-0.7))/0.5,0,1);
  const veloOp  = veloIn*(1-veloOut)*0.93;
  const u1E = Easing.easeOutCubic(clamp((t-T.unica1)/0.6,0,1));
  const u2E = Easing.easeOutCubic(clamp((t-T.unica2)/0.6,0,1));

  // Cortinilla Terminal → play (parametrizada: se reutiliza en las demás piezas del área)
  const coP = clamp((t-T.salida)/1.1,0,1), coE = Easing.easeInOutCubic(coP);

  const URL_BASE  = 'https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR';
  const URL_QUERY = '?nif=…&numserie=…&fecha=…&importe=…';

  // ── El bloque de código ──
  const Bar = ({ y, w })=>(
    <div style={{position:'absolute', left:22, top:y+13, width:w, height:13, borderRadius:7, background:'#3B4759', opacity:0.55}}/>
  );
  // Marcador de argumento: el volcado del repo no trae el argumento real, así que
  // el hueco se queda numerado y el nombre del parámetro (que sí está anclado) va debajo.
  const Slot = ({ i })=>{
    const on = t >= DATOS[i].t;
    const p = clamp((t-DATOS[i].t)/0.4,0,1), e = Easing.easeOutBack(p);
    return (
      <span style={{display:'inline-block', transform:on ? `scale(${lerp(0.7,1,e)})` : 'none',
                    color: on ? '#38BDF8' : '#7C8798', fontWeight:on ? 700 : 400}}>{'‹'+(i+1)+'›'}</span>
    );
  };

  return (
    <SlideCanvas variant="light">
      {/* Eyebrow + de qué documento hablamos */}
      <div className="f-plex" style={{position:'absolute', left:62, top:50, fontSize:18, fontWeight:700, letterSpacing:'3px',
                                      color:'#0085FF', opacity:clamp(t/0.5,0,1)}}>
        QUIÉN CONSTRUYE EL CUADRO
      </div>
      <div style={{position:'absolute', right:60, top:40, opacity:clamp((t-0.3)/0.6,0,1)}}>
        <span className="f-plex" style={{display:'inline-flex', alignItems:'center', gap:12, padding:'10px 20px', borderRadius:12,
                      background:'#fff', border:'1px solid #E2E8F0', boxShadow:'0 8px 22px rgba(15,23,42,0.08)', fontSize:19, color:'#64748B'}}>
          el documento que la factura incluye
          <span className="f-mono" style={{fontSize:20, fontWeight:700, color:'#0F172A'}}>Factura JSON</span>
        </span>
      </div>

      {/* ─────────── El segundo editor ─────────── */}
      {abP > 0 && (
        <div style={{position:'absolute', left:WX, top:WY, width:WW, height:WH,
                     opacity:clamp(abP*1.4,0,1)*atenuaEs, transform:`translateX(${(1-abE)*70}px)`,
                     filter:esP > 0 ? 'saturate(0.7)' : 'none'}}>
          <div style={{position:'absolute', inset:0, background:'#1B2430', borderRadius:14,
                       border:'1px solid #45484F', boxShadow:'0 44px 100px rgba(2,6,23,0.55)', overflow:'hidden'}}>
            <div style={{position:'absolute', left:0, right:0, top:0, height:64, background:'linear-gradient(180deg,#2C2E33,#25272B)',
                         borderBottom:'1px solid #3C3F45', display:'flex', alignItems:'center', gap:15, padding:'0 18px'}}>
              <div style={{width:36, height:36, borderRadius:9, background:'linear-gradient(135deg,#0085FF,#0063BE)',
                           display:'flex', alignItems:'center', justifyContent:'center'}}>
                <svg width="19" height="19" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="1.9">
                  <path d="M6 3 H14 L19 8 V21 H6 Z" strokeLinejoin="round"/><path d="M14 3 V8 H19"/>
                </svg>
              </div>
              <span className="f-plex" style={{fontSize:28, fontWeight:700, color:'#F2F5F9'}}>Editor documento dinámico</span>
              <div style={{flex:1}}/>
              <div style={{display:'flex', gap:24, opacity:0.65}}>
                <svg width="15" height="15" viewBox="0 0 16 16"><path d="M2 8 H14" stroke="#A9B0BA" strokeWidth="1.6"/></svg>
                <svg width="15" height="15" viewBox="0 0 16 16"><rect x="2.5" y="2.5" width="11" height="11" fill="none" stroke="#A9B0BA" strokeWidth="1.6"/></svg>
                <svg width="15" height="15" viewBox="0 0 16 16"><path d="M3 3 L13 13 M13 3 L3 13" stroke="#A9B0BA" strokeWidth="1.6"/></svg>
              </div>
            </div>
            <div style={{position:'absolute', left:0, right:0, top:64, height:52, background:'#2A2C30',
                         borderBottom:'1px solid #3C3F45', display:'flex', alignItems:'flex-end', gap:2, padding:'0 18px'}}>
              {['Básico','Variables','Código','Previa'].map((s,i)=>(
                <span key={s} className="f-plex" style={{padding:'11px 28px', fontSize:21, fontWeight:i===2?700:500,
                              color:i===2?'#F2F5F9':'#8C939E', background:i===2?'#1B2430':'transparent',
                              borderTop:`3px solid ${i===2?'#0085FF':'transparent'}`, borderRadius:'6px 6px 0 0'}}>{s}</span>
              ))}
            </div>
            {/* leyenda literal del pie de la pestaña de código */}
            <div className="f-mono" style={{position:'absolute', left:0, right:0, bottom:0, height:40, background:'#161E28',
                          borderTop:'1px solid #2B3644', display:'flex', alignItems:'center', padding:'0 36px',
                          fontSize:17, color:'#6E7C8E', letterSpacing:'0.02em'}}>
              S = Sistema | F = Funciones | D = Datos Especiales | G = Configuración
            </div>
          </div>
        </div>
      )}

      {/* ─────────── El código que sube ─────────── */}
      {suP > 0 && (
        <div style={{position:'absolute', left:CX, top:CY, width:CW, height:CH, overflow:'hidden',
                     opacity:clamp(suP*1.5,0,1), borderRadius:10, background:'#1B2430',
                     boxShadow:esP > 0 ? `0 0 ${esP*70}px rgba(0,133,255,0.55)` : 'none'}}>
          <div style={{position:'absolute', left:0, right:0, top:0, transform:`translateY(${(1-suE)*120}px)`}}>
            <Bar y={8} w={760}/><Bar y={48} w={560}/><Bar y={88} w={880}/>

            {/* if ‹campo› = S.Enums.cumplimientosistema.verifactu */}
            <div className="f-mono" style={{position:'absolute', left:22, top:132, fontSize:28, lineHeight:'40px',
                          opacity:lfP > 0 ? (cdOn ? 1 : 0.62) : 0.25, whiteSpace:'pre',
                          background:cdOn && !ulOn ? 'rgba(0,133,255,0.12)' : 'transparent', borderRadius:6, padding:'2px 8px'}}>
              <span style={{color:'#C792EA', fontWeight:700}}>if</span>
              <span style={{color:'#94A3B8'}}>  ‹campo›  </span>
              <span style={{color:'#E2E8F0'}}>= </span>
              <span style={{color:cuOn ? '#56E16A' : '#7C8798', fontWeight:cuOn?700:400,
                            borderBottom:cuOn ? '3px solid #56E16A' : 'none', paddingBottom:2}}>S.Enums.cumplimientosistema.verifactu</span>
            </div>

            {/* F.DataTable_SetValue(v.TablaResumen, v.C_VerifactuQR, */}
            <div className="f-mono" style={{position:'absolute', left:22, top:182, fontSize:28, lineHeight:'40px', whiteSpace:'pre',
                          opacity:lfP > 0 ? (ulOn ? 1 : 0.55) : 0,
                          background:ulOn ? `rgba(0,133,255,${esP > 0 ? 0.22 : 0.14})` : 'transparent',
                          borderRadius:'6px 6px 0 0', padding:'2px 8px'}}>
              <span style={{color:'#94A3B8'}}>    </span>
              <span style={{color:esP > 0 ? '#38BDF8' : '#E2E8F0', fontWeight:700}}>F.DataTable_SetValue</span>
              <span style={{color:'#E2E8F0'}}>(</span>
              <span style={{color:'#FFCB6B'}}>v.TablaResumen</span>
              <span style={{color:'#E2E8F0'}}>, </span>
              <span style={{color:'#FB8C00', fontWeight:700}}>v.C_VerifactuQR</span>
              <span style={{color:'#E2E8F0'}}>,</span>
            </div>

            {/* F.BuildQR_Verifactu( ‹1› , ‹2› , ‹3› , ‹4› )) */}
            <div className="f-mono" style={{position:'absolute', left:22, top:228, fontSize:28, lineHeight:'40px', whiteSpace:'pre',
                          opacity:lfP > 0 ? (ulOn ? 1 : 0.55) : 0,
                          background:ulOn ? `rgba(0,133,255,${esP > 0 ? 0.22 : 0.14})` : 'transparent',
                          borderRadius:'0 0 6px 6px', padding:'2px 8px'}}>
              <span style={{color:'#94A3B8'}}>{'          '}</span>
              <span style={{color:esP > 0 ? '#38BDF8' : '#E2E8F0', fontWeight:700}}>F.BuildQR_Verifactu</span>
              <span style={{color:'#E2E8F0'}}>(</span>
              <Slot i={0}/><span style={{color:'#E2E8F0'}}>, </span>
              <Slot i={1}/><span style={{color:'#E2E8F0'}}>, </span>
              <Slot i={2}/><span style={{color:'#E2E8F0'}}>, </span>
              <Slot i={3}/><span style={{color:'#E2E8F0'}}>))</span>
            </div>

            <div className="f-mono" style={{position:'absolute', left:22, top:278, fontSize:28, lineHeight:'40px',
                          color:'#C792EA', fontWeight:700, opacity:lfP > 0 ? (cdOn ? 0.85 : 0.5) : 0.25}}>end if</div>

            <Bar y={330} w={680}/><Bar y={370} w={820}/><Bar y={410} w={500}/>
          </div>

          {/* el marco de la línea que faltaba */}
          {lfP > 0 && (
            <div style={{position:'absolute', left:12, top:(1-suE)*120+124, width:CW-24, height:196, borderRadius:10,
                         border:'2px solid rgba(0,133,255,0.45)', opacity:lfP*(ulOn?1:0.5), pointerEvents:'none'}}/>
          )}
        </div>
      )}

      {/* ─────────── Los cuatro datos: uno por hueco, ni uno más ─────────── */}
      {c4P > 0 && (
        <div style={{position:'absolute', left:CX, top:DY, width:CW, height:104,
                     opacity:clamp(c4P*1.3,0,1)*atenuaEs}}>
          <div style={{position:'absolute', left:24, top:0, display:'flex', alignItems:'baseline', gap:14,
                       transform:`scale(${lerp(0.85,1,c4E)})`, transformOrigin:'left top'}}>
            <span className="f-plex" style={{fontSize:76, fontWeight:800, color:'#0085FF', lineHeight:1}}>{puestos}</span>
            <span style={{display:'inline-block', lineHeight:1.25}}>
              <span className="f-mono" style={{display:'block', fontSize:16, letterSpacing:'2.4px', color:'#64748B', fontWeight:700}}>PARÁMETROS</span>
              <span className="f-plex" style={{display:'block', fontSize:20, color:'#94A3B8'}}>y ninguno más</span>
            </span>
          </div>
          {DATOS.map((d,i)=>{
            const p = clamp((t-d.t)/0.45,0,1), e = Easing.easeOutBack(p);
            return (
              <div key={d.n} style={{position:'absolute', left:392+i*226, top:12, width:210, height:60, borderRadius:10,
                            background:p > 0 ? 'rgba(0,133,255,0.10)' : '#F1F5F9',
                            border:`2px ${p > 0 ? 'solid #0085FF' : 'dashed #CBD5E1'}`,
                            display:'flex', alignItems:'center', gap:12, padding:'0 16px',
                            opacity:p > 0 ? clamp(p*1.3,0,1) : 0.5, transform:`scale(${p > 0 ? lerp(0.82,1,e) : 1})`}}>
                <span className="f-mono" style={{fontSize:20, fontWeight:700, color:p > 0 ? '#0085FF' : '#94A3B8'}}>{'‹'+(i+1)+'›'}</span>
                <span className="f-mono" style={{fontSize:23, fontWeight:700, color:p > 0 ? '#0F172A' : '#CBD5E1'}}>{p > 0 ? d.n : '—'}</span>
              </div>
            );
          })}
        </div>
      )}

      {/* ─────────── El panel del enlace ─────────── */}
      {seP > 0 || enP > 0 ? (
        <div style={{position:'absolute', left:CX, top:PY, width:CW, height:PH, opacity:atenuaEs}}>
          {/* los dos sellos que NO viajan dentro del cuadro */}
          {seP > 0 && (
            <div style={{position:'absolute', left:24, top:10, display:'flex', alignItems:'center', gap:18, opacity:seP}}>
              {['hash','firma'].map((s,i)=>{
                const p = i === 0 ? seP : fiP;
                const tacha = Easing.easeInOutCubic(clamp((t-(i===0?T.sello:T.firma)-0.1)/0.5,0,1));
                if (p <= 0) return null;
                return (
                  <span key={s} style={{position:'relative', display:'inline-block', padding:'8px 20px', borderRadius:8,
                                        background:'#EEF1F5', border:'1px solid #CBD5E1', opacity:p}}>
                    <span className="f-mono" style={{fontSize:22, color:'#94A3B8'}}>{s}</span>
                    <span style={{position:'absolute', left:8, right:8, top:'50%', height:3, borderRadius:2, background:'#94A3B8',
                                  transform:`scaleX(${tacha})`, transformOrigin:'left'}}/>
                  </span>
                );
              })}
              <span className="f-plex" style={{fontSize:21, fontWeight:600, color:'#64748B'}}>no van dentro del cuadro</span>
            </div>
          )}

          {/* el enlace, escrito carácter a carácter */}
          {enP > 0 && (
            <div style={{position:'absolute', left:24, top:70, width:CW-48, opacity:clamp(enP*1.3,0,1),
                         transform:`translateY(${(1-enE)*10}px)`}}>
              <div style={{padding:'15px 20px', borderRadius:10, background:'#0F172A',
                           boxShadow:diGlow > 0 ? `0 0 ${diGlow*40}px rgba(0,133,255,0.55)` : 'none'}}>
                <div className="f-mono" style={{fontSize:20, color:'#93B7DB', lineHeight:1.5, whiteSpace:'nowrap', overflow:'hidden'}}>
                  <Typewriter text={URL_BASE} start={T.enlace} cps={T.urlSpeed} t={t}/>
                  <span style={{color:'#FFCB6B'}}>
                    <Typewriter text={URL_QUERY} start={T.enlace + URL_BASE.length/T.urlSpeed} cps={T.urlSpeed} t={t} caret/>
                  </span>
                </div>
              </div>
            </div>
          )}

          {/* dos destinos: pruebas y producción */}
          {etP > 0 && (
            <div style={{position:'absolute', left:24, top:146, display:'flex', gap:18, opacity:clamp(etP*1.3,0,1),
                         transform:`translateY(${(1-etE)*10}px)`}}>
              {[['pruebas','prewww2.aeat.es'], ['producción','www2.agenciatributaria.gob.es']].map((d,i)=>{
                const on = prod ? i === 1 : i === 0;
                return (
                  <span key={d[0]} style={{display:'inline-flex', alignItems:'center', gap:12, padding:'11px 20px', borderRadius:10,
                                background:on ? 'rgba(0,133,255,0.10)' : '#F1F5F9',
                                border:`2px solid ${on ? '#0085FF' : '#E2E8F0'}`}}>
                    <span style={{width:11, height:11, borderRadius:99, background:on ? '#0085FF' : '#CBD5E1'}}/>
                    <span className="f-plex" style={{fontSize:20, fontWeight:700, color:on ? '#0F172A' : '#94A3B8'}}>{d[0]}</span>
                    <span className="f-mono" style={{fontSize:19, color:on ? '#0085FF' : '#B6BDC8'}}>{d[1]}</span>
                  </span>
                );
              })}
            </div>
          )}
        </div>
      ) : null}

      {/* ─────────── La factura vuelve en pequeño, y el cuadro aterriza ─────────── */}
      {mfP > 0 && (
        <div style={{position:'absolute', left:RX, top:290, width:RW, height:600,
                     opacity:clamp(mfP*1.4,0,1)*atenuaEs, transform:`translateX(${(1-mfE)*40}px)`}}>
          <div style={{position:'absolute', inset:0, background:'#fff', borderRadius:8,
                       boxShadow:'0 26px 64px rgba(15,23,42,0.20)', border:'1px solid #E2E8F0', padding:'22px 24px'}}>
            <div className="f-plex" style={{fontSize:24, fontWeight:800, color:'#0F172A'}}>FACTURA</div>
            <div className="f-mono" style={{fontSize:16, color:'#64748B', marginTop:3}}>V-2026-0184 · 12/08/2026</div>
            <div style={{marginTop:16}}>
              {[92,74,86,62].map((w,i)=>(
                <div key={i} style={{display:'flex', gap:10, alignItems:'center', padding:'7px 0', borderBottom:'1px solid #F4F7FA'}}>
                  <div style={{height:9, width:`${w*0.6}%`, borderRadius:5, background:'#E2E8F0'}}/>
                  <div style={{flex:1}}/>
                  <div style={{height:9, width:56, borderRadius:5, background:'#CBD5E1'}}/>
                </div>
              ))}
            </div>
            <div style={{marginTop:14, display:'flex', justifyContent:'space-between', alignItems:'baseline'}}>
              <span className="f-plex" style={{fontSize:15, letterSpacing:'2px', color:'#94A3B8', fontWeight:700}}>TOTAL</span>
              <span className="f-mono" style={{fontSize:26, fontWeight:800, color:'#0F172A'}}>875,83 €</span>
            </div>
            {/* la esquina: el hueco de la escena 3 y, ahora, el cuadro */}
            <div style={{position:'absolute', right:24, bottom:26, width:170, textAlign:'center'}}>
              <div style={{position:'relative', width:150, height:150, marginLeft:10, borderRadius:8,
                           border:qrP > 0 ? '1px solid #E2E8F0' : '3px dashed #FB8C00',
                           background:'#fff', overflow:'hidden',
                           boxShadow:qrGlow > 0 ? `0 0 ${qrGlow*46}px rgba(16,185,129,0.7)` : 'none',
                           transform:`scale(${qrP > 0 ? lerp(0.55,1,qrE) : 1})`}}>
                {qrP > 0 && (
                  <svg width="150" height="150" viewBox="0 0 21 21" style={{display:'block', opacity:clamp(qrP*1.6,0,1)}}>
                    <rect width="21" height="21" fill="#fff"/>
                    {Array.from({length:21}).map((_,y)=>Array.from({length:21}).map((_,x)=>{
                      const finder = (x<7&&y<7)||(x>13&&y<7)||(x<7&&y>13);
                      const ring = finder && (x%7===0||y%7===0||x%7===6||y%7===6||(x%7>=2&&x%7<=4&&y%7>=2&&y%7<=4));
                      const on = finder ? ring : ((x*7 + y*13 + ((x*y)%5)) % 5) < 2;
                      return on ? <rect key={x+'-'+y} x={x} y={y} width="1" height="1" fill="#0F172A"/> : null;
                    }))}
                  </svg>
                )}
              </div>
              {qrP > 0 && (
                <div className="f-plex" style={{fontSize:15, fontWeight:700, color:'#334155', marginTop:8, opacity:clamp((t-T.momento-0.35)/0.5,0,1)}}>
                  ✔erifactu • Dinaup
                </div>
              )}
            </div>
          </div>
        </div>
      )}

      {/* ─────────── La Única Cosa · PRUEBA ─────────── */}
      {veloOp > 0 && <div style={{position:'absolute', inset:0, background:'#fff', opacity:veloOp}}/>}
      {t >= T.unica1 && (
        <div className="f-plex" style={{position:'absolute', left:0, right:0, top:400, textAlign:'center', fontSize:74, fontWeight:800,
                                        letterSpacing:'-0.03em', color:'#0F172A',
                                        opacity:clamp((t-T.unica1)/0.6,0,1)*(1-veloOut), transform:`translateY(${(1-u1E)*18}px)`}}>
          El documento es una plantilla tuya.
        </div>
      )}
      {t >= T.unica2 && (
        <div className="f-plex" style={{position:'absolute', left:0, right:0, top:514, textAlign:'center', fontSize:74, fontWeight:800,
                                        letterSpacing:'-0.03em', opacity:clamp((t-T.unica2)/0.6,0,1)*(1-veloOut),
                                        transform:`translateY(${(1-u2E)*18}px)`}}>
          <span className="grad-text">Lo que no escribas en ella, no sale impreso.</span>
        </div>
      )}

      {/* ─────────── Cortinilla: del escritorio al navegador ─────────── */}
      {coP > 0 && (
        <div style={{position:'absolute', inset:0, overflow:'hidden', pointerEvents:'none'}}>
          <div style={{position:'absolute', top:0, bottom:0, left:`${(1-coE)*100}%`, width:'100%',
                       background:'linear-gradient(120deg,#0B1220 0%,#132030 100%)'}}>
            <div style={{position:'absolute', left:0, top:0, bottom:0, width:10,
                         background:'linear-gradient(180deg,#00C1FF,#FF6751 33%,#56E16A 66%,#FFDC18)'}}/>
            <div style={{position:'absolute', left:0, right:0, top:452, display:'flex', alignItems:'center', justifyContent:'center', gap:36}}>
              <span className="f-mono" style={{fontSize:26, fontWeight:700, letterSpacing:'3px', color:'#64748B'}}>DINAUP TERMINAL</span>
              <svg width="70" height="26" viewBox="0 0 70 26" fill="none">
                <path d="M2 13 H58" stroke="#0085FF" strokeWidth="3.5" strokeLinecap="round"/>
                <path d="M48 4 L58 13 L48 22" stroke="#0085FF" strokeWidth="3.5" strokeLinecap="round" strokeLinejoin="round"/>
              </svg>
              <span className="f-mono" style={{fontSize:26, fontWeight:700, letterSpacing:'3px', color:'#fff'}}>PLAY</span>
            </div>
          </div>
        </div>
      )}
    </SlideCanvas>
  );
}
Object.assign(window, { EscenaPL04 });
