'use client';

import {useId} from 'react';

type Paint = (name:string)=>string;

const palettes = [
  ['#b7fff0','#35debd','#03957c','#075d60'],
  ['#c8e7ff','#6baaff','#3665e9','#16378b'],
  ['#ecdbff','#bb8cff','#8650e5','#49318f'],
  ['#fff0c1','#ffc56d','#e79438','#875123'],
  ['#c3fff9','#56ded8','#14a9b6','#116079'],
] as const;

function Platform({x,y,width=188,paint}:{x:number;y:number;width?:number;paint:Paint}){
 const h=width*.24;
 return <g><ellipse cx={x} cy={y+24} rx={width*.57} ry={h*.64} fill={paint('shadow')}/><path d={`M${x-width/2} ${y}v13l${width/2} ${h} ${width/2}-${h}v-13l-${width/2} ${h}Z`} fill={paint('side')} stroke={paint('edge')}/><path d={`M${x-width/2} ${y}l${width/2}-${h} ${width/2} ${h}-${width/2} ${h}Z`} fill={paint('platform')} stroke={paint('edge')}/><path d={`M${x-width*.43} ${y-1}l${width*.43}-${h*.86} ${width*.43} ${h*.86}`} fill="none" stroke="#fff" strokeOpacity=".72" strokeWidth="1.5"/></g>;
}

function Coin({x,y,r=28,paint,logo=false,className}:{x:number;y:number;r?:number;paint:Paint;logo?:boolean;className?:string}){
 return <g className={className}><circle cx={x+4} cy={y+5} r={r} fill={paint('deep')}/><circle cx={x} cy={y} r={r} fill={paint('metal')} stroke={paint('edge')} strokeWidth="1.4"/><circle cx={x} cy={y} r={r*.8} fill={paint('coin')} stroke="#fff" strokeOpacity=".6"/><path d={`M${x-r*.72} ${y-r*.34}a${r*.8} ${r*.8} 0 0 1 ${r*1.01}-${r*.39}`} fill="none" stroke="#fff" strokeWidth="2" strokeLinecap="round" opacity=".82"/>{logo?<image href="/images/plank-symbol.svg" x={x-r*.31} y={y-r*.43} width={r*.62} height={r*.8}/>:<path d={`m${x} ${y-r*.39} ${r*.27} ${r*.39}-${r*.27} ${r*.39}-${r*.27}-${r*.39}Z`} fill={paint('accent')} stroke="#fff" strokeOpacity=".55"/>}</g>;
}

function TokenStack({x,y,paint,levels=3}:{x:number;y:number;paint:Paint;levels?:number}){
 return <g>{Array.from({length:levels},(_,i)=><g key={i} transform={`translate(0 ${-i*10})`}><path d={`M${x-29} ${y}v7c0 15 58 15 58 0v-7`} fill={paint('metal')} stroke={paint('edge')}/><ellipse cx={x} cy={y} rx="29" ry="11" fill={paint('coin')} stroke={paint('edge')}/><ellipse cx={x} cy={y} rx="21" ry="7" fill="none" stroke="#fff" strokeOpacity=".5"/><path d={`M${x-21} ${y+8}v4m8-2v4m9-3v4m9-3v4m9-4v4`} stroke={paint('deep')} opacity=".4"/></g>)}</g>;
}

