{"title":"Puzzles Under $25","description":"\u003cp\u003eLooking for an affordable mechanical puzzle? This collection features hand-picked 3D-printed puzzles all priced under $25 - without sacrificing quality or challenge. Whether you want a flat symmetry puzzle like Shinobi, a packing challenge like Trimini Frame, or a mystery puzzle surprise, you'll find something worth solving here. Each puzzle is designed to challenge your spatial thinking and makes a great gift for puzzle lovers of any level. Browse below - sorted by difficulty - and find your next solve.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eNot sure where to start?\u003c\/strong\u003e Here are four worth knowing about:\u003c\/p\u003e\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003eBest for Gifting:\u003c\/strong\u003e \u003ca href=\"\/products\/tower-of-hanoi-puzzle\"\u003eTower of Hanoi\u003c\/a\u003e - A classic for a reason. Easy to hand to someone who doesn't think they like puzzles.\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eBest for Beginners:\u003c\/strong\u003e \u003ca href=\"\/products\/baby-puzzle\"\u003eBaby Puzzle\u003c\/a\u003e - Don't let the name fool you. It's a real puzzle. Just a friendly one.\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eBest for Challenge Lovers:\u003c\/strong\u003e \u003ca href=\"\/products\/alpacka-1\"\u003eAlpacka 1\u003c\/a\u003e - Looks simple. It's not. Most people spend a lot longer on this than they expect.\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eBest for the Brave:\u003c\/strong\u003e \u003ca href=\"\/products\/minima-tower\"\u003eMINIMA Tower\u003c\/a\u003e - This one will humble you. You've been warned.\u003c\/li\u003e\n\u003c\/ul\u003e","products":[{"product_id":"6-piece-star-puzzle","title":"6-Piece Star Puzzle | Star Brainteaser","description":"\u003cp\u003eThe 6-Piece Star Puzzle was one of the first puzzles I ever solved. I remember taking it apart for the first time - what a surprise that was! Putting it back together is the real challenge.\u003c\/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eQuick Summary:\u003c\/strong\u003e The 6-Piece Star Puzzle is a classic 3D-printed mechanical brainteaser - 6 interlocking pieces that come apart easily but fight to go back together. Difficulty: Easy. Solve time: 5-30 min. Trains spatial thinking and 3D imagination.\u003c\/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e curious beginners, gift buyers looking for a low-cost, high-delight puzzle that anyone can attempt but not everyone will crack on the first try.\u003c\/p\u003e\n\n\u003cp\u003eIt looks simple. Six pieces, a recognizable star shape, no hidden mechanisms. But the moment you take it apart, you realize the real challenge was never the star - it was getting back to it.\u003c\/p\u003e\n\n\u003ch3\u003eSpecs\u003c\/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003ePieces:\u003c\/strong\u003e 6\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eDifficulty:\u003c\/strong\u003e Easy\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSolve time:\u003c\/strong\u003e 5-30 min\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSkill trained:\u003c\/strong\u003e Spatial Thinking, 3D Imagination\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eWhy people love it\u003c\/h3\u003e\n\u003cp\u003eThe 6-Piece Star is one of Greg Puzzles' all-time bestsellers because it nails the sweet spot: approachable enough to hand to anyone, satisfying enough that you won't put it down until it's solved. It's tactile, portable, and endlessly re-solvable - the kind of puzzle you keep on your desk to hand to the next person who says they're bored.\u003c\/p\u003e\n\n\u003ch3\u003eFrequently Asked Questions\u003c\/h3\u003e\n\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is the 6-Piece Star Puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eThe 6-Piece Star Puzzle is a 3D-printed interlocking mechanical puzzle. You disassemble the star shape into 6 individual pieces and then reassemble it - no tools, no instructions, one correct solution.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow hard is the 6-Piece Star Puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eIt's rated Easy - one of the most approachable puzzles in the Greg Puzzles catalog. Most solvers crack it in 5-30 minutes, though first-timers often find reassembly trickier than expected.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs the 6-Piece Star Puzzle a good gift?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\n\u003cp\u003eYes. At Easy difficulty, it's one of the best entry-level mechanical puzzle gifts - compact, beautifully shaped, and satisfying for curious minds.\u003c\/p\u003e\n\u003cp\u003eThe 6-Piece Star is a \u003ca href=\"\/collections\/stewart-coffin\"\u003eStewart Coffin\u003c\/a\u003e classic, and one of the most recognisable shapes in mechanical puzzling.\u003c\/p\u003e\n\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Marble White","offer_id":46556039053479,"sku":"GP-6STAR-MARWHI","price":15.0,"currency_code":"USD","in_stock":true},{"title":"Oreo","offer_id":46556039086247,"sku":"GP-6STAR-ORE","price":17.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/6_piece_star_marble.png?v=1782038337"},{"product_id":"baby-puzzle","title":"Baby Puzzle | Easy 2-Piece Jigsaw","description":"\u003ch2\u003eQuick Summary\u003c\/h2\u003e\n\n\u003cp\u003eThe Baby Puzzle is a deceptively simple 2-piece jigsaw puzzle designed to challenge your spatial intuition. Your goal: pack both curved jigsaw pieces into the tray. It looks effortless - it isn't. Easy difficulty, 2 pieces, 5-30 min solve time. Designed by Katarn.\u003c\/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e first-time puzzle solvers, beginners, or anyone looking for a satisfying entry into mechanical puzzles or a playful gift.\u003c\/p\u003e\n\n\u003ch2\u003eOnly 2 Pieces. How Hard Can It Be?\u003c\/h2\u003e\n\n\u003cp\u003eThat's exactly what most people think. Then they spend ten minutes rotating the same piece in circles wondering what they're missing.\u003c\/p\u003e\n\n\u003cp\u003eThe Baby Puzzle uses two asymmetric jigsaw shapes that look like they should drop right in - but spatial intuition doesn't always agree with reality. Getting the orientation right requires a small but genuine mental shift. And when it clicks? That moment of discovery is genuinely rewarding.\u003c\/p\u003e\n\n\u003cp\u003eSimple goal, real challenge, satisfying solve.\u003c\/p\u003e\n\n\u003ch2\u003eWhat You'll Experience\u003c\/h2\u003e\n\n\u003cp\u003eThe pieces are 3D printed with a clean, tactile finish - solid in your hands, not flimsy. You'll feel the weight of a well-made object the moment you pick it up. As you work through the orientations, there's a growing sense that you're close - and then the two pieces settle flat into the tray with a satisfying click that makes the whole thing worth it.\u003c\/p\u003e\n\n\u003cp\u003eThat click is the payoff.\u003c\/p\u003e\n\n\u003cp\u003eIt sounds easy. The spatial challenge surprises most solvers. The simplicity is exactly what makes it work.\u003c\/p\u003e\n\n\u003ch2\u003eSpecs\u003c\/h2\u003e\n\n\u003cp\u003ePieces: 2 | Difficulty: Easy | Solve time: 5-30 minutes | 3D printed | Trains: Spatial Thinking | Size: Compact, travel-friendly | Ships assembled\u003c\/p\u003e\n\n\u003ch2\u003eFAQ\u003c\/h2\u003e\n\n\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs this a good starter puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eYes - it's our most beginner-friendly puzzle, ideal for someone trying a mechanical puzzle for the first time. The goal is simple and the solve is rewarding without being frustrating.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is the Baby Puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA 2-piece jigsaw puzzle where your goal is to pack both pieces flat into a small tray. Sounds easy - the spatial challenge surprises most solvers.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow long does it take to solve?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eMost first-time solvers crack it in 5-30 minutes, making it perfect for a quick puzzle fix or introducing someone new to mechanical puzzles.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\n\u003cdiv class=\"gpbb\" data-handle=\"baby-puzzle\"\u003e\n\u003cstyle\u003e\n.gpbb{--gpbb-fg:rgb(var(--color-foreground,18,18,18));\n --gpbb-line:rgba(var(--color-foreground,18,18,18),.18);\n --gpbb-muted:rgba(var(--color-foreground,18,18,18),.7);\n --gpbb-accent:#0B7FA8;\n font-family:inherit;color:var(--gpbb-fg);margin:1.2em 0;max-width:30em;outline:none}\n.gpbb:focus{outline:none}\n.gpbb:focus-visible{outline:none}\n\/* the ring shows for keyboard use only, never after a tap *\/\n.gpbb.gpbb-kbd:focus .gpbb-board svg{outline:2px solid var(--gpbb-accent);outline-offset:2px;border-radius:4px}\n.gpbb *{box-sizing:border-box}\n.gpbb .gpbb-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;margin:0 0 .3em;color:var(--gpbb-fg)}\n.gpbb .gpbb-intro{font-size:.92em;line-height:1.5;margin:0 0 .8em;color:var(--gpbb-muted);max-width:36em}\n.gpbb .gpbb-board{width:100%;max-width:24em;direction:ltr}\n.gpbb .gpbb-board svg{display:block;width:100%;height:auto;max-width:none;\n \/* a finger on the empty tray still scrolls the page; a finger on a piece drags it *\/\n touch-action:pan-y}\n.gpbb .gpbb-board,.gpbb .gpbb-ctl button{-webkit-tap-highlight-color:transparent;\n -webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n.gpbb .gpbb-ctl{display:flex;flex-wrap:wrap;gap:.45em;margin-top:.8em}\n.gpbb .gpbb-ctl button{appearance:none;-webkit-appearance:none;margin:0;border:1px solid var(--gpbb-line);\n background:transparent;color:var(--gpbb-fg);font-family:inherit;font-size:.85em;line-height:1.2;\n letter-spacing:normal;text-transform:none;min-height:2.9em;padding:.6em 1em;border-radius:6px;\n cursor:pointer;box-shadow:none}\n.gpbb .gpbb-ctl button:hover{border-color:var(--gpbb-accent)}\n.gpbb .gpbb-ctl button:disabled{opacity:.38;cursor:default}\n.gpbb .gpbb-ctl button:disabled:hover{border-color:var(--gpbb-line)}\n.gpbb .gpbb-say{font-size:.88em;line-height:1.45;color:var(--gpbb-muted);min-height:1.45em;margin:.7em 0 0}\n.gpbb .gpbb-stage{display:flex;flex-direction:column;align-items:flex-start}\n.gpbb .gpbb-rack{display:flex;flex-wrap:nowrap;gap:.6em;align-items:center;justify-content:flex-start;direction:ltr;\n width:100%;max-width:24em;min-height:3.4em;margin-top:.7em;padding:.5em;\n border:1px solid var(--gpbb-line);border-radius:7px;-webkit-tap-highlight-color:transparent;\n -webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n.gpbb .gpbb-rack svg{display:block;flex:none;width:calc(50% - .3em);height:auto;aspect-ratio:1 \/ 1;max-width:none;\n touch-action:none;cursor:grab;border-radius:4px}\n.gpbb .gpbb-rack svg[data-sel]{outline:2px solid var(--gpbb-accent);outline-offset:2px}\n.gpbb .gpbb-none{display:inline-block;min-height:1em}\n.gpbb .gpbb-best{font-size:.95em;line-height:1.45;font-weight:600;color:var(--gpbb-fg);margin:.3em 0 0}\n.gpbb .gpbb-end{font-size:1em;line-height:1.45;font-weight:600;color:var(--gpbb-accent);margin:.45em 0 0}\n.gpbb .gpbb-end[hidden]{display:none}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n\/* Greg Puzzles Baby Puzzle (.gpbb) - \"it won't go in\" teaser.\n   The real tray and the real pieces from the design files, in millimetres. A piece goes\n   into the tray from above, lands where it is dropped (a drop that misses a wall by a\n   hair is set flush against it), and turns only a quarter at a time. A drop is refused\n   if the piece would cross the tray wall or cover the other piece; pieces never slide\n   around inside the tray. The page carries shapes and nothing else: no positions, no\n   finish check, no network calls, and no finished state is ever shown.\n\n   Written to live inside a Shopify product description:\n   - every DOM node is made with createElement \/ createElementNS, so no closing tag ever\n     appears inside a JS string (Shopify reparses body_html);\n   - SVG attributes are set with setAttribute, so viewBox keeps its case;\n   - nothing relies on an empty div being visible (the theme hides div:empty);\n   - hit tests go through each SVG's own screen matrix. *\/\n(function () {\n  \"use strict\";\n  if (window.GPBB) return;\n\n  var NS = \"http:\/\/www.w3.org\/2000\/svg\";\n  var seq = 0;\n  var SNAP = 1.5;                 \/* mm: a drop this close to fitting against a wall lands flush *\/\n  var TOL = 0.05;                 \/* mm a piece may graze a wall (the printed corners differ by less) *\/\n  var PLAY_GAP_CAP = 12000;\n  var EFFORT_MS = 45000;\n  var EFFORT_OUTS = 3;\n\n  var TXT = {\n    en: {\n      title: \"Try it yourself\",\n      intro: \"Get both pieces into the tray. A piece goes in from above and turns only a quarter at a time. Tap a piece, then tap where it should drop. Dragging works too.\",\n      rotate: \"Rotate\", take: \"Take out\", empty: \"Empty the tray\", reset: \"Start over\",\n      best: \"Best so far: {n} of {m} in\",\n      end: \"Still won't fit? That's the puzzle.\",\n      nofit: \"That will not fit there.\",\n      noturn: \"No room to turn it there.\",\n      pick: \"Tap a piece first.\",\n      board: \"Puzzle tray\", rack: \"Pieces\"\n    },\n    he: {\n      title: \"נסו בעצמכם\",\n      intro: \"הכניסו את שני החלקים למגש. חלק נכנס מלמעלה ומסתובב רק רבע סיבוב בכל פעם. הקישו על חלק ואז על המקום שבו הוא צריך לנחות. אפשר גם לגרור.\",\n      rotate: \"סיבוב\", take: \"הוצאה\", empty: \"ריקון המגש\", reset: \"התחלה מחדש\",\n      best: \"השיא עד עכשיו: {n} מתוך {m} בפנים\",\n      end: \"עדיין לא נכנס? זה הפאזל.\",\n      nofit: \"זה לא נכנס שם.\",\n      noturn: \"אין שם מקום לסובב אותו.\",\n      pick: \"הקישו קודם על חלק.\",\n      board: \"מגש הפאזל\", rack: \"החלקים\"\n    },\n    ja: {\n      title: \"試してみてください\",\n      intro: \"2つのピースをトレイに入れてください。ピースは上から入れ、回転は90度ずつだけです。ピースをタップしてから、置きたい場所をタップします。ドラッグでも動かせます。\",\n      rotate: \"回転\", take: \"取り出す\", empty: \"トレイを空にする\", reset: \"最初から\",\n      best: \"これまでの最高：{m}個中{n}個が入りました\",\n      end: \"まだ入らない？それがこのパズルです。\",\n      nofit: \"そこには入りません。\",\n      noturn: \"そこでは回す余地がありません。\",\n      pick: \"先にピースをタップしてください。\",\n      board: \"パズルのトレイ\", rack: \"ピース\"\n    }\n  };\n\n  function langOf() {\n    var l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\n    if (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\n    if (l.indexOf(\"ja\") === 0) return \"ja\";\n    return \"en\";\n  }\n  function fmt(s, o) {\n    return s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n  }\n  function el(tag, cls, txt) {\n    var e = document.createElement(tag);\n    if (cls) e.className = cls;\n    if (txt != null) e.textContent = txt;\n    return e;\n  }\n  function sv(tag, attrs) {\n    var e = document.createElementNS(NS, tag);\n    for (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) e.setAttribute(k, attrs[k]);\n    return e;\n  }\n  function clear(node) { while (node.firstChild) node.removeChild(node.firstChild); }\n  function num(v) { return String(Math.round(v * 1000) \/ 1000); }\n\n  \/* ---------- shapes: points in mm, x right, y down, bounding box from 0, 0 ---------- *\/\n  function pairs(flat) {\n    var out = [];\n    for (var i = 0; i + 1 \u003c flat.length; i += 2) out.push([flat[i], flat[i + 1]]);\n    return out;\n  }\n  function box(pts) {\n    var w = 0, h = 0;\n    pts.forEach(function (p) { if (p[0] \u003e w) w = p[0]; if (p[1] \u003e h) h = p[1]; });\n    return [w, h];\n  }\n  \/* a quarter turn clockwise on screen, bounding box kept at 0, 0 *\/\n  function quarter(pts) {\n    var h = box(pts)[1];\n    return pts.map(function (p) { return [h - p[1], p[0]]; });\n  }\n  function pathOf(pts) {\n    var d = \"\";\n    pts.forEach(function (p, i) { d += (i ? \"L\" : \"M\") + num(p[0]) + \" \" + num(p[1]); });\n    return d + \"Z\";\n  }\n\n  \/* ---------- geometry tests ---------- *\/\n  function inCavity(pts, at, cav) {\n    var W = cav[0], H = cav[1], r = cav[2], e = TOL;\n    for (var i = 0; i \u003c pts.length; i++) {\n      var x = pts[i][0] + at[0], y = pts[i][1] + at[1];\n      if (x \u003c -e || y \u003c -e || x \u003e W + e || y \u003e H + e) return false;\n      var cx = x \u003c r ? r : (x \u003e W - r ? W - r : x), cy = y \u003c r ? r : (y \u003e H - r ? H - r : y);\n      var dx = x - cx, dy = y - cy;\n      if (dx * dx + dy * dy \u003e (r + e) * (r + e)) return false;\n    }\n    return true;\n  }\n  function inside(px, py, poly, at) {\n    var c = false;\n    for (var i = 0, j = poly.length - 1; i \u003c poly.length; j = i++) {\n      var xi = poly[i][0] + at[0], yi = poly[i][1] + at[1], xj = poly[j][0] + at[0], yj = poly[j][1] + at[1];\n      if ((yi \u003e py) !== (yj \u003e py) \u0026\u0026 px \u003c (xj - xi) * (py - yi) \/ (yj - yi) + xi) c = !c;\n    }\n    return c;\n  }\n  function cross(ax, ay, bx, by, cx, cy) { return (bx - ax) * (cy - ay) - (by - ay) * (cx - ax); }\n  \/* two outlines share area: an edge of one crosses an edge of the other, or one holds the\n     other's point. Touching edges do not count. *\/\n  function overlaps(A, a, B, b) {\n    var ba = box(A), bb = box(B), e = 1e-7;\n    if (a[0] + ba[0] \u003c= b[0] || b[0] + bb[0] \u003c= a[0] || a[1] + ba[1] \u003c= b[1] || b[1] + bb[1] \u003c= a[1]) return false;\n    for (var i = 0; i \u003c A.length; i++) {\n      var p1x = A[i][0] + a[0], p1y = A[i][1] + a[1];\n      var q = A[(i + 1) % A.length], p2x = q[0] + a[0], p2y = q[1] + a[1];\n      var minx = Math.min(p1x, p2x), maxx = Math.max(p1x, p2x), miny = Math.min(p1y, p2y), maxy = Math.max(p1y, p2y);\n      for (var j = 0; j \u003c B.length; j++) {\n        var r1x = B[j][0] + b[0], r1y = B[j][1] + b[1];\n        var s = B[(j + 1) % B.length], r2x = s[0] + b[0], r2y = s[1] + b[1];\n        if (Math.max(r1x, r2x) \u003c minx || Math.min(r1x, r2x) \u003e maxx ||\n            Math.max(r1y, r2y) \u003c miny || Math.min(r1y, r2y) \u003e maxy) continue;\n        var d1 = cross(p1x, p1y, p2x, p2y, r1x, r1y), d2 = cross(p1x, p1y, p2x, p2y, r2x, r2y);\n        var d3 = cross(r1x, r1y, r2x, r2y, p1x, p1y), d4 = cross(r1x, r1y, r2x, r2y, p2x, p2y);\n        if (((d1 \u003e e \u0026\u0026 d2 \u003c -e) || (d1 \u003c -e \u0026\u0026 d2 \u003e e)) \u0026\u0026 ((d3 \u003e e \u0026\u0026 d4 \u003c -e) || (d3 \u003c -e \u0026\u0026 d4 \u003e e))) return true;\n      }\n    }\n    \/* no crossing edges: one may sit wholly inside the other; test a point a hair inside *\/\n    function probe(P, p, Q, qq) {\n      for (var k = 0; k \u003c P.length; k++) {\n        var m = P[k], n = P[(k + 1) % P.length];\n        var mx = (m[0] + n[0]) \/ 2 + p[0], my = (m[1] + n[1]) \/ 2 + p[1];\n        if (inside(mx, my, Q, qq)) return true;\n      }\n      return false;\n    }\n    return probe(A, a, B, b) || probe(B, b, A, a);\n  }\n\n  \/* screen point -\u003e SVG user units, through the element's own matrix *\/\n  function toView(svgEl, x, y) {\n    var m = svgEl.getScreenCTM();\n    if (!m) return { x: NaN, y: NaN };\n    var inv = m.inverse(), q;\n    if (typeof DOMPoint === \"function\") q = new DOMPoint(x, y).matrixTransform(inv);\n    else { var pt = svgEl.createSVGPoint(); pt.x = x; pt.y = y; q = pt.matrixTransform(inv); }\n    return { x: q.x, y: q.y };\n  }\n\n  function mount(root, C) {\n    if (!root || root.getAttribute(\"data-gpbb-on\")) return;\n    root.setAttribute(\"data-gpbb-on\", \"1\");\n    var L = langOf(), t = TXT[L];\n    root.setAttribute(\"dir\", L === \"he\" ? \"rtl\" : \"ltr\");\n    root.setAttribute(\"lang\", L);\n    root.tabIndex = 0;\n\n    var CAV = C.cav, RIM = C.rim;\n    var uid = \"gpbb\" + (++seq) + Math.floor(Math.random() * 1e8).toString(36);\n    var pieces = C.pieces.map(function (flat, i) {\n      var turns = [pairs(flat)];\n      for (var k = 1; k \u003c 4; k++) turns.push(quarter(turns[k - 1]));\n      return { i: i, turns: turns, k: 0, at: null, wasIn: false };\n    });\n    function pts(p, k) { return p.turns[k == null ? p.k : k]; }\n    function size(p, k) { return box(pts(p, k)); }\n    var SIDE = 0;                      \/* the rack draws every piece in the same square *\/\n    pieces.forEach(function (p) { var b = size(p, 0); SIDE = Math.max(SIDE, b[0], b[1]); });\n\n    var sel = null, drag = null, tap = null, msg = \"\";\n    var best = 0, outs = 0, playMs = 0, lastAct = 0, endOn = false;\n\n    \/* ---------- rules ---------- *\/\n    function other(p) { return pieces[1 - p.i]; }\n    function fitsAt(p, k, at) {\n      if (!inCavity(pts(p, k), at, CAV)) return false;\n      var o = other(p);\n      return !(o.at \u0026\u0026 overlaps(pts(p, k), at, pts(o), o.at));\n    }\n    \/* where a drop lands: as dropped, or set flush against a wall it misses by under SNAP *\/\n    function landing(p, k, at) {\n      var b = size(p, k), x = at[0], y = at[1];\n      if (x \u003c 0 \u0026\u0026 x \u003e -SNAP) x = 0;\n      if (y \u003c 0 \u0026\u0026 y \u003e -SNAP) y = 0;\n      if (x + b[0] \u003e CAV[0] \u0026\u0026 x + b[0] \u003c CAV[0] + SNAP) x = CAV[0] - b[0];\n      if (y + b[1] \u003e CAV[1] \u0026\u0026 y + b[1] \u003c CAV[1] + SNAP) y = CAV[1] - b[1];\n      return [x, y];\n    }\n    function drop(p, k, at) {\n      var a = landing(p, k, at);\n      if (!fitsAt(p, k, a)) return false;\n      p.k = k;\n      p.at = a;\n      return true;\n    }\n\n    \/* ---------- effort and the best count ---------- *\/\n    function act() {\n      var now = Date.now();\n      if (lastAct) playMs += Math.min(Math.max(0, now - lastAct), PLAY_GAP_CAP);\n      lastAct = now;\n    }\n    function settle() {\n      var n = 0;\n      pieces.forEach(function (p) {\n        if (p.at) { n++; p.wasIn = true; }\n        else if (p.wasIn) { outs++; p.wasIn = false; }\n      });\n      if (n \u003e best) best = n;\n      if (!endOn \u0026\u0026 (outs \u003e= EFFORT_OUTS || playMs \u003e= EFFORT_MS)) endOn = true;\n      render();\n    }\n\n    \/* ---------- DOM ---------- *\/\n    root.appendChild(el(\"h3\", \"gpbb-h\", t.title));\n    root.appendChild(el(\"p\", \"gpbb-intro\", t.intro));\n    var stage = el(\"div\", \"gpbb-stage\");\n    var boardEl = el(\"div\", \"gpbb-board\");\n    boardEl.setAttribute(\"dir\", \"ltr\");\n    stage.appendChild(boardEl);\n    var rackEl = el(\"div\", \"gpbb-rack\");\n    rackEl.setAttribute(\"dir\", \"ltr\");\n    rackEl.setAttribute(\"role\", \"group\");\n    rackEl.setAttribute(\"aria-label\", t.rack);\n    stage.appendChild(rackEl);\n    root.appendChild(stage);\n    var ctl = el(\"div\", \"gpbb-ctl\");\n    function button(label, name) {\n      var b = el(\"button\", \"gpbb-btn\", label);\n      b.type = \"button\";\n      b.setAttribute(\"data-act\", name);\n      ctl.appendChild(b);\n      return b;\n    }\n    var bRot = button(t.rotate, \"rotate\"), bTake = button(t.take, \"take\"),\n        bEmpty = button(t.empty, \"empty\"), bReset = button(t.reset, \"reset\");\n    root.appendChild(ctl);\n    var sayEl = el(\"p\", \"gpbb-say\", \" \");\n    sayEl.setAttribute(\"aria-live\", \"polite\");\n    var bestEl = el(\"p\", \"gpbb-best\", \"\");\n    var endEl = el(\"p\", \"gpbb-end\", t.end);\n    endEl.hidden = true;\n    root.appendChild(sayEl);\n    root.appendChild(bestEl);\n    root.appendChild(endEl);\n\n    function defsFor(svg, id) {\n      var defs = sv(\"defs\", {});\n      var g = sv(\"linearGradient\", { id: id + \"w\", x1: \"0\", y1: \"0\", x2: \"0\", y2: \"1\" });\n      g.appendChild(sv(\"stop\", { offset: \"0\", \"stop-color\": \"#FFFFFF\" }));\n      g.appendChild(sv(\"stop\", { offset: \"1\", \"stop-color\": \"#E7E4DC\" }));\n      defs.appendChild(g);\n      \/* black specks like the printed filament *\/\n      var sp = sv(\"filter\", { id: id + \"sp\", x: \"0\", y: \"0\", width: \"100%\", height: \"100%\" });\n      sp.appendChild(sv(\"feTurbulence\", { type: \"fractalNoise\", baseFrequency: \"1.1\", numOctaves: \"1\", seed: \"11\" }));\n      sp.appendChild(sv(\"feColorMatrix\", { type: \"matrix\",\n        values: \"0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  9 0 0 0 -6.4\" }));\n      sp.appendChild(sv(\"feComponentTransfer\", {}));\n      sp.lastChild.appendChild(sv(\"feFuncA\", { type: \"discrete\", tableValues: \"0 .75\" }));\n      defs.appendChild(sp);\n      var soft = sv(\"filter\", { id: id + \"soft\", x: \"-20%\", y: \"-20%\", width: \"140%\", height: \"140%\" });\n      soft.appendChild(sv(\"feGaussianBlur\", { stdDeviation: \"0.35\" }));\n      defs.appendChild(soft);\n      var grain = sv(\"filter\", { id: id + \"grain\", x: \"0\", y: \"0\", width: \"100%\", height: \"100%\" });\n      grain.appendChild(sv(\"feTurbulence\", { type: \"fractalNoise\", baseFrequency: \"1.4\", numOctaves: \"2\", seed: \"4\" }));\n      grain.appendChild(sv(\"feColorMatrix\", { type: \"saturate\", values: \"0\" }));\n      var ct = sv(\"feComponentTransfer\", {});\n      ct.appendChild(sv(\"feFuncA\", { type: \"discrete\", tableValues: \"0 0 0 .35\" }));\n      grain.appendChild(ct);\n      defs.appendChild(grain);\n      svg.appendChild(defs);\n    }\n    var clipSeq = 0;\n    function pieceNode(p, id, k, at, opts) {\n      var g = sv(\"g\", { \"data-p\": String(p.i), style: \"cursor:grab;touch-action:none\",\n        transform: \"translate(\" + num(at[0]) + \",\" + num(at[1]) + \")\" });\n      g.setAttribute(\"data-at\", num(at[0]) + \",\" + num(at[1]));\n      g.setAttribute(\"data-k\", String(k));\n      if (opts.sel) g.setAttribute(\"data-sel\", \"1\");\n      if (opts.ghost) { g.setAttribute(\"data-ghost\", \"1\"); g.setAttribute(\"data-bad\", opts.bad ? \"1\" : \"0\"); g.setAttribute(\"pointer-events\", \"none\"); }\n      var d = pathOf(pts(p, k));\n      if (!opts.ghost) {\n        g.appendChild(sv(\"path\", { d: d, fill: \"rgba(10,40,48,.28)\", transform: \"translate(0.35,0.6)\",\n          filter: \"url(#\" + id + \"soft)\", \"pointer-events\": \"none\" }));\n      }\n      g.appendChild(sv(\"path\", { d: d, fill: \"url(#\" + id + \"w)\", \"fill-opacity\": opts.ghost ? \".7\" : \"1\",\n        stroke: opts.bad ? \"#C2544C\" : (opts.sel ? \"#0B5F80\" : \"rgba(30,30,30,.45)\"),\n        \"stroke-width\": opts.sel || opts.bad ? \".55\" : \".25\", \"stroke-linejoin\": \"round\" }));\n      if (!opts.ghost) {\n        var cid = id + \"c\" + (++clipSeq);\n        var clip = sv(\"clipPath\", { id: cid });\n        clip.appendChild(sv(\"path\", { d: d }));\n        g.appendChild(clip);\n        var b = size(p, k);\n        g.appendChild(sv(\"rect\", { x: \"0\", y: \"0\", width: num(b[0]), height: num(b[1]), fill: \"#2A2622\",\n          filter: \"url(#\" + id + \"sp)\", \"clip-path\": \"url(#\" + cid + \")\", \"pointer-events\": \"none\" }));\n      }\n      return g;\n    }\n\n    \/* ---------- the tray SVG ---------- *\/\n    var M = 1.2;\n    var vb = [-RIM - M, -RIM - M, CAV[0] + 2 * RIM + 2 * M, CAV[1] + 2 * RIM + 2 * M];\n    var svgEl = sv(\"svg\", { width: \"100%\", role: \"img\", \"aria-label\": t.board });\n    svgEl.setAttribute(\"viewBox\", vb.map(num).join(\" \"));\n    svgEl.style.aspectRatio = num(vb[2]) + \" \/ \" + num(vb[3]);\n    defsFor(svgEl, uid);\n    var trayG = sv(\"g\", { \"data-layer\": \"tray\" });\n    trayG.appendChild(sv(\"rect\", { x: num(-RIM + 0.4), y: num(-RIM + 0.9), width: num(CAV[0] + 2 * RIM - 0.8),\n      height: num(CAV[1] + 2 * RIM - 0.4), rx: \"1.6\", fill: \"rgba(8,60,70,.25)\", filter: \"url(#\" + uid + \"soft)\" }));\n    trayG.appendChild(sv(\"rect\", { x: num(-RIM), y: num(-RIM), width: num(CAV[0] + 2 * RIM), height: num(CAV[1] + 2 * RIM),\n      rx: \"1.4\", fill: \"#1FA3B5\" }));\n    trayG.appendChild(sv(\"rect\", { x: num(-RIM), y: num(-RIM), width: num(CAV[0] + 2 * RIM), height: num(CAV[1] + 2 * RIM),\n      rx: \"1.4\", fill: \"#FFFFFF\", \"fill-opacity\": \".5\", filter: \"url(#\" + uid + \"grain)\" }));\n    trayG.appendChild(sv(\"rect\", { x: \"-0.9\", y: \"-0.9\", width: num(CAV[0] + 1.8), height: num(CAV[1] + 1.8),\n      rx: num(CAV[2] + 0.9), fill: \"#178C9C\" }));\n    trayG.appendChild(sv(\"rect\", { x: \"0\", y: \"0\", width: num(CAV[0]), height: num(CAV[1]), rx: num(CAV[2]), fill: \"#3BB6C7\" }));\n    var stripes = \"\";\n    for (var sx = -CAV[1]; sx \u003c CAV[0]; sx += 1.6) {\n      stripes += \"M\" + num(Math.max(sx, 0)) + \" \" + num(sx \u003c 0 ? -sx : 0) + \"L\" +\n        num(Math.min(sx + CAV[1], CAV[0])) + \" \" + num(sx + CAV[1] \u003e CAV[0] ? CAV[0] - sx : CAV[1]);\n    }\n    var floorClip = sv(\"clipPath\", { id: uid + \"floor\" });\n    floorClip.appendChild(sv(\"rect\", { x: \"0\", y: \"0\", width: num(CAV[0]), height: num(CAV[1]), rx: num(CAV[2]) }));\n    trayG.appendChild(floorClip);\n    trayG.appendChild(sv(\"path\", { d: stripes, stroke: \"rgba(255,255,255,.13)\", \"stroke-width\": \".35\", fill: \"none\",\n      \"clip-path\": \"url(#\" + uid + \"floor)\" }));\n    trayG.appendChild(sv(\"rect\", { x: \"0\", y: \"0\", width: num(CAV[0]), height: num(CAV[1]), rx: num(CAV[2]), fill: \"none\",\n      stroke: \"rgba(6,50,60,.35)\", \"stroke-width\": \".3\" }));\n    svgEl.appendChild(trayG);\n    var pieceG = sv(\"g\", { \"data-layer\": \"pieces\" });\n    svgEl.appendChild(pieceG);\n    boardEl.appendChild(svgEl);\n\n    function drawPieces() {\n      clear(pieceG);\n      pieces.forEach(function (p) {\n        if (!p.at || (drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p)) return;\n        pieceG.appendChild(pieceNode(p, uid, p.k, p.at, { sel: sel === p }));\n      });\n      if (drag \u0026\u0026 drag.live \u0026\u0026 !drag.off) {\n        pieceG.appendChild(pieceNode(drag.p, uid, drag.p.k, drag.at, { ghost: true, bad: !drag.ok }));\n      }\n    }\n    function drawRack() {\n      clear(rackEl);\n      pieces.forEach(function (p) {\n        if (p.at) return;\n        var b = size(p), id = uid + \"r\" + p.i;\n        var s = sv(\"svg\", { \"data-p\": String(p.i), role: \"img\" });\n        s.setAttribute(\"viewBox\", num(-(SIDE - b[0]) \/ 2 - 0.8) + \" \" + num(-(SIDE - b[1]) \/ 2 - 0.8) + \" \" +\n          num(SIDE + 1.6) + \" \" + num(SIDE + 1.6));\n        if (sel === p) s.setAttribute(\"data-sel\", \"1\");\n        if (drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) s.style.opacity = \".35\";\n        defsFor(s, id);\n        s.appendChild(pieceNode(p, id, p.k, [0, 0], { sel: sel === p }));\n        rackEl.appendChild(s);\n      });\n      if (!rackEl.firstChild) rackEl.appendChild(el(\"span\", \"gpbb-none\", \" \"));\n    }\n    function render() {\n      drawPieces();\n      drawRack();\n      var had = document.activeElement;\n      bRot.disabled = !sel;\n      bTake.disabled = !(sel \u0026\u0026 sel.at);\n      bEmpty.disabled = !pieces.some(function (p) { return !!p.at; });\n      if (had \u0026\u0026 had.parentNode === ctl \u0026\u0026 had.disabled) focusRoot();\n      sayEl.textContent = msg || \" \";\n      bestEl.textContent = fmt(t.best, { n: best, m: pieces.length });\n      endEl.hidden = !endOn;\n    }\n\n    \/* ---------- input ---------- *\/\n    var lastPointer = 0;\n    function focusRoot() { try { root.focus({ preventScroll: true }); } catch (e) { \/* old browsers *\/ } }\n    root.addEventListener(\"pointerdown\", function () { lastPointer = Date.now(); root.classList.remove(\"gpbb-kbd\"); }, true);\n    root.addEventListener(\"focus\", function () { if (Date.now() - lastPointer \u003e 800) root.classList.add(\"gpbb-kbd\"); });\n    root.addEventListener(\"keydown\", function () { root.classList.add(\"gpbb-kbd\"); }, true);\n    function mm(ev) { var q = toView(svgEl, ev.clientX, ev.clientY); return [q.x, q.y]; }\n    function overBoard(ev) {\n      var b = svgEl.getBoundingClientRect();\n      return ev.clientX \u003e= b.left \u0026\u0026 ev.clientX \u003c= b.right \u0026\u0026 ev.clientY \u003e= b.top \u0026\u0026 ev.clientY \u003c= b.bottom;\n    }\n    function startDrag(p, ev, grab, fromRack) {\n      if (ev.cancelable) ev.preventDefault();\n      try { (fromRack ? rackEl : svgEl).setPointerCapture(ev.pointerId); } catch (e) { \/* synthetic pointer *\/ }\n      drag = { p: p, grab: grab, fromRack: fromRack, sx: ev.clientX, sy: ev.clientY, pid: ev.pointerId,\n        live: false, off: true, ok: false, at: null };\n      window.addEventListener(\"pointermove\", onMove);\n      window.addEventListener(\"pointerup\", onUp);\n      window.addEventListener(\"pointercancel\", onCancel);\n    }\n    function endListen() {\n      window.removeEventListener(\"pointermove\", onMove);\n      window.removeEventListener(\"pointerup\", onUp);\n      window.removeEventListener(\"pointercancel\", onCancel);\n    }\n    function lifted(p) { var keep = p.at; p.at = null; return keep; }\n    function onMove(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      if (!drag.live) {\n        if (Math.abs(ev.clientX - drag.sx) + Math.abs(ev.clientY - drag.sy) \u003c 6) return;\n        drag.live = true;\n        drag.from = lifted(drag.p);        \/* a piece in the tray is lifted out while it moves *\/\n        sel = drag.p;\n        msg = \"\";\n        drawRack();\n      }\n      if (!overBoard(ev)) { drag.off = true; drawPieces(); return; }\n      var q = mm(ev);\n      drag.off = false;\n      drag.at = landing(drag.p, drag.p.k, [q[0] - drag.grab[0], q[1] - drag.grab[1]]);\n      drag.ok = fitsAt(drag.p, drag.p.k, drag.at);\n      drawPieces();\n    }\n    function onUp(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      var d = drag;\n      drag = null;\n      act();\n      if (!d.live) {\n        if (d.fallTap) { boardTap(d.downAt); return; }\n        d.p.grab = d.grab;\n        sel = (sel === d.p) ? null : d.p;\n        msg = \"\";\n        settle();\n        return;\n      }\n      if (d.off) {\n        msg = \"\";                              \/* let go off the tray: back with the pieces *\/\n      } else if (d.ok) {\n        d.p.at = d.at;\n        msg = \"\";\n      } else {\n        d.p.at = d.from;                       \/* refused: it stays where it was *\/\n        msg = t.nofit;\n      }\n      d.p.grab = d.grab;\n      sel = d.p;\n      settle();\n    }\n    function onCancel(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      if (drag.live) drag.p.at = drag.from;\n      drag = null;\n      settle();\n    }\n    function boardTap(q) {\n      if (!sel) { msg = t.pick; render(); return; }\n      var g = sel.grab || [size(sel)[0] \/ 2, size(sel)[1] \/ 2];\n      var keep = lifted(sel);\n      if (drop(sel, sel.k, [q[0] - g[0], q[1] - g[1]])) msg = \"\";\n      else { sel.at = keep; msg = t.nofit; }\n      settle();\n    }\n\n    svgEl.addEventListener(\"pointerdown\", function (ev) {\n      if (ev.button \u003e 0) return;\n      act();\n      focusRoot();\n      var hit = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      var q = mm(ev);\n      if (hit \u0026\u0026 !hit.getAttribute(\"data-ghost\")) {\n        var p = pieces[+hit.getAttribute(\"data-p\")];\n        startDrag(p, ev, [q[0] - p.at[0], q[1] - p.at[1]], false);\n        \/* a piece from the rack in hand: a tap on a tray piece is an attempt to drop there *\/\n        drag.fallTap = !!sel \u0026\u0026 !sel.at \u0026\u0026 sel !== p;\n        drag.downAt = q;\n        return;\n      }\n      tap = { x: ev.clientX, y: ev.clientY, pid: ev.pointerId, q: q };\n    });\n    svgEl.addEventListener(\"pointerup\", function (ev) {\n      if (!tap || ev.pointerId !== tap.pid) return;\n      var t0 = tap;\n      tap = null;\n      if (Math.abs(ev.clientX - t0.x) + Math.abs(ev.clientY - t0.y) \u003e 10) return;\n      act();\n      boardTap(t0.q);\n    });\n    svgEl.addEventListener(\"pointercancel\", function () { tap = null; });\n    \/* a finger that lands on a piece drags it; anywhere else the page still scrolls *\/\n    svgEl.addEventListener(\"touchstart\", function (ev) {\n      var h = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      if (h \u0026\u0026 ev.cancelable) ev.preventDefault();\n    }, { passive: false });\n    rackEl.addEventListener(\"pointerdown\", function (ev) {\n      if (ev.button \u003e 0) return;\n      var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n      if (!s) return;\n      act();\n      focusRoot();\n      var p = pieces[+s.getAttribute(\"data-p\")];\n      var q = toView(s, ev.clientX, ev.clientY);\n      startDrag(p, ev, [q.x, q.y], true);\n    });\n    rackEl.addEventListener(\"touchstart\", function (ev) {\n      var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n      if (s \u0026\u0026 ev.cancelable) ev.preventDefault();\n    }, { passive: false });\n    document.addEventListener(\"touchmove\", function (ev) {\n      if (drag \u0026\u0026 ev.cancelable) ev.preventDefault();\n    }, { passive: false });\n\n    bRot.addEventListener(\"click\", function () {\n      act();\n      if (!sel) { msg = t.pick; render(); return; }\n      var k = (sel.k + 1) % 4;\n      sel.grab = null;\n      if (!sel.at) { sel.k = k; msg = \"\"; settle(); return; }\n      \/* in the tray: lifted, turned about its middle, dropped back *\/\n      var b0 = size(sel), b1 = size(sel, k);\n      var at = [sel.at[0] + (b0[0] - b1[0]) \/ 2, sel.at[1] + (b0[1] - b1[1]) \/ 2];\n      var keep = lifted(sel);\n      if (drop(sel, k, at)) msg = \"\";\n      else { sel.at = keep; msg = t.noturn; }\n      settle();\n    });\n    bTake.addEventListener(\"click\", function () {\n      act();\n      if (!sel || !sel.at) { render(); return; }\n      sel.at = null;\n      msg = \"\";\n      settle();\n    });\n    bEmpty.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) { p.at = null; });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n    bReset.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) { p.at = null; p.k = 0; p.grab = null; });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n\n    \n\n    settle();\n  }\n\n  window.GPBB = { mount: mount, v: 1 };\n})();\n(function(){var C={\"v\":1,\"cav\":[50.554,36.2,1.009],\"rim\":5.0,\"pieces\":[[0.0,1.0,0.0,6.74,0.03,7.22,0.14,7.69,0.3,8.13,0.53,8.55,0.67,8.75,0.98,9.11,1.34,9.42,1.74,9.68,2.18,9.88,2.64,10.01,2.87,10.06,3.35,10.09,8.69,10.09,9.33,10.13,9.97,10.23,10.59,10.4,10.89,10.51,11.48,10.78,12.03,11.11,12.55,11.5,12.79,11.71,13.23,12.17,13.63,12.68,13.8,12.95,14.11,13.52,14.36,14.12,14.45,14.42,14.6,15.05,14.68,15.69,14.69,16.01,14.66,16.65,14.62,16.97,14.57,17.29,14.41,17.91,14.3,18.22,14.04,18.81,13.72,19.37,13.53,19.63,13.34,19.89,12.9,20.36,12.42,20.79,12.16,20.98,11.9,21.16,11.33,21.48,11.04,21.61,10.44,21.83,10.13,21.92,9.49,22.04,9.17,22.07,8.53,22.09,8.21,22.07,7.57,21.99,6.94,21.83,6.34,21.61,5.76,21.33,5.48,21.16,5.22,20.98,4.71,20.58,4.11,19.99,3.79,19.74,3.62,19.63,3.25,19.47,2.86,19.37,2.45,19.33,2.25,19.34,2.05,19.36,1.66,19.46,1.29,19.62,1.11,19.73,0.79,19.97,0.52,20.27,0.4,20.44,0.21,20.79,0.08,21.17,0.01,21.57,0.0,21.78,0.0,29.0,0.03,29.26,0.13,29.5,0.29,29.71,0.5,29.87,0.74,29.97,1.0,30.0,19.0,30.0,19.26,29.97,19.5,29.87,19.71,29.71,19.87,29.5,19.92,29.38,19.99,29.13,20.01,23.22,20.08,22.88,20.21,22.57,20.4,22.28,20.64,22.04,20.93,21.85,21.25,21.72,21.59,21.66,21.93,21.66,22.27,21.73,22.43,21.79,23.19,22.16,23.82,22.39,24.15,22.49,24.81,22.61,25.48,22.68,26.15,22.67,26.82,22.59,27.15,22.52,27.8,22.34,28.43,22.09,29.03,21.78,29.59,21.41,30.11,20.98,30.58,20.5,31.0,19.97,31.37,19.41,31.67,18.81,31.91,18.18,32.01,17.85,32.09,17.52,32.19,16.86,32.23,16.19,32.22,15.85,32.15,15.18,32.09,14.85,31.91,14.19,31.68,13.56,31.53,13.26,31.2,12.67,30.81,12.13,30.59,11.87,30.36,11.62,29.86,11.17,29.6,10.96,29.03,10.59,28.74,10.42,28.13,10.14,27.49,9.92,26.83,9.77,26.5,9.73,25.83,9.68,25.49,9.68,24.55,9.77,24.02,9.78,23.48,9.72,23.22,9.66,22.71,9.5,22.22,9.28,21.99,9.15,21.56,8.84,21.16,8.47,20.82,8.06,20.67,7.84,20.41,7.37,20.21,6.88,20.08,6.36,20.01,5.83,20.0,5.56,19.99,0.87,19.92,0.62,19.87,0.5,19.71,0.29,19.5,0.13,19.26,0.03,19.0,0.0,1.0,0.0,0.87,0.01,0.62,0.08,0.5,0.13,0.29,0.29,0.13,0.5,0.08,0.62,0.03,0.74],[20.01,24.51,19.99,29.13,19.92,29.38,19.87,29.5,19.71,29.71,19.5,29.87,19.26,29.97,19.0,30.0,1.0,30.0,0.74,29.97,0.5,29.87,0.29,29.71,0.21,29.61,0.08,29.38,0.01,29.13,0.0,29.0,0.01,21.57,0.08,21.17,0.21,20.79,0.4,20.44,0.65,20.12,0.79,19.97,1.11,19.73,1.29,19.62,1.66,19.46,2.05,19.36,2.25,19.34,2.45,19.33,2.86,19.37,3.25,19.47,3.62,19.63,3.79,19.74,4.11,19.99,4.71,20.58,5.22,20.98,5.48,21.16,6.05,21.48,6.34,21.61,6.94,21.83,7.57,21.99,8.21,22.07,8.53,22.09,9.17,22.07,9.49,22.04,10.13,21.92,10.44,21.83,11.04,21.61,11.33,21.48,11.62,21.33,12.16,20.98,12.42,20.79,12.9,20.36,13.34,19.89,13.53,19.63,13.72,19.37,14.04,18.81,14.18,18.52,14.41,17.91,14.5,17.61,14.62,16.97,14.66,16.65,14.69,16.01,14.65,15.37,14.6,15.05,14.45,14.42,14.24,13.81,13.96,13.23,13.8,12.95,13.63,12.68,13.23,12.17,12.79,11.71,12.55,11.5,12.03,11.11,11.76,10.94,11.19,10.64,10.59,10.4,10.28,10.31,9.97,10.23,9.33,10.13,8.69,10.09,1.36,10.09,1.21,10.08,0.91,10.02,0.64,9.88,0.4,9.69,0.21,9.46,0.13,9.32,0.03,9.03,0.0,8.73,0.0,1.0,0.03,0.74,0.13,0.5,0.29,0.29,0.39,0.21,0.62,0.08,0.87,0.01,1.0,0.0,19.0,0.0,19.13,0.01,19.38,0.08,19.61,0.21,19.79,0.39,19.92,0.62,19.99,0.87,20.01,8.43,20.07,8.8,20.2,9.16,20.39,9.49,20.63,9.78,20.92,10.02,21.08,10.13,21.42,10.29,21.78,10.39,22.16,10.43,22.35,10.43,22.72,10.37,23.71,10.0,24.03,9.9,24.69,9.76,25.02,9.72,25.69,9.68,26.03,9.69,26.36,9.71,27.03,9.81,27.68,9.98,28.0,10.09,28.62,10.36,29.2,10.69,29.75,11.08,30.01,11.29,30.49,11.76,30.71,12.01,30.92,12.28,31.3,12.83,31.61,13.43,31.87,14.05,31.97,14.37,32.12,15.02,32.21,15.69,32.22,16.36,32.17,17.03,32.12,17.37,31.96,18.02,31.74,18.65,31.45,19.26,31.28,19.55,30.9,20.11,30.69,20.37,30.47,20.62,29.99,21.09,29.46,21.5,29.18,21.69,28.89,21.86,28.28,22.16,27.65,22.39,27.33,22.48,26.67,22.61,26.0,22.67,25.33,22.67,22.16,22.48,21.78,22.52,21.42,22.63,21.08,22.8,20.92,22.9,20.77,23.02,20.5,23.29,20.29,23.61,20.2,23.78,20.07,24.13]]};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gpbb \")\u003c0)r=document.querySelector(\".gpbb:not([data-gpbb-on])\");if(r\u0026\u0026window.GPBB)window.GPBB.mount(r,C);})();\n\u003c\/script\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":46738701811879,"sku":"GP-BABY","price":12.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/baby_puzzle_marble.png?v=1781972086"},{"product_id":"three-piece-block-puzzle","title":"Three-Piece Block | Geometric Conundrum","description":"\u003cp\u003e\u003cstrong\u003eQuick Summary:\u003c\/strong\u003e The Three-Piece Block is a geometric assembly puzzle designed by legendary puzzle designer \u003ca href=\"\/collections\/stewart-coffin\"\u003eStewart Coffin\u003c\/a\u003e. Your goal: arrange 3 interlocking solid-cube pieces into a perfect pyramid. Sounds simple - it isn't. Medium difficulty, 3 pieces, 30-60 min solve time. Best for adults and teens who enjoy spatial reasoning and satisfying aha-moment solves.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e adults and older teens who enjoy spatial puzzles, desk challenges, and elegant designs with a surprising level of depth.\u003c\/p\u003e\u003ch2\u003eWhat Makes This Puzzle Special\u003c\/h2\u003e\u003cp\u003eEach of the 3 pieces is built from solid cubes joined at different angles. That single design choice makes the pyramid assembly far less obvious than it looks. You can hold all 3 pieces in your hand, understand the goal completely, and still spend an hour figuring out exactly how they lock together.\u003c\/p\u003e\u003cp\u003eThe construction is solid and tactile - 3D-printed with clean edges and a satisfying weight. The geometric shapes look sharp sitting on a desk, so it works just as well as a display object as it does a brain teaser. Pick it up, solve it, set it back down. It holds its own either way.\u003c\/p\u003e\u003cp\u003eStewart Coffin is one of the most respected names in mechanical puzzle design. He spent decades creating puzzles with elegant constraints and surprising depth. The Three-Piece Block is a perfect example of his approach: minimal pieces, maximum challenge.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow hard is the Three-Piece Block puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eMedium difficulty. Most solvers spend 30-60 minutes on their first attempt. The challenge lies in orienting 3 geometrically distinct pieces so they lock into a stable pyramid. It is not a brute-force puzzle - orientation matters more than you expect.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow many pieces does the Three-Piece Block have?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003e3 pieces, each made from solid cubes joined in different configurations. The differences between them are subtle enough to make the assembly genuinely tricky.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho is the Three-Piece Block puzzle good for?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eGreat for adults, teens, and anyone who enjoys spatial reasoning puzzles. It also makes a stylish desk object between solves. If you like puzzles that reward patience and spatial thinking over trial and error, this one is for you.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":46738790252711,"sku":"GP-THREBLOC","price":11.25,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/three_piece_block_marble.png?v=1781971412"},{"product_id":"infinity-chocolate","title":"Infinity Chocolate ∞ | Geometric Dissection Illusion","description":"\u003ch2\u003eWhat Is the Infinity Chocolate Trick?\u003c\/h2\u003e\u003cp\u003eThe Infinity Chocolate puzzle is a physical mechanical puzzle based on a geometric dissection illusion. By rearranging the pieces in a specific sequence, one chocolate square appears to be created from nothing - a tactile demonstration of how area can seem to vanish and reappear through careful geometric cuts. It's a repeatable, hands-on way to experience one of math's most mind-bending concepts without a single equation.\u003c\/p\u003e\u003ch2\u003eHow To Use It\u003c\/h2\u003e\u003cp\u003eHand it to a friend. Let them count the squares. Then perform the move sequence - and watch their face.\u003c\/p\u003e\u003cp\u003eThat's really it. No setup. No explanation needed. No sleight of hand. The puzzle does the work. One moment the bar is whole. The next, there's an extra square sitting right there, impossible to explain. They'll count again. They'll check your hands. They'll ask you to do it again.\u003c\/p\u003e\u003cp\u003eOnce you learn the sequence - and it doesn't take long - you can pull this out anywhere. At a dinner table, a classroom, a party. It works every single time.\u003c\/p\u003e\u003ch2\u003eWho Is This For?\u003c\/h2\u003e\u003cp\u003e\u003cstrong\u003eParty hosts\u003c\/strong\u003e who want one conversation piece that actually delivers.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eTeachers\u003c\/strong\u003e looking for a tactile way to introduce geometry, dissection puzzles, or mathematical paradoxes to students who'd rather touch something than stare at a whiteboard.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eGift-givers\u003c\/strong\u003e who are tired of giving things people forget. This one gets remembered.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003ePuzzle lovers\u003c\/strong\u003e who enjoy the sharing side of puzzles just as much as the solving side.\u003c\/p\u003e\u003ch2\u003eFAQ\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs this a magic trick or a puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eBoth. It's a mechanical puzzle that functions as a repeatable party trick. The \"magic\" is pure geometry.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs it made of real chocolate?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo - it's 3D-printed to look exactly like a chocolate bar. Lasts forever. Zero calories.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow difficult is it to perform?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eThe move sequence is simple once learned. Most people have it down in a few minutes. After that, you can do it in seconds.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":46754795847847,"sku":"GP-INFICHOC","price":18.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/infinity_chocolate_marble.png?v=1782150398"},{"product_id":"spiral-cone-fidget-toy","title":"Spiral Cone Fidget Toy","description":"\u003cp\u003e\u003cstrong\u003eQuick answer:\u003c\/strong\u003e The Spiral Cone Fidget Toy is a 110mm 3D-printed fidget object with a smooth, continuous spiral motion. Designed for desk use, anxiety relief, and ADHD focus support, it's a silent, tactile alternative to fidget spinners and click pens. No batteries. No noise. Just motion.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e desk workers, students, and adults managing anxiety or ADHD who want a calming, silent, hands-on fidget tool with real desk presence.\u003c\/p\u003e\n\u003cp\u003eWatch the spiral cone swivel smoothly from top to bottom - a mesmerizing motion you'll reach for again and again. Looks impossible at first. Then you do it once, and you just keep going.\u003c\/p\u003e\u003cp\u003eThis is for the person who needs something to do with their hands. The desk worker who's been staring at screens all day. Someone managing anxiety or ADHD who wants a calming, tactile outlet that actually works. Or honestly - it makes a genuinely unique gift for anyone who appreciates something a little different.\u003c\/p\u003e\u003cp\u003eIt's jumbo-sized - 110mm tall, 80mm diameter - so it has a real satisfying weight and presence to it. 3D printed, with that smooth mechanical action that just feels right.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eCalming repetitive motion.\u003c\/strong\u003e There's something about the spiral swivel - top to bottom, over and over - that just settles your nervous system. Hard to explain until you try it.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eSatisfying mechanical action.\u003c\/strong\u003e It's not a spinner or a clicker. The motion is deliberate and smooth. Every swivel feels earned.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eScreen-free engagement.\u003c\/strong\u003e Keeps your hands busy without pulling you into a phone or a feed. That alone is worth something.\u003c\/p\u003e\u003cp\u003eThe Spiral Cone Fidget Toy Jumbo is a 110mm 3D-printed fidget device with a mesmerizing spiral swivel motion - designed for calm, tactile, screen-free stress relief.\u003c\/p\u003e\n\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\n\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is the Spiral Cone Fidget Toy?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eThe Spiral Cone Fidget Toy is a 110mm 3D-printed fidget object with a mesmerizing spiral motion - the cone slides smoothly from top to bottom in a continuous loop. Silent, satisfying, and screen-free. Designed for tactile stress relief and calm hand engagement.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs the Spiral Cone good for anxiety or ADHD?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eYes. The continuous, repetitive spiral motion provides a predictable tactile loop that many users find grounding during high-focus or high-stress tasks. It's silent, which makes it office- and classroom-safe.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow is this different from a fidget spinner?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eUnlike a fidget spinner, the Spiral Cone uses a linear spiral motion - the cone slides smoothly from top to bottom in a continuous loop, rather than rotating in place. The motion is slower, more deliberate, and more visually calming.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":46754832973991,"sku":"GP-SPIRCONE","price":15.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/spiral_cone_marble.png?v=1782131220"},{"product_id":"tower-of-hanoi-puzzle","title":"Tower of Hanoi | Travel Puzzle","description":"\u003cp\u003eTower Of Hanoi is a classic mechanical puzzle invented back in 1883 in france by the mathematician Edouard Lucas.\u003c\/p\u003e\n\u003cp\u003eThe idea originated from a legend of about a Hindu temple where priests are transferring 64 golden disks, a task that would take 585 billion years to complete at a pace of one move per second! Coincidentally, 585 billion years is 42 times the current estimiate age of our universe, according to science.\u003c\/p\u003e\n\u003cp\u003eThe goal of the puzzle is to move the whole stack of disks from one rod to another, with 3 rules:\u003c\/p\u003e\n\u003col\u003e\n\u003cli\u003eOnly one disk can move at a time\u003c\/li\u003e\n\u003cli\u003eEach move consists of taking a disk and moving it to another rod or stack\u003c\/li\u003e\n\u003cli\u003e\nA disk can only be placed on top of an empty rod or a bigger disk.\n\u003c\/li\u003e\n\u003c\/ol\u003e\n\u003cp\u003eOur version comes with 7 disks, so once you understand how it works, it can totally be conquered. \u003c\/p\u003e\n\u003cp\u003eAlso, the rods are detachable, which allows for an easy travel mode.\u003c\/p\u003e\n\u003cp\u003eThis puzzle greatly develops mind-muscle connection, mathematical and logical thinking as well as perseverance for boys. Don't worry - it is also a fun challenge for adults. You really can't go wrong with this puzzle as a gift! \u003c\/p\u003e\n\u003cp\u003eSize: 150 x 52 x 42 mm\u003c\/p\u003e\u003cdiv class=\"gphe\" id=\"gpheRoot\"\u003e\n\u003ch3\u003ePlay the Tower of Hanoi\u003c\/h3\u003e\n\u003cp class=\"gphe-sub\"\u003eThe one in the photographs is this puzzle in 3D printed plastic. This is the same puzzle on screen, so you can see what you would be getting before you buy it.\u003c\/p\u003e\n\u003cdiv class=\"gphe-bar\"\u003e\n\u003cspan class=\"gphe-lab\"\u003eDiscs\u003c\/span\u003e\u003cbutton type=\"button\" data-n=\"3\" aria-pressed=\"true\"\u003e3\u003c\/button\u003e\u003cbutton type=\"button\" data-n=\"4\" aria-pressed=\"false\"\u003e4\u003c\/button\u003e\u003cbutton type=\"button\" data-n=\"5\" aria-pressed=\"false\"\u003e5\u003c\/button\u003e\u003cbutton type=\"button\" data-n=\"6\" aria-pressed=\"false\"\u003e6\u003c\/button\u003e\u003cbutton type=\"button\" data-n=\"7\" aria-pressed=\"false\"\u003e7\u003c\/button\u003e\u003cbutton type=\"button\" data-act=\"reset\"\u003eStart over\u003c\/button\u003e\n\u003c\/div\u003e\n\u003csvg id=\"gpheBoard\" class=\"gphe-board\" viewbox=\"0 0 300 90\"\u003e\u003c\/svg\u003e\u003cdiv class=\"gphe-score\"\u003e\n\u003cdiv\u003e\n\u003cb id=\"gpheMoves\"\u003e0\u003c\/b\u003e\u003cspan\u003eyour moves\u003c\/span\u003e\n\u003c\/div\u003e\n\u003cdiv\u003e\n\u003cb id=\"gpheMin\"\u003e7\u003c\/b\u003e\u003cspan\u003ethe fewest possible\u003c\/span\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cp class=\"gphe-say\" id=\"gpheSay\"\u003e\u003c\/p\u003e\n\u003cp class=\"gphe-foot\"\u003eA new one to play every day is on the \u003ca href=\"https:\/\/gregpuzzles.com\/pages\/daily-tower-of-hanoi\"\u003eDaily Tower of Hanoi\u003c\/a\u003e.\u003c\/p\u003e\n\u003cstyle\u003e\n\/* Sizes are em, never rem: this theme sets the root font to 10px, so rem put\n   the heading at 11px against the article's 16px body. em inherits whatever\n   the surrounding page is using, which is what a block dropped into someone\n   else's template wants. font-family is inherited for the same reason - left\n   alone, the heading fell back to Helvetica beside the theme's Nunito. *\/\n.gphe{--a:#02A9F7;--marble:#F4F3EF;\n --fg:rgb(var(--color-foreground,18,18,18));\n --line:rgba(var(--color-foreground,18,18,18),.14);\n --muted:rgba(var(--color-foreground,18,18,18),.62);\n font-family:inherit;border:1px solid var(--line);border-radius:14px;\n padding:1.1em 1.2em 1em;margin:2em 0;background:var(--marble);color:var(--fg)}\n.gphe *{box-sizing:border-box;font-family:inherit}\n.gphe h3{margin:0 0 .2em;font-size:1.25em;line-height:1.25;font-weight:600;letter-spacing:0}\n.gphe .gphe-sub{margin:0 0 .9em;color:var(--muted);font-size:.95em;line-height:1.55}\n.gphe .gphe-bar{display:flex;flex-wrap:wrap;gap:.4em;align-items:center;margin-bottom:.8em}\n.gphe .gphe-bar span.gphe-lab{color:var(--muted);font-size:.9em;margin-right:.2em}\n.gphe button{font:inherit;font-size:.95em;color:var(--fg);background:#fff;\n border:1px solid var(--line);border-radius:8px;padding:.3em .7em;cursor:pointer;line-height:1.3}\n.gphe button:hover{border-color:var(--a)}\n.gphe button[aria-pressed=\"true\"]{background:var(--a);border-color:var(--a);color:#fff}\n.gphe button:focus-visible{outline:2px solid var(--a);outline-offset:2px}\n.gphe .gphe-board{background:#fff;border:1px solid var(--line);border-radius:10px;\n touch-action:none;width:100%;max-width:440px;margin:0 auto;display:block}\n.gphe .gphe-score{display:flex;gap:1.6em;margin:.9em 0 .2em;flex-wrap:wrap}\n.gphe .gphe-score div{display:flex;flex-direction:column;line-height:1.2}\n.gphe .gphe-score b{font-size:1.3em;font-weight:600;font-variant-numeric:tabular-nums}\n.gphe .gphe-score span{color:var(--muted);font-size:.85em}\n.gphe .gphe-say{min-height:1.6em;margin:.5em 0 0;font-size:.98em;line-height:1.5}\n.gphe .gphe-say b{color:var(--a)}\n.gphe .gphe-foot{margin:.8em 0 0;font-size:.95em;line-height:1.6;color:var(--muted)}\n.gphe .gphe-foot a{color:var(--a)}\n@media(max-width:480px){.gphe{padding:.9em .85em}.gphe .gphe-score{gap:1.1em}}\n\u003c\/style\u003e\n\u003cscript\u003e\n(function(){\n  var root = document.getElementById('gpheRoot');\n  if(!root || root.dataset.ready) return;\n  root.dataset.ready = '1';\n  var svg = document.getElementById('gpheBoard');\n  var elMoves = document.getElementById('gpheMoves');\n  var elMin = document.getElementById('gpheMin');\n  var elSay = document.getElementById('gpheSay');\n  var W = 300, PEG = [50,150,250], DH = 14, NARROW = 34, STEP = 10, TOP = 26;\n  var n = 3, pegs, moves, lifted, won;\n  \/\/ the board grows with the stack, so three discs do not sit in a tall empty frame\n  function base(){ return TOP + n*DH + 10; }\n  function height(){ return base() + 12; }\n\n  function reset(k){\n    n = k || n; pegs = [[],[],[]]; moves = 0; lifted = null; won = false;\n    for(var d=n; d\u003e=1; d--) pegs[0].push(d);\n    elMin.textContent = Math.pow(2,n)-1;\n    say('Move the whole stack to the right hand peg.');\n    paint();\n  }\n  function say(h){ elSay.innerHTML = h; }\n  function top(p){ return pegs[p].length ? pegs[p][pegs[p].length-1] : 0; }\n\n  function paint(){\n    var BASE = base(), H = height();\n    var s = ['\u003csvg id=\"gpheBoard\" class=\"gphe-board\" viewBox=\"0 0 '+W+' '+H+\n             '\" role=\"img\" aria-label=\"Tower of Hanoi board\"\u003e'];\n    s.push('\u003cdefs\u003e\u003clinearGradient id=\"gpheG\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"\u003e'+\n           '\u003cstop offset=\"0\" stop-color=\"#5CCCFB\"\/\u003e\u003cstop offset=\"1\" stop-color=\"#0190D4\"\/\u003e'+\n           '\u003c\/linearGradient\u003e\u003c\/defs\u003e');\n    s.push('\u003crect x=\"10\" y=\"'+BASE+'\" width=\"'+(W-20)+'\" height=\"7\" rx=\"3.5\" fill=\"#CFC9BC\"\/\u003e');\n    for(var p=0;p\u003c3;p++){\n      var ptop = BASE - n*DH - 8;\n      s.push('\u003crect x=\"'+(PEG[p]-2.5)+'\" y=\"'+ptop+'\" width=\"5\" height=\"'+(BASE-ptop)+\n             '\" rx=\"2.5\" fill=\"#D9D5CB\"\/\u003e');\n      \/\/ a wide invisible target, so a peg is easy to hit on a phone\n      s.push('\u003crect class=\"gphe-hit\" data-p=\"'+p+'\" x=\"'+(PEG[p]-48)+'\" y=\"0\" width=\"96\" height=\"'+\n             (BASE+6)+'\" fill=\"transparent\"\/\u003e');\n      for(var i=0;i\u003cpegs[p].length;i++){\n        var d = pegs[p][i], w = NARROW + (d-1)*STEP;\n        var y = BASE - (i+1)*DH;\n        s.push('\u003crect x=\"'+(PEG[p]-w\/2)+'\" y=\"'+y+'\" width=\"'+w+'\" height=\"'+(DH-3)+\n               '\" rx=\"5\" fill=\"url(#gpheG)\" stroke=\"rgba(0,0,0,.14)\" stroke-width=\"0.6\"'+\n               ' opacity=\"'+(lifted===p\u0026\u0026i===pegs[p].length-1?'.3':'1')+'\"\/\u003e');\n      }\n      if(lifted===p){\n        var d2 = top(p), w2 = NARROW + (d2-1)*STEP;\n        s.push('\u003crect x=\"'+(PEG[p]-w2\/2)+'\" y=\"4\" width=\"'+w2+'\" height=\"'+(DH-3)+\n               '\" rx=\"5\" fill=\"url(#gpheG)\" stroke=\"rgba(0,0,0,.14)\" stroke-width=\"0.6\"\/\u003e');\n      }\n    }\n    s.push('\u003c\/svg\u003e');\n    svg.outerHTML = s.join('');\n    svg = document.getElementById('gpheBoard');\n    elMoves.textContent = moves;\n    wire();\n  }\n\n  function tap(p){\n    if(won) return;\n    if(lifted === null){\n      if(!pegs[p].length){ say('That peg is empty. Lift a disc first.'); return; }\n      lifted = p; say('Now tap the peg to put it on.'); paint(); return;\n    }\n    if(lifted === p){ lifted = null; say('Put back. Lift any disc to start again.'); paint(); return; }\n    var d = top(lifted), t = top(p);\n    if(t \u0026\u0026 t \u003c d){\n      say('A disc may never sit on a smaller one.');\n      lifted = null; paint(); return;\n    }\n    pegs[lifted].pop(); pegs[p].push(d); moves++; lifted = null;\n    if(pegs[2].length === n){\n      won = true;\n      var best = Math.pow(2,n)-1;\n      say(moves === best\n          ? '\u003cb\u003eSolved in '+moves+' moves, the fewest possible.\u003c\/b\u003e'\n          : '\u003cb\u003eSolved in '+moves+' moves.\u003c\/b\u003e The fewest possible is '+best+'.');\n    } else {\n      say('');\n    }\n    paint();\n  }\n\n  function pegFromPoint(x){\n    \/\/ derive from the live box and the viewBox, never from restated numbers\n    var r = svg.getBoundingClientRect();\n    var vx = (x - r.left) \/ r.width * W;\n    var bestP = 0, bestD = 1e9;\n    for(var p=0;p\u003c3;p++){ var d = Math.abs(vx - PEG[p]); if(d \u003c bestD){ bestD = d; bestP = p; } }\n    return bestP;\n  }\n\n  function wire(){\n    svg.addEventListener('pointerdown', function(e){\n      e.preventDefault();\n      tap(pegFromPoint(e.clientX));\n    });\n  }\n\n  root.addEventListener('click', function(e){\n    var b = e.target.closest('button[data-n]');\n    if(!b) return;\n    var k = +b.dataset.n;\n    root.querySelectorAll('button[data-n]').forEach(function(x){\n      x.setAttribute('aria-pressed', (+x.dataset.n === k) ? 'true' : 'false');\n    });\n    reset(k);\n  });\n  root.querySelector('[data-act=\"reset\"]').addEventListener('click', function(){ reset(); });\n  document.addEventListener('keydown', function(e){\n    if(e.key !== '1' \u0026\u0026 e.key !== '2' \u0026\u0026 e.key !== '3') return;\n    var r = root.getBoundingClientRect();\n    if(r.bottom \u003c 0 || r.top \u003e innerHeight) return;   \/\/ only when it is on screen\n    tap(+e.key - 1);\n  });\n\n  reset(3);\n})();\n\u003c\/script\u003e\n\u003c\/div\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":47103748800679,"sku":"GP-TOWEHANO","price":18.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/tower_of_hanoi_marble.png?v=1782070667"},{"product_id":"jigsaw-traffic-puzzle","title":"Jigsaw Traffic Puzzle | Pack 4 Jigsaw Pieces","description":"\u003ch2\u003ePack 4 Jigsaw Pieces Into a Frame That Fights Back\u003c\/h2\u003e\u003cp\u003eJigsaw Traffic is a 3D-printed plastic packing puzzle by designer \u003ca href=\"\/collections\/samuel-cook\"\u003eSamuel Cook\u003c\/a\u003e. The goal is simple to state: fit 4 jigsaw-shaped pieces inside a restricted frame. Getting there is another story.\u003c\/p\u003e\u003cp\u003eThe frame has a designated entrance and internal cutouts. Neither can be used in the final position of the pieces. There are guide lines etched inside the frame to show you the target space - but knowing where the pieces need to end up and actually getting them there are two very different problems.\u003c\/p\u003e\u003cp\u003eRotations are allowed. That sounds like a relief. It is not.\u003c\/p\u003e\u003ch2\u003eQuick Summary\u003c\/h2\u003e\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003eType:\u003c\/strong\u003e Packing puzzle\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003ePieces:\u003c\/strong\u003e 4 jigsaw-shaped pieces + restricted frame\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eMaterial:\u003c\/strong\u003e 3D-printed plastic\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eKey rule:\u003c\/strong\u003e Entrance and cutouts are off-limits for the final orientation\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eRotations:\u003c\/strong\u003e Allowed\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSize:\u003c\/strong\u003e 90mm x 90mm x 11mm\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eDesigner:\u003c\/strong\u003e Samuel Cook\u003c\/li\u003e\n\u003c\/ul\u003e\u003ch2\u003eThe Mechanic\u003c\/h2\u003e\u003cp\u003eThe jigsaw piece shape is not decorative. It creates interlocking protrusions and recesses that interact with the frame in ways a simple rectangle never would. Every piece you place shifts your options for the next. The entrance and cutout restrictions eliminate the obvious approaches early, which means you are solving a geometry problem with fewer degrees of freedom than you expect.\u003c\/p\u003e\u003cp\u003eJigsaw Traffic draws inspiration from two respected names in the constraint puzzle world: Koichi Miura and Haym Hirsh. Miura's influence shows in the packing challenge structure - tight spatial constraints, no wasted space, solutions that feel almost impossible until they suddenly are not. Hirsh's influence lives in the piece shapes themselves, which carry that distinctive interlocking logic that makes each placement count.\u003c\/p\u003e\u003cp\u003eSamuel Cook has combined both lineages into something that feels fresh. This is not a tribute puzzle. It is a real packing problem that earns its difficulty honestly.\u003c\/p\u003e\u003ch2\u003eBest For\u003c\/h2\u003e\u003cul\u003e\n\u003cli\u003eConstraint and packing puzzle enthusiasts who want a compact challenge with real depth\u003c\/li\u003e\n\u003cli\u003eCollectors who follow the work of Koichi Miura or Haym Hirsh and want to see their design ideas extended by a new voice\u003c\/li\u003e\n\u003cli\u003eIndustrial designers and architects drawn to tight geometric problems where shape and space interact in non-obvious ways\u003c\/li\u003e\n\u003cli\u003ePuzzle collectors building a set around designer lineage and traceable creative influence\u003c\/li\u003e\n\u003c\/ul\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat does \"entrance and cutouts off-limits\" actually mean?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eThe frame has an opening used to load the pieces and internal cutouts visible inside the frame. In the final solved position, no piece can occupy or rest in those areas. The pieces must fill only the restricted interior target space marked by the guide lines.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eAre rotations really allowed?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eYes. You can rotate any piece in any direction. This expands the solution space - but the entrance and cutout restrictions still apply regardless of orientation, so it does not make the puzzle easy.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow difficult is this puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eIt is harder than it looks. Four pieces sounds manageable. The jigsaw geometry and the placement restrictions combine to make the solution space much smaller than expected. Most solvers will spend significant time on this one.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat material is Jigsaw Traffic made from?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eJigsaw Traffic is 3D-printed plastic.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat are the dimensions?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003e90mm x 90mm x 11mm.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":47305112125607,"sku":"GP-JIGSTRAF","price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/jigsaw_traffic_marble.png?v=1782043988"},{"product_id":"6-piece-cross-puzzle","title":"6-Piece Cross Puzzle","description":"\u003ch2\u003eThe 6-Piece Cross Puzzle - Classic Burr Puzzle\u003c\/h2\u003e\u003cp\u003eThe 6-Piece Cross Puzzle - also known as a 6-Piece Burr Puzzle - is a classic 3D-printed mechanical puzzle where 6 interlocking notched pieces form a symmetrical cross shape. Medium difficulty, 6 pieces, 30-60 min solve time.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e first-time puzzle solvers, gift buyers looking for an approachable brain teaser, and puzzle collectors starting with burr puzzles.\u003c\/p\u003e\u003cdiv class=\"gpba\"\u003e\n\u003cstyle\u003e\n.gpba{--bg:#EAE7E1;--line:rgba(var(--color-foreground,18,18,18),.14);\n --muted:rgba(var(--color-foreground,18,18,18),.64);\n --fg:rgb(var(--color-foreground,18,18,18));--accent:#02A9F7;\n font-family:var(--font-body-family,inherit);margin:2.4rem 0;max-width:46rem}\n.gpba *{box-sizing:border-box}\n.gpba h3{font-family:var(--font-heading-family,inherit);font-size:1.9rem;\n line-height:1.3;margin:0 0 .5rem;color:var(--fg)}\n.gpba p{font-size:1.45rem;line-height:1.65;margin:0 0 1.1rem;color:var(--muted);max-width:60ch}\n.gpba canvas{display:block;width:100%;aspect-ratio:4\/3;background:var(--bg);\n border:1px solid var(--line);border-radius:7px;cursor:grab;\n \/* pan-y, not none: a finger landing here must still scroll the page.\n    Horizontal drags turn the model, vertical ones scroll past it. *\/\n touch-action:pan-y}\n.gpba canvas:active{cursor:grabbing}\n.gpba-ctl{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap;margin:.9rem 0 0}\n.gpba-ctl button{appearance:none;border:1px solid var(--line);background:transparent;\n color:var(--muted);font-family:inherit;font-size:1.25rem;padding:.6rem 1.2rem;\n border-radius:5px;cursor:pointer}\n.gpba-ctl button:hover{border-color:var(--accent);color:var(--fg)}\n.gpba-ctl span{font-size:1.2rem;color:var(--muted);margin-left:auto;\n font-variant-numeric:tabular-nums}\n\u003c\/style\u003e\n\u003ch3\u003eWatch the six pieces lock together\u003c\/h3\u003e\n\u003cp\u003eEach stick goes in one at a time, in the order on the sheet that comes with the puzzle,\nand each is carried over the ones already seated because there is no straight way past them.\nThe plain uncut bar goes in last. Then the whole thing is shaken and nothing moves.\nDrag to turn it.\u003c\/p\u003e\n\u003ccanvas id=\"baCanvas\"\u003e\u003c\/canvas\u003e\n\u003cdiv class=\"gpba-ctl\"\u003e\n  \u003cbutton type=\"button\" id=\"baPlay\"\u003ePause\u003c\/button\u003e\n  \u003cbutton type=\"button\" id=\"baReplay\"\u003eReplay\u003c\/button\u003e\n  \u003cbutton type=\"button\" id=\"baSlow\"\u003eSlow\u003c\/button\u003e\n  \u003cspan id=\"baCount\"\u003e\u003c\/span\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n(function(){\nvar DATA={\"names\":[\"Blue Offset\",\"Blue Single Wide\",\"Blue Solid\",\"White Double Wide\",\"White Offset\",\"White W Shape\"],\"placed\":[{\"slot\":\"X1\",\"piece\":0,\"cells\":[[0,3,2],[0,3,3],[0,4,2],[0,4,3],[1,3,2],[1,3,3],[1,4,2],[1,4,3],[2,3,2],[2,3,3],[2,4,2],[2,4,3],[3,4,2],[3,4,3],[4,4,2],[5,3,2],[5,4,2],[6,3,2],[6,3,3],[6,4,2],[6,4,3],[7,3,2],[7,3,3],[7,4,2],[7,4,3]]},{\"slot\":\"X2\",\"piece\":1,\"cells\":[[0,3,4],[0,3,5],[0,4,4],[0,4,5],[1,3,4],[1,3,5],[1,4,4],[1,4,5],[2,3,5],[2,4,5],[3,3,5],[3,4,5],[4,3,5],[4,4,5],[5,3,5],[5,4,5],[6,3,4],[6,3,5],[6,4,4],[6,4,5],[7,3,4],[7,3,5],[7,4,4],[7,4,5]]},{\"slot\":\"Y1\",\"piece\":5,\"cells\":[[2,0,3],[2,0,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4],[2,3,4],[2,4,4],[2,5,3],[2,5,4],[2,6,3],[2,6,4],[2,7,3],[2,7,4],[3,0,3],[3,0,4],[3,1,3],[3,1,4],[3,3,4],[3,4,4],[3,6,3],[3,6,4],[3,7,3],[3,7,4]]},{\"slot\":\"Y2\",\"piece\":2,\"cells\":[[4,0,3],[4,0,4],[4,1,3],[4,1,4],[4,2,3],[4,2,4],[4,3,3],[4,3,4],[4,4,3],[4,4,4],[4,5,3],[4,5,4],[4,6,3],[4,6,4],[4,7,3],[4,7,4],[5,0,3],[5,0,4],[5,1,3],[5,1,4],[5,2,3],[5,2,4],[5,3,3],[5,3,4],[5,4,3],[5,4,4],[5,5,3],[5,5,4],[5,6,3],[5,6,4],[5,7,3],[5,7,4]]},{\"slot\":\"Z1\",\"piece\":4,\"cells\":[[3,2,0],[3,2,1],[3,2,2],[3,2,3],[3,2,4],[3,2,5],[3,2,6],[3,2,7],[3,3,0],[3,3,1],[3,3,2],[3,3,3],[3,3,6],[3,3,7],[4,2,0],[4,2,1],[4,2,2],[4,2,5],[4,2,6],[4,2,7],[4,3,0],[4,3,1],[4,3,2],[4,3,6],[4,3,7]]},{\"slot\":\"Z2\",\"piece\":3,\"cells\":[[3,4,0],[3,4,1],[3,4,6],[3,4,7],[3,5,0],[3,5,1],[3,5,2],[3,5,3],[3,5,4],[3,5,5],[3,5,6],[3,5,7],[4,4,0],[4,4,1],[4,4,6],[4,4,7],[4,5,0],[4,5,1],[4,5,2],[4,5,5],[4,5,6],[4,5,7]]}]};\n\/* ---------- how a six piece burr interlocks ---------- *\/\n(function(){\nvar AX={X1:0,X2:0,Y1:1,Y2:1,Z1:2,Z2:2};\nvar P=DATA.placed, NAMES=DATA.names;\nvar cv=document.getElementById(\"baCanvas\"), ctx=cv.getContext(\"2d\");\nvar $=function(i){return document.getElementById(i);};\n\/* order the sticks go home in, and which way each comes from *\/\n\/* The order on the sheet that came with the puzzle: two sticks joined first,\n   then one at a time, with the uncut linchpin last. Pieces cannot all travel\n   at once - each needs the one before it already seated. *\/\nvar SHEET=[\"White Offset\",\"Blue Offset\",\"White W Shape\",\"Blue Single Wide\",\n           \"White Double Wide\",\"Blue Solid\"];\nvar SEQ=SHEET.map(function(nm){\n  for(var i=0;i\u003cP.length;i++) if(NAMES[P[i].piece]===nm) return i;\n  return 0;\n});\n\/* Where each stick comes in from is worked out, not assumed. The direction\n   used to be taken from the slot name, which is arbitrary, so sticks were\n   driven straight through ones already seated. Instead every candidate path is\n   tested against the pieces already in place and only a clear one is used. *\/\nvar APART_=9;\nfunction shifted(i,ax,off,la,lift){\n  var cs=P[i].cells, out=[];\n  for(var k=0;k\u003ccs.length;k++){\n    var c=cs[k];\n    out.push([c[0]+(ax===0?off:0)+(la===0?lift:0),\n              c[1]+(ax===1?off:0)+(la===1?lift:0),\n              c[2]+(ax===2?off:0)+(la===2?lift:0)]);\n  }\n  return out;\n}\nfunction hits(cells,seated){\n  for(var k=0;k\u003ccells.length;k++) if(seated[cells[k].join(\",\")]) return true;\n  return false;\n}\nfunction findEntry(i,seated){\n  var ax=AX[P[i].slot];\n  for(var di=0;di\u003c2;di++){\n    var d=di?-1:1, ok=true;\n    for(var o=APART_;o\u003e=0\u0026\u0026ok;o--) if(hits(shifted(i,ax,o*d,0,0),seated)) ok=false;\n    if(ok) return {dir:d, lift:0, la:0};        \/* a clear straight slide *\/\n  }\n  for(var la=0;la\u003c3;la++){\n    if(la===ax) continue;                        \/* lifting along travel does nothing *\/\n    for(var L=3;L\u003c=9;L++){\n      for(var sgn=0;sgn\u003c2;sgn++){\n        var lv=sgn?-L:L;\n        for(var dj=0;dj\u003c2;dj++){\n          var d2=dj?-1:1, good=true;\n          for(var o2=APART_;o2\u003e=0\u0026\u0026good;o2--)\n            if(hits(shifted(i,ax,o2*d2,la,lv),seated)) good=false;\n          for(var h=Math.abs(lv);h\u003e=0\u0026\u0026good;h--)\n            if(hits(shifted(i,ax,0,la,lv\u003c0?-h:h),seated)) good=false;\n          if(good) return {dir:d2, lift:lv, la:la};\n        }\n      }\n    }\n  }\n  return null;\n}\nvar ENTRY={}, seatedMap={}, UNREACHABLE=[];\nSEQ.forEach(function(i){\n  var e=findEntry(i,seatedMap);\n  if(!e){ UNREACHABLE.push(NAMES[P[i].piece]); e={dir:1,lift:8,la:(AX[P[i].slot]===1?0:1)}; }\n  ENTRY[i]=e;\n  P[i].cells.forEach(function(c){ seatedMap[c.join(\",\")]=1; });\n});\nif(UNREACHABLE.length \u0026\u0026 window.console) console.log(\"no clear path for:\",UNREACHABLE.join(\", \"));\nvar DIR={}; SEQ.forEach(function(i){ DIR[i]=ENTRY[i].dir; });\n\n\/* precompute the faces each stick actually shows, once *\/\nvar FACEDEF=[\n {d:[0,1,0],p:[[0,1,0],[1,1,0],[1,1,1],[0,1,1]],f:1.04},\n {d:[0,-1,0],p:[[0,0,0],[0,0,1],[1,0,1],[1,0,0]],f:0.58},\n {d:[1,0,0],p:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]],f:0.86},\n {d:[-1,0,0],p:[[0,0,0],[0,0,1],[0,1,1],[0,1,0]],f:0.70},\n {d:[0,0,1],p:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]],f:0.78},\n {d:[0,0,-1],p:[[0,0,0],[0,1,0],[1,1,0],[1,0,0]],f:0.64}\n];\nvar FACES=[];\nP.forEach(function(p,i){\n  var own={}; p.cells.forEach(function(c){ own[c.join(\",\")]=1; });\n  p.cells.forEach(function(c){\n    FACEDEF.forEach(function(F){\n      if(own[[c[0]+F.d[0],c[1]+F.d[1],c[2]+F.d[2]].join(\",\")]) return;\n            FACES.push({i:i, f:F.f, n:F.d.join(\",\"), keep:[true,true,true,true],\n        pts:F.p.map(function(q){ return [c[0]+q[0], c[1]+q[1], c[2]+q[2]]; })});\n    });\n  });\n});\n\/* An edge is only an edge of a stick if the two faces meeting along it face\n   different ways. This is worked out per stick, not across the whole model:\n   doing it globally meant that wherever a neighbouring stick also had a face\n   on the same edge, three faces met there, the count was not two, and the\n   seam was kept. Those seams were invisible while assembled and appeared as\n   grid lines the moment the pieces came apart. *\/\n(function(){\n  var byPiece={};\n  FACES.forEach(function(F,fi){ (byPiece[F.i]=byPiece[F.i]||[]).push(fi); });\n  Object.keys(byPiece).forEach(function(pi){\n    var seen={};\n    byPiece[pi].forEach(function(fi){\n      var F=FACES[fi];\n      for(var j=0;j\u003c4;j++){\n        var a=F.pts[j], b=F.pts[(j+1)%4];\n        var k=(a[0]\u003cb[0]||(a[0]===b[0]\u0026\u0026(a[1]\u003cb[1]||(a[1]===b[1]\u0026\u0026a[2]\u003c=b[2]))))\n          ? a.join(\",\")+\"|\"+b.join(\",\") : b.join(\",\")+\"|\"+a.join(\",\");\n        (seen[k]=seen[k]||[]).push([fi,j,F.n]);\n      }\n    });\n    for(var k in seen){\n      var us=seen[k];\n      if(us.length!==2) continue;               \/* a silhouette edge, keep it *\/\n      if(us[0][2]!==us[1][2]) continue;         \/* a real corner, keep it *\/\n      FACES[us[0][0]].keep[us[0][1]]=false;     \/* flat continuation, drop it *\/\n      FACES[us[1][0]].keep[us[1][1]]=false;\n    }\n  });\n})();\nvar CEN=(function(){\n  var n=0,s=[0,0,0];\n  P.forEach(function(p){ p.cells.forEach(function(c){\n    s[0]+=c[0];s[1]+=c[1];s[2]+=c[2];n++; }); });\n  return [s[0]\/n+0.5,s[1]\/n+0.5,s[2]\/n+0.5];\n})();\nvar SHADE=[\"#EFEBE2\",\"#EFEBE2\",\"#EFEBE2\",\"#EFEBE2\",\"#EFEBE2\",\"#EFEBE2\"];\nfunction tone(hex,f){\n  var n=parseInt(hex.slice(1),16);\n  return \"rgb(\"+Math.min(255,Math.round((n\u003e\u003e16)*f))+\",\"\n    +Math.min(255,Math.round(((n\u003e\u003e8)\u0026255)*f))+\",\"\n    +Math.min(255,Math.round((n\u0026255)*f))+\")\";\n}\nvar t=0, playing=true, yaw=0.62, pitch=0.44, last=0, speed=1, userYaw=null;\nvar APART=9, HOLD=34, STEP=30;           \/* frames per stick, then a pause *\/\nvar SHAKE=78;                            \/* the test that it will not come apart *\/\nvar ASSEMBLED=6*STEP;\nvar TOTAL=ASSEMBLED+HOLD+SHAKE+HOLD;\n\nfunction liftAxis(i){ return ENTRY[i].la; }\nfunction moveAt(i,frame){\n  \/* A straight slide along the axis drove each stick through the ones already\n     seated. So it arrives on an arc instead: held clear of the cross while it\n     travels across, then lowered into its slot at the end. *\/\n  var k=SEQ.indexOf(i);\n  var startF=k*STEP, endF=startF+STEP-6;\n  var L=ENTRY[i].lift;\n  if(frame\u003c=startF) return {ax:APART*DIR[i], lift:L};\n  if(frame\u003e=endF)   return {ax:0, lift:0};\n  var u=(frame-startF)\/(endF-startF);\n  \/* cross over first, then come down *\/\n  var across=Math.min(1,u\/0.6), down=Math.max(0,(u-0.45)\/0.55);\n  across=across\u003c0.5 ? 2*across*across : 1-Math.pow(-2*across+2,2)\/2;\n  down=down\u003c0.5 ? 2*down*down : 1-Math.pow(-2*down+2,2)\/2;\n  return {ax:APART*DIR[i]*(1-across), lift:L*(1-down)};\n}\nfunction offsetAt(i,frame){ return moveAt(i,frame).ax; }\nfunction shakeAt(frame){\n  \/* After the last stick is in, give the whole thing a rattle. Each stick is\n     nudged along its own axis by a fraction of a cube and springs back,\n     because there is nowhere for any of them to go. *\/\n  if(frame\u003cASSEMBLED+HOLD) return {amp:0,rock:0};\n  var u=(frame-ASSEMBLED-HOLD)\/SHAKE;\n  if(u\u003e1) return {amp:0,rock:0};\n  var decay=Math.exp(-u*2.1);\n  return {amp:0.13*decay*Math.sin(u*Math.PI*14),\n          rock:0.035*decay*Math.sin(u*Math.PI*11)};\n}\nfunction draw(frame){\n  var w=cv.clientWidth, h=cv.clientHeight, dpr=window.devicePixelRatio||1;\n  if(cv.width!==Math.round(w*dpr)){ cv.width=Math.round(w*dpr); cv.height=Math.round(h*dpr); }\n  ctx.setTransform(dpr,0,0,dpr,0,0);\n  ctx.clearRect(0,0,w,h);\n  var cy=Math.cos(yaw), sy=Math.sin(yaw), cp=Math.cos(pitch), sp=Math.sin(pitch);\n  var sh=shakeAt(frame);\n  var offs=[], lifts=[], spread=0;\n  for(var i=0;i\u003cP.length;i++){\n    var m=moveAt(i,frame), o=m.ax;\n    if(sh.amp) o += sh.amp*((i%2)?1:-1);     \/* strain, then spring back *\/\n    offs.push(o); lifts.push(m.lift);\n    var reach=Math.abs(o)+Math.abs(m.lift);\n    if(reach\u003espread) spread=reach;\n  }\n  \/* zoom with the spread, so the finished cross fills the frame instead of\n     being sized for the moment the pieces are furthest apart *\/\n  \/* Fit from the projected extent rather than a guess. A lifted stick reaches\n     much further up the screen than its offset suggests, and it was being\n     clipped at the top of the canvas. *\/\n  var S=Math.min(w,h)\/(11.5+spread*0.95);\n  var minx=1e9,maxx=-1e9,miny=1e9,maxy=-1e9;\n  var out=[], n=FACES.length;\n  for(var k=0;k\u003cn;k++){\n    var F=FACES[k], a=AX[P[F.i].slot], o=offs[F.i], lf=lifts[F.i], la=liftAxis(F.i);\n    var pts=[], zs=0;\n    for(var j=0;j\u003c4;j++){\n      var q=F.pts[j];\n      var x=q[0]+(a===0?o:0)+(la===0?lf:0)-CEN[0];\n      var y=q[1]+(a===1?o:0)+(la===1?lf:0)-CEN[1];\n      var z=q[2]+(a===2?o:0)+(la===2?lf:0)-CEN[2];\n      var x1=x*cy-z*sy, z1=x*sy+z*cy;\n      var y1=y*cp-z1*sp, z2=y*sp+z1*cp;\n      pts.push([w\/2+x1*S, h\/2-y1*S]); zs+=z2;\n    }\n    for(var jb=0;jb\u003c4;jb++){\n      if(pts[jb][0]\u003cminx)minx=pts[jb][0]; if(pts[jb][0]\u003emaxx)maxx=pts[jb][0];\n      if(pts[jb][1]\u003cminy)miny=pts[jb][1]; if(pts[jb][1]\u003emaxy)maxy=pts[jb][1];\n    }\n    out.push({z:zs\/4, pts:pts, c:tone(SHADE[F.i],F.f), keep:F.keep});\n  }\n  \/* Centre on the content, then scale. Scaling about the middle of the canvas\n     left the model off centre and still clipped, because the pieces spread\n     unevenly while they are arriving. *\/\n  var bw=Math.max(maxx-minx,1), bh=Math.max(maxy-miny,1);\n  var fit=Math.min((w-20)\/bw,(h-20)\/bh,1);\n  var ccx=(minx+maxx)\/2, ccy=(miny+maxy)\/2;\n  for(var q0=0;q0\u003cout.length;q0++){\n    var pp=out[q0].pts;\n    for(var q1=0;q1\u003c4;q1++){\n      pp[q1][0]=w\/2+(pp[q1][0]-ccx)*fit;\n      pp[q1][1]=h\/2+(pp[q1][1]-ccy)*fit;\n    }\n  }\n  S=S*fit;\n  out.sort(function(a,b){ return a.z-b.z; });\n  \/* Fill and outline each face together, in depth order. Stroking every edge\n     in a second pass after all the fills put the back of the model on top of\n     the front and turned it into a wireframe. *\/\n  ctx.lineJoin=\"round\"; ctx.lineCap=\"round\";\n  var EW=Math.max(0.7,S*0.045);\n  for(var m=0;m\u003cout.length;m++){\n    var q=out[m];\n    ctx.beginPath();\n    ctx.moveTo(q.pts[0][0],q.pts[0][1]);\n    for(var j2=1;j2\u003c4;j2++) ctx.lineTo(q.pts[j2][0],q.pts[j2][1]);\n    ctx.closePath();\n    ctx.fillStyle=q.c; ctx.fill();\n    ctx.strokeStyle=q.c; ctx.lineWidth=1.0; ctx.stroke();  \/* hide coplanar seams *\/\n    ctx.beginPath();\n    var any=false;\n    for(var j3=0;j3\u003c4;j3++){\n      if(!q.keep[j3]) continue;\n      any=true;\n      var a2=q.pts[j3], b2=q.pts[(j3+1)%4];\n      ctx.moveTo(a2[0],a2[1]); ctx.lineTo(b2[0],b2[1]);\n    }\n    if(any){ ctx.strokeStyle=\"rgba(62,58,50,.70)\"; ctx.lineWidth=EW; ctx.stroke(); }\n  }\n  var placedN=0;\n  for(var i2=0;i2\u003cP.length;i2++) if(Math.abs(offs[i2])\u003c0.2\u0026\u0026Math.abs(lifts[i2])\u003c0.2) placedN++;\n  var shaking=frame\u003e=ASSEMBLED+HOLD \u0026\u0026 frame\u003cASSEMBLED+HOLD+SHAKE;\n  $(\"baCount\").textContent = shaking ? \"Shaking it. Nothing moves.\"\n    : (placedN===6 ? \"All six in. It will not come apart.\"\n                   : placedN+\" of 6 in place\");\n}\nfunction frameLoop(now){\n  if(playing){\n    if(!last) last=now;\n    t += (now-last)*0.06*speed; last=now;\n    if(t\u003eTOTAL) t=0;\n  } else last=0;\n  \/* A full spin kept passing through face on angles where the cross reads as\n     a flat diagram. A slow sway around a three quarter view stays legible. *\/\n  if(userYaw===null){\n    var sh=shakeAt(Math.min(t,TOTAL));\n    yaw = 0.62 + 0.20*Math.sin(t*0.012) + sh.rock;\n  }\n  draw(Math.min(t,TOTAL));\n  requestAnimationFrame(frameLoop);\n}\n$(\"baPlay\").addEventListener(\"click\",function(){\n  playing=!playing; last=0;\n  $(\"baPlay\").textContent=playing?\"Pause\":\"Play\";\n});\n$(\"baReplay\").addEventListener(\"click\",function(){ t=0; last=0; playing=true; userYaw=null;\n  $(\"baPlay\").textContent=\"Pause\"; });\n$(\"baSlow\").addEventListener(\"click\",function(){\n  speed=(speed===1)?0.4:1;\n  $(\"baSlow\").textContent=(speed===1)?\"Slow\":\"Normal\";\n});\nvar drag=null;\ncv.addEventListener(\"pointerdown\",function(e){\n  drag={x:e.clientX,y:e.clientY,yaw:yaw,pitch:pitch};\n  cv.setPointerCapture(e.pointerId); });\ncv.addEventListener(\"pointermove\",function(e){\n  if(!drag) return;\n  userYaw=yaw=drag.yaw+(e.clientX-drag.x)*0.011;\n  pitch=Math.max(-1.25,Math.min(1.25,drag.pitch+(e.clientY-drag.y)*0.011)); });\ncv.addEventListener(\"pointerup\",function(){ drag=null; });\nrequestAnimationFrame(frameLoop);\n})();\n\n})();\n\u003c\/script\u003e\n\u003ch2\u003eWhat Is a Burr Puzzle?\u003c\/h2\u003e\u003cp\u003eA burr puzzle is a type of interlocking mechanical puzzle where pieces fit together using only their physical geometry - no glue, no magnets, no tools. The 6-Piece Cross is the most iconic burr puzzle design: six notched sticks interlock to form a three-dimensional cross. Disassembling it is satisfying. Reassembling it is the real challenge.\u003c\/p\u003e\u003ch2\u003eHow It Works\u003c\/h2\u003e\u003cp\u003eSix notched pieces. One symmetrical cross. No glue, no tools, no tricks - just geometry.\u003c\/p\u003e\u003cp\u003eYour goal is simple: take it apart, then put it back together. The disassembly is satisfying. The reassembly is where most people spend their time. Every piece looks identical at first glance. They are not.\u003c\/p\u003e\u003cp\u003eMost beginners will hold all six pieces in their hands and think they have it figured out. Then they will try to reassemble it. Then they will not.\u003c\/p\u003e\u003cp\u003eThat is the puzzle.\u003c\/p\u003e\n\u003ch2\u003ePuzzle Specs\u003c\/h2\u003e\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003ePieces:\u003c\/strong\u003e 6\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eDifficulty:\u003c\/strong\u003e Medium\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSolve Time:\u003c\/strong\u003e 30-60 min\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSize:\u003c\/strong\u003e 60x60x60 mm\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eTrains:\u003c\/strong\u003e Spatial Thinking\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eShips:\u003c\/strong\u003e Assembled\u003c\/li\u003e\n\u003c\/ul\u003e\u003cdiv style=\"border:2px solid #e0e0e0;border-radius:8px;padding:1.2em 1.5em;margin:2em 0;\"\u003e\n\u003ch2 style=\"margin-top:0;\"\u003eReady for a Harder Burr?\u003c\/h2\u003e\n\u003cp\u003eThe 6-Piece Cross is where most people start. The next step is a board burr: six flat boards instead of notched sticks. \u003ca href=\"\/products\/zigzag\"\u003eZigZag\u003c\/a\u003e is the first separated board burr ever built, designed by Frans de Vreugd in 2002. Hard, 1-4 hrs. For the far end of that family, \u003ca href=\"\/products\/extreme-torture\"\u003eExtreme Torture\u003c\/a\u003e takes 69 moves to take apart. Expert, 4+ hrs.\u003c\/p\u003e\n\u003cp\u003eAlready have one and stuck? \u003ca href=\"\/blogs\/greg-puzzles-blog\/how-to-solve-the-6-piece-burr-puzzle\"\u003eHow to solve the 6-piece burr puzzle\u003c\/a\u003e walks through it step by step.\u003c\/p\u003e\n\u003c\/div\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is a 6-piece burr puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA 6-piece burr puzzle is a classic mechanical puzzle made of six interlocking notched pieces that form a cross or star shape. It is one of the most popular introductory puzzles for adults new to mechanical puzzles.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow hard is the 6-Piece Cross Puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eThe 6-Piece Cross Puzzle is rated Medium difficulty with a typical solve time of 30-60 minutes. It is approachable for beginners but still offers a satisfying challenge for first-timers.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs this a good gift for someone new to puzzles?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eYes - the 6-Piece Cross is one of the best entry-level mechanical puzzles. Its familiar cross shape and clear goal make it easy to understand, while the reassembly provides a real brain challenge.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":47842463744167,"sku":"GP-6CROS","price":13.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/6_piece_cross_marble.png?v=1782067074"},{"product_id":"impossible-dovetail-box","title":"Impossible Dovetail Box | Open the Sealed Box","description":"\u003cp\u003eA box that looks like it shouldn't exist. The Impossible Dovetail Box is a secret-mechanism puzzle box that appears permanently sealed - your only goal is to figure out how to open it, using no tools. Medium difficulty, 30-60 min solve time.\u003c\/p\u003e\u003cp\u003eA dovetail joint is an interlocking mechanism that comes from woodworking - traditionally considered impossible to pull apart once assembled. This puzzle takes that concept and turns it into a standalone brain teaser. The joint locks tighter the harder you pull. The box appears to be impossible - like it shouldn't, or can't, physically exist. The solution requires you to think, observe, or maybe smell, maybe listen, maybe even talk to the box. Who knows! No tools required. No force required. Only lateral thinking.\u003c\/p\u003e\u003ch2\u003eWho Is This For?\u003c\/h2\u003e\u003cp\u003eBest for: adults who love escape rooms, hidden-mechanism reveals, and puzzles that reward patient observation over trial-and-error. An ideal gift for engineers, designers, and anyone who says they love puzzles - this one will test that claim.\u003c\/p\u003e\u003ch2\u003eRepeat-Solve Quality\u003c\/h2\u003e\u003cp\u003eThe mechanism resets cleanly after each solve, which is what makes this work as a demonstration puzzle. The box returns to its original state, ready for the next person. Knowing the answer does not retire it - it just changes the challenge from solving it yourself to watching someone else work through it.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is the Impossible Dovetail Box?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA secret-mechanism puzzle box with no visible way in. The goal is to open it using only observation and lateral thinking - no tools, no instructions, and no force.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow hard is the Impossible Dovetail Box?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eMedium difficulty. Most solvers crack it in 30-60 minutes, though first-timers often spend longer because the solution is genuinely counterintuitive.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs the Impossible Dovetail Box a good gift?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eYes - it is compact, beautifully finished, and delivers a satisfying aha moment.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":47889408098471,"sku":"GP-IMPODOVE","price":15.2,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/dovetail_marble.png?v=1782069042"},{"product_id":"3-piece-cross-puzzle","title":"3-Piece Cross Puzzle","description":"\u003ch2\u003eThe 3-Piece Cross Puzzle\u003c\/h2\u003e\u003cp\u003eThe 3-Piece Cross Puzzle is an Easy-difficulty interlocking puzzle and one of the best entry points into the world of mechanical puzzles. With 3 interlocking pieces and a 5-30 minute solve time, the challenge is to disassemble the cross shape and reassemble it - no tools, no tricks, just spatial thinking.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e Beginners exploring interlocking puzzles for the first time, adults new to mechanical puzzles, teachers looking for hands-on classroom tools, and gift buyers wanting an approachable yet satisfying brainteaser.\u003c\/p\u003e\u003ch2\u003eWhy the 3-Piece Cross?\u003c\/h2\u003e\u003cp\u003eInterlocking puzzles are 3D mechanical puzzles where pieces lock together without glue or hardware - the geometry itself holds everything in place. The 3-Piece Cross is a classic form of this category: compact, elegant, and surprisingly tricky to reassemble once taken apart. It trains spatial thinking and makes an ideal introduction to puzzle solving.\u003c\/p\u003e\u003cp\u003eHere is the thing - taking it apart is one challenge. Putting it back together is another. Most people pull the three pieces free without much trouble. Then they stare at them. The cross shape that looked so simple a moment ago suddenly feels like a different puzzle entirely. That is the magic of it.\u003c\/p\u003e\u003cp\u003eNo moving parts. No hidden mechanisms. Just three pieces and one question: can you put them back the way you found them?\u003c\/p\u003e\u003ch2\u003ePuzzle Specs\u003c\/h2\u003e\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003ePieces:\u003c\/strong\u003e 3\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eDifficulty:\u003c\/strong\u003e Easy\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSolve time:\u003c\/strong\u003e 5-30 minutes\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eTrains:\u003c\/strong\u003e Spatial thinking\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eTools required:\u003c\/strong\u003e None\u003c\/li\u003e\n\u003c\/ul\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is the 3-Piece Cross Puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eThe 3-Piece Cross Puzzle is a classic 3D interlocking puzzle where three identically shaped pieces lock together to form a cross. The goal is to disassemble them and reassemble the original shape without tools. It is rated Easy difficulty with a 5-30 minute solve time.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow hard is the 3-Piece Cross Puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eThe 3-Piece Cross Puzzle is rated Easy - it is designed as an entry-level interlocking puzzle suitable for beginners and first-time solvers. Most people complete it within 5-30 minutes.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho is the 3-Piece Cross Puzzle best for?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eThe 3-Piece Cross Puzzle is best for beginners exploring interlocking puzzles for the first time, adults building spatial reasoning skills, and anyone looking for a quick, satisfying puzzle gift.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":47889552638119,"sku":"GP-3CROS","price":14.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/3_piece_cross_marble.png?v=1782067350"},{"product_id":"cube-alchemy","title":"Cube Alchemy | 180 Challenges in One!","description":"\u003cp\u003eInspired by the classic Soma Cube-style puzzle - this product comes with our exclusive booklet with 180 distinct challenges handpicked and curated by Greg. \u003c\/p\u003e\n\u003cp\u003eSeven simple pieces. One 3x3x3 cube. MANY different challenges. Most people can take it apart in seconds. Putting it back together is a completely different story.\u003c\/p\u003e\n\u003cp\u003eGoal: assemble all 7 pieces into a perfect 3x3x3 cube (Challenge 1\/180)\u003cbr\u003e\u003c\/p\u003e\n\u003cp\u003eFun fact - There are 240 solutions for the first challenge alone! \u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Cube Alchemy?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eDevelops 3D spatial imagination\u003c\/li\u003e\n\u003cli\u003eIncludes booklet with favorite 180 challenges\u003c\/li\u003e\n\u003cli\u003eChallenge difficulty can vary!\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cdiv class=\"gpca\" data-handle=\"cube-alchemy\"\u003e\n\u003cstyle\u003e\n.gpca{--gpca-fg:rgb(var(--color-foreground,18,18,18));\n --gpca-line:rgba(var(--color-foreground,18,18,18),.18);\n --gpca-muted:rgba(var(--color-foreground,18,18,18),.7);\n --gpca-accent:#02A9F7;--gpca-ink:#0B7FA8;\n font-family:inherit;color:var(--gpca-fg);margin:1.2em 0;max-width:30em}\n.gpca *{box-sizing:border-box}\n.gpca .gpca-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;margin:0 0 .3em;color:var(--gpca-fg)}\n.gpca .gpca-intro{font-size:.92em;line-height:1.5;margin:0 0 .8em;color:var(--gpca-muted);max-width:36em}\n.gpca button{appearance:none;-webkit-appearance:none;margin:0;font-family:inherit;letter-spacing:normal;\n text-transform:none;box-shadow:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent;\n color:var(--gpca-fg);cursor:pointer}\n.gpca .gpca-tabs{display:flex;flex-wrap:wrap;gap:.4em;margin:0 0 .6em}\n.gpca .gpca-tabs button{font-size:.88em;line-height:1.2;min-height:2.6em;padding:.45em 1em;\n border:1px solid var(--gpca-line);border-radius:6px;background:transparent}\n.gpca .gpca-tabs button[aria-pressed=true]{background:var(--gpca-accent);border-color:var(--gpca-accent);\n color:#fff;font-weight:600}\n.gpca .gpca-stage{position:relative;direction:ltr;border:1px solid var(--gpca-line);border-radius:8px;\n overflow:hidden;background:#F1F5F8}\n.gpca .gpca-view{display:block;width:100%;max-width:none;cursor:grab;outline:none;\n \/* asleep, a finger on the view scrolls the page; awake, it turns the view *\/\n touch-action:pan-y;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;\n -webkit-tap-highlight-color:transparent}\n.gpca[data-live] .gpca-view{touch-action:none}\n.gpca .gpca-view:active{cursor:grabbing}\n.gpca .gpca-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);\n padding:.55em 1.2em;border:1px solid var(--gpca-line);border-radius:999px;background:rgba(255,255,255,.92);\n box-shadow:0 .1em .6em rgba(0,0,0,.08);font-size:.95em;line-height:1.2;font-weight:600;white-space:nowrap;\n color:var(--gpca-fg);pointer-events:none;opacity:1;transition:opacity .25s}\n.gpca[data-live] .gpca-play{opacity:0}\n.gpca .gpca-stage:focus-within{border-color:var(--gpca-accent)}\n.gpca .gpca-turn{position:absolute;top:.5em;right:.5em;font-size:.8em;line-height:1.2;min-height:2.5em;\n padding:.45em .85em;border:1px solid var(--gpca-line);border-radius:999px;background:rgba(255,255,255,.9)}\n.gpca .gpca-turn:hover{border-color:var(--gpca-accent)}\n.gpca .gpca-say{font-size:.88em;line-height:1.45;color:var(--gpca-muted);min-height:2.9em;margin:.55em 0 0}\n.gpca .gpca-say[data-done]{color:var(--gpca-ink);font-weight:600;font-size:.95em}\n.gpca .gpca-tray{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:.3em;margin:.35em 0 0;\n direction:ltr;border-radius:8px;transition:box-shadow .2s}\n.gpca .gpca-tray[data-nudge]{box-shadow:0 0 0 2px var(--gpca-accent)}\n.gpca .gpca-tile{display:flex;flex-direction:column;align-items:center;min-width:0;padding:.2em 0 .15em;\n border:1px solid var(--gpca-line);border-radius:7px;background:transparent;-webkit-user-select:none;user-select:none}\n.gpca .gpca-tile canvas{display:block;width:100%;max-width:none;pointer-events:none}\n.gpca .gpca-tile span{font-size:.72em;line-height:1.2;color:var(--gpca-muted)}\n.gpca .gpca-tile[aria-pressed=true]{border-color:var(--gpca-accent);background:rgba(2,169,247,.1);\n box-shadow:0 0 0 1px var(--gpca-accent) inset}\n.gpca .gpca-tile[data-in]{opacity:.3}\n.gpca .gpca-ctl{display:flex;flex-wrap:wrap;gap:.4em;margin:.7em 0 0}\n.gpca .gpca-ctl button{flex:1 1 auto;font-size:.85em;line-height:1.2;min-height:2.9em;padding:.55em .8em;\n border:1px solid var(--gpca-line);border-radius:6px;background:transparent}\n.gpca .gpca-ctl button:hover{border-color:var(--gpca-accent)}\n.gpca .gpca-ctl .gpca-go{background:var(--gpca-accent);border-color:var(--gpca-accent);color:#fff;font-weight:600}\n.gpca .gpca-ctl button:disabled{opacity:.38;cursor:default}\n.gpca .gpca-ctl button:disabled:hover{border-color:var(--gpca-line)}\n.gpca .gpca-ctl .gpca-go:disabled:hover{border-color:var(--gpca-accent)}\n.gpca button:focus-visible{outline:2px solid var(--gpca-accent);outline-offset:2px}\n@media (prefers-reduced-motion:reduce){.gpca .gpca-play{transition:none}}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n\/* Greg Puzzles Cube Alchemy (.gpca) - build a Soma figure by hand, in 3D.\n   The target shape is drawn as light glass cubes; each placed piece is a solid\n   coloured block. Drag the view to turn it.\n\n   How a piece goes in: pick one of the seven, tap a glass cube, and a ghost of\n   the piece appears covering that cube. Tapping the same cube again (or Turn\n   piece) steps through every other way the piece can cover it that FITS: all\n   of it inside the shape and none of it on a placed piece. Nothing else is\n   used to choose or order them. Place drops it; tapping a placed piece takes\n   it back out.\n\n   The page carries the piece shapes and the target shapes, nothing more: no\n   arrangement that finishes a shape, no search, no counts. A shape is done\n   when every glass cube is covered, checked by that rule alone.\n\n   Written to live inside a Shopify product description:\n   - every DOM node is made with createElement, so no closing tag ever appears\n     inside a JS string (Shopify reparses body_html);\n   - nothing relies on an empty div being visible (the theme hides div:empty);\n   - sizes are in em (the theme root is 10px) and the font is inherited;\n   - taps are tested against the polygons of the last frame actually drawn,\n     never against restated numbers. *\/\n(function () {\n  \"use strict\";\n  if (window.GPCA) return;\n\n  var TXT = {\n    en: {\n      title: \"Build it yourself\",\n      intro: \"Pick a piece below, then tap a glass cube where it should go. Tap the same cube again to try it another way. Drag the view to turn it.\",\n      shape: \"Shape\",\n      shapes: { castle: \"Castle\", sofa: \"Sofa\", tower: \"Tower\" },\n      view: \"3D view of the {shape}. Drag to turn it.\",\n      play: \"Tap to play\",\n      turnView: \"Turn view\", turnPiece: \"Turn piece\", place: \"Place\", undo: \"Undo\", reset: \"Start over\",\n      tray: \"The seven pieces\", piece: \"Piece {k}\",\n      start: \"Pick a piece below, then tap a glass cube.\",\n      pickFirst: \"Pick a piece below first.\",\n      picked: \"Now tap a glass cube where it should go.\",\n      ways: \"Way {i} of {n} that fits here. Tap the cube again, or press Place.\",\n      onlyWay: \"The only way it fits here. Press Place to put it in.\",\n      nofit: \"That piece does not fit over this cube.\",\n      placed: \"In. {k} of 7 placed.\",\n      out: \"Taken out. {k} of 7 placed.\",\n      undone: \"Undone. {k} of 7 placed.\",\n      cleared: \"Cleared. Undo brings the pieces back.\",\n      already: \"Already in. Tap it in the view to take it out.\",\n      done: \"You built the {shape}! Every glass cube is filled.\"\n    },\n    he: {\n      title: \"בנו את זה בעצמכם\",\n      intro: \"בחרו חלק למטה, ואז הקישו על קובייה שקופה במקום שבו הוא צריך להיות. הקישו שוב על אותה קובייה כדי לנסות אותו אחרת. גררו את התצוגה כדי לסובב אותה.\",\n      shape: \"צורה\",\n      shapes: { castle: \"טירה\", sofa: \"ספה\", tower: \"מגדל\" },\n      view: \"תצוגת תלת־ממד של ה{shape}. גררו כדי לסובב.\",\n      play: \"הקישו כדי לשחק\",\n      turnView: \"סובבו את התצוגה\", turnPiece: \"סובבו את החלק\", place: \"הניחו\", undo: \"בטלו\", reset: \"התחילו מחדש\",\n      tray: \"שבעת החלקים\", piece: \"חלק {k}\",\n      start: \"בחרו חלק למטה, ואז הקישו על קובייה שקופה.\",\n      pickFirst: \"בחרו קודם חלק למטה.\",\n      picked: \"עכשיו הקישו על קובייה שקופה במקום שבו הוא צריך להיות.\",\n      ways: \"אפשרות {i} מתוך {n} שנכנסת כאן. הקישו שוב על הקובייה, או הניחו אותו.\",\n      onlyWay: \"רק כך הוא נכנס כאן. הניחו אותו.\",\n      nofit: \"החלק הזה לא נכנס על הקובייה הזו.\",\n      placed: \"בפנים. {k} מתוך 7 הונחו.\",\n      out: \"החלק הוצא. {k} מתוך 7 הונחו.\",\n      undone: \"בוטל. {k} מתוך 7 הונחו.\",\n      cleared: \"נוקה. בטלו כדי להחזיר את החלקים.\",\n      already: \"החלק כבר בפנים. הקישו עליו בתצוגה כדי להוציא אותו.\",\n      done: \"בניתם את ה{shape}! כל הקוביות השקופות מלאות.\"\n    },\n    ja: {\n      title: \"自分で組み立ててみてください\",\n      intro: \"下のピースを選び、置きたい場所のガラスのキューブをタップしてください。同じキューブをもう一度タップすると別の置き方になります。ドラッグすると向きを変えられます。\",\n      shape: \"形\",\n      shapes: { castle: \"城\", sofa: \"ソファ\", tower: \"塔\" },\n      view: \"{shape}の3D表示。ドラッグで回せます。\",\n      play: \"タップして遊ぶ\",\n      turnView: \"視点を回す\", turnPiece: \"ピースを回す\", place: \"置く\", undo: \"元に戻す\", reset: \"最初から\",\n      tray: \"7つのピース\", piece: \"ピース{k}\",\n      start: \"下のピースを選んでから、ガラスのキューブをタップしてください。\",\n      pickFirst: \"先に下のピースを選んでください。\",\n      picked: \"置きたい場所のガラスのキューブをタップしてください。\",\n      ways: \"ここに収まる置き方{n}通りのうち{i}番目。もう一度タップするか、「置く」を押してください。\",\n      onlyWay: \"ここに収まる置き方はこれだけです。「置く」を押してください。\",\n      nofit: \"このピースはこのキューブには収まりません。\",\n      placed: \"置きました。7個中{k}個。\",\n      out: \"取り出しました。7個中{k}個。\",\n      undone: \"元に戻しました。7個中{k}個。\",\n      cleared: \"空にしました。「元に戻す」でピースが戻ります。\",\n      already: \"このピースはもう置いてあります。取り出すには、表示の中でタップしてください。\",\n      done: \"{shape}が完成しました！ガラスのキューブがすべて埋まりました。\"\n    }\n  };\n\n  function langOf() {\n    var l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\n    if (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\n    if (l.indexOf(\"ja\") === 0) return \"ja\";\n    return \"en\";\n  }\n  function fmt(s, o) {\n    return s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n  }\n  function el(tag, cls, txt) {\n    var e = document.createElement(tag);\n    if (cls) e.className = cls;\n    if (txt != null) e.textContent = txt;\n    return e;\n  }\n\n  \/* ---------- cells ---------- *\/\n  function K(c) { return c[0] + \",\" + c[1] + \",\" + c[2]; }\n  function norm(cs) {\n    var m = [Infinity, Infinity, Infinity];\n    cs.forEach(function (c) { for (var i = 0; i !== 3; i++) if (c[i] \u003c m[i]) m[i] = c[i]; });\n    var out = cs.map(function (c) { return [c[0] - m[0], c[1] - m[1], c[2] - m[2]]; });\n    out.sort(function (a, b) { return a[2] - b[2] || a[1] - b[1] || a[0] - b[0]; });\n    return out;\n  }\n  function setKey(cells) { return cells.map(K).sort().join(\";\"); }\n\n  \/* the 24 turns of a solid block; no mirror images, because nobody can\n     reflect a piece of plastic *\/\n  var ROTS = (function () {\n    function mul(a, b) {\n      var r = [];\n      for (var i = 0; i !== 3; i++) {\n        r.push([]);\n        for (var j = 0; j !== 3; j++) {\n          var s = 0;\n          for (var k = 0; k !== 3; k++) s += a[i][k] * b[k][j];\n          r[i].push(s);\n        }\n      }\n      return r;\n    }\n    var X = [[1, 0, 0], [0, 0, -1], [0, 1, 0]], Y = [[0, 0, 1], [0, 1, 0], [-1, 0, 0]];\n    var seen = {}, out = [], q = [[[1, 0, 0], [0, 1, 0], [0, 0, 1]]];\n    while (q.length) {\n      var m = q.shift(), k = JSON.stringify(m);\n      if (seen[k]) continue;\n      seen[k] = 1; out.push(m);\n      q.push(mul(X, m)); q.push(mul(Y, m));\n    }\n    return out;\n  })();\n  function orientations(cells) {\n    var seen = {}, out = [];\n    ROTS.forEach(function (m) {\n      var o = norm(cells.map(function (c) {\n        return [m[0][0] * c[0] + m[0][1] * c[1] + m[0][2] * c[2],\n                m[1][0] * c[0] + m[1][1] * c[1] + m[1][2] * c[2],\n                m[2][0] * c[0] + m[2][1] * c[1] + m[2][2] * c[2]];\n      }));\n      var k = o.map(K).join(\";\");\n      if (!seen[k]) { seen[k] = 1; out.push(o); }\n    });\n    return out;\n  }\n\n  \/* ---------- drawing: unit cubes, orthographic, painter's order ----------\n     Cubes on a grid never interpenetrate, so drawing whole cubes far to near\n     by the depth of their centres is exact in an orthographic view, and the\n     front faces of one cube never overlap each other. *\/\n  var FACES = [\n    { n: [1, 0, 0],  q: [[1, 0, 0], [1, 1, 0], [1, 1, 1], [1, 0, 1]] },\n    { n: [-1, 0, 0], q: [[0, 0, 0], [0, 0, 1], [0, 1, 1], [0, 1, 0]] },\n    { n: [0, 1, 0],  q: [[0, 1, 0], [0, 1, 1], [1, 1, 1], [1, 1, 0]] },\n    { n: [0, -1, 0], q: [[0, 0, 0], [1, 0, 0], [1, 0, 1], [0, 0, 1]] },\n    { n: [0, 0, 1],  q: [[0, 0, 1], [1, 0, 1], [1, 1, 1], [0, 1, 1]] },\n    { n: [0, 0, -1], q: [[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]] }\n  ];\n  function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; }\n  \/* yaw turns about the vertical, pitch lifts the eye above the table.\n     R x U = V, so the view is never a mirror image (A and B stay themselves). *\/\n  function cam(yaw, pitch) {\n    var sa = Math.sin(yaw), ca = Math.cos(yaw), sb = Math.sin(pitch), cb = Math.cos(pitch);\n    var R = [ca, sa, 0], U = [-sb * sa, sb * ca, cb], V = [cb * sa, -cb * ca, sb], L = [0, 0, 0];\n    for (var i = 0; i !== 3; i++) L[i] = -0.42 * R[i] + 0.8 * U[i] + 0.45 * V[i];\n    var n = Math.sqrt(dot(L, L));\n    return { R: R, U: U, V: V, L: [L[0] \/ n, L[1] \/ n, L[2] \/ n] };\n  }\n  function hexRGB(hex) {\n    var n = parseInt(hex.slice(1), 16);\n    return [(n \u003e\u003e 16) \u0026 255, (n \u003e\u003e 8) \u0026 255, n \u0026 255];\n  }\n  function rgba(rgb, f, a) {\n    return \"rgba(\" + Math.min(255, Math.round(rgb[0] * f)) + \",\" + Math.min(255, Math.round(rgb[1] * f)) + \",\" +\n      Math.min(255, Math.round(rgb[2] * f)) + \",\" + a + \")\";\n  }\n  function project(C, S, ctr, off) {\n    return function (p) {\n      var q = [p[0] - ctr[0], p[1] - ctr[1], p[2] - ctr[2]];\n      return [off[0] + dot(q, C.R) * S, off[1] - dot(q, C.U) * S];\n    };\n  }\n  \/* items: {c, kind: solid|ghost|glass, show[6], rgb, mark}. Fills in .polys\n     (screen quads actually drawn) and returns the items in drawing order. *\/\n  function paint(ctx, items, C, S, ctr, off) {\n    var P = project(C, S, ctr, off), V = C.V, lw = Math.max(1, S * 0.028);\n    items.forEach(function (it) {\n      it.d = (it.c[0] + 0.5 - ctr[0]) * V[0] + (it.c[1] + 0.5 - ctr[1]) * V[1] + (it.c[2] + 0.5 - ctr[2]) * V[2];\n      it.polys = [];\n    });\n    items.sort(function (a, b) { return a.d - b.d; });\n    ctx.lineJoin = \"round\";\n    items.forEach(function (it) {\n      for (var f = 0; f !== 6; f++) {\n        if (!it.show[f] || dot(FACES[f].n, V) \u003c= 1e-6) continue;\n        var pts = FACES[f].q.map(function (q) { return P([it.c[0] + q[0], it.c[1] + q[1], it.c[2] + q[2]]); });\n        it.polys.push(pts);\n        var lit = 0.62 + 0.38 * Math.max(0, dot(FACES[f].n, C.L));\n        ctx.beginPath();\n        ctx.moveTo(pts[0][0], pts[0][1]);\n        for (var j = 1; j !== 4; j++) ctx.lineTo(pts[j][0], pts[j][1]);\n        ctx.closePath();\n        if (it.kind === \"solid\") {\n          ctx.fillStyle = rgba(it.rgb, lit, 1); ctx.fill();\n          ctx.strokeStyle = \"rgba(0,0,0,.30)\"; ctx.lineWidth = lw * 0.8; ctx.stroke();\n        } else if (it.kind === \"ghost\") {\n          ctx.fillStyle = rgba(it.rgb, lit, Math.min(1, (it.a || 0.75) + (it.mark ? 0.1 : 0))); ctx.fill();\n          ctx.strokeStyle = rgba(it.rgb, 0.45, 1); ctx.lineWidth = lw * 1.5; ctx.stroke();\n        } else {\n          ctx.fillStyle = \"rgba(2,169,247,\" + (0.035 + 0.26 * (1 - lit)).toFixed(3) + \")\"; ctx.fill();\n          ctx.strokeStyle = it.mark ? \"rgba(2,130,200,1)\" : \"rgba(20,96,140,.4)\";\n          ctx.lineWidth = it.mark ? lw * 1.6 : lw * 0.75; ctx.stroke();\n        }\n      }\n    });\n    return items;\n  }\n  function inPoly(p, x, y) {\n    var s = 0;\n    for (var i = 0; i !== p.length; i++) {\n      var a = p[i], b = p[(i + 1) % p.length];\n      var c = (b[0] - a[0]) * (y - a[1]) - (b[1] - a[1]) * (x - a[0]);\n      if (c !== 0) {\n        var sg = c \u003e 0 ? 1 : -1;\n        if (s \u0026\u0026 sg !== s) return false;\n        s = sg;\n      }\n    }\n    return true;\n  }\n  \/* nearest first. Glass is see-through, so a ghost seen through glass still\n     takes the tap; a solid piece stops the search. *\/\n  function hit(list, x, y) {\n    var glass = null;\n    for (var i = list.length - 1; i \u003e= 0; i--) {\n      var it = list[i];\n      for (var j = 0; j !== it.polys.length; j++) {\n        if (!inPoly(it.polys[j], x, y)) continue;\n        if (it.kind === \"ghost\") return it;\n        if (it.kind === \"solid\") return glass || it;\n        if (!glass) glass = it;\n        break;\n      }\n    }\n    return glass;\n  }\n  function extent(cells, C) {\n    var P = project(C, 1, [0, 0, 0], [0, 0]), b = [Infinity, Infinity, -Infinity, -Infinity];\n    cells.forEach(function (c) {\n      for (var i = 0; i !== 8; i++) {\n        var p = P([c[0] + (i \u0026 1), c[1] + ((i \u003e\u003e 1) \u0026 1), c[2] + ((i \u003e\u003e 2) \u0026 1)]);\n        if (p[0] \u003c b[0]) b[0] = p[0]; if (p[1] \u003c b[1]) b[1] = p[1];\n        if (p[0] \u003e b[2]) b[2] = p[0]; if (p[1] \u003e b[3]) b[3] = p[1];\n      }\n    });\n    return b;\n  }\n\n  \/* ---------- the block ---------- *\/\n  function mount(root, cfg) {\n    if (!root || root.getAttribute(\"data-gpca-on\")) return;\n    root.setAttribute(\"data-gpca-on\", \"1\");\n    var lang = langOf(), T = TXT[lang];\n    root.setAttribute(\"dir\", lang === \"he\" ? \"rtl\" : \"ltr\");\n    var reduce = window.matchMedia \u0026\u0026 window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n\n    var PIECES = cfg.pieces.map(function (p) {\n      return { k: p.k, rgb: hexRGB(p.c), cells: norm(p.cells), ors: orientations(p.cells) };\n    });\n    var SHAPES = cfg.shapes.map(function (s) {\n      var cells = norm(s.cells), inS = {}, ext = [0, 0, 0];\n      cells.forEach(function (c) {\n        inS[K(c)] = 1;\n        for (var i = 0; i !== 3; i++) if (c[i] + 1 \u003e ext[i]) ext[i] = c[i] + 1;\n      });\n      return { id: s.id, cells: cells, inS: inS, ctr: [ext[0] \/ 2, ext[1] \/ 2, ext[2] \/ 2],\n               rad: Math.sqrt(ext[0] * ext[0] + ext[1] * ext[1] + ext[2] * ext[2]) \/ 2,\n               at: {}, occ: {}, hist: [], yaw: s.view[0], pitch: s.view[1] };\n    });\n    var cur = 0, sel = -1, anchor = null, opts = [], oi = 0, list = [], W = 0, H = 0;\n    function shp() { return SHAPES[cur]; }\n\n    \/* ----- DOM ----- *\/\n    var title = el(\"h3\", \"gpca-h\", T.title);\n    var intro = el(\"p\", \"gpca-intro\", T.intro);\n    var tabs = el(\"div\", \"gpca-tabs\");\n    tabs.setAttribute(\"role\", \"group\"); tabs.setAttribute(\"aria-label\", T.shape);\n    var tabBtns = SHAPES.map(function (s, i) {\n      var b = el(\"button\", null, T.shapes[s.id] || s.id);\n      b.type = \"button\"; b.setAttribute(\"data-shape\", s.id);\n      b.addEventListener(\"click\", function () { pickShape(i); });\n      tabs.appendChild(b);\n      return b;\n    });\n    var stage = el(\"div\", \"gpca-stage\");\n    var cv = el(\"canvas\", \"gpca-view\");\n    cv.tabIndex = 0; cv.setAttribute(\"role\", \"img\");\n    var turnBtn = el(\"button\", \"gpca-turn\", \"↻ \" + T.turnView);\n    turnBtn.type = \"button\"; turnBtn.setAttribute(\"data-act\", \"view\");\n    \/* until the visitor taps the view (or a piece), a finger on it scrolls the\n       page like anywhere else; this label says how to start *\/\n    var wakeLabel = el(\"span\", \"gpca-play\", T.play);\n    wakeLabel.setAttribute(\"aria-hidden\", \"true\");\n    stage.appendChild(cv); stage.appendChild(wakeLabel); stage.appendChild(turnBtn);\n    var say = el(\"p\", \"gpca-say\", T.start);\n    say.setAttribute(\"aria-live\", \"polite\");\n    var tray = el(\"div\", \"gpca-tray\");\n    tray.setAttribute(\"role\", \"group\"); tray.setAttribute(\"aria-label\", T.tray);\n    var tiles = PIECES.map(function (p, i) {\n      var b = el(\"button\", \"gpca-tile\"), c = el(\"canvas\");\n      b.type = \"button\"; b.setAttribute(\"data-piece\", p.k); b.setAttribute(\"aria-label\", fmt(T.piece, { k: p.k }));\n      b.appendChild(c); b.appendChild(el(\"span\", null, p.k));\n      b.addEventListener(\"click\", function () { wake(); pickPiece(i); });\n      tray.appendChild(b);\n      return { b: b, cv: c };\n    });\n    var ctl = el(\"div\", \"gpca-ctl\");\n    function mk(act, label, cls, fn) {\n      var b = el(\"button\", cls, label);\n      b.type = \"button\"; b.setAttribute(\"data-act\", act);\n      b.addEventListener(\"click\", fn);\n      ctl.appendChild(b);\n      return b;\n    }\n    var bTurn = mk(\"turn\", T.turnPiece, null, function () { turnPiece(); });\n    var bPlace = mk(\"place\", T.place, \"gpca-go\", function () { place(); });\n    var bUndo = mk(\"undo\", T.undo, null, function () { undo(); });\n    var bReset = mk(\"reset\", T.reset, null, function () { reset(); });\n    [title, intro, tabs, stage, say, tray, ctl].forEach(function (n) { root.appendChild(n); });\n\n    \/* ----- rules ----- *\/\n    function fits(cells) {\n      var S = shp();\n      for (var i = 0; i !== cells.length; i++) {\n        var k = K(cells[i]);\n        if (!S.inS[k] || S.occ[k] !== undefined) return false;\n      }\n      return true;\n    }\n    \/* every way piece p can cover cell c and fit; order is plain enumeration\n       (turn, then which of its cubes sits on c), nothing smarter *\/\n    function optionsAt(p, c) {\n      var out = [], seen = {};\n      PIECES[p].ors.forEach(function (o) {\n        o.forEach(function (oc) {\n          var cells = o.map(function (q) { return [q[0] + c[0] - oc[0], q[1] + c[1] - oc[1], q[2] + c[2] - oc[2]]; });\n          if (!fits(cells)) return;\n          var k = setKey(cells);\n          if (seen[k]) return;\n          seen[k] = 1; out.push(cells);\n        });\n      });\n      return out;\n    }\n    function indexOf(cells) {\n      if (!cells) return -1;\n      var k = setKey(cells);\n      for (var i = 0; i !== opts.length; i++) if (setKey(opts[i]) === k) return i;\n      return -1;\n    }\n    function count() { return Object.keys(shp().at).length; }\n    function complete() { var S = shp(); return Object.keys(S.occ).length === S.cells.length; }\n    function put(p, cells) {\n      var S = shp();\n      S.at[p] = cells;\n      cells.forEach(function (c) { S.occ[K(c)] = p; });\n    }\n    function lift(p) {\n      var S = shp(), cells = S.at[p];\n      cells.forEach(function (c) { delete S.occ[K(c)]; });\n      delete S.at[p];\n      return cells;\n    }\n    function tell(text, isDone) {\n      say.textContent = text;\n      if (isDone) say.setAttribute(\"data-done\", \"1\"); else say.removeAttribute(\"data-done\");\n    }\n    function tellWays() {\n      tell(opts.length === 1 ? T.onlyWay : fmt(T.ways, { i: oi + 1, n: opts.length }));\n    }\n    function tellCount(key) {\n      if (complete()) tell(fmt(T.done, { shape: T.shapes[shp().id] || shp().id }), true);\n      else tell(fmt(T[key], { k: count() }));\n    }\n    function clearGhost() { anchor = null; opts = []; oi = 0; }\n    \/* after anything changes underneath a ghost, keep it if it still fits *\/\n    function refresh() {\n      if (sel \u003e= 0 \u0026\u0026 shp().at[sel]) sel = -1;\n      if (!anchor) return;\n      if (shp().occ[anchor.k] !== undefined) { clearGhost(); return; }\n      if (sel \u003c 0) { opts = []; oi = 0; return; }\n      var was = opts[oi];\n      opts = optionsAt(sel, anchor.c);\n      var j = indexOf(was);\n      oi = j \u003e= 0 ? j : 0;\n    }\n    function aim(c, from) {\n      anchor = { k: K(c), c: c };\n      if (sel \u003c 0) { opts = []; oi = 0; tell(T.pickFirst); nudge(); return; }\n      opts = optionsAt(sel, c);\n      if (!opts.length) { oi = 0; tell(T.nofit); return; }\n      var j = indexOf(from);\n      oi = j \u003e= 0 ? (j + 1) % opts.length : 0;\n      tellWays();\n    }\n    function tapGlass(c) { aim(c, null); sync(); }\n    function tapGhost(c) {\n      if (anchor \u0026\u0026 K(c) === anchor.k) {\n        if (opts.length \u003e 1) oi = (oi + 1) % opts.length;\n        tellWays();\n      } else aim(c, opts[oi]);\n      sync();\n    }\n    function turnPiece() {\n      if (!opts.length) return;\n      oi = (oi + 1) % opts.length;\n      tellWays(); sync();\n    }\n    function place() {\n      if (sel \u003c 0 || !opts.length) return;\n      var cells = opts[oi];\n      if (!fits(cells)) return;               \/* cannot happen: ghosts only ever fit *\/\n      put(sel, cells);\n      shp().hist.push({ t: \"put\", p: sel, cells: cells });\n      sel = -1; clearGhost();\n      tellCount(\"placed\"); sync();\n    }\n    function takeOut(p) {\n      var cells = lift(p);\n      shp().hist.push({ t: \"take\", p: p, cells: cells });\n      refresh(); tellCount(\"out\"); sync();\n    }\n    function undo() {\n      var S = shp(), h = S.hist.pop();\n      if (!h) return;\n      if (h.t === \"put\") lift(h.p);\n      else if (h.t === \"take\") put(h.p, h.cells);\n      else Object.keys(h.at).forEach(function (p) { put(+p, h.at[p]); });\n      refresh(); tellCount(\"undone\"); sync();\n    }\n    function reset() {\n      var S = shp();\n      if (count()) {\n        S.hist.push({ t: \"clear\", at: S.at });\n        S.at = {}; S.occ = {};\n        tell(T.cleared);\n      } else tell(T.start);\n      sel = -1; clearGhost(); sync();\n    }\n    function pickPiece(i) {\n      if (shp().at[i]) { tell(T.already); return; }\n      if (sel === i) { sel = -1; opts = []; oi = 0; tell(T.start); sync(); return; }\n      sel = i;\n      if (anchor) aim(anchor.c, null); else tell(T.picked);\n      sync();\n    }\n    function pickShape(i) {\n      if (i === cur) return;\n      stopSpin(); cur = i; sel = -1; clearGhost();\n      if (complete()) tellCount(\"placed\"); else tell(T.start);\n      sync();\n    }\n    var nudgeT = 0;\n    function nudge() {\n      tray.setAttribute(\"data-nudge\", \"1\");\n      clearTimeout(nudgeT);\n      nudgeT = setTimeout(function () { tray.removeAttribute(\"data-nudge\"); }, 900);\n    }\n\n    \/* ----- view ----- *\/\n    function scene() {\n      var S = shp(), gh = {}, out = [];\n      if (opts.length) opts[oi].forEach(function (c) { gh[K(c)] = 1; });\n      S.cells.forEach(function (c) {\n        var k = K(c), solid = S.occ[k] !== undefined, kind = solid ? \"solid\" : (gh[k] ? \"ghost\" : \"glass\");\n        var show = FACES.map(function (F) {\n          var nk = K([c[0] + F.n[0], c[1] + F.n[1], c[2] + F.n[2]]);\n          if (kind === \"solid\") return S.occ[nk] === undefined;\n          if (kind === \"ghost\") return S.occ[nk] === undefined \u0026\u0026 !gh[nk];\n          return !S.inS[nk];                  \/* glass: only where the shape ends *\/\n        });\n        var p = solid ? S.occ[k] : (kind === \"ghost\" ? sel : -1);\n        out.push({ c: c, k: k, kind: kind, show: show, piece: p, rgb: p \u003e= 0 ? PIECES[p].rgb : null,\n                   mark: !!anchor \u0026\u0026 anchor.k === k, a: ghostA });\n      });\n      return out;\n    }\n    function size(c, ratio) {\n      var w = c.clientWidth || 300, h = Math.round(w * ratio), dpr = window.devicePixelRatio || 1;\n      c.style.height = h + \"px\";\n      if (c.width !== Math.round(w * dpr) || c.height !== Math.round(h * dpr)) {\n        c.width = Math.round(w * dpr); c.height = Math.round(h * dpr);\n      }\n      var ctx = c.getContext(\"2d\");\n      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n      ctx.clearRect(0, 0, w, h);\n      return { ctx: ctx, w: w, h: h };\n    }\n    function render() {\n      var g = size(cv, 0.9), S = shp();\n      W = g.w; H = g.h;\n      var scale = Math.min(W, H) \/ (2 * S.rad + 0.5);\n      list = paint(g.ctx, scene(), cam(S.yaw, S.pitch), scale, S.ctr, [W \/ 2, H \/ 2]);\n    }\n    var raf = 0;\n    function draw() {\n      if (raf) return;\n      raf = requestAnimationFrame(function () { raf = 0; render(); });\n    }\n    \/* the ghost breathes, so it never reads as a piece already put in *\/\n    var ghostA = 0.75, pulse = 0, seen = true;\n    function breathe(now) {\n      pulse = 0;\n      if (!opts.length || reduce) { ghostA = 0.75; return; }\n      ghostA = 0.72 + 0.14 * Math.sin(now \/ 260);\n      if (seen) render();\n      pulse = requestAnimationFrame(breathe);\n    }\n    if (window.IntersectionObserver)\n      new IntersectionObserver(function (es) { seen = es[es.length - 1].isIntersecting; }).observe(cv);\n    var TILE_CAM = cam(0.62, 0.6);\n    function drawTiles() {\n      var fit = Infinity, boxes = PIECES.map(function (p) {\n        var b = extent(p.cells, TILE_CAM);\n        return b;\n      });\n      tiles.forEach(function (t, i) {\n        var g = size(t.cv, 1), b = boxes[i];\n        fit = Math.min(fit, (g.w - 8) \/ Math.max(b[2] - b[0], 2.6), (g.h - 8) \/ Math.max(b[3] - b[1], 2.6));\n      });\n      tiles.forEach(function (t, i) {\n        var g = size(t.cv, 1), p = PIECES[i], b = boxes[i], own = {};\n        p.cells.forEach(function (c) { own[K(c)] = 1; });\n        var items = p.cells.map(function (c) {\n          return { c: c, kind: \"solid\", rgb: p.rgb, show: FACES.map(function (F) {\n            return !own[K([c[0] + F.n[0], c[1] + F.n[1], c[2] + F.n[2]])];\n          }) };\n        });\n        var off = [g.w \/ 2 - (b[0] + b[2]) \/ 2 * fit, g.h \/ 2 - (b[1] + b[3]) \/ 2 * fit];\n        paint(g.ctx, items, TILE_CAM, fit, [0, 0, 0], off);\n      });\n    }\n    function sync() {\n      var S = shp();\n      tabBtns.forEach(function (b, i) { b.setAttribute(\"aria-pressed\", i === cur ? \"true\" : \"false\"); });\n      tiles.forEach(function (t, i) {\n        t.b.setAttribute(\"aria-pressed\", i === sel ? \"true\" : \"false\");\n        if (S.at[i]) t.b.setAttribute(\"data-in\", \"1\"); else t.b.removeAttribute(\"data-in\");\n      });\n      bTurn.disabled = opts.length \u003c 2;\n      bPlace.disabled = !opts.length;\n      bUndo.disabled = !S.hist.length;\n      bReset.disabled = !count() \u0026\u0026 sel \u003c 0 \u0026\u0026 !anchor;\n      cv.setAttribute(\"aria-label\", fmt(T.view, { shape: T.shapes[S.id] || S.id }));\n      if (complete()) root.setAttribute(\"data-done\", S.id); else root.removeAttribute(\"data-done\");\n      if (opts.length \u0026\u0026 !pulse \u0026\u0026 !reduce) pulse = requestAnimationFrame(breathe);\n      draw();\n    }\n\n    \/* ----- turning ----- *\/\n    var spin = 0;\n    function stopSpin() { if (spin) cancelAnimationFrame(spin); spin = 0; }\n    function turnView() {\n      var S = shp(), from = S.yaw, to = from - Math.PI \/ 2, t0 = null;\n      stopSpin();\n      if (reduce) { S.yaw = to; draw(); return; }\n      function step(now) {\n        if (t0 === null) t0 = now;\n        var u = Math.min(1, (now - t0) \/ 380);\n        u = u \u003c 0.5 ? 2 * u * u : 1 - Math.pow(-2 * u + 2, 2) \/ 2;\n        S.yaw = from + (to - from) * u;\n        render();\n        spin = u \u003c 1 ? requestAnimationFrame(step) : 0;\n      }\n      spin = requestAnimationFrame(step);\n    }\n    turnBtn.addEventListener(\"click\", turnView);\n\n    function tapAt(x, y) {\n      render();                               \/* test against exactly what is on screen *\/\n      var r = cv.getBoundingClientRect(), it = hit(list, x - r.left - cv.clientLeft, y - r.top - cv.clientTop);\n      if (!it) return;\n      if (it.kind === \"solid\") takeOut(it.piece);\n      else if (it.kind === \"ghost\") tapGhost(it.c);\n      else tapGlass(it.c);\n    }\n    \/* Asleep, the view leaves a finger to the page (touch-action pan-y, nothing\n       prevented), so a visitor scrolling past is never caught. A tap wakes it and\n       only wakes it; from then on a finger turns it (touch-action none). Once the\n       block has left the screen entirely it falls asleep again. A mouse never\n       fights the page, so it can drag at once; its first click or drag wakes it. *\/\n    var live = false, drag = null;\n    function wake() {\n      if (live) return;\n      live = true; root.setAttribute(\"data-live\", \"1\");\n    }\n    function sleep() {\n      if (!live) return;\n      live = false; drag = null; root.removeAttribute(\"data-live\");\n    }\n    if (window.IntersectionObserver)\n      new IntersectionObserver(function (es) { if (!es[es.length - 1].isIntersecting) sleep(); }).observe(root);\n    else window.addEventListener(\"scroll\", function () {\n      var r = root.getBoundingClientRect();\n      if (r.bottom \u003c= 0 || r.top \u003e= window.innerHeight) sleep();\n    }, { passive: true });\n    cv.addEventListener(\"pointerdown\", function (e) {\n      var mouse = e.pointerType === \"mouse\";\n      if (drag || (mouse \u0026\u0026 e.button !== 0)) return;\n      drag = { id: e.pointerId, x: e.clientX, y: e.clientY, yaw: shp().yaw, pitch: shp().pitch, moved: false,\n               waking: !live, mouse: mouse };\n      if (!live \u0026\u0026 !mouse) return;            \/* asleep: the page may scroll on this finger *\/\n      try { cv.setPointerCapture(e.pointerId); } catch (err) { \/* old browsers *\/ }\n      e.preventDefault();\n    });\n    cv.addEventListener(\"pointermove\", function (e) {\n      if (!drag || e.pointerId !== drag.id) return;\n      var dx = e.clientX - drag.x, dy = e.clientY - drag.y;\n      if (!drag.moved \u0026\u0026 dx * dx + dy * dy \u003c 64) return;\n      drag.moved = true;\n      if (drag.waking \u0026\u0026 !drag.mouse) return; \/* a finger passing over a sleeping view *\/\n      wake(); stopSpin();\n      var S = shp();\n      S.yaw = drag.yaw - dx * 0.011;\n      S.pitch = Math.max(-0.5, Math.min(1.45, drag.pitch + dy * 0.011));\n      draw();\n    });\n    function release(e) {\n      if (!drag || e.pointerId !== drag.id) return;\n      var d = drag;\n      drag = null;\n      if (e.type !== \"pointerup\" || d.moved) return;\n      if (d.waking) wake();                   \/* the waking tap does nothing else *\/\n      else tapAt(e.clientX, e.clientY);\n    }\n    cv.addEventListener(\"pointerup\", release);\n    cv.addEventListener(\"pointercancel\", release);\n    \/* awake, a finger on the view turns it and never scrolls the page *\/\n    cv.addEventListener(\"touchmove\", function (e) { if (live) e.preventDefault(); }, { passive: false });\n    cv.addEventListener(\"keydown\", function (e) {\n      var S = shp(), k = e.key;\n      if (k === \"ArrowLeft\") S.yaw += 0.2;\n      else if (k === \"ArrowRight\") S.yaw -= 0.2;\n      else if (k === \"ArrowUp\") S.pitch = Math.max(-0.5, S.pitch - 0.15);\n      else if (k === \"ArrowDown\") S.pitch = Math.min(1.45, S.pitch + 0.15);\n      else if (k === \"Enter\") { wake(); place(); e.preventDefault(); return; }\n      else return;\n      e.preventDefault(); wake(); stopSpin(); draw();\n    });\n\n    \/* redraw only when the width changes: the canvases set their own heights,\n       which must not feed back into the observer *\/\n    var lastW = -1;\n    function onResize() {\n      var w = root.clientWidth;\n      if (w === lastW) return;\n      lastW = w;\n      requestAnimationFrame(function () { drawTiles(); render(); });\n    }\n    if (window.ResizeObserver) new ResizeObserver(onResize).observe(root);\n    else window.addEventListener(\"resize\", onResize);\n\n        function area(p) {\n      var s = 0;\n      for (var i = 0; i !== p.length; i++) { var a = p[i], b = p[(i + 1) % p.length]; s += a[0] * b[1] - b[0] * a[1]; }\n      return Math.abs(s) \/ 2;\n    }\n\n    sync(); drawTiles(); render();\n  }\n\n  window.GPCA = { mount: mount };\n})();\n(function(){var C={\"v\":1,\"pieces\":[{\"k\":\"V\",\"c\":\"#E8833A\",\"cells\":[[0,0,0],[1,0,0],[0,1,0]]},{\"k\":\"L\",\"c\":\"#02A9F7\",\"cells\":[[0,0,0],[1,0,0],[2,0,0],[0,1,0]]},{\"k\":\"T\",\"c\":\"#3BAA6E\",\"cells\":[[0,0,0],[1,0,0],[2,0,0],[1,1,0]]},{\"k\":\"Z\",\"c\":\"#D9465B\",\"cells\":[[0,0,0],[1,0,0],[1,1,0],[2,1,0]]},{\"k\":\"A\",\"c\":\"#8A63D2\",\"cells\":[[0,0,0],[1,0,0],[0,1,0],[1,0,1]]},{\"k\":\"B\",\"c\":\"#E8C33A\",\"cells\":[[0,0,0],[1,0,0],[0,1,0],[0,1,1]]},{\"k\":\"P\",\"c\":\"#2BB3A6\",\"cells\":[[0,0,0],[1,0,0],[0,1,0],[0,0,1]]}],\"shapes\":[{\"id\":\"castle\",\"cells\":[[0,0,0],[1,0,0],[2,0,0],[3,0,0],[0,1,0],[1,1,0],[2,1,0],[3,1,0],[0,0,1],[1,0,1],[2,0,1],[3,0,1],[0,1,1],[1,1,1],[2,1,1],[3,1,1],[0,0,2],[1,0,2],[2,0,2],[3,0,2],[0,1,2],[1,1,2],[2,1,2],[3,1,2],[0,0,3],[3,0,3],[0,1,3]],\"view\":[0.55,0.5]},{\"id\":\"sofa\",\"cells\":[[0,0,0],[1,0,0],[2,0,0],[3,0,0],[4,0,0],[0,1,0],[1,1,0],[2,1,0],[3,1,0],[4,1,0],[0,0,1],[1,0,1],[2,0,1],[3,0,1],[4,0,1],[0,1,1],[1,1,1],[2,1,1],[3,1,1],[4,1,1],[0,0,2],[1,0,2],[2,0,2],[3,0,2],[4,0,2],[0,1,2],[4,1,2]],\"view\":[2.5916,0.52]},{\"id\":\"tower\",\"cells\":[[0,0,0],[1,0,0],[0,1,0],[1,1,0],[0,0,1],[1,0,1],[0,1,1],[1,1,1],[0,0,2],[1,0,2],[0,1,2],[1,1,2],[0,0,3],[1,0,3],[0,1,3],[1,1,3],[0,0,4],[1,0,4],[0,1,4],[1,1,4],[0,0,5],[1,0,5],[0,1,5],[1,1,5],[0,0,6],[1,0,6],[0,1,6]],\"view\":[0.6,0.36]}]};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gpca \")===-1)r=document.querySelector(\".gpca:not([data-gpca-on])\");function go(){if(r\u0026\u0026window.GPCA\u0026\u0026!r.hasAttribute(\"data-gpca-on\"))window.GPCA.mount(r,C);}if(r\u0026\u0026window.IntersectionObserver){var io=new IntersectionObserver(function(es){for(var i=0;i!==es.length;i++)if(es[i].isIntersecting){io.disconnect();go();return;}},{rootMargin:\"600px 0px\"});io.observe(r);}else go();})();\n\u003c\/script\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":50034802294951,"sku":"GP-CUBEALCH","price":17.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/cube_alchemy_marble.png?v=1782222961"},{"product_id":"loach-bed","title":"Loach Bed | Pack 3 Pieces in Box","description":"\u003cp\u003eThis brand-new Osanori puzzle is one of the most elegant, brilliant packing puzzles I've ever seen in my life.\u003c\/p\u003e\n\u003cp\u003eGoal: fit all three pieces inside the box so nothing sticks out.\u003c\/p\u003e\n\u003cp\u003eShips disassembled.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhy Loach Bed is my favorite Osanori to start with:\u003c\/strong\u003e it uses only one hole, a small MINIMA-style box, two identical pieces and one bigger piece. It's the perfect difficulty for someone enjoying their first Osanori puzzle.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Loach Bed?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eThe best Osanori puzzle for beginners, in my opinion\u003c\/li\u003e\n\u003cli\u003eSmall MINIMA-style box - great desk footprint\u003c\/li\u003e\n\u003cli\u003eDevelops spatial imagination through a single hole\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/osanori-yamamoto\"\u003eOsanori Yamamoto\u003c\/a\u003e\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":50973123149991,"sku":"GP-LOACBED","price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/loach_bed_marble.png?v=1783947884"},{"product_id":"identical-twins","title":"Identical Twins | Assemble 2 Pieces in a Cube","description":"\u003cp\u003eGoal: assemble the two identical pieces inside the cube frame.\u003c\/p\u003e\n\u003cp\u003eSolution level 6.2. Rotations required.\u003c\/p\u003e\n\u003cp\u003eShips disassembled.\u003c\/p\u003e\n\u003cp\u003eTop 3 Osanori puzzles by the Mechanical Puzzle Discord. Won puzzlers' award in IPP37.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Identical Twins?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eTwo identical pieces, one deceptive frame\u003c\/li\u003e\n\u003cli\u003eDevelops 3D spatial imagination\u003c\/li\u003e\n\u003cli\u003eSatisfying 'aha' moment when it clicks\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/osanori-yamamoto\"\u003eOsanori Yamamoto\u003c\/a\u003e\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":50973123805351,"sku":"GP-IDENTWIN","price":22.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/identical_twins_marble_v2.png?v=1784194440"},{"product_id":"conga-line","title":"Conga Line | 6-Piece Packing Puzzle","description":"\u003cp\u003eSix unusually shaped turquoise pieces. One marble-white frame. This innocent-looking puzzle may be tricky to figure out!\u003c\/p\u003e\n\u003cp\u003eGoal: pack all the blue pieces into the frame so nothing sticks out.\u003c\/p\u003e\n\u003cp\u003eThird puzzle from the rising designer \u003ca href=\"\/collections\/samuel-cook\"\u003eSamuel Cook\u003c\/a\u003e following Jigsaw Traffic and Turbulence. \u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Conga Line?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eDevelops advanced spatial imagination\u003c\/li\u003e\n\u003cli\u003eDeceptively tricky piece interactions\u003c\/li\u003e\n\u003cli\u003eSatisfying and clean when solved\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by Samuel Cook\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51109616156839,"sku":"GP-CONGLINE","price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/conga_line_marble.png?v=1786011102"},{"product_id":"snake-cube-puzzle","title":"Snake Cube Puzzle | Fold It Back Into a Cube","description":"\u003ch2\u003eSnake Cube Puzzle - Quick Summary\u003c\/h2\u003e\n\u003cp\u003eThe Snake Cube Puzzle is a 3D-printed puzzle built from 27 cubes linked by an elastic cord into one continuous piece. You unfold the chain freely in seconds. Getting it back into a perfect 3x3x3 cube is the real challenge. Medium difficulty, 30-60 min solve time. Ships assembled.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eOne of the best gifts in the shop.\u003c\/strong\u003e Best for: gift buyers shopping for a colleague, a teenager, or a parent, and first-time solvers picking up their first mechanical puzzle.\u003c\/p\u003e\n\u003ch2\u003eWhat Makes It Tricky\u003c\/h2\u003e\n\u003cp\u003eThere is one correct solution hidden inside the sequence of cube orientations - and finding it is harder than it sounds. The elastic cord holds all 27 cubes together so nothing gets lost. But that same cord means every wrong fold compounds on itself. Undo one cube and you may need to unravel five more before you can correct course.\u003c\/p\u003e\n\u003cp\u003eThe puzzle does not forgive half-measures. You either have it or you do not. That moment when the final piece locks into place - the satisfying snap that tells you the cube is whole again - is the payoff for every failed attempt before it.\u003c\/p\u003e\n\u003ch2\u003ePuzzle Specs\u003c\/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003ePieces:\u003c\/strong\u003e 1 (27 linked cubes)\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eDifficulty:\u003c\/strong\u003e Medium\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSolve Time:\u003c\/strong\u003e 30-60 min\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eTrains:\u003c\/strong\u003e Spatial Thinking\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eShips:\u003c\/strong\u003e Assembled\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\n\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is a snake cube puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA snake cube puzzle is a chain of 27 linked cubes connected by an elastic cord that runs through each piece. The goal is to fold that chain back into a solid 3x3x3 cube - with only one correct sequence of folds that gets you there.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow hard is the Snake Cube Puzzle?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eMedium difficulty. Most solvers can expect to spend 30-60 minutes working through the correct fold sequence before the cube comes together.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho is the Snake Cube Puzzle best for?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eIt is one of the best gifts in the shop - recognisable enough that anyone picks it up, hard enough that it holds them. It also works well as a desk object between solves, compact enough to sit out and satisfying enough to pick up whenever you have a few minutes.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\n\u003cdiv class=\"gpsc\" id=\"gpscRoot\" data-runs=\"[3, 2, 2, 3, 2, 3, 2, 2, 3, 3, 2, 2, 2, 3, 3, 3, 3]\" data-hint=\"0\"\u003e\n\u003ch3\u003eFold the Snake Cube\u003c\/h3\u003e\n\u003cp class=\"gpsc-sub\"\u003eThis is the chain in the photographs, on screen. The opening is placed for you, which only chooses which way up the cube sits; after that every bend is yours.\u003c\/p\u003e\n\u003cdiv class=\"gpsc-bar\"\u003e\n\u003cbutton type=\"button\" data-act=\"undo\"\u003eUndo\u003c\/button\u003e\u003cbutton type=\"button\" data-act=\"turn\"\u003eTurn\u003c\/button\u003e\u003cbutton type=\"button\" data-act=\"reset\"\u003eStart over\u003c\/button\u003e\n\u003c\/div\u003e\n\u003csvg id=\"gpscBoard\" class=\"gpsc-board\" viewbox=\"-110 -105 220 230\"\u003e\u003c\/svg\u003e\u003cp class=\"gpsc-chaincap\"\u003eThe chain laid out flat, the way you would put the real one on a table. Each number is how many cubes are in that straight run, and a dot marks the cube the chain bends at. Filled cubes are the ones you have placed.\u003c\/p\u003e\n\u003csvg id=\"gpscChain\" class=\"gpsc-chain\" viewbox=\"0 0 270 29\"\u003e\u003c\/svg\u003e\u003cp class=\"gpsc-chainlab\" id=\"gpscChainLab\"\u003e\u003c\/p\u003e\n\u003cdiv class=\"gpsc-score\"\u003e\n\u003cdiv\u003e\n\u003cb id=\"gpscDone\"\u003e0\u003c\/b\u003e\u003cspan\u003eof 27 cubes placed\u003c\/span\u003e\n\u003c\/div\u003e\n\u003cdiv\u003e\n\u003cb id=\"gpscBends\"\u003e0\u003c\/b\u003e\u003cspan\u003ebends to go\u003c\/span\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cp class=\"gpsc-say\" id=\"gpscSay\"\u003e\u003c\/p\u003e\n\u003cp class=\"gpsc-foot\"\u003eThe same puzzle in 3D printed plastic is on this page, and there are more to play on the \u003ca href=\"https:\/\/gregpuzzles.com\/pages\/games\"\u003egames\u003c\/a\u003e page.\u003c\/p\u003e\n\u003cstyle\u003e\n\/* em, never rem: this theme sets the root font to 10px. *\/\n.gpsc{--a:#02A9F7;--marble:#F4F3EF;\n --fg:rgb(var(--color-foreground,18,18,18));\n --line:rgba(var(--color-foreground,18,18,18),.14);\n --muted:rgba(var(--color-foreground,18,18,18),.62);\n font-family:inherit;border:1px solid var(--line);border-radius:14px;\n padding:1.1em 1.2em 1em;margin:2em 0;background:var(--marble);color:var(--fg)}\n.gpsc *{box-sizing:border-box;font-family:inherit}\n.gpsc h3{margin:0 0 .2em;font-size:1.25em;line-height:1.25;font-weight:600}\n.gpsc .gpsc-sub{margin:0 0 .9em;color:var(--muted);font-size:.95em;line-height:1.55}\n.gpsc .gpsc-bar{display:flex;flex-wrap:wrap;gap:.4em;align-items:center;margin-bottom:.8em}\n.gpsc button{font:inherit;font-size:.95em;color:var(--fg);background:#fff;\n border:1px solid var(--line);border-radius:8px;padding:.3em .7em;cursor:pointer;line-height:1.3}\n.gpsc button:hover:not(:disabled){border-color:var(--a)}\n.gpsc button:disabled{opacity:.45;cursor:default}\n.gpsc button:focus-visible{outline:2px solid var(--a);outline-offset:2px}\n.gpsc .gpsc-board{background:#fff;border:1px solid var(--line);border-radius:10px;\n touch-action:manipulation;width:100%;max-width:330px;margin:0 auto;display:block}\n.gpsc .gpsc-board .gh{cursor:pointer}\n.gpsc .gpsc-board .gh:hover polygon{fill:#02A9F7;fill-opacity:.55}\n\/* The strip gets the whole block width, not the board's. Capped to the board\n   it rendered at about 12px a cube and the run numbers were unreadable. *\/\n.gpsc .gpsc-chain{width:100%;margin:1em auto .1em;display:block}\n.gpsc .gpsc-chaincap{margin:1.1em 0 0;color:var(--muted);font-size:.86em;line-height:1.45}\n.gpsc .gpsc-chainlab{margin:.3em 0 0;color:var(--muted);font-size:.9em;line-height:1.45}\n.gpsc .gpsc-chainlab b{color:var(--a)}\n.gpsc .gpsc-score{display:flex;gap:1.6em;margin:.9em 0 .2em;flex-wrap:wrap}\n.gpsc .gpsc-score div{display:flex;flex-direction:column;line-height:1.2}\n.gpsc .gpsc-score b{font-size:1.3em;font-weight:600;font-variant-numeric:tabular-nums}\n.gpsc .gpsc-score span{color:var(--muted);font-size:.85em}\n.gpsc .gpsc-say{min-height:1.6em;margin:.5em 0 0;font-size:.98em;line-height:1.5}\n.gpsc .gpsc-say b{color:var(--a)}\n.gpsc .gpsc-own{margin:.7em 0 0;font-size:.92em;line-height:1.5;color:var(--muted)}\n.gpsc .gpsc-own summary{cursor:pointer;color:var(--a)}\n.gpsc .gpsc-own input{font:inherit;font-size:.95em;width:100%;max-width:26em;margin:.5em .4em .4em 0;\n padding:.35em .5em;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--fg)}\n.gpsc .gpsc-foot{margin:.8em 0 0;font-size:.95em;line-height:1.6;color:var(--muted)}\n.gpsc .gpsc-foot a{color:var(--a)}\n@media(max-width:480px){.gpsc{padding:.9em .85em}\/* The strip gets the whole block width, not the board's. Capped to the board\n   it rendered at about 12px a cube and the run numbers were unreadable. *\/\n.gpsc .gpsc-chain{width:100%;margin:1em auto .1em;display:block}\n.gpsc .gpsc-chaincap{margin:1.1em 0 0;color:var(--muted);font-size:.86em;line-height:1.45}\n.gpsc .gpsc-chainlab{margin:.3em 0 0;color:var(--muted);font-size:.9em;line-height:1.45}\n.gpsc .gpsc-chainlab b{color:var(--a)}\n.gpsc .gpsc-score{gap:1.1em}}\n\u003c\/style\u003e\n\u003cscript\u003e\n(function(){\n  var root = document.getElementById('gpscRoot');\n  if(!root || root.dataset.ready) return;\n  root.dataset.ready = '1';\n\n  var N = 3, CELLS = 27;\n  var DIRS = [[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]];\n  var runs = JSON.parse(root.dataset.runs);\n  var allowHint = root.dataset.hint === '1';\n\n  var path, runAt, dir, view, solution, say;\n  var elBoard, elChain, elChainLab, elDone, elBends, elSay;\n\n  function key(p){ return p[0]+','+p[1]+','+p[2]; }\n  function inside(p){ return p[0]\u003e=0\u0026\u0026p[0]\u003cN\u0026\u0026p[1]\u003e=0\u0026\u0026p[1]\u003cN\u0026\u0026p[2]\u003e=0\u0026\u0026p[2]\u003cN; }\n  function perp(d){\n    var o=[]; for(var i=0;i\u003cDIRS.length;i++){\n      var e=DIRS[i]; if(e[0]*d[0]+e[1]*d[1]+e[2]*d[2]===0) o.push(e);\n    } return o;\n  }\n  function cubeCount(r){ var s=0; for(var i=0;i\u003cr.length;i++) s+=r[i]; return s-(r.length-1); }\n\n  \/* Lay run ri going d from pos, with the bend cube already down.\n     Returns a completed path or null. Same search the board uses for hints. *\/\n  function search(occ, pathSoFar, ri, pos, d){\n    if(ri === runs.length) return pathSoFar.slice();\n    var need = runs[ri]-1, added = [], p = pos, i, q;\n    for(i=0;i\u003cneed;i++){\n      p = [p[0]+d[0], p[1]+d[1], p[2]+d[2]];\n      if(!inside(p) || occ[key(p)]){\n        for(q=0;q\u003cadded.length;q++){ delete occ[key(added[q])]; pathSoFar.pop(); }\n        return null;\n      }\n      occ[key(p)] = 1; pathSoFar.push(p); added.push(p);\n    }\n    var opts = perp(d);\n    for(i=0;i\u003copts.length;i++){\n      var r = search(occ, pathSoFar, ri+1, p, opts[i]);\n      if(r) return r;\n    }\n    for(q=0;q\u003cadded.length;q++){ delete occ[key(added[q])]; pathSoFar.pop(); }\n    return null;\n  }\n\n  function solveFrom(pathSoFar, ri, d){\n    var occ = {}, i;\n    for(i=0;i\u003cpathSoFar.length;i++) occ[key(pathSoFar[i])] = 1;\n    var work = pathSoFar.slice();\n    var opts = (d === null) ? DIRS : perp(d);\n    for(i=0;i\u003copts.length;i++){\n      var r = search(occ, work, ri, pathSoFar[pathSoFar.length-1], opts[i]);\n      if(r) return {path:r, first:opts[i]};\n    }\n    return null;\n  }\n\n  function openingFor(r){\n    \/* Take the opening from a real solution so the board always starts legally. *\/\n    var occ, x, y, z, i, j;\n    for(x=0;x\u003cN;x++) for(y=0;y\u003cN;y++) for(z=0;z\u003cN;z++){\n      for(i=0;i\u003cDIRS.length;i++){\n        occ = {}; occ[key([x,y,z])] = 1;\n        var res = search(occ, [[x,y,z]], 0, [x,y,z], DIRS[i]);\n        if(res) return {start:[x,y,z], dir:DIRS[i], solution:res};\n      }\n    }\n    return null;\n  }\n\n  function isCorner(p){\n    return (p[0]===0||p[0]===N-1)\u0026\u0026(p[1]===0||p[1]===N-1)\u0026\u0026(p[2]===0||p[2]===N-1);\n  }\n\n  function reset(){\n    var open = openingFor(runs);\n    if(!open){\n      path=[]; runAt=0; dir=null; solution=null;\n      tell('That chain cannot be folded into a 3 by 3 cube.');\n      draw(); return;\n    }\n    solution = open.solution;\n    path = solution.slice(0, runs[0]);\n    runAt = 1;\n    dir = open.dir;\n    tell(isCorner(open.start)\n      ? 'The first three cubes are placed. That only chooses which way up the cube sits. Now tap a ghost to bend.'\n      : 'The opening is placed to get you going. Tap a ghost cube to bend.');\n    draw();\n  }\n\n  function tell(h){ say = h; if(elSay) elSay.innerHTML = h; }\n\n  function legalMoves(){\n    if(runAt \u003e= runs.length) return [];\n    var occ = {}, i;\n    for(i=0;i\u003cpath.length;i++) occ[key(path[i])] = 1;\n    var head = path[path.length-1], out = [], opts = perp(dir);\n    for(i=0;i\u003copts.length;i++){\n      var d = opts[i], need = runs[runAt]-1, p = head, cells = [], ok = true;\n      for(var k=0;k\u003cneed;k++){\n        p = [p[0]+d[0], p[1]+d[1], p[2]+d[2]];\n        if(!inside(p) || occ[key(p)]){ ok = false; break; }\n        cells.push(p);\n      }\n      if(ok) out.push({dir:d, cells:cells});\n    }\n    return out;\n  }\n\n  \/* ---- isometric drawing ---- *\/\n  function rot(p){\n    var x=p[0], y=p[1], z=p[2], t;\n    for(var i=0;i\u003cview;i++){ t=x; x=y; y=N-1-t; }\n    return [x,y,z];\n  }\n  \/* True isometric: 30 degrees, z straight up. Fit is computed from the box's\n     own projected bounds rather than guessed, so the drawing fills the frame. *\/\n  var S = 34;\n  function proj(x,y,z){\n    return [(x-y)*0.866*S, (x+y)*0.5*S - z*S];\n  }\n  function viewBox(){\n    var xs=[], ys=[], x, y, z;\n    for(x=0;x\u003c=N;x++) for(y=0;y\u003c=N;y++) for(z=0;z\u003c=N;z++){\n      var p = proj(x,y,z); xs.push(p[0]); ys.push(p[1]);\n    }\n    var pad = 10;\n    var x0 = Math.min.apply(null,xs)-pad, x1 = Math.max.apply(null,xs)+pad;\n    var y0 = Math.min.apply(null,ys)-pad, y1 = Math.max.apply(null,ys)+pad;\n    return [x0, y0, x1-x0, y1-y0].map(function(v){ return Math.round(v*10)\/10; }).join(' ');\n  }\n  function faces(c){\n    var x=c[0], y=c[1], z=c[2];\n    var P=function(a,b,d){ return proj(a,b,d).join(','); };\n    return [\n      [P(x,y,z+1),P(x+1,y,z+1),P(x+1,y+1,z+1),P(x,y+1,z+1)],   \/* top *\/\n      [P(x+1,y,z),P(x+1,y+1,z),P(x+1,y+1,z+1),P(x+1,y,z+1)],   \/* +x  *\/\n      [P(x,y+1,z),P(x+1,y+1,z),P(x+1,y+1,z+1),P(x,y+1,z+1)]    \/* +y  *\/\n    ];\n  }\n  function cubeSvg(c, fills, cls, extra){\n    var f = faces(c), s = '', cls2 = cls;\n    s += '\u003cg'+(cls?' class=\"'+cls+'\"':'')+(extra||'')+'\u003e';\n    for(var i=0;i\u003c3;i++){\n      s += '\u003cpolygon points=\"'+f[i].join(' ')+'\" fill=\"'+fills[i]+'\" stroke=\"'+\n           (cls === 'gh' ? 'rgba(2,169,247,.75)\" stroke-dasharray=\"3 2' : 'rgba(0,0,0,.22)')+\n           '\" stroke-width=\"0.9\" stroke-linejoin=\"round\"\/\u003e';\n    }\n    s += '\u003c\/g\u003e';\n    return s;\n  }\n  var SHADE = {\n    \/* two shades for the two parities: the alternating pattern of the box *\/\n    even: ['#7FD8FC','#17A5E8','#0C83BC'],\n    odd:  ['#CFEFFB','#8ED4F2','#64B6DC'],\n    ghost:['rgba(2,169,247,.20)','rgba(2,169,247,.16)','rgba(2,169,247,.12)']\n  };\n\n  \/* The whole chain, laid out flat the way you would lay the real one on a\n     table: 27 cubes, every bend marked, every straight run labelled with its\n     length. Without it a player can see neither the numbers nor what is\n     coming, which the board alone cannot show. *\/\n  function drawChain(){\n    var CW = 10, Y = 15, H = 11, i, j;\n    var w = CELLS*CW, s = ['\u003csvg id=\"gpscChain\" class=\"gpsc-chain\" viewBox=\"-2 0 '+(w+4)+\n      ' 29\" role=\"img\" aria-label=\"The chain, flat, with each straight run labelled\"\u003e'];\n    \/* which cube index ends each run: those are the bends *\/\n    var ends = {}, starts = [], idx = 0;\n    for(i=0;i\u003cruns.length;i++){\n      starts.push(idx);\n      idx = idx + runs[i] - 1;\n      if(i \u003c runs.length-1) ends[idx] = 1;\n    }\n    for(i=0;i\u003cCELLS;i++){\n      var placed = i \u003c path.length;\n      var fill = '#fff', stroke = 'rgba(0,0,0,.22)', sw = '0.8';\n      if(placed){\n        var c = path[i], par = (c[0]+c[1]+c[2]) % 2;\n        fill = par ? SHADE.odd[0] : SHADE.even[1];\n      }\n      if(i === path.length-1){ stroke = '#02A9F7'; sw = '1.8'; }\n      s.push('\u003crect x=\"'+(i*CW+0.8)+'\" y=\"'+Y+'\" width=\"'+(CW-1.6)+'\" height=\"'+H+\n             '\" rx=\"1.6\" fill=\"'+fill+'\" stroke=\"'+stroke+'\" stroke-width=\"'+sw+'\"\/\u003e');\n      if(ends[i]){\n        \/* a bend happens AT this cube: mark it *\/\n        s.push('\u003ccircle cx=\"'+(i*CW+CW\/2)+'\" cy=\"'+(Y+H\/2)+'\" r=\"1.7\" fill=\"'+\n               (placed ? 'rgba(0,0,0,.45)' : 'rgba(0,0,0,.3)')+'\"\/\u003e');\n      }\n    }\n    for(i=0;i\u003cruns.length;i++){\n      var a = starts[i], b = a + runs[i] - 1, mid = (a+b)\/2*CW + CW\/2;\n      var done = (b \u003c path.length);\n      var current = (i === runAt);\n      s.push('\u003ctext x=\"'+mid+'\" y=\"10.5\" text-anchor=\"middle\" font-size=\"9\" '+\n             'font-weight=\"'+(current?'700':'400')+'\" fill=\"'+\n             (current ? '#02A9F7' : (done ? 'rgba(0,0,0,.34)' : 'rgba(0,0,0,.62)'))+\n             '\"\u003e'+runs[i]+'\u003c\/text\u003e');\n    }\n    s.push('\u003c\/svg\u003e');\n    elChain.outerHTML = s.join('');\n    elChain = document.getElementById('gpscChain');\n    if(elChainLab){\n      elChainLab.innerHTML = (runAt \u003c runs.length)\n        ? ('Next: a run of \u003cb\u003e'+runs[runAt]+'\u003c\/b\u003e, then a bend.')\n        : 'Every run is placed.';\n    }\n  }\n\n  function draw(){\n    var items = [], i;\n    for(i=0;i\u003cpath.length;i++){\n      var r = rot(path[i]);\n      items.push({d:r[0]+r[1]+r[2], c:r, kind:'solid', idx:i});\n    }\n    var moves = legalMoves();\n    for(i=0;i\u003cmoves.length;i++){\n      for(var k=0;k\u003cmoves[i].cells.length;k++){\n        var g = rot(moves[i].cells[k]);\n        items.push({d:g[0]+g[1]+g[2], c:g, kind:'ghost', move:i});\n      }\n    }\n    \/* Solids in depth order, then ghosts on top. Depth-sorting the ghosts in\n       with the solids hides any bend that goes behind what is already built,\n       and a hidden ghost cannot be tapped, so the move becomes unreachable.\n       They are translucent and dashed, so reading them as \"possible next\"\n       rather than as solid geometry still works. *\/\n    items.sort(function(a,b){\n      if(a.kind !== b.kind) return a.kind === 'ghost' ? 1 : -1;\n      return a.d - b.d;\n    });\n    var s = ['\u003csvg id=\"gpscBoard\" class=\"gpsc-board\" viewBox=\"'+viewBox()+'\" role=\"img\"'+\n             ' aria-label=\"Snake cube board\"\u003e'];\n    \/* the box it has to fit inside *\/\n    s.push('\u003cg stroke=\"rgba(0,0,0,.18)\" stroke-width=\"1\" fill=\"none\"\u003e');\n    var E = [[[0,0,0],[N,0,0]],[[0,0,0],[0,N,0]],[[0,0,0],[0,0,N]],\n             [[N,0,0],[N,N,0]],[[N,0,0],[N,0,N]],[[0,N,0],[N,N,0]],[[0,N,0],[0,N,N]],\n             [[0,0,N],[N,0,N]],[[0,0,N],[0,N,N]],[[N,N,0],[N,N,N]],[[N,0,N],[N,N,N]],\n             [[0,N,N],[N,N,N]]];\n    for(i=0;i\u003cE.length;i++){\n      var a = proj(E[i][0][0],E[i][0][1],E[i][0][2]), b = proj(E[i][1][0],E[i][1][1],E[i][1][2]);\n      s.push('\u003cline x1=\"'+a[0]+'\" y1=\"'+a[1]+'\" x2=\"'+b[0]+'\" y2=\"'+b[1]+'\"\/\u003e');\n    }\n    s.push('\u003c\/g\u003e');\n    for(i=0;i\u003citems.length;i++){\n      var it = items[i];\n      if(it.kind === 'solid'){\n        var par = (path[it.idx][0]+path[it.idx][1]+path[it.idx][2]) % 2;\n        s.push(cubeSvg(it.c, par ? SHADE.odd : SHADE.even, null, ''));\n      } else {\n        s.push(cubeSvg(it.c, SHADE.ghost, 'gh', ' data-move=\"'+it.move+'\"'));\n      }\n    }\n    s.push('\u003c\/svg\u003e');\n    elBoard.outerHTML = s.join('');\n    elBoard = document.getElementById('gpscBoard');\n    elDone.textContent = path.length;\n    elBends.textContent = Math.max(0, runs.length - runAt);\n    drawChain();\n    elBoard.addEventListener('click', onBoard);\n    if(elSay) elSay.innerHTML = say;\n  }\n\n  function onBoard(e){\n    var g = e.target.closest('g.gh');\n    if(!g) return;\n    play(+g.dataset.move);\n  }\n\n  function play(mi){\n    var moves = legalMoves();\n    if(mi \u003c 0 || mi \u003e= moves.length) return;\n    var m = moves[mi], i;\n    for(i=0;i\u003cm.cells.length;i++) path.push(m.cells[i]);\n    dir = m.dir; runAt++;\n    if(path.length === CELLS){\n      tell('\u003cb\u003eSolved.\u003c\/b\u003e All 27 cubes are in the box, and the colours alternate '+\n           'right through it. That checker pattern is the first thing to watch '+\n           'on the real one.');\n    } else if(legalMoves().length === 0){\n      tell('Stuck: no legal bend from here. Undo and try the other way.');\n    } else {\n      tell('');\n    }\n    draw();\n  }\n\n  function undo(){\n    if(runAt \u003c= 1) return;\n    runAt--;\n    path = path.slice(0, path.length - (runs[runAt]-1));\n    \/* recover the heading from the last two cubes *\/\n    var a = path[path.length-2], b = path[path.length-1];\n    dir = [b[0]-a[0], b[1]-a[1], b[2]-a[2]];\n    tell('');\n    draw();\n  }\n\n  function hint(){\n    var res = solveFrom(path, runAt, dir);\n    if(!res){ tell('No bend from here can finish it. Undo a move or two.'); draw(); return; }\n    var moves = legalMoves();\n    for(var i=0;i\u003cmoves.length;i++){\n      var d = moves[i].dir;\n      if(d[0]===res.first[0] \u0026\u0026 d[1]===res.first[1] \u0026\u0026 d[2]===res.first[2]){\n        play(i);\n        \/* play() has already said something better if that finished it *\/\n        if(path.length \u003c CELLS){\n          tell('\u003cb\u003eThat bend keeps a solution alive.\u003c\/b\u003e The method matters more '+\n               'than the move: keep the chain off its own path, and build the '+\n               'layer you can see.');\n          draw();\n        }\n        return;\n      }\n    }\n  }\n\n  function setRuns(r){\n    runs = r;\n    root.dataset.runs = JSON.stringify(r);\n    reset();\n  }\n\n  root.addEventListener('click', function(e){\n    var b = e.target.closest('button[data-act]');\n    if(!b) return;\n    var a = b.dataset.act;\n    if(a === 'undo') undo();\n    else if(a === 'reset') reset();\n    else if(a === 'turn'){ view = (view+1) % 4; draw(); }\n    else if(a === 'hint') hint();\n    else if(a === 'own'){\n      var raw = root.querySelector('[data-own]').value;\n      var parts = raw.split(\/[^0-9]+\/).filter(function(x){ return x.length; }).map(Number);\n      if(!parts.length){ tell('Type the run lengths, like 3 3 2 3 3 2.'); draw(); return; }\n      for(var i=0;i\u003cparts.length;i++){\n        if(parts[i] \u003c 2){ tell('Every straight run is at least 2 cubes.'); draw(); return; }\n      }\n      if(cubeCount(parts) !== CELLS){\n        tell('That comes to '+cubeCount(parts)+' cubes. A 3 by 3 snake cube has 27.');\n        draw(); return;\n      }\n      setRuns(parts);\n    }\n  });\n\n  elBoard = document.getElementById('gpscBoard');\n  elChain = document.getElementById('gpscChain');\n  elChainLab = document.getElementById('gpscChainLab');\n  elDone = document.getElementById('gpscDone');\n  elBends = document.getElementById('gpscBends');\n  elSay = document.getElementById('gpscSay');\n  view = 0;\n  reset();\n})();\n\u003c\/script\u003e\n\u003c\/div\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51109725765799,"sku":"GP-SNAKCUBE","price":18.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/snake_cube___fold_it_back_into_a_cube_marble.png?v=1786012063"},{"product_id":"turbulence-4-piece-packing-puzzle","title":"Turbulence | 4-Piece Packing Puzzle","description":"\u003cp\u003eSecond puzzle by \u003ca href=\"\/collections\/samuel-cook\"\u003eSamuel Cook\u003c\/a\u003e. Minimal, clean and elegant.  \u003c\/p\u003e\n\u003cp\u003eGoal: pack all 4 blue pieces flat inside the frame so nothing sticks out.\u003c\/p\u003e\n\u003cp\u003eSamuel's sequel to Jigsaw Traffic uses 4 pieces and a sneaky square frame yet again. This time, the pieces are geometric shapes. How would they interact with each other? That is the question! \u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Turbulence?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eDeceptively simple - hard in practice\u003c\/li\u003e\n\u003cli\u003eDevelops 2D spatial reasoning and logic\u003c\/li\u003e\n\u003cli\u003eCompact and satisfying to solve\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by Samuel Cook\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51109743100071,"sku":"GP-TURB","price":22.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/turbulence___4-piece_packing_puzzle_marble.png?v=1786012228"},{"product_id":"fish-tank-3-piece-packing-puzzle","title":"Fish Tank | 3-Piece Packing Puzzle","description":"\u003ch2\u003eQuick Summary\u003c\/h2\u003e\u003cp\u003eFish Tank is a 3-piece packing puzzle designed by Goh Pit Khiam. Pack two fish and a staircase flat inside a square frame so nothing sticks out. Medium difficulty, 3 pieces plus frame, 30-60 min solve time.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like small, clean packing puzzles, and gift buyers who want a compact puzzle that still puts up a fight.\u003c\/p\u003e\n\u003cp\u003eTwo fish and a staircase, one square tank. Three pieces, and they still will not go in.\u003c\/p\u003e\n\u003cp\u003eGoal: pack all 3 pieces flat inside the frame so nothing sticks out.\u003c\/p\u003e\n\u003cp\u003eWith only three pieces there is nowhere to hide. Every wrong attempt is obvious, which is exactly what makes finding the right one feel so good.\u003c\/p\u003e\n\u003cp\u003eIf three pieces are not enough, \u003ca href=\"\/products\/wild-west-4-piece-packing-puzzle\"\u003eWild West\u003c\/a\u003e is the same idea with four: four simple shapes, one square frame, and a fourth piece that ruins everything.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Fish Tank?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eOnly 3 pieces and still a real challenge\u003c\/li\u003e\n\u003cli\u003eDevelops 2D spatial reasoning\u003c\/li\u003e\n\u003cli\u003ePlayful shapes, serious puzzle\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/goh-pit-khiam\"\u003eGoh Pit Khiam\u003c\/a\u003e\u003c\/p\u003e\n\u003cdiv class=\"gptr\" data-handle=\"fish-tank-3-piece-packing-puzzle\"\u003e\n\u003cstyle\u003e\n.gptr{--gptr-fg:rgb(var(--color-foreground,18,18,18));\n --gptr-line:rgba(var(--color-foreground,18,18,18),.18);\n --gptr-muted:rgba(var(--color-foreground,18,18,18),.7);\n --gptr-accent:#0B7FA8;\n font-family:inherit;color:var(--gptr-fg);margin:1.2em 0;max-width:30em;outline:none}\n.gptr:focus{outline:none}\n.gptr:focus-visible{outline:none}\n.gptr:focus-visible .gptr-board svg{outline:2px solid var(--gptr-accent);outline-offset:2px;border-radius:4px}\n.gptr *{box-sizing:border-box}\n.gptr .gptr-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;margin:0 0 .3em;color:var(--gptr-fg)}\n.gptr .gptr-intro{font-size:.92em;line-height:1.5;margin:0 0 .8em;color:var(--gptr-muted);max-width:36em}\n.gptr .gptr-stage{display:flex;flex-direction:column;align-items:flex-start}\n.gptr .gptr-board{width:100%;max-width:24em;direction:ltr}\n.gptr .gptr-board svg{display:block;width:100%;height:auto;max-width:none;\n \/* a finger on the empty tray still scrolls the page; a finger on a piece drags it *\/\n touch-action:pan-y}\n.gptr .gptr-board,.gptr .gptr-rack,.gptr .gptr-ctl button{-webkit-tap-highlight-color:transparent;\n -webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n.gptr .gptr-rack{display:flex;flex-wrap:wrap;gap:.6em;align-items:center;direction:ltr;\n width:100%;max-width:24em;min-height:3.4em;margin-top:.7em;padding:.6em .7em;\n border:1px solid var(--gptr-line);border-radius:7px}\n.gptr[dir=rtl] .gptr-rack{justify-content:flex-end}\n.gptr .gptr-rack svg{display:block;flex:none;touch-action:none;cursor:grab;border-radius:4px;max-width:none}\n.gptr .gptr-rack svg[data-sel]{outline:2px solid var(--gptr-accent);outline-offset:2px}\n.gptr .gptr-none{display:inline-block;min-height:1em}\n.gptr .gptr-ctl{display:flex;flex-wrap:wrap;gap:.45em;margin-top:.8em}\n.gptr .gptr-ctl button{appearance:none;-webkit-appearance:none;margin:0;border:1px solid var(--gptr-line);\n background:transparent;color:var(--gptr-fg);font-family:inherit;font-size:.85em;line-height:1.2;\n letter-spacing:normal;text-transform:none;min-height:2.9em;padding:.6em 1em;border-radius:6px;\n cursor:pointer;box-shadow:none}\n.gptr .gptr-ctl button:hover{border-color:var(--gptr-accent)}\n.gptr .gptr-ctl button:disabled{opacity:.38;cursor:default}\n.gptr .gptr-ctl button:disabled:hover{border-color:var(--gptr-line)}\n.gptr .gptr-say{font-size:.88em;line-height:1.45;color:var(--gptr-muted);min-height:1.45em;margin:.7em 0 0}\n.gptr .gptr-best{font-size:.95em;line-height:1.45;font-weight:600;color:var(--gptr-fg);margin:.3em 0 0}\n.gptr .gptr-end{font-size:1em;line-height:1.45;font-weight:600;color:var(--gptr-accent);margin:.45em 0 0}\n.gptr .gptr-end[hidden]{display:none}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n\/* Greg Puzzles tray teaser (.gptr) - engine.\n   The real tray and the real pieces, quarter turns and flips only. The page\n   carries shapes and nothing else: no positions that finish the puzzle, no\n   finish check, no network calls, and no finished state is ever shown.\n\n   Written to live inside a Shopify product description:\n   - every DOM node is made with createElement \/ createElementNS, so no closing\n     tag ever appears inside a JS string (Shopify reparses body_html);\n   - SVG attributes are set with setAttribute, so viewBox keeps its case;\n   - nothing relies on an empty div being visible (the theme hides div:empty);\n   - hit tests go through the SVG's own screen matrix, never restated numbers.\n\n   Two modes, chosen by the config:\n   - \"place\": pieces come from a rack and go anywhere inside the tray grid.\n   - \"slide\": pieces start outside the tray and get in only by sliding through\n     the opening one square at a time; they turn only while fully outside. *\/\n(function () {\n  \"use strict\";\n  if (window.GPTR) return;\n\n  var NS = \"http:\/\/www.w3.org\/2000\/svg\";\n  var S = 10;                     \/* one grid square in SVG units *\/\n  var seq = 0, clipSeq = 0;\n  var COL = [\"#2E93C4\", \"#17678F\", \"#4FAAD0\", \"#0F4D69\"];\n  var LIGHT = [\"#58B3DD\", \"#2E88B2\", \"#78C6E4\", \"#2A6E8E\"];\n  var PLAY_GAP_CAP = 12000;       \/* idle time between touches counts up to this *\/\n  var EFFORT_MS = 45000;          \/* about 45 seconds of real play *\/\n  var EFFORT_OUTS = 3;            \/* or three pieces taken back out *\/\n\n  var TXT = {\n    en: {\n      title: \"Try it yourself\",\n      introPlace: \"Tap a piece, then tap a square in the tray. Dragging works too.\",\n      introSlide: \"Pieces go in only through the gap in the wall, one square at a time. Tap a piece, then tap where it should slide. Dragging works too.\",\n      rotate: \"Rotate\", flip: \"Flip\", take: \"Take out\", empty: \"Empty the tray\", reset: \"Start over\",\n      best: \"Best so far: {n} of {m} in\",\n      end: \"Still won't fit? That's the puzzle.\",\n      nofit: \"That will not fit there.\",\n      noturn: \"No room to turn it there.\",\n      blocked: \"That piece has nowhere to go that way.\",\n      board: \"Puzzle tray\", rack: \"Pieces\"\n    },\n    he: {\n      title: \"נסו בעצמכם\",\n      introPlace: \"הקישו על חלק ואז על משבצת במגש. אפשר גם לגרור.\",\n      introSlide: \"החלקים נכנסים רק דרך הפתח בדופן, משבצת אחת בכל פעם. הקישו על חלק ואז על המקום שאליו הוא אמור להחליק. אפשר גם לגרור.\",\n      rotate: \"סיבוב\", flip: \"היפוך\", take: \"הוצאה\", empty: \"ריקון המגש\", reset: \"התחלה מחדש\",\n      best: \"השיא עד עכשיו: {n} מתוך {m} בפנים\",\n      end: \"עדיין לא נכנס? זה הפאזל.\",\n      nofit: \"זה לא נכנס שם.\",\n      noturn: \"אין שם מקום לסובב אותו.\",\n      blocked: \"לחלק הזה אין לאן לזוז לכיוון הזה.\",\n      board: \"מגש הפאזל\", rack: \"החלקים\"\n    },\n    ja: {\n      title: \"試してみてください\",\n      introPlace: \"ピースをタップしてから、トレイのマスをタップしてください。ドラッグでも動かせます。\",\n      introSlide: \"ピースは壁のすき間からしか入りません。1マスずつです。ピースをタップしてから、すべらせたい先をタップしてください。ドラッグでも動かせます。\",\n      rotate: \"回転\", flip: \"裏返す\", take: \"取り出す\", empty: \"トレイを空にする\", reset: \"最初から\",\n      best: \"これまでの最高：{m}個中{n}個が入りました\",\n      end: \"まだ入らない？それがこのパズルです。\",\n      nofit: \"そこには入りません。\",\n      noturn: \"そこでは回す余地がありません。\",\n      blocked: \"そのピースはその方向へ動けません。\",\n      board: \"パズルのトレイ\", rack: \"ピース\"\n    }\n  };\n\n  function langOf() {\n    var l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\n    if (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\n    if (l.indexOf(\"ja\") === 0) return \"ja\";\n    return \"en\";\n  }\n  function fmt(s, o) {\n    return s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n  }\n  function el(tag, cls, txt) {\n    var e = document.createElement(tag);\n    if (cls) e.className = cls;\n    if (txt != null) e.textContent = txt;\n    return e;\n  }\n  function sv(tag, attrs) {\n    var e = document.createElementNS(NS, tag);\n    for (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) e.setAttribute(k, attrs[k]);\n    return e;\n  }\n  function clear(node) { while (node.firstChild) node.removeChild(node.firstChild); }\n\n  \/* ---------- shapes: cells are [row, col], rows run down ---------- *\/\n  function norm(cs) {\n    var r0 = Infinity, c0 = Infinity;\n    cs.forEach(function (c) { if (c[0] \u003c r0) r0 = c[0]; if (c[1] \u003c c0) c0 = c[1]; });\n    return cs.map(function (c) { return [c[0] - r0, c[1] - c0]; });\n  }\n  \/* order is kept by both, so a marked cell (the fish's eye) stays marked *\/\n  function rot(cs) { return norm(cs.map(function (c) { return [c[1], -c[0]]; })); }\n  function flp(cs) { return norm(cs.map(function (c) { return [c[0], -c[1]]; })); }\n  function dims(cs) {\n    var h = 0, w = 0;\n    cs.forEach(function (c) { if (c[0] + 1 \u003e h) h = c[0] + 1; if (c[1] + 1 \u003e w) w = c[1] + 1; });\n    return [h, w];\n  }\n  function shift(cs, at) { return cs.map(function (c) { return [c[0] + at[0], c[1] + at[1]]; }); }\n  function copy(cs) { return cs.map(function (c) { return [c[0], c[1]]; }); }\n  function key(r, c) { return r + \",\" + c; }\n  function nearestCell(shape, rel) {\n    var best = shape[0], bd = Infinity;\n    shape.forEach(function (c) {\n      var d = Math.abs(c[0] - rel[0]) + Math.abs(c[1] - rel[1]);\n      if (d \u003c bd) { bd = d; best = c; }\n    });\n    return [best[0], best[1]];\n  }\n\n  \/* ---------- outlines: one rounded path per piece ---------- *\/\n  function outline(cells) {\n    var has = {};\n    cells.forEach(function (c) { has[key(c[0], c[1])] = 1; });\n    var seg = [];\n    cells.forEach(function (c) {\n      var r = c[0], k = c[1];\n      if (!has[key(r - 1, k)]) seg.push([[k, r], [k + 1, r]]);\n      if (!has[key(r + 1, k)]) seg.push([[k, r + 1], [k + 1, r + 1]]);\n      if (!has[key(r, k - 1)]) seg.push([[k, r], [k, r + 1]]);\n      if (!has[key(r, k + 1)]) seg.push([[k + 1, r], [k + 1, r + 1]]);\n    });\n    return seg;\n  }\n  function loops(cells) {\n    var segs = outline(cells).map(function (e) { return [e[0].slice(), e[1].slice()]; });\n    var out = [];\n    while (segs.length) {\n      var ring = [segs[0][0], segs[0][1]];\n      segs.splice(0, 1);\n      var guard = 0;\n      while (guard++ \u003c 400) {\n        var head = ring[ring.length - 1], found = -1;\n        for (var i = 0; i \u003c segs.length; i++) {\n          if (segs[i][0][0] === head[0] \u0026\u0026 segs[i][0][1] === head[1]) { ring.push(segs[i][1]); found = i; break; }\n          if (segs[i][1][0] === head[0] \u0026\u0026 segs[i][1][1] === head[1]) { ring.push(segs[i][0]); found = i; break; }\n        }\n        if (found \u003c 0) break;\n        segs.splice(found, 1);\n        var a = ring[0], b = ring[ring.length - 1];\n        if (a[0] === b[0] \u0026\u0026 a[1] === b[1]) { ring.pop(); break; }\n      }\n      if (ring.length \u003e 2) out.push(ring);\n    }\n    return out;\n  }\n  function roundedPath(ring, r) {\n    \/* drop collinear points first so long straight edges stay one segment *\/\n    var pts = ring.filter(function (p1, i) {\n      var p0 = ring[(i - 1 + ring.length) % ring.length], p2 = ring[(i + 1) % ring.length];\n      return (p1[0] - p0[0]) * (p2[1] - p1[1]) - (p1[1] - p0[1]) * (p2[0] - p1[0]) !== 0;\n    });\n    var d = \"\", n = pts.length;\n    for (var i = 0; i \u003c n; i++) {\n      var p0 = pts[(i - 1 + n) % n], p1 = pts[i], p2 = pts[(i + 1) % n];\n      var v1 = [p1[0] - p0[0], p1[1] - p0[1]], v2 = [p2[0] - p1[0], p2[1] - p1[1]];\n      var l1 = Math.hypot(v1[0], v1[1]) || 1, l2 = Math.hypot(v2[0], v2[1]) || 1;\n      var rr = Math.min(r, l1 \/ 2, l2 \/ 2);\n      var a = [p1[0] - v1[0] \/ l1 * rr, p1[1] - v1[1] \/ l1 * rr];\n      var b = [p1[0] + v2[0] \/ l2 * rr, p1[1] + v2[1] \/ l2 * rr];\n      d += (i === 0 ? \"M\" : \"L\") + a[0].toFixed(2) + \" \" + a[1].toFixed(2);\n      d += \"Q\" + p1[0].toFixed(2) + \" \" + p1[1].toFixed(2) + \" \" + b[0].toFixed(2) + \" \" + b[1].toFixed(2);\n    }\n    return d + \"Z\";\n  }\n  function piecePath(cells) {\n    return loops(cells).map(function (ring) {\n      return roundedPath(ring.map(function (p) { return [p[0] * S, p[1] * S]; }), S * 0.17);\n    }).join(\" \");\n  }\n\n  \/* screen point -\u003e SVG user units, through the element's own matrix *\/\n  function toView(svgEl, x, y) {\n    var m = svgEl.getScreenCTM();\n    if (!m) return { x: NaN, y: NaN };\n    var inv = m.inverse(), q;\n    if (typeof DOMPoint === \"function\") q = new DOMPoint(x, y).matrixTransform(inv);\n    else { var pt = svgEl.createSVGPoint(); pt.x = x; pt.y = y; q = pt.matrixTransform(inv); }\n    return { x: q.x, y: q.y };\n  }\n\n  function mount(root, C) {\n    if (!root || root.getAttribute(\"data-gptr-on\")) return;\n    root.setAttribute(\"data-gptr-on\", \"1\");\n    var L = langOf(), t = TXT[L];\n    root.setAttribute(\"dir\", L === \"he\" ? \"rtl\" : \"ltr\");\n    root.setAttribute(\"lang\", L);\n    root.tabIndex = 0;\n\n    var W = C.grid[0], H = C.grid[1];\n    var SLIDE = C.mode === \"slide\";\n    var uid = \"gptr\" + (++seq) + Math.floor(Math.random() * 1e8).toString(36);\n    var Z = C.zone || null;\n    var OPEN = {};\n    if (C.opening) C.opening.cols.forEach(function (c) { OPEN[c] = 1; });\n\n    var pieces = C.pieces.map(function (p, i) {\n      return {\n        i: i, base: copy(p.cells), shape: copy(p.cells), at: null,\n        hole: p.hole ? p.hole[0] : -1, holeR: p.hole ? p.hole[1] : 0,\n        grab: [p.cells[0][0], p.cells[0][1]], wasIn: false\n      };\n    });\n    function home(p) { return C.start ? [C.start[p.i][0], C.start[p.i][1]] : null; }\n    if (SLIDE) pieces.forEach(function (p) { p.at = home(p); });\n\n    var sel = null, drag = null, tap = null, msg = \"\";\n    var best = 0, outs = 0, playMs = 0, lastAct = 0, endOn = false;\n\n    \/* ---------- rules ---------- *\/\n    function free(r, c) {\n      if (r \u003e= 0 \u0026\u0026 r \u003c H \u0026\u0026 c \u003e= 0 \u0026\u0026 c \u003c W) return true;          \/* the tray grid *\/\n      if (!SLIDE) return false;\n      if (r === -1) return OPEN[c] === 1;                             \/* the wall: only its gap *\/\n      return r \u003e= Z.top \u0026\u0026 r \u003c= -2 \u0026\u0026 c \u003e= Z.left \u0026\u0026 c \u003c= Z.right;    \/* the table outside *\/\n    }\n    function occupied(skip) {\n      var o = {};\n      pieces.forEach(function (q) {\n        if (q === skip || !q.at) return;\n        shift(q.shape, q.at).forEach(function (c) { o[key(c[0], c[1])] = 1; });\n      });\n      return o;\n    }\n    function legal(p, shape, at) {\n      var o = occupied(p), cs = shift(shape, at);\n      for (var i = 0; i \u003c cs.length; i++) {\n        if (!free(cs[i][0], cs[i][1]) || o[key(cs[i][0], cs[i][1])]) return false;\n      }\n      return true;\n    }\n    function cellsOf(p) { return p.at ? shift(p.shape, p.at) : null; }\n    function allOutside(cs) { return cs.every(function (c) { return c[0] \u003c= -2; }); }\n    function isIn(p) {\n      var cs = cellsOf(p);\n      return !!cs \u0026\u0026 cs.every(function (c) { return c[0] \u003e= 0 \u0026\u0026 c[0] \u003c H \u0026\u0026 c[1] \u003e= 0 \u0026\u0026 c[1] \u003c W; });\n    }\n    function isOut(p) { return SLIDE ? allOutside(cellsOf(p)) : !p.at; }\n    function engaged(p) { return SLIDE ? !isOut(p) : !!p.at; }\n\n    function step(p, dr, dc) {\n      var at = [p.at[0] + dr, p.at[1] + dc];\n      if (!legal(p, p.shape, at)) return false;\n      p.at = at;\n      return true;\n    }\n    \/* slide one square at a time toward a target, the bigger pull first and\n       the other axis when that is blocked *\/\n    function toward(p, target, grab) {\n      var moved = 0;\n      for (var g = 0; g \u003c 40; g++) {\n        var dr = target[0] - grab[0] - p.at[0], dc = target[1] - grab[1] - p.at[1];\n        if (!dr \u0026\u0026 !dc) break;\n        var sr = dr \u003e 0 ? 1 : (dr \u003c 0 ? -1 : 0), sc = dc \u003e 0 ? 1 : (dc \u003c 0 ? -1 : 0);\n        var tries = Math.abs(dr) \u003e= Math.abs(dc) ? [[sr, 0], [0, sc]] : [[0, sc], [sr, 0]];\n        var ok = false;\n        for (var i = 0; i \u003c 2; i++) {\n          if (!tries[i][0] \u0026\u0026 !tries[i][1]) continue;\n          if (step(p, tries[i][0], tries[i][1])) { ok = true; break; }\n        }\n        if (!ok) break;\n        moved++;\n      }\n      return moved;\n    }\n    \/* tap-to-place: the touched square of the piece lands on the tapped square\n       if it can; otherwise any other square of the piece that lets it fit *\/\n    function placeNear(p, cell) {\n      var anchors = p.shape.map(function (c, i) {\n        return { c: c, i: i, d: Math.abs(c[0] - p.grab[0]) + Math.abs(c[1] - p.grab[1]) };\n      });\n      anchors.sort(function (a, b) { return (a.d - b.d) || (a.i - b.i); });\n      for (var k = 0; k \u003c anchors.length; k++) {\n        var at = [cell[0] - anchors[k].c[0], cell[1] - anchors[k].c[1]];\n        if (legal(p, p.shape, at)) { p.at = at; return true; }\n      }\n      return false;\n    }\n    function turn(p, fn) {\n      var ns = fn(p.shape);\n      if (!p.at) { p.shape = ns; return true; }\n      if (SLIDE \u0026\u0026 !isOut(p)) return false;\n      var d0 = dims(p.shape), d1 = dims(ns);\n      var base = [p.at[0] + Math.round((d0[0] - d1[0]) \/ 2), p.at[1] + Math.round((d0[1] - d1[1]) \/ 2)];\n      var offs = [];\n      for (var dr = -2; dr \u003c= 2; dr++) for (var dc = -2; dc \u003c= 2; dc++) offs.push([dr, dc]);\n      offs.sort(function (a, b) {\n        return (Math.abs(a[0]) + Math.abs(a[1])) - (Math.abs(b[0]) + Math.abs(b[1]));\n      });\n      for (var i = 0; i \u003c offs.length; i++) {\n        var at = [base[0] + offs[i][0], base[1] + offs[i][1]];\n        if (legal(p, ns, at) \u0026\u0026 (!SLIDE || allOutside(shift(ns, at)))) { p.shape = ns; p.at = at; return true; }\n      }\n      return false;\n    }\n    \/* slide mode: lift a piece out and set it down on the table, near its start *\/\n    function sendHome(p) {\n      var h = home(p), shapes = [p.shape, p.base];\n      for (var s = 0; s \u003c shapes.length; s++) {\n        var sh = shapes[s], dm = dims(sh), bestAt = null, bd = Infinity;\n        for (var r = Z.top; r + dm[0] - 1 \u003c= -2; r++) {\n          for (var c = Z.left; c + dm[1] - 1 \u003c= Z.right; c++) {\n            if (!legal(p, sh, [r, c])) continue;\n            var d = Math.abs(r - h[0]) + Math.abs(c - h[1]);\n            if (d \u003c bd) { bd = d; bestAt = [r, c]; }\n          }\n        }\n        if (bestAt) { p.shape = copy(sh); p.at = bestAt; return true; }\n      }\n      return false;\n    }\n\n    \/* ---------- effort and the best count ---------- *\/\n    function act() {\n      var now = Date.now();\n      if (lastAct) playMs += Math.min(Math.max(0, now - lastAct), PLAY_GAP_CAP);\n      lastAct = now;\n    }\n    function settle() {\n      var n = 0;\n      pieces.forEach(function (p) {\n        if (isIn(p)) { n++; p.wasIn = true; }\n        else if (p.wasIn \u0026\u0026 isOut(p)) { outs++; p.wasIn = false; }\n      });\n      if (n \u003e best) best = n;\n      if (!endOn \u0026\u0026 (outs \u003e= EFFORT_OUTS || playMs \u003e= EFFORT_MS)) endOn = true;\n      render();\n    }\n\n    \/* ---------- DOM ---------- *\/\n    root.appendChild(el(\"h3\", \"gptr-h\", t.title));\n    root.appendChild(el(\"p\", \"gptr-intro\", SLIDE ? t.introSlide : t.introPlace));\n    var stage = el(\"div\", \"gptr-stage\");\n    var boardEl = el(\"div\", \"gptr-board\");\n    boardEl.setAttribute(\"dir\", \"ltr\");\n    stage.appendChild(boardEl);\n    var rackEl = null;\n    if (!SLIDE) {\n      rackEl = el(\"div\", \"gptr-rack\");\n      rackEl.setAttribute(\"dir\", \"ltr\");\n      rackEl.setAttribute(\"role\", \"group\");\n      rackEl.setAttribute(\"aria-label\", t.rack);\n      stage.appendChild(rackEl);\n    }\n    root.appendChild(stage);\n    var ctl = el(\"div\", \"gptr-ctl\");\n    function button(label, name) {\n      var b = el(\"button\", \"gptr-btn\", label);\n      b.type = \"button\";\n      b.setAttribute(\"data-act\", name);\n      ctl.appendChild(b);\n      return b;\n    }\n    var bRot = button(t.rotate, \"rotate\"), bFlip = button(t.flip, \"flip\"),\n        bTake = button(t.take, \"take\"), bEmpty = button(t.empty, \"empty\"), bReset = button(t.reset, \"reset\");\n    root.appendChild(ctl);\n    var sayEl = el(\"p\", \"gptr-say\", \" \");\n    sayEl.setAttribute(\"aria-live\", \"polite\");\n    var bestEl = el(\"p\", \"gptr-best\", \"\");\n    var endEl = el(\"p\", \"gptr-end\", t.end);\n    endEl.hidden = true;\n    root.appendChild(sayEl);\n    root.appendChild(bestEl);\n    root.appendChild(endEl);\n\n    \/* ---------- the board SVG: built once, only the piece layer is redrawn ---------- *\/\n    var cw = C.cavity[0], ch = C.cavity[1];\n    var offX = (cw - W) \/ 2, offY = (ch - H) \/ 2;      \/* grid centred in the cavity *\/\n    var R = C.rim * S;\n    var cx = -offX * S, cy = -offY * S;\n    var wallT = SLIDE ? C.opening.wall * S : R;\n    var vb;\n    if (SLIDE) {\n      var M = 1.5;\n      vb = [Z.left * S - M, Z.top * S - M, (Z.right - Z.left + 1) * S + 2 * M, (H - Z.top) * S + R + 2 * M];\n    } else {\n      vb = [cx - R, cy - R, cw * S + 2 * R, ch * S + 2 * R];\n    }\n    var svgEl = sv(\"svg\", { width: \"100%\", role: \"img\", \"aria-label\": t.board, \"data-s\": String(S) });\n    svgEl.setAttribute(\"viewBox\", vb.map(function (v) { return +v.toFixed(3); }).join(\" \"));\n    svgEl.style.aspectRatio = vb[2].toFixed(3) + \" \/ \" + vb[3].toFixed(3);\n    var defs = sv(\"defs\", {});\n    COL.forEach(function (c, k) {\n      var g = sv(\"linearGradient\", { id: uid + \"g\" + k, x1: \"0\", y1: \"0\", x2: \"0\", y2: \"1\" });\n      g.appendChild(sv(\"stop\", { offset: \"0\", \"stop-color\": LIGHT[k] }));\n      g.appendChild(sv(\"stop\", { offset: \"1\", \"stop-color\": c }));\n      defs.appendChild(g);\n    });\n    var soft = sv(\"filter\", { id: uid + \"soft\", x: \"-20%\", y: \"-20%\", width: \"140%\", height: \"140%\" });\n    soft.appendChild(sv(\"feGaussianBlur\", { stdDeviation: \"0.5\" }));\n    defs.appendChild(soft);\n    var grain = sv(\"filter\", { id: uid + \"grain\", x: \"0\", y: \"0\", width: \"100%\", height: \"100%\" });\n    grain.appendChild(sv(\"feTurbulence\", { type: \"fractalNoise\", baseFrequency: \"0.9\", numOctaves: \"3\", seed: \"4\" }));\n    grain.appendChild(sv(\"feColorMatrix\", { type: \"saturate\", values: \"0\" }));\n    var ct = sv(\"feComponentTransfer\", {});\n    ct.appendChild(sv(\"feFuncA\", { type: \"discrete\", tableValues: \"0 0 0 0 .5\" }));\n    grain.appendChild(ct);\n    defs.appendChild(grain);\n    svgEl.appendChild(defs);\n\n    var trayG = sv(\"g\", { \"data-layer\": \"tray\" });\n    function speckled(x, y, w, h, rx, base, op) {\n      trayG.appendChild(sv(\"rect\", { x: x, y: y, width: w, height: h, rx: rx, fill: base }));\n      trayG.appendChild(sv(\"rect\", { x: x, y: y, width: w, height: h, rx: rx, fill: \"#8A8275\",\n        \"fill-opacity\": op, filter: \"url(#\" + uid + \"grain)\" }));\n    }\n    if (SLIDE) {\n      \/* the table the pieces wait on, and the strip that leads into the gap *\/\n      var gx0 = cx + C.opening.from * S, gx1 = cx + C.opening.to * S;\n      var mat = { fill: \"#8A8275\", \"fill-opacity\": \".07\", stroke: \"rgba(80,74,64,.22)\",\n        \"stroke-width\": \".4\", \"stroke-dasharray\": \"1.6 1.4\" };\n      var m1 = { x: Z.left * S, y: Z.top * S, width: (Z.right - Z.left + 1) * S, height: (-1 - Z.top) * S, rx: \"2\" };\n      for (var mk in mat) m1[mk] = mat[mk];\n      trayG.appendChild(sv(\"rect\", m1));\n      trayG.appendChild(sv(\"rect\", { x: gx0, y: -S - 0.2, width: gx1 - gx0, height: S - wallT + 0.4,\n        fill: \"#8A8275\", \"fill-opacity\": \".07\" }));\n    }\n    speckled(cx - R, cy - wallT, cw * S + 2 * R, ch * S + R + wallT, \"3\", \"#EDEAE3\", \".5\");\n    speckled(cx, cy, cw * S, ch * S, \"1.6\", \"#F6F4EF\", \".28\");\n    trayG.appendChild(sv(\"rect\", { x: cx, y: cy, width: cw * S, height: ch * S, rx: \"1.6\", fill: \"none\",\n      stroke: \"rgba(80,74,64,.30)\", \"stroke-width\": \".5\" }));\n    if (SLIDE) {\n      \/* the gap in the wall: floor runs through it *\/\n      var g0 = cx + C.opening.from * S, g1 = cx + C.opening.to * S;\n      speckled(g0, cy - wallT - 0.01, g1 - g0, wallT + 1.2, \"0\", \"#F6F4EF\", \".28\");\n      trayG.appendChild(sv(\"path\", { d: \"M\" + g0 + \" \" + (cy - wallT) + \"V\" + cy + \"M\" + g1 + \" \" + (cy - wallT) + \"V\" + cy,\n        stroke: \"rgba(80,74,64,.30)\", \"stroke-width\": \".5\", fill: \"none\" }));\n    }\n    svgEl.appendChild(trayG);\n    var pieceG = sv(\"g\", { \"data-layer\": \"pieces\" });\n    svgEl.appendChild(pieceG);\n    boardEl.appendChild(svgEl);\n\n    function pieceNode(p, cells, opts) {\n      var k = p.i % COL.length;\n      var g = sv(\"g\", { \"data-p\": String(p.i), style: \"cursor:grab;touch-action:none\" });\n      g.setAttribute(\"data-cells\", cells.map(function (c) { return c[0] + \",\" + c[1]; }).join(\" \"));\n      if (opts.sel) g.setAttribute(\"data-sel\", \"1\");\n      var d = piecePath(cells);\n      if (opts.ghost) {\n        g.setAttribute(\"data-ghost\", \"1\");\n        g.setAttribute(\"data-bad\", opts.bad ? \"1\" : \"0\");\n        g.setAttribute(\"pointer-events\", \"none\");\n      } else {\n        g.appendChild(sv(\"path\", { d: d, fill: \"rgba(18,32,40,.22)\", transform: \"translate(0.5,0.9)\",\n          filter: \"url(#\" + uid + \"soft)\", \"pointer-events\": \"none\" }));\n      }\n      g.appendChild(sv(\"path\", { d: d, fill: \"url(#\" + uid + \"g\" + k + \")\",\n        \"fill-opacity\": opts.ghost ? \".45\" : \"1\",\n        stroke: opts.bad ? \"#C2544C\" : (opts.sel ? \"#0B7FA8\" : \"rgba(10,26,34,.42)\"),\n        \"stroke-width\": opts.sel || opts.bad ? \"1.1\" : \".45\", \"stroke-linejoin\": \"round\" }));\n      if (!opts.ghost) {\n        var cid = uid + \"c\" + (++clipSeq);\n        var clip = sv(\"clipPath\", { id: cid });\n        clip.appendChild(sv(\"path\", { d: d }));\n        g.appendChild(clip);\n        g.appendChild(sv(\"path\", { d: d, fill: \"none\", stroke: \"rgba(255,255,255,.34)\", \"stroke-width\": \".5\",\n          \"stroke-linejoin\": \"round\", transform: \"translate(0,0.45)\", \"clip-path\": \"url(#\" + cid + \")\",\n          \"pointer-events\": \"none\" }));\n      }\n      if (p.hole \u003e= 0 \u0026\u0026 cells[p.hole]) {\n        var hc = cells[p.hole];\n        g.appendChild(sv(\"circle\", { cx: (hc[1] + 0.5) * S, cy: (hc[0] + 0.5) * S, r: (p.holeR * S).toFixed(2),\n          fill: \"#E9E5DC\", \"fill-opacity\": opts.ghost ? \".5\" : \"1\", stroke: \"rgba(10,26,34,.45)\", \"stroke-width\": \".45\" }));\n      }\n      return g;\n    }\n\n    function drawPieces() {\n      clear(pieceG);\n      pieces.forEach(function (p) {\n        if (!p.at) return;\n        if (!SLIDE \u0026\u0026 drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) return;   \/* lifted: the ghost shows it *\/\n        pieceG.appendChild(pieceNode(p, cellsOf(p), { sel: sel === p }));\n      });\n      if (!SLIDE \u0026\u0026 drag \u0026\u0026 drag.live \u0026\u0026 !drag.off) {\n        pieceG.appendChild(pieceNode(drag.p, drag.cells, { ghost: true, bad: !drag.ok }));\n      }\n    }\n    var rackEm = 1.4;\n    if (rackEl) {\n      var tw = 0;\n      pieces.forEach(function (p) { tw += dims(p.base)[1]; });\n      rackEm = Math.max(0.95, Math.min(1.4, 18 \/ tw));\n    }\n    function drawRack() {\n      if (!rackEl) return;\n      clear(rackEl);\n      var any = false;\n      pieces.forEach(function (p) {\n        if (p.at) return;\n        any = true;\n        var dm = dims(p.shape);\n        var s = sv(\"svg\", { \"data-p\": String(p.i), \"data-s\": String(S), role: \"img\" });\n        s.setAttribute(\"viewBox\", \"-0.6 -0.6 \" + (dm[1] * S + 1.2) + \" \" + (dm[0] * S + 1.2));\n        s.style.width = (dm[1] * rackEm).toFixed(3) + \"em\";\n        s.style.height = (dm[0] * rackEm).toFixed(3) + \"em\";\n        if (sel === p) s.setAttribute(\"data-sel\", \"1\");\n        if (drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) s.style.opacity = \".35\";\n        s.appendChild(pieceNode(p, p.shape, { sel: sel === p }));\n        rackEl.appendChild(s);\n      });\n      if (!any) rackEl.appendChild(el(\"span\", \"gptr-none\", \" \"));\n    }\n    function turnTarget() {\n      if (sel) return (SLIDE \u0026\u0026 !isOut(sel)) ? null : sel;\n      for (var i = 0; i \u003c pieces.length; i++) {\n        if (SLIDE ? isOut(pieces[i]) : !pieces[i].at) return pieces[i];\n      }\n      return null;\n    }\n    function render() {\n      drawPieces();\n      drawRack();\n      var tt = turnTarget(), had = document.activeElement;\n      bRot.disabled = bFlip.disabled = !tt;\n      bTake.disabled = !(sel \u0026\u0026 engaged(sel));\n      bEmpty.disabled = !pieces.some(engaged);\n      \/* a button that just went disabled drops focus to the page, and the\n         arrow keys with it: keep them working on the board *\/\n      if (had \u0026\u0026 had.parentNode === ctl \u0026\u0026 had.disabled) focusRoot();\n      sayEl.textContent = msg || \" \";\n      bestEl.textContent = fmt(t.best, { n: best, m: pieces.length });\n      endEl.hidden = !endOn;\n    }\n\n    \/* ---------- input ---------- *\/\n    function focusRoot() { try { root.focus({ preventScroll: true }); } catch (e) { \/* old browsers *\/ } }\n    function boardCell(ev) {\n      var q = toView(svgEl, ev.clientX, ev.clientY);\n      var r = Math.floor(q.y \/ S), c = Math.floor(q.x \/ S);\n      if (!SLIDE \u0026\u0026 q.x \u003e= cx \u0026\u0026 q.x \u003c= cx + cw * S \u0026\u0026 q.y \u003e= cy \u0026\u0026 q.y \u003c= cy + ch * S) {\n        \/* inside the cavity but in its slack around the grid: snap to the edge squares *\/\n        r = Math.max(0, Math.min(H - 1, r));\n        c = Math.max(0, Math.min(W - 1, c));\n      }\n      return [r, c];\n    }\n    function overBoard(ev) {\n      var b = svgEl.getBoundingClientRect();\n      return ev.clientX \u003e= b.left \u0026\u0026 ev.clientX \u003c= b.right \u0026\u0026 ev.clientY \u003e= b.top \u0026\u0026 ev.clientY \u003c= b.bottom;\n    }\n    function startDrag(p, ev, fromRack, grab, fallTap, downCell) {\n      if (ev.cancelable) ev.preventDefault();\n      try { (fromRack ? rackEl : svgEl).setPointerCapture(ev.pointerId); } catch (e) { \/* synthetic pointer *\/ }\n      drag = { p: p, fromRack: fromRack, grab: grab, sx: ev.clientX, sy: ev.clientY, pid: ev.pointerId,\n        live: false, off: true, ok: false, at: null, cells: null, fallTap: fallTap, downCell: downCell };\n      window.addEventListener(\"pointermove\", onMove);\n      window.addEventListener(\"pointerup\", onUp);\n      window.addEventListener(\"pointercancel\", onCancel);\n    }\n    function endListen() {\n      window.removeEventListener(\"pointermove\", onMove);\n      window.removeEventListener(\"pointerup\", onUp);\n      window.removeEventListener(\"pointercancel\", onCancel);\n    }\n    function onMove(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      if (!drag.live) {\n        if (Math.abs(ev.clientX - drag.sx) + Math.abs(ev.clientY - drag.sy) \u003c 6) return;\n        drag.live = true;\n        if (drag.fromRack) drawRack();\n      }\n      var cell = boardCell(ev);\n      if (SLIDE) {\n        if (toward(drag.p, cell, drag.grab)) msg = \"\";\n        drawPieces();\n        return;\n      }\n      if (!overBoard(ev)) { drag.off = true; drag.cells = null; drawPieces(); return; }\n      drag.off = false;\n      drag.at = [cell[0] - drag.grab[0], cell[1] - drag.grab[1]];\n      drag.cells = shift(drag.p.shape, drag.at);\n      drag.ok = legal(drag.p, drag.p.shape, drag.at);\n      drawPieces();\n    }\n    function onUp(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      var d = drag;\n      drag = null;\n      act();\n      if (!d.live) {                                  \/* a tap, not a drag *\/\n        if (d.fallTap) { boardTap(d.downCell); return; }\n        d.p.grab = d.grab;\n        sel = (sel === d.p) ? null : d.p;\n        msg = \"\";\n        settle();\n        return;\n      }\n      if (SLIDE) { sel = d.p; d.p.grab = d.grab; settle(); return; }\n      if (d.off) {\n        if (d.p.at) d.p.at = null;                    \/* dragged off the board: back with the pieces *\/\n        msg = \"\";\n      } else if (d.ok) {\n        d.p.at = d.at;\n        sel = null;\n        msg = \"\";\n      } else {\n        msg = t.nofit;\n      }\n      settle();\n    }\n    function onCancel(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      drag = null;\n      settle();\n    }\n    function boardTap(cell) {\n      if (!sel) { render(); return; }\n      if (SLIDE) {\n        msg = toward(sel, cell, sel.grab) ? \"\" : t.blocked;\n      } else if (placeNear(sel, cell)) {\n        sel = null;\n        msg = \"\";\n      } else {\n        msg = t.nofit;\n      }\n      settle();\n    }\n\n    svgEl.addEventListener(\"pointerdown\", function (ev) {\n      if (ev.button \u003e 0) return;\n      act();\n      focusRoot();\n      var hit = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      var cell = boardCell(ev);\n      if (hit \u0026\u0026 !hit.getAttribute(\"data-ghost\")) {\n        var p = pieces[+hit.getAttribute(\"data-p\")];\n        var grab = nearestCell(p.shape, [cell[0] - p.at[0], cell[1] - p.at[1]]);\n        \/* a piece in hand from the rack wants to be placed: a tap on a piece in\n           the tray is an attempt to put it there *\/\n        var fall = !SLIDE \u0026\u0026 !!sel \u0026\u0026 !sel.at \u0026\u0026 sel !== p;\n        startDrag(p, ev, false, grab, fall, cell);\n        return;\n      }\n      tap = { x: ev.clientX, y: ev.clientY, pid: ev.pointerId, cell: cell };\n    });\n    svgEl.addEventListener(\"pointerup\", function (ev) {\n      if (!tap || ev.pointerId !== tap.pid) return;\n      var t0 = tap;\n      tap = null;\n      if (Math.abs(ev.clientX - t0.x) + Math.abs(ev.clientY - t0.y) \u003e 10) return;\n      act();\n      boardTap(t0.cell);\n    });\n    svgEl.addEventListener(\"pointercancel\", function () { tap = null; });\n    \/* a finger that lands on a piece drags it; anywhere else the page still scrolls *\/\n    svgEl.addEventListener(\"touchstart\", function (ev) {\n      var h = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      if (h \u0026\u0026 ev.cancelable) ev.preventDefault();\n    }, { passive: false });\n\n    if (rackEl) {\n      rackEl.addEventListener(\"pointerdown\", function (ev) {\n        if (ev.button \u003e 0) return;\n        var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n        if (!s) return;\n        act();\n        focusRoot();\n        var p = pieces[+s.getAttribute(\"data-p\")];\n        var q = toView(s, ev.clientX, ev.clientY);\n        startDrag(p, ev, true, nearestCell(p.shape, [Math.floor(q.y \/ S), Math.floor(q.x \/ S)]), false, null);\n      });\n      rackEl.addEventListener(\"touchstart\", function (ev) {\n        var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n        if (s \u0026\u0026 ev.cancelable) ev.preventDefault();\n      }, { passive: false });\n    }\n\n    root.addEventListener(\"keydown\", function (e) {\n      var d = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] }[e.key];\n      if (!d || !sel || !sel.at) return;\n      e.preventDefault();\n      act();\n      if (SLIDE) {\n        msg = step(sel, d[0], d[1]) ? \"\" : t.blocked;\n      } else {\n        var at = [sel.at[0] + d[0], sel.at[1] + d[1]];\n        if (legal(sel, sel.shape, at)) { sel.at = at; msg = \"\"; } else msg = t.nofit;\n      }\n      settle();\n    });\n\n    function turnBtn(fn) {\n      return function () {\n        act();\n        var p = turnTarget();\n        if (!p) { render(); return; }\n        if (turn(p, fn)) { sel = p; msg = \"\"; } else msg = t.noturn;\n        settle();\n      };\n    }\n    bRot.addEventListener(\"click\", turnBtn(rot));\n    bFlip.addEventListener(\"click\", turnBtn(flp));\n    bTake.addEventListener(\"click\", function () {\n      act();\n      if (!sel || !engaged(sel)) { render(); return; }\n      if (SLIDE) sendHome(sel); else sel.at = null;\n      msg = \"\";\n      settle();\n    });\n    bEmpty.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) {\n        if (!engaged(p)) return;\n        if (SLIDE) sendHome(p); else p.at = null;\n      });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n    bReset.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) { p.shape = copy(p.base); p.at = home(p); p.grab = [p.base[0][0], p.base[0][1]]; });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n\n    settle();\n  }\n\n  window.GPTR = { mount: mount, v: 1 };\n})();\n(function(){var C={\"v\":1,\"mode\":\"place\",\"grid\":[5,5],\"rim\":0.3,\"pieces\":[{\"cells\":[[0,1],[1,0],[1,1],[1,2],[2,1],[2,2]],\"hole\":[3,0.2327]},{\"cells\":[[0,1],[1,0],[1,1],[1,2],[2,1],[2,2]],\"hole\":[3,0.2327]},{\"cells\":[[0,0],[0,1],[1,1],[1,2],[2,2],[2,3]]}],\"cavity\":[5.0133,5.0133]};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gptr \")\u003c0)r=document.querySelector(\".gptr:not([data-gptr-on])\");if(r\u0026\u0026window.GPTR)window.GPTR.mount(r,C);})();\n\u003c\/script\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51325795827879,"sku":"GP-FISHTANK","price":15.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/fish_tank_marble.png?v=1789059479"},{"product_id":"wild-west-4-piece-packing-puzzle","title":"Wild West | 4-Piece Packing Puzzle","description":"\u003cp\u003eFour blocky pieces and a square frame. It looks like it should fall together on the first try.\u003c\/p\u003e\n\u003cp\u003eGoal: pack all 4 pieces flat inside the frame so nothing sticks out.\u003c\/p\u003e\n\u003cp\u003eThe shapes are chunky and simple, so three of them go in almost immediately. The fourth is where the puzzle actually starts, and fitting it means going back and undoing the three you were happy with.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Wild West?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eSimple shapes, stubborn solution\u003c\/li\u003e\n\u003cli\u003eDevelops 2D spatial reasoning and planning\u003c\/li\u003e\n\u003cli\u003eCompact and clean when solved\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/goh-pit-khiam\"\u003eGoh Pit Khiam\u003c\/a\u003e\u003c\/p\u003e\n\u003cdiv class=\"gptr\" data-handle=\"wild-west-4-piece-packing-puzzle\"\u003e\n\u003cstyle\u003e\n.gptr{--gptr-fg:rgb(var(--color-foreground,18,18,18));\n --gptr-line:rgba(var(--color-foreground,18,18,18),.18);\n --gptr-muted:rgba(var(--color-foreground,18,18,18),.7);\n --gptr-accent:#0B7FA8;\n font-family:inherit;color:var(--gptr-fg);margin:1.2em 0;max-width:30em;outline:none}\n.gptr:focus{outline:none}\n.gptr:focus-visible{outline:none}\n.gptr:focus-visible .gptr-board svg{outline:2px solid var(--gptr-accent);outline-offset:2px;border-radius:4px}\n.gptr *{box-sizing:border-box}\n.gptr .gptr-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;margin:0 0 .3em;color:var(--gptr-fg)}\n.gptr .gptr-intro{font-size:.92em;line-height:1.5;margin:0 0 .8em;color:var(--gptr-muted);max-width:36em}\n.gptr .gptr-stage{display:flex;flex-direction:column;align-items:flex-start}\n.gptr .gptr-board{width:100%;max-width:24em;direction:ltr}\n.gptr .gptr-board svg{display:block;width:100%;height:auto;max-width:none;\n \/* a finger on the empty tray still scrolls the page; a finger on a piece drags it *\/\n touch-action:pan-y}\n.gptr .gptr-board,.gptr .gptr-rack,.gptr .gptr-ctl button{-webkit-tap-highlight-color:transparent;\n -webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n.gptr .gptr-rack{display:flex;flex-wrap:wrap;gap:.6em;align-items:center;direction:ltr;\n width:100%;max-width:24em;min-height:3.4em;margin-top:.7em;padding:.6em .7em;\n border:1px solid var(--gptr-line);border-radius:7px}\n.gptr[dir=rtl] .gptr-rack{justify-content:flex-end}\n.gptr .gptr-rack svg{display:block;flex:none;touch-action:none;cursor:grab;border-radius:4px;max-width:none}\n.gptr .gptr-rack svg[data-sel]{outline:2px solid var(--gptr-accent);outline-offset:2px}\n.gptr .gptr-none{display:inline-block;min-height:1em}\n.gptr .gptr-ctl{display:flex;flex-wrap:wrap;gap:.45em;margin-top:.8em}\n.gptr .gptr-ctl button{appearance:none;-webkit-appearance:none;margin:0;border:1px solid var(--gptr-line);\n background:transparent;color:var(--gptr-fg);font-family:inherit;font-size:.85em;line-height:1.2;\n letter-spacing:normal;text-transform:none;min-height:2.9em;padding:.6em 1em;border-radius:6px;\n cursor:pointer;box-shadow:none}\n.gptr .gptr-ctl button:hover{border-color:var(--gptr-accent)}\n.gptr .gptr-ctl button:disabled{opacity:.38;cursor:default}\n.gptr .gptr-ctl button:disabled:hover{border-color:var(--gptr-line)}\n.gptr .gptr-say{font-size:.88em;line-height:1.45;color:var(--gptr-muted);min-height:1.45em;margin:.7em 0 0}\n.gptr .gptr-best{font-size:.95em;line-height:1.45;font-weight:600;color:var(--gptr-fg);margin:.3em 0 0}\n.gptr .gptr-end{font-size:1em;line-height:1.45;font-weight:600;color:var(--gptr-accent);margin:.45em 0 0}\n.gptr .gptr-end[hidden]{display:none}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n\/* Greg Puzzles tray teaser (.gptr) - engine.\n   The real tray and the real pieces, quarter turns and flips only. The page\n   carries shapes and nothing else: no positions that finish the puzzle, no\n   finish check, no network calls, and no finished state is ever shown.\n\n   Written to live inside a Shopify product description:\n   - every DOM node is made with createElement \/ createElementNS, so no closing\n     tag ever appears inside a JS string (Shopify reparses body_html);\n   - SVG attributes are set with setAttribute, so viewBox keeps its case;\n   - nothing relies on an empty div being visible (the theme hides div:empty);\n   - hit tests go through the SVG's own screen matrix, never restated numbers.\n\n   Two modes, chosen by the config:\n   - \"place\": pieces come from a rack and go anywhere inside the tray grid.\n   - \"slide\": pieces start outside the tray and get in only by sliding through\n     the opening one square at a time; they turn only while fully outside. *\/\n(function () {\n  \"use strict\";\n  if (window.GPTR) return;\n\n  var NS = \"http:\/\/www.w3.org\/2000\/svg\";\n  var S = 10;                     \/* one grid square in SVG units *\/\n  var seq = 0, clipSeq = 0;\n  var COL = [\"#2E93C4\", \"#17678F\", \"#4FAAD0\", \"#0F4D69\"];\n  var LIGHT = [\"#58B3DD\", \"#2E88B2\", \"#78C6E4\", \"#2A6E8E\"];\n  var PLAY_GAP_CAP = 12000;       \/* idle time between touches counts up to this *\/\n  var EFFORT_MS = 45000;          \/* about 45 seconds of real play *\/\n  var EFFORT_OUTS = 3;            \/* or three pieces taken back out *\/\n\n  var TXT = {\n    en: {\n      title: \"Try it yourself\",\n      introPlace: \"Tap a piece, then tap a square in the tray. Dragging works too.\",\n      introSlide: \"Pieces go in only through the gap in the wall, one square at a time. Tap a piece, then tap where it should slide. Dragging works too.\",\n      rotate: \"Rotate\", flip: \"Flip\", take: \"Take out\", empty: \"Empty the tray\", reset: \"Start over\",\n      best: \"Best so far: {n} of {m} in\",\n      end: \"Still won't fit? That's the puzzle.\",\n      nofit: \"That will not fit there.\",\n      noturn: \"No room to turn it there.\",\n      blocked: \"That piece has nowhere to go that way.\",\n      board: \"Puzzle tray\", rack: \"Pieces\"\n    },\n    he: {\n      title: \"נסו בעצמכם\",\n      introPlace: \"הקישו על חלק ואז על משבצת במגש. אפשר גם לגרור.\",\n      introSlide: \"החלקים נכנסים רק דרך הפתח בדופן, משבצת אחת בכל פעם. הקישו על חלק ואז על המקום שאליו הוא אמור להחליק. אפשר גם לגרור.\",\n      rotate: \"סיבוב\", flip: \"היפוך\", take: \"הוצאה\", empty: \"ריקון המגש\", reset: \"התחלה מחדש\",\n      best: \"השיא עד עכשיו: {n} מתוך {m} בפנים\",\n      end: \"עדיין לא נכנס? זה הפאזל.\",\n      nofit: \"זה לא נכנס שם.\",\n      noturn: \"אין שם מקום לסובב אותו.\",\n      blocked: \"לחלק הזה אין לאן לזוז לכיוון הזה.\",\n      board: \"מגש הפאזל\", rack: \"החלקים\"\n    },\n    ja: {\n      title: \"試してみてください\",\n      introPlace: \"ピースをタップしてから、トレイのマスをタップしてください。ドラッグでも動かせます。\",\n      introSlide: \"ピースは壁のすき間からしか入りません。1マスずつです。ピースをタップしてから、すべらせたい先をタップしてください。ドラッグでも動かせます。\",\n      rotate: \"回転\", flip: \"裏返す\", take: \"取り出す\", empty: \"トレイを空にする\", reset: \"最初から\",\n      best: \"これまでの最高：{m}個中{n}個が入りました\",\n      end: \"まだ入らない？それがこのパズルです。\",\n      nofit: \"そこには入りません。\",\n      noturn: \"そこでは回す余地がありません。\",\n      blocked: \"そのピースはその方向へ動けません。\",\n      board: \"パズルのトレイ\", rack: \"ピース\"\n    }\n  };\n\n  function langOf() {\n    var l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\n    if (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\n    if (l.indexOf(\"ja\") === 0) return \"ja\";\n    return \"en\";\n  }\n  function fmt(s, o) {\n    return s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n  }\n  function el(tag, cls, txt) {\n    var e = document.createElement(tag);\n    if (cls) e.className = cls;\n    if (txt != null) e.textContent = txt;\n    return e;\n  }\n  function sv(tag, attrs) {\n    var e = document.createElementNS(NS, tag);\n    for (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) e.setAttribute(k, attrs[k]);\n    return e;\n  }\n  function clear(node) { while (node.firstChild) node.removeChild(node.firstChild); }\n\n  \/* ---------- shapes: cells are [row, col], rows run down ---------- *\/\n  function norm(cs) {\n    var r0 = Infinity, c0 = Infinity;\n    cs.forEach(function (c) { if (c[0] \u003c r0) r0 = c[0]; if (c[1] \u003c c0) c0 = c[1]; });\n    return cs.map(function (c) { return [c[0] - r0, c[1] - c0]; });\n  }\n  \/* order is kept by both, so a marked cell (the fish's eye) stays marked *\/\n  function rot(cs) { return norm(cs.map(function (c) { return [c[1], -c[0]]; })); }\n  function flp(cs) { return norm(cs.map(function (c) { return [c[0], -c[1]]; })); }\n  function dims(cs) {\n    var h = 0, w = 0;\n    cs.forEach(function (c) { if (c[0] + 1 \u003e h) h = c[0] + 1; if (c[1] + 1 \u003e w) w = c[1] + 1; });\n    return [h, w];\n  }\n  function shift(cs, at) { return cs.map(function (c) { return [c[0] + at[0], c[1] + at[1]]; }); }\n  function copy(cs) { return cs.map(function (c) { return [c[0], c[1]]; }); }\n  function key(r, c) { return r + \",\" + c; }\n  function nearestCell(shape, rel) {\n    var best = shape[0], bd = Infinity;\n    shape.forEach(function (c) {\n      var d = Math.abs(c[0] - rel[0]) + Math.abs(c[1] - rel[1]);\n      if (d \u003c bd) { bd = d; best = c; }\n    });\n    return [best[0], best[1]];\n  }\n\n  \/* ---------- outlines: one rounded path per piece ---------- *\/\n  function outline(cells) {\n    var has = {};\n    cells.forEach(function (c) { has[key(c[0], c[1])] = 1; });\n    var seg = [];\n    cells.forEach(function (c) {\n      var r = c[0], k = c[1];\n      if (!has[key(r - 1, k)]) seg.push([[k, r], [k + 1, r]]);\n      if (!has[key(r + 1, k)]) seg.push([[k, r + 1], [k + 1, r + 1]]);\n      if (!has[key(r, k - 1)]) seg.push([[k, r], [k, r + 1]]);\n      if (!has[key(r, k + 1)]) seg.push([[k + 1, r], [k + 1, r + 1]]);\n    });\n    return seg;\n  }\n  function loops(cells) {\n    var segs = outline(cells).map(function (e) { return [e[0].slice(), e[1].slice()]; });\n    var out = [];\n    while (segs.length) {\n      var ring = [segs[0][0], segs[0][1]];\n      segs.splice(0, 1);\n      var guard = 0;\n      while (guard++ \u003c 400) {\n        var head = ring[ring.length - 1], found = -1;\n        for (var i = 0; i \u003c segs.length; i++) {\n          if (segs[i][0][0] === head[0] \u0026\u0026 segs[i][0][1] === head[1]) { ring.push(segs[i][1]); found = i; break; }\n          if (segs[i][1][0] === head[0] \u0026\u0026 segs[i][1][1] === head[1]) { ring.push(segs[i][0]); found = i; break; }\n        }\n        if (found \u003c 0) break;\n        segs.splice(found, 1);\n        var a = ring[0], b = ring[ring.length - 1];\n        if (a[0] === b[0] \u0026\u0026 a[1] === b[1]) { ring.pop(); break; }\n      }\n      if (ring.length \u003e 2) out.push(ring);\n    }\n    return out;\n  }\n  function roundedPath(ring, r) {\n    \/* drop collinear points first so long straight edges stay one segment *\/\n    var pts = ring.filter(function (p1, i) {\n      var p0 = ring[(i - 1 + ring.length) % ring.length], p2 = ring[(i + 1) % ring.length];\n      return (p1[0] - p0[0]) * (p2[1] - p1[1]) - (p1[1] - p0[1]) * (p2[0] - p1[0]) !== 0;\n    });\n    var d = \"\", n = pts.length;\n    for (var i = 0; i \u003c n; i++) {\n      var p0 = pts[(i - 1 + n) % n], p1 = pts[i], p2 = pts[(i + 1) % n];\n      var v1 = [p1[0] - p0[0], p1[1] - p0[1]], v2 = [p2[0] - p1[0], p2[1] - p1[1]];\n      var l1 = Math.hypot(v1[0], v1[1]) || 1, l2 = Math.hypot(v2[0], v2[1]) || 1;\n      var rr = Math.min(r, l1 \/ 2, l2 \/ 2);\n      var a = [p1[0] - v1[0] \/ l1 * rr, p1[1] - v1[1] \/ l1 * rr];\n      var b = [p1[0] + v2[0] \/ l2 * rr, p1[1] + v2[1] \/ l2 * rr];\n      d += (i === 0 ? \"M\" : \"L\") + a[0].toFixed(2) + \" \" + a[1].toFixed(2);\n      d += \"Q\" + p1[0].toFixed(2) + \" \" + p1[1].toFixed(2) + \" \" + b[0].toFixed(2) + \" \" + b[1].toFixed(2);\n    }\n    return d + \"Z\";\n  }\n  function piecePath(cells) {\n    return loops(cells).map(function (ring) {\n      return roundedPath(ring.map(function (p) { return [p[0] * S, p[1] * S]; }), S * 0.17);\n    }).join(\" \");\n  }\n\n  \/* screen point -\u003e SVG user units, through the element's own matrix *\/\n  function toView(svgEl, x, y) {\n    var m = svgEl.getScreenCTM();\n    if (!m) return { x: NaN, y: NaN };\n    var inv = m.inverse(), q;\n    if (typeof DOMPoint === \"function\") q = new DOMPoint(x, y).matrixTransform(inv);\n    else { var pt = svgEl.createSVGPoint(); pt.x = x; pt.y = y; q = pt.matrixTransform(inv); }\n    return { x: q.x, y: q.y };\n  }\n\n  function mount(root, C) {\n    if (!root || root.getAttribute(\"data-gptr-on\")) return;\n    root.setAttribute(\"data-gptr-on\", \"1\");\n    var L = langOf(), t = TXT[L];\n    root.setAttribute(\"dir\", L === \"he\" ? \"rtl\" : \"ltr\");\n    root.setAttribute(\"lang\", L);\n    root.tabIndex = 0;\n\n    var W = C.grid[0], H = C.grid[1];\n    var SLIDE = C.mode === \"slide\";\n    var uid = \"gptr\" + (++seq) + Math.floor(Math.random() * 1e8).toString(36);\n    var Z = C.zone || null;\n    var OPEN = {};\n    if (C.opening) C.opening.cols.forEach(function (c) { OPEN[c] = 1; });\n\n    var pieces = C.pieces.map(function (p, i) {\n      return {\n        i: i, base: copy(p.cells), shape: copy(p.cells), at: null,\n        hole: p.hole ? p.hole[0] : -1, holeR: p.hole ? p.hole[1] : 0,\n        grab: [p.cells[0][0], p.cells[0][1]], wasIn: false\n      };\n    });\n    function home(p) { return C.start ? [C.start[p.i][0], C.start[p.i][1]] : null; }\n    if (SLIDE) pieces.forEach(function (p) { p.at = home(p); });\n\n    var sel = null, drag = null, tap = null, msg = \"\";\n    var best = 0, outs = 0, playMs = 0, lastAct = 0, endOn = false;\n\n    \/* ---------- rules ---------- *\/\n    function free(r, c) {\n      if (r \u003e= 0 \u0026\u0026 r \u003c H \u0026\u0026 c \u003e= 0 \u0026\u0026 c \u003c W) return true;          \/* the tray grid *\/\n      if (!SLIDE) return false;\n      if (r === -1) return OPEN[c] === 1;                             \/* the wall: only its gap *\/\n      return r \u003e= Z.top \u0026\u0026 r \u003c= -2 \u0026\u0026 c \u003e= Z.left \u0026\u0026 c \u003c= Z.right;    \/* the table outside *\/\n    }\n    function occupied(skip) {\n      var o = {};\n      pieces.forEach(function (q) {\n        if (q === skip || !q.at) return;\n        shift(q.shape, q.at).forEach(function (c) { o[key(c[0], c[1])] = 1; });\n      });\n      return o;\n    }\n    function legal(p, shape, at) {\n      var o = occupied(p), cs = shift(shape, at);\n      for (var i = 0; i \u003c cs.length; i++) {\n        if (!free(cs[i][0], cs[i][1]) || o[key(cs[i][0], cs[i][1])]) return false;\n      }\n      return true;\n    }\n    function cellsOf(p) { return p.at ? shift(p.shape, p.at) : null; }\n    function allOutside(cs) { return cs.every(function (c) { return c[0] \u003c= -2; }); }\n    function isIn(p) {\n      var cs = cellsOf(p);\n      return !!cs \u0026\u0026 cs.every(function (c) { return c[0] \u003e= 0 \u0026\u0026 c[0] \u003c H \u0026\u0026 c[1] \u003e= 0 \u0026\u0026 c[1] \u003c W; });\n    }\n    function isOut(p) { return SLIDE ? allOutside(cellsOf(p)) : !p.at; }\n    function engaged(p) { return SLIDE ? !isOut(p) : !!p.at; }\n\n    function step(p, dr, dc) {\n      var at = [p.at[0] + dr, p.at[1] + dc];\n      if (!legal(p, p.shape, at)) return false;\n      p.at = at;\n      return true;\n    }\n    \/* slide one square at a time toward a target, the bigger pull first and\n       the other axis when that is blocked *\/\n    function toward(p, target, grab) {\n      var moved = 0;\n      for (var g = 0; g \u003c 40; g++) {\n        var dr = target[0] - grab[0] - p.at[0], dc = target[1] - grab[1] - p.at[1];\n        if (!dr \u0026\u0026 !dc) break;\n        var sr = dr \u003e 0 ? 1 : (dr \u003c 0 ? -1 : 0), sc = dc \u003e 0 ? 1 : (dc \u003c 0 ? -1 : 0);\n        var tries = Math.abs(dr) \u003e= Math.abs(dc) ? [[sr, 0], [0, sc]] : [[0, sc], [sr, 0]];\n        var ok = false;\n        for (var i = 0; i \u003c 2; i++) {\n          if (!tries[i][0] \u0026\u0026 !tries[i][1]) continue;\n          if (step(p, tries[i][0], tries[i][1])) { ok = true; break; }\n        }\n        if (!ok) break;\n        moved++;\n      }\n      return moved;\n    }\n    \/* tap-to-place: the touched square of the piece lands on the tapped square\n       if it can; otherwise any other square of the piece that lets it fit *\/\n    function placeNear(p, cell) {\n      var anchors = p.shape.map(function (c, i) {\n        return { c: c, i: i, d: Math.abs(c[0] - p.grab[0]) + Math.abs(c[1] - p.grab[1]) };\n      });\n      anchors.sort(function (a, b) { return (a.d - b.d) || (a.i - b.i); });\n      for (var k = 0; k \u003c anchors.length; k++) {\n        var at = [cell[0] - anchors[k].c[0], cell[1] - anchors[k].c[1]];\n        if (legal(p, p.shape, at)) { p.at = at; return true; }\n      }\n      return false;\n    }\n    function turn(p, fn) {\n      var ns = fn(p.shape);\n      if (!p.at) { p.shape = ns; return true; }\n      if (SLIDE \u0026\u0026 !isOut(p)) return false;\n      var d0 = dims(p.shape), d1 = dims(ns);\n      var base = [p.at[0] + Math.round((d0[0] - d1[0]) \/ 2), p.at[1] + Math.round((d0[1] - d1[1]) \/ 2)];\n      var offs = [];\n      for (var dr = -2; dr \u003c= 2; dr++) for (var dc = -2; dc \u003c= 2; dc++) offs.push([dr, dc]);\n      offs.sort(function (a, b) {\n        return (Math.abs(a[0]) + Math.abs(a[1])) - (Math.abs(b[0]) + Math.abs(b[1]));\n      });\n      for (var i = 0; i \u003c offs.length; i++) {\n        var at = [base[0] + offs[i][0], base[1] + offs[i][1]];\n        if (legal(p, ns, at) \u0026\u0026 (!SLIDE || allOutside(shift(ns, at)))) { p.shape = ns; p.at = at; return true; }\n      }\n      return false;\n    }\n    \/* slide mode: lift a piece out and set it down on the table, near its start *\/\n    function sendHome(p) {\n      var h = home(p), shapes = [p.shape, p.base];\n      for (var s = 0; s \u003c shapes.length; s++) {\n        var sh = shapes[s], dm = dims(sh), bestAt = null, bd = Infinity;\n        for (var r = Z.top; r + dm[0] - 1 \u003c= -2; r++) {\n          for (var c = Z.left; c + dm[1] - 1 \u003c= Z.right; c++) {\n            if (!legal(p, sh, [r, c])) continue;\n            var d = Math.abs(r - h[0]) + Math.abs(c - h[1]);\n            if (d \u003c bd) { bd = d; bestAt = [r, c]; }\n          }\n        }\n        if (bestAt) { p.shape = copy(sh); p.at = bestAt; return true; }\n      }\n      return false;\n    }\n\n    \/* ---------- effort and the best count ---------- *\/\n    function act() {\n      var now = Date.now();\n      if (lastAct) playMs += Math.min(Math.max(0, now - lastAct), PLAY_GAP_CAP);\n      lastAct = now;\n    }\n    function settle() {\n      var n = 0;\n      pieces.forEach(function (p) {\n        if (isIn(p)) { n++; p.wasIn = true; }\n        else if (p.wasIn \u0026\u0026 isOut(p)) { outs++; p.wasIn = false; }\n      });\n      if (n \u003e best) best = n;\n      if (!endOn \u0026\u0026 (outs \u003e= EFFORT_OUTS || playMs \u003e= EFFORT_MS)) endOn = true;\n      render();\n    }\n\n    \/* ---------- DOM ---------- *\/\n    root.appendChild(el(\"h3\", \"gptr-h\", t.title));\n    root.appendChild(el(\"p\", \"gptr-intro\", SLIDE ? t.introSlide : t.introPlace));\n    var stage = el(\"div\", \"gptr-stage\");\n    var boardEl = el(\"div\", \"gptr-board\");\n    boardEl.setAttribute(\"dir\", \"ltr\");\n    stage.appendChild(boardEl);\n    var rackEl = null;\n    if (!SLIDE) {\n      rackEl = el(\"div\", \"gptr-rack\");\n      rackEl.setAttribute(\"dir\", \"ltr\");\n      rackEl.setAttribute(\"role\", \"group\");\n      rackEl.setAttribute(\"aria-label\", t.rack);\n      stage.appendChild(rackEl);\n    }\n    root.appendChild(stage);\n    var ctl = el(\"div\", \"gptr-ctl\");\n    function button(label, name) {\n      var b = el(\"button\", \"gptr-btn\", label);\n      b.type = \"button\";\n      b.setAttribute(\"data-act\", name);\n      ctl.appendChild(b);\n      return b;\n    }\n    var bRot = button(t.rotate, \"rotate\"), bFlip = button(t.flip, \"flip\"),\n        bTake = button(t.take, \"take\"), bEmpty = button(t.empty, \"empty\"), bReset = button(t.reset, \"reset\");\n    root.appendChild(ctl);\n    var sayEl = el(\"p\", \"gptr-say\", \" \");\n    sayEl.setAttribute(\"aria-live\", \"polite\");\n    var bestEl = el(\"p\", \"gptr-best\", \"\");\n    var endEl = el(\"p\", \"gptr-end\", t.end);\n    endEl.hidden = true;\n    root.appendChild(sayEl);\n    root.appendChild(bestEl);\n    root.appendChild(endEl);\n\n    \/* ---------- the board SVG: built once, only the piece layer is redrawn ---------- *\/\n    var cw = C.cavity[0], ch = C.cavity[1];\n    var offX = (cw - W) \/ 2, offY = (ch - H) \/ 2;      \/* grid centred in the cavity *\/\n    var R = C.rim * S;\n    var cx = -offX * S, cy = -offY * S;\n    var wallT = SLIDE ? C.opening.wall * S : R;\n    var vb;\n    if (SLIDE) {\n      var M = 1.5;\n      vb = [Z.left * S - M, Z.top * S - M, (Z.right - Z.left + 1) * S + 2 * M, (H - Z.top) * S + R + 2 * M];\n    } else {\n      vb = [cx - R, cy - R, cw * S + 2 * R, ch * S + 2 * R];\n    }\n    var svgEl = sv(\"svg\", { width: \"100%\", role: \"img\", \"aria-label\": t.board, \"data-s\": String(S) });\n    svgEl.setAttribute(\"viewBox\", vb.map(function (v) { return +v.toFixed(3); }).join(\" \"));\n    svgEl.style.aspectRatio = vb[2].toFixed(3) + \" \/ \" + vb[3].toFixed(3);\n    var defs = sv(\"defs\", {});\n    COL.forEach(function (c, k) {\n      var g = sv(\"linearGradient\", { id: uid + \"g\" + k, x1: \"0\", y1: \"0\", x2: \"0\", y2: \"1\" });\n      g.appendChild(sv(\"stop\", { offset: \"0\", \"stop-color\": LIGHT[k] }));\n      g.appendChild(sv(\"stop\", { offset: \"1\", \"stop-color\": c }));\n      defs.appendChild(g);\n    });\n    var soft = sv(\"filter\", { id: uid + \"soft\", x: \"-20%\", y: \"-20%\", width: \"140%\", height: \"140%\" });\n    soft.appendChild(sv(\"feGaussianBlur\", { stdDeviation: \"0.5\" }));\n    defs.appendChild(soft);\n    var grain = sv(\"filter\", { id: uid + \"grain\", x: \"0\", y: \"0\", width: \"100%\", height: \"100%\" });\n    grain.appendChild(sv(\"feTurbulence\", { type: \"fractalNoise\", baseFrequency: \"0.9\", numOctaves: \"3\", seed: \"4\" }));\n    grain.appendChild(sv(\"feColorMatrix\", { type: \"saturate\", values: \"0\" }));\n    var ct = sv(\"feComponentTransfer\", {});\n    ct.appendChild(sv(\"feFuncA\", { type: \"discrete\", tableValues: \"0 0 0 0 .5\" }));\n    grain.appendChild(ct);\n    defs.appendChild(grain);\n    svgEl.appendChild(defs);\n\n    var trayG = sv(\"g\", { \"data-layer\": \"tray\" });\n    function speckled(x, y, w, h, rx, base, op) {\n      trayG.appendChild(sv(\"rect\", { x: x, y: y, width: w, height: h, rx: rx, fill: base }));\n      trayG.appendChild(sv(\"rect\", { x: x, y: y, width: w, height: h, rx: rx, fill: \"#8A8275\",\n        \"fill-opacity\": op, filter: \"url(#\" + uid + \"grain)\" }));\n    }\n    if (SLIDE) {\n      \/* the table the pieces wait on, and the strip that leads into the gap *\/\n      var gx0 = cx + C.opening.from * S, gx1 = cx + C.opening.to * S;\n      var mat = { fill: \"#8A8275\", \"fill-opacity\": \".07\", stroke: \"rgba(80,74,64,.22)\",\n        \"stroke-width\": \".4\", \"stroke-dasharray\": \"1.6 1.4\" };\n      var m1 = { x: Z.left * S, y: Z.top * S, width: (Z.right - Z.left + 1) * S, height: (-1 - Z.top) * S, rx: \"2\" };\n      for (var mk in mat) m1[mk] = mat[mk];\n      trayG.appendChild(sv(\"rect\", m1));\n      trayG.appendChild(sv(\"rect\", { x: gx0, y: -S - 0.2, width: gx1 - gx0, height: S - wallT + 0.4,\n        fill: \"#8A8275\", \"fill-opacity\": \".07\" }));\n    }\n    speckled(cx - R, cy - wallT, cw * S + 2 * R, ch * S + R + wallT, \"3\", \"#EDEAE3\", \".5\");\n    speckled(cx, cy, cw * S, ch * S, \"1.6\", \"#F6F4EF\", \".28\");\n    trayG.appendChild(sv(\"rect\", { x: cx, y: cy, width: cw * S, height: ch * S, rx: \"1.6\", fill: \"none\",\n      stroke: \"rgba(80,74,64,.30)\", \"stroke-width\": \".5\" }));\n    if (SLIDE) {\n      \/* the gap in the wall: floor runs through it *\/\n      var g0 = cx + C.opening.from * S, g1 = cx + C.opening.to * S;\n      speckled(g0, cy - wallT - 0.01, g1 - g0, wallT + 1.2, \"0\", \"#F6F4EF\", \".28\");\n      trayG.appendChild(sv(\"path\", { d: \"M\" + g0 + \" \" + (cy - wallT) + \"V\" + cy + \"M\" + g1 + \" \" + (cy - wallT) + \"V\" + cy,\n        stroke: \"rgba(80,74,64,.30)\", \"stroke-width\": \".5\", fill: \"none\" }));\n    }\n    svgEl.appendChild(trayG);\n    var pieceG = sv(\"g\", { \"data-layer\": \"pieces\" });\n    svgEl.appendChild(pieceG);\n    boardEl.appendChild(svgEl);\n\n    function pieceNode(p, cells, opts) {\n      var k = p.i % COL.length;\n      var g = sv(\"g\", { \"data-p\": String(p.i), style: \"cursor:grab;touch-action:none\" });\n      g.setAttribute(\"data-cells\", cells.map(function (c) { return c[0] + \",\" + c[1]; }).join(\" \"));\n      if (opts.sel) g.setAttribute(\"data-sel\", \"1\");\n      var d = piecePath(cells);\n      if (opts.ghost) {\n        g.setAttribute(\"data-ghost\", \"1\");\n        g.setAttribute(\"data-bad\", opts.bad ? \"1\" : \"0\");\n        g.setAttribute(\"pointer-events\", \"none\");\n      } else {\n        g.appendChild(sv(\"path\", { d: d, fill: \"rgba(18,32,40,.22)\", transform: \"translate(0.5,0.9)\",\n          filter: \"url(#\" + uid + \"soft)\", \"pointer-events\": \"none\" }));\n      }\n      g.appendChild(sv(\"path\", { d: d, fill: \"url(#\" + uid + \"g\" + k + \")\",\n        \"fill-opacity\": opts.ghost ? \".45\" : \"1\",\n        stroke: opts.bad ? \"#C2544C\" : (opts.sel ? \"#0B7FA8\" : \"rgba(10,26,34,.42)\"),\n        \"stroke-width\": opts.sel || opts.bad ? \"1.1\" : \".45\", \"stroke-linejoin\": \"round\" }));\n      if (!opts.ghost) {\n        var cid = uid + \"c\" + (++clipSeq);\n        var clip = sv(\"clipPath\", { id: cid });\n        clip.appendChild(sv(\"path\", { d: d }));\n        g.appendChild(clip);\n        g.appendChild(sv(\"path\", { d: d, fill: \"none\", stroke: \"rgba(255,255,255,.34)\", \"stroke-width\": \".5\",\n          \"stroke-linejoin\": \"round\", transform: \"translate(0,0.45)\", \"clip-path\": \"url(#\" + cid + \")\",\n          \"pointer-events\": \"none\" }));\n      }\n      if (p.hole \u003e= 0 \u0026\u0026 cells[p.hole]) {\n        var hc = cells[p.hole];\n        g.appendChild(sv(\"circle\", { cx: (hc[1] + 0.5) * S, cy: (hc[0] + 0.5) * S, r: (p.holeR * S).toFixed(2),\n          fill: \"#E9E5DC\", \"fill-opacity\": opts.ghost ? \".5\" : \"1\", stroke: \"rgba(10,26,34,.45)\", \"stroke-width\": \".45\" }));\n      }\n      return g;\n    }\n\n    function drawPieces() {\n      clear(pieceG);\n      pieces.forEach(function (p) {\n        if (!p.at) return;\n        if (!SLIDE \u0026\u0026 drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) return;   \/* lifted: the ghost shows it *\/\n        pieceG.appendChild(pieceNode(p, cellsOf(p), { sel: sel === p }));\n      });\n      if (!SLIDE \u0026\u0026 drag \u0026\u0026 drag.live \u0026\u0026 !drag.off) {\n        pieceG.appendChild(pieceNode(drag.p, drag.cells, { ghost: true, bad: !drag.ok }));\n      }\n    }\n    var rackEm = 1.4;\n    if (rackEl) {\n      var tw = 0;\n      pieces.forEach(function (p) { tw += dims(p.base)[1]; });\n      rackEm = Math.max(0.95, Math.min(1.4, 18 \/ tw));\n    }\n    function drawRack() {\n      if (!rackEl) return;\n      clear(rackEl);\n      var any = false;\n      pieces.forEach(function (p) {\n        if (p.at) return;\n        any = true;\n        var dm = dims(p.shape);\n        var s = sv(\"svg\", { \"data-p\": String(p.i), \"data-s\": String(S), role: \"img\" });\n        s.setAttribute(\"viewBox\", \"-0.6 -0.6 \" + (dm[1] * S + 1.2) + \" \" + (dm[0] * S + 1.2));\n        s.style.width = (dm[1] * rackEm).toFixed(3) + \"em\";\n        s.style.height = (dm[0] * rackEm).toFixed(3) + \"em\";\n        if (sel === p) s.setAttribute(\"data-sel\", \"1\");\n        if (drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) s.style.opacity = \".35\";\n        s.appendChild(pieceNode(p, p.shape, { sel: sel === p }));\n        rackEl.appendChild(s);\n      });\n      if (!any) rackEl.appendChild(el(\"span\", \"gptr-none\", \" \"));\n    }\n    function turnTarget() {\n      if (sel) return (SLIDE \u0026\u0026 !isOut(sel)) ? null : sel;\n      for (var i = 0; i \u003c pieces.length; i++) {\n        if (SLIDE ? isOut(pieces[i]) : !pieces[i].at) return pieces[i];\n      }\n      return null;\n    }\n    function render() {\n      drawPieces();\n      drawRack();\n      var tt = turnTarget(), had = document.activeElement;\n      bRot.disabled = bFlip.disabled = !tt;\n      bTake.disabled = !(sel \u0026\u0026 engaged(sel));\n      bEmpty.disabled = !pieces.some(engaged);\n      \/* a button that just went disabled drops focus to the page, and the\n         arrow keys with it: keep them working on the board *\/\n      if (had \u0026\u0026 had.parentNode === ctl \u0026\u0026 had.disabled) focusRoot();\n      sayEl.textContent = msg || \" \";\n      bestEl.textContent = fmt(t.best, { n: best, m: pieces.length });\n      endEl.hidden = !endOn;\n    }\n\n    \/* ---------- input ---------- *\/\n    function focusRoot() { try { root.focus({ preventScroll: true }); } catch (e) { \/* old browsers *\/ } }\n    function boardCell(ev) {\n      var q = toView(svgEl, ev.clientX, ev.clientY);\n      var r = Math.floor(q.y \/ S), c = Math.floor(q.x \/ S);\n      if (!SLIDE \u0026\u0026 q.x \u003e= cx \u0026\u0026 q.x \u003c= cx + cw * S \u0026\u0026 q.y \u003e= cy \u0026\u0026 q.y \u003c= cy + ch * S) {\n        \/* inside the cavity but in its slack around the grid: snap to the edge squares *\/\n        r = Math.max(0, Math.min(H - 1, r));\n        c = Math.max(0, Math.min(W - 1, c));\n      }\n      return [r, c];\n    }\n    function overBoard(ev) {\n      var b = svgEl.getBoundingClientRect();\n      return ev.clientX \u003e= b.left \u0026\u0026 ev.clientX \u003c= b.right \u0026\u0026 ev.clientY \u003e= b.top \u0026\u0026 ev.clientY \u003c= b.bottom;\n    }\n    function startDrag(p, ev, fromRack, grab, fallTap, downCell) {\n      if (ev.cancelable) ev.preventDefault();\n      try { (fromRack ? rackEl : svgEl).setPointerCapture(ev.pointerId); } catch (e) { \/* synthetic pointer *\/ }\n      drag = { p: p, fromRack: fromRack, grab: grab, sx: ev.clientX, sy: ev.clientY, pid: ev.pointerId,\n        live: false, off: true, ok: false, at: null, cells: null, fallTap: fallTap, downCell: downCell };\n      window.addEventListener(\"pointermove\", onMove);\n      window.addEventListener(\"pointerup\", onUp);\n      window.addEventListener(\"pointercancel\", onCancel);\n    }\n    function endListen() {\n      window.removeEventListener(\"pointermove\", onMove);\n      window.removeEventListener(\"pointerup\", onUp);\n      window.removeEventListener(\"pointercancel\", onCancel);\n    }\n    function onMove(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      if (!drag.live) {\n        if (Math.abs(ev.clientX - drag.sx) + Math.abs(ev.clientY - drag.sy) \u003c 6) return;\n        drag.live = true;\n        if (drag.fromRack) drawRack();\n      }\n      var cell = boardCell(ev);\n      if (SLIDE) {\n        if (toward(drag.p, cell, drag.grab)) msg = \"\";\n        drawPieces();\n        return;\n      }\n      if (!overBoard(ev)) { drag.off = true; drag.cells = null; drawPieces(); return; }\n      drag.off = false;\n      drag.at = [cell[0] - drag.grab[0], cell[1] - drag.grab[1]];\n      drag.cells = shift(drag.p.shape, drag.at);\n      drag.ok = legal(drag.p, drag.p.shape, drag.at);\n      drawPieces();\n    }\n    function onUp(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      var d = drag;\n      drag = null;\n      act();\n      if (!d.live) {                                  \/* a tap, not a drag *\/\n        if (d.fallTap) { boardTap(d.downCell); return; }\n        d.p.grab = d.grab;\n        sel = (sel === d.p) ? null : d.p;\n        msg = \"\";\n        settle();\n        return;\n      }\n      if (SLIDE) { sel = d.p; d.p.grab = d.grab; settle(); return; }\n      if (d.off) {\n        if (d.p.at) d.p.at = null;                    \/* dragged off the board: back with the pieces *\/\n        msg = \"\";\n      } else if (d.ok) {\n        d.p.at = d.at;\n        sel = null;\n        msg = \"\";\n      } else {\n        msg = t.nofit;\n      }\n      settle();\n    }\n    function onCancel(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      drag = null;\n      settle();\n    }\n    function boardTap(cell) {\n      if (!sel) { render(); return; }\n      if (SLIDE) {\n        msg = toward(sel, cell, sel.grab) ? \"\" : t.blocked;\n      } else if (placeNear(sel, cell)) {\n        sel = null;\n        msg = \"\";\n      } else {\n        msg = t.nofit;\n      }\n      settle();\n    }\n\n    svgEl.addEventListener(\"pointerdown\", function (ev) {\n      if (ev.button \u003e 0) return;\n      act();\n      focusRoot();\n      var hit = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      var cell = boardCell(ev);\n      if (hit \u0026\u0026 !hit.getAttribute(\"data-ghost\")) {\n        var p = pieces[+hit.getAttribute(\"data-p\")];\n        var grab = nearestCell(p.shape, [cell[0] - p.at[0], cell[1] - p.at[1]]);\n        \/* a piece in hand from the rack wants to be placed: a tap on a piece in\n           the tray is an attempt to put it there *\/\n        var fall = !SLIDE \u0026\u0026 !!sel \u0026\u0026 !sel.at \u0026\u0026 sel !== p;\n        startDrag(p, ev, false, grab, fall, cell);\n        return;\n      }\n      tap = { x: ev.clientX, y: ev.clientY, pid: ev.pointerId, cell: cell };\n    });\n    svgEl.addEventListener(\"pointerup\", function (ev) {\n      if (!tap || ev.pointerId !== tap.pid) return;\n      var t0 = tap;\n      tap = null;\n      if (Math.abs(ev.clientX - t0.x) + Math.abs(ev.clientY - t0.y) \u003e 10) return;\n      act();\n      boardTap(t0.cell);\n    });\n    svgEl.addEventListener(\"pointercancel\", function () { tap = null; });\n    \/* a finger that lands on a piece drags it; anywhere else the page still scrolls *\/\n    svgEl.addEventListener(\"touchstart\", function (ev) {\n      var h = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      if (h \u0026\u0026 ev.cancelable) ev.preventDefault();\n    }, { passive: false });\n\n    if (rackEl) {\n      rackEl.addEventListener(\"pointerdown\", function (ev) {\n        if (ev.button \u003e 0) return;\n        var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n        if (!s) return;\n        act();\n        focusRoot();\n        var p = pieces[+s.getAttribute(\"data-p\")];\n        var q = toView(s, ev.clientX, ev.clientY);\n        startDrag(p, ev, true, nearestCell(p.shape, [Math.floor(q.y \/ S), Math.floor(q.x \/ S)]), false, null);\n      });\n      rackEl.addEventListener(\"touchstart\", function (ev) {\n        var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n        if (s \u0026\u0026 ev.cancelable) ev.preventDefault();\n      }, { passive: false });\n    }\n\n    root.addEventListener(\"keydown\", function (e) {\n      var d = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] }[e.key];\n      if (!d || !sel || !sel.at) return;\n      e.preventDefault();\n      act();\n      if (SLIDE) {\n        msg = step(sel, d[0], d[1]) ? \"\" : t.blocked;\n      } else {\n        var at = [sel.at[0] + d[0], sel.at[1] + d[1]];\n        if (legal(sel, sel.shape, at)) { sel.at = at; msg = \"\"; } else msg = t.nofit;\n      }\n      settle();\n    });\n\n    function turnBtn(fn) {\n      return function () {\n        act();\n        var p = turnTarget();\n        if (!p) { render(); return; }\n        if (turn(p, fn)) { sel = p; msg = \"\"; } else msg = t.noturn;\n        settle();\n      };\n    }\n    bRot.addEventListener(\"click\", turnBtn(rot));\n    bFlip.addEventListener(\"click\", turnBtn(flp));\n    bTake.addEventListener(\"click\", function () {\n      act();\n      if (!sel || !engaged(sel)) { render(); return; }\n      if (SLIDE) sendHome(sel); else sel.at = null;\n      msg = \"\";\n      settle();\n    });\n    bEmpty.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) {\n        if (!engaged(p)) return;\n        if (SLIDE) sendHome(p); else p.at = null;\n      });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n    bReset.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) { p.shape = copy(p.base); p.at = home(p); p.grab = [p.base[0][0], p.base[0][1]]; });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n\n    settle();\n  }\n\n  window.GPTR = { mount: mount, v: 1 };\n})();\n(function(){var C={\"v\":1,\"mode\":\"place\",\"grid\":[5,5],\"rim\":0.3,\"pieces\":[{\"cells\":[[0,0],[0,1],[1,1],[1,2],[2,2]]},{\"cells\":[[0,0],[0,1],[1,1],[1,2],[2,2]]},{\"cells\":[[0,0],[0,1],[1,1],[1,2]]},{\"cells\":[[0,3],[1,0],[1,1],[1,2],[1,3],[2,3]]}],\"cavity\":[5.01,5.01]};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gptr \")\u003c0)r=document.querySelector(\".gptr:not([data-gptr-on])\");if(r\u0026\u0026window.GPTR)window.GPTR.mount(r,C);})();\n\u003c\/script\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51325796450471,"sku":"GP-WILDWEST","price":15.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/wild_west_marble.png?v=1789059488"},{"product_id":"trivial-3-piece-packing-puzzle","title":"Trivial Puzzle | 3-Piece Packing Puzzle","description":"\u003cp\u003eTrivial Puzzle, but is it really? Three pieces, one tray, nothing hidden, and it still stops people.\u003c\/p\u003e\n\u003cp\u003eGoal: pack all 3 pieces flat inside the frame so nothing sticks out.\u003c\/p\u003e\n\u003cp\u003eGoh Pit Khiam is known for designs where the setup looks obvious and the solution is anything but. You can see every piece and every corner of the tray from the first second. That is what makes it uncomfortable.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Trivial?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eNothing is hidden and it still gets you\u003c\/li\u003e\n\u003cli\u003eDevelops 2D spatial reasoning\u003c\/li\u003e\n\u003cli\u003eA quiet, absorbing desk challenge\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/goh-pit-khiam\"\u003eGoh Pit Khiam\u003c\/a\u003e\u003c\/p\u003e\n\u003cdiv class=\"gptr\" data-handle=\"trivial-3-piece-packing-puzzle\"\u003e\n\u003cstyle\u003e\n.gptr{--gptr-fg:rgb(var(--color-foreground,18,18,18));\n --gptr-line:rgba(var(--color-foreground,18,18,18),.18);\n --gptr-muted:rgba(var(--color-foreground,18,18,18),.7);\n --gptr-accent:#0B7FA8;\n font-family:inherit;color:var(--gptr-fg);margin:1.2em 0;max-width:30em;outline:none}\n.gptr:focus{outline:none}\n.gptr:focus-visible{outline:none}\n.gptr:focus-visible .gptr-board svg{outline:2px solid var(--gptr-accent);outline-offset:2px;border-radius:4px}\n.gptr *{box-sizing:border-box}\n.gptr .gptr-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;margin:0 0 .3em;color:var(--gptr-fg)}\n.gptr .gptr-intro{font-size:.92em;line-height:1.5;margin:0 0 .8em;color:var(--gptr-muted);max-width:36em}\n.gptr .gptr-stage{display:flex;flex-direction:column;align-items:flex-start}\n.gptr .gptr-board{width:100%;max-width:24em;direction:ltr}\n.gptr .gptr-board svg{display:block;width:100%;height:auto;max-width:none;\n \/* a finger on the empty tray still scrolls the page; a finger on a piece drags it *\/\n touch-action:pan-y}\n.gptr .gptr-board,.gptr .gptr-rack,.gptr .gptr-ctl button{-webkit-tap-highlight-color:transparent;\n -webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n.gptr .gptr-rack{display:flex;flex-wrap:wrap;gap:.6em;align-items:center;direction:ltr;\n width:100%;max-width:24em;min-height:3.4em;margin-top:.7em;padding:.6em .7em;\n border:1px solid var(--gptr-line);border-radius:7px}\n.gptr[dir=rtl] .gptr-rack{justify-content:flex-end}\n.gptr .gptr-rack svg{display:block;flex:none;touch-action:none;cursor:grab;border-radius:4px;max-width:none}\n.gptr .gptr-rack svg[data-sel]{outline:2px solid var(--gptr-accent);outline-offset:2px}\n.gptr .gptr-none{display:inline-block;min-height:1em}\n.gptr .gptr-ctl{display:flex;flex-wrap:wrap;gap:.45em;margin-top:.8em}\n.gptr .gptr-ctl button{appearance:none;-webkit-appearance:none;margin:0;border:1px solid var(--gptr-line);\n background:transparent;color:var(--gptr-fg);font-family:inherit;font-size:.85em;line-height:1.2;\n letter-spacing:normal;text-transform:none;min-height:2.9em;padding:.6em 1em;border-radius:6px;\n cursor:pointer;box-shadow:none}\n.gptr .gptr-ctl button:hover{border-color:var(--gptr-accent)}\n.gptr .gptr-ctl button:disabled{opacity:.38;cursor:default}\n.gptr .gptr-ctl button:disabled:hover{border-color:var(--gptr-line)}\n.gptr .gptr-say{font-size:.88em;line-height:1.45;color:var(--gptr-muted);min-height:1.45em;margin:.7em 0 0}\n.gptr .gptr-best{font-size:.95em;line-height:1.45;font-weight:600;color:var(--gptr-fg);margin:.3em 0 0}\n.gptr .gptr-end{font-size:1em;line-height:1.45;font-weight:600;color:var(--gptr-accent);margin:.45em 0 0}\n.gptr .gptr-end[hidden]{display:none}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n\/* Greg Puzzles tray teaser (.gptr) - engine.\n   The real tray and the real pieces, quarter turns and flips only. The page\n   carries shapes and nothing else: no positions that finish the puzzle, no\n   finish check, no network calls, and no finished state is ever shown.\n\n   Written to live inside a Shopify product description:\n   - every DOM node is made with createElement \/ createElementNS, so no closing\n     tag ever appears inside a JS string (Shopify reparses body_html);\n   - SVG attributes are set with setAttribute, so viewBox keeps its case;\n   - nothing relies on an empty div being visible (the theme hides div:empty);\n   - hit tests go through the SVG's own screen matrix, never restated numbers.\n\n   Two modes, chosen by the config:\n   - \"place\": pieces come from a rack and go anywhere inside the tray grid.\n   - \"slide\": pieces start outside the tray and get in only by sliding through\n     the opening one square at a time; they turn only while fully outside. *\/\n(function () {\n  \"use strict\";\n  if (window.GPTR) return;\n\n  var NS = \"http:\/\/www.w3.org\/2000\/svg\";\n  var S = 10;                     \/* one grid square in SVG units *\/\n  var seq = 0, clipSeq = 0;\n  var COL = [\"#2E93C4\", \"#17678F\", \"#4FAAD0\", \"#0F4D69\"];\n  var LIGHT = [\"#58B3DD\", \"#2E88B2\", \"#78C6E4\", \"#2A6E8E\"];\n  var PLAY_GAP_CAP = 12000;       \/* idle time between touches counts up to this *\/\n  var EFFORT_MS = 45000;          \/* about 45 seconds of real play *\/\n  var EFFORT_OUTS = 3;            \/* or three pieces taken back out *\/\n\n  var TXT = {\n    en: {\n      title: \"Try it yourself\",\n      introPlace: \"Tap a piece, then tap a square in the tray. Dragging works too.\",\n      introSlide: \"Pieces go in only through the gap in the wall, one square at a time. Tap a piece, then tap where it should slide. Dragging works too.\",\n      rotate: \"Rotate\", flip: \"Flip\", take: \"Take out\", empty: \"Empty the tray\", reset: \"Start over\",\n      best: \"Best so far: {n} of {m} in\",\n      end: \"Still won't fit? That's the puzzle.\",\n      nofit: \"That will not fit there.\",\n      noturn: \"No room to turn it there.\",\n      blocked: \"That piece has nowhere to go that way.\",\n      board: \"Puzzle tray\", rack: \"Pieces\"\n    },\n    he: {\n      title: \"נסו בעצמכם\",\n      introPlace: \"הקישו על חלק ואז על משבצת במגש. אפשר גם לגרור.\",\n      introSlide: \"החלקים נכנסים רק דרך הפתח בדופן, משבצת אחת בכל פעם. הקישו על חלק ואז על המקום שאליו הוא אמור להחליק. אפשר גם לגרור.\",\n      rotate: \"סיבוב\", flip: \"היפוך\", take: \"הוצאה\", empty: \"ריקון המגש\", reset: \"התחלה מחדש\",\n      best: \"השיא עד עכשיו: {n} מתוך {m} בפנים\",\n      end: \"עדיין לא נכנס? זה הפאזל.\",\n      nofit: \"זה לא נכנס שם.\",\n      noturn: \"אין שם מקום לסובב אותו.\",\n      blocked: \"לחלק הזה אין לאן לזוז לכיוון הזה.\",\n      board: \"מגש הפאזל\", rack: \"החלקים\"\n    },\n    ja: {\n      title: \"試してみてください\",\n      introPlace: \"ピースをタップしてから、トレイのマスをタップしてください。ドラッグでも動かせます。\",\n      introSlide: \"ピースは壁のすき間からしか入りません。1マスずつです。ピースをタップしてから、すべらせたい先をタップしてください。ドラッグでも動かせます。\",\n      rotate: \"回転\", flip: \"裏返す\", take: \"取り出す\", empty: \"トレイを空にする\", reset: \"最初から\",\n      best: \"これまでの最高：{m}個中{n}個が入りました\",\n      end: \"まだ入らない？それがこのパズルです。\",\n      nofit: \"そこには入りません。\",\n      noturn: \"そこでは回す余地がありません。\",\n      blocked: \"そのピースはその方向へ動けません。\",\n      board: \"パズルのトレイ\", rack: \"ピース\"\n    }\n  };\n\n  function langOf() {\n    var l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\n    if (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\n    if (l.indexOf(\"ja\") === 0) return \"ja\";\n    return \"en\";\n  }\n  function fmt(s, o) {\n    return s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n  }\n  function el(tag, cls, txt) {\n    var e = document.createElement(tag);\n    if (cls) e.className = cls;\n    if (txt != null) e.textContent = txt;\n    return e;\n  }\n  function sv(tag, attrs) {\n    var e = document.createElementNS(NS, tag);\n    for (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) e.setAttribute(k, attrs[k]);\n    return e;\n  }\n  function clear(node) { while (node.firstChild) node.removeChild(node.firstChild); }\n\n  \/* ---------- shapes: cells are [row, col], rows run down ---------- *\/\n  function norm(cs) {\n    var r0 = Infinity, c0 = Infinity;\n    cs.forEach(function (c) { if (c[0] \u003c r0) r0 = c[0]; if (c[1] \u003c c0) c0 = c[1]; });\n    return cs.map(function (c) { return [c[0] - r0, c[1] - c0]; });\n  }\n  \/* order is kept by both, so a marked cell (the fish's eye) stays marked *\/\n  function rot(cs) { return norm(cs.map(function (c) { return [c[1], -c[0]]; })); }\n  function flp(cs) { return norm(cs.map(function (c) { return [c[0], -c[1]]; })); }\n  function dims(cs) {\n    var h = 0, w = 0;\n    cs.forEach(function (c) { if (c[0] + 1 \u003e h) h = c[0] + 1; if (c[1] + 1 \u003e w) w = c[1] + 1; });\n    return [h, w];\n  }\n  function shift(cs, at) { return cs.map(function (c) { return [c[0] + at[0], c[1] + at[1]]; }); }\n  function copy(cs) { return cs.map(function (c) { return [c[0], c[1]]; }); }\n  function key(r, c) { return r + \",\" + c; }\n  function nearestCell(shape, rel) {\n    var best = shape[0], bd = Infinity;\n    shape.forEach(function (c) {\n      var d = Math.abs(c[0] - rel[0]) + Math.abs(c[1] - rel[1]);\n      if (d \u003c bd) { bd = d; best = c; }\n    });\n    return [best[0], best[1]];\n  }\n\n  \/* ---------- outlines: one rounded path per piece ---------- *\/\n  function outline(cells) {\n    var has = {};\n    cells.forEach(function (c) { has[key(c[0], c[1])] = 1; });\n    var seg = [];\n    cells.forEach(function (c) {\n      var r = c[0], k = c[1];\n      if (!has[key(r - 1, k)]) seg.push([[k, r], [k + 1, r]]);\n      if (!has[key(r + 1, k)]) seg.push([[k, r + 1], [k + 1, r + 1]]);\n      if (!has[key(r, k - 1)]) seg.push([[k, r], [k, r + 1]]);\n      if (!has[key(r, k + 1)]) seg.push([[k + 1, r], [k + 1, r + 1]]);\n    });\n    return seg;\n  }\n  function loops(cells) {\n    var segs = outline(cells).map(function (e) { return [e[0].slice(), e[1].slice()]; });\n    var out = [];\n    while (segs.length) {\n      var ring = [segs[0][0], segs[0][1]];\n      segs.splice(0, 1);\n      var guard = 0;\n      while (guard++ \u003c 400) {\n        var head = ring[ring.length - 1], found = -1;\n        for (var i = 0; i \u003c segs.length; i++) {\n          if (segs[i][0][0] === head[0] \u0026\u0026 segs[i][0][1] === head[1]) { ring.push(segs[i][1]); found = i; break; }\n          if (segs[i][1][0] === head[0] \u0026\u0026 segs[i][1][1] === head[1]) { ring.push(segs[i][0]); found = i; break; }\n        }\n        if (found \u003c 0) break;\n        segs.splice(found, 1);\n        var a = ring[0], b = ring[ring.length - 1];\n        if (a[0] === b[0] \u0026\u0026 a[1] === b[1]) { ring.pop(); break; }\n      }\n      if (ring.length \u003e 2) out.push(ring);\n    }\n    return out;\n  }\n  function roundedPath(ring, r) {\n    \/* drop collinear points first so long straight edges stay one segment *\/\n    var pts = ring.filter(function (p1, i) {\n      var p0 = ring[(i - 1 + ring.length) % ring.length], p2 = ring[(i + 1) % ring.length];\n      return (p1[0] - p0[0]) * (p2[1] - p1[1]) - (p1[1] - p0[1]) * (p2[0] - p1[0]) !== 0;\n    });\n    var d = \"\", n = pts.length;\n    for (var i = 0; i \u003c n; i++) {\n      var p0 = pts[(i - 1 + n) % n], p1 = pts[i], p2 = pts[(i + 1) % n];\n      var v1 = [p1[0] - p0[0], p1[1] - p0[1]], v2 = [p2[0] - p1[0], p2[1] - p1[1]];\n      var l1 = Math.hypot(v1[0], v1[1]) || 1, l2 = Math.hypot(v2[0], v2[1]) || 1;\n      var rr = Math.min(r, l1 \/ 2, l2 \/ 2);\n      var a = [p1[0] - v1[0] \/ l1 * rr, p1[1] - v1[1] \/ l1 * rr];\n      var b = [p1[0] + v2[0] \/ l2 * rr, p1[1] + v2[1] \/ l2 * rr];\n      d += (i === 0 ? \"M\" : \"L\") + a[0].toFixed(2) + \" \" + a[1].toFixed(2);\n      d += \"Q\" + p1[0].toFixed(2) + \" \" + p1[1].toFixed(2) + \" \" + b[0].toFixed(2) + \" \" + b[1].toFixed(2);\n    }\n    return d + \"Z\";\n  }\n  function piecePath(cells) {\n    return loops(cells).map(function (ring) {\n      return roundedPath(ring.map(function (p) { return [p[0] * S, p[1] * S]; }), S * 0.17);\n    }).join(\" \");\n  }\n\n  \/* screen point -\u003e SVG user units, through the element's own matrix *\/\n  function toView(svgEl, x, y) {\n    var m = svgEl.getScreenCTM();\n    if (!m) return { x: NaN, y: NaN };\n    var inv = m.inverse(), q;\n    if (typeof DOMPoint === \"function\") q = new DOMPoint(x, y).matrixTransform(inv);\n    else { var pt = svgEl.createSVGPoint(); pt.x = x; pt.y = y; q = pt.matrixTransform(inv); }\n    return { x: q.x, y: q.y };\n  }\n\n  function mount(root, C) {\n    if (!root || root.getAttribute(\"data-gptr-on\")) return;\n    root.setAttribute(\"data-gptr-on\", \"1\");\n    var L = langOf(), t = TXT[L];\n    root.setAttribute(\"dir\", L === \"he\" ? \"rtl\" : \"ltr\");\n    root.setAttribute(\"lang\", L);\n    root.tabIndex = 0;\n\n    var W = C.grid[0], H = C.grid[1];\n    var SLIDE = C.mode === \"slide\";\n    var uid = \"gptr\" + (++seq) + Math.floor(Math.random() * 1e8).toString(36);\n    var Z = C.zone || null;\n    var OPEN = {};\n    if (C.opening) C.opening.cols.forEach(function (c) { OPEN[c] = 1; });\n\n    var pieces = C.pieces.map(function (p, i) {\n      return {\n        i: i, base: copy(p.cells), shape: copy(p.cells), at: null,\n        hole: p.hole ? p.hole[0] : -1, holeR: p.hole ? p.hole[1] : 0,\n        grab: [p.cells[0][0], p.cells[0][1]], wasIn: false\n      };\n    });\n    function home(p) { return C.start ? [C.start[p.i][0], C.start[p.i][1]] : null; }\n    if (SLIDE) pieces.forEach(function (p) { p.at = home(p); });\n\n    var sel = null, drag = null, tap = null, msg = \"\";\n    var best = 0, outs = 0, playMs = 0, lastAct = 0, endOn = false;\n\n    \/* ---------- rules ---------- *\/\n    function free(r, c) {\n      if (r \u003e= 0 \u0026\u0026 r \u003c H \u0026\u0026 c \u003e= 0 \u0026\u0026 c \u003c W) return true;          \/* the tray grid *\/\n      if (!SLIDE) return false;\n      if (r === -1) return OPEN[c] === 1;                             \/* the wall: only its gap *\/\n      return r \u003e= Z.top \u0026\u0026 r \u003c= -2 \u0026\u0026 c \u003e= Z.left \u0026\u0026 c \u003c= Z.right;    \/* the table outside *\/\n    }\n    function occupied(skip) {\n      var o = {};\n      pieces.forEach(function (q) {\n        if (q === skip || !q.at) return;\n        shift(q.shape, q.at).forEach(function (c) { o[key(c[0], c[1])] = 1; });\n      });\n      return o;\n    }\n    function legal(p, shape, at) {\n      var o = occupied(p), cs = shift(shape, at);\n      for (var i = 0; i \u003c cs.length; i++) {\n        if (!free(cs[i][0], cs[i][1]) || o[key(cs[i][0], cs[i][1])]) return false;\n      }\n      return true;\n    }\n    function cellsOf(p) { return p.at ? shift(p.shape, p.at) : null; }\n    function allOutside(cs) { return cs.every(function (c) { return c[0] \u003c= -2; }); }\n    function isIn(p) {\n      var cs = cellsOf(p);\n      return !!cs \u0026\u0026 cs.every(function (c) { return c[0] \u003e= 0 \u0026\u0026 c[0] \u003c H \u0026\u0026 c[1] \u003e= 0 \u0026\u0026 c[1] \u003c W; });\n    }\n    function isOut(p) { return SLIDE ? allOutside(cellsOf(p)) : !p.at; }\n    function engaged(p) { return SLIDE ? !isOut(p) : !!p.at; }\n\n    function step(p, dr, dc) {\n      var at = [p.at[0] + dr, p.at[1] + dc];\n      if (!legal(p, p.shape, at)) return false;\n      p.at = at;\n      return true;\n    }\n    \/* slide one square at a time toward a target, the bigger pull first and\n       the other axis when that is blocked *\/\n    function toward(p, target, grab) {\n      var moved = 0;\n      for (var g = 0; g \u003c 40; g++) {\n        var dr = target[0] - grab[0] - p.at[0], dc = target[1] - grab[1] - p.at[1];\n        if (!dr \u0026\u0026 !dc) break;\n        var sr = dr \u003e 0 ? 1 : (dr \u003c 0 ? -1 : 0), sc = dc \u003e 0 ? 1 : (dc \u003c 0 ? -1 : 0);\n        var tries = Math.abs(dr) \u003e= Math.abs(dc) ? [[sr, 0], [0, sc]] : [[0, sc], [sr, 0]];\n        var ok = false;\n        for (var i = 0; i \u003c 2; i++) {\n          if (!tries[i][0] \u0026\u0026 !tries[i][1]) continue;\n          if (step(p, tries[i][0], tries[i][1])) { ok = true; break; }\n        }\n        if (!ok) break;\n        moved++;\n      }\n      return moved;\n    }\n    \/* tap-to-place: the touched square of the piece lands on the tapped square\n       if it can; otherwise any other square of the piece that lets it fit *\/\n    function placeNear(p, cell) {\n      var anchors = p.shape.map(function (c, i) {\n        return { c: c, i: i, d: Math.abs(c[0] - p.grab[0]) + Math.abs(c[1] - p.grab[1]) };\n      });\n      anchors.sort(function (a, b) { return (a.d - b.d) || (a.i - b.i); });\n      for (var k = 0; k \u003c anchors.length; k++) {\n        var at = [cell[0] - anchors[k].c[0], cell[1] - anchors[k].c[1]];\n        if (legal(p, p.shape, at)) { p.at = at; return true; }\n      }\n      return false;\n    }\n    function turn(p, fn) {\n      var ns = fn(p.shape);\n      if (!p.at) { p.shape = ns; return true; }\n      if (SLIDE \u0026\u0026 !isOut(p)) return false;\n      var d0 = dims(p.shape), d1 = dims(ns);\n      var base = [p.at[0] + Math.round((d0[0] - d1[0]) \/ 2), p.at[1] + Math.round((d0[1] - d1[1]) \/ 2)];\n      var offs = [];\n      for (var dr = -2; dr \u003c= 2; dr++) for (var dc = -2; dc \u003c= 2; dc++) offs.push([dr, dc]);\n      offs.sort(function (a, b) {\n        return (Math.abs(a[0]) + Math.abs(a[1])) - (Math.abs(b[0]) + Math.abs(b[1]));\n      });\n      for (var i = 0; i \u003c offs.length; i++) {\n        var at = [base[0] + offs[i][0], base[1] + offs[i][1]];\n        if (legal(p, ns, at) \u0026\u0026 (!SLIDE || allOutside(shift(ns, at)))) { p.shape = ns; p.at = at; return true; }\n      }\n      return false;\n    }\n    \/* slide mode: lift a piece out and set it down on the table, near its start *\/\n    function sendHome(p) {\n      var h = home(p), shapes = [p.shape, p.base];\n      for (var s = 0; s \u003c shapes.length; s++) {\n        var sh = shapes[s], dm = dims(sh), bestAt = null, bd = Infinity;\n        for (var r = Z.top; r + dm[0] - 1 \u003c= -2; r++) {\n          for (var c = Z.left; c + dm[1] - 1 \u003c= Z.right; c++) {\n            if (!legal(p, sh, [r, c])) continue;\n            var d = Math.abs(r - h[0]) + Math.abs(c - h[1]);\n            if (d \u003c bd) { bd = d; bestAt = [r, c]; }\n          }\n        }\n        if (bestAt) { p.shape = copy(sh); p.at = bestAt; return true; }\n      }\n      return false;\n    }\n\n    \/* ---------- effort and the best count ---------- *\/\n    function act() {\n      var now = Date.now();\n      if (lastAct) playMs += Math.min(Math.max(0, now - lastAct), PLAY_GAP_CAP);\n      lastAct = now;\n    }\n    function settle() {\n      var n = 0;\n      pieces.forEach(function (p) {\n        if (isIn(p)) { n++; p.wasIn = true; }\n        else if (p.wasIn \u0026\u0026 isOut(p)) { outs++; p.wasIn = false; }\n      });\n      if (n \u003e best) best = n;\n      if (!endOn \u0026\u0026 (outs \u003e= EFFORT_OUTS || playMs \u003e= EFFORT_MS)) endOn = true;\n      render();\n    }\n\n    \/* ---------- DOM ---------- *\/\n    root.appendChild(el(\"h3\", \"gptr-h\", t.title));\n    root.appendChild(el(\"p\", \"gptr-intro\", SLIDE ? t.introSlide : t.introPlace));\n    var stage = el(\"div\", \"gptr-stage\");\n    var boardEl = el(\"div\", \"gptr-board\");\n    boardEl.setAttribute(\"dir\", \"ltr\");\n    stage.appendChild(boardEl);\n    var rackEl = null;\n    if (!SLIDE) {\n      rackEl = el(\"div\", \"gptr-rack\");\n      rackEl.setAttribute(\"dir\", \"ltr\");\n      rackEl.setAttribute(\"role\", \"group\");\n      rackEl.setAttribute(\"aria-label\", t.rack);\n      stage.appendChild(rackEl);\n    }\n    root.appendChild(stage);\n    var ctl = el(\"div\", \"gptr-ctl\");\n    function button(label, name) {\n      var b = el(\"button\", \"gptr-btn\", label);\n      b.type = \"button\";\n      b.setAttribute(\"data-act\", name);\n      ctl.appendChild(b);\n      return b;\n    }\n    var bRot = button(t.rotate, \"rotate\"), bFlip = button(t.flip, \"flip\"),\n        bTake = button(t.take, \"take\"), bEmpty = button(t.empty, \"empty\"), bReset = button(t.reset, \"reset\");\n    root.appendChild(ctl);\n    var sayEl = el(\"p\", \"gptr-say\", \" \");\n    sayEl.setAttribute(\"aria-live\", \"polite\");\n    var bestEl = el(\"p\", \"gptr-best\", \"\");\n    var endEl = el(\"p\", \"gptr-end\", t.end);\n    endEl.hidden = true;\n    root.appendChild(sayEl);\n    root.appendChild(bestEl);\n    root.appendChild(endEl);\n\n    \/* ---------- the board SVG: built once, only the piece layer is redrawn ---------- *\/\n    var cw = C.cavity[0], ch = C.cavity[1];\n    var offX = (cw - W) \/ 2, offY = (ch - H) \/ 2;      \/* grid centred in the cavity *\/\n    var R = C.rim * S;\n    var cx = -offX * S, cy = -offY * S;\n    var wallT = SLIDE ? C.opening.wall * S : R;\n    var vb;\n    if (SLIDE) {\n      var M = 1.5;\n      vb = [Z.left * S - M, Z.top * S - M, (Z.right - Z.left + 1) * S + 2 * M, (H - Z.top) * S + R + 2 * M];\n    } else {\n      vb = [cx - R, cy - R, cw * S + 2 * R, ch * S + 2 * R];\n    }\n    var svgEl = sv(\"svg\", { width: \"100%\", role: \"img\", \"aria-label\": t.board, \"data-s\": String(S) });\n    svgEl.setAttribute(\"viewBox\", vb.map(function (v) { return +v.toFixed(3); }).join(\" \"));\n    svgEl.style.aspectRatio = vb[2].toFixed(3) + \" \/ \" + vb[3].toFixed(3);\n    var defs = sv(\"defs\", {});\n    COL.forEach(function (c, k) {\n      var g = sv(\"linearGradient\", { id: uid + \"g\" + k, x1: \"0\", y1: \"0\", x2: \"0\", y2: \"1\" });\n      g.appendChild(sv(\"stop\", { offset: \"0\", \"stop-color\": LIGHT[k] }));\n      g.appendChild(sv(\"stop\", { offset: \"1\", \"stop-color\": c }));\n      defs.appendChild(g);\n    });\n    var soft = sv(\"filter\", { id: uid + \"soft\", x: \"-20%\", y: \"-20%\", width: \"140%\", height: \"140%\" });\n    soft.appendChild(sv(\"feGaussianBlur\", { stdDeviation: \"0.5\" }));\n    defs.appendChild(soft);\n    var grain = sv(\"filter\", { id: uid + \"grain\", x: \"0\", y: \"0\", width: \"100%\", height: \"100%\" });\n    grain.appendChild(sv(\"feTurbulence\", { type: \"fractalNoise\", baseFrequency: \"0.9\", numOctaves: \"3\", seed: \"4\" }));\n    grain.appendChild(sv(\"feColorMatrix\", { type: \"saturate\", values: \"0\" }));\n    var ct = sv(\"feComponentTransfer\", {});\n    ct.appendChild(sv(\"feFuncA\", { type: \"discrete\", tableValues: \"0 0 0 0 .5\" }));\n    grain.appendChild(ct);\n    defs.appendChild(grain);\n    svgEl.appendChild(defs);\n\n    var trayG = sv(\"g\", { \"data-layer\": \"tray\" });\n    function speckled(x, y, w, h, rx, base, op) {\n      trayG.appendChild(sv(\"rect\", { x: x, y: y, width: w, height: h, rx: rx, fill: base }));\n      trayG.appendChild(sv(\"rect\", { x: x, y: y, width: w, height: h, rx: rx, fill: \"#8A8275\",\n        \"fill-opacity\": op, filter: \"url(#\" + uid + \"grain)\" }));\n    }\n    if (SLIDE) {\n      \/* the table the pieces wait on, and the strip that leads into the gap *\/\n      var gx0 = cx + C.opening.from * S, gx1 = cx + C.opening.to * S;\n      var mat = { fill: \"#8A8275\", \"fill-opacity\": \".07\", stroke: \"rgba(80,74,64,.22)\",\n        \"stroke-width\": \".4\", \"stroke-dasharray\": \"1.6 1.4\" };\n      var m1 = { x: Z.left * S, y: Z.top * S, width: (Z.right - Z.left + 1) * S, height: (-1 - Z.top) * S, rx: \"2\" };\n      for (var mk in mat) m1[mk] = mat[mk];\n      trayG.appendChild(sv(\"rect\", m1));\n      trayG.appendChild(sv(\"rect\", { x: gx0, y: -S - 0.2, width: gx1 - gx0, height: S - wallT + 0.4,\n        fill: \"#8A8275\", \"fill-opacity\": \".07\" }));\n    }\n    speckled(cx - R, cy - wallT, cw * S + 2 * R, ch * S + R + wallT, \"3\", \"#EDEAE3\", \".5\");\n    speckled(cx, cy, cw * S, ch * S, \"1.6\", \"#F6F4EF\", \".28\");\n    trayG.appendChild(sv(\"rect\", { x: cx, y: cy, width: cw * S, height: ch * S, rx: \"1.6\", fill: \"none\",\n      stroke: \"rgba(80,74,64,.30)\", \"stroke-width\": \".5\" }));\n    if (SLIDE) {\n      \/* the gap in the wall: floor runs through it *\/\n      var g0 = cx + C.opening.from * S, g1 = cx + C.opening.to * S;\n      speckled(g0, cy - wallT - 0.01, g1 - g0, wallT + 1.2, \"0\", \"#F6F4EF\", \".28\");\n      trayG.appendChild(sv(\"path\", { d: \"M\" + g0 + \" \" + (cy - wallT) + \"V\" + cy + \"M\" + g1 + \" \" + (cy - wallT) + \"V\" + cy,\n        stroke: \"rgba(80,74,64,.30)\", \"stroke-width\": \".5\", fill: \"none\" }));\n    }\n    svgEl.appendChild(trayG);\n    var pieceG = sv(\"g\", { \"data-layer\": \"pieces\" });\n    svgEl.appendChild(pieceG);\n    boardEl.appendChild(svgEl);\n\n    function pieceNode(p, cells, opts) {\n      var k = p.i % COL.length;\n      var g = sv(\"g\", { \"data-p\": String(p.i), style: \"cursor:grab;touch-action:none\" });\n      g.setAttribute(\"data-cells\", cells.map(function (c) { return c[0] + \",\" + c[1]; }).join(\" \"));\n      if (opts.sel) g.setAttribute(\"data-sel\", \"1\");\n      var d = piecePath(cells);\n      if (opts.ghost) {\n        g.setAttribute(\"data-ghost\", \"1\");\n        g.setAttribute(\"data-bad\", opts.bad ? \"1\" : \"0\");\n        g.setAttribute(\"pointer-events\", \"none\");\n      } else {\n        g.appendChild(sv(\"path\", { d: d, fill: \"rgba(18,32,40,.22)\", transform: \"translate(0.5,0.9)\",\n          filter: \"url(#\" + uid + \"soft)\", \"pointer-events\": \"none\" }));\n      }\n      g.appendChild(sv(\"path\", { d: d, fill: \"url(#\" + uid + \"g\" + k + \")\",\n        \"fill-opacity\": opts.ghost ? \".45\" : \"1\",\n        stroke: opts.bad ? \"#C2544C\" : (opts.sel ? \"#0B7FA8\" : \"rgba(10,26,34,.42)\"),\n        \"stroke-width\": opts.sel || opts.bad ? \"1.1\" : \".45\", \"stroke-linejoin\": \"round\" }));\n      if (!opts.ghost) {\n        var cid = uid + \"c\" + (++clipSeq);\n        var clip = sv(\"clipPath\", { id: cid });\n        clip.appendChild(sv(\"path\", { d: d }));\n        g.appendChild(clip);\n        g.appendChild(sv(\"path\", { d: d, fill: \"none\", stroke: \"rgba(255,255,255,.34)\", \"stroke-width\": \".5\",\n          \"stroke-linejoin\": \"round\", transform: \"translate(0,0.45)\", \"clip-path\": \"url(#\" + cid + \")\",\n          \"pointer-events\": \"none\" }));\n      }\n      if (p.hole \u003e= 0 \u0026\u0026 cells[p.hole]) {\n        var hc = cells[p.hole];\n        g.appendChild(sv(\"circle\", { cx: (hc[1] + 0.5) * S, cy: (hc[0] + 0.5) * S, r: (p.holeR * S).toFixed(2),\n          fill: \"#E9E5DC\", \"fill-opacity\": opts.ghost ? \".5\" : \"1\", stroke: \"rgba(10,26,34,.45)\", \"stroke-width\": \".45\" }));\n      }\n      return g;\n    }\n\n    function drawPieces() {\n      clear(pieceG);\n      pieces.forEach(function (p) {\n        if (!p.at) return;\n        if (!SLIDE \u0026\u0026 drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) return;   \/* lifted: the ghost shows it *\/\n        pieceG.appendChild(pieceNode(p, cellsOf(p), { sel: sel === p }));\n      });\n      if (!SLIDE \u0026\u0026 drag \u0026\u0026 drag.live \u0026\u0026 !drag.off) {\n        pieceG.appendChild(pieceNode(drag.p, drag.cells, { ghost: true, bad: !drag.ok }));\n      }\n    }\n    var rackEm = 1.4;\n    if (rackEl) {\n      var tw = 0;\n      pieces.forEach(function (p) { tw += dims(p.base)[1]; });\n      rackEm = Math.max(0.95, Math.min(1.4, 18 \/ tw));\n    }\n    function drawRack() {\n      if (!rackEl) return;\n      clear(rackEl);\n      var any = false;\n      pieces.forEach(function (p) {\n        if (p.at) return;\n        any = true;\n        var dm = dims(p.shape);\n        var s = sv(\"svg\", { \"data-p\": String(p.i), \"data-s\": String(S), role: \"img\" });\n        s.setAttribute(\"viewBox\", \"-0.6 -0.6 \" + (dm[1] * S + 1.2) + \" \" + (dm[0] * S + 1.2));\n        s.style.width = (dm[1] * rackEm).toFixed(3) + \"em\";\n        s.style.height = (dm[0] * rackEm).toFixed(3) + \"em\";\n        if (sel === p) s.setAttribute(\"data-sel\", \"1\");\n        if (drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) s.style.opacity = \".35\";\n        s.appendChild(pieceNode(p, p.shape, { sel: sel === p }));\n        rackEl.appendChild(s);\n      });\n      if (!any) rackEl.appendChild(el(\"span\", \"gptr-none\", \" \"));\n    }\n    function turnTarget() {\n      if (sel) return (SLIDE \u0026\u0026 !isOut(sel)) ? null : sel;\n      for (var i = 0; i \u003c pieces.length; i++) {\n        if (SLIDE ? isOut(pieces[i]) : !pieces[i].at) return pieces[i];\n      }\n      return null;\n    }\n    function render() {\n      drawPieces();\n      drawRack();\n      var tt = turnTarget(), had = document.activeElement;\n      bRot.disabled = bFlip.disabled = !tt;\n      bTake.disabled = !(sel \u0026\u0026 engaged(sel));\n      bEmpty.disabled = !pieces.some(engaged);\n      \/* a button that just went disabled drops focus to the page, and the\n         arrow keys with it: keep them working on the board *\/\n      if (had \u0026\u0026 had.parentNode === ctl \u0026\u0026 had.disabled) focusRoot();\n      sayEl.textContent = msg || \" \";\n      bestEl.textContent = fmt(t.best, { n: best, m: pieces.length });\n      endEl.hidden = !endOn;\n    }\n\n    \/* ---------- input ---------- *\/\n    function focusRoot() { try { root.focus({ preventScroll: true }); } catch (e) { \/* old browsers *\/ } }\n    function boardCell(ev) {\n      var q = toView(svgEl, ev.clientX, ev.clientY);\n      var r = Math.floor(q.y \/ S), c = Math.floor(q.x \/ S);\n      if (!SLIDE \u0026\u0026 q.x \u003e= cx \u0026\u0026 q.x \u003c= cx + cw * S \u0026\u0026 q.y \u003e= cy \u0026\u0026 q.y \u003c= cy + ch * S) {\n        \/* inside the cavity but in its slack around the grid: snap to the edge squares *\/\n        r = Math.max(0, Math.min(H - 1, r));\n        c = Math.max(0, Math.min(W - 1, c));\n      }\n      return [r, c];\n    }\n    function overBoard(ev) {\n      var b = svgEl.getBoundingClientRect();\n      return ev.clientX \u003e= b.left \u0026\u0026 ev.clientX \u003c= b.right \u0026\u0026 ev.clientY \u003e= b.top \u0026\u0026 ev.clientY \u003c= b.bottom;\n    }\n    function startDrag(p, ev, fromRack, grab, fallTap, downCell) {\n      if (ev.cancelable) ev.preventDefault();\n      try { (fromRack ? rackEl : svgEl).setPointerCapture(ev.pointerId); } catch (e) { \/* synthetic pointer *\/ }\n      drag = { p: p, fromRack: fromRack, grab: grab, sx: ev.clientX, sy: ev.clientY, pid: ev.pointerId,\n        live: false, off: true, ok: false, at: null, cells: null, fallTap: fallTap, downCell: downCell };\n      window.addEventListener(\"pointermove\", onMove);\n      window.addEventListener(\"pointerup\", onUp);\n      window.addEventListener(\"pointercancel\", onCancel);\n    }\n    function endListen() {\n      window.removeEventListener(\"pointermove\", onMove);\n      window.removeEventListener(\"pointerup\", onUp);\n      window.removeEventListener(\"pointercancel\", onCancel);\n    }\n    function onMove(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      if (!drag.live) {\n        if (Math.abs(ev.clientX - drag.sx) + Math.abs(ev.clientY - drag.sy) \u003c 6) return;\n        drag.live = true;\n        if (drag.fromRack) drawRack();\n      }\n      var cell = boardCell(ev);\n      if (SLIDE) {\n        if (toward(drag.p, cell, drag.grab)) msg = \"\";\n        drawPieces();\n        return;\n      }\n      if (!overBoard(ev)) { drag.off = true; drag.cells = null; drawPieces(); return; }\n      drag.off = false;\n      drag.at = [cell[0] - drag.grab[0], cell[1] - drag.grab[1]];\n      drag.cells = shift(drag.p.shape, drag.at);\n      drag.ok = legal(drag.p, drag.p.shape, drag.at);\n      drawPieces();\n    }\n    function onUp(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      var d = drag;\n      drag = null;\n      act();\n      if (!d.live) {                                  \/* a tap, not a drag *\/\n        if (d.fallTap) { boardTap(d.downCell); return; }\n        d.p.grab = d.grab;\n        sel = (sel === d.p) ? null : d.p;\n        msg = \"\";\n        settle();\n        return;\n      }\n      if (SLIDE) { sel = d.p; d.p.grab = d.grab; settle(); return; }\n      if (d.off) {\n        if (d.p.at) d.p.at = null;                    \/* dragged off the board: back with the pieces *\/\n        msg = \"\";\n      } else if (d.ok) {\n        d.p.at = d.at;\n        sel = null;\n        msg = \"\";\n      } else {\n        msg = t.nofit;\n      }\n      settle();\n    }\n    function onCancel(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      drag = null;\n      settle();\n    }\n    function boardTap(cell) {\n      if (!sel) { render(); return; }\n      if (SLIDE) {\n        msg = toward(sel, cell, sel.grab) ? \"\" : t.blocked;\n      } else if (placeNear(sel, cell)) {\n        sel = null;\n        msg = \"\";\n      } else {\n        msg = t.nofit;\n      }\n      settle();\n    }\n\n    svgEl.addEventListener(\"pointerdown\", function (ev) {\n      if (ev.button \u003e 0) return;\n      act();\n      focusRoot();\n      var hit = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      var cell = boardCell(ev);\n      if (hit \u0026\u0026 !hit.getAttribute(\"data-ghost\")) {\n        var p = pieces[+hit.getAttribute(\"data-p\")];\n        var grab = nearestCell(p.shape, [cell[0] - p.at[0], cell[1] - p.at[1]]);\n        \/* a piece in hand from the rack wants to be placed: a tap on a piece in\n           the tray is an attempt to put it there *\/\n        var fall = !SLIDE \u0026\u0026 !!sel \u0026\u0026 !sel.at \u0026\u0026 sel !== p;\n        startDrag(p, ev, false, grab, fall, cell);\n        return;\n      }\n      tap = { x: ev.clientX, y: ev.clientY, pid: ev.pointerId, cell: cell };\n    });\n    svgEl.addEventListener(\"pointerup\", function (ev) {\n      if (!tap || ev.pointerId !== tap.pid) return;\n      var t0 = tap;\n      tap = null;\n      if (Math.abs(ev.clientX - t0.x) + Math.abs(ev.clientY - t0.y) \u003e 10) return;\n      act();\n      boardTap(t0.cell);\n    });\n    svgEl.addEventListener(\"pointercancel\", function () { tap = null; });\n    \/* a finger that lands on a piece drags it; anywhere else the page still scrolls *\/\n    svgEl.addEventListener(\"touchstart\", function (ev) {\n      var h = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      if (h \u0026\u0026 ev.cancelable) ev.preventDefault();\n    }, { passive: false });\n\n    if (rackEl) {\n      rackEl.addEventListener(\"pointerdown\", function (ev) {\n        if (ev.button \u003e 0) return;\n        var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n        if (!s) return;\n        act();\n        focusRoot();\n        var p = pieces[+s.getAttribute(\"data-p\")];\n        var q = toView(s, ev.clientX, ev.clientY);\n        startDrag(p, ev, true, nearestCell(p.shape, [Math.floor(q.y \/ S), Math.floor(q.x \/ S)]), false, null);\n      });\n      rackEl.addEventListener(\"touchstart\", function (ev) {\n        var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n        if (s \u0026\u0026 ev.cancelable) ev.preventDefault();\n      }, { passive: false });\n    }\n\n    root.addEventListener(\"keydown\", function (e) {\n      var d = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] }[e.key];\n      if (!d || !sel || !sel.at) return;\n      e.preventDefault();\n      act();\n      if (SLIDE) {\n        msg = step(sel, d[0], d[1]) ? \"\" : t.blocked;\n      } else {\n        var at = [sel.at[0] + d[0], sel.at[1] + d[1]];\n        if (legal(sel, sel.shape, at)) { sel.at = at; msg = \"\"; } else msg = t.nofit;\n      }\n      settle();\n    });\n\n    function turnBtn(fn) {\n      return function () {\n        act();\n        var p = turnTarget();\n        if (!p) { render(); return; }\n        if (turn(p, fn)) { sel = p; msg = \"\"; } else msg = t.noturn;\n        settle();\n      };\n    }\n    bRot.addEventListener(\"click\", turnBtn(rot));\n    bFlip.addEventListener(\"click\", turnBtn(flp));\n    bTake.addEventListener(\"click\", function () {\n      act();\n      if (!sel || !engaged(sel)) { render(); return; }\n      if (SLIDE) sendHome(sel); else sel.at = null;\n      msg = \"\";\n      settle();\n    });\n    bEmpty.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) {\n        if (!engaged(p)) return;\n        if (SLIDE) sendHome(p); else p.at = null;\n      });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n    bReset.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) { p.shape = copy(p.base); p.at = home(p); p.grab = [p.base[0][0], p.base[0][1]]; });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n\n    settle();\n  }\n\n  window.GPTR = { mount: mount, v: 1 };\n})();\n(function(){var C={\"v\":1,\"mode\":\"place\",\"grid\":[6,6],\"rim\":0.3,\"pieces\":[{\"cells\":[[0,3],[0,4],[1,0],[1,1],[1,2],[1,3],[2,3]]},{\"cells\":[[0,3],[0,4],[1,0],[1,1],[1,2],[1,3],[2,3]]},{\"cells\":[[0,3],[0,4],[1,0],[1,1],[1,2],[1,3],[2,3]]}],\"cavity\":[6.01,6.01]};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gptr \")\u003c0)r=document.querySelector(\".gptr:not([data-gptr-on])\");if(r\u0026\u0026window.GPTR)window.GPTR.mount(r,C);})();\n\u003c\/script\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51325796909223,"sku":"GP-TRIV","price":16.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/trivial_marble.png?v=1789059498"},{"product_id":"slidely-trivial-3-piece-packing-puzzle","title":"Slidely Trivial | 3-Piece Packing Puzzle","description":"\u003ch2\u003eQuick Summary\u003c\/h2\u003e\u003cp\u003eSlidely Trivial is a 3-piece packing puzzle designed by Goh Pit Khiam. Pack all 3 pieces into the tray, but every piece has to go in flat through the opening and slide into place, so the order matters as much as the fit. Medium difficulty, 3 pieces plus tray, 30-60 min solve time.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e packing puzzle fans who already solved Trivial and want the same tray with a harder rule, and gift buyers looking for a small puzzle with a twist.\u003c\/p\u003e\u003cp\u003e\u003ca href=\"\/products\/trivial-3-piece-packing-puzzle\"\u003eTrivial\u003c\/a\u003e's sibling, with one restriction that changes everything: pieces can only go into the tray flat, through the opening.\u003c\/p\u003e\n\u003cp\u003eGoal: pack all 3 pieces inside the tray.\u003c\/p\u003e\n\u003cp\u003eYou cannot drop a piece straight into its spot or tilt it in. Every piece enters flat through the opening and has to travel from there, so the puzzle is as much about the order you go in as it is about where each shape ends up. \u003ca href=\"\/collections\/goh-pit-khiam\"\u003eGoh Pit Khiam\u003c\/a\u003e is known for exactly this kind of sliding-move design.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Slidely Trivial?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eOne restriction turns a simple pack into a sliding challenge\u003c\/li\u003e\n\u003cli\u003eDevelops planning and 2D spatial reasoning\u003c\/li\u003e\n\u003cli\u003eLightweight and travel-friendly\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by Goh Pit Khiam\u003c\/p\u003e\n\u003cdiv class=\"gptr\" data-handle=\"slidely-trivial-3-piece-packing-puzzle\"\u003e\n\u003cstyle\u003e\n.gptr{--gptr-fg:rgb(var(--color-foreground,18,18,18));\n --gptr-line:rgba(var(--color-foreground,18,18,18),.18);\n --gptr-muted:rgba(var(--color-foreground,18,18,18),.7);\n --gptr-accent:#0B7FA8;\n font-family:inherit;color:var(--gptr-fg);margin:1.2em 0;max-width:30em;outline:none}\n.gptr:focus{outline:none}\n.gptr:focus-visible{outline:none}\n.gptr:focus-visible .gptr-board svg{outline:2px solid var(--gptr-accent);outline-offset:2px;border-radius:4px}\n.gptr *{box-sizing:border-box}\n.gptr .gptr-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;margin:0 0 .3em;color:var(--gptr-fg)}\n.gptr .gptr-intro{font-size:.92em;line-height:1.5;margin:0 0 .8em;color:var(--gptr-muted);max-width:36em}\n.gptr .gptr-stage{display:flex;flex-direction:column;align-items:flex-start}\n.gptr .gptr-board{width:100%;max-width:24em;direction:ltr}\n.gptr .gptr-board svg{display:block;width:100%;height:auto;max-width:none;\n \/* a finger on the empty tray still scrolls the page; a finger on a piece drags it *\/\n touch-action:pan-y}\n.gptr .gptr-board,.gptr .gptr-rack,.gptr .gptr-ctl button{-webkit-tap-highlight-color:transparent;\n -webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n.gptr .gptr-rack{display:flex;flex-wrap:wrap;gap:.6em;align-items:center;direction:ltr;\n width:100%;max-width:24em;min-height:3.4em;margin-top:.7em;padding:.6em .7em;\n border:1px solid var(--gptr-line);border-radius:7px}\n.gptr[dir=rtl] .gptr-rack{justify-content:flex-end}\n.gptr .gptr-rack svg{display:block;flex:none;touch-action:none;cursor:grab;border-radius:4px;max-width:none}\n.gptr .gptr-rack svg[data-sel]{outline:2px solid var(--gptr-accent);outline-offset:2px}\n.gptr .gptr-none{display:inline-block;min-height:1em}\n.gptr .gptr-ctl{display:flex;flex-wrap:wrap;gap:.45em;margin-top:.8em}\n.gptr .gptr-ctl button{appearance:none;-webkit-appearance:none;margin:0;border:1px solid var(--gptr-line);\n background:transparent;color:var(--gptr-fg);font-family:inherit;font-size:.85em;line-height:1.2;\n letter-spacing:normal;text-transform:none;min-height:2.9em;padding:.6em 1em;border-radius:6px;\n cursor:pointer;box-shadow:none}\n.gptr .gptr-ctl button:hover{border-color:var(--gptr-accent)}\n.gptr .gptr-ctl button:disabled{opacity:.38;cursor:default}\n.gptr .gptr-ctl button:disabled:hover{border-color:var(--gptr-line)}\n.gptr .gptr-say{font-size:.88em;line-height:1.45;color:var(--gptr-muted);min-height:1.45em;margin:.7em 0 0}\n.gptr .gptr-best{font-size:.95em;line-height:1.45;font-weight:600;color:var(--gptr-fg);margin:.3em 0 0}\n.gptr .gptr-end{font-size:1em;line-height:1.45;font-weight:600;color:var(--gptr-accent);margin:.45em 0 0}\n.gptr .gptr-end[hidden]{display:none}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n\/* Greg Puzzles tray teaser (.gptr) - engine.\n   The real tray and the real pieces, quarter turns and flips only. The page\n   carries shapes and nothing else: no positions that finish the puzzle, no\n   finish check, no network calls, and no finished state is ever shown.\n\n   Written to live inside a Shopify product description:\n   - every DOM node is made with createElement \/ createElementNS, so no closing\n     tag ever appears inside a JS string (Shopify reparses body_html);\n   - SVG attributes are set with setAttribute, so viewBox keeps its case;\n   - nothing relies on an empty div being visible (the theme hides div:empty);\n   - hit tests go through the SVG's own screen matrix, never restated numbers.\n\n   Two modes, chosen by the config:\n   - \"place\": pieces come from a rack and go anywhere inside the tray grid.\n   - \"slide\": pieces start outside the tray and get in only by sliding through\n     the opening one square at a time; they turn only while fully outside. *\/\n(function () {\n  \"use strict\";\n  if (window.GPTR) return;\n\n  var NS = \"http:\/\/www.w3.org\/2000\/svg\";\n  var S = 10;                     \/* one grid square in SVG units *\/\n  var seq = 0, clipSeq = 0;\n  var COL = [\"#2E93C4\", \"#17678F\", \"#4FAAD0\", \"#0F4D69\"];\n  var LIGHT = [\"#58B3DD\", \"#2E88B2\", \"#78C6E4\", \"#2A6E8E\"];\n  var PLAY_GAP_CAP = 12000;       \/* idle time between touches counts up to this *\/\n  var EFFORT_MS = 45000;          \/* about 45 seconds of real play *\/\n  var EFFORT_OUTS = 3;            \/* or three pieces taken back out *\/\n\n  var TXT = {\n    en: {\n      title: \"Try it yourself\",\n      introPlace: \"Tap a piece, then tap a square in the tray. Dragging works too.\",\n      introSlide: \"Pieces go in only through the gap in the wall, one square at a time. Tap a piece, then tap where it should slide. Dragging works too.\",\n      rotate: \"Rotate\", flip: \"Flip\", take: \"Take out\", empty: \"Empty the tray\", reset: \"Start over\",\n      best: \"Best so far: {n} of {m} in\",\n      end: \"Still won't fit? That's the puzzle.\",\n      nofit: \"That will not fit there.\",\n      noturn: \"No room to turn it there.\",\n      blocked: \"That piece has nowhere to go that way.\",\n      board: \"Puzzle tray\", rack: \"Pieces\"\n    },\n    he: {\n      title: \"נסו בעצמכם\",\n      introPlace: \"הקישו על חלק ואז על משבצת במגש. אפשר גם לגרור.\",\n      introSlide: \"החלקים נכנסים רק דרך הפתח בדופן, משבצת אחת בכל פעם. הקישו על חלק ואז על המקום שאליו הוא אמור להחליק. אפשר גם לגרור.\",\n      rotate: \"סיבוב\", flip: \"היפוך\", take: \"הוצאה\", empty: \"ריקון המגש\", reset: \"התחלה מחדש\",\n      best: \"השיא עד עכשיו: {n} מתוך {m} בפנים\",\n      end: \"עדיין לא נכנס? זה הפאזל.\",\n      nofit: \"זה לא נכנס שם.\",\n      noturn: \"אין שם מקום לסובב אותו.\",\n      blocked: \"לחלק הזה אין לאן לזוז לכיוון הזה.\",\n      board: \"מגש הפאזל\", rack: \"החלקים\"\n    },\n    ja: {\n      title: \"試してみてください\",\n      introPlace: \"ピースをタップしてから、トレイのマスをタップしてください。ドラッグでも動かせます。\",\n      introSlide: \"ピースは壁のすき間からしか入りません。1マスずつです。ピースをタップしてから、すべらせたい先をタップしてください。ドラッグでも動かせます。\",\n      rotate: \"回転\", flip: \"裏返す\", take: \"取り出す\", empty: \"トレイを空にする\", reset: \"最初から\",\n      best: \"これまでの最高：{m}個中{n}個が入りました\",\n      end: \"まだ入らない？それがこのパズルです。\",\n      nofit: \"そこには入りません。\",\n      noturn: \"そこでは回す余地がありません。\",\n      blocked: \"そのピースはその方向へ動けません。\",\n      board: \"パズルのトレイ\", rack: \"ピース\"\n    }\n  };\n\n  function langOf() {\n    var l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\n    if (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\n    if (l.indexOf(\"ja\") === 0) return \"ja\";\n    return \"en\";\n  }\n  function fmt(s, o) {\n    return s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n  }\n  function el(tag, cls, txt) {\n    var e = document.createElement(tag);\n    if (cls) e.className = cls;\n    if (txt != null) e.textContent = txt;\n    return e;\n  }\n  function sv(tag, attrs) {\n    var e = document.createElementNS(NS, tag);\n    for (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) e.setAttribute(k, attrs[k]);\n    return e;\n  }\n  function clear(node) { while (node.firstChild) node.removeChild(node.firstChild); }\n\n  \/* ---------- shapes: cells are [row, col], rows run down ---------- *\/\n  function norm(cs) {\n    var r0 = Infinity, c0 = Infinity;\n    cs.forEach(function (c) { if (c[0] \u003c r0) r0 = c[0]; if (c[1] \u003c c0) c0 = c[1]; });\n    return cs.map(function (c) { return [c[0] - r0, c[1] - c0]; });\n  }\n  \/* order is kept by both, so a marked cell (the fish's eye) stays marked *\/\n  function rot(cs) { return norm(cs.map(function (c) { return [c[1], -c[0]]; })); }\n  function flp(cs) { return norm(cs.map(function (c) { return [c[0], -c[1]]; })); }\n  function dims(cs) {\n    var h = 0, w = 0;\n    cs.forEach(function (c) { if (c[0] + 1 \u003e h) h = c[0] + 1; if (c[1] + 1 \u003e w) w = c[1] + 1; });\n    return [h, w];\n  }\n  function shift(cs, at) { return cs.map(function (c) { return [c[0] + at[0], c[1] + at[1]]; }); }\n  function copy(cs) { return cs.map(function (c) { return [c[0], c[1]]; }); }\n  function key(r, c) { return r + \",\" + c; }\n  function nearestCell(shape, rel) {\n    var best = shape[0], bd = Infinity;\n    shape.forEach(function (c) {\n      var d = Math.abs(c[0] - rel[0]) + Math.abs(c[1] - rel[1]);\n      if (d \u003c bd) { bd = d; best = c; }\n    });\n    return [best[0], best[1]];\n  }\n\n  \/* ---------- outlines: one rounded path per piece ---------- *\/\n  function outline(cells) {\n    var has = {};\n    cells.forEach(function (c) { has[key(c[0], c[1])] = 1; });\n    var seg = [];\n    cells.forEach(function (c) {\n      var r = c[0], k = c[1];\n      if (!has[key(r - 1, k)]) seg.push([[k, r], [k + 1, r]]);\n      if (!has[key(r + 1, k)]) seg.push([[k, r + 1], [k + 1, r + 1]]);\n      if (!has[key(r, k - 1)]) seg.push([[k, r], [k, r + 1]]);\n      if (!has[key(r, k + 1)]) seg.push([[k + 1, r], [k + 1, r + 1]]);\n    });\n    return seg;\n  }\n  function loops(cells) {\n    var segs = outline(cells).map(function (e) { return [e[0].slice(), e[1].slice()]; });\n    var out = [];\n    while (segs.length) {\n      var ring = [segs[0][0], segs[0][1]];\n      segs.splice(0, 1);\n      var guard = 0;\n      while (guard++ \u003c 400) {\n        var head = ring[ring.length - 1], found = -1;\n        for (var i = 0; i \u003c segs.length; i++) {\n          if (segs[i][0][0] === head[0] \u0026\u0026 segs[i][0][1] === head[1]) { ring.push(segs[i][1]); found = i; break; }\n          if (segs[i][1][0] === head[0] \u0026\u0026 segs[i][1][1] === head[1]) { ring.push(segs[i][0]); found = i; break; }\n        }\n        if (found \u003c 0) break;\n        segs.splice(found, 1);\n        var a = ring[0], b = ring[ring.length - 1];\n        if (a[0] === b[0] \u0026\u0026 a[1] === b[1]) { ring.pop(); break; }\n      }\n      if (ring.length \u003e 2) out.push(ring);\n    }\n    return out;\n  }\n  function roundedPath(ring, r) {\n    \/* drop collinear points first so long straight edges stay one segment *\/\n    var pts = ring.filter(function (p1, i) {\n      var p0 = ring[(i - 1 + ring.length) % ring.length], p2 = ring[(i + 1) % ring.length];\n      return (p1[0] - p0[0]) * (p2[1] - p1[1]) - (p1[1] - p0[1]) * (p2[0] - p1[0]) !== 0;\n    });\n    var d = \"\", n = pts.length;\n    for (var i = 0; i \u003c n; i++) {\n      var p0 = pts[(i - 1 + n) % n], p1 = pts[i], p2 = pts[(i + 1) % n];\n      var v1 = [p1[0] - p0[0], p1[1] - p0[1]], v2 = [p2[0] - p1[0], p2[1] - p1[1]];\n      var l1 = Math.hypot(v1[0], v1[1]) || 1, l2 = Math.hypot(v2[0], v2[1]) || 1;\n      var rr = Math.min(r, l1 \/ 2, l2 \/ 2);\n      var a = [p1[0] - v1[0] \/ l1 * rr, p1[1] - v1[1] \/ l1 * rr];\n      var b = [p1[0] + v2[0] \/ l2 * rr, p1[1] + v2[1] \/ l2 * rr];\n      d += (i === 0 ? \"M\" : \"L\") + a[0].toFixed(2) + \" \" + a[1].toFixed(2);\n      d += \"Q\" + p1[0].toFixed(2) + \" \" + p1[1].toFixed(2) + \" \" + b[0].toFixed(2) + \" \" + b[1].toFixed(2);\n    }\n    return d + \"Z\";\n  }\n  function piecePath(cells) {\n    return loops(cells).map(function (ring) {\n      return roundedPath(ring.map(function (p) { return [p[0] * S, p[1] * S]; }), S * 0.17);\n    }).join(\" \");\n  }\n\n  \/* screen point -\u003e SVG user units, through the element's own matrix *\/\n  function toView(svgEl, x, y) {\n    var m = svgEl.getScreenCTM();\n    if (!m) return { x: NaN, y: NaN };\n    var inv = m.inverse(), q;\n    if (typeof DOMPoint === \"function\") q = new DOMPoint(x, y).matrixTransform(inv);\n    else { var pt = svgEl.createSVGPoint(); pt.x = x; pt.y = y; q = pt.matrixTransform(inv); }\n    return { x: q.x, y: q.y };\n  }\n\n  function mount(root, C) {\n    if (!root || root.getAttribute(\"data-gptr-on\")) return;\n    root.setAttribute(\"data-gptr-on\", \"1\");\n    var L = langOf(), t = TXT[L];\n    root.setAttribute(\"dir\", L === \"he\" ? \"rtl\" : \"ltr\");\n    root.setAttribute(\"lang\", L);\n    root.tabIndex = 0;\n\n    var W = C.grid[0], H = C.grid[1];\n    var SLIDE = C.mode === \"slide\";\n    var uid = \"gptr\" + (++seq) + Math.floor(Math.random() * 1e8).toString(36);\n    var Z = C.zone || null;\n    var OPEN = {};\n    if (C.opening) C.opening.cols.forEach(function (c) { OPEN[c] = 1; });\n\n    var pieces = C.pieces.map(function (p, i) {\n      return {\n        i: i, base: copy(p.cells), shape: copy(p.cells), at: null,\n        hole: p.hole ? p.hole[0] : -1, holeR: p.hole ? p.hole[1] : 0,\n        grab: [p.cells[0][0], p.cells[0][1]], wasIn: false\n      };\n    });\n    function home(p) { return C.start ? [C.start[p.i][0], C.start[p.i][1]] : null; }\n    if (SLIDE) pieces.forEach(function (p) { p.at = home(p); });\n\n    var sel = null, drag = null, tap = null, msg = \"\";\n    var best = 0, outs = 0, playMs = 0, lastAct = 0, endOn = false;\n\n    \/* ---------- rules ---------- *\/\n    function free(r, c) {\n      if (r \u003e= 0 \u0026\u0026 r \u003c H \u0026\u0026 c \u003e= 0 \u0026\u0026 c \u003c W) return true;          \/* the tray grid *\/\n      if (!SLIDE) return false;\n      if (r === -1) return OPEN[c] === 1;                             \/* the wall: only its gap *\/\n      return r \u003e= Z.top \u0026\u0026 r \u003c= -2 \u0026\u0026 c \u003e= Z.left \u0026\u0026 c \u003c= Z.right;    \/* the table outside *\/\n    }\n    function occupied(skip) {\n      var o = {};\n      pieces.forEach(function (q) {\n        if (q === skip || !q.at) return;\n        shift(q.shape, q.at).forEach(function (c) { o[key(c[0], c[1])] = 1; });\n      });\n      return o;\n    }\n    function legal(p, shape, at) {\n      var o = occupied(p), cs = shift(shape, at);\n      for (var i = 0; i \u003c cs.length; i++) {\n        if (!free(cs[i][0], cs[i][1]) || o[key(cs[i][0], cs[i][1])]) return false;\n      }\n      return true;\n    }\n    function cellsOf(p) { return p.at ? shift(p.shape, p.at) : null; }\n    function allOutside(cs) { return cs.every(function (c) { return c[0] \u003c= -2; }); }\n    function isIn(p) {\n      var cs = cellsOf(p);\n      return !!cs \u0026\u0026 cs.every(function (c) { return c[0] \u003e= 0 \u0026\u0026 c[0] \u003c H \u0026\u0026 c[1] \u003e= 0 \u0026\u0026 c[1] \u003c W; });\n    }\n    function isOut(p) { return SLIDE ? allOutside(cellsOf(p)) : !p.at; }\n    function engaged(p) { return SLIDE ? !isOut(p) : !!p.at; }\n\n    function step(p, dr, dc) {\n      var at = [p.at[0] + dr, p.at[1] + dc];\n      if (!legal(p, p.shape, at)) return false;\n      p.at = at;\n      return true;\n    }\n    \/* slide one square at a time toward a target, the bigger pull first and\n       the other axis when that is blocked *\/\n    function toward(p, target, grab) {\n      var moved = 0;\n      for (var g = 0; g \u003c 40; g++) {\n        var dr = target[0] - grab[0] - p.at[0], dc = target[1] - grab[1] - p.at[1];\n        if (!dr \u0026\u0026 !dc) break;\n        var sr = dr \u003e 0 ? 1 : (dr \u003c 0 ? -1 : 0), sc = dc \u003e 0 ? 1 : (dc \u003c 0 ? -1 : 0);\n        var tries = Math.abs(dr) \u003e= Math.abs(dc) ? [[sr, 0], [0, sc]] : [[0, sc], [sr, 0]];\n        var ok = false;\n        for (var i = 0; i \u003c 2; i++) {\n          if (!tries[i][0] \u0026\u0026 !tries[i][1]) continue;\n          if (step(p, tries[i][0], tries[i][1])) { ok = true; break; }\n        }\n        if (!ok) break;\n        moved++;\n      }\n      return moved;\n    }\n    \/* tap-to-place: the touched square of the piece lands on the tapped square\n       if it can; otherwise any other square of the piece that lets it fit *\/\n    function placeNear(p, cell) {\n      var anchors = p.shape.map(function (c, i) {\n        return { c: c, i: i, d: Math.abs(c[0] - p.grab[0]) + Math.abs(c[1] - p.grab[1]) };\n      });\n      anchors.sort(function (a, b) { return (a.d - b.d) || (a.i - b.i); });\n      for (var k = 0; k \u003c anchors.length; k++) {\n        var at = [cell[0] - anchors[k].c[0], cell[1] - anchors[k].c[1]];\n        if (legal(p, p.shape, at)) { p.at = at; return true; }\n      }\n      return false;\n    }\n    function turn(p, fn) {\n      var ns = fn(p.shape);\n      if (!p.at) { p.shape = ns; return true; }\n      if (SLIDE \u0026\u0026 !isOut(p)) return false;\n      var d0 = dims(p.shape), d1 = dims(ns);\n      var base = [p.at[0] + Math.round((d0[0] - d1[0]) \/ 2), p.at[1] + Math.round((d0[1] - d1[1]) \/ 2)];\n      var offs = [];\n      for (var dr = -2; dr \u003c= 2; dr++) for (var dc = -2; dc \u003c= 2; dc++) offs.push([dr, dc]);\n      offs.sort(function (a, b) {\n        return (Math.abs(a[0]) + Math.abs(a[1])) - (Math.abs(b[0]) + Math.abs(b[1]));\n      });\n      for (var i = 0; i \u003c offs.length; i++) {\n        var at = [base[0] + offs[i][0], base[1] + offs[i][1]];\n        if (legal(p, ns, at) \u0026\u0026 (!SLIDE || allOutside(shift(ns, at)))) { p.shape = ns; p.at = at; return true; }\n      }\n      return false;\n    }\n    \/* slide mode: lift a piece out and set it down on the table, near its start *\/\n    function sendHome(p) {\n      var h = home(p), shapes = [p.shape, p.base];\n      for (var s = 0; s \u003c shapes.length; s++) {\n        var sh = shapes[s], dm = dims(sh), bestAt = null, bd = Infinity;\n        for (var r = Z.top; r + dm[0] - 1 \u003c= -2; r++) {\n          for (var c = Z.left; c + dm[1] - 1 \u003c= Z.right; c++) {\n            if (!legal(p, sh, [r, c])) continue;\n            var d = Math.abs(r - h[0]) + Math.abs(c - h[1]);\n            if (d \u003c bd) { bd = d; bestAt = [r, c]; }\n          }\n        }\n        if (bestAt) { p.shape = copy(sh); p.at = bestAt; return true; }\n      }\n      return false;\n    }\n\n    \/* ---------- effort and the best count ---------- *\/\n    function act() {\n      var now = Date.now();\n      if (lastAct) playMs += Math.min(Math.max(0, now - lastAct), PLAY_GAP_CAP);\n      lastAct = now;\n    }\n    function settle() {\n      var n = 0;\n      pieces.forEach(function (p) {\n        if (isIn(p)) { n++; p.wasIn = true; }\n        else if (p.wasIn \u0026\u0026 isOut(p)) { outs++; p.wasIn = false; }\n      });\n      if (n \u003e best) best = n;\n      if (!endOn \u0026\u0026 (outs \u003e= EFFORT_OUTS || playMs \u003e= EFFORT_MS)) endOn = true;\n      render();\n    }\n\n    \/* ---------- DOM ---------- *\/\n    root.appendChild(el(\"h3\", \"gptr-h\", t.title));\n    root.appendChild(el(\"p\", \"gptr-intro\", SLIDE ? t.introSlide : t.introPlace));\n    var stage = el(\"div\", \"gptr-stage\");\n    var boardEl = el(\"div\", \"gptr-board\");\n    boardEl.setAttribute(\"dir\", \"ltr\");\n    stage.appendChild(boardEl);\n    var rackEl = null;\n    if (!SLIDE) {\n      rackEl = el(\"div\", \"gptr-rack\");\n      rackEl.setAttribute(\"dir\", \"ltr\");\n      rackEl.setAttribute(\"role\", \"group\");\n      rackEl.setAttribute(\"aria-label\", t.rack);\n      stage.appendChild(rackEl);\n    }\n    root.appendChild(stage);\n    var ctl = el(\"div\", \"gptr-ctl\");\n    function button(label, name) {\n      var b = el(\"button\", \"gptr-btn\", label);\n      b.type = \"button\";\n      b.setAttribute(\"data-act\", name);\n      ctl.appendChild(b);\n      return b;\n    }\n    var bRot = button(t.rotate, \"rotate\"), bFlip = button(t.flip, \"flip\"),\n        bTake = button(t.take, \"take\"), bEmpty = button(t.empty, \"empty\"), bReset = button(t.reset, \"reset\");\n    root.appendChild(ctl);\n    var sayEl = el(\"p\", \"gptr-say\", \" \");\n    sayEl.setAttribute(\"aria-live\", \"polite\");\n    var bestEl = el(\"p\", \"gptr-best\", \"\");\n    var endEl = el(\"p\", \"gptr-end\", t.end);\n    endEl.hidden = true;\n    root.appendChild(sayEl);\n    root.appendChild(bestEl);\n    root.appendChild(endEl);\n\n    \/* ---------- the board SVG: built once, only the piece layer is redrawn ---------- *\/\n    var cw = C.cavity[0], ch = C.cavity[1];\n    var offX = (cw - W) \/ 2, offY = (ch - H) \/ 2;      \/* grid centred in the cavity *\/\n    var R = C.rim * S;\n    var cx = -offX * S, cy = -offY * S;\n    var wallT = SLIDE ? C.opening.wall * S : R;\n    var vb;\n    if (SLIDE) {\n      var M = 1.5;\n      vb = [Z.left * S - M, Z.top * S - M, (Z.right - Z.left + 1) * S + 2 * M, (H - Z.top) * S + R + 2 * M];\n    } else {\n      vb = [cx - R, cy - R, cw * S + 2 * R, ch * S + 2 * R];\n    }\n    var svgEl = sv(\"svg\", { width: \"100%\", role: \"img\", \"aria-label\": t.board, \"data-s\": String(S) });\n    svgEl.setAttribute(\"viewBox\", vb.map(function (v) { return +v.toFixed(3); }).join(\" \"));\n    svgEl.style.aspectRatio = vb[2].toFixed(3) + \" \/ \" + vb[3].toFixed(3);\n    var defs = sv(\"defs\", {});\n    COL.forEach(function (c, k) {\n      var g = sv(\"linearGradient\", { id: uid + \"g\" + k, x1: \"0\", y1: \"0\", x2: \"0\", y2: \"1\" });\n      g.appendChild(sv(\"stop\", { offset: \"0\", \"stop-color\": LIGHT[k] }));\n      g.appendChild(sv(\"stop\", { offset: \"1\", \"stop-color\": c }));\n      defs.appendChild(g);\n    });\n    var soft = sv(\"filter\", { id: uid + \"soft\", x: \"-20%\", y: \"-20%\", width: \"140%\", height: \"140%\" });\n    soft.appendChild(sv(\"feGaussianBlur\", { stdDeviation: \"0.5\" }));\n    defs.appendChild(soft);\n    var grain = sv(\"filter\", { id: uid + \"grain\", x: \"0\", y: \"0\", width: \"100%\", height: \"100%\" });\n    grain.appendChild(sv(\"feTurbulence\", { type: \"fractalNoise\", baseFrequency: \"0.9\", numOctaves: \"3\", seed: \"4\" }));\n    grain.appendChild(sv(\"feColorMatrix\", { type: \"saturate\", values: \"0\" }));\n    var ct = sv(\"feComponentTransfer\", {});\n    ct.appendChild(sv(\"feFuncA\", { type: \"discrete\", tableValues: \"0 0 0 0 .5\" }));\n    grain.appendChild(ct);\n    defs.appendChild(grain);\n    svgEl.appendChild(defs);\n\n    var trayG = sv(\"g\", { \"data-layer\": \"tray\" });\n    function speckled(x, y, w, h, rx, base, op) {\n      trayG.appendChild(sv(\"rect\", { x: x, y: y, width: w, height: h, rx: rx, fill: base }));\n      trayG.appendChild(sv(\"rect\", { x: x, y: y, width: w, height: h, rx: rx, fill: \"#8A8275\",\n        \"fill-opacity\": op, filter: \"url(#\" + uid + \"grain)\" }));\n    }\n    if (SLIDE) {\n      \/* the table the pieces wait on, and the strip that leads into the gap *\/\n      var gx0 = cx + C.opening.from * S, gx1 = cx + C.opening.to * S;\n      var mat = { fill: \"#8A8275\", \"fill-opacity\": \".07\", stroke: \"rgba(80,74,64,.22)\",\n        \"stroke-width\": \".4\", \"stroke-dasharray\": \"1.6 1.4\" };\n      var m1 = { x: Z.left * S, y: Z.top * S, width: (Z.right - Z.left + 1) * S, height: (-1 - Z.top) * S, rx: \"2\" };\n      for (var mk in mat) m1[mk] = mat[mk];\n      trayG.appendChild(sv(\"rect\", m1));\n      trayG.appendChild(sv(\"rect\", { x: gx0, y: -S - 0.2, width: gx1 - gx0, height: S - wallT + 0.4,\n        fill: \"#8A8275\", \"fill-opacity\": \".07\" }));\n    }\n    speckled(cx - R, cy - wallT, cw * S + 2 * R, ch * S + R + wallT, \"3\", \"#EDEAE3\", \".5\");\n    speckled(cx, cy, cw * S, ch * S, \"1.6\", \"#F6F4EF\", \".28\");\n    trayG.appendChild(sv(\"rect\", { x: cx, y: cy, width: cw * S, height: ch * S, rx: \"1.6\", fill: \"none\",\n      stroke: \"rgba(80,74,64,.30)\", \"stroke-width\": \".5\" }));\n    if (SLIDE) {\n      \/* the gap in the wall: floor runs through it *\/\n      var g0 = cx + C.opening.from * S, g1 = cx + C.opening.to * S;\n      speckled(g0, cy - wallT - 0.01, g1 - g0, wallT + 1.2, \"0\", \"#F6F4EF\", \".28\");\n      trayG.appendChild(sv(\"path\", { d: \"M\" + g0 + \" \" + (cy - wallT) + \"V\" + cy + \"M\" + g1 + \" \" + (cy - wallT) + \"V\" + cy,\n        stroke: \"rgba(80,74,64,.30)\", \"stroke-width\": \".5\", fill: \"none\" }));\n    }\n    svgEl.appendChild(trayG);\n    var pieceG = sv(\"g\", { \"data-layer\": \"pieces\" });\n    svgEl.appendChild(pieceG);\n    boardEl.appendChild(svgEl);\n\n    function pieceNode(p, cells, opts) {\n      var k = p.i % COL.length;\n      var g = sv(\"g\", { \"data-p\": String(p.i), style: \"cursor:grab;touch-action:none\" });\n      g.setAttribute(\"data-cells\", cells.map(function (c) { return c[0] + \",\" + c[1]; }).join(\" \"));\n      if (opts.sel) g.setAttribute(\"data-sel\", \"1\");\n      var d = piecePath(cells);\n      if (opts.ghost) {\n        g.setAttribute(\"data-ghost\", \"1\");\n        g.setAttribute(\"data-bad\", opts.bad ? \"1\" : \"0\");\n        g.setAttribute(\"pointer-events\", \"none\");\n      } else {\n        g.appendChild(sv(\"path\", { d: d, fill: \"rgba(18,32,40,.22)\", transform: \"translate(0.5,0.9)\",\n          filter: \"url(#\" + uid + \"soft)\", \"pointer-events\": \"none\" }));\n      }\n      g.appendChild(sv(\"path\", { d: d, fill: \"url(#\" + uid + \"g\" + k + \")\",\n        \"fill-opacity\": opts.ghost ? \".45\" : \"1\",\n        stroke: opts.bad ? \"#C2544C\" : (opts.sel ? \"#0B7FA8\" : \"rgba(10,26,34,.42)\"),\n        \"stroke-width\": opts.sel || opts.bad ? \"1.1\" : \".45\", \"stroke-linejoin\": \"round\" }));\n      if (!opts.ghost) {\n        var cid = uid + \"c\" + (++clipSeq);\n        var clip = sv(\"clipPath\", { id: cid });\n        clip.appendChild(sv(\"path\", { d: d }));\n        g.appendChild(clip);\n        g.appendChild(sv(\"path\", { d: d, fill: \"none\", stroke: \"rgba(255,255,255,.34)\", \"stroke-width\": \".5\",\n          \"stroke-linejoin\": \"round\", transform: \"translate(0,0.45)\", \"clip-path\": \"url(#\" + cid + \")\",\n          \"pointer-events\": \"none\" }));\n      }\n      if (p.hole \u003e= 0 \u0026\u0026 cells[p.hole]) {\n        var hc = cells[p.hole];\n        g.appendChild(sv(\"circle\", { cx: (hc[1] + 0.5) * S, cy: (hc[0] + 0.5) * S, r: (p.holeR * S).toFixed(2),\n          fill: \"#E9E5DC\", \"fill-opacity\": opts.ghost ? \".5\" : \"1\", stroke: \"rgba(10,26,34,.45)\", \"stroke-width\": \".45\" }));\n      }\n      return g;\n    }\n\n    function drawPieces() {\n      clear(pieceG);\n      pieces.forEach(function (p) {\n        if (!p.at) return;\n        if (!SLIDE \u0026\u0026 drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) return;   \/* lifted: the ghost shows it *\/\n        pieceG.appendChild(pieceNode(p, cellsOf(p), { sel: sel === p }));\n      });\n      if (!SLIDE \u0026\u0026 drag \u0026\u0026 drag.live \u0026\u0026 !drag.off) {\n        pieceG.appendChild(pieceNode(drag.p, drag.cells, { ghost: true, bad: !drag.ok }));\n      }\n    }\n    var rackEm = 1.4;\n    if (rackEl) {\n      var tw = 0;\n      pieces.forEach(function (p) { tw += dims(p.base)[1]; });\n      rackEm = Math.max(0.95, Math.min(1.4, 18 \/ tw));\n    }\n    function drawRack() {\n      if (!rackEl) return;\n      clear(rackEl);\n      var any = false;\n      pieces.forEach(function (p) {\n        if (p.at) return;\n        any = true;\n        var dm = dims(p.shape);\n        var s = sv(\"svg\", { \"data-p\": String(p.i), \"data-s\": String(S), role: \"img\" });\n        s.setAttribute(\"viewBox\", \"-0.6 -0.6 \" + (dm[1] * S + 1.2) + \" \" + (dm[0] * S + 1.2));\n        s.style.width = (dm[1] * rackEm).toFixed(3) + \"em\";\n        s.style.height = (dm[0] * rackEm).toFixed(3) + \"em\";\n        if (sel === p) s.setAttribute(\"data-sel\", \"1\");\n        if (drag \u0026\u0026 drag.live \u0026\u0026 drag.p === p) s.style.opacity = \".35\";\n        s.appendChild(pieceNode(p, p.shape, { sel: sel === p }));\n        rackEl.appendChild(s);\n      });\n      if (!any) rackEl.appendChild(el(\"span\", \"gptr-none\", \" \"));\n    }\n    function turnTarget() {\n      if (sel) return (SLIDE \u0026\u0026 !isOut(sel)) ? null : sel;\n      for (var i = 0; i \u003c pieces.length; i++) {\n        if (SLIDE ? isOut(pieces[i]) : !pieces[i].at) return pieces[i];\n      }\n      return null;\n    }\n    function render() {\n      drawPieces();\n      drawRack();\n      var tt = turnTarget(), had = document.activeElement;\n      bRot.disabled = bFlip.disabled = !tt;\n      bTake.disabled = !(sel \u0026\u0026 engaged(sel));\n      bEmpty.disabled = !pieces.some(engaged);\n      \/* a button that just went disabled drops focus to the page, and the\n         arrow keys with it: keep them working on the board *\/\n      if (had \u0026\u0026 had.parentNode === ctl \u0026\u0026 had.disabled) focusRoot();\n      sayEl.textContent = msg || \" \";\n      bestEl.textContent = fmt(t.best, { n: best, m: pieces.length });\n      endEl.hidden = !endOn;\n    }\n\n    \/* ---------- input ---------- *\/\n    function focusRoot() { try { root.focus({ preventScroll: true }); } catch (e) { \/* old browsers *\/ } }\n    function boardCell(ev) {\n      var q = toView(svgEl, ev.clientX, ev.clientY);\n      var r = Math.floor(q.y \/ S), c = Math.floor(q.x \/ S);\n      if (!SLIDE \u0026\u0026 q.x \u003e= cx \u0026\u0026 q.x \u003c= cx + cw * S \u0026\u0026 q.y \u003e= cy \u0026\u0026 q.y \u003c= cy + ch * S) {\n        \/* inside the cavity but in its slack around the grid: snap to the edge squares *\/\n        r = Math.max(0, Math.min(H - 1, r));\n        c = Math.max(0, Math.min(W - 1, c));\n      }\n      return [r, c];\n    }\n    function overBoard(ev) {\n      var b = svgEl.getBoundingClientRect();\n      return ev.clientX \u003e= b.left \u0026\u0026 ev.clientX \u003c= b.right \u0026\u0026 ev.clientY \u003e= b.top \u0026\u0026 ev.clientY \u003c= b.bottom;\n    }\n    function startDrag(p, ev, fromRack, grab, fallTap, downCell) {\n      if (ev.cancelable) ev.preventDefault();\n      try { (fromRack ? rackEl : svgEl).setPointerCapture(ev.pointerId); } catch (e) { \/* synthetic pointer *\/ }\n      drag = { p: p, fromRack: fromRack, grab: grab, sx: ev.clientX, sy: ev.clientY, pid: ev.pointerId,\n        live: false, off: true, ok: false, at: null, cells: null, fallTap: fallTap, downCell: downCell };\n      window.addEventListener(\"pointermove\", onMove);\n      window.addEventListener(\"pointerup\", onUp);\n      window.addEventListener(\"pointercancel\", onCancel);\n    }\n    function endListen() {\n      window.removeEventListener(\"pointermove\", onMove);\n      window.removeEventListener(\"pointerup\", onUp);\n      window.removeEventListener(\"pointercancel\", onCancel);\n    }\n    function onMove(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      if (!drag.live) {\n        if (Math.abs(ev.clientX - drag.sx) + Math.abs(ev.clientY - drag.sy) \u003c 6) return;\n        drag.live = true;\n        if (drag.fromRack) drawRack();\n      }\n      var cell = boardCell(ev);\n      if (SLIDE) {\n        if (toward(drag.p, cell, drag.grab)) msg = \"\";\n        drawPieces();\n        return;\n      }\n      if (!overBoard(ev)) { drag.off = true; drag.cells = null; drawPieces(); return; }\n      drag.off = false;\n      drag.at = [cell[0] - drag.grab[0], cell[1] - drag.grab[1]];\n      drag.cells = shift(drag.p.shape, drag.at);\n      drag.ok = legal(drag.p, drag.p.shape, drag.at);\n      drawPieces();\n    }\n    function onUp(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      var d = drag;\n      drag = null;\n      act();\n      if (!d.live) {                                  \/* a tap, not a drag *\/\n        if (d.fallTap) { boardTap(d.downCell); return; }\n        d.p.grab = d.grab;\n        sel = (sel === d.p) ? null : d.p;\n        msg = \"\";\n        settle();\n        return;\n      }\n      if (SLIDE) { sel = d.p; d.p.grab = d.grab; settle(); return; }\n      if (d.off) {\n        if (d.p.at) d.p.at = null;                    \/* dragged off the board: back with the pieces *\/\n        msg = \"\";\n      } else if (d.ok) {\n        d.p.at = d.at;\n        sel = null;\n        msg = \"\";\n      } else {\n        msg = t.nofit;\n      }\n      settle();\n    }\n    function onCancel(ev) {\n      if (!drag || ev.pointerId !== drag.pid) return;\n      endListen();\n      drag = null;\n      settle();\n    }\n    function boardTap(cell) {\n      if (!sel) { render(); return; }\n      if (SLIDE) {\n        msg = toward(sel, cell, sel.grab) ? \"\" : t.blocked;\n      } else if (placeNear(sel, cell)) {\n        sel = null;\n        msg = \"\";\n      } else {\n        msg = t.nofit;\n      }\n      settle();\n    }\n\n    svgEl.addEventListener(\"pointerdown\", function (ev) {\n      if (ev.button \u003e 0) return;\n      act();\n      focusRoot();\n      var hit = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      var cell = boardCell(ev);\n      if (hit \u0026\u0026 !hit.getAttribute(\"data-ghost\")) {\n        var p = pieces[+hit.getAttribute(\"data-p\")];\n        var grab = nearestCell(p.shape, [cell[0] - p.at[0], cell[1] - p.at[1]]);\n        \/* a piece in hand from the rack wants to be placed: a tap on a piece in\n           the tray is an attempt to put it there *\/\n        var fall = !SLIDE \u0026\u0026 !!sel \u0026\u0026 !sel.at \u0026\u0026 sel !== p;\n        startDrag(p, ev, false, grab, fall, cell);\n        return;\n      }\n      tap = { x: ev.clientX, y: ev.clientY, pid: ev.pointerId, cell: cell };\n    });\n    svgEl.addEventListener(\"pointerup\", function (ev) {\n      if (!tap || ev.pointerId !== tap.pid) return;\n      var t0 = tap;\n      tap = null;\n      if (Math.abs(ev.clientX - t0.x) + Math.abs(ev.clientY - t0.y) \u003e 10) return;\n      act();\n      boardTap(t0.cell);\n    });\n    svgEl.addEventListener(\"pointercancel\", function () { tap = null; });\n    \/* a finger that lands on a piece drags it; anywhere else the page still scrolls *\/\n    svgEl.addEventListener(\"touchstart\", function (ev) {\n      var h = ev.target.closest ? ev.target.closest(\"[data-p]\") : null;\n      if (h \u0026\u0026 ev.cancelable) ev.preventDefault();\n    }, { passive: false });\n\n    if (rackEl) {\n      rackEl.addEventListener(\"pointerdown\", function (ev) {\n        if (ev.button \u003e 0) return;\n        var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n        if (!s) return;\n        act();\n        focusRoot();\n        var p = pieces[+s.getAttribute(\"data-p\")];\n        var q = toView(s, ev.clientX, ev.clientY);\n        startDrag(p, ev, true, nearestCell(p.shape, [Math.floor(q.y \/ S), Math.floor(q.x \/ S)]), false, null);\n      });\n      rackEl.addEventListener(\"touchstart\", function (ev) {\n        var s = ev.target.closest ? ev.target.closest(\"svg[data-p]\") : null;\n        if (s \u0026\u0026 ev.cancelable) ev.preventDefault();\n      }, { passive: false });\n    }\n\n    root.addEventListener(\"keydown\", function (e) {\n      var d = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] }[e.key];\n      if (!d || !sel || !sel.at) return;\n      e.preventDefault();\n      act();\n      if (SLIDE) {\n        msg = step(sel, d[0], d[1]) ? \"\" : t.blocked;\n      } else {\n        var at = [sel.at[0] + d[0], sel.at[1] + d[1]];\n        if (legal(sel, sel.shape, at)) { sel.at = at; msg = \"\"; } else msg = t.nofit;\n      }\n      settle();\n    });\n\n    function turnBtn(fn) {\n      return function () {\n        act();\n        var p = turnTarget();\n        if (!p) { render(); return; }\n        if (turn(p, fn)) { sel = p; msg = \"\"; } else msg = t.noturn;\n        settle();\n      };\n    }\n    bRot.addEventListener(\"click\", turnBtn(rot));\n    bFlip.addEventListener(\"click\", turnBtn(flp));\n    bTake.addEventListener(\"click\", function () {\n      act();\n      if (!sel || !engaged(sel)) { render(); return; }\n      if (SLIDE) sendHome(sel); else sel.at = null;\n      msg = \"\";\n      settle();\n    });\n    bEmpty.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) {\n        if (!engaged(p)) return;\n        if (SLIDE) sendHome(p); else p.at = null;\n      });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n    bReset.addEventListener(\"click\", function () {\n      act();\n      pieces.forEach(function (p) { p.shape = copy(p.base); p.at = home(p); p.grab = [p.base[0][0], p.base[0][1]]; });\n      sel = null;\n      msg = \"\";\n      settle();\n    });\n\n    settle();\n  }\n\n  window.GPTR = { mount: mount, v: 1 };\n})();\n(function(){var C={\"v\":1,\"mode\":\"slide\",\"grid\":[4,4],\"rim\":0.473,\"pieces\":[{\"cells\":[[0,0],[0,1],[1,1],[1,2]]},{\"cells\":[[0,0],[0,1],[1,1],[1,2]]},{\"cells\":[[0,0],[0,1],[1,1],[1,2]]}],\"opening\":{\"cols\":[1,2],\"from\":1.0,\"to\":3.013,\"wall\":0.473},\"zone\":{\"top\":-5,\"left\":-2,\"right\":5},\"start\":[[-3,-2],[-3,3],[-5,-2]],\"cavity\":[4.0133,4.0337]};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gptr \")\u003c0)r=document.querySelector(\".gptr:not([data-gptr-on])\");if(r\u0026\u0026window.GPTR)window.GPTR.mount(r,C);})();\n\u003c\/script\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51325797531815,"sku":"GP-SLIDTRIV","price":13.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/slidely_trivial_marble.png?v=1789059508"},{"product_id":"multi-grain-burr","title":"Multi-Grain Burr | 4-Piece Geometric Puzzle","description":"\u003ch2\u003eMulti-Grain Burr - Quick Summary\u003c\/h2\u003e\n\u003cp\u003eThe Multi-Grain Burr is a four-piece geometric assembly puzzle designed by \u003ca href=\"\/collections\/stewart-coffin\"\u003eStewart Coffin\u003c\/a\u003e. Four pieces come together into a very peculiar shape. Despite the name it is not a burr - there are no notched sticks and nothing interlocks. The difficulty is purely geometric: working out how four solids occupy one space. The next level of the \u003ca href=\"https:\/\/gregpuzzles.com\/products\/three-piece-block-puzzle\"\u003eThree Piece Block puzzle.\u003c\/a\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e People with highly developed spatial perception.\u003c\/p\u003e\n\u003ch2\u003eAbout the Designer\u003c\/h2\u003e\n\u003cp\u003eStewart Coffin is one of the most respected names in mechanical puzzle design. His work is known for geometric elegance rather than brute complexity - puzzles that look like they should come apart easily and then decline to.\u003c\/p\u003e\n\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\n\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eHow hard is the Multi-Grain Burr?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eHard. Most solvers spend one to four hours on it. If you have solved a standard six-piece burr, expect this one to take longer despite having fewer pieces - and expect the burr method to be no help, because this is a different kind of problem.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs the Multi-Grain Burr actually a burr?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. The name comes from the design, not the mechanism. A burr is built from notched sticks that interlock along three axes. This is four solid pieces assembling into a geometric shape, which is why the usual burr techniques do not apply.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed the Multi-Grain Burr?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eStewart Coffin, a designer whose mechanical puzzles are widely collected for their geometric precision.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51347709427879,"sku":"GP-MULTGRAI","price":19.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/multi-grain_burr_marble.png?v=1789665707"},{"product_id":"extreme-torture","title":"Extreme Torture | 69-Move Board Burr","description":"\u003cp\u003eTo be frank, I highly doubt anyone will ever solve our version of this puzzle without outside help.\u003c\/p\u003e\n\u003cp\u003eThat is not a sales line. The version most people have met came assembled in a box with a solution booklet. Ours arrives as six loose boards and nothing else.\u003c\/p\u003e\n\u003ch2\u003eExtreme Torture - Quick Summary\u003c\/h2\u003e\n\u003cp\u003eExtreme Torture is a six-piece separated board burr designed by Frans de Vreugd in 2002. It takes 69 moves to take apart - burr level 28-21-9-8-3 - the hardest form found in de Vreugd's research. Expert difficulty, 4+ hour solve time. Ships disassembled. It is the same design ThinkFun later mass-produced as Gordian's Knot.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who have finished the hard puzzles in their collection and want something that will genuinely beat them for a while, and collectors who measure a puzzle by how long it held out.\u003c\/p\u003e\n\u003ch2\u003e69 Moves\u003c\/h2\u003e\n\u003cp\u003eDe Vreugd did not design this by hand. He fed separated board burrs into \u003cstrong\u003eBurrgrower\u003c\/strong\u003e, a program written to raise the level of a puzzle - first drafted by Dic Sonneveld and rewritten in C++ by \u003ca href=\"\/collections\/goh-pit-khiam\"\u003eGoh Pit-Khiam\u003c\/a\u003e, whose own packing puzzles we carry. Extreme Torture is what came back.\u003c\/p\u003e\u003cp\u003eThe level notation reads 28-21-9-8-3: twenty-eight moves just to free the first board, then twenty-one more for the second, then nine, then eight, then three.\u003c\/p\u003e\n\u003cp\u003eNothing about it yields early. You can make twenty correct moves and have nothing visible to show for it.\u003c\/p\u003e\u003ch2\u003eThe Scale of the Search\u003c\/h2\u003e\u003cp\u003eDe Vreugd published the numbers himself. He narrowed the design space to \u003cstrong\u003eeleven\u003c\/strong\u003e usable board shapes, which give \u003cstrong\u003e8,008\u003c\/strong\u003e possible six-piece sets. Those sets can be fitted together in \u003cstrong\u003e1,364,932\u003c\/strong\u003e ways.\u003c\/p\u003e\u003cp\u003eOnly \u003cstrong\u003e2,394\u003c\/strong\u003e of those can be taken apart again - \u003cstrong\u003e0.18%\u003c\/strong\u003e.\u003c\/p\u003e\u003cp\u003eThat is the context this puzzle sits in. Almost everything that looks like a solved board burr is a dead end, and Extreme Torture is the hardest thing that survived the search.\u003c\/p\u003e\n\u003ch2\u003eWhere the Design Came From\u003c\/h2\u003e\n\u003cp\u003eIt started with a suggestion. Jim Gooch told de Vreugd that you could take a standard six board burr and pull the two boards in each pair one unit apart. De Vreugd wrote a search to find piece sets that would still assemble. \u003ca href=\"\/products\/zigzag\"\u003eZigZag\u003c\/a\u003e came out first, then \u003ca href=\"\/products\/torture\"\u003eTorture\u003c\/a\u003e at level 17.4, and then he made one last push with the software. Extreme Torture is the end of that road.\u003c\/p\u003e\n\u003ch2\u003eSold for Years as Gordian's Knot\u003c\/h2\u003e\n\u003cp\u003eThis design went into commercial production in 2002 under the name Gordian's Knot, made by ThinkFun, now part of Ravensburger. That is where most people ran into it, on a toy shop shelf rather than in a puzzle collection. It has since been discontinued.\u003c\/p\u003e\n\u003cp\u003eGreg Puzzles is not affiliated with ThinkFun or Ravensburger. We list the design under the name Frans de Vreugd gave it, and ours comes out of the box in pieces.\u003c\/p\u003e\n\u003ch2\u003eIt Arrives in Pieces\u003c\/h2\u003e\n\u003cp\u003eThis puzzle ships disassembled, and that is deliberate. Assembly is the challenge, and handing it to you already solved would remove the entire point. It also means you are working those 69 moves in reverse, with no solved reference state to copy and no photograph to work backwards from. You get six boards and the knowledge that they fit.\u003c\/p\u003e\n\u003cp\u003eExpect to put it down and come back to it. Most people do.\u003c\/p\u003e\n\u003cp\u003eIf you would rather work up to this one, all three are sold together as the \u003ca href=\"\/products\/separated-board-burr-set\"\u003eSeparated Board Burr Set\u003c\/a\u003e.\u003c\/p\u003e\n\u003ch2\u003eHow Many Solutions Does Extreme Torture Have?\u003c\/h2\u003e\n\u003cp\u003eSix. Ivan (Puzzle Guy) ran our boards through BurrTools, and the six pieces fit together in six different ways that still come apart. Only one of them is the 69-move puzzle.\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003e17 moves (4-6-3-3), two different assemblies\u003c\/li\u003e\n\u003cli\u003e18 moves (6-5-1-3-3)\u003c\/li\u003e\n\u003cli\u003e21 moves (6-6-3-3-3)\u003c\/li\u003e\n\u003cli\u003e32 moves (14-12-1-2-3)\u003c\/li\u003e\n\u003cli\u003e\u003cstrong\u003e69 moves (28-21-9-8-3), the Extreme Torture\u003c\/strong\u003e\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eBecause the boards ship loose, you can build one of the easier five first. Count the moves. If your assembly took less than 69, you still haven't found the ultimate solution.\u003c\/p\u003e\n\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\n\u003ch3\u003eHow many moves does Extreme Torture take?\u003c\/h3\u003e\n\u003cp\u003e69 moves to disassemble. The burr level is 28-21-9-8-3 - the first board alone takes 28 moves to free.\u003c\/p\u003e\n\u003ch3\u003eDoes Extreme Torture arrive assembled?\u003c\/h3\u003e\n\u003cp\u003eNo. It ships disassembled, as six separate boards. Assembling it is the puzzle - a solved puzzle in the box would be no puzzle at all.\u003c\/p\u003e\n\u003ch3\u003eHow hard is Extreme Torture?\u003c\/h3\u003e\n\u003cp\u003eExpert, and at the top of that band. Plan on four hours or more spread across more than one sitting, and do not treat it as a reasonable first attempt at interlocking designs. It is the hardest form found in de Vreugd's research.\u003c\/p\u003e\n\u003ch3\u003eIs Extreme Torture the same as Gordian's Knot?\u003c\/h3\u003e\n\u003cp\u003eIt is the same design. Frans de Vreugd named it Extreme Torture in 2002, and it went into commercial production that year as Gordian's Knot, which has since been discontinued. We use the designer's original name.\u003c\/p\u003e\n\u003ch3\u003eWho designed Extreme Torture?\u003c\/h3\u003e\n\u003cp\u003eFrans de Vreugd, a Dutch puzzle designer, in 2002, working from Jim Gooch's separated board burr idea and using Burrgrower, the level-raising software written by Dic Sonneveld and \u003ca href=\"\/collections\/goh-pit-khiam\"\u003eGoh Pit-Khiam\u003c\/a\u003e.\u003c\/p\u003e\n\u003ch3\u003eHow many solutions does Extreme Torture have?\u003c\/h3\u003e\n\u003cp\u003eSix assemblies come apart: two take 17 moves, the others 18, 21, 32 and 69. Only the 69-move assembly, level 28-21-9-8-3, is the full Extreme Torture.\u003c\/p\u003e\n\u003cdiv class=\"gpbr\" data-handle=\"extreme-torture\"\u003e\n\u003cstyle\u003e\n.gpbr{--gpbr-fg:rgb(var(--color-foreground,18,18,18));\n --gpbr-line:rgba(var(--color-foreground,18,18,18),.18);\n --gpbr-muted:rgba(var(--color-foreground,18,18,18),.72);\n --gpbr-accent:#02A9F7;\n font-family:inherit;color:var(--gpbr-fg);margin:1.2em 0;max-width:32em}\n.gpbr *{box-sizing:border-box}\n.gpbr .gpbr-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;text-transform:none;margin:0 0 .3em;color:var(--gpbr-fg)}\n.gpbr .gpbr-goal{font-size:1em;line-height:1.4;font-weight:600;margin:0 0 .2em;color:var(--gpbr-fg)}\n.gpbr .gpbr-rule{font-size:.86em;line-height:1.45;margin:0 0 .75em;color:var(--gpbr-muted);max-width:36em}\n.gpbr .gpbr-stage{display:flex;flex-direction:column;gap:.5em;direction:ltr}\n.gpbr .gpbr-view{position:relative;width:100%;border-radius:8px;overflow:hidden;\n background:radial-gradient(ellipse at 50% 42%,#FFFFFF 0%,#F3F2EE 70%,#ECEAE4 100%);border:1px solid var(--gpbr-line)}\n.gpbr canvas.gpbr-cv{display:block;width:100%;height:auto;aspect-ratio:1\/0.8;touch-action:pan-y;cursor:grab;\n -webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none}\n.gpbr canvas.gpbr-cv:active{cursor:grabbing}\n.gpbr[data-play=\"1\"] canvas.gpbr-cv{touch-action:none}\n.gpbr .gpbr-veil{position:absolute;left:0;right:0;bottom:.8em;display:flex;justify-content:center;pointer-events:none;\n opacity:1;transition:opacity .25s}\n.gpbr[data-play=\"1\"] .gpbr-veil{opacity:0}\n.gpbr .gpbr-veil-t{font-size:.85em;line-height:1.2;font-weight:600;color:var(--gpbr-fg);padding:.5em 1em;border-radius:999px;\n background:rgba(255,255,255,.88);border:1px solid var(--gpbr-line);box-shadow:0 1px 3px rgba(0,0,0,.08)}\n.gpbr .gpbr-tray{display:flex;flex-wrap:wrap;align-items:center;gap:.4em;min-height:3.6em;padding:.35em .5em;\n border-radius:8px;border:1px dashed var(--gpbr-line)}\n.gpbr .gpbr-tray-h{font-size:.75em;line-height:1;color:var(--gpbr-muted);margin-inline-end:.3em}\n.gpbr button.gpbr-slot{position:relative;appearance:none;-webkit-appearance:none;margin:0;padding:0;width:3.4em;height:3.4em;\n border:1px solid var(--gpbr-line);border-radius:7px;background:#FAFAF8;cursor:pointer;box-shadow:none;\n -webkit-tap-highlight-color:transparent}\n.gpbr button.gpbr-slot[hidden]{display:none}\n.gpbr button.gpbr-slot:hover{border-color:var(--gpbr-accent)}\n.gpbr button.gpbr-slot:disabled{opacity:.5;cursor:default}\n.gpbr canvas.gpbr-thumb{display:block;width:100%;height:100%;pointer-events:none}\n.gpbr .gpbr-num{position:absolute;top:.15em;left:.3em;font-size:.68em;line-height:1;font-weight:600;color:var(--gpbr-muted);pointer-events:none}\n.gpbr .gpbr-ctl{display:flex;flex-wrap:wrap;align-items:center;gap:.6em 1em;margin-top:.6em;direction:ltr}\n.gpbr .gpbr-pad{position:relative;width:9.6em;height:9.6em;flex:none;border-radius:50%;background:rgba(var(--color-foreground,18,18,18),.035)}\n.gpbr button.gpbr-mv{position:absolute;appearance:none;-webkit-appearance:none;margin:0;padding:.45em;width:2.9em;height:2.9em;\n border:2px solid;border-radius:50%;background:#fff;cursor:pointer;box-shadow:0 1px 2px rgba(0,0,0,.12);\n -webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:left .12s,top .12s}\n.gpbr button.gpbr-mv svg{display:block;pointer-events:none}\n.gpbr button.gpbr-mv[aria-disabled=\"true\"]{opacity:.55}\n.gpbr button.gpbr-mv:disabled{opacity:.3;cursor:default}\n.gpbr .gpbr-side{display:flex;flex-wrap:wrap;gap:.45em;flex:1 1 9em;align-content:center}\n.gpbr .gpbr-side button,.gpbr .gpbr-bar button,.gpbr button.gpbr-tog{appearance:none;-webkit-appearance:none;margin:0;border:1px solid var(--gpbr-line);\n background:transparent;color:var(--gpbr-fg);font-family:inherit;font-size:.85em;line-height:1.2;\n letter-spacing:normal;text-transform:none;min-height:2.9em;padding:.6em .9em;border-radius:6px;\n cursor:pointer;box-shadow:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}\n.gpbr .gpbr-side button{flex:1 1 4.2em;padding:.6em .4em;white-space:nowrap}\n.gpbr .gpbr-side button:hover,.gpbr .gpbr-bar button:hover,.gpbr button.gpbr-tog:hover{border-color:var(--gpbr-accent)}\n.gpbr .gpbr-side button:disabled,.gpbr .gpbr-bar button:disabled{opacity:.38;cursor:default}\n.gpbr .gpbr-side button:disabled:hover,.gpbr .gpbr-bar button:disabled:hover{border-color:var(--gpbr-line)}\n.gpbr .gpbr-sayrow{display:flex;flex-wrap:wrap;align-items:center;gap:.4em .8em;margin:.6em 0 0;min-height:1.45em}\n.gpbr .gpbr-say{flex:1 1 14em;font-size:.88em;line-height:1.45;color:var(--gpbr-muted);min-height:1.45em;margin:0}\n.gpbr button.gpbr-tog{border-color:var(--gpbr-accent);font-weight:600}\n.gpbr button.gpbr-tog[hidden]{display:none}\n.gpbr .gpbr-win{font-size:.98em;line-height:1.45;font-weight:600;color:var(--gpbr-fg);margin:.5em 0 0;\n padding:.55em .8em;border-radius:6px;background:#E8F7FD;border-inline-start:3px solid var(--gpbr-accent)}\n.gpbr .gpbr-win[hidden]{display:none}\n.gpbr .gpbr-bar{display:flex;flex-wrap:wrap;align-items:center;gap:.45em;margin-top:.75em}\n.gpbr .gpbr-stat{display:flex;flex-direction:column;gap:.1em;margin-inline-end:auto}\n.gpbr .gpbr-count{font-size:.95em;line-height:1.2;font-weight:600;font-variant-numeric:tabular-nums;color:var(--gpbr-fg)}\n.gpbr .gpbr-free{font-size:.8em;line-height:1.25;font-weight:400;color:var(--gpbr-muted)}\n.gpbr .gpbr-lock{display:flex;flex-wrap:wrap;align-items:center;gap:.6em .9em;margin-top:.75em;\n padding:.8em .9em;border-radius:7px;background:#E8F7FD;border:1px solid rgba(2,169,247,.35)}\n.gpbr .gpbr-lock[hidden]{display:none}\n.gpbr .gpbr-lock-line{flex:1 1 12em;margin:0;font-size:.95em;line-height:1.4;font-weight:600;color:var(--gpbr-fg)}\n.gpbr a.gpbr-buy,.gpbr a.gpbr-buy:visited{display:inline-block;flex:none;padding:.7em 1.2em;border-radius:6px;\n background:var(--gpbr-accent);color:#121212;font-family:inherit;font-size:.92em;line-height:1.2;font-weight:600;\n letter-spacing:normal;text-decoration:none;text-transform:none;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.gpbr a.gpbr-buy:hover{background:#2BB8F8;color:#121212;text-decoration:none}\n.gpbr .gpbr-credit{font-size:.72em;line-height:1.4;color:var(--gpbr-muted);margin:.9em 0 0;opacity:.85}\n@media (min-width:600px){\n .gpbr .gpbr-stage{flex-direction:row;align-items:stretch}\n .gpbr .gpbr-view{flex:1 1 auto;min-width:0}\n .gpbr .gpbr-tray{flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;width:4.6em;flex:none;padding:.5em .4em}\n .gpbr .gpbr-tray-h{margin:0 0 .2em}\n}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n(function () {\n\"use strict\";\nif (window.GPBR_ENGINE) return;\nvar DIRS = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]];\nvar FAR = 6;\nfunction det(m) {\nreturn m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -\nm[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) +\nm[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);\n}\nvar ROTS = [];\n(function () {\nvar perms = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]];\nfor (var p = 0; p \u003c 6; p++) {\nfor (var s = 0; s \u003c 8; s++) {\nvar m = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\nfor (var r = 0; r \u003c 3; r++) m[r][perms[p][r]] = (s \u003e\u003e r \u0026 1) ? -1 : 1;\nif (det(m) === 1) ROTS.push(m);\n}\n}\n})();\nfunction mmul(a, b) {\nvar o = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\nfor (var r = 0; r \u003c 3; r++) for (var c = 0; c \u003c 3; c++)\nfor (var k = 0; k \u003c 3; k++) o[r][c] += a[r][k] * b[k][c];\nreturn o;\n}\nfunction rotIndex(m) {\nfor (var i = 0; i \u003c ROTS.length; i++) {\nvar R = ROTS[i], same = true;\nfor (var r = 0; r \u003c 3 \u0026\u0026 same; r++) for (var c = 0; c \u003c 3; c++) if (R[r][c] !== m[r][c]) { same = false; break; }\nif (same) return i;\n}\nreturn -1;\n}\nvar MUL = ROTS.map(function (a) { return ROTS.map(function (b) { return rotIndex(mmul(a, b)); }); });\nvar QT = [rotIndex([[1, 0, 0], [0, 0, -1], [0, 1, 0]]),\nrotIndex([[0, 0, 1], [0, 1, 0], [-1, 0, 0]]),\nrotIndex([[0, -1, 0], [1, 0, 0], [0, 0, 1]])];\nvar ID = rotIndex([[1, 0, 0], [0, 1, 0], [0, 0, 1]]);\nfunction dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; }\nfunction key(x, y, z) { return ((x + 512) * 1024 + (y + 512)) * 1024 + (z + 512); }\nfunction axisOf(d) { return d[0] ? 0 : d[1] ? 1 : 2; }\nfunction signOf(d) { return d[0] + d[1] + d[2]; }\nfunction gaps(a, b) {\nvar g = [];\nfor (var k = 0; k \u003c 3; k++) g.push(Math.max(a.lo[k] - b.hi[k] - 1, b.lo[k] - a.hi[k] - 1));\nreturn g;\n}\nfunction Game(C) {\nthis.C = C;\nthis.n = C.pieces.length;\nthis.shapes = {};\nthis.reset();\n}\nvar G = Game.prototype;\nG.reset = function () {\nthis.P = [];\nfor (var i = 0; i \u003c this.n; i++) this.P.push({ on: false, r: ID, p: [0, 0, 0] });\nthis.moves = 0;\nthis.hist = [];\n};\nG.snap = function () {\nreturn { P: this.P.map(function (q) { return { on: q.on, r: q.r, p: q.p.slice() }; }), moves: this.moves };\n};\nG.save = function () { this.hist.push(this.snap()); };\nG.canUndo = function () { return this.hist.length \u003e 0; };\nG.undo = function () {\nvar s = this.hist.pop();\nif (!s) return false;\nthis.P = s.P;\nreturn true;\n};\nG.shape = function (i, r) {\nvar k = i + \"\/\" + r, sh = this.shapes[k];\nif (sh) return sh;\nvar R = ROTS[r], cs = this.C.pieces[i], out = [], lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9];\nfor (var j = 0; j \u003c cs.length; j++) {\nvar c = cs[j], v = [0, 0, 0];\nfor (var a = 0; a \u003c 3; a++) {\nv[a] = R[a][0] * c[0] + R[a][1] * c[1] + R[a][2] * c[2];\nif (v[a] \u003c lo[a]) lo[a] = v[a];\nif (v[a] \u003e hi[a]) hi[a] = v[a];\n}\nout.push(v);\n}\nfor (j = 0; j \u003c out.length; j++) for (a = 0; a \u003c 3; a++) out[j][a] -= lo[a];\nsh = { c: out, s: [hi[0] - lo[0] + 1, hi[1] - lo[1] + 1, hi[2] - lo[2] + 1] };\nthis.shapes[k] = sh;\nreturn sh;\n};\nG.cells = function (i) {\nvar q = this.P[i], sh = this.shape(i, q.r);\nreturn sh.c.map(function (c) { return [c[0] + q.p[0], c[1] + q.p[1], c[2] + q.p[2]]; });\n};\nG.box = function (i) {\nvar q = this.P[i], s = this.shape(i, q.r).s;\nreturn { lo: q.p.slice(), hi: [q.p[0] + s[0] - 1, q.p[1] + s[1] - 1, q.p[2] + s[2] - 1] };\n};\nG.boxOf = function (list) {\nvar lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9];\nfor (var j = 0; j \u003c list.length; j++) {\nvar b = this.box(list[j]);\nfor (var a = 0; a \u003c 3; a++) {\nif (b.lo[a] \u003c lo[a]) lo[a] = b.lo[a];\nif (b.hi[a] \u003e hi[a]) hi[a] = b.hi[a];\n}\n}\nreturn { lo: lo, hi: hi };\n};\nG.inPlay = function () {\nvar o = [];\nfor (var i = 0; i \u003c this.n; i++) if (this.P[i].on) o.push(i);\nreturn o;\n};\nG.occ = function (skip) {\nvar m = {};\nfor (var i = 0; i \u003c this.n; i++) {\nif (!this.P[i].on || (skip \u0026\u0026 skip[i])) continue;\nvar cs = this.cells(i);\nfor (var j = 0; j \u003c cs.length; j++) m[key(cs[j][0], cs[j][1], cs[j][2])] = i;\n}\nreturn m;\n};\nG.blockers = function (group, d) {\nvar inG = {}, j;\nfor (j = 0; j \u003c group.length; j++) inG[group[j]] = 1;\nvar occ = this.occ(inG), hit = {}, out = [];\nfor (j = 0; j \u003c group.length; j++) {\nvar cs = this.cells(group[j]);\nfor (var k = 0; k \u003c cs.length; k++) {\nvar o = occ[key(cs[k][0] + d[0], cs[k][1] + d[1], cs[k][2] + d[2])];\nif (o !== undefined \u0026\u0026 !hit[o]) { hit[o] = 1; out.push(o); }\n}\n}\nreturn out.sort(function (a, b) { return a - b; });\n};\nG.closure = function (i, d) {\nvar g = [i];\nfor (;;) {\nvar b = this.blockers(g, d);\nif (!b.length) return g.sort(function (a, c) { return a - c; });\ng = g.concat(b);\n}\n};\nG.clearWay = function (i, mine) {\nvar on = this.inPlay(), others = [], k, j;\nmine = mine || this.cells(i);\nfor (k = 0; k \u003c on.length; k++) if (on[k] !== i) {\nvar cs = this.cells(on[k]);\nfor (j = 0; j \u003c cs.length; j++) others.push(cs[j]);\n}\nif (!others.length) return 1;\nfor (var di = 0; di \u003c 6; di++) {\nvar d = DIRS[di], a = axisOf(d), s = signOf(d), free = true;\nfor (j = 0; j \u003c mine.length \u0026\u0026 free; j++) {\nvar c = mine[j];\nfor (k = 0; k \u003c others.length; k++) {\nvar o = others[k], same = true;\nfor (var b = 0; b \u003c 3; b++) if (b !== a \u0026\u0026 o[b] !== c[b]) { same = false; break; }\nif (same \u0026\u0026 (o[a] - c[a]) * s \u003e 0) { free = false; break; }\n}\n}\nif (free) return di + 1;\n}\nreturn 0;\n};\nG.hits = function (i, cells) {\nvar occ = this.occ(null);\nfor (var j = 0; j \u003c cells.length; j++) {\nvar o = occ[key(cells[j][0], cells[j][1], cells[j][2])];\nif (o !== undefined \u0026\u0026 o !== i) return true;\n}\nreturn false;\n};\nG.place = function (i, r, p) {\nreturn this.shape(i, r).c.map(function (c) { return [c[0] + p[0], c[1] + p[1], c[2] + p[2]]; });\n};\nG.spawn = function (i, side) {\nvar q = this.P[i];\nif (q.on) return { ok: false, why: \"on\" };\nvar sh = this.shape(i, q.r), on = this.inPlay(), p = [0, 0, 0];\nif (!on.length) {\nfor (var a = 0; a \u003c 3; a++) p[a] = -Math.floor(sh.s[a] \/ 2);\n} else {\nvar O = this.boxOf(on), d = DIRS[side], ax = axisOf(d);\nfor (a = 0; a \u003c 3; a++) {\nif (a === ax) continue;\np[a] = Math.floor((O.lo[a] + O.hi[a] + 1 - sh.s[a]) \/ 2);\n}\np[ax] = signOf(d) \u003e 0 ? O.hi[ax] + 2 : O.lo[ax] - 1 - sh.s[ax];\n}\nreturn this.spawnAt(i, q.r, p);\n};\nG.spawnAt = function (i, r, p) {\nvar q = this.P[i];\nif (q.on || r \u003c 0 || r \u003e= 24) return { ok: false, why: \"on\" };\nvar cells = this.place(i, r, p);\nif (this.hits(i, cells) || !this.clearWay(i, cells)) return { ok: false, why: \"inside\" };\nthis.save();\nthis.P[i] = { on: true, r: r, p: p.slice() };\nreturn { ok: true, i: i };\n};\nG.slide = function (i, di) {\nvar q = this.P[i], d = DIRS[di];\nif (!q || !q.on) return { ok: false, why: \"pick\" };\nvar on = this.inPlay();\nif (on.length \u003c 2) return { ok: false, why: \"alone\" };\nvar by = this.blockers([i], d);\nif (by.length) {\nvar g = this.closure(i, d);\nreturn { ok: false, why: \"blocked\", by: by, group: g.length \u003c on.length ? g : null };\n}\nvar others = on.filter(function (j) { return j !== i; });\nvar O = this.boxOf(others), before = gaps(this.box(i), O);\nthis.save();\nq.p = [q.p[0] + d[0], q.p[1] + d[1], q.p[2] + d[2]];\nthis.moves++;\nvar after = gaps(this.box(i), O), ax = axisOf(d), res = { ok: true, moved: [i], d: di };\nif (after[ax] \u003e FAR \u0026\u0026 after[ax] \u003e before[ax]) {\nq.on = false;\nres.out = i;\n}\nreturn res;\n};\nG.slideGroup = function (group, di) {\nvar d = DIRS[di], on = this.inPlay(), j;\nif (!group.length || group.length \u003e= on.length) return { ok: false, why: \"all\" };\nfor (j = 0; j \u003c group.length; j++) if (!this.P[group[j]].on) return { ok: false, why: \"pick\" };\nvar by = this.blockers(group, d);\nif (by.length) return { ok: false, why: \"blocked\", by: by, group: null };\nvar inG = {};\nfor (j = 0; j \u003c group.length; j++) inG[group[j]] = 1;\nvar rest = on.filter(function (k) { return !inG[k]; });\nvar O = this.boxOf(rest), B = this.boxOf(group), ax = axisOf(d), before = gaps(B, O);\nvar after = gaps({ lo: [B.lo[0] + d[0], B.lo[1] + d[1], B.lo[2] + d[2]], hi: [B.hi[0] + d[0], B.hi[1] + d[1], B.hi[2] + d[2]] }, O);\nif (after[ax] \u003e FAR \u0026\u0026 after[ax] \u003e before[ax]) return { ok: false, why: \"far\" };\nthis.save();\nfor (j = 0; j \u003c group.length; j++) {\nvar q = this.P[group[j]];\nq.p = [q.p[0] + d[0], q.p[1] + d[1], q.p[2] + d[2]];\n}\nthis.moves++;\nreturn { ok: true, moved: group.slice(), d: di };\n};\nG.free = function (i) {\nvar q = this.P[i];\nreturn !!(q \u0026\u0026 q.on \u0026\u0026 this.clearWay(i));\n};\nG.turn = function (i, ax, back) {\nif (!this.free(i)) return { ok: false, why: \"turn\" };\nvar q = this.P[i], old = this.box(i);\nvar Q = QT[ax];\nif (back) Q = MUL[Q][MUL[Q][Q]];\nvar r = MUL[Q][q.r], s = this.shape(i, r).s, p0 = [0, 0, 0], a;\nfor (a = 0; a \u003c 3; a++) p0[a] = Math.floor((old.lo[a] + old.hi[a] + 1 - s[a]) \/ 2);\nvar on = this.inPlay(), mid = [0, 0, 0], self = this;\nif (on.length \u003e 1) {\nvar O = this.boxOf(on.filter(function (j) { return j !== i; }));\nfor (a = 0; a \u003c 3; a++) mid[a] = (O.lo[a] + O.hi[a] + 1) \/ 2 - (old.lo[a] + old.hi[a] + 1) \/ 2;\n}\nvar order = [0, 1, 2, 3, 4, 5].sort(function (x, y) { return dot(DIRS[x], mid) - dot(DIRS[y], mid); });\nvar tries = [p0];\nfor (var k = 1; k \u003c= 8; k++) order.forEach(function (di) {\nvar d = DIRS[di];\ntries.push([p0[0] + d[0] * k, p0[1] + d[1] * k, p0[2] + d[2] * k]);\n});\nfor (var t = 0; t \u003c tries.length; t++) {\nvar cells = self.place(i, r, tries[t]);\nif (self.hits(i, cells) || !self.clearWay(i, cells)) continue;\nthis.save();\nq.r = r;\nq.p = tries[t];\nreturn { ok: true };\n}\nreturn { ok: false, why: \"room\" };\n};\nG.toTray = function (i) {\nvar q = this.P[i];\nif (!q || !q.on) return { ok: false, why: \"pick\" };\nif (this.inPlay().length \u003e 1 \u0026\u0026 !this.clearWay(i)) return { ok: false, why: \"stuck\" };\nthis.save();\nq.on = false;\nreturn { ok: true, out: i };\n};\nG.won = function () {\nvar on = this.inPlay(), gl = this.C.goal;\nif (on.length !== this.n) return false;\nvar B = this.boxOf(on), dims = [0, 1, 2].map(function (a) { return B.hi[a] - B.lo[a] + 1; });\nif (gl.type === \"box\") {\nvar num = function (x, y) { return x - y; };\nvar want = gl.size.slice().sort(num), got = dims.slice().sort(num);\nreturn want[0] === got[0] \u0026\u0026 want[1] === got[1] \u0026\u0026 want[2] === got[2];\n}\nif (gl.type === \"slots\") {\nfor (var a = 0; a \u003c 3; a++) if (dims[a] !== gl.span[a]) return false;\nvar self = this;\nreturn [0, 1].some(function (mirror) {\nvar want = {};\ngl.slots.forEach(function (sl) {\nvar c = sl[0], s = sl[1];\nif (mirror) { c = [c[1], c[0], c[2]]; s = [s[1], s[0], s[2]]; }\nwant[c.join(\",\") + \"\/\" + s.join(\",\")] = 1;\n});\nreturn on.every(function (i) {\nvar b = self.box(i), lo = [b.lo[0] - B.lo[0], b.lo[1] - B.lo[1], b.lo[2] - B.lo[2]];\nvar s = [b.hi[0] - b.lo[0] + 1, b.hi[1] - b.lo[1] + 1, b.hi[2] - b.lo[2] + 1];\nreturn want[lo.join(\",\") + \"\/\" + s.join(\",\")] === 1;\n});\n});\n}\nreturn false;\n};\nwindow.GPBR_ENGINE = { Game: Game, DIRS: DIRS, ROTS: ROTS, MUL: MUL, QT: QT, ID: ID, gaps: gaps, v: 1 };\n})();\n(function () {\n\"use strict\";\nif (window.GPBR) return;\nvar E = window.GPBR_ENGINE;\nif (!E) return;\nvar NS = \"http:\/\/www.w3.org\/2000\/svg\";\nvar ACC = \"#02A9F7\", BAD = \"#E0533D\";\nvar AXC = [\"#C8553D\", \"#3E8E5A\", \"#3569B8\"];\nvar DIRS = E.DIRS;\nvar seq = 0;\nvar TXT = {\nen: {\ntitle: \"Try it yourself\", play: \"Tap to play\",\nhow: \"Drag the view to turn it. Tap a piece in the tray to bring it in, tap a piece to pick it, then slide it with the arrows.\",\nmoves: \"Moves: {n}\", undo: \"Undo\", reset: \"Start over\", tray: \"Tray\", toTray: \"To tray\",\nturnY: \"Turn\", turnX: \"Tip\", turnZ: \"Spin\", together: \"Move together\",\nslide: \"Slide\", view: \"Puzzle view, drag to turn\",\nempty: \"Tap a piece in the tray to bring it in.\",\npick: \"Tap a piece first.\",\ninNow: \"{Name} is in. Turn it while it is clear, then slide it.\",\nalone: \"Bring in another piece to slide against.\",\nblocked: \"Blocked by {list}.\",\npush: \"It would push {list} too.\",\npushAll: \"Blocked by {list}. Pushing it would move the whole puzzle.\",\nfar: \"That's as far as it goes.\",\nout: \"{Name} is back in the tray.\",\nnoTurn: \"It's held in place. Slide it clear of the others first, then turn it.\",\nnoRoom: \"No room to turn it here. Slide it further out first.\",\nstuck: \"It can't come out from here yet.\",\nnoun: { block: [\"piece {p}\", \"Piece {p}\", \"pieces {a} and {b}\"], boards: [\"board {p}\", \"Board {p}\", \"boards {a} and {b}\"] }, and: \", \",\nfree: \"{n} free moves left\", freeOne: \"1 free move left\", freeNone: \"No free moves left\",\nlockLine: \"That's the free part. Finish it with the real one.\", buy: \"Add to cart\",\ncredit: \"Moves follow the rules of BurrTools, Andreas Röver's free puzzle program.\",\nblock: { goal: \"Put the five pieces together into one solid block.\",\nrule: \"Pieces only slide in straight lines, and a piece can only be turned while it is clear of the others.\",\nwin: \"Done in {n} moves. The block is complete.\" },\nboards: { goal: \"Fit the six boards together into the finished burr.\",\nrule: \"Boards only slide in straight lines, and a board can only be turned while it is clear of the others.\",\nwin: \"Done in {n} moves. All six boards are in place.\" }\n},\nhe: {\ntitle: \"נסו בעצמכם\", play: \"הקישו כדי לשחק\",\nhow: \"גררו את התצוגה כדי לסובב אותה. הקישו על חלק במגש כדי להכניס אותו, הקישו על חלק כדי לבחור בו, ואז הזיזו אותו עם החצים.\",\nmoves: \"מהלכים: {n}\", undo: \"ביטול מהלך\", reset: \"התחלה מחדש\", tray: \"מגש\", toTray: \"למגש\",\nturnY: \"סיבוב\", turnX: \"הטיה\", turnZ: \"גלגול\", together: \"הזיזו יחד\",\nslide: \"הזזה\", view: \"תצוגת הפאזל, גררו כדי לסובב\",\nempty: \"הקישו על חלק במגש כדי להכניס אותו.\",\npick: \"הקישו קודם על חלק.\",\ninNow: \"{Name} בפנים. סובבו אותו כל עוד הוא רחוק מהאחרים, ואז הזיזו אותו.\",\nalone: \"הכניסו עוד חלק כדי שיהיה מול מה להזיז.\",\nblocked: \"חסום על ידי {list}.\",\npush: \"הוא ידחוף גם את {list}.\",\npushAll: \"חסום על ידי {list}. דחיפה תזיז את כל הפאזל.\",\nfar: \"עד כאן אפשר להרחיק אותו.\",\nout: \"{Name} חזר למגש.\",\nnoTurn: \"הוא תקוע במקומו. הרחיקו אותו קודם מהחלקים האחרים, ואז סובבו אותו.\",\nnoRoom: \"אין כאן מקום לסובב אותו. הרחיקו אותו עוד קודם.\",\nstuck: \"עדיין אי אפשר להוציא אותו מכאן.\",\nnoun: { block: [\"חלק {p}\", \"חלק {p}\", \"חלקים {a} ו-{b}\"], boards: [\"לוח {p}\", \"לוח {p}\", \"לוחות {a} ו-{b}\"] }, and: \", \",\nfree: \"נותרו {n} מהלכים חינם\", freeOne: \"נותר מהלך חינם אחד\", freeNone: \"לא נותרו מהלכים חינם\",\nlockLine: \"זה החלק החינמי. סיימו אותו עם הפאזל האמיתי.\", buy: \"הוספה לעגלה\",\ncredit: \"המהלכים פועלים לפי הכללים של BurrTools, תוכנת הפאזלים החופשית של אנדראס רובר.\",\nblock: { goal: \"חברו את חמשת החלקים לקובייה אחת מלאה.\",\nrule: \"החלקים זזים רק בקווים ישרים, ואפשר לסובב חלק רק כשהוא רחוק מהאחרים.\",\nwin: \"הצלחתם ב-{n} מהלכים. הקובייה שלמה.\" },\nboards: { goal: \"חברו את ששת הלוחות לפאזל השלם.\",\nrule: \"הלוחות זזים רק בקווים ישרים, ואפשר לסובב לוח רק כשהוא רחוק מהאחרים.\",\nwin: \"הצלחתם ב-{n} מהלכים. כל ששת הלוחות במקומם.\" }\n},\nja: {\ntitle: \"試してみてください\", play: \"タップして遊ぶ\",\nhow: \"画面をドラッグすると向きが変わります。トレイのピースをタップして入れ、ピースをタップして選び、矢印でスライドさせてください。\",\nmoves: \"手数：{n}\", undo: \"1手戻す\", reset: \"最初から\", tray: \"トレイ\", toTray: \"トレイへ\",\nturnY: \"回す\", turnX: \"倒す\", turnZ: \"ひねる\", together: \"一緒に動かす\",\nslide: \"スライド\", view: \"パズルの表示（ドラッグで回転）\",\nempty: \"トレイのピースをタップして入れてください。\",\npick: \"まずピースをタップしてください。\",\ninNow: \"{Name}が入りました。離れているうちに向きを変えてから、スライドさせてください。\",\nalone: \"もう1つピースを入れてから動かしてください。\",\nblocked: \"{list}に当たって動けません。\",\npush: \"{list}も一緒に押すことになります。\",\npushAll: \"{list}に当たって動けません。押すとパズル全体が動いてしまいます。\",\nfar: \"これ以上は離せません。\",\nout: \"{Name}がトレイに戻りました。\",\nnoTurn: \"今は固定されています。向きを変えるには、まず他のピースから離してください。\",\nnoRoom: \"ここでは回す場所がありません。もう少し離してください。\",\nstuck: \"ここからはまだ取り出せません。\",\nnoun: { block: [\"ピース{p}\", \"ピース{p}\", \"ピース{a}と{b}\"], boards: [\"板{p}\", \"板{p}\", \"板{a}と{b}\"] }, and: \"、\",\nfree: \"無料であと{n}手\", freeOne: \"無料であと1手\", freeNone: \"無料の手はここまで\",\nlockLine: \"無料で遊べるのはここまでです。続きは本物のパズルでどうぞ。\", buy: \"カートに追加\",\ncredit: \"動きのルールは、Andreas Röver さんの無料パズルソフト BurrTools に従っています。\",\nblock: { goal: \"5つのピースを組み合わせて、すき間のない1つのブロックにしてください。\",\nrule: \"ピースはまっすぐスライドするだけです。向きを変えられるのは、他のピースから離れているときだけです。\",\nwin: \"{n}手で完成！ブロックができあがりました。\" },\nboards: { goal: \"6枚の板を組み合わせて、パズルを完成させてください。\",\nrule: \"板はまっすぐスライドするだけです。向きを変えられるのは、他の板から離れているときだけです。\",\nwin: \"{n}手で完成！6枚の板がすべて収まりました。\" }\n}\n};\nfunction langOf() {\nvar l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\nif (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\nif (l.indexOf(\"ja\") === 0) return \"ja\";\nreturn \"en\";\n}\nfunction fmt(s, o) {\nreturn s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n}\nfunction el(tag, cls, txt) {\nvar e = document.createElement(tag);\nif (cls) e.className = cls;\nif (txt != null) e.textContent = txt;\nreturn e;\n}\nfunction sv(tag, attrs) {\nvar e = document.createElementNS(NS, tag);\nfor (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) e.setAttribute(k, attrs[k]);\nreturn e;\n}\nfunction track(name, handle) {\ntry { if (typeof window.gtag === \"function\") window.gtag(\"event\", name, { product: handle }); } catch (e) {  }\n}\nfunction buyButton(root) {\nvar scopes = [], sec = root.closest ? root.closest(\"section, .shopify-section, product-info\") : null;\nif (sec) scopes.push(sec);\nscopes.push(document);\nfor (var k = 0; k \u003c scopes.length; k++) {\nvar b = scopes[k].querySelector('[id^=\"ProductSubmitButton-\"]');\nif (b \u0026\u0026 !root.contains(b)) return b;\nvar forms = scopes[k].querySelectorAll('form[action*=\"\/cart\/add\"]');\nfor (var i = 0; i \u003c forms.length; i++) {\nif (root.contains(forms[i])) continue;\nvar x = forms[i].querySelector('[type=\"submit\"], button:not([type])');\nif (x) return x;\n}\n}\nreturn null;\n}\nfunction rgb(h) {\nvar n = parseInt(h.slice(1), 16);\nreturn [n \u003e\u003e 16 \u0026 255, n \u003e\u003e 8 \u0026 255, n \u0026 255];\n}\nfunction dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; }\nvar now = (window.performance \u0026\u0026 performance.now) ? function () { return performance.now(); } : function () { return Date.now(); };\nvar CORN = [[0, 0], [1, 0], [1, 1], [0, 1]];\nvar OUTW = [[0, -1], [1, 0], [0, 1], [-1, 0]];\nfunction facesOf(cells) {\nvar has = {}, F = [];\nfunction k(x, y, z) { return x + \",\" + y + \",\" + z; }\ncells.forEach(function (c) { has[k(c[0], c[1], c[2])] = 1; });\ncells.forEach(function (c) {\nfor (var n = 0; n \u003c 6; n++) {\nvar d = DIRS[n];\nif (has[k(c[0] + d[0], c[1] + d[1], c[2] + d[2])]) continue;\nvar a = d[0] ? 0 : d[1] ? 1 : 2, s = d[0] + d[1] + d[2], b = (a + 1) % 3, e = (a + 2) % 3;\nvar pts = CORN.map(function (uv) {\nvar p = [0, 0, 0];\np[a] = c[a] + (s \u003e 0 ? 1 : 0); p[b] = c[b] + uv[0]; p[e] = c[e] + uv[1];\nreturn p;\n});\nvar mask = 0;\nfor (var j = 0; j \u003c 4; j++) {\nvar u = [0, 0, 0];\nu[b] = OUTW[j][0]; u[e] = OUTW[j][1];\nvar m = [c[0] + u[0], c[1] + u[1], c[2] + u[2]];\nvar flat = has[k(m[0], m[1], m[2])] \u0026\u0026 !has[k(m[0] + d[0], m[1] + d[1], m[2] + d[2])];\nif (!flat) mask |= 1 \u003c\u003c j;\n}\nF.push({ n: n, pts: pts, cc: [c[0] + 0.5, c[1] + 0.5, c[2] + 0.5], m: mask });\n}\n});\nreturn F;\n}\nfunction mount(root, C) {\nif (!root || root.getAttribute(\"data-gpbr-on\")) return;\nroot.setAttribute(\"data-gpbr-on\", \"1\");\nvar L = langOf(), t = TXT[L], T = t[C.text] || t.block;\nroot.setAttribute(\"lang\", L);\nroot.setAttribute(\"dir\", L === \"he\" ? \"rtl\" : \"ltr\");\nvar handle = root.getAttribute(\"data-handle\") || \"\";\nvar game = new E.Game(C), n = game.n;\nvar FREE = C.free \u003e 0 ? C.free : Infinity;\nvar COL = (C.colors || []).map(rgb);\nvar yaw = -0.62, pitch = 0.52;\nvar sel = null, pending = null, flash = {}, anim = {}, msg = t.empty, won = false;\nvar faceCache = {};\nvar view = { s: 0, c: [0, 0, 0], ts: 0, tc: [0, 0, 0] };\nvar drawn = [];\nvar dirty = false, raf = 0;\nfunction locked() { return game.moves \u003e= FREE; }\nfunction label(i) { return String(i + 1); }\nvar NOUN = t.noun[C.text] || t.noun.block;\nfunction names(list) {\nif (list.length === 1) return fmt(NOUN[0], { p: label(list[0]) });\nvar head = list.slice(0, -1).map(label).join(t.and);\nreturn fmt(NOUN[2], { a: head, b: label(list[list.length - 1]) });\n}\nfunction Name(i) { return fmt(NOUN[1], { p: label(i) }); }\nroot.appendChild(el(\"h3\", \"gpbr-h\", t.title));\nroot.appendChild(el(\"p\", \"gpbr-goal\", T.goal));\nroot.appendChild(el(\"p\", \"gpbr-rule\", T.rule + (L === \"ja\" ? \"\" : \" \") + t.how));\nvar stage = el(\"div\", \"gpbr-stage\");\nroot.appendChild(stage);\nvar viewEl = el(\"div\", \"gpbr-view\");\nstage.appendChild(viewEl);\nvar cv = el(\"canvas\", \"gpbr-cv\");\ncv.setAttribute(\"role\", \"img\");\ncv.setAttribute(\"aria-label\", t.view);\nviewEl.appendChild(cv);\nvar veil = el(\"div\", \"gpbr-veil\");\nveil.appendChild(el(\"span\", \"gpbr-veil-t\", t.play));\nviewEl.appendChild(veil);\nvar ctx = cv.getContext(\"2d\");\nvar trayEl = el(\"div\", \"gpbr-tray\");\nstage.appendChild(trayEl);\ntrayEl.appendChild(el(\"span\", \"gpbr-tray-h\", t.tray));\nvar slots = [];\nfor (var i = 0; i \u003c n; i++) {\nvar b = el(\"button\", \"gpbr-slot\");\nb.type = \"button\";\nb.setAttribute(\"data-piece\", String(i));\nvar tc = el(\"canvas\", \"gpbr-thumb\");\nb.appendChild(tc);\nb.appendChild(el(\"span\", \"gpbr-num\", label(i)));\ntrayEl.appendChild(b);\nslots.push({ b: b, cv: tc });\n}\nvar ctl = el(\"div\", \"gpbr-ctl\");\nroot.appendChild(ctl);\nvar pad = el(\"div\", \"gpbr-pad\");\nctl.appendChild(pad);\nvar mvb = [];\nDIRS.forEach(function (d, di) {\nvar bt = el(\"button\", \"gpbr-mv\");\nbt.type = \"button\";\nbt.setAttribute(\"data-dir\", String(di));\nvar ax = d[0] ? 0 : d[1] ? 1 : 2;\nbt.style.borderColor = AXC[ax];\nvar svg = sv(\"svg\", { viewBox: \"-12 -12 24 24\", width: \"100%\", height: \"100%\", \"aria-hidden\": \"true\", focusable: \"false\" });\nvar g = sv(\"g\", {});\ng.appendChild(sv(\"path\", { d: \"M-7 0H6M1-5L6 0L1 5\", fill: \"none\", stroke: AXC[ax], \"stroke-width\": \"2.6\", \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\" }));\nsvg.appendChild(g);\nvar mark = sv(\"circle\", { cx: \"0\", cy: \"0\", r: \"3.2\", fill: AXC[ax] });\nsvg.appendChild(mark);\nbt.appendChild(svg);\npad.appendChild(bt);\nmvb.push({ b: bt, g: g, mark: mark, ax: ax });\n});\nvar side = el(\"div\", \"gpbr-side\");\nctl.appendChild(side);\nfunction sideBtn(txt, cls) {\nvar bt = el(\"button\", \"gpbr-sb \" + cls, txt);\nbt.type = \"button\";\nside.appendChild(bt);\nreturn bt;\n}\nvar bTurnY = sideBtn(t.turnY, \"gpbr-turn\");\nvar bTurnX = sideBtn(t.turnX, \"gpbr-turn\");\nvar bTurnZ = sideBtn(t.turnZ, \"gpbr-turn\");\nvar bTray = sideBtn(t.toTray, \"gpbr-out\");\nvar sayRow = el(\"div\", \"gpbr-sayrow\");\nroot.appendChild(sayRow);\nvar sayEl = el(\"p\", \"gpbr-say\", \"\");\nsayEl.setAttribute(\"aria-live\", \"polite\");\nsayRow.appendChild(sayEl);\nvar bTog = el(\"button\", \"gpbr-tog\", t.together);\nbTog.type = \"button\";\nbTog.hidden = true;\nsayRow.appendChild(bTog);\nvar winEl = el(\"p\", \"gpbr-win\", \"\");\nwinEl.hidden = true;\nwinEl.setAttribute(\"aria-live\", \"polite\");\nroot.appendChild(winEl);\nvar bar = el(\"div\", \"gpbr-bar\");\nroot.appendChild(bar);\nvar stat = el(\"div\", \"gpbr-stat\");\nbar.appendChild(stat);\nvar countEl = el(\"span\", \"gpbr-count\", \"\");\nstat.appendChild(countEl);\nvar freeEl = el(\"span\", \"gpbr-free\", \"\");\nif (FREE !== Infinity) stat.appendChild(freeEl);\nvar bUndo = el(\"button\", \"\", t.undo);\nbUndo.type = \"button\";\nbar.appendChild(bUndo);\nvar bReset = el(\"button\", \"\", t.reset);\nbReset.type = \"button\";\nbar.appendChild(bReset);\nvar lockEl = el(\"div\", \"gpbr-lock\");\nlockEl.hidden = true;\nlockEl.setAttribute(\"aria-live\", \"polite\");\nlockEl.appendChild(el(\"p\", \"gpbr-lock-line\", t.lockLine));\nvar buyEl = el(\"a\", \"gpbr-buy\", t.buy);\nbuyEl.setAttribute(\"href\", \"\/products\/\" + handle);\nbuyEl.setAttribute(\"role\", \"button\");\nlockEl.appendChild(buyEl);\nroot.appendChild(lockEl);\nroot.appendChild(el(\"p\", \"gpbr-credit\", t.credit));\nfunction basis() {\nvar cy = Math.cos(yaw), sy = Math.sin(yaw), cp = Math.cos(pitch), sp = Math.sin(pitch);\nreturn { X: [cy, -sy, 0], Y: [sp * sy, sp * cy, cp], D: [cp * sy, cp * cy, -sp] };\n}\nvar LIGHT = [-0.42, 0.74, -0.52];\nfunction faces(i, r) {\nvar k = i + \"\/\" + r;\nif (!faceCache[k]) faceCache[k] = facesOf(game.shape(i, r).c);\nreturn faceCache[k];\n}\nfunction offsetOf(i, tnow) {\nvar q = game.P[i], o = [q.p[0], q.p[1], q.p[2]], a = anim[i];\nif (a) {\nvar e = Math.min(1, (tnow - a.t0) \/ a.ms);\nif (e \u003e= 1) delete anim[i];\nelse {\nvar f = 1 - (1 - e) * (1 - e);\nfor (var k = 0; k \u003c 3; k++) o[k] += a.v[k] * (1 - f);\n}\n}\nreturn o;\n}\nfunction table() { return !game.inPlay().length; }\nfunction scene(tnow) {\nvar on = game.inPlay(), list = [], lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9], k;\nif (on.length) {\non.forEach(function (i) { list.push({ i: i, r: game.P[i].r, off: tnow == null ? game.P[i].p.slice() : offsetOf(i, tnow) }); });\n} else {\nvar sp = 0, cols = n \u003c= 4 ? 2 : 3;\nfor (k = 0; k \u003c n; k++) { var s0 = game.shape(k, game.P[k].r).s; sp = Math.max(sp, s0[0], s0[1], s0[2]); }\nsp += 2;\nfor (k = 0; k \u003c n; k++) {\nvar sz = game.shape(k, game.P[k].r).s, col = k % cols, row = Math.floor(k \/ cols);\nlist.push({ i: k, r: game.P[k].r, off: [Math.round(col * sp - sz[0] \/ 2), Math.round(-row * sp - sz[1] \/ 2), Math.round(-sz[2] \/ 2)] });\n}\n}\nlist.forEach(function (it) {\nvar s1 = game.shape(it.i, it.r).s;\nfor (var a = 0; a \u003c 3; a++) {\nlo[a] = Math.min(lo[a], it.off[a]);\nhi[a] = Math.max(hi[a], it.off[a] + s1[a] - 1);\n}\n});\nreturn { list: list, lo: lo, hi: hi };\n}\nvar lastTable = null;\nfunction fitTarget() {\nvar B = scene(null), c = [], r2 = 0;\nif (!B.list.length) return;\nif (lastTable !== table()) { lastTable = table(); view.s = 0; }\nfor (var k = 0; k \u003c 3; k++) {\nc.push((B.lo[k] + B.hi[k] + 1) \/ 2);\nvar h = (B.hi[k] - B.lo[k] + 1) \/ 2;\nr2 += h * h;\n}\nvar r = Math.sqrt(r2) + 0.35, W = cv.clientWidth || 300, H = cv.clientHeight || 260;\nview.ts = Math.min(W, H) \/ (2 * r);\nview.tc = c;\nif (!view.s) { view.s = view.ts; view.c = c.slice(); }\n}\nfunction shade(rgbv, f) {\nreturn \"rgb(\" + Math.round(rgbv[0] * f) + \",\" + Math.round(rgbv[1] * f) + \",\" + Math.round(rgbv[2] * f) + \")\";\n}\nfunction paint(g2, list, B, s, c, W, H, dpr, pick) {\nvar items = [];\nlist.forEach(function (it) {\nvar F = faces(it.i, it.r), col = COL[it.i % COL.length] || [200, 200, 200];\nfor (var j = 0; j \u003c F.length; j++) {\nvar f = F[j], nd = DIRS[f.n];\nvar nz = dot(nd, B.D);\nif (nz \u003e -1e-6) continue;\nvar pts = [];\nfor (var k = 0; k \u003c 4; k++) {\nvar p = [f.pts[k][0] + it.off[0] - c[0], f.pts[k][1] + it.off[1] - c[1], f.pts[k][2] + it.off[2] - c[2]];\npts.push([W \/ 2 + s * dot(p, B.X), H \/ 2 - s * dot(p, B.Y)]);\n}\nvar cc = [f.cc[0] + it.off[0], f.cc[1] + it.off[1], f.cc[2] + it.off[2]];\nvar fc = [cc[0] + nd[0] * 0.5, cc[1] + nd[1] * 0.5, cc[2] + nd[2] * 0.5];\nvar nv = [dot(nd, B.X), dot(nd, B.Y), nz];\nvar lum = 0.6 + 0.4 * Math.max(0, dot(nv, LIGHT));\nitems.push({ i: it.i, pts: pts, m: f.m, z: dot(cc, B.D), z2: dot(fc, B.D), fill: shade(col, lum) });\n}\n});\nitems.sort(function (a, b) { return (b.z - a.z) || (b.z2 - a.z2); });\ng2.lineJoin = \"round\";\ng2.lineCap = \"round\";\nfor (var q = 0; q \u003c items.length; q++) {\nvar it = items[q], P = it.pts;\nvar mx = (P[0][0] + P[1][0] + P[2][0] + P[3][0]) \/ 4, my = (P[0][1] + P[1][1] + P[2][1] + P[3][1]) \/ 4;\ng2.beginPath();\nfor (var k2 = 0; k2 \u003c 4; k2++) {\nvar ex = P[k2][0] - mx, ey = P[k2][1] - my, el2 = Math.sqrt(ex * ex + ey * ey) || 1;\nvar gx = P[k2][0] + ex \/ el2 * 0.6, gy = P[k2][1] + ey \/ el2 * 0.6;\nif (k2) g2.lineTo(gx, gy); else g2.moveTo(gx, gy);\n}\ng2.closePath();\ng2.fillStyle = it.fill;\ng2.fill();\nvar hot = pick \u0026\u0026 (it.i === sel ? ACC : flash[it.i] ? BAD : null);\ng2.strokeStyle = hot || \"rgba(30,30,30,.55)\";\ng2.lineWidth = (hot ? 2.2 : 1) * dpr;\ng2.beginPath();\nfor (k2 = 0; k2 \u003c 4; k2++) {\nif (!(it.m \u003e\u003e k2 \u0026 1)) continue;\ng2.moveTo(P[k2][0], P[k2][1]);\ng2.lineTo(P[(k2 + 1) % 4][0], P[(k2 + 1) % 4][1]);\n}\ng2.stroke();\n}\nreturn items;\n}\nfunction size() {\nvar dpr = Math.min(window.devicePixelRatio || 1, 2.5);\nvar W = cv.clientWidth, H = cv.clientHeight;\nif (cv.width !== Math.round(W * dpr) || cv.height !== Math.round(H * dpr)) {\ncv.width = Math.round(W * dpr);\ncv.height = Math.round(H * dpr);\n}\nreturn dpr;\n}\nfunction draw() {\nraf = 0;\nvar tnow = now(), dpr = size(), W = cv.width, H = cv.height, B = basis(), more = false;\nfitTarget();\nif (view.s) {\nvar ds = view.ts - view.s;\nview.s += ds * 0.28;\nif (Math.abs(ds) \u003e view.ts * 0.004) more = true; else view.s = view.ts;\nfor (var k = 0; k \u003c 3; k++) {\nvar dc = view.tc[k] - view.c[k];\nview.c[k] += dc * 0.28;\nif (Math.abs(dc) \u003e 0.01) more = true; else view.c[k] = view.tc[k];\n}\n}\nctx.clearRect(0, 0, W, H);\nvar list = scene(tnow).list;\nfor (var a in anim) if (Object.prototype.hasOwnProperty.call(anim, a)) more = true;\nfor (var f in flash) if (Object.prototype.hasOwnProperty.call(flash, f)) {\nif (tnow \u003e flash[f]) delete flash[f]; else more = true;\n}\ndrawn = list.length ? paint(ctx, list, B, view.s * dpr, view.c, W, H, dpr, true) : [];\nif (more) schedule();\n}\nfunction schedule() { if (!raf) raf = (window.requestAnimationFrame || function (cb) { return setTimeout(cb, 16); })(draw); }\nfunction drawTray() {\nvar B = basis(), dpr = Math.min(window.devicePixelRatio || 1, 2.5);\nslots.forEach(function (sl, i) {\nvar q = game.P[i];\nsl.b.hidden = q.on;\nsl.b.disabled = locked() || won;\nif (q.on) return;\nvar W = Math.round((sl.cv.clientWidth || 48) * dpr), H = Math.round((sl.cv.clientHeight || 48) * dpr);\nif (sl.cv.width !== W) sl.cv.width = W;\nif (sl.cv.height !== H) sl.cv.height = H;\nvar g2 = sl.cv.getContext(\"2d\"), s = game.shape(i, q.r).s;\ng2.clearRect(0, 0, W, H);\nvar r = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]) \/ 2 + 0.2;\npaint(g2, [{ i: i, r: q.r, off: [0, 0, 0] }], B, Math.min(W, H) \/ (2 * r), [s[0] \/ 2, s[1] \/ 2, s[2] \/ 2], W, H, dpr * 0.8, false);\n});\n}\nfunction layoutPad() {\nvar B = basis(), R = 3.15, ring = [], mid = [];\nmvb.forEach(function (m, di) {\nvar d = DIRS[di], vx = dot(d, B.X), vy = dot(d, B.Y), len = Math.sqrt(vx * vx + vy * vy);\nvar ang = Math.atan2(vy, vx);\nm.g.setAttribute(\"transform\", \"rotate(\" + (-ang * 180 \/ Math.PI).toFixed(1) + \") scale(\" + Math.max(0.45, Math.min(1, len)).toFixed(2) + \")\");\nm.mark.setAttribute(\"r\", len \u003c 0.35 ? (dot(d, B.D) \u003c 0 ? \"3.4\" : \"0\") : \"0\");\nm.b.setAttribute(\"aria-label\", t.slide + \" \" + [\"x\", \"y\", \"z\"][m.ax] + (di % 2 ? \"-\" : \"+\"));\nif (len \u003c 0.3) mid.push({ m: m, toward: dot(d, B.D) \u003c 0 });\nelse ring.push({ m: m, a: ang });\n});\nring.sort(function (p, q) { return p.a - q.a; });\nvar MIN = 1.0;\nfor (var it = 0; it \u003c 60; it++) {\nfor (var j = 0; j \u003c ring.length; j++) {\nvar p = ring[j], q = ring[(j + 1) % ring.length];\nvar gap = q.a - p.a + (j === ring.length - 1 ? 2 * Math.PI : 0);\nif (gap \u003c MIN) { var push = (MIN - gap) \/ 2; p.a -= push; q.a += push; }\n}\n}\nring.forEach(function (o) {\no.m.b.style.left = (4.8 + R * Math.cos(o.a) - 1.45).toFixed(2) + \"em\";\no.m.b.style.top = (4.8 - R * Math.sin(o.a) - 1.45).toFixed(2) + \"em\";\n});\nmid.forEach(function (o, j) {\nvar x = mid.length === 1 ? 0 : (o.toward ? -0.8 : 0.8);\no.m.b.style.left = (4.8 + x * 1.9 - 1.45).toFixed(2) + \"em\";\no.m.b.style.top = (4.8 - 1.45).toFixed(2) + \"em\";\n});\n}\nfunction upSide() {\nvar B = basis(), best = 4, bv = -9;\nDIRS.forEach(function (d, di) { var v = dot(d, B.Y); if (v \u003e bv + 1e-9) { bv = v; best = di; } });\nreturn best;\n}\nfunction turnAxis(vec) {\nvar best = 0, bv = 0;\nfor (var a = 0; a \u003c 3; a++) if (Math.abs(vec[a]) \u003e Math.abs(bv)) { bv = vec[a]; best = a; }\nreturn [best, bv \u003c 0];\n}\nfunction render() {\nvar lk = locked();\nvar on = game.inPlay();\ncountEl.textContent = fmt(t.moves, { n: game.moves });\nif (FREE !== Infinity) {\nvar left = FREE - game.moves;\nfreeEl.textContent = left \u003c= 0 ? t.freeNone : left === 1 ? t.freeOne : fmt(t.free, { n: left });\n}\nlockEl.hidden = !lk;\nvar can = sel != null \u0026\u0026 game.P[sel] \u0026\u0026 game.P[sel].on \u0026\u0026 !lk \u0026\u0026 !won;\nmvb.forEach(function (m) { m.b.disabled = lk || won; m.b.setAttribute(\"aria-disabled\", can ? \"false\" : \"true\"); });\nvar fr = can \u0026\u0026 game.free(sel);\nbTurnX.disabled = bTurnY.disabled = bTurnZ.disabled = !fr;\nbTray.disabled = !can || (on.length \u003e 1 \u0026\u0026 !game.clearWay(sel));\nbUndo.disabled = lk || !game.canUndo();\nbTog.hidden = !pending;\nsayEl.textContent = msg;\nif (won) { winEl.hidden = false; winEl.textContent = fmt(T.win, { n: game.moves }); }\nelse winEl.hidden = true;\nroot.setAttribute(\"data-state\", won ? \"done\" : lk ? \"locked\" : \"play\");\nroot.setAttribute(\"data-moves\", String(game.moves));\nlayoutPad();\ndrawTray();\nschedule();\n}\nfunction after(res, di) {\nif (res.ok \u0026\u0026 res.moved) {\nvar d = DIRS[di], tnow = now();\nres.moved.forEach(function (i) { if (game.P[i].on) anim[i] = { v: [-d[0], -d[1], -d[2]], t0: tnow, ms: 130 }; });\n}\nif (res.ok \u0026\u0026 res.out != null) {\nif (sel === res.out) sel = null;\nmsg = fmt(t.out, { Name: Name(res.out) });\n}\nif (res.ok) {\nwon = game.won();\nif (locked() \u0026\u0026 !won) { msg = \"\"; track(\"demo_limit_reached\", handle); }\n}\n}\nfunction act(di) {\npending = null;\nif (locked() || won) return;\nif (sel == null || !game.P[sel].on) { msg = t.pick; render(); return; }\nvar res = game.slide(sel, di);\nif (res.ok) { msg = \"\"; after(res, di); render(); return; }\nif (res.why === \"alone\") msg = t.alone;\nelse if (res.why === \"blocked\") {\nvar tend = now() + 700;\nres.by.forEach(function (j) { flash[j] = tend; });\nif (res.group) {\nvar others = res.group.filter(function (j) { return j !== sel; });\nmsg = fmt(t.push, { list: names(others) });\npending = { group: res.group, di: di };\n} else msg = fmt(t.pushAll, { list: names(res.by) });\n} else msg = t.pick;\nrender();\n}\nfunction together() {\nif (!pending || locked() || won) return;\nvar p = pending;\npending = null;\nvar res = game.slideGroup(p.group, p.di);\nif (res.ok) { msg = \"\"; after(res, p.di); }\nelse msg = res.why === \"far\" ? t.far : fmt(t.blocked, { list: names(res.by || []) });\nrender();\n}\nfunction bringIn(i) {\npending = null;\nif (locked() || won || game.P[i].on) return;\nvar sideDi = upSide(), res = game.spawn(i, sideDi);\nif (!res.ok) return;\nsel = i;\nvar d = DIRS[sideDi];\nif (game.inPlay().length \u003e 1) anim[i] = { v: [d[0] * 2, d[1] * 2, d[2] * 2], t0: now(), ms: 180 };\nmsg = fmt(t.inNow, { Name: Name(i) });\nrender();\n}\nfunction turn(vec) {\npending = null;\nif (sel == null || locked() || won) return;\nvar ta = turnAxis(vec), res = game.turn(sel, ta[0], ta[1]);\nmsg = res.ok ? \"\" : res.why === \"room\" ? t.noRoom : t.noTurn;\nrender();\n}\nvar awake = false, drag = null;\nfunction wake(on) {\nif (awake === on) return;\nawake = on;\nroot.setAttribute(\"data-play\", on ? \"1\" : \"0\");\n}\nroot.setAttribute(\"data-play\", \"0\");\nif (window.IntersectionObserver) {\nnew window.IntersectionObserver(function (es) {\nfor (var k = 0; k \u003c es.length; k++) if (!es[k].isIntersecting) { drag = null; wake(false); }\n}, { threshold: 0 }).observe(root);\n} else {\nwindow.addEventListener(\"scroll\", function () {\nvar r = root.getBoundingClientRect();\nif (r.bottom \u003c 0 || r.top \u003e (window.innerHeight || 0)) { drag = null; wake(false); }\n}, { passive: true });\n}\ncv.addEventListener(\"pointerdown\", function (e) {\nvar touch = e.pointerType \u0026\u0026 e.pointerType !== \"mouse\";\nif (!touch) wake(true);\ndrag = { x: e.clientX, y: e.clientY, yaw: yaw, pitch: pitch, moved: false, id: e.pointerId, sleep: !awake };\nif (!awake) return;\ntry { cv.setPointerCapture(e.pointerId); } catch (er) {  }\ne.preventDefault();\n});\ncv.addEventListener(\"pointermove\", function (e) {\nif (!drag || e.pointerId !== drag.id) return;\nvar dx = e.clientX - drag.x, dy = e.clientY - drag.y;\nif (drag.sleep) { if (dx * dx + dy * dy \u003e= 100) drag.moved = true; return; }\nif (!drag.moved \u0026\u0026 dx * dx + dy * dy \u003c 36) return;\ndrag.moved = true;\nyaw = drag.yaw - dx * 0.011;\npitch = Math.max(-1.45, Math.min(1.45, drag.pitch + dy * 0.011));\nlayoutPad();\ndrawTray();\nschedule();\ne.preventDefault();\n});\nfunction hitAt(x, y) {\nfor (var j = drawn.length - 1; j \u003e= 0; j--) {\nvar P = drawn[j].pts, inside = true, sgn = 0;\nfor (var k = 0; k \u003c 4; k++) {\nvar a = P[k], b = P[(k + 1) % 4];\nvar cr = (b[0] - a[0]) * (y - a[1]) - (b[1] - a[1]) * (x - a[0]);\nif (Math.abs(cr) \u003c 1e-9) continue;\nif (!sgn) sgn = cr \u003e 0 ? 1 : -1;\nelse if ((cr \u003e 0 ? 1 : -1) !== sgn) { inside = false; break; }\n}\nif (inside) return drawn[j].i;\n}\nreturn null;\n}\nfunction up(e) {\nif (!drag || e.pointerId !== drag.id) return;\nvar d = drag;\ndrag = null;\nif (d.moved) return;\nif (d.sleep) { wake(true); return; }\nvar r = cv.getBoundingClientRect(), dpr = cv.width \/ (r.width || 1);\nvar hit = hitAt((e.clientX - r.left) * dpr, (e.clientY - r.top) * dpr);\npending = null;\nif (table()) {\nif (hit != null) bringIn(hit);\nreturn;\n}\nsel = hit;\nmsg = \"\";\nrender();\n}\ncv.addEventListener(\"pointerup\", up);\ncv.addEventListener(\"pointercancel\", function () { drag = null; });\nmvb.forEach(function (m, di) { m.b.addEventListener(\"click\", function () { wake(true); act(di); }); });\nslots.forEach(function (sl, i) { sl.b.addEventListener(\"click\", function () { wake(true); bringIn(i); }); });\nbTurnY.addEventListener(\"click\", function () { turn(basis().Y); });\nbTurnX.addEventListener(\"click\", function () { turn(basis().X); });\nbTurnZ.addEventListener(\"click\", function () { var D = basis().D; turn([-D[0], -D[1], -D[2]]); });\nbTray.addEventListener(\"click\", function () {\npending = null;\nif (sel == null || locked() || won) return;\nvar res = game.toTray(sel);\nif (res.ok) { msg = fmt(t.out, { Name: Name(sel) }); sel = null; }\nelse msg = t.stuck;\nrender();\n});\nbTog.addEventListener(\"click\", together);\nbUndo.addEventListener(\"click\", function () {\nif (locked()) return;\nif (game.undo()) {\npending = null; won = false; msg = \"\";\nif (sel != null \u0026\u0026 !game.P[sel].on) sel = null;\nrender();\n}\n});\nbReset.addEventListener(\"click\", function () {\ngame.reset(); sel = null; pending = null; won = false; anim = {}; msg = t.empty;\nview.s = 0;\nrender();\n});\nbuyEl.addEventListener(\"click\", function (e) {\ntrack(\"demo_limit_atc\", handle);\nvar b = buyButton(root);\nif (!b) return;\ne.preventDefault();\nif (b.disabled) { if (b.scrollIntoView) b.scrollIntoView({ block: \"center\" }); return; }\nb.click();\n});\nif (window.ResizeObserver) new window.ResizeObserver(function () { drawTray(); schedule(); }).observe(viewEl);\nelse window.addEventListener(\"resize\", function () { drawTray(); schedule(); });\nrender();\n}\nwindow.GPBR = { mount: mount, v: 1 };\n})();\n(function(){var C={\"v\":1,\"text\":\"boards\",\"pieces\":[[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,0,0],[2,3,0],[2,4,0],[3,0,0],[3,4,0],[4,0,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,2,0],[3,0,0],[3,2,0],[3,3,0],[3,4,0],[4,0,0],[4,2,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,0,0],[2,2,0],[2,4,0],[3,0,0],[3,2,0],[3,4,0],[4,0,0],[4,2,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,0,0],[2,4,0],[3,0,0],[3,4,0],[4,0,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,0,0],[2,4,0],[3,0,0],[3,4,0],[4,0,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,0,0],[2,2,0],[2,4,0],[3,0,0],[3,4,0],[4,0,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]]],\"colors\":[\"#E8E4DA\",\"#E9A07E\",\"#9CC5A6\",\"#F0CF86\",\"#8FA6D6\",\"#C99BC4\"],\"goal\":{\"type\":\"slots\",\"span\":[7,7,7],\"slots\":[[[0,1,2],[7,5,1]],[[2,0,1],[1,7,5]],[[1,2,0],[5,1,7]],[[0,1,4],[7,5,1]],[[4,0,1],[1,7,5]],[[1,4,0],[5,1,7]]]},\"free\":0};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gpbr \")\u003c0)r=document.querySelector(\".gpbr:not([data-gpbr-on])\");if(!r||!window.GPBR)return;var go=function(){window.GPBR.mount(r,C);};if(window.IntersectionObserver){var o=new IntersectionObserver(function(e){if(e[0]\u0026\u0026e[0].isIntersecting){o.disconnect();go();}},{rootMargin:\"600px 0px\"});o.observe(r);}else go();})();\n\u003c\/script\u003e\n\u003cp class=\"gp-tm-note\" style=\"font-size:1.2rem;opacity:.7;margin-top:2.4rem\"\u003eGordian's Knot is a trademark of ThinkFun. Greg Puzzles is not affiliated with ThinkFun.\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51347709919399,"sku":"GP-EXTRTORT","price":20.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/extreme_torture_marble.png?v=1790218328"},{"product_id":"microma","title":"Microma | Pack 3 Pieces in a Small Box","description":"\u003ch2\u003eMicroma - Quick Summary\u003c\/h2\u003e\n\u003cp\u003eMicroma is a 3D dynamic packing puzzle designed by \u003ca href=\"\/collections\/andreas-rover\"\u003eAndreas Röver\u003c\/a\u003e. Your goal: pack all of the pieces into the box. Rotations are allowed. Do not disassemble the pieces.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e MINIMA puzzle lovers, and as a gift for clever people who assume they will crack it in five minutes. It is waaay harder than it looks.\u003c\/p\u003e\n\u003ch2\u003eWhy We Carry It\u003c\/h2\u003e\n\u003cp\u003eMicroma was Andreas Röver's exchange puzzle at the 2026 International Puzzle Party in Assisi - an international gathering of a closed circle of puzzle collectors, where brand-new puzzles are introduced and exchanged.\u003c\/p\u003e\n\u003cp\u003eI solved it there, and I immediately knew I wanted to share this design with you all. \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e's MINIMA series has inspired a whole wave of designers, and this could be one of the most brilliant MINIMA-inspired designs out there.\u003c\/p\u003e\n\u003ch2\u003eThe Rules\u003c\/h2\u003e\n\u003cp\u003ePack every piece into the box. Rotations are allowed, which is where the difficulty lives - a piece that clearly does not fit in one orientation may fit perfectly in another, and finding which is the whole puzzle.\u003c\/p\u003e\n\u003cp\u003eOne rule matters more than the rest: do not disassemble the pieces. A smart guy I know did it once. Don't do it. They are meant to stay whole. If you find yourself pulling one apart, you have left the puzzle and started a different one.\u003c\/p\u003e\n\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\n\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is Microma?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eMicroma is a 3D dynamic packing puzzle designed by Andreas Röver. The goal is to pack all of the pieces into the box, with rotations allowed and no disassembly of the pieces themselves.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eAre rotations allowed?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eYes. Rotating pieces is part of the intended solution, not a workaround.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eCan I take the pieces apart?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. The pieces are meant to stay intact - disassembling them is not part of the solution.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed Microma?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eAndreas Röver. Microma was his exchange puzzle at the 2026 International Puzzle Party in Assisi, Italy.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51349310636199,"sku":"GP-MICR","price":21.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/microma_marble.png?v=1789665715"},{"product_id":"zigzag","title":"ZigZag | The First Separated Board Burr","description":"\u003ch2\u003eZigZag - Quick Summary\u003c\/h2\u003e\n\u003cp\u003eZigZag is the first separated board burr ever built, designed by Frans de Vreugd in 2002 from an idea by Jim Gooch. Six flat boards, level 7.8: seven moves to split the puzzle into two identical halves, then eight more to free a board from each half. Hard difficulty, 1-4 hour solve time. Ships disassembled.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e burr collectors who want the puzzle that started a whole family of designs, and solvers stepping up from standard six-piece burrs into board burrs for the first time.\u003c\/p\u003e\n\u003ch2\u003eIt Started With One Sentence\u003c\/h2\u003e\n\u003cp\u003eA standard six board burr has six flat pieces grouped in three pairs. Jim Gooch, a puzzle maker from Oregon, suggested to Frans de Vreugd that you could pull the two boards in each pair one unit apart and see what happened. The shape that came back was more open, with far more room for complicated movement, and nobody knew whether a working set of pieces even existed.\u003c\/p\u003e\n\u003cp\u003eDe Vreugd spent a full day on it. Hundreds of combinations came apart into nothing. Then he tried two zigzag-shaped boards, and this puzzle fell out of it. George Miller had a small run made within days, and it was introduced at the fifth Gathering for Gardner in Atlanta.\u003c\/p\u003e\n\u003ch2\u003eSeven Moves, Then It Splits\u003c\/h2\u003e\n\u003cp\u003eThe piece set is completely symmetrical, and so is the solution. Seven moves in, the whole lattice comes apart into two identical halves. Then you need another eight to get a board out of each half.\u003c\/p\u003e\n\u003cp\u003eThat symmetry is why ZigZag is the right place to start with this family. There is a logic you can actually see once you find it, which is not something you can say about \u003ca href=\"\/products\/torture\"\u003eTorture\u003c\/a\u003e or \u003ca href=\"\/products\/extreme-torture\"\u003eExtreme Torture\u003c\/a\u003e. It is also not the only way through - there is a shorter route and a couple of longer ones - so the puzzle forgives you a little.\u003c\/p\u003e\n\u003cp\u003eOurs is printed in two colours, which makes it much easier to keep track of which board you just moved.\u003c\/p\u003e\n\u003ch2\u003eIt Arrives in Pieces\u003c\/h2\u003e\n\u003cp\u003eSix loose boards, no solved reference to copy and no photograph to work backwards from. Assembly is the puzzle. Handing it over already built would remove the point of it.\u003c\/p\u003e\n\u003cp\u003eIf you already know you want the whole family, ZigZag, Torture and Extreme Torture are sold together as the \u003ca href=\"\/products\/separated-board-burr-set\"\u003eSeparated Board Burr Set\u003c\/a\u003e.\u003c\/p\u003e\n\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\n\u003ch3\u003eWhat is a separated board burr?\u003c\/h3\u003e\n\u003cp\u003eA standard six board burr has six flat pieces in three pairs. In a separated board burr the two boards in each pair sit one unit apart instead of flush together. The gap opens the shape up and leaves room for far longer move sequences. Jim Gooch suggested the idea in 2002, Frans de Vreugd designed the puzzles that came out of it.\u003c\/p\u003e\n\u003ch3\u003eHow hard is ZigZag?\u003c\/h3\u003e\n\u003cp\u003eHard, not Expert. Seven moves to split it and eight more after that, with a symmetry you can lean on. It is the gentlest of de Vreugd's three separated board burrs, and the one to own first.\u003c\/p\u003e\n\u003ch3\u003eDoes ZigZag arrive assembled?\u003c\/h3\u003e\n\u003cp\u003eNo. It ships as six separate boards. Assembling it is the challenge.\u003c\/p\u003e\n\u003ch3\u003eWho designed ZigZag?\u003c\/h3\u003e\n\u003cp\u003eFrans de Vreugd, in 2002, from a suggestion by Jim Gooch. The original run was made by George Miller for the fifth Gathering for Gardner.\u003c\/p\u003e\n\u003cdiv class=\"gpbr\" data-handle=\"zigzag\"\u003e\n\u003cstyle\u003e\n.gpbr{--gpbr-fg:rgb(var(--color-foreground,18,18,18));\n --gpbr-line:rgba(var(--color-foreground,18,18,18),.18);\n --gpbr-muted:rgba(var(--color-foreground,18,18,18),.72);\n --gpbr-accent:#02A9F7;\n font-family:inherit;color:var(--gpbr-fg);margin:1.2em 0;max-width:32em}\n.gpbr *{box-sizing:border-box}\n.gpbr .gpbr-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;text-transform:none;margin:0 0 .3em;color:var(--gpbr-fg)}\n.gpbr .gpbr-goal{font-size:1em;line-height:1.4;font-weight:600;margin:0 0 .2em;color:var(--gpbr-fg)}\n.gpbr .gpbr-rule{font-size:.86em;line-height:1.45;margin:0 0 .75em;color:var(--gpbr-muted);max-width:36em}\n.gpbr .gpbr-stage{display:flex;flex-direction:column;gap:.5em;direction:ltr}\n.gpbr .gpbr-view{position:relative;width:100%;border-radius:8px;overflow:hidden;\n background:radial-gradient(ellipse at 50% 42%,#FFFFFF 0%,#F3F2EE 70%,#ECEAE4 100%);border:1px solid var(--gpbr-line)}\n.gpbr canvas.gpbr-cv{display:block;width:100%;height:auto;aspect-ratio:1\/0.8;touch-action:pan-y;cursor:grab;\n -webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none}\n.gpbr canvas.gpbr-cv:active{cursor:grabbing}\n.gpbr[data-play=\"1\"] canvas.gpbr-cv{touch-action:none}\n.gpbr .gpbr-veil{position:absolute;left:0;right:0;bottom:.8em;display:flex;justify-content:center;pointer-events:none;\n opacity:1;transition:opacity .25s}\n.gpbr[data-play=\"1\"] .gpbr-veil{opacity:0}\n.gpbr .gpbr-veil-t{font-size:.85em;line-height:1.2;font-weight:600;color:var(--gpbr-fg);padding:.5em 1em;border-radius:999px;\n background:rgba(255,255,255,.88);border:1px solid var(--gpbr-line);box-shadow:0 1px 3px rgba(0,0,0,.08)}\n.gpbr .gpbr-tray{display:flex;flex-wrap:wrap;align-items:center;gap:.4em;min-height:3.6em;padding:.35em .5em;\n border-radius:8px;border:1px dashed var(--gpbr-line)}\n.gpbr .gpbr-tray-h{font-size:.75em;line-height:1;color:var(--gpbr-muted);margin-inline-end:.3em}\n.gpbr button.gpbr-slot{position:relative;appearance:none;-webkit-appearance:none;margin:0;padding:0;width:3.4em;height:3.4em;\n border:1px solid var(--gpbr-line);border-radius:7px;background:#FAFAF8;cursor:pointer;box-shadow:none;\n -webkit-tap-highlight-color:transparent}\n.gpbr button.gpbr-slot[hidden]{display:none}\n.gpbr button.gpbr-slot:hover{border-color:var(--gpbr-accent)}\n.gpbr button.gpbr-slot:disabled{opacity:.5;cursor:default}\n.gpbr canvas.gpbr-thumb{display:block;width:100%;height:100%;pointer-events:none}\n.gpbr .gpbr-num{position:absolute;top:.15em;left:.3em;font-size:.68em;line-height:1;font-weight:600;color:var(--gpbr-muted);pointer-events:none}\n.gpbr .gpbr-ctl{display:flex;flex-wrap:wrap;align-items:center;gap:.6em 1em;margin-top:.6em;direction:ltr}\n.gpbr .gpbr-pad{position:relative;width:9.6em;height:9.6em;flex:none;border-radius:50%;background:rgba(var(--color-foreground,18,18,18),.035)}\n.gpbr button.gpbr-mv{position:absolute;appearance:none;-webkit-appearance:none;margin:0;padding:.45em;width:2.9em;height:2.9em;\n border:2px solid;border-radius:50%;background:#fff;cursor:pointer;box-shadow:0 1px 2px rgba(0,0,0,.12);\n -webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:left .12s,top .12s}\n.gpbr button.gpbr-mv svg{display:block;pointer-events:none}\n.gpbr button.gpbr-mv[aria-disabled=\"true\"]{opacity:.55}\n.gpbr button.gpbr-mv:disabled{opacity:.3;cursor:default}\n.gpbr .gpbr-side{display:flex;flex-wrap:wrap;gap:.45em;flex:1 1 9em;align-content:center}\n.gpbr .gpbr-side button,.gpbr .gpbr-bar button,.gpbr button.gpbr-tog{appearance:none;-webkit-appearance:none;margin:0;border:1px solid var(--gpbr-line);\n background:transparent;color:var(--gpbr-fg);font-family:inherit;font-size:.85em;line-height:1.2;\n letter-spacing:normal;text-transform:none;min-height:2.9em;padding:.6em .9em;border-radius:6px;\n cursor:pointer;box-shadow:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}\n.gpbr .gpbr-side button{flex:1 1 4.2em;padding:.6em .4em;white-space:nowrap}\n.gpbr .gpbr-side button:hover,.gpbr .gpbr-bar button:hover,.gpbr button.gpbr-tog:hover{border-color:var(--gpbr-accent)}\n.gpbr .gpbr-side button:disabled,.gpbr .gpbr-bar button:disabled{opacity:.38;cursor:default}\n.gpbr .gpbr-side button:disabled:hover,.gpbr .gpbr-bar button:disabled:hover{border-color:var(--gpbr-line)}\n.gpbr .gpbr-sayrow{display:flex;flex-wrap:wrap;align-items:center;gap:.4em .8em;margin:.6em 0 0;min-height:1.45em}\n.gpbr .gpbr-say{flex:1 1 14em;font-size:.88em;line-height:1.45;color:var(--gpbr-muted);min-height:1.45em;margin:0}\n.gpbr button.gpbr-tog{border-color:var(--gpbr-accent);font-weight:600}\n.gpbr button.gpbr-tog[hidden]{display:none}\n.gpbr .gpbr-win{font-size:.98em;line-height:1.45;font-weight:600;color:var(--gpbr-fg);margin:.5em 0 0;\n padding:.55em .8em;border-radius:6px;background:#E8F7FD;border-inline-start:3px solid var(--gpbr-accent)}\n.gpbr .gpbr-win[hidden]{display:none}\n.gpbr .gpbr-bar{display:flex;flex-wrap:wrap;align-items:center;gap:.45em;margin-top:.75em}\n.gpbr .gpbr-stat{display:flex;flex-direction:column;gap:.1em;margin-inline-end:auto}\n.gpbr .gpbr-count{font-size:.95em;line-height:1.2;font-weight:600;font-variant-numeric:tabular-nums;color:var(--gpbr-fg)}\n.gpbr .gpbr-free{font-size:.8em;line-height:1.25;font-weight:400;color:var(--gpbr-muted)}\n.gpbr .gpbr-lock{display:flex;flex-wrap:wrap;align-items:center;gap:.6em .9em;margin-top:.75em;\n padding:.8em .9em;border-radius:7px;background:#E8F7FD;border:1px solid rgba(2,169,247,.35)}\n.gpbr .gpbr-lock[hidden]{display:none}\n.gpbr .gpbr-lock-line{flex:1 1 12em;margin:0;font-size:.95em;line-height:1.4;font-weight:600;color:var(--gpbr-fg)}\n.gpbr a.gpbr-buy,.gpbr a.gpbr-buy:visited{display:inline-block;flex:none;padding:.7em 1.2em;border-radius:6px;\n background:var(--gpbr-accent);color:#121212;font-family:inherit;font-size:.92em;line-height:1.2;font-weight:600;\n letter-spacing:normal;text-decoration:none;text-transform:none;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.gpbr a.gpbr-buy:hover{background:#2BB8F8;color:#121212;text-decoration:none}\n.gpbr .gpbr-credit{font-size:.72em;line-height:1.4;color:var(--gpbr-muted);margin:.9em 0 0;opacity:.85}\n@media (min-width:600px){\n .gpbr .gpbr-stage{flex-direction:row;align-items:stretch}\n .gpbr .gpbr-view{flex:1 1 auto;min-width:0}\n .gpbr .gpbr-tray{flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;width:4.6em;flex:none;padding:.5em .4em}\n .gpbr .gpbr-tray-h{margin:0 0 .2em}\n}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n(function () {\n\"use strict\";\nif (window.GPBR_ENGINE) return;\nvar DIRS = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]];\nvar FAR = 6;\nfunction det(m) {\nreturn m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -\nm[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) +\nm[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);\n}\nvar ROTS = [];\n(function () {\nvar perms = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]];\nfor (var p = 0; p \u003c 6; p++) {\nfor (var s = 0; s \u003c 8; s++) {\nvar m = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\nfor (var r = 0; r \u003c 3; r++) m[r][perms[p][r]] = (s \u003e\u003e r \u0026 1) ? -1 : 1;\nif (det(m) === 1) ROTS.push(m);\n}\n}\n})();\nfunction mmul(a, b) {\nvar o = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\nfor (var r = 0; r \u003c 3; r++) for (var c = 0; c \u003c 3; c++)\nfor (var k = 0; k \u003c 3; k++) o[r][c] += a[r][k] * b[k][c];\nreturn o;\n}\nfunction rotIndex(m) {\nfor (var i = 0; i \u003c ROTS.length; i++) {\nvar R = ROTS[i], same = true;\nfor (var r = 0; r \u003c 3 \u0026\u0026 same; r++) for (var c = 0; c \u003c 3; c++) if (R[r][c] !== m[r][c]) { same = false; break; }\nif (same) return i;\n}\nreturn -1;\n}\nvar MUL = ROTS.map(function (a) { return ROTS.map(function (b) { return rotIndex(mmul(a, b)); }); });\nvar QT = [rotIndex([[1, 0, 0], [0, 0, -1], [0, 1, 0]]),\nrotIndex([[0, 0, 1], [0, 1, 0], [-1, 0, 0]]),\nrotIndex([[0, -1, 0], [1, 0, 0], [0, 0, 1]])];\nvar ID = rotIndex([[1, 0, 0], [0, 1, 0], [0, 0, 1]]);\nfunction dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; }\nfunction key(x, y, z) { return ((x + 512) * 1024 + (y + 512)) * 1024 + (z + 512); }\nfunction axisOf(d) { return d[0] ? 0 : d[1] ? 1 : 2; }\nfunction signOf(d) { return d[0] + d[1] + d[2]; }\nfunction gaps(a, b) {\nvar g = [];\nfor (var k = 0; k \u003c 3; k++) g.push(Math.max(a.lo[k] - b.hi[k] - 1, b.lo[k] - a.hi[k] - 1));\nreturn g;\n}\nfunction Game(C) {\nthis.C = C;\nthis.n = C.pieces.length;\nthis.shapes = {};\nthis.reset();\n}\nvar G = Game.prototype;\nG.reset = function () {\nthis.P = [];\nfor (var i = 0; i \u003c this.n; i++) this.P.push({ on: false, r: ID, p: [0, 0, 0] });\nthis.moves = 0;\nthis.hist = [];\n};\nG.snap = function () {\nreturn { P: this.P.map(function (q) { return { on: q.on, r: q.r, p: q.p.slice() }; }), moves: this.moves };\n};\nG.save = function () { this.hist.push(this.snap()); };\nG.canUndo = function () { return this.hist.length \u003e 0; };\nG.undo = function () {\nvar s = this.hist.pop();\nif (!s) return false;\nthis.P = s.P;\nreturn true;\n};\nG.shape = function (i, r) {\nvar k = i + \"\/\" + r, sh = this.shapes[k];\nif (sh) return sh;\nvar R = ROTS[r], cs = this.C.pieces[i], out = [], lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9];\nfor (var j = 0; j \u003c cs.length; j++) {\nvar c = cs[j], v = [0, 0, 0];\nfor (var a = 0; a \u003c 3; a++) {\nv[a] = R[a][0] * c[0] + R[a][1] * c[1] + R[a][2] * c[2];\nif (v[a] \u003c lo[a]) lo[a] = v[a];\nif (v[a] \u003e hi[a]) hi[a] = v[a];\n}\nout.push(v);\n}\nfor (j = 0; j \u003c out.length; j++) for (a = 0; a \u003c 3; a++) out[j][a] -= lo[a];\nsh = { c: out, s: [hi[0] - lo[0] + 1, hi[1] - lo[1] + 1, hi[2] - lo[2] + 1] };\nthis.shapes[k] = sh;\nreturn sh;\n};\nG.cells = function (i) {\nvar q = this.P[i], sh = this.shape(i, q.r);\nreturn sh.c.map(function (c) { return [c[0] + q.p[0], c[1] + q.p[1], c[2] + q.p[2]]; });\n};\nG.box = function (i) {\nvar q = this.P[i], s = this.shape(i, q.r).s;\nreturn { lo: q.p.slice(), hi: [q.p[0] + s[0] - 1, q.p[1] + s[1] - 1, q.p[2] + s[2] - 1] };\n};\nG.boxOf = function (list) {\nvar lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9];\nfor (var j = 0; j \u003c list.length; j++) {\nvar b = this.box(list[j]);\nfor (var a = 0; a \u003c 3; a++) {\nif (b.lo[a] \u003c lo[a]) lo[a] = b.lo[a];\nif (b.hi[a] \u003e hi[a]) hi[a] = b.hi[a];\n}\n}\nreturn { lo: lo, hi: hi };\n};\nG.inPlay = function () {\nvar o = [];\nfor (var i = 0; i \u003c this.n; i++) if (this.P[i].on) o.push(i);\nreturn o;\n};\nG.occ = function (skip) {\nvar m = {};\nfor (var i = 0; i \u003c this.n; i++) {\nif (!this.P[i].on || (skip \u0026\u0026 skip[i])) continue;\nvar cs = this.cells(i);\nfor (var j = 0; j \u003c cs.length; j++) m[key(cs[j][0], cs[j][1], cs[j][2])] = i;\n}\nreturn m;\n};\nG.blockers = function (group, d) {\nvar inG = {}, j;\nfor (j = 0; j \u003c group.length; j++) inG[group[j]] = 1;\nvar occ = this.occ(inG), hit = {}, out = [];\nfor (j = 0; j \u003c group.length; j++) {\nvar cs = this.cells(group[j]);\nfor (var k = 0; k \u003c cs.length; k++) {\nvar o = occ[key(cs[k][0] + d[0], cs[k][1] + d[1], cs[k][2] + d[2])];\nif (o !== undefined \u0026\u0026 !hit[o]) { hit[o] = 1; out.push(o); }\n}\n}\nreturn out.sort(function (a, b) { return a - b; });\n};\nG.closure = function (i, d) {\nvar g = [i];\nfor (;;) {\nvar b = this.blockers(g, d);\nif (!b.length) return g.sort(function (a, c) { return a - c; });\ng = g.concat(b);\n}\n};\nG.clearWay = function (i, mine) {\nvar on = this.inPlay(), others = [], k, j;\nmine = mine || this.cells(i);\nfor (k = 0; k \u003c on.length; k++) if (on[k] !== i) {\nvar cs = this.cells(on[k]);\nfor (j = 0; j \u003c cs.length; j++) others.push(cs[j]);\n}\nif (!others.length) return 1;\nfor (var di = 0; di \u003c 6; di++) {\nvar d = DIRS[di], a = axisOf(d), s = signOf(d), free = true;\nfor (j = 0; j \u003c mine.length \u0026\u0026 free; j++) {\nvar c = mine[j];\nfor (k = 0; k \u003c others.length; k++) {\nvar o = others[k], same = true;\nfor (var b = 0; b \u003c 3; b++) if (b !== a \u0026\u0026 o[b] !== c[b]) { same = false; break; }\nif (same \u0026\u0026 (o[a] - c[a]) * s \u003e 0) { free = false; break; }\n}\n}\nif (free) return di + 1;\n}\nreturn 0;\n};\nG.hits = function (i, cells) {\nvar occ = this.occ(null);\nfor (var j = 0; j \u003c cells.length; j++) {\nvar o = occ[key(cells[j][0], cells[j][1], cells[j][2])];\nif (o !== undefined \u0026\u0026 o !== i) return true;\n}\nreturn false;\n};\nG.place = function (i, r, p) {\nreturn this.shape(i, r).c.map(function (c) { return [c[0] + p[0], c[1] + p[1], c[2] + p[2]]; });\n};\nG.spawn = function (i, side) {\nvar q = this.P[i];\nif (q.on) return { ok: false, why: \"on\" };\nvar sh = this.shape(i, q.r), on = this.inPlay(), p = [0, 0, 0];\nif (!on.length) {\nfor (var a = 0; a \u003c 3; a++) p[a] = -Math.floor(sh.s[a] \/ 2);\n} else {\nvar O = this.boxOf(on), d = DIRS[side], ax = axisOf(d);\nfor (a = 0; a \u003c 3; a++) {\nif (a === ax) continue;\np[a] = Math.floor((O.lo[a] + O.hi[a] + 1 - sh.s[a]) \/ 2);\n}\np[ax] = signOf(d) \u003e 0 ? O.hi[ax] + 2 : O.lo[ax] - 1 - sh.s[ax];\n}\nreturn this.spawnAt(i, q.r, p);\n};\nG.spawnAt = function (i, r, p) {\nvar q = this.P[i];\nif (q.on || r \u003c 0 || r \u003e= 24) return { ok: false, why: \"on\" };\nvar cells = this.place(i, r, p);\nif (this.hits(i, cells) || !this.clearWay(i, cells)) return { ok: false, why: \"inside\" };\nthis.save();\nthis.P[i] = { on: true, r: r, p: p.slice() };\nreturn { ok: true, i: i };\n};\nG.slide = function (i, di) {\nvar q = this.P[i], d = DIRS[di];\nif (!q || !q.on) return { ok: false, why: \"pick\" };\nvar on = this.inPlay();\nif (on.length \u003c 2) return { ok: false, why: \"alone\" };\nvar by = this.blockers([i], d);\nif (by.length) {\nvar g = this.closure(i, d);\nreturn { ok: false, why: \"blocked\", by: by, group: g.length \u003c on.length ? g : null };\n}\nvar others = on.filter(function (j) { return j !== i; });\nvar O = this.boxOf(others), before = gaps(this.box(i), O);\nthis.save();\nq.p = [q.p[0] + d[0], q.p[1] + d[1], q.p[2] + d[2]];\nthis.moves++;\nvar after = gaps(this.box(i), O), ax = axisOf(d), res = { ok: true, moved: [i], d: di };\nif (after[ax] \u003e FAR \u0026\u0026 after[ax] \u003e before[ax]) {\nq.on = false;\nres.out = i;\n}\nreturn res;\n};\nG.slideGroup = function (group, di) {\nvar d = DIRS[di], on = this.inPlay(), j;\nif (!group.length || group.length \u003e= on.length) return { ok: false, why: \"all\" };\nfor (j = 0; j \u003c group.length; j++) if (!this.P[group[j]].on) return { ok: false, why: \"pick\" };\nvar by = this.blockers(group, d);\nif (by.length) return { ok: false, why: \"blocked\", by: by, group: null };\nvar inG = {};\nfor (j = 0; j \u003c group.length; j++) inG[group[j]] = 1;\nvar rest = on.filter(function (k) { return !inG[k]; });\nvar O = this.boxOf(rest), B = this.boxOf(group), ax = axisOf(d), before = gaps(B, O);\nvar after = gaps({ lo: [B.lo[0] + d[0], B.lo[1] + d[1], B.lo[2] + d[2]], hi: [B.hi[0] + d[0], B.hi[1] + d[1], B.hi[2] + d[2]] }, O);\nif (after[ax] \u003e FAR \u0026\u0026 after[ax] \u003e before[ax]) return { ok: false, why: \"far\" };\nthis.save();\nfor (j = 0; j \u003c group.length; j++) {\nvar q = this.P[group[j]];\nq.p = [q.p[0] + d[0], q.p[1] + d[1], q.p[2] + d[2]];\n}\nthis.moves++;\nreturn { ok: true, moved: group.slice(), d: di };\n};\nG.free = function (i) {\nvar q = this.P[i];\nreturn !!(q \u0026\u0026 q.on \u0026\u0026 this.clearWay(i));\n};\nG.turn = function (i, ax, back) {\nif (!this.free(i)) return { ok: false, why: \"turn\" };\nvar q = this.P[i], old = this.box(i);\nvar Q = QT[ax];\nif (back) Q = MUL[Q][MUL[Q][Q]];\nvar r = MUL[Q][q.r], s = this.shape(i, r).s, p0 = [0, 0, 0], a;\nfor (a = 0; a \u003c 3; a++) p0[a] = Math.floor((old.lo[a] + old.hi[a] + 1 - s[a]) \/ 2);\nvar on = this.inPlay(), mid = [0, 0, 0], self = this;\nif (on.length \u003e 1) {\nvar O = this.boxOf(on.filter(function (j) { return j !== i; }));\nfor (a = 0; a \u003c 3; a++) mid[a] = (O.lo[a] + O.hi[a] + 1) \/ 2 - (old.lo[a] + old.hi[a] + 1) \/ 2;\n}\nvar order = [0, 1, 2, 3, 4, 5].sort(function (x, y) { return dot(DIRS[x], mid) - dot(DIRS[y], mid); });\nvar tries = [p0];\nfor (var k = 1; k \u003c= 8; k++) order.forEach(function (di) {\nvar d = DIRS[di];\ntries.push([p0[0] + d[0] * k, p0[1] + d[1] * k, p0[2] + d[2] * k]);\n});\nfor (var t = 0; t \u003c tries.length; t++) {\nvar cells = self.place(i, r, tries[t]);\nif (self.hits(i, cells) || !self.clearWay(i, cells)) continue;\nthis.save();\nq.r = r;\nq.p = tries[t];\nreturn { ok: true };\n}\nreturn { ok: false, why: \"room\" };\n};\nG.toTray = function (i) {\nvar q = this.P[i];\nif (!q || !q.on) return { ok: false, why: \"pick\" };\nif (this.inPlay().length \u003e 1 \u0026\u0026 !this.clearWay(i)) return { ok: false, why: \"stuck\" };\nthis.save();\nq.on = false;\nreturn { ok: true, out: i };\n};\nG.won = function () {\nvar on = this.inPlay(), gl = this.C.goal;\nif (on.length !== this.n) return false;\nvar B = this.boxOf(on), dims = [0, 1, 2].map(function (a) { return B.hi[a] - B.lo[a] + 1; });\nif (gl.type === \"box\") {\nvar num = function (x, y) { return x - y; };\nvar want = gl.size.slice().sort(num), got = dims.slice().sort(num);\nreturn want[0] === got[0] \u0026\u0026 want[1] === got[1] \u0026\u0026 want[2] === got[2];\n}\nif (gl.type === \"slots\") {\nfor (var a = 0; a \u003c 3; a++) if (dims[a] !== gl.span[a]) return false;\nvar self = this;\nreturn [0, 1].some(function (mirror) {\nvar want = {};\ngl.slots.forEach(function (sl) {\nvar c = sl[0], s = sl[1];\nif (mirror) { c = [c[1], c[0], c[2]]; s = [s[1], s[0], s[2]]; }\nwant[c.join(\",\") + \"\/\" + s.join(\",\")] = 1;\n});\nreturn on.every(function (i) {\nvar b = self.box(i), lo = [b.lo[0] - B.lo[0], b.lo[1] - B.lo[1], b.lo[2] - B.lo[2]];\nvar s = [b.hi[0] - b.lo[0] + 1, b.hi[1] - b.lo[1] + 1, b.hi[2] - b.lo[2] + 1];\nreturn want[lo.join(\",\") + \"\/\" + s.join(\",\")] === 1;\n});\n});\n}\nreturn false;\n};\nwindow.GPBR_ENGINE = { Game: Game, DIRS: DIRS, ROTS: ROTS, MUL: MUL, QT: QT, ID: ID, gaps: gaps, v: 1 };\n})();\n(function () {\n\"use strict\";\nif (window.GPBR) return;\nvar E = window.GPBR_ENGINE;\nif (!E) return;\nvar NS = \"http:\/\/www.w3.org\/2000\/svg\";\nvar ACC = \"#02A9F7\", BAD = \"#E0533D\";\nvar AXC = [\"#C8553D\", \"#3E8E5A\", \"#3569B8\"];\nvar DIRS = E.DIRS;\nvar seq = 0;\nvar TXT = {\nen: {\ntitle: \"Try it yourself\", play: \"Tap to play\",\nhow: \"Drag the view to turn it. Tap a piece in the tray to bring it in, tap a piece to pick it, then slide it with the arrows.\",\nmoves: \"Moves: {n}\", undo: \"Undo\", reset: \"Start over\", tray: \"Tray\", toTray: \"To tray\",\nturnY: \"Turn\", turnX: \"Tip\", turnZ: \"Spin\", together: \"Move together\",\nslide: \"Slide\", view: \"Puzzle view, drag to turn\",\nempty: \"Tap a piece in the tray to bring it in.\",\npick: \"Tap a piece first.\",\ninNow: \"{Name} is in. Turn it while it is clear, then slide it.\",\nalone: \"Bring in another piece to slide against.\",\nblocked: \"Blocked by {list}.\",\npush: \"It would push {list} too.\",\npushAll: \"Blocked by {list}. Pushing it would move the whole puzzle.\",\nfar: \"That's as far as it goes.\",\nout: \"{Name} is back in the tray.\",\nnoTurn: \"It's held in place. Slide it clear of the others first, then turn it.\",\nnoRoom: \"No room to turn it here. Slide it further out first.\",\nstuck: \"It can't come out from here yet.\",\nnoun: { block: [\"piece {p}\", \"Piece {p}\", \"pieces {a} and {b}\"], boards: [\"board {p}\", \"Board {p}\", \"boards {a} and {b}\"] }, and: \", \",\nfree: \"{n} free moves left\", freeOne: \"1 free move left\", freeNone: \"No free moves left\",\nlockLine: \"That's the free part. Finish it with the real one.\", buy: \"Add to cart\",\ncredit: \"Moves follow the rules of BurrTools, Andreas Röver's free puzzle program.\",\nblock: { goal: \"Put the five pieces together into one solid block.\",\nrule: \"Pieces only slide in straight lines, and a piece can only be turned while it is clear of the others.\",\nwin: \"Done in {n} moves. The block is complete.\" },\nboards: { goal: \"Fit the six boards together into the finished burr.\",\nrule: \"Boards only slide in straight lines, and a board can only be turned while it is clear of the others.\",\nwin: \"Done in {n} moves. All six boards are in place.\" }\n},\nhe: {\ntitle: \"נסו בעצמכם\", play: \"הקישו כדי לשחק\",\nhow: \"גררו את התצוגה כדי לסובב אותה. הקישו על חלק במגש כדי להכניס אותו, הקישו על חלק כדי לבחור בו, ואז הזיזו אותו עם החצים.\",\nmoves: \"מהלכים: {n}\", undo: \"ביטול מהלך\", reset: \"התחלה מחדש\", tray: \"מגש\", toTray: \"למגש\",\nturnY: \"סיבוב\", turnX: \"הטיה\", turnZ: \"גלגול\", together: \"הזיזו יחד\",\nslide: \"הזזה\", view: \"תצוגת הפאזל, גררו כדי לסובב\",\nempty: \"הקישו על חלק במגש כדי להכניס אותו.\",\npick: \"הקישו קודם על חלק.\",\ninNow: \"{Name} בפנים. סובבו אותו כל עוד הוא רחוק מהאחרים, ואז הזיזו אותו.\",\nalone: \"הכניסו עוד חלק כדי שיהיה מול מה להזיז.\",\nblocked: \"חסום על ידי {list}.\",\npush: \"הוא ידחוף גם את {list}.\",\npushAll: \"חסום על ידי {list}. דחיפה תזיז את כל הפאזל.\",\nfar: \"עד כאן אפשר להרחיק אותו.\",\nout: \"{Name} חזר למגש.\",\nnoTurn: \"הוא תקוע במקומו. הרחיקו אותו קודם מהחלקים האחרים, ואז סובבו אותו.\",\nnoRoom: \"אין כאן מקום לסובב אותו. הרחיקו אותו עוד קודם.\",\nstuck: \"עדיין אי אפשר להוציא אותו מכאן.\",\nnoun: { block: [\"חלק {p}\", \"חלק {p}\", \"חלקים {a} ו-{b}\"], boards: [\"לוח {p}\", \"לוח {p}\", \"לוחות {a} ו-{b}\"] }, and: \", \",\nfree: \"נותרו {n} מהלכים חינם\", freeOne: \"נותר מהלך חינם אחד\", freeNone: \"לא נותרו מהלכים חינם\",\nlockLine: \"זה החלק החינמי. סיימו אותו עם הפאזל האמיתי.\", buy: \"הוספה לעגלה\",\ncredit: \"המהלכים פועלים לפי הכללים של BurrTools, תוכנת הפאזלים החופשית של אנדראס רובר.\",\nblock: { goal: \"חברו את חמשת החלקים לקובייה אחת מלאה.\",\nrule: \"החלקים זזים רק בקווים ישרים, ואפשר לסובב חלק רק כשהוא רחוק מהאחרים.\",\nwin: \"הצלחתם ב-{n} מהלכים. הקובייה שלמה.\" },\nboards: { goal: \"חברו את ששת הלוחות לפאזל השלם.\",\nrule: \"הלוחות זזים רק בקווים ישרים, ואפשר לסובב לוח רק כשהוא רחוק מהאחרים.\",\nwin: \"הצלחתם ב-{n} מהלכים. כל ששת הלוחות במקומם.\" }\n},\nja: {\ntitle: \"試してみてください\", play: \"タップして遊ぶ\",\nhow: \"画面をドラッグすると向きが変わります。トレイのピースをタップして入れ、ピースをタップして選び、矢印でスライドさせてください。\",\nmoves: \"手数：{n}\", undo: \"1手戻す\", reset: \"最初から\", tray: \"トレイ\", toTray: \"トレイへ\",\nturnY: \"回す\", turnX: \"倒す\", turnZ: \"ひねる\", together: \"一緒に動かす\",\nslide: \"スライド\", view: \"パズルの表示（ドラッグで回転）\",\nempty: \"トレイのピースをタップして入れてください。\",\npick: \"まずピースをタップしてください。\",\ninNow: \"{Name}が入りました。離れているうちに向きを変えてから、スライドさせてください。\",\nalone: \"もう1つピースを入れてから動かしてください。\",\nblocked: \"{list}に当たって動けません。\",\npush: \"{list}も一緒に押すことになります。\",\npushAll: \"{list}に当たって動けません。押すとパズル全体が動いてしまいます。\",\nfar: \"これ以上は離せません。\",\nout: \"{Name}がトレイに戻りました。\",\nnoTurn: \"今は固定されています。向きを変えるには、まず他のピースから離してください。\",\nnoRoom: \"ここでは回す場所がありません。もう少し離してください。\",\nstuck: \"ここからはまだ取り出せません。\",\nnoun: { block: [\"ピース{p}\", \"ピース{p}\", \"ピース{a}と{b}\"], boards: [\"板{p}\", \"板{p}\", \"板{a}と{b}\"] }, and: \"、\",\nfree: \"無料であと{n}手\", freeOne: \"無料であと1手\", freeNone: \"無料の手はここまで\",\nlockLine: \"無料で遊べるのはここまでです。続きは本物のパズルでどうぞ。\", buy: \"カートに追加\",\ncredit: \"動きのルールは、Andreas Röver さんの無料パズルソフト BurrTools に従っています。\",\nblock: { goal: \"5つのピースを組み合わせて、すき間のない1つのブロックにしてください。\",\nrule: \"ピースはまっすぐスライドするだけです。向きを変えられるのは、他のピースから離れているときだけです。\",\nwin: \"{n}手で完成！ブロックができあがりました。\" },\nboards: { goal: \"6枚の板を組み合わせて、パズルを完成させてください。\",\nrule: \"板はまっすぐスライドするだけです。向きを変えられるのは、他の板から離れているときだけです。\",\nwin: \"{n}手で完成！6枚の板がすべて収まりました。\" }\n}\n};\nfunction langOf() {\nvar l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\nif (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\nif (l.indexOf(\"ja\") === 0) return \"ja\";\nreturn \"en\";\n}\nfunction fmt(s, o) {\nreturn s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n}\nfunction el(tag, cls, txt) {\nvar e = document.createElement(tag);\nif (cls) e.className = cls;\nif (txt != null) e.textContent = txt;\nreturn e;\n}\nfunction sv(tag, attrs) {\nvar e = document.createElementNS(NS, tag);\nfor (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) e.setAttribute(k, attrs[k]);\nreturn e;\n}\nfunction track(name, handle) {\ntry { if (typeof window.gtag === \"function\") window.gtag(\"event\", name, { product: handle }); } catch (e) {  }\n}\nfunction buyButton(root) {\nvar scopes = [], sec = root.closest ? root.closest(\"section, .shopify-section, product-info\") : null;\nif (sec) scopes.push(sec);\nscopes.push(document);\nfor (var k = 0; k \u003c scopes.length; k++) {\nvar b = scopes[k].querySelector('[id^=\"ProductSubmitButton-\"]');\nif (b \u0026\u0026 !root.contains(b)) return b;\nvar forms = scopes[k].querySelectorAll('form[action*=\"\/cart\/add\"]');\nfor (var i = 0; i \u003c forms.length; i++) {\nif (root.contains(forms[i])) continue;\nvar x = forms[i].querySelector('[type=\"submit\"], button:not([type])');\nif (x) return x;\n}\n}\nreturn null;\n}\nfunction rgb(h) {\nvar n = parseInt(h.slice(1), 16);\nreturn [n \u003e\u003e 16 \u0026 255, n \u003e\u003e 8 \u0026 255, n \u0026 255];\n}\nfunction dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; }\nvar now = (window.performance \u0026\u0026 performance.now) ? function () { return performance.now(); } : function () { return Date.now(); };\nvar CORN = [[0, 0], [1, 0], [1, 1], [0, 1]];\nvar OUTW = [[0, -1], [1, 0], [0, 1], [-1, 0]];\nfunction facesOf(cells) {\nvar has = {}, F = [];\nfunction k(x, y, z) { return x + \",\" + y + \",\" + z; }\ncells.forEach(function (c) { has[k(c[0], c[1], c[2])] = 1; });\ncells.forEach(function (c) {\nfor (var n = 0; n \u003c 6; n++) {\nvar d = DIRS[n];\nif (has[k(c[0] + d[0], c[1] + d[1], c[2] + d[2])]) continue;\nvar a = d[0] ? 0 : d[1] ? 1 : 2, s = d[0] + d[1] + d[2], b = (a + 1) % 3, e = (a + 2) % 3;\nvar pts = CORN.map(function (uv) {\nvar p = [0, 0, 0];\np[a] = c[a] + (s \u003e 0 ? 1 : 0); p[b] = c[b] + uv[0]; p[e] = c[e] + uv[1];\nreturn p;\n});\nvar mask = 0;\nfor (var j = 0; j \u003c 4; j++) {\nvar u = [0, 0, 0];\nu[b] = OUTW[j][0]; u[e] = OUTW[j][1];\nvar m = [c[0] + u[0], c[1] + u[1], c[2] + u[2]];\nvar flat = has[k(m[0], m[1], m[2])] \u0026\u0026 !has[k(m[0] + d[0], m[1] + d[1], m[2] + d[2])];\nif (!flat) mask |= 1 \u003c\u003c j;\n}\nF.push({ n: n, pts: pts, cc: [c[0] + 0.5, c[1] + 0.5, c[2] + 0.5], m: mask });\n}\n});\nreturn F;\n}\nfunction mount(root, C) {\nif (!root || root.getAttribute(\"data-gpbr-on\")) return;\nroot.setAttribute(\"data-gpbr-on\", \"1\");\nvar L = langOf(), t = TXT[L], T = t[C.text] || t.block;\nroot.setAttribute(\"lang\", L);\nroot.setAttribute(\"dir\", L === \"he\" ? \"rtl\" : \"ltr\");\nvar handle = root.getAttribute(\"data-handle\") || \"\";\nvar game = new E.Game(C), n = game.n;\nvar FREE = C.free \u003e 0 ? C.free : Infinity;\nvar COL = (C.colors || []).map(rgb);\nvar yaw = -0.62, pitch = 0.52;\nvar sel = null, pending = null, flash = {}, anim = {}, msg = t.empty, won = false;\nvar faceCache = {};\nvar view = { s: 0, c: [0, 0, 0], ts: 0, tc: [0, 0, 0] };\nvar drawn = [];\nvar dirty = false, raf = 0;\nfunction locked() { return game.moves \u003e= FREE; }\nfunction label(i) { return String(i + 1); }\nvar NOUN = t.noun[C.text] || t.noun.block;\nfunction names(list) {\nif (list.length === 1) return fmt(NOUN[0], { p: label(list[0]) });\nvar head = list.slice(0, -1).map(label).join(t.and);\nreturn fmt(NOUN[2], { a: head, b: label(list[list.length - 1]) });\n}\nfunction Name(i) { return fmt(NOUN[1], { p: label(i) }); }\nroot.appendChild(el(\"h3\", \"gpbr-h\", t.title));\nroot.appendChild(el(\"p\", \"gpbr-goal\", T.goal));\nroot.appendChild(el(\"p\", \"gpbr-rule\", T.rule + (L === \"ja\" ? \"\" : \" \") + t.how));\nvar stage = el(\"div\", \"gpbr-stage\");\nroot.appendChild(stage);\nvar viewEl = el(\"div\", \"gpbr-view\");\nstage.appendChild(viewEl);\nvar cv = el(\"canvas\", \"gpbr-cv\");\ncv.setAttribute(\"role\", \"img\");\ncv.setAttribute(\"aria-label\", t.view);\nviewEl.appendChild(cv);\nvar veil = el(\"div\", \"gpbr-veil\");\nveil.appendChild(el(\"span\", \"gpbr-veil-t\", t.play));\nviewEl.appendChild(veil);\nvar ctx = cv.getContext(\"2d\");\nvar trayEl = el(\"div\", \"gpbr-tray\");\nstage.appendChild(trayEl);\ntrayEl.appendChild(el(\"span\", \"gpbr-tray-h\", t.tray));\nvar slots = [];\nfor (var i = 0; i \u003c n; i++) {\nvar b = el(\"button\", \"gpbr-slot\");\nb.type = \"button\";\nb.setAttribute(\"data-piece\", String(i));\nvar tc = el(\"canvas\", \"gpbr-thumb\");\nb.appendChild(tc);\nb.appendChild(el(\"span\", \"gpbr-num\", label(i)));\ntrayEl.appendChild(b);\nslots.push({ b: b, cv: tc });\n}\nvar ctl = el(\"div\", \"gpbr-ctl\");\nroot.appendChild(ctl);\nvar pad = el(\"div\", \"gpbr-pad\");\nctl.appendChild(pad);\nvar mvb = [];\nDIRS.forEach(function (d, di) {\nvar bt = el(\"button\", \"gpbr-mv\");\nbt.type = \"button\";\nbt.setAttribute(\"data-dir\", String(di));\nvar ax = d[0] ? 0 : d[1] ? 1 : 2;\nbt.style.borderColor = AXC[ax];\nvar svg = sv(\"svg\", { viewBox: \"-12 -12 24 24\", width: \"100%\", height: \"100%\", \"aria-hidden\": \"true\", focusable: \"false\" });\nvar g = sv(\"g\", {});\ng.appendChild(sv(\"path\", { d: \"M-7 0H6M1-5L6 0L1 5\", fill: \"none\", stroke: AXC[ax], \"stroke-width\": \"2.6\", \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\" }));\nsvg.appendChild(g);\nvar mark = sv(\"circle\", { cx: \"0\", cy: \"0\", r: \"3.2\", fill: AXC[ax] });\nsvg.appendChild(mark);\nbt.appendChild(svg);\npad.appendChild(bt);\nmvb.push({ b: bt, g: g, mark: mark, ax: ax });\n});\nvar side = el(\"div\", \"gpbr-side\");\nctl.appendChild(side);\nfunction sideBtn(txt, cls) {\nvar bt = el(\"button\", \"gpbr-sb \" + cls, txt);\nbt.type = \"button\";\nside.appendChild(bt);\nreturn bt;\n}\nvar bTurnY = sideBtn(t.turnY, \"gpbr-turn\");\nvar bTurnX = sideBtn(t.turnX, \"gpbr-turn\");\nvar bTurnZ = sideBtn(t.turnZ, \"gpbr-turn\");\nvar bTray = sideBtn(t.toTray, \"gpbr-out\");\nvar sayRow = el(\"div\", \"gpbr-sayrow\");\nroot.appendChild(sayRow);\nvar sayEl = el(\"p\", \"gpbr-say\", \"\");\nsayEl.setAttribute(\"aria-live\", \"polite\");\nsayRow.appendChild(sayEl);\nvar bTog = el(\"button\", \"gpbr-tog\", t.together);\nbTog.type = \"button\";\nbTog.hidden = true;\nsayRow.appendChild(bTog);\nvar winEl = el(\"p\", \"gpbr-win\", \"\");\nwinEl.hidden = true;\nwinEl.setAttribute(\"aria-live\", \"polite\");\nroot.appendChild(winEl);\nvar bar = el(\"div\", \"gpbr-bar\");\nroot.appendChild(bar);\nvar stat = el(\"div\", \"gpbr-stat\");\nbar.appendChild(stat);\nvar countEl = el(\"span\", \"gpbr-count\", \"\");\nstat.appendChild(countEl);\nvar freeEl = el(\"span\", \"gpbr-free\", \"\");\nif (FREE !== Infinity) stat.appendChild(freeEl);\nvar bUndo = el(\"button\", \"\", t.undo);\nbUndo.type = \"button\";\nbar.appendChild(bUndo);\nvar bReset = el(\"button\", \"\", t.reset);\nbReset.type = \"button\";\nbar.appendChild(bReset);\nvar lockEl = el(\"div\", \"gpbr-lock\");\nlockEl.hidden = true;\nlockEl.setAttribute(\"aria-live\", \"polite\");\nlockEl.appendChild(el(\"p\", \"gpbr-lock-line\", t.lockLine));\nvar buyEl = el(\"a\", \"gpbr-buy\", t.buy);\nbuyEl.setAttribute(\"href\", \"\/products\/\" + handle);\nbuyEl.setAttribute(\"role\", \"button\");\nlockEl.appendChild(buyEl);\nroot.appendChild(lockEl);\nroot.appendChild(el(\"p\", \"gpbr-credit\", t.credit));\nfunction basis() {\nvar cy = Math.cos(yaw), sy = Math.sin(yaw), cp = Math.cos(pitch), sp = Math.sin(pitch);\nreturn { X: [cy, -sy, 0], Y: [sp * sy, sp * cy, cp], D: [cp * sy, cp * cy, -sp] };\n}\nvar LIGHT = [-0.42, 0.74, -0.52];\nfunction faces(i, r) {\nvar k = i + \"\/\" + r;\nif (!faceCache[k]) faceCache[k] = facesOf(game.shape(i, r).c);\nreturn faceCache[k];\n}\nfunction offsetOf(i, tnow) {\nvar q = game.P[i], o = [q.p[0], q.p[1], q.p[2]], a = anim[i];\nif (a) {\nvar e = Math.min(1, (tnow - a.t0) \/ a.ms);\nif (e \u003e= 1) delete anim[i];\nelse {\nvar f = 1 - (1 - e) * (1 - e);\nfor (var k = 0; k \u003c 3; k++) o[k] += a.v[k] * (1 - f);\n}\n}\nreturn o;\n}\nfunction table() { return !game.inPlay().length; }\nfunction scene(tnow) {\nvar on = game.inPlay(), list = [], lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9], k;\nif (on.length) {\non.forEach(function (i) { list.push({ i: i, r: game.P[i].r, off: tnow == null ? game.P[i].p.slice() : offsetOf(i, tnow) }); });\n} else {\nvar sp = 0, cols = n \u003c= 4 ? 2 : 3;\nfor (k = 0; k \u003c n; k++) { var s0 = game.shape(k, game.P[k].r).s; sp = Math.max(sp, s0[0], s0[1], s0[2]); }\nsp += 2;\nfor (k = 0; k \u003c n; k++) {\nvar sz = game.shape(k, game.P[k].r).s, col = k % cols, row = Math.floor(k \/ cols);\nlist.push({ i: k, r: game.P[k].r, off: [Math.round(col * sp - sz[0] \/ 2), Math.round(-row * sp - sz[1] \/ 2), Math.round(-sz[2] \/ 2)] });\n}\n}\nlist.forEach(function (it) {\nvar s1 = game.shape(it.i, it.r).s;\nfor (var a = 0; a \u003c 3; a++) {\nlo[a] = Math.min(lo[a], it.off[a]);\nhi[a] = Math.max(hi[a], it.off[a] + s1[a] - 1);\n}\n});\nreturn { list: list, lo: lo, hi: hi };\n}\nvar lastTable = null;\nfunction fitTarget() {\nvar B = scene(null), c = [], r2 = 0;\nif (!B.list.length) return;\nif (lastTable !== table()) { lastTable = table(); view.s = 0; }\nfor (var k = 0; k \u003c 3; k++) {\nc.push((B.lo[k] + B.hi[k] + 1) \/ 2);\nvar h = (B.hi[k] - B.lo[k] + 1) \/ 2;\nr2 += h * h;\n}\nvar r = Math.sqrt(r2) + 0.35, W = cv.clientWidth || 300, H = cv.clientHeight || 260;\nview.ts = Math.min(W, H) \/ (2 * r);\nview.tc = c;\nif (!view.s) { view.s = view.ts; view.c = c.slice(); }\n}\nfunction shade(rgbv, f) {\nreturn \"rgb(\" + Math.round(rgbv[0] * f) + \",\" + Math.round(rgbv[1] * f) + \",\" + Math.round(rgbv[2] * f) + \")\";\n}\nfunction paint(g2, list, B, s, c, W, H, dpr, pick) {\nvar items = [];\nlist.forEach(function (it) {\nvar F = faces(it.i, it.r), col = COL[it.i % COL.length] || [200, 200, 200];\nfor (var j = 0; j \u003c F.length; j++) {\nvar f = F[j], nd = DIRS[f.n];\nvar nz = dot(nd, B.D);\nif (nz \u003e -1e-6) continue;\nvar pts = [];\nfor (var k = 0; k \u003c 4; k++) {\nvar p = [f.pts[k][0] + it.off[0] - c[0], f.pts[k][1] + it.off[1] - c[1], f.pts[k][2] + it.off[2] - c[2]];\npts.push([W \/ 2 + s * dot(p, B.X), H \/ 2 - s * dot(p, B.Y)]);\n}\nvar cc = [f.cc[0] + it.off[0], f.cc[1] + it.off[1], f.cc[2] + it.off[2]];\nvar fc = [cc[0] + nd[0] * 0.5, cc[1] + nd[1] * 0.5, cc[2] + nd[2] * 0.5];\nvar nv = [dot(nd, B.X), dot(nd, B.Y), nz];\nvar lum = 0.6 + 0.4 * Math.max(0, dot(nv, LIGHT));\nitems.push({ i: it.i, pts: pts, m: f.m, z: dot(cc, B.D), z2: dot(fc, B.D), fill: shade(col, lum) });\n}\n});\nitems.sort(function (a, b) { return (b.z - a.z) || (b.z2 - a.z2); });\ng2.lineJoin = \"round\";\ng2.lineCap = \"round\";\nfor (var q = 0; q \u003c items.length; q++) {\nvar it = items[q], P = it.pts;\nvar mx = (P[0][0] + P[1][0] + P[2][0] + P[3][0]) \/ 4, my = (P[0][1] + P[1][1] + P[2][1] + P[3][1]) \/ 4;\ng2.beginPath();\nfor (var k2 = 0; k2 \u003c 4; k2++) {\nvar ex = P[k2][0] - mx, ey = P[k2][1] - my, el2 = Math.sqrt(ex * ex + ey * ey) || 1;\nvar gx = P[k2][0] + ex \/ el2 * 0.6, gy = P[k2][1] + ey \/ el2 * 0.6;\nif (k2) g2.lineTo(gx, gy); else g2.moveTo(gx, gy);\n}\ng2.closePath();\ng2.fillStyle = it.fill;\ng2.fill();\nvar hot = pick \u0026\u0026 (it.i === sel ? ACC : flash[it.i] ? BAD : null);\ng2.strokeStyle = hot || \"rgba(30,30,30,.55)\";\ng2.lineWidth = (hot ? 2.2 : 1) * dpr;\ng2.beginPath();\nfor (k2 = 0; k2 \u003c 4; k2++) {\nif (!(it.m \u003e\u003e k2 \u0026 1)) continue;\ng2.moveTo(P[k2][0], P[k2][1]);\ng2.lineTo(P[(k2 + 1) % 4][0], P[(k2 + 1) % 4][1]);\n}\ng2.stroke();\n}\nreturn items;\n}\nfunction size() {\nvar dpr = Math.min(window.devicePixelRatio || 1, 2.5);\nvar W = cv.clientWidth, H = cv.clientHeight;\nif (cv.width !== Math.round(W * dpr) || cv.height !== Math.round(H * dpr)) {\ncv.width = Math.round(W * dpr);\ncv.height = Math.round(H * dpr);\n}\nreturn dpr;\n}\nfunction draw() {\nraf = 0;\nvar tnow = now(), dpr = size(), W = cv.width, H = cv.height, B = basis(), more = false;\nfitTarget();\nif (view.s) {\nvar ds = view.ts - view.s;\nview.s += ds * 0.28;\nif (Math.abs(ds) \u003e view.ts * 0.004) more = true; else view.s = view.ts;\nfor (var k = 0; k \u003c 3; k++) {\nvar dc = view.tc[k] - view.c[k];\nview.c[k] += dc * 0.28;\nif (Math.abs(dc) \u003e 0.01) more = true; else view.c[k] = view.tc[k];\n}\n}\nctx.clearRect(0, 0, W, H);\nvar list = scene(tnow).list;\nfor (var a in anim) if (Object.prototype.hasOwnProperty.call(anim, a)) more = true;\nfor (var f in flash) if (Object.prototype.hasOwnProperty.call(flash, f)) {\nif (tnow \u003e flash[f]) delete flash[f]; else more = true;\n}\ndrawn = list.length ? paint(ctx, list, B, view.s * dpr, view.c, W, H, dpr, true) : [];\nif (more) schedule();\n}\nfunction schedule() { if (!raf) raf = (window.requestAnimationFrame || function (cb) { return setTimeout(cb, 16); })(draw); }\nfunction drawTray() {\nvar B = basis(), dpr = Math.min(window.devicePixelRatio || 1, 2.5);\nslots.forEach(function (sl, i) {\nvar q = game.P[i];\nsl.b.hidden = q.on;\nsl.b.disabled = locked() || won;\nif (q.on) return;\nvar W = Math.round((sl.cv.clientWidth || 48) * dpr), H = Math.round((sl.cv.clientHeight || 48) * dpr);\nif (sl.cv.width !== W) sl.cv.width = W;\nif (sl.cv.height !== H) sl.cv.height = H;\nvar g2 = sl.cv.getContext(\"2d\"), s = game.shape(i, q.r).s;\ng2.clearRect(0, 0, W, H);\nvar r = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]) \/ 2 + 0.2;\npaint(g2, [{ i: i, r: q.r, off: [0, 0, 0] }], B, Math.min(W, H) \/ (2 * r), [s[0] \/ 2, s[1] \/ 2, s[2] \/ 2], W, H, dpr * 0.8, false);\n});\n}\nfunction layoutPad() {\nvar B = basis(), R = 3.15, ring = [], mid = [];\nmvb.forEach(function (m, di) {\nvar d = DIRS[di], vx = dot(d, B.X), vy = dot(d, B.Y), len = Math.sqrt(vx * vx + vy * vy);\nvar ang = Math.atan2(vy, vx);\nm.g.setAttribute(\"transform\", \"rotate(\" + (-ang * 180 \/ Math.PI).toFixed(1) + \") scale(\" + Math.max(0.45, Math.min(1, len)).toFixed(2) + \")\");\nm.mark.setAttribute(\"r\", len \u003c 0.35 ? (dot(d, B.D) \u003c 0 ? \"3.4\" : \"0\") : \"0\");\nm.b.setAttribute(\"aria-label\", t.slide + \" \" + [\"x\", \"y\", \"z\"][m.ax] + (di % 2 ? \"-\" : \"+\"));\nif (len \u003c 0.3) mid.push({ m: m, toward: dot(d, B.D) \u003c 0 });\nelse ring.push({ m: m, a: ang });\n});\nring.sort(function (p, q) { return p.a - q.a; });\nvar MIN = 1.0;\nfor (var it = 0; it \u003c 60; it++) {\nfor (var j = 0; j \u003c ring.length; j++) {\nvar p = ring[j], q = ring[(j + 1) % ring.length];\nvar gap = q.a - p.a + (j === ring.length - 1 ? 2 * Math.PI : 0);\nif (gap \u003c MIN) { var push = (MIN - gap) \/ 2; p.a -= push; q.a += push; }\n}\n}\nring.forEach(function (o) {\no.m.b.style.left = (4.8 + R * Math.cos(o.a) - 1.45).toFixed(2) + \"em\";\no.m.b.style.top = (4.8 - R * Math.sin(o.a) - 1.45).toFixed(2) + \"em\";\n});\nmid.forEach(function (o, j) {\nvar x = mid.length === 1 ? 0 : (o.toward ? -0.8 : 0.8);\no.m.b.style.left = (4.8 + x * 1.9 - 1.45).toFixed(2) + \"em\";\no.m.b.style.top = (4.8 - 1.45).toFixed(2) + \"em\";\n});\n}\nfunction upSide() {\nvar B = basis(), best = 4, bv = -9;\nDIRS.forEach(function (d, di) { var v = dot(d, B.Y); if (v \u003e bv + 1e-9) { bv = v; best = di; } });\nreturn best;\n}\nfunction turnAxis(vec) {\nvar best = 0, bv = 0;\nfor (var a = 0; a \u003c 3; a++) if (Math.abs(vec[a]) \u003e Math.abs(bv)) { bv = vec[a]; best = a; }\nreturn [best, bv \u003c 0];\n}\nfunction render() {\nvar lk = locked();\nvar on = game.inPlay();\ncountEl.textContent = fmt(t.moves, { n: game.moves });\nif (FREE !== Infinity) {\nvar left = FREE - game.moves;\nfreeEl.textContent = left \u003c= 0 ? t.freeNone : left === 1 ? t.freeOne : fmt(t.free, { n: left });\n}\nlockEl.hidden = !lk;\nvar can = sel != null \u0026\u0026 game.P[sel] \u0026\u0026 game.P[sel].on \u0026\u0026 !lk \u0026\u0026 !won;\nmvb.forEach(function (m) { m.b.disabled = lk || won; m.b.setAttribute(\"aria-disabled\", can ? \"false\" : \"true\"); });\nvar fr = can \u0026\u0026 game.free(sel);\nbTurnX.disabled = bTurnY.disabled = bTurnZ.disabled = !fr;\nbTray.disabled = !can || (on.length \u003e 1 \u0026\u0026 !game.clearWay(sel));\nbUndo.disabled = lk || !game.canUndo();\nbTog.hidden = !pending;\nsayEl.textContent = msg;\nif (won) { winEl.hidden = false; winEl.textContent = fmt(T.win, { n: game.moves }); }\nelse winEl.hidden = true;\nroot.setAttribute(\"data-state\", won ? \"done\" : lk ? \"locked\" : \"play\");\nroot.setAttribute(\"data-moves\", String(game.moves));\nlayoutPad();\ndrawTray();\nschedule();\n}\nfunction after(res, di) {\nif (res.ok \u0026\u0026 res.moved) {\nvar d = DIRS[di], tnow = now();\nres.moved.forEach(function (i) { if (game.P[i].on) anim[i] = { v: [-d[0], -d[1], -d[2]], t0: tnow, ms: 130 }; });\n}\nif (res.ok \u0026\u0026 res.out != null) {\nif (sel === res.out) sel = null;\nmsg = fmt(t.out, { Name: Name(res.out) });\n}\nif (res.ok) {\nwon = game.won();\nif (locked() \u0026\u0026 !won) { msg = \"\"; track(\"demo_limit_reached\", handle); }\n}\n}\nfunction act(di) {\npending = null;\nif (locked() || won) return;\nif (sel == null || !game.P[sel].on) { msg = t.pick; render(); return; }\nvar res = game.slide(sel, di);\nif (res.ok) { msg = \"\"; after(res, di); render(); return; }\nif (res.why === \"alone\") msg = t.alone;\nelse if (res.why === \"blocked\") {\nvar tend = now() + 700;\nres.by.forEach(function (j) { flash[j] = tend; });\nif (res.group) {\nvar others = res.group.filter(function (j) { return j !== sel; });\nmsg = fmt(t.push, { list: names(others) });\npending = { group: res.group, di: di };\n} else msg = fmt(t.pushAll, { list: names(res.by) });\n} else msg = t.pick;\nrender();\n}\nfunction together() {\nif (!pending || locked() || won) return;\nvar p = pending;\npending = null;\nvar res = game.slideGroup(p.group, p.di);\nif (res.ok) { msg = \"\"; after(res, p.di); }\nelse msg = res.why === \"far\" ? t.far : fmt(t.blocked, { list: names(res.by || []) });\nrender();\n}\nfunction bringIn(i) {\npending = null;\nif (locked() || won || game.P[i].on) return;\nvar sideDi = upSide(), res = game.spawn(i, sideDi);\nif (!res.ok) return;\nsel = i;\nvar d = DIRS[sideDi];\nif (game.inPlay().length \u003e 1) anim[i] = { v: [d[0] * 2, d[1] * 2, d[2] * 2], t0: now(), ms: 180 };\nmsg = fmt(t.inNow, { Name: Name(i) });\nrender();\n}\nfunction turn(vec) {\npending = null;\nif (sel == null || locked() || won) return;\nvar ta = turnAxis(vec), res = game.turn(sel, ta[0], ta[1]);\nmsg = res.ok ? \"\" : res.why === \"room\" ? t.noRoom : t.noTurn;\nrender();\n}\nvar awake = false, drag = null;\nfunction wake(on) {\nif (awake === on) return;\nawake = on;\nroot.setAttribute(\"data-play\", on ? \"1\" : \"0\");\n}\nroot.setAttribute(\"data-play\", \"0\");\nif (window.IntersectionObserver) {\nnew window.IntersectionObserver(function (es) {\nfor (var k = 0; k \u003c es.length; k++) if (!es[k].isIntersecting) { drag = null; wake(false); }\n}, { threshold: 0 }).observe(root);\n} else {\nwindow.addEventListener(\"scroll\", function () {\nvar r = root.getBoundingClientRect();\nif (r.bottom \u003c 0 || r.top \u003e (window.innerHeight || 0)) { drag = null; wake(false); }\n}, { passive: true });\n}\ncv.addEventListener(\"pointerdown\", function (e) {\nvar touch = e.pointerType \u0026\u0026 e.pointerType !== \"mouse\";\nif (!touch) wake(true);\ndrag = { x: e.clientX, y: e.clientY, yaw: yaw, pitch: pitch, moved: false, id: e.pointerId, sleep: !awake };\nif (!awake) return;\ntry { cv.setPointerCapture(e.pointerId); } catch (er) {  }\ne.preventDefault();\n});\ncv.addEventListener(\"pointermove\", function (e) {\nif (!drag || e.pointerId !== drag.id) return;\nvar dx = e.clientX - drag.x, dy = e.clientY - drag.y;\nif (drag.sleep) { if (dx * dx + dy * dy \u003e= 100) drag.moved = true; return; }\nif (!drag.moved \u0026\u0026 dx * dx + dy * dy \u003c 36) return;\ndrag.moved = true;\nyaw = drag.yaw - dx * 0.011;\npitch = Math.max(-1.45, Math.min(1.45, drag.pitch + dy * 0.011));\nlayoutPad();\ndrawTray();\nschedule();\ne.preventDefault();\n});\nfunction hitAt(x, y) {\nfor (var j = drawn.length - 1; j \u003e= 0; j--) {\nvar P = drawn[j].pts, inside = true, sgn = 0;\nfor (var k = 0; k \u003c 4; k++) {\nvar a = P[k], b = P[(k + 1) % 4];\nvar cr = (b[0] - a[0]) * (y - a[1]) - (b[1] - a[1]) * (x - a[0]);\nif (Math.abs(cr) \u003c 1e-9) continue;\nif (!sgn) sgn = cr \u003e 0 ? 1 : -1;\nelse if ((cr \u003e 0 ? 1 : -1) !== sgn) { inside = false; break; }\n}\nif (inside) return drawn[j].i;\n}\nreturn null;\n}\nfunction up(e) {\nif (!drag || e.pointerId !== drag.id) return;\nvar d = drag;\ndrag = null;\nif (d.moved) return;\nif (d.sleep) { wake(true); return; }\nvar r = cv.getBoundingClientRect(), dpr = cv.width \/ (r.width || 1);\nvar hit = hitAt((e.clientX - r.left) * dpr, (e.clientY - r.top) * dpr);\npending = null;\nif (table()) {\nif (hit != null) bringIn(hit);\nreturn;\n}\nsel = hit;\nmsg = \"\";\nrender();\n}\ncv.addEventListener(\"pointerup\", up);\ncv.addEventListener(\"pointercancel\", function () { drag = null; });\nmvb.forEach(function (m, di) { m.b.addEventListener(\"click\", function () { wake(true); act(di); }); });\nslots.forEach(function (sl, i) { sl.b.addEventListener(\"click\", function () { wake(true); bringIn(i); }); });\nbTurnY.addEventListener(\"click\", function () { turn(basis().Y); });\nbTurnX.addEventListener(\"click\", function () { turn(basis().X); });\nbTurnZ.addEventListener(\"click\", function () { var D = basis().D; turn([-D[0], -D[1], -D[2]]); });\nbTray.addEventListener(\"click\", function () {\npending = null;\nif (sel == null || locked() || won) return;\nvar res = game.toTray(sel);\nif (res.ok) { msg = fmt(t.out, { Name: Name(sel) }); sel = null; }\nelse msg = t.stuck;\nrender();\n});\nbTog.addEventListener(\"click\", together);\nbUndo.addEventListener(\"click\", function () {\nif (locked()) return;\nif (game.undo()) {\npending = null; won = false; msg = \"\";\nif (sel != null \u0026\u0026 !game.P[sel].on) sel = null;\nrender();\n}\n});\nbReset.addEventListener(\"click\", function () {\ngame.reset(); sel = null; pending = null; won = false; anim = {}; msg = t.empty;\nview.s = 0;\nrender();\n});\nbuyEl.addEventListener(\"click\", function (e) {\ntrack(\"demo_limit_atc\", handle);\nvar b = buyButton(root);\nif (!b) return;\ne.preventDefault();\nif (b.disabled) { if (b.scrollIntoView) b.scrollIntoView({ block: \"center\" }); return; }\nb.click();\n});\nif (window.ResizeObserver) new window.ResizeObserver(function () { drawTray(); schedule(); }).observe(viewEl);\nelse window.addEventListener(\"resize\", function () { drawTray(); schedule(); });\nrender();\n}\nwindow.GPBR = { mount: mount, v: 1 };\n})();\n(function(){var C={\"v\":1,\"text\":\"boards\",\"pieces\":[[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,4,0],[3,0,0],[3,1,0],[3,2,0],[3,3,0],[3,4,0],[4,0,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,4,0],[3,0,0],[3,1,0],[3,2,0],[3,3,0],[3,4,0],[4,0,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,4,0],[3,0,0],[3,4,0],[4,0,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,4,0],[3,0,0],[3,4,0],[4,0,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,2,0],[2,4,0],[3,0,0],[3,2,0],[3,4,0],[4,0,0],[4,2,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,2,0],[2,4,0],[3,0,0],[3,2,0],[3,4,0],[4,0,0],[4,2,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]]],\"colors\":[\"#E8E4DA\",\"#E9A07E\",\"#9CC5A6\",\"#F0CF86\",\"#8FA6D6\",\"#C99BC4\"],\"goal\":{\"type\":\"slots\",\"span\":[7,7,7],\"slots\":[[[0,1,2],[7,5,1]],[[2,0,1],[1,7,5]],[[1,2,0],[5,1,7]],[[0,1,4],[7,5,1]],[[4,0,1],[1,7,5]],[[1,4,0],[5,1,7]]]},\"free\":0};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gpbr \")\u003c0)r=document.querySelector(\".gpbr:not([data-gpbr-on])\");if(!r||!window.GPBR)return;var go=function(){window.GPBR.mount(r,C);};if(window.IntersectionObserver){var o=new IntersectionObserver(function(e){if(e[0]\u0026\u0026e[0].isIntersecting){o.disconnect();go();}},{rootMargin:\"600px 0px\"});o.observe(r);}else go();})();\n\u003c\/script\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51411264110759,"sku":"GP-ZIGZ","price":20.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/zigzag_marble.png?v=1790218141"},{"product_id":"torture","title":"Torture | One Solution Out of 7,680 Assemblies","description":"\u003ch2\u003eTorture - Quick Summary\u003c\/h2\u003e\n\u003cp\u003eTorture is a six-piece separated board burr designed by Frans de Vreugd in 2002, burr level 17.4. The six boards form 7,680 assemblies, and exactly one of those is a solution. Expert difficulty, 4+ hour solve time. Ships disassembled.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e burr collectors who already own a board burr or two and want the one with a genuinely unique solution, and solvers who have finished \u003ca href=\"\/products\/zigzag\"\u003eZigZag\u003c\/a\u003e and want the next step up.\u003c\/p\u003e\n\u003ch2\u003eOne Solution Out of 7,680 Assemblies\u003c\/h2\u003e\n\u003cp\u003eMost interlocking puzzles let you wander a bit. Torture does not. De Vreugd ran a computer search across every combination of pieces this shape allows. 7,680 of them are assemblies, meaning the boards genuinely form the finished shape. Exactly one of those assemblies is a solution, meaning it can actually be built and taken apart. Everything else is a dead end that looks correct right up until the last board will not drop in.\u003c\/p\u003e\n\u003cp\u003eThe level reads 17.4. Seventeen moves to free the first board, four more for the second.\u003c\/p\u003e\n\u003ch2\u003eMoves That Look Like Nothing\u003c\/h2\u003e\n\u003cp\u003eDe Vreugd noticed a mechanism that keeps turning up in high level puzzles. Boards slide back and forth, apparently getting nowhere, purely to shift one other board a few units across. In Torture it takes seven moves to move a single board three units. Nothing is wasted and nothing looks like progress, which is most of what makes it hard.\u003c\/p\u003e\n\u003cp\u003eIt is also the design that made \u003ca href=\"\/products\/extreme-torture\"\u003eExtreme Torture\u003c\/a\u003e possible. Torture came first, and once de Vreugd had it he pushed the same search as far as it would go.\u003c\/p\u003e\n\u003ch2\u003eIt Arrives in Pieces\u003c\/h2\u003e\n\u003cp\u003eSix loose boards and the knowledge that they fit. There is no solved state to copy, and with one solution out of 7,680 assemblies there is not much room to guess your way in. Expect to put it down and come back to it.\u003c\/p\u003e\n\u003cp\u003eTorture sits in the middle of the three. If you want all of them, they come together as the \u003ca href=\"\/products\/separated-board-burr-set\"\u003eSeparated Board Burr Set\u003c\/a\u003e.\u003c\/p\u003e\n\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\n\u003ch3\u003eWhat is a separated board burr?\u003c\/h3\u003e\n\u003cp\u003eA standard six board burr has six flat pieces in three pairs. In a separated board burr the two boards in each pair sit one unit apart rather than flush. The gap opens the shape up and allows much longer move sequences. Jim Gooch suggested the idea in 2002, Frans de Vreugd designed the puzzles.\u003c\/p\u003e\n\u003ch3\u003eWhy is Torture so hard to assemble?\u003c\/h3\u003e\n\u003cp\u003eBecause almost every arrangement that looks right is wrong. The six boards form 7,680 assemblies and only one of those is a solution that can actually be built, so recognising the correct arrangement is a real part of the puzzle, not just executing the moves.\u003c\/p\u003e\n\u003ch3\u003eDoes Torture arrive assembled?\u003c\/h3\u003e\n\u003cp\u003eNo. It ships as six separate boards, and assembling them is the challenge.\u003c\/p\u003e\n\u003ch3\u003eIs Torture harder than Extreme Torture?\u003c\/h3\u003e\n\u003cp\u003eNo. Torture is level 17.4, Extreme Torture is level 28-21-9-8-3. Torture is the one to solve first.\u003c\/p\u003e\n\u003cdiv class=\"gpbr\" data-handle=\"torture\"\u003e\n\u003cstyle\u003e\n.gpbr{--gpbr-fg:rgb(var(--color-foreground,18,18,18));\n --gpbr-line:rgba(var(--color-foreground,18,18,18),.18);\n --gpbr-muted:rgba(var(--color-foreground,18,18,18),.72);\n --gpbr-accent:#02A9F7;\n font-family:inherit;color:var(--gpbr-fg);margin:1.2em 0;max-width:32em}\n.gpbr *{box-sizing:border-box}\n.gpbr .gpbr-h{font-family:inherit;font-size:1.2em;line-height:1.3;font-weight:600;\n letter-spacing:normal;text-transform:none;margin:0 0 .3em;color:var(--gpbr-fg)}\n.gpbr .gpbr-goal{font-size:1em;line-height:1.4;font-weight:600;margin:0 0 .2em;color:var(--gpbr-fg)}\n.gpbr .gpbr-rule{font-size:.86em;line-height:1.45;margin:0 0 .75em;color:var(--gpbr-muted);max-width:36em}\n.gpbr .gpbr-stage{display:flex;flex-direction:column;gap:.5em;direction:ltr}\n.gpbr .gpbr-view{position:relative;width:100%;border-radius:8px;overflow:hidden;\n background:radial-gradient(ellipse at 50% 42%,#FFFFFF 0%,#F3F2EE 70%,#ECEAE4 100%);border:1px solid var(--gpbr-line)}\n.gpbr canvas.gpbr-cv{display:block;width:100%;height:auto;aspect-ratio:1\/0.8;touch-action:pan-y;cursor:grab;\n -webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none}\n.gpbr canvas.gpbr-cv:active{cursor:grabbing}\n.gpbr[data-play=\"1\"] canvas.gpbr-cv{touch-action:none}\n.gpbr .gpbr-veil{position:absolute;left:0;right:0;bottom:.8em;display:flex;justify-content:center;pointer-events:none;\n opacity:1;transition:opacity .25s}\n.gpbr[data-play=\"1\"] .gpbr-veil{opacity:0}\n.gpbr .gpbr-veil-t{font-size:.85em;line-height:1.2;font-weight:600;color:var(--gpbr-fg);padding:.5em 1em;border-radius:999px;\n background:rgba(255,255,255,.88);border:1px solid var(--gpbr-line);box-shadow:0 1px 3px rgba(0,0,0,.08)}\n.gpbr .gpbr-tray{display:flex;flex-wrap:wrap;align-items:center;gap:.4em;min-height:3.6em;padding:.35em .5em;\n border-radius:8px;border:1px dashed var(--gpbr-line)}\n.gpbr .gpbr-tray-h{font-size:.75em;line-height:1;color:var(--gpbr-muted);margin-inline-end:.3em}\n.gpbr button.gpbr-slot{position:relative;appearance:none;-webkit-appearance:none;margin:0;padding:0;width:3.4em;height:3.4em;\n border:1px solid var(--gpbr-line);border-radius:7px;background:#FAFAF8;cursor:pointer;box-shadow:none;\n -webkit-tap-highlight-color:transparent}\n.gpbr button.gpbr-slot[hidden]{display:none}\n.gpbr button.gpbr-slot:hover{border-color:var(--gpbr-accent)}\n.gpbr button.gpbr-slot:disabled{opacity:.5;cursor:default}\n.gpbr canvas.gpbr-thumb{display:block;width:100%;height:100%;pointer-events:none}\n.gpbr .gpbr-num{position:absolute;top:.15em;left:.3em;font-size:.68em;line-height:1;font-weight:600;color:var(--gpbr-muted);pointer-events:none}\n.gpbr .gpbr-ctl{display:flex;flex-wrap:wrap;align-items:center;gap:.6em 1em;margin-top:.6em;direction:ltr}\n.gpbr .gpbr-pad{position:relative;width:9.6em;height:9.6em;flex:none;border-radius:50%;background:rgba(var(--color-foreground,18,18,18),.035)}\n.gpbr button.gpbr-mv{position:absolute;appearance:none;-webkit-appearance:none;margin:0;padding:.45em;width:2.9em;height:2.9em;\n border:2px solid;border-radius:50%;background:#fff;cursor:pointer;box-shadow:0 1px 2px rgba(0,0,0,.12);\n -webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:left .12s,top .12s}\n.gpbr button.gpbr-mv svg{display:block;pointer-events:none}\n.gpbr button.gpbr-mv[aria-disabled=\"true\"]{opacity:.55}\n.gpbr button.gpbr-mv:disabled{opacity:.3;cursor:default}\n.gpbr .gpbr-side{display:flex;flex-wrap:wrap;gap:.45em;flex:1 1 9em;align-content:center}\n.gpbr .gpbr-side button,.gpbr .gpbr-bar button,.gpbr button.gpbr-tog{appearance:none;-webkit-appearance:none;margin:0;border:1px solid var(--gpbr-line);\n background:transparent;color:var(--gpbr-fg);font-family:inherit;font-size:.85em;line-height:1.2;\n letter-spacing:normal;text-transform:none;min-height:2.9em;padding:.6em .9em;border-radius:6px;\n cursor:pointer;box-shadow:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}\n.gpbr .gpbr-side button{flex:1 1 4.2em;padding:.6em .4em;white-space:nowrap}\n.gpbr .gpbr-side button:hover,.gpbr .gpbr-bar button:hover,.gpbr button.gpbr-tog:hover{border-color:var(--gpbr-accent)}\n.gpbr .gpbr-side button:disabled,.gpbr .gpbr-bar button:disabled{opacity:.38;cursor:default}\n.gpbr .gpbr-side button:disabled:hover,.gpbr .gpbr-bar button:disabled:hover{border-color:var(--gpbr-line)}\n.gpbr .gpbr-sayrow{display:flex;flex-wrap:wrap;align-items:center;gap:.4em .8em;margin:.6em 0 0;min-height:1.45em}\n.gpbr .gpbr-say{flex:1 1 14em;font-size:.88em;line-height:1.45;color:var(--gpbr-muted);min-height:1.45em;margin:0}\n.gpbr button.gpbr-tog{border-color:var(--gpbr-accent);font-weight:600}\n.gpbr button.gpbr-tog[hidden]{display:none}\n.gpbr .gpbr-win{font-size:.98em;line-height:1.45;font-weight:600;color:var(--gpbr-fg);margin:.5em 0 0;\n padding:.55em .8em;border-radius:6px;background:#E8F7FD;border-inline-start:3px solid var(--gpbr-accent)}\n.gpbr .gpbr-win[hidden]{display:none}\n.gpbr .gpbr-bar{display:flex;flex-wrap:wrap;align-items:center;gap:.45em;margin-top:.75em}\n.gpbr .gpbr-stat{display:flex;flex-direction:column;gap:.1em;margin-inline-end:auto}\n.gpbr .gpbr-count{font-size:.95em;line-height:1.2;font-weight:600;font-variant-numeric:tabular-nums;color:var(--gpbr-fg)}\n.gpbr .gpbr-free{font-size:.8em;line-height:1.25;font-weight:400;color:var(--gpbr-muted)}\n.gpbr .gpbr-lock{display:flex;flex-wrap:wrap;align-items:center;gap:.6em .9em;margin-top:.75em;\n padding:.8em .9em;border-radius:7px;background:#E8F7FD;border:1px solid rgba(2,169,247,.35)}\n.gpbr .gpbr-lock[hidden]{display:none}\n.gpbr .gpbr-lock-line{flex:1 1 12em;margin:0;font-size:.95em;line-height:1.4;font-weight:600;color:var(--gpbr-fg)}\n.gpbr a.gpbr-buy,.gpbr a.gpbr-buy:visited{display:inline-block;flex:none;padding:.7em 1.2em;border-radius:6px;\n background:var(--gpbr-accent);color:#121212;font-family:inherit;font-size:.92em;line-height:1.2;font-weight:600;\n letter-spacing:normal;text-decoration:none;text-transform:none;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.gpbr a.gpbr-buy:hover{background:#2BB8F8;color:#121212;text-decoration:none}\n.gpbr .gpbr-credit{font-size:.72em;line-height:1.4;color:var(--gpbr-muted);margin:.9em 0 0;opacity:.85}\n@media (min-width:600px){\n .gpbr .gpbr-stage{flex-direction:row;align-items:stretch}\n .gpbr .gpbr-view{flex:1 1 auto;min-width:0}\n .gpbr .gpbr-tray{flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;width:4.6em;flex:none;padding:.5em .4em}\n .gpbr .gpbr-tray-h{margin:0 0 .2em}\n}\n\u003c\/style\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n(function () {\n\"use strict\";\nif (window.GPBR_ENGINE) return;\nvar DIRS = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]];\nvar FAR = 6;\nfunction det(m) {\nreturn m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -\nm[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) +\nm[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);\n}\nvar ROTS = [];\n(function () {\nvar perms = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]];\nfor (var p = 0; p \u003c 6; p++) {\nfor (var s = 0; s \u003c 8; s++) {\nvar m = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\nfor (var r = 0; r \u003c 3; r++) m[r][perms[p][r]] = (s \u003e\u003e r \u0026 1) ? -1 : 1;\nif (det(m) === 1) ROTS.push(m);\n}\n}\n})();\nfunction mmul(a, b) {\nvar o = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\nfor (var r = 0; r \u003c 3; r++) for (var c = 0; c \u003c 3; c++)\nfor (var k = 0; k \u003c 3; k++) o[r][c] += a[r][k] * b[k][c];\nreturn o;\n}\nfunction rotIndex(m) {\nfor (var i = 0; i \u003c ROTS.length; i++) {\nvar R = ROTS[i], same = true;\nfor (var r = 0; r \u003c 3 \u0026\u0026 same; r++) for (var c = 0; c \u003c 3; c++) if (R[r][c] !== m[r][c]) { same = false; break; }\nif (same) return i;\n}\nreturn -1;\n}\nvar MUL = ROTS.map(function (a) { return ROTS.map(function (b) { return rotIndex(mmul(a, b)); }); });\nvar QT = [rotIndex([[1, 0, 0], [0, 0, -1], [0, 1, 0]]),\nrotIndex([[0, 0, 1], [0, 1, 0], [-1, 0, 0]]),\nrotIndex([[0, -1, 0], [1, 0, 0], [0, 0, 1]])];\nvar ID = rotIndex([[1, 0, 0], [0, 1, 0], [0, 0, 1]]);\nfunction dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; }\nfunction key(x, y, z) { return ((x + 512) * 1024 + (y + 512)) * 1024 + (z + 512); }\nfunction axisOf(d) { return d[0] ? 0 : d[1] ? 1 : 2; }\nfunction signOf(d) { return d[0] + d[1] + d[2]; }\nfunction gaps(a, b) {\nvar g = [];\nfor (var k = 0; k \u003c 3; k++) g.push(Math.max(a.lo[k] - b.hi[k] - 1, b.lo[k] - a.hi[k] - 1));\nreturn g;\n}\nfunction Game(C) {\nthis.C = C;\nthis.n = C.pieces.length;\nthis.shapes = {};\nthis.reset();\n}\nvar G = Game.prototype;\nG.reset = function () {\nthis.P = [];\nfor (var i = 0; i \u003c this.n; i++) this.P.push({ on: false, r: ID, p: [0, 0, 0] });\nthis.moves = 0;\nthis.hist = [];\n};\nG.snap = function () {\nreturn { P: this.P.map(function (q) { return { on: q.on, r: q.r, p: q.p.slice() }; }), moves: this.moves };\n};\nG.save = function () { this.hist.push(this.snap()); };\nG.canUndo = function () { return this.hist.length \u003e 0; };\nG.undo = function () {\nvar s = this.hist.pop();\nif (!s) return false;\nthis.P = s.P;\nreturn true;\n};\nG.shape = function (i, r) {\nvar k = i + \"\/\" + r, sh = this.shapes[k];\nif (sh) return sh;\nvar R = ROTS[r], cs = this.C.pieces[i], out = [], lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9];\nfor (var j = 0; j \u003c cs.length; j++) {\nvar c = cs[j], v = [0, 0, 0];\nfor (var a = 0; a \u003c 3; a++) {\nv[a] = R[a][0] * c[0] + R[a][1] * c[1] + R[a][2] * c[2];\nif (v[a] \u003c lo[a]) lo[a] = v[a];\nif (v[a] \u003e hi[a]) hi[a] = v[a];\n}\nout.push(v);\n}\nfor (j = 0; j \u003c out.length; j++) for (a = 0; a \u003c 3; a++) out[j][a] -= lo[a];\nsh = { c: out, s: [hi[0] - lo[0] + 1, hi[1] - lo[1] + 1, hi[2] - lo[2] + 1] };\nthis.shapes[k] = sh;\nreturn sh;\n};\nG.cells = function (i) {\nvar q = this.P[i], sh = this.shape(i, q.r);\nreturn sh.c.map(function (c) { return [c[0] + q.p[0], c[1] + q.p[1], c[2] + q.p[2]]; });\n};\nG.box = function (i) {\nvar q = this.P[i], s = this.shape(i, q.r).s;\nreturn { lo: q.p.slice(), hi: [q.p[0] + s[0] - 1, q.p[1] + s[1] - 1, q.p[2] + s[2] - 1] };\n};\nG.boxOf = function (list) {\nvar lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9];\nfor (var j = 0; j \u003c list.length; j++) {\nvar b = this.box(list[j]);\nfor (var a = 0; a \u003c 3; a++) {\nif (b.lo[a] \u003c lo[a]) lo[a] = b.lo[a];\nif (b.hi[a] \u003e hi[a]) hi[a] = b.hi[a];\n}\n}\nreturn { lo: lo, hi: hi };\n};\nG.inPlay = function () {\nvar o = [];\nfor (var i = 0; i \u003c this.n; i++) if (this.P[i].on) o.push(i);\nreturn o;\n};\nG.occ = function (skip) {\nvar m = {};\nfor (var i = 0; i \u003c this.n; i++) {\nif (!this.P[i].on || (skip \u0026\u0026 skip[i])) continue;\nvar cs = this.cells(i);\nfor (var j = 0; j \u003c cs.length; j++) m[key(cs[j][0], cs[j][1], cs[j][2])] = i;\n}\nreturn m;\n};\nG.blockers = function (group, d) {\nvar inG = {}, j;\nfor (j = 0; j \u003c group.length; j++) inG[group[j]] = 1;\nvar occ = this.occ(inG), hit = {}, out = [];\nfor (j = 0; j \u003c group.length; j++) {\nvar cs = this.cells(group[j]);\nfor (var k = 0; k \u003c cs.length; k++) {\nvar o = occ[key(cs[k][0] + d[0], cs[k][1] + d[1], cs[k][2] + d[2])];\nif (o !== undefined \u0026\u0026 !hit[o]) { hit[o] = 1; out.push(o); }\n}\n}\nreturn out.sort(function (a, b) { return a - b; });\n};\nG.closure = function (i, d) {\nvar g = [i];\nfor (;;) {\nvar b = this.blockers(g, d);\nif (!b.length) return g.sort(function (a, c) { return a - c; });\ng = g.concat(b);\n}\n};\nG.clearWay = function (i, mine) {\nvar on = this.inPlay(), others = [], k, j;\nmine = mine || this.cells(i);\nfor (k = 0; k \u003c on.length; k++) if (on[k] !== i) {\nvar cs = this.cells(on[k]);\nfor (j = 0; j \u003c cs.length; j++) others.push(cs[j]);\n}\nif (!others.length) return 1;\nfor (var di = 0; di \u003c 6; di++) {\nvar d = DIRS[di], a = axisOf(d), s = signOf(d), free = true;\nfor (j = 0; j \u003c mine.length \u0026\u0026 free; j++) {\nvar c = mine[j];\nfor (k = 0; k \u003c others.length; k++) {\nvar o = others[k], same = true;\nfor (var b = 0; b \u003c 3; b++) if (b !== a \u0026\u0026 o[b] !== c[b]) { same = false; break; }\nif (same \u0026\u0026 (o[a] - c[a]) * s \u003e 0) { free = false; break; }\n}\n}\nif (free) return di + 1;\n}\nreturn 0;\n};\nG.hits = function (i, cells) {\nvar occ = this.occ(null);\nfor (var j = 0; j \u003c cells.length; j++) {\nvar o = occ[key(cells[j][0], cells[j][1], cells[j][2])];\nif (o !== undefined \u0026\u0026 o !== i) return true;\n}\nreturn false;\n};\nG.place = function (i, r, p) {\nreturn this.shape(i, r).c.map(function (c) { return [c[0] + p[0], c[1] + p[1], c[2] + p[2]]; });\n};\nG.spawn = function (i, side) {\nvar q = this.P[i];\nif (q.on) return { ok: false, why: \"on\" };\nvar sh = this.shape(i, q.r), on = this.inPlay(), p = [0, 0, 0];\nif (!on.length) {\nfor (var a = 0; a \u003c 3; a++) p[a] = -Math.floor(sh.s[a] \/ 2);\n} else {\nvar O = this.boxOf(on), d = DIRS[side], ax = axisOf(d);\nfor (a = 0; a \u003c 3; a++) {\nif (a === ax) continue;\np[a] = Math.floor((O.lo[a] + O.hi[a] + 1 - sh.s[a]) \/ 2);\n}\np[ax] = signOf(d) \u003e 0 ? O.hi[ax] + 2 : O.lo[ax] - 1 - sh.s[ax];\n}\nreturn this.spawnAt(i, q.r, p);\n};\nG.spawnAt = function (i, r, p) {\nvar q = this.P[i];\nif (q.on || r \u003c 0 || r \u003e= 24) return { ok: false, why: \"on\" };\nvar cells = this.place(i, r, p);\nif (this.hits(i, cells) || !this.clearWay(i, cells)) return { ok: false, why: \"inside\" };\nthis.save();\nthis.P[i] = { on: true, r: r, p: p.slice() };\nreturn { ok: true, i: i };\n};\nG.slide = function (i, di) {\nvar q = this.P[i], d = DIRS[di];\nif (!q || !q.on) return { ok: false, why: \"pick\" };\nvar on = this.inPlay();\nif (on.length \u003c 2) return { ok: false, why: \"alone\" };\nvar by = this.blockers([i], d);\nif (by.length) {\nvar g = this.closure(i, d);\nreturn { ok: false, why: \"blocked\", by: by, group: g.length \u003c on.length ? g : null };\n}\nvar others = on.filter(function (j) { return j !== i; });\nvar O = this.boxOf(others), before = gaps(this.box(i), O);\nthis.save();\nq.p = [q.p[0] + d[0], q.p[1] + d[1], q.p[2] + d[2]];\nthis.moves++;\nvar after = gaps(this.box(i), O), ax = axisOf(d), res = { ok: true, moved: [i], d: di };\nif (after[ax] \u003e FAR \u0026\u0026 after[ax] \u003e before[ax]) {\nq.on = false;\nres.out = i;\n}\nreturn res;\n};\nG.slideGroup = function (group, di) {\nvar d = DIRS[di], on = this.inPlay(), j;\nif (!group.length || group.length \u003e= on.length) return { ok: false, why: \"all\" };\nfor (j = 0; j \u003c group.length; j++) if (!this.P[group[j]].on) return { ok: false, why: \"pick\" };\nvar by = this.blockers(group, d);\nif (by.length) return { ok: false, why: \"blocked\", by: by, group: null };\nvar inG = {};\nfor (j = 0; j \u003c group.length; j++) inG[group[j]] = 1;\nvar rest = on.filter(function (k) { return !inG[k]; });\nvar O = this.boxOf(rest), B = this.boxOf(group), ax = axisOf(d), before = gaps(B, O);\nvar after = gaps({ lo: [B.lo[0] + d[0], B.lo[1] + d[1], B.lo[2] + d[2]], hi: [B.hi[0] + d[0], B.hi[1] + d[1], B.hi[2] + d[2]] }, O);\nif (after[ax] \u003e FAR \u0026\u0026 after[ax] \u003e before[ax]) return { ok: false, why: \"far\" };\nthis.save();\nfor (j = 0; j \u003c group.length; j++) {\nvar q = this.P[group[j]];\nq.p = [q.p[0] + d[0], q.p[1] + d[1], q.p[2] + d[2]];\n}\nthis.moves++;\nreturn { ok: true, moved: group.slice(), d: di };\n};\nG.free = function (i) {\nvar q = this.P[i];\nreturn !!(q \u0026\u0026 q.on \u0026\u0026 this.clearWay(i));\n};\nG.turn = function (i, ax, back) {\nif (!this.free(i)) return { ok: false, why: \"turn\" };\nvar q = this.P[i], old = this.box(i);\nvar Q = QT[ax];\nif (back) Q = MUL[Q][MUL[Q][Q]];\nvar r = MUL[Q][q.r], s = this.shape(i, r).s, p0 = [0, 0, 0], a;\nfor (a = 0; a \u003c 3; a++) p0[a] = Math.floor((old.lo[a] + old.hi[a] + 1 - s[a]) \/ 2);\nvar on = this.inPlay(), mid = [0, 0, 0], self = this;\nif (on.length \u003e 1) {\nvar O = this.boxOf(on.filter(function (j) { return j !== i; }));\nfor (a = 0; a \u003c 3; a++) mid[a] = (O.lo[a] + O.hi[a] + 1) \/ 2 - (old.lo[a] + old.hi[a] + 1) \/ 2;\n}\nvar order = [0, 1, 2, 3, 4, 5].sort(function (x, y) { return dot(DIRS[x], mid) - dot(DIRS[y], mid); });\nvar tries = [p0];\nfor (var k = 1; k \u003c= 8; k++) order.forEach(function (di) {\nvar d = DIRS[di];\ntries.push([p0[0] + d[0] * k, p0[1] + d[1] * k, p0[2] + d[2] * k]);\n});\nfor (var t = 0; t \u003c tries.length; t++) {\nvar cells = self.place(i, r, tries[t]);\nif (self.hits(i, cells) || !self.clearWay(i, cells)) continue;\nthis.save();\nq.r = r;\nq.p = tries[t];\nreturn { ok: true };\n}\nreturn { ok: false, why: \"room\" };\n};\nG.toTray = function (i) {\nvar q = this.P[i];\nif (!q || !q.on) return { ok: false, why: \"pick\" };\nif (this.inPlay().length \u003e 1 \u0026\u0026 !this.clearWay(i)) return { ok: false, why: \"stuck\" };\nthis.save();\nq.on = false;\nreturn { ok: true, out: i };\n};\nG.won = function () {\nvar on = this.inPlay(), gl = this.C.goal;\nif (on.length !== this.n) return false;\nvar B = this.boxOf(on), dims = [0, 1, 2].map(function (a) { return B.hi[a] - B.lo[a] + 1; });\nif (gl.type === \"box\") {\nvar num = function (x, y) { return x - y; };\nvar want = gl.size.slice().sort(num), got = dims.slice().sort(num);\nreturn want[0] === got[0] \u0026\u0026 want[1] === got[1] \u0026\u0026 want[2] === got[2];\n}\nif (gl.type === \"slots\") {\nfor (var a = 0; a \u003c 3; a++) if (dims[a] !== gl.span[a]) return false;\nvar self = this;\nreturn [0, 1].some(function (mirror) {\nvar want = {};\ngl.slots.forEach(function (sl) {\nvar c = sl[0], s = sl[1];\nif (mirror) { c = [c[1], c[0], c[2]]; s = [s[1], s[0], s[2]]; }\nwant[c.join(\",\") + \"\/\" + s.join(\",\")] = 1;\n});\nreturn on.every(function (i) {\nvar b = self.box(i), lo = [b.lo[0] - B.lo[0], b.lo[1] - B.lo[1], b.lo[2] - B.lo[2]];\nvar s = [b.hi[0] - b.lo[0] + 1, b.hi[1] - b.lo[1] + 1, b.hi[2] - b.lo[2] + 1];\nreturn want[lo.join(\",\") + \"\/\" + s.join(\",\")] === 1;\n});\n});\n}\nreturn false;\n};\nwindow.GPBR_ENGINE = { Game: Game, DIRS: DIRS, ROTS: ROTS, MUL: MUL, QT: QT, ID: ID, gaps: gaps, v: 1 };\n})();\n(function () {\n\"use strict\";\nif (window.GPBR) return;\nvar E = window.GPBR_ENGINE;\nif (!E) return;\nvar NS = \"http:\/\/www.w3.org\/2000\/svg\";\nvar ACC = \"#02A9F7\", BAD = \"#E0533D\";\nvar AXC = [\"#C8553D\", \"#3E8E5A\", \"#3569B8\"];\nvar DIRS = E.DIRS;\nvar seq = 0;\nvar TXT = {\nen: {\ntitle: \"Try it yourself\", play: \"Tap to play\",\nhow: \"Drag the view to turn it. Tap a piece in the tray to bring it in, tap a piece to pick it, then slide it with the arrows.\",\nmoves: \"Moves: {n}\", undo: \"Undo\", reset: \"Start over\", tray: \"Tray\", toTray: \"To tray\",\nturnY: \"Turn\", turnX: \"Tip\", turnZ: \"Spin\", together: \"Move together\",\nslide: \"Slide\", view: \"Puzzle view, drag to turn\",\nempty: \"Tap a piece in the tray to bring it in.\",\npick: \"Tap a piece first.\",\ninNow: \"{Name} is in. Turn it while it is clear, then slide it.\",\nalone: \"Bring in another piece to slide against.\",\nblocked: \"Blocked by {list}.\",\npush: \"It would push {list} too.\",\npushAll: \"Blocked by {list}. Pushing it would move the whole puzzle.\",\nfar: \"That's as far as it goes.\",\nout: \"{Name} is back in the tray.\",\nnoTurn: \"It's held in place. Slide it clear of the others first, then turn it.\",\nnoRoom: \"No room to turn it here. Slide it further out first.\",\nstuck: \"It can't come out from here yet.\",\nnoun: { block: [\"piece {p}\", \"Piece {p}\", \"pieces {a} and {b}\"], boards: [\"board {p}\", \"Board {p}\", \"boards {a} and {b}\"] }, and: \", \",\nfree: \"{n} free moves left\", freeOne: \"1 free move left\", freeNone: \"No free moves left\",\nlockLine: \"That's the free part. Finish it with the real one.\", buy: \"Add to cart\",\ncredit: \"Moves follow the rules of BurrTools, Andreas Röver's free puzzle program.\",\nblock: { goal: \"Put the five pieces together into one solid block.\",\nrule: \"Pieces only slide in straight lines, and a piece can only be turned while it is clear of the others.\",\nwin: \"Done in {n} moves. The block is complete.\" },\nboards: { goal: \"Fit the six boards together into the finished burr.\",\nrule: \"Boards only slide in straight lines, and a board can only be turned while it is clear of the others.\",\nwin: \"Done in {n} moves. All six boards are in place.\" }\n},\nhe: {\ntitle: \"נסו בעצמכם\", play: \"הקישו כדי לשחק\",\nhow: \"גררו את התצוגה כדי לסובב אותה. הקישו על חלק במגש כדי להכניס אותו, הקישו על חלק כדי לבחור בו, ואז הזיזו אותו עם החצים.\",\nmoves: \"מהלכים: {n}\", undo: \"ביטול מהלך\", reset: \"התחלה מחדש\", tray: \"מגש\", toTray: \"למגש\",\nturnY: \"סיבוב\", turnX: \"הטיה\", turnZ: \"גלגול\", together: \"הזיזו יחד\",\nslide: \"הזזה\", view: \"תצוגת הפאזל, גררו כדי לסובב\",\nempty: \"הקישו על חלק במגש כדי להכניס אותו.\",\npick: \"הקישו קודם על חלק.\",\ninNow: \"{Name} בפנים. סובבו אותו כל עוד הוא רחוק מהאחרים, ואז הזיזו אותו.\",\nalone: \"הכניסו עוד חלק כדי שיהיה מול מה להזיז.\",\nblocked: \"חסום על ידי {list}.\",\npush: \"הוא ידחוף גם את {list}.\",\npushAll: \"חסום על ידי {list}. דחיפה תזיז את כל הפאזל.\",\nfar: \"עד כאן אפשר להרחיק אותו.\",\nout: \"{Name} חזר למגש.\",\nnoTurn: \"הוא תקוע במקומו. הרחיקו אותו קודם מהחלקים האחרים, ואז סובבו אותו.\",\nnoRoom: \"אין כאן מקום לסובב אותו. הרחיקו אותו עוד קודם.\",\nstuck: \"עדיין אי אפשר להוציא אותו מכאן.\",\nnoun: { block: [\"חלק {p}\", \"חלק {p}\", \"חלקים {a} ו-{b}\"], boards: [\"לוח {p}\", \"לוח {p}\", \"לוחות {a} ו-{b}\"] }, and: \", \",\nfree: \"נותרו {n} מהלכים חינם\", freeOne: \"נותר מהלך חינם אחד\", freeNone: \"לא נותרו מהלכים חינם\",\nlockLine: \"זה החלק החינמי. סיימו אותו עם הפאזל האמיתי.\", buy: \"הוספה לעגלה\",\ncredit: \"המהלכים פועלים לפי הכללים של BurrTools, תוכנת הפאזלים החופשית של אנדראס רובר.\",\nblock: { goal: \"חברו את חמשת החלקים לקובייה אחת מלאה.\",\nrule: \"החלקים זזים רק בקווים ישרים, ואפשר לסובב חלק רק כשהוא רחוק מהאחרים.\",\nwin: \"הצלחתם ב-{n} מהלכים. הקובייה שלמה.\" },\nboards: { goal: \"חברו את ששת הלוחות לפאזל השלם.\",\nrule: \"הלוחות זזים רק בקווים ישרים, ואפשר לסובב לוח רק כשהוא רחוק מהאחרים.\",\nwin: \"הצלחתם ב-{n} מהלכים. כל ששת הלוחות במקומם.\" }\n},\nja: {\ntitle: \"試してみてください\", play: \"タップして遊ぶ\",\nhow: \"画面をドラッグすると向きが変わります。トレイのピースをタップして入れ、ピースをタップして選び、矢印でスライドさせてください。\",\nmoves: \"手数：{n}\", undo: \"1手戻す\", reset: \"最初から\", tray: \"トレイ\", toTray: \"トレイへ\",\nturnY: \"回す\", turnX: \"倒す\", turnZ: \"ひねる\", together: \"一緒に動かす\",\nslide: \"スライド\", view: \"パズルの表示（ドラッグで回転）\",\nempty: \"トレイのピースをタップして入れてください。\",\npick: \"まずピースをタップしてください。\",\ninNow: \"{Name}が入りました。離れているうちに向きを変えてから、スライドさせてください。\",\nalone: \"もう1つピースを入れてから動かしてください。\",\nblocked: \"{list}に当たって動けません。\",\npush: \"{list}も一緒に押すことになります。\",\npushAll: \"{list}に当たって動けません。押すとパズル全体が動いてしまいます。\",\nfar: \"これ以上は離せません。\",\nout: \"{Name}がトレイに戻りました。\",\nnoTurn: \"今は固定されています。向きを変えるには、まず他のピースから離してください。\",\nnoRoom: \"ここでは回す場所がありません。もう少し離してください。\",\nstuck: \"ここからはまだ取り出せません。\",\nnoun: { block: [\"ピース{p}\", \"ピース{p}\", \"ピース{a}と{b}\"], boards: [\"板{p}\", \"板{p}\", \"板{a}と{b}\"] }, and: \"、\",\nfree: \"無料であと{n}手\", freeOne: \"無料であと1手\", freeNone: \"無料の手はここまで\",\nlockLine: \"無料で遊べるのはここまでです。続きは本物のパズルでどうぞ。\", buy: \"カートに追加\",\ncredit: \"動きのルールは、Andreas Röver さんの無料パズルソフト BurrTools に従っています。\",\nblock: { goal: \"5つのピースを組み合わせて、すき間のない1つのブロックにしてください。\",\nrule: \"ピースはまっすぐスライドするだけです。向きを変えられるのは、他のピースから離れているときだけです。\",\nwin: \"{n}手で完成！ブロックができあがりました。\" },\nboards: { goal: \"6枚の板を組み合わせて、パズルを完成させてください。\",\nrule: \"板はまっすぐスライドするだけです。向きを変えられるのは、他の板から離れているときだけです。\",\nwin: \"{n}手で完成！6枚の板がすべて収まりました。\" }\n}\n};\nfunction langOf() {\nvar l = (document.documentElement.getAttribute(\"lang\") || \"\").toLowerCase();\nif (l.indexOf(\"he\") === 0 || l.indexOf(\"iw\") === 0) return \"he\";\nif (l.indexOf(\"ja\") === 0) return \"ja\";\nreturn \"en\";\n}\nfunction fmt(s, o) {\nreturn s.replace(\/\\{(\\w+)\\}\/g, function (m, k) { return (k in o) ? String(o[k]) : m; });\n}\nfunction el(tag, cls, txt) {\nvar e = document.createElement(tag);\nif (cls) e.className = cls;\nif (txt != null) e.textContent = txt;\nreturn e;\n}\nfunction sv(tag, attrs) {\nvar e = document.createElementNS(NS, tag);\nfor (var k in attrs) if (Object.prototype.hasOwnProperty.call(attrs, k)) e.setAttribute(k, attrs[k]);\nreturn e;\n}\nfunction track(name, handle) {\ntry { if (typeof window.gtag === \"function\") window.gtag(\"event\", name, { product: handle }); } catch (e) {  }\n}\nfunction buyButton(root) {\nvar scopes = [], sec = root.closest ? root.closest(\"section, .shopify-section, product-info\") : null;\nif (sec) scopes.push(sec);\nscopes.push(document);\nfor (var k = 0; k \u003c scopes.length; k++) {\nvar b = scopes[k].querySelector('[id^=\"ProductSubmitButton-\"]');\nif (b \u0026\u0026 !root.contains(b)) return b;\nvar forms = scopes[k].querySelectorAll('form[action*=\"\/cart\/add\"]');\nfor (var i = 0; i \u003c forms.length; i++) {\nif (root.contains(forms[i])) continue;\nvar x = forms[i].querySelector('[type=\"submit\"], button:not([type])');\nif (x) return x;\n}\n}\nreturn null;\n}\nfunction rgb(h) {\nvar n = parseInt(h.slice(1), 16);\nreturn [n \u003e\u003e 16 \u0026 255, n \u003e\u003e 8 \u0026 255, n \u0026 255];\n}\nfunction dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; }\nvar now = (window.performance \u0026\u0026 performance.now) ? function () { return performance.now(); } : function () { return Date.now(); };\nvar CORN = [[0, 0], [1, 0], [1, 1], [0, 1]];\nvar OUTW = [[0, -1], [1, 0], [0, 1], [-1, 0]];\nfunction facesOf(cells) {\nvar has = {}, F = [];\nfunction k(x, y, z) { return x + \",\" + y + \",\" + z; }\ncells.forEach(function (c) { has[k(c[0], c[1], c[2])] = 1; });\ncells.forEach(function (c) {\nfor (var n = 0; n \u003c 6; n++) {\nvar d = DIRS[n];\nif (has[k(c[0] + d[0], c[1] + d[1], c[2] + d[2])]) continue;\nvar a = d[0] ? 0 : d[1] ? 1 : 2, s = d[0] + d[1] + d[2], b = (a + 1) % 3, e = (a + 2) % 3;\nvar pts = CORN.map(function (uv) {\nvar p = [0, 0, 0];\np[a] = c[a] + (s \u003e 0 ? 1 : 0); p[b] = c[b] + uv[0]; p[e] = c[e] + uv[1];\nreturn p;\n});\nvar mask = 0;\nfor (var j = 0; j \u003c 4; j++) {\nvar u = [0, 0, 0];\nu[b] = OUTW[j][0]; u[e] = OUTW[j][1];\nvar m = [c[0] + u[0], c[1] + u[1], c[2] + u[2]];\nvar flat = has[k(m[0], m[1], m[2])] \u0026\u0026 !has[k(m[0] + d[0], m[1] + d[1], m[2] + d[2])];\nif (!flat) mask |= 1 \u003c\u003c j;\n}\nF.push({ n: n, pts: pts, cc: [c[0] + 0.5, c[1] + 0.5, c[2] + 0.5], m: mask });\n}\n});\nreturn F;\n}\nfunction mount(root, C) {\nif (!root || root.getAttribute(\"data-gpbr-on\")) return;\nroot.setAttribute(\"data-gpbr-on\", \"1\");\nvar L = langOf(), t = TXT[L], T = t[C.text] || t.block;\nroot.setAttribute(\"lang\", L);\nroot.setAttribute(\"dir\", L === \"he\" ? \"rtl\" : \"ltr\");\nvar handle = root.getAttribute(\"data-handle\") || \"\";\nvar game = new E.Game(C), n = game.n;\nvar FREE = C.free \u003e 0 ? C.free : Infinity;\nvar COL = (C.colors || []).map(rgb);\nvar yaw = -0.62, pitch = 0.52;\nvar sel = null, pending = null, flash = {}, anim = {}, msg = t.empty, won = false;\nvar faceCache = {};\nvar view = { s: 0, c: [0, 0, 0], ts: 0, tc: [0, 0, 0] };\nvar drawn = [];\nvar dirty = false, raf = 0;\nfunction locked() { return game.moves \u003e= FREE; }\nfunction label(i) { return String(i + 1); }\nvar NOUN = t.noun[C.text] || t.noun.block;\nfunction names(list) {\nif (list.length === 1) return fmt(NOUN[0], { p: label(list[0]) });\nvar head = list.slice(0, -1).map(label).join(t.and);\nreturn fmt(NOUN[2], { a: head, b: label(list[list.length - 1]) });\n}\nfunction Name(i) { return fmt(NOUN[1], { p: label(i) }); }\nroot.appendChild(el(\"h3\", \"gpbr-h\", t.title));\nroot.appendChild(el(\"p\", \"gpbr-goal\", T.goal));\nroot.appendChild(el(\"p\", \"gpbr-rule\", T.rule + (L === \"ja\" ? \"\" : \" \") + t.how));\nvar stage = el(\"div\", \"gpbr-stage\");\nroot.appendChild(stage);\nvar viewEl = el(\"div\", \"gpbr-view\");\nstage.appendChild(viewEl);\nvar cv = el(\"canvas\", \"gpbr-cv\");\ncv.setAttribute(\"role\", \"img\");\ncv.setAttribute(\"aria-label\", t.view);\nviewEl.appendChild(cv);\nvar veil = el(\"div\", \"gpbr-veil\");\nveil.appendChild(el(\"span\", \"gpbr-veil-t\", t.play));\nviewEl.appendChild(veil);\nvar ctx = cv.getContext(\"2d\");\nvar trayEl = el(\"div\", \"gpbr-tray\");\nstage.appendChild(trayEl);\ntrayEl.appendChild(el(\"span\", \"gpbr-tray-h\", t.tray));\nvar slots = [];\nfor (var i = 0; i \u003c n; i++) {\nvar b = el(\"button\", \"gpbr-slot\");\nb.type = \"button\";\nb.setAttribute(\"data-piece\", String(i));\nvar tc = el(\"canvas\", \"gpbr-thumb\");\nb.appendChild(tc);\nb.appendChild(el(\"span\", \"gpbr-num\", label(i)));\ntrayEl.appendChild(b);\nslots.push({ b: b, cv: tc });\n}\nvar ctl = el(\"div\", \"gpbr-ctl\");\nroot.appendChild(ctl);\nvar pad = el(\"div\", \"gpbr-pad\");\nctl.appendChild(pad);\nvar mvb = [];\nDIRS.forEach(function (d, di) {\nvar bt = el(\"button\", \"gpbr-mv\");\nbt.type = \"button\";\nbt.setAttribute(\"data-dir\", String(di));\nvar ax = d[0] ? 0 : d[1] ? 1 : 2;\nbt.style.borderColor = AXC[ax];\nvar svg = sv(\"svg\", { viewBox: \"-12 -12 24 24\", width: \"100%\", height: \"100%\", \"aria-hidden\": \"true\", focusable: \"false\" });\nvar g = sv(\"g\", {});\ng.appendChild(sv(\"path\", { d: \"M-7 0H6M1-5L6 0L1 5\", fill: \"none\", stroke: AXC[ax], \"stroke-width\": \"2.6\", \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\" }));\nsvg.appendChild(g);\nvar mark = sv(\"circle\", { cx: \"0\", cy: \"0\", r: \"3.2\", fill: AXC[ax] });\nsvg.appendChild(mark);\nbt.appendChild(svg);\npad.appendChild(bt);\nmvb.push({ b: bt, g: g, mark: mark, ax: ax });\n});\nvar side = el(\"div\", \"gpbr-side\");\nctl.appendChild(side);\nfunction sideBtn(txt, cls) {\nvar bt = el(\"button\", \"gpbr-sb \" + cls, txt);\nbt.type = \"button\";\nside.appendChild(bt);\nreturn bt;\n}\nvar bTurnY = sideBtn(t.turnY, \"gpbr-turn\");\nvar bTurnX = sideBtn(t.turnX, \"gpbr-turn\");\nvar bTurnZ = sideBtn(t.turnZ, \"gpbr-turn\");\nvar bTray = sideBtn(t.toTray, \"gpbr-out\");\nvar sayRow = el(\"div\", \"gpbr-sayrow\");\nroot.appendChild(sayRow);\nvar sayEl = el(\"p\", \"gpbr-say\", \"\");\nsayEl.setAttribute(\"aria-live\", \"polite\");\nsayRow.appendChild(sayEl);\nvar bTog = el(\"button\", \"gpbr-tog\", t.together);\nbTog.type = \"button\";\nbTog.hidden = true;\nsayRow.appendChild(bTog);\nvar winEl = el(\"p\", \"gpbr-win\", \"\");\nwinEl.hidden = true;\nwinEl.setAttribute(\"aria-live\", \"polite\");\nroot.appendChild(winEl);\nvar bar = el(\"div\", \"gpbr-bar\");\nroot.appendChild(bar);\nvar stat = el(\"div\", \"gpbr-stat\");\nbar.appendChild(stat);\nvar countEl = el(\"span\", \"gpbr-count\", \"\");\nstat.appendChild(countEl);\nvar freeEl = el(\"span\", \"gpbr-free\", \"\");\nif (FREE !== Infinity) stat.appendChild(freeEl);\nvar bUndo = el(\"button\", \"\", t.undo);\nbUndo.type = \"button\";\nbar.appendChild(bUndo);\nvar bReset = el(\"button\", \"\", t.reset);\nbReset.type = \"button\";\nbar.appendChild(bReset);\nvar lockEl = el(\"div\", \"gpbr-lock\");\nlockEl.hidden = true;\nlockEl.setAttribute(\"aria-live\", \"polite\");\nlockEl.appendChild(el(\"p\", \"gpbr-lock-line\", t.lockLine));\nvar buyEl = el(\"a\", \"gpbr-buy\", t.buy);\nbuyEl.setAttribute(\"href\", \"\/products\/\" + handle);\nbuyEl.setAttribute(\"role\", \"button\");\nlockEl.appendChild(buyEl);\nroot.appendChild(lockEl);\nroot.appendChild(el(\"p\", \"gpbr-credit\", t.credit));\nfunction basis() {\nvar cy = Math.cos(yaw), sy = Math.sin(yaw), cp = Math.cos(pitch), sp = Math.sin(pitch);\nreturn { X: [cy, -sy, 0], Y: [sp * sy, sp * cy, cp], D: [cp * sy, cp * cy, -sp] };\n}\nvar LIGHT = [-0.42, 0.74, -0.52];\nfunction faces(i, r) {\nvar k = i + \"\/\" + r;\nif (!faceCache[k]) faceCache[k] = facesOf(game.shape(i, r).c);\nreturn faceCache[k];\n}\nfunction offsetOf(i, tnow) {\nvar q = game.P[i], o = [q.p[0], q.p[1], q.p[2]], a = anim[i];\nif (a) {\nvar e = Math.min(1, (tnow - a.t0) \/ a.ms);\nif (e \u003e= 1) delete anim[i];\nelse {\nvar f = 1 - (1 - e) * (1 - e);\nfor (var k = 0; k \u003c 3; k++) o[k] += a.v[k] * (1 - f);\n}\n}\nreturn o;\n}\nfunction table() { return !game.inPlay().length; }\nfunction scene(tnow) {\nvar on = game.inPlay(), list = [], lo = [1e9, 1e9, 1e9], hi = [-1e9, -1e9, -1e9], k;\nif (on.length) {\non.forEach(function (i) { list.push({ i: i, r: game.P[i].r, off: tnow == null ? game.P[i].p.slice() : offsetOf(i, tnow) }); });\n} else {\nvar sp = 0, cols = n \u003c= 4 ? 2 : 3;\nfor (k = 0; k \u003c n; k++) { var s0 = game.shape(k, game.P[k].r).s; sp = Math.max(sp, s0[0], s0[1], s0[2]); }\nsp += 2;\nfor (k = 0; k \u003c n; k++) {\nvar sz = game.shape(k, game.P[k].r).s, col = k % cols, row = Math.floor(k \/ cols);\nlist.push({ i: k, r: game.P[k].r, off: [Math.round(col * sp - sz[0] \/ 2), Math.round(-row * sp - sz[1] \/ 2), Math.round(-sz[2] \/ 2)] });\n}\n}\nlist.forEach(function (it) {\nvar s1 = game.shape(it.i, it.r).s;\nfor (var a = 0; a \u003c 3; a++) {\nlo[a] = Math.min(lo[a], it.off[a]);\nhi[a] = Math.max(hi[a], it.off[a] + s1[a] - 1);\n}\n});\nreturn { list: list, lo: lo, hi: hi };\n}\nvar lastTable = null;\nfunction fitTarget() {\nvar B = scene(null), c = [], r2 = 0;\nif (!B.list.length) return;\nif (lastTable !== table()) { lastTable = table(); view.s = 0; }\nfor (var k = 0; k \u003c 3; k++) {\nc.push((B.lo[k] + B.hi[k] + 1) \/ 2);\nvar h = (B.hi[k] - B.lo[k] + 1) \/ 2;\nr2 += h * h;\n}\nvar r = Math.sqrt(r2) + 0.35, W = cv.clientWidth || 300, H = cv.clientHeight || 260;\nview.ts = Math.min(W, H) \/ (2 * r);\nview.tc = c;\nif (!view.s) { view.s = view.ts; view.c = c.slice(); }\n}\nfunction shade(rgbv, f) {\nreturn \"rgb(\" + Math.round(rgbv[0] * f) + \",\" + Math.round(rgbv[1] * f) + \",\" + Math.round(rgbv[2] * f) + \")\";\n}\nfunction paint(g2, list, B, s, c, W, H, dpr, pick) {\nvar items = [];\nlist.forEach(function (it) {\nvar F = faces(it.i, it.r), col = COL[it.i % COL.length] || [200, 200, 200];\nfor (var j = 0; j \u003c F.length; j++) {\nvar f = F[j], nd = DIRS[f.n];\nvar nz = dot(nd, B.D);\nif (nz \u003e -1e-6) continue;\nvar pts = [];\nfor (var k = 0; k \u003c 4; k++) {\nvar p = [f.pts[k][0] + it.off[0] - c[0], f.pts[k][1] + it.off[1] - c[1], f.pts[k][2] + it.off[2] - c[2]];\npts.push([W \/ 2 + s * dot(p, B.X), H \/ 2 - s * dot(p, B.Y)]);\n}\nvar cc = [f.cc[0] + it.off[0], f.cc[1] + it.off[1], f.cc[2] + it.off[2]];\nvar fc = [cc[0] + nd[0] * 0.5, cc[1] + nd[1] * 0.5, cc[2] + nd[2] * 0.5];\nvar nv = [dot(nd, B.X), dot(nd, B.Y), nz];\nvar lum = 0.6 + 0.4 * Math.max(0, dot(nv, LIGHT));\nitems.push({ i: it.i, pts: pts, m: f.m, z: dot(cc, B.D), z2: dot(fc, B.D), fill: shade(col, lum) });\n}\n});\nitems.sort(function (a, b) { return (b.z - a.z) || (b.z2 - a.z2); });\ng2.lineJoin = \"round\";\ng2.lineCap = \"round\";\nfor (var q = 0; q \u003c items.length; q++) {\nvar it = items[q], P = it.pts;\nvar mx = (P[0][0] + P[1][0] + P[2][0] + P[3][0]) \/ 4, my = (P[0][1] + P[1][1] + P[2][1] + P[3][1]) \/ 4;\ng2.beginPath();\nfor (var k2 = 0; k2 \u003c 4; k2++) {\nvar ex = P[k2][0] - mx, ey = P[k2][1] - my, el2 = Math.sqrt(ex * ex + ey * ey) || 1;\nvar gx = P[k2][0] + ex \/ el2 * 0.6, gy = P[k2][1] + ey \/ el2 * 0.6;\nif (k2) g2.lineTo(gx, gy); else g2.moveTo(gx, gy);\n}\ng2.closePath();\ng2.fillStyle = it.fill;\ng2.fill();\nvar hot = pick \u0026\u0026 (it.i === sel ? ACC : flash[it.i] ? BAD : null);\ng2.strokeStyle = hot || \"rgba(30,30,30,.55)\";\ng2.lineWidth = (hot ? 2.2 : 1) * dpr;\ng2.beginPath();\nfor (k2 = 0; k2 \u003c 4; k2++) {\nif (!(it.m \u003e\u003e k2 \u0026 1)) continue;\ng2.moveTo(P[k2][0], P[k2][1]);\ng2.lineTo(P[(k2 + 1) % 4][0], P[(k2 + 1) % 4][1]);\n}\ng2.stroke();\n}\nreturn items;\n}\nfunction size() {\nvar dpr = Math.min(window.devicePixelRatio || 1, 2.5);\nvar W = cv.clientWidth, H = cv.clientHeight;\nif (cv.width !== Math.round(W * dpr) || cv.height !== Math.round(H * dpr)) {\ncv.width = Math.round(W * dpr);\ncv.height = Math.round(H * dpr);\n}\nreturn dpr;\n}\nfunction draw() {\nraf = 0;\nvar tnow = now(), dpr = size(), W = cv.width, H = cv.height, B = basis(), more = false;\nfitTarget();\nif (view.s) {\nvar ds = view.ts - view.s;\nview.s += ds * 0.28;\nif (Math.abs(ds) \u003e view.ts * 0.004) more = true; else view.s = view.ts;\nfor (var k = 0; k \u003c 3; k++) {\nvar dc = view.tc[k] - view.c[k];\nview.c[k] += dc * 0.28;\nif (Math.abs(dc) \u003e 0.01) more = true; else view.c[k] = view.tc[k];\n}\n}\nctx.clearRect(0, 0, W, H);\nvar list = scene(tnow).list;\nfor (var a in anim) if (Object.prototype.hasOwnProperty.call(anim, a)) more = true;\nfor (var f in flash) if (Object.prototype.hasOwnProperty.call(flash, f)) {\nif (tnow \u003e flash[f]) delete flash[f]; else more = true;\n}\ndrawn = list.length ? paint(ctx, list, B, view.s * dpr, view.c, W, H, dpr, true) : [];\nif (more) schedule();\n}\nfunction schedule() { if (!raf) raf = (window.requestAnimationFrame || function (cb) { return setTimeout(cb, 16); })(draw); }\nfunction drawTray() {\nvar B = basis(), dpr = Math.min(window.devicePixelRatio || 1, 2.5);\nslots.forEach(function (sl, i) {\nvar q = game.P[i];\nsl.b.hidden = q.on;\nsl.b.disabled = locked() || won;\nif (q.on) return;\nvar W = Math.round((sl.cv.clientWidth || 48) * dpr), H = Math.round((sl.cv.clientHeight || 48) * dpr);\nif (sl.cv.width !== W) sl.cv.width = W;\nif (sl.cv.height !== H) sl.cv.height = H;\nvar g2 = sl.cv.getContext(\"2d\"), s = game.shape(i, q.r).s;\ng2.clearRect(0, 0, W, H);\nvar r = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]) \/ 2 + 0.2;\npaint(g2, [{ i: i, r: q.r, off: [0, 0, 0] }], B, Math.min(W, H) \/ (2 * r), [s[0] \/ 2, s[1] \/ 2, s[2] \/ 2], W, H, dpr * 0.8, false);\n});\n}\nfunction layoutPad() {\nvar B = basis(), R = 3.15, ring = [], mid = [];\nmvb.forEach(function (m, di) {\nvar d = DIRS[di], vx = dot(d, B.X), vy = dot(d, B.Y), len = Math.sqrt(vx * vx + vy * vy);\nvar ang = Math.atan2(vy, vx);\nm.g.setAttribute(\"transform\", \"rotate(\" + (-ang * 180 \/ Math.PI).toFixed(1) + \") scale(\" + Math.max(0.45, Math.min(1, len)).toFixed(2) + \")\");\nm.mark.setAttribute(\"r\", len \u003c 0.35 ? (dot(d, B.D) \u003c 0 ? \"3.4\" : \"0\") : \"0\");\nm.b.setAttribute(\"aria-label\", t.slide + \" \" + [\"x\", \"y\", \"z\"][m.ax] + (di % 2 ? \"-\" : \"+\"));\nif (len \u003c 0.3) mid.push({ m: m, toward: dot(d, B.D) \u003c 0 });\nelse ring.push({ m: m, a: ang });\n});\nring.sort(function (p, q) { return p.a - q.a; });\nvar MIN = 1.0;\nfor (var it = 0; it \u003c 60; it++) {\nfor (var j = 0; j \u003c ring.length; j++) {\nvar p = ring[j], q = ring[(j + 1) % ring.length];\nvar gap = q.a - p.a + (j === ring.length - 1 ? 2 * Math.PI : 0);\nif (gap \u003c MIN) { var push = (MIN - gap) \/ 2; p.a -= push; q.a += push; }\n}\n}\nring.forEach(function (o) {\no.m.b.style.left = (4.8 + R * Math.cos(o.a) - 1.45).toFixed(2) + \"em\";\no.m.b.style.top = (4.8 - R * Math.sin(o.a) - 1.45).toFixed(2) + \"em\";\n});\nmid.forEach(function (o, j) {\nvar x = mid.length === 1 ? 0 : (o.toward ? -0.8 : 0.8);\no.m.b.style.left = (4.8 + x * 1.9 - 1.45).toFixed(2) + \"em\";\no.m.b.style.top = (4.8 - 1.45).toFixed(2) + \"em\";\n});\n}\nfunction upSide() {\nvar B = basis(), best = 4, bv = -9;\nDIRS.forEach(function (d, di) { var v = dot(d, B.Y); if (v \u003e bv + 1e-9) { bv = v; best = di; } });\nreturn best;\n}\nfunction turnAxis(vec) {\nvar best = 0, bv = 0;\nfor (var a = 0; a \u003c 3; a++) if (Math.abs(vec[a]) \u003e Math.abs(bv)) { bv = vec[a]; best = a; }\nreturn [best, bv \u003c 0];\n}\nfunction render() {\nvar lk = locked();\nvar on = game.inPlay();\ncountEl.textContent = fmt(t.moves, { n: game.moves });\nif (FREE !== Infinity) {\nvar left = FREE - game.moves;\nfreeEl.textContent = left \u003c= 0 ? t.freeNone : left === 1 ? t.freeOne : fmt(t.free, { n: left });\n}\nlockEl.hidden = !lk;\nvar can = sel != null \u0026\u0026 game.P[sel] \u0026\u0026 game.P[sel].on \u0026\u0026 !lk \u0026\u0026 !won;\nmvb.forEach(function (m) { m.b.disabled = lk || won; m.b.setAttribute(\"aria-disabled\", can ? \"false\" : \"true\"); });\nvar fr = can \u0026\u0026 game.free(sel);\nbTurnX.disabled = bTurnY.disabled = bTurnZ.disabled = !fr;\nbTray.disabled = !can || (on.length \u003e 1 \u0026\u0026 !game.clearWay(sel));\nbUndo.disabled = lk || !game.canUndo();\nbTog.hidden = !pending;\nsayEl.textContent = msg;\nif (won) { winEl.hidden = false; winEl.textContent = fmt(T.win, { n: game.moves }); }\nelse winEl.hidden = true;\nroot.setAttribute(\"data-state\", won ? \"done\" : lk ? \"locked\" : \"play\");\nroot.setAttribute(\"data-moves\", String(game.moves));\nlayoutPad();\ndrawTray();\nschedule();\n}\nfunction after(res, di) {\nif (res.ok \u0026\u0026 res.moved) {\nvar d = DIRS[di], tnow = now();\nres.moved.forEach(function (i) { if (game.P[i].on) anim[i] = { v: [-d[0], -d[1], -d[2]], t0: tnow, ms: 130 }; });\n}\nif (res.ok \u0026\u0026 res.out != null) {\nif (sel === res.out) sel = null;\nmsg = fmt(t.out, { Name: Name(res.out) });\n}\nif (res.ok) {\nwon = game.won();\nif (locked() \u0026\u0026 !won) { msg = \"\"; track(\"demo_limit_reached\", handle); }\n}\n}\nfunction act(di) {\npending = null;\nif (locked() || won) return;\nif (sel == null || !game.P[sel].on) { msg = t.pick; render(); return; }\nvar res = game.slide(sel, di);\nif (res.ok) { msg = \"\"; after(res, di); render(); return; }\nif (res.why === \"alone\") msg = t.alone;\nelse if (res.why === \"blocked\") {\nvar tend = now() + 700;\nres.by.forEach(function (j) { flash[j] = tend; });\nif (res.group) {\nvar others = res.group.filter(function (j) { return j !== sel; });\nmsg = fmt(t.push, { list: names(others) });\npending = { group: res.group, di: di };\n} else msg = fmt(t.pushAll, { list: names(res.by) });\n} else msg = t.pick;\nrender();\n}\nfunction together() {\nif (!pending || locked() || won) return;\nvar p = pending;\npending = null;\nvar res = game.slideGroup(p.group, p.di);\nif (res.ok) { msg = \"\"; after(res, p.di); }\nelse msg = res.why === \"far\" ? t.far : fmt(t.blocked, { list: names(res.by || []) });\nrender();\n}\nfunction bringIn(i) {\npending = null;\nif (locked() || won || game.P[i].on) return;\nvar sideDi = upSide(), res = game.spawn(i, sideDi);\nif (!res.ok) return;\nsel = i;\nvar d = DIRS[sideDi];\nif (game.inPlay().length \u003e 1) anim[i] = { v: [d[0] * 2, d[1] * 2, d[2] * 2], t0: now(), ms: 180 };\nmsg = fmt(t.inNow, { Name: Name(i) });\nrender();\n}\nfunction turn(vec) {\npending = null;\nif (sel == null || locked() || won) return;\nvar ta = turnAxis(vec), res = game.turn(sel, ta[0], ta[1]);\nmsg = res.ok ? \"\" : res.why === \"room\" ? t.noRoom : t.noTurn;\nrender();\n}\nvar awake = false, drag = null;\nfunction wake(on) {\nif (awake === on) return;\nawake = on;\nroot.setAttribute(\"data-play\", on ? \"1\" : \"0\");\n}\nroot.setAttribute(\"data-play\", \"0\");\nif (window.IntersectionObserver) {\nnew window.IntersectionObserver(function (es) {\nfor (var k = 0; k \u003c es.length; k++) if (!es[k].isIntersecting) { drag = null; wake(false); }\n}, { threshold: 0 }).observe(root);\n} else {\nwindow.addEventListener(\"scroll\", function () {\nvar r = root.getBoundingClientRect();\nif (r.bottom \u003c 0 || r.top \u003e (window.innerHeight || 0)) { drag = null; wake(false); }\n}, { passive: true });\n}\ncv.addEventListener(\"pointerdown\", function (e) {\nvar touch = e.pointerType \u0026\u0026 e.pointerType !== \"mouse\";\nif (!touch) wake(true);\ndrag = { x: e.clientX, y: e.clientY, yaw: yaw, pitch: pitch, moved: false, id: e.pointerId, sleep: !awake };\nif (!awake) return;\ntry { cv.setPointerCapture(e.pointerId); } catch (er) {  }\ne.preventDefault();\n});\ncv.addEventListener(\"pointermove\", function (e) {\nif (!drag || e.pointerId !== drag.id) return;\nvar dx = e.clientX - drag.x, dy = e.clientY - drag.y;\nif (drag.sleep) { if (dx * dx + dy * dy \u003e= 100) drag.moved = true; return; }\nif (!drag.moved \u0026\u0026 dx * dx + dy * dy \u003c 36) return;\ndrag.moved = true;\nyaw = drag.yaw - dx * 0.011;\npitch = Math.max(-1.45, Math.min(1.45, drag.pitch + dy * 0.011));\nlayoutPad();\ndrawTray();\nschedule();\ne.preventDefault();\n});\nfunction hitAt(x, y) {\nfor (var j = drawn.length - 1; j \u003e= 0; j--) {\nvar P = drawn[j].pts, inside = true, sgn = 0;\nfor (var k = 0; k \u003c 4; k++) {\nvar a = P[k], b = P[(k + 1) % 4];\nvar cr = (b[0] - a[0]) * (y - a[1]) - (b[1] - a[1]) * (x - a[0]);\nif (Math.abs(cr) \u003c 1e-9) continue;\nif (!sgn) sgn = cr \u003e 0 ? 1 : -1;\nelse if ((cr \u003e 0 ? 1 : -1) !== sgn) { inside = false; break; }\n}\nif (inside) return drawn[j].i;\n}\nreturn null;\n}\nfunction up(e) {\nif (!drag || e.pointerId !== drag.id) return;\nvar d = drag;\ndrag = null;\nif (d.moved) return;\nif (d.sleep) { wake(true); return; }\nvar r = cv.getBoundingClientRect(), dpr = cv.width \/ (r.width || 1);\nvar hit = hitAt((e.clientX - r.left) * dpr, (e.clientY - r.top) * dpr);\npending = null;\nif (table()) {\nif (hit != null) bringIn(hit);\nreturn;\n}\nsel = hit;\nmsg = \"\";\nrender();\n}\ncv.addEventListener(\"pointerup\", up);\ncv.addEventListener(\"pointercancel\", function () { drag = null; });\nmvb.forEach(function (m, di) { m.b.addEventListener(\"click\", function () { wake(true); act(di); }); });\nslots.forEach(function (sl, i) { sl.b.addEventListener(\"click\", function () { wake(true); bringIn(i); }); });\nbTurnY.addEventListener(\"click\", function () { turn(basis().Y); });\nbTurnX.addEventListener(\"click\", function () { turn(basis().X); });\nbTurnZ.addEventListener(\"click\", function () { var D = basis().D; turn([-D[0], -D[1], -D[2]]); });\nbTray.addEventListener(\"click\", function () {\npending = null;\nif (sel == null || locked() || won) return;\nvar res = game.toTray(sel);\nif (res.ok) { msg = fmt(t.out, { Name: Name(sel) }); sel = null; }\nelse msg = t.stuck;\nrender();\n});\nbTog.addEventListener(\"click\", together);\nbUndo.addEventListener(\"click\", function () {\nif (locked()) return;\nif (game.undo()) {\npending = null; won = false; msg = \"\";\nif (sel != null \u0026\u0026 !game.P[sel].on) sel = null;\nrender();\n}\n});\nbReset.addEventListener(\"click\", function () {\ngame.reset(); sel = null; pending = null; won = false; anim = {}; msg = t.empty;\nview.s = 0;\nrender();\n});\nbuyEl.addEventListener(\"click\", function (e) {\ntrack(\"demo_limit_atc\", handle);\nvar b = buyButton(root);\nif (!b) return;\ne.preventDefault();\nif (b.disabled) { if (b.scrollIntoView) b.scrollIntoView({ block: \"center\" }); return; }\nb.click();\n});\nif (window.ResizeObserver) new window.ResizeObserver(function () { drawTray(); schedule(); }).observe(viewEl);\nelse window.addEventListener(\"resize\", function () { drawTray(); schedule(); });\nrender();\n}\nwindow.GPBR = { mount: mount, v: 1 };\n})();\n(function(){var C={\"v\":1,\"text\":\"boards\",\"pieces\":[[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,4,0],[3,0,0],[3,4,0],[4,0,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,4,0],[3,0,0],[3,4,0],[4,0,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,2,0],[3,0,0],[3,2,0],[3,4,0],[4,0,0],[4,2,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,0,0],[2,2,0],[3,0,0],[3,2,0],[3,4,0],[4,2,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,2,0],[2,4,0],[3,0,0],[3,2,0],[3,4,0],[4,0,0],[4,2,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]],[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[1,0,0],[1,2,0],[1,4,0],[2,2,0],[2,4,0],[3,0,0],[3,2,0],[3,4,0],[4,0,0],[4,2,0],[4,4,0],[5,0,0],[5,2,0],[5,4,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0]]],\"colors\":[\"#E8E4DA\",\"#E9A07E\",\"#9CC5A6\",\"#F0CF86\",\"#8FA6D6\",\"#C99BC4\"],\"goal\":{\"type\":\"slots\",\"span\":[7,7,7],\"slots\":[[[0,1,2],[7,5,1]],[[2,0,1],[1,7,5]],[[1,2,0],[5,1,7]],[[0,1,4],[7,5,1]],[[4,0,1],[1,7,5]],[[1,4,0],[5,1,7]]]},\"free\":0};var s=document.currentScript,r=s\u0026\u0026s.previousElementSibling;if(!r||(\" \"+r.className+\" \").indexOf(\" gpbr \")\u003c0)r=document.querySelector(\".gpbr:not([data-gpbr-on])\");if(!r||!window.GPBR)return;var go=function(){window.GPBR.mount(r,C);};if(window.IntersectionObserver){var o=new IntersectionObserver(function(e){if(e[0]\u0026\u0026e[0].isIntersecting){o.disconnect();go();}},{rootMargin:\"600px 0px\"});o.observe(r);}else go();})();\n\u003c\/script\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51411272269991,"sku":"GP-TORT","price":20.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/torture_marble.png?v=1790218238"},{"product_id":"one-way-or-another-move-the-disc-corner-to-corner","title":"One Way or Another | Move the Disc Corner to Corner","description":"\u003cdiv class=\"gpow\"\u003e\n\u003cstyle\u003e\n.gpow{--fg:rgb(var(--color-foreground,18,18,18));\n --line:rgba(var(--color-foreground,18,18,18),.14);\n --muted:rgba(var(--color-foreground,18,18,18),.64);--accent:#02A9F7;\n font-family:var(--font-body-family,inherit);margin:2.4rem 0;max-width:46rem}\n.gpow *{box-sizing:border-box}\n.gpow h3{font-family:var(--font-heading-family,inherit);font-size:1.9rem;\n line-height:1.3;margin:0 0 .5rem;color:var(--fg)}\n.gpow p{font-size:1.45rem;line-height:1.65;margin:0 0 1.1rem;color:var(--muted);max-width:60ch}\n.gpow #owPhase{font-size:1.15rem;letter-spacing:.04em;color:var(--muted);margin-bottom:.4rem}\n.gpow #owBoard{width:100%;max-width:34rem}\n.gpow #owBoard svg{display:block;width:100%;height:auto;\n \/* The player sets touch-action:none inline because a dedicated page wants\n    full control. On a product page a finger landing here must still scroll,\n    so this overrides it: horizontal drags work, vertical ones scroll past,\n    and the whole puzzle is playable by tapping either way. *\/\n touch-action:pan-y !important}\n\/* iOS: no grey flash on every tap, no text selection while dragging a piece,\n   and no callout menu when a finger rests on the board *\/\n.gpow #owBoard,.gpow #owTray,.gpow .ctl button{-webkit-tap-highlight-color:transparent;\n -webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n.gpow .row{display:flex;gap:1.2rem;align-items:flex-start;flex-wrap:wrap;margin-top:.9rem}\n.gpow #owTray{display:flex;gap:.7rem;align-items:center;flex-wrap:wrap;padding:.7rem .8rem;\n border:1px solid var(--line);border-radius:7px;min-height:3.6rem;min-width:12rem}\n.gpow #owTray .empty{font-size:1.2rem;color:var(--muted)}\n.gpow .ctl{display:flex;gap:.5rem;flex-wrap:wrap}\n.gpow .ctl button{appearance:none;border:1px solid var(--line);background:transparent;\n color:var(--muted);font-family:inherit;font-size:1.2rem;padding:.55rem 1.1rem;\n border-radius:5px;cursor:pointer}\n.gpow .ctl button:hover{border-color:var(--accent);color:var(--fg)}\n.gpow .ctl button:disabled{opacity:.38;cursor:default}\n.gpow .ctl button:disabled:hover{border-color:var(--line);color:var(--muted)}\n.gpow #owSay{font-size:1.3rem;color:var(--muted);min-height:2rem;margin-top:.7rem}\n\u003c\/style\u003e\n\u003ch3\u003eTry it before you buy it\u003c\/h3\u003e\n\u003cp\u003ePack the four pieces in so the disc keeps its corner, then move the disc to the far\ncorner. Pieces push each other, so sliding one can shove the next along. Plenty of packings\nfit the tray. Far fewer leave the disc anywhere to go, and that is the whole puzzle.\u003c\/p\u003e\n\u003cp\u003eTap a piece to pick it up, then tap a square to nudge it that way. Dragging works too,\nand so do the arrow keys.\u003c\/p\u003e\n\u003cdiv id=\"owPhase\"\u003e\u003c\/div\u003e\n\u003cdiv id=\"owBoard\"\u003e\u003c\/div\u003e\n\u003cdiv class=\"row\"\u003e\n  \u003cdiv id=\"owTray\"\u003e\u003c\/div\u003e\n  \u003cdiv class=\"ctl\"\u003e\n    \u003cbutton type=\"button\" id=\"owRotate\"\u003eRotate\u003c\/button\u003e\n    \u003cbutton type=\"button\" id=\"owFlip\"\u003eFlip\u003c\/button\u003e\n    \u003cbutton type=\"button\" id=\"owTake\"\u003eTake out\u003c\/button\u003e\n    \u003cbutton type=\"button\" id=\"owUnpack\"\u003eEmpty the tray\u003c\/button\u003e\n    \u003cbutton type=\"button\" id=\"owReset\"\u003eStart over\u003c\/button\u003e\n  \u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv id=\"owSay\"\u003e\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n(function(){\nvar D={\"w\":5,\"h\":4,\"order\":[\"tromino\",\"square\",\"tee\",\"ell\"],\"shapes\":{\"tromino\":[[0,0],[0,1],[1,0]],\"square\":[[0,0],[0,1],[1,0],[1,1]],\"tee\":[[0,0],[0,1],[0,2],[1,1]],\"ell\":[[0,0],[1,0],[2,0],[2,1]]},\"start\":[0,0],\"goal\":[3,4]};\n\/* ---------- One Way or Another: pack, then slide ---------- *\/\n(function(){\nvar W=D.w, H=D.h, ORDER=D.order, SHAPES=D.shapes;\nvar START=D.start, GOAL=D.goal, S=10;\nvar slideFrom=null;         \/* where the disc stood when the last piece went in *\/\nvar $=function(i){return document.getElementById(i);};\nvar NS=\"http:\/\/www.w3.org\/2000\/svg\";\nvar phase=\"pack\", placed={}, shapeOf={}, tray={}, disc=null, msg=\"\";\nvar drag=null, svgEl=null, picked=null;\nvar COL={tromino:\"#2E93C4\",square:\"#17678F\",tee:\"#4FAAD0\",ell:\"#0F4D69\"};\nvar LIGHT={tromino:\"#58B3DD\",square:\"#2E88B2\",tee:\"#78C6E4\",ell:\"#2A6E8E\"};\n\nfunction norm(cs){\n  var r0=Math.min.apply(null,cs.map(function(c){return c[0];}));\n  var c0=Math.min.apply(null,cs.map(function(c){return c[1];}));\n  return cs.map(function(c){return [c[0]-r0,c[1]-c0];});\n}\nfunction rotate(cs){ return norm(cs.map(function(c){ return [c[1],-c[0]]; })); }\nfunction flipped(cs){ return norm(cs.map(function(c){ return [c[0],-c[1]]; })); }\nfunction occupied(skip){\n  var o={};\n  for(var k in placed){\n    if(k===skip) continue;\n    placed[k].forEach(function(c){ o[c[0]+\",\"+c[1]]=k; });\n  }\n  if(disc \u0026\u0026 skip!==\"disc\") o[disc[0]+\",\"+disc[1]]=\"disc\";\n  return o;\n}\nfunction inside(cs){\n  return cs.every(function(c){ return c[0]\u003e=0\u0026\u0026c[0]\u003cH\u0026\u0026c[1]\u003e=0\u0026\u0026c[1]\u003cW; });\n}\nfunction fits(name,cells){\n  if(!inside(cells)) return false;\n  var occ=occupied(name);\n  for(var i=0;i\u003ccells.length;i++) if(occ[cells[i][0]+\",\"+cells[i][1]]) return false;\n  return true;\n}\nfunction reset(){\n  phase=\"pack\"; placed={}; shapeOf={}; disc=START.slice(); drag=null; picked=null;\n  slideFrom=null;\n  tray={}; ORDER.forEach(function(n){ tray[n]=SHAPES[n].map(function(c){return c.slice();}); });\n  msg=\"Click a piece then click the tray, or just drag it in. The disc moves too - drag it, or click it and click where it should go.\";\n  draw();\n}\nfunction packed(){ return ORDER.every(function(n){ return !!placed[n]; }); }\nfunction atGoal(p){ return p[0]===GOAL[0] \u0026\u0026 p[1]===GOAL[1]; }\nfunction setDisc(p){\n  disc=[p[0],p[1]];\n  \/* leaving the target square gives the disc a run to make, so a player who\n     packed with it already home only has to move it off and bring it back *\/\n  if(phase===\"slide\" \u0026\u0026 !atGoal(disc)) slideFrom=disc.slice();\n}\n\/* The disc roams while you pack, so parking it on the far square and then\n   packing around it is not a solved puzzle - it still has to make the trip. *\/\nfunction won(){ return phase===\"slide\" \u0026\u0026 atGoal(disc) \u0026\u0026 !atGoal(slideFrom||START); }\n\n\/* ---------- solid outlines ---------- *\/\nfunction outline(cells){\n  \/* Draw the piece as one shape. Rendering cell by cell left seams across the\n     middle of every piece, which made them hard to read as single objects. *\/\n  var has={}; cells.forEach(function(c){ has[c[0]+\",\"+c[1]]=1; });\n  var seg=[];\n  cells.forEach(function(c){\n    var r=c[0], k=c[1];\n    if(!has[(r-1)+\",\"+k]) seg.push([[k,r],[k+1,r]]);\n    if(!has[(r+1)+\",\"+k]) seg.push([[k,r+1],[k+1,r+1]]);\n    if(!has[r+\",\"+(k-1)]) seg.push([[k,r],[k,r+1]]);\n    if(!has[r+\",\"+(k+1)]) seg.push([[k+1,r],[k+1,r+1]]);\n  });\n  return seg;\n}\nfunction loops(cells){\n  \/* Chain the boundary segments into closed rings. A single path per piece is\n     what lets the corners round and the shadow sit under the whole shape,\n     instead of each cell being its own little square. *\/\n  var segs=outline(cells).map(function(e){ return [e[0].slice(),e[1].slice()]; });\n  var out=[];\n  while(segs.length){\n    var ring=[segs[0][0],segs[0][1]]; segs.splice(0,1);\n    var guard=0;\n    while(guard++\u003c400){\n      var head=ring[ring.length-1], found=-1;\n      for(var i=0;i\u003csegs.length;i++){\n        if(segs[i][0][0]===head[0]\u0026\u0026segs[i][0][1]===head[1]){ ring.push(segs[i][1]); found=i; break; }\n        if(segs[i][1][0]===head[0]\u0026\u0026segs[i][1][1]===head[1]){ ring.push(segs[i][0]); found=i; break; }\n      }\n      if(found\u003c0) break;\n      segs.splice(found,1);\n      var a=ring[0], b=ring[ring.length-1];\n      if(a[0]===b[0]\u0026\u0026a[1]===b[1]){ ring.pop(); break; }\n    }\n    if(ring.length\u003e2) out.push(ring);\n  }\n  return out;\n}\nfunction roundedPath(ring,r){\n  \/* walk the ring, cutting each corner with a quadratic *\/\n  var d=\"\", n=ring.length;\n  for(var i=0;i\u003cn;i++){\n    var p0=ring[(i-1+n)%n], p1=ring[i], p2=ring[(i+1)%n];\n    var v1=[p1[0]-p0[0],p1[1]-p0[1]], v2=[p2[0]-p1[0],p2[1]-p1[1]];\n    var l1=Math.hypot(v1[0],v1[1])||1, l2=Math.hypot(v2[0],v2[1])||1;\n    var rr=Math.min(r,l1\/2,l2\/2);\n    var a=[p1[0]-v1[0]\/l1*rr, p1[1]-v1[1]\/l1*rr];\n    var b=[p1[0]+v2[0]\/l2*rr, p1[1]+v2[1]\/l2*rr];\n    d += (i===0 ? \"M\"+a[0].toFixed(2)+\" \"+a[1].toFixed(2)\n                : \"L\"+a[0].toFixed(2)+\" \"+a[1].toFixed(2));\n    d += \"Q\"+p1[0].toFixed(2)+\" \"+p1[1].toFixed(2)+\" \"+b[0].toFixed(2)+\" \"+b[1].toFixed(2);\n  }\n  return d+\"Z\";\n}\nfunction svg(t,a){ var e=document.createElementNS(NS,t);\n  for(var k in a) e.setAttribute(k,a[k]); return e; }\nfunction pieceNode(name,cells,opts){\n  var g=svg(\"g\",{style:\"cursor:grab;touch-action:none\"});\n  g.setAttribute(\"data-p\",name);\n  var rings=loops(cells).map(function(ring){\n    return roundedPath(ring.map(function(p){ return [p[0]*S,p[1]*S]; }), S*0.17);\n  });\n  var d=rings.join(\" \");\n  if(!opts.ghost){\n    g.appendChild(svg(\"path\",{d:d,fill:\"rgba(18,32,40,.22)\",transform:\"translate(0.5,0.9)\",\n      filter:\"url(#owSoft)\"}));\n  }\n  g.appendChild(svg(\"path\",{d:d,fill:\"url(#ow_\"+name+\")\",\n    \"fill-opacity\":opts.ghost?\".45\":\"1\",\n    stroke:opts.bad?\"#C2544C\":(opts.sel?\"#0B7FA8\":\"rgba(10,26,34,.42)\"),\n    \"stroke-width\":opts.sel?\"1.1\":\".45\",\"stroke-linejoin\":\"round\"}));\n  if(!opts.ghost){\n    g.appendChild(svg(\"path\",{d:d,fill:\"none\",stroke:\"rgba(255,255,255,.34)\",\n      \"stroke-width\":\".5\",\"stroke-linejoin\":\"round\",transform:\"translate(0,0.45)\",\n      \"clip-path\":\"url(#owClip_\"+name+\")\"}));\n  }\n  return g;\n}\n\/* ---------- drawing ---------- *\/\nfunction syncButtons(){\n  var t=$(\"owTake\");\n  if(t) t.disabled = !(phase===\"slide\" \u0026\u0026 picked \u0026\u0026 placed[picked]);\n}\nfunction draw(){\n  var s=svg(\"svg\",{viewBox:(-PAD)+\" \"+(-PAD)+\" \"+(W*S+PAD*2)+\" \"+(H*S+PAD*2),\n    width:\"100%\",height:\"100%\",style:\"touch-action:none\"});\n  var defs=svg(\"defs\",{});\n  var grads=\"\";\n  for(var nm in COL){\n    grads+='\u003clinearGradient id=\"ow_'+nm+'\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"\u003e'\n      +'\u003cstop offset=\"0\" stop-color=\"'+LIGHT[nm]+'\"\/\u003e'\n      +'\u003cstop offset=\"1\" stop-color=\"'+COL[nm]+'\"\/\u003e\u003c\/linearGradient\u003e';\n  }\n  defs.innerHTML=grads\n    +'\u003cfilter id=\"owSoft\" x=\"-20%\" y=\"-20%\" width=\"140%\" height=\"140%\"\u003e'\n    +'\u003cfeGaussianBlur stdDeviation=\"0.5\"\/\u003e\u003c\/filter\u003e'\n    +'\u003cfilter id=\"owGrain\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\"\u003e'\n    +'\u003cfeTurbulence type=\"fractalNoise\" baseFrequency=\"0.9\" numOctaves=\"3\" seed=\"4\"\/\u003e'\n    +'\u003cfeColorMatrix type=\"saturate\" values=\"0\"\/\u003e'\n    +'\u003cfeComponentTransfer\u003e\u003cfeFuncA type=\"discrete\" tableValues=\"0 0 0 0 .5\"\/\u003e'\n    +'\u003c\/feComponentTransfer\u003e\u003c\/filter\u003e'\n    +'\u003cradialGradient id=\"owDisc\" cx=\"0.35\" cy=\"0.3\" r=\"0.8\"\u003e'\n    +'\u003cstop offset=\"0\" stop-color=\"#3E63D8\"\/\u003e\u003cstop offset=\"1\" stop-color=\"#15308C\"\/\u003e'\n    +'\u003c\/radialGradient\u003e';\n  s.appendChild(defs);\n  \/* the tray: a speckled rim with a recessed floor, like the printed one *\/\n  s.appendChild(svg(\"rect\",{x:-PAD,y:-PAD,width:W*S+PAD*2,height:H*S+PAD*2,rx:\"3\",fill:\"#EDEAE3\"}));\n  s.appendChild(svg(\"rect\",{x:-PAD,y:-PAD,width:W*S+PAD*2,height:H*S+PAD*2,rx:\"3\",\n    fill:\"#8A8275\",\"fill-opacity\":\".5\",filter:\"url(#owGrain)\"}));\n  s.appendChild(svg(\"rect\",{x:-0.6,y:-0.6,width:W*S+1.2,height:H*S+1.2,rx:\"1.6\",\n    fill:\"#F6F4EF\",stroke:\"rgba(80,74,64,.30)\",\"stroke-width\":\".5\"}));\n  s.appendChild(svg(\"rect\",{x:-0.6,y:-0.6,width:W*S+1.2,height:H*S+1.2,rx:\"1.6\",\n    fill:\"#8A8275\",\"fill-opacity\":\".28\",filter:\"url(#owGrain)\"}));\n  s.appendChild(svg(\"rect\",{x:GOAL[1]*S+1.4,y:GOAL[0]*S+1.4,width:S-2.8,height:S-2.8,rx:\"1.4\",\n    fill:\"none\",stroke:\"#0B7FA8\",\"stroke-opacity\":\".75\",\"stroke-width\":\".65\",\n    \"stroke-dasharray\":\"1.8 1.4\"}));\n  ORDER.forEach(function(n){\n    if(!placed[n]) return;\n    if(drag\u0026\u0026drag.name===n\u0026\u0026drag.live) return;      \/* drawn as the ghost instead *\/\n    s.appendChild(pieceNode(n,placed[n],{sel:picked===n}));\n  });\n  if(disc \u0026\u0026 !(drag\u0026\u0026drag.name===\"disc\"\u0026\u0026drag.live)){\n    s.appendChild(svg(\"circle\",{cx:disc[1]*S+S\/2+0.5,cy:disc[0]*S+S\/2+0.9,r:S*0.36,\n      fill:\"rgba(18,32,40,.26)\",filter:\"url(#owSoft)\",\"pointer-events\":\"none\"}));\n    var d=svg(\"circle\",{cx:disc[1]*S+S\/2,cy:disc[0]*S+S\/2,r:S*0.36,\n      fill:\"url(#owDisc)\",stroke:picked===\"disc\"?\"#0B7FA8\":\"rgba(8,20,60,.5)\",\n      \"stroke-width\":picked===\"disc\"?\".9\":\".4\",style:\"cursor:pointer\"});\n    d.setAttribute(\"data-p\",\"disc\");\n    d.setAttribute(\"style\",\"touch-action:none\");\n    s.appendChild(d);\n    \/* the sheen is decoration: it must not swallow the click meant for the disc *\/\n    s.appendChild(svg(\"ellipse\",{cx:disc[1]*S+S\/2-S*0.1,cy:disc[0]*S+S\/2-S*0.13,\n      rx:S*0.15,ry:S*0.09,fill:\"rgba(255,255,255,.28)\",\"pointer-events\":\"none\"}));\n  }\n  if(drag\u0026\u0026drag.live){\n    if(drag.name===\"disc\"){\n      var dc=(drag.cells\u0026\u0026drag.cells[0])||disc;\n      s.appendChild(svg(\"circle\",{cx:dc[1]*S+S\/2,cy:dc[0]*S+S\/2,r:S*0.36,\n        fill:\"#1B3FAE\",\"fill-opacity\":\".78\",stroke:\"#0B7FA8\",\"stroke-width\":\".7\"}));\n    } else {\n      s.appendChild(pieceNode(drag.name,drag.cells,{ghost:true,bad:!drag.ok,sel:true}));\n    }\n  }\n  svgEl=s;\n  $(\"owBoard\").innerHTML=\"\"; $(\"owBoard\").appendChild(s);\n  wire(s);\n  syncButtons();\n  drawTray();\n  $(\"owSay\").textContent = won()? \"The disc is across. That is the whole puzzle.\" : msg;\n  $(\"owPhase\").textContent = phase===\"pack\" ? \"Step one: pack the tray\"\n                                            : \"Step two: move the disc\";\n}\nfunction drawTray(){\n  var box=$(\"owTray\"); box.innerHTML=\"\";\n  ORDER.forEach(function(n){\n    if(!tray[n]) return;\n    var cs=tray[n];\n    var hh=Math.max.apply(null,cs.map(function(c){return c[0];}))+1;\n    var ww=Math.max.apply(null,cs.map(function(c){return c[1];}))+1;\n    var s=svg(\"svg\",{viewBox:\"-.6 -.6 \"+(ww*S+1.2)+\" \"+(hh*S+1.2),\n      width:(ww*19)+\"px\",height:(hh*19)+\"px\",style:\"cursor:grab;touch-action:none\"});\n    s.appendChild(pieceNode(n,cs,{sel:picked===n}));\n    if(picked===n) s.style.outline=\"2px solid #0B7FA8\";\n    s.style.outlineOffset=\"2px\"; s.style.borderRadius=\"4px\";\n    s.addEventListener(\"pointerdown\",function(e){ startDrag(n,cs,e,true); });\n    box.appendChild(s);\n  });\n  if(!Object.keys(tray).length) box.innerHTML='\u003cspan class=\"empty\"\u003eAll packed\u003c\/span\u003e';\n}\n\/* ---------- dragging ---------- *\/\nvar PAD=3;                                   \/* the tray rim, in view units *\/\nfunction cellAt(ev){\n  \/* Derived from the viewBox rather than hardcoded. Adding the rim changed the\n     viewBox from -1 to -3 and this kept using the old numbers, so every\n     pointer position mapped to the wrong square. *\/\n  var b=svgEl.getBoundingClientRect();\n  var vw=W*S+PAD*2, vh=H*S+PAD*2;\n  var vx=-PAD+((ev.clientX-b.left)\/b.width)*vw;\n  var vy=-PAD+((ev.clientY-b.top)\/b.height)*vh;\n  return [Math.floor(vy\/S), Math.floor(vx\/S)];\n}\nfunction originOf(cells){\n  return [Math.min.apply(null,cells.map(function(c){return c[0];})),\n          Math.min.apply(null,cells.map(function(c){return c[1];}))];\n}\nfunction startDrag(name,cells,ev,fromRack){\n  ev.preventDefault();\n  var base=norm(cells.map(function(c){return c.slice();}));\n  var anchor=fromRack?[0,0]:null;\n  drag={name:name,base:base,fromRack:fromRack,live:false,cells:cells,ok:true,anchor:anchor};\n  if(!fromRack \u0026\u0026 name!==\"disc\" \u0026\u0026 placed[name]){\n    \/* which square of the piece the pointer came down on, so the piece follows\n       the hand instead of assuming it was grabbed by its first cell *\/\n    var gc=cellAt(ev), og=originOf(placed[name]);\n    drag.grab=[gc[0]-og[0], gc[1]-og[1]];\n  }\n  if(!fromRack\u0026\u0026name!==\"disc\"){\n    drag.start=cells.map(function(c){return c.slice();});\n  }\n  window.addEventListener(\"pointermove\",onMove);\n  window.addEventListener(\"pointerup\",onUp);\n  window.addEventListener(\"pointercancel\",onCancel);\n}\nfunction onCancel(){\n  window.removeEventListener(\"pointermove\",onMove);\n  window.removeEventListener(\"pointerup\",onUp);\n  window.removeEventListener(\"pointercancel\",onCancel);\n  if(!drag) return;\n  var d=drag; drag=null;\n  if(d.restore){                     \/* it was lifted off the board - put it back *\/\n    placed[d.name]=d.restore.cells; shapeOf[d.name]=d.restore.shape; delete tray[d.name];\n  }\n  picked=null; draw();\n}\nfunction onMove(ev){\n  if(!drag||!svgEl) return;\n  var rc=cellAt(ev);\n  drag.live=true;\n  if(drag.name===\"disc\"){\n    \/* the disc never jumps: it only follows as far as empty squares reach *\/\n    var occ=occupied(\"disc\");\n    if(rc[0]\u003e=0\u0026\u0026rc[0]\u003cH\u0026\u0026rc[1]\u003e=0\u0026\u0026rc[1]\u003cW\u0026\u0026!occ[rc[0]+\",\"+rc[1]]\n       \u0026\u0026reachable(disc,rc,occ)) drag.cells=[rc];\n    else if(!drag.cells) drag.cells=[disc.slice()];\n    drag.ok=true; draw(); return;\n  }\n  if(phase===\"pack\"||drag.fromRack){\n    var cells=drag.base.map(function(c){ return [c[0]+rc[0],c[1]+rc[1]]; });\n    drag.cells=cells; drag.ok=fits(drag.name,cells);\n  } else {\n    \/* sliding: step toward the pointer, pushing anything in the way *\/\n    var guard=0, grab=drag.grab||[0,0];\n    while(guard++\u003c12){\n      var cur=originOf(placed[drag.name]);\n      var want=[rc[0]-grab[0], rc[1]-grab[1]];\n      var dr=Math.sign(want[0]-cur[0]), dc=Math.sign(want[1]-cur[1]);\n      if(!dr\u0026\u0026!dc) break;\n      \/* try the bigger pull first, then the other axis, so a mostly sideways\n         drag is not abandoned just because the vertical step is blocked *\/\n      var tries=(Math.abs(want[0]-cur[0])\u003e=Math.abs(want[1]-cur[1]))\n        ? [[dr,0],[0,dc]] : [[0,dc],[dr,0]];\n      var mv=null, step=null;\n      for(var ti=0;ti\u003ctries.length;ti++){\n        var t=tries[ti];\n        if(!t[0]\u0026\u0026!t[1]) continue;\n        mv=chainMove(drag.name,t[0],t[1]);\n        if(mv){ step=t; break; }\n      }\n      if(!mv) break;\n      applyChain(mv,step[0],step[1]);\n      if(Object.keys(mv).length\u003e1) msg=\"Pushed \"+(Object.keys(mv).length-1)\n        +\" piece\"+(Object.keys(mv).length\u003e2?\"s\":\"\")+\" along.\";\n    }\n    drag.cells=placed[drag.name].map(function(c){return c.slice();});\n    drag.ok=true;\n  }\n  draw();\n}\nfunction onUp(){\n  window.removeEventListener(\"pointermove\",onMove);\n  window.removeEventListener(\"pointerup\",onUp);\n  window.removeEventListener(\"pointercancel\",onCancel);\n  if(!drag){ return; }\n  var d=drag; drag=null;\n  if(!d.live){\n    \/* a tap, not a drag *\/\n    if(d.name===\"disc\"){\n      picked=(picked===\"disc\")?null:\"disc\";\n      msg=(picked===\"disc\")?\"Disc picked up. Click an empty square to send it there.\":\"\";\n      draw(); return;\n    }\n    if(d.fromRack){ picked=d.name; }           \/* hold it until the tray is tapped *\/\n    else if(phase===\"slide\"){\n      if(picked===d.name){ picked=null; msg=\"\"; }\n      else {\n        picked=d.name;\n        msg=\"Tap a square to nudge it that way, or drag it. \"\n           +\"Take out puts it back in the tray.\";\n      }\n    }\n    draw(); return;\n  }\n  if(d.live){\n    picked=null;\n    if(d.name===\"disc\"){\n      var t=d.cells\u0026\u0026d.cells[0];\n      var occ3=occupied(\"disc\");\n      if(t\u0026\u0026!occ3[t[0]+\",\"+t[1]]\u0026\u0026reachable(disc,t,occ3)){ setDisc(t); msg=\"\"; }\n      draw(); return;\n    }\n    if(phase===\"pack\"||d.fromRack){\n      if(d.ok){ placed[d.name]=d.cells; shapeOf[d.name]=d.base; delete tray[d.name];\n        msg = packed()? \"\" : \"\";\n        if(packed()){ phase=\"slide\"; slideFrom=disc.slice();\n          msg = atGoal(disc)\n            ? \"Packed, but the disc is already sitting on its target. Start it \"\n              +\"somewhere else so it has a run to make.\"\n            : \"Packed. Drag the disc, or click it and click where it should go. \"\n              +\"Arrow keys work too. Click a piece to take it back out.\"; }\n      } else { msg=\"That will not fit there.\"; }\n    }\n  }\n  draw();\n}\nfunction discStep(dr,dc){\n  var n=[disc[0]+dr,disc[1]+dc];\n  if(n[0]\u003c0||n[0]\u003e=H||n[1]\u003c0||n[1]\u003e=W) return false;\n  var occ=occupied(\"disc\");\n  if(occ[n[0]+\",\"+n[1]]){ msg=\"The disc is blocked. Drag a piece out of its way.\"; return false; }\n  setDisc(n); msg=\"\"; return true;\n}\nfunction occupantAt(cell,movers){\n  var k=cell[0]+\",\"+cell[1];\n  for(var n in placed){\n    if(movers[n]) continue;\n    for(var i=0;i\u003cplaced[n].length;i++)\n      if(placed[n][i][0]===cell[0]\u0026\u0026placed[n][i][1]===cell[1]) return n;\n  }\n  if(!movers.disc \u0026\u0026 disc \u0026\u0026 disc[0]===cell[0] \u0026\u0026 disc[1]===cell[1]) return \"disc\";\n  return null;\n}\nfunction stepToward(name,rc){\n  var cs=placed[name];\n  var rs=cs.map(function(c){return c[0];}), cl=cs.map(function(c){return c[1];});\n  var top=Math.min.apply(null,rs), bot=Math.max.apply(null,rs);\n  var lef=Math.min.apply(null,cl), rig=Math.max.apply(null,cl);\n  var dr=rc[0]\u003ctop?-1:(rc[0]\u003ebot?1:0);\n  var dc=rc[1]\u003clef?-1:(rc[1]\u003erig?1:0);\n  if(!dr\u0026\u0026!dc) return false;\n  \/* the bigger offset first, then the other axis, so a tap that is mostly\n     sideways still moves the piece when the vertical step is blocked *\/\n  var dRow=Math.min(Math.abs(rc[0]-top),Math.abs(rc[0]-bot));\n  var dCol=Math.min(Math.abs(rc[1]-lef),Math.abs(rc[1]-rig));\n  var tries=(dRow\u003e=dCol)?[[dr,0],[0,dc]]:[[0,dc],[dr,0]];\n  for(var i=0;i\u003ctries.length;i++){\n    var t=tries[i];\n    if(!t[0]\u0026\u0026!t[1]) continue;\n    var mv=chainMove(name,t[0],t[1]);\n    if(mv){\n      applyChain(mv,t[0],t[1]);\n      msg = Object.keys(mv).length\u003e1\n        ? \"Pushed \"+(Object.keys(mv).length-1)+\" along.\"\n        : \"\";\n      return true;\n    }\n  }\n  msg=\"That piece has nowhere to go that way.\";\n  return false;\n}\nfunction chainMove(name,dr,dc){\n  \/* Slide one piece into another and the second one goes too, as long as it\n     has somewhere to go. The push carries on down the line, and the disc gets\n     shoved along with everything else, the way a loose disc in a tray would. *\/\n  var movers={}; movers[name]=1;\n  var queue=[name], guard=0;\n  while(queue.length \u0026\u0026 guard++\u003c30){\n    var n=queue.shift();\n    var cells=(n===\"disc\")?[disc]:placed[n];\n    for(var i=0;i\u003ccells.length;i++){\n      var t=[cells[i][0]+dr, cells[i][1]+dc];\n      if(t[0]\u003c0||t[0]\u003e=H||t[1]\u003c0||t[1]\u003e=W) return null;   \/* the tray wall stops it *\/\n      var occ=occupantAt(t,movers);\n      if(occ){ movers[occ]=1; queue.push(occ); }\n    }\n  }\n  if(queue.length) return null;\n  return movers;\n}\nfunction applyChain(movers,dr,dc){\n  for(var n in movers){\n    if(n===\"disc\"){ setDisc([disc[0]+dr, disc[1]+dc]); continue; }\n    placed[n]=placed[n].map(function(c){ return [c[0]+dr,c[1]+dc]; });\n  }\n}\nfunction reachable(from,to,occ){\n  \/* the disc travels through empty squares, it never jumps over a piece *\/\n  var seen={}, q=[from]; seen[from[0]+\",\"+from[1]]=1;\n  while(q.length){\n    var c=q.shift();\n    if(c[0]===to[0]\u0026\u0026c[1]===to[1]) return true;\n    var ds=[[1,0],[-1,0],[0,1],[0,-1]];\n    for(var i=0;i\u003cds.length;i++){\n      var n=[c[0]+ds[i][0],c[1]+ds[i][1]], k=n[0]+\",\"+n[1];\n      if(n[0]\u003c0||n[0]\u003e=H||n[1]\u003c0||n[1]\u003e=W||seen[k]||occ[k]) continue;\n      seen[k]=1; q.push(n);\n    }\n  }\n  return false;\n}\nfunction wire(s){\n  \/* Swiping the board walks the disc, so once everything is packed you can\n     play with flicks or the arrow keys and never have to grab the disc itself. *\/\n  s.addEventListener(\"click\",function(ev){\n    \/* Picking the disc up happens in onUp - see the tap branch there. The disc is\n       loose in the tray from the start, so it answers to clicks while you are\n       still packing, not only once the last piece is in. *\/\n    if(picked===\"disc\"){\n      var rc2=cellAt(ev);\n      var occ2=occupied(\"disc\");\n      if(rc2[0]\u003c0||rc2[0]\u003e=H||rc2[1]\u003c0||rc2[1]\u003e=W) return;\n      if(rc2[0]===disc[0]\u0026\u0026rc2[1]===disc[1]) return;   \/* the tap that picked it up *\/\n      if(occ2[rc2[0]+\",\"+rc2[1]]){ msg=\"Something is already there.\"; draw(); return; }\n      if(reachable(disc,rc2,occ2)){ setDisc(rc2); picked=null; msg=\"\"; }\n      else msg=\"No clear run of empty squares that way.\";\n      draw(); return;\n    }\n    if(phase===\"slide\"){\n      if(picked\u0026\u0026placed[picked]){\n        var rcp=cellAt(ev);\n        if(rcp[0]\u003c0||rcp[0]\u003e=H||rcp[1]\u003c0||rcp[1]\u003e=W) return;\n        stepToward(picked,rcp); draw();\n      }\n      return;\n    }\n    if(!picked||!tray[picked]) return;\n    var rc=cellAt(ev);\n    var base=norm(tray[picked].map(function(c){return c.slice();}));\n    var cells=base.map(function(c){ return [c[0]+rc[0],c[1]+rc[1]]; });\n    if(fits(picked,cells)){\n      placed[picked]=cells; shapeOf[picked]=base; delete tray[picked];\n      picked=null;\n      if(packed()){ phase=\"slide\"; slideFrom=disc.slice();\n        msg = atGoal(disc)\n          ? \"Packed, but the disc is already sitting on its target. Start it \"\n            +\"somewhere else so it has a run to make.\"\n          : \"Packed. Arrow keys or a swipe move the disc. Drag a piece to shift it.\"; }\n      else msg=\"\";\n    } else msg=\"That will not fit there.\";\n    draw();\n  });\n  var sw=null;\n  s.addEventListener(\"pointerdown\",function(ev){\n    \/* a swipe may start on the disc too - only a piece takes priority *\/\n    var hit=ev.target.closest\u0026\u0026ev.target.closest(\"[data-p]\");\n    if(hit\u0026\u0026hit.getAttribute(\"data-p\")!==\"disc\") return;\n    sw={x:ev.clientX,y:ev.clientY};\n  });\n  s.addEventListener(\"pointerup\",function(ev){\n    if(!sw) return;\n    var dx=ev.clientX-sw.x, dy=ev.clientY-sw.y; sw=null;\n    if(Math.abs(dx)\u003c12\u0026\u0026Math.abs(dy)\u003c12) return;\n    var step=Math.abs(dx)\u003eMath.abs(dy) ? [0,dx\u003e0?1:-1] : [dy\u003e0?1:-1,0];\n    var n=Math.max(1,Math.round(Math.max(Math.abs(dx),Math.abs(dy))\n          \/(s.getBoundingClientRect().width\/W)));\n    for(var k=0;k\u003cn;k++) if(!discStep(step[0],step[1])) break;\n    draw();\n  });\n  Array.prototype.forEach.call(s.querySelectorAll(\"[data-p]\"),function(e){\n    e.addEventListener(\"pointerdown\",function(ev){\n      var n=e.getAttribute(\"data-p\");\n      if(n===\"disc\"){\n        \/* a piece in hand wants to be placed, so let the click fall through\n           to the tray and report that the disc's square is taken *\/\n        if(picked\u0026\u0026picked!==\"disc\"\u0026\u0026tray[picked]) return;\n        startDrag(\"disc\",[disc.slice()],ev,false); return;\n      }\n      if(phase===\"pack\"){\n        var wasAt=placed[n], wasShape=shapeOf[n];\n        tray[n]=shapeOf[n]; delete placed[n]; delete shapeOf[n];\n        startDrag(n,tray[n],ev,true);\n        if(drag) drag.restore={cells:wasAt,shape:wasShape};\n      } else startDrag(n,placed[n],ev,false);\n    });\n  });\n}\ndocument.addEventListener(\"keydown\",function(e){\n  var d={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]}[e.key];\n  if(!d) return;\n  e.preventDefault();\n  if(phase===\"slide\"\u0026\u0026picked\u0026\u0026placed[picked]){\n    var mv=chainMove(picked,d[0],d[1]);\n    if(mv){ applyChain(mv,d[0],d[1]); msg=\"\"; }\n    else msg=\"That piece has nowhere to go that way.\";\n  } else discStep(d[0],d[1]);\n  draw();\n});\n$(\"owRotate\").addEventListener(\"click\",function(){\n  var n=(picked\u0026\u0026tray[picked])?picked:Object.keys(tray)[0];\n  if(n){ tray[n]=rotate(tray[n]); draw(); }\n});\n$(\"owFlip\").addEventListener(\"click\",function(){\n  var n=(picked\u0026\u0026tray[picked])?picked:Object.keys(tray)[0];\n  if(n){ tray[n]=flipped(tray[n]); draw(); }\n});\nfunction backToPack(){\n  \/* The disc stays exactly where it is. Taking a piece out is a way to free it\n     up, so sending it home would undo the run you were in the middle of. *\/\n  phase=\"pack\";\n  slideFrom=null;\n}\nvar takeBtn=$(\"owTake\");\nif(takeBtn) takeBtn.addEventListener(\"click\",function(){\n  if(phase!==\"slide\"||!picked||!placed[picked]) return;\n  tray[picked]=shapeOf[picked];\n  delete placed[picked]; delete shapeOf[picked];\n  backToPack();\n  msg=\"Took that piece out. Place it again when you are ready.\";\n  draw();\n});\nvar emptyBtn=$(\"owUnpack\");\nif(emptyBtn) emptyBtn.addEventListener(\"click\",function(){\n  ORDER.forEach(function(n){\n    if(!placed[n]) return;\n    tray[n]=shapeOf[n];\n    delete placed[n]; delete shapeOf[n];\n  });\n  backToPack(); picked=null;\n  msg=\"Tray emptied. Pack it again however you like.\";\n  draw();\n});\n$(\"owReset\").addEventListener(\"click\",reset);\nreset();\n})();\n\n})();\n\u003c\/script\u003e\n\n\n\n\n\n\n\u003cp\u003ePut the disc in one corner. Pack the pieces in around it. Now slide them until the disc comes out in the opposite corner.\u003c\/p\u003e\n\u003cp\u003eGoal: fit every piece into the tray so one corner stays free for the disc, then move the disc to the diagonally opposite corner using sliding moves alone.\u003c\/p\u003e\n\u003cp\u003eAlexander Magyarics took a tray packing puzzle and gave it somewhere to go. Finding an arrangement that fits is the easy half. Finding the one that also leaves the disc a path across the tray is the part worth owning. It earned a Jury Honorable Mention at the 2026 Nob Yoshigahara Puzzle Design Competition in Assisi.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about One Way or Another?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eUnique puzzle in one tray: pack it, then slide to create a path\u003c\/li\u003e\n\u003cli\u003eJury Honorable Mention, 2026 Nob Yoshigahara Puzzle Design Competition\u003c\/li\u003e\n\u003cli\u003eFlat and light enough to take with you\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eBest for: packing puzzle fans who have run out of tray puzzles that still surprise them, and gift buyers after a small desk puzzle with a real idea behind it.\u003c\/p\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/alexander-magyarics\"\u003eAlexander Magyarics\u003c\/a\u003e\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51517396910247,"sku":"GP-ONEWAY","price":16.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/one_way_or_another___move_the_disc_corne_marble.png?v=1792040466"},{"product_id":"6l-puzzle","title":"6L Puzzle | Hide the Holes","description":"\u003cp\u003eSix identical L-shaped pieces. One cube with holes in its walls. Getting them inside is only half the job.\u003c\/p\u003e\n\u003cp\u003eGoal: pack all 6 L-shaped pieces into the cube so that every hole is hidden.\u003c\/p\u003e\n\u003cp\u003eShips disassembled.\u003c\/p\u003e\n\u003cp\u003eDesigned by Osanori Yamamoto. Each window in the cube has to end up covered by a piece - no hole you can see through.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about 6L?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eDevelops 3D spatial imagination\u003c\/li\u003e\n\u003cli\u003eSix identical pieces, one box to fill\u003c\/li\u003e\n\u003cli\u003eA hide-the-holes puzzle, like Osanori's A6L and 6N\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/osanori-yamamoto\"\u003eOsanori Yamamoto\u003c\/a\u003e\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51858012766375,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/6l_puzzle___hide_the_holes_marble.png?v=1794451855"},{"product_id":"acorn","title":"Acorn | Pack 3 Pieces in Box","description":"\u003cp\u003eThree pieces. One cube with an open corner. Looks simple - it is not.\u003c\/p\u003e\n\u003cp\u003eGoal: pack all 3 pieces inside the cube.\u003c\/p\u003e\n\u003cp\u003eShips disassembled.\u003c\/p\u003e\n\u003cp\u003eDesigned by Osanori Yamamoto. Everything has to go in through the opening in one corner of the cube.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Acorn?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eDevelops 3D spatial imagination\u003c\/li\u003e\n\u003cli\u003eOnly three pieces - and still a real puzzle\u003c\/li\u003e\n\u003cli\u003eSmall cube that sits well on a desk\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/osanori-yamamoto\"\u003eOsanori Yamamoto\u003c\/a\u003e\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51858031575207,"sku":null,"price":22.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/acorn_marble_v2.png?v=1794817341"},{"product_id":"superdia","title":"Superdia | Pack 3 Pieces in Box","description":"\u003cp\u003eGoal: pack all 3 pieces inside the cube.\u003c\/p\u003e\n\u003cp\u003eShips disassembled.\u003c\/p\u003e\n\u003cp\u003eDesigned by Osanori Yamamoto. The window sits across the corner of the cube, and that changes how every piece has to go in. There is also a hole on the opposite corner. Why is it there?\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Superdia?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eDevelops 3D spatial imagination\u003c\/li\u003e\n\u003cli\u003eOnly three pieces\u003c\/li\u003e\n\u003cli\u003eA window cut across the corner instead of a face\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/osanori-yamamoto\"\u003eOsanori Yamamoto\u003c\/a\u003e\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51858037145767,"sku":null,"price":22.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/superdia___pack_the_pieces_in_box_marble.png?v=1794452171"},{"product_id":"voz-2","title":"Voz 2 | Pack 3 Pieces in Box","description":"\u003cp\u003ePack three pieces inside an apparent cube. The shape of this cube may be tricky to fill! \u003c\/p\u003e\n\u003cp\u003eGoal: pack all 3 pieces inside the cube.\u003c\/p\u003e\n\u003cp\u003eShips disassembled.\u003c\/p\u003e\n\u003cp\u003eDesigned by Osanori Yamamoto. The cube has more than one opening, and working out which one each piece needs is just one part of the puzzle.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eWhat's special about Voz 2?\u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eDevelops 3D spatial imagination\u003c\/li\u003e\n\u003cli\u003eOnly three pieces\u003c\/li\u003e\n\u003cli\u003eSmall cube that sits well on a desk\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned by \u003ca href=\"\/collections\/osanori-yamamoto\"\u003eOsanori Yamamoto\u003c\/a\u003e\u003c\/p\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51858052350119,"sku":null,"price":22.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/voz_2_scattered_marble_00d98bc7-fa41-4c5e-95ca-2968c6280e4b.png?v=1794733165"},{"product_id":"minima-1","title":"MINIMA 1 | Pack 3 Pieces in Box","description":"\u003ch2\u003eMINIMA 1 - Quick Summary\u003c\/h2\u003e\u003cp\u003eMINIMA 1 is a packing puzzle by \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e, from his MINIMA series. Your goal: fit all 3 turquoise pieces inside the small marble-white box. The box is open at one top corner and has a square window in its side.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like packing puzzles with very few pieces, and anyone who already owns \u003ca href=\"\/products\/minima-tower\"\u003eMINIMA Tower\u003c\/a\u003e or \u003ca href=\"\/products\/minima-slider\"\u003eMINIMA Slider\u003c\/a\u003e.\u003c\/p\u003e\u003ch2\u003eThe MINIMA Series\u003c\/h2\u003e\u003cp\u003eMINIMA is my favorite series of Frederic's. Every one is the same idea: a small box, a handful of pieces, and nothing else to hide behind. Frederic lives in Tokyo and works out many of his puzzles in his head on the Tokyo Metro. I make these with his blessing.\u003c\/p\u003e\u003cp\u003eMINIMA 1 is one of four new MINIMA puzzles, along with \u003ca href=\"\/products\/minima-2\"\u003eMINIMA 2\u003c\/a\u003e, \u003ca href=\"\/products\/minima-3\"\u003eMINIMA 3\u003c\/a\u003e and \u003ca href=\"\/products\/minima-4\"\u003eMINIMA 4\u003c\/a\u003e. If you want all four, they come together as the \u003ca href=\"\/products\/minima-1-4-set\"\u003eMINIMA 1-4 Set\u003c\/a\u003e. The next four, MINIMA 5 to 8, come together as the \u003ca href=\"\/products\/minima-5-8-set\"\u003eMINIMA 5-8 Set\u003c\/a\u003e.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eShips:\u003c\/strong\u003e Disassembled - the 3 pieces arrive outside the box.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is MINIMA 1?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA packing puzzle by Frederic Boucher: fit 3 pieces inside a small box. It is part of his MINIMA series, along with MINIMA 2, MINIMA 3, MINIMA 4, MINIMA 5 to 8, MINIMA Tower and MINIMA Slider.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eDoes MINIMA 1 come assembled?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. It ships disassembled, with the 3 pieces outside the box. Getting them in is the puzzle.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed MINIMA 1?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eFrederic Boucher, a Canadian puzzle designer living in Tokyo. You can find all his puzzles in the \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher collection\u003c\/a\u003e.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51928454561959,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/minima_1_scattered_marble.png?v=1795073506"},{"product_id":"minima-2","title":"MINIMA 2 | Pack 4 Pieces in Box","description":"\u003ch2\u003eMINIMA 2 - Quick Summary\u003c\/h2\u003e\u003cp\u003eMINIMA 2 is a packing puzzle by \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e, from his MINIMA series. Your goal: fit all 4 turquoise pieces inside the small marble-white box. The box has two windows in its front, so you can watch the pieces settle in.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like packing puzzles with very few pieces, and anyone who already owns \u003ca href=\"\/products\/minima-tower\"\u003eMINIMA Tower\u003c\/a\u003e or \u003ca href=\"\/products\/minima-slider\"\u003eMINIMA Slider\u003c\/a\u003e.\u003c\/p\u003e\u003ch2\u003eThe MINIMA Series\u003c\/h2\u003e\u003cp\u003eMINIMA is my favorite series of Frederic's. Every one is the same idea: a small box, a handful of pieces, and nothing else to hide behind. Frederic lives in Tokyo and works out many of his puzzles in his head on the Tokyo Metro. I make these with his blessing.\u003c\/p\u003e\u003cp\u003eMINIMA 2 is one of four new MINIMA puzzles, along with \u003ca href=\"\/products\/minima-1\"\u003eMINIMA 1\u003c\/a\u003e, \u003ca href=\"\/products\/minima-3\"\u003eMINIMA 3\u003c\/a\u003e and \u003ca href=\"\/products\/minima-4\"\u003eMINIMA 4\u003c\/a\u003e. If you want all four, they come together as the \u003ca href=\"\/products\/minima-1-4-set\"\u003eMINIMA 1-4 Set\u003c\/a\u003e. The next four, MINIMA 5 to 8, come together as the \u003ca href=\"\/products\/minima-5-8-set\"\u003eMINIMA 5-8 Set\u003c\/a\u003e.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eShips:\u003c\/strong\u003e Disassembled - the 4 pieces arrive outside the box.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is MINIMA 2?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA packing puzzle by Frederic Boucher: fit 4 pieces inside a small box. It is part of his MINIMA series, along with MINIMA 1, MINIMA 3, MINIMA 4, MINIMA 5 to 8, MINIMA Tower and MINIMA Slider.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eDoes MINIMA 2 come assembled?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. It ships disassembled, with the 4 pieces outside the box. Getting them in is the puzzle.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed MINIMA 2?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eFrederic Boucher, a Canadian puzzle designer living in Tokyo. You can find all his puzzles in the \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher collection\u003c\/a\u003e.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51928548343975,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/minima_2_scattered_marble.png?v=1795073510"},{"product_id":"minima-3","title":"MINIMA 3 | Pack 3 Pieces in Box","description":"\u003ch2\u003eMINIMA 3 - Quick Summary\u003c\/h2\u003e\u003cp\u003eMINIMA 3 is a packing puzzle by \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e, from his MINIMA series. Your goal: fit all 3 turquoise pieces inside the small marble-white box. The box has two small slots in its top and open sections in its walls.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like packing puzzles with very few pieces, and anyone who already owns \u003ca href=\"\/products\/minima-tower\"\u003eMINIMA Tower\u003c\/a\u003e or \u003ca href=\"\/products\/minima-slider\"\u003eMINIMA Slider\u003c\/a\u003e.\u003c\/p\u003e\u003ch2\u003eThe MINIMA Series\u003c\/h2\u003e\u003cp\u003eMINIMA is my favorite series of Frederic's. Every one is the same idea: a small box, a handful of pieces, and nothing else to hide behind. Frederic lives in Tokyo and works out many of his puzzles in his head on the Tokyo Metro. I make these with his blessing.\u003c\/p\u003e\u003cp\u003eMINIMA 3 is one of four new MINIMA puzzles, along with \u003ca href=\"\/products\/minima-1\"\u003eMINIMA 1\u003c\/a\u003e, \u003ca href=\"\/products\/minima-2\"\u003eMINIMA 2\u003c\/a\u003e and \u003ca href=\"\/products\/minima-4\"\u003eMINIMA 4\u003c\/a\u003e. If you want all four, they come together as the \u003ca href=\"\/products\/minima-1-4-set\"\u003eMINIMA 1-4 Set\u003c\/a\u003e. The next four, MINIMA 5 to 8, come together as the \u003ca href=\"\/products\/minima-5-8-set\"\u003eMINIMA 5-8 Set\u003c\/a\u003e.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eShips:\u003c\/strong\u003e Disassembled - the 3 pieces arrive outside the box.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is MINIMA 3?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA packing puzzle by Frederic Boucher: fit 3 pieces inside a small box. It is part of his MINIMA series, along with MINIMA 1, MINIMA 2, MINIMA 4, MINIMA 5 to 8, MINIMA Tower and MINIMA Slider.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eDoes MINIMA 3 come assembled?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. It ships disassembled, with the 3 pieces outside the box. Getting them in is the puzzle.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed MINIMA 3?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eFrederic Boucher, a Canadian puzzle designer living in Tokyo. You can find all his puzzles in the \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher collection\u003c\/a\u003e.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51928931401895,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/minima_3_scattered_marble.png?v=1795073514"},{"product_id":"minima-4","title":"MINIMA 4 | Pack 4 Pieces in Box","description":"\u003ch2\u003eMINIMA 4 - Quick Summary\u003c\/h2\u003e\u003cp\u003eMINIMA 4 is a packing puzzle by \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e, from his MINIMA series. Your goal: fit all 4 turquoise pieces inside the small marble-white box. The box has two windows in its front and an open section on one side.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like packing puzzles with very few pieces, and anyone who already owns \u003ca href=\"\/products\/minima-tower\"\u003eMINIMA Tower\u003c\/a\u003e or \u003ca href=\"\/products\/minima-slider\"\u003eMINIMA Slider\u003c\/a\u003e.\u003c\/p\u003e\u003ch2\u003eThe MINIMA Series\u003c\/h2\u003e\u003cp\u003eMINIMA is my favorite series of Frederic's. Every one is the same idea: a small box, a handful of pieces, and nothing else to hide behind. Frederic lives in Tokyo and works out many of his puzzles in his head on the Tokyo Metro. I make these with his blessing.\u003c\/p\u003e\u003cp\u003eMINIMA 4 is one of four new MINIMA puzzles, along with \u003ca href=\"\/products\/minima-1\"\u003eMINIMA 1\u003c\/a\u003e, \u003ca href=\"\/products\/minima-2\"\u003eMINIMA 2\u003c\/a\u003e and \u003ca href=\"\/products\/minima-3\"\u003eMINIMA 3\u003c\/a\u003e. If you want all four, they come together as the \u003ca href=\"\/products\/minima-1-4-set\"\u003eMINIMA 1-4 Set\u003c\/a\u003e. The next four, MINIMA 5 to 8, come together as the \u003ca href=\"\/products\/minima-5-8-set\"\u003eMINIMA 5-8 Set\u003c\/a\u003e.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eShips:\u003c\/strong\u003e Disassembled - the 4 pieces arrive outside the box.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is MINIMA 4?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA packing puzzle by Frederic Boucher: fit 4 pieces inside a small box. It is part of his MINIMA series, along with MINIMA 1, MINIMA 2, MINIMA 3, MINIMA 5 to 8, MINIMA Tower and MINIMA Slider.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eDoes MINIMA 4 come assembled?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. It ships disassembled, with the 4 pieces outside the box. Getting them in is the puzzle.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed MINIMA 4?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eFrederic Boucher, a Canadian puzzle designer living in Tokyo. You can find all his puzzles in the \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher collection\u003c\/a\u003e.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":51929039241383,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/minima_4_scattered_marble.png?v=1795073517"},{"product_id":"minima-5","title":"MINIMA 5 | Pack 4 Pieces in Box","description":"\u003ch2\u003eMINIMA 5 - Quick Summary\u003c\/h2\u003e\u003cp\u003eMINIMA 5 is a packing puzzle by \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e, from his MINIMA series. Your goal: fit all 4 turquoise pieces inside the small marble-white box. It has two windows on top, and more openings cut into its front and side.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like packing puzzles with very few pieces, and anyone who has already solved \u003ca href=\"\/products\/minima-1\"\u003eMINIMA 1\u003c\/a\u003e to \u003ca href=\"\/products\/minima-4\"\u003e4\u003c\/a\u003e.\u003c\/p\u003e\u003ch2\u003eThe MINIMA Series\u003c\/h2\u003e\u003cp\u003eMINIMA is my favorite series of Frederic's. Every one is the same idea: a small box, a handful of pieces, and nothing else to hide behind. Frederic lives in Tokyo and works out many of his puzzles in his head on the Tokyo Metro. I make these with his blessing.\u003c\/p\u003e\u003cp\u003eThe boxes are all the same size. Only the openings change, and that is enough to make each one a new puzzle. Allard Walker wrote that everyone he handed the series to had the same reaction: \"How the heck can this simple little thing be \u003cem\u003ethat\u003c\/em\u003e difficult?\"\u003c\/p\u003e\u003cp\u003eMINIMA 5 is one of four new MINIMA puzzles, along with \u003ca href=\"\/products\/minima-6\"\u003eMINIMA 6\u003c\/a\u003e, \u003ca href=\"\/products\/minima-7\"\u003eMINIMA 7\u003c\/a\u003e and \u003ca href=\"\/products\/minima-8\"\u003eMINIMA 8\u003c\/a\u003e. If you want all four, they come together as the \u003ca href=\"\/products\/minima-5-8-set\"\u003eMINIMA 5-8 Set\u003c\/a\u003e. The first four are here as well, as the \u003ca href=\"\/products\/minima-1-4-set\"\u003eMINIMA 1-4 Set\u003c\/a\u003e.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eShips:\u003c\/strong\u003e Disassembled - the 4 pieces arrive outside the box.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is MINIMA 5?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA packing puzzle by Frederic Boucher: fit 4 pieces inside a small box. It is part of his MINIMA series, along with MINIMA 1 to 8, MINIMA Tower and MINIMA Slider.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eDoes MINIMA 5 come assembled?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. It ships disassembled, with the 4 pieces outside the box. Getting them in is the puzzle.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed MINIMA 5?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eFrederic Boucher, a Canadian puzzle designer living in Tokyo. You can find all his puzzles in the \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher collection\u003c\/a\u003e.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":52115714375847,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/minima_5_scattered_marble.png?v=1795746632"},{"product_id":"minima-6","title":"MINIMA 6 | Pack 3 Pieces in Box","description":"\u003ch2\u003eMINIMA 6 - Quick Summary\u003c\/h2\u003e\u003cp\u003eMINIMA 6 is a packing puzzle by \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e, from his MINIMA series. Your goal: fit all 3 turquoise pieces inside the small marble-white box. Its front is cut wide open, right up into the top, and one side is open too.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like packing puzzles with very few pieces, and anyone who has already solved \u003ca href=\"\/products\/minima-1\"\u003eMINIMA 1\u003c\/a\u003e to \u003ca href=\"\/products\/minima-4\"\u003e4\u003c\/a\u003e.\u003c\/p\u003e\u003ch2\u003eThe MINIMA Series\u003c\/h2\u003e\u003cp\u003eMINIMA is my favorite series of Frederic's. Every one is the same idea: a small box, a handful of pieces, and nothing else to hide behind. Frederic lives in Tokyo and works out many of his puzzles in his head on the Tokyo Metro. I make these with his blessing.\u003c\/p\u003e\u003cp\u003eThe boxes are all the same size. Only the openings change, and that is enough to make each one a new puzzle. Allard Walker wrote that everyone he handed the series to had the same reaction: \"How the heck can this simple little thing be \u003cem\u003ethat\u003c\/em\u003e difficult?\"\u003c\/p\u003e\u003cp\u003eMINIMA 6 is one of four new MINIMA puzzles, along with \u003ca href=\"\/products\/minima-5\"\u003eMINIMA 5\u003c\/a\u003e, \u003ca href=\"\/products\/minima-7\"\u003eMINIMA 7\u003c\/a\u003e and \u003ca href=\"\/products\/minima-8\"\u003eMINIMA 8\u003c\/a\u003e. If you want all four, they come together as the \u003ca href=\"\/products\/minima-5-8-set\"\u003eMINIMA 5-8 Set\u003c\/a\u003e. The first four are here as well, as the \u003ca href=\"\/products\/minima-1-4-set\"\u003eMINIMA 1-4 Set\u003c\/a\u003e.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eShips:\u003c\/strong\u003e Disassembled - the 3 pieces arrive outside the box.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is MINIMA 6?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA packing puzzle by Frederic Boucher: fit 3 pieces inside a small box. It is part of his MINIMA series, along with MINIMA 1 to 8, MINIMA Tower and MINIMA Slider.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eDoes MINIMA 6 come assembled?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. It ships disassembled, with the 3 pieces outside the box. Getting them in is the puzzle.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed MINIMA 6?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eFrederic Boucher, a Canadian puzzle designer living in Tokyo. You can find all his puzzles in the \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher collection\u003c\/a\u003e.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":52115742294183,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/minima_6_scattered_marble.png?v=1795746739"},{"product_id":"minima-7","title":"MINIMA 7 | Pack 4 Pieces in Box","description":"\u003ch2\u003eMINIMA 7 - Quick Summary\u003c\/h2\u003e\u003cp\u003eMINIMA 7 is a packing puzzle by \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e, from his MINIMA series. Your goal: fit all 4 turquoise pieces inside the small marble-white box. Two windows run up its front and over the top edge, split by a single thin column.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like packing puzzles with very few pieces, and anyone who has already solved \u003ca href=\"\/products\/minima-1\"\u003eMINIMA 1\u003c\/a\u003e to \u003ca href=\"\/products\/minima-4\"\u003e4\u003c\/a\u003e.\u003c\/p\u003e\u003ch2\u003eThe MINIMA Series\u003c\/h2\u003e\u003cp\u003eMINIMA is my favorite series of Frederic's. Every one is the same idea: a small box, a handful of pieces, and nothing else to hide behind. Frederic lives in Tokyo and works out many of his puzzles in his head on the Tokyo Metro. I make these with his blessing.\u003c\/p\u003e\u003cp\u003eThe boxes are all the same size. Only the openings change, and that is enough to make each one a new puzzle. Allard Walker wrote that everyone he handed the series to had the same reaction: \"How the heck can this simple little thing be \u003cem\u003ethat\u003c\/em\u003e difficult?\"\u003c\/p\u003e\u003cp\u003eMINIMA 7 is one of four new MINIMA puzzles, along with \u003ca href=\"\/products\/minima-5\"\u003eMINIMA 5\u003c\/a\u003e, \u003ca href=\"\/products\/minima-6\"\u003eMINIMA 6\u003c\/a\u003e and \u003ca href=\"\/products\/minima-8\"\u003eMINIMA 8\u003c\/a\u003e. If you want all four, they come together as the \u003ca href=\"\/products\/minima-5-8-set\"\u003eMINIMA 5-8 Set\u003c\/a\u003e. The first four are here as well, as the \u003ca href=\"\/products\/minima-1-4-set\"\u003eMINIMA 1-4 Set\u003c\/a\u003e.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eShips:\u003c\/strong\u003e Disassembled - the 4 pieces arrive outside the box.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is MINIMA 7?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA packing puzzle by Frederic Boucher: fit 4 pieces inside a small box. It is part of his MINIMA series, along with MINIMA 1 to 8, MINIMA Tower and MINIMA Slider.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eDoes MINIMA 7 come assembled?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. It ships disassembled, with the 4 pieces outside the box. Getting them in is the puzzle.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed MINIMA 7?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eFrederic Boucher, a Canadian puzzle designer living in Tokyo. You can find all his puzzles in the \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher collection\u003c\/a\u003e.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":52115754221735,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/minima_7_scattered_marble.png?v=1795746868"},{"product_id":"minima-8","title":"MINIMA 8 | Pack 4 Pieces in Box","description":"\u003ch2\u003eMINIMA 8 - Quick Summary\u003c\/h2\u003e\u003cp\u003eMINIMA 8 is a packing puzzle by \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher\u003c\/a\u003e, from his MINIMA series. Your goal: fit all 4 turquoise pieces inside the small marble-white box. It has two windows on top and an opening that wraps around one corner.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eBest for:\u003c\/strong\u003e solvers who like packing puzzles with very few pieces, and anyone who has already solved \u003ca href=\"\/products\/minima-1\"\u003eMINIMA 1\u003c\/a\u003e to \u003ca href=\"\/products\/minima-4\"\u003e4\u003c\/a\u003e.\u003c\/p\u003e\u003ch2\u003eThe Hardest of the Twelve\u003c\/h2\u003e\u003cp\u003eMINIMA 8 has a reputation. Allard Walker reviewed all twelve of the original series and got through most of them steadily, but of number 8 he wrote: \"that one keeps me thoroughly stumped for a long time\" (\u003ca href=\"https:\/\/allardspuzzlingtimes.blogspot.com\/2024\/03\/minima-series-1-12.html\"\u003ePuzzling Times\u003c\/a\u003e). Kevin Sadler wrote on \u003ca href=\"https:\/\/www.puzzlemad.co.uk\/2025\/03\/a-minima-that-is-anything-but.html\"\u003ePuzzleMad\u003c\/a\u003e that he had \"got quite badly stuck\" on it too.\u003c\/p\u003e\u003cp\u003eIt is still just a few pieces and a small box. That is what makes it so hard to put down.\u003c\/p\u003e\u003ch2\u003eThe MINIMA Series\u003c\/h2\u003e\u003cp\u003eMINIMA is my favorite series of Frederic's. Every one is the same idea: a small box, a handful of pieces, and nothing else to hide behind. Frederic lives in Tokyo and works out many of his puzzles in his head on the Tokyo Metro. I make these with his blessing.\u003c\/p\u003e\u003cp\u003eThe boxes are all the same size. Only the openings change, and that is enough to make each one a new puzzle. Allard Walker wrote that everyone he handed the series to had the same reaction: \"How the heck can this simple little thing be \u003cem\u003ethat\u003c\/em\u003e difficult?\"\u003c\/p\u003e\u003cp\u003eMINIMA 8 is one of four new MINIMA puzzles, along with \u003ca href=\"\/products\/minima-5\"\u003eMINIMA 5\u003c\/a\u003e, \u003ca href=\"\/products\/minima-6\"\u003eMINIMA 6\u003c\/a\u003e and \u003ca href=\"\/products\/minima-7\"\u003eMINIMA 7\u003c\/a\u003e. If you want all four, they come together as the \u003ca href=\"\/products\/minima-5-8-set\"\u003eMINIMA 5-8 Set\u003c\/a\u003e. The first four are here as well, as the \u003ca href=\"\/products\/minima-1-4-set\"\u003eMINIMA 1-4 Set\u003c\/a\u003e.\u003c\/p\u003e\u003cp\u003e\u003cstrong\u003eShips:\u003c\/strong\u003e Disassembled - the 4 pieces arrive outside the box.\u003c\/p\u003e\u003ch2\u003eFrequently Asked Questions\u003c\/h2\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWhat is MINIMA 8?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eA packing puzzle by Frederic Boucher: fit 4 pieces inside a small box. It is part of his MINIMA series, along with MINIMA 1 to 8, MINIMA Tower and MINIMA Slider.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eDoes MINIMA 8 come assembled?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eNo. It ships disassembled, with the 4 pieces outside the box. Getting them in is the puzzle.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eIs MINIMA 8 harder than the other MINIMAs?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eOf the numbered MINIMAs, it has that reputation: it is the one both Allard Walker and Kevin Sadler got stuck on. That is why we rate it Expert, and MINIMA 5, 6 and 7 Hard. If you are new to the series, start with MINIMA 1.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e\u003cdetails class=\"gp-faq\"\u003e\u003csummary\u003e\u003ch3\u003eWho designed MINIMA 8?\u003c\/h3\u003e\u003c\/summary\u003e\u003cdiv class=\"gp-faq__a\"\u003e\u003cp\u003eFrederic Boucher, a Canadian puzzle designer living in Tokyo. You can find all his puzzles in the \u003ca href=\"\/collections\/frederic-boucher\"\u003eFrederic Boucher collection\u003c\/a\u003e.\u003c\/p\u003e\u003c\/div\u003e\u003c\/details\u003e","brand":"Greg Puzzles","offers":[{"title":"Default Title","offer_id":52115764412583,"sku":null,"price":24.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0668\/2827\/1783\/files\/minima_8_scattered_marble.png?v=1795746978"}],"url":"https:\/\/gregpuzzles.com\/collections\/puzzles-under-25.oembed?page=2","provider":"Greg Puzzles","version":"1.0","type":"link"}