Back to winniegolf
SOURCE / PINNED RELEASE

Made of little things.

winniegolf

Release
017b791c0f4b…
Author-recorded commit
612845c125fd…
License
Check the original source
Author’s source reference
nostr://npub18weq5jzw27gkhwcuf6gu57alcptjdvh78nlulgpkz8s7pnlxfnnspc00s9/wss%3A%2F%2Fgit.napplet.soy%2F/n-2d501957e21

The hash-verified playable HTML, which may contain bundled or minified code. This view does not execute it.

index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Winnie Golf — 10-hole mini golf</title>
    <script type="module" crossorigin>var dt=Object.defineProperty;var ft=(e,t,n)=>t in e?dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var b=(e,t,n)=>ft(e,typeof t!="symbol"?t+"":t,n);function pt(){const e=window;if(!e.napplet)throw new Error("window.napplet is unavailable -- runtime did not inject the napplet namespace");return e.napplet}function d(e){const n=pt()[e];if(!n)throw new Error(`window.napplet.${String(e)} is unavailable -- runtime did not inject this domain`);return n}var Ue={getItem(e){return d("storage").getItem(e)},setItem(e,t){return d("storage").setItem(e,t)},removeItem(e){return d("storage").removeItem(e)},keys(){return d("storage").keys()},instance:{getItem(e){return d("storage").instance.getItem(e)},setItem(e,t){return d("storage").instance.setItem(e,t)},removeItem(e){return d("storage").instance.removeItem(e)},keys(){return d("storage").instance.keys()}}},yt={getPublicKey(){return d("identity").getPublicKey()},onChanged(e){return d("identity").onChanged(e)},getRelays(){return d("identity").getRelays()},getProfile(){return d("identity").getProfile()},getFollows(){return d("identity").getFollows()},getList(e){return d("identity").getList(e)},getZaps(){return d("identity").getZaps()},getMutes(){return d("identity").getMutes()},getBlocked(){return d("identity").getBlocked()},getBadges(){return d("identity").getBadges()}},se={get(){return d("config").get()},subscribe(e){return d("config").subscribe(e)},openSettings(e){d("config").openSettings(e)},registerSchema(e,t){return d("config").registerSchema(e,t)},onSchemaError(e){return d("config").onSchemaError(e)},get schema(){return d("config").schema}},mt={discover(e){return d("cvm").discover(e)},request(e,t,n){return d("cvm").request(e,t,n)},listTools(e,t){return d("cvm").listTools(e,t)},callTool(e,t,n,s){return d("cvm").callTool(e,t,n,s)},listResources(e,t){return d("cvm").listResources(e,t)},readResource(e,t,n){return d("cvm").readResource(e,t,n)},close(e){return d("cvm").close(e)},onEvent(e){return d("cvm").onEvent(e)},registry:{list(e){return d("cvm").registry.list(e)},has(e,t){return d("cvm").registry.has(e,t)},describe(e,t){return d("cvm").registry.describe(e,t)},call(e,t,n,s){return d("cvm").registry.call(e,t,n,s)}}};function gt(e,t){return!!(e!=null&&e[t])}function K(e){return gt(window.napplet,e)}const B={textSize:14,aimGuide:!0,effects:!0,playerName:""};let $=null;function ze(){return $||($=typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null),($==null?void 0:$.matches)===!0}const wt="http://json-schema.org/draft-07/schema#",vt=1,kt="object",St=!1,xt={textSize:{type:"integer",title:"Text size",description:"Broadcast bar and card text size in pixels. Changes apply while the napplet is running.",minimum:11,maximum:18,default:14,"x-napplet-section":"Appearance","x-napplet-order":1},aimGuide:{type:"boolean",title:"Aim guide",description:"Show the dashed predicted path and power ring while lining up a putt.",default:!0,"x-napplet-section":"Play","x-napplet-order":2},effects:{type:"boolean",title:"Effects",description:"Show ball trail, impact particles and screen shake. The system reduced-motion setting is honoured either way.",default:!0,"x-napplet-section":"Play","x-napplet-order":3},playerName:{type:"string",title:"Player name",description:"Name shown on the shared top-3 board. Left blank, the shell profile name is used when the host provides one.",default:"",maxLength:32,"x-napplet-section":"Play","x-napplet-order":4}},bt={$schema:wt,$version:vt,type:kt,additionalProperties:St,properties:xt};K("config")&&(async()=>{se.schema||await se.registerSchema(bt);const e=se.subscribe(t=>{typeof t.textSize=="number"&&Number.isFinite(t.textSize)&&(B.textSize=t.textSize),typeof t.aimGuide=="boolean"&&(B.aimGuide=t.aimGuide),typeof t.effects=="boolean"&&(B.effects=t.effects),typeof t.playerName=="string"&&(B.playerName=t.playerName.slice(0,32)),document.documentElement.style.setProperty("--hud-fs",`${B.textSize}px`)});window.addEventListener("pagehide",()=>e.close(),{once:!0})})().catch(()=>{});const v=560,m=400,S=16;function L(e,t){return[{x:0,y:0,w:e,h:S},{x:0,y:t-S,w:e,h:S},{x:0,y:S,w:S,h:t-S*2},{x:e-S,y:S,w:S,h:t-S*2}]}const T=[{id:1,name:"First Light",hint:"A clean line to the cup.",par:2,w:v,h:m,tee:{x:85,y:300},cup:{x:475,y:110},walls:[...L(v,m),{x:230,y:40,w:80,h:70},{x:300,y:290,w:80,h:70}],sand:[],land:null,bumpers:[],spinners:[]},{id:2,name:"Dogleg",hint:"Thread the gap on the right, then bank back to the cup.",par:3,w:v,h:m,tee:{x:80,y:320},cup:{x:170,y:70},walls:[...L(v,m),{x:S,y:170,w:360,h:18},{x:280,y:90,w:90,h:60}],sand:[],land:null,bumpers:[],spinners:[]},{id:3,name:"Sandbar",hint:"Carry the bunker, then thread the gate.",par:3,w:v,h:m,tee:{x:80,y:193},cup:{x:500,y:193},walls:[...L(v,m),{x:390,y:S,w:70,h:120},{x:390,y:250,w:70,h:134}],sand:[{x:170,y:S,w:150,h:m-S*2}],land:null,bumpers:[],spinners:[]},{id:4,name:"Windmill",hint:"Time the blade, then thread the gate.",par:5,w:v,h:m,tee:{x:80,y:340},cup:{x:510,y:133},walls:[...L(v,m),{x:400,y:S,w:70,h:90},{x:400,y:160,w:70,h:80}],sand:[],land:null,bumpers:[{x:120,y:90,r:24},{x:470,y:310,r:24}],spinners:[{cx:250,cy:200,half:120,thick:16,speed:1.7,phase:0}]},{id:5,name:"Island Green",hint:"Stay on the dry line. Water costs a stroke.",par:4,w:v,h:m,tee:{x:110,y:325},cup:{x:455,y:85},walls:L(v,m),sand:[],land:[{x:40,y:280,w:150,h:90},{x:190,y:300,w:210,h:45},{x:365,y:130,w:45,h:170},{x:365,y:40,w:155,h:90}],bumpers:[],spinners:[]},{id:6,name:"Millrace",hint:"Firm carry over the sand, then time the blade before the gate.",par:5,w:v,h:m,tee:{x:80,y:320},cup:{x:500,y:80},walls:[...L(v,m),{x:410,y:S,w:60,h:110},{x:410,y:260,w:60,h:124}],sand:[{x:140,y:S,w:110,h:m-S*2}],land:null,bumpers:[{x:500,y:310,r:24}],spinners:[{cx:315,cy:193,half:90,thick:16,speed:1.7,phase:0}]},{id:7,name:"Toll Bridge",hint:"Two narrow bridges, and the pegs will happily pay your toll.",par:5,w:v,h:m,tee:{x:100,y:320},cup:{x:480,y:55},walls:L(v,m),sand:[],land:[{x:40,y:260,w:140,h:110},{x:178,y:300,w:102,h:50},{x:270,y:150,w:130,h:200},{x:330,y:90,w:50,h:70},{x:300,y:20,w:220,h:80}],bumpers:[{x:310,y:230,r:24},{x:375,y:180,r:24}],spinners:[]},{id:8,name:"Needle",hint:"Pick a side of the pillar, then ease it past the pegs — long and it dies in the sand behind the cup.",par:5,w:v,h:m,tee:{x:80,y:200},cup:{x:495,y:200},walls:[...L(v,m),{x:270,y:180,w:40,h:40}],sand:[{x:150,y:S,w:260,h:120},{x:150,y:264,w:260,h:120},{x:518,y:150,w:26,h:100}],land:null,bumpers:[{x:190,y:200,r:24},{x:445,y:145,r:24},{x:445,y:255,r:24}],spinners:[]},{id:9,name:"Riptide",hint:"Up the channel, then cross the bridge only when the blade swings in line.",par:5,w:v,h:m,tee:{x:90,y:320},cup:{x:440,y:300},walls:L(v,m),sand:[],land:[{x:30,y:250,w:150,h:120},{x:120,y:120,w:50,h:140},{x:120,y:80,w:280,h:50},{x:350,y:128,w:50,h:122},{x:300,y:230,w:200,h:120}],bumpers:[{x:360,y:290,r:24}],spinners:[{cx:92,cy:175,half:66,thick:16,speed:1.7,phase:1.57}]},{id:10,name:"Crucible",hint:"Three crossings, one choke, and the blade never sleeps — everything you have learned, at once.",par:5,w:v,h:m,tee:{x:90,y:330},cup:{x:490,y:50},walls:L(v,m),sand:[{x:300,y:195,w:50,h:40}],land:[{x:30,y:260,w:150,h:110},{x:175,y:300,w:95,h:50},{x:255,y:185,w:135,h:165},{x:300,y:85,w:50,h:115},{x:320,y:20,w:200,h:130}],bumpers:[{x:310,y:240,r:24},{x:355,y:300,r:24},{x:495,y:115,r:24}],spinners:[{cx:420,cy:85,half:55,thick:16,speed:1.7,phase:0}]}],X=T.reduce((e,t)=>e+t.par,0),R=13,Y=19,Mt=620,Ee=95,Ie=720,Pt=135,Tt=850,V=.72,Re=1.14,Et=7,It=250,Ae=Y+6,Rt=460,At=250,Lt=1/300,Ct=60;function Bt(){return{sunk:!1,wet:!1,rail:!1,bumper:!1,at:null}}function Dt(e,t,n){return e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h}function ye(e,t,n,s){const r=Math.max(s.x,Math.min(e,s.x+s.w)),a=Math.max(s.y,Math.min(t,s.y+s.h)),i=e-r,l=t-a,o=i*i+l*l;if(o>n*n)return null;if(o>1e-9){const x=Math.sqrt(o);return{nx:i/x,ny:l/x,depth:n-x}}const p=e-s.x,f=s.x+s.w-e,y=t-s.y,k=s.y+s.h-t,w=Math.min(p,f,y,k);return w===p?{nx:-1,ny:0,depth:p+n}:w===f?{nx:1,ny:0,depth:f+n}:w===y?{nx:0,ny:-1,depth:y+n}:{nx:0,ny:1,depth:k+n}}function Nt(e,t,n){for(const s of n.sand)if(ye(e,t,R,s))return"sand";return"green"}function _t(e,t,n){if(!n.land)return!0;for(const s of n.land)if(Dt(e,t,s))return!0;return!1}function Ke(e,t){return e.phase+e.speed*t}function me(e){const t=Math.hypot(e.vx,e.vy);if(t>Ie){const n=Ie/t;e.vx*=n,e.vy*=n}}function Ht(e,t,n){for(let s=0;s<3;s+=1){let r=!1;for(const a of t.walls){const i=ye(e.x,e.y,R,a);if(!i)continue;e.x+=i.nx*i.depth,e.y+=i.ny*i.depth;const l=e.vx*i.nx+e.vy*i.ny;l<0&&(e.vx-=(1+V)*l*i.nx,e.vy-=(1+V)*l*i.ny,n.rail=!0,n.at={x:e.x,y:e.y}),r=!0}if(!r)break}me(e)}function Wt(e,t,n){for(const s of t.bumpers){const r=e.x-s.x,a=e.y-s.y,i=Math.hypot(r,a),l=R+s.r;if(i>=l||i<1e-6)continue;const o=r/i,p=a/i;e.x=s.x+o*l,e.y=s.y+p*l;const f=e.vx*o+e.vy*p;f<0&&(e.vx-=(1+Re)*f*o,e.vy-=(1+Re)*f*p,n.bumper=!0,n.at={x:e.x,y:e.y})}me(e)}function qt(e,t,n,s){for(const r of t.spinners){const a=Ke(r,n),i=Math.cos(a),l=Math.sin(a),o=r.cx-i*r.half,p=r.cy-l*r.half,f=i*r.half*2,y=l*r.half*2,k=f*f+y*y;let w=((e.x-o)*f+(e.y-p)*y)/k;w=Math.max(0,Math.min(1,w));const x=o+f*w,q=p+y*w;let _=e.x-x,M=e.y-q,C=Math.hypot(_,M);const te=R+r.thick/2;if(C>=te)continue;C<1e-6?(_=-l,M=i,C=1):(_/=C,M/=C),e.x=x+_*te,e.y=q+M*te;const ut=x-r.cx,be=-(q-r.cy)*r.speed,Me=ut*r.speed,Pe=e.vx-be,Te=e.vy-Me,ne=Pe*_+Te*M;ne<0&&(e.vx=Pe-(1+V)*ne*_+be,e.vy=Te-(1+V)*ne*M+Me,s.rail=!0,s.at={x:e.x,y:e.y})}me(e)}function $t(e,t,n,s,r){const a=t.cup.x-e.x,i=t.cup.y-e.y,l=Math.hypot(a,i);let o=Math.hypot(e.vx,e.vy);if(l<Ae&&l>.001&&o<At){const k=Rt*n/l;e.vx+=a*k,e.vy+=i*k,o=Math.hypot(e.vx,e.vy)}const p=Nt(e.x,e.y,t)==="sand"?Tt:Pt;if(o>0){const k=Math.max(0,o-p*n),w=k/o;e.vx*=w,e.vy*=w,o=k}e.x+=e.vx*n,e.y+=e.vy*n,Ht(e,t,r),Wt(e,t,r),qt(e,t,s,r),o<Et&&l>=Ae&&(e.vx=0,e.vy=0),_t(e.x,e.y,t)||(r.wet=!0);const f=t.cup.x-e.x,y=t.cup.y-e.y;Math.hypot(f,y)<Y&&Math.hypot(e.vx,e.vy)<It&&(r.sunk=!0)}function Ft(e,t,n,s,r){let a=n,i=s,l=0;for(;a>1e-6&&l<Ct;){const o=Math.min(Lt,a);if($t(e,t,o,i,r),i+=o,a-=o,l+=1,r.sunk||r.wet)break}return i}function Ot(e,t,n,s,r){const a=[{x:e.x,y:e.y}];let i=e.x,l=e.y,o=t.x,p=t.y,f=0,y=0;const k=4;for(;f<s&&y<=r;){let w=i+o*k,x=l+p*k,q=!1;for(const _ of n.walls){const M=ye(w,x,R,_);if(!M)continue;w+=M.nx*M.depth,x+=M.ny*M.depth;const C=o*M.nx+p*M.ny;C<0&&(o-=2*C*M.nx,p-=2*C*M.ny),a.push({x:w,y:x}),i=w,l=x,y+=1,f+=k,q=!0;break}q||(i=w,l=x,f+=k,a.push({x:i,y:l}))}return a}const u={rough:"#225c31",roughAlt:"#1f552d",turfA:"#51ad5e",turfB:"#459e52",shore:"#d8c48c",sand:"#eedda9",sandEdge:"#d2bc82",water:"#2f7fd0",waterDeep:"#2468ae",waterSpark:"#8ecaf7",rail:"#e9e3d4",railTop:"#f6f2e7",cup:"#141c26",cupRim:"#0a1017",ball:"#ffffff",ballShade:"#d9dee4",flag:"#e8433f",pole:"#f6f2e7",brass:"#e6b45a",brassDeep:"#b8863a",ink:"#101a24",shadow:"rgba(8, 16, 11, 0.32)",dust:"rgba(246, 242, 231, 0.92)",splash:"#a8d8ff",aim:"rgba(246, 242, 231, 0.88)"},Le=240;class Ut{constructor(){b(this,"levelIndex",0);b(this,"holeStrokes",T.map(()=>0));b(this,"currentStrokes",0);b(this,"ball",{x:0,y:0,vx:0,vy:0});b(this,"phase","ready");b(this,"courseTime",0);b(this,"aimAngle",0);b(this,"aimPower",.45);b(this,"aiming",!1);b(this,"particles",[]);b(this,"trail",[]);b(this,"shake",0);b(this,"message","");b(this,"messageTimer",0);b(this,"hintTimer",0);b(this,"lastSafe",{x:0,y:0});b(this,"trailClear",0);this.loadLevel(0)}get level(){return T[this.levelIndex]}get isFinalHole(){return this.levelIndex===T.length-1}get totalStrokes(){let t=0;for(let n=0;n<T.length;n+=1)this.holeStrokes[n]>0?t+=this.holeStrokes[n]:n===this.levelIndex&&(t+=this.currentStrokes);return t}get startedPar(){let t=0;for(let n=0;n<T.length;n+=1)(this.holeStrokes[n]>0||n===this.levelIndex)&&(t+=T[n].par);return t}get vsPar(){return this.totalStrokes-this.startedPar}loadLevel(t){this.levelIndex=Math.max(0,Math.min(T.length-1,t));const n=this.level;this.ball={x:n.tee.x,y:n.tee.y,vx:0,vy:0},this.currentStrokes=0,this.phase="ready",this.aiming=!1,this.aimAngle=Math.atan2(n.cup.y-n.tee.y,n.cup.x-n.tee.x),this.aimPower=.45,this.particles=[],this.trail=[],this.lastSafe={x:n.tee.x,y:n.tee.y},this.shake=0,this.message="",this.messageTimer=0,this.hintTimer=4.5}restartHole(){this.loadLevel(this.levelIndex)}newRound(){this.holeStrokes=T.map(()=>0),this.loadLevel(0)}nextLevel(){return this.isFinalHole?!1:(this.loadLevel(this.levelIndex+1),!0)}setAim(t,n){this.aimAngle=t,this.aimPower=Math.max(0,Math.min(1,n))}putt(){if(this.phase!=="ready")return!1;if(this.aimPower<.06)return this.aiming=!1,!1;const t=Ee+this.aimPower*(Mt-Ee);return this.lastSafe={x:this.ball.x,y:this.ball.y},this.ball.vx=Math.cos(this.aimAngle)*t,this.ball.vy=Math.sin(this.aimAngle)*t,this.currentStrokes+=1,this.phase="rolling",this.aiming=!1,this.trail=[],this.trailClear=0,this.hintTimer=0,!0}update(t,n){const s=Bt(),r=n.effects&&!n.reduced;if(this.phase!=="sunk"&&(this.courseTime=Ft(this.ball,this.level,t,this.courseTime,s)),s.wet)this.handleWater(r,n.effects);else if(s.sunk)return this.handleSink(n.effects),this.advanceTimers(t),!0;if(this.phase==="rolling"&&Math.hypot(this.ball.vx,this.ball.vy)<1e-6){this.phase="ready";const{x:a,y:i}=this.level.cup;this.aimAngle=Math.atan2(i-this.ball.y,a-this.ball.x),this.aiming=!1}return s.bumper&&s.at?(r&&(this.shake=Math.max(this.shake,9)),n.effects&&this.spawnBurst(s.at.x,s.at.y,8,u.brass)):s.rail&&s.at&&(r&&(this.shake=Math.max(this.shake,5)),n.effects&&this.spawnBurst(s.at.x,s.at.y,5,u.dust)),this.advanceTimers(t),this.updateTrail(t),this.updateParticles(t),!1}handleWater(t,n){const s={x:this.ball.x,y:this.ball.y};n&&this.spawnSplash(s.x,s.y),t&&(this.shake=Math.max(this.shake,11)),this.currentStrokes+=1,this.ball.x=this.lastSafe.x,this.ball.y=this.lastSafe.y,this.ball.vx=0,this.ball.vy=0,this.phase="ready",this.trail=[],this.message="Water — one stroke penalty",this.messageTimer=2.4}handleSink(t){this.phase="sunk",this.holeStrokes[this.levelIndex]=this.currentStrokes,this.trail=[],this.message="",this.messageTimer=0,t&&(this.spawnBurst(this.level.cup.x,this.level.cup.y,26,u.flag),this.spawnBurst(this.level.cup.x,this.level.cup.y,14,u.brass))}advanceTimers(t){this.shake=Math.max(0,this.shake-t*34),this.messageTimer>0&&(this.messageTimer-=t),this.hintTimer>0&&(this.hintTimer-=t)}updateTrail(t){if(this.phase==="rolling"){const n=this.trail[this.trail.length-1];(!n||Math.hypot(this.ball.x-n.x,this.ball.y-n.y)>7)&&(this.trail.push({x:this.ball.x,y:this.ball.y}),this.trail.length>16&&this.trail.shift()),this.trailClear=.45}else this.trail.length>0&&(this.trailClear-=t,this.trailClear<=0&&(this.trail=[]))}updateParticles(t){if(this.particles.length!==0){for(const n of this.particles){n.x+=n.vx*t,n.y+=n.vy*t;const s=Math.max(0,1-n.drag*t);n.vx*=s,n.vy*=s,n.life-=t}this.particles=this.particles.filter(n=>n.life>0)}}spawnBurst(t,n,s,r){for(let a=0;a<s;a+=1){if(this.particles.length>=Le)return;const i=Math.random()*Math.PI*2,l=45+Math.random()*110,o=.3+Math.random()*.35;this.particles.push({x:t,y:n,vx:Math.cos(i)*l,vy:Math.sin(i)*l,life:o,maxLife:o,size:2+Math.random()*3,color:r,drag:4.5})}}spawnSplash(t,n){for(let s=0;s<22;s+=1){if(this.particles.length>=Le)return;const r=Math.random()*Math.PI*2,a=60+Math.random()*150,i=.35+Math.random()*.4;this.particles.push({x:t,y:n,vx:Math.cos(r)*a,vy:Math.sin(r)*a,life:i,maxLife:i,size:2+Math.random()*3.5,color:Math.random()>.4?u.splash:u.waterSpark,drag:3.4})}}}const Xe=1,je="naddr1qvzqqqyf8ypzqwajpfyyu4u3dwa3cn53efamlszhy6e0u08le7srvy0pur87vn88qqxkutfjvs6nqvfex5mk2v33dy0d6z",Ge={pubkey:"60517f64548279854ee9a122531e4d1a413e3dc956e2d0a450217420623ca688",relays:["wss://relay.napplet.soy/"]},Ye=["round-strokes-v2"],zt={version:Xe,napplet:je,provider:Ge,boards:Ye},Kt=Object.freeze(Object.defineProperty({__proto__:null,boards:Ye,default:zt,napplet:je,provider:Ge,version:Xe},Symbol.toStringTag,{value:"Module"})),Xt="round-strokes-v2",jt=3,Gt=Object.assign({"../../.napplet-space/soy-backend.json":Kt});function Ve(){for(const e of Object.values(Gt)){const t=e==null?void 0:e.default;if(t&&typeof t.napplet=="string")return t}return null}function ee(){var t;if(!K("cvm"))return!1;const e=Ve();return!!(e!=null&&e.napplet&&((t=e.provider)!=null&&t.pubkey))}async function Je(e,t){var a,i,l;if(!ee())return null;const n=Ve();if(!(n!=null&&n.napplet)||!((a=n.provider)!=null&&a.pubkey))return null;const s={pubkey:n.provider.pubkey,...n.provider.relays?{relays:n.provider.relays}:{}},r={napplet:n.napplet,board:Xt};try{const o=await mt.callTool(s,e,{...r,...t});if(o.isError)return null;const p=o.structuredContent;if(p&&typeof p=="object")return p;const f=(l=(i=o.content)==null?void 0:i.find(y=>y.type==="text"))==null?void 0:l.text;if(f){const y=JSON.parse(f);if(y&&typeof y=="object")return y}}catch{}return null}function Yt(e){const t=e==null?void 0:e.rows;if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!s||typeof s!="object")continue;const r=s,a=typeof r.score=="number"?r.score:Number(r.score);Number.isFinite(a)&&n.push({score:a,name:typeof r.name=="string"&&r.name.trim()?r.name.trim():null,actor:typeof r.actor=="string"?r.actor:""})}return n.sort((s,r)=>s.score-r.score||s.actor.localeCompare(r.actor)),n}async function Vt(e=jt){const t=await Je("soy_board_read",{limit:Math.max(1,e)});return t?Yt(t).slice(0,e):null}async function Jt(e,t){if(!ee()||!Number.isFinite(e))return!1;const n=t.trim();return await Je("soy_board_submit",{score:e,...n?{name:n.slice(0,32)}:{}})!==null}function Ze(e,t,n,s,r){const a=Math.max(40,t-r),i=Math.min(e/n,a/s),l=Math.min(e/s,a/n),o=l>i,p=o?l:i,f=o?s:n,y=o?n:s;return{scale:p,tx:(e-f*p)/2,ty:r+(a-y*p)/2,rotate:o}}function Zt(e,t,n,s){const r=(e-n.tx)/n.scale,a=(t-n.ty)/n.scale;return n.rotate?{x:a,y:s-r}:{x:r,y:a}}function Qt(e,t,n,s){const r=s*t.scale;t.rotate?(e.setTransform(r,0,0,r,s*(t.tx+t.scale*n),s*t.ty),e.rotate(Math.PI/2)):e.setTransform(r,0,0,r,s*t.tx,s*t.ty)}function j(e,t,n,s,r,a){const i=Math.max(0,Math.min(a,Math.min(s,r)/2));e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+s-i,n),e.quadraticCurveTo(t+s,n,t+s,n+i),e.lineTo(t+s,n+r-i),e.quadraticCurveTo(t+s,n+r,t+s-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Ce(e,t,n){e.fillStyle=u.turfA,e.fillRect(0,0,t,n),e.fillStyle=u.turfB;const s=34;for(let r=0;r<n;r+=s*2)e.fillRect(0,r,t,s)}function en(e,t,n){e.fillStyle=u.water,e.fillRect(0,0,t.w,t.h),e.fillStyle=u.waterDeep,e.globalAlpha=.35;const s=Math.sin(n*1.4)*6;for(let r=-20;r<t.w+20;r+=64)e.fillRect(r+s,0,18,t.h);e.globalAlpha=1}function tn(e,t){if(t.land){e.fillStyle=u.shore;for(const n of t.land)e.fillRect(n.x-7,n.y-7,n.w+14,n.h+14)}}function nn(e,t){for(const n of t.walls)e.fillStyle=u.shadow,j(e,n.x,n.y+5,n.w,n.h,7),e.fill(),e.fillStyle=u.rail,j(e,n.x,n.y,n.w,n.h-5,7),e.fill(),e.fillStyle=u.railTop,j(e,n.x+2,n.y+1,n.w-4,4,2),e.fill()}function sn(e,t){for(const n of t.sand)j(e,n.x,n.y,n.w,n.h,18),e.fillStyle=u.sand,e.fill(),e.strokeStyle=u.sandEdge,e.lineWidth=3,e.stroke()}function rn(e,t){for(const n of t.bumpers)e.fillStyle=u.shadow,e.beginPath(),e.arc(n.x,n.y+5,n.r+1,0,Math.PI*2),e.fill(),e.fillStyle=u.brass,e.beginPath(),e.arc(n.x,n.y,n.r,0,Math.PI*2),e.fill(),e.strokeStyle=u.brassDeep,e.lineWidth=3,e.stroke(),e.fillStyle=u.ink,e.beginPath(),e.arc(n.x,n.y,n.r*.4,0,Math.PI*2),e.fill()}function an(e,t,n){for(const s of t.spinners){const r=Ke(s,n),a=Math.cos(r),i=Math.sin(r),l=s.cx-a*s.half,o=s.cy-i*s.half,p=s.cx+a*s.half,f=s.cy+i*s.half;e.lineCap="round",e.strokeStyle=u.shadow,e.lineWidth=s.thick,e.beginPath(),e.moveTo(l+4,o+6),e.lineTo(p+4,f+6),e.stroke(),e.strokeStyle=u.rail,e.beginPath(),e.moveTo(l,o),e.lineTo(p,f),e.stroke();const y=6,k=s.half*2/y;e.lineCap="butt",e.strokeStyle=u.flag;for(let w=0;w<y;w+=2){const x=-s.half+w*k;e.beginPath(),e.moveTo(s.cx+a*x,s.cy+i*x),e.lineTo(s.cx+a*(x+k),s.cy+i*(x+k)),e.stroke()}e.fillStyle=u.ink,e.beginPath(),e.arc(s.cx,s.cy,s.thick*.95,0,Math.PI*2),e.fill(),e.fillStyle=u.brass,e.beginPath(),e.arc(s.cx,s.cy,s.thick*.4,0,Math.PI*2),e.fill()}}function on(e,t,n){const{x:s,y:r}=t.cup;e.fillStyle=u.cupRim,e.beginPath(),e.arc(s,r,Y+3,0,Math.PI*2),e.fill(),e.fillStyle=u.cup,e.beginPath(),e.arc(s,r,Y,0,Math.PI*2),e.fill();const a={x:s,y:r-42},i=Math.sin(n*3)*4;e.strokeStyle="rgba(8, 16, 11, 0.28)",e.lineWidth=4,e.lineCap="round",e.beginPath(),e.moveTo(s+5,r+4),e.lineTo(a.x+16,a.y+10),e.stroke(),e.fillStyle=u.flag,e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(a.x+26+i,a.y+7+i*.4),e.lineTo(a.x,a.y+15),e.closePath(),e.fill(),e.strokeStyle=u.pole,e.lineWidth=3.5,e.beginPath(),e.moveTo(s,r),e.lineTo(a.x,a.y),e.stroke()}function ln(e,t){for(let n=0;n<t.length;n+=1){const s=(n+1)/(t.length+1);e.globalAlpha=s*.4,e.fillStyle=u.ball,e.beginPath(),e.arc(t[n].x,t[n].y,R*(.3+s*.45),0,Math.PI*2),e.fill()}e.globalAlpha=1}function hn(e,t){e.fillStyle=u.shadow,e.beginPath(),e.ellipse(t.x+3,t.y+5,R*1.02,R*.84,0,0,Math.PI*2),e.fill();const n=e.createRadialGradient(t.x-4,t.y-5,1,t.x,t.y,R);n.addColorStop(0,u.ball),n.addColorStop(.65,u.ball),n.addColorStop(1,u.ballShade),e.fillStyle=n,e.beginPath(),e.arc(t.x,t.y,R,0,Math.PI*2),e.fill(),e.fillStyle="rgba(120, 132, 145, 0.35)";const s=[[-4,2],[3,4],[1,-4],[6,-2],[-2,-6]];for(const[r,a]of s)e.beginPath(),e.arc(t.x+r,t.y+a,1.7,0,Math.PI*2),e.fill()}function cn(e,t,n,s,r,a){const i={x:Math.cos(s),y:Math.sin(s)},l=90+r*380,o=Ot({x:n.x,y:n.y},i,t,l,2);e.save(),e.setLineDash([10,10]),e.lineDashOffset=-a*34,e.lineCap="round",e.lineWidth=4,e.strokeStyle=u.aim,e.beginPath(),e.moveTo(o[0].x,o[0].y);for(let f=1;f<o.length;f+=1)e.lineTo(o[f].x,o[f].y);e.stroke(),e.restore();const p=R+10;e.lineWidth=5,e.strokeStyle="rgba(16, 26, 36, 0.5)",e.beginPath(),e.arc(n.x,n.y,p,-Math.PI/2,Math.PI*1.5),e.stroke(),r>.02&&(e.strokeStyle=r>.78?u.flag:u.brass,e.beginPath(),e.arc(n.x,n.y,p,-Math.PI/2,-Math.PI/2+r*Math.PI*2),e.stroke())}function un(e,t){for(const n of t)e.globalAlpha=Math.max(0,n.life/n.maxLife),e.fillStyle=n.color,e.beginPath(),e.arc(n.x,n.y,n.size,0,Math.PI*2),e.fill();e.globalAlpha=1}function dn(e,t,n){e.setTransform(1,0,0,1,0,0),e.fillStyle=u.rough,e.fillRect(0,0,t,n),e.strokeStyle=u.roughAlt,e.lineWidth=14,e.globalAlpha=.55,e.beginPath();for(let s=-n;s<t+n;s+=44)e.moveTo(s,0),e.lineTo(s+n,n);e.stroke(),e.globalAlpha=1}function fn(e,t){const{level:n,view:s,dpr:r,width:a,height:i}=t;if(e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,a,i),dn(e,a,i),Qt(e,s,n.h,r),e.translate(t.shakeX/s.scale,t.shakeY/s.scale),e.save(),e.beginPath(),e.rect(0,0,n.w,n.h),e.clip(),n.land){en(e,n,t.time),tn(e,n),e.save(),e.beginPath();for(const l of n.land)e.rect(l.x,l.y,l.w,l.h);e.clip(),Ce(e,n.w,n.h),e.restore()}else Ce(e,n.w,n.h);sn(e,n),e.restore(),nn(e,n),rn(e,n),an(e,n,t.time),on(e,n,t.time),t.trail.length>1&&ln(e,t.trail),t.aiming&&t.showGuide&&cn(e,n,t.ball,t.aimAngle,t.aimPower,t.time),hn(e,t.ball),un(e,t.particles)}const pn=240,yn=180,Qe="winniegolf.best-v1",Be=2,De=.7,le=.06,mn=6;function c(e){const t=document.querySelector(e);if(!t)throw new Error(`Missing required element: ${e}`);return t}function H(e,t){e.textContent!==t&&(e.textContent=t)}function P(e,t){e.hidden!==t&&(e.hidden=t)}function O(e){return e===0?"E":e>0?`+${e}`:`${e}`}function ge(e){return e<0?"under":e>0?"over":"even"}const gn=c("#app"),Ne=c("#stage"),I=c("#course"),wn=c("#hud"),vn=c("#tooSmall"),kn=c("#holeBadge"),Sn=c("#holeName"),xn=c("#strokeCount"),bn=c("#hudPar"),re=c("#totalValue"),he=c("#dock"),D=c("#powerSlider"),Mn=c("#powerTrack"),_e=c("#powerFill"),He=c("#powerThumb"),Pn=c("#powerValue"),et=c("#puttButton"),We=c("#hintBar"),qe=c("#messageBar"),Tn=c("#screenTitle"),En=c("#screenPause"),In=c("#screenHole"),Rn=c("#screenResults"),An=c("#playButton"),Ln=c("#pauseButton"),Cn=c("#resumeButton"),Bn=c("#restartButton"),Dn=c("#quitButton"),tt=c("#nextHoleButton"),Nn=c("#replayHoleButton"),_n=c("#playAgainButton"),Hn=c("#titleButton"),Wn=c("#bestScore"),qn=c("#saveNote"),$n=c("#pauseHole"),Fn=c("#holeResultKicker"),On=c("#holeResultName"),Un=c("#holeResultStrokes"),zn=c("#holeResultUnit"),$e=c("#holeResultVs"),Kn=c("#resultHeadline"),Xn=c("#resultTotal"),jn=c("#resultUnit"),Fe=c("#resultBest"),Gn=[{section:c("#leaderboardTitle"),list:c("#leaderListTitle"),note:c("#leaderNoteTitle")},{section:c("#leaderboardResults"),list:c("#leaderListResults"),note:c("#leaderNoteResults")}],nt=I.getContext("2d");if(!nt)throw new Error("Canvas 2D rendering is unavailable in this shell.");const Yn=nt,h=new Ut;let g="title",ce=Ze(640,400,T[0].w,T[0].h,60),ue=!1,we=0,ie=0,W=null,U=K("storage");const E=new Set;let A=null,de={x:0,y:0},J=!1;function N(e){g=e,P(Tn,e!=="title"),P(En,e!=="paused"),P(In,e!=="hole"),P(Rn,e!=="results")}function ve(){h.newRound(),N("playing")}function ke(){g==="playing"&&($n.textContent=`Hole ${h.levelIndex+1} · ${h.level.name}`,N("paused"))}function st(){g==="paused"&&N("playing")}function rt(){N("title")}function Z(){h.restartHole(),N("playing")}function Vn(){const e=h.holeStrokes[h.levelIndex],t=h.level.par,n=e-t;Fn.textContent=`Hole ${h.levelIndex+1} of ${T.length}`,On.textContent=h.level.name,Un.textContent=String(e),zn.textContent=e===1?"stroke":"strokes",$e.textContent=`par ${t} · ${O(n)}`,$e.dataset.state=ge(n),tt.textContent=h.isFinalHole?"See results":"Next hole",N("hole")}function fe(){if(h.nextLevel()){N("playing");return}Jn()}function Jn(){const e=h.totalStrokes,t=e-X,n=W,s=n===null||e<n;Kn.textContent=O(t),Xn.textContent=String(e),jn.textContent=`strokes · par ${X}`,Fe.textContent=s?n===null?"First round recorded":`New best, beating ${n}`:`Best round ${n} · ${O(n-X)}`,Fe.dataset.state=s?"under":ge(t),s&&Qn(e),N("results"),ts(e)}function z(){Wn.textContent=W===null?"—":`${W} · ${O(W-X)}`,P(qn,U)}async function Zn(){if(!K("storage")){U=!1,z();return}try{const e=await Ue.getItem(Qe);if(e){const t=JSON.parse(e),n=typeof t=="object"&&t!==null?t.best:void 0;typeof n=="number"&&Number.isFinite(n)&&n>0&&(W=Math.round(n))}}catch{U=!1}z()}async function Qn(e){if((W===null||e<W)&&(W=e),z(),!!U)try{await Ue.setItem(Qe,JSON.stringify({best:e}))}catch{U=!1,z()}}let F={kind:"off"},Oe=0;async function es(){const e=B.playerName.trim();if(e)return e.slice(0,32);if(K("identity"))try{const t=await yt.getProfile(),n=(t==null?void 0:t.displayName)??(t==null?void 0:t.name);if(typeof n=="string"&&n.trim())return n.trim().slice(0,32)}catch{}return""}async function it(){const e=++Oe;if(!ee()){F={kind:"off"},G();return}F={kind:"loading"},G();const t=await Vt(3);e===Oe&&(t?F=t.length?{kind:"rows",rows:t}:{kind:"empty"}:F={kind:"error"},G())}async function ts(e){if(!ee()||e<5||e>300)return;const t=await es();await Jt(e,t),await it()}function G(){for(const e of Gn)ns(e,F)}function ns(e,t){const{section:n,list:s,note:r}=e;if(t.kind==="off"){P(n,!0);return}if(P(n,!1),t.kind!=="rows"){s.replaceChildren(),P(s,!0),P(r,!1),r.textContent=t.kind==="loading"?"Loading the course leaders…":t.kind==="empty"?"No rounds posted yet. Yours could be first.":"Leaderboard unavailable right now.";return}P(r,!0),P(s,!1);const a=t.rows.map((i,l)=>{const o=document.createElement("li"),p=document.createElement("span");p.className="leader-rank",p.textContent=String(l+1);const f=document.createElement("span");f.className="leader-name",f.textContent=i.name??"Guest";const y=document.createElement("span");return y.className="leader-score",y.textContent=String(i.score),o.append(p,f,y),o});s.replaceChildren(...a)}function Se(){g==="playing"&&h.putt()}function pe(e,t){const n=I.getBoundingClientRect(),s=Zt(e-n.left,t-n.top,ce,h.level.h),r=s.x-h.ball.x,a=s.y-h.ball.y;Math.hypot(r,a)>=1&&h.setAim(Math.atan2(a,r),h.aimPower)}I.addEventListener("pointerdown",e=>{if(!(g!=="playing"||h.phase!=="ready"||A!==null)){A=e.pointerId,J=!1,de={x:e.clientX,y:e.clientY},h.aiming=!0;try{I.setPointerCapture(e.pointerId)}catch{}pe(e.clientX,e.clientY),e.preventDefault()}});I.addEventListener("pointermove",e=>{if(A===null){e.pointerType==="mouse"&&pe(e.clientX,e.clientY);return}A===e.pointerId&&(!J&&Math.hypot(e.clientX-de.x,e.clientY-de.y)>mn&&(J=!0),pe(e.clientX,e.clientY))});function ss(e){A===e.pointerId&&(A=null,h.aiming=!1,e.pointerType==="mouse"&&!J&&Se())}I.addEventListener("pointerup",ss);I.addEventListener("pointercancel",e=>{A===e.pointerId&&(A=null,h.aiming=!1)});let Q=null;function at(e){const t=Mn.getBoundingClientRect();if(t.width<1)return;const n=Math.max(0,Math.min(1,(e-t.left)/t.width));h.setAim(h.aimAngle,le+n*(1-le))}D.addEventListener("pointerdown",e=>{if(!(g!=="playing"||h.phase!=="ready")){Q=e.pointerId;try{D.setPointerCapture(e.pointerId)}catch{}at(e.clientX),e.preventDefault()}});D.addEventListener("pointermove",e=>{Q===e.pointerId&&at(e.clientX)});function ot(e){if(Q===e.pointerId){Q=null;try{D.releasePointerCapture(e.pointerId)}catch{}}}D.addEventListener("pointerup",ot);D.addEventListener("pointercancel",ot);function lt(){if(E.clear(),A!==null){try{I.releasePointerCapture(A)}catch{}A=null}h.aiming=!1}function ae(e){return e==="Space"||e==="Enter"||e==="NumpadEnter"}function oe(){return document.activeElement instanceof HTMLButtonElement}window.addEventListener("keydown",e=>{if(e.key==="Tab")return;const t=e.code;if(g==="playing"){if(t==="Escape"||t==="KeyP"){e.preventDefault(),ke();return}if(t==="KeyR"){e.preventDefault(),Z();return}if(ae(t)){if(oe())return;e.preventDefault(),e.repeat||Se();return}(t==="ArrowLeft"||t==="ArrowRight"||t==="ArrowUp"||t==="ArrowDown")&&e.preventDefault(),E.add(t);return}if(g==="paused"){(t==="Escape"||t==="KeyP")&&(e.preventDefault(),st());return}if(g==="hole"){if(t==="KeyN"&&!e.repeat){e.preventDefault(),fe();return}if(t==="KeyR"&&!e.repeat){e.preventDefault(),Z();return}if(ae(t)){if(oe())return;e.preventDefault(),e.repeat||fe()}return}if(ae(t)){if(oe()||(e.preventDefault(),e.repeat))return;(g==="title"||g==="results")&&ve()}});window.addEventListener("keyup",e=>{E.delete(e.code)});window.addEventListener("blur",lt);document.addEventListener("visibilitychange",()=>{document.hidden&&(lt(),g==="playing"&&ke())});function rs(e){if(g!=="playing"||h.phase!=="ready"||E.size===0)return;let t=h.aimAngle,n=h.aimPower,s=!1;(E.has("ArrowLeft")||E.has("KeyA"))&&(t-=Be*e,s=!0),(E.has("ArrowRight")||E.has("KeyD"))&&(t+=Be*e,s=!0),(E.has("ArrowUp")||E.has("KeyW"))&&(n+=De*e,s=!0),(E.has("ArrowDown")||E.has("KeyS"))&&(n-=De*e,s=!0),s&&h.setAim(t,Math.max(le,Math.min(1,n)))}An.addEventListener("click",ve);Ln.addEventListener("click",ke);Cn.addEventListener("click",st);Bn.addEventListener("click",Z);Dn.addEventListener("click",rt);tt.addEventListener("click",fe);Nn.addEventListener("click",Z);_n.addEventListener("click",ve);Hn.addEventListener("click",rt);et.addEventListener("click",Se);function xe(){const e=window.innerWidth<pn||window.innerHeight<yn;e!==ue&&(ue=e,P(vn,e),gn.classList.toggle("is-too-small",e))}function ht(){const e=h.level;H(kn,`${h.levelIndex+1}/${T.length}`),H(Sn,e.name),H(xn,String(h.currentStrokes)),H(bn,`par ${e.par}`);const t=h.vsPar;H(re,O(t));const n=ge(t);re.dataset.state!==n&&(re.dataset.state=n);const s=g==="playing"&&h.phase==="ready";P(he,g!=="playing"&&g!=="paused"),et.disabled=!s,D.setAttribute("aria-disabled",s?"false":"true");const r=Math.round(h.aimPower*100),a=`${r}%`;_e.style.width!==a&&(_e.style.width=a),He.style.left!==a&&(He.style.left=a),D.getAttribute("aria-valuenow")!==String(r)&&D.setAttribute("aria-valuenow",String(r)),H(Pn,`${r}%`);const i=g==="playing"&&h.messageTimer>0;P(qe,!i),i&&H(qe,h.message);const l=g==="playing"&&h.hintTimer>0&&h.messageTimer<=0;P(We,!l),l&&H(We,e.hint)}function is(){const e=Ne.clientWidth,t=Ne.clientHeight;if(e<1||t<1)return;const n=Math.min(2.5,window.devicePixelRatio||1),s=Math.max(1,Math.round(e*n)),r=Math.max(1,Math.round(t*n));(I.width!==s||I.height!==r)&&(I.width=s,I.height=r);const a=wn.offsetHeight,i=he.hidden?0:he.offsetHeight,l=Math.max(28,Math.min(130,a+i+12));ce=Ze(e,t,h.level.w,h.level.h,l);const o=B.effects&&!ze()?h.shake:0;fn(Yn,{level:h.level,ball:h.ball,time:h.courseTime,view:ce,shakeX:o>0?(Math.random()*2-1)*o:0,shakeY:o>0?(Math.random()*2-1)*o:0,dpr:n,width:s,height:r,aiming:g==="playing"&&h.phase==="ready",aimAngle:h.aimAngle,aimPower:h.aimPower,showGuide:B.aimGuide,particles:h.particles,trail:h.trail})}function ct(e){we=requestAnimationFrame(ct);const t=ie===0?0:Math.min(.05,Math.max(0,(e-ie)/1e3));if(ie=e,xe(),ue)return;(g==="playing"||g==="title")&&(rs(t),h.update(t,{effects:B.effects,reduced:ze()})&&g==="playing"&&Vn()),ht(),is()}window.addEventListener("resize",xe);window.addEventListener("pagehide",()=>cancelAnimationFrame(we),{once:!0});xe();z();G();Zn();it();ht();N("title");we=requestAnimationFrame(ct);