function SelectionScene({paint}:{paint:Paint}){
 return <>
  <path d="M173 184 307 260 445 181" fill="none" stroke={paint('accent')} strokeWidth="1.5" strokeDasharray="4 7" opacity=".45"/>
  <Platform x={363} y={258} width={230} paint={paint}/>
  <Platform x={178} y={198} width={144} paint={paint}/>
  <g className="tz-scene-float">
   <path d="m319 105 70 40v108l-70-40Z" fill={paint('accent')} stroke={paint('edge')}/><path d="m389 145 46-27v108l-46 27Z" fill={paint('deep')} stroke={paint('edge')}/><path d="m319 105 47-27 69 40-46 27Z" fill={paint('metal')} stroke="#d6fff4"/>
   <path d="m330 113 35-20 46 27-34 20Z" fill="#e7fff7" opacity=".8"/>
   {[0,1,2,3,4].map(row=><g key={row} stroke="#d3fff6" strokeWidth="5" strokeLinecap="round"><path d={`M333 ${133+row*20}l10 6m12 7 10 6`} opacity=".85"/><path d={`M401 ${155+row*16}l19-11`} opacity=".6"/></g>)}
   <path d="m298 190 38 22v45l-38-22Z" fill={paint('metal')} stroke={paint('edge')}/><path d="m336 212 26-15v45l-26 15Z" fill={paint('accent')}/><path d="m298 190 25-15 39 22-26 15Z" fill="#c4fff0"/><path d="m309 215 12 7v24l-12-7Z" fill={paint('deep')} opacity=".7"/>
  </g>
  <g transform="translate(128 61) rotate(-9 52 57)" filter={paint('lift')}>
   <rect x="4" y="5" width="110" height="121" rx="20" fill={paint('deep')} opacity=".4"/><rect width="110" height="121" rx="20" fill={paint('glass')} stroke={paint('edge')} strokeWidth="1.5"/>
   <path d="m55 21 31 26-31 45-31-45Z" fill="#8e70ed" stroke="#e7e0ff"/><path d="m55 21 13 26H42Z" fill="#e5ceff"/><path d="M24 47h62L55 92Z" fill="#ac8eff"/><path d="m42 47 13 45 13-45Z" fill="#795bdc"/><path d="M24 47h62" stroke="#fff" strokeOpacity=".8"/>
   <path d="M29 106h52" stroke={paint('accent')} strokeWidth="4" strokeLinecap="round" opacity=".65"/>
  </g>
  <g transform="translate(185 212) rotate(8)">
   <rect x="4" y="5" width="94" height="66" rx="13" fill={paint('deep')} opacity=".35"/><rect width="94" height="66" rx="13" fill={paint('glass')} stroke={paint('edge')}/><rect x="14" y="16" width="26" height="29" rx="7" fill="#ffba74"/><path d="m20 32 7-8 7 8-7 8Z" fill="#fff2d9"/><path d="M51 23h27m-27 11h20m-20 11h27" stroke={paint('accent')} strokeWidth="4" strokeLinecap="round" opacity=".65"/>
  </g>
  <g className="tz-scene-pulse"><circle cx="448" cy="75" r="28" fill={paint('deep')} opacity=".13"/><circle cx="448" cy="75" r="21" fill={paint('metal')} stroke="#d9fff4" strokeWidth="1.5"/><path d="m438 75 7 7 13-14" fill="none" stroke="#087b65" strokeWidth="4" strokeLinecap="round" strokeLinejoin="round"/></g>
  <path d="m453 180 12 27 4-11 11-4Z" fill="#f4fffb" stroke={paint('accent')} strokeWidth="2"/>
 </>;
}

