• Updated 19 Nov, 14:26 UTC
  • Next run 20 Nov, 05:17 UTCNext 20 Nov 05:17
  • Last 7 days: 9 new models · 69 runs7 d: 9 models · 69 runs
Playable Breakout

Qwen4 MaxAlibaba

Network offOpen alone (new tab)

Run details

Model
qwen/qwen4-max
Route
OpenRouter API, one user message
Served by
Alibaba
Effort
high, OpenRouter's default for this model
Limits
60 min · 393,216 output tokens (the model's limit)
Date
16 Nov 2026
Time
3 min
Size
22 kB
Tokens
99 in, 12,195 out (2,528 of them thinking)
List price
$0.052 at today's price ($1.43 in / $4.28 out per M)
Paid
$0.055

Raw files: output · meta.json

Exact prompt

Make a Breakout game I can play right now with the keyboard or the mouse. Give it several levels, a score and some juice.

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

22 kB 676 lines Raw

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NEON BREAKOUT</title>
<style>
  html,body{
    margin:0;padding:0;height:100%;
    background:#07080f;
    overflow:hidden;
    font-family:"Segoe UI",system-ui,Arial,sans-serif;
    -webkit-user-select:none;user-select:none;
  }
  #wrap{
    position:fixed;inset:0;
    display:flex;align-items:center;justify-content:center;
    background:radial-gradient(ellipse at 50% 30%, #101427 0%, #07080f 70%);
  }
  canvas{
    display:block;
    max-width:97vw;max-height:96vh;
    aspect-ratio:4/3;
    width:min(97vw, calc(96vh * 4 / 3));
    border-radius:10px;
    box-shadow:0 0 60px rgba(60,120,255,.18), 0 0 0 1px rgba(120,160,255,.15);
    cursor:none;
    touch-action:none;
  }
</style>
</head>
<body>
<div id="wrap"><canvas id="game" width="800" height="600"></canvas></div>
<script>
(function(){
"use strict";
const W=800,H=600;
const cv=document.getElementById("game");
const ctx=cv.getContext("2d");

/* ---------- audio (all synthesized, zero assets) ---------- */
let AC=null, master=null, muted=false;
function audio(){
  if(!AC){
    try{
      AC=new (window.AudioContext||window.webkitAudioContext)();
      master=AC.createGain(); master.gain.value=0.5; master.connect(AC.destination);
    }catch(e){}
  }
  if(AC && AC.state==="suspended") AC.resume();
}
function beep(f,dur,type,vol,slide){
  if(!AC||muted) return;
  type=type||"square"; vol=vol===undefined?0.14:vol;
  const t=AC.currentTime;
  const o=AC.createOscillator(), g=AC.createGain();
  o.type=type; o.frequency.setValueAtTime(f,t);
  if(slide) o.frequency.exponentialRampToValueAtTime(Math.max(30,slide),t+dur);
  g.gain.setValueAtTime(vol,t);
  g.gain.exponentialRampToValueAtTime(0.0001,t+dur);
  o.connect(g); g.connect(master);
  o.start(t); o.stop(t+dur+0.02);
}
function arp(freqs,step,dur,type,vol){
  freqs.forEach((f,i)=>setTimeout(()=>beep(f,dur,type,vol),i*step));
}

/* ---------- levels ---------- */
const LEVELS=[
 {name:"WARM UP",rows:[
  "111111111111",
  "111111111111",
  "111111111111",
  "111111111111",
  "111111111111"]},
 {name:"CHECKERBOARD",rows:[
  "2.2.2.2.2.2.",
  ".1.1.1.1.1.1",
  "2.2.2.2.2.2.",
  ".1.1.1.1.1.1",
  "2.2.2.2.2.2.",
  ".1.1.1.1.1.1"]},
 {name:"THE PYRAMID",rows:[
  ".....33.....",
  "....3223....",
  "...322223...",
  "..32211223..",
  ".3221111223.",
  "322111111223",
  "111111111111"]},
 {name:"STEEL PILLARS",rows:[
  "2S22S22S22S2",
  "2S11S11S11S2",
  "2S22S22S22S2",
  "1S11S11S11S1",
  "2S22S22S22S2",
  "1S11S11S11S1"]},
 {name:"THE DIAMOND",rows:[
  ".....SS.....",
  "....S33S....",
  "...S3223S...",
  "..S321123S..",
  ".S32111123S.",
  "..S321123S..",
  "...S3223S...",
  "....S33S....",
  ".....SS....."]},
 {name:"THE FORTRESS",rows:[
  "SSSSSSSSSSSS",
  "S3333333333S",
  "S3222222223S",
  "S3211111123S",
  "S3211331123S",
  "S3211111123S",
  "S3222222223S",
  "S3........3S",
  "SS........SS"]}
];

/* ---------- palette ---------- */
const HP_COLORS={1:["#31d2f7","#0e6f8f"],2:["#ffb02e","#8f5a0e"],3:["#ff4d8d","#8f1e46"]};
const STEEL=["#9aa7bd","#4a5468"];
const POW={
  W:{c:"#3dff9a",label:"W",name:"WIDE PADDLE"},
  M:{c:"#ffd23d",label:"M",name:"MULTIBALL"},
  S:{c:"#7ab8ff",label:"S",name:"SLOW MOTION"},
  L:{c:"#ff6b6b",label:"+",name:"EXTRA LIFE"}
};

/* ---------- state ---------- */
let state="menu"; // menu | play | clear | over | win
let paused=false;
let score=0, hi=0, lives=3, level=0, combo=0, comboTimer=0;
let bricks=[], balls=[], powers=[], particles=[], floats=[];
let paddle={x:W/2,y:H-46,w:110,targetW:110,h:14,squash:0};
let wideT=0, slowT=0;
let shake=0, flashA=0, flashC="255,255,255";
let keys={}, mouseX=W/2, mouseActive=false;
let tGlobal=0, clearBonus=0, bricksBroken=0;
let stars=[];
try{ hi=parseInt(localStorage.getItem("neonBreakoutHi")||"0",10)||0; }catch(e){}
for(let i=0;i<70;i++) stars.push({x:Math.random()*W,y:Math.random()*H,r:Math.random()*1.4+0.3,s:Math.random()*8+3,p:Math.random()*6.28});

const COLS=12, MARGIN=26, GAP=5, BH=22, TOP=76;
const BW=(W-2*MARGIN-(COLS-1)*GAP)/COLS;

function ballSpeed(){ return Math.min(640, 330+level*28+bricksBroken*2.2); }

function buildLevel(n){
  bricks=[]; powers=[]; particles=[]; floats=[]; combo=0; bricksBroken=0;
  wideT=0; slowT=0; paddle.targetW=110;
  const rows=LEVELS[n].rows;
  for(let r=0;r<rows.length;r++){
    for(let c=0;c<COLS;c++){
      const ch=rows[r][c];
      if(ch===".") continue;
      const steel=ch==="S";
      const hp=steel?Infinity:parseInt(ch,10);
      bricks.push({
        x:MARGIN+c*(BW+GAP), y:TOP+r*(BH+GAP), w:BW, h:BH,
        hp:hp, maxHp:steel?1:hp, steel:steel, flash:0, alive:true,
        hue:(r*9)%30
      });
    }
  }
  resetBall();
}
function breakableLeft(){ return bricks.some(b=>b.alive&&!b.steel); }
function resetBall(){
  balls=[{x:paddle.x,y:paddle.y-9,vx:0,vy:0,r:7,stuck:true,trail:[]}];
}
function startGame(){
  score=0; lives=3; level=0;
  buildLevel(0);
  state="play"; paused=false;
  addFloat(W/2,H/2-40,"LEVEL 1 — "+LEVELS[0].name,"#8fd0ff",1.6,26);
}
function launch(){
  let launched=false;
  for(const b of balls){
    if(b.stuck){
      b.stuck=false;
      const a=-Math.PI/2+(Math.random()*0.7-0.35);
      const s=ballSpeed();
      b.vx=Math.cos(a)*s; b.vy=Math.sin(a)*s;
      launched=true;
    }
  }
  if(launched) beep(400,0.12,"triangle",0.15,800);
}
function advance(){
  audio();
  if(state==="menu") startGame();
  else if(state==="play"){ if(paused){paused=false;return;} launch(); }
  else if(state==="clear"){
    level++;
    if(level>=LEVELS.length){ state="win"; saveHi(); arp([523,659,784,1046,1318],110,0.25,"triangle",0.18); }
    else{
      buildLevel(level); state="play";
      addFloat(W/2,H/2-40,"LEVEL "+(level+1)+" — "+LEVELS[level].name,"#8fd0ff",1.6,26);
    }
  }
  else if(state==="over"||state==="win") startGame();
}
function saveHi(){ if(score>hi){hi=score; try{localStorage.setItem("neonBreakoutHi",String(hi));}catch(e){}} }

/* ---------- juice helpers ---------- */
function addShake(m){ shake=Math.min(22,shake+m); }
function addFlash(a,c){ flashA=Math.max(flashA,a); flashC=c||"255,255,255"; }
function addFloat(x,y,text,color,life,size){
  floats.push({x:x,y:y,text:text,color:color,life:life||0.9,max:life||0.9,size:size||18});
}
function burst(x,y,color,n,spd,grav){
  for(let i=0;i<n;i++){
    const a=Math.random()*Math.PI*2, s=(Math.random()*0.7+0.3)*(spd||220);
    particles.push({x:x,y:y,vx:Math.cos(a)*s,vy:Math.sin(a)*s-40,
      life:0.4+Math.random()*0.5,max:0.9,color:color,size:1.5+Math.random()*3,g:grav===undefined?520:grav});
  }
}

/* ---------- power-ups ---------- */
function maybeDrop(x,y){
  if(Math.random()>0.19) return;
  const r=Math.random();
  let t = r<0.30?"W" : r<0.58?"M" : r<0.88?"S" : "L";
  powers.push({x:x,y:y,vy:130,type:t,rot:Math.random()*6.28});
}
function applyPower(t){
  const p=POW[t];
  addFloat(paddle.x,paddle.y-30,p.name,p.c,1.1,18);
  burst(paddle.x,paddle.y,p.c,18,260,300);
  beep(660,0.09,"square",0.14); setTimeout(()=>beep(990,0.12,"square",0.14),80);
  if(t==="W"){ wideT=12; paddle.targetW=175; }
  else if(t==="S"){ slowT=8; }
  else if(t==="L"){ lives=Math.min(6,lives+1); addFlash(0.25,"80,255,140"); }
  else if(t==="M"){
    const src=balls.filter(b=>!b.stuck);
    const base=src.length?src[0]:balls[0];
    if(base && !base.stuck){
      for(const off of [-0.5,0.5]){
        if(balls.length>=6) break;
        const s=Math.hypot(base.vx,base.vy)||ballSpeed();
        const a=Math.atan2(base.vy,base.vx)+off;
        balls.push({x:base.x,y:base.y,vx:Math.cos(a)*s,vy:Math.sin(a)*s,r:7,stuck:false,trail:[]});
      }
    }
  }
}

/* ---------- brick / life events ---------- */
function hitBrick(b,bx,by){
  b.flash=1;
  if(b.steel){
    beep(150,0.08,"sawtooth",0.12);
    burst(bx,by,"#c8d4ea",5,160);
    addShake(2);
    return;
  }
  b.hp--;
  if(b.hp<=0){
    b.alive=false;
    combo++; comboTimer=2.2;
    const pts=50*b.maxHp*Math.max(1,combo);
    score+=pts; bricksBroken++;
    const col=HP_COLORS[b.maxHp][0];
    burst(b.x+b.w/2,b.y+b.h/2,col,14+b.maxHp*4,240);
    addShake(3+b.maxHp);
    addFloat(b.x+b.w/2,b.y,"+"+pts,col,0.8,15);
    beep(380+Math.min(combo,12)*55,0.09,"square",0.13,700+combo*60);
    maybeDrop(b.x+b.w/2,b.y+b.h/2);
    // nudge speed up
    for(const ball of balls){
      if(ball.stuck) continue;
      const s=Math.hypot(ball.vx,ball.vy), ns=ballSpeed();
      if(s>0){ ball.vx*=ns/s; ball.vy*=ns/s; }
    }
    if(!breakableLeft()){
      clearBonus=500+lives*250;
      score+=clearBonus; saveHi();
      state="clear";
      addFlash(0.5,"140,220,255"); addShake(10);
      arp([523,659,784,1046],90,0.22,"triangle",0.18);
      for(let i=0;i<50;i++) burst(Math.random()*W,TOP+Math.random()*180,["#31d2f7","#ffb02e","#ff4d8d","#3dff9a"][i%4],1,320,220);
    }
  }else{
    beep(260,0.06,"square",0.1);
    burst(bx,by,HP_COLORS[b.maxHp][0],6,150);
    addShake(1.5);
    score+=10;
  }
}
function loseLife(){
  lives--; combo=0;
  addShake(16); addFlash(0.55,"255,60,60");
  beep(300,0.5,"sawtooth",0.2,60);
  burst(paddle.x,paddle.y+10,"#ff5566",30,320);
  powers=[]; wideT=0; slowT=0; paddle.targetW=110;
  if(lives<=0){ state="over"; saveHi(); }
  else{ resetBall(); addFloat(W/2,H/2,"BALL LOST","#ff8090",1.2,26); }
}

/* ---------- physics ---------- */
function circleRect(b,br){
  const cx=Math.max(br.x,Math.min(b.x,br.x+br.w));
  const cy=Math.max(br.y,Math.min(b.y,br.y+br.h));
  const dx=b.x-cx, dy=b.y-cy;
  return dx*dx+dy*dy <= b.r*b.r ? {cx:cx,cy:cy,dx:dx,dy:dy} : null;
}
function stepBall(b,dt){
  if(b.stuck){ b.x=paddle.x; b.y=paddle.y-b.r-2; return true; }
  const factor=slowT>0?0.55:1;
  const spd=Math.hypot(b.vx,b.vy);
  const steps=Math.max(1,Math.ceil(spd*factor*dt/(b.r*0.8)));
  const sdt=dt*factor/steps;
  for(let s=0;s<steps;s++){
    b.x+=b.vx*sdt; b.y+=b.vy*sdt;
    // walls
    if(b.x<b.r){ b.x=b.r; b.vx=Math.abs(b.vx); beep(200,0.04,"square",0.07); burst(b.x,b.y,"#6f8dff",3,120,200);}
    if(b.x>W-b.r){ b.x=W-b.r; b.vx=-Math.abs(b.vx); beep(200,0.04,"square",0.07); burst(b.x,b.y,"#6f8dff",3,120,200);}
    if(b.y<b.r+44){ b.y=b.r+44; b.vy=Math.abs(b.vy); beep(200,0.04,"square",0.07);}
    // paddle
    if(b.vy>0 && b.y+b.r>=paddle.y && b.y-b.r<=paddle.y+paddle.h &&
       b.x>=paddle.x-paddle.w/2-b.r && b.x<=paddle.x+paddle.w/2+b.r){
      const rel=Math.max(-1,Math.min(1,(b.x-paddle.x)/(paddle.w/2)));
      const ang=-Math.PI/2+rel*1.05; // up to ~60deg
      const sp=Math.hypot(b.vx,b.vy);
      b.vx=Math.cos(ang)*sp; b.vy=Math.sin(ang)*sp;
      b.y=paddle.y-b.r-0.5;
      combo=0;
      paddle.squash=1;
      beep(320,0.07,"triangle",0.15,260);
      burst(b.x,paddle.y,"#9fd8ff",5,140,300);
      addShake(1);
    }
    // bricks
    for(const br of bricks){
      if(!br.alive) continue;
      const hit=circleRect(b,br);
      if(hit){
        // resolve axis by penetration
        const overlapX=(b.r-Math.abs(hit.dx));
        const overlapY=(b.r-Math.abs(hit.dy));
        if(hit.dx===0&&hit.dy===0){ b.vy=-b.vy; }
        else if(overlapX<overlapY){
          b.vx = hit.dx>0?Math.abs(b.vx):-Math.abs(b.vx);
          b.x += (hit.dx>0?overlapX:-overlapX);
        }else{
          b.vy = hit.dy>0?Math.abs(b.vy):-Math.abs(b.vy);
          b.y += (hit.dy>0?overlapY:-overlapY);
        }
        hitBrick(br,hit.cx||b.x,hit.cy||b.y);
        break;
      }
    }
    if(b.y-b.r>H) return false;
  }
  b.trail.push({x:b.x,y:b.y});
  if(b.trail.length>10) b.trail.shift();
  return true;
}

/* ---------- update ---------- */
function update(dt){
  tGlobal+=dt;
  shake=Math.max(0,shake-dt*40);
  flashA=Math.max(0,flashA-dt*1.8);
  paddle.squash=Math.max(0,paddle.squash-dt*6);
  paddle.w+=(paddle.targetW-paddle.w)*Math.min(1,dt*10);
  for(const f of floats){ f.life-=dt; f.y-=28*dt; }
  floats=floats.filter(f=>f.life>0);
  for(const p of particles){
    p.life-=dt; p.vy+=p.g*dt; p.x+=p.vx*dt; p.y+=p.vy*dt; p.vx*=(1-1.5*dt);
  }
  particles=particles.filter(p=>p.life>0);
  for(const br of bricks) br.flash=Math.max(0,br.flash-dt*5);

  if(state!=="play"||paused) return;

  comboTimer-=dt; if(comboTimer<=0) combo=0;
  if(wideT>0){ wideT-=dt; if(wideT<=0) paddle.targetW=110; }
  if(slowT>0) slowT-=dt;

  // paddle control
  const kspeed=640;
  let moved=false;
  if(keys.left){ paddle.x-=kspeed*dt; moved=true; }
  if(keys.right){ paddle.x+=kspeed*dt; moved=true; }
  if(moved) mouseActive=false;
  if(mouseActive) paddle.x+=(mouseX-paddle.x)*Math.min(1,dt*22);
  paddle.x=Math.max(paddle.w/2+6,Math.min(W-paddle.w/2-6,paddle.x));

  // balls
  for(let i=balls.length-1;i>=0;i--){
    if(!stepBall(balls[i],dt)){
      burst(balls[i].x,H-6,"#ff5566",10,200);
      balls.splice(i,1);
    }
  }
  if(balls.length===0 && state==="play") loseLife();

  // powerups
  for(let i=powers.length-1;i>=0;i--){
    const p=powers[i];
    p.y+=p.vy*dt; p.vy+=140*dt; p.rot+=dt*3;
    if(p.y>H+20){ powers.splice(i,1); continue; }
    if(p.y+10>=paddle.y && p.y-10<=paddle.y+paddle.h+8 &&
       Math.abs(p.x-paddle.x)<=paddle.w/2+12){
      applyPower(p.type);
      powers.splice(i,1);
    }
  }
}

/* ---------- drawing ---------- */
function rr(x,y,w,h,r){
  r=Math.min(r,w/2,h/2);
  ctx.beginPath();
  ctx.moveTo(x+r,y);
  ctx.arcTo(x+w,y,x+w,y+h,r);
  ctx.arcTo(x+w,y+h,x,y+h,r);
  ctx.arcTo(x,y+h,x,y,r);
  ctx.arcTo(x,y,x+w,y,r);
  ctx.closePath();
}
function text(t,x,y,size,color,align,glow,weight){
  ctx.font=(weight||"700")+" "+size+"px 'Segoe UI',system-ui,Arial,sans-serif";
  ctx.textAlign=align||"center"; ctx.textBaseline="middle";
  if(glow){ ctx.shadowColor=color; ctx.shadowBlur=glow; }
  ctx.fillStyle=color; ctx.fillText(t,x,y);
  ctx.shadowBlur=0;
}
function draw(){
  ctx.setTransform(1,0,0,1,0,0);
  // background
  const g=ctx.createLinearGradient(0,0,0,H);
  g.addColorStop(0,"#0c1024"); g.addColorStop(1,"#07080f");
  ctx.fillStyle=g; ctx.fillRect(0,0,W,H);
  for(const s of stars){
    const tw=0.4+0.6*Math.abs(Math.sin(tGlobal*0.7+s.p));
    ctx.globalAlpha=0.35*tw;
    ctx.fillStyle="#9db8ff";
    ctx.beginPath(); ctx.arc(s.x,(s.y+tGlobal*s.s)%H,s.r,0,6.28); ctx.fill();
  }
  ctx.globalAlpha=1;

  // shake
  const sx=(Math.random()*2-1)*shake, sy=(Math.random()*2-1)*shake;
  ctx.translate(sx,sy);

  // playfield border
  ctx.strokeStyle="rgba(110,150,255,0.25)"; ctx.lineWidth=2;
  rr(3,44,W-6,H-47,8); ctx.stroke();

  // bricks
  for(const b of bricks){
    if(!b.alive) continue;
    const pal=b.steel?STEEL:HP_COLORS[b.maxHp];
    const dim=b.steel?1:(0.55+0.45*(b.hp/b.maxHp));
    ctx.fillStyle=pal[1];
    rr(b.x,b.y,b.w,b.h,5); ctx.fill();
    ctx.globalAlpha=dim;
    ctx.fillStyle=pal[0];
    rr(b.x+2,b.y+2,b.w-4,b.h-6,4); ctx.fill();
    ctx.globalAlpha=1;
    // top shine
    ctx.fillStyle="rgba(255,255,255,0.28)";
    rr(b.x+3,b.y+2,b.w-6,4,2); ctx.fill();
    if(b.steel){
      ctx.fillStyle="rgba(30,36,52,0.7)";
      for(let i=0;i<3;i++){ ctx.beginPath(); ctx.arc(b.x+10+i*(b.w-20)/2,b.y+b.h/2+1,2,0,6.28); ctx.fill(); }
    }else if(b.maxHp>1){
      ctx.fillStyle="rgba(10,12,20,0.65)";
      for(let i=0;i<b.hp;i++){ ctx.beginPath(); ctx.arc(b.x+b.w/2+(i-(b.hp-1)/2)*8,b.y+b.h/2+2,2.2,0,6.28); ctx.fill(); }
    }
    if(b.flash>0){
      ctx.globalAlpha=b.flash*0.85;
      ctx.fillStyle="#ffffff"; rr(b.x,b.y,b.w,b.h,5); ctx.fill();
      ctx.globalAlpha=1;
    }
  }

  // powerups
  for(const p of powers){
    const info=POW[p.type];
    const wob=Math.sin(p.rot)*3;
    ctx.save();
    ctx.translate(p.x+wob,p.y);
    ctx.shadowColor=info.c; ctx.shadowBlur=14;
    ctx.fillStyle="rgba(10,14,26,0.9)";
    rr(-14,-10,28,20,9); ctx.fill();
    ctx.strokeStyle=info.c; ctx.lineWidth=2; rr(-14,-10,28,20,9); ctx.stroke();
    ctx.shadowBlur=0;
    text(info.label,0,1,14,info.c,"center",8);
    ctx.restore();
  }

  // particles
  for(const p of particles){
    ctx.globalAlpha=Math.max(0,p.life/p.max);
    ctx.fillStyle=p.color;
    ctx.fillRect(p.x-p.size/2,p.y-p.size/2,p.size,p.size);
  }
  ctx.globalAlpha=1;

  // paddle
  const sq=paddle.squash;
  const pw=paddle.w*(1+sq*0.12), ph=paddle.h*(1-sq*0.35);
  const px=paddle.x-pw/2, py=paddle.y+(paddle.h-ph)/2;
  ctx.shadowColor=wideT>0?"#3dff9a":"#4dc3ff"; ctx.shadowBlur=16;
  const pg=ctx.createLinearGradient(0,py,0,py+ph);
  pg.addColorStop(0,wideT>0?"#8dffca":"#9fdcff");
  pg.addColorStop(1,wideT>0?"#12b56a":"#1f7fd6");
  ctx.fillStyle=pg; rr(px,py,pw,ph,7); ctx.fill();
  ctx.shadowBlur=0;
  ctx.fillStyle="rgba(255,255,255,0.5)"; rr(px+4,py+2,pw-8,3,2); ctx.fill();

  // balls + trails
  for(const b of balls){
    for(let i=0;i<b.trail.length;i++){
      const t=b.trail[i], a=(i+1)/b.trail.length;
      ctx.globalAlpha=a*0.25;
      ctx.fillStyle=slowT>0?"#7ab8ff":"#ffd76b";
      ctx.beginPath(); ctx.arc(t.x,t.y,b.r*a,0,6.28); ctx.fill();
    }
    ctx.globalAlpha=1;
    ctx.shadowColor=slowT>0?"#7ab8ff":"#ffcf4d"; ctx.shadowBlur=18;
    const bg=ctx.createRadialGradient(b.x-2,b.y-2,1,b.x,b.y,b.r);
    bg.addColorStop(0,"#ffffff");
    bg.addColorStop(1,slowT>0?"#6fa8ff":"#ffb02e");
    ctx.fillStyle=bg;
    ctx.beginPath(); ctx.arc(b.x,b.y,b.r,0,6.28); ctx.fill();
    ctx.shadowBlur=0;
  }

  // floats
  for(const f of floats){
    ctx.globalAlpha=Math.min(1,f.life/f.max*1.6);
    text(f.text,f.x,f.y,f.size,f.color,"center",10);
  }
  ctx.globalAlpha=1;

  /* HUD */
  ctx.fillStyle="rgba(8,10,20,0.85)"; ctx.fillRect(0,0,W,42);
  ctx.fillStyle="rgba(110,150,255,0.25)"; ctx.fillRect(0,42,W,1);
  text("SCORE",22,13,10,"#6f83b8","left",0);
  text(String(score).padStart(6,"0"),22,29,18,"#eaf2ff","left",6);
  text("HI",160,13,10,"#6f83b8","left",0);
  text(String(Math.max(hi,score)).padStart(6,"0"),160,29,15,"#9db8ff","left",0);
  text("LEVEL "+(level+1)+"/"+LEVELS.length+"  ·  "+(LEVELS[level]?LEVELS[level].name:""),W/2,21,14,"#8fd0ff","center",6);
  // hearts
  for(let i=0;i<6;i++){
    const hx=W-150+i*22;
    ctx.globalAlpha=i<lives?1:0.15;
    ctx.fillStyle="#ff5577";
    ctx.shadowColor="#ff5577"; ctx.shadowBlur=i<lives?8:0;
    ctx.beginPath();
    ctx.moveTo(hx,26);
    ctx.bezierCurveTo(hx-8,18,hx-6,10,hx,15);
    ctx.bezierCurveTo(hx+6,10,hx+8,18,hx,26);
    ctx.fill();
    ctx.shadowBlur=0;
  }
  ctx.globalAlpha=1;
  text(muted?"🔇 M":"🔊 M",W-16,21,11,"#6f83b8","right",0);

  // combo badge
  if(combo>=2 && state==="play"){
    const pulse=1+0.08*Math.sin(tGlobal*12);
    ctx.save(); ctx.translate(W/2,60); ctx.scale(pulse,pulse);
    text("COMBO ×"+combo,0,0,20,"#ffd23d","center",16);
    ctx.restore();
  }
  // effect timers
  let ey=H-14;
  if(wideT>0) text("WIDE "+Math.ceil(wideT)+"s",14,ey,12,"#3dff9a","left",6);
  if(slowT>0) text("SLOW "+Math.ceil(slowT)+"s",110,ey,12,"#7ab8ff","left",6);

  // stuck hint
  if(state==="play" && !paused && balls.some(b=>b.stuck)){
    const a=0.55+0.45*Math.sin(tGlobal*4);
    ctx.globalAlpha=a;
    text("SPACE / CLICK TO LAUNCH",W/2,H-90,16,"#cfe4ff","center",10);
    ctx.globalAlpha=1;
  }

  /* overlays */
  function overlay(alpha){ ctx.fillStyle="rgba(5,7,14,"+alpha+")"; ctx.fillRect(-30,-30,W+60,H+60); }
  const blink=0.6+0.4*Math.sin(tGlobal*4);
  if(state==="menu"){
    overlay(0.72);
    text("NEON",W/2,180,64,"#31d2f7","center",30);
    text("BREAKOUT",W/2,245,64,"#ff4d8d","center",30);
    text("6 LEVELS · POWER-UPS · COMBOS",W/2,300,15,"#8fd0ff","center",6);
    text("MOUSE or ← → / A D to move",W/2,352,16,"#cfe4ff","center",0,"400");
    text("SPACE / CLICK to launch · P pause · M mute · R restart",W/2,378,14,"#9db8ff","center",0,"400");
    ctx.globalAlpha=blink;
    text("PRESS SPACE OR CLICK TO START",W/2,440,20,"#ffd23d","center",14);
    ctx.globalAlpha=1;
    if(hi>0) text("HIGH SCORE  "+hi,W/2,490,15,"#9db8ff","center",0);
  }else if(paused){
    overlay(0.6);
    text("PAUSED",W/2,H/2-20,44,"#8fd0ff","center",20);
    ctx.globalAlpha=blink; text("P / SPACE / CLICK TO RESUME",W/2,H/2+34,16,"#cfe4ff","center",8); ctx.globalAlpha=1;
  }else if(state==="clear"){
    overlay(0.6);
    text("LEVEL "+(level+1)+" CLEAR!",W/2,H/2-60,44,"#3dff9a","center",24);
    text("BONUS +"+clearBonus,W/2,H/2-8,24,"#ffd23d","center",12);
    ctx.globalAlpha=blink;
    text(level+1>=LEVELS.length?"SPACE / CLICK TO FINISH":"SPACE / CLICK FOR NEXT LEVEL",W/2,H/2+56,17,"#cfe4ff","center",8);
    ctx.globalAlpha=1;
  }else if(state==="over"){
    overlay(0.72);
    text("GAME OVER",W/2,H/2-70,52,"#ff4d6d","center",28);
    text("SCORE  "+score,W/2,H/2-10,26,"#eaf2ff","center",10);
    if(score>=hi&&score>0) text("★ NEW HIGH SCORE ★",W/2,H/2+26,18,"#ffd23d","center",14);
    ctx.globalAlpha=blink; text("SPACE / CLICK TO PLAY AGAIN",W/2,H/2+80,18,"#cfe4ff","center",8); ctx.globalAlpha=1;
  }else if(state==="win"){
    overlay(0.72);
    text("YOU WIN!",W/2,H/2-80,58,"#3dff9a","center",30);
    text("ALL 6 LEVELS CONQUERED",W/2,H/2-24,18,"#8fd0ff","center",8);
    text("FINAL SCORE  "+score,W/2,H/2+16,26,"#eaf2ff","center",10);
    if(score>=hi) text("★ NEW HIGH SCORE ★",W/2,H/2+52,18,"#ffd23d","center",14);
    ctx.globalAlpha=blink; text("SPACE / CLICK TO PLAY AGAIN",W/2,H/2+104,18,"#cfe4ff","center",8); ctx.globalAlpha=1;
  }

  // flash
  if(flashA>0){
    ctx.fillStyle="rgba("+flashC+","+flashA.toFixed(3)+")";
    ctx.fillRect(-30,-30,W+60,H+60);
  }
}

/* ---------- input ---------- */
window.addEventListener("keydown",e=>{
  const k=e.key;
  if(["ArrowLeft","ArrowRight"," ","ArrowUp","ArrowDown"].includes(k)) e.preventDefault();
  audio();
  if(k==="ArrowLeft"||k==="a"||k==="A") keys.left=true;
  if(k==="ArrowRight"||k==="d"||k==="D") keys.right=true;
  if(k===" "||k==="Enter") advance();
  if(k==="p"||k==="P"){ if(state==="play") paused=!paused; }
  if(k==="m"||k==="M"){ muted=!muted; }
  if(k==="r"||k==="R"){ startGame(); }
});
window.addEventListener("keyup",e=>{
  const k=e.key;
  if(k==="ArrowLeft"||k==="a"||k==="A") keys.left=false;
  if(k==="ArrowRight"||k==="d"||k==="D") keys.right=false;
});
function pointerPos(e){
  const r=cv.getBoundingClientRect();
  return (e.clientX-r.left)/r.width*W;
}
cv.addEventListener("pointermove",e=>{
  mouseX=pointerPos(e); mouseActive=true;
});
cv.addEventListener("pointerdown",e=>{
  mouseX=pointerPos(e); mouseActive=true;
  advance();
});
window.addEventListener("blur",()=>{ if(state==="play") paused=true; keys={}; });

/* ---------- main loop ---------- */
let last=performance.now();
function frame(now){
  let dt=(now-last)/1000; last=now;
  if(dt>0.033) dt=0.033;
  update(dt);
  draw();
  requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
})();
</script>
</body>
</html>

Compare with

Qwen4 Max: other attempts