# #147 — Dockable Live Property Inspector Rail

> Precision dark vector artboard with selectable layers, live X/Y/Size/Radius/Rotation/Fill inspector rail, CSS export, and mobile sheet.

## Metadata

- **Index**: #147
- **Slug**: `dockable-property-inspector`
- **Kind**: `ui`
- **Family**: Design & Creative Tools
- **Theme**: `dark`
- **Mobile Strength**: `high`
- **Tags**: `property-inspector`, `design-tool`, `vector-stage`, `dockable-rail`, `css-export`, `creative-ui`
- **Best For**: Browser-based vector, motion, and UI editors, No-code page builders and theme customizers, 3D/WebGL scene and shader inspectors, Component playground and token studios
- **Real-World Inspiration**: [Rive](https://rive.app/)
- **Detail Page**: https://templates.michaelpitts.net/t/dockable-property-inspector
- **Live Demo**: https://templates.michaelpitts.net/demos/dockable-property-inspector.html
- **JSON API**: https://templates.michaelpitts.net/api/templates/dockable-property-inspector

## Why This Aesthetic Is Unique

Brings native design-tool ergonomics to the browser by pairing a live interactive artboard with a compact grouped property rail that docks neatly into a toggleable mobile bottom sheet.

## Color Palette

| Role | Name | Hex |
|------|------|-----|
| `canvas` | Studio Charcoal | `#111216` |
| `surface` | Inspector Panel | `#1B1D24` |
| `ink` | Precision White | `#F3F4F6` |
| `accent` | Electric Blue | `#3B82F6` |
| `muted` | Axis Slate | `#8E94A5` |

## Typography

- **Display**: `Inter`
- **Body**: `Inter`
- **Mono**: `JetBrains Mono`
- **Scale Notes**: 11px uppercase section headers (Transform, Fill, Effects), 12.5px mono numeric inputs, 12px exported CSS preview.
- **Google Fonts**: https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&family=JetBrains+Mono:wght@500;600&display=swap
  ```html
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&family=JetBrains+Mono:wght@500;600&display=swap">
  ```

## Layout Architecture

Center checkerboard artboard stage + 300px dockable right inspector rail on desktop; full-width stage with a floating 'Inspector' bottom sheet toggle on <=860px mobile.

## Interaction & Micro-Motion Rules

Click any layer on the artboard (or layer chips) to bind the inspector; scrubbing X, Y, Width, Height, Radius, Rotation, Opacity, Fill, or Shadow updates the stage and live CSS output instantly.

## Mobile & Responsive Rules

Keeps the artboard unobstructed at 390px and opens the grouped property controls in a smooth bottom sheet with >=44px inputs and one-tap Copy CSS.

## Agent Guardrails

### DO
- Group properties logically (Transform, Appearance, Effects) in compact 2-column numeric grids.
- Highlight the selected layer on the stage with a crisp selection bounding box.
- Convert the right inspector rail into a toggleable bottom sheet below 860px.

### DON'T
- Never squeeze a 300px inspector rail next to the canvas on a 390px viewport.
- Avoid unlabelled raw number inputs; always show compact X/Y/W/H/R axis prefixes.

## Complete Standalone Starter Code

File: `demos/dockable-property-inspector.html`

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Kinetix Studio — Dockable Property Inspector Rail</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<style>
  :root {
    --bg: #111216;
    --panel: #1A1C22;
    --panel-elev: #22252E;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --ink: #EEF1F6;
    --muted: #8E95A5;
    --blue: #3B82F6;
    --blue-glow: rgba(59, 130, 246, 0.35);
    --cyan: #22D3EE;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  html, body {
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
  }

  .app {
    display: grid;
    grid-template-rows: 52px 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
  }

  /* Top Toolbar */
  .toolbar {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    z-index: 20;
  }

  .tool-left, .tool-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
    margin-right: 6px;
  }

  .logo-dot {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: linear-gradient(135deg, #3B82F6, #22D3EE);
    display: grid;
    place-items: center;
    color: #0B1120;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 700;
  }

  .layer-pills {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border);
  }

  .layer-btn {
    min-height: 36px;
    padding: 0 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.14s ease;
  }

  .layer-btn:hover { color: var(--ink); }
  .layer-btn.active {
    background: var(--blue);
    color: #fff;
  }

  .tbtn {
    min-height: 38px;
    min-width: 38px;
    padding: 0 12px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--panel-elev);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
  }

  .tbtn:hover { border-color: var(--border-strong); background: #2A2E3A; }
  .tbtn.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
  }
  .tbtn.primary:hover { background: #2563EB; }

  /* Main Workspace */
  .workspace {
    display: grid;
    grid-template-columns: 1fr 312px;
    min-height: 0;
    position: relative;
    transition: grid-template-columns 0.2s ease;
  }

  .workspace.dock-collapsed {
    grid-template-columns: 1fr 0px;
  }

  /* Vector Stage */
  .stage-wrap {
    position: relative;
    overflow: hidden;
    background-color: #13151A;
    background-image:
      radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.09) 1px, transparent 0);
    background-size: 24px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .artboard {
    position: relative;
    width: 560px;
    height: 420px;
    max-width: 100%;
    max-height: 100%;
    background: #181B22;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    touch-action: none;
  }

  .artboard-label {
    position: absolute;
    top: 10px;
    left: 12px;
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--muted);
    pointer-events: none;
    letter-spacing: 0.04em;
  }

  .shape {
    position: absolute;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: box-shadow 0.08s linear;
  }

  .shape:active { cursor: grabbing; }

  .shape.selected {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
  }

  .shape.selected::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 1px dashed rgba(59, 130, 246, 0.55);
    pointer-events: none;
  }

  .stage-hud {
    position: absolute;
    bottom: 14px;
    left: 14px;
    background: rgba(26, 28, 34, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    display: flex;
    gap: 12px;
  }

  .stage-hud strong { color: var(--ink); font-weight: 500; }

  /* Right Inspector Rail */
  .inspector {
    background: var(--panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .inspector-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .inspector-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
  }

  .shape-badge {
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.16);
    color: #93C5FD;
    font-family: var(--mono);
    font-size: 0.7rem;
  }

  .inspector-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .prop-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
  }

  .prop-group:last-child { border-bottom: none; padding-bottom: 4px; }

  .group-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
  }

  .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .field {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0 9px;
    height: 36px;
    gap: 6px;
  }

  .field:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px var(--blue-glow);
  }

  .field span {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    user-select: none;
  }

  .field input[type="number"] {
    width: 100%;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.8rem;
    outline: none;
  }

  .slider-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .slider-top {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: var(--muted);
  }

  .slider-top strong {
    font-family: var(--mono);
    color: var(--ink);
    font-weight: 500;
  }

  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: #2C303C;
    outline: none;
    cursor: pointer;
  }

  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid #EEF1F6;
  }

  .color-row {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .color-picker {
    width: 38px;
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--bg);
    padding: 2px;
    cursor: pointer;
  }

  .swatches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .sw {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    cursor: pointer;
  }

  .css-box {
    background: #0D0E12;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.55;
    color: #A5B4FC;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .copy-btn {
    width: 100%;
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid var(--blue);
    background: rgba(59, 130, 246, 0.14);
    color: #93C5FD;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
  }

  .copy-btn:hover { background: var(--blue); color: #fff; }

  /* Mobile Bottom Sheet */
  .sheet-toggle {
    display: none;
  }

  @media (max-width: 820px) {
    .layer-pills { display: none; }
    .workspace, .workspace.dock-collapsed {
      grid-template-columns: 1fr;
    }
    #dockBtn { display: none; }
    .stage-wrap {
      padding: 12px 12px 76px;
      align-items: flex-start;
    }
    .artboard {
      height: 340px;
    }
    .stage-hud { bottom: 68px; left: 12px; }

    .inspector {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      height: 58vh;
      max-height: 460px;
      border-left: none;
      border-top: 1px solid var(--border-strong);
      border-radius: 16px 16px 0 0;
      box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.55);
      z-index: 40;
      transform: translateY(calc(100% - 56px));
      transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .inspector.sheet-open {
      transform: translateY(0);
    }

    .inspector-head {
      min-height: 56px;
      cursor: pointer;
    }

    .sheet-toggle {
      display: inline-flex;
      min-height: 44px;
      padding: 0 12px;
      align-items: center;
      border-radius: 999px;
      border: 1px solid var(--border-strong);
      background: var(--panel-elev);
      color: var(--ink);
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
    }
  }
</style>
</head>
<body>
<div class="app">
  <header class="toolbar">
    <div class="tool-left">
      <div class="logo">
        <span class="logo-dot">KX</span>
        <span>Kinetix Inspector</span>
      </div>
      <div class="layer-pills" id="layerPills" role="tablist" aria-label="Canvas layers"></div>
    </div>
    <div class="tool-right">
      <button class="tbtn" id="resetShapeBtn" type="button" title="Reset active layer">Reset</button>
      <button class="tbtn primary" id="dockBtn" type="button" aria-pressed="true">Dock Rail</button>
    </div>
  </header>

  <div class="workspace" id="workspace">
    <main class="stage-wrap">
      <div class="artboard" id="artboard" aria-label="Interactive vector canvas">
        <span class="artboard-label">STAGE 560 &times; 420 &middot; DRAG OR INSPECT</span>
      </div>
      <div class="stage-hud" id="stageHud">
        <span>Layer: <strong id="hudName">Hero Card</strong></span>
        <span>Pos: <strong id="hudPos">160, 96</strong></span>
      </div>
    </main>

    <aside class="inspector sheet-open" id="inspector" aria-label="Property inspector">
      <div class="inspector-head" id="inspectorHead">
        <div class="inspector-title">
          <span id="inspName">Hero Card</span>
          <span class="shape-badge" id="inspType">RECT</span>
        </div>
        <button class="sheet-toggle" id="sheetToggle" type="button">Collapse</button>
      </div>

      <div class="inspector-body">
        <div class="prop-group">
          <span class="group-label">Transform</span>
          <div class="grid-2">
            <label class="field"><span>X</span><input type="number" id="inX" step="1"></label>
            <label class="field"><span>Y</span><input type="number" id="inY" step="1"></label>
            <label class="field"><span>W</span><input type="number" id="inW" min="24" max="420" step="1"></label>
            <label class="field"><span>H</span><input type="number" id="inH" min="24" max="360" step="1"></label>
          </div>
          <div class="slider-row">
            <div class="slider-top"><span>Rotation</span><strong id="valRot">0&deg;</strong></div>
            <input type="range" id="inRot" min="-180" max="180" step="1">
          </div>
          <div class="slider-row">
            <div class="slider-top"><span>Corner Radius</span><strong id="valRad">24px</strong></div>
            <input type="range" id="inRad" min="0" max="140" step="1">
          </div>
        </div>

        <div class="prop-group">
          <span class="group-label">Appearance</span>
          <div class="color-row">
            <input type="color" id="inColor" class="color-picker" aria-label="Fill color">
            <div class="swatches" id="swatches"></div>
          </div>
          <div class="slider-row">
            <div class="slider-top"><span>Opacity</span><strong id="valOp">100%</strong></div>
            <input type="range" id="inOp" min="10" max="100" step="1">
          </div>
          <div class="slider-row">
            <div class="slider-top"><span>Drop Shadow Blur</span><strong id="valSh">28px</strong></div>
            <input type="range" id="inSh" min="0" max="64" step="1">
          </div>
        </div>

        <div class="prop-group">
          <span class="group-label">Live CSS Export</span>
          <pre class="css-box" id="cssOutput"></pre>
          <button class="copy-btn" id="copyCssBtn" type="button">Copy CSS Properties</button>
        </div>
      </div>
    </aside>
  </div>
</div>

<script>
const INITIAL_LAYERS = [
  { id: 'card', name: 'Hero Card', type: 'RECT', x: 150, y: 105, w: 196, h: 148, rot: -6, rad: 26, color: '#3B82F6', op: 96, sh: 32 },
  { id: 'orb', name: 'Accent Orb', type: 'OVAL', x: 300, y: 62, w: 112, h: 112, rot: 0, rad: 99, color: '#22D3EE', op: 88, sh: 24 },
  { id: 'pill', name: 'Action Pill', type: 'PILL', x: 82, y: 242, w: 164, h: 52, rot: 4, rad: 26, color: '#A855F7', op: 100, sh: 18 }
];

const SWATCH_COLORS = ['#3B82F6', '#22D3EE', '#A855F7', '#F43F5E', '#10B981', '#F59E0B', '#E2E8F0'];

let layers = INITIAL_LAYERS.map(l => ({ ...l }));
let selectedId = 'card';
let dockOpen = true;
let sheetOpen = true;

const artboard = document.getElementById('artboard');
const layerPills = document.getElementById('layerPills');
const workspace = document.getElementById('workspace');
const inspector = document.getElementById('inspector');
const sheetToggle = document.getElementById('sheetToggle');
const cssOutput = document.getElementById('cssOutput');
const copyCssBtn = document.getElementById('copyCssBtn');

const inputs = {
  x: document.getElementById('inX'),
  y: document.getElementById('inY'),
  w: document.getElementById('inW'),
  h: document.getElementById('inH'),
  rot: document.getElementById('inRot'),
  rad: document.getElementById('inRad'),
  color: document.getElementById('inColor'),
  op: document.getElementById('inOp'),
  sh: document.getElementById('inSh')
};

function getSelected() {
  return layers.find(l => l.id === selectedId) || layers[0];
}

function buildCSS(l) {
  const shadow = l.sh > 0
    ? `0 ${Math.round(l.sh * 0.45)}px ${l.sh}px rgba(0, 0, 0, 0.48)`
    : 'none';
  return `.${l.id} {\n  width: ${l.w}px;\n  height: ${l.h}px;\n  border-radius: ${l.rad}px;\n  background: ${l.color};\n  opacity: ${(l.op / 100).toFixed(2)};\n  transform: translate(${l.x}px, ${l.y}px) rotate(${l.rot}deg);\n  box-shadow: ${shadow};\n}`;
}

function renderStage() {
  artboard.querySelectorAll('.shape').forEach(el => el.remove());

  layers.forEach(l => {
    const el = document.createElement('div');
    el.className = 'shape' + (l.id === selectedId ? ' selected' : '');
    el.dataset.id = l.id;
    el.style.left = l.x + 'px';
    el.style.top = l.y + 'px';
    el.style.width = l.w + 'px';
    el.style.height = l.h + 'px';
    el.style.borderRadius = l.rad + 'px';
    el.style.background = l.color;
    el.style.opacity = l.op / 100;
    el.style.transform = `rotate(${l.rot}deg)`;
    el.style.boxShadow = l.sh > 0 ? `0 ${Math.round(l.sh * 0.45)}px ${l.sh}px rgba(0, 0, 0, 0.48)` : 'none';

    el.addEventListener('pointerdown', (e) => {
      e.stopPropagation();
      selectLayer(l.id);
      const startX = e.clientX;
      const startY = e.clientY;
      const origX = l.x;
      const origY = l.y;
      el.setPointerCapture(e.pointerId);

      const onMove = (ev) => {
        l.x = Math.round(origX + (ev.clientX - startX));
        l.y = Math.round(origY + (ev.clientY - startY));
        el.style.left = l.x + 'px';
        el.style.top = l.y + 'px';
        syncInspector();
      };
      const onUp = () => {
        el.removeEventListener('pointermove', onMove);
        el.removeEventListener('pointerup', onUp);
      };
      el.addEventListener('pointermove', onMove);
      el.addEventListener('pointerup', onUp);
    });

    artboard.appendChild(el);
  });
}

function renderPills() {
  layerPills.innerHTML = '';
  layers.forEach(l => {
    const b = document.createElement('button');
    b.type = 'button';
    b.className = 'layer-btn' + (l.id === selectedId ? ' active' : '');
    b.textContent = l.name;
    b.addEventListener('click', () => selectLayer(l.id));
    layerPills.appendChild(b);
  });
}

function syncInspector() {
  const l = getSelected();
  document.getElementById('inspName').textContent = l.name;
  document.getElementById('inspType').textContent = l.type;
  document.getElementById('hudName').textContent = l.name;
  document.getElementById('hudPos').textContent = `${l.x}, ${l.y}`;

  inputs.x.value = l.x;
  inputs.y.value = l.y;
  inputs.w.value = l.w;
  inputs.h.value = l.h;
  inputs.rot.value = l.rot;
  inputs.rad.value = l.rad;
  inputs.color.value = l.color;
  inputs.op.value = l.op;
  inputs.sh.value = l.sh;

  document.getElementById('valRot').textContent = `${l.rot}°`;
  document.getElementById('valRad').textContent = `${l.rad}px`;
  document.getElementById('valOp').textContent = `${l.op}%`;
  document.getElementById('valSh').textContent = `${l.sh}px`;

  cssOutput.textContent = buildCSS(l);
}

function selectLayer(id) {
  selectedId = id;
  renderPills();
  renderStage();
  syncInspector();
}

function bindProp(key, parser = v => parseInt(v, 10)) {
  inputs[key].addEventListener('input', () => {
    const l = getSelected();
    const val = parser(inputs[key].value);
    if (typeof val === 'number' && Number.isNaN(val)) return;
    l[key] = val;
    renderStage();
    syncInspector();
  });
}

['x', 'y', 'w', 'h', 'rot', 'rad', 'op', 'sh'].forEach(k => bindProp(k));
bindProp('color', v => v);

// Swatches
const swatchesEl = document.getElementById('swatches');
SWATCH_COLORS.forEach(hex => {
  const s = document.createElement('button');
  s.type = 'button';
  s.className = 'sw';
  s.style.background = hex;
  s.setAttribute('aria-label', `Set fill to ${hex}`);
  s.addEventListener('click', () => {
    getSelected().color = hex;
    renderStage();
    syncInspector();
  });
  swatchesEl.appendChild(s);
});

// Dock Rail Toggle (Desktop)
const dockBtn = document.getElementById('dockBtn');
dockBtn.addEventListener('click', () => {
  dockOpen = !dockOpen;
  workspace.classList.toggle('dock-collapsed', !dockOpen);
  dockBtn.setAttribute('aria-pressed', String(dockOpen));
  dockBtn.textContent = dockOpen ? 'Hide Rail' : 'Dock Rail';
});

// Mobile Bottom Sheet Toggle
function toggleSheet() {
  sheetOpen = !sheetOpen;
  inspector.classList.toggle('sheet-open', sheetOpen);
  sheetToggle.textContent = sheetOpen ? 'Collapse' : 'Inspect';
}
sheetToggle.addEventListener('click', (e) => {
  e.stopPropagation();
  toggleSheet();
});
document.getElementById('inspectorHead').addEventListener('click', () => {
  if (window.innerWidth <= 820) toggleSheet();
});

// Reset Active Layer
document.getElementById('resetShapeBtn').addEventListener('click', () => {
  const orig = INITIAL_LAYERS.find(l => l.id === selectedId);
  const idx = layers.findIndex(l => l.id === selectedId);
  if (orig && idx >= 0) {
    layers[idx] = { ...orig };
    renderStage();
    syncInspector();
  }
});

// Copy CSS
copyCssBtn.addEventListener('click', async () => {
  const text = cssOutput.textContent;
  try {
    await navigator.clipboard.writeText(text);
  } catch (_) {
    // fallback no-op
  }
  copyCssBtn.textContent = 'Copied to Clipboard';
  setTimeout(() => { copyCssBtn.textContent = 'Copy CSS Properties'; }, 1400);
});

renderPills();
renderStage();
syncInspector();
</script>
</body>
</html>
```