function VerificationScene({paint}:{paint:Paint}){
 return <>
  <Platform x={315} y={258} width={250} paint={paint}/>
  <path d="M155 156 218 120 309 173 464 147M311 173l-37 95" fill="none" stroke={paint('accent')} strokeDasharray="5 8" strokeWidth="1.7" opacity=".5"/>
  <g transform="translate(112 110) rotate(-11 55 75)" filter={paint('lift')}>
   <path d="M6 7h77l34 35v122H6Z" fill={paint('deep')} opacity=".35"/><path d="M0 0h77l34 35v122H0Z" fill={paint('paper')} stroke={paint('edge')} strokeWidth="1.5"/><path d="M77 0v35h34" fill="#b7d7ff" stroke="#edf8ff"/><rect x="19" y="29" width="35" height="29" rx="6" fill="#619bef"/><path d="m25 48 10-12 10 12m-10-12v17" fill="none" stroke="#ecf7ff" strokeWidth="2.5"/>
   <path d="M19 79h73m-73 13h59m-59 13h68" fill="none" stroke="#85b0e9" strokeWidth="5" strokeLinecap="round"/>
   <circle cx="72" cy="132" r="14" fill="#96d6ef"/><path d="m65 132 5 5 9-10" fill="none" stroke="#267494" strokeWidth="2.6" strokeLinecap="round"/>
  </g>
  <g className="tz-scene-float" filter={paint('lift')}>
   <path d="M312 55q36 27 80 34v73c0 57-34 86-80 109-46-23-80-52-80-109V89q45-7 80-34Z" fill={paint('deep')} transform="translate(7 5)"/>
   <path d="M312 50q36 27 80 34v73c0 57-34 86-80 109-46-23-80-52-80-109V84q45-7 80-34Z" fill={paint('metal')} stroke="#d9ebff" strokeWidth="2"/>
   <path d="M312 67q30 22 64 29v60c0 45-26 71-64 93-38-22-64-48-64-93V96q35-7 64-29Z" fill={paint('shield')} stroke="#cfebff" strokeOpacity=".55"/>
   <path d="M251 96q32-5 61-27v174" fill="none" stroke="#fff" strokeOpacity=".25" strokeWidth="2"/>
   <circle cx="312" cy="151" r="36" fill="#d3f8ff" fillOpacity=".2" stroke="#dbfaff" strokeOpacity=".65"/><path d="m290 151 15 16 30-33" fill="none" stroke="#f0ffff" strokeWidth="9" strokeLinecap="round" strokeLinejoin="round"/>
  </g>
  <g transform="translate(433 100)"><path d="M0 117h78l-13-10H14Z" fill={paint('metal')} stroke={paint('edge')}/><path d="M39 105V19M2 38l74-18" stroke={paint('deep')} strokeWidth="6" strokeLinecap="round"/><circle cx="39" cy="29" r="8" fill={paint('metal')} stroke={paint('edge')}/><g fill="none" stroke="#93c7fb" strokeWidth="2"><path d="m3 38-16 39H21Zm73-18-17 39h34Z"/></g><path d="M-13 77h34c-3 21-31 21-34 0Zm72-18h34c-4 20-31 20-34 0Z" fill={paint('metal')} stroke={paint('edge')}/></g>
  <TokenStack x={438} y={258} levels={3} paint={paint}/>
  {[{x:214,y:78},{x:458,y:67},{x:510,y:236}].map(({x,y},i)=><g key={i} className="tz-scene-pulse"><circle cx={x} cy={y} r="12" fill={paint('glass')} stroke={paint('edge')}/><path d={`m${x-5} ${y} 3 3 7-7`} fill="none" stroke={paint('accent')} strokeWidth="2.5" strokeLinecap="round"/></g>)}
 </>;
}

