{
  "id": 23,
  "slug": "handheld-crank-console",
  "name": "Handheld Crank Console",
  "kind": "style",
  "family": "Hardware & Industrial",
  "sourceSite": {
    "name": "Playdate",
    "url": "https://play.date/",
    "verifiedStatus": 200
  },
  "tagline": "Sunny yellow molded hardware, razor-sharp 1-bit reflective LCD canvas, and playful rotary crank controls.",
  "whyUnique": "Marries friendly molded-plastic toy optimism with ultra-crisp 1-bit monochrome pixel rendering and bold 3px ink outlines.",
  "theme": "light",
  "mobileStrength": "native-first",
  "tags": [
    "handheld-console",
    "one-bit-lcd",
    "playful-industrial",
    "yellow-hardware",
    "crank-control"
  ],
  "bestFor": [
    "Indie game studios",
    "Creative hardware gadgets",
    "Interactive storytelling apps",
    "Playful developer SDK portals"
  ],
  "palette": [
    {
      "role": "canvas",
      "hex": "#FFFDF5",
      "name": "Warm Cream"
    },
    {
      "role": "surface",
      "hex": "#FFC500",
      "name": "Playdate Yellow"
    },
    {
      "role": "ink",
      "hex": "#1C1B18",
      "name": "Deep Molded Ink"
    },
    {
      "role": "accent",
      "hex": "#6D3DF2",
      "name": "Cartridge Violet"
    },
    {
      "role": "muted",
      "hex": "#5A564C",
      "name": "Reflective Slate"
    }
  ],
  "typography": {
    "display": "Fredoka",
    "body": "Fredoka",
    "mono": "IBM Plex Mono",
    "googleFontsUrl": "https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=IBM+Plex+Mono:wght@400;600&display=swap",
    "scaleNotes": "Friendly rounded geometric headlines (34–56px) balanced against crisp 10–12px monospace LCD technical readouts."
  },
  "layoutNotes": "Split hero pairing bold cartridge selector pills with an interactive yellow handheld console frame and crank dock, followed by a 3-column weekly game card shelf.",
  "interactionNotes": "Live 1-bit Canvas 2D memory-LCD running three switchable crank-driven mini-scenes (Surf, Orbit Clock, Pixel Radar) controlled by a crank slider, tappable side crank handle, D-pad, and A/B invert buttons.",
  "mobileNotes": "Console body scales smoothly inside 390px viewports with full-width crank slider, 46px circular A/B buttons, and single-column game cards.",
  "agentGuardrails": {
    "do": [
      "Use thick 2.5–3.5px ink outlines and solid offset drop shadows to evoke injection-molded hardware.",
      "Keep embedded screen canvases strictly 1-bit monochrome (#B7B5AA and #24231E) with crisp pixelated rendering.",
      "Pair sunny yellow hardware blocks with warm off-white page breathing room."
    ],
    "dont": [
      "Never muddy the 1-bit display aesthetic with anti-aliased multi-color gradients inside the LCD.",
      "Avoid corporate stock aesthetics or thin hairline borders that fight the chunky tactile shell."
    ]
  },
  "demoFile": "demos/handheld-crank-console.html",
  "thumbDesktop": "thumbs/handheld-crank-console-desktop.webp",
  "thumbMobile": "thumbs/handheld-crank-console-mobile.webp",
  "urls": {
    "page": "https://templates.michaelpitts.net/t/handheld-crank-console",
    "markdown": "https://templates.michaelpitts.net/t/handheld-crank-console.md",
    "api": "https://templates.michaelpitts.net/api/templates/handheld-crank-console",
    "demo": "https://templates.michaelpitts.net/demos/handheld-crank-console.html",
    "thumbDesktop": "https://templates.michaelpitts.net/thumbs/handheld-crank-console-desktop.webp",
    "thumbMobile": "https://templates.michaelpitts.net/thumbs/handheld-crank-console-mobile.webp"
  },
  "agentPrompt": "Design & build using template #023 \"Handheld Crank Console\" (style / Hardware & Industrial, light theme).\nFull AI blueprint & standalone starter code: https://templates.michaelpitts.net/t/handheld-crank-console.md\nLive demo: https://templates.michaelpitts.net/demos/handheld-crank-console.html\nReal-world inspiration: Playdate (https://play.date/)\n\nCore aesthetic: Marries friendly molded-plastic toy optimism with ultra-crisp 1-bit monochrome pixel rendering and bold 3px ink outlines.\nPalette: canvas: #FFFDF5 (Warm Cream), surface: #FFC500 (Playdate Yellow), ink: #1C1B18 (Deep Molded Ink), accent: #6D3DF2 (Cartridge Violet), muted: #5A564C (Reflective Slate)\nTypography: Display=\"Fredoka\", Body=\"Fredoka\", Mono=\"IBM Plex Mono\"\nLayout: Split hero pairing bold cartridge selector pills with an interactive yellow handheld console frame and crank dock, followed by a 3-column weekly game card shelf.\nInteractions: Live 1-bit Canvas 2D memory-LCD running three switchable crank-driven mini-scenes (Surf, Orbit Clock, Pixel Radar) controlled by a crank slider, tappable side crank handle, D-pad, and A/B invert buttons.\nMobile: Console body scales smoothly inside 390px viewports with full-width crank slider, 46px circular A/B buttons, and single-column game cards.\n\nGuardrails:\n- DO: Use thick 2.5–3.5px ink outlines and solid offset drop shadows to evoke injection-molded hardware.\n- DO: Keep embedded screen canvases strictly 1-bit monochrome (#B7B5AA and #24231E) with crisp pixelated rendering.\n- DO: Pair sunny yellow hardware blocks with warm off-white page breathing room.\n- DON'T: Never muddy the 1-bit display aesthetic with anti-aliased multi-color gradients inside the LCD.\n- DON'T: Avoid corporate stock aesthetics or thin hairline borders that fight the chunky tactile shell.",
  "sourceCode": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>CRANK-1 // Handheld 1-Bit Yellow Console</title>\n<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n<link href=\"https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=IBM+Plex+Mono:wght@400;600&display=swap\" rel=\"stylesheet\">\n<style>\n  :root {\n    --yellow: #FFC500;\n    --yellow-deep: #E5AF00;\n    --canvas: #FFFDF5;\n    --surface: #FFF6CC;\n    --ink: #1C1B18;\n    --muted: #5A564C;\n    --lcd-bg: #B7B5AA;\n    --lcd-ink: #24231E;\n    --purple: #6D3DF2;\n    --font-display: 'Fredoka', system-ui, sans-serif;\n    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;\n  }\n\n  *, *::before, *::after { box-sizing: border-box; }\n\n  html, body {\n    margin: 0;\n    padding: 0;\n    background: var(--canvas);\n    color: var(--ink);\n    font-family: var(--font-display);\n    overflow-x: hidden;\n  }\n\n  /* Header */\n  .pd-nav {\n    background: var(--yellow);\n    border-bottom: 3px solid var(--ink);\n    padding: 0 20px;\n  }\n\n  .pd-nav-inner {\n    max-width: 1120px;\n    margin: 0 auto;\n    min-height: 62px;\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 14px;\n  }\n\n  .pd-brand {\n    font-size: 22px;\n    font-weight: 700;\n    letter-spacing: -0.02em;\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    text-decoration: none;\n    color: var(--ink);\n  }\n\n  .pd-badge {\n    font-family: var(--font-mono);\n    font-size: 11px;\n    font-weight: 600;\n    background: var(--ink);\n    color: var(--yellow);\n    padding: 3px 8px;\n    border-radius: 999px;\n  }\n\n  .pd-links {\n    display: flex;\n    gap: 16px;\n    align-items: center;\n  }\n\n  .pd-links a {\n    font-family: var(--font-mono);\n    font-size: 12px;\n    font-weight: 600;\n    color: var(--ink);\n    text-decoration: none;\n  }\n\n  .pd-links a:hover { text-decoration: underline; }\n\n  /* Hero Stage */\n  .wrap {\n    max-width: 1120px;\n    margin: 0 auto;\n    padding: 36px 20px 68px;\n  }\n\n  .hero-grid {\n    display: grid;\n    grid-template-columns: 1fr 1.05fr;\n    gap: 36px;\n    align-items: center;\n  }\n\n  .kicker {\n    font-family: var(--font-mono);\n    font-size: 11px;\n    font-weight: 600;\n    letter-spacing: 0.08em;\n    text-transform: uppercase;\n    display: inline-block;\n    background: var(--yellow);\n    border: 2px solid var(--ink);\n    padding: 4px 10px;\n    border-radius: 6px;\n    margin-bottom: 14px;\n  }\n\n  h1 {\n    font-size: clamp(34px, 5vw, 56px);\n    line-height: 1.02;\n    margin: 0 0 16px;\n    letter-spacing: -0.02em;\n  }\n\n  .lead {\n    font-size: 17px;\n    line-height: 1.5;\n    color: var(--muted);\n    margin: 0 0 24px;\n    font-weight: 500;\n  }\n\n  .cartridge-pills {\n    display: flex;\n    gap: 10px;\n    flex-wrap: wrap;\n    margin-bottom: 18px;\n  }\n\n  .cart-btn {\n    min-height: 44px;\n    padding: 0 16px;\n    border: 2.5px solid var(--ink);\n    border-radius: 10px;\n    background: #FFFFFF;\n    color: var(--ink);\n    font-family: var(--font-mono);\n    font-size: 12px;\n    font-weight: 600;\n    cursor: pointer;\n    box-shadow: 0 3px 0 var(--ink);\n    transition: transform 0.1s;\n  }\n\n  .cart-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }\n  .cart-btn.active {\n    background: var(--purple);\n    color: #FFFFFF;\n  }\n\n  /* Handheld Console Hardware Shell */\n  .console-stage {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 16px;\n  }\n\n  .handheld-unit {\n    display: flex;\n    align-items: center;\n    max-width: 100%;\n  }\n\n  .console-body {\n    width: 310px;\n    max-width: calc(100vw - 74px);\n    background: var(--yellow);\n    border: 3.5px solid var(--ink);\n    border-radius: 22px;\n    padding: 18px 18px 22px;\n    box-shadow: 8px 8px 0 var(--ink);\n    position: relative;\n  }\n\n  .console-top-bolts {\n    display: flex;\n    justify-content: space-between;\n    margin-bottom: 10px;\n    font-family: var(--font-mono);\n    font-size: 10px;\n    font-weight: 600;\n    align-items: center;\n  }\n\n  .screw {\n    width: 12px;\n    height: 12px;\n    border-radius: 50%;\n    border: 2px solid var(--ink);\n    background: var(--yellow-deep);\n  }\n\n  .lcd-bezel {\n    background: var(--ink);\n    border-radius: 10px;\n    padding: 10px;\n    margin-bottom: 18px;\n  }\n\n  .lcd-canvas {\n    width: 100%;\n    height: auto;\n    display: block;\n    background: var(--lcd-bg);\n    border-radius: 4px;\n    image-rendering: pixelated;\n  }\n\n  .controls-row {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    padding: 0 8px;\n  }\n\n  .dpad {\n    display: grid;\n    grid-template-columns: repeat(3, 28px);\n    grid-template-rows: repeat(3, 28px);\n    gap: 2px;\n  }\n\n  .dpad-btn {\n    border: 2px solid var(--ink);\n    background: var(--yellow-deep);\n    cursor: pointer;\n    border-radius: 4px;\n    font-weight: 700;\n    color: var(--ink);\n    padding: 0;\n  }\n\n  .dpad-btn:active { background: var(--ink); color: var(--yellow); }\n\n  .ab-cluster {\n    display: flex;\n    gap: 12px;\n    align-items: center;\n  }\n\n  .ab-btn {\n    width: 46px;\n    height: 46px;\n    border-radius: 50%;\n    border: 2.5px solid var(--ink);\n    background: #FFFFFF;\n    font-family: var(--font-mono);\n    font-size: 14px;\n    font-weight: 700;\n    cursor: pointer;\n    box-shadow: 0 3px 0 var(--ink);\n  }\n\n  .ab-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }\n\n  /* Side Crank Handle */\n  .crank-arm {\n    width: 28px;\n    height: 92px;\n    background: #D8D6CE;\n    border: 3px solid var(--ink);\n    border-left: none;\n    border-radius: 0 12px 12px 0;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: flex-end;\n    padding-bottom: 8px;\n    cursor: pointer;\n    box-shadow: 4px 4px 0 var(--ink);\n  }\n\n  .crank-grip {\n    width: 16px;\n    height: 36px;\n    background: var(--yellow);\n    border: 2px solid var(--ink);\n    border-radius: 6px;\n  }\n\n  /* Crank Scrubber Control */\n  .crank-dock {\n    width: 100%;\n    max-width: 340px;\n    background: var(--surface);\n    border: 2.5px solid var(--ink);\n    border-radius: 14px;\n    padding: 12px 16px;\n  }\n\n  .crank-dock-head {\n    display: flex;\n    justify-content: space-between;\n    font-family: var(--font-mono);\n    font-size: 11px;\n    font-weight: 600;\n    margin-bottom: 8px;\n  }\n\n  .crank-slider {\n    width: 100%;\n    height: 36px;\n    accent-color: var(--ink);\n    cursor: ew-resize;\n  }\n\n  /* Season Games Grid */\n  .season-section {\n    margin-top: 56px;\n    padding-top: 36px;\n    border-top: 3px solid var(--ink);\n  }\n\n  .season-head {\n    display: flex;\n    justify-content: space-between;\n    align-items: baseline;\n    flex-wrap: wrap;\n    gap: 12px;\n    margin-bottom: 22px;\n  }\n\n  .season-head h2 {\n    font-size: 28px;\n    margin: 0;\n  }\n\n  .games-grid {\n    display: grid;\n    grid-template-columns: repeat(3, 1fr);\n    gap: 18px;\n  }\n\n  .game-card {\n    background: #FFFFFF;\n    border: 2.5px solid var(--ink);\n    border-radius: 14px;\n    padding: 18px;\n    box-shadow: 5px 5px 0 var(--yellow);\n    display: flex;\n    flex-direction: column;\n    justify-content: space-between;\n    gap: 12px;\n  }\n\n  .game-week {\n    font-family: var(--font-mono);\n    font-size: 10px;\n    font-weight: 600;\n    color: var(--purple);\n    text-transform: uppercase;\n  }\n\n  .game-card h3 { margin: 4px 0 6px; font-size: 20px; }\n  .game-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }\n\n  .spec-pill-row {\n    display: flex;\n    gap: 6px;\n    flex-wrap: wrap;\n  }\n\n  .mini-tag {\n    font-family: var(--font-mono);\n    font-size: 10px;\n    padding: 3px 8px;\n    background: var(--surface);\n    border: 1.5px solid var(--ink);\n    border-radius: 6px;\n  }\n\n  @media (max-width: 860px) {\n    .hero-grid { grid-template-columns: 1fr; }\n    .games-grid { grid-template-columns: 1fr; }\n    .pd-links { display: none; }\n  }\n</style>\n</head>\n<body>\n\n<header class=\"pd-nav\">\n  <div class=\"pd-nav-inner\">\n    <a href=\"#\" class=\"pd-brand\">\n      <span>CRANK·01</span>\n      <span class=\"pd-badge\">1-BIT LCD</span>\n    </a>\n    <nav class=\"pd-links\" aria-label=\"Primary\">\n      <a href=\"#console\">Try Crank</a>\n      <a href=\"#season\">Season One</a>\n      <a href=\"#season\">SDK Docs</a>\n    </nav>\n  </div>\n</header>\n\n<main class=\"wrap\">\n  <section class=\"hero-grid\" id=\"console\">\n    <div>\n      <span class=\"kicker\">POCKET HARDWARE + ROTARY CRANK</span>\n      <h1>Tiny yellow box.<br>Sharp 1-bit magic.</h1>\n      <p class=\"lead\">\n        A high-reflectivity 400×240 monochrome screen with zero backlight glare, two crisp buttons, and a precision Hall-effect flip-out crank that turns analog rotation directly into gameplay.\n      </p>\n\n      <div class=\"cartridge-pills\" role=\"group\" aria-label=\"Select 1-bit Cartridge\">\n        <button class=\"cart-btn active\" data-mode=\"surf\">01 · CRANK SURF</button>\n        <button class=\"cart-btn\" data-mode=\"orbit\">02 · ORBIT CLOCK</button>\n        <button class=\"cart-btn\" data-mode=\"radar\">03 · PIXEL RADAR</button>\n      </div>\n      <p style=\"font-family:var(--font-mono);font-size:12px;color:var(--muted);margin:0;\">\n        Drag the crank slider or press A/B on the console to scrub the 1-bit LCD.\n      </p>\n    </div>\n\n    <div class=\"console-stage\">\n      <div class=\"handheld-unit\">\n        <div class=\"console-body\">\n          <div class=\"console-top-bolts\">\n            <span class=\"screw\" aria-hidden=\"true\"></span>\n            <span>400×240 · 1-BIT MEMORY LCD</span>\n            <span class=\"screw\" aria-hidden=\"true\"></span>\n          </div>\n\n          <div class=\"lcd-bezel\">\n            <canvas class=\"lcd-canvas\" id=\"lcd\" width=\"260\" height=\"156\"></canvas>\n          </div>\n\n          <div class=\"controls-row\">\n            <div class=\"dpad\" aria-label=\"D-pad controls\">\n              <span></span>\n              <button class=\"dpad-btn\" id=\"btnUp\" aria-label=\"Up\">▲</button>\n              <span></span>\n              <button class=\"dpad-btn\" id=\"btnLeft\" aria-label=\"Left\">◀</button>\n              <button class=\"dpad-btn\" id=\"btnCenter\" aria-label=\"Reset\">●</button>\n              <button class=\"dpad-btn\" id=\"btnRight\" aria-label=\"Right\">▶</button>\n              <span></span>\n              <button class=\"dpad-btn\" id=\"btnDown\" aria-label=\"Down\">▼</button>\n              <span></span>\n            </div>\n\n            <div class=\"ab-cluster\">\n              <button class=\"ab-btn\" id=\"btnB\">B</button>\n              <button class=\"ab-btn\" id=\"btnA\">A</button>\n            </div>\n          </div>\n        </div>\n\n        <button class=\"crank-arm\" id=\"crankTap\" title=\"Tap to turn crank +30°\" aria-label=\"Turn crank 30 degrees\">\n          <span class=\"crank-grip\"></span>\n        </button>\n      </div>\n\n      <div class=\"crank-dock\">\n        <div class=\"crank-dock-head\">\n          <span>ANALOG CRANK ANGLE</span>\n          <span id=\"angleReadout\">045°</span>\n        </div>\n        <input type=\"range\" min=\"0\" max=\"360\" value=\"45\" class=\"crank-slider\" id=\"crankSlider\" aria-label=\"Crank rotation angle\">\n      </div>\n    </div>\n  </section>\n\n  <section class=\"season-section\" id=\"season\">\n    <div class=\"season-head\">\n      <h2>24 Surprise Games, Delivered Weekly</h2>\n      <span style=\"font-family:var(--font-mono);font-size:12px;color:var(--muted);\">INCLUDED WITH EVERY CONSOLE · ZERO ADS</span>\n    </div>\n\n    <div class=\"games-grid\">\n      <article class=\"game-card\">\n        <div>\n          <span class=\"game-week\">WEEK 01 · ARCADE</span>\n          <h3>Whitewater Wipeout</h3>\n          <p>Carve razor-sharp 1-bit barrels by spinning the crank to match swell angle and launch aerial tricks.</p>\n        </div>\n        <div class=\"spec-pill-row\">\n          <span class=\"mini-tag\">CRANK NATIVE</span>\n          <span class=\"mini-tag\">60 FPS</span>\n        </div>\n      </article>\n\n      <article class=\"game-card\">\n        <div>\n          <span class=\"game-week\">WEEK 04 · PUZZLE</span>\n          <h3>Crankin's Time Travel</h3>\n          <p>Rewind and fast-forward time itself with your thumb to dodge flying hazards on the way to brunch.</p>\n        </div>\n        <div class=\"spec-pill-row\">\n          <span class=\"mini-tag\">TIME SCRUB</span>\n          <span class=\"mini-tag\">LUA SDK</span>\n        </div>\n      </article>\n\n      <article class=\"game-card\">\n        <div>\n          <span class=\"game-week\">WEEK 09 · SYNTH</span>\n          <h3>Boogie Loops</h3>\n          <p>Dithered 1-bit groovebox where crank velocity bends pitch and triggers crunchy chiptune fills.</p>\n        </div>\n        <div class=\"spec-pill-row\">\n          <span class=\"mini-tag\">AUDIO TOY</span>\n          <span class=\"mini-tag\">MONO SPEAKER</span>\n        </div>\n      </article>\n    </div>\n  </section>\n</main>\n\n<script>\n  const lcd = document.getElementById('lcd');\n  const ctx = lcd.getContext('2d');\n  const slider = document.getElementById('crankSlider');\n  const angleReadout = document.getElementById('angleReadout');\n\n  let angle = 45;\n  let mode = 'surf';\n  let invert = false;\n  let offsetX = 0;\n\n  function drawLCD() {\n    const bg = invert ? '#24231E' : '#B7B5AA';\n    const fg = invert ? '#B7B5AA' : '#24231E';\n    ctx.fillStyle = bg;\n    ctx.fillRect(0, 0, 260, 156);\n\n    const rad = (angle * Math.PI) / 180;\n    ctx.fillStyle = fg;\n    ctx.strokeStyle = fg;\n    ctx.lineWidth = 2;\n\n    // 1-bit HUD Header\n    ctx.fillRect(0, 0, 260, 18);\n    ctx.fillStyle = bg;\n    ctx.font = 'bold 10px monospace';\n    ctx.fillText(`MODE:${mode.toUpperCase()}`, 8, 12);\n    ctx.fillText(`CRANK:${String(Math.round(angle)).padStart(3,'0')}°`, 180, 12);\n    ctx.fillStyle = fg;\n\n    if (mode === 'surf') {\n      // Dithered sky dots\n      for (let x = 8; x < 252; x += 12) {\n        for (let y = 26; y < 70; y += 12) {\n          if ((x + y) % 24 === 0) ctx.fillRect(x, y, 2, 2);\n        }\n      }\n      // Animated 1-bit ocean wave\n      for (let x = 0; x < 260; x += 4) {\n        const y = 104 + Math.sin(x * 0.04 + rad * 2) * 20;\n        ctx.fillRect(x, Math.floor(y), 4, 156 - Math.floor(y));\n      }\n      // Surfer sprite riding wave\n      const sx = Math.max(24, Math.min(230, 126 + offsetX));\n      const sy = 96 + Math.sin(sx * 0.04 + rad * 2) * 20;\n      ctx.fillRect(sx - 10, sy - 6, 22, 4); // board\n      ctx.fillRect(sx - 2, sy - 18, 6, 12); // body\n      ctx.fillRect(sx - 1, sy - 24, 5, 5);   // head\n    } else if (mode === 'orbit') {\n      const cx = 130 + offsetX * 0.4;\n      const cy = 88;\n      ctx.beginPath(); ctx.arc(cx, cy, 46, 0, Math.PI * 2); ctx.stroke();\n      ctx.beginPath(); ctx.arc(cx, cy, 24, 0, Math.PI * 2); ctx.stroke();\n      // Planet 1\n      const px = cx + Math.cos(rad) * 46;\n      const py = cy + Math.sin(rad) * 46;\n      ctx.fillRect(px - 5, py - 5, 10, 10);\n      // Planet 2\n      const mx = cx + Math.cos(-rad * 2) * 24;\n      const my = cy + Math.sin(-rad * 2) * 24;\n      ctx.fillRect(mx - 3, my - 3, 6, 6);\n      // Sun\n      ctx.fillRect(cx - 7, cy - 7, 14, 14);\n    } else {\n      // Pixel Radar\n      const cx = 130, cy = 88;\n      for (let r = 18; r <= 54; r += 18) {\n        ctx.beginPath(); ctx.arc(cx, cy, r, 0, Math.PI * 2); ctx.stroke();\n      }\n      ctx.beginPath();\n      ctx.moveTo(cx, cy);\n      ctx.lineTo(cx + Math.cos(rad) * 56, cy + Math.sin(rad) * 56);\n      ctx.stroke();\n      // Blips\n      [[154, 66], [96, 106], [164, 112]].forEach(([bx, by]) => {\n        ctx.fillRect(bx - 3, by - 3, 6, 6);\n      });\n    }\n  }\n\n  function setAngle(val) {\n    angle = ((val % 360) + 360) % 360;\n    slider.value = angle;\n    angleReadout.textContent = `${String(Math.round(angle)).padStart(3, '0')}°`;\n    drawLCD();\n  }\n\n  slider.addEventListener('input', e => setAngle(Number(e.target.value)));\n  document.getElementById('crankTap').addEventListener('click', () => setAngle(angle + 30));\n  document.getElementById('btnA').addEventListener('click', () => setAngle(angle + 22));\n  document.getElementById('btnB').addEventListener('click', () => { invert = !invert; drawLCD(); });\n  document.getElementById('btnLeft').addEventListener('click', () => { offsetX -= 16; drawLCD(); });\n  document.getElementById('btnRight').addEventListener('click', () => { offsetX += 16; drawLCD(); });\n  document.getElementById('btnUp').addEventListener('click', () => setAngle(angle + 15));\n  document.getElementById('btnDown').addEventListener('click', () => setAngle(angle - 15));\n  document.getElementById('btnCenter').addEventListener('click', () => { offsetX = 0; invert = false; setAngle(45); });\n\n  document.querySelectorAll('.cart-btn').forEach(btn => {\n    btn.addEventListener('click', () => {\n      document.querySelectorAll('.cart-btn').forEach(b => b.classList.remove('active'));\n      btn.classList.add('active');\n      mode = btn.dataset.mode;\n      drawLCD();\n    });\n  });\n\n  drawLCD();\n</script>\n</body>\n</html>\n"
}
