#056 style light mobile: high Minimalist Utility & Indie Developer Tooling

Calm Mesh Networking

Warm sand-and-charcoal WireGuard mesh utility with interactive peer topology, MagicDNS switches, and live ping console.

Inspired by Tailscale ↗

Download .html
Fullscreen ↗

WHY THIS AESTHETIC IS UNIQUE

Demystifies complex zero-trust networking by replacing intimidating enterprise firewall tables with warm sand surfaces, calm editorial headings, and an immediately legible SVG peer graph.

BEST FOR

Networking, VPN, and infrastructure admin consolesDeveloper security and identity management toolsFleet and device telemetry dashboards

TAGS

COLOR PALETTE (CLICK TO COPY HEX)

TYPOGRAPHY

Display
Newsreader
Body
Inter
Mono
IBM Plex Mono
Scale
Humanist serif hero statements (32-48px) paired with crisp 13-14px sans UI and monospace IPv4/WireGuard node identifiers.

Google Fonts Stylesheet ↗

ARCHITECTURE & MOBILE NOTES

LAYOUT

Editorial intro alongside a compact MagicDNS/Exit-Node toggle card, above an interactive SVG mesh topology paired with a live peer inspector and filterable machines table.

INTERACTION

Click any peer node in the SVG mesh or table to inspect Direct UDP vs DERP relay routing, toggle MagicDNS or Exit Node routing, and run a simulated live ping.

MOBILE

Navigation collapses into a 44px menu drawer, topology and inspector stack cleanly, and non-essential table columns hide gracefully at 390px.

AI AGENT GUARDRAILS

