Run details
- Model
- qwen/qwen4-35b-a3b
- Route
- OpenRouter API
- Served by
- PrimeIntellect
- Effort
- high (OpenRouter default)
- Limits
- 60 min · 65,536 output tokens (model max)
- Date
- 4 Dec 2026
- Time
- 1 min 48 s
- Size
- 17 kB
- Tokens
- 98 in, 21,710 out (14,175 thinking)
- List price
- $0.008 at today's price ($0.06 in / $0.36 out per M)
- Paid
- $0.008
Prompt
Draw a mechanical wristwatch that shows the current local time, with a sweeping seconds hand and a date window. Make it look expensive. It must be one complete, self-contained HTML file: inline all CSS and JavaScript, and make no network requests of any kind (no CDNs, web fonts or remote images). Reply with the file in a single ```html code block.
Source
17 kB 432 lines Raw
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Léonard Genève — Mécanique</title>
<style>
html,body{
margin:0;height:100%;overflow:hidden;
background:radial-gradient(120% 100% at 50% 28%,#3b3b45 0%,#17171c 55%,#09090c 100%);
}
canvas{display:block}
</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
"use strict";
/* ============================================================
Léonard Genève — a rendered mechanical wristwatch
Live local time · 8 Hz (28 800 A/h) eased sweeping seconds
Date aperture · open-work balance beating at 3 Hz
============================================================ */
const RAD = Math.PI/180;
const SERIF = 'Georgia,"Times New Roman",serif';
const cv = document.getElementById('c');
const ctx = cv.getContext('2d');
let W,H,dpr,CX,CY,R,Rd; // geometry (logical px)
let staticCv = null; // pre-rendered dial / case layer
let glareGrad = null, sheenGrad = null;
/* ---------- helpers ---------- */
function rr(g,x,y,w,h,r){ // rounded-rect path
g.beginPath();
g.moveTo(x+r,y);
g.arcTo(x+w,y,x+w,y+h,r); g.arcTo(x+w,y+h,x,y+h,r);
g.arcTo(x,y+h,x,y,r); g.arcTo(x,y,x+w,y,r);
g.closePath();
}
function spaced(g,txt,x,y,sp){ // letterspaced centred text
const chars=[...txt];
const ws=chars.map(c=>g.measureText(c).width);
let total=sp*(chars.length-1); ws.forEach(w=>total+=w);
let cx=x-total/2; const prev=g.textAlign; g.textAlign='left';
chars.forEach((c,i)=>{ g.fillText(c,cx,y); cx+=ws[i]+sp; });
g.textAlign=prev;
}
function engrave(g,drawFn){ // debossed-print illusion on the dial
g.fillStyle='rgba(255,255,255,0.5)';
g.save(); g.translate(0,Rd*0.009); drawFn(); g.restore();
g.fillStyle='#2e2e34'; drawFn();
}
/* polished-metal and sun-brushed colour fields */
function metalColor(a){
const th=(a-315)*RAD;
let b=100+80*Math.cos(2*th)+40*Math.cos(4*th+0.9)
+95*Math.pow(Math.max(0,Math.cos(th-0.5)),4);
b=Math.max(26,Math.min(255,b));
return 'rgb('+Math.min(255,(b*1.04+14)|0)+','+((b*0.90+8)|0)+','+((b*0.56)|0)+')';
}
function dialColor(a){
const th=(a-300)*RAD;
let b=150+55*Math.pow(Math.max(0,Math.cos(th)),1.3)
+30*Math.pow(Math.max(0,Math.cos(th+Math.PI)),2)
+((((a*13)|0)%7)-3)*1.4;
return 'rgb('+(b|0)+','+((b-2)|0)+','+((b-9)|0)+')';
}
function metalRing(g,r0,r1){
for(let a=-1;a<360;a+=0.5){
g.fillStyle=metalColor(a);
g.beginPath();
g.arc(CX,CY,r1,(a-90)*RAD,(a+0.62-90)*RAD);
g.arc(CX,CY,r0,(a+0.62-90)*RAD,(a-90)*RAD,true);
g.closePath(); g.fill();
}
}
/* ---------- static artwork ---------- */
function buildStatic(){
staticCv=document.createElement('canvas');
staticCv.width=Math.max(1,W*dpr); staticCv.height=Math.max(1,H*dpr);
const g=staticCv.getContext('2d');
g.setTransform(dpr,0,0,dpr,0,0);
const Sw2=R*0.56; // strap half width at the case
/* --- cast shadow (strap + case) --- */
g.save();
g.shadowColor='rgba(0,0,0,0.65)'; g.shadowBlur=R*0.16; g.shadowOffsetY=R*0.07;
g.fillStyle='#0b0b0d';
g.beginPath(); // top strap
g.moveTo(CX-Sw2,CY-R*0.5); g.lineTo(CX+Sw2,CY-R*0.5);
g.lineTo(CX+R*0.44,-40); g.lineTo(CX-R*0.44,-40); g.closePath(); g.fill();
g.beginPath(); // bottom strap
g.moveTo(CX-Sw2,CY+R*0.5); g.lineTo(CX+Sw2,CY+R*0.5);
g.lineTo(CX+R*0.44,H+40); g.lineTo(CX-R*0.44,H+40); g.closePath(); g.fill();
g.beginPath(); g.arc(CX,CY,R*0.99,0,7); g.fill();
g.restore();
/* --- leather straps --- */
function strap(top){
const yEnd = top ? -40 : H+40, yCas = top ? CY-R*0.5 : CY+R*0.5;
const grd = g.createLinearGradient(0,top?yCas:yCas,0,yEnd);
grd.addColorStop(0,'#26190f'); grd.addColorStop(1,'#0d0906');
g.fillStyle=grd;
g.beginPath();
g.moveTo(CX-Sw2,yCas); g.lineTo(CX+Sw2,yCas);
g.lineTo(CX+R*0.44,yEnd); g.lineTo(CX-R*0.44,yEnd);
g.closePath(); g.fill();
/* centre crease */
g.strokeStyle='rgba(0,0,0,0.55)'; g.lineWidth=R*0.018;
g.beginPath(); g.moveTo(CX,yCas+(top?-R*0.02:R*0.02)); g.lineTo(CX,yEnd); g.stroke();
/* stitching */
g.strokeStyle='rgba(198,168,118,0.38)'; g.lineWidth=R*0.011;
g.setLineDash([R*0.05,R*0.034]);
for(const s of [-1,1]){
g.beginPath();
g.moveTo(CX+s*(Sw2-R*0.075), yCas);
g.lineTo(CX+s*(R*0.44-R*0.06), yEnd);
g.stroke();
}
g.setLineDash([]);
}
strap(true); strap(false);
/* --- lugs --- */
function lugs(flip){
g.save();
if(flip){ g.translate(0,2*CY); g.scale(1,-1); }
for(const s of [-1,1]){
const lg=g.createLinearGradient(CX+s*R*0.35,0,CX+s*R*0.65,0);
lg.addColorStop(0,'#8a662a'); lg.addColorStop(.5,'#f0d88f'); lg.addColorStop(1,'#9c7833');
g.fillStyle=lg;
g.beginPath();
g.moveTo(CX+s*R*0.44,CY-R*0.70);
g.quadraticCurveTo(CX+s*R*0.62,CY-R*0.88, CX+s*R*0.60,CY-R*1.10);
g.quadraticCurveTo(CX+s*R*0.59,CY-R*1.17, CX+s*R*0.51,CY-R*1.15);
g.quadraticCurveTo(CX+s*R*0.41,CY-R*1.11, CX+s*R*0.37,CY-R*0.80);
g.closePath(); g.fill();
g.strokeStyle='rgba(40,28,8,0.7)'; g.lineWidth=1.2; g.stroke();
}
g.restore();
}
lugs(false); lugs(true);
/* --- crown at 3 o'clock --- */
{
const cg=g.createLinearGradient(0,CY-R*0.10,0,CY+R*0.10);
cg.addColorStop(0,'#f2da92'); cg.addColorStop(.5,'#c9a44c'); cg.addColorStop(1,'#7c5d24');
g.fillStyle=cg;
rr(g,CX+R*0.95,CY-R*0.10,R*0.17,R*0.20,R*0.045); g.fill();
g.strokeStyle='rgba(40,28,8,0.7)'; g.lineWidth=1.2; g.stroke();
g.strokeStyle='rgba(60,42,12,0.55)'; g.lineWidth=1;
for(let x=CX+R*0.97;x<CX+R*1.11;x+=R*0.021){
g.beginPath(); g.moveTo(x,CY-R*0.095); g.lineTo(x,CY+R*0.095); g.stroke();
}
}
/* --- case & bezel --- */
metalRing(g,Rd,R);
g.strokeStyle='rgba(48,34,10,0.85)'; g.lineWidth=1.6;
g.beginPath(); g.arc(CX,CY,R-0.5,0,7); g.stroke();
g.strokeStyle='rgba(0,0,0,0.45)'; g.lineWidth=2.4;
g.beginPath(); g.arc(CX,CY,Rd+0.5,0,7); g.stroke();
g.strokeStyle='rgba(255,246,214,0.55)'; g.lineWidth=1;
g.beginPath(); g.arc(CX,CY,Rd+2.2,0,7); g.stroke();
/* --- sun-brushed dial --- */
for(let a=-1;a<360;a+=0.5){
g.fillStyle=dialColor(a);
g.beginPath(); g.moveTo(CX,CY);
g.arc(CX,CY,Rd+2,(a-90)*RAD,(a+0.62-90)*RAD);
g.closePath(); g.fill();
}
/* dial vignette + edge shade */
let vg=g.createRadialGradient(CX,CY,Rd*0.1,CX,CY,Rd);
vg.addColorStop(0,'rgba(255,255,255,0.05)');
vg.addColorStop(0.72,'rgba(0,0,0,0)');
vg.addColorStop(0.95,'rgba(0,0,0,0.06)');
vg.addColorStop(1,'rgba(0,0,0,0.38)');
g.fillStyle=vg; g.beginPath(); g.arc(CX,CY,Rd,0,7); g.fill();
/* --- minute track --- */
for(let m=0;m<60;m++){
const big=m%5===0;
g.save(); g.translate(CX,CY); g.rotate(m*6*RAD);
g.fillStyle=big?'#2c2c31':'#5a5a60';
const w=Rd*(big?0.014:0.006), len=Rd*(big?0.058:0.03);
g.fillRect(-w/2,-Rd*0.965,w,len);
g.restore();
}
/* --- applied gold indices (3 replaced by the date aperture) --- */
function bar(xc,w){
const rOut=Rd*0.885, len=Rd*0.155;
g.save(); g.translate(CX,CY);
g.fillStyle='rgba(0,0,0,0.42)'; // shadow
g.fillRect(xc-w/2+Rd*0.012,-rOut+Rd*0.016,w,len);
const gl=g.createLinearGradient(0,-rOut,0,-rOut+len); // left facet
gl.addColorStop(0,'#f6e3a1'); gl.addColorStop(.55,'#d8b45c'); gl.addColorStop(1,'#a17c33');
g.fillStyle=gl; g.fillRect(xc-w/2,-rOut,w/2,len);
const gr=g.createLinearGradient(0,-rOut,0,-rOut+len); // right facet
gr.addColorStop(0,'#caa44e'); gr.addColorStop(.55,'#8f6c2c'); gr.addColorStop(1,'#6d5122');
g.fillStyle=gr; g.fillRect(xc,-rOut,w/2,len);
g.fillStyle='rgba(255,250,225,0.85)'; // crisp centre bevel
g.fillRect(xc-0.5,-rOut,1,len);
g.restore();
}
for(let h=1;h<12;h++){ if(h===3) continue;
g.save(); g.translate(CX,CY); g.rotate(h*30*RAD); g.translate(-CX,-CY);
bar(CX,Rd*0.044); g.restore();
}
g.save(); g.translate(CX,CY); g.rotate(-0*RAD); g.translate(-CX,-CY);
bar(CX-Rd*0.047,Rd*0.034); bar(CX+Rd*0.047,Rd*0.034); g.restore();
/* --- signatures --- */
g.textBaseline='alphabetic';
g.font='600 '+Rd*0.088+'px '+SERIF;
engrave(g,()=>spaced(g,'LÉONARD',CX,CY-Rd*0.40,Rd*0.022));
g.font=Rd*0.046+'px '+SERIF;
engrave(g,()=>spaced(g,'GENÈVE',CX,CY-Rd*0.315,Rd*0.034));
g.font=Rd*0.040+'px '+SERIF;
engrave(g,()=>spaced(g,'AUTOMATIC',CX,CY+Rd*0.26,Rd*0.020));
g.font=Rd*0.033+'px '+SERIF;
engrave(g,()=>spaced(g,'SWISS MADE',CX,CY+Rd*0.735,Rd*0.014));
/* --- date aperture at 3 o'clock --- */
const dx=CX+Rd*0.64, dw=Rd*0.215, dh=Rd*0.155;
const wg=g.createLinearGradient(0,CY-dh/2,0,CY+dh/2);
wg.addColorStop(0,'#d9d7d1'); wg.addColorStop(0.25,'#fbfaf7'); wg.addColorStop(1,'#efece6');
g.fillStyle=wg; rr(g,dx-dw/2,CY-dh/2,dw,dh,Rd*0.02); g.fill();
g.strokeStyle='rgba(0,0,0,0.30)'; g.lineWidth=Rd*0.012; // inner shadow lip
g.beginPath(); g.moveTo(dx-dw/2+Rd*0.02,CY-dh/2+Rd*0.012);
g.lineTo(dx+dw/2-Rd*0.02,CY-dh/2+Rd*0.012); g.stroke();
const fg=g.createLinearGradient(dx-dw/2,CY-dh/2,dx+dw/2,CY+dh/2); // gold frame
fg.addColorStop(0,'#f3dd97'); fg.addColorStop(.5,'#9a7630'); fg.addColorStop(1,'#e6cb7d');
g.strokeStyle=fg; g.lineWidth=Rd*0.018;
rr(g,dx-dw/2,CY-dh/2,dw,dh,Rd*0.02); g.stroke();
g.strokeStyle='rgba(40,28,8,0.65)'; g.lineWidth=1;
rr(g,dx-dw/2-Rd*0.011,CY-dh/2-Rd*0.011,dw+Rd*0.022,dh+Rd*0.022,Rd*0.024); g.stroke();
/* --- open-work aperture (balance below, drawn live) --- */
const by=CY+Rd*0.46, br=Rd*0.17;
const hg=g.createRadialGradient(CX,by,br*0.1,CX,by,br);
hg.addColorStop(0,'#191512'); hg.addColorStop(1,'#070605');
g.fillStyle=hg; g.beginPath(); g.arc(CX,by,br,0,7); g.fill();
g.strokeStyle='rgba(0,0,0,0.5)'; g.lineWidth=Rd*0.006;
g.beginPath(); g.arc(CX,by,br+Rd*0.012,0,7); g.stroke();
const og=g.createLinearGradient(CX-br,by-br,CX+br,by+br);
og.addColorStop(0,'#f0d88f'); og.addColorStop(.5,'#8f6c2c'); og.addColorStop(1,'#dcbc6c');
g.strokeStyle=og; g.lineWidth=Rd*0.016;
g.beginPath(); g.arc(CX,by,br+Rd*0.004,0,7); g.stroke();
/* --- crystal lighting (cached gradients) --- */
glareGrad = ctx.createLinearGradient(CX-R,CY-R,CX+R*0.4,CY+R*0.6);
glareGrad.addColorStop(0,'rgba(255,255,255,0.9)');
glareGrad.addColorStop(0.22,'rgba(255,255,255,0.22)');
glareGrad.addColorStop(0.5,'rgba(255,255,255,0)');
sheenGrad = ctx.createRadialGradient(CX-R*0.3,CY-R*0.55,R*0.05,CX-R*0.3,CY-R*0.55,R*0.9);
sheenGrad.addColorStop(0,'rgba(255,255,255,0.10)');
sheenGrad.addColorStop(1,'rgba(255,255,255,0)');
}
/* ---------- live layer ---------- */
function drawBalance(t){
const bx=CX, by=CY+Rd*0.46, br=Rd*0.17;
const bal=Math.sin(t*2*Math.PI*3)*2.35; // ±135°, 3 Hz
ctx.save();
ctx.beginPath(); ctx.arc(bx,by,br*0.99,0,7); ctx.clip();
/* breathing hairspring */
ctx.strokeStyle='rgba(205,175,125,0.85)'; ctx.lineWidth=Math.max(1,Rd*0.005);
ctx.beginPath();
for(let i=0;i<=170;i++){
const f=i/170, aa=f*3.5*2*Math.PI+bal*0.18;
const r=br*(0.10+0.60*f)*(1+0.02*Math.sin(t*2*Math.PI*3+4*f));
const x=bx+r*Math.cos(aa), y=by+r*Math.sin(aa);
i?ctx.lineTo(x,y):ctx.moveTo(x,y);
}
ctx.stroke();
/* balance wheel */
ctx.save(); ctx.translate(bx,by); ctx.rotate(bal);
const r=br*0.66;
ctx.strokeStyle='#c8a24e'; ctx.lineWidth=br*0.15;
ctx.beginPath(); ctx.arc(0,0,r,0,7); ctx.stroke();
ctx.strokeStyle='#f1dc96';
ctx.beginPath(); ctx.arc(0,0,r,-2.6,-0.6); ctx.stroke();
ctx.strokeStyle='#b8923f'; ctx.lineWidth=br*0.09;
ctx.beginPath(); ctx.moveTo(-r,0); ctx.lineTo(r,0); ctx.stroke();
ctx.beginPath(); ctx.moveTo(0,-r); ctx.lineTo(0,r); ctx.stroke();
ctx.fillStyle='#8a6a2a';
for(let i=0;i<4;i++){
const a=i*Math.PI/2+Math.PI/4;
ctx.beginPath(); ctx.arc(Math.cos(a)*(r+br*0.10),Math.sin(a)*(r+br*0.10),br*0.045,0,7); ctx.fill();
}
ctx.fillStyle='#e8d6a0'; ctx.beginPath(); ctx.arc(0,0,br*0.10,0,7); ctx.fill();
ctx.fillStyle='#9c2f2f'; ctx.beginPath(); ctx.arc(0,0,br*0.04,0,7); ctx.fill(); // ruby
ctx.restore();
ctx.restore();
}
function dauphine(len,wd,tail,ang){
const ox=Rd*0.018, oy=Rd*0.03;
ctx.save(); ctx.translate(CX,CY); ctx.rotate(ang*RAD);
ctx.fillStyle='rgba(8,8,14,0.32)'; // soft cast shadow
ctx.beginPath(); ctx.moveTo(ox,-len+oy); ctx.lineTo(ox-wd,-len*0.25+oy);
ctx.lineTo(ox,tail+oy); ctx.lineTo(ox+wd,-len*0.25+oy); ctx.closePath(); ctx.fill();
let gd=ctx.createLinearGradient(0,-len,0,tail); // lit facet
gd.addColorStop(0,'#4a6fe0'); gd.addColorStop(0.5,'#24409f'); gd.addColorStop(1,'#101f5e');
ctx.fillStyle=gd;
ctx.beginPath(); ctx.moveTo(0,-len); ctx.lineTo(-wd,-len*0.25); ctx.lineTo(0,tail); ctx.closePath(); ctx.fill();
gd=ctx.createLinearGradient(0,-len,0,tail); // shaded facet
gd.addColorStop(0,'#1b2f7e'); gd.addColorStop(0.5,'#0e1c55'); gd.addColorStop(1,'#070f33');
ctx.fillStyle=gd;
ctx.beginPath(); ctx.moveTo(0,-len); ctx.lineTo(wd,-len*0.25); ctx.lineTo(0,tail); ctx.closePath(); ctx.fill();
ctx.strokeStyle='rgba(190,210,255,0.35)'; ctx.lineWidth=0.8;
ctx.beginPath(); ctx.moveTo(0,-len); ctx.lineTo(-wd,-len*0.25); ctx.stroke();
ctx.restore();
}
function secondHand(ang){
const ox=Rd*0.018, oy=Rd*0.03;
ctx.save(); ctx.translate(CX,CY); ctx.rotate(ang*RAD);
ctx.strokeStyle='rgba(8,8,14,0.30)'; // shadow pass
ctx.lineWidth=Rd*0.016; ctx.lineCap='round';
ctx.beginPath(); ctx.moveTo(ox,Rd*0.21+oy); ctx.lineTo(ox,-Rd*0.845+oy); ctx.stroke();
ctx.beginPath(); ctx.arc(ox,Rd*0.155+oy,Rd*0.034,0,7); ctx.stroke();
const gd=ctx.createLinearGradient(0,-Rd*0.86,0,Rd*0.22);
gd.addColorStop(0,'#4d74e6'); gd.addColorStop(0.5,'#1c348f'); gd.addColorStop(1,'#0d1a4d');
ctx.strokeStyle=gd; ctx.lineWidth=Rd*0.0125;
ctx.beginPath(); ctx.moveTo(0,Rd*0.205); ctx.lineTo(0,-Rd*0.855); ctx.stroke();
ctx.fillStyle=gd; // counterpoise
ctx.beginPath(); ctx.arc(0,Rd*0.155,Rd*0.031,0,7); ctx.fill();
ctx.fillStyle='rgba(255,255,255,0.35)';
ctx.beginPath(); ctx.arc(-Rd*0.009,Rd*0.147,Rd*0.008,0,7); ctx.fill();
ctx.restore();
}
function centerCap(){
const r=Rd*0.056;
ctx.save(); ctx.translate(CX,CY);
const gd=ctx.createRadialGradient(-r*0.35,-r*0.4,r*0.1,0,0,r);
gd.addColorStop(0,'#fdf0bf'); gd.addColorStop(0.55,'#d8b45c'); gd.addColorStop(1,'#6d5122');
ctx.fillStyle='rgba(0,0,0,0.4)';
ctx.beginPath(); ctx.arc(r*0.18,r*0.26,r,0,7); ctx.fill();
ctx.fillStyle=gd; ctx.beginPath(); ctx.arc(0,0,r,0,7); ctx.fill();
ctx.strokeStyle='rgba(40,28,8,0.7)'; ctx.lineWidth=1; ctx.stroke();
ctx.fillStyle='rgba(255,255,255,0.9)';
ctx.beginPath(); ctx.arc(-r*0.32,-r*0.36,r*0.16,0,7); ctx.fill();
ctx.restore();
}
function crystal(){
ctx.save();
ctx.beginPath(); ctx.arc(CX,CY,R*0.995,0,7); ctx.clip();
ctx.fillStyle=sheenGrad;
ctx.beginPath(); ctx.arc(CX,CY,R,0,7); ctx.fill();
ctx.globalAlpha=0.11; ctx.fillStyle=glareGrad;
ctx.beginPath();
ctx.moveTo(CX-R*1.02,CY-R*0.10);
ctx.quadraticCurveTo(CX-R*0.90,CY-R*0.92, CX-R*0.10,CY-R*1.02);
ctx.lineTo(CX+R*0.38,CY-R*1.02);
ctx.quadraticCurveTo(CX-R*0.32,CY-R*0.52, CX-R*1.02,CY+R*0.48);
ctx.closePath(); ctx.fill();
ctx.globalAlpha=0.06;
ctx.beginPath();
ctx.moveTo(CX-R*1.02,CY+R*0.66);
ctx.quadraticCurveTo(CX-R*0.2,CY-R*0.30, CX+R*0.62,CY-R*1.02);
ctx.lineTo(CX+R*0.82,CY-R*1.02);
ctx.quadraticCurveTo(CX+R*0.1,CY-R*0.25, CX-R*0.86,CY+R*0.9);
ctx.closePath(); ctx.fill();
ctx.restore();
}
/* ---------- main loop ---------- */
let shownDay=-1;
function loop(){
ctx.clearRect(0,0,W,H);
if(staticCv) ctx.drawImage(staticCv,0,0,W,H);
const now=new Date();
const t=performance.now()/1000;
drawBalance(t);
/* time — seconds flick forward in eased 1/8 s beats (28 800 A/h feel) */
const ms=now.getMilliseconds();
const s=now.getSeconds()+ms/1000;
const u=s*8, k=Math.floor(u), f=u-k;
const ease=1-Math.pow(1-Math.min(1,f*2.4),3);
const secPos=k+ease;
const minA=(now.getMinutes()+s/60)*6;
const hrA =((now.getHours()%12)+now.getMinutes()/60)*30;
dauphine(Rd*0.52,Rd*0.047,Rd*0.06,hrA);
dauphine(Rd*0.76,Rd*0.037,Rd*0.07,minA);
secondHand(secPos*6);
centerCap();
if(shownDay!==now.getDate()){ // date aperture text
shownDay=now.getDate();
ctx.font='700 '+Rd*0.115+'px '+SERIF;
ctx.fillStyle='#1d1d22';
ctx.textAlign='center'; ctx.textBaseline='middle';
ctx.fillText(String(shownDay),CX+Rd*0.64,CY+Rd*0.008);
ctx.textBaseline='alphabetic';
}
crystal();
requestAnimationFrame(loop);
}
/* ---------- sizing ---------- */
function resize(){
dpr=Math.min(window.devicePixelRatio||1,2.5);
W=window.innerWidth; H=window.innerHeight;
cv.width=Math.max(1,W*dpr); cv.height=Math.max(1,H*dpr);
cv.style.width=W+'px'; cv.style.height=H+'px';
ctx.setTransform(dpr,0,0,dpr,0,0);
CX=W/2; CY=H/2;
R=Math.min(W,H)*0.40; Rd=R*0.80;
shownDay=-1;
buildStatic();
}
window.addEventListener('resize',resize);
resize();
requestAnimationFrame(loop);
</script>
</body>
</html>

