  :root {
    --bg: #f7f7f5;
    --panel: #ffffff;
    --text: #1c1c1e;
    --muted: #6b6b70;
    --border: #e2e2e0;
    --accent: #2563eb;
    --accent-2: #dc7609;
    --grid: #e9e9e7;
  }
  * { box-sizing: border-box; }
  body {
    font-family: monospace;
    font-size: 100%;
    background-color: white;
    color: #111;
    width: 80%;
    padding: 0;
    margin: 1% 10%;
    display: block;
  }
  a { text-decoration: underline; color: #111; }
  div.header {
    text-align: left;
    padding: 1em;
    margin: 0;
    border: thin solid gray;
    border-width: 1px 1px 1px 1px;
    border-radius: 5px 5px 0px 0px;
    display: block;
  }
  div.footer {
    text-align: right;
    padding: 1em;
    margin: 0;
    border: thin solid gray;
    border-width: 1px 1px 1px 1px;
    border-radius: 0px 0px 5px 5px;
    display: block;
  }
  div.content {
    padding: 1em;
    margin: 0;
    border: thin solid gray;
    border-width: 0px 1px 0px 1px;
    display: block;
  }
  .left { text-align: left; float: left; }
  .right { text-align: right; }
  .ride-header h1 {
    font-size: 18px;
    margin: 0 0 2px;
    font-weight: 600;
  }
  .ride-header .sub {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
  }
  .stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 20px;
  }
  .stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    min-width: 92px;
  }
  .stat .label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .stat .value {
    font-size: 18px;
    font-weight: 600;
    margin-top: 2px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 6px 20px 20px;
  }
  .map-wrap {
    position: relative;
    width: 100%;
  }
  #map {
    width: 100%;
    height: 560px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
  }
  .map-wrap.maximized {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    background: var(--bg);
  }
  .map-wrap.maximized #map {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
  .fs-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  }
  .fs-btn:hover { filter: brightness(1.08); }
  .side {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
  }
  .chart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--muted);
  }
  .chart-controls select {
    font-size: 13px;
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
  }
  #readout {
    font-size: 13px;
    color: var(--muted);
    min-height: 18px;
    margin-bottom: 4px;
  }
  #readout b { color: var(--text); }
  svg#chart { width: 100%; height: 260px; display: block; cursor: crosshair; }
  .grid-line { stroke: var(--grid); stroke-width: 1; }
  .axis-text { fill: var(--muted); font-size: 10px; }
  .ele-area { fill: var(--accent); opacity: 0.14; }
  .ele-line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
  .metric-line { fill: none; stroke: var(--accent-2); stroke-width: 1.6; }
  .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
  .dot { r: 4; }
  .dot.ele { fill: var(--accent); }
  .dot.metric { fill: var(--accent-2); }
  .legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
  .legend span { display: inline-flex; align-items: center; gap: 5px; }
  .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
  .photo-marker {
    font-size: 20px;
    line-height: 26px;
    text-align: center;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
  }
  .photo-popup img {
    display: block;
    width: 200px;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: zoom-in;
  }
  .photo-popup .caption {
    font-size: 12px;
    color: #333;
  }
  .lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
  }
  .lightbox.open { display: flex; }
  .lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
  }