DO

  • Use warm sand (#F7F5F0) and quiet 1px borders to keep infrastructure controls calm and approachable
  • Clearly distinguish Direct P2P links from DERP-relayed connections with color and dash patterns
  • Display IP addresses, FQDNs, and WireGuard keys in tabular monospace

DON'T

  • Do not use dark hacker-movie aesthetics for human-centered networking utilities
  • Do not overload the machine table with raw firewall rules by default
STANDALONE SOURCE · demos/calm-mesh-networking.html (25.5 KB)
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Tailmesh — Calm WireGuard Mesh Utility</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=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&display=swap" rel="stylesheet">
  <style>
    :root {
      --canvas: #F7F5F0;
      --surface: #FFFFFF;
      --surface-warm: #EFECE4;
      --ink: #1F1E1C;
      --muted: #6E6B64;
      --accent: #3B5BDB;
      --accent-soft: #E9EEFC;
      --green: #2B8A3E;
      --green-soft: #EBFBEE;
      --amber: #B45309;
      --amber-soft: #FEF3C7;
      --border: #E2DDD2;
      --radius: 10px;
      --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      --font-serif: 'Newsreader', Georgia, serif;
      --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
    }
    *, *::before, *::after { box-sizing: border-box; }
    html, body {
      margin: 0;
      padding: 0;
      background: var(--canvas);
      color: var(--ink);
      font-family: var(--font-sans);
      -webkit-font-smoothing: antialiased;
      overflow-x: hidden;
    }
    a { color: inherit; text-decoration: none; }
    button { font-family: inherit; cursor: pointer; }

    /* Header */
    .topbar {
      position: sticky;
      top: 0;
      z-index: 30;
      background: rgba(247, 245, 240, 0.92);
      backdrop-filter: blur(10px);
      border-bottom: 1px solid var(--border);
    }
    .topbar-inner {
      max-width: 1180px;
      margin: 0 auto;
      padding: 0 20px;
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      font-weight: 600;
      font-size: 15px;
      letter-spacing: -0.01em;
    }
    .dot-grid {
      display: grid;
      grid-template-columns: repeat(3, 5px);
      gap: 3px;
    }
    .dot-grid span {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: #C5BFB3;
    }
    .dot-grid span.on { background: var(--ink); }
    .nav-links {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .nav-links button {
      background: transparent;
      border: 1px solid transparent;
      color: var(--muted);
      padding: 8px 12px;
      min-height: 44px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 500;
      transition: background 0.15s, color 0.15s;
    }
    .nav-links button:hover { color: var(--ink); background: var(--surface-warm); }
    .nav-links button.active {
      color: var(--ink);
      background: var(--surface);
      border-color: var(--border);
    }
    .status-pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 6px 12px;
      border-radius: 999px;
      background: var(--green-soft);
      color: var(--green);
      font-size: 12px;
      font-family: var(--font-mono);
      font-weight: 500;
    }
    .pulse {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--green);
      box-shadow: 0 0 0 3px rgba(43, 138, 62, 0.2);
    }
    .mobile-menu-btn {
      display: none;
      align-items: center;
      justify-content: center;
      width: 44px;
      height: 44px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--ink);
    }
    .mobile-drawer {
      display: none;
      border-top: 1px solid var(--border);
      background: var(--surface);
      padding: 12px 20px 16px;
      flex-direction: column;
      gap: 6px;
    }
    .mobile-drawer.open { display: flex; }
    .mobile-drawer button {
      text-align: left;
      min-height: 44px;
      padding: 10px 12px;
      border-radius: 8px;
      border: 1px solid transparent;
      background: transparent;
      font-size: 15px;
      color: var(--ink);
    }
    .mobile-drawer button.active {
      background: var(--surface-warm);
      font-weight: 600;
    }

    /* Main layout */
    .container {
      max-width: 1180px;
      margin: 0 auto;
      padding: 36px 20px 64px;
    }
    .hero-band {
      display: grid;
      grid-template-columns: 1.25fr 1fr;
      gap: 28px;
      align-items: end;
      margin-bottom: 32px;
    }
    .eyebrow {
      font-family: var(--font-mono);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--accent);
      margin-bottom: 10px;
    }
    h1 {
      font-family: var(--font-serif);
      font-weight: 400;
      font-size: clamp(32px, 4.2vw, 48px);
      line-height: 1.08;
      letter-spacing: -0.02em;
      margin: 0 0 12px;
    }
    .lead {
      font-size: 16px;
      line-height: 1.55;
      color: var(--muted);
      margin: 0;
      max-width: 56ch;
    }
    .control-bar {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .toggle-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-height: 44px;
    }
    .toggle-meta strong {
      display: block;
      font-size: 14px;
      font-weight: 600;
    }
    .toggle-meta span {
      font-size: 12px;
      color: var(--muted);
    }
    .switch {
      position: relative;
      width: 48px;
      height: 28px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--surface-warm);
      padding: 0;
      flex-shrink: 0;
      transition: background 0.2s, border-color 0.2s;
    }
    .switch::after {
      content: '';
      position: absolute;
      top: 3px;
      left: 3px;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: var(--surface);
      box-shadow: 0 1px 3px rgba(0,0,0,0.16);
      transition: transform 0.2s;
    }
    .switch[aria-pressed="true"] {
      background: var(--accent);
      border-color: var(--accent);
    }
    .switch[aria-pressed="true"]::after {
      transform: translateX(20px);
    }

    /* Interactive Mesh Stage */
    .mesh-grid {
      display: grid;
      grid-template-columns: 1.45fr 1fr;
      gap: 20px;
      margin-bottom: 28px;
    }
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }
    .card-head {
      padding: 14px 18px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }
    .card-title {
      font-size: 13px;
      font-weight: 600;
      letter-spacing: -0.01em;
    }
    .card-sub {
      font-family: var(--font-mono);
      font-size: 12px;
      color: var(--muted);
    }
    .svg-wrap {
      padding: 18px;
      background:
        radial-gradient(circle at 1px 1px, #DDD7CA 1px, transparent 0) 0 0 / 20px 20px,
        #FBF9F5;
    }
    svg.mesh-svg {
      width: 100%;
      height: auto;
      display: block;
    }
    .mesh-link {
      stroke: #C8C1B4;
      stroke-width: 1.5;
      stroke-dasharray: 4 4;
      transition: stroke 0.25s, stroke-width 0.25s;
    }
    .mesh-link.direct {
      stroke: var(--accent);
      stroke-dasharray: none;
      stroke-width: 2;
    }
    .mesh-link.relay {
      stroke: var(--amber);
      stroke-dasharray: 5 4;
      stroke-width: 1.8;
    }
    .node-group { cursor: pointer; }
    .node-ring {
      fill: var(--surface);
      stroke: #B8B1A3;
      stroke-width: 2;
      transition: stroke 0.2s, fill 0.2s;
    }
    .node-group.selected .node-ring {
      stroke: var(--accent);
      stroke-width: 3;
      fill: var(--accent-soft);
    }
    .node-label {
      font-family: var(--font-mono);
      font-size: 11px;
      fill: var(--ink);
      font-weight: 500;
    }
    .node-ip {
      font-family: var(--font-mono);
      font-size: 10px;
      fill: var(--muted);
    }

    /* Inspector Panel */
    .inspector-body {
      padding: 18px;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    .node-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
    }
    .node-name {
      font-family: var(--font-mono);
      font-size: 18px;
      font-weight: 500;
      margin: 0 0 4px;
    }
    .badge {
      display: inline-flex;
      align-items: center;
      padding: 4px 9px;
      border-radius: 6px;
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
    }
    .badge.direct { background: var(--green-soft); color: var(--green); }
    .badge.relay { background: var(--amber-soft); color: var(--amber); }
    .kv-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }
    .kv {
      background: var(--canvas);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 12px;
    }
    .kv label {
      display: block;
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 4px;
    }
    .kv code {
      font-family: var(--font-mono);
      font-size: 13px;
      color: var(--ink);
      word-break: break-all;
    }
    .ping-btn {
      min-height: 44px;
      padding: 10px 14px;
      border-radius: 8px;
      border: 1px solid var(--ink);
      background: var(--ink);
      color: var(--surface);
      font-size: 13px;
      font-weight: 500;
      transition: opacity 0.15s;
    }
    .ping-btn:hover { opacity: 0.88; }
    .ping-log {
      font-family: var(--font-mono);
      font-size: 12px;
      line-height: 1.6;
      background: #1B1A18;
      color: #E5E1D8;
      padding: 12px 14px;
      border-radius: 8px;
      min-height: 82px;
      white-space: pre-wrap;
    }

    /* Machine Table */
    .filter-strip {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      padding: 14px 18px;
      border-bottom: 1px solid var(--border);
    }
    .pill-group {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }
    .pill {
      min-height: 44px;
      padding: 0 14px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--canvas);
      color: var(--muted);
      font-size: 13px;
      font-weight: 500;
    }
    .pill.active {
      background: var(--ink);
      border-color: var(--ink);
      color: var(--surface);
    }
    .table-wrap {
      width: 100%;
      overflow-x: auto;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 14px;
    }
    th {
      text-align: left;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--muted);
      font-weight: 500;
      padding: 12px 18px;
      border-bottom: 1px solid var(--border);
      background: #FAF8F4;
    }
    td {
      padding: 14px 18px;
      border-bottom: 1px solid var(--border);
      vertical-align: middle;
    }
    tr:last-child td { border-bottom: none; }
    tbody tr { cursor: pointer; transition: background 0.12s; }
    tbody tr:hover { background: #FAF8F4; }
    tbody tr.selected { background: var(--accent-soft); }
    .mono { font-family: var(--font-mono); font-size: 13px; }
    .tag {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 5px;
      background: var(--surface-warm);
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--ink);
      margin-right: 4px;
    }

    @media (max-width: 900px) {
      .hero-band, .mesh-grid { grid-template-columns: 1fr; }
    }
    @media (max-width: 680px) {
      .nav-links, .status-pill { display: none; }
      .mobile-menu-btn { display: inline-flex; }
      .kv-grid { grid-template-columns: 1fr; }
      .container { padding: 24px 16px 48px; }
      th:nth-child(4), td:nth-child(4) { display: none; }
    }
  </style>