</script>
    <style>:root{--bg: #101a24;--fg: #f6f2e7;--hud-bg: rgba(13, 21, 30, .9);--hud-fg: #f6f2e7;--hud-dim: rgba(246, 242, 231, .62);--brass: #e6b45a;--accent: #e8433f;--under-par: #ff7f70;--over-par: #94a8be;--even: #f6f2e7;--focus: #e6b45a;--card: #f6f2e7;--card-ink: #16202b;--card-dim: #5f6b7a;--card-line: rgba(22, 32, 43, .16);--space-1: 4px;--space-2: 8px;--space-3: 12px;--space-4: 18px;--control-h: 44px;--radius: 12px;--hud-fs: 14px;--napplet-text-selection: none;font:14px/1.45 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}*{box-sizing:border-box}:where(html,body,body *){-webkit-user-select:var(--napplet-text-selection, none);user-select:var(--napplet-text-selection, none)}[hidden]{display:none!important}html,body,#app{height:100%;margin:0;background:var(--bg);color:var(--fg)}button{font:inherit;min-height:var(--control-h);padding:0 18px;border:1.5px solid var(--card-line);border-radius:var(--radius);background:#fff;color:var(--card-ink);font-weight:800;font-size:15px;cursor:pointer;transition:transform .12s ease,background .12s ease,border-color .12s ease}button:hover:not(:disabled){border-color:#16202b6b}button:active:not(:disabled){transform:translateY(1px)}button:focus-visible{outline:3px solid var(--focus);outline-offset:2px}.app{position:relative;container-type:inline-size;display:grid;grid-template-rows:minmax(0,1fr);overflow:hidden}.stage{position:relative;min-height:0;min-width:0;overflow:hidden}#course{position:absolute;top:0;right:0;bottom:0;left:0;display:block;width:100%;height:100%;touch-action:none;cursor:crosshair;outline:none}#course:focus-visible{outline:3px solid var(--focus);outline-offset:-3px}.hud{position:absolute;inset:0 0 auto 0;z-index:2;display:flex;align-items:center;gap:var(--space-2);padding:6px 8px;background:linear-gradient(180deg,var(--hud-bg) 0%,rgba(13,21,30,.78) 62%,rgba(13,21,30,0) 100%);color:var(--hud-fg);font-size:var(--hud-fs);pointer-events:none}.hud-group{display:flex;align-items:center;gap:6px;min-width:0}.hud-hole{margin-right:auto}.hud-total{margin-left:auto;flex-direction:column;align-items:flex-end;gap:0;line-height:1}.hud-label{font-size:.7em;font-weight:800;text-transform:uppercase;letter-spacing:.1em;color:var(--hud-dim);white-space:nowrap}.hud-big{font-size:1.85em;font-weight:900;line-height:1;color:var(--brass);font-variant-numeric:tabular-nums}.hud-sub{font-size:.8em;font-weight:700;color:var(--hud-dim);white-space:nowrap}.hud-total-value{font-size:1.4em;font-weight:900;font-variant-numeric:tabular-nums}.hud-total-value[data-state=under]{color:var(--under-par)}.hud-total-value[data-state=over]{color:var(--over-par)}.hud-total-value[data-state=even]{color:var(--even)}.badge{display:inline-grid;place-items:center;min-width:38px;height:26px;padding:0 7px;border-radius:7px;background:var(--accent);color:#fff;font-size:.82em;font-weight:900;letter-spacing:.04em;font-variant-numeric:tabular-nums}.hole-name{font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.icon-button{pointer-events:auto;display:grid;place-items:center;width:var(--control-h);height:var(--control-h);min-height:var(--control-h);padding:0;flex:0 0 auto;border:1px solid rgba(246,242,231,.24);border-radius:10px;background:#0d151eb8;color:var(--hud-fg)}.icon-button:hover:not(:disabled){background:#0d151ef2;border-color:var(--brass)}.glyph-pause{position:relative;display:block;width:15px;height:16px}.glyph-pause:before,.glyph-pause:after{content:"";position:absolute;top:0;width:4px;height:16px;border-radius:1.5px;background:currentColor}.glyph-pause:before{left:1px}.glyph-pause:after{right:1px}.dock{position:absolute;inset:auto 0 0 0;z-index:3;display:flex;align-items:center;gap:10px;padding:10px 10px calc(10px + env(safe-area-inset-bottom,0px));background:linear-gradient(0deg,var(--hud-bg) 0%,rgba(13,21,30,.82) 58%,rgba(13,21,30,0) 100%);pointer-events:none}.dock>*{pointer-events:auto}.dock-power{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:8px;min-height:var(--control-h);padding:0 4px;touch-action:none;cursor:pointer;border-radius:10px}.dock-power:focus-visible{outline:3px solid var(--focus);outline-offset:2px}.power-track{position:relative;flex:1 1 auto;height:12px;border-radius:999px;background:#f6f2e72e}.power-fill{position:absolute;inset:0 auto 0 0;width:45%;border-radius:999px;background:linear-gradient(90deg,var(--brass),var(--accent))}.power-thumb{position:absolute;top:50%;left:45%;width:22px;height:22px;border-radius:50%;background:var(--fg);border:3px solid var(--brass);transform:translate(-50%,-50%);box-shadow:0 2px 8px #00000073;pointer-events:none}.power-value{min-width:3.6ch;text-align:right;font-weight:900;font-variant-numeric:tabular-nums;color:var(--hud-fg)}.putt-button{flex:0 0 auto;min-width:92px;min-height:var(--control-h);border-color:var(--accent);background:var(--accent);color:#fff;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.putt-button:hover:not(:disabled){background:#f05a55;border-color:#f05a55}.putt-button:disabled{opacity:.4;cursor:default;transform:none}.bar{position:absolute;left:50%;bottom:10px;z-index:3;transform:translate(-50%);max-width:calc(100% - 20px);margin:0;padding:7px 14px;border-radius:999px;background:#0d151ee6;color:var(--hud-fg);font-size:12.5px;font-weight:700;text-align:center;pointer-events:none}.bar-alert{background:var(--accent);color:#fff;font-weight:800}.overlay{position:absolute;top:0;right:0;bottom:0;left:0;z-index:4;display:grid;pointer-events:none}.screen{grid-area:1 / 1;display:grid;place-content:center;place-content:safe center;place-items:center;padding:var(--space-3);overflow:auto;background:#080e14a8;pointer-events:auto}.card{width:min(430px,calc(100vw - 24px));padding:clamp(16px,4.5vw,28px);border-radius:18px;background:var(--card);color:var(--card-ink);box-shadow:0 20px 44px #0006;text-align:center}.card-narrow{width:min(340px,calc(100vw - 24px))}.logo-mark{position:relative;display:block;width:46px;height:32px;margin:0 auto 2px}.logo-mark:before{content:"";position:absolute;left:6px;top:0;width:3px;height:32px;border-radius:2px;background:var(--card-ink)}.logo-mark:after{content:"";position:absolute;left:9px;top:1px;width:28px;height:16px;background:var(--accent);clip-path:polygon(0 0,100% 38%,0 100%)}.logo{margin:4px 0 2px;font-size:clamp(28px,8vw,42px);font-weight:900;letter-spacing:-.025em;line-height:1.02}.kicker{margin:0 0 12px;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.14em;color:var(--card-dim)}.blurb{margin:0 0 16px;font-size:14px;line-height:1.5;color:var(--card-dim)}.screen-title{margin:2px 0 12px;font-size:clamp(22px,6.5vw,32px);font-weight:900;letter-spacing:-.02em;line-height:1.1}.score-row{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);padding:10px 14px;margin-bottom:10px;border-radius:12px;background:#16202b0f}.score-label{font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.1em;color:var(--card-dim)}.score-value{font-size:21px;font-weight:900;font-variant-numeric:tabular-nums}.fine-print{margin:0 0 12px;font-size:12px;line-height:1.45;color:var(--card-dim)}.controls-hint{margin:12px 0 0;font-size:12px;line-height:1.45;color:var(--card-dim)}.result-strokes{display:flex;align-items:baseline;justify-content:center;gap:7px;margin:0 0 4px}.result-strokes strong{font-size:clamp(38px,12vw,56px);font-weight:900;line-height:1;font-variant-numeric:tabular-nums}.result-strokes span{font-size:13px;font-weight:800;color:var(--card-dim);text-transform:uppercase;letter-spacing:.08em}.result-vs{margin:0 0 16px;font-size:14px;font-weight:800;color:var(--card-dim)}.result-vs[data-state=under]{color:#c0392f}.result-vs[data-state=over]{color:#4a5a6d}.leaderboard{margin:0 0 12px;padding:10px 12px;border-radius:12px;background:#16202b0f;text-align:left}.leader-kicker{margin:0 0 6px;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.1em;color:var(--card-dim)}.leader-list{margin:0;padding:0;list-style:none;display:grid;gap:4px}.leader-list li{display:flex;align-items:center;gap:8px;min-width:0;font-size:14px;font-weight:700;line-height:1.4}.leader-rank{flex:none;width:18px;text-align:center;font-variant-numeric:tabular-nums;color:var(--card-dim)}.leader-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.leader-score{flex:none;font-variant-numeric:tabular-nums;color:var(--card-dim)}.leader-note{margin:0;font-size:12px;line-height:1.45;color:var(--card-dim)}.button-stack{display:grid;gap:var(--space-2)}.primary{width:100%;background:var(--card-ink);border-color:var(--card-ink);color:var(--fg)}.primary:hover:not(:disabled){background:#22303f;border-color:#22303f}.ghost{background:transparent}.too-small{position:absolute;top:0;right:0;bottom:0;left:0;z-index:6;display:grid;place-content:center;gap:var(--space-2);padding:var(--space-4);text-align:center;background:var(--bg)}.too-small-title{margin:0;font-size:17px;font-weight:900}.too-small-body{margin:0;max-width:36ch;justify-self:center;font-size:13px;line-height:1.5;color:var(--hud-dim)}@container (max-width: 419px){.hud{gap:6px;padding:4px 6px}.hole-name,.hud-label,.hud-sub{display:none}.badge{min-width:34px;height:24px}.hud-big{font-size:1.6em}.dock{gap:8px;padding:8px 8px calc(8px + env(safe-area-inset-bottom,0px))}.putt-button{min-width:72px}}@container (min-width: 420px){.hud{padding:6px 10px;gap:var(--space-2)}}@container (min-width: 900px){.hud{--hud-fs: 16px;padding:8px 14px;gap:var(--space-3)}}@media(max-height:360px){.bar{display:none}.hud{padding-top:3px;padding-bottom:3px}.card{padding:14px 18px}.blurb,.controls-hint{display:none}.dock{padding-top:6px;padding-bottom:calc(6px + env(safe-area-inset-bottom,0px))}}@media(max-height:300px){.score-row,.fine-print,.leaderboard{display:none}}@media(pointer:coarse){button{min-height:48px}.icon-button{width:48px;height:48px;min-height:48px}}@media(prefers-reduced-motion:reduce){button{transition:none}}
</style>
    <meta name="napplet-type" content="winniegolf">
    <meta name="napplet-config-schema" content="{&quot;$schema&quot;:&quot;http://json-schema.org/draft-07/schema#&quot;,&quot;$version&quot;:1,&quot;type&quot;:&quot;object&quot;,&quot;additionalProperties&quot;:false,&quot;properties&quot;:{&quot;textSize&quot;:{&quot;type&quot;:&quot;integer&quot;,&quot;title&quot;:&quot;Text size&quot;,&quot;description&quot;:&quot;Broadcast bar and card text size in pixels. Changes apply while the napplet is running.&quot;,&quot;minimum&quot;:11,&quot;maximum&quot;:18,&quot;default&quot;:14,&quot;x-napplet-section&quot;:&quot;Appearance&quot;,&quot;x-napplet-order&quot;:1},&quot;aimGuide&quot;:{&quot;type&quot;:&quot;boolean&quot;,&quot;title&quot;:&quot;Aim guide&quot;,&quot;description&quot;:&quot;Show the dashed predicted path and power ring while lining up a putt.&quot;,&quot;default&quot;:true,&quot;x-napplet-section&quot;:&quot;Play&quot;,&quot;x-napplet-order&quot;:2},&quot;effects&quot;:{&quot;type&quot;:&quot;boolean&quot;,&quot;title&quot;:&quot;Effects&quot;,&quot;description&quot;:&quot;Show ball trail, impact particles and screen shake. The system reduced-motion setting is honoured either way.&quot;,&quot;default&quot;:true,&quot;x-napplet-section&quot;:&quot;Play&quot;,&quot;x-napplet-order&quot;:3},&quot;playerName&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;title&quot;:&quot;Player name&quot;,&quot;description&quot;:&quot;Name shown on the shared top-3 board. Left blank, the shell profile name is used when the host provides one.&quot;,&quot;default&quot;:&quot;&quot;,&quot;maxLength&quot;:32,&quot;x-napplet-section&quot;:&quot;Play&quot;,&quot;x-napplet-order&quot;:4}}}">
  </head>
  <body>
    <!--
      A napplet is an applet framed by a runtime: the runtime already shows this
      napplet's name, so there is no page masthead here. The frame is the course
      from the first pixel and adapts to any size the shell gives it.
    -->
    <main id="app" class="app">
      <div class="stage" id="stage">
        <canvas
          id="course"
          tabindex="0"
          aria-label="Golf course. Move the mouse or drag on the course to aim. Set power with the slider or the Up and Down keys. Click the course or press Space to putt."
        ></canvas>

        <header class="hud" id="hud">
          <div class="hud-group hud-hole">
            <span class="badge" id="holeBadge">1</span>
            <span class="hole-name" id="holeName">First Light</span>
          </div>
          <div class="hud-group hud-strokes">
            <span class="hud-label">Strokes</span>
            <strong class="hud-big" id="strokeCount">0</strong>
            <span class="hud-sub" id="hudPar">par 2</span>
          </div>
          <div class="hud-group hud-total">
            <strong class="hud-total-value" id="totalValue">E</strong>
            <span class="hud-label">round</span>
          </div>
          <button
            id="pauseButton"
            class="icon-button"
            type="button"
            aria-label="Pause game"
            title="Pause"
          >
            <span class="glyph-pause" aria-hidden="true"></span>
          </button>
        </header>

        <p class="bar" id="hintBar" hidden></p>
        <p class="bar bar-alert" id="messageBar" role="status" hidden></p>

        <div class="dock" id="dock" hidden>
          <div
            class="dock-power"
            id="powerSlider"
            role="slider"
            tabindex="0"
            aria-label="Power"
            aria-orientation="horizontal"
            aria-valuemin="6"
            aria-valuemax="100"
            aria-valuenow="45"
          >
            <span class="hud-label">Power</span>
            <div class="power-track" id="powerTrack">
              <div class="power-fill" id="powerFill"></div>
              <div class="power-thumb" id="powerThumb"></div>
            </div>
            <span class="power-value" id="powerValue">45%</span>
          </div>
          <button class="putt-button" id="puttButton" type="button">Putt</button>
        </div>

        <div class="overlay" id="overlay">
          <section class="screen" id="screenTitle" hidden>
            <div class="card">
              <span class="logo-mark" aria-hidden="true"></span>
              <h1 class="logo" id="gameTitle">Winnie Golf</h1>
              <p class="kicker">Ten holes, rising trouble</p>
              <p class="blurb">
                Bank off the rails, carry the bunkers, and hold your line across
                the island green.
              </p>
              <div class="score-row">
                <span class="score-label">Best round</span>
                <span class="score-value" id="bestScore">—</span>
              </div>
              <p class="fine-print" id="saveNote" hidden>
                Scores can’t be saved in this shell, so your best only lasts this
                session.
              </p>
              <section class="leaderboard" id="leaderboardTitle" hidden>
                <p class="leader-kicker">Course leaders</p>
                <ol class="leader-list" id="leaderListTitle"></ol>
                <p class="leader-note" id="leaderNoteTitle" hidden></p>
              </section>
              <button class="primary" id="playButton" type="button">Tee off</button>
              <p class="controls-hint">
                Aim by pointing or dragging on the course. Set power with the
                slider or Up / Down, then Putt. On a desktop, a click on the
                course also putts.
              </p>
            </div>
          </section>

          <section class="screen" id="screenPause" hidden>
            <div class="card card-narrow">
              <p class="kicker" id="pauseHole">Hole 1 · First Light</p>
              <h2 class="screen-title">Paused</h2>
              <div class="button-stack">
                <button class="primary" id="resumeButton" type="button">Resume</button>
                <button id="restartButton" type="button">Restart hole</button>
                <button class="ghost" id="quitButton" type="button">Quit to title</button>
              </div>
            </div>
          </section>

          <section class="screen" id="screenHole" hidden>
            <div class="card card-narrow">
              <p class="kicker" id="holeResultKicker">Hole 1 of 10</p>
              <h2 class="screen-title" id="holeResultName">First Light</h2>
              <p class="result-strokes">
                <strong id="holeResultStrokes">2</strong>
                <span id="holeResultUnit">strokes</span>
              </p>
              <p class="result-vs" id="holeResultVs">par 2 · even</p>
              <div class="button-stack">
                <button class="primary" id="nextHoleButton" type="button">Next hole</button>
                <button id="replayHoleButton" type="button">Replay hole</button>
              </div>
            </div>
          </section>

          <section class="screen" id="screenResults" hidden>
            <div class="card card-narrow">
              <p class="kicker">Round complete</p>
              <h2 class="screen-title" id="resultHeadline">Even</h2>
              <p class="result-strokes">
                <strong id="resultTotal">17</strong>
                <span id="resultUnit">strokes · par 17</span>
              </p>
              <p class="result-vs" id="resultBest">Best round: —</p>
              <section class="leaderboard" id="leaderboardResults" hidden>
                <p class="leader-kicker">Top rounds</p>
                <ol class="leader-list" id="leaderListResults"></ol>
                <p class="leader-note" id="leaderNoteResults" hidden></p>
              </section>
              <div class="button-stack">
                <button class="primary" id="playAgainButton" type="button">Play again</button>
                <button id="titleButton" type="button">Back to title</button>
              </div>
            </div>
          </section>
        </div>
      </div>

      <div class="too-small" id="tooSmall" role="status" hidden>
        <p class="too-small-title">A little more room, please</p>
        <p class="too-small-body">
          This round needs a frame of at least <strong>240 × 180</strong>. Enlarge
          the panel and you come straight back to the tee.
        </p>
      </div>
    </main>
  </body>
</html>