' + (nxt <= PLAN.maxL ? 'Buying level ' + nxt + ' (' + $$(price(nxt)) + ') ' + where + how + skipped + '.' : 'At the top of the ladder.') + '
'
+ + (nxt <= PLAN.maxL ? '' : '')
+ + '
Directs: ' + n.directs + '
'
+ + [0, 1, 2].filter(k => k !== n.directs).map(k => '').join('');
+ pop.hidden = false;
+ const w = 250, h = pop.offsetHeight || 140;
+ let left = r.left + r.width / 2 - w / 2, top = r.bottom + 8;
+ left = Math.max(8, Math.min(left, window.innerWidth - w - 8));
+ if (top + h > window.innerHeight - 8) top = r.top - h - 8;
+ pop.style.left = left + 'px'; pop.style.top = top + 'px';
+ const pb = document.getElementById('popBuy'); if (pb) pb.onclick = () => { closePop(); buy(n); };
+ pop.querySelectorAll('[data-dir]').forEach(b => b.onclick = () => {
+ closePop(); const k = Number(b.dataset.dir);
+ if (k >= 1 && n.directs < 1) n.cashFromHalf = nextId; // the first direct arrives now: depths 1-2 pay from here on
+ if (k >= 2 && n.directs < 2) n.cashFrom = nextId; // the second: full reach from here on
+ n.directs = k; refreshNode(n); paintPays();
+ const older = cnt(nodes.filter(x => x.id < nextId && x !== n).length);
+ const msg = k === 2 ? name(n) + ' now has two directs: full reach, cash from its own directs and from positions that join from now on. The ' + older + ' existing positions keep passing it.'
+ : k === 1 ? name(n) + ' now has one direct: ' + (PLAN.half ? 'cash from depths 1-2 (levels 2-3), from its own directs and from positions that join from now on' : 'no cash until the second (half step is off)') + (PLAN.unq === 'licence' ? '; licences still reach it.' : '.')
+ : name(n) + ' now has no directs: cash passes over it' + (PLAN.unq === 'licence' ? ', licences still reach it.' : '.');
+ renderLast(null, null, null, msg, k ? 'cash' : 'none');
+ addLog([{ kind: k ? 'cash' : 'skip', text: msg }], name(n));
+ });
+ }
+ document.addEventListener('click', e => { if (!pop.hidden && !pop.contains(e.target) && !e.target.closest('.node')) closePop(); });
+ document.addEventListener('keydown', e => { if (e.key === 'Escape') closePop(); });
+
+ function renderLast(n, L, steps, override, cls){
+ const el = document.getElementById('last');
+ if (override) { el.className = 'last ' + (cls || ''); el.innerHTML = override; return; }
+ const lic = steps.filter(s => s.kind === 'lic');
+ const cash = steps.filter(s => s.kind === 'cash');
+ const youLic = lic.some(s => /^YOU held/.test(s.text));
+ const youCash = cash.some(s => /^YOU already/.test(s.text));
+ let text = '' + name(n) + ' bought level ' + L + ' (' + product(L) + ') for ' + $$(price(L)) + '. ';
+ if (youLic) text += 'That payment was your licence: you were upgraded in the same transaction and the cost went on above you.';
+ else if (youCash) text += 'It reached you as cash' + (lic.length ? ', after issuing ' + lic.length + ' licence' + (lic.length > 1 ? 's' : '') + ' on the way up' : '') + '.';
+ else if (lic.length) text += 'It became a licence for ' + lic[0].text.split(' held')[0] + ' and the money climbed on from there.';
+ else if (cash.length && !/above you/.test(cash[0].text)) text += 'It paid ' + cash[0].text.split(' already')[0] + ' as cash.';
+ else text += 'It went above you, to your own upline.';
+ const why = youLic || youCash ? '' : 'Not yours: a depth-' + n.depth + ' position pays you only when it buys level ' + (n.depth + 1) + '. It holds level ' + L + ' now' + (L < n.depth + 1 ? ', so ' + (n.depth + 1 - L) + ' more purchase' + (n.depth + 1 - L > 1 ? 's' : '') + ' until its next one reaches you.' : '.') + '';
+ el.className = 'last ' + (youLic ? 'lic' : youCash ? 'cash' : 'none');
+ el.innerHTML = text + why;
+ }
+
+ function buy(n){
+ const L = n.level + 1;
+ if (L > PLAN.maxL) return;
+ clearHot();
+ n.level = L; refreshNode(n);
+ const steps = [], flashes = [[n, 'flash-src']];
+ purchase(n, L, steps, flashes);
+ for (const [m, c] of flashes) { const g = document.getElementById('n' + m.id); if (g) g.classList.add(c); }
+ addLog(steps, `${name(n)} bought level ${L} for ${$$(price(L))}`);
+ renderLast(n, L, steps);
+ paintPays();
+ return steps;
+ }
+
+ function paintPays(){
+ for (const n of nodes) {
+ if (n === you) continue;
+ const g = document.getElementById('n' + n.id); if (!g) continue;
+ const r = n.level + 1 <= PLAN.maxL ? route(n, n.level + 1, n.level - 1, false, n) : { to: null };
+ g.classList.toggle('pays', r.to === you);
+ }
+ }
+
+ function wave(){
+ clearHot();
+ const before = you.level, cashBefore = totals.cash;
+ const steps = [];
+ quiet = true; tally = {};
+ const order = nodes.filter(n => n !== you).sort((a, b) => a.depth - b.depth || a.idx - b.idx);
+ let bought = 0, licYou = 0, skipYou = 0;
+ for (const n of order) {
+ if (!n.qual) continue;
+ const L = n.level + 1; if (L > PLAN.maxL) continue;
+ tallyOrigin = n.depth; const tf = tallyFor(n.depth); tf.n++; tf.L = L;
+ n.level = L; refreshNode(n); bought++;
+ const sub = [], fl = [];
+ const licBefore = totals.lic;
+ purchase(n, L, sub, fl);
+ if (totals.lic > licBefore) licYou++;
+ if (sub.some(s => /went on above you/.test(s.text))) skipYou++;
+ }
+ quiet = false;
+ renderWaveTable();
+ const after = you.level;
+ steps.push({ kind: 'lic', text: `${bought} positions each bought one level, shallow to deep.` });
+ steps.push({ kind: after > before ? 'lic' : 'cash', text: after > before
+ ? `YOU went from level ${before} to ${after} without buying anything: ${licYou} licence${licYou === 1 ? '' : 's'} were funded from below.`
+ : (before >= DEPTHS
+ ? `YOU stayed at level ${before}: your org is only ${DEPTHS} deep, and licence ${before + 1} is funded by a depth-${before} position buying level ${before + 1}. Nothing that deep exists here. Grow the org to keep climbing.`
+ : `YOU stayed at level ${before}: nothing at depth ${before} bought level ${before + 1} this wave.`) });
+ steps.push({ kind: 'cash', text: `Cash to you this wave: ${$$(totals.cash - cashBefore)}.` });
+ if (skipYou) steps.push({ kind: 'skip', text: `${skipYou} payment${skipYou === 1 ? '' : 's'} went on above you: levels that pay uplines higher than you. Not a miss.` });
+ addLog(steps, 'Wave');
+ renderLast(null, null, null, 'Wave: ' + steps.map(s => s.text).join(' '), after > before ? 'lic' : 'cash');
+ paintPays();
+ }
+
+ function renderWaveTable(){
+ const box = document.getElementById('waveBox'), tb = document.querySelector('#waveTable tbody');
+ if (!box || !tb || !tally) return;
+ tb.innerHTML = '';
+ for (const d of Object.keys(tally).map(Number).sort((a, b) => a - b)) {
+ const t = tally[d];
+ const toYou = [t.youLic ? '' + t.youLic + ' licence' + (t.youLic > 1 ? 's' : '') + '' : '', t.youCash ? '' + $$(t.youCash) + '' : ''].filter(Boolean).join(' + ') || '—';
+ const others = Object.keys(t.cash).concat(Object.keys(t.lic)).filter((v, i, a) => a.indexOf(v) === i).map(Number).sort((a, b) => a - b)
+ .map(k => 'depth ' + k + ': ' + (t.cash[k] ? $$(t.cash[k]) : '') + (t.lic[k] ? (t.cash[k] ? ' + ' : '') + t.lic[k] + ' licence' + (t.lic[k] > 1 ? 's' : '') : '')).join(' ') || '—';
+ const tr = document.createElement('tr');
+ const above = [t.above ? $$(t.above) : '', t.licUp ? $$(t.licUp) + ' (your licence cost, climbing)' : ''].filter(Boolean).join(' + ') || '—';
+ tr.innerHTML = '
' + d + '
' + t.L + ' (' + $$(price(t.L)) + ')
' + t.n + '
' + toYou + '
' + others + '
' + above + '
';
+ tb.appendChild(tr);
+ }
+ box.hidden = false;
+ }
+ function addLog(steps, head){
+ const ol = document.getElementById('logList');
+ if (ol.firstChild && /Nothing yet|Reset\./.test(ol.firstChild.textContent)) ol.innerHTML = '';
+ const h = document.createElement('li'); h.className = 'head'; h.textContent = head; ol.prepend(h);
+ let after = h;
+ for (const s of steps) {
+ const li = document.createElement('li');
+ const chip = document.createElement('span'); chip.className = 'chip ' + s.kind; chip.textContent = s.kind === 'lic' ? 'licence' : s.kind === 'skip' ? 'skip' : 'cash';
+ li.appendChild(chip); li.appendChild(document.createTextNode(' ' + s.text));
+ after.after(li); after = li;
+ }
+ while (ol.children.length > 60) ol.removeChild(ol.lastChild);
+ }
+ function clearLog(msg){ document.getElementById('logList').innerHTML = `
${msg}
`; }
+ const lastShown = {};
+ function setV(id, text){
+ const el = document.getElementById(id); if (!el) return;
+ if (lastShown[id] !== undefined && lastShown[id] !== text) { el.classList.remove('bump'); void el.offsetWidth; el.classList.add('bump'); }
+ lastShown[id] = text; el.textContent = text;
+ }
+ function renderTotals(){
+ if (!you) return;
+ setV('mLevel', you.level);
+ const sl = document.getElementById('youLevel'); if (sl && Number(sl.value) !== you.level && you.level <= Number(sl.max)) { sl.value = you.level; document.getElementById('youLevelVal').textContent = you.level; }
+ const mr = document.getElementById('mReach'); if (mr) mr.textContent = you.level;
+ setV('mEntry', $$(totals.entry));
+ const en = document.getElementById('mEntryN'); if (en) en.textContent = you.children.length + ' directs × ' + $$(net(1)) + ' (the ' + $$(price(1)) + ' entry after the fee), no qualification';
+ setV('mCash', $$(totals.cash));
+ const cn = document.getElementById('mCashN'); if (cn) cn.textContent = totals.cashN + ' payment' + (totals.cashN === 1 ? '' : 's');
+ setV('mLic', totals.lic);
+ const lv = document.getElementById('mLicV'); if (lv) lv.textContent = 'worth ' + $$(totals.licV) + ', paid by your org';
+ setV('mTotal', $$(totals.entry + totals.cash + totals.licV));
+ setV('mFuel', $$(AUD.treasury)); const fs = document.getElementById('mFuelS'); if (fs) fs.textContent = PLAN.fee ? Math.round(PLAN.fee * 100) + '% out of every price; the other ' + Math.round((1 - PLAN.fee) * 100) + '% climbs' : 'no fee: the whole price climbs';
+ const ol = document.getElementById('youLedger');
+ if (ol) {
+ ol.innerHTML = '';
+ if (!youLedger.length) ol.innerHTML = '
Nothing yet.
';
+ for (const e of youLedger.slice(0, 10)) {
+ const li = document.createElement('li');
+ li.innerHTML = '' + (e.kind === 'lic' ? 'licence' : 'cash') + ' ' + (e.kind === 'lic' ? 'your licence ' + e.L + ', funded by ' : 'level-' + e.L + ' money from ') + name(e.from) + '' + (e.kind === 'lic' ? 'licence ' + e.L + ' (' + $$(e.amt) + ')' : '+' + $$(e.amt)) + '';
+ ol.appendChild(li);
+ }
+ }
+ const ln = document.getElementById('ledgerNote'); if (ln) ln.textContent = 'Each position pays you at most once per level, so the count is what matters: at level L there are ' + PLAN.w + '^' + '(L−1) positions at the depth that pays you, and each pays the level-L price.';
+ ladder();
+ }
+
+ document.getElementById('youLevel').addEventListener('input', e => {
+ document.getElementById('youLevelVal').textContent = e.target.value;
+ you.level = Number(e.target.value); refreshNode(you); paintReach(); paintPays(); renderTotals();
+ });
+ document.getElementById('wave').addEventListener('click', wave);
+
+ function at(path){ let n = you; for (const ch of path) n = n.children[ch === 'L' ? 0 : 1]; return n; }
+ const TOUR = [
+ { step: 'Step 1 of 7 · your licence', say: 'You hold level 1, like every new member, and so do your directs (labelled). Their entries already paid you. Your FIRST direct buys level 2. Level-2 money pays the first upline, which is you, and you hold exactly one level below, so this payment IS your licence 2: you are upgraded in the same transaction and the money continues above you. No cash yet.',
+ act: () => buy(at('L')) },
+ { step: 'Step 2 of 7 · cash', say: 'Your SECOND direct buys level 2. You now hold level 2, so this one is cash: the level-2 price to you. Watch the bar.',
+ act: () => buy(at('R')) },
+ { step: 'Step 3 of 7 · not yours', say: 'A grandchild, under your first direct, buys level 2. Level-2 money stops at the FIRST upline, its own parent, who already holds level 2, so it is that parent\'s cash and never reaches you. That is why the rings matter: a position pays you only at the one level that maps to its depth.',
+ act: () => buy(at('LL')) },
+ { step: 'Step 4 of 7 · your licence 3', say: 'The same grandchild buys level 3. Level-3 money skips one upline and lands on you; you hold level 2, exactly one below, so this is your licence 3. The amber band steps down a depth and the rings move.',
+ act: () => buy(at('LL')) },
+ { step: 'Step 5 of 7 · cascade', say: 'One purchase can pay two people. A depth-3 position under your second direct buys level 2. It pays its parent (depth 2), who holds exactly level 1: that parent gets licence 2, and the parent\'s own level-2 cost climbs to your second direct as cash. One buyer, one licence issued, one cash payment.',
+ act: () => buy(at('RLL')) },
+ { step: 'Step 6 of 7 · skipped', say: 'Your first direct now has NO directs of its own (dashed). Its other child buys level 2. That money would pay the parent, but the parent has recruited nobody, so cash passes over it and keeps climbing: you catch it. Qualification decides who is skipped; it never holds money back. (With one direct, the half step would let the parent keep this one.)',
+ act: () => { const l = at('L'); l.directs = 0; refreshNode(l); paintPays(); buy(at('LR')); } },
+ { step: 'Step 7 of 7 · the wave', say: 'Everything at once: every position buys one level, shallow to deep. Read the table that appears under the strip: one row per depth, where that depth\'s money went. Then press Run a wave again and watch your level climb without buying anything.',
+ act: () => wave() },
+ { step: 'Done', say: 'That is the whole plan. Now switch the gap rule and the width at the top and run waves again: the tree resets, and the difference shows up in the money bar.', act: null }
+ ];
+ let ti = -1;
+ function tourShow(){
+ const t = TOUR[ti]; document.getElementById('tourStep').textContent = t.step; document.getElementById('tourSay').textContent = t.say;
+ const nx = document.getElementById('tourNext'); nx.hidden = false; nx.textContent = t.act ? 'Show me' : 'Finish';
+ document.getElementById('tourStart').textContent = 'Restart tour';
+ }
+ document.getElementById('tourStart').addEventListener('click', () => { document.getElementById('youLevel').value = 1; document.getElementById('youLevelVal').textContent = '1'; build(); ti = 0; tourShow(); });
+ document.getElementById('tourNext').addEventListener('click', () => {
+ const t = TOUR[ti];
+ if (t.act) { t.act(); }
+ if (ti < TOUR.length - 1) { ti++; tourShow(); }
+ else { document.getElementById('tourNext').hidden = true; }
+ });
+ document.getElementById('reset').addEventListener('click', () => { document.getElementById('youLevel').value = 1; document.getElementById('youLevelVal').textContent = '1'; build(); });
+ document.getElementById('grow').addEventListener('click', grow);
+ function depthLabel(){ const el = document.getElementById('depthLabel'); if (el) el.textContent = DEPTHS + ' deep, ' + cnt(nodes.length - 1) + ' positions'; const g = document.getElementById('grow'); if (g) g.disabled = DEPTHS >= MAXD[PLAN.w]; }
+ function grow(){
+ if (DEPTHS >= MAXD[PLAN.w]) return;
+ const leaves = nodes.filter(n => n.depth === DEPTHS);
+ DEPTHS++;
+ let entries = 0;
+ for (const n of leaves) for (let k = 0; k < PLAN.w; k++) { mkNode(n.depth + 1, n, n.idx * PLAN.w + k); entries += net(1); }
+ geometry(); layout(); draw(); paintPays(); renderTotals(); depthLabel();
+ addLog([{ kind: 'lic', text: `The org is now ${DEPTHS} deep: ${leaves.length * PLAN.w} new level-1 positions joined at the bottom and paid ${$$(entries)} of entries to the row above. Everything else is as it was.` }], 'Grew one depth');
+ }
+
+ // ── ladder table ──
+ const priceEl = document.getElementById('price');
+ function ladder(){
+ document.getElementById('priceVal').textContent = '$' + priceEl.value;
+ const tb = document.querySelector('#ladder tbody'); if (!tb) return; tb.innerHTML = '';
+ const rows = [1]; const top = Math.min(12, PLAN.maxL);
+ for (let L = 2; L <= top; L++) rows.push(L);
+ if (PLAN.maxL > 12) rows.push('gap', 20, 'gap', PLAN.maxL);
+ let climb = 0; for (let L = 1; L <= PLAN.maxL; L++) climb += price(L);
+ for (const L of rows) {
+ const tr = document.createElement('tr');
+ if (L === 'gap') { tr.className = 'gap'; tr.innerHTML = '
⋮
'; tb.appendChild(tr); continue; }
+ const d = L === 1 ? 1 : L - 1, pos = Math.pow(PLAN.w, d);
+ if (you && L === you.level + 1) tr.className = 'you';
+ tr.innerHTML = `
${L}${you && L === you.level + 1 ? ' your next' : ''}
${product(L)} placeholder
${L === 1 ? 'entries from depth 1, no qualification' : 'depth ' + d + ', buying level ' + L}
${cnt(pos)}
${$$(pos * net(L))}
${$$(price(L))}${L === 1 ? ' everyone pays this to enter' : ' or the first payment from depth ' + d + ''}
`;
+ tb.appendChild(tr);
+ }
+ const ln = document.getElementById('ladderNote'); if (ln) ln.textContent = PLAN.w + '-wide, ' + PLAN.maxL + ' levels. Potential is one payment from every position at the depth that pays that level, so it grows ' + PLAN.w + '× per level on its own; the price ladder only sets the dollars, and ' + Math.round(PLAN.fee * 100) + '% of every price goes to the admin wallet before anything climbs. Climbing all ' + PLAN.maxL + ' levels yourself would cost ' + $$(climb) + ', which nobody has to do: the first payment at each depth is the licence.';
+ }
+ priceEl.addEventListener('input', () => { renderTotals(); for (const n of nodes) refreshNode(n); if (dp) deepRender(); });
+
+ // ── deep simulator: the same rules on counts per depth ──
+ let dp = null;
+ function deepReset(){
+ const fill = Number(document.getElementById('deepFill').value) / 100, D = PLAN.maxL;
+ dp = { D, levels: [], counts: [], lic: [], licV: [], cash: [], entry: [], pays: [], waves: 0, above: 0, spent: 0, treasury: 0 };
+ window.deepAudit = () => { const rec = dp.cash.reduce((a, b) => a + b, 0) + dp.entry.reduce((a, b) => a + b, 0) + dp.above + dp.treasury; return { spent: Math.round(dp.spent), received: Math.round(rec), ok: Math.abs(dp.spent - rec) <= 1 + 1e-9 * dp.spent }; };
+ for (let d = 0; d <= D; d++) {
+ dp.levels[d] = 1;
+ dp.counts[d] = d === 0 ? 1 : Math.max(1, Math.round(Math.pow(PLAN.w * fill, d)));
+ dp.lic[d] = 0; dp.licV[d] = 0; dp.cash[d] = 0; dp.entry[d] = 0; dp.pays[d] = 0;
+ }
+ for (let d = 1; d <= D; d++) { dp.entry[d - 1] += dp.counts[d] * net(1); dp.spent += dp.counts[d] * price(1); dp.treasury += dp.counts[d] * price(1) * PLAN.fee; } // Rule 0, once, when the org is built
+ deepRender('Reset. Everyone at level 1, you included; entries paid.');
+ }
+ // n payments of `amt` for level L from depth `from`: skip `skipN`, then the gap rule on aggregate levels
+ function deepPay(n, from, L, amt, skipN, rem){
+ if (n <= 0) return;
+ let r = from - 1 - skipN;
+ while (r >= 0 && !(rem ? dp.levels[r] >= L : (PLAN.gap === 'fund' || dp.levels[r] >= L - 1))) r--;
+ if (r < 0) { dp.above += n * amt; return; }
+ if (dp.levels[r] >= L) { dp.cash[r] += n * amt; dp.pays[r] += n; return; }
+ const nl = dp.levels[r] + 1, cost = net(nl);
+ const granted = Math.min(dp.counts[r], n);
+ dp.lic[r] += granted; dp.licV[r] += granted * cost; dp.levels[r] = nl;
+ deepPay(granted, r, nl, cost, nl - 2); // the licence costs climb from depth r
+ if (amt - cost > 0.005) deepPay(granted, r, L, amt - cost, 0, true); // the remainder climbs on, cash only
+ deepPay(n - granted, from, L, amt, skipN); // the rest of this depth's payments, now that r has moved up
+ }
+ function deepWave(){
+ if (!dp) deepReset();
+ for (let d = 1; d <= dp.D; d++) { const L = dp.levels[d] + 1; if (L > PLAN.maxL) continue; dp.spent += dp.counts[d] * price(L); dp.treasury += dp.counts[d] * price(L) * PLAN.fee; deepPay(dp.counts[d], d, L, net(L), L - 2); dp.levels[d] = Math.max(dp.levels[d], L); }
+ dp.waves++;
+ }
+ function deepRender(note){
+ document.getElementById('dLevel').textContent = dp.levels[0];
+ document.getElementById('dReach').textContent = Math.min(dp.levels[0], dp.D);
+ document.getElementById('dEntry').textContent = $$(dp.entry[0]);
+ document.getElementById('dCash').textContent = $$(dp.cash[0]);
+ document.getElementById('dCashN').textContent = cnt(dp.pays[0]) + ' payment' + (dp.pays[0] === 1 ? '' : 's');
+ document.getElementById('dLic').textContent = dp.lic[0];
+ document.getElementById('dLicV').textContent = 'worth ' + $$(dp.licV[0]);
+ document.getElementById('dWaves').textContent = dp.waves;
+ document.getElementById('dAbove').textContent = $$(dp.above);
+ document.getElementById('dFuel').textContent = $$(dp.treasury);
+ const tb = document.querySelector('#deepTable tbody'); tb.innerHTML = '';
+ const maxCash = Math.max(1, ...dp.cash.map((c, d) => d === 0 ? 0 : c));
+ for (let d = 0; d <= dp.D; d++) {
+ const tr = document.createElement('tr');
+ tr.className = d === 0 ? 'you' : d <= dp.levels[0] ? 'reach' : d === dp.levels[0] + 1 ? 'next' : '';
+ const per = dp.counts[d] ? (dp.cash[d] + dp.entry[d]) / dp.counts[d] : 0;
+ tr.innerHTML = '
' + (d === 0 ? 'YOU' : d) + '
' + cnt(dp.counts[d]) + '
' + dp.levels[d] + '
' + cnt(dp.lic[d]) + '
' + $$(dp.entry[d]) + '
' + $$(dp.cash[d]) + '
'
+ + '
' + (d === 0 ? '' : '') + '
' + $$(per) + '
';
+ tb.appendChild(tr);
+ }
+ if (note) document.getElementById('deepNote').textContent = note;
+ }
+ function deepRun(k){
+ const before = dp ? dp.levels[0] : 1; let ran = 0;
+ for (let i = 0; i < k; i++) { if (dp && dp.levels[0] >= PLAN.maxL) break; deepWave(); ran++; }
+ const after = dp.levels[0];
+ deepRender(ran + ' wave' + (ran === 1 ? '' : 's') + ' run. ' + (after > before ? 'You went from level ' + before + ' to ' + after + ' without buying anything: the first payment at each new depth was your licence.' : after >= PLAN.maxL ? 'You hold level ' + PLAN.maxL + ', the top of the ladder. Every payment from every depth is cash from here on.' : 'Your level did not move this time.'));
+ }
+ document.getElementById('deepWave').addEventListener('click', () => deepRun(1));
+ document.getElementById('deepWave5').addEventListener('click', () => deepRun(5));
+ document.getElementById('deepToTop').addEventListener('click', () => deepRun(80));
+ document.getElementById('deepReset').addEventListener('click', deepReset);
+ document.getElementById('deepFill').addEventListener('input', e => { document.getElementById('deepFillVal').textContent = e.target.value + '%'; deepReset(); });
+
+ // ── plan controls ──
+ function applyPlan(){
+ PLAN.w = Number(document.getElementById('width').value);
+ PLAN.maxL = Number(document.getElementById('levels').value);
+ PLAN.shape = document.getElementById('shape').value;
+ PLAN.steps = document.getElementById('steps').value.split(',').map(s => Number(s.trim())).filter(n => n > 0);
+ PLAN.products = document.getElementById('products').value.split(',').map(s => s.trim()).filter(Boolean);
+ PLAN.fee = Number(document.getElementById('fee').value) || 0;
+ if (!PLAN.steps.length) PLAN.steps = [10];
+ document.getElementById('stepsCtl').hidden = PLAN.shape !== 'stepped';
+ document.getElementById('priceCtl').hidden = PLAN.shape === 'stepped';
+ document.getElementById('gapSkip').setAttribute('aria-pressed', String(PLAN.gap === 'skip'));
+ document.getElementById('gapFund').setAttribute('aria-pressed', String(PLAN.gap === 'fund'));
+ document.getElementById('unqSkip').setAttribute('aria-pressed', String(PLAN.unq === 'skip'));
+ document.getElementById('unqLic').setAttribute('aria-pressed', String(PLAN.unq === 'licence'));
+ document.getElementById('halfOff').setAttribute('aria-pressed', String(!PLAN.half));
+ document.getElementById('halfOn').setAttribute('aria-pressed', String(PLAN.half));
+ document.getElementById('wmOff').setAttribute('aria-pressed', String(!PLAN.wm));
+ document.getElementById('wmOn').setAttribute('aria-pressed', String(PLAN.wm));
+ const yl = document.getElementById('youLevel'); yl.max = PLAN.maxL; yl.value = 1; // a new plan starts you at level 1, like everyone
+ document.getElementById('youLevelVal').textContent = yl.value;
+ document.getElementById('deepHead').textContent = 'All ' + PLAN.maxL + ' levels, simulated by depth';
+ svg.setAttribute('aria-label', PLAN.w + '-wide matrix under you');
+ build(); deepReset();
+ }
+ for (const id of ['width', 'levels', 'shape']) document.getElementById(id).addEventListener('change', applyPlan);
+ document.getElementById('steps').addEventListener('change', applyPlan);
+ document.getElementById('products').addEventListener('change', applyPlan);
+ document.getElementById('fee').addEventListener('change', applyPlan);
+ document.getElementById('gapSkip').addEventListener('click', () => { PLAN.gap = 'skip'; applyPlan(); });
+ document.getElementById('gapFund').addEventListener('click', () => { PLAN.gap = 'fund'; applyPlan(); });
+ document.getElementById('unqSkip').addEventListener('click', () => { PLAN.unq = 'skip'; applyPlan(); });
+ document.getElementById('unqLic').addEventListener('click', () => { PLAN.unq = 'licence'; applyPlan(); });
+ document.getElementById('halfOff').addEventListener('click', () => { PLAN.half = false; applyPlan(); });
+ document.getElementById('halfOn').addEventListener('click', () => { PLAN.half = true; applyPlan(); });
+ document.getElementById('wmOff').addEventListener('click', () => { PLAN.wm = false; applyPlan(); });
+ document.getElementById('wmOn').addEventListener('click', () => { PLAN.wm = true; applyPlan(); });
+
+ applyPlan();
+})();
diff --git a/public/plan-lab.html b/public/plan-lab.html
new file mode 100644
index 0000000..d35d846
--- /dev/null
+++ b/public/plan-lab.html
@@ -0,0 +1,281 @@
+
+
+
+
+
+
+Reach Ladder · plan lab
+
+
+
+
+
+
+
+
+
+
Compensation plan · working draft · 27 Sep 2026
+
Your reach is your level. Width does the rest.
+
A forced matrix with the same two-directs rule to receive, and three things RM Circle does not have: every payment that reaches you is either cash or your next licence, and the contract knows which; the matrix can be wider than two, so the people you build sit within your reach instead of 28 deep; and prices step up with the product, never double. The working plan is 4 wide, 8 levels, a stepped ladder and the fund-the-gap rule; the other settings are there to compare against.
+
+
+
Eight rules, and nothing else
+
+
PLACEMENT
Shallowest open slot under your recruiter
Your sponsor is the person whose link you used, always. You are placed in the shallowest open slot in their organisation, breadth-first, so orgs fill wide before they fill deep. Decided 27 Sep.
+
RULE 0
Level 1 is the entry
Everyone pays the same to come in. After the admin fee, half goes to the recruiter and half to the upline directly above the placement, no qualification, never a licence. Someone with no recruiter is assigned to a member who needs a direct. (In this drawn tree every position was recruited by its upline, so both halves land there.)
+
RULE 1
A level-L purchase pays one upline
Skip the first L−2 uplines outright. Then pay the first one with two directs. Same climb as RM Circle today.
+
RULE 2
So depth d pays you when it buys level d+1
The positions at depth d under you are the ones whose level-(d+1) purchases land on you. Depth 1 also pays you its entries.
+
RULE 3
Reach = your level
At level A you collect cash from depths 1 to A. The first payment from depth A is your next licence. Deeper money routes past you, for now.
+
RULE 4
The gap rule
Fund the gap (decided 27 Sep, with the stepped ladder): a payment that reaches someone more than one level behind buys their next licence, and the remainder climbs on as cash. Nobody qualified is ever skipped. The RM Circle skip is kept as a switch for comparison only.
+
RULE 5
Licences reach everyone, cash reaches the qualified
A pass-up that reaches a member with fewer than two directs buys their next licence; the cost climbs on. Cash steps up with recruits: no directs, entries only; one direct, cash from depths 1 and 2; two directs, full reach. Each step counts from the moment it was reached: cash comes from your own directs and from positions created after it. Positions that passed you before keep passing you.
+
RULE 6
The licence cascades, the contract holds nothing
When a licence is issued, its cost moves up that member's chain by Rule 1 and lands on the first person already at that level. Every coin leaves in the block it arrived.
+
+
+
+
+
Simulator
+
You are the black node. Click any position: a small menu tells you where its next purchase would go before you buy, then lets you buy it or mark it as having one direct (dashed, gets skipped). The strip under the tree says in plain words what each purchase did. Run a wave has the whole organisation buy one level, shallow to deep, so you can watch your own level climb without buying anything.
+
+
+
Your level
1
reach = depth 1 to 1
+
Entries to you
$0
from your directs, no qualification
+
Cash to you
$0
0 payments
+
Licences funded for you
0
worth $0, paid by your org
+
Total received
$0
entries + cash + licences
+
Admin fee, to the receiver wallet
$0
20% out of every price
+
+
+
+
+
+
+
+
+
$25
+
+
+
+
+
+
+
1
+
+
+
+
+
glowing ring = this position's next purchase lands on youshaded band = within your reachcash to the recipientlicence issued (cost keeps climbing)skipped: one direct, or behind the level under the skip rule
+
+
Guided tour
Seven clicks, one rule each: cash, licence, cascade, skip, "not yours", and the wave. Press Start; the tree resets and each step tells you what to look at before it happens.
+
+
+
+
Nothing bought yet. Click a ringed position first: its money reaches you.
+
+
Where this wave's money went, by the depth that bought
+
Depth
Bought level
Positions
To you
To others in your org
Above you
+
A depth-d position pays you only when it buys level d+1. Anything else it buys pays someone between you and it, or someone above you. "Above you" is not lost money: it is the same rule paying your own upline.
+
+
+
+
Every step, in order
+
Nothing yet. Click a position, or run a wave.
+
+
+
Money that reached you, newest first
+
Nothing yet.
+
+
A wave pays you from every depth up to your reach, and the first payment from the depth at your reach is your next licence. Everyone starts at level 1, you included. In the first wave your directs buy level 2: the first of those payments is your licence 2, the rest is cash. Every wave after that carries you up one rung, funded from below.
+
+
+
+
+
+
+
All 8 levels, simulated by depth
+
A drawn tree stops early. This runs the same rules on counts per depth with every position qualified (the unqualified and late-qualifier rules need individual positions, so they live in the tree above), so it goes the whole way up the ladder. Every depth's positions buy one level per wave; each purchase climbs the rule, the first payment to a depth one level behind is its licence and the cost keeps climbing, the rest is cash. Fill is how full the matrix is: 100% is a perfect tree (widthd positions at depth d), lower values thin it out with depth the way real organisations do. Entries are paid once, when the org is built.
+
+
+
100%
+
+
+
+
+
+
+
Your level
1
reach = depth 1 to 1
+
Entries to you
$0
your directs' level 1
+
Cash to you
$0
0 payments
+
Licences funded for you
0
worth $0
+
Waves run
0
one level per position per wave
+
Went above you
$0
levels that pay uplines higher than you
+
Admin fee
$0
to the receiver wallet
+
+
Depth
Positions
Level now
Licences funded
Entries
Cash collected
Per position
+
+
+
+
+
+
The ladder, in numbers: one product per level
+
+
+
Level
Delivers
Paid by
Positions there
Potential, if full, after the fee
Cost to you
+
+
+
+
Mechanics only. Prices are illustrative knobs, not proposals. What each licence delivers is a separate decision.
+
+
+
+
Unlisted working page for planning. Not a member page, not an offer. Every number here is a mechanic, not a prediction.
+
+
+
diff --git a/server.js b/server.js
index 7d58eb6..0f3e2ea 100644
--- a/server.js
+++ b/server.js
@@ -3448,7 +3448,9 @@ const server = http.createServer(async (req, res) => {
return res.end(blog.renderPost(post, related));
}
if (p === '/wallets') return sendFile(res, path.join(PUBLIC_DIR, 'wallets.html'));
- if (p === '/friday') return sendFile(res, path.join(PUBLIC_DIR, 'friday.html')); // Five Dollar Friday bridge page: ?ref= works like any page (Marty, 2026-09-25)
+ if (p === '/friday') return sendFile(res, path.join(PUBLIC_DIR, 'friday.html'));
+ if (p === '/plan-lab') return sendFile(res, path.join(PUBLIC_DIR, 'plan-lab.html'), { 'X-Robots-Tag': 'noindex, nofollow' }); // Reach Ladder simulator for Marty's planning group: unlisted, shared by link (2026-09-27)
+ if (p === '/plan-lab') return sendFile(res, path.join(PUBLIC_DIR, 'plan-lab.html')); // Reach Ladder simulator for Marty's planning group: unlisted, shared by link (2026-09-27) // Five Dollar Friday bridge page: ?ref= works like any page (Marty, 2026-09-25)
if (p === '/launch') return sendFile(res, path.join(PUBLIC_DIR, 'launch.html'));
if (/^\/view\/[a-f0-9]{32}$/.test(p)) return sendFile(res, path.join(PUBLIC_DIR, 'view.html'));
m = /^\/uploads\/([a-z0-9]{24}\.(?:png|jpg|webp|gif|mp4|webm))$/.exec(p);