</head>
<body>
  <header class="topbar">
    <div class="topbar-inner">
      <a href="#top" class="brand">
        <span class="dot-grid" aria-hidden="true">
          <span class="on"></span><span></span><span class="on"></span>
          <span></span><span class="on"></span><span></span>
          <span class="on"></span><span></span><span class="on"></span>
        </span>
        <span>Tailmesh</span>
      </a>
      <nav class="nav-links" aria-label="Primary">
        <button class="active" data-view="machines">Machines</button>
        <button data-view="dns">MagicDNS</button>
        <button data-view="acl">Access Controls</button>
      </nav>
      <div class="status-pill"><span class="pulse"></span>tailnet.ts.net · 5 online</div>
      <button class="mobile-menu-btn" id="menuBtn" aria-label="Toggle navigation" aria-expanded="false">
        <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8">
          <path d="M3 5h14M3 10h14M3 15h14" stroke-linecap="round"/>
        </svg>
      </button>
    </div>
    <div class="mobile-drawer" id="mobileDrawer">
      <button class="active" data-view="machines">Machines (5)</button>
      <button data-view="dns">MagicDNS · tailnet.ts.net</button>
      <button data-view="acl">Access Controls</button>
    </div>
  </header>

  <main class="container" id="top">
    <section class="hero-band">
      <div>
        <div class="eyebrow">Private WireGuard Overlay · Zero Config</div>
        <h1>A quiet network where every machine feels local.</h1>
        <p class="lead">Encrypted peer-to-peer tunnels across laptops, build servers, and home labs without punching firewall ports or maintaining brittle VPN concentrators.</p>
      </div>
      <div class="control-bar" aria-label="Tailnet controls">
        <div class="toggle-row">
          <div class="toggle-meta">
            <strong>MagicDNS Resolution</strong>
            <span>Resolve bare hostnames like <code class="mono">build-01</code> automatically</span>
          </div>
          <button class="switch" id="dnsToggle" aria-pressed="true" aria-label="Toggle MagicDNS"></button>
        </div>
        <div class="toggle-row">
          <div class="toggle-meta">
            <strong>Route via Exit Node</strong>
            <span>Send internet egress through <code class="mono">hel-gw-01</code> (Helsinki)</span>
          </div>
          <button class="switch" id="exitToggle" aria-pressed="false" aria-label="Toggle Exit Node"></button>
        </div>
      </div>
    </section>

    <section class="mesh-grid">
      <div class="card">
        <div class="card-head">
          <span class="card-title">Live WireGuard Mesh Topology</span>
          <span class="card-sub" id="topoSummary">4 Direct P2P · 1 DERP Relay</span>
        </div>
        <div class="svg-wrap">
          <svg class="mesh-svg" viewBox="0 0 620 340" role="img" aria-label="Interactive mesh topology diagram">
            <g id="linksLayer">
              <line id="l-mac-build" class="mesh-link direct" x1="120" y1="90" x2="310" y2="70"/>
              <line id="l-mac-hel" class="mesh-link direct" x1="120" y1="90" x2="500" y2="110"/>
              <line id="l-mac-nas" class="mesh-link direct" x1="120" y1="90" x2="180" y2="255"/>
              <line id="l-build-hel" class="mesh-link direct" x1="310" y1="70" x2="500" y2="110"/>
              <line id="l-build-phone" class="mesh-link relay" x1="310" y1="70" x2="430" y2="265"/>
              <line id="l-nas-phone" class="mesh-link relay" x1="180" y1="255" x2="430" y2="265"/>
              <line id="l-hel-phone" class="mesh-link direct" x1="500" y1="110" x2="430" y2="265"/>
            </g>

            <g class="node-group selected" data-node="macbook-pro" tabindex="0">
              <circle class="node-ring" cx="120" cy="90" r="24"/>
              <circle cx="120" cy="90" r="6" fill="#2B8A3E"/>
              <text class="node-label" x="120" y="130" text-anchor="middle">macbook-pro</text>
              <text class="node-ip" x="120" y="144" text-anchor="middle">100.64.0.12</text>
            </g>

            <g class="node-group" data-node="build-01" tabindex="0">
              <circle class="node-ring" cx="310" cy="70" r="24"/>
              <circle cx="310" cy="70" r="6" fill="#2B8A3E"/>
              <text class="node-label" x="310" y="110" text-anchor="middle">build-01</text>
              <text class="node-ip" x="310" y="124" text-anchor="middle">100.64.0.44</text>
            </g>

            <g class="node-group" data-node="hel-gw-01" tabindex="0">
              <circle class="node-ring" cx="500" cy="110" r="24"/>
              <circle cx="500" cy="110" r="6" fill="#3B5BDB"/>
              <text class="node-label" x="500" y="150" text-anchor="middle">hel-gw-01</text>
              <text class="node-ip" x="500" y="164" text-anchor="middle">100.64.0.1</text>
            </g>

            <g class="node-group" data-node="home-nas" tabindex="0">
              <circle class="node-ring" cx="180" cy="255" r="24"/>
              <circle cx="180" cy="255" r="6" fill="#2B8A3E"/>
              <text class="node-label" x="180" y="295" text-anchor="middle">home-nas</text>
              <text class="node-ip" x="180" y="309" text-anchor="middle">100.64.0.88</text>
            </g>

            <g class="node-group" data-node="pixel-field" tabindex="0">
              <circle class="node-ring" cx="430" cy="265" r="24"/>
              <circle cx="430" cy="265" r="6" fill="#B45309"/>
              <text class="node-label" x="430" y="305" text-anchor="middle">pixel-field</text>
              <text class="node-ip" x="430" y="319" text-anchor="middle">100.64.0.91</text>
            </g>
          </svg>
        </div>
      </div>

      <aside class="card" aria-live="polite">
        <div class="card-head">
          <span class="card-title">Node Inspector</span>
          <span class="card-sub">Click any peer</span>
        </div>
        <div class="inspector-body">
          <div class="node-header">
            <div>
              <h2 class="node-name" id="insName">macbook-pro</h2>
              <div class="card-sub" id="insFqdn">macbook-pro.tailnet.ts.net</div>
            </div>
            <span class="badge direct" id="insBadge">Direct UDP</span>
          </div>
          <div class="kv-grid">
            <div class="kv">
              <label>Tailscale IPv4</label>
              <code id="insIp">100.64.0.12</code>
            </div>
            <div class="kv">
              <label>Path &amp; Latency</label>
              <code id="insLatency">8.4 ms (direct)</code>
            </div>
            <div class="kv">
              <label>Operating System</label>
              <code id="insOs">macOS 15.3</code>
            </div>
            <div class="kv">
              <label>WireGuard Key</label>
              <code id="insKey">nodekey:8f2a...9c1d</code>
            </div>
          </div>
          <button class="ping-btn" id="pingBtn">Run tailscale ping</button>
          <div class="ping-log" id="pingLog">$ tailscale ping macbook-pro
