#140 ui dark mobile: high Commerce & Hardware

Parametric Product Configurator

Hardware build configurator with a live-updating SVG chassis schematic, dynamic price/TDP gauges, and a sticky mobile summary bar.

Inspired by System76 ↗

Download .html
Fullscreen ↗

WHY THIS AESTHETIC IS UNIQUE

Links every hardware component choice (Chassis, CPU, GPU, RAM, Storage) directly to a parametric SVG workstation diagram, thermal/wattage budget, benchmark bars, and instant price delta.

BEST FOR

Custom hardware, PC, and bike configuratorsAutomotive and industrial equipment buildersModular SaaS plan and compute calculatorsBespoke furniture and architectural configurators

TAGS

COLOR PALETTE (CLICK TO COPY HEX)

TYPOGRAPHY

Display
Inter
Body
Inter
Mono
JetBrains Mono
Scale
28px tabular-nums total price, 14px option titles, 12px mono price deltas (+$240) and TDP wattage readouts.

Google Fonts Stylesheet ↗

ARCHITECTURE & MOBILE NOTES

LAYOUT

Sticky left parametric SVG preview + live spec gauges paired with a scrollable right configuration stack on desktop; top schematic + sticky bottom price/spec drawer on mobile.

INTERACTION

Selecting any tier visually updates the workstation SVG (chassis finish, GPU fan array, RAM sticks, NVMe bays), recalculates total price, wattage, and compute/render score bars.

MOBILE

Pins a persistent bottom summary bar showing live total price and an expandable Spec Sheet button so shoppers never lose sight of cost while scrolling options.

AI AGENT GUARDRAILS

DO

  • Display explicit relative price deltas (+$200 / Included) on every option card.
  • Keep the live total price continuously visible via a sticky sidebar on desktop and sticky bottom bar on mobile.
  • Reflect configuration changes immediately in both the visual preview and technical spec gauges.

DON'T

  • Never force users to scroll back to the top to see how a selection affected total price.
  • Avoid disabling incompatible options silently without explaining why.
