// illustrations12b.jsx — Capítulo 12 · Escenas 4 y 5 (principio realista)
const { SceneFrame, SkyBackdrop, LuminousChrist, useRun, globeDots } = window;

// ════════════════════════════════════════════════════════════════════════
// ─── PORTADA · ENVIADO CON UNA MISIÓN ────────────────────────────────────
// Un hijo sale de la casa del Padre (puerta encendida) y, lámpara en mano,
// camina por el sendero hacia el mundo — que se va encendiendo a su paso.
// ════════════════════════════════════════════════════════════════════════
function ScenePortada({ pal, active }) {
  const run = useRun(active);

  // Mundo (a la derecha) — esfera tenue que se enciende a la llegada
  const wx = 1330, wy = 270, wR = 150;
  const wdots = globeDots(wx, wy, wR, 20, 13);
  const NN = 13, ga = Math.PI * (3 - Math.sqrt(5)), tilt = -0.2;
  const wnodes = [];
  for (let i = 0; i < NN; i++) {
    const yy = 1 - (i / (NN - 1)) * 2;
    const rr = Math.sqrt(Math.max(0, 1 - yy * yy));
    const th = i * ga;
    const px = Math.cos(th) * rr, py0 = yy, pz0 = Math.sin(th) * rr;
    const py = py0 * Math.cos(tilt) - pz0 * Math.sin(tilt);
    const pz = py0 * Math.sin(tilt) + pz0 * Math.cos(tilt);
    if (pz <= 0.22) continue;
    wnodes.push({ x: wx + wR * px * 0.88, y: wy - wR * py * 0.88, i: wnodes.length });
  }

  return (
    <SceneFrame pal={pal} viewBox="0 0 1600 520">
      <defs>
        <radialGradient id="pDoorGlow" cx="50%" cy="50%">
          <stop offset="0%" stopColor="#fff7e6" stopOpacity="0.95" />
          <stop offset="45%" stopColor={pal.warm} stopOpacity="0.55" />
          <stop offset="100%" stopColor={pal.warm} stopOpacity="0" />
        </radialGradient>
        <linearGradient id="pDoorSpill" x1="0" y1="0" x2="1" y2="0">
          <stop offset="0%" stopColor="#fff3d4" stopOpacity="0.5" />
          <stop offset="100%" stopColor={pal.warm} stopOpacity="0" />
        </linearGradient>
        <linearGradient id="pRoof" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0%" stopColor={pal.medium} />
          <stop offset="100%" stopColor={pal.deep} />
        </linearGradient>
        <linearGradient id="pWall" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0%" stopColor={pal.deep} />
          <stop offset="100%" stopColor={pal.abyss} />
        </linearGradient>
        <linearGradient id="pRoad" x1="0" y1="0" x2="1" y2="0">
          <stop offset="0%" stopColor={pal.deep} stopOpacity="0.85" />
          <stop offset="100%" stopColor={pal.abyss} stopOpacity="0.2" />
        </linearGradient>
        <radialGradient id="pWorldSphere" cx="42%" cy="32%">
          <stop offset="0%" stopColor={pal.deep} />
          <stop offset="58%" stopColor={pal.deep} stopOpacity="0.5" />
          <stop offset="100%" stopColor={pal.abyss} />
        </radialGradient>
        <radialGradient id="pWorldAtm" cx="50%" cy="50%">
          <stop offset="0%" stopColor="#9fb2e0" stopOpacity="0" />
          <stop offset="84%" stopColor="#9fb2e0" stopOpacity="0" />
          <stop offset="94%" stopColor="#9fb2e0" stopOpacity="0.32" />
          <stop offset="100%" stopColor="#9fb2e0" stopOpacity="0" />
        </radialGradient>
        <radialGradient id="pWorldWarm" cx="50%" cy="32%">
          <stop offset="0%" stopColor="#fff3d4" stopOpacity="0.9" />
          <stop offset="45%" stopColor={pal.warm} stopOpacity="0.45" />
          <stop offset="100%" stopColor={pal.warm} stopOpacity="0" />
        </radialGradient>
        <radialGradient id="pCity" cx="50%" cy="50%">
          <stop offset="0%" stopColor="#fff3d4" stopOpacity="0.95" />
          <stop offset="45%" stopColor={pal.warm} stopOpacity="0.55" />
          <stop offset="100%" stopColor={pal.warm} stopOpacity="0" />
        </radialGradient>
        <radialGradient id="pLantern" cx="50%" cy="50%">
          <stop offset="0%" stopColor="#fff7e6" stopOpacity="0.95" />
          <stop offset="40%" stopColor={pal.warm} stopOpacity="0.5" />
          <stop offset="100%" stopColor={pal.warm} stopOpacity="0" />
        </radialGradient>
        <linearGradient id="pRobe" x1="0" y1="0" x2="0.3" y2="1">
          <stop offset="0%" stopColor="#3a3f5e" />
          <stop offset="100%" stopColor={pal.abyss} />
        </linearGradient>
        <linearGradient id="pSkin" x1="0" y1="0" x2="1" y2="0">
          <stop offset="0%" stopColor="#8a6f52" />
          <stop offset="100%" stopColor="#e6c49a" />
        </linearGradient>
        <clipPath id="pWorldClip"><circle cx={wx} cy={wy} r={wR} /></clipPath>
      </defs>

      <SkyBackdrop pal={pal} w={1600} h={520} n={72} />

      {/* suelo / horizonte */}
      <path d="M 0 470 H 1600" stroke={pal.deep} strokeWidth="1.5" opacity="0.5" />

      {/* MUNDO — a la derecha, tenue; se enciende al llegar el hijo */}
      <circle cx={wx} cy={wy} r={wR + 16} fill="url(#pWorldAtm)" />
      <circle cx={wx} cy={wy} r={wR} fill="url(#pWorldSphere)" stroke={pal.medium} strokeOpacity="0.25" strokeWidth="1" />
      <g clipPath="url(#pWorldClip)">
        {wdots.map((d, i) => <circle key={i} cx={d.x} cy={d.y} r={d.r} fill={pal.soft} opacity={d.op} />)}
      </g>
      <g key={'world' + run}>
        <g clipPath="url(#pWorldClip)">
          <circle cx={wx} cy={wy - 20} r={wR + 24} fill="url(#pWorldWarm)" opacity="0"
            style={{ animation: 'c12-worldCycle 9s ease-in-out infinite' }} />
          <g style={{ animation: 'c12-worldCycle 9s ease-in-out infinite' }}>
            {wnodes.map((c) => (
              <g key={c.i}>
                <circle cx={c.x} cy={c.y} r="12" fill="url(#pCity)"
                  style={{ animation: `c12-glow ${2.2 + (c.i % 3) * 0.4}s ease-in-out infinite`, transformOrigin: `${c.x}px ${c.y}px` }} />
                <circle cx={c.x} cy={c.y} r="2.2" fill="#fffaf0" />
              </g>
            ))}
          </g>
        </g>
      </g>

      {/* SENDERO de la casa al mundo (perspectiva) */}
      <path d="M 330 466 L 1230 462 L 1230 470 L 330 500 Z" fill="url(#pRoad)" />
      <path d="M 350 484 Q 790 470 1226 466" fill="none" stroke={pal.warm} strokeWidth="2"
        strokeDasharray="3 14" opacity="0.3" strokeLinecap="round" />

      {/* LA CASA del Padre — puerta encendida */}
      <g>
        <ellipse cx="245" cy="472" rx="170" ry="12" fill={pal.abyss} opacity="0.5" />
        {/* muro */}
        <rect x="120" y="318" width="250" height="152" fill="url(#pWall)" stroke={pal.deep} strokeWidth="1.5" />
        {/* techo */}
        <path d="M 96 326 L 245 220 L 394 326 Z" fill="url(#pRoof)" stroke={pal.medium} strokeWidth="1.5" strokeOpacity="0.5" />
        {/* ventana encendida */}
        <rect x="150" y="356" width="56" height="52" rx="4" fill="url(#pDoorGlow)" />
        <rect x="150" y="356" width="56" height="52" rx="4" fill="none" stroke={pal.warm} strokeWidth="1.5" opacity="0.6" />
        <line x1="178" y1="356" x2="178" y2="408" stroke={pal.warm} strokeWidth="1.2" opacity="0.5" />
        <line x1="150" y1="382" x2="206" y2="382" stroke={pal.warm} strokeWidth="1.2" opacity="0.5" />
        {/* puerta abierta, luz que sale */}
        <path d="M 256 470 L 256 352 L 318 340 L 318 470 Z" fill="url(#pDoorGlow)" />
        <path d="M 256 470 L 256 352 L 318 340 L 318 470 Z" fill="none" stroke={pal.warm} strokeWidth="1.5" opacity="0.7" />
        {/* derrame de luz hacia el sendero */}
        <path d="M 318 348 L 720 452 L 690 506 L 318 470 Z" fill="url(#pDoorSpill)" opacity="0.55"
          style={{ animation: 'c12-glow 6s ease-in-out infinite' }} />
      </g>

      {/* motas de luz que el hijo va dejando en el camino */}
      <g key={'motes' + run}>
        {[{ x: 560, d: 2.2 }, { x: 800, d: 4.1 }, { x: 1020, d: 5.8 }].map((m, i) => (
          <circle key={i} cx={m.x} cy="458" r={2.2 + (i % 2)} fill="#fff3d4"
            style={{ animation: `c12-rise 4.5s ease-in ${m.d}s infinite`, transformOrigin: `${m.x}px 458px` }} />
        ))}
      </g>

      {/* EL HIJO ENVIADO — sale de la casa y recorre el sendero, lámpara en mano */}
      <g key={'walk' + run}>
        <g style={{ animation: 'c12-journey 9s cubic-bezier(.4,0,.2,1) infinite' }}>
          <g style={{ animation: 'c12-walk 1.5s ease-in-out infinite', transformOrigin: '345px 400px' }}>
            <g transform="translate(345 470)">
              {/* sombra */}
              <ellipse cx="6" cy="2" rx="34" ry="7" fill={pal.abyss} opacity="0.5" />
              {/* pierna trasera */}
              <path d="M -6 -86 Q -20 -42 -22 -2 L -10 -2 Q -4 -44 8 -86 Z" fill={pal.abyss} />
              <ellipse cx="-18" cy="-1" rx="13" ry="5" fill={pal.abyss} />
              {/* pierna delantera (paso) */}
              <path d="M 4 -86 Q 18 -44 28 -4 L 40 -4 Q 30 -48 18 -88 Z" fill={pal.deep} />
              <ellipse cx="34" cy="-3" rx="14" ry="5" fill={pal.deep} />
              {/* túnica / torso */}
              <path d="M -20 -78 Q -27 -116 -16 -150 Q 0 -162 16 -150 Q 27 -116 20 -78 Q 0 -70 -20 -78 Z" fill="url(#pRobe)" />
              <path d="M -8 -150 Q -10 -114 -8 -78" stroke={pal.abyss} strokeWidth="2" opacity="0.35" fill="none" />
              {/* manto sobre el hombro */}
              <path d="M -18 -140 Q 0 -150 18 -140 Q 8 -132 0 -132 Q -8 -132 -18 -140 Z" fill={pal.abyss} opacity="0.55" />
              {/* rim cálido del lado de la lámpara */}
              <path d="M 16 -150 Q 27 -116 20 -78" stroke={pal.warm} strokeWidth="2.4" fill="none" opacity="0.6" strokeLinecap="round" />
              {/* brazo trasero */}
              <path d="M -12 -142 Q -32 -116 -26 -86" stroke="url(#pRobe)" strokeWidth="12" fill="none" strokeLinecap="round" />
              {/* brazo delantero levantando la lámpara */}
              <path d="M 10 -144 Q 42 -128 54 -100" stroke="url(#pRobe)" strokeWidth="13" fill="none" strokeLinecap="round" />
              <path d="M 12 -146 Q 42 -130 54 -102" stroke={pal.warm} strokeWidth="1.6" fill="none" opacity="0.5" strokeLinecap="round" />
              {/* cuello + cabeza (mira al mundo) */}
              <rect x="-6" y="-162" width="12" height="14" rx="5" fill="url(#pSkin)" />
              <g transform="rotate(4 2 -178)">
                <ellipse cx="2" cy="-178" rx="18" ry="21" fill="url(#pSkin)" />
                <path d="M -16 -184 Q 2 -206 22 -186 Q 24 -176 16 -178 L -8 -178 Q -16 -178 -16 -184 Z" fill={pal.abyss} />
                <path d="M 20 -184 Q 24 -172 16 -160" stroke={pal.warm} strokeWidth="1.8" fill="none" opacity="0.6" strokeLinecap="round" />
                <circle cx="12" cy="-180" r="2.4" fill={pal.warm} style={{ animation: 'c12-glow 2.6s ease-in-out infinite' }} />
              </g>
              {/* LÁMPARA — la luz que lleva al mundo */}
              <g>
                <line x1="54" y1="-100" x2="60" y2="-118" stroke={pal.warmDeep} strokeWidth="2" strokeLinecap="round" />
                <circle cx="60" cy="-104" r="30" fill="url(#pLantern)"
                  style={{ animation: 'c12-glow 3s ease-in-out infinite', transformOrigin: '60px -104px' }} />
                <rect x="53" y="-116" width="14" height="4" rx="2" fill={pal.warmDeep} />
                <rect x="54" y="-113" width="12" height="17" rx="3" fill={pal.warmDeep} opacity="0.85" stroke={pal.warm} strokeWidth="1" strokeOpacity="0.6" />
                <circle cx="60" cy="-104" r="5" fill="#fffaf0"
                  style={{ animation: 'c12-pulse 2.4s ease-in-out infinite', transformOrigin: '60px -104px' }} />
              </g>
            </g>
          </g>
        </g>
      </g>
    </SceneFrame>
  );
}

