<!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": "Sunnyvale → Lake Tahoe · 3 Days",
"subtitle": "Sunnyvale → South Lake Tahoe (US-50) → around the lake → back via Truckee & I-80",
"dateRange": "2026-10-16 ~ 2026-10-18",
"travelers": "2 adults",
"vehicle": {
"type": "gas",
"model": "Gas car",
"mpg": 30,
"rangeMiles": null
},
"loopType": "loop",
"totalMiles": 500,
"drivingDays": 3,
"region": "mountain",
"units": {
"distance": "mi",
"temp": "F",
"currency": "USD"
},
"days": [
{
"date": "10/16",
"title": "Sunnyvale → South Lake Tahoe (via US-50)",
"from": "Sunnyvale, CA",
"to": "South Lake Tahoe, CA",
"driveMiles": 235,
"driveTime": "3h50m",
"overnight": "South Lake Tahoe, CA",
"weather": {
"icon": "partly-cloudy",
"high": 60,
"low": 33
},
"stops": [
{
"name": "Sunnyvale (start)",
"type": "city",
"lat": 37.3688,
"lng": -122.0363,
"note": "Fuel up; Sacramento and Placerville have the last cheap gas before the climb."
},
{
"name": "Apple Hill, Placerville",
"type": "scenic",
"lat": 38.7296,
"lng": -120.7985,
"admission": {
"status": "free",
"label": "General area visit; purchases extra"
},
"note": "October = apple/harvest season; orchards, cider, pie. Weekends get crowded — go early."
},
{
"name": "Heavenly Village, South Lake Tahoe",
"type": "city",
"lat": 38.9399,
"lng": -119.9772,
"note": "Arrive, check in, walk the lakefront at Lakeview Commons."
}
],
"fuelCharging": [
{
"name": "Fuel @ Placerville, CA",
"type": "gas",
"lat": 38.7296,
"lng": -120.7985,
"note": "Last good-value fuel before US-50 climbs to Echo Summit (7,382 ft)."
}
],
"meal": {
"name": "Dinner in Heavenly Village",
"perPerson": 35
},
"risks": [
"US-50 climbs over Echo Summit (~7,400 ft). By mid-October an early snowstorm is possible — check Caltrans QuickMap and carry chains; R2 chain controls can appear on short notice.",
"Leave by ~9am to clear the Sacramento area before traffic and reach Apple Hill before the weekend crowd."
]
},
{
"date": "10/17",
"title": "Around the lake: Emerald Bay & East Shore",
"from": "South Lake Tahoe, CA",
"to": "South Lake Tahoe, CA",
"driveMiles": 75,
"driveTime": "2h00m",
"overnight": "South Lake Tahoe, CA",
"timezoneNote": "East shore (Sand Harbor) is in Nevada — same Pacific time, but you cross the state line",
"weather": {
"icon": "sunny",
"high": 62,
"low": 34
},
"stops": [
{
"name": "Emerald Bay / Vikingsholm",
"type": "scenic",
"lat": 38.9542,
"lng": -120.1095,
"admission": {
"status": "paid",
"label": "Day-use parking or optional castle tour"
},
"note": "Iconic overlook; steep 1-mi trail down to Vikingsholm castle if you want the legs workout."
},
{
"name": "Eagle Falls Trailhead",
"type": "hike",
"lat": 38.9519,
"lng": -120.1133,
"ticket": "day-use parking fee",
"admission": {
"status": "paid",
"label": "Day-use parking fee"
},
"note": "Short hike to the falls / Eagle Lake. Tiny lot — arrive before 9am or it's full."
},
{
"name": "Sand Harbor, NV (Lake Tahoe NV State Park)",
"type": "scenic",
"lat": 39.1986,
"lng": -119.9301,
"ticket": "NV state park day-use fee",
"admission": {
"status": "paid",
"label": "Nevada state park day-use fee"
},
"note": "Best swimming/boulders & clearest water. Parking lot closes when full (often mid-morning summer; easier in Oct)."
}
],
"fuelCharging": [],
"meal": {
"name": "Picnic at Sand Harbor or lunch in Tahoe City",
"perPerson": 22
},
"risks": [
"Emerald Bay's parking pullouts are small and fill fast on weekends — have a plan B viewpoint.",
"October water is cold and afternoons get windy; mornings are calmer for the lake."
]
},
{
"date": "10/18",
"title": "North Shore → Truckee → Sunnyvale (I-80)",
"from": "South Lake Tahoe, CA",
"to": "Sunnyvale, CA",
"driveMiles": 245,
"driveTime": "4h10m",
"overnight": null,
"weather": {
"icon": "partly-cloudy",
"high": 58,
"low": 31
},
"stops": [
{
"name": "Tahoe City",
"type": "city",
"lat": 39.1677,
"lng": -120.1435,
"note": "Coffee + the Truckee River outlet; quick stop before heading to I-80."
},
{
"name": "Donner Memorial State Park, Truckee",
"type": "scenic",
"lat": 39.3236,
"lng": -120.2336,
"ticket": "state park day-use fee",
"admission": {
"status": "paid",
"label": "California state park day-use fee"
},
"note": "Donner Lake, visitor center & the Pioneer Monument — history of Donner Pass."
},
{
"name": "Sunnyvale (end)",
"type": "city",
"lat": 37.3688,
"lng": -122.0363,
"note": "Refuel before returning home/rental."
}
],
"fuelCharging": [
{
"name": "Fuel @ Truckee, CA",
"type": "gas",
"lat": 39.328,
"lng": -120.1833,
"note": "Top up before the Donner Pass descent and the long I-80 run west."
}
],
"meal": {
"name": "Lunch in Truckee (historic downtown)",
"perPerson": 28
},
"risks": [
"Donner Pass (I-80, ~7,000 ft) is the Sierra's biggest snow magnet. A mid-October storm can trigger chain controls or brief closures — check Caltrans before leaving Tahoe and don't push into an active storm.",
"Sunday afternoon I-80 westbound from Tahoe is the classic Bay Area return jam. Leave Tahoe by late morning to beat it."
]
}
],
"lodging": [
{
"name": "South Lake Tahoe hotel / cabin",
"area": "South Lake Tahoe, CA",
"nights": 2,
"pricePerNight": 190,
"rating": "4.2",
"booked": false
}
],
"bookingCountdown": [
{
"item": "South Lake Tahoe lodging (weekend)",
"bookBy": "2026-09-16",
"where": "Booking / Airbnb / hotel direct",
"category": "hotel",
"price": {
"amount": 190,
"currency": "USD",
"unit": "night",
"reliability": "reference"
},
"priority": "high",
"note": "Tahoe weekends sell out and surge-price; lock a refundable rate early."
},
{
"item": "Vikingsholm castle tour (if wanted)",
"bookBy": "2026-10-01",
"where": "Sierra State Parks / vikingsholm.com",
"category": "attraction",
"priority": "low",
"note": "Seasonal tours often end by late Sept/Oct — confirm it's still running."
},
{
"item": "Campground (if camping instead): D.L. Bliss / Emerald Bay = ReserveCalifornia; Fallen Leaf = Recreation.gov",
"bookBy": "2026-04-16",
"where": "ReserveCalifornia.com (state) / Recreation.gov (USFS)",
"category": "hotel",
"priority": "medium",
"note": "California STATE parks use ReserveCalifornia, NOT Recreation.gov. Both release ~6 months out. Many Tahoe campgrounds close for the season by mid-Oct."
}
],
"budget": {
"currency": "USD",
"items": [
{
"label": "Fuel (~500 mi ÷ 30 MPG × $4.90/gal)",
"amount": 82,
"reliability": "estimate"
},
{
"label": "Lodging (2 nights, S. Lake Tahoe)",
"amount": 380,
"reliability": "reference"
},
{
"label": "State park day-use fees (Eagle Falls / Sand Harbor / Donner)",
"amount": 35,
"reliability": "reference"
},
{
"label": "Food (3 days, 2 adults)",
"amount": 300,
"reliability": "estimate"
},
{
"label": "Misc (parking, cider at Apple Hill, snacks)",
"amount": 60,
"reliability": "estimate"
}
],
"total": 857,
"perPerson": 429
},
"tips": [
"No national park here, so the $80 America the Beautiful pass is NOT needed — but Tahoe ringed by California + Nevada STATE parks (separate day-use fees). Carry a bit of cash/card for lot kiosks.",
"Mid-October is shoulder season: smaller crowds and fall color, but the first Sierra snow can arrive any time. Watch Caltrans QuickMap for chain controls on US-50 (Echo Summit) and I-80 (Donner Pass), and keep chains in the trunk.",
"Sand Harbor and Eagle Falls have tiny lots that fill by mid-morning even off-season — do the popular stops early, relax in the afternoon.",
"Going up US-50 and back via I-80/Truckee makes a natural loop so you see both the south and north shores without backtracking.",
"Cell coverage is patchy on US-50 over the summit and around the west shore — download offline maps for the whole loop."
],
"disclaimer": "This itinerary was assembled by an AI from general knowledge and may be out of date. Sierra weather, road/chain controls, park hours and fees, and lodging prices change fast — confirm with official sources (Caltrans QuickMap, the park sites, ReserveCalifornia/Recreation.gov, your nav app) before and during your 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, "&").replace(/</g, "<")
.replace(/>/g, ">").replace(/"/g, """);
}
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 ? " 👎 " + 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: "© 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(" · ") + "</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>