STANDALONE SOURCE · demos/parametric-product-configurator.html (24.9 KB)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Kestrel Works — Parametric Workstation Configurator</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
  :root {
    --bg: #111316;
    --panel: #191c21;
    --panel-2: #20242b;
    --border: #2c313a;
    --ink: #f1f3f5;
    --muted: #9aa3b0;
    --copper: #e07a3f;
    --copper-soft: rgba(224, 122, 63, 0.14);
    --copper-hi: #f29a63;
    --teal: #38bdf8;
    --ok: #34d399;
    --warn: #f59e0b;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { overflow-x: hidden; }
  body {
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at 20% 0%, #1d2128 0%, var(--bg) 55%);
    color: var(--ink);
    min-height: 100vh;
    padding-bottom: 92px;
  }
  .mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

  .shell {
    max-width: 1260px;
    margin: 0 auto;
    padding: 20px 20px 40px;
  }
  header.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
  }
  .logo {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .logo-badge {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1.5px solid var(--copper);
    background: var(--copper-soft);
    display: grid;
    place-items: center;
    color: var(--copper-hi);
    font-weight: 700;
    font-size: 16px;
  }
  .logo h1 { font-size: 20px; letter-spacing: -0.02em; }
  .logo p { font-size: 12.5px; color: var(--muted); }

  .presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .preset-btn {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
  }
  .preset-btn:hover { border-color: var(--copper); color: var(--ink); }
  .preset-btn.active {
    background: var(--copper-soft);
    border-color: var(--copper);
    color: var(--copper-hi);
  }

  .grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 22px;
    align-items: start;
  }

  /* Left sticky schematic & telemetry */
  .stage-col {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .schematic-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    position: relative;
    overflow: hidden;
  }
  .schematic-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }
  .schematic-head .tag {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--copper-hi);
    background: var(--copper-soft);
    padding: 4px 9px;
    border-radius: 6px;
  }
  .schematic-head .sku { font-size: 12px; color: var(--muted); }
  .svg-wrap {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #121519;
    border: 1px solid #262b33;
    border-radius: 12px;
    display: grid;
    place-items: center;
    padding: 10px;
  }
  .svg-wrap svg { width: 100%; height: 100%; max-height: 310px; }

  .gauges {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 14px;
  }
  .gauge {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
  }
  .gauge-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .gauge-val {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .gauge-bar {
    height: 6px;
    border-radius: 99px;
    background: #2b303a;
    margin-top: 8px;
    overflow: hidden;
  }
  .gauge-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.3s ease, background 0.3s ease;
  }

  .spec-sheet {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 18px;
  }
  .spec-sheet h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
  }
  .spec-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .spec-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #282d36;
  }
  .spec-row:last-child { border-bottom: none; padding-bottom: 0; }
  .spec-row span:first-child { color: var(--muted); }
  .spec-row span:last-child { text-align: right; font-weight: 500; }

  .desktop-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }
  .price-big {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .price-sub { font-size: 12px; color: var(--muted); }
  .btn-order {
    min-height: 48px;
    padding: 0 22px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--copper), #c85f26);
    color: #fff;
    font: inherit;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s, filter 0.15s;
  }
  .btn-order:hover { filter: brightness(1.08); }
  .btn-order:active { transform: scale(0.98); }

  /* Right options column */
  .controls-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .group {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
  }
  .group-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
  }
  .group-head h3 {
    font-size: 15px;
    font-weight: 600;
  }
  .group-head span {
    font-size: 12px;
    color: var(--muted);
  }
  .options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .options.two-col {
    grid-template-columns: repeat(2, 1fr);
  }
  .opt-card {
    min-height: 56px;
    text-align: left;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1.5px solid var(--border);
    background: var(--panel-2);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: border-color 0.15s, background 0.15s;
  }
  .opt-card:hover { border-color: #4a5260; }
  .opt-card.selected {
    border-color: var(--copper);
    background: linear-gradient(135deg, rgba(224, 122, 63, 0.14), rgba(224, 122, 63, 0.04));
  }
  .opt-title { font-size: 14px; font-weight: 600; }
  .opt-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .opt-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--copper-hi);
    white-space: nowrap;
  }

  /* Mobile sticky summary bar */
  .mobile-bar {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: rgba(20, 23, 28, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    z-index: 40;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .toast {
    position: fixed;
    top: 18px;
    right: 18px;
    background: #1d2a24;
    border: 1px solid var(--ok);
    color: #d1fae5;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 60;
  }
  .toast.show { opacity: 1; transform: translateY(0); }

  @media (max-width: 900px) {
    .grid { grid-template-columns: 1fr; }
    .stage-col { position: static; }
    .desktop-cta { display: none; }
    .mobile-bar { display: flex; }
  }
  @media (max-width: 480px) {
    .shell { padding: 14px 12px 24px; }
    .gauges { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .gauge { padding: 9px; }
    .gauge-val { font-size: 16px; }
    .options.two-col { grid-template-columns: 1fr; }
  }
</style>
</head>
<body>
<div class="shell">
  <header class="top">
    <div class="logo">
      <div class="logo-badge mono">K7</div>
      <div>
        <h1>Kestrel R7 Workstation</h1>
        <p>Hand-assembled Linux &amp; AI compute tower · Boulder, CO</p>
      </div>
    </div>
    <div class="presets" id="presetBar">
      <button class="preset-btn active" data-preset="dev">Kernel Dev</button>
      <button class="preset-btn" data-preset="ml">Local LLM Rig</button>
      <button class="preset-btn" data-preset="render">3D Render Node</button>
    </div>
  </header>

  <div class="grid">
    <div class="stage-col">
      <section class="schematic-card">
        <div class="schematic-head">
          <span class="tag mono" id="chassisTag">ANODIZED GRAPHITE</span>
          <span class="sku mono" id="skuLabel">K7-TR32-4090-128</span>
        </div>
        <div class="svg-wrap">
          <svg id="rigSvg" viewBox="0 0 560 340" role="img" aria-label="Interactive workstation internal schematic">
            <defs>
              <pattern id="gridPat" width="20" height="20" patternUnits="userSpaceOnUse">
                <path d="M 20 0 L 0 0 0 20" fill="none" stroke="#1e232b" stroke-width="1"/>
              </pattern>
            </defs>
            <rect width="560" height="340" fill="url(#gridPat)"/>
            <!-- Chassis Frame -->
            <rect id="svgChassis" x="34" y="24" width="492" height="292" rx="14" fill="#181c22" stroke="#525b68" stroke-width="3"/>
            <rect id="svgAccent" x="34" y="24" width="12" height="292" rx="4" fill="#e07a3f"/>
            <!-- Front Intake Fans -->
            <g id="svgFans" transform="translate(465, 50)">
              <circle cx="22" cy="36" r="24" fill="#121519" stroke="#3a414c" stroke-width="2"/>
              <circle cx="22" cy="36" r="8" fill="#e07a3f" opacity="0.8"/>
              <circle cx="22" cy="116" r="24" fill="#121519" stroke="#3a414c" stroke-width="2"/>
              <circle cx="22" cy="116" r="8" fill="#e07a3f" opacity="0.8"/>
              <circle cx="22" cy="196" r="24" fill="#121519" stroke="#3a414c" stroke-width="2"/>
              <circle cx="22" cy="196" r="8" fill="#e07a3f" opacity="0.8"/>
            </g>
            <!-- Motherboard -->
            <rect x="64" y="42" width="376" height="256" rx="8" fill="#1f242c" stroke="#333a45" stroke-width="1.5"/>
            <!-- CPU Socket & Cooler -->
            <g id="svgCpu" transform="translate(110, 62)">
              <rect width="108" height="96" rx="8" fill="#272d38" stroke="#e07a3f" stroke-width="2"/>
              <rect x="14" y="14" width="80" height="68" rx="4" fill="#16191f" stroke="#47505e"/>
              <text id="svgCpuText" x="54" y="46" text-anchor="middle" fill="#f1f3f5" font-family="IBM Plex Mono, monospace" font-size="11" font-weight="600">24-CORE</text>
              <text id="svgCpuSub" x="54" y="63" text-anchor="middle" fill="#e07a3f" font-family="IBM Plex Mono, monospace" font-size="9">THREADRIPPER</text>
            </g>
            <!-- RAM DIMM Slots (up to 8 sticks) -->
            <g id="svgRam" transform="translate(238, 62)"></g>
            <!-- NVMe Storage Bays -->
            <g id="svgStorage" transform="translate(344, 62)"></g>
            <!-- GPU Slots -->
            <g id="svgGpu" transform="translate(88, 184)"></g>
            <!-- PSU Shroud -->
            <rect x="64" y="264" width="376" height="34" rx="5" fill="#15181d" stroke="#2e343f"/>
            <text id="svgPsuText" x="252" y="285" text-anchor="middle" fill="#9aa3b0" font-family="IBM Plex Mono, monospace" font-size="11">1000W TITANIUM PSU · 48% LOAD</text>
          </svg>
        </div>

        <div class="gauges">
          <div class="gauge">
            <div class="gauge-label">Compute Score</div>
            <div class="gauge-val mono" id="gScore">0</div>
            <div class="gauge-bar"><div class="gauge-fill" id="barScore" style="width:0%;background:var(--copper)"></div></div>
          </div>
          <div class="gauge">
            <div class="gauge-label">Peak Draw</div>
            <div class="gauge-val mono" id="gWatts">0W</div>
            <div class="gauge-bar"><div class="gauge-fill" id="barWatts" style="width:0%;background:var(--teal)"></div></div>
          </div>
          <div class="gauge">
            <div class="gauge-label">Acoustics</div>
            <div class="gauge-val mono" id="gNoise">24 dBA</div>
            <div class="gauge-bar"><div class="gauge-fill" id="barNoise" style="width:0%;background:var(--ok)"></div></div>
          </div>
        </div>
      </section>

      <section class="spec-sheet">
        <h2><span>Live Spec Sheet</span><span class="mono" id="shipLead">Ships in 5 days</span></h2>
        <div class="spec-list" id="specList"></div>
        <div class="desktop-cta">
          <div>
            <div class="price-big mono" id="desktopPrice">$0</div>
            <div class="price-sub">Includes 3-year US hardware warranty</div>
          </div>
          <button class="btn-order" id="orderBtnDesktop">Save Build &amp; Quote</button>
        </div>
      </section>
    </div>

    <div class="controls-col" id="controlsCol"></div>
  </div>
</div>

<div class="mobile-bar">
  <div>
    <div class="mono" style="font-size:20px;font-weight:700" id="mobilePrice">$0</div>
    <div style="font-size:11.5px;color:var(--muted)" id="mobileSummary">0W · Score 0</div>
  </div>
  <button class="btn-order" id="orderBtnMobile">Save Quote</button>
</div>

<div class="toast" id="toast" role="status" aria-live="polite"></div>

<script>
(() => {
  const CATALOG = [
    {
      key: 'chassis',
      title: 'Chassis Finish',
      hint: 'CNC milled aluminum',
      twoCol: true,
      options: [
        { id: 'graphite', name: 'Anodized Graphite', sub: 'Bead-blasted slate · copper accent', price: 0, watts: 15, score: 0, fill: '#181c22', stroke: '#525b68', accent: '#e07a3f', tag: 'ANODIZED GRAPHITE' },
        { id: 'walnut', name: 'Charred Walnut Front', sub: 'Acoustic timber slats · brass trim', price: 180, watts: 15, score: 0, fill: '#221c18', stroke: '#8c6244', accent: '#d9a05b', tag: 'WALNUT EDITION' }
      ]
    },
    {
      key: 'cpu',
      title: 'Processor (CPU)',
      hint: 'Socket sTR5 · ECC ready',
      options: [
        { id: 'tr24', name: 'Threadripper 7960X', sub: '24 Cores / 48 Threads · 5.3 GHz', price: 1490, watts: 280, score: 62, short: '24-CORE', sku: 'TR24' },
        { id: 'tr32', name: 'Threadripper 7970X', sub: '32 Cores / 64 Threads · 5.3 GHz', price: 2490, watts: 330, score: 82, short: '32-CORE', sku: 'TR32' },
        { id: 'tr64', name: 'Threadripper PRO 7985WX', sub: '64 Cores / 128 Threads · 256MB L3', price: 4890, watts: 350, score: 100, short: '64-CORE', sku: 'TR64' }
      ]
    },
    {
      key: 'gpu',
      title: 'Graphics & AI Compute (GPU)',
      hint: 'PCIe 5.0 x16',
      options: [
        { id: 'rtx4070', name: '1× RTX 4070 Ti Super', sub: '16 GB GDDR6X · Quiet dual-fan', price: 820, watts: 285, score: 48, cards: 1, vram: '16GB', sku: '4070S' },
        { id: 'rtx4090', name: '1× RTX 4090 Workstation', sub: '24 GB GDDR6X · Blower vapor chamber', price: 1890, watts: 450, score: 78, cards: 1, vram: '24GB', sku: '4090' },
        { id: 'dual4090', name: '2× RTX 4090 NV-Link Pair', sub: '48 GB Total VRAM · Local 70B models', price: 3780, watts: 860, score: 100, cards: 2, vram: '48GB', sku: '2X4090' }
      ]
    },
    {
      key: 'ram',
      title: 'ECC DDR5 Memory',
      hint: '4800 MT/s Registered',
      twoCol: true,
      options: [
        { id: '64g', name: '64 GB (2×32)', sub: 'Dual channel ECC', price: 260, watts: 24, score: 35, sticks: 2, sku: '64G' },
        { id: '128g', name: '128 GB (4×32)', sub: 'Quad channel ECC', price: 520, watts: 42, score: 65, sticks: 4, sku: '128G' },
        { id: '256g', name: '256 GB (8×32)', sub: 'Full 8-DIMM bank', price: 1080, watts: 74, score: 90, sticks: 8, sku: '256G' },
        { id: '512g', name: '512 GB (8×64)', sub: 'Max dataset capacity', price: 2240, watts: 92, score: 100, sticks: 8, sku: '512G' }
      ]
    },
    {
      key: 'storage',
      title: 'NVMe PCIe 5.0 Storage',
      hint: 'Up to 14 GB/s sequential',
      twoCol: true,
      options: [
        { id: '2tb', name: '2 TB Gen5 NVMe', sub: '1× M.2 drive', price: 220, watts: 10, score: 45, drives: 1 },
        { id: '4tb', name: '4 TB (2×2 TB RAID)', sub: '2× M.2 mirrored', price: 460, watts: 18, score: 70, drives: 2 },
        { id: '8tb', name: '8 TB (2×4 TB)', sub: '2× M.2 scratch + OS', price: 890, watts: 22, score: 88, drives: 2 },
        { id: '12tb', name: '12 TB (3×4 TB)', sub: '3× M.2 full bay', price: 1320, watts: 30, score: 100, drives: 3 }
      ]
    }
  ];

  const PRESETS = {
    dev: { chassis: 'graphite', cpu: 'tr24', gpu: 'rtx4070', ram: '64g', storage: '2tb' },
    ml: { chassis: 'graphite', cpu: 'tr32', gpu: 'dual4090', ram: '256g', storage: '8tb' },
    render: { chassis: 'walnut', cpu: 'tr64', gpu: 'rtx4090', ram: '128g', storage: '12tb' }
  };

  const BASE_PRICE = 680; // Motherboard, chassis base, liquid cooler, Linux OS
  let state = { ...PRESETS.dev };

  const controlsCol = document.getElementById('controlsCol');
  const specList = document.getElementById('specList');

  function getOpt(key) {
    const group = CATALOG.find(g => g.key === key);
    return group.options.find(o => o.id === state[key]);
  }

  function renderControls() {
    controlsCol.innerHTML = '';
    CATALOG.forEach(group => {
      const sec = document.createElement('section');
      sec.className = 'group';
      sec.innerHTML = `<div class="group-head"><h3>${group.title}</h3><span>${group.hint}</span></div>`;
      const grid = document.createElement('div');
      grid.className = 'options' + (group.twoCol ? ' two-col' : '');
      group.options.forEach(opt => {
        const btn = document.createElement('button');
        btn.type = 'button';
        btn.className = 'opt-card' + (state[group.key] === opt.id ? ' selected' : '');
        btn.innerHTML = `
          <div>
            <div class="opt-title">${opt.name}</div>
            <div class="opt-sub">${opt.sub}</div>
          </div>
          <div class="opt-price mono">${opt.price === 0 ? 'Incl.' : '+$' + opt.price.toLocaleString()}</div>
        `;
        btn.addEventListener('click', () => {
          state[group.key] = opt.id;
          document.querySelectorAll('.preset-btn').forEach(b => b.classList.remove('active'));
          updateAll();
        });
        grid.appendChild(btn);
      });
      sec.appendChild(grid);
      controlsCol.appendChild(sec);
    });
  }

  function updateSchematic(ch, cpu, gpu, ram, sto, watts, psuCap) {
    document.getElementById('svgChassis').setAttribute('fill', ch.fill);
    document.getElementById('svgChassis').setAttribute('stroke', ch.stroke);
    document.getElementById('svgAccent').setAttribute('fill', ch.accent);
    document.getElementById('chassisTag').textContent = ch.tag;
    document.getElementById('skuLabel').textContent = `K7-${cpu.sku}-${gpu.sku}-${ram.sku}`;

    document.getElementById('svgCpuText').textContent = cpu.short;

    // RAM sticks
    const ramG = document.getElementById('svgRam');
    ramG.innerHTML = '';
    for (let i = 0; i < 8; i++) {
      const filled = i < ram.sticks;
      const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
      rect.setAttribute('x', i * 11);
      rect.setAttribute('y', 0);
      rect.setAttribute('width', 7);
      rect.setAttribute('height', 96);
      rect.setAttribute('rx', 2);
      rect.setAttribute('fill', filled ? '#38bdf8' : '#16191f');
      rect.setAttribute('stroke', filled ? '#7dd3fc' : '#2e3540');
      rect.setAttribute('opacity', filled ? '0.9' : '0.6');
      ramG.appendChild(rect);
    }

    // Storage bays
    const stoG = document.getElementById('svgStorage');
    stoG.innerHTML = '';
    for (let i = 0; i < 3; i++) {
      const filled = i < sto.drives;
      const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
      rect.setAttribute('x', 0);
      rect.setAttribute('y', i * 33);
      rect.setAttribute('width', 78);
      rect.setAttribute('height', 24);
      rect.setAttribute('rx', 4);
      rect.setAttribute('fill', filled ? '#23352f' : '#16191f');
      rect.setAttribute('stroke', filled ? '#34d399' : '#2e3540');
      stoG.appendChild(rect);
      const txt = document.createElementNS('http://www.w3.org/2000/svg', 'text');
      txt.setAttribute('x', 39);
      txt.setAttribute('y', i * 33 + 15);
      txt.setAttribute('text-anchor', 'middle');
      txt.setAttribute('fill', filled ? '#a7f3d0' : '#4b5563');
      txt.setAttribute('font-family', 'IBM Plex Mono, monospace');
      txt.setAttribute('font-size', '9');
      txt.textContent = filled ? `NVMe #${i + 1}` : 'OPEN M.2';
      stoG.appendChild(txt);
    }

    // GPUs
    const gpuG = document.getElementById('svgGpu');
    gpuG.innerHTML = '';
    for (let i = 0; i < gpu.cards; i++) {
      const y = i * 38;
      const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
      g.innerHTML = `
        <rect x="0" y="${y}" width="324" height="32" rx="5" fill="#252a34" stroke="${ch.accent}" stroke-width="1.8"/>
        <circle cx="292" cy="${y + 16}" r="10" fill="#14171c" stroke="#525b68"/>
        <text x="16" y="${y + 20}" fill="#f1f3f5" font-family="IBM Plex Mono, monospace" font-size="11" font-weight="600">${gpu.name.replace(/^\d×\s*/, '')} · ${gpu.cards === 2 ? '24GB' : gpu.vram}</text>
      `;
      gpuG.appendChild(g);
    }

    const loadPct = Math.round((watts / psuCap) * 100);
    document.getElementById('svgPsuText').textContent = `${psuCap}W TITANIUM PSU · ${loadPct}% PEAK LOAD`;
  }

  function updateAll() {
    renderControls();
    const ch = getOpt('chassis');
    const cpu = getOpt('cpu');
    const gpu = getOpt('gpu');
    const ram = getOpt('ram');
    const sto = getOpt('storage');

    const total = BASE_PRICE + ch.price + cpu.price + gpu.price + ram.price + sto.price;
    const watts = 45 + ch.watts + cpu.watts + gpu.watts + ram.watts + sto.watts;
    const psuCap = watts > 950 ? 1600 : (watts > 700 ? 1200 : 1000);
    const score = Math.round(cpu.score * 0.35 + gpu.score * 0.42 + ram.score * 0.15 + sto.score * 0.08);
    const dba = Math.round(21 + (watts / 1450) * 18);

    updateSchematic(ch, cpu, gpu, ram, sto, watts, psuCap);

    document.getElementById('gScore').textContent = `${score}/100`;
    document.getElementById('barScore').style.width = `${score}%`;

    document.getElementById('gWatts').textContent = `${watts}W`;
    const wPct = Math.min(100, Math.round((watts / 1500) * 100));
    const barW = document.getElementById('barWatts');
    barW.style.width = `${wPct}%`;
    barW.style.background = watts > 1100 ? 'var(--warn)' : 'var(--teal)';

    document.getElementById('gNoise').textContent = `${dba} dBA`;
    document.getElementById('barNoise').style.width = `${Math.min(100, Math.round((dba / 45) * 100))}%`;

    const formatted = '$' + total.toLocaleString();
    document.getElementById('desktopPrice').textContent = formatted;
    document.getElementById('mobilePrice').textContent = formatted;
    document.getElementById('mobileSummary').textContent = `${watts}W · Score ${score} · ${psuCap}W PSU`;
    document.getElementById('shipLead').textContent = gpu.cards === 2 ? 'Ships in 8 days' : 'Ships in 5 days';

    specList.innerHTML = [
      ['Chassis', ch.name],
      ['Processor', cpu.name],
      ['Graphics', gpu.name],
      ['Memory', ram.name + ' ECC'],
      ['Storage', sto.name],
      ['Power Supply', `${psuCap}W 80+ Titanium Modular`],
      ['OS Preload', 'Pop!_OS 24.04 LTS + CUDA 12.6']
    ].map(([k, v]) => `<div class="spec-row"><span>${k}</span><span class="mono">${v}</span></div>`).join('');
  }

  document.getElementById('presetBar').addEventListener('click', (e) => {
    const btn = e.target.closest('.preset-btn');
    if (!btn) return;
    document.querySelectorAll('.preset-btn').forEach(b => b.classList.toggle('active', b === btn));
    state = { ...PRESETS[btn.dataset.preset] };
    updateAll();
  });

  function triggerQuote() {
    const sku = document.getElementById('skuLabel').textContent;
    const price = document.getElementById('desktopPrice').textContent;
    const toast = document.getElementById('toast');
    toast.textContent = `Build ${sku} (${price}) saved to quote clipboard.`;
    toast.classList.add('show');
    if (navigator.clipboard) navigator.clipboard.writeText(`${sku} — ${price}`).catch(() => {});
    setTimeout(() => toast.classList.remove('show'), 2800);
  }
  document.getElementById('orderBtnDesktop').addEventListener('click', triggerQuote);
  document.getElementById('orderBtnMobile').addEventListener('click', triggerQuote);

  updateAll();
})();
</script>
</body>
</html>