function MintingScene({paint}:{paint:Paint}){
 return <>
  <ellipse cx="322" cy="259" rx="111" ry="38" fill={paint('shadow')}/><path d="M225 222v25c0 51 194 51 194 0v-25" fill={paint('side')} stroke={paint('edge')}/><ellipse cx="322" cy="222" rx="97" ry="36" fill={paint('platform')} stroke={paint('edge')}/><ellipse cx="322" cy="222" rx="76" ry="27" fill="none" stroke="#dacbff" strokeWidth="2"/><ellipse cx="322" cy="223" rx="52" ry="18" fill={paint('accent')} opacity=".3"/>
  <g fill="none" stroke={paint('accent')} strokeWidth="1.5" opacity=".6"><path d="M185 166 230 144 273 174m102-41 83-47m-73 95 95 39m-159-79v-61"/><ellipse cx="322" cy="151" rx="96" ry="82" strokeDasharray="3 9"/></g>
  <g className="tz-scene-float"><Coin x={320} y={135} r={65} logo paint={paint}/><path d="m377 71 4-12 4 12 12 4-12 4-4 12-4-12-12-4Z" fill="#efc7ff" stroke="#fff0ff"/><path d="M286 220v-35m69 35v-33" stroke={paint('accent')} strokeDasharray="3 5" opacity=".5"/></g>
  <g transform="translate(92 137) rotate(-8 62 56)" filter={paint('lift')}><rect x="5" y="6" width="126" height="113" rx="17" fill={paint('deep')} opacity=".6"/><rect width="126" height="113" rx="17" fill={paint('glass')} stroke={paint('edge')} strokeWidth="1.5"/>{[28,56,84].map((y,i)=><g key={y}><path d={`M21 ${y}h84`} stroke="#a998d9" strokeWidth="4" strokeLinecap="round" opacity=".5"/><path d={`M21 ${y}h${[34,58,22][i]}`} stroke={paint('accent')} strokeWidth="4" strokeLinecap="round"/><circle cx={[55,79,43][i]} cy={y} r="8" fill={paint('metal')} stroke="#eee2ff" strokeWidth="2"/></g>)}</g>
  <Platform x={471} y={254} width={124} paint={paint}/><TokenStack x={459} y={251} levels={5} paint={paint}/><TokenStack x={500} y={265} levels={3} paint={paint}/><Coin x={487} y={180} r={24} paint={paint}/>
  {[{x:157,y:82,r:15},{x:448,y:64,r:16},{x:534,y:137,r:11},{x:221,y:270,r:9}].map(({x,y,r},i)=><g key={i} className="tz-scene-pulse"><circle cx={x} cy={y} r={r+5} fill={paint('accent')} opacity=".1"/><circle cx={x} cy={y} r={r} fill={paint('metal')} stroke={paint('edge')}/><path d={`m${x} ${y-r*.5} ${r*.5} ${r*.5}-${r*.5} ${r*.5}-${r*.5}-${r*.5}Z`} fill={paint('deep')} opacity=".65"/></g>)}
 </>;
}

function MarketPortal({x,y,paint,type=0}:{x:number;y:number;paint:Paint;type?:number}){
 return <g transform={`translate(${x} ${y})`}><path d="M-40 20v9l40 23 40-23v-9L0 43Z" fill={paint('side')} stroke={paint('edge')}/><path d="m-40 20 40-23 40 23L0 43Z" fill={paint('platform')} stroke={paint('edge')}/><rect x="-28" y="-41" width="56" height="62" rx="12" fill={paint('glass')} stroke={paint('edge')} strokeWidth="1.5"/>{type===0?<g fill="none" stroke="#508ac3" strokeWidth="2.5"><circle cy="-11" r="16"/><ellipse cy="-11" rx="7" ry="16"/><path d="M-16-11h32M-12-21h24m-24 20h24"/></g>:type===1?<g stroke="#8671c2" strokeWidth="2.5" fill="none"><path d="m-16-17 16-10 16 10M-13-14v22m13-22v22m13-22v22M-18 10h36"/></g>:<g fill="none" stroke="#26aa9c" strokeWidth="2.8"><path d="M-17-22h34v29h-34Z"/><path d="m-12-2 8-8 7 4 9-10" strokeLinecap="round" strokeLinejoin="round"/></g>}</g>;
}

