{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"oil-paint-tube-colour-mixer-that-squeezes-beads-onto-an-enamel-tray-for-a-palette-knife-to-blend","type":"registry:component","title":"Oil Paint Tube Colour Mixer That Squeezes Beads onto an Enamel Tray for a Palette Knife to Blend","description":"Colour mixer on a canvas: squeeze a wet bead from a paint tube onto an enamel tray, then drag the palette knife through to blend. Free React and HTML code.","dependencies":[],"files":[{"path":"components/we-inc/oil-paint-tube-colour-mixer-that-squeezes-beads-onto-an-enamel-tray-for-a-palette-knife-to-blend.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// The tubes in the box. `rgb` is the pigment, `strength` is how hard it tints a mix (white and blue dominate, as they do in oils).\nconst tubes = [\n  { name: \"Titanium White\", short: \"white\", rgb: [247, 245, 238], strength: 2.4 },\n  { name: \"Cadmium Yellow\", short: \"yellow\", rgb: [250, 198, 40], strength: 1 },\n  { name: \"Scarlet Lake\", short: \"scarlet\", rgb: [212, 36, 34], strength: 1.1 },\n  { name: \"Ultramarine\", short: \"ultramarine\", rgb: [26, 64, 170], strength: 1 },\n  { name: \"Burnt Sienna\", short: \"sienna\", rgb: [138, 58, 26], strength: 1 },\n];\nconst START = [1, 2, 0, 1, 0]; // parts already on the tray when the piece loads\nconst MAX_PARTS = 10; // the tray is full after this many squeezes\nconst DEMO_ORDER = [2, 1, 4, 3, 0]; // what the self-running demo squeezes until someone touches it\nconst M = 40; // spare canvas around the scene so soft shadows are never cut off\n\ntype Pose = { x: number; y: number; r: number };\nconst TILT = [0.035, -0.05, 0.02, -0.03, 0.045];\nconst layoutFor = (wide: boolean) =>\n  wide\n    ? { W: 810, H: 540, tray: { x: 322, y: 100, w: 424, h: 328 }, pile: { x: 520, y: 258 }, tube: (i: number): Pose => ({ x: 160 + (i % 2) * 10, y: 100 + i * 82, r: -Math.PI / 2 + TILT[i] }), knife: { x: 688, y: 366, r: -0.64 } as Pose }\n    : { W: 380, H: 620, tray: { x: 12, y: 196, w: 356, h: 344 }, pile: { x: 176, y: 350 }, tube: (i: number): Pose => ({ x: 46 + i * 72, y: 92 + (i % 2) * 8, r: TILT[i] }), knife: { x: 292, y: 440, r: -0.35 } as Pose };\n\n// Pigments multiply rather than add: yellow and blue make green, not grey.\nconst mixOf = (parts: number[]) => {\n  let W = 0; const s = [0, 0, 0];\n  parts.forEach((p, i) => { const w = p * tubes[i].strength; W += w; for (let c = 0; c < 3; c++) s[c] += w * Math.log(Math.max(8, tubes[i].rgb[c]) / 255); });\n  return W ? s.map((v) => Math.round(255 * Math.exp(v / W))) : null;\n};\nconst hexOf = (c: number[]) => \"#\" + c.map((v) => v.toString(16).padStart(2, \"0\")).join(\"\").toUpperCase();\n\nexport default function OilPaintTubeColourMixer() {\n  const root = useRef<HTMLDivElement>(null);\n  const canvas = useRef<HTMLCanvasElement>(null);\n  const pad = useRef<HTMLDivElement>(null);\n  const [wide, setWide] = useState(true);\n  const [parts, setParts] = useState(START);\n  const partsRef = useRef(START);\n  const [live, setLive] = useState(false);\n  const user = useRef(false);\n  const api = useRef<{ squeeze: (i: number) => void; clean: () => void } | null>(null);\n\n  useEffect(() => {\n    const el = root.current;\n    if (!el) return;\n    const ro = new ResizeObserver(() => setWide(el.clientWidth >= 760));\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n\n  useEffect(() => {\n    const cv = canvas.current, hit = pad.current;\n    if (!cv || !hit) return;\n    const ctx = cv.getContext(\"2d\");\n    if (!ctx) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    const L = layoutFor(wide);\n    let px = 1;\n\n    // The wet paint lives on a grid: one thickness value per pigment per cell.\n    const well = { x: L.tray.x + 15, y: L.tray.y + 15, w: L.tray.w - 30, h: L.tray.h - 30 };\n    const G = 1.5, gw = Math.round(well.w * G), gh = Math.round(well.h * G), N = gw * gh, K = tubes.length;\n    const P = tubes.map(() => new Float32Array(N));\n    const T = new Float32Array(N);\n    const LN = tubes.map((t) => t.rgb.map((v) => Math.log(Math.max(8, v) / 255)));\n    const STR = tubes.map((t) => t.strength);\n    const pc = document.createElement(\"canvas\"); pc.width = gw; pc.height = gh;\n    const pctx = pc.getContext(\"2d\");\n    if (!pctx) return;\n    const img = pctx.createImageData(gw, gh);\n    let dx0 = 1e9, dy0 = 1e9, dx1 = -1, dy1 = -1;\n    const touch = (x: number, y: number, r: number) => { if (x - r < dx0) dx0 = x - r; if (y - r < dy0) dy0 = y - r; if (x + r > dx1) dx1 = x + r; if (y + r > dy1) dy1 = y + r; };\n\n    // Turn thickness into a lit, glossy surface: slope gives the shading, steep ridges catch a highlight, thick paint shadows the enamel.\n    const shade = () => {\n      if (dx1 < 0) return;\n      const x0 = Math.max(0, Math.floor(dx0) - 7), y0 = Math.max(0, Math.floor(dy0) - 7), x1 = Math.min(gw - 1, Math.ceil(dx1) + 7), y1 = Math.min(gh - 1, Math.ceil(dy1) + 7);\n      dx0 = dy0 = 1e9; dx1 = dy1 = -1;\n      if (x1 < x0 || y1 < y0) return;\n      for (let y = y0; y <= y1; y++) for (let x = x0; x <= x1; x++) { const i = y * gw + x; let t = 0; for (let k = 0; k < K; k++) t += P[k][i]; T[i] = t; }\n      const d = img.data, S = 2.7;\n      for (let y = y0; y <= y1; y++) for (let x = x0; x <= x1; x++) {\n        const i = y * gw + x, t = T[i], o = i * 4;\n        const far = x >= 5 && y >= 6 ? T[i - 5 - 6 * gw] : 0, near = x >= 2 && y >= 2 ? T[i - 2 - 2 * gw] : 0;\n        const occ = Math.min(0.5, Math.max(0, Math.max(far * 0.8, near) - t) * 0.42);\n        if (t < 0.004) { d[o] = 24; d[o + 1] = 18; d[o + 2] = 10; d[o + 3] = occ * 255; continue; }\n        let W = 0, r = 0, g = 0, b = 0;\n        for (let k = 0; k < K; k++) { const a = P[k][i]; if (a > 0.0005) { const w = a * STR[k]; W += w; r += w * LN[k][0]; g += w * LN[k][1]; b += w * LN[k][2]; } }\n        if (W <= 0) { d[o + 3] = occ * 255; continue; }\n        r = Math.exp(r / W); g = Math.exp(g / W); b = Math.exp(b / W);\n        const nx = -((x < gw - 1 ? T[i + 1] : t) - (x > 0 ? T[i - 1] : t)) * S, ny = -((y < gh - 1 ? T[i + gw] : t) - (y > 0 ? T[i - gw] : t)) * S;\n        const inv = 1 / Math.sqrt(nx * nx + ny * ny + 1);\n        const diff = Math.max(0, (nx * -0.45 + ny * -0.6 + 0.66) * inv);\n        let sp = Math.max(0, (nx * -0.247 + ny * -0.33 + 0.912) * inv); sp *= sp; sp *= sp; sp *= sp; sp *= sp; sp *= sp; sp *= sp;\n        sp *= Math.min(1, t * 2.5) * 215;\n        const lit = (0.4 + 0.78 * diff) * 255, cov = 1 - Math.exp(-11 * t), A = cov + (1 - cov) * occ, k2 = ((1 - occ * 0.7) * cov) / A;\n        d[o] = Math.min(255, (r * lit + sp) * k2); d[o + 1] = Math.min(255, (g * lit + sp) * k2); d[o + 2] = Math.min(255, (b * lit + sp) * k2); d[o + 3] = A * 255;\n      }\n      pctx.putImageData(img, 0, 0, x0, y0, x1 - x0 + 1, y1 - y0 + 1);\n    };\n\n    // One round blob of a single pigment. A row of these is the worm that comes out of the nozzle.\n    const stamp = (k: number, lx: number, ly: number, rad: number, amt: number) => {\n      const gx = (lx - well.x) * G, gy = (ly - well.y) * G, R = rad * G;\n      for (let y = Math.max(0, Math.floor(gy - R)); y <= Math.min(gh - 1, Math.ceil(gy + R)); y++) for (let x = Math.max(0, Math.floor(gx - R)); x <= Math.min(gw - 1, Math.ceil(gx + R)); x++) {\n        const d2 = ((x - gx) * (x - gx) + (y - gy) * (y - gy)) / (R * R);\n        if (d2 >= 1) continue;\n        const v = amt * Math.pow(1 - d2, 0.6), i = y * gw + x;\n        if (P[k][i] < v) { const keep = 1 - 0.9 * Math.min(1, (v / amt) * 1.6); for (let j = 0; j < K; j++) if (j !== k) P[j][i] *= keep; P[k][i] = v; }\n      }\n      touch(gx, gy, R + 1);\n    };\n\n    // The knife pushes whatever is under its blade along with it, hardest at the middle and in uneven bands,\n    // which is what folds two colours into streaks and, after a few passes, into one.\n    const RB = 36 * G, SIDE = Math.ceil(RB) * 2 + 4, tmp = new Float32Array(SIDE * SIDE), fb = new Float32Array(SIDE * SIDE);\n    let seed = 11;\n    const rand = () => { seed = (seed * 16807) % 2147483647; return seed / 2147483647; };\n    const band = Array.from({ length: 40 }, () => rand());\n    const wet = { r: 0, g: 0, b: 0, a: 0 };\n    const drag = (ax: number, ay: number, bx: number, by: number, rot: number) => {\n      const x0 = (ax - well.x) * G, y0 = (ay - well.y) * G, x1 = (bx - well.x) * G, y1 = (by - well.y) * G;\n      const dist = Math.hypot(x1 - x0, y1 - y0);\n      if (dist < 0.02) return;\n      const steps = Math.max(1, Math.ceil(dist / 5)), mx = (x1 - x0) / steps, my = (y1 - y0) / steps, ux = -Math.sin(rot), uy = Math.cos(rot);\n      for (let s = 1; s <= steps; s++) {\n        const cx = x0 + mx * s, cy = y0 + my * s;\n        const xa = Math.max(2, Math.floor(cx - RB)), xb = Math.min(gw - 3, Math.ceil(cx + RB)), ya = Math.max(2, Math.floor(cy - RB)), yb = Math.min(gh - 3, Math.ceil(cy + RB)), w = xb - xa + 1;\n        if (w <= 0 || yb < ya) continue;\n        for (let y = ya; y <= yb; y++) for (let x = xa; x <= xb; x++) {\n          const ex = x - cx, ey = y - cy, al = ex * ux + ey * uy, ac = ex * uy - ey * ux, q = (al * al) / (RB * RB) + (ac * ac) / (RB * RB * 0.2);\n          let f = 0;\n          if (q < 1) { f = 1 - q; f = f * f * (3 - 2 * f); const u = (al / RB + 1) * 19, n = Math.floor(u), t = u - n; f *= 0.5 + 0.5 * (band[n] + (band[n + 1] - band[n]) * t); }\n          fb[(y - ya) * w + (x - xa)] = f;\n        }\n        for (let k = 0; k < K; k++) {\n          const A = P[k];\n          for (let y = ya; y <= yb; y++) for (let x = xa; x <= xb; x++) {\n            const j = (y - ya) * w + (x - xa), f = fb[j], i = y * gw + x;\n            if (f <= 0) { tmp[j] = A[i]; continue; }\n            const sx = x - mx * f, sy = y - my * f, ix = Math.floor(sx), iy = Math.floor(sy), tx2 = sx - ix, ty2 = sy - iy, i0 = iy * gw + ix;\n            tmp[j] = (A[i0] * (1 - tx2) + A[i0 + 1] * tx2) * (1 - ty2) + (A[i0 + gw] * (1 - tx2) + A[i0 + gw + 1] * tx2) * ty2;\n          }\n          for (let y = ya; y <= yb; y++) { const o = y * gw + xa, j = (y - ya) * w; for (let x = 0; x < w; x++) A[o + x] = tmp[j + x]; }\n        }\n      }\n      touch(Math.min(x0, x1), Math.min(y0, y1), RB + 2); touch(Math.max(x0, x1), Math.max(y0, y1), RB + 2);\n      // What is under the blade now is what clings to it.\n      const ci = Math.round(y1) * gw + Math.round(x1);\n      if (ci > 0 && ci < N) {\n        let W = 0, r = 0, g = 0, b = 0, t = 0;\n        for (let k = 0; k < K; k++) { const v = P[k][ci]; t += v; const wv = v * STR[k]; W += wv; r += wv * LN[k][0]; g += wv * LN[k][1]; b += wv * LN[k][2]; }\n        if (t > 0.08 && W > 0) { const m = wet.a < 0.05 ? 1 : 0.12; wet.r += (235 * Math.exp(r / W) - wet.r) * m; wet.g += (235 * Math.exp(g / W) - wet.g) * m; wet.b += (235 * Math.exp(b / W) - wet.b) * m; wet.a = Math.min(0.9, wet.a + 0.06); }\n      }\n    };\n\n    const depAt = (n: number) => { const a = n * 2.4 + 0.6; return [L.pile.x + Math.cos(a) * 42, L.pile.y + Math.sin(a) * 31]; };\n    const stirAt = (n: number, u: number) => { const a = n * 1.7 + u * Math.PI * 2 * 1.9, rad = 56 - 44 * u; return [L.pile.x + Math.cos(a) * rad * 1.2 + 12 * Math.sin(a * 2.3 + n), L.pile.y + Math.sin(a) * rad * 0.86 + 9 * Math.cos(a * 1.7 + n)]; };\n    const stirRot = (n: number, u: number) => L.knife.r + 0.26 * Math.sin(u * 15 + n);\n    const nozzleOf = (p: Pose) => [p.x - Math.sin(p.r) * 86, p.y + Math.cos(p.r) * 86];\n    const wormFor = (i: number, n: number) => {\n      const dep = depAt(n), rest = nozzleOf(L.tube(i));\n      const len = Math.hypot(rest[0] - dep[0], rest[1] - dep[1]) || 1, dir = [(rest[0] - dep[0]) / len, (rest[1] - dep[1]) / len];\n      let r1 = Math.atan2(dir[0], -dir[1]); const r0 = L.tube(i).r;\n      while (r1 - r0 > Math.PI) r1 -= Math.PI * 2; while (r1 - r0 < -Math.PI) r1 += Math.PI * 2;\n      r1 = r0 + Math.max(-0.5, Math.min(0.5, r1 - r0));\n      const at = (v: number) => [dep[0] + dir[0] * 46 * v - dir[1] * Math.sin(v * 7.5) * 6, dep[1] + dir[1] * 46 * v + dir[0] * Math.sin(v * 7.5) * 6];\n      return { dir, r1, at };\n    };\n    const layWorm = (i: number, at: (v: number) => number[], from: number, to: number) => { for (let v = from; v <= to; v += 0.02) { const q = at(v); stamp(i, q[0], q[1], 13.5 - 2.5 * v, 2.2); } };\n\n    let nDep = 0;\n    const used = tubes.map(() => 0);\n    const rebuild = (want: number[]) => {\n      for (const p of P) p.fill(0); T.fill(0); wet.a = 0; img.data.fill(0); pctx.clearRect(0, 0, gw, gh);\n      nDep = 0; const left = want.slice(); let any = true;\n      while (any) {\n        any = false;\n        for (let i = 0; i < K; i++) if (left[i] > 0) {\n          left[i]--; any = true; const n = nDep++;\n          layWorm(i, wormFor(i, n).at, 0, 1);\n          let prev = stirAt(n, 0);\n          for (let s = 1; s <= 60; s++) { const q = stirAt(n, s / 60); drag(prev[0], prev[1], q[0], q[1], stirRot(n, s / 60)); prev = q; }\n        }\n      }\n      // The paint that was already down has been worked a little longer than the newest bead.\n      if (nDep > 1) for (let extra = 0; extra < 4; extra++) { let prev = stirAt(extra + 7, 0.15); for (let s = 1; s <= 50; s++) { const u = 0.15 + (0.85 * s) / 50, q = stirAt(extra + 7, u); drag(prev[0], prev[1], q[0], q[1], stirRot(extra, u)); prev = q; } }\n      want.forEach((v, i) => { used[i] = v; });\n      dx0 = dy0 = 0; dx1 = gw; dy1 = gh; shade();\n    };\n\n    // ---- drawing ----\n    const rr = (c: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number) => { c.moveTo(x + r, y); c.arcTo(x + w, y, x + w, y + h, r); c.arcTo(x + w, y + h, x, y + h, r); c.arcTo(x, y + h, x, y, r); c.arcTo(x, y, x + w, y, r); c.closePath(); };\n    const bg = document.createElement(\"canvas\");\n    const paintTray = () => {\n      const c = bg.getContext(\"2d\");\n      if (!c) return;\n      bg.width = cv.width; bg.height = cv.height;\n      c.setTransform(px, 0, 0, px, M * px, M * px);\n      const { x, y, w, h } = L.tray;\n      c.save(); c.shadowColor = \"rgba(0,0,0,0.6)\"; c.shadowBlur = 44 * px; c.shadowOffsetX = 12 * px; c.shadowOffsetY = 28 * px; c.beginPath(); rr(c, x, y, w, h, 30); c.fillStyle = \"#e7e3d8\"; c.fill(); c.restore();\n      c.save(); c.shadowColor = \"rgba(0,0,0,0.7)\"; c.shadowBlur = 5 * px; c.shadowOffsetX = 1 * px; c.shadowOffsetY = 3 * px; c.beginPath(); rr(c, x, y, w, h, 30); c.fillStyle = \"#e7e3d8\"; c.fill(); c.restore();\n      const rim = c.createLinearGradient(x, y, x + w, y + h); rim.addColorStop(0, \"#fdfcf9\"); rim.addColorStop(0.5, \"#efece4\"); rim.addColorStop(1, \"#d6d2c6\");\n      c.beginPath(); rr(c, x, y, w, h, 30); c.fillStyle = rim; c.fill();\n      c.beginPath(); rr(c, x + 1.6, y + 1.6, w - 3.2, h - 3.2, 28.5); c.lineWidth = 3.2; c.strokeStyle = \"#1c2a55\"; c.stroke();\n      c.beginPath(); rr(c, x + 4.2, y + 4.2, w - 8.4, h - 8.4, 26); c.lineWidth = 1.1; c.strokeStyle = \"rgba(255,255,255,0.95)\"; c.stroke();\n      c.beginPath(); rr(c, x + 3.4, y + 3.4, w - 6.8, h - 6.8, 27); c.lineWidth = 0.6; c.strokeStyle = \"rgba(120,140,220,0.5)\"; c.stroke();\n      // The well: a floor a few millimetres below the rim, shadowed by the wall nearest the lamp.\n      c.save(); c.beginPath(); rr(c, well.x, well.y, well.w, well.h, 17); c.clip();\n      const floor = c.createLinearGradient(well.x, well.y, well.x + well.w, well.y + well.h); floor.addColorStop(0, \"#e9e6dd\"); floor.addColorStop(0.45, \"#f3f1ea\"); floor.addColorStop(1, \"#f8f6f1\");\n      c.fillStyle = floor; c.fillRect(well.x, well.y, well.w, well.h);\n      const gloss = c.createLinearGradient(well.x + well.w * 0.25, well.y, well.x + well.w * 0.75, well.y + well.h); gloss.addColorStop(0.3, \"rgba(255,255,255,0)\"); gloss.addColorStop(0.46, \"rgba(255,255,255,0.5)\"); gloss.addColorStop(0.5, \"rgba(255,255,255,0.1)\"); gloss.addColorStop(0.56, \"rgba(255,255,255,0.35)\"); gloss.addColorStop(0.7, \"rgba(255,255,255,0)\");\n      c.fillStyle = gloss; c.fillRect(well.x, well.y, well.w, well.h);\n      c.shadowColor = \"rgba(46,34,12,0.55)\"; c.shadowBlur = 11 * px; c.shadowOffsetX = 6 * px; c.shadowOffsetY = 7 * px;\n      c.beginPath(); c.rect(x - 60, y - 60, w + 120, h + 120); rr(c, well.x, well.y, well.w, well.h, 17); c.fillStyle = \"#000\"; c.fill(\"evenodd\");\n      c.shadowColor = \"rgba(255,255,255,0.95)\"; c.shadowBlur = 3 * px; c.shadowOffsetX = -2 * px; c.shadowOffsetY = -2.5 * px;\n      c.beginPath(); c.rect(x - 60, y - 60, w + 120, h + 120); rr(c, well.x, well.y, well.w, well.h, 17); c.fill(\"evenodd\");\n      c.restore();\n      c.beginPath(); rr(c, well.x, well.y, well.w, well.h, 17); c.lineWidth = 0.7; c.strokeStyle = \"rgba(60,50,30,0.28)\"; c.stroke();\n      // Two chips in the enamel where the steel shows through.\n      const chip = (cx: number, cy: number, s: number, a: number) => {\n        c.save(); c.translate(cx, cy); c.rotate(a); c.scale(s, s);\n        c.beginPath(); c.moveTo(-5, -1); c.lineTo(-2, -3.4); c.lineTo(2.4, -2.6); c.lineTo(5.2, 0.4); c.lineTo(2.2, 3); c.lineTo(-2.6, 2.4); c.closePath();\n        c.fillStyle = \"#6b3a1c\"; c.fill(); c.scale(0.72, 0.72); c.fillStyle = \"#17140f\"; c.fill();\n        c.restore();\n      };\n      chip(x + w - 20, y + 6.5, 1, 0.7); chip(x + 6.5, y + h * 0.62, 0.8, 1.5); chip(x + w * 0.36, y + h - 6, 0.6, 0.1);\n    };\n\n    const metal = (c: CanvasRenderingContext2D, a: number, b: number, dark = 0) => {\n      const g = c.createLinearGradient(a, 0, b, 0);\n      const stops: [number, number][] = [[0, 96], [0.07, 150], [0.24, 236], [0.33, 250], [0.44, 214], [0.66, 172], [0.86, 128], [0.95, 96], [1, 70]];\n      for (const [p, v] of stops) { const s = Math.max(0, v - dark); g.addColorStop(p, `rgb(${s},${s + 2},${Math.min(255, s + 5)})`); }\n      return g;\n    };\n    const drawTube = (i: number, pose: Pose, lift: number, sq: number) => {\n      const c = ctx, t = tubes[i], col = `rgb(${t.rgb[0]},${t.rgb[1]},${t.rgb[2]})`, wear = Math.min(1, used[i] * 0.3 + sq);\n      const body = () => { c.beginPath(); c.moveTo(-29, -60); c.lineTo(29, -60); c.bezierCurveTo(29, -34, 25, -24, 25, -4); c.lineTo(25, 58); c.lineTo(-25, 58); c.lineTo(-25, -4); c.bezierCurveTo(-25, -24, -29, -34, -29, -60); c.closePath(); };\n      c.save(); c.translate(pose.x, pose.y); c.rotate(pose.r); c.scale(1 - 0.05 * sq, 1);\n      c.save(); c.shadowColor = \"rgba(0,0,0,0.55)\"; c.shadowBlur = (9 + 20 * lift) * px; c.shadowOffsetX = (4 + 9 * lift) * px; c.shadowOffsetY = (8 + 20 * lift) * px; body(); c.fillStyle = \"#333\"; c.fill(); c.restore();\n      // crimped end\n      const cr = c.createLinearGradient(0, -69, 0, -59); cr.addColorStop(0, \"#f2f3f4\"); cr.addColorStop(0.42, \"#a4a8ad\"); cr.addColorStop(0.5, \"#e2e4e6\"); cr.addColorStop(1, \"#7f8388\");\n      c.beginPath(); rr(c, -30.5, -69, 61, 10, 1.6); c.fillStyle = cr; c.fill(); c.lineWidth = 0.5; c.strokeStyle = \"rgba(0,0,0,0.4)\"; c.stroke();\n      c.lineWidth = 0.6; c.strokeStyle = \"rgba(0,0,0,0.2)\"; c.beginPath(); for (let x = -28; x <= 28; x += 2.6) { c.moveTo(x, -67.4); c.lineTo(x, -61.2); } c.stroke();\n      // body\n      body(); c.fillStyle = metal(c, -29, 29); c.fill();\n      const flat = c.createLinearGradient(0, -60, 0, 4); flat.addColorStop(0, \"rgba(214,217,220,0.92)\"); flat.addColorStop(0.5, \"rgba(206,209,213,0.5)\"); flat.addColorStop(1, \"rgba(206,209,213,0)\");\n      body(); c.fillStyle = flat; c.fill();\n      c.save(); body(); c.clip();\n      const fold = (x0: number, y0: number, x1: number, y1: number, a: number) => {\n        c.lineCap = \"round\"; c.lineWidth = 1.5; c.strokeStyle = `rgba(0,0,0,${0.2 * a})`; c.beginPath(); c.moveTo(x0, y0); c.lineTo(x1, y1); c.stroke();\n        c.lineWidth = 1.1; c.strokeStyle = `rgba(255,255,255,${0.7 * a})`; c.beginPath(); c.moveTo(x0 + 1.5, y0 + 0.4); c.lineTo(x1 + 1.5, y1 + 0.4); c.stroke();\n      };\n      fold(-24, -59, -9, -26, 0.9); fold(22, -59, 8, -30, 0.9); fold(-4, -59, 1, -40, 0.6);\n      if (wear > 0.02) {\n        const dent = c.createRadialGradient(-3, -34, 1, 1, -30, 24); dent.addColorStop(0, `rgba(20,24,30,${0.34 * wear})`); dent.addColorStop(0.7, `rgba(20,24,30,${0.12 * wear})`); dent.addColorStop(1, \"rgba(20,24,30,0)\");\n        c.fillStyle = dent; c.fillRect(-29, -60, 58, 60);\n        c.lineWidth = 1.3; c.strokeStyle = `rgba(255,255,255,${0.75 * wear})`; c.beginPath(); c.ellipse(1, -31, 15, 19, 0, 0.1, 1.5); c.stroke();\n        fold(-17, -22, 14, -19, wear * 0.8);\n      }\n      // paper label\n      c.fillStyle = col; c.fillRect(-25, -14, 50, 60);\n      c.fillStyle = \"#1b1a18\"; c.fillRect(-25, -14, 50, 2.6); c.fillRect(-25, 43.4, 50, 2.6);\n      c.fillStyle = \"#f1ecdf\"; c.fillRect(-13, -8, 26, 48);\n      c.lineWidth = 0.5; c.strokeStyle = \"rgba(27,26,24,0.75)\"; c.strokeRect(-11.4, -6.4, 22.8, 44.8);\n      c.save(); c.translate(0, 16); c.rotate(Math.PI / 2); c.textAlign = \"center\"; c.textBaseline = \"middle\"; c.fillStyle = \"#1b1a18\";\n      c.font = \"700 5.1px Georgia, 'Times New Roman', serif\"; c.fillText(t.name.toUpperCase(), 0, -4.6, 41);\n      c.fillRect(-13, -0.3, 26, 0.5);\n      c.font = \"400 3.9px Georgia, 'Times New Roman', serif\"; c.fillText(\"Artists' oil colour  37 ml\", 0, 4.6, 41);\n      c.restore();\n      const round = c.createLinearGradient(-25, 0, 25, 0); round.addColorStop(0, \"rgba(0,0,0,0.5)\"); round.addColorStop(0.1, \"rgba(0,0,0,0.18)\"); round.addColorStop(0.27, \"rgba(255,255,255,0.3)\"); round.addColorStop(0.4, \"rgba(255,255,255,0)\"); round.addColorStop(0.72, \"rgba(0,0,0,0.1)\"); round.addColorStop(0.92, \"rgba(0,0,0,0.34)\"); round.addColorStop(1, \"rgba(0,0,0,0.56)\");\n      c.fillStyle = round; c.fillRect(-25, -14, 50, 60);\n      c.restore();\n      body(); c.lineWidth = 0.6; c.strokeStyle = \"rgba(0,0,0,0.42)\"; c.stroke();\n      // shoulder, thread and the paint at the mouth\n      c.beginPath(); c.moveTo(-25, 58); c.lineTo(25, 58); c.quadraticCurveTo(20, 70, 9, 74); c.lineTo(-9, 74); c.quadraticCurveTo(-20, 70, -25, 58); c.closePath();\n      c.fillStyle = metal(c, -25, 25, 14); c.fill(); c.lineWidth = 0.6; c.strokeStyle = \"rgba(0,0,0,0.42)\"; c.stroke();\n      c.lineWidth = 0.7; c.strokeStyle = \"rgba(0,0,0,0.3)\"; c.beginPath(); c.moveTo(-25, 58.4); c.lineTo(25, 58.4); c.stroke();\n      c.strokeStyle = \"rgba(255,255,255,0.6)\"; c.beginPath(); c.moveTo(-24, 59.6); c.lineTo(24, 59.6); c.stroke();\n      c.fillStyle = metal(c, -7.5, 7.5, 6); c.fillRect(-7.5, 73.5, 15, 11.5);\n      for (let y = 75.2; y < 84.6; y += 2.3) { c.fillStyle = \"rgba(0,0,0,0.34)\"; c.fillRect(-7.5, y, 15, 0.9); c.fillStyle = \"rgba(255,255,255,0.4)\"; c.fillRect(-7.5, y + 0.9, 15, 0.5); }\n      c.strokeStyle = \"rgba(0,0,0,0.5)\"; c.lineWidth = 0.5; c.strokeRect(-7.5, 73.5, 15, 11.5);\n      c.beginPath(); c.ellipse(0, 85.6, 5.6, 2.9, 0, 0, Math.PI * 2); c.fillStyle = col; c.fill(); c.lineWidth = 0.5; c.strokeStyle = \"rgba(0,0,0,0.35)\"; c.stroke();\n      c.beginPath(); c.ellipse(-1.6, 84.9, 1.9, 0.8, 0, 0, Math.PI * 2); c.fillStyle = \"rgba(255,255,255,0.6)\"; c.fill();\n      c.restore();\n    };\n\n    const drawKnife = (x: number, y: number, r: number, lift: number) => {\n      const c = ctx;\n      const blade = () => { c.beginPath(); c.moveTo(0, -40); c.bezierCurveTo(5.5, -31, 10, -8, 10, 8); c.bezierCurveTo(10, 20, 4.4, 28, 1.9, 32); c.lineTo(-1.9, 32); c.bezierCurveTo(-4.4, 28, -10, 20, -10, 8); c.bezierCurveTo(-10, -8, -5.5, -31, 0, -40); c.closePath(); };\n      const handle = () => { c.beginPath(); c.moveTo(-4.6, 61); c.bezierCurveTo(-8.4, 82, -8.4, 114, -5.4, 130); c.quadraticCurveTo(0, 137, 5.4, 130); c.bezierCurveTo(8.4, 114, 8.4, 82, 4.6, 61); c.closePath(); };\n      c.save(); c.translate(x, y); c.rotate(r); c.scale(1.3, 1.3);\n      c.save(); c.shadowColor = \"rgba(0,0,0,0.5)\"; c.shadowBlur = (5 + 12 * lift) * px; c.shadowOffsetX = (3 + 9 * lift) * px; c.shadowOffsetY = (5 + 16 * lift) * px; c.fillStyle = \"#444\";\n      blade(); c.fill(); c.fillRect(-1.9, 30, 3.8, 24); handle(); c.fill(); c.restore();\n      const st = c.createLinearGradient(-10, -12, 10, 8); st.addColorStop(0, \"#737a82\"); st.addColorStop(0.3, \"#e9edf0\"); st.addColorStop(0.46, \"#b4bac1\"); st.addColorStop(0.6, \"#fafbfc\"); st.addColorStop(0.78, \"#aab0b7\"); st.addColorStop(1, \"#6a7179\");\n      blade(); c.fillStyle = st; c.fill();\n      if (wet.a > 0.02) {\n        c.save(); blade(); c.clip();\n        const a = wet.a, cc = [Math.round(wet.r), Math.round(wet.g), Math.round(wet.b)];\n        const sm = c.createRadialGradient(0, 2, 2, 0, 0, 30);\n        sm.addColorStop(0, `rgba(${cc[0]},${cc[1]},${cc[2]},${a})`); sm.addColorStop(0.6, `rgba(${cc[0]},${cc[1]},${cc[2]},${a * 0.85})`); sm.addColorStop(1, `rgba(${cc[0]},${cc[1]},${cc[2]},0)`);\n        c.fillStyle = sm; c.fillRect(-10, -40, 20, 62);\n        c.strokeStyle = `rgba(255,255,255,${0.5 * a})`; c.lineWidth = 1.1; c.lineCap = \"round\"; c.beginPath(); c.moveTo(-4, -16); c.quadraticCurveTo(-6, 0, -4.5, 12); c.stroke();\n        c.restore();\n      }\n      blade(); c.lineWidth = 0.5; c.strokeStyle = \"rgba(20,24,30,0.55)\"; c.stroke();\n      const rod = c.createLinearGradient(-2, 0, 2, 0); rod.addColorStop(0, \"#60666d\"); rod.addColorStop(0.4, \"#f1f3f5\"); rod.addColorStop(1, \"#555b62\");\n      c.fillStyle = rod; c.fillRect(-1.9, 31, 3.8, 23);\n      const br = c.createLinearGradient(-5, 0, 5, 0); br.addColorStop(0, \"#6e4f17\"); br.addColorStop(0.35, \"#f3da92\"); br.addColorStop(0.6, \"#b98b2e\"); br.addColorStop(1, \"#5c400f\");\n      c.beginPath(); rr(c, -4.9, 52, 9.8, 10.5, 1.2); c.fillStyle = br; c.fill(); c.lineWidth = 0.5; c.strokeStyle = \"rgba(0,0,0,0.5)\"; c.stroke();\n      c.fillStyle = \"rgba(0,0,0,0.25)\"; c.fillRect(-4.9, 55, 9.8, 0.7); c.fillRect(-4.9, 59, 9.8, 0.7);\n      const wd = c.createLinearGradient(-8, 0, 8, 0); wd.addColorStop(0, \"#2b1a0e\"); wd.addColorStop(0.28, \"#8b5a33\"); wd.addColorStop(0.4, \"#c08a58\"); wd.addColorStop(0.55, \"#7c4f2b\"); wd.addColorStop(1, \"#27170c\");\n      handle(); c.fillStyle = wd; c.fill(); c.lineWidth = 0.5; c.strokeStyle = \"rgba(0,0,0,0.55)\"; c.stroke();\n      c.save(); handle(); c.clip(); c.strokeStyle = \"rgba(30,16,6,0.25)\"; c.lineWidth = 0.5;\n      for (let g = -6; g <= 6; g += 1.7) { c.beginPath(); c.moveTo(g, 60); c.bezierCurveTo(g * 1.5, 85, g * 1.4, 110, g * 0.8, 134); c.stroke(); }\n      c.strokeStyle = \"rgba(255,236,206,0.5)\"; c.lineWidth = 1; c.beginPath(); c.moveTo(-2.6, 66); c.quadraticCurveTo(-4.4, 96, -2.8, 124); c.stroke();\n      c.restore();\n      c.restore();\n    };\n\n    // ---- state ----\n    type Squeeze = { i: number; n: number; phase: number; p: number; at: (v: number) => number[]; dir: number[]; r1: number; laid: number };\n    let tube: Squeeze | null = null;\n    const queue: number[] = [];\n    let kmode: \"rest\" | \"to\" | \"stir\" | \"back\" | \"user\" = \"rest\", kx = L.knife.x, ky = L.knife.y, kr = L.knife.r, klift = 0, kp = 0, kn = 0, kfx = kx, kfy = ky, kfr = kr, stirNext = -1, tx = kx, ty = ky, down = false;\n    let fade = 1, fadeTo = 1, afterFade: number[] | null = null;\n    let raf = 0, last = 0, t0 = 0, seen = true, nextDemo = 0.9, demoAt = 0, needDraw = true;\n    const ease = (p: number) => p * p * (3 - 2 * p);\n    const mixPose = (a: Pose, b: Pose, p: number): Pose => ({ x: a.x + (b.x - a.x) * p, y: a.y + (b.y - a.y) * p, r: a.r + (b.r - a.r) * p });\n\n    const draw = () => {\n      ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.clearRect(0, 0, cv.width, cv.height); ctx.drawImage(bg, 0, 0);\n      ctx.setTransform(px, 0, 0, px, M * px, M * px);\n      ctx.save(); ctx.beginPath(); rr(ctx, well.x, well.y, well.w, well.h, 17); ctx.clip();\n      ctx.globalAlpha = fade; ctx.imageSmoothingEnabled = true; ctx.imageSmoothingQuality = \"high\"; ctx.drawImage(pc, well.x, well.y, well.w, well.h); ctx.restore();\n      let pose: Pose | null = null, lift = 0, sq = 0;\n      if (tube) {\n        const rest = L.tube(tube.i), s = tube;\n        const hold = (v: number): Pose => { const q = s.at(v), r = s.r1 + Math.sin(v * 9) * 0.035, tipx = q[0] + s.dir[0] * 5, tipy = q[1] + s.dir[1] * 5; return { x: tipx + Math.sin(r) * 86, y: tipy - Math.cos(r) * 86, r }; };\n        if (s.phase === 1) { const e = ease(s.p); pose = mixPose(rest, hold(0), e); lift = Math.sin(Math.PI * s.p) * 0.75 + 0.25 * e; }\n        else if (s.phase === 2) { pose = hold(ease(s.p)); lift = 0.25; sq = Math.pow(Math.sin(Math.PI * s.p), 0.6); }\n        else { const e = ease(s.p); pose = mixPose(hold(1), rest, e); lift = Math.sin(Math.PI * s.p) * 0.75 + 0.25 * (1 - e); }\n      }\n      for (let i = 0; i < K; i++) if (!tube || tube.i !== i) drawTube(i, L.tube(i), 0, 0);\n      drawKnife(kx, ky, kr, klift);\n      if (tube && pose) drawTube(tube.i, pose, lift, sq);\n    };\n\n    const step = (dt: number) => {\n      let busy = false;\n      if (!tube && queue.length) { const i = queue.shift() as number, n = nDep++, w = wormFor(i, n); tube = { i, n, phase: 1, p: 0, at: w.at, dir: w.dir, r1: w.r1, laid: 0 }; }\n      if (tube) {\n        busy = true;\n        tube.p += dt / (tube.phase === 2 ? 0.56 : 0.36);\n        if (tube.phase === 2) { const v = ease(Math.min(1, tube.p)); layWorm(tube.i, tube.at, tube.laid, v); tube.laid = v; }\n        if (tube.p >= 1) { if (tube.phase === 2) { used[tube.i]++; stirNext = tube.n; } tube.p = 0; tube.phase++; if (tube.phase > 3) tube = null; }\n      }\n      if (kmode === \"user\") {\n        busy = true;\n        const ox = kx, oy = ky; kx += (tx - kx) * Math.min(1, dt * 24); ky += (ty - ky) * Math.min(1, dt * 24);\n        kr += (L.knife.r + Math.max(-0.4, Math.min(0.4, (kx - ox) * 0.05)) - kr) * Math.min(1, dt * 8);\n        klift += ((down ? 0.12 : 0.8) - klift) * Math.min(1, dt * 12);\n        if (down) drag(ox, oy, kx, ky, kr);\n      } else {\n        if (stirNext >= 0 && (kmode === \"rest\" || kmode === \"back\")) { kmode = \"to\"; kn = stirNext; stirNext = -1; kp = 0; kfx = kx; kfy = ky; kfr = kr; }\n        if (kmode === \"to\") {\n          busy = true; kp = Math.min(1, kp + dt / 0.3); const e = ease(kp), q = stirAt(kn, 0);\n          kx = kfx + (q[0] - kfx) * e; ky = kfy + (q[1] - kfy) * e; kr = kfr + (stirRot(kn, 0) - kfr) * e; klift = Math.max(0.12, Math.sin(Math.PI * kp));\n          if (kp >= 1) { kmode = \"stir\"; kp = 0; }\n        } else if (kmode === \"stir\") {\n          busy = true; kp = Math.min(1, kp + dt / 1.5); const q = stirAt(kn, kp), nr = stirRot(kn, kp);\n          drag(kx, ky, q[0], q[1], nr); kx = q[0]; ky = q[1]; kr = nr; klift = 0.12;\n          if (kp >= 1) { kp = 0; kfx = kx; kfy = ky; kfr = kr; kmode = \"back\"; }\n        } else if (kmode === \"back\") {\n          busy = true; kp = Math.min(1, kp + dt / 0.5); const e = ease(kp);\n          kx = kfx + (L.knife.x - kfx) * e; ky = kfy + (L.knife.y - kfy) * e; kr = kfr + (L.knife.r - kfr) * e; klift = Math.sin(Math.PI * kp) * 0.9;\n          if (kp >= 1) { kmode = \"rest\"; klift = 0; }\n        }\n      }\n      if (fade !== fadeTo) {\n        busy = true; fade += Math.sign(fadeTo - fade) * Math.min(Math.abs(fadeTo - fade), dt / 0.32);\n        if (fade <= 0 && afterFade) { rebuild(afterFade); afterFade = null; fadeTo = 1; }\n      }\n      shade();\n      return busy;\n    };\n\n    const frame = (now: number) => {\n      raf = 0;\n      if (!t0) { t0 = now; last = now; }\n      const dt = Math.min(0.033, (now - last) / 1000); last = now;\n      const t = (now - t0) / 1000;\n      if (!user.current && t > nextDemo && !tube && !queue.length && kmode === \"rest\" && fade === 1) {\n        const cur = partsRef.current, total = cur.reduce((a, b) => a + b, 0);\n        if (total >= 8) { partsRef.current = START; setParts(START); afterFade = START; fadeTo = 0; }\n        else { const i = DEMO_ORDER[demoAt++ % DEMO_ORDER.length], next = cur.map((v, j) => (j === i ? v + 1 : v)); partsRef.current = next; setParts(next); queue.push(i); }\n        nextDemo = t + 4.4;\n      }\n      const busy = step(dt);\n      if (busy || needDraw) { draw(); needDraw = false; }\n      if (seen && !document.hidden) raf = requestAnimationFrame(frame);\n    };\n    const wake = () => { if (!raf && !reduce) { last = performance.now(); raf = requestAnimationFrame(frame); } };\n\n    const size = () => {\n      const b = cv.getBoundingClientRect(), dpr = Math.min(2, window.devicePixelRatio || 1);\n      if (!b.width) return;\n      cv.width = Math.round(b.width * dpr); cv.height = Math.round((b.width * dpr * (L.H + M * 2)) / (L.W + M * 2));\n      px = cv.width / (L.W + M * 2); paintTray(); needDraw = true;\n      if (reduce) draw();\n    };\n    rebuild(partsRef.current);\n    size();\n    const ro = new ResizeObserver(size); ro.observe(cv);\n\n    api.current = {\n      squeeze: (i) => {\n        if (reduce) { rebuild(partsRef.current); draw(); return; }\n        if (queue.length < 4) queue.push(i);\n        wake();\n      },\n      clean: () => {\n        queue.length = 0; stirNext = -1;\n        if (reduce) { rebuild(partsRef.current); draw(); return; }\n        afterFade = partsRef.current; fadeTo = 0; wake();\n      },\n    };\n    if (reduce) draw(); else wake();\n\n    const where = (e: PointerEvent) => { const b = cv.getBoundingClientRect(); return [((e.clientX - b.left) / b.width) * (L.W + M * 2) - M, ((e.clientY - b.top) / b.height) * (L.H + M * 2) - M]; };\n    const onDown = (e: PointerEvent) => {\n      user.current = true; setLive(true);\n      const q = where(e); tx = q[0]; ty = q[1]; down = true;\n      if (reduce) { kx = tx; ky = ty; draw(); } else { kmode = \"user\"; stirNext = -1; }\n      hit.setPointerCapture(e.pointerId); e.preventDefault(); wake();\n    };\n    const onMove = (e: PointerEvent) => {\n      if (!down) return;\n      const q = where(e);\n      if (reduce) { drag(kx, ky, q[0], q[1], kr); kx = q[0]; ky = q[1]; shade(); draw(); } else { tx = q[0]; ty = q[1]; }\n    };\n    const onUp = () => {\n      if (!down) return;\n      down = false;\n      if (reduce) { kx = L.knife.x; ky = L.knife.y; draw(); return; }\n      kmode = \"back\"; kp = 0; kfx = kx; kfy = ky; kfr = kr;\n    };\n    hit.addEventListener(\"pointerdown\", onDown); hit.addEventListener(\"pointermove\", onMove); hit.addEventListener(\"pointerup\", onUp); hit.addEventListener(\"pointercancel\", onUp);\n    const io = new IntersectionObserver(([entry]) => { seen = entry.isIntersecting; if (seen) wake(); });\n    io.observe(cv);\n    const onVis = () => { if (!document.hidden) wake(); };\n    document.addEventListener(\"visibilitychange\", onVis);\n    return () => {\n      cancelAnimationFrame(raf); api.current = null; ro.disconnect(); io.disconnect();\n      hit.removeEventListener(\"pointerdown\", onDown); hit.removeEventListener(\"pointermove\", onMove); hit.removeEventListener(\"pointerup\", onUp); hit.removeEventListener(\"pointercancel\", onUp);\n      document.removeEventListener(\"visibilitychange\", onVis);\n    };\n  }, [wide]);\n\n  const L = layoutFor(wide);\n  const total = parts.reduce((a, b) => a + b, 0);\n  const mix = mixOf(parts);\n  const full = total >= MAX_PARTS;\n  const squeeze = (i: number) => {\n    user.current = true; setLive(true);\n    if (full) return;\n    const next = partsRef.current.map((v, j) => (j === i ? v + 1 : v));\n    partsRef.current = next; setParts(next); api.current?.squeeze(i);\n  };\n  const clean = () => {\n    user.current = true; setLive(true);\n    const next = tubes.map(() => 0);\n    partsRef.current = next; setParts(next); api.current?.clean();\n  };\n  const recipe = parts.map((p, i) => (p ? `${p} ${tubes[i].short}` : \"\")).filter(Boolean).join(\", \");\n\n  return (\n    <div ref={root} className=\"flex min-h-[680px] w-full flex-col items-center justify-center overflow-hidden bg-[#15120e] bg-[radial-gradient(110%_78%_at_46%_36%,#2c261e_0%,#15120e_66%)] px-4 py-10 sm:min-h-[720px]\">\n      <div className={`relative w-full ${wide ? \"max-w-[920px]\" : \"max-w-[440px]\"}`} style={{ aspectRatio: `${L.W} / ${L.H}` }}>\n        <canvas ref={canvas} aria-hidden=\"true\" className=\"pointer-events-none absolute\" style={{ left: `${(-M / L.W) * 100}%`, top: `${(-M / L.H) * 100}%`, width: `${((L.W + M * 2) / L.W) * 100}%`, height: `${((L.H + M * 2) / L.H) * 100}%` }} />\n        <div\n          ref={pad}\n          aria-hidden=\"true\"\n          className=\"absolute cursor-crosshair touch-none rounded-2xl\"\n          style={{ left: `${((L.tray.x + 15) / L.W) * 100}%`, top: `${((L.tray.y + 15) / L.H) * 100}%`, width: `${((L.tray.w - 30) / L.W) * 100}%`, height: `${((L.tray.h - 30) / L.H) * 100}%` }}\n        />\n        <div role=\"group\" aria-label=\"Paint tubes\">\n          {tubes.map((t, i) => {\n            const p = L.tube(i), box = wide ? { x: p.x - 70, y: p.y - 31, w: 160, h: 62 } : { x: p.x - 31, y: p.y - 70, w: 62, h: 160 };\n            return (\n              <button\n                key={t.name}\n                type=\"button\"\n                aria-disabled={full}\n                aria-label={`Squeeze ${t.name}. ${parts[i]} ${parts[i] === 1 ? \"part\" : \"parts\"} on the tray`}\n                onClick={() => squeeze(i)}\n                className=\"absolute cursor-pointer rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-amber-300 focus-visible:ring-offset-2 focus-visible:ring-offset-[#15120e]\"\n                style={{ left: `${(box.x / L.W) * 100}%`, top: `${(box.y / L.H) * 100}%`, width: `${(box.w / L.W) * 100}%`, height: `${(box.h / L.H) * 100}%` }}\n              />\n            );\n          })}\n        </div>\n      </div>\n      <div className=\"mt-7 flex min-h-[44px] flex-wrap items-center justify-center gap-x-4 gap-y-2 font-mono text-[11px] uppercase tracking-[0.16em] text-stone-400\">\n        <span aria-hidden=\"true\" className=\"h-5 w-5 rounded-full ring-1 ring-white/25\" style={{ backgroundColor: mix ? hexOf(mix) : \"#f1eee6\" }} />\n        <output aria-live={live ? \"polite\" : \"off\"} className=\"text-center\">\n          <span className=\"text-stone-100\">{mix ? hexOf(mix) : \"Clean tray\"}</span>\n          <span className=\"mx-2 text-stone-600\">/</span>\n          {mix ? recipe : \"squeeze a tube to start\"}\n          {full ? <span className=\"text-amber-300\"> / tray is full</span> : null}\n        </output>\n        <button\n          type=\"button\"\n          onClick={clean}\n          className=\"h-10 rounded-full border border-stone-600 px-4 font-mono text-[11px] uppercase tracking-[0.16em] text-stone-200 outline-none transition-colors hover:border-stone-300 hover:text-white focus-visible:ring-2 focus-visible:ring-amber-300 motion-reduce:transition-none\"\n        >\n          Scrape clean\n        </button>\n      </div>\n    </div>\n  );\n}\n"}]}
