Skip to content

Waybox-AI/roadtrip-skill

roadtrip-navigator

Verified

Generate North American road-trip itineraries as a map-first, offline-friendly single-file HTML page. Plans around daily driving segments, overnight stops, fuel/EV-charging, national-park reservations (Recreation.gov / NPS), seasonal road closures, and timezone/border crossings — for executable, decision-ready trips. Two entry modes: give a start + region/destination + days and it plans the whole route, or hand it an existing route and it verifies, fills gaps, and produces the page.

assets/preview-pnw.html

View on GitHub
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="RoadTrip Navigator · Waybox AI · rtn-2607" />
<title>RoadTrip Navigator</title>
<meta name="theme-color" id="themeColor" content="#12171d" />
<script>
  (function () {
    var theme = "dark";
    try { if (localStorage.getItem("rtn_theme") === "light") theme = "light"; } catch (e) {}
    document.documentElement.setAttribute("data-theme", theme);
    document.documentElement.style.colorScheme = theme;
    var themeColor = document.getElementById("themeColor");
    if (themeColor) themeColor.setAttribute("content", theme === "light" ? "#eeedea" : "#12171d");
  })();
</script>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
  integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
<style>
  :root {
    color-scheme: dark;
    --bg: #12171d; --card: #1d242c; --card-2: #171d24;
    --ink: #e8eaed; --muted: #949ca6; --line: rgba(255,255,255,.13);
    --accent: #fffbbb; --on-accent: #12171d; --accent-soft: #2b2a1c;
    --ok: #a9d8bc; --warn: #f2cb78; --danger: #ff9e98;
    --shadow: 0 1px 2px rgba(0,0,0,.45), 0 18px 36px -22px rgba(0,0,0,.75);
  }
  html[data-theme="light"] {
    color-scheme: light;
    --bg: #eeedea; --card: #ffffff; --card-2: #f5f5f3;
    --ink: #1f1f1e; --muted: #777671; --line: rgba(31,31,30,.14);
    --accent: #4a4947; --on-accent: #ffffff; --accent-soft: #fffbbb;
    --ok: #387052; --warn: #7a5b14; --danger: #a33a34;
    --shadow: 0 2px 4px rgba(31,31,30,.04), 0 22px 46px -28px rgba(31,31,30,.22);
  }

  * { box-sizing: border-box; }
  body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.55; -webkit-font-smoothing: antialiased;
  }
  body, .card, header.hero, .theme-toggle {
    transition: background-color .25s, color .25s, border-color .25s, box-shadow .25s;
  }
  .wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 64px; }
  a { color: var(--accent); }

  header.hero {
    position: relative; overflow: hidden;
    background: radial-gradient(circle at 85% 0, rgba(255,251,187,.16), transparent 38%), var(--card);
    color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
    padding: 26px 22px; box-shadow: var(--shadow);
  }
  header.hero h1 { margin: 0 0 6px; font-size: 1.7rem; }
  header.hero .sub { color: var(--muted); font-size: 1rem; margin-bottom: 14px; }
  .facts { display: flex; flex-wrap: wrap; gap: 10px; }
  .fact { background: var(--card-2); border: 1px solid var(--line);
    padding: 6px 12px; border-radius: 999px; font-size: .85rem; }
  .theme-toggle { position: absolute; top: 16px; right: 16px; border: 1px solid var(--line);
    border-radius: 999px; padding: 8px 12px; background: var(--card-2); color: var(--ink);
    font: 600 .78rem/1 inherit; cursor: pointer; }
  .theme-toggle:hover { border-color: var(--accent); }

  .section { margin-top: 26px; }
  .section h2 { font-size: 1.15rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow); }

  /* Categorized booking deadlines */
  .booking-zone { overflow: hidden; }
  .booking-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    padding: 8px; background: var(--card-2); border-bottom: 1px solid var(--line); }
  .booking-tab { display: flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 0; border: 0; border-radius: 999px; padding: 10px 12px;
    background: transparent; color: var(--muted); cursor: pointer;
    font: 650 .88rem/1 inherit; }
  .booking-tab:hover { color: var(--ink); }
  .booking-tab[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
  .booking-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .booking-tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px;
    border-radius: 999px; padding: 0 5px; background: rgba(127,127,127,.16);
    color: inherit; font-size: .7rem; }
  .booking-panel { padding: 20px; }
  .booking-panel[hidden] { display: none; }
  .booking-panel-head { display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; margin-bottom: 8px; }
  .booking-kicker { margin: 0 0 4px; color: var(--muted); font-size: .72rem;
    font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
  .booking-panel-head h2 { margin: 0; font-size: 1.1rem; }
  .booking-earliest { flex: none; border: 1px solid var(--line); border-radius: 999px;
    padding: 6px 10px; background: var(--accent-soft); color: var(--accent);
    font-size: .75rem; white-space: nowrap; }
  .booking-timeline { position: relative; display: grid; }
  .booking-timeline::before { content: ""; position: absolute; top: 18px; bottom: 18px;
    left: 91px; width: 1px; background: var(--line); }
  .booking-timeline-row { position: relative; display: grid;
    grid-template-columns: 74px 18px minmax(0, 1fr); gap: 10px; padding: 12px 0; }
  .booking-timeline-date { color: var(--muted); font-size: .72rem; line-height: 1.35;
    text-align: right; text-decoration: none; }
  .booking-timeline-date strong { display: block; color: var(--ink); font-size: .78rem; }
  .booking-timeline-dot { position: relative; z-index: 1; width: 10px; height: 10px;
    margin-top: 4px; border-radius: 50%; background: var(--accent);
    box-shadow: 0 0 0 4px var(--card); }
  .booking-timeline-dot.pri-high { background: var(--danger); }
  .booking-copy { min-width: 0; }
  .booking-title-row { display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; }
  .booking-copy h3 { margin: 0 0 4px; font-size: .95rem; }
  .booking-price { flex: none; border: 1px solid var(--line); border-radius: 999px;
    padding: 4px 8px; background: var(--card-2); color: var(--ink);
    font-size: .72rem; font-weight: 700; white-space: nowrap; }
  .booking-price.unknown { color: var(--muted); font-weight: 600; }
  .booking-copy p { margin: 0; color: var(--muted); font-size: .82rem; }
  .booking-copy .booking-item-meta { color: var(--ink); font-weight: 600; }
  .booking-copy p + p { margin-top: 3px; }
  .booking-empty { margin: 18px 0 8px; color: var(--muted); font-size: .88rem; }

  /* Map */
  #map { height: 460px; border-radius: 14px; border: 1px solid var(--line); }
  .map-fallback { padding: 16px; color: var(--muted); font-size: .9rem; }
  .leaflet-popup-content { font-size: .9rem; }
  .popup-actions { margin-top: 8px; display: flex; gap: 8px; }
  .popup-actions a { font-size: .82rem; text-decoration: none; padding: 4px 8px;
    border: 1px solid var(--line); border-radius: 8px; }

  /* Days */
  .day { padding: 16px 18px; margin-bottom: 14px; }
  .day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
  .day-badge { background: var(--accent); color: var(--on-accent); font-weight: 700; border-radius: 8px;
    padding: 2px 10px; font-size: .85rem; }
  .day-title { font-size: 1.05rem; font-weight: 700; }
  .day-meta { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; }
  .day-meta b { color: var(--ink); }
  .tznote { color: var(--warn); font-weight: 600; }
  .stops { list-style: none; margin: 12px 0 0; padding: 0; }
  .stops li { padding: 8px 0 8px 26px; position: relative; border-top: 1px solid var(--line); }
  .stops li:before { content: ""; position: absolute; left: 6px; top: 14px; width: 9px; height: 9px;
    border-radius: 50%; background: var(--accent); }
  .stop-name { font-weight: 600; }
  .tag { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: middle; }
  .tag.timed { background: #fdecec; color: var(--danger); }
  .stop-note { color: var(--muted); font-size: .87rem; }
  .fuel-row, .meal-row { font-size: .87rem; color: var(--muted); margin-top: 8px; }
  .risks { margin: 10px 0 0; padding: 10px 12px; background: var(--accent-soft); border: 1px solid var(--line);
    border-radius: 10px; font-size: .85rem; }
  .risks b { color: var(--warn); }

  /* Tables */
  table { width: 100%; border-collapse: collapse; font-size: .9rem; }
  th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
  th { color: var(--muted); font-weight: 600; }
  .num { text-align: right; white-space: nowrap; }
  .rel { font-size: .72rem; padding: 1px 7px; border-radius: 999px; }
  .rel.verified { background: var(--card-2); color: var(--ok); }
  .rel.reference { background: var(--accent-soft); color: var(--accent); }
  .rel.estimate { background: var(--card-2); color: var(--muted); }
  tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }

  ul.tips { margin: 0; padding-left: 18px; }
  ul.tips li { margin: 6px 0; }

  .share-button { width: 100%; border: 0; border-radius: 999px; padding: 13px 20px;
    background: var(--accent); color: var(--on-accent); cursor: pointer;
    font: 750 .95rem/1 inherit; box-shadow: var(--shadow); }
  .share-button:hover { transform: translateY(-1px); }
  .share-status { min-height: 1.4em; margin-top: 7px; text-align: center;
    color: var(--muted); font-size: .8rem; }

  .disclaimer { margin-top: 26px; font-size: .82rem; color: var(--muted);
    background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 14px 16px; }
  .footer-meta { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 14px; }
  .footer-meta a { color: inherit; }

  /* Route comparison */
  .routes-table td.chosen-cell { font-weight: 700; }
  .routes-table tr.chosen { background: var(--accent-soft); }
  .chosen-badge { display: inline-block; font-size: .7rem; background: var(--accent);
    color: #fff; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
  .intensity-relaxed { color: var(--ok); }
  .intensity-moderate { color: var(--warn); }
  .intensity-intense { color: var(--danger); font-weight: 700; }

  /* Cross-border */
  .border-card { padding: 16px 18px; border-left: 5px solid var(--accent); }
  .border-crossing { padding: 12px 0; border-bottom: 1px dashed var(--line); }
  .border-crossing:last-child { border-bottom: 0; }
  .border-route { font-weight: 700; font-size: 1rem; }
  .border-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 8px; }
  @media (min-width: 760px) { .border-grid { grid-template-columns: 1fr 1fr; } }
  .border-block h4 { margin: 0 0 4px; font-size: .85rem; color: var(--muted); }
  .border-block ul { margin: 0; padding-left: 18px; font-size: .85rem; }
  .border-insurance { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px;
    padding: 8px 12px; font-size: .85rem; margin-top: 8px; }
  .border-insurance.critical { background: var(--card-2); border-color: var(--danger); }
  .units-after { font-size: .82rem; color: var(--accent); margin-top: 6px; }

  /* EV corridor */
  .ev-card { padding: 6px 10px; }
  .soc-cell { min-width: 130px; }
  .soc-bar { position: relative; height: 16px; background: var(--card-2); border-radius: 8px; overflow: hidden; }
  .soc-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; }
  .soc-fill.good { background: var(--ok); }
  .soc-fill.low { background: var(--warn); }
  .soc-fill.bad { background: var(--danger); }
  .soc-num { font-size: .78rem; color: var(--muted); }
  tr.ev-mid td { background: rgba(0,0,0,.022); font-size: .88em; }
  tr.ev-mid td:first-child { padding-left: 22px; }
  .ev-midtag { font-size: .68rem; font-weight: 600; color: var(--muted);
    border: 1px solid rgba(0,0,0,.14); border-radius: 999px; padding: 1px 7px;
    margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
  .ev-stay { font-size: .8rem; color: var(--muted); font-weight: 500; }
  .ev-warn { margin-top: 10px; padding: 10px 12px; background: var(--card-2); border: 1px solid var(--danger);
    border-radius: 10px; font-size: .85rem; }
  .ev-assume { font-size: .78rem; color: var(--muted); margin-top: 8px; }
  .charge-note { font-size: .8rem; color: var(--accent); }

  .scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.86) contrast(.92) saturate(.55); }
  html[data-theme="light"] .leaflet-tile-pane { filter: none; }

  @media (max-width: 600px) {
    .wrap { padding: 14px 12px 48px; }
    header.hero { padding: 18px 16px; border-radius: 14px; }
    header.hero h1 { font-size: 1.4rem; }
    header.hero .sub { font-size: .92rem; }
    .facts { gap: 7px; }
    .fact { font-size: .77rem; padding: 5px 10px; }
    .section { margin-top: 20px; }
    .section h2 { font-size: 1.05rem; }
    #map { height: 300px; }
    .day { padding: 14px 15px; }
    .day-title { font-size: 1rem; }
    .day-badge { font-size: .8rem; }
    .stops li { padding-left: 24px; }
    table { font-size: .84rem; }
    th, td { padding: 7px 8px; }
    .routes-table { min-width: 600px; }   /* keep columns legible; scroll within .scrollx */
    .booking-panel { padding: 16px 14px; }
    .booking-panel-head { align-items: flex-start; flex-direction: column; gap: 8px; }
    .booking-tab { gap: 5px; padding: 9px 6px; font-size: .8rem; }
    .booking-timeline::before { left: 77px; }
    .booking-timeline-row { grid-template-columns: 60px 18px minmax(0, 1fr); gap: 8px; }
    .theme-toggle { position: static; margin: 14px 0 0; }
  }

  @media print {
    :root, html[data-theme="light"] {
      color-scheme: light;
      --bg: #fff; --card: #fff; --card-2: #f5f5f3;
      --ink: #1f1f1e; --muted: #5f5f5b; --line: rgba(31,31,30,.18);
      --accent: #4a4947; --on-accent: #fff; --accent-soft: #f7f2d0;
      --ok: #387052; --warn: #7a5b14; --danger: #a33a34; --shadow: none;
    }
    body { background: #fff; color: #1f1f1e; }
    #map { height: 320px; }
    .card, header.hero { box-shadow: none; }
    .booking-tabs { display: none; }
    .booking-panel, .booking-panel[hidden] { display: block !important; break-inside: avoid; }
    .booking-panel + .booking-panel { border-top: 1px solid var(--line); }
    .day { break-inside: avoid; }
  }
</style>
</head>
<body>
<div class="wrap" id="app">
  <header class="hero" id="hero"></header>
  <div id="routes"></div>
  <div id="bookingTabs"></div>
  <div id="crossborder"></div>
  <div class="section">
    <h2>🗺️ Route map</h2>
    <div id="map"></div>
    <div id="map-fallback" class="map-fallback" style="display:none">
      Map could not load (offline?). Stop coordinates are listed in each day below.
    </div>
  </div>
  <div id="evplan"></div>
  <div class="section">
    <h2>📅 Day by day</h2>
    <div id="days"></div>
  </div>
  <div class="section">
    <div id="budget"></div>
  </div>
  <div id="tips" class="section"></div>
  <div id="share" class="section"></div>
  <div id="disclaimer"></div>
  <div class="footer-meta" id="footer-meta"></div>
</div>

<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
  integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script>
// ---- Trip data is injected here by generate.py ----
var TRIP_DATA = {
  "title": "Seattle → Vancouver & Whistler · 4 Days (EV, cross-border)",
  "subtitle": "Seattle → Vancouver, BC → Whistler → back · electric, two border crossings",
  "dateRange": "2026-05-15 ~ 2026-05-18",
  "travelers": "2 adults",
  "vehicle": {
    "type": "EV",
    "model": "EV (~280 mi range)",
    "mpg": null,
    "rangeMiles": 280
  },
  "loopType": "loop",
  "totalMiles": 450,
  "drivingDays": 4,
  "region": "forest",
  "units": {
    "distance": "mi",
    "temp": "F",
    "currency": "USD"
  },
  "routeOptions": [
    {
      "name": "Sea-to-Sky loop (I-5 + Hwy 99)",
      "miles": 450,
      "days": 4,
      "highlights": "Vancouver, Sea-to-Sky, Whistler",
      "bestSeason": "year-round (Hwy 99 plowed)",
      "estCost": 1680,
      "pros": "open all year, fully EV-charged corridor",
      "cons": "two border crossings",
      "chosen": true,
      "driveIntensity": "relaxed (~2.0h/day)"
    },
    {
      "name": "+ North Cascades Hwy (SR-20) return",
      "miles": 620,
      "days": 5,
      "highlights": "adds alpine SR-20 scenery",
      "bestSeason": "Jun–Oct ONLY",
      "estCost": 2100,
      "pros": "spectacular mountain pass",
      "cons": "SR-20 CLOSED in winter; sparse EV charging",
      "driveIntensity": "relaxed (~2.3h/day)"
    }
  ],
  "crossBorder": {
    "crossings": [
      {
        "source": "rules",
        "from": "US",
        "to": "CA",
        "docs": [
          "Valid passport (or NEXUS / enhanced driver's license at land crossings)",
          "Birth certificate + photo ID for minors; consent letter if a child travels without both parents"
        ],
        "vehicleDocs": [
          "Vehicle registration",
          "Driver's license",
          "Rental agreement that EXPLICITLY permits crossing into Canada (many US rentals require a cross-border authorization letter)"
        ],
        "insuranceNote": "US auto insurance is generally valid in Canada — carry a Canadian Non-Resident Inter-Province Motor Vehicle Liability Insurance Card (ask your insurer) as proof. Confirm coverage before you go.",
        "customsNotes": [
          "Declare all food, alcohol, tobacco, and cash > CAD $10,000",
          "Cannabis is illegal to carry across the border in EITHER direction",
          "Firearms must be declared and most handguns are prohibited",
          "Radar detectors are illegal in several provinces"
        ],
        "unitsAfter": {
          "distance": "km",
          "temp": "C",
          "currency": "CAD",
          "fuel": "litre"
        },
        "waitTimes": "CBSA Border Wait Times (cbsa-asfc.gc.ca)",
        "estWaitNote": "Border waits swing from minutes to 2+ hours by port/time of day — check live before you go and avoid weekend/holiday peaks.",
        "disclaimer": "Entry rules change frequently — confirm with CBP / CBSA / Mexican customs (Banjercito) before travel."
      },
      {
        "source": "rules",
        "from": "CA",
        "to": "US",
        "docs": [
          "Valid passport / passport card / NEXUS / enhanced ID (WHTI-compliant)",
          "Visa or ESTA if applicable to your nationality"
        ],
        "vehicleDocs": [
          "Vehicle registration",
          "Driver's license",
          "Proof of insurance",
          "Rental agreement permitting US entry"
        ],
        "insuranceNote": "Carry proof of US-valid auto insurance. If entering from Mexico, your Mexican policy will not cover you in the US.",
        "customsNotes": [
          "Declare all agricultural products, food, and cash > USD $10,000",
          "Cannabis remains federally illegal to bring into the US",
          "Have your CBP declaration ready; consider Global Entry to speed re-entry"
        ],
        "unitsAfter": {
          "distance": "mi",
          "temp": "F",
          "currency": "USD",
          "fuel": "gallon"
        },
        "waitTimes": "CBP Border Wait Times (bwt.cbp.gov) / CBP One app",
        "estWaitNote": "Border waits swing from minutes to 2+ hours by port/time of day — check live before you go and avoid weekend/holiday peaks.",
        "disclaimer": "Entry rules change frequently — confirm with CBP / CBSA / Mexican customs (Banjercito) before travel."
      }
    ],
    "summary": "US→CA · CA→US"
  },
  "evPlan": {
    "source": "model",
    "usableRange": 280,
    "effectiveRange": 280.0,
    "winterDerate": 0.0,
    "assumptions": {
      "startSoC": 90,
      "minSoC": 10,
      "bufferSoC": 10,
      "maxChargeSoC": 90
    },
    "legs": [
      {
        "to": "Bellingham, WA",
        "miles": 90.0,
        "departSoC": 90,
        "arriveSoC": 58,
        "ok": true,
        "charger": true,
        "chargerKW": 350
      },
      {
        "to": "Vancouver, BC",
        "miles": 55.0,
        "departSoC": 58,
        "arriveSoC": 38,
        "ok": true,
        "charger": true,
        "chargerKW": 100,
        "chargeTo": 49,
        "chargeNote": "charge to ~49% (100kW) before the next leg"
      },
      {
        "to": "Whistler, BC",
        "miles": 80.0,
        "departSoC": 49,
        "arriveSoC": 20,
        "ok": true,
        "charger": true,
        "chargerKW": 50,
        "chargeTo": 34,
        "chargeNote": "charge to ~34% (50kW) before the next leg"
      },
      {
        "to": "Squamish, BC",
        "miles": 40.0,
        "departSoC": 34,
        "arriveSoC": 20,
        "ok": true,
        "charger": true,
        "chargerKW": 100,
        "chargeTo": 54,
        "chargeNote": "charge to ~54% (100kW) before the next leg"
      },
      {
        "to": "Bellingham, WA",
        "miles": 95.0,
        "departSoC": 54,
        "arriveSoC": 20,
        "ok": true,
        "charger": true,
        "chargerKW": 150,
        "chargeTo": 52,
        "chargeNote": "charge to ~52% (150kW) before the next leg"
      },
      {
        "to": "Seattle, WA",
        "miles": 90.0,
        "departSoC": 52,
        "arriveSoC": 20,
        "ok": true,
        "charger": false,
        "chargerKW": null
      }
    ],
    "warnings": [],
    "note": "Linear range model for planning only — verify with ABRP / the car's planner.",
    "model": "EV · ~280 mi range"
  },
  "days": [
    {
      "date": "05/15",
      "title": "Seattle → Vancouver, BC (cross border)",
      "from": "Seattle, WA",
      "to": "Vancouver, BC",
      "driveMiles": 145,
      "driveTime": "3h00m",
      "overnight": "Vancouver, BC",
      "timezoneNote": "Same timezone (PT); units switch to km/°C/CAD in Canada",
      "weather": {
        "icon": "rain",
        "high": 61,
        "low": 48
      },
      "stops": [
        {
          "name": "Seattle (start)",
          "type": "city",
          "lat": 47.6062,
          "lng": -122.3321,
          "note": "Charge to ~90% before leaving; fuel/charge cheaper on the US side."
        },
        {
          "name": "Bellingham, WA (charge + lunch)",
          "type": "city",
          "lat": 48.7519,
          "lng": -122.4787,
          "note": "Last US charge stop; Fairhaven district for lunch."
        },
        {
          "name": "Peace Arch / Blaine border",
          "type": "scenic",
          "lat": 49.0027,
          "lng": -122.757,
          "timedEntry": false,
          "ticket": "passport required",
          "admission": {
            "status": "free",
            "label": "No attraction admission; valid travel documents required"
          },
          "note": "Busiest BC crossing — check live wait; Nexus lane if eligible."
        },
        {
          "name": "Vancouver, BC",
          "type": "city",
          "lat": 49.2827,
          "lng": -123.1207,
          "note": "Check in; walk the seawall / Gastown."
        }
      ],
      "fuelCharging": [
        {
          "name": "Charge @ Bellingham (Electrify America)",
          "type": "charge",
          "lat": 48.7519,
          "lng": -122.4787,
          "powerKW": 350,
          "note": "top up before the border; chargers are pricier/scarcer in the city core."
        }
      ],
      "meal": {
        "name": "Lunch in Fairhaven, Bellingham",
        "perPerson": 24
      },
      "risks": [
        "Peace Arch backups can exceed an hour on weekends/holidays — cross mid-morning weekday if you can.",
        "Carry the rental's cross-border authorization letter; without it you can be turned back."
      ]
    },
    {
      "date": "05/16",
      "title": "Vancouver city day",
      "from": "Vancouver, BC",
      "to": "Vancouver, BC",
      "driveMiles": 20,
      "driveTime": "0h50m",
      "overnight": "Vancouver, BC",
      "weather": {
        "icon": "partly-cloudy",
        "high": 64,
        "low": 50
      },
      "stops": [
        {
          "name": "Stanley Park",
          "type": "scenic",
          "lat": 49.3019,
          "lng": -123.1417,
          "admission": {
            "status": "free"
          },
          "note": "Seawall loop by bike or car; totem poles."
        },
        {
          "name": "Granville Island",
          "type": "food",
          "lat": 49.271,
          "lng": -123.134,
          "note": "Public market; lunch + local makers."
        },
        {
          "name": "Capilano Suspension Bridge",
          "type": "scenic",
          "lat": 49.3429,
          "lng": -123.1149,
          "ticket": "timed ticket",
          "admission": {
            "status": "paid",
            "label": "Timed admission ticket"
          },
          "note": "Buy timed tickets online to skip the line."
        }
      ],
      "fuelCharging": [],
      "meal": {
        "name": "Granville Island Public Market",
        "perPerson": 26
      },
      "risks": [
        "Downtown Vancouver parking is expensive — transit/walk the core; some hotels charge nightly for charging."
      ]
    },
    {
      "date": "05/17",
      "title": "Vancouver → Whistler (Sea-to-Sky Hwy 99)",
      "from": "Vancouver, BC",
      "to": "Whistler, BC",
      "driveMiles": 80,
      "driveTime": "2h00m",
      "overnight": "Whistler, BC",
      "weather": {
        "icon": "partly-cloudy",
        "high": 59,
        "low": 42
      },
      "stops": [
        {
          "name": "Shannon Falls / Sea to Sky Gondola, Squamish",
          "type": "scenic",
          "lat": 49.6766,
          "lng": -123.1556,
          "ticket": "gondola ticket",
          "admission": {
            "status": "paid",
            "label": "Gondola ticket; falls visit is free"
          },
          "note": "Stretch + huge falls; gondola for the view."
        },
        {
          "name": "Whistler Village",
          "type": "city",
          "lat": 50.1163,
          "lng": -122.9574,
          "note": "Walk the village; off-season rates are far lower than winter."
        }
      ],
      "fuelCharging": [
        {
          "name": "Charge @ Squamish",
          "type": "charge",
          "lat": 49.7016,
          "lng": -123.1558,
          "powerKW": 100,
          "note": "good mid-point charge on Hwy 99."
        }
      ],
      "meal": {
        "name": "Dinner in Whistler Village",
        "perPerson": 40
      },
      "risks": [
        "Sea-to-Sky is stunning but winding with rockslide zones — drive it in daylight.",
        "Fewer fast chargers north of Squamish — arrive in Whistler with margin."
      ]
    },
    {
      "date": "05/18",
      "title": "Whistler → Seattle (return, cross border)",
      "from": "Whistler, BC",
      "to": "Seattle, WA",
      "driveMiles": 230,
      "driveTime": "4h30m",
      "overnight": null,
      "timezoneNote": "Units switch back to mi/°F/USD after re-entering the US",
      "weather": {
        "icon": "rain",
        "high": 60,
        "low": 47
      },
      "stops": [
        {
          "name": "Squamish (charge)",
          "type": "city",
          "lat": 49.7016,
          "lng": -123.1558,
          "note": "Charge before the long run south."
        },
        {
          "name": "Peace Arch / Blaine border (southbound)",
          "type": "scenic",
          "lat": 49.0027,
          "lng": -122.757,
          "ticket": "passport required",
          "admission": {
            "status": "free",
            "label": "No attraction admission; valid travel documents required"
          },
          "note": "Declare goods; US re-entry, have CBP declaration ready."
        },
        {
          "name": "Seattle (end)",
          "type": "city",
          "lat": 47.6062,
          "lng": -122.3321,
          "note": "Charge near home/return rental."
        }
      ],
      "fuelCharging": [
        {
          "name": "Charge @ Bellingham (US side)",
          "type": "charge",
          "lat": 48.7519,
          "lng": -122.4787,
          "powerKW": 150,
          "note": "final top-up after the border."
        }
      ],
      "meal": {
        "name": "Lunch en route (Bellingham)",
        "perPerson": 22
      },
      "risks": [
        "Longest drive of the trip + a border crossing — leave Whistler by late morning to beat afternoon border and I-5 traffic."
      ]
    }
  ],
  "lodging": [
    {
      "name": "Downtown Vancouver hotel",
      "area": "Vancouver, BC",
      "nights": 2,
      "pricePerNight": 260,
      "rating": "4.4",
      "booked": false
    },
    {
      "name": "Whistler Village (off-season)",
      "area": "Whistler, BC",
      "nights": 1,
      "pricePerNight": 230,
      "rating": "4.5",
      "booked": false
    }
  ],
  "bookingCountdown": [
    {
      "item": "Mexican/Canadian insurance — N/A; confirm US policy covers Canada",
      "bookBy": "2026-05-08",
      "where": "Your auto insurer",
      "category": "attraction",
      "priority": "high",
      "note": "Get the Canadian Non-Resident insurance card before departure."
    },
    {
      "item": "Rental cross-border authorization letter",
      "bookBy": "2026-05-08",
      "where": "Rental company",
      "category": "attraction",
      "priority": "high",
      "note": "Must explicitly permit driving into Canada."
    },
    {
      "item": "Vancouver + Whistler lodging",
      "bookBy": "2026-03-15",
      "where": "Booking / hotel direct",
      "category": "hotel",
      "price": {
        "amount": 250,
        "currency": "USD",
        "unit": "night",
        "reliability": "estimate"
      },
      "priority": "medium",
      "note": "Whistler is cheap off-season but books up on weekends."
    },
    {
      "item": "Capilano Suspension Bridge timed ticket",
      "bookBy": "2026-05-14",
      "where": "capbridge.com",
      "category": "attraction",
      "priority": "low",
      "note": "Reserve a time slot online."
    }
  ],
  "budget": {
    "currency": "USD",
    "items": [
      {
        "label": "EV charging (~450 mi public DC, est.)",
        "amount": 55,
        "reliability": "estimate"
      },
      {
        "label": "Lodging (3 nights: Vancouver ×2, Whistler ×1)",
        "amount": 750,
        "reliability": "reference"
      },
      {
        "label": "Food (4 days, 2 adults)",
        "amount": 420,
        "reliability": "estimate"
      },
      {
        "label": "Attractions (Capilano, gondola, parking)",
        "amount": 160,
        "reliability": "reference"
      },
      {
        "label": "Mexican/Canadian auto insurance rider",
        "amount": 0,
        "reliability": "verified"
      },
      {
        "label": "Misc (tolls/parking/border)",
        "amount": 80,
        "reliability": "estimate"
      }
    ],
    "total": 1465,
    "perPerson": 732
  },
  "tips": [
    "US auto insurance is usually valid in Canada — but carry the Canadian Non-Resident Inter-Province insurance card as proof. (Mexico is the opposite: US insurance is NOT valid there.)",
    "Cannabis cannot cross the border in either direction, even between two places where it's legal.",
    "In Canada everything is km/°C/CAD and fuel/charging is sold per litre/kWh — the page flags the switch on the relevant days.",
    "EV range drops ~20–25% in winter; this May plan keeps a 10% buffer per leg, but re-run the corridor with a winter derate if you go in the cold.",
    "Sea-to-Sky (Hwy 99) is plowed year-round, but the scenic North Cascades Hwy (SR-20) alternative is CLOSED in winter — see the route comparison."
  ],
  "disclaimer": "AI-assembled from general knowledge; border rules, EV charger availability, prices, and road conditions change fast. Confirm with CBP/CBSA, your insurer, PlugShare/ABRP, and your nav app before and during the trip.",
  "generationDate": "2026-06-16"
};
// ---------------------------------------------------

(function () {
  "use strict";
  var T = TRIP_DATA || {};
  var U = (T.units || {});
  var distUnit = U.distance || "mi";
  var tempUnit = U.temp || "F";
  var cur = (T.budget && T.budget.currency) || U.currency || "USD";
  var curSym = ({ USD: "$", CAD: "C$", MXN: "MX$", CNY: "¥", RMB: "¥" })[cur] || "$";

  function esc(s) {
    if (s === null || s === undefined) return "";
    return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;")
      .replace(/>/g, "&gt;").replace(/"/g, "&quot;");
  }
  function el(id) { return document.getElementById(id); }
  function money(n) { return curSym + Number(n || 0).toLocaleString("en-US"); }
  function isZh() { return T.lang === "zh"; }
  var theme = document.documentElement.getAttribute("data-theme") === "light" ? "light" : "dark";

  function applyTheme(next, persist) {
    theme = next === "light" ? "light" : "dark";
    document.documentElement.setAttribute("data-theme", theme);
    document.documentElement.style.colorScheme = theme;
    var meta = el("themeColor");
    if (meta) meta.setAttribute("content", theme === "light" ? "#eeedea" : "#12171d");
    if (persist) { try { localStorage.setItem("rtn_theme", theme); } catch (e) {} }
    var button = el("themeToggle");
    if (button) {
      var toLight = theme === "dark";
      button.textContent = (toLight ? "☀ " : "☾ ") +
        (isZh() ? (toLight ? "日间" : "夜间") : (toLight ? "Day" : "Night"));
      button.setAttribute("aria-label", isZh()
        ? (toLight ? "切换到日间模式" : "切换到夜间模式")
        : (toLight ? "Switch to day mode" : "Switch to night mode"));
    }
  }

  var WEATHER_ICONS = {
    "sunny": "☀️", "partly-cloudy": "⛅", "cloudy": "☁️",
    "rain": "🌧️", "snow": "❄️", "storm": "⛈️", "windy": "💨", "fog": "🌫️"
  };
  var STOP_ICONS = {
    park: "🏞️", hike: "🥾", scenic: "📸", city: "🏙️",
    tour: "🎫", food: "🍽️", lodging: "🛏️", default: "📍"
  };

  document.documentElement.setAttribute("data-region", T.region || "desert");

  // ---------- Header ----------
  function renderHero() {
    var f = [];
    if (T.dateRange) f.push(fact("📆", T.dateRange));
    if (T.travelers) f.push(fact("👥", T.travelers));
    if (T.vehicle) f.push(fact(vehIcon(T.vehicle.type), vehLabel(T.vehicle)));
    if (T.totalMiles) f.push(fact("🛣️", T.totalMiles.toLocaleString("en-US") + " " + distUnit));
    if (T.drivingDays) f.push(fact("📍", T.drivingDays + " days"));
    if (T.loopType) f.push(fact("🔁", T.loopType === "loop" ? "Loop" : "One-way"));
    var h = '<button class="theme-toggle" id="themeToggle" type="button"></button>' +
      "<h1>" + esc(T.title || "Road Trip") + "</h1>";
    if (T.subtitle) h += '<div class="sub">' + esc(T.subtitle) + "</div>";
    h += '<div class="facts">' + f.join("") + "</div>";
    el("hero").innerHTML = h;
    el("themeToggle").addEventListener("click", function () {
      applyTheme(theme === "dark" ? "light" : "dark", true);
    });
    applyTheme(theme, false);
  }
  function fact(icon, text) { return '<span class="fact">' + icon + " " + esc(text) + "</span>"; }
  function vehIcon(t) { return t === "EV" ? "🔌" : (t === "RV" ? "🚐" : "🚗"); }
  function vehLabel(v) {
    var parts = [v.model || v.type || "Vehicle"];
    if (v.type === "EV" && v.rangeMiles) parts.push("~" + v.rangeMiles + distUnit + " range");
    if (v.type === "gas" && v.mpg) parts.push(v.mpg + " MPG");
    return parts.join(" · ");
  }

  // ---------- Route comparison (multi-route) ----------
  function renderRoutes() {
    var opts = T.routeOptions || [];
    if (opts.length < 2) { el("routes").innerHTML = ""; return; }
    var rows = opts.map(function (o) {
      var intl = (o.driveIntensity || "").split(" ")[0];
      var cls = "intensity-" + (["relaxed", "moderate", "intense"].indexOf(intl) >= 0 ? intl : "moderate");
      var name = esc(o.name) + (o.chosen ? '<span class="chosen-badge">✓ chosen</span>' : "");
      return '<tr class="' + (o.chosen ? "chosen" : "") + '">' +
        '<td class="' + (o.chosen ? "chosen-cell" : "") + '">' + name + "</td>" +
        "<td class='num'>" + (o.miles != null ? o.miles + " " + distUnit : "—") + "</td>" +
        "<td class='num'>" + (o.days != null ? o.days + "d" : "—") + "</td>" +
        '<td class="' + cls + '">' + esc(o.driveIntensity || "—") + "</td>" +
        "<td>" + esc(o.highlights || "") + "</td>" +
        "<td>" + esc(o.bestSeason || "") + "</td>" +
        "<td class='num'>" + (o.estCost != null ? money(o.estCost) : "—") + "</td>" +
        "</tr>";
    }).join("");
    var pc = opts.map(function (o) {
      if (!o.pros && !o.cons) return "";
      return "<div class='stop-note'><b>" + esc(o.name) + ":</b> " +
        (o.pros ? "👍 " + esc(o.pros) : "") + (o.cons ? " &nbsp; 👎 " + esc(o.cons) : "") + "</div>";
    }).join("");
    el("routes").innerHTML =
      '<div class="section"><h2>🧭 Route options compared</h2>' +
      '<div class="card" style="padding:6px 10px"><div class="scrollx"><table class="routes-table"><thead><tr>' +
      "<th>Route</th><th class='num'>Miles</th><th class='num'>Days</th><th>Driving</th>" +
      "<th>Highlights</th><th>Best season</th><th class='num'>Est. cost</th>" +
      "</tr></thead><tbody>" + rows + "</tbody></table></div></div>" +
      (pc ? "<div style='margin-top:8px'>" + pc + "</div>" : "") + "</div>";
  }

  // ---------- Cross-border ----------
  function renderCrossBorder() {
    var cb = T.crossBorder;
    if (!cb || !cb.crossings || !cb.crossings.length) { el("crossborder").innerHTML = ""; return; }
    var blocks = cb.crossings.map(function (c) {
      if (c.source === "error") return "";
      var s = '<div class="border-crossing">';
      s += '<div class="border-route">🛂 ' + esc(c.from) + " → " + esc(c.to) + "</div>";
      var crit = /not valid|critical/i.test(c.insuranceNote || "");
      if (c.insuranceNote) {
        s += '<div class="border-insurance' + (crit ? " critical" : "") + '">🛡️ ' +
          esc(c.insuranceNote) + "</div>";
      }
      s += '<div class="border-grid">';
      s += borderList("📄 Documents", c.docs);
      s += borderList("🚗 Vehicle", c.vehicleDocs);
      s += borderList("📦 Customs", c.customsNotes);
      s += "</div>";
      if (c.unitsAfter) {
        s += '<div class="units-after">↔️ After crossing, switch to ' +
          esc(c.unitsAfter.distance) + " / °" + esc(c.unitsAfter.temp) + " / " +
          esc(c.unitsAfter.currency) + " (fuel by the " + esc(c.unitsAfter.fuel) + ")</div>";
      }
      if (c.waitTimes) {
        s += "<div class='stop-note'>⏱️ Live wait times: " + esc(c.waitTimes) +
          (c.estWaitNote ? " — " + esc(c.estWaitNote) : "") + "</div>";
      }
      return s + "</div>";
    }).join("");
    var df = cb.dutyFree, dfHtml = "";
    if (df && df.note) {
      var zh = T.lang === "zh";
      var conds = (zh ? df.conditionsZh : df.conditions) || [];
      dfHtml = '<div class="border-crossing"><div class="border-route">🛍️ ' +
        (zh ? "免税额度" : "Duty-free exemption") + "</div>" +
        "<div class='stop-note'>" + esc(zh ? (df.noteZh || df.note) : df.note) +
        (conds.length ? "<br>• " + conds.map(esc).join("<br>• ") : "") +
        (df.verify ? "<br>" + (zh ? "核实:" : "Verify: ") + esc(df.verify) : "") +
        "</div></div>";
    }
    el("crossborder").innerHTML =
      '<div class="section"><h2>🛂 Border crossing</h2>' +
      '<div class="card border-card">' + blocks + dfHtml +
      "<div class='stop-note' style='margin-top:8px'>⚠️ Entry rules change — confirm with " +
      "CBP / CBSA / Mexican customs before you travel.</div></div></div>";
  }
  function borderList(title, items) {
    if (!items || !items.length) return "";
    return "<div class='border-block'><h4>" + esc(title) + "</h4><ul>" +
      items.map(function (x) { return "<li>" + esc(x) + "</li>"; }).join("") + "</ul></div>";
  }

  // ---------- EV charging corridor ----------
  function socClass(p) { return p == null ? "" : (p < 10 ? "bad" : (p < 20 ? "low" : "good")); }
  function renderEvPlan() {
    var ev = T.evPlan;
    if (!ev || !ev.legs || !ev.legs.length) { el("evplan").innerHTML = ""; return; }
    var zh = T.lang === "zh";
    var badCount = 0;
    var stayTo = null, stayNight = 0;   // consecutive same-destination overnight rows
    var rows = ev.legs.map(function (l) {
      var p = l.arriveSoC;
      var cls = socClass(p);
      var w = Math.max(0, Math.min(100, p == null ? 0 : p));
      // Negative SoC is a planning gap, not a physical state — show the
      // shortfall in miles instead of a negative percentage.
      var short = l.shortByMiles != null ? l.shortByMiles : (p != null && p < 0 ? Math.round(-p) : null);
      var socTxt;
      if (p == null) socTxt = "—";
      else if (p < 0) socTxt = zh ? ("到达 0%(缺 ~" + short + " " + distUnit + ")")
                                  : ("arrive 0% (short ~" + short + " " + distUnit + ")");
      else socTxt = (zh ? "到达 " : "arrive ") + p + "%";
      if (l.chargeTo != null) socTxt += (zh ? " → 充至 " : " → charge ") + l.chargeTo + "%";
      var bar = '<div class="soc-cell"><div class="soc-bar"><div class="soc-fill ' + cls +
        '" style="width:' + w + '%"></div></div><span class="soc-num">' + socTxt + "</span></div>";
      var note = "";
      if (!l.ok) {
        badCount++;
        var n = l.stopsNeeded || 1;
        var failTxt;
        if (p != null && p < 0) {
          failTxt = zh ? ("本段一次充电跑不完 — 建议中途充电约 " + n + " 次")
                       : ("Won't make it on one charge — add ~" + n +
                          " mid-leg charging stop" + (n > 1 ? "s" : ""));
        } else {
          failTxt = zh ? "到达电量低于 10% 缓冲 — 建议在本段提前补电"
                       : "Arrives below the 10% buffer — top up earlier on this stretch";
        }
        note = "<div class='charge-note' style='color:var(--danger)'>⚠️ " + failTxt + "</div>";
      }
      if (l.chargeTo != null) {
        var kwTxt = l.chargerKW ? (zh ? "(" + l.chargerKW + "kW)" : " (" + l.chargerKW + "kW)") : "";
        note += "<div class='charge-note'>🔌 " +
          (l.midLeg
            ? (zh ? ("此站充电至 ~" + l.chargeTo + "%" + kwTxt + " 再出发")
                  : ("charge to ~" + l.chargeTo + "%" + kwTxt + " before the next leg"))
            : (zh ? ("过夜充电至 ~" + l.chargeTo + "%" + kwTxt)
                  : ("charge overnight to ~" + l.chargeTo + "%" + kwTxt))) +
          "</div>";
      } else if (l.chargeNote) {
        note += "<div class='charge-note' style='color:var(--danger)'>🔌 " +
          (zh ? ("此站没有充电桩,但下一段需要 ~" +
                 (l.chargeTargetPct != null ? l.chargeTargetPct + "%" : "补电") + " — 请在附近找桩")
              : esc(l.chargeNote)) + "</div>";
      }
      var name = esc(l.to) + (l.ok ? "" : " ❗");
      if (l.midLeg) {
        name = "⚡ " + name +
          ' <span class="ev-midtag">' + (zh ? "中途充电" : "mid-leg charge") + "</span>";
      } else {
        // A multi-night stay repeats the same overnight destination on several
        // rows; number them so they don't read as duplicate cities.
        if (l.to === stayTo) { stayNight++; } else { stayTo = l.to; stayNight = 1; }
        if (stayNight > 1) name += '<span class="ev-stay">' +
          (zh ? " · 第" + stayNight + "晚" : " · night " + stayNight) + "</span>";
      }
      return "<tr" + (l.midLeg ? " class='ev-mid'" : "") + "><td>" + name + "</td>" +
        "<td class='num'>" + (l.miles != null ? l.miles + " " + distUnit : "—") + "</td>" +
        "<td>" + bar + note + "</td></tr>";
    }).join("");
    var warns = badCount
      ? '<div class="ev-warn"><b>⚠️ ' +
        (zh ? ("有 " + badCount + " 段一次充电跑不完 — 请为红色行安排中途充电。")
            : (badCount + " leg" + (badCount > 1 ? "s" : "") + " won't make it on one charge — " +
               "add mid-leg charging on the red rows.")) + "</b></div>"
      : "";
    var a = ev.assumptions || {};
    var assume = zh
      ? '<div class="ev-assume">假设:可用续航 ' + esc(ev.usableRange) + " " + distUnit +
        (ev.winterDerate ? ",冬季衰减 −" + Math.round(ev.winterDerate * 100) + "%(有效 " +
          esc(ev.effectiveRange) + " " + distUnit + ")" : "") +
        ",出发电量 " + esc(a.startSoC) + "%,全程保留 ≥ " + esc(a.minSoC) +
        "% 缓冲。线性估算仅供规划参考 — 请以车机 / ABRP 为准。</div>"
      : '<div class="ev-assume">Assumptions: usable range ' +
        esc(ev.usableRange) + distUnit +
        (ev.winterDerate ? ", winter derate −" + Math.round(ev.winterDerate * 100) + "% (eff. " +
          esc(ev.effectiveRange) + distUnit + ")" : "") +
        ", start " + esc(a.startSoC) + "%, keep ≥ " + esc(a.minSoC) + "% buffer. " +
        (ev.note || "") + "</div>";
    el("evplan").innerHTML =
      '<div class="section"><h2>⚡ ' + (zh ? "EV 充电走廊" : "EV charging corridor") + "</h2>" +
      '<div class="card ev-card"><table><thead><tr>' +
      (zh ? "<th>到达</th><th class='num'>里程</th><th>到达电量 → 充电安排</th>"
          : "<th>Arrive at</th><th class='num'>Leg</th><th>Battery on arrival → plan</th>") +
      "</tr></thead><tbody>" + rows + "</tbody></table></div>" + warns + assume + "</div>";
  }

  // ---------- Categorized booking deadlines ----------
  var BOOKING_CATEGORIES = [
    { id: "attraction", icon: "◇", en: "Attractions", singular: "attraction", zh: "景点" },
    { id: "restaurant", icon: "⌁", en: "Restaurants", singular: "restaurant", zh: "餐厅" },
    { id: "hotel", icon: "▣", en: "Hotels", singular: "hotel", zh: "酒店" }
  ];

  function bookingCategory(item) {
    var explicit = String(item.category || "").toLowerCase();
    if (["attraction", "restaurant", "hotel"].indexOf(explicit) >= 0) return explicit;
    var text = [item.item, item.where, item.note].join(" ").toLowerCase();
    if (/restaurant|dining|dinner|lunch|breakfast|cafe|bistro|meal|餐厅|餐馆|餐饮|晚餐|午餐|早餐|咖啡/.test(text)) {
      return "restaurant";
    }
    if (/hotel|lodg|motel|inn|resort|hostel|cabin|camp|airbnb|住宿|酒店|旅馆|民宿|营地|露营|山庄/.test(text)) {
      return "hotel";
    }
    return "attraction";
  }

  function bookingMatchTokens(value) {
    var stop = ["and", "area", "book", "booking", "cabin", "camp", "campsite", "canyon",
      "cafe", "city", "dining", "direct", "grand", "guided", "hotel", "hostel", "inn",
      "lodge", "lodging", "meal", "motel", "national", "park", "point", "reservation",
      "reserve", "resort", "restaurant", "room", "the", "tour"];
    return (String(value || "").toLowerCase().match(/[a-z0-9\u3400-\u9fff]{3,}/g) || [])
      .filter(function (token) { return stop.indexOf(token) < 0; });
  }

  function sharedBookingTokens(left, right) {
    var rightTokens = bookingMatchTokens(right);
    return bookingMatchTokens(left).filter(function (token, index, tokens) {
      return tokens.indexOf(token) === index && rightTokens.indexOf(token) >= 0;
    }).length;
  }

  function bookingDeadlineScore(item, deadline) {
    var deadlineText = [deadline.item, deadline.where, deadline.note].join(" ").toLowerCase();
    var name = String(item.item || item.name || "").toLowerCase();
    var context = String(item.matchContext || item.area || "").toLowerCase();
    var score = sharedBookingTokens(name, deadlineText) * 3 +
      sharedBookingTokens(context, deadlineText);
    if (name.length >= 4 && deadlineText.indexOf(name) >= 0) score += 10;
    if (context.length >= 4 && deadlineText.indexOf(context) >= 0) score += 8;
    return score;
  }

  function bookingDeadlineAssignments(items, deadlines) {
    var matches = {};
    var usedDeadlines = {};
    deadlines.forEach(function (deadline, deadlineIndex) {
      var bestItem = -1;
      var bestScore = 1;
      items.forEach(function (item, itemIndex) {
        if (matches[itemIndex]) return;
        var score = bookingDeadlineScore(item, deadline);
        if (score > bestScore) { bestScore = score; bestItem = itemIndex; }
      });
      if (bestItem >= 0) {
        matches[bestItem] = deadline;
        usedDeadlines[deadlineIndex] = true;
      }
    });
    return { matches: matches, usedDeadlines: usedDeadlines };
  }

  function bookingItemKey(value) {
    return String(value || "").toLowerCase().replace(/[^a-z0-9\u3400-\u9fff]+/g, " ").trim();
  }

  function appendVisitDate(item, date) {
    if (date && item.visitDates.indexOf(date) < 0) item.visitDates.push(date);
  }

  function hotelBookingItems(list) {
    var deadlines = list.filter(function (item) { return bookingCategory(item) === "hotel"; });
    var hotels = Array.isArray(T.lodging) ? T.lodging.filter(function (hotel) {
      return hotel && (hotel.name || hotel.area);
    }) : [];
    if (!hotels.length) return deadlines;

    var assignments = bookingDeadlineAssignments(hotels, deadlines);

    var merged = hotels.map(function (hotel, hotelIndex) {
      var deadline = assignments.matches[hotelIndex] || {};
      var price = deadline.price;
      if (typeof hotel.pricePerNight === "number" && isFinite(hotel.pricePerNight) &&
          hotel.pricePerNight >= 0) {
        price = {
          amount: hotel.pricePerNight,
          currency: price && price.currency ? price.currency : cur,
          unit: "night",
          reliability: price && price.reliability ? price.reliability : "reference"
        };
      }
      return {
        item: hotel.name || deadline.item || hotel.area,
        bookBy: deadline.bookBy || "",
        where: deadline.where || "",
        category: "hotel",
        price: price,
        priority: deadline.priority,
        note: deadline.note,
        stayArea: hotel.area || "",
        nights: hotel.nights,
        bookingRequired: true,
        booked: hotel.booked === true
      };
    });
    deadlines.forEach(function (deadline, deadlineIndex) {
      if (!assignments.usedDeadlines[deadlineIndex]) merged.push(deadline);
    });
    return merged;
  }

  function restaurantBookingItems(list) {
    var deadlines = list.filter(function (item) { return bookingCategory(item) === "restaurant"; });
    var meals = [];
    var mealsByName = {};
    (T.days || []).forEach(function (day) {
      var meal = day.meal;
      if (!meal || !meal.name) return;
      var key = bookingItemKey(meal.name);
      var item = mealsByName[key];
      if (!item) {
        item = {
          item: meal.name,
          category: "restaurant",
          visitDates: [],
          matchContext: day.title || ""
        };
        if (typeof meal.perPerson === "number" && isFinite(meal.perPerson) &&
            meal.perPerson >= 0) {
          item.price = {
            amount: meal.perPerson, currency: cur, unit: "person", reliability: "estimate"
          };
        }
        mealsByName[key] = item;
        meals.push(item);
      }
      appendVisitDate(item, day.date);
    });
    if (!meals.length) return deadlines;

    var assignments = bookingDeadlineAssignments(meals, deadlines);
    var merged = meals.map(function (meal, mealIndex) {
      var deadline = assignments.matches[mealIndex] || {};
      return {
        item: meal.item,
        bookBy: deadline.bookBy || "",
        where: deadline.where || "",
        category: "restaurant",
        price: deadline.price || meal.price,
        priority: deadline.priority,
        note: deadline.note,
        visitDates: meal.visitDates,
        bookingRequired: Boolean(deadline.bookBy)
      };
    });
    deadlines.forEach(function (deadline, deadlineIndex) {
      if (!assignments.usedDeadlines[deadlineIndex]) merged.push(deadline);
    });
    return merged;
  }

  function attractionBookingItems(list) {
    var deadlines = list.filter(function (item) { return bookingCategory(item) === "attraction"; });
    var excludedTypes = ["charge", "charging", "city", "food", "fuel", "gas", "hotel",
      "lodging", "restaurant"];
    var attractions = [];
    var attractionsByName = {};
    (T.days || []).forEach(function (day) {
      (day.stops || []).forEach(function (stop) {
        if (!stop || !stop.name || excludedTypes.indexOf(String(stop.type || "").toLowerCase()) >= 0) {
          return;
        }
        var key = bookingItemKey(stop.name);
        var item = attractionsByName[key];
        if (!item) {
          var admission = stop.admission && typeof stop.admission === "object"
            ? stop.admission : {};
          var admissionStatus = String(admission.status || "").toLowerCase();
          if (["free", "included", "paid", "unknown"].indexOf(admissionStatus) < 0) {
            var legacyTicket = String(stop.ticket || "").toLowerCase();
            admissionStatus = legacyTicket.indexOf("free") >= 0 ? "free" :
              (legacyTicket.indexOf("pass") >= 0 ? "included" :
                (/ticket|fee|guided tour/.test(legacyTicket) ? "paid" : "unknown"));
          }
          item = {
            item: stop.name,
            category: "attraction",
            visitDates: [],
            matchContext: [day.title, stop.type, stop.ticket, admission.label].join(" "),
            admissionStatus: admissionStatus,
            admissionLabel: admission.label || "",
            price: admission.price
          };
          attractionsByName[key] = item;
          attractions.push(item);
        }
        appendVisitDate(item, day.date);
      });
    });
    if (!attractions.length) return deadlines;

    var assignments = bookingDeadlineAssignments(attractions, deadlines);
    var merged = attractions.map(function (attraction, attractionIndex) {
      var deadline = assignments.matches[attractionIndex] || {};
      return {
        item: attraction.item,
        bookBy: deadline.bookBy || "",
        where: deadline.where || "",
        category: "attraction",
        price: deadline.price || attraction.price,
        admissionStatus: attraction.admissionStatus,
        admissionLabel: attraction.admissionLabel,
        priority: deadline.priority,
        note: deadline.note,
        visitDates: attraction.visitDates,
        bookingRequired: Boolean(deadline.bookBy)
      };
    });
    deadlines.forEach(function (deadline, deadlineIndex) {
      if (!assignments.usedDeadlines[deadlineIndex]) merged.push(deadline);
    });
    return merged;
  }

  function bookingDateParts(value, bookingRequired) {
    var match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(value || ""));
    if (!match) {
      var noAdvanceBooking = bookingRequired === false;
      return {
        short: esc(value || (noAdvanceBooking
          ? (isZh() ? "无需提前预约" : "No advance booking")
          : (isZh() ? "暂时不知道截止日期" : "Deadline unknown"))),
        year: "",
        iso: ""
      };
    }
    var months = isZh()
      ? ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
      : ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
    return {
      short: isZh() ? months[Number(match[2]) - 1] + Number(match[3]) + "日"
                    : months[Number(match[2]) - 1] + " " + Number(match[3]),
      year: match[1], iso: value
    };
  }

  function bookingPriceMarkup(item) {
    var price = item.price;
    if (typeof price === "number") price = { amount: price };
    if (!price || typeof price !== "object" || typeof price.amount !== "number" ||
        !isFinite(price.amount) || price.amount < 0) {
      if (item.category === "attraction") {
        if (item.admissionStatus === "free") {
          return '<span class="booking-price">' + (isZh() ? "免费" : "Free") + "</span>";
        }
        if (item.admissionStatus === "included") {
          return '<span class="booking-price">' +
            (isZh() ? "公园通票已包含" : "Included in park pass") + "</span>";
        }
        if (item.admissionStatus === "paid") {
          return '<span class="booking-price unknown">' +
            (isZh() ? "收费 · 价格暂不可用" : "Paid · price unavailable") + "</span>";
        }
      }
      return '<span class="booking-price unknown">' +
        (isZh() ? "价格暂不可用" : "Price unavailable") + "</span>";
    }
    if (price.amount === 0) {
      return '<span class="booking-price">' + (isZh() ? "免费" : "Free") + "</span>";
    }
    var code = String(price.currency || cur).toUpperCase();
    var symbols = { USD: "$", CAD: "C$", MXN: "MX$", CNY: "¥", RMB: "¥" };
    var symbol = symbols[code] || code + " ";
    var prefix = price.reliability === "estimate" ? "≈" :
      (price.reliability === "reference" ? "~" : "");
    var unit = String(price.unit || "total").toLowerCase();
    var units = isZh()
      ? { person: "/人", night: "/晚", vehicle: "/车", group: "/组", booking: "/次", total: "" }
      : { person: "/person", night: "/night", vehicle: "/vehicle", group: "/group",
          booking: "/booking", total: "" };
    return '<span class="booking-price">' + prefix + symbol +
      Number(price.amount).toLocaleString("en-US") + esc(units[unit] || ("/" + unit)) + "</span>";
  }

  function tripDateLabel(value) {
    var slash = /^(\d{1,2})\/(\d{1,2})$/.exec(String(value || ""));
    if (slash) {
      if (isZh()) return Number(slash[1]) + "月" + Number(slash[2]) + "日";
      var months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN",
        "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
      return months[Number(slash[1]) - 1] + " " + Number(slash[2]);
    }
    var iso = bookingDateParts(value);
    return iso.iso ? iso.short : String(value || "");
  }

  function bookingItemMetaMarkup(item) {
    var bits = [];
    if (item.visitDates && item.visitDates.length) {
      bits.push((isZh() ? "行程日期 " : "Trip date ") +
        item.visitDates.map(tripDateLabel).join(", "));
    }
    if (item.stayArea) bits.push(esc(item.stayArea));
    if (typeof item.nights === "number" && item.nights > 0) {
      bits.push(isZh() ? item.nights + " 晚" :
        item.nights + " night" + (item.nights === 1 ? "" : "s"));
    }
    return bits.length ? '<p class="booking-item-meta">' + bits.join(" · ") + "</p>" : "";
  }

  function bookingPanelTitle(category, items) {
    var count = items.length;
    if (category.id === "hotel") {
      var totalNights = items.reduce(function (sum, item) {
        return sum + (typeof item.nights === "number" && item.nights > 0 ? item.nights : 0);
      }, 0);
      if (totalNights) {
        return isZh()
          ? count + " 个住宿 · " + totalNights + " 晚"
          : count + " stay" + (count === 1 ? "" : "s") + " · " + totalNights +
            " night" + (totalNights === 1 ? "" : "s");
      }
    }
    if (isZh()) {
      if (category.id === "restaurant") return count + " 个用餐安排与预订截止日期";
      if (category.id === "hotel") return count + " 个住宿安排与预订截止日期";
      return count + " 个景点与预订截止日期";
    }
    var noun = category.id === "restaurant" ? "dining plan" :
      (category.id === "hotel" ? "stay" : "attraction");
    return count + " " + noun + (count === 1 ? "" : "s") + " and booking deadlines";
  }

  function bookingPanelMarkup(category, items, active) {
    var label = isZh() ? category.zh : category.en;
    var first = null;
    items.some(function (item) {
      var date = bookingDateParts(item.bookBy, item.bookingRequired);
      if (!date.iso) return false;
      first = date;
      return true;
    });
    var earliest = first
      ? (isZh() ? "最早截止 · " : "Earliest deadline · ") + first.short
      : (isZh() ? "暂无截止日期" : "No deadlines yet");
    var title = bookingPanelTitle(category, items);
    var rows = items.map(function (item) {
      var date = bookingDateParts(item.bookBy, item.bookingRequired);
      var source = item.where
        ? "<p>" + (isZh() ? "预订渠道:" : "via ") + esc(item.where) + "</p>" : "";
      var meta = bookingItemMetaMarkup(item);
      var note = item.note ? "<p>" + esc(item.note) + "</p>" : "";
      var price = bookingPriceMarkup(item);
      var priority = item.priority === "high" ? " pri-high" : "";
      var deadlineLabel = date.iso
        ? (isZh() ? "预订截止 " : "Book by ") + item.bookBy
        : (item.bookingRequired === false
          ? (isZh() ? "无需提前预约" : "No advance booking required")
          : (isZh() ? "暂时不知道截止日期" : "Booking deadline unknown"));
      return '<article class="booking-timeline-row">' +
        '<time class="booking-timeline-date" datetime="' + esc(date.iso) + '" aria-label="' +
          esc(deadlineLabel) + '"><strong>' +
          date.short + "</strong><span>" + date.year + "</span></time>" +
        '<span class="booking-timeline-dot' + priority + '" aria-hidden="true"></span>' +
        '<div class="booking-copy"><div class="booking-title-row"><h3>' + esc(item.item) +
        "</h3>" + price + "</div>" + meta + source + note + "</div></article>";
    }).join("");
    if (!rows) rows = '<p class="booking-empty">' +
      (isZh() ? "这个分类暂时没有项目。" : "Nothing in this category yet.") + "</p>";
    return '<section class="booking-panel" id="booking-panel-' + category.id +
      '" role="tabpanel" tabindex="0" aria-labelledby="booking-tab-' + category.id + '"' +
      (active ? "" : " hidden") + '><div class="booking-panel-head"><div>' +
      '<p class="booking-kicker">' + label + "</p>" +
      "<h2>" + title + '</h2></div><span class="booking-earliest">' + earliest + "</span></div>" +
      '<div class="booking-timeline">' + rows + "</div></section>";
  }

  function renderBookingTabs() {
    var list = T.bookingCountdown || [];
    var groups = { attraction: [], restaurant: [], hotel: [] };
    groups.attraction = attractionBookingItems(list);
    groups.restaurant = restaurantBookingItems(list);
    groups.hotel = hotelBookingItems(list);
    if (!groups.attraction.length && !groups.restaurant.length && !groups.hotel.length) {
      el("bookingTabs").innerHTML = "";
      return;
    }
    BOOKING_CATEGORIES.forEach(function (category) {
      groups[category.id].sort(function (a, b) {
        return String(a.bookBy || "9999").localeCompare(String(b.bookBy || "9999"));
      });
    });
    var tabs = BOOKING_CATEGORIES.map(function (category, index) {
      var label = isZh() ? category.zh : category.en;
      return '<button class="booking-tab" id="booking-tab-' + category.id +
        '" type="button" role="tab" aria-selected="' + (index === 0 ? "true" : "false") +
        '" aria-controls="booking-panel-' + category.id + '" tabindex="' + (index === 0 ? "0" : "-1") +
        '" data-booking-category="' + category.id + '"><span aria-hidden="true">' + category.icon +
        '</span><span>' + label + '</span><span class="booking-tab-count">' + groups[category.id].length +
        "</span></button>";
    }).join("");
    var panels = BOOKING_CATEGORIES.map(function (category, index) {
      return bookingPanelMarkup(category, groups[category.id], index === 0);
    }).join("");
    el("bookingTabs").innerHTML = '<div class="section"><div class="card booking-zone">' +
      '<nav class="booking-tabs" role="tablist" aria-label="' +
      (isZh() ? "预订分类" : "Booking categories") + '">' + tabs +
      '</nav><div class="booking-panels">' + panels + "</div></div></div>";

    var tabButtons = Array.prototype.slice.call(
      el("bookingTabs").querySelectorAll("[data-booking-category]"));
    function activate(button, focus) {
      tabButtons.forEach(function (candidate) {
        var selected = candidate === button;
        candidate.setAttribute("aria-selected", selected ? "true" : "false");
        candidate.setAttribute("tabindex", selected ? "0" : "-1");
        el(candidate.getAttribute("aria-controls")).hidden = !selected;
      });
      if (focus) button.focus();
    }
    tabButtons.forEach(function (button, index) {
      button.addEventListener("click", function () { activate(button, false); });
      button.addEventListener("keydown", function (event) {
        var next = null;
        if (event.key === "ArrowRight") next = (index + 1) % tabButtons.length;
        if (event.key === "ArrowLeft") next = (index - 1 + tabButtons.length) % tabButtons.length;
        if (event.key === "Home") next = 0;
        if (event.key === "End") next = tabButtons.length - 1;
        if (next !== null) { event.preventDefault(); activate(tabButtons[next], true); }
      });
    });
  }

  // ---------- Map ----------
  function navLinks(lat, lng, name) {
    var q = encodeURIComponent(name || (lat + "," + lng));
    var g = "https://www.google.com/maps/search/?api=1&query=" + lat + "," + lng;
    var a = "https://maps.apple.com/?q=" + q + "&ll=" + lat + "," + lng;
    return '<div class="popup-actions">' +
      '<a href="' + g + '" target="_blank" rel="noopener">Google Maps</a>' +
      '<a href="' + a + '" target="_blank" rel="noopener">Apple Maps</a></div>';
  }

  function collectStops() {
    var pts = [], n = 0;
    (T.days || []).forEach(function (d) {
      (d.stops || []).forEach(function (s) {
        if (typeof s.lat === "number" && typeof s.lng === "number" && (s.lat || s.lng)) {
          n++;
          pts.push({ n: n, lat: s.lat, lng: s.lng, name: s.name, type: s.type, date: d.date });
        }
      });
    });
    return pts;
  }

  function renderMap() {
    var pts = collectStops();
    if (typeof L === "undefined" || !pts.length) {
      el("map").style.display = "none";
      el("map-fallback").style.display = "block";
      return;
    }
    try {
      var map = L.map("map", { scrollWheelZoom: false });
      L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
        maxZoom: 18, attribution: "&copy; OpenStreetMap contributors"
      }).addTo(map);

      var latlngs = [];
      pts.forEach(function (p) {
        latlngs.push([p.lat, p.lng]);
        var icon = L.divIcon({
          className: "", html:
            '<div style="background:var(--accent);color:#fff;border-radius:50%;width:26px;height:26px;' +
            'display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;' +
            'box-shadow:0 1px 4px rgba(0,0,0,.4);border:2px solid #fff">' + p.n + "</div>",
          iconSize: [26, 26], iconAnchor: [13, 13]
        });
        var pop = "<b>" + esc(p.n + ". " + p.name) + "</b><br><span style='color:#6b6258'>Day " +
          esc(p.date) + "</span>" + navLinks(p.lat, p.lng, p.name);
        L.marker([p.lat, p.lng], { icon: icon }).addTo(map).bindPopup(pop);
      });
      L.polyline(latlngs, { color: getComputedStyle(document.documentElement)
        .getPropertyValue("--accent") || "#c2641a", weight: 3, opacity: .7, dashArray: "6 6" }).addTo(map);
      map.fitBounds(L.latLngBounds(latlngs).pad(0.15));
    } catch (e) {
      el("map").style.display = "none";
      el("map-fallback").style.display = "block";
    }
  }

  // ---------- Days ----------
  function renderDays() {
    var html = (T.days || []).map(function (d, i) { return dayCard(d, i + 1); }).join("");
    el("days").innerHTML = html;
  }
  function dayCard(d, idx) {
    var s = '<div class="card day">';
    s += '<div class="day-head"><span class="day-badge">Day ' + idx + " · " + esc(d.date) + "</span>";
    s += '<span class="day-title">' + esc(d.title) + "</span></div>";

    var meta = [];
    if (typeof d.driveMiles === "number") meta.push("<span>🚗 <b>" + d.driveMiles + " " + distUnit +
      "</b>" + (d.driveTime ? " · " + esc(d.driveTime) : "") + "</span>");
    if (d.overnight) meta.push("<span>🛏️ Overnight: <b>" + esc(d.overnight) + "</b></span>");
    if (d.weather) meta.push("<span>" + (WEATHER_ICONS[d.weather.icon] || "🌡️") + " " +
      esc(d.weather.high) + "°/" + esc(d.weather.low) + "°" + tempUnit + "</span>");
    if (d.timezoneNote) meta.push('<span class="tznote">🕒 ' + esc(d.timezoneNote) + "</span>");
    s += '<div class="day-meta">' + meta.join("") + "</div>";

    if (d.stops && d.stops.length) {
      s += '<ul class="stops">' + d.stops.map(stopRow).join("") + "</ul>";
    }
    if (d.fuelCharging && d.fuelCharging.length) {
      s += '<div class="fuel-row">' + d.fuelCharging.map(function (f) {
        var ico = f.type === "charge" ? "🔌" : "⛽";
        var pw = f.powerKW ? " (" + f.powerKW + "kW)" : "";
        return ico + " " + esc(f.name) + pw + (f.note ? " — " + esc(f.note) : "");
      }).join(" &nbsp;·&nbsp; ") + "</div>";
    }
    if (d.meal) {
      s += '<div class="meal-row">🍽️ ' + esc(d.meal.name) +
        (d.meal.perPerson ? " — ~" + money(d.meal.perPerson) + "/person" : "") + "</div>";
    }
    if (d.risks && d.risks.length) {
      s += '<div class="risks"><b>⚠️ Watch out:</b> ' +
        d.risks.map(esc).join("<br>⚠️ ") + "</div>";
    }
    s += "</div>";
    return s;
  }
  function stopRow(s) {
    var ico = STOP_ICONS[s.type] || STOP_ICONS.default;
    var r = "<li><span class='stop-name'>" + ico + " " + esc(s.name) + "</span>";
    if (s.timedEntry) r += '<span class="tag timed">timed entry</span>';
    if (s.ticket) r += '<span class="tag">' + esc(s.ticket) + "</span>";
    else if (s.type) r += '<span class="tag">' + esc(s.type) + "</span>";
    if (s.note) r += "<div class='stop-note'>" + esc(s.note) + "</div>";
    if (typeof s.lat === "number" && (s.lat || s.lng)) {
      r += navLinks(s.lat, s.lng, s.name);
    }
    return r + "</li>";
  }

  // ---------- Budget ----------
  function renderBudget() {
    var b = T.budget;
    if (!b || !b.items) { el("budget").innerHTML = ""; return; }
    var rows = b.items.map(function (it) {
      var rel = (it.reliability || "estimate").toLowerCase();
      var relLabel = ({ verified: "verified", reference: "~ reference", estimate: "≈ estimate" })[rel] || rel;
      return "<tr><td>" + esc(it.label) + ' <span class="rel ' + esc(rel) + '">' + relLabel + "</span></td>" +
        "<td class='num'>" + money(it.amount) + "</td></tr>";
    }).join("");
    var foot = "<tfoot><tr><td>Total</td><td class='num'>" + money(b.total) + "</td></tr>";
    if (b.perPerson) foot += "<tr><td>Per person</td><td class='num'>" + money(b.perPerson) + "</td></tr>";
    foot += "</tfoot>";
    el("budget").innerHTML =
      '<div><h2 style="font-size:1.15rem;margin:0 0 12px">💰 Budget estimate</h2>' +
      '<div class="card" style="padding:6px 10px"><table><tbody>' + rows + "</tbody>" + foot +
      "</table></div>" +
      "<div class='stop-note' style='margin-top:8px'>Legend: <span class='rel verified'>verified</span> " +
      "<span class='rel reference'>~ reference</span> <span class='rel estimate'>≈ estimate</span>. " +
      "Fuel/lodging are dynamic — confirm before departure.</div></div>";
  }

  // ---------- Tips ----------
  function renderTips() {
    var t = T.tips || [];
    if (!t.length) { el("tips").innerHTML = ""; return; }
    el("tips").innerHTML = "<h2>💡 Tips & local know-how</h2><div class='card' style='padding:14px 18px'>" +
      "<ul class='tips'>" + t.map(function (x) { return "<li>" + esc(x) + "</li>"; }).join("") + "</ul></div>";
  }

  // ---------- Share ----------
  function renderShare() {
    var label = isZh() ? "分享这份行程" : "Share this trip";
    el("share").innerHTML = '<button class="share-button" id="shareButton" type="button">↗ ' +
      label + '</button><div class="share-status" id="shareStatus" aria-live="polite"></div>';
    el("shareButton").addEventListener("click", function () {
      var data = { title: T.title || "Road Trip", url: window.location.href };
      if (navigator.share) { navigator.share(data).catch(function () {}); return; }
      if (navigator.clipboard && navigator.clipboard.writeText) {
        navigator.clipboard.writeText(data.url).then(function () {
          el("shareStatus").textContent = isZh() ? "链接已复制" : "Link copied";
        }).catch(function () {});
      }
    });
  }

  // ---------- Disclaimer ----------
  function renderDisclaimer() {
    var d = T.disclaimer || "Information assembled by AI; verify with official sources before travel.";
    el("disclaimer").innerHTML = '<div class="disclaimer">⚠️ ' + esc(d) + "</div>";
    el("footer-meta").innerHTML = "Generated " + esc(T.generationDate || "") +
      " · <a href='https://github.com/Waybox-AI/roadtrip-skill' rel='generator'>RoadTrip Navigator</a>" +
      " · map data © OpenStreetMap contributors";
  }

  // ---------- Boot ----------
  try {
    renderHero(); renderRoutes(); renderBookingTabs(); renderCrossBorder();
    renderDays(); renderEvPlan();
    renderBudget(); renderTips(); renderShare(); renderDisclaimer();
    renderMap();
  } catch (err) {
    el("app").insertAdjacentHTML("afterbegin",
      "<div class='disclaimer'>Render error: " + esc(err.message) + "</div>");
  }
})();
</script>
</body>
</html>
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall