Puzzles: results pull you on to the next one

After three stars, Next puzzle is the one big button (and has the focus); the
results card counts the stars still to win in the pack; and when one more link
within budget would earn the third star, the card and the results say so.
This commit is contained in:
Frederic Jung 2026-10-28 20:01:58 +01:00
parent f4980dc098
commit 3fa3b3e579
No known key found for this signature in database
10 changed files with 73 additions and 5 deletions

View file

@ -2856,6 +2856,7 @@
"puzzles.euro_trip":"Euro-Trip",
"puzzles.every_internet_starts_with_one_tube":"Jedes Internet beginnt mit einer Röhre.",
"puzzles.every_link_n_g_or_more":"Jeder Link {n}G oder mehr",
"puzzles.every_star_in_this_pack_is":"Alle Sterne in diesem Paket gehören dir.",
"puzzles.fat_pipes_only":"Nur dicke Rohre",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Für Architekten, die die Baggersaison verschlafen.",
@ -2878,6 +2879,7 @@
"puzzles.n_1_club":"N-1-Club",
"puzzles.n_1_connect_everything_first":"N-1: erst alles verbinden",
"puzzles.n_g_links":"{n}G-Links",
"puzzles.n_stars_left_in_this_pack":{"one":"Noch {n} ⭐ in diesem Paket","other":"Noch {n} ⭐ in diesem Paket"},
"puzzles.n_week_streak":{"one":"{n} Woche in Folge","other":"{n} Wochen in Folge"},
"puzzles.new_zealand_is_far_from_everything":"Neuseeland ist weit weg von allem. Genau das ist der Witz, und das Problem.",
"puzzles.next_pack_unlocks_at_n":"Nächstes Paket, {pack}, ab {n}⭐",
@ -2923,6 +2925,7 @@
"puzzles.size":"Größe",
"puzzles.small_calm_network_builds":"Kleine, entspannte Netzbauten",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.so_close_one_more_link_and":"Fast: noch ein Link, und kein Bagger kann dir was.",
"puzzles.speed_runs":"Speedruns",
"puzzles.spent_x":"Ausgegeben {x}",
"puzzles.spent_x_of_y":"Ausgegeben {x} / {y}",

View file

@ -2854,6 +2854,7 @@
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Todo internet empieza con un tubo.",
"puzzles.every_link_n_g_or_more":"Cada enlace de {n}G o más",
"puzzles.every_star_in_this_pack_is":"Todas las estrellas de este paquete son tuyas.",
"puzzles.fat_pipes_only":"Solo tuberías gordas",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Para arquitectos que duermen tranquilos en temporada de retroexcavadoras.",
@ -2876,6 +2877,7 @@
"puzzles.n_1_club":"Club N-1",
"puzzles.n_1_connect_everything_first":"N-1: primero conéctalo todo",
"puzzles.n_g_links":"enlaces de {n}G",
"puzzles.n_stars_left_in_this_pack":{"one":"Queda {n} ⭐ en este paquete","other":"Quedan {n} ⭐ en este paquete"},
"puzzles.n_week_streak":{"one":"{n} semana seguida","other":"{n} semanas seguidas"},
"puzzles.new_zealand_is_far_from_everything":"Nueva Zelanda está lejos de todo. Esa es la gracia, y el problema.",
"puzzles.next_pack_unlocks_at_n":"El siguiente pack, {pack}, se desbloquea con {n}⭐",
@ -2921,6 +2923,7 @@
"puzzles.size":"Tamaño",
"puzzles.small_calm_network_builds":"Redes pequeñas y tranquilas",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.so_close_one_more_link_and":"Casi: un enlace más y ninguna retroexcavadora podrá contigo.",
"puzzles.speed_runs":"Contrarreloj",
"puzzles.spent_x":"Gastado {x}",
"puzzles.spent_x_of_y":"Gastado {x} / {y}",

View file

@ -2854,6 +2854,7 @@
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Tout internet commence par un tube.",
"puzzles.every_link_n_g_or_more":"Chaque lien à {n}G ou plus",
"puzzles.every_star_in_this_pack_is":"Toutes les étoiles de ce pack sont à toi.",
"puzzles.fat_pipes_only":"Gros tuyaux uniquement",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Pour les architectes qui dorment pendant la saison des pelleteuses.",
@ -2876,6 +2877,7 @@
"puzzles.n_1_club":"Club N-1",
"puzzles.n_1_connect_everything_first":"N-1 : relie d’abord tout",
"puzzles.n_g_links":"liens {n}G",
"puzzles.n_stars_left_in_this_pack":{"one":"Encore {n} ⭐ dans ce pack","other":"Encore {n} ⭐ dans ce pack"},
"puzzles.n_week_streak":{"one":"{n} semaine d’affilée","other":"{n} semaines d’affilée"},
"puzzles.new_zealand_is_far_from_everything":"La Nouvelle-Zélande est loin de tout. C’est tout l’intérêt, et tout le problème.",
"puzzles.next_pack_unlocks_at_n":"Prochain pack, {pack}, à {n}⭐",
@ -2921,6 +2923,7 @@
"puzzles.size":"Taille",
"puzzles.small_calm_network_builds":"Petits réseaux, tranquillement",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.so_close_one_more_link_and":"Presque : encore un lien et aucune pelleteuse ne pourra rien contre toi.",
"puzzles.speed_runs":"Contre la montre",
"puzzles.spent_x":"Dépensé {x}",
"puzzles.spent_x_of_y":"Dépensé {x} / {y}",

View file

@ -2854,6 +2854,7 @@
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Ogni internet comincia con un tubo.",
"puzzles.every_link_n_g_or_more":"Ogni link da {n}G o più",
"puzzles.every_star_in_this_pack_is":"Tutte le stelle di questo pacchetto sono tue.",
"puzzles.fat_pipes_only":"Solo tubi grossi",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Per architetti che dormono sonni tranquilli nella stagione delle ruspe.",
@ -2876,6 +2877,7 @@
"puzzles.n_1_club":"Club N-1",
"puzzles.n_1_connect_everything_first":"N-1: prima collega tutto",
"puzzles.n_g_links":"link da {n}G",
"puzzles.n_stars_left_in_this_pack":{"one":"Ancora {n} ⭐ in questo pacchetto","other":"Ancora {n} ⭐ in questo pacchetto"},
"puzzles.n_week_streak":{"one":"{n} settimana di fila","other":"{n} settimane di fila"},
"puzzles.new_zealand_is_far_from_everything":"La Nuova Zelanda è lontana da tutto. È proprio questo il bello, e il problema.",
"puzzles.next_pack_unlocks_at_n":"Il prossimo pacchetto, {pack}, si sblocca a {n}⭐",
@ -2921,6 +2923,7 @@
"puzzles.size":"Taglia",
"puzzles.small_calm_network_builds":"Piccole reti, con calma",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.so_close_one_more_link_and":"Ci sei quasi: ancora un link e nessuna ruspa può toccarti.",
"puzzles.speed_runs":"Corse contro il tempo",
"puzzles.spent_x":"Speso {x}",
"puzzles.spent_x_of_y":"Speso {x} / {y}",

View file

@ -2854,6 +2854,7 @@
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Toda internet começa com um tubo.",
"puzzles.every_link_n_g_or_more":"Todo link com {n}G ou mais",
"puzzles.every_star_in_this_pack_is":"Todas as estrelas deste pacote são suas.",
"puzzles.fat_pipes_only":"Só tubos grossos",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Para arquitetos que dormem tranquilos na temporada das retroescavadeiras.",
@ -2876,6 +2877,7 @@
"puzzles.n_1_club":"Clube N-1",
"puzzles.n_1_connect_everything_first":"N-1: conecte tudo primeiro",
"puzzles.n_g_links":"links de {n}G",
"puzzles.n_stars_left_in_this_pack":{"one":"Falta {n} ⭐ neste pacote","other":"Faltam {n} ⭐ neste pacote"},
"puzzles.n_week_streak":{"one":"{n} semana seguida","other":"{n} semanas seguidas"},
"puzzles.new_zealand_is_far_from_everything":"A Nova Zelândia fica longe de tudo. Essa é a graça, e o problema.",
"puzzles.next_pack_unlocks_at_n":"O próximo pacote, {pack}, abre com {n}⭐",
@ -2921,6 +2923,7 @@
"puzzles.size":"Tamanho",
"puzzles.small_calm_network_builds":"Redes pequenas, com calma",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.so_close_one_more_link_and":"Quase lá: mais um link e nenhuma retroescavadeira te alcança.",
"puzzles.speed_runs":"Contra o relógio",
"puzzles.spent_x":"Gasto {x}",
"puzzles.spent_x_of_y":"Gasto {x} / {y}",

View file

@ -56,6 +56,14 @@ function pzEval(){const P=S.pz,ls=S.links,cs=P.cities,spend=pzSpend();
const weak=conn?units.filter(u=>{const g=pzComp(ls,u,cs[0]);return !cs.every(c=>g.has(c));}):[];
const n1=conn&&units.length>0&&!weak.length,cheap=!P.budget||spend<=P.budget;
return {marks,conn,tw,goal,spend,cheap,n1,weak,stars:goal?1+(cheap?1:0)+(n1?1:0):0};}
// Two stars, and one more link within budget would survive any cut? Then the third star is close. Tries every route
// between the puzzle's cities at the smallest allowed size, so the nudge is true, not a guess.
function pzOneMore(e){const P=S.pz;if(e.stars!==2||!e.cheap||e.n1)return false;const cs=[...P.cities,...P.via],tier=P.minG?1:0,cs0=P.cities[0];
for(const a of cs)for(const b of cs){if(a>=b)continue;for(const r of pzRoutes(a,b)){if((P.noSub&&r.sub)||subWaveWhy(tier,r.km,r.sub))continue;
const div=!r.sub&&S.links.some(l=>edgeKey(l)===edgeKey({a,b})&&!l.cable),cost=pzLinkCost(r,tier,div)+(S.pops[a]?0:pzPopCost(a))+(S.pops[b]?0:pzPopCost(b));
if(e.spend+cost>P.budget)continue;const ls=[...S.links,{id:'pz?',a,b,cable:r.cab,trench:r.cab?'cab:'+r.cab:'pz?'}];if(P.ring&&!pzRingOk(ls))continue;
if([...new Set(ls.map(pzUnit))].every(u=>{const g=pzComp(ls,u,cs0);return P.cities.every(c=>g.has(c));}))return true;}}
return false;}
// ---------- the weekly puzzle: the same for everyone, seeded by the ISO week like the weekly challenge ----------
function pzWeekKey(dt){const {y,w}=isoWeek(dt);return `${y}-W${String(w).padStart(2,'0')}`;}
function pzPrevKey(key){const m=/^(\d{4})-W(\d{2})$/.exec(key);if(!m)return null;return pzWeekKey(new Date(+m[1],0,4+(+m[2]-2)*7));}

View file

