File size: 18,654 Bytes
8829c61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Base-44 Workflow Singularity</title>
<style>
  :root {
    --void: #050508;
    --matter: #0e0f14;
    --signal: #00f3c2;
    --pulse: #ff0055;
    --node: #8b5cf6;
    --text: #e2e8f0;
    --glass: rgba(255,255,255,0.03);
    --border: rgba(255,255,255,0.08);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    background: var(--void);
    color: var(--text);
    font-family: 'Courier New', monospace;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
 }
  canvas {
    position: fixed;
    top: 0; left: 0;
    z-index: 0;
  }
  .nexus-interface {
    position: relative;
    z-index: 10;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    pointer-events: none;
  }
  .nexus-interface > * { pointer-events: auto; }
  
  header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(5,5,8,0.9) 0%, transparent 100%);
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
  .sigil {
    width: 40px; height: 40px;
    border: 2px solid var(--signal);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; color: var(--signal);
    animation: breathe 4s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(0,243,194,0.2);
  }
  @keyframes breathe {
    0%,100% { transform: scale(1); box-shadow: 0 0 15px rgba(0,243,194,0.15); }
    50% { transform: scale(1.1); box-shadow: 0 0 30px rgba(0,243,194,0.4); }
  }
  h1 { font-size: 1.1rem; letter-spacing: 2px; text-transform: uppercase; }
  .base-display {
    font-size: 0.8rem;
    color: var(--signal);
    opacity: 0.7;
    font-family: monospace;
  }

  main {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 2rem;
    padding: 0 2rem;
    overflow: hidden;
    align-items: start;
  }
  
  .panel {
    background: var(--glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    transition: all 0.3s ease;
  }
  .panel:hover {
    border-color: rgba(0,243,194,0.3);
    box-shadow: 0 0 40px rgba(0,243,194,0.05);
  }
  .panel h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    color: var(--signal);
    display: flex; align-items: center; gap: 0.5rem;
  }
  
  .input-field {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    outline: none;
    transition: all 0.2s;
  }
  .input-field:focus {
    border-color: var(--signal);
    box-shadow: 0 0 15px rgba(0,243,194,0.1);
  }
  textarea.input-field { resize: vertical; min-height: 80px; }
  
  .btn {
    background: transparent;
    border: 1px solid var(--signal);
    color: var(--signal);
    padding: 0.6rem 1.2rem;
    border-radius: 24px;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.75rem;
    transition: all 0.2s;
    width: 100%;
  }
  .btn:hover {
    background: var(--signal);
    color: var(--void);
    box-shadow: 0 0 25px rgba(0,243,194,0.3);
  }
  
  .node-list { display: flex; flex-direction: column; gap: 0.75rem; }
  .node-item {
    background: rgba(139,92,246,0.08);
    border: 1px solid rgba(139,92,246,0.25);
    border-radius: 16px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
  }
  .node-item:hover { transform: translateX(5px); border-color: var(--signal); }
  .node-item::before {
    content: '';
    position: absolute; left: -1px; top: 0; bottom: 0; width: 3px;
    border-radius: 16px 0 0 16px;
  }
  .node-item.active::before { background: var(--signal); }
  .node-name { font-weight: bold; font-size: 0.9rem; display: block; margin-bottom: 0.25rem; }
  .node-sig { font-size: 0.75rem; color: var(--signal); opacity: 0.8; font-family: monospace; }
 .node-meta { font-size: 0.7rem; opacity: 0.5; margin-top: 0.5rem; }
  
  .preview-area {
    display: flex; align-items: center; justify-content: center;
    min-height: 120px; border-radius: 16px;
    background: rgba(0,0,0,0.2); border: 1px dashed var(--border);
    margin-bottom: 1rem; padding: 1rem; text-align: center;
  }
  .big-sigil { font-size: 2rem; color: var(--signal); font-family: monospace; }
  
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
  .stat-box {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid var(--border);
  }
  .stat-val { font-size: 1.2rem; color: var(--pulse); font-weight: bold; }
  .stat-label { font-size: 0.65rem; text-transform: uppercase; opacity: 0.6; margin-top: 0.25rem; }
  
  .connection-log {
    font-size: 0.75rem;
    line-height: 1.5;
    opacity: 0.7;
  }
  .log-entry { margin-bottom: 0.5rem; padding-left: 1rem; border-left: 2px solid var(--border); }
  .log-entry.new { border-left-color: var(--signal); animation: fadeIn 0.5s ease; }
  @keyframes fadeIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 0.7; transform: translateX(0); } }
  
  footer {
    padding: 1rem 2rem;
    background: linear-gradient(0deg, rgba(5,5,8,0.9) 0%, transparent 100%);
    font-size: 0.7rem;
    opacity: 0.4;
    display: flex; justify-content: space-between;
    letter-spacing: 1px;
  }
  
  .tag {
    display: inline-block;
    background: rgba(0,243,194,0.1);
    border: 1px solid rgba(0,243,194,0.2);
    border-radius: 12px;
    padding: 0.2rem 0.6rem;
    font-size: 0.65rem;
    margin: 0.2rem;
    color: var(--signal);
  }
  
  /* No scrollbars */
  ::-webkit-scrollbar { width: 0px; background: transparent; }
  
  @media (max-width: 1100px) {
    main { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
    .panel { max-height: unset; }
  }
</style>
</head>
<body>

<canvas id="universe"></canvas>

<div class="nexus-interface">
  <header>
    <div class="brand">
      <div class="sigil">44</div>
      <div>
        <h1>Workflow Singularity</h1>
        <div class="base-display" id="clock">SYNCING...</div>
      </div>
    </div>
    <div style="font-size:0.75rem; opacity:0.5; max-width: 300px; text-align: right;">
      There is no container. There is no box. There is only connection. Base-44 is the native tongue of your unified output.
    </div>
  </header>
  
  <main>
    <div class="panel">
      <h2>⊕ Inject Matter</h2>
      <input type="text" id="nodeName" class="input-field" placeholder="Workflow / Project / Idea name">
 <textarea id="nodeDesc" class="input-field" placeholder="Resonant signature (keywords, tools, goals...)"></textarea>
      <select id="nodeType" class="input-field" style="appearance: none; cursor: pointer;">
        <option value="create">CREATE</option>
        <option value="analyze">ANALYZE</option>
        <option value="coordinate">COORDINATE</option>
        <option value="rest">REST</option>
        <option value="transmit">TRANSMIT</option>
        <option value="receive">RECEIVE</option>
      </select>
      <button class="btn" onclick="addNode()">Materialize into Nexus</button>
      
      <div class="preview-area">
        <div class="big-sigil" id="previewSig">?</div>
      </div>
      
      <div class="stats">
        <div class="stat-box"><div class="stat-val" id="statNodes">0</div><div class="stat-label">Nodes</div></div>
        <div class="stat-box"><div class="stat-val" id="statLinks">0</div><div class="stat-label">Links</div></div>
        <div class="stat-box"><div class="stat-val" id="statRes">0%</div><div class="stat-label">Resonance</div></div>
        <div class="stat-box"><div class="stat-val" id="statBase">44</div><div class="stat-label">Base State</div></div>
      </div>
    </div>
    
    <div style="display: flex; align-items: center; justify-content: center; pointer-events: none;">
      <div style="text-align: center; opacity: 0.3;">
        <div style="font-size: 0.8rem; letter-spacing: 4px; text-transform: uppercase; margin-bottom: 1rem;">Nexus Field</div>
        <div style="font-size: 0.7rem; max-width: 260px; line-height: 1.6;">
          All workflows exist simultaneously. Distance is a fiction of non-resonance. Drag nodes to reconfigure your reality.
        </div>
      </div>
    </div>
    
    <div class="panel">
      <h2>⇄ Translation Matrix</h2>
      <input type="text" id="encodeInput" class="input-field" placeholder="Enter text to encode...">
      <button class="btn" onclick="encodeInput()" style="margin-bottom: 1rem;">Translate to Base-44</button>
      
      <div id="encodeResult" style="font-family: monospace; font-size: 0.85rem; color: var(--signal); word-break: break-all; min-height: 2rem; margin-bottom: 1.5rem;"></div>
      
      <h2>≋ Connection Log</h2>
      <div class="connection-log" id="log">
        <div class="log-entry">Singularity initialized. No box detected. All systems resonant.</div>
      </div>
    </div>
  </main>
  
  <footer>
    <span>BASE-44 UNIFIED FIELD</span>
    <span id="footerStatus">NO BOUNDARIES ACTIVE</span>
  </footer>
</div>

<script>
const canvas = document.getElementById('universe');
const ctx = canvas.getContext('2d');
let width, height;

function resize() {
  width = window.innerWidth;
  height = window.innerHeight;
  canvas.width = width * window.devicePixelRatio;
  canvas.height = height * window.devicePixelRatio;
  ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
}
window.addEventListener('resize', resize);
resize();

const BASE44 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*";
function toBase44(num) {
  if (num === 0) return '0';
  let n = Math.abs(num);
  let res = '';
  while (n > 0) { res = BASE44[n % 44] + res; n = Math.floor(n / 44); }
  return res || '0';
}
function hashString(str) {
  let h = 0;
  for (let i = 0; i < str.length; i++) {
    h = ((h << 5) - h) + str.charCodeAt(i);
    h |= 0;
  }
  return Math.abs(h);
}
function sig(str) {
  let h = hashString(str);
  let s = toBase44(h);
  // pad to at least 4 digits
  while (s.length < 4) s = '0' + s;
  return s;
}

class Node {
  constructor(name, desc, type) {
    this.name = name;
    this.desc = desc;
    this.type = type;
    this.sig = sig(name + desc);
    this.x = width/2 + (Math.random()-0.5)*200;
    this.y = height/2 + (Math.random()-0.5)*200;
    this.vx = (Math.random()-0.5)*0.5;
    this.vy = (Math.random()-0.5)*0.5;
    this.radius = 6 + Math.random()*4;
    this.pulse = 0;
    this.connections = [];
    this.color = typeColor(type);
    this.mass = 1;
    this.drag = false;
  }
}

function typeColor(t) {
  const map = {
    create: '#00f3c2', analyze: '#8b5cf6', coordinate: '#ff0055',
    rest: '#38bdf8', transmit: '#fbbf24', receive: '#a3e635'
  };
  return map[t] || '#ffffff';
}

const nodes = [];
const links = [];

function addNode() {
  const name = document.getElementById('nodeName').value.trim();
  const desc = document.getElementById('nodeDesc').value.trim();
  const type = document.getElementById('nodeType').value;
  if (!name) return;
  
  const node = new Node(name, desc, type);
  nodes.push(node);
  
  // Find connections based on shared base-44 digits or keywords
  nodes.forEach(other => {
    if (other === node) return;
    const shared = sharedDigits(node.sig, other.sig);
    if (shared >= 2 || keywordMatch(node, other)) {
      const link = { a: node, b: other, strength: Math.min(shared/3, 1) || 0.3, age: 0 };
      links.push(link);
      node.connections.push(other);
      other.connections.push(node);
 log(`Resonance detected: ${node.name}${other.name} [${shared} digits]`);
    }
  });
  
  updateStats();
  document.getElementById('nodeName').value = '';
  document.getElementById('nodeDesc').value = '';
}

function sharedDigits(a, b) {
 const sa = a.split(''), sb = b.split('');
  let count = 0;
  const set = new Set(sa);
  for (let c of sb) if (set.has(c)) count++;
  return count;
}

function keywordMatch(a, b) {
  const aw = (a.desc+' '+a.name).toLowerCase().split(/\s+/);
  const bw = (b.desc+' '+b.name).toLowerCase().split(/\s+/);
  let hits = 0;
  for (let w of aw) if (w.length > 3 && bw.includes(w)) hits++;
  return hits > 0;
}

function encodeInput() {
  const val = document.getElementById('encodeInput').value;
  if (!val) return;
  let h = hashString(val);
  let s = toBase44(h);
  // Also convert to a "human readable" base44 rune string by encoding each char  let runes = val.split('').map(c => toBase44(c.charCodeAt(0))).join('-');
  document.getElementById('encodeResult').innerHTML = `Hash: <b>${s}</b><br>Rune: <span style="opacity:0.6">${runes}</span>`;
}

function log(msg) {
  const d = document.getElementById('log');
  const entry = document.createElement('div');
  entry.className = 'log-entry new';
  entry.textContent = msg;
  d.insertBefore(entry, d.firstChild);
  if (d.children.length > 20) d.lastChild.remove();
}

function updateStats() {
  document.getElementById('statNodes').textContent = nodes.length;
  document.getElementById('statLinks').textContent = links.length;
  const res = nodes.length < 2 ? 0 : Math.min(100, Math.floor((links.length*2)/(nodes.length)*100));
  document.getElementById('statRes').textContent = res + '%';
}

// Demo nodes to show concept
function seed() {
  const seeds = [
    {n:'Neural Writing Engine', d:'LLM-assisted longform drafting blog book', t:'create'},
    {n:'Client Signal Decoder', d:'Parse requirements feedback loops scope', t:'analyze'},
    {n:'The Deep Rest Protocol', d:'Sleep exercise recovery non-work state', t:'rest'},
    {n:'Capital Flow Model', d:'Invoices investments revenue tracking', t:'coordinate'},
    {n:'Broadcast Array', d:'Social publishing newsletter distribution', t:'transmit'},
    {n:'Ingestion Funnel', d:'Reading research news intake curation', t:'receive'},
 {n:'Iteration Core', d:'Review refinement editing qa feedback', t:'analyze'},
    {n:'Collaboration Mesh', d:'Team sync standups shared documents', t:'coordinate'}
  ];
  seeds.forEach(s => {
    document.getElementById('nodeName').value = s.n;
    document.getElementById('nodeDesc').value = s.d;
    document.getElementById('nodeType').value = s.t;
    addNode();
  });
}

// Physicslet mouse = {x:0,y:0,down:false};
window.addEventListener('mousemove', e => { mouse.x = e.clientX; mouse.y = e.clientY; });
let dragNode = null;

canvas.addEventListener('mousedown', e => {
  const mx = e.clientX, my = e.clientY;
  let best = null, bestDist = 30;
  for (let n of nodes) {
    const d = Math.hypot(n.x-mx, n.y-my);
    if (d < bestDist) { bestDist = d; best = n; }
  }
  if (best) { dragNode = best; best.drag = true; }
});
window.addEventListener('mouseup', () => { if (dragNode) dragNode.drag = false; dragNode = null; });

function update() {
  // Forces
  const cx = width/2, cy = height/2;
  for (let n of nodes) {
    if (n.drag) { n.x = mouse.x; n.y = mouse.y; n.vx=0; n.vy=0; continue; }
    // gravity to center (gentle)
    n.vx += (cx - n.x) * 0.0001;
    n.vy += (cy - n.y) * 0.0001;
    // repel
    for (let o of nodes) {
      if (o===n) continue;
      const dx = n.x-o.x, dy = n.y-o.y;
 const dist = Math.hypot(dx,dy) || 1;
      if (dist < 150) {
        const f = 20/(dist*dist);
        n.vx += (dx/dist)*f;
        n.vy += (dy/dist)*f;
      }
    }
    // spring links    for (let l of links) {
      if (l.a!==n && l.b!==n) continue;
      const other = l.a===n ? l.b : l.a;
      const dx = other.x - n.x, dy = other.y - n.y;
      const dist = Math.hypot(dx,dy) || 1;
      const target = 80 + (1-l.strength)*100;
      const f = (dist-target)*0.002*l.strength;
      n.vx += (dx/dist)*f;
      n.vy += (dy/dist)*f;
    }
    // damp
    n.vx *= 0.92; n.vy *= 0.92;
    // move
    n.x += n.vx; n.y += n.vy;
    // bounds soft
    if (n.x < 0) n.x = 0;
    if (n.x > width) n.x = width;
    if (n.y < 0) n.y = 0;
    if (n.y > height) n.y = height;
    n.pulse += 0.05;
  }
}