// ════════════════════════════════════════════════════════════════════════
// ─── ESCENA 4 · A LOS PIES DE LA CRUZ ────────────────────────────────────
// El joven ve la cruz; detrás de la cruz reconoce al Padre. Se acerca y se
// sienta a Sus pies a contemplarlo — quedan unidos, como familia.
// ════════════════════════════════════════════════════════════════════════
function SceneRegazo({ pal, active }) {
  const run = useRun(active);
  const Cx = 592, Cy = 330;            // centro de la figura de Jesús
  const Yx = 556, Yy = 602;            // joven sentado a sus pies

  return (
    <SceneFrame pal={pal}>
      <defs>
        <linearGradient id="youthRobe4" x1="1" y1="0" x2="0" y2="1">
          <stop offset="0%" stopColor="#6a5a8e" />
          <stop offset="55%" stopColor={pal.deep} />
          <stop offset="100%" stopColor={pal.abyss} />
        </linearGradient>
        <linearGradient id="youthSkin4" x1="1" y1="0" x2="0" y2="0">
          <stop offset="0%" stopColor="#e6c49a" />
          <stop offset="100%" stopColor="#8a6f52" />
        </linearGradient>
        <radialGradient id="warmBloom4" cx="50%" cy="42%">
          <stop offset="0%" stopColor="#fff3d4" stopOpacity="0.5" />
          <stop offset="55%" stopColor={pal.warm} stopOpacity="0.18" />
          <stop offset="100%" stopColor={pal.warm} stopOpacity="0" />
        </radialGradient>
      </defs>

      <SkyBackdrop pal={pal} n={48} />

      <g key={run}>
        {/* bloom que une al Padre y al hijo, como familia */}
        <ellipse cx={Cx - 10} cy={Cy + 150} rx="270" ry="290" fill="url(#warmBloom4)" opacity="0"
          style={{ animation: 'c12-gaze 2.6s ease 4.6s both' }} />

        {/* Jesús (la cruz y, detrás, el Padre) aparece / se reconoce */}
        <g style={{ animation: 'c12-fadeIn 2s ease 0.2s both' }}>
          <LuminousChrist pal={pal} cx={Cx} cy={Cy} scale={1.0} />
        </g>

        {/* mirada de contemplación: del joven hacia el rostro del Padre */}
        <path d={`M ${Yx + 8} ${Yy - 96} Q ${Cx - 30} ${Cy - 30} ${Cx} ${Cy - 110}`} fill="none"
          stroke={pal.warm} strokeWidth="2" strokeDasharray="2 8" strokeLinecap="round" opacity="0"
          style={{ animation: 'c12-gaze 1.6s ease 5.2s both' }} />

        {/* EL JOVEN — se acerca y se sienta a los pies de la cruz a contemplar */}
        <g style={{ animation: 'c12-fromAfar 3s cubic-bezier(.45,0,.2,1) 2s both', transformOrigin: `${Yx}px ${Yy}px` }}>
          <g transform={`translate(${Yx} ${Yy})`}>
            <ellipse cx="0" cy="40" rx="52" ry="9" fill={pal.abyss} opacity="0.5" />
            {/* piernas cruzadas en el suelo */}
            <path d="M -48 34 Q -56 10 -22 8 L 34 10 Q 54 16 46 38 Q 0 48 -48 34 Z" fill="url(#youthRobe4)" />
            <path d="M -22 8 Q 0 2 34 10" stroke={pal.abyss} strokeWidth="2" opacity="0.4" fill="none" />
            {/* torso, recostado un poco hacia atrás para mirar arriba */}
            <g transform="rotate(-7 0 -6)">
              <path d="M -21 10 Q -28 -34 -18 -66 Q 0 -80 18 -66 Q 28 -34 22 10 Q 0 18 -21 10 Z" fill="url(#youthRobe4)" />
              {/* manto sobre el hombro */}
              <path d="M -20 -36 Q 0 -48 20 -36 Q 9 -28 0 -28 Q -9 -28 -20 -36 Z" fill={pal.abyss} opacity="0.6" />
              {/* rim cálido (luz de la cruz arriba) */}
              <path d="M 18 -66 Q 28 -34 22 10" stroke={pal.warm} strokeWidth="2.4" fill="none" opacity="0.6" strokeLinecap="round" />
              {/* brazos descansando sobre las rodillas */}
              <path d="M -16 -48 Q -40 -22 -40 6" stroke="url(#youthRobe4)" strokeWidth="13" fill="none" strokeLinecap="round" />
              <path d="M 16 -48 Q 40 -22 40 8" stroke="url(#youthRobe4)" strokeWidth="13" fill="none" strokeLinecap="round" />
              {/* cuello + cabeza levantada, contemplando */}
              <rect x="-3" y="-80" width="14" height="16" rx="5" fill="url(#youthSkin4)" />
              <g transform="rotate(8 4 -94)">
                <ellipse cx="4" cy="-94" rx="20" ry="24" fill="url(#youthSkin4)" />
                <path d="M -16 -102 Q 4 -126 24 -102 Q 26 -88 18 -90 L -8 -90 Q -18 -90 -16 -102 Z" fill="#3a2c20" />
                {/* mejilla iluminada + ojo contemplativo */}
                <path d="M 22 -98 Q 26 -86 18 -74" stroke={pal.warm} strokeWidth="1.8" fill="none" opacity="0.6" strokeLinecap="round" />
                <circle cx="12" cy="-98" r="2.4" fill={pal.warm} style={{ animation: 'c12-glow 2.8s ease-in-out infinite' }} />
              </g>
            </g>
          </g>
        </g>
      </g>
    </SceneFrame>
  );
}

