// === Escena 05 — "La app de tu equipo. El portal de tus clientes." · audio real 117.32s ===
// LOCUCIÓN (cobra "¿y tu equipo?" de la 04 → dos caras): "Tu equipo no ve nada de esto, y no le hace
//   falta. A pie de obra nadie quiere buscar en una lista... quieren algo más sencillo. Sobre esa
//   BASE DE DATOS que acabas de montar, a ellos se les dibuja otra cara: una app hecha para su
//   trabajo. Y lo que tocan cae solo en tu Dinaup, sin que nadie copie nada. Imagínate un desguace —
//   Autodesguaces Alicante. Si tuvieras uno, querrías controlar el desmontaje: qué coche, qué piezas,
//   cuánto se tarda... en tiempo real. Sobre esa base de datos se le dibuja una app al mecánico.
//   [marca piezas → caen en tu base de datos] Una app así te da TRES cosas: [1] tan fácil que apenas
//   hay que enseñar — delegar es trivial; [2] difícil equivocarse; [3] ves la carga y el estado del
//   taller en vivo. [minigolf] La administración ya la tienes hecha: es tu base de datos en Dinaup.
//   Lo único que se dibuja encima es su cara de fuera."
// Sync clavado a mp3 real 117.32s (whisper). FASE 1 rediseñada al guion nuevo: base de datos → tu
//   equipo no la ve → se le dibuja una app → cae solo en Dinaup.
function Escena05({ t }){
  const P = {
    // Fase 1 · Concepto: base de datos → tu equipo no la ve → se le dibuja una app → cae solo
    bdd:        0.3, // "Tu equipo no ve nada de esto"         → base de datos
    noVe:       1.4,                                        // (apoyo) no la ve
    sobreBase: 10.7, // "sobre esa base de datos"              → sobre la base
    otraCara:  13.7, // "se les dibuja otra cara"              → otra cara
    caeSolo:   19.2, // "cae solo en tu Dinaup"                → cae solo
    concFade:  23.5,                                        // (apoyo) fade del concepto
    concEnd:   24.8,                                        // (apoyo) fin del concepto
    // Fase 2 · Desguace
    imagina:   25.0, // "Imagínate un desguace"                → entra el desguace
    cliente:   28.0, // "Autodesguaces Alicante"               → cliente
    querrias:  31.4, // "querrías controlar el desmontaje"     → querrías
    cols:      [33.5, 34.4, 35.8],   // "qué coche toca" · "qué piezas se recuperan" · "cuánto se tarda"
    appDibuja: 40.8, // "se le dibuja una app al mecánico"     → se dibuja la app
    coche:     44.1, // "le aparece el coche a desmontar"      → coche
    marks:     [47.7, 49.5, 50.8, 52.0],   // "en buen estado" · "se desecha" · "Dos botones" · "cada marca cae"
    caeVivo:   50.8,                                        // (apoyo) cae en vivo
    // Fase 3 · Tríada
    triad:     [60.3, 69.4, 77.0],   // "apenas hay que enseñar nada" · "difícil cometer un error" · "ves la carga de trabajo"
    taller:    78.3, // "el estado del taller en vivo"         → taller
    desExit:   82.0, // "Otro ejemplo"                         → sale el desguace
    // Fase 4 · Minigolf
    golfEnter: 83.3, // "Un minigolf"                          → entra el minigolf
    scores:    [91.9, 92.7, 93.6],                          // (apoyo) puntuaciones
    // Fase 5 · Cierre
    toSides:  97.5, // "la administración ya la tienes hecha" → a los lados
    both:     99.8,                                        // (apoyo) las dos caras
    remate:   105.3, // "la app de tu equipo"                  → remate
  };
  const DES_CENTER = 463, GOLF_CENTER = -462;

  const concOp = t < P.concFade ? clamp((t-0.3)/0.6, 0, 1) : clamp(1-(t-P.concFade)/(P.concEnd-P.concFade), 0, 1);

  // DESGUACE
  let dDx, dOp;
  if (t < P.imagina) { dOp = 0; dDx = DES_CENTER + 140; }
  else if (t < P.desExit) { const e = Easing.easeOutCubic(clamp((t-P.imagina)/0.8, 0, 1)); dOp = e; dDx = lerp(DES_CENTER+140, DES_CENTER, e); }
  else if (t < P.desExit+1.3) { const e = Easing.easeInCubic(clamp((t-P.desExit)/1.3, 0, 1)); dOp = 1-e; dDx = lerp(DES_CENTER, DES_CENTER-820, e); }
  else if (t < P.toSides) { dOp = 0; dDx = -560; }
  else { const e = Easing.easeOutCubic(clamp((t-P.toSides)/1.0, 0, 1)); dOp = e; dDx = lerp(-360, 0, e); }

  // MINIGOLF
  let gDx, gOp;
  if (t < P.golfEnter) { gOp = 0; gDx = 220; }
  else if (t < P.toSides) { const e = Easing.easeOutCubic(clamp((t-P.golfEnter)/0.9, 0, 1)); gOp = e; gDx = lerp(220, GOLF_CENTER, e); }
  else { const e = Easing.easeInOutCubic(clamp((t-P.toSides)/1.0, 0, 1)); gOp = 1; gDx = lerp(GOLF_CENTER, 0, e); }

  const phoneP = clamp((t-P.appDibuja)/0.6, 0, 1), phoneE = Easing.easeOutBack(phoneP);
  const cocheP = clamp((t-P.coche)/0.5, 0, 1);
  const colHi = (i)=> t >= P.cols[i] && t < P.cols[i]+1.1;
  const remateP = clamp((t-P.remate)/0.7, 0, 1);
  const bothOn = t >= P.both;

  // Beat "estado del taller en vivo" (benef 3)
  const tallerOn = t >= P.taller && t < P.desExit;
  const tallerPulse = (t >= P.taller && t < P.taller+3.0) ? Math.sin((t-P.taller)/3.0*Math.PI) : 0;
  const caeOn = t >= P.caeVivo && t < P.caeVivo+3.4;

  // Fase 1 · concepto (base de datos → tu equipo no la ve → se le dibuja una app → cae solo)
  const bddFaseE  = Easing.easeOutBack(clamp((t-P.bdd)/0.6, 0, 1));
  const bddAtenua = t >= P.noVe && t < P.sobreBase;
  const appCaraE  = Easing.easeOutBack(clamp((t-P.otraCara)/0.6, 0, 1));
  const caeSoloE  = clamp((t-P.caeSolo)/0.5, 0, 1);
  const linkCaraP = clamp((t-P.otraCara)/0.7, 0, 1);
  const pulsoSube = (t >= P.caeSolo && t < P.caeSolo+1.6) ? clamp((t-P.caeSolo)/1.0, 0, 1) : -1;

  const PIEZAS = [
    { n:'Faro delantero', est:'ok',  mark:P.marks[0] },
    { n:'Parachoques',    est:'bad', mark:P.marks[1] },
    { n:'Alternador',     est:'ok',  mark:P.marks[2] },
    { n:'Puerta cond.',   est:'ok',  mark:P.marks[3] },
  ];
  const nMarcadas = PIEZAS.reduce((a,p)=> a + (t >= p.mark ? 1 : 0), 0);
  const MEC = { left:405, top:150, w:200, h:378 };
  const BKL = { left:110, top:556, w:760, h:344 };
  const mecRowY = (i)=> MEC.top + 4 + 84 + i*60 + 30;
  const mecTapX = MEC.left + MEC.w - 38;

  const JUG  = [ {n:'Ana', g:3}, {n:'Luis', g:4}, {n:'Marta', g:2} ];
  const GOLF = { left:1315, top:150, w:200, h:378 };
  const BKR  = { left:1050, top:556, w:760, h:344 };
  const golfStepY = (i)=> GOLF.top + 4 + 88 + i*66 + 33;
  const golfTapX = GOLF.left + GOLF.w - 40;
  const golpesDe = (i)=>{ let g=0; if(t>=P.scores[0]) g=i===0?3:i===1?1:0; if(t>=P.scores[1]) g=i===0?3:i===1?4:1; if(t>=P.scores[2]) g=JUG[i].g; return g; };
  const nPartidas = t >= P.scores[2] ? 3 : t >= P.scores[1] ? 2 : t >= P.scores[0] ? 1 : 0;

  const mecTaps  = PIEZAS.map((p,i)=> ({ t:p.mark, x:mecTapX,  y:mecRowY(i) }));
  const golfTaps = P.scores.map((s,i)=> ({ t:s,     x:golfTapX, y:golfStepY(i) }));

  const estChip = (est)=> est==='ok'
    ? { c:'#059669', bg:'rgba(16,185,129,0.12)', bd:'rgba(16,185,129,0.45)', txt:'✓ recuperable' }
    : { c:'#DC2626', bg:'rgba(239,68,68,0.12)', bd:'rgba(239,68,68,0.45)', txt:'✗ desecho' };

  const LIST_Y = 704;
  const pulseMec  = (i)=>{ const p = clamp((t-PIEZAS[i].mark)/0.5, 0, 1); return (p>0 && p<1) ? p : -1; };
  const pulseGolf = (i)=>{ const p = clamp((t-P.scores[i])/0.5, 0, 1); return (p>0 && p<1) ? p : -1; };

  const BENEFS = [
    { at:P.triad[0], ic:'👥', t1:'Delegar es trivial', t2:'apenas formación · un novato, al lío el día 1', c:'#0085FF' },
    { at:P.triad[1], ic:'🛡️', t1:'Difícil equivocarse', t2:'no hay nada que teclear, solo se toca', c:'#8B5CF6' },
    { at:P.triad[2], ic:'⚡', t1:'El taller en vivo', t2:'carga de trabajo y estado, en tiempo real', c:'#059669' },
  ];

  const DinaupWin = ({ box, company, initials, breadcrumb, titulo, children, focus, live })=> (
    <div style={{position:'absolute', left:box.left, top:box.top, width:box.w, height:box.h, background:'#fff', borderRadius:12, overflow:'hidden', border:`1px solid ${live?'rgba(5,150,105,0.5)':'#E2E8F0'}`, boxShadow:`0 26px 70px rgba(0,133,255,${focus?0.2:0.12})${live?`, 0 0 0 ${tallerPulse*8}px rgba(5,150,105,0.08)`:''}, 0 8px 20px rgba(15,23,42,0.07)`, zIndex:4, transition:'border 300ms'}}>
      <BrowserChrome url={`play.dinaup.com/BusinessApp/${company.toLowerCase().replace(/[^a-z]/g,'')}`} title={`${titulo||'Base de datos'} — ${company}`}/>
      <DinaupAppHeader breadcrumb={breadcrumb} company={company} initials={initials}/>
      {children}
    </div>
  );

  return (
    <SlideCanvas variant="light-soft">
      <DemoHeader t={Math.max(0,t-0.2)} eyebrow="LA PUNTA · LO QUE VE TU EQUIPO" title={<span>La app de tu equipo. <span className="grad-text">El portal de tus clientes.</span></span>}/>

      {/* ============ FASE 1 · CONCEPTO: base de datos → tu equipo no la ve → se le dibuja una app → cae solo ============ */}
      {concOp > 0.01 && (
      <div style={{position:'absolute', inset:0, opacity:concOp, zIndex:6}}>
        <svg style={{position:'absolute', inset:0, width:'100%', height:'100%', pointerEvents:'none'}} viewBox="0 0 1920 1080">
          {t>=P.otraCara && <line x1="960" y1="446" x2="960" y2="612" stroke="#FF6751" strokeWidth="2.5" strokeDasharray="8 8" strokeDashoffset={200*(1-linkCaraP)} opacity={0.75*linkCaraP}/>}
          {pulsoSube>=0 && <circle cx="960" cy={lerp(612,446,Easing.easeInOutCubic(pulsoSube))} r="8" fill="#059669"/>}
        </svg>

        {/* Base de datos (lo que montaste en la 04) */}
        <div style={{position:'absolute', top:352, left:'50%', transform:`translateX(-50%) scale(${lerp(0.8,1,bddFaseE)})`, display:'flex', alignItems:'center', gap:13, background:'#0F172A', color:'#fff', borderRadius:16, padding:'16px 30px', boxShadow:'0 18px 44px rgba(15,23,42,0.35)', opacity: bddAtenua?0.4:1, filter: bddAtenua?'grayscale(0.4)':'none', transition:'opacity 400ms, filter 400ms'}}>
          <span style={{fontSize:22}}>🗄️</span>
          <div>
            <div className="f-mono" style={{fontSize:9, color:'rgba(255,255,255,0.6)', letterSpacing:'2px'}}>LO QUE MONTASTE · TU BASE DE DATOS</div>
            <div className="f-plex" style={{fontSize:18, fontWeight:800}}>Piezas del desguace</div>
          </div>
          {t>=P.sobreBase && t<P.otraCara+2 && <span className="f-mono" style={{fontSize:9, fontWeight:800, color:'#0F172A', background:'#56E16A', borderRadius:100, padding:'4px 11px', marginLeft:4}}>ya es Dinaup</span>}
        </div>

        {/* Badge: tu equipo no ve esto (hasta que aparece la base) */}
        {t >= P.noVe && t < P.sobreBase && (
          <div className="f-mono" style={{position:'absolute', top:276, left:0, right:0, textAlign:'center', opacity:clamp((t-P.noVe)/0.5,0,1)}}>
            <span style={{fontSize:14, fontWeight:800, color:'#64748B', background:'#fff', border:'1.5px solid #E2E8F0', borderRadius:100, padding:'9px 22px', boxShadow:'0 10px 26px rgba(15,23,42,0.08)'}}>👷 tu equipo no ve esto — ni le hace falta</span>
          </div>
        )}

        {/* La app que se le dibuja encima (cara de fuera) */}
        {t >= P.otraCara && (
          <div style={{position:'absolute', top:612, left:'50%', transform:`translateX(-50%) scale(${lerp(0.8,1,appCaraE)})`, width:460, background:'#fff', border:'1.5px solid rgba(255,103,81,0.45)', borderRadius:16, padding:'20px 26px', boxShadow:'0 18px 44px rgba(255,103,81,0.15)'}}>
            <div style={{display:'flex', alignItems:'center', gap:11, marginBottom:9}}>
              <span style={{fontSize:24}}>📱</span>
              <div><div className="f-mono" style={{fontSize:9, color:'#FF6751', letterSpacing:'1.5px', fontWeight:800}}>SU CARA DE FUERA · SE DIBUJA</div><div className="f-plex" style={{fontSize:18, fontWeight:800, color:'#0F172A'}}>Una app hecha para su trabajo</div></div>
            </div>
            <div style={{fontSize:12.5, color:'#64748B'}}>Nada de listas ni buscadores: algo mucho más sencillo</div>
            {t >= P.caeSolo && (
              <div style={{marginTop:11, display:'flex', alignItems:'center', gap:8, opacity:caeSoloE}}>
                <span className="f-mono" style={{fontSize:10.5, fontWeight:800, color:'#059669', background:'rgba(16,185,129,0.1)', border:'1px solid rgba(16,185,129,0.4)', borderRadius:100, padding:'5px 14px'}}>↑ lo que tocan cae solo en tu Dinaup · sin copiar nada</span>
              </div>
            )}
          </div>
        )}
      </div>
      )}

      {/* ============ Tríada de beneficios (durante el desguace) ============ */}
      {dOp > 0.5 && t >= P.triad[0]-0.3 && t < P.desExit && (
        <div style={{position:'absolute', left:70, top:290, display:'flex', flexDirection:'column', gap:15, zIndex:8}}>
          {BENEFS.map((b,i)=>{
            const p = clamp((t-b.at)/0.5, 0, 1), e = Easing.easeOutBack(p);
            if (p<=0) return null;
            const hot = i===2 && tallerOn;
            return (
              <div key={i} style={{display:'flex', alignItems:'center', gap:14, background:'#fff', border:`1.5px solid ${b.c}${hot?'':'55'}`, borderRadius:14, padding:'14px 20px', width:360, transform:`translateX(${(1-e)*-40}px) scale(${hot?1+tallerPulse*0.03:1})`, opacity:clamp(p*1.3,0,1), boxShadow:`0 14px 34px ${b.c}22${hot?`, 0 0 0 ${tallerPulse*8}px ${b.c}15`:''}`}}>
                <div style={{width:44, height:44, borderRadius:12, background:`${b.c}18`, display:'flex', alignItems:'center', justifyContent:'center', fontSize:22}}>{b.ic}</div>
                <div>
                  <div className="f-plex" style={{fontSize:16, fontWeight:800, color:'#0F172A'}}>{b.t1}</div>
                  <div className="f-mono" style={{fontSize:10.5, color:'#64748B', marginTop:2}}>{b.t2}</div>
                </div>
              </div>
            );
          })}
        </div>
      )}

      {/* ============ Rótulos de zona (cierre, con ambos) ============ */}
      {remateP > 0 && bothOn && (
        <React.Fragment>
          <div className="f-mono" style={{position:'absolute', top:126, left:0, right:0, textAlign:'center', zIndex:7, opacity:remateP}}>
            <span style={{fontSize:12, fontWeight:800, letterSpacing:'3px', color:'#0085FF', background:'rgba(0,133,255,0.08)', border:'1.5px solid rgba(0,133,255,0.4)', borderRadius:100, padding:'6px 20px'}}>↑ SU CARA DE FUERA · SE DISEÑA</span>
          </div>
          <div className="f-mono" style={{position:'absolute', top:512, left:0, right:0, textAlign:'center', zIndex:7, opacity:remateP}}>
            <span style={{fontSize:12, fontWeight:800, letterSpacing:'3px', color:'#059669', background:'rgba(16,185,129,0.1)', border:'1.5px solid rgba(16,185,129,0.45)', borderRadius:100, padding:'6px 20px'}}>↓ TU BASE DE DATOS · YA ES DINAUP</span>
          </div>
        </React.Fragment>
      )}

      {/* ============ COLUMNA DESGUACE ============ */}
      {dOp > 0.01 && (
      <div style={{position:'absolute', inset:0, transform:`translateX(${dDx}px)`, opacity:dOp, zIndex:5}}>
        <svg style={{position:'absolute', inset:0, width:'100%', height:'100%', pointerEvents:'none'}} viewBox="0 0 1920 1080">
          {phoneP > 0.3 && <line x1={MEC.left+MEC.w/2} y1={MEC.top+MEC.h} x2={BKL.left+BKL.w/2} y2={LIST_Y-16} stroke="#0085FF" strokeWidth="2.5" strokeDasharray="7 7" opacity={0.7*phoneP}/>}
          {PIEZAS.map((p,i)=>{ const pp = pulseMec(i); if(pp<0) return null; const x=lerp(MEC.left+MEC.w/2,BKL.left+BKL.w/2,pp), y=lerp(MEC.top+MEC.h,LIST_Y-16,pp); return <circle key={i} cx={x} cy={y} r="7.5" fill="#0085FF"/>; })}
        </svg>

        {/* App del mecánico (aparece en "se le dibuja una app") */}
        {phoneP > 0.01 && (
        <div style={{position:'absolute', left:MEC.left, top:MEC.top, opacity:phoneP, transform:`translateY(${(1-phoneE)*22}px)`}}>
          <div className="f-mono" style={{position:'absolute', top:-28, left:'50%', transform:'translateX(-50%)', fontSize:9.5, fontWeight:800, color:'#0085FF', background:'#fff', border:'1.5px solid rgba(0,133,255,0.4)', borderRadius:100, padding:'4px 13px', whiteSpace:'nowrap', boxShadow:'0 8px 20px rgba(0,133,255,0.18)'}}>APP · MECÁNICO</div>
          <PhoneFrame w={MEC.w} h={MEC.h}>
            <div style={{height:84, background:'linear-gradient(135deg,#0F172A,#1E3A5F)', padding:'11px 14px', color:'#fff'}}>
              <div style={{display:'flex', alignItems:'center', gap:7}}><span style={{fontSize:15}}>🔧</span><span className="f-plex" style={{fontSize:12.5, fontWeight:800}}>Desmontaje</span></div>
              <div style={{marginTop:7, background: cocheP>0?'rgba(0,133,255,0.4)':'rgba(255,255,255,0.12)', border:`1px solid ${cocheP>0?'#56A8FF':'rgba(255,255,255,0.2)'}`, borderRadius:7, padding:'5px 9px', transition:'background 300ms'}}>
                <div className="f-mono" style={{fontSize:7, color:'rgba(255,255,255,0.6)', letterSpacing:'1px'}}>VEHÍCULO</div>
                <div className="f-plex" style={{fontSize:11, fontWeight:700, color:'#fff'}}>5843-KLM · Seat Ibiza</div>
              </div>
            </div>
            <div style={{padding:'7px 11px', display:'flex', flexDirection:'column', gap:6}}>
              {PIEZAS.map((p,i)=>{
                const marked = t >= p.mark; const chip = estChip(p.est);
                return (
                  <div key={i} style={{background: marked?chip.bg:'#F8FAFC', border:`1.5px solid ${marked?chip.bd:'#E2E8F0'}`, borderRadius:9, padding:'6px 9px'}}>
                    <div className="f-plex" style={{fontSize:10.5, fontWeight:700, color:'#0F172A', marginBottom:5}}>{p.n}</div>
                    {marked ? (
                      <div className="f-mono" style={{fontSize:10, fontWeight:800, color:chip.c, textAlign:'center', background:'#fff', borderRadius:6, padding:'5px 0'}}>{chip.txt}</div>
                    ) : (
                      <div style={{display:'flex', gap:5}}>
                        <div style={{flex:1, background:'#ECFDF5', border:'1px solid #A7F3D0', borderRadius:6, padding:'5px 0', textAlign:'center', fontSize:8.5, fontWeight:700, color:'#059669'}}>✓ Bien</div>
                        <div style={{flex:1, background:'#FEF2F2', border:'1px solid #FECACA', borderRadius:6, padding:'5px 0', textAlign:'center', fontSize:8.5, fontWeight:700, color:'#DC2626'}}>✗ Desecho</div>
                      </div>
                    )}
                  </div>
                );
              })}
              <div className="f-mono" style={{fontSize:7.5, color:'#B6C2D2', textAlign:'center', marginTop:1}}>{nMarcadas}/4 · dos botones, sin teclear</div>
            </div>
          </PhoneFrame>
        </div>
        )}

        {/* Su base de datos en Dinaup */}
        <DinaupWin box={BKL} company="Autodesguaces Alicante" initials="AA" breadcrumb={["Desguace","Base de datos"]} titulo="Base de datos" focus live={tallerOn}>
          <div style={{padding:'14px 22px'}}>
            {/* Estado del taller en vivo (benef 3) */}
            {tallerOn && (
              <div style={{display:'flex', alignItems:'center', gap:12, background:'rgba(16,185,129,0.06)', border:'1.5px solid rgba(16,185,129,0.4)', borderRadius:10, padding:'8px 14px', marginBottom:10, opacity:clamp((t-P.taller)/0.4,0,1)}}>
                <span className="f-mono" style={{fontSize:9, fontWeight:800, color:'#059669', letterSpacing:'1px', display:'flex', alignItems:'center', gap:5}}><span style={{width:7, height:7, borderRadius:100, background:'#10B981', boxShadow:`0 0 ${4+tallerPulse*6}px #10B981`}}/>ESTADO DEL TALLER · EN VIVO</span>
                <span className="f-mono" style={{marginLeft:'auto', fontSize:11, color:'#334155', display:'flex', gap:16}}>
                  <span>En curso <b style={{color:'#0085FF'}}>3</b></span><span>Piezas hoy <b style={{color:'#059669'}}>47</b></span><span>Pendientes <b style={{color:'#B45309'}}>2</b></span>
                </span>
              </div>
            )}
            <div style={{display:'flex', alignItems:'center', gap:8, marginBottom:10}}>
              <span style={{width:8, height:8, borderRadius:100, background:'#0085FF'}}/>
              <span className="f-plex" style={{fontSize:13, fontWeight:700, color:'#0F172A'}}>Piezas · Desmontaje</span>
              <span className="f-mono" style={{marginLeft:'auto', fontSize:9.5, color:'#94A3B8', display:'flex', alignItems:'center', gap:6}}>
                {caeOn && <span style={{display:'flex', alignItems:'center', gap:5, color:'#059669', fontWeight:800}}><span style={{width:6, height:6, borderRadius:100, background:'#10B981'}}/>EN VIVO ·</span>}
                {nMarcadas} registradas
              </span>
            </div>
            <div style={{display:'grid', gridTemplateColumns:'1fr 78px 130px 54px', gap:'0 8px', padding:'4px 8px', borderBottom:'1.5px solid #E2E8F0'}}>
              {[['Pieza',0],['Vehículo',0],['Estado',1],['Tarda',2]].map(([h,ci])=><span key={h} className="f-mono" style={{fontSize:8.5, color: colHi(ci)?'#0085FF':'#94A3B8', fontWeight: colHi(ci)?800:400, letterSpacing:'0.5px', textTransform:'uppercase', background: colHi(ci)?'rgba(0,133,255,0.08)':'transparent', borderRadius:4, transition:'all 200ms'}}>{h}</span>)}
            </div>
            {PIEZAS.map((p,i)=>{
              const born = t >= p.mark + 0.5; if (!born) return null;
              const bp = clamp((t-(p.mark+0.5))/0.4, 0, 1), be = Easing.easeOutBack(bp); const chip = estChip(p.est);
              const fresh = t < p.mark + 1.3;
              return (
                <div key={i} style={{display:'grid', gridTemplateColumns:'1fr 78px 130px 54px', gap:'0 8px', alignItems:'center', padding:'8px', borderBottom:'1px solid #F1F5F9', background: fresh?'rgba(16,185,129,0.07)':(i%2?'#FBFDFF':'#fff'), transform:`translateY(${(1-be)*-14}px)`, opacity:clamp(bp*1.3,0,1)}}>
                  <span className="f-plex" style={{fontSize:11, fontWeight:600, color:'#0F172A'}}>{p.n}</span>
                  <span className="f-mono" style={{fontSize:10, color:'#64748B'}}>Ibiza</span>
                  <span className="f-mono" style={{fontSize:9.5, fontWeight:800, color:chip.c, background:chip.bg, border:`1px solid ${chip.bd}`, borderRadius:100, padding:'2px 8px', justifySelf:'start'}}>{chip.txt}</span>
                  <span className="f-mono" style={{fontSize:9, color:'#94A3B8'}}>{['14′','8′','11′','6′'][i]}</span>
                </div>
              );
            })}
            {nMarcadas===0 && <div className="f-mono" style={{marginTop:14, fontSize:10, color:'#B6C2D2', textAlign:'center', fontStyle:'italic'}}>{phoneP>0.5 ? 'esperando lo que marca el mecánico…' : 'controla el desmontaje: qué coche, qué piezas, cuánto se tarda…'}</div>}
          </div>
        </DinaupWin>
        {phoneP > 0.5 && <FingerTap t={t} taps={mecTaps}/>}
      </div>
      )}

      {/* ============ COLUMNA MINIGOLF ============ */}
      {gOp > 0.01 && (
      <div style={{position:'absolute', inset:0, transform:`translateX(${gDx}px)`, opacity:gOp, zIndex:5}}>
        <svg style={{position:'absolute', inset:0, width:'100%', height:'100%', pointerEvents:'none'}} viewBox="0 0 1920 1080">
          <line x1={GOLF.left+GOLF.w/2} y1={GOLF.top+GOLF.h} x2={BKR.left+BKR.w/2} y2={LIST_Y-16} stroke="#FF6751" strokeWidth="2.5" strokeDasharray="7 7" opacity="0.7"/>
          {P.scores.map((s,i)=>{ const pp = pulseGolf(i); if(pp<0) return null; const x=lerp(GOLF.left+GOLF.w/2,BKR.left+BKR.w/2,pp), y=lerp(GOLF.top+GOLF.h,LIST_Y-16,pp); return <circle key={i} cx={x} cy={y} r="7.5" fill="#FF6751"/>; })}
        </svg>
        <div style={{position:'absolute', left:GOLF.left, top:GOLF.top}}>
          <div className="f-mono" style={{position:'absolute', top:-28, left:'50%', transform:'translateX(-50%)', fontSize:9.5, fontWeight:800, color:'#FF6751', background:'#fff', border:'1.5px solid rgba(255,103,81,0.4)', borderRadius:100, padding:'4px 13px', whiteSpace:'nowrap', boxShadow:'0 8px 20px rgba(255,103,81,0.18)'}}>PORTAL · CLIENTE</div>
          <PhoneFrame w={GOLF.w} h={GOLF.h}>
            <div style={{height:88, background:'linear-gradient(135deg,#FF6751,#E14A34)', padding:'11px 14px', color:'#fff'}}>
              <div style={{display:'flex', alignItems:'center', gap:7}}><span style={{fontSize:15}}>⛳</span><span className="f-plex" style={{fontSize:12.5, fontWeight:800}}>Mi tarjeta</span></div>
              <div style={{marginTop:7, background:'rgba(255,255,255,0.15)', borderRadius:7, padding:'5px 9px'}}>
                <div className="f-mono" style={{fontSize:7, color:'rgba(255,255,255,0.7)', letterSpacing:'1px'}}>HOYO 7 · GRUPO</div>
                <div className="f-plex" style={{fontSize:11, fontWeight:700, color:'#fff'}}>Familia Ortega</div>
              </div>
            </div>
            <div style={{padding:'9px 11px', display:'flex', flexDirection:'column', gap:9}}>
              {JUG.map((j,i)=>{
                const g = golpesDe(i); const justUp = t >= P.scores[Math.min(i,2)] && t < P.scores[Math.min(i,2)]+0.4;
                return (
                  <div key={i} style={{display:'flex', alignItems:'center', gap:8, background:'#FFF7F5', border:'1.5px solid #FFD9D1', borderRadius:9, padding:'7px 10px'}}>
                    <span className="f-plex" style={{fontSize:11, fontWeight:700, color:'#0F172A', flex:1}}>{j.n}</span>
                    <span style={{width:22, height:22, borderRadius:7, background:'#FEE2E2', display:'flex', alignItems:'center', justifyContent:'center', fontSize:12, fontWeight:800, color:'#DC2626'}}>−</span>
                    <span className="f-mono" style={{fontSize:16, fontWeight:800, color:'#0F172A', width:20, textAlign:'center', transform:`scale(${justUp?1.3:1})`, transition:'transform 200ms'}}>{g}</span>
                    <span style={{width:22, height:22, borderRadius:7, background:'#DCFCE7', display:'flex', alignItems:'center', justifyContent:'center', fontSize:12, fontWeight:800, color:'#059669'}}>+</span>
                  </div>
                );
              })}
              <div className="f-mono" style={{fontSize:7.5, color:'#E8A79B', textAlign:'center'}}>anotan desde la pista</div>
            </div>
          </PhoneFrame>
        </div>
        <DinaupWin box={BKR} company="Minigolf El Pinar" initials="EP" breadcrumb={["Minigolf","Base de datos"]} titulo="Base de datos" focus>
          <div style={{padding:'14px 22px'}}>
            <div style={{display:'flex', alignItems:'center', gap:8, marginBottom:10}}>
              <span style={{width:8, height:8, borderRadius:100, background:'#FF6751'}}/>
              <span className="f-plex" style={{fontSize:13, fontWeight:700, color:'#0F172A'}}>Partidas · Hoyo 7</span>
              <span className="f-mono" style={{marginLeft:'auto', fontSize:9.5, color:'#94A3B8'}}>{nPartidas} anotadas</span>
            </div>
            <div style={{display:'grid', gridTemplateColumns:'1fr 120px 90px 70px', gap:'0 8px', padding:'4px 8px', borderBottom:'1.5px solid #E2E8F0'}}>
              {['Jugador','Grupo','Golpes','Hora'].map((h)=><span key={h} className="f-mono" style={{fontSize:8.5, color:'#94A3B8', letterSpacing:'0.5px', textTransform:'uppercase'}}>{h}</span>)}
            </div>
            {JUG.map((j,i)=>{
              const born = t >= P.scores[i] + 0.5; if (!born) return null;
              const bp = clamp((t-(P.scores[i]+0.5))/0.4, 0, 1), be = Easing.easeOutBack(bp);
              return (
                <div key={i} style={{display:'grid', gridTemplateColumns:'1fr 120px 90px 70px', gap:'0 8px', alignItems:'center', padding:'8px', borderBottom:'1px solid #F1F5F9', background: i%2?'#FFFBFA':'#fff', transform:`translateY(${(1-be)*-14}px)`, opacity:clamp(bp*1.3,0,1)}}>
                  <span className="f-plex" style={{fontSize:11, fontWeight:600, color:'#0F172A'}}>{j.n}</span>
                  <span className="f-mono" style={{fontSize:10, color:'#64748B'}}>F. Ortega</span>
                  <span className="f-mono" style={{fontSize:12, fontWeight:800, color:'#DC2626', justifySelf:'start'}}>{j.g}</span>
                  <span className="f-mono" style={{fontSize:9, color:'#94A3B8'}}>17:0{i}</span>
                </div>
              );
            })}
            {nPartidas===0 && <div className="f-mono" style={{marginTop:14, fontSize:10, color:'#E8A79B', textAlign:'center', fontStyle:'italic'}}>esperando lo que anotan los clientes…</div>}
          </div>
        </DinaupWin>
        <FingerTap t={t} taps={golfTaps}/>
      </div>
      )}
    </SlideCanvas>
  );
}
Object.assign(window, { Escena05 });
