{
  "id": 41,
  "slug": "atmospheric-vector-telemetry",
  "name": "Atmospheric Vector Telemetry",
  "kind": "style",
  "family": "Telemetry & Cartographic",
  "sourceSite": {
    "name": "earth.nullschool.net",
    "url": "https://earth.nullschool.net/",
    "verifiedStatus": 200
  },
  "tagline": "Full-bleed abyssal wind-streamline canvas with translucent instrument HUD and barometric altitude controls.",
  "whyUnique": "Replaces conventional dashboard cards with a continuous animated fluid-field visualization where controls float as ultra-lightweight translucent instrument drawers.",
  "theme": "dark",
  "mobileStrength": "high",
  "tags": [
    "telemetry",
    "weather",
    "canvas-2d",
    "cartography",
    "hud-overlay",
    "scientific"
  ],
  "bestFor": [
    "Real-time meteorological and atmospheric monitors",
    "Oceanographic or geospatial vector-field explorers",
    "Environmental sensor network live maps"
  ],
  "palette": [
    {
      "role": "canvas",
      "hex": "#091119",
      "name": "Abyssal Slate"
    },
    {
      "role": "surface",
      "hex": "#101D29",
      "name": "Instrument Deep"
    },
    {
      "role": "ink",
      "hex": "#E4F0F6",
      "name": "Vapor White"
    },
    {
      "role": "accent",
      "hex": "#2EE6C5",
      "name": "Jetstream Cyan"
    },
    {
      "role": "muted",
      "hex": "#6B879B",
      "name": "Radar Haze"
    }
  ],
  "typography": {
    "display": "Space Grotesk",
    "body": "Inter",
    "mono": "IBM Plex Mono",
    "googleFontsUrl": "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap",
    "scaleNotes": "Compact monospace telemetry readouts (11-13px) paired with crisp 15-18px instrument headers so the canvas remains dominant."
  },
  "layoutNotes": "Full-viewport Canvas 2D streamline field with anchored corner HUD controls, collapsible altitude/layer drawer, and pinned bottom-left coordinate readout.",
  "interactionNotes": "Click or tap anywhere on the field to inspect local wind vector speed and bearing; switch pressure levels (Surface, 850 hPa, 250 hPa) to dynamically alter particle velocity and curl.",
  "mobileNotes": "HUD controls collapse into a thumb-friendly bottom drawer with 44px touch targets while keeping the live wind canvas unobstructed at 390px width.",
  "agentGuardrails": {
    "do": [
      "Keep HUD panels semi-translucent with crisp 1px borders so the live vector canvas breathes",
      "Format coordinates, pressure levels, and speeds in tabular monospace figures",
      "Provide an immediate interactive altitude or layer toggle that visibly changes the flow field"
    ],
    "dont": [
      "Do not bury the visualization inside heavy opaque dashboard chrome",
      "Do not use neon green matrix cliches; stick to deep oceanic slate and cyan-amber velocity ramps"
    ]
  },
  "demoFile": "demos/atmospheric-vector-telemetry.html",
  "thumbDesktop": "thumbs/atmospheric-vector-telemetry-desktop.webp",
  "thumbMobile": "thumbs/atmospheric-vector-telemetry-mobile.webp",
  "urls": {
    "page": "https://templates.michaelpitts.net/t/atmospheric-vector-telemetry",
    "markdown": "https://templates.michaelpitts.net/t/atmospheric-vector-telemetry.md",
    "api": "https://templates.michaelpitts.net/api/templates/atmospheric-vector-telemetry",
    "demo": "https://templates.michaelpitts.net/demos/atmospheric-vector-telemetry.html",
    "thumbDesktop": "https://templates.michaelpitts.net/thumbs/atmospheric-vector-telemetry-desktop.webp",
    "thumbMobile": "https://templates.michaelpitts.net/thumbs/atmospheric-vector-telemetry-mobile.webp"
  },
  "agentPrompt": "Design & build using template #041 \"Atmospheric Vector Telemetry\" (style / Telemetry & Cartographic, dark theme).\nFull AI blueprint & standalone starter code: https://templates.michaelpitts.net/t/atmospheric-vector-telemetry.md\nLive demo: https://templates.michaelpitts.net/demos/atmospheric-vector-telemetry.html\nReal-world inspiration: earth.nullschool.net (https://earth.nullschool.net/)\n\nCore aesthetic: Replaces conventional dashboard cards with a continuous animated fluid-field visualization where controls float as ultra-lightweight translucent instrument drawers.\nPalette: canvas: #091119 (Abyssal Slate), surface: #101D29 (Instrument Deep), ink: #E4F0F6 (Vapor White), accent: #2EE6C5 (Jetstream Cyan), muted: #6B879B (Radar Haze)\nTypography: Display=\"Space Grotesk\", Body=\"Inter\", Mono=\"IBM Plex Mono\"\nLayout: Full-viewport Canvas 2D streamline field with anchored corner HUD controls, collapsible altitude/layer drawer, and pinned bottom-left coordinate readout.\nInteractions: Click or tap anywhere on the field to inspect local wind vector speed and bearing; switch pressure levels (Surface, 850 hPa, 250 hPa) to dynamically alter particle velocity and curl.\nMobile: HUD controls collapse into a thumb-friendly bottom drawer with 44px touch targets while keeping the live wind canvas unobstructed at 390px width.\n\nGuardrails:\n- DO: Keep HUD panels semi-translucent with crisp 1px borders so the live vector canvas breathes\n- DO: Format coordinates, pressure levels, and speeds in tabular monospace figures\n- DO: Provide an immediate interactive altitude or layer toggle that visibly changes the flow field\n- DON'T: Do not bury the visualization inside heavy opaque dashboard chrome\n- DON'T: Do not use neon green matrix cliches; stick to deep oceanic slate and cyan-amber velocity ramps",
  "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>AETHER // Global Atmospheric Vector Telemetry</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=IBM+Plex+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">\n  <style>\n    :root {\n      --canvas: #091119;\n      --surface: #101D29;\n      --surface-glass: rgba(16, 29, 41, 0.82);\n      --border: rgba(228, 240, 246, 0.14);\n      --border-strong: rgba(46, 230, 197, 0.42);\n      --ink: #E4F0F6;\n      --accent: #2EE6C5;\n      --accent-dim: rgba(46, 230, 197, 0.15);\n      --muted: #6B879B;\n      --warn: #FFB454;\n      --jet: #FF5D8F;\n      --font-sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;\n      --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;\n    }\n\n    *, *::before, *::after {\n      box-sizing: border-box;\n      margin: 0;\n      padding: 0;\n    }\n\n    html, body {\n      width: 100%;\n      height: 100%;\n      overflow: hidden;\n      background: var(--canvas);\n      color: var(--ink);\n      font-family: var(--font-sans);\n      -webkit-font-smoothing: antialiased;\n    }\n\n    .viewport {\n      position: relative;\n      width: 100vw;\n      height: 100vh;\n      height: 100dvh;\n      overflow: hidden;\n      background: radial-gradient(circle at 52% 48%, #0f2030 0%, #091119 68%, #050a0f 100%);\n    }\n\n    #windCanvas {\n      position: absolute;\n      inset: 0;\n      width: 100%;\n      height: 100%;\n      display: block;\n      cursor: crosshair;\n    }\n\n    /* Top Telemetry Strip */\n    .hud-top {\n      position: absolute;\n      top: 16px;\n      left: 16px;\n      right: 16px;\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n      gap: 12px;\n      pointer-events: none;\n      z-index: 20;\n    }\n\n    .brand-pill {\n      pointer-events: auto;\n      display: flex;\n      align-items: center;\n      gap: 12px;\n      padding: 10px 16px;\n      background: var(--surface-glass);\n      backdrop-filter: blur(14px);\n      -webkit-backdrop-filter: blur(14px);\n      border: 1px solid var(--border);\n      border-radius: 6px;\n    }\n\n    .pulse-dot {\n      width: 8px;\n      height: 8px;\n      border-radius: 50%;\n      background: var(--accent);\n      box-shadow: 0 0 10px var(--accent);\n      animation: pulse 2.2s infinite ease-in-out;\n      flex-shrink: 0;\n    }\n\n    @keyframes pulse {\n      0%, 100% { opacity: 1; transform: scale(1); }\n      50% { opacity: 0.45; transform: scale(0.8); }\n    }\n\n    .brand-title {\n      font-size: 0.92rem;\n      font-weight: 700;\n      letter-spacing: 0.12em;\n      text-transform: uppercase;\n    }\n\n    .brand-meta {\n      font-family: var(--font-mono);\n      font-size: 0.72rem;\n      color: var(--muted);\n      border-left: 1px solid var(--border);\n      padding-left: 12px;\n      white-space: nowrap;\n    }\n\n    .top-actions {\n      pointer-events: auto;\n      display: flex;\n      align-items: center;\n      gap: 8px;\n    }\n\n    .hud-btn {\n      min-height: 44px;\n      min-width: 44px;\n      padding: 0 14px;\n      background: var(--surface-glass);\n      backdrop-filter: blur(14px);\n      -webkit-backdrop-filter: blur(14px);\n      border: 1px solid var(--border);\n      border-radius: 6px;\n      color: var(--ink);\n      font-family: var(--font-mono);\n      font-size: 0.75rem;\n      letter-spacing: 0.04em;\n      cursor: pointer;\n      display: inline-flex;\n      align-items: center;\n      justify-content: center;\n      gap: 8px;\n      transition: border-color 0.2s, background 0.2s, color 0.2s;\n    }\n\n    .hud-btn:hover, .hud-btn[aria-pressed=\"true\"] {\n      border-color: var(--border-strong);\n      background: rgba(20, 39, 54, 0.94);\n      color: var(--accent);\n    }\n\n    .mobile-menu-btn {\n      display: none;\n    }\n\n    /* Left Instrument Drawer / Dock */\n    .instrument-dock {\n      position: absolute;\n      left: 16px;\n      bottom: 16px;\n      width: 332px;\n      max-width: calc(100vw - 32px);\n      background: var(--surface-glass);\n      backdrop-filter: blur(16px);\n      -webkit-backdrop-filter: blur(16px);\n      border: 1px solid var(--border);\n      border-radius: 8px;\n      padding: 16px;\n      z-index: 25;\n      display: flex;\n      flex-direction: column;\n      gap: 14px;\n      box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);\n    }\n\n    .dock-header {\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n      border-bottom: 1px solid var(--border);\n      padding-bottom: 10px;\n    }\n\n    .dock-label {\n      font-family: var(--font-mono);\n      font-size: 0.7rem;\n      letter-spacing: 0.1em;\n      text-transform: uppercase;\n      color: var(--muted);\n    }\n\n    .dock-close {\n      display: none;\n      background: transparent;\n      border: 1px solid var(--border);\n      color: var(--ink);\n      border-radius: 4px;\n      min-width: 44px;\n      min-height: 44px;\n      font-family: var(--font-mono);\n      font-size: 0.85rem;\n      cursor: pointer;\n    }\n\n    .pressure-group {\n      display: grid;\n      grid-template-columns: repeat(3, 1fr);\n      gap: 6px;\n    }\n\n    .pressure-btn {\n      min-height: 46px;\n      padding: 8px 6px;\n      background: rgba(9, 17, 25, 0.7);\n      border: 1px solid var(--border);\n      border-radius: 5px;\n      color: var(--ink);\n      cursor: pointer;\n      display: flex;\n      flex-direction: column;\n      align-items: center;\n      justify-content: center;\n      gap: 2px;\n      transition: all 0.18s ease;\n    }\n\n    .pressure-btn strong {\n      font-family: var(--font-mono);\n      font-size: 0.76rem;\n      font-weight: 600;\n    }\n\n    .pressure-btn span {\n      font-size: 0.64rem;\n      color: var(--muted);\n    }\n\n    .pressure-btn.active {\n      background: var(--accent-dim);\n      border-color: var(--accent);\n      color: var(--accent);\n    }\n\n    .pressure-btn.active span {\n      color: var(--ink);\n    }\n\n    .overlay-row {\n      display: flex;\n      gap: 6px;\n    }\n\n    .chip-btn {\n      flex: 1;\n      min-height: 44px;\n      background: rgba(9, 17, 25, 0.65);\n      border: 1px solid var(--border);\n      border-radius: 5px;\n      color: var(--muted);\n      font-family: var(--font-mono);\n      font-size: 0.7rem;\n      cursor: pointer;\n      transition: all 0.18s ease;\n    }\n\n    .chip-btn.active {\n      border-color: var(--border-strong);\n      color: var(--ink);\n      background: rgba(46, 230, 197, 0.12);\n    }\n\n    .control-slider {\n      display: flex;\n      flex-direction: column;\n      gap: 6px;\n    }\n\n    .slider-head {\n      display: flex;\n      justify-content: space-between;\n      font-family: var(--font-mono);\n      font-size: 0.7rem;\n      color: var(--muted);\n    }\n\n    .slider-head output {\n      color: var(--ink);\n    }\n\n    input[type=\"range\"] {\n      width: 100%;\n      accent-color: var(--accent);\n      height: 6px;\n      cursor: pointer;\n    }\n\n    .scale-bar {\n      display: flex;\n      flex-direction: column;\n      gap: 5px;\n    }\n\n    .scale-gradient {\n      height: 8px;\n      border-radius: 99px;\n      background: linear-gradient(90deg, #1b4d6e 0%, #2ee6c5 38%, #ffb454 72%, #ff5d8f 100%);\n      border: 1px solid rgba(255, 255, 255, 0.12);\n    }\n\n    .scale-ticks {\n      display: flex;\n      justify-content: space-between;\n      font-family: var(--font-mono);\n      font-size: 0.66rem;\n      color: var(--muted);\n    }\n\n    /* Right Coordinate & Wind Inspector */\n    .inspector-card {\n      position: absolute;\n      right: 16px;\n      bottom: 16px;\n      width: 288px;\n      max-width: calc(100vw - 32px);\n      background: var(--surface-glass);\n      backdrop-filter: blur(16px);\n      -webkit-backdrop-filter: blur(16px);\n      border: 1px solid var(--border);\n      border-radius: 8px;\n      padding: 14px 16px;\n      z-index: 20;\n      display: flex;\n      flex-direction: column;\n      gap: 10px;\n    }\n\n    .inspector-head {\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n    }\n\n    .inspector-coord {\n      font-family: var(--font-mono);\n      font-size: 0.82rem;\n      font-weight: 600;\n      color: var(--accent);\n    }\n\n    .inspector-grid {\n      display: grid;\n      grid-template-columns: repeat(2, 1fr);\n      gap: 8px;\n    }\n\n    .metric-box {\n      background: rgba(9, 17, 25, 0.65);\n      border: 1px solid var(--border);\n      border-radius: 5px;\n      padding: 8px 10px;\n    }\n\n    .metric-box .k {\n      display: block;\n      font-family: var(--font-mono);\n      font-size: 0.62rem;\n      text-transform: uppercase;\n      letter-spacing: 0.08em;\n      color: var(--muted);\n      margin-bottom: 3px;\n    }\n\n    .metric-box .v {\n      font-family: var(--font-mono);\n      font-size: 0.92rem;\n      font-weight: 600;\n      color: var(--ink);\n    }\n\n    .inspector-hint {\n      font-size: 0.72rem;\n      color: var(--muted);\n      line-height: 1.4;\n    }\n\n    /* Mobile Drawer Backdrop */\n    .drawer-backdrop {\n      display: none;\n      position: fixed;\n      inset: 0;\n      background: rgba(5, 10, 15, 0.65);\n      z-index: 24;\n    }\n\n    @media (max-width: 820px) {\n      .brand-meta {\n        display: none;\n      }\n\n      .mobile-menu-btn {\n        display: inline-flex;\n      }\n\n      .desktop-only {\n        display: none;\n      }\n\n      .instrument-dock {\n        position: fixed;\n        top: 0;\n        left: 0;\n        bottom: 0;\n        width: min(320px, 88vw);\n        max-width: 88vw;\n        border-radius: 0 10px 10px 0;\n        transform: translateX(-105%);\n        transition: transform 0.25s ease;\n        overflow-y: auto;\n        padding-top: 20px;\n      }\n\n      .instrument-dock.open {\n        transform: translateX(0);\n      }\n\n      .drawer-backdrop.open {\n        display: block;\n      }\n\n      .dock-close {\n        display: inline-flex;\n        align-items: center;\n        justify-content: center;\n      }\n\n      .inspector-card {\n        left: 12px;\n        right: 12px;\n        bottom: 12px;\n        width: auto;\n        max-width: none;\n        padding: 12px;\n      }\n\n      .hud-top {\n        top: 12px;\n        left: 12px;\n        right: 12px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <main class=\"viewport\">\n    <canvas id=\"windCanvas\" aria-label=\"Interactive global atmospheric wind streamline field\"></canvas>\n\n    <header class=\"hud-top\">\n      <div class=\"brand-pill\">\n        <span class=\"pulse-dot\" aria-hidden=\"true\"></span>\n        <span class=\"brand-title\">AETHER // GFS-0.25°</span>\n        <span class=\"brand-meta\" id=\"utcClock\">2026-12-06 05:20 UTC · CYCLE 00Z</span>\n      </div>\n\n      <div class=\"top-actions\">\n        <button class=\"hud-btn desktop-only\" id=\"projBtn\" type=\"button\" aria-pressed=\"false\">PROJ: ORTHO</button>\n        <button class=\"hud-btn\" id=\"pauseBtn\" type=\"button\" aria-pressed=\"false\">PAUSE</button>\n        <button class=\"hud-btn mobile-menu-btn\" id=\"drawerOpenBtn\" type=\"button\" aria-expanded=\"false\" aria-controls=\"instrumentDock\">CONTROLS</button>\n      </div>\n    </header>\n\n    <div class=\"drawer-backdrop\" id=\"drawerBackdrop\"></div>\n\n    <aside class=\"instrument-dock\" id=\"instrumentDock\" aria-label=\"Atmospheric telemetry controls\">\n      <div class=\"dock-header\">\n        <span class=\"dock-label\">ISOBARIC LAYER // WIND VECTOR</span>\n        <button class=\"dock-close\" id=\"drawerCloseBtn\" type=\"button\" aria-label=\"Close controls\">✕</button>\n      </div>\n\n      <div class=\"pressure-group\" role=\"group\" aria-label=\"Pressure altitude levels\">\n        <button class=\"pressure-btn active\" type=\"button\" data-level=\"sfc\">\n          <strong>SFC</strong>\n          <span>10m Surface</span>\n        </button>\n        <button class=\"pressure-btn\" type=\"button\" data-level=\"850\">\n          <strong>850 hPa</strong>\n          <span>1.5 km Trade</span>\n        </button>\n        <button class=\"pressure-btn\" type=\"button\" data-level=\"250\">\n          <strong>250 hPa</strong>\n          <span>10.5 km Jet</span>\n        </button>\n      </div>\n\n      <div class=\"dock-label\">OVERLAY FIELD</div>\n      <div class=\"overlay-row\" role=\"group\" aria-label=\"Scalar overlay\">\n        <button class=\"chip-btn active\" type=\"button\" data-overlay=\"speed\">WIND SPD</button>\n        <button class=\"chip-btn\" type=\"button\" data-overlay=\"temp\">TEMP ANOM</button>\n        <button class=\"chip-btn\" type=\"button\" data-overlay=\"mslp\">ISOBARS</button>\n      </div>\n\n      <div class=\"control-slider\">\n        <div class=\"slider-head\">\n          <label for=\"densitySlider\">PARTICLE DENSITY</label>\n          <output id=\"densityOut\">1,100</output>\n        </div>\n        <input id=\"densitySlider\" type=\"range\" min=\"400\" max=\"2000\" step=\"100\" value=\"1100\">\n      </div>\n\n      <div class=\"scale-bar\">\n        <div class=\"dock-label\" id=\"scaleLabel\">VELOCITY SCALE (KM/H)</div>\n        <div class=\"scale-gradient\"></div>\n        <div class=\"scale-ticks\" id=\"scaleTicks\">\n          <span>0</span>\n          <span>35</span>\n          <span>75</span>\n          <span>120</span>\n          <span>180+</span>\n        </div>\n      </div>\n    </aside>\n\n    <section class=\"inspector-card\" aria-live=\"polite\" aria-label=\"Coordinate wind telemetry inspector\">\n      <div class=\"inspector-head\">\n        <span class=\"dock-label\">PROBE TELEMETRY</span>\n        <span class=\"inspector-coord\" id=\"probeCoord\">38.4°N, 142.6°W</span>\n      </div>\n      <div class=\"inspector-grid\">\n        <div class=\"metric-box\">\n          <span class=\"k\">WIND SPEED</span>\n          <span class=\"v\" id=\"probeSpeed\">64.2 km/h</span>\n        </div>\n        <div class=\"metric-box\">\n          <span class=\"k\">AZIMUTH</span>\n          <span class=\"v\" id=\"probeBearing\">258° WSW</span>\n        </div>\n        <div class=\"metric-box\">\n          <span class=\"k\">AIR TEMP</span>\n          <span class=\"v\" id=\"probeTemp\">9.4 °C</span>\n        </div>\n        <div class=\"metric-box\">\n          <span class=\"k\">PRESSURE</span>\n          <span class=\"v\" id=\"probePressure\">1004 hPa</span>\n        </div>\n      </div>\n      <p class=\"inspector-hint\" id=\"probeHint\">Click or tap anywhere on the projection to drop the atmospheric sonde.</p>\n    </section>\n  </main>\n\n  <script>\n    (() => {\n      const canvas = document.getElementById('windCanvas');\n      const ctx = canvas.getContext('2d');\n\n      const state = {\n        level: 'sfc',\n        overlay: 'speed',\n        projection: 'ortho',\n        paused: false,\n        particleCount: 1100,\n        width: window.innerWidth,\n        height: window.innerHeight,\n        dpr: Math.min(window.devicePixelRatio || 1, 2),\n        probe: { lat: 38.4, lon: -142.6, x: 0.36, y: 0.38 },\n        time: 0\n      };\n\n      const LEVEL_CFG = {\n        sfc: { name: 'Surface 10m', speedMult: 1.0, baseTemp: 14, basePress: 1013, scaleMax: 120, jetBias: 0.25 },\n        850: { name: '850 hPa', speedMult: 1.45, baseTemp: 4, basePress: 850, scaleMax: 160, jetBias: 0.55 },\n        250: { name: '250 hPa Jet Stream', speedMult: 2.35, baseTemp: -48, basePress: 250, scaleMax: 260, jetBias: 1.15 }\n      };\n\n      // Stylized simplified continental polygons (lon, lat) for scientific graticule context\n      const CONTINENTS = [\n        [[-130,52],[-122,42],[-112,28],[-98,20],[-82,25],[-76,38],[-62,48],[-80,60],[-115,62]],\n        [[-78,8],[-68,-8],[-54,-22],[-62,-46],[-72,-52],[-76,-28],[-80,-4]],\n        [[-10,36],[4,44],[24,56],[36,64],[14,68],[-4,56],[-10,44]],\n        [[-14,14],[10,32],[34,30],[44,8],[32,-26],[18,-34],[8,-12],[-8,4]],\n        [[42,58],[74,66],[122,64],[142,46],[124,24],[102,14],[82,10],[66,24],[46,38]],\n        [[114,-22],[134,-14],[152,-26],[146,-38],[124,-34]]\n      ];\n\n      let particles = [];\n\n      function resize() {\n        state.width = window.innerWidth;\n        state.height = window.innerHeight;\n        canvas.width = Math.floor(state.width * state.dpr);\n        canvas.height = Math.floor(state.height * state.dpr);\n        ctx.setTransform(state.dpr, 0, 0, state.dpr, 0, 0);\n        ctx.fillStyle = '#091119';\n        ctx.fillRect(0, 0, state.width, state.height);\n        seedParticles();\n      }\n\n      function projectPoint(lon, lat) {\n        const cx = state.width * 0.5;\n        const cy = state.height * 0.48;\n        if (state.projection === 'ortho') {\n          const r = Math.min(state.width, state.height) * 0.41;\n          const lam = ((lon + 35) * Math.PI) / 180;\n          const phi = (lat * Math.PI) / 180;\n          const cosC = Math.cos(phi) * Math.cos(lam);\n          if (cosC < 0) return null;\n          return {\n            x: cx + r * Math.cos(phi) * Math.sin(lam),\n            y: cy - r * Math.sin(phi),\n            r\n          };\n        }\n        return {\n          x: ((lon + 180) / 360) * state.width,\n          y: ((90 - lat) / 180) * state.height,\n          r: Math.min(state.width, state.height) * 0.45\n        };\n      }\n\n      function screenToLatLon(x, y) {\n        const cx = state.width * 0.5;\n        const cy = state.height * 0.48;\n        if (state.projection === 'ortho') {\n          const r = Math.min(state.width, state.height) * 0.41;\n          const dx = (x - cx) / r;\n          const dy = (cy - y) / r;\n          const dist2 = dx * dx + dy * dy;\n          if (dist2 > 1) return null;\n          const z = Math.sqrt(1 - dist2);\n          const lat = Math.asin(dy) * (180 / Math.PI);\n          const lon = Math.atan2(dx, z) * (180 / Math.PI) - 35;\n          return { lat, lon: ((lon + 540) % 360) - 180 };\n        }\n        return {\n          lat: 90 - (y / state.height) * 180,\n          lon: (x / state.width) * 360 - 180\n        };\n      }\n\n      // Deterministic synoptic wind vector field (cyclones, anticyclones, jet stream)\n      function sampleWind(nx, ny) {\n        const cfg = LEVEL_CFG[state.level];\n        const latRad = (0.5 - ny) * Math.PI;\n        const lonRad = nx * Math.PI * 2;\n\n        // Zonal jet + trade winds\n        let u = Math.cos(latRad * 2.8) * 1.15 + cfg.jetBias * Math.exp(-Math.pow((Math.abs(latRad) - 0.65) / 0.24, 2)) * 2.1;\n        let v = Math.sin(lonRad * 2.0 + state.time * 0.15) * 0.42 * Math.cos(latRad);\n\n        // Two synoptic low/high vortices\n        const vortices = [\n          { x: 0.34, y: 0.34, s: 1.55, r: 0.16 },\n          { x: 0.68, y: 0.42, s: -1.35, r: 0.18 },\n          { x: 0.52, y: 0.66, s: 1.15, r: 0.15 }\n        ];\n        for (const vtx of vortices) {\n          const dx = nx - vtx.x;\n          const dy = ny - vtx.y;\n          const d2 = dx * dx + dy * dy + 0.0025;\n          const falloff = Math.exp(-d2 / (vtx.r * vtx.r));\n          u += (-dy / Math.sqrt(d2)) * vtx.s * falloff;\n          v += (dx / Math.sqrt(d2)) * vtx.s * falloff;\n        }\n\n        u *= cfg.speedMult;\n        v *= cfg.speedMult;\n        const mag = Math.hypot(u, v);\n        return { u, v, mag };\n      }\n\n      function speedColor(mag) {\n        const cfg = LEVEL_CFG[state.level];\n        const t = Math.min(mag / (2.6 * cfg.speedMult), 1);\n        if (state.overlay === 'temp') {\n          if (t < 0.45) return `rgba(74, 159, 255, ${0.45 + t})`;\n          if (t < 0.75) return `rgba(255, 180, 84, ${0.65 + t * 0.3})`;\n          return `rgba(255, 93, 143, 0.92)`;\n        }\n        if (t < 0.35) return `rgba(46, 230, 197, ${0.38 + t * 1.2})`;\n        if (t < 0.72) return `rgba(255, 180, 84, ${0.65 + t * 0.3})`;\n        return `rgba(255, 93, 143, 0.94)`;\n      }\n\n      function spawnParticle() {\n        return {\n          x: Math.random() * state.width,\n          y: Math.random() * state.height,\n          age: Math.floor(Math.random() * 80),\n          maxAge: 55 + Math.floor(Math.random() * 75)\n        };\n      }\n\n      function seedParticles() {\n        particles = Array.from({ length: state.particleCount }, spawnParticle);\n      }\n\n      function drawBackdropGeometry() {\n        const cx = state.width * 0.5;\n        const cy = state.height * 0.48;\n        const r = Math.min(state.width, state.height) * 0.41;\n\n        ctx.save();\n        if (state.projection === 'ortho') {\n          ctx.beginPath();\n          ctx.arc(cx, cy, r, 0, Math.PI * 2);\n          ctx.strokeStyle = 'rgba(46, 230, 197, 0.22)';\n          ctx.lineWidth = 1.2;\n          ctx.stroke();\n\n          // Graticule rings\n          ctx.strokeStyle = 'rgba(228, 240, 246, 0.05)';\n          ctx.lineWidth = 1;\n          for (let lat = -60; lat <= 60; lat += 30) {\n            ctx.beginPath();\n            let started = false;\n            for (let lon = -180; lon <= 180; lon += 6) {\n              const p = projectPoint(lon, lat);\n              if (!p) { started = false; continue; }\n              if (!started) { ctx.moveTo(p.x, p.y); started = true; }\n              else ctx.lineTo(p.x, p.y);\n            }\n            ctx.stroke();\n          }\n        } else {\n          ctx.strokeStyle = 'rgba(228, 240, 246, 0.06)';\n          ctx.lineWidth = 1;\n          for (let i = 1; i < 6; i++) {\n            const y = (state.height / 6) * i;\n            ctx.beginPath();\n            ctx.moveTo(0, y);\n            ctx.lineTo(state.width, y);\n            ctx.stroke();\n          }\n          for (let i = 1; i < 12; i++) {\n            const x = (state.width / 12) * i;\n            ctx.beginPath();\n            ctx.moveTo(x, 0);\n            ctx.lineTo(x, state.height);\n            ctx.stroke();\n          }\n        }\n\n        // Simplified continental outlines\n        ctx.strokeStyle = 'rgba(107, 135, 155, 0.34)';\n        ctx.lineWidth = 1.1;\n        for (const poly of CONTINENTS) {\n          ctx.beginPath();\n          let started = false;\n          for (const [lon, lat] of poly) {\n            const p = projectPoint(lon, lat);\n            if (!p) { started = false; continue; }\n            if (!started) { ctx.moveTo(p.x, p.y); started = true; }\n            else ctx.lineTo(p.x, p.y);\n          }\n          if (started) ctx.closePath();\n          ctx.stroke();\n        }\n\n        // Isobars overlay when active\n        if (state.overlay === 'mslp') {\n          ctx.strokeStyle = 'rgba(228, 240, 246, 0.14)';\n          ctx.setLineDash([4, 4]);\n          [0.34, 0.68].forEach((vx, idx) => {\n            const px = vx * state.width;\n            const py = (idx === 0 ? 0.34 : 0.42) * state.height;\n            for (let rad = 36; rad <= 144; rad += 36) {\n              ctx.beginPath();\n              ctx.ellipse(px, py, rad * 1.25, rad * 0.85, 0.25, 0, Math.PI * 2);\n              ctx.stroke();\n            }\n          });\n          ctx.setLineDash([]);\n        }\n\n        // Probe reticle\n        const px = state.probe.x * state.width;\n        const py = state.probe.y * state.height;\n        ctx.strokeStyle = '#2EE6C5';\n        ctx.lineWidth = 1.5;\n        ctx.beginPath();\n        ctx.arc(px, py, 9, 0, Math.PI * 2);\n        ctx.stroke();\n        ctx.beginPath();\n        ctx.moveTo(px - 15, py);\n        ctx.lineTo(px - 5, py);\n        ctx.moveTo(px + 5, py);\n        ctx.lineTo(px + 15, py);\n        ctx.moveTo(px, py - 15);\n        ctx.lineTo(px, py - 5);\n        ctx.moveTo(px, py + 5);\n        ctx.lineTo(px, py + 15);\n        ctx.stroke();\n        ctx.restore();\n      }\n\n      function updateInspector() {\n        const cfg = LEVEL_CFG[state.level];\n        const vec = sampleWind(state.probe.x, state.probe.y);\n        const speedKmh = Math.round(vec.mag * 36 * 10) / 10;\n        const deg = Math.round(((Math.atan2(vec.u, -vec.v) * 180) / Math.PI + 360) % 360);\n        const dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'];\n        const cardinal = dirs[Math.round(deg / 22.5) % 16];\n        const latFactor = Math.cos((state.probe.lat * Math.PI) / 180);\n        const temp = (cfg.baseTemp + latFactor * 14 - vec.mag * 2.1).toFixed(1);\n        const press = Math.round(cfg.basePress - vec.mag * 6.5);\n\n        const latStr = `${Math.abs(state.probe.lat).toFixed(1)}°${state.probe.lat >= 0 ? 'N' : 'S'}`;\n        const lonStr = `${Math.abs(state.probe.lon).toFixed(1)}°${state.probe.lon >= 0 ? 'E' : 'W'}`;\n\n        document.getElementById('probeCoord').textContent = `${latStr}, ${lonStr}`;\n        document.getElementById('probeSpeed').textContent = `${speedKmh.toFixed(1)} km/h`;\n        document.getElementById('probeBearing').textContent = `${deg}° ${cardinal}`;\n        document.getElementById('probeTemp').textContent = `${temp} °C`;\n        document.getElementById('probePressure').textContent = `${press} hPa`;\n      }\n\n      function tick() {\n        if (!state.paused) {\n          state.time += 0.012;\n          // Fade previous trails\n          ctx.fillStyle = 'rgba(9, 17, 25, 0.085)';\n          ctx.fillRect(0, 0, state.width, state.height);\n\n          const cx = state.width * 0.5;\n          const cy = state.height * 0.48;\n          const r = Math.min(state.width, state.height) * 0.41;\n\n          ctx.lineWidth = 1.25;\n          for (let i = 0; i < particles.length; i++) {\n            const p = particles[i];\n            if (p.age >= p.maxAge || p.x < 0 || p.x > state.width || p.y < 0 || p.y > state.height) {\n              particles[i] = spawnParticle();\n              continue;\n            }\n            if (state.projection === 'ortho') {\n              const dist = Math.hypot(p.x - cx, p.y - cy);\n              if (dist > r) {\n                const ang = Math.random() * Math.PI * 2;\n                const rad = Math.sqrt(Math.random()) * r * 0.98;\n                p.x = cx + Math.cos(ang) * rad;\n                p.y = cy + Math.sin(ang) * rad;\n                p.age = 0;\n                continue;\n              }\n            }\n            const vec = sampleWind(p.x / state.width, p.y / state.height);\n            const nx = p.x + vec.u * 1.85;\n            const ny = p.y + vec.v * 1.85;\n\n            ctx.beginPath();\n            ctx.strokeStyle = speedColor(vec.mag);\n            ctx.moveTo(p.x, p.y);\n            ctx.lineTo(nx, ny);\n            ctx.stroke();\n\n            p.x = nx;\n            p.y = ny;\n            p.age++;\n          }\n          drawBackdropGeometry();\n        }\n        requestAnimationFrame(tick);\n      }\n\n      // Event wiring\n      canvas.addEventListener('click', (e) => {\n        const rect = canvas.getBoundingClientRect();\n        const x = e.clientX - rect.left;\n        const y = e.clientY - rect.top;\n        const ll = screenToLatLon(x, y);\n        if (!ll) return;\n        state.probe = { lat: ll.lat, lon: ll.lon, x: x / state.width, y: y / state.height };\n        document.getElementById('probeHint').textContent = `Sonde locked on ${LEVEL_CFG[state.level].name} streamline vector.`;\n        updateInspector();\n      });\n\n      document.querySelectorAll('.pressure-btn').forEach((btn) => {\n        btn.addEventListener('click', () => {\n          document.querySelectorAll('.pressure-btn').forEach((b) => b.classList.remove('active'));\n          btn.classList.add('active');\n          state.level = btn.dataset.level;\n          const max = LEVEL_CFG[state.level].scaleMax;\n          const ticks = document.getElementById('scaleTicks').children;\n          [0, Math.round(max * 0.25), Math.round(max * 0.5), Math.round(max * 0.75), `${max}+`].forEach((v, idx) => {\n            ticks[idx].textContent = v;\n          });\n          updateInspector();\n        });\n      });\n\n      document.querySelectorAll('.chip-btn').forEach((btn) => {\n        btn.addEventListener('click', () => {\n          document.querySelectorAll('.chip-btn').forEach((b) => b.classList.remove('active'));\n          btn.classList.add('active');\n          state.overlay = btn.dataset.overlay;\n          document.getElementById('scaleLabel').textContent =\n            state.overlay === 'temp' ? 'THERMAL GRADIENT (°C)' : 'VELOCITY SCALE (KM/H)';\n        });\n      });\n\n      document.getElementById('densitySlider').addEventListener('input', (e) => {\n        state.particleCount = Number(e.target.value);\n        document.getElementById('densityOut').textContent = state.particleCount.toLocaleString();\n        seedParticles();\n      });\n\n      document.getElementById('pauseBtn').addEventListener('click', (e) => {\n        state.paused = !state.paused;\n        e.currentTarget.textContent = state.paused ? 'RESUME' : 'PAUSE';\n        e.currentTarget.setAttribute('aria-pressed', String(state.paused));\n      });\n\n      document.getElementById('projBtn').addEventListener('click', (e) => {\n        state.projection = state.projection === 'ortho' ? 'equirect' : 'ortho';\n        e.currentTarget.textContent = state.projection === 'ortho' ? 'PROJ: ORTHO' : 'PROJ: EQUIRECT';\n        e.currentTarget.setAttribute('aria-pressed', String(state.projection === 'equirect'));\n        ctx.fillStyle = '#091119';\n        ctx.fillRect(0, 0, state.width, state.height);\n      });\n\n      // Mobile drawer controls\n      const dock = document.getElementById('instrumentDock');\n      const backdrop = document.getElementById('drawerBackdrop');\n      const openBtn = document.getElementById('drawerOpenBtn');\n      const closeBtn = document.getElementById('drawerCloseBtn');\n\n      function setDrawer(open) {\n        dock.classList.toggle('open', open);\n        backdrop.classList.toggle('open', open);\n        openBtn.setAttribute('aria-expanded', String(open));\n      }\n\n      openBtn.addEventListener('click', () => setDrawer(true));\n      closeBtn.addEventListener('click', () => setDrawer(false));\n      backdrop.addEventListener('click', () => setDrawer(false));\n\n      window.addEventListener('resize', resize);\n      resize();\n      updateInspector();\n      requestAnimationFrame(tick);\n    })();\n  </script>\n</body>\n</html>\n"
}