@ -22,7 +22,7 @@ function pzRender(){const el=$('pzBox');if(!pzOn()){el.hidden=true;return;}el.hi
const sp=fmt$(e.spend);
h+=P.budget?`<div class="pzbud"><div class="kv"><span>${tr('puzzles.spent_x_of_y',{x:sp,y:fmt$(P.budget)})}</span><b>${e.cheap?'✓':'✗'}</b></div><div class="bar ${e.cheap?(e.spend>P.budget*0.85?'warn':''):'bad'}"><i style="width:${Math.min(100,e.spend/P.budget*100).toFixed(1)}%"></i></div></div>`
:`<div class="pzbud"><div class="kv"><span>${tr('puzzles.spent_x',{x:sp})}</span><b>${tr('puzzles.no_budget_star_on_the_house')}</b></div></div>`;
h+=!e.conn?`<div class="pzn1">🛡 ${tr('puzzles.n_1_connect_everything_first')}</div>`:e.n1?`<div class="pzn1 on">🛡 ${tr('puzzles.survives_any_single_cut')}</div>`:`<div class="pzn1 bad">⚠️ ${tr('puzzles.one_cut_splits_it_where',{where:pzUnitName(e.weak[0])})}</div>`;
h+=!e.conn?`<div class="pzn1">🛡 ${tr('puzzles.n_1_connect_everything_first')}</div>`:e.n1?`<div class="pzn1 on">🛡 ${tr('puzzles.survives_any_single_cut')}</div>`:`<div class="pzn1 bad">⚠️ ${tr('puzzles.one_cut_splits_it_where',{where:pzUnitName(e.weak[0])})}${pzOneMore(e)?`<br><small>${tr('puzzles.so_close_one_more_link_and')}</small>`:''}</div>`;
h+=`<div class="btns">${btn('↶ '+tr('puzzles.undo'),'pzUndo',{},'ghost sm',!(UI.pzHist&&UI.pzHist.length))}${btn(tr('puzzles.reset'),'pzReset',{},'ghost sm',!S.links.length&&!Object.keys(S.pops).length)}${btn(UI.pzFrom==='game'?tr('puzzles.back_to_my_network'):tr('puzzles.back_to_the_title'),'pzLeave',{},'ghost sm')}</div>`;
if(h!==UI._pzh){UI._pzh=h;morph(el,h);}}
function pzPanel(sel){const head=(eb,name,facts)=>`<div class="ph"><div style="min-width:0"><div class="eyebrow">${eb}</div><h2>${name}</h2>${facts?`<div class="facts">${facts}</div>`:''}</div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div>`;
@ -56,17 +56,21 @@ function pzLinkModal(a,b,keep){const kb=pzKind(b);
h+=`<div class="tiers">${PZ_TIERS.map(i=>{const why=subWaveWhy(i,r.km,r.sub),c=pzLinkCost(r,i,div)+pop;return `<button class="tierbtn" data-act="pzLink" data-args='{"tier":${i}}'${why||(P.noSub&&r.sub)?' disabled':''}><span class="sz">${LT[i].n}</span><span class="grow meta">${why?tr('common.too_far_for_this_cable'):pop?tr('puzzles.with_the_pop_price',{price:fmt$(c)}):''}</span><span class="pr num">${tr('puzzles.price_per_year',{price:fmt$(pzLinkCost(r,i,div))})}</span></button>`;}).join('')}</div>`;
openModal(h);}
// ---------- results ----------
function pzLine(e){return e.stars>=3?tr('puzzles.a_backhoe_walks_into_your_network'):!e.n1&&!e.cheap?tr('puzzles.it_works_finance_and_the_backhoe'):!e.n1?tr('puzzles.one_backhoe_away_from_a_very'):tr('puzzles.rock_solid_and_gold_plated_the');}
function pzLine(e){return e.stars>=3?tr('puzzles.a_backhoe_walks_into_your_network'):!e.n1&&!e.cheap?tr('puzzles.it_works_finance_and_the_backhoe'):!e.n1?(pzOneMore(e)?tr('puzzles.so_close_one_more_link_and'):tr('puzzles.one_backhoe_away_from_a_very')):tr('puzzles.rock_solid_and_gold_plated_the');}
// Stars still to win in this puzzle's pack, from the progress just saved.
function pzPackLeft(P){const d=pzDef(P.id);if(!d)return null;const p=pzLoad(),xs=PZ.filter(x=>x.pack===d.pack);return xs.length*3-xs.reduce((a,x)=>a+((p.s[x.id]||{}).st|0),0);}
function pzConfetti(){if(!animOn())return '';const cols=['#FF4F9A','#FFD23F','#22C47A','#2F8CFF','#FF8A3D','#7B61FF'];let h='';
for(let i=0;i<28;i++)h+=`<i style="--x:${(i*37)%100}%;--c:${cols[i%cols.length]};--r:${(i%2?1:-1)*(180+(i*53)%360)}deg;--t:${1.4+(i%5)*0.25}s;--dl:${((i*7)%10)/10}s"></i>`;
return `<div class="pzconf" aria-hidden="true">${h}</div>`;}
function pzResults(e,prev){const P=S.pz,nx=P.id==='weekly'?null:pzNextDef();
function pzResults(e,prev){const P=S.pz,nx=P.id==='weekly'?null:pzNextDef(),left=pzPackLeft(P),done=e.stars>=3;
const row=(ok,l,v)=>`<div class="kv"><span>${ok?'⭐':'☆'} ${l}</span><b>${v}</b></div>`;
const stars=[0,1,2].map(i=>`<span class="pzbig${i<e.stars?' on':''}${i>=prev&&i<e.stars?' pop':''}" style="--d:${Math.max(0,i-prev)*0.45}s">⭐</span>`).join('');
openModal(`<div class="pzres">${e.stars>=3?pzConfetti():''}<div style="display:flex;align-items:center"><div class="grow"><div class="eyebrow">${tr('puzzles.puzzle_solved')}</div><h2 style="font-size:28px">${esc(pzName(pzDef(P.id)||P))}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
<div class="pzstars">${stars}</div><p class="tagline" style="text-align:center">${pzLine(e)}</p>
<div class="pzstars">${stars}</div><p class="tagline" style="text-align:center">${pzLine(e)}</p>${left==null?'':`<p class="pzleft">${left?trn('puzzles.n_stars_left_in_this_pack',left):tr('puzzles.every_star_in_this_pack_is')}</p>`}
${row(true,tr('puzzles.goal'),tr('puzzles.connected'))}${row(e.cheap,tr('puzzles.budget'),P.budget?tr('puzzles.spent_x_of_y',{x:fmt$(e.spend),y:fmt$(P.budget)}):tr('puzzles.on_the_house'))}${row(e.n1,'N-1',e.n1?tr('puzzles.survives_any_single_cut'):tr('puzzles.one_cut_splits_it'))}
<div class="btns cta" style="margin-top:12px">${nx?btn(tr('puzzles.next_puzzle'),'pzStart',{id:nx.id},'pink big'):btn(tr('puzzles.more_puzzles'),'puzzleMenu',{},'pink big')}${e.stars<3?btn(tr('puzzles.retry_for_3_stars'),'pzRetry',{},''):''}${btn(tr('common.share_2cd9'),'pzShare',{},'')}${btn(tr('puzzles.keep_building'),'closeModal',{},'ghost')}</div></div>`);
<div class="btns cta${done?' pzdone':''}" style="margin-top:12px">${nx?btn(tr('puzzles.next_puzzle')+(done?' →':''),'pzStart',{id:nx.id},'pink big pznext'):btn(tr('puzzles.more_puzzles'),'puzzleMenu',{},'pink big pznext')}${!done?btn(tr('puzzles.retry_for_3_stars'),'pzRetry',{},''):''}${btn(tr('common.share_2cd9'),'pzShare',{},done?'ghost':'')}${btn(tr('puzzles.keep_building'),'closeModal',{},'ghost')}</div></div>`);
// Three stars: Next is the one big obvious tap (and the keyboard's default).
if(done){const b=document.querySelector('#modalCard .pznext');if(b)try{b.focus({preventScroll:true});}catch(_){}}
for(let i=prev;i<e.stars;i++)setTimeout(()=>{sfx('star');haptic(15);},Math.max(0,i-prev)*450+150);
if(e.stars>=3&&prev<3)setTimeout(()=>sfx('fanfare'),(3-prev)*450+250);}
// ---------- the list ----------

View file

@ -2855,6 +2855,7 @@
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Every internet starts with one tube.",
"puzzles.every_link_n_g_or_more":"Every link {n}G or more",
"puzzles.every_star_in_this_pack_is":"Every star in this pack is yours.",
"puzzles.fat_pipes_only":"Fat Pipes Only",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"For architects who sleep through backhoe season.",
@ -2877,6 +2878,7 @@
"puzzles.n_1_club":"N-1 Club",
"puzzles.n_1_connect_everything_first":"N-1: connect everything first",
"puzzles.n_g_links":"{n}G links",
"puzzles.n_stars_left_in_this_pack":{"one":"{n} ⭐ left in this pack","other":"{n} ⭐ left in this pack"},
"puzzles.n_week_streak":{"one":"{n} week in a row","other":"{n} weeks in a row"},
"puzzles.new_zealand_is_far_from_everything":"New Zealand is far from everything. That is the point, and the problem.",
"puzzles.next_pack_unlocks_at_n":"Next pack, {pack}, unlocks at {n}⭐",
@ -2922,6 +2924,7 @@
"puzzles.size":"Size",
"puzzles.small_calm_network_builds":"Small, calm network builds",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.so_close_one_more_link_and":"So close: one more link and a backhoe can't touch you.",
"puzzles.speed_runs":"Speed Runs",
"puzzles.spent_x":"Spent {x}",
"puzzles.spent_x_of_y":"Spent {x} / {y}",

View file

@ -19,6 +19,10 @@ body.pz #hud .chip:not(.brand):not(.speed),body.pz #hud .speed button:not(#muteB
.scn.lock{opacity:.5}
.pzres{position:relative}.pzstars{display:flex;justify-content:center;gap:10px;margin:10px 0 2px}
.pzbig{font-size:46px;filter:grayscale(1);opacity:.3}.pzbig.on{filter:none;opacity:1}
.pzleft{text-align:center;font-weight:900;font-size:13px;margin:2px 0 0;color:var(--ink2)}
.btns.pzdone .pznext{flex:1 1 100%;font-size:22px;padding:10px 18px 8px;animation:pznudge 1.8s ease-in-out 1.6s infinite}
@keyframes pznudge{50%{transform:translateY(-2px);box-shadow:0 5px 0 var(--ink)}}
@media (prefers-reduced-motion:reduce){.btns.pzdone .pznext{animation:none}}
.pzbig.pop{animation:pzpop .5s cubic-bezier(.3,1.6,.5,1) var(--d) both}
@keyframes pzpop{0%{transform:scale(0) rotate(-40deg);opacity:0}100%{transform:scale(1) rotate(0);opacity:1}}
.pzconf{position:absolute;inset:-16px;pointer-events:none;overflow:hidden;z-index:2}

View file

@ -411,3 +411,37 @@ test('phone sheet: 40 px touch targets, pinned actions, and goal chips with a cl
assert.ok(ev("[...document.querySelectorAll('#pzBox button')].every(b=>b.classList.contains('b'))"), 'every sheet button is a .b the rule sizes');
assert.deepEqual(errors, []);
});
test('results pull you on: Next is the big tap after three stars, stars left in the pack, and a nudge when 3 stars are one link away', () => {
const { ev, errors } = load();
ev("localStorage.removeItem('sot-puzzles');pzBegin(pzDef('braces'))");
build(ev, REF.braces.one);
let card = ev("document.getElementById('modalCard').textContent");
assert.equal(evalP(ev).stars, 2);
assert.match(card, /So close: one more link and a backhoe can't touch you\./, 'Dublin to New York would do it, within budget');
assert.match(ev("document.getElementById('pzBox').textContent"), /So close/);
assert.match(card, /10 ⭐ left in this pack/, '4 puzzles × 3 stars, 2 won');
assert.ok(ev("!!document.querySelector('#modalCard [data-act=pzRetry]')"));
assert.ok(!ev("document.querySelector('#modalCard .btns.cta').classList.contains('pzdone')"));
build(ev, [['dub', 'nyc', 'havf']]);
card = ev("document.getElementById('modalCard').textContent");
assert.match(card, /9 ⭐ left in this pack/);
assert.ok(ev("document.querySelector('#modalCard .btns.cta').classList.contains('pzdone')"), 'three stars: the big Next layout');
assert.ok(ev("document.activeElement===document.querySelector('#modalCard .pznext')"), 'the big button has the focus');
assert.equal(ev("document.querySelector('#modalCard [data-act=pzRetry]')"), null, 'no retry after three stars');
assert.match(ev("document.querySelector('#modalCard .pznext').textContent"), /More puzzles/, 'the last pack points back to the list');
ev("pzBegin(pzDef('eurotrip'))");build(ev, REF.eurotrip.three);
assert.match(ev("document.querySelector('#modalCard .pznext').textContent"), /Next puzzle →/);
assert.equal(ev("document.activeElement.dataset.act"), 'pzStart');
// No nudge when no single link fits the budget: an over-budget gold plate is not "close".
ev("pzBegin(pzDef('braces'));S.pz.budget=245000");
build(ev, REF.braces.one);
assert.equal(evalP(ev).stars, 2);
assert.doesNotMatch(ev("document.getElementById('modalCard').textContent"), /So close/);
assert.match(ev("document.getElementById('modalCard').textContent"), /One backhoe away/);
// A finished pack says so.
ev("localStorage.setItem('sot-puzzles',JSON.stringify({s:{sharks:{st:3},braces:{st:3},nofra:{st:3},fatpipes:{st:2}}}));pzBegin(pzDef('fatpipes'))");
build(ev, REF.fatpipes.three);
assert.match(ev("document.getElementById('modalCard').textContent"), /Every star in this pack is yours/);
assert.deepEqual(errors, []);
});