function DistributionScene({paint}:{paint:Paint}){
 return <>
  <g fill="none" stroke={paint('accent')} strokeWidth="2"><path d="M252 126C206 103 172 82 110 87M370 122c46-33 84-52 134-43M365 228c48 32 73 41 134 31" strokeDasharray="5 7"/><path d="m130 82-17 5 13 10m354-25 19 7-15 10m-12 158 17 12-19 3" strokeLinecap="round" strokeLinejoin="round"/></g>
  <MarketPortal x={113} y={99} paint={paint}/><MarketPortal x={513} y={91} paint={paint} type={1}/><MarketPortal x={514} y={250} paint={paint} type={2}/>
  <Platform x={309} y={267} width={240} paint={paint}/>
  <g className="tz-scene-float" filter={paint('lift')}>
   <path d="M222 103h168v145l-18 13H204V119Z" fill={paint('deep')}/><rect x="207" y="104" width="165" height="146" rx="15" fill={paint('paper')} stroke={paint('edge')} strokeWidth="1.5"/>
   <path d="M225 103V75c0-8 7-15 15-15h113c8 0 15 7 15 15v28" fill={paint('metal')} stroke={paint('edge')}/><rect x="241" y="68" width="111" height="38" rx="9" fill="#fff8e4" fillOpacity=".75"/>
   <image href="/images/plank-symbol.svg" x="286" y="73" width="22" height="28"/>
   <path d="M211 112h170l17 35H194Z" fill={paint('metal')} stroke={paint('edge')}/>
   {[0,1,2,3,4].map(i=><path key={i} d={`M${211+i*34} 112h17l${-8+i*4} 35h-20Z`} fill={i%2?'#f8bb59':'#fff1c7'} opacity=".78"/>)}
   <path d="M194 147h204v9c0 14-26 14-26 0-1 14-26 14-27 0-1 14-26 14-27 0-1 14-27 14-28 0-1 14-28 14-29 0-1 14-27 14-28 0-1 14-26 14-27 0-1 14-22 14-22 0Z" fill={paint('accent')} stroke={paint('edge')}/>
   <rect x="224" y="177" width="86" height="54" rx="9" fill={paint('glass')} stroke="#d6ba84"/><path d="m228 222 76-41" stroke="#fff" strokeWidth="4" opacity=".7"/>
   <rect x="323" y="172" width="35" height="78" rx="8" fill={paint('deep')} opacity=".85"/><path d="M330 180h20v63h-20Z" fill={paint('glass')}/><circle cx="346" cy="213" r="2.5" fill="#fff2c4"/>
   <Coin x={263} y={206} r={20} logo paint={paint}/>
  </g>
  <Coin x={160} y={185} r={20} paint={paint} className="tz-scene-pulse"/><Coin x={435} y={139} r={16} paint={paint} className="tz-scene-pulse"/><TokenStack x={421} y={278} levels={3} paint={paint}/>
 </>;
}