pong from macbook-pro (100.64.0.12) via direct UDP in 8.4ms</div>
        </div>
      </aside>
    </section>

    <section class="card">
      <div class="filter-strip">
        <span class="card-title" id="tableHeading">Connected Machines</span>
        <div class="pill-group" role="tablist" aria-label="Filter machines">
          <button class="pill active" data-filter="all">All (5)</button>
          <button class="pill" data-filter="direct">Direct P2P (4)</button>
          <button class="pill" data-filter="relay">DERP Relay (1)</button>
        </div>
      </div>
      <div class="table-wrap">
        <table>
          <thead>
            <tr>
              <th>Machine</th>
              <th>Address</th>
              <th>Route</th>
              <th>Tags</th>
            </tr>
          </thead>
          <tbody id="machineRows"></tbody>
        </table>
      </div>
    </section>
  </main>

  <script>
    const NODES = {
      'macbook-pro': {
        name: 'macbook-pro', ip: '100.64.0.12', os: 'macOS 15.3', mode: 'direct',
        latency: '8.4 ms (direct)', key: 'nodekey:8f2a...9c1d', tags: ['tag:dev', 'tag:laptop'],
        endpoint: '203.0.113.19:41641'
      },
      'build-01': {
        name: 'build-01', ip: '100.64.0.44', os: 'Ubuntu 24.04 LTS', mode: 'direct',
        latency: '14.2 ms (direct)', key: 'nodekey:3d71...e4b0', tags: ['tag:ci', 'tag:linux'],
        endpoint: '198.51.100.82:41641'
      },
      'hel-gw-01': {
        name: 'hel-gw-01', ip: '100.64.0.1', os: 'Debian 12', mode: 'direct',
        latency: '31.7 ms (direct)', key: 'nodekey:a19c...02ff', tags: ['tag:exit-node', 'tag:eu'],
        endpoint: '192.0.2.55:41641'
      },
      'home-nas': {
        name: 'home-nas', ip: '100.64.0.88', os: 'TrueNAS Scale', mode: 'direct',
        latency: '11.9 ms (direct)', key: 'nodekey:7c04...51aa', tags: ['tag:storage', 'tag:lan'],
        endpoint: '203.0.113.74:41641'
      },
      'pixel-field': {
        name: 'pixel-field', ip: '100.64.0.91', os: 'Android 15', mode: 'relay',
        latency: '46.5 ms (DERP nyc)', key: 'nodekey:f910...bb28', tags: ['tag:mobile', 'tag:lte'],
        endpoint: 'DERP(nyc) via CGNAT'
      }
    };

    let selectedId = 'macbook-pro';
    let currentFilter = 'all';
    let magicDns = true;
    let exitNode = false;

    const el = id => document.getElementById(id);

    function renderInspector() {
      const n = NODES[selectedId];
      el('insName').textContent = n.name;
      el('insFqdn').textContent = magicDns ? `${n.name}.tailnet.ts.net` : `${n.ip} (MagicDNS disabled)`;
      const badge = el('insBadge');
      badge.textContent = n.mode === 'direct' ? 'Direct UDP' : 'DERP Relay';
      badge.className = `badge ${n.mode}`;
      el('insIp').textContent = n.ip;
      el('insLatency').textContent = exitNode && n.name !== 'hel-gw-01' ? `${n.latency} · egress via hel-gw-01` : n.latency;
      el('insOs').textContent = n.os;
      el('insKey').textContent = n.key;

      document.querySelectorAll('.node-group').forEach(g => {
        g.classList.toggle('selected', g.dataset.node === selectedId);
      });
      renderTable();
    }

    function renderTable() {
      const tbody = el('machineRows');
      const items = Object.values(NODES).filter(n => currentFilter === 'all' || n.mode === currentFilter);
      tbody.innerHTML = items.map(n => `
        <tr data-node="${n.name}" class="${n.name === selectedId ? 'selected' : ''}">
          <td>
            <div style="font-weight:600">${n.name}</div>
            <div class="card-sub">${n.os}</div>
          </td>
          <td class="mono">${magicDns ? n.name + '.ts.net' : n.ip}<div class="card-sub">${n.ip}</div></td>
          <td><span class="badge ${n.mode}">${n.mode === 'direct' ? 'Direct' : 'DERP nyc'}</span></td>
          <td>${n.tags.map(t => `<span class="tag">${t}</span>`).join('')}</td>
        </tr>
      `).join('');

      tbody.querySelectorAll('tr').forEach(tr => {
        tr.addEventListener('click', () => {
          selectedId = tr.dataset.node;
          renderInspector();
        });
      });
    }

    document.querySelectorAll('.node-group').forEach(g => {
      g.addEventListener('click', () => {
        selectedId = g.dataset.node;
        renderInspector();
      });
      g.addEventListener('keydown', e => {
        if (e.key === 'Enter' || e.key === ' ') {
          e.preventDefault();
          selectedId = g.dataset.node;
          renderInspector();
        }
      });
    });

    document.querySelectorAll('.pill').forEach(btn => {
      btn.addEventListener('click', () => {
        currentFilter = btn.dataset.filter;
        document.querySelectorAll('.pill').forEach(b => b.classList.toggle('active', b === btn));
        renderTable();
      });
    });

    el('dnsToggle').addEventListener('click', () => {
      magicDns = !magicDns;
      el('dnsToggle').setAttribute('aria-pressed', String(magicDns));
      renderInspector();
    });

    el('exitToggle').addEventListener('click', () => {
      exitNode = !exitNode;
      el('exitToggle').setAttribute('aria-pressed', String(exitNode));
      el('topoSummary').textContent = exitNode
        ? 'Exit Node active: hel-gw-01 · 4 Direct P2P'
        : '4 Direct P2P · 1 DERP Relay';
      renderInspector();
    });

    el('pingBtn').addEventListener('click', () => {
      const n = NODES[selectedId];
      const base = n.mode === 'direct' ? (7 + Math.random() * 14) : (42 + Math.random() * 12);
      const t1 = base.toFixed(1), t2 = (base - 0.6).toFixed(1);
      el('pingLog').textContent =
        `$ tailscale ping ${magicDns ? n.name : n.ip}\n` +
        `pong from ${n.name} (${n.ip}) via ${n.endpoint} in ${t1}ms\n` +
        `pong from ${n.name} (${n.ip}) via ${n.endpoint} in ${t2}ms`;
    });

    // View tabs + mobile menu
    function setView(view) {
      document.querySelectorAll('[data-view]').forEach(b => b.classList.toggle('active', b.dataset.view === view));
      const headings = {
        machines: 'Connected Machines',
        dns: 'MagicDNS Hostname Registry',
        acl: 'Tag-Based Access Policy Preview'
      };
      el('tableHeading').textContent = headings[view] || 'Connected Machines';
      el('mobileDrawer').classList.remove('open');
      el('menuBtn').setAttribute('aria-expanded', 'false');
    }
    document.querySelectorAll('[data-view]').forEach(b => b.addEventListener('click', () => setView(b.dataset.view)));

    el('menuBtn').addEventListener('click', () => {
      const open = el('mobileDrawer').classList.toggle('open');
      el('menuBtn').setAttribute('aria-expanded', String(open));
    });

    renderInspector();
  </script>
</body>
</html>