// ════════════════════════════════════════════════════════════════════════
// ─── ESCENA 5 · UN ALTAR EN MEDIO DE ELLOS ───────────────────────────────
// Personas de rodillas, en círculo, tomadas de la mano, levantando un altar
// con una CRUZ — y Dios brilla en medio de ellos.
// ════════════════════════════════════════════════════════════════════════
function SceneCirculo({ pal, active }) {
  const run = useRun(active);
  const cx = 500, cy = 552, rx = 332, ry = 148;
  const N = 9;

  const figs = Array.from({ length: N }, (_, k) => {
    const theta = (k / N) * Math.PI * 2 + Math.PI / 2;
    const x = cx + rx * Math.cos(theta);
    const y = cy + ry * Math.sin(theta);
    const front = (Math.sin(theta) + 1) / 2;
    return { x, y, s: 0.62 + 0.55 * front, depth: front };
  }).sort((a, b) => a.depth - b.depth);

  const ellipsePath = `M ${cx - rx} ${cy} A ${rx} ${ry} 0 1 1 ${cx + rx} ${cy} A ${rx} ${ry} 0 1 1 ${cx - rx} ${cy} Z`;

  // Figura claramente ARRODILLADA, inclinada hacia el centro, con rim cálido
  const Kneel = ({ f, i }) => (
    <g style={{ animation: `c12-breatheSm ${4 + (i % 3) * 0.8}s ease-in-out ${(i % 5) * 0.4}s infinite`, transformOrigin: `${f.x}px ${f.y}px` }}>
      <g transform={`translate(${f.x} ${f.y}) scale(${f.s})`}>
        <ellipse cx="0" cy="42" rx="33" ry="8" fill={pal.abyss} opacity="0.45" />
        {/* talones/pies que asoman detrás */}
        <ellipse cx="-14" cy="40" rx="8" ry="4.5" fill={pal.abyss} />
        <ellipse cx="14" cy="40" rx="8" ry="4.5" fill={pal.abyss} />
        {/* piernas dobladas — rodillas apoyadas en el suelo */}
        <path d="M -22 38 Q -30 12 -14 6 L 14 6 Q 30 12 22 38 Q 0 46 -22 38 Z" fill="url(#circRobe)" />
        {/* torso erguido con leve reverencia */}
        <path d="M -18 8 Q -24 -38 -14 -72 Q 0 -86 14 -72 Q 24 -38 20 8 Q 0 16 -18 8 Z" fill="url(#circRobe)" />
        {/* manto sobre los hombros */}
        <path d="M -18 -36 Q 0 -48 18 -36 Q 8 -28 0 -28 Q -8 -28 -18 -36 Z" fill={pal.abyss} opacity="0.55" />
        {/* rim cálido del lado del altar */}
        <path d="M -14 -72 Q 0 -86 14 -72" stroke={pal.warm} strokeWidth="2.2" fill="none" opacity="0.5" strokeLinecap="round" />
        {/* cabeza inclinada */}
        <circle cx="0" cy="-86" r="15" fill="url(#circRobe)" />
        <path d="M 0 -100 Q 12 -96 13 -82" stroke={pal.warm} strokeWidth="1.6" fill="none" opacity="0.4" strokeLinecap="round" />
        {/* brazos hacia los lados (manos tomadas con el de al lado) */}
        <path d="M -15 -42 Q -42 -26 -56 -4" stroke="url(#circRobe)" strokeWidth="8.5" fill="none" strokeLinecap="round" />
        <path d="M 15 -42 Q 42 -26 56 -4" stroke="url(#circRobe)" strokeWidth="8.5" fill="none" strokeLinecap="round" />
      </g>
    </g>
  );

  return (
    <SceneFrame pal={pal}>
      <defs>
        <radialGradient id="altarGlow5" cx="50%" cy="40%">
          <stop offset="0%" stopColor="#fff7e6" stopOpacity="0.95" />
          <stop offset="35%" stopColor="#ffeec9" stopOpacity="0.55" />
          <stop offset="70%" stopColor={pal.warm} stopOpacity="0.22" />
          <stop offset="100%" stopColor={pal.warm} stopOpacity="0" />
        </radialGradient>
        <linearGradient id="altarBeam5" x1="0" y1="1" x2="0" y2="0">
          <stop offset="0%" stopColor={pal.warm} stopOpacity="0.6" />
          <stop offset="60%" stopColor="#fff3d4" stopOpacity="0.3" />
          <stop offset="100%" stopColor="#fff3d4" stopOpacity="0" />
        </linearGradient>
        <linearGradient id="stone5" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0%" stopColor={pal.medium} />
          <stop offset="100%" stopColor={pal.deep} />
        </linearGradient>
        <linearGradient id="cross5" x1="0" y1="0" x2="0.5" y2="1">
          <stop offset="0%" stopColor="#fff7e6" />
          <stop offset="60%" stopColor="#f3d9af" />
          <stop offset="100%" stopColor={pal.warmDeep} />
        </linearGradient>
        <linearGradient id="circRobe" x1="0" y1="0" x2="0.3" y2="1">
          <stop offset="0%" stopColor="#3a3f5e" />
          <stop offset="100%" stopColor={pal.abyss} />
        </linearGradient>
      </defs>

      <SkyBackdrop pal={pal} n={50} />

      {/* halo del altar */}
      <circle cx={cx} cy="430" r="220" fill="url(#altarGlow5)"
        style={{ animation: 'c12-glow 5.5s ease-in-out infinite', transformOrigin: `${cx}px 430px` }} />

      <g key={run}>
        {/* columna de luz que asciende detrás de la cruz */}
        <rect x={cx - 24} y="120" width="48" height="340" fill="url(#altarBeam5)"
          style={{ animation: 'c12-ascend 2.6s ease 0.3s both', transformOrigin: `${cx}px 460px` }} />
        {[-42, -22, 22, 42].map((a, i) => (
          <line key={i} x1={cx} y1="400"
            x2={cx + Math.sin(a * Math.PI / 180) * 250} y2={400 - Math.cos(a * Math.PI / 180) * 250}
            stroke={pal.warm} strokeWidth="1.4" strokeDasharray="3 8" opacity="0.4"
            style={{ animation: `c12-glowS ${4 + i}s ease-in-out ${i * 0.4}s infinite` }} />
        ))}
      </g>

      {/* ALTAR de piedra */}
      <ellipse cx={cx} cy="476" rx="62" ry="15" fill={pal.abyss} opacity="0.5" />
      <path d={`M ${cx - 50} 470 L ${cx - 40} 428 L ${cx + 40} 428 L ${cx + 50} 470 Z`} fill="url(#stone5)" stroke={pal.medium} strokeWidth="1" strokeOpacity="0.5" />
      <rect x={cx - 42} y="420" width="84" height="13" rx="3" fill="url(#stone5)" />

      {/* CRUZ sobre el altar */}
      <g style={{ animation: 'c12-glow 5s ease-in-out infinite' }}>
        <rect x={cx - 50} y="280" width="100" height="150" fill="url(#altarGlow5)" opacity="0.5" />
      </g>
      <g>
        <rect x={cx - 9} y="300" width="18" height="128" rx="3" fill="url(#cross5)" stroke="#fff7e6" strokeWidth="1" strokeOpacity="0.4" />
        <rect x={cx - 34} y="332" width="68" height="17" rx="3" fill="url(#cross5)" stroke="#fff7e6" strokeWidth="1" strokeOpacity="0.4" />
        <rect x={cx - 4} y="300" width="8" height="128" rx="3" fill="#fffaf0" opacity="0.5" />
      </g>
      <circle cx={cx} cy="426" r="13" fill="#fffaf0"
        style={{ animation: 'c12-pulse 3s ease-in-out infinite', transformOrigin: `${cx}px 426px` }} />

      {/* motas que ascienden */}
      <g key={'motes' + run}>
        {Array.from({ length: 10 }, (_, i) => (
          <circle key={i} cx={cx + (i % 5 - 2) * 16} cy="436" r={1.6 + (i % 3) * 0.7} fill="#fff3d4"
            style={{ animation: `c12-rise ${4 + (i % 4) * 0.8}s ease-in ${(i % 6) * 0.7}s infinite`, transformOrigin: `${cx}px 436px` }} />
        ))}
      </g>

      {/* figuras de rodillas alrededor */}
      {figs.map((f, i) => <Kneel key={i} f={f} i={i} />)}

      {/* anillo de manos tomadas + pulsos */}
      <path d={ellipsePath} fill="none" stroke={pal.warm} strokeWidth="2" opacity="0.5"
        style={{ animation: 'c12-glow 4s ease-in-out infinite' }} />
      <g key={'pulse' + run}>
        <circle r="4" fill="#fffaf0" style={{ offsetPath: `path('${ellipsePath}')`, animation: 'c12-ring 6s linear infinite' }} />
        <circle r="4" fill="#fffaf0" opacity="0.7" style={{ offsetPath: `path('${ellipsePath}')`, animation: 'c12-ring 6s linear 3s infinite' }} />
      </g>
    </SceneFrame>
  );
}

Object.assign(window, { ScenePortada, SceneRegazo, SceneCirculo });