function ManagementScene({paint}:{paint:Paint}){
 return <>
  <Platform x={315} y={262} width={323} paint={paint}/>
  <path d="M139 212 183 189m219-59 48-39m-61 140 65 25" fill="none" stroke={paint('accent')} strokeWidth="1.7" strokeDasharray="4 7" opacity=".6"/>
  <g className="tz-scene-float" filter={paint('lift')}><g transform="translate(161 62) skewY(-5)">
   <rect x="7" y="8" width="266" height="177" rx="18" fill={paint('deep')}/><rect width="266" height="177" rx="18" fill={paint('paper')} stroke={paint('edge')} strokeWidth="1.5"/>
   <path d="M0 33h266" stroke="#85c8d2" strokeOpacity=".45"/><circle cx="19" cy="17" r="4" fill="#50d1b2"/><circle cx="34" cy="17" r="4" fill="#8baff5"/><circle cx="49" cy="17" r="4" fill="#cfb1f5"/>
   <path d="M199 17h45" stroke="#5dabb8" strokeWidth="4" strokeLinecap="round" opacity=".55"/>
   <rect x="17" y="49" width="61" height="109" rx="10" fill={paint('glass')} stroke="#b0dde3"/><circle cx="48" cy="78" r="16" fill="none" stroke="#8ee1db" strokeWidth="8"/><path d="M48 62a16 16 0 0 1 16 16" fill="none" stroke="#9675dd" strokeWidth="8"/><path d="M30 111h35m-35 12h25m-25 12h35" stroke="#61aeb8" strokeWidth="4" strokeLinecap="round" opacity=".65"/>
   <rect x="91" y="49" width="157" height="109" rx="10" fill="#e7fffe" fillOpacity=".7" stroke="#b0dde3"/>
   <g stroke="#58aebe" strokeOpacity=".18"><path d="M102 78h134m-134 24h134m-134 24h134M127 64v81m37-81v81m37-81v81"/></g>
   <path d="m103 131 25-15 23 8 26-28 25 7 33-33v74H103Z" fill={paint('chart')} opacity=".65"/>
   <path d="m103 131 25-15 23 8 26-28 25 7 33-33" fill="none" stroke="#159aaa" strokeWidth="4" strokeLinecap="round" strokeLinejoin="round"/>
   <circle cx="235" cy="70" r="5" fill="#2bd8c1" stroke="#fff" strokeWidth="2"/>
  </g></g>
  <g transform="translate(453 82) rotate(12)" filter={paint('lift')}><rect x="-1" y="4" width="91" height="60" rx="12" fill="#5276bd"/><rect x="-6" width="91" height="60" rx="12" fill={paint('credit')} stroke="#e4e8ff"/><rect x="7" y="13" width="17" height="13" rx="3" fill="#ffe0a1" stroke="#fff2ce"/><path d="M8 42h13m7 0h13m7 0h13" stroke="#e9f0ff" strokeWidth="3" strokeLinecap="round"/><circle cx="63" cy="21" r="9" fill="#c5e7ff" opacity=".6"/><circle cx="72" cy="21" r="9" fill="#99a9fb" opacity=".8"/></g>
  <g transform="translate(125 234)" filter={paint('lift')}><circle r="42" fill={paint('glass')} stroke={paint('edge')}/><path d="M-14-8v-12a14 14 0 0 1 28 0v12" fill="none" stroke={paint('metal')} strokeWidth="8"/><rect x="-22" y="-9" width="44" height="35" rx="10" fill={paint('metal')} stroke="#cffcf6"/><circle cy="5" r="5" fill={paint('deep')}/><path d="M0 8v7" stroke={paint('deep')} strokeWidth="4" strokeLinecap="round"/></g>
  <TokenStack x={434} y={261} levels={4} paint={paint}/><TokenStack x={480} y={277} levels={3} paint={paint}/><Coin x={489} y={207} r={27} logo paint={paint}/>
  <g fill="none" stroke={paint('accent')} strokeWidth="2" strokeLinecap="round"><path d="M451 171c11-11 34-11 47 1m-6-9 8 10-13 2M462 304c-22 1-40-10-47-26m-3 10 1-13 11 5"/></g>
 </>;
}