function draw() {
  ctx.clearRect(0,0,width,height);
  
  // Draw links
  for (let l of links) {
    const age = Math.min(l.age, 1);
    l.age += 0.02;
    ctx.beginPath();
    ctx.moveTo(l.a.x, l.a.y);
    ctx.lineTo(l.b.x, l.b.y);
    const alpha = 0.1 + (l.strength*0.3)*age;
    ctx.strokeStyle = `rgba(0,243,194,${alpha})`;
    ctx.lineWidth = 0.5 + l.strength;
    ctx.stroke();
    
    // midpoint glow
    const mx = (l.a.x + l.b.x)/2;
    const my = (l.a.y + l.b.y)/2;
    const grad = ctx.createRadialGradient(mx,my,0,mx,my,10);
    grad.addColorStop(0, `rgba(0,243,194,${alpha*2})`);
    grad.addColorStop(1, 'transparent');
    ctx.fillStyle = grad;
    ctx.beginPath(); ctx.arc(mx,my,10,0,Math.PI*2); ctx.fill();
  }
  
  // Draw nodes
  for (let n of nodes) {
    // outer glow ring
    const radius = n.radius + Math.sin(n.pulse)*2;
    const grad = ctx.createRadialGradient(n.x,n.y,0,n.x,n.y,radius*3);
    grad.addColorStop(0, n.color);
    grad.addColorStop(0.4, n.color+'40');
    grad.addColorStop(1, 'transparent');
    ctx.fillStyle = grad;
    ctx.beginPath(); ctx.arc(n.x,n.y,radius*3,0,Math.PI*2); ctx.fill();
    
    // core
    ctx.fillStyle = '#fff';
    ctx.beginPath(); ctx.arc(n.x,n.y,n.radius*0.6,0,Math.PI*2); ctx.fill();
    
    // label
    ctx.fillStyle = 'rgba(226,232,240,0.8)';
    ctx.font = '11px Courier New';
    ctx.textAlign = 'center';
    ctx.fillText(n.name, n.x, n.y + radius*3 + 14);
    ctx.fillStyle = 'rgba(0,243,194,0.6)';
    ctx.fillText(n.sig, n.x, n.y + radius*3 + 26);
  }
}

function loop() {
  update();
  draw();
  requestAnimationFrame(loop);
}

// Clock
setInterval(() => {
  const now = Date.now();
  document.getElementById('clock').textContent = toBase44(Math.floor(now/1000)) + '.' + toBase44(now%1000);
  document.getElementById('footerStatus').textContent = 'NO BOX | ' + nodes.length + ' FORMS | ' + links.length + ' TIES';
}, 100);

// Preview sigilsetInterval(() => {
  const name = document.getElementById('nodeName').value;
  const desc = document.getElementById('nodeDesc').value;
  if (name || desc) {
    document.getElementById('previewSig').textContent = sig(name+desc);
  } else {
    document.getElementById('previewSig').textContent = toBase44(Date.now()%1000000);
  }
}, 300);

seed();
loop();
</script>
</body>
</html>