/** Five separate editorial scenes; decorative, never a real issuance/status display. */
export function TokenizationStageScene({stage}:{stage:number}){
 const id=`tz-scene-${useId().replace(/[^a-zA-Z0-9_-]/g,'')}`;
 const current=Math.max(0,Math.min(4,Math.floor(Number.isFinite(stage)?stage:0)));
 const [light,bright,accent,deep]=palettes[current];
 const paint:Paint=name=>`url(#${id}-${name})`;
 const scenes=[SelectionScene,VerificationScene,MintingScene,DistributionScene,ManagementScene];
 const Scene=scenes[current];
 return <svg viewBox="0 0 620 330" className="tz-graphic tz-stage-scene" data-stage={current} aria-hidden="true" focusable="false">
  <defs>
   <linearGradient id={`${id}-accent`} x1="0" y1="0" x2="1" y2="1"><stop stopColor={bright}/><stop offset="1" stopColor={accent}/></linearGradient>
   <linearGradient id={`${id}-deep`} x1="0" y1="0" x2=".7" y2="1"><stop stopColor={accent}/><stop offset="1" stopColor={deep}/></linearGradient>
   <linearGradient id={`${id}-metal`} x1="0" y1="0" x2=".8" y2="1"><stop stopColor="#fff"/><stop offset=".17" stopColor={light}/><stop offset=".47" stopColor={bright}/><stop offset=".74" stopColor={accent}/><stop offset="1" stopColor={bright}/></linearGradient>
   <linearGradient id={`${id}-coin`} x1=".2" y1="0" x2=".8" y2="1"><stop stopColor="#fff"/><stop offset=".56" stopColor={light}/><stop offset="1" stopColor={bright}/></linearGradient>
   <linearGradient id={`${id}-glass`} x1="0" y1="0" x2="1" y2="1"><stop stopColor="#fff" stopOpacity=".89"/><stop offset=".5" stopColor={light} stopOpacity=".62"/><stop offset="1" stopColor={bright} stopOpacity=".32"/></linearGradient>
   <linearGradient id={`${id}-paper`} x1="0" y1="0" x2="1" y2="1"><stop stopColor="#faffff"/><stop offset="1" stopColor={light}/></linearGradient>
   <linearGradient id={`${id}-platform`} x1="0" y1="0" x2="1" y2="1"><stop stopColor={light} stopOpacity=".65"/><stop offset=".55" stopColor={bright} stopOpacity=".25"/><stop offset="1" stopColor={accent} stopOpacity=".4"/></linearGradient>
   <linearGradient id={`${id}-side`} x1="0" y1="0" x2="1" y2="1"><stop stopColor={accent} stopOpacity=".4"/><stop offset=".5" stopColor={deep} stopOpacity=".74"/><stop offset="1" stopColor={accent} stopOpacity=".3"/></linearGradient>
   <linearGradient id={`${id}-edge`} x1="0" y1="0" x2="1" y2="1"><stop stopColor="#fff" stopOpacity=".96"/><stop offset=".5" stopColor={bright} stopOpacity=".8"/><stop offset="1" stopColor={light} stopOpacity=".55"/></linearGradient>
   <linearGradient id={`${id}-shield`} x1="0" y1="0" x2="1" y2="1"><stop stopColor="#82caff" stopOpacity=".7"/><stop offset=".53" stopColor="#397def"/><stop offset="1" stopColor="#294aba"/></linearGradient>
   <linearGradient id={`${id}-chart`} x1="0" y1="0" x2="0" y2="1"><stop stopColor="#22bdbe" stopOpacity=".5"/><stop offset="1" stopColor="#55d5b9" stopOpacity="0"/></linearGradient>
   <linearGradient id={`${id}-credit`} x1="0" y1="0" x2="1" y2="1"><stop stopColor="#abdfff"/><stop offset=".5" stopColor="#7d98e7"/><stop offset="1" stopColor="#9a76d8"/></linearGradient>
   <radialGradient id={`${id}-shadow`}><stop stopColor={deep} stopOpacity=".3"/><stop offset="1" stopColor={deep} stopOpacity="0"/></radialGradient>
   <radialGradient id={`${id}-aura`}><stop stopColor={bright} stopOpacity=".18"/><stop offset="1" stopColor={bright} stopOpacity="0"/></radialGradient>
   <filter id={`${id}-lift`} x="-35%" y="-30%" width="180%" height="185%"><feDropShadow dx="0" dy="9" stdDeviation="8" floodColor={deep} floodOpacity=".15"/></filter>
  </defs>
  <ellipse cx="316" cy="181" rx="248" ry="138" fill={paint('aura')}/>
  <g fill="none" stroke={accent} strokeWidth=".65" opacity=".12"><path d="m62 253 241-139 253 147M103 278l239-137 174 100M149 301l241-138 134 78M139 221l189 109M183 196l215 124M228 169l252 145"/></g>
  <Scene paint={paint}/>
  <g fill={bright} opacity=".8"><circle cx="82" cy="174" r="2"/><circle cx="209" cy="47" r="2"/><circle cx="549" cy="189" r="2"/><circle cx="361" cy="309" r="1.5"/><path d="m466 33 2-6 2 6 6 2-6 2-2 6-2-6-6-2Z"/><path d="m79 290 1.5-4 1.5 4 4 1.5-4 1.5-1.5 4-1.5-4-4-1.5Z"/></g>
 </svg>;
}
