/* ── Reset ── */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html, body { height: 100%; overflow: hidden; }

    :root {
      --ink:      #0B0F14;
      --paper:    #F5F2E8;
      --chalk:    #E7E0D1;
      --moss:     #1F6F5B;
      --signal:   #E94F37;
      --sky:      #7BDFF2;
      --violet:   #5B4EED;
      --pink:     #E8006F;
      --muted:    rgba(11,15,20,.62);
      --hair:     rgba(11,15,20,.12);
      --shadow:   0 18px 55px rgba(0,0,0,.22);
      --shadow2:  0 8px 26px rgba(0,0,0,.18);
      --radius:   16px;
      --radius-sm:10px;
      --bar-h:    56px;
    }

    body {
      font-family: 'Inter', system-ui, sans-serif;
      background: #101419;
      color: #EDEBE6;
    }

    /* ── Map fills everything ── */
    #map {
      position: fixed;
      inset: 0;
      z-index: 0;
      background: #101419;

      /* Desktop trackpad pinch: stops Chrome from page-zooming when the gesture
         starts over the map/overlays; Leaflet will handle zoom via wheel events. */
      touch-action: pan-x pan-y;
    }
    .leaflet-container { background: #101419; }
    .leaflet-control-attribution { display: none; }
    .leaflet-control-zoom {
      border: none !important;
      /* Top margin removed so the zoom control lines up vertically with the
         Home control (both sit at padding-top: calc(var(--bar-h) + 2px)). */
      margin: 0 0 0 12px !important;
    }
    .leaflet-control-zoom a {
      width: 34px !important;
      height: 34px !important;
      line-height: 34px !important;
      font-size: 18px !important;
      background: rgba(15,15,20,0.80) !important;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      color: #fff !important;
      border: 1px solid rgba(255,255,255,0.10) !important;
      border-radius: 8px !important;
      box-shadow: 0 4px 14px rgba(0,0,0,.35) !important;
      transition: background 0.15s;

      /* center the + / − glyphs perfectly */
      display: grid !important;
      place-items: center !important;
      padding: 0 !important;
      text-indent: 0 !important;
    }
    .leaflet-control-zoom a:hover {
      background: rgba(232,0,111,0.55) !important;
    }

    /* Leaflet wraps the glyph in a span; normalize it so it truly centers */
    .leaflet-control-zoom a span{
      display: inline-block !important;
      line-height: 1 !important;
      transform: translateY(-0.5px);
    }

    .leaflet-control-zoom-in { border-radius: 8px 8px 0 0 !important; margin-bottom: 2px; }
    .leaflet-control-zoom-out { border-radius: 0 0 8px 8px !important; }

    /* ── Custom map controls (e.g. Home / GPS) — match the zoom buttons ── */
    .cc-map-control.leaflet-bar {
      border: none;
      box-shadow: none;
      background: transparent;
      margin: 0;
    }

    /* Disabled state for custom map controls */
    .cc-map-control.cc-map-control--disabled .cc-map-control__btn,
    .cc-map-control .cc-map-control__btn[aria-disabled='true']{
      opacity: 0.45;
      filter: grayscale(0.25);
      cursor: not-allowed;
      pointer-events: none;
    }

    /* Ensure Home & Layer buttons match Leaflet zoom buttons exactly */
    .cc-map-control .cc-map-control__btn {
      width: 34px !important;
      height: 34px !important;
      line-height: 34px !important;
      display: grid !important;
      place-items: center !important;
      background: rgba(15,15,20,0.80) !important;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      color: #fff !important;
      border: 1px solid rgba(255,255,255,0.10) !important;
      border-radius: 8px !important;
      box-shadow: 0 4px 14px rgba(0,0,0,.35) !important;
      text-decoration: none !important;
      cursor: pointer;
    }

    /* Layer button spacing:
       When positioned in the top-right corner (under zoom +/-), Leaflet already
       stacks controls vertically with a small gap.
       Keep the layer control close to the zoom control (no extra offset). */
    /* Nudge the layers button down slightly to visually match the zoom stack */
    .cc-map-control--layer{ margin-top: 2px !important; }
    .cc-map-control .cc-map-control__btn .ms {
      font-family: 'Material Symbols Rounded';
      font-weight: 400;
      font-style: normal;
      font-size: 18px;
      line-height: 1;
      color: #fff;
      font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    }
    .cc-map-control--home .cc-map-control__btn:hover {
      background: rgba(60, 64, 72, 0.92);
    }

    /* Add a small gap between the Home button and the GPS (Near Me) button.
       Leaflet stacks controls by margin-bottom on the control container, not the
       control itself, so target the home control container. */
    .cc-map-control--home{ margin-bottom: 4px !important; }

    /* ── Top bar ── */
    #topbar {
      position: fixed;
      top: 0; left: 0; right: 0;
      height: var(--bar-h);
      z-index: 1000;
      display: flex;
      align-items: center;
      padding: 0 10px;
      gap: 8px;
      background: rgba(10, 12, 16, 0.75);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid rgba(255,255,255,0.07);
    }

    /* ── Live navigation mode (full-screen, bike-handlebar friendly) ───────── */
    body.cc-live-nav #topbar,
    body.cc-live-nav #radiusBar,
    body.cc-live-nav #drawer,
    body.cc-live-nav #sheetWrap,
    body.cc-live-nav #stravaModal,
    body.cc-live-nav #stravaModalOverlay,
    body.cc-live-nav #overlay,
    body.cc-live-nav #toast,
    body.cc-live-nav #layerPop{
      display: none !important;
    }

    /* Hide Leaflet default controls; Live Nav provides its own minimal overlays. */
    body.cc-live-nav .leaflet-control-container{
      display:none !important;
    }

    body.cc-live-nav #map{
      inset: 0;
    }

    body.cc-live-nav .cc-live-nav-ui{
      position: fixed;
      inset: 0;
      z-index: 1200;
      pointer-events: none;
      display: block;
    }

    body.cc-live-nav .cc-live-nav-ui .cc-live-nav-exit,
    body.cc-live-nav .cc-live-nav-ui .cc-live-nav-pill{
      pointer-events: auto;
    }

    body.cc-live-nav .cc-live-nav-exit{
      position: fixed;
      left: 12px;
      top: 12px;

      height: 44px;
      padding: 0 12px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.14);
      background: rgba(10, 12, 16, 0.72);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      color: rgba(255,255,255,0.92);
      box-shadow: 0 8px 26px rgba(0,0,0,0.35);

      display: inline-flex;
      align-items: center;
      gap: 8px;
      font: 700 13px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
      letter-spacing: 0.01em;
    }

    body.cc-live-nav .cc-live-nav-exit .ms{
      font-family: 'Material Symbols Rounded';
      font-weight: 400;
      font-style: normal;
      font-size: 20px;
      line-height: 1;
      color: rgba(255,255,255,0.92);
      font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    }

    body.cc-live-nav .cc-live-nav-pill{
      position: fixed;
      right: 12px;
      top: 12px;

      min-height: 44px;
      padding: 10px 12px;
      border-radius: 14px;
      border: 1px solid rgba(255,255,255,0.14);
      background: rgba(10, 12, 16, 0.72);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      color: rgba(255,255,255,0.92);
      box-shadow: 0 8px 26px rgba(0,0,0,0.35);

      display: flex;
      flex-direction: column;
      gap: 6px;
      align-items: flex-end;
    }

    body.cc-live-nav .cc-live-nav-row{
      display:flex;
      align-items: baseline;
      justify-content: flex-end;
      gap: 10px;
      white-space: nowrap;
    }

    body.cc-live-nav .cc-live-nav-k{
      font: 600 11px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
      opacity: 0.75;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    body.cc-live-nav .cc-live-nav-v{
      font: 800 18px/1 Outfit, Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
      letter-spacing: -0.02em;
    }

    body.cc-live-nav .cc-live-nav-compass{
      position: fixed;
      left: 12px;
      bottom: 12px;

      width: 70px;
      height: 70px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.14);
      background: rgba(10, 12, 16, 0.65);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      box-shadow: 0 10px 32px rgba(0,0,0,0.40);

      display: grid;
      place-items: center;
      pointer-events: none;
    }

    body.cc-live-nav .cc-live-nav-compass .arrow{
      width: 0;
      height: 0;
      border-left: 10px solid transparent;
      border-right: 10px solid transparent;
      border-bottom: 26px solid rgba(232,0,111,0.95);
      transform-origin: 50% 70%;
      filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45));
    }

    @media (prefers-reduced-motion: reduce){
      body.cc-live-nav .cc-live-nav-compass .arrow{
        transition: none !important;
      }
    }

    /* ── Logo ── */
    #logo {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      gap: 8px;
      text-decoration: none;
      cursor: default;
    }
    #logo-badge {
      width: 36px;
      height: 36px;
      background: var(--pink);
      border-radius: 9px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      box-shadow: 0 0 0 0 rgba(232,0,111,0.4);
      transition: box-shadow 0.2s;
    }
    #logo-badge:hover { box-shadow: 0 0 0 4px rgba(232,0,111,0.25); }
    #logo-wordmark {
      font-family: 'Outfit', sans-serif;
      font-size: 16px;
      letter-spacing: 0.02em;
      color: #fff;
      line-height: 1;
      white-space: nowrap;
    }

    /* Offloaded logo image */
    .ccLogo {
      flex-shrink: 0;
      border: 1px solid rgba(255,255,255,0.18);
      border-radius: 9px;
      height: 36px;
      width: 36px;
      display: block;
    }

    @media (max-width: 380px) { #logo-wordmark { display: none; } }

    /* ── Search ── */
    #search-wrap {
      flex: 1;
      display: flex;
      justify-content: center;
    }
    .search-inner {
      position: relative;
      width: 100%;
      max-width: 400px;
    }
    #search-icon {
      position: absolute;
      left: 10px;
      top: 50%;
      transform: translateY(-50%);
      pointer-events: none;
      color: rgba(255,255,255,0.38);
    }
    #search-box {
      width: 100%;
      height: 36px;
      background: rgba(255,255,255,0.09);
      border: 1px solid rgba(232,0,111,0.55);
      border-radius: 18px;
      color: #fff;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      padding: 0 14px 0 34px;
      outline: none;
      transition: background 0.2s, border-color 0.2s;
      -webkit-appearance: none;
    }
    #search-box::placeholder { color: rgba(255,255,255,0.38); }
    #search-box:focus {
      background: rgba(255,255,255,0.13);
      border-color: var(--pink);
    }

    /* ── Burger ── */
    #burger {
      flex-shrink: 0;
      width: 36px;
      height: 36px;
      background: var(--pink);
      border: 1px solid rgba(255,255,255,0.18);
      border-radius: 9px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 5px;
      cursor: pointer;
      transition: transform 0.12s ease, filter 0.15s ease;
    }
    #burger:hover { filter: brightness(1.06); }
    #burger:active { transform: scale(0.98); }
    #burger span {
      display: block;
      width: 17px;
      height: 2px;
      background: #fff;
      border-radius: 2px;
      transition: transform 0.25s ease, opacity 0.2s ease;
      transform-origin: center;
    }
    body.menu-open #burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    body.menu-open #burger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    body.menu-open #burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* ── Overlay ── */
    #overlay {
      position: fixed;
      inset: 0;
      z-index: 998;
      background: rgba(0,0,0,0.45);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.28s;
    }
    body.menu-open #overlay { opacity: 1; pointer-events: all; }

    /* ── Drawer ── */
    #drawer {
      position: fixed;
      top: 0; right: 0;
      width: min(300px, 88vw);
      height: 100%;
      z-index: 999;
      background: rgba(11, 13, 18, 0.97);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-left: 1px solid rgba(255,255,255,0.07);
      transform: translateX(100%);
      transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
      display: flex;
      flex-direction: column;
      overflow-y: auto;
      padding-top: calc(var(--bar-h) + env(safe-area-inset-top) + 8px);
      padding-bottom: 32px;
    }

    /* Bottom-anchored logout row */
    .cc-logoutRow{
      margin-top: auto;
      padding-top: 14px;
    }
    .cc-logoutBtn{
      width: 100%;
      display: flex;
      align-items: center;
      gap: 10px;
      justify-content: center;
      height: 44px;
      border-radius: 12px;
      border: 1px solid rgba(232,0,111,0.55);
      background: rgba(232,0,111,0.14);
      color: rgba(255,255,255,0.96);
      cursor: pointer;
      font: 800 13px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
    }
    .cc-logoutBtn:hover{ background: rgba(232,0,111,0.20); }
    /* Ensure Material Symbols render as icons (not literal text) inside the drawer */
    #drawer .ms{
      font-family: 'Material Symbols Rounded';
      font-weight: 400;
      font-style: normal;
      font-size: 18px;
      line-height: 1;
      letter-spacing: normal;
      text-transform: none;
      display: inline-block;
      white-space: nowrap;
      word-wrap: normal;
      direction: ltr;
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;
      -moz-osx-font-smoothing: grayscale;
      font-feature-settings: 'liga';
    }

    .cc-logoutBtn .ms{ font-size: 18px; }
    .cc-logoutBtn__text{ letter-spacing: 0.02em; }
    body.menu-open #drawer { transform: translateX(0); }

    .drawer-section { padding: 16px 18px 0; }
    .drawer-divider {
      height: 1px;
      background: rgba(255,255,255,0.06);
      margin: 16px 18px 0;
    }
    .drawer-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.13em;
      text-transform: uppercase;
      color: var(--pink);
      margin-bottom: 10px;
    }

    /* Area buttons */
    .area-list { display: flex; flex-direction: column; gap: 5px; }
    .area-btn {
      display: flex;
      align-items: center;
      gap: 9px;
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 8px;
      padding: 9px 11px;
      color: #ccc;
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
      text-align: left;
    }
    .area-btn:hover, .area-btn.active {
      background: rgba(232,0,111,0.13);
      border-color: rgba(232,0,111,0.55);
      color: #fff;
    }
    .area-dot {
      width: 7px; height: 7px;
      border-radius: 50%;
      background: var(--pink);
      flex-shrink: 0;
    }

    /* Grade filter */
    .filter-row { margin-bottom: 14px; }
    .filter-row label {
      display: flex;
      justify-content: space-between;
      font-size: 12px;
      color: #999;
      margin-bottom: 7px;
    }
    .filter-row label span { color: var(--pink); font-weight: 600; font-family: 'IBM Plex Mono', monospace; }
    input[type=range] {
      -webkit-appearance: none;
      width: 100%;
      height: 4px;
      border-radius: 2px;
      background: rgba(255,255,255,0.10);
      outline: none;
      cursor: pointer;
    }
    input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 18px; height: 18px;
      border-radius: 50%;
      background: var(--pink);
      border: 2px solid #fff;
      box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    }
    input[type=range]::-moz-range-thumb {
      width: 18px; height: 18px;
      border-radius: 50%;
      background: var(--pink);
      border: 2px solid #fff;
    }

    /* Fit button */
    .fit-btn {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      background: rgba(232,0,111,0.13);
      border: 1px solid rgba(232,0,111,0.40);
      border-radius: 8px;
      color: #fff;
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 600;
      padding: 9px 14px;
      cursor: pointer;
      transition: background 0.15s;
      width: 100%;
      justify-content: center;
    }
    .fit-btn:hover { background: rgba(232,0,111,0.25); }

    /* Layer toggles */
    .layer-list { display: flex; flex-direction: column; gap: 5px; }
    .layer-btn {
      display: flex;
      align-items: center;
      gap: 9px;
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 8px;
      padding: 9px 11px;
      color: #ccc;
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
      text-align: left;
    }
    .layer-btn:hover, .layer-btn.active {
      background: rgba(232,0,111,0.13);
      border-color: rgba(232,0,111,0.55);
      color: #fff;
    }
    .layer-icon { font-size: 15px; width: 18px; text-align: center; }

    /* Layer picker popover (top-right, under zoom +/- and next to the map style button) */
    #layerPop.layer-pop{
      position: fixed;
      left: auto;
      /* pull the popover slightly left so it doesn’t butt against the button */
      right: 54px;
      /* align with the layer button which is stacked under zoom */
      top: 112px;
      width: min(320px, calc(100vw - 28px));
      z-index: 1200;
      background: rgba(16,20,25,0.96);
      border: 1px solid rgba(232,0,111,0.22);
      border-radius: 16px;
      box-shadow: 0 18px 60px rgba(0,0,0,0.45);
      padding: 10px;
      display: none;
    }
    #layerPop.open{ display: block; }

    .layer-pop__head{
      display:flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 6px 8px 10px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
      margin-bottom: 10px;
    }
    .layer-pop__title{
      color: rgba(255,255,255,0.92);
      font: 900 12px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }
    .layer-pop__val{
      color: rgba(255,255,255,0.55);
      font: 700 11px/1 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      text-transform: none;
      letter-spacing: 0;
    }

    .layer-pop__list{ display:flex; flex-direction: column; gap: 8px; }
    .layer-pop__btn{
      width: 100%;
      height: 44px;
      border-radius: 12px;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(255,255,255,0.04);
      color: rgba(255,255,255,0.92);
      font: 800 14px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
      text-align: left;
      padding: 0 14px;
      cursor: pointer;
    }
    .layer-pop__btn:hover,
    .layer-pop__btn.active{
      background: rgba(232,0,111,0.14);
      border-color: rgba(232,0,111,0.55);
    }

    /* About */
    .about-text { font-size: 12px; color: #666; line-height: 1.65; }
    .about-text strong { color: #aaa; }

    /* ── Modals (Strava + cycle.travel) ── */
    #stravaModalOverlay,
    #ctModalOverlay {
      position: fixed;
      inset: 0;
      z-index: 1200;
      background: rgba(0,0,0,0.55);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.18s ease;
    }
    #stravaModalOverlay.open,
    #ctModalOverlay.open { opacity: 1; pointer-events: all; }

    #stravaModal,
    #ctModal {
      position: fixed;
      left: 50%;
      top: 50%;
      right: auto;
      bottom: auto;
      transform: translate(-50%, -50%) scale(0.98);
      width: min(560px, calc(100vw - 28px));
      z-index: 1201;
      border-radius: 16px;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(11, 13, 18, 0.96);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
      box-shadow: 0 18px 55px rgba(0,0,0,.55);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.18s ease, transform 0.18s ease;

      /* Desktop safety: prevent the modal from being taller than the viewport */
      max-height: calc(100vh - 56px);
      overflow: auto;
    }

    #stravaModal { position: fixed; }


    #stravaModal.open,
    #ctModal.open {
      opacity: 1;
      pointer-events: auto;
      transform: translate(-50%, -50%);
    }

    /* Mobile (touch): bottom-sheet feel for cycle.travel */
    @media (max-width: 680px) and (pointer: coarse){
      #ctModal{
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 12px;
        width: auto;
        transform: translate(0, 12px);
        border-radius: 18px;
      }
      #ctModal.open{ transform: translate(0, 0); }
    }


    /* cycle.travel modal interior */
    /* Sheet header: close button pinned left of road name */
    .sheetNameRow{
      display:flex;
      align-items: center;
      gap: 10px;
    }
    .sheetClose{
      flex-shrink: 0;
      width: 34px;
      height: 34px;
      border-radius: 10px;
      display:grid;
      place-items: center;
    }
    .sheetClose--name{
      margin-top: 1px; /* optical align with cap height */
    }

    .ctHead{
      padding: 14px 14px 10px;
      display:flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .ctHead h3{
      margin: 0;
      font-family: 'Outfit', sans-serif;
      font-size: 16px;
      letter-spacing: 0.02em;
      color: #fff;
    }
    .ctBody{ padding: 12px 14px 14px; display:grid; gap: 12px; }
    .ctLead{ margin: 0; font-size: 13px; line-height: 1.5; color: rgba(255,255,255,0.72); }
    .ctSteps{ display:grid; gap: 10px; }
    .ctStep{ display:grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
    .ctNum{
      width: 22px; height: 22px;
      border-radius: 999px;
      background: rgba(232,0,111,0.95);
      color: #fff;
      font: 900 12px/22px Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
      text-align: center;
      box-shadow: 0 0 0 4px rgba(232,0,111,0.18);
    }
    .ctStepTxt{ font-size: 13px; line-height: 1.35; color: rgba(255,255,255,0.86); }
    .ctStepTxt strong{ font-weight: 800; }
    .ctMono{ font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; }
    .ctTip{
      padding-top: 12px;
      border-top: 1px solid rgba(255,255,255,0.08);
      font-size: 12px;
      line-height: 1.5;
      color: rgba(255,255,255,0.62);
    }
    .ctActions{ display:flex; justify-content: flex-end; gap: 10px; margin-top: 2px; }
    .ctBtn{
      appearance: none;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(255,255,255,0.06);
      color: #fff;
      border-radius: 10px;
      padding: 9px 12px;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 12px;
      cursor: pointer;
    }
    .ctBtn:hover{ background: rgba(255,255,255,0.10); }
    .ctBtn--primary{ border-color: rgba(232,0,111,0.45); background: rgba(232,0,111,0.18); }
    .ctBtn--primary:hover{ background: rgba(232,0,111,0.26); }

    .stravaHead {
      padding: 14px 14px 10px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .stravaTitle {
      display: flex;
      align-items: baseline;
      gap: 10px;
      margin: 0;
    }
    .stravaTitle h3 {
      margin: 0;
      font-family: 'Outfit', sans-serif;
      font-size: 16px;
      letter-spacing: 0.02em;
      color: #fff;
    }
    .stravaPill {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 11px;
      padding: 6px 10px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(255,255,255,0.06);
      color: rgba(255,255,255,0.75);
      white-space: nowrap;
    }
    .stravaPill.is-connected {
      border-color: rgba(46,160,67,0.45);
      background: rgba(46,160,67,0.18);
      color: rgba(220,255,230,0.95);
    }
    .stravaPill.is-not-connected {
      border-color: rgba(233,79,55,0.85);
      background: rgba(233,79,55,0.28);
      color: rgba(255,235,230,0.98);
    }

    .iconBtn {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(255,255,255,0.06);
      color: #fff;
      cursor: pointer;
    }
    .iconBtn:hover { background: rgba(232,0,111,0.18); border-color: rgba(232,0,111,0.35); }

    .stravaBody { padding: 12px 14px 14px; display: grid; gap: 10px; position: relative; }

    .stravaRow {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: center;
      padding: 10px 10px;
      border-radius: 12px;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(255,255,255,0.04);
    }
    .stravaRow .k { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: rgba(255,255,255,0.62); }
    .stravaRow .v { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: rgba(255,255,255,0.88); text-align: right; }

    .stravaActions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; align-items: center; }
    .stravaConnectByMenu { color: rgba(255,255,255,0.75); font-size: 14px; padding: 6px 10px; border: 1px solid rgba(255,255,255,0.12); border-radius: 999px; }

    /* Strava brand button (uses official asset) */
    .cc-stravaBtn,
    .cc-stravaBtn--drawer{
      appearance: none;
      border: 0;
      background: transparent;
      padding: 0;
      margin: 0;
      cursor: pointer;
      line-height: 0;
    }
    .cc-stravaBtn__img{
      display: block;
      height: 40px;          /* typical Strava button height */
      width: auto;
    }

    /* Drawer layout: center the brand button */
    .cc-stravaBtn--drawer{
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .cc-stravaBtn:focus-visible{
      outline: 2px solid rgba(255,255,255,0.8);
      outline-offset: 2px;
      border-radius: 6px;
    }

    .sbtn {
      appearance: none;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(255,255,255,0.06);
      color: #fff;
      border-radius: 10px;
      padding: 9px 12px;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 12px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    .sbtn:hover { background: rgba(255,255,255,0.10); }
    .sbtn.primary { border-color: rgba(232,0,111,0.45); background: rgba(232,0,111,0.18); }
    .sbtn.primary:hover { background: rgba(232,0,111,0.26); }
    .sbtn.danger { border-color: rgba(233,79,55,.45); background: rgba(233,79,55,.14); }
    .sbtn.danger:hover { background: rgba(233,79,55,.22); }

    #btnStravaSync .ms,
    #btnStravaDisconnect .ms,
    #btnStravaResyncAll .ms {
      font-family: 'Material Symbols Rounded';
      font-weight: 400;
      font-size: 18px;
      line-height: 1;
    }

    .stravaConsent{
      font-size: 12px;
      line-height: 1.5;
      color: rgba(255,255,255,0.62);
      margin-top: 8px;
      margin-bottom: 2px;
    }
    .stravaConsent a{
      color: rgba(255,255,255,0.92);
      text-decoration: none;
      border-bottom: 1px solid rgba(255,255,255,0.18);
    }
    .stravaConsent a:hover{
      border-bottom-color: rgba(232,0,111,0.45);
    }

    .stravaNote {
      font-size: 12px;
      line-height: 1.5;
      color: rgba(255,255,255,0.62);
      margin-top: 6px;
    }
    .cc-stravaAttribution{
      margin-top: 6px;
      font-size: 11px;
      color: rgba(255,255,255,0.52);
    }

    .stravaPoweredBy{
      height: 28px;
      width: auto;
      opacity: 0.85;
      pointer-events: none;
      margin-left: auto;
      margin-top: 4px;
    }

    /* Account drawer meta */
    .cc-accountHead{
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 8px;
      margin-bottom: 10px;
    }
    .cc-accountAvatar{
      width: 42px;
      height: 42px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.14);
      object-fit: cover;
      background: rgba(255,255,255,0.06);
      flex-shrink: 0;
    }
    .cc-accountIdent{ display:flex; flex-direction: column; gap: 3px; min-width: 0; }
    .cc-accountName{
      font: 900 14px/1.1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
      color: rgba(255,255,255,0.92);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .cc-accountSub{
      font: 700 12px/1.2 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      color: rgba(255,255,255,0.62);
    }
    .cc-accountMeta{
      margin-top: 0;
      margin-bottom: 10px;
      font-size: 12px;
      line-height: 1.35;
      color: rgba(255,255,255,0.68);
      font-family: 'IBM Plex Mono', monospace;
      word-break: break-word;
      white-space: pre-line;
    }

    /* Account actions live inside cc-accountMeta, but should look like normal drawer buttons.
       The meta container uses mono/12px; override it for the action list so it doesn’t
       render “tiny” right after the OAuth redirect / initial injection. */
    .cc-accountMeta .layer-btn{
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      line-height: 1.2;
      color: #ccc;
    }
    .cc-accountMeta .layer-icon{
      font-size: 15px;
      width: 18px;
      text-align: center;
    }

    /* ── Bottom sheet ── */
    #sheetWrap {
      position: fixed;
      left: 0; right: 0; bottom: 0;
      z-index: 500;
      padding: 10px 12px 12px;
      pointer-events: none;
    }
    #sheet {
      pointer-events: none;
      max-width: 860px;
      margin: 0 auto;
      background: rgba(245,242,232,0.94);
      color: var(--ink);
      border-radius: 18px;
      border: 1px solid rgba(11,15,20,0.10);
      box-shadow: var(--shadow);
      overflow: hidden;
      transform: translateY(16px);
      opacity: 0;
      transition: opacity 0.18s ease, transform 0.22s ease;
    }
    #sheet.open { opacity: 1; transform: translateY(0); pointer-events: auto; }

    /* IMPORTANT: don’t enable pointer events on *every* descendant.
       On mobile, this can create an invisible click-catcher area (e.g. the header
       grid stretches wider/taller than the visible sheet), blocking map taps.
       Let interactive controls opt-in instead. */
    #sheet.open * { pointer-events: none; }

    /* Allow interactions inside the visible sheet body */
    #sheet.open .sheetBody,
    #sheet.open .sheetBody * { pointer-events: auto; }

    /* If you ever add a close button / actions into the header, whitelist them here. */
    #sheet.open .sheetTop button,
    #sheet.open .sheetTop a,
    #sheet.open .sheetTop [role="button"] { pointer-events: auto; }

    .sheetTop {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 10px;
      padding: 12px 12px 10px;
      align-items: start;
      border-bottom: 1px solid rgba(11,15,20,0.10);
      background:
        radial-gradient(900px 200px at 0% 0%, rgba(123,223,242,.16), transparent 60%),
        radial-gradient(900px 200px at 100% 0%, rgba(91,78,237,.14), transparent 60%),
        rgba(245,242,232,0.92);
    }
    .sheetName {
      margin: 0;
      font-family: 'Inter', sans-serif;
      font-size: 16px;
      font-weight: 700;
      letter-spacing: -0.01em;
      line-height: 1.15;
    }
    .sheetMeta {
      margin-top: 6px;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      font-size: 12px;
      color: var(--muted);
    }
    .tag {
      border: 1px solid rgba(11,15,20,0.12);
      background: rgba(231,224,209,0.65);
      border-radius: 999px;
      padding: 4px 8px;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 11px;
    }
    .gradeBadge {
      /* Match the “collected” pill geometry (shape + padding),
         but keep background colour driven by the grade value (set inline by JS). */
      border-radius: 999px;
      padding: 6px 10px;
      font-weight: 800;
      letter-spacing: .01em;
      border: 1px solid rgba(11,15,20,0.12);
      font-family: 'IBM Plex Mono', monospace;
      min-width: 68px;
      text-align: center;
      font-size: 13px;

      /* Remove any fade/filters applied elsewhere */
      opacity: 1 !important;
      filter: none !important;
      mix-blend-mode: normal !important;
    }
    .sheetBody { padding: 10px 12px 12px; display: grid; gap: 8px; }
    .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat {
      border-radius: var(--radius-sm);
      border: 1px solid rgba(11,15,20,0.10);
      background: rgba(255,255,255,0.65);
      padding: 9px 10px;
    }
    .stat .k { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
    .stat .v { margin-top: 3px; font-size: 17px; font-weight: 700; font-family: 'IBM Plex Mono', monospace; }
    .hint { font-size: 11px; color: rgba(11,15,20,.65); line-height: 1.4; }
    .miniLegend {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border-radius: var(--radius-sm);
      border: 1px solid rgba(11,15,20,0.10);
      background: rgba(255,255,255,0.55);
      padding: 9px 10px;
    }
    .ramp {
      height: 9px;
      flex: 1;
      border-radius: 999px;
      background: linear-gradient(90deg, #1F6F5B 0%, #7BDFF2 30%, #5B4EED 60%, #E94F37 85%, #FFB703 100%);
      border: 1px solid rgba(11,15,20,0.18);
    }
    .legendLabel { font-size: 10px; color: rgba(11,15,20,0.62); font-family: 'IBM Plex Mono', monospace; }



    /* ── Elevation profile ── */
    .profile {
      border-radius: var(--radius-sm);
      border: 1px solid rgba(11,15,20,0.10);
      background: rgba(255,255,255,0.62);
      padding: 10px 10px 8px;
      overflow: hidden;
    }
    .profileHead {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 8px;
    }
    .profileTitle {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: .13em;
      color: rgba(11,15,20,0.62);
      font-weight: 700;
    }
    .profileMeta {
      font-family: 'IBM Plex Mono', ui-monospace, monospace;
      font-size: 11px;
      color: rgba(11,15,20,0.62);
      white-space: nowrap;
    }
    #profileSvg {
      width: 100%;
      height: 92px;
      display: block;
    }
    .profileAxis {
      stroke: rgba(11,15,20,0.18);
      stroke-width: 1;
    }
    .profileFill {
      fill: rgba(232,0,111,0.18);
    }
    .profileStroke {
      stroke: rgba(11,15,20,0.70);
      stroke-width: 1.5;
      fill: none;
    }
    .profileMarker {
      stroke: rgba(11,15,20,0.65);
      stroke-width: 1.5;
    }
    .profileMarkerDot {
      fill: #fff;
      stroke: rgba(11,15,20,0.7);
      stroke-width: 1.5;
    }
    .profileMinMax {
      fill: rgba(11,15,20,0.55);
      font-family: 'IBM Plex Mono', ui-monospace, monospace;
      font-size: 10px;
    }

    /* ── Toast ── */
    #toast {
      position: fixed;
      left: 12px;
      right: 12px;
      top: calc(var(--bar-h) + env(safe-area-inset-top) + 10px);
      z-index: 1302;
      max-width: 500px;
      margin: 0 auto;
      border-radius: 10px;
      padding: 10px 14px;

      /* New toast skin: serious tool grey + pink edge */
      border: 1px solid rgba(232,0,111,1);
      background: rgba(35,40,48,0.6);
      color: rgba(255,255,255,0.96);

      backdrop-filter: blur(10px);
      font-size: 13px;
      display: none;
      pointer-events: none;
    }
    #toast.show { display: block; }

    /* On mobile the toast would otherwise span full width at the same height as
       the Home (top-left) and zoom (top-right) controls and cover them. Narrow it
       and inset it so it sits centered between the two corner buttons. */
    @media (max-width: 600px) {
      #toast {
        left: 54px;
        right: 54px;
        max-width: none;
      }
    }



    @media (prefers-reduced-motion: reduce) {
      #sheet, #drawer { transition: none; }
    }

    /* ── Progress popover ── */
    /*
      Target: progress window should be ~90% of the viewport on ALL screen sizes.
      We still leave a small gutter so it doesn't feel jammed against edges.
    */
    #progressPop{
      /* Make Progress a true centered modal popover (not anchored to the control bar).
         This prevents right-edge overflow from any inherited "left" offsets / transforms
         used by other ctl-pop instances.
      */
      position: fixed;
      left: 50% !important;
      right: auto !important;
      transform: translateX(-50%) !important;

      /* Keep the whole panel inside the viewport */
      top: calc(var(--bar-h) + env(safe-area-inset-top) + 12px) !important;
      bottom: calc(var(--bar-h) + 16px) !important;

      width: 90vw;
      max-width: calc(100vw - 24px);
      box-sizing: border-box;
      overflow-x: hidden;
      margin: 0 !important;

      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    /* Let the chart grow/shrink with available height (desktop), but keep a sensible minimum (mobile) */
    .progressChart{
      border-radius: 16px;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(255,255,255,0.04);
      padding: 12px 12px;
      margin-top: 10px;

      width: 100%;
      flex: 1 1 auto;
      min-height: 180px;            /* prevents the “too short” mobile chart */
      max-height: min(56vh, 520px); /* prevents top overflow on short viewports */

      overflow: hidden;
      display: grid;
      place-items: stretch;
    }

    .progressSvg{ width: 100%; height: 100%; display: block; }

    /* On wider screens, keep the chart’s aspect feel without forcing overflow */
    @media (min-width: 900px){
      .progressChart{ aspect-ratio: 900 / 420; }
    }
    .progressAxis{ stroke: rgba(255,255,255,0.16); stroke-width: 1; }
    .progressLine{ stroke: rgba(232,0,111,0.95); stroke-width: 2.8; fill: none; }
    .progressHit{ cursor: crosshair; }
    .progressFill{ fill: rgba(232,0,111,0.18); }
    .progressDot{ fill: rgba(255,255,255,0.92); stroke: rgba(232,0,111,0.95); stroke-width: 2; }
    .progressLbl{ fill: rgba(255,255,255,0.72); font: 800 10px/1 "IBM Plex Mono", ui-monospace, monospace; }
    .progressNote{
      margin-top: 10px;
      font-size: 12px;
      line-height: 1.4;
      color: rgba(255,255,255,0.62);
    }
    .progressNote strong{ color: rgba(255,255,255,0.86); }




/* ─────────────────────────────────────────────────────────────
   Climb detail sheet — redesign to match dark + pink system
   Glass header, disciplined type, card surfaces
   ───────────────────────────────────────────────────────────── */

#sheetWrap{
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 850;
  pointer-events: none;
}

#sheet{
  /* Closed sheet must NOT intercept map taps. */
  pointer-events: none;
  width: min(620px, calc(100vw - 24px));
  margin: 0 auto 78px; /* clears bottom control bar */
  border-radius: 18px;
  overflow: visible;
  background: rgba(16,20,25,0.92);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 22px 70px rgba(0,0,0,0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateY(18px);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}
#sheet.open{ opacity: 1; transform: translateY(0); pointer-events: auto; }

/* Desktop keeps left dock behavior from components.css; align visuals */
@media (min-width: 900px){
  #sheet{ margin: 0; }
}

/* Header band (glass like topbar) */
#sheet .sheetTop{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  background: rgba(10,12,16,0.70);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#sheetName{
  font-family: Outfit, Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-weight: 800;
  letter-spacing: -0.015em;
  font-size: 18px;
  line-height: 1.12;
  color: rgba(255,255,255,0.96);
  margin: 0;
}

#sheetMeta{
  margin-top: 10px;
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items:center;
}

/* Meta tokens */
.cc-meta{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.78);
  font: 700 12px/1.05 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.cc-tick{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(232,0,111,0.16);
  border: 1px solid rgba(232,0,111,0.42);
  color: rgba(255,255,255,0.94);
  box-shadow: 0 0 0 0 rgba(232,0,111,0.35);
}
.cc-tick__svg{ color:#fff; filter: drop-shadow(0 6px 14px rgba(232,0,111,0.25)); }
.cc-tick__txt{
  font: 800 11px/1 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.02em;
}

/* Make legacy .tag (hit list button) match system */
#sheetMeta .tag{
  display:none !important;
}
#sheetMeta .tag:hover{ background: rgba(255,255,255,0.10) !important; }

/* Grade badge in header: match collected pill geometry (shape + padding),
   keep background colour driven by the grade value (set inline by JS).
   Also explicitly remove any fade. */
#sheet .gradeBadge{
  border-radius: 999px;
  padding: 6px 10px;
  font: 800 13px/1 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.01em;
  border: 1px solid rgba(255,255,255,0.12);

  opacity: 1 !important;
  visibility: visible !important;
  filter: none !important;
  -webkit-filter: none !important;

  /* “Fade” is often a CSS mask/clip or transform; neutralize those too. */
  mask-image: none !important;
  -webkit-mask-image: none !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Stats grid: tighten, dark cards */
#sheet .sheetGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px 14px;
  background: rgba(16,20,25,0.92);
}
#sheet .stat{
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(232,0,111,0.55);
  padding: 12px 12px;
}
#sheet .statLabel{
  font: 800 10px/1.1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
}
#sheet .statValue{
  margin-top: 6px;
  font: 900 22px/1.05 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: rgba(255,255,255,0.98);
}
#sheet .statValue small{
  font-weight: 800;
  font-size: 14px;
  opacity: 0.92;
}

/* Profile card */
#sheet .profileWrap{
  margin: 0 14px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  overflow: hidden;
}
#sheet .profileHead{
  display:flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
#sheet .profileTitle{
  font: 900 12px/1.1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.70);
}
#sheet .profileMeta{
  font: 800 12px/1.1 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: rgba(255,255,255,0.72);
}

/* ── Strava stat boxes under profile ── */
#sheet .cc-stravaBoxes{
  /* Match the elevation profile width (it sits inside the same .sheetBody padding) */
  margin: 0px 0px;
 /* padding-top: 2px; /* a little more air above the boxes */

  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
#sheet .cc-sbox{
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(232,0,111,0.55); /* pink outline */
  padding: 12px 12px;
  min-height: 56px;
  display:flex;
  flex-direction: column;
  justify-content: center;
}
#sheet .cc-sbox__k{
  font: 800 10px/1.1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.64);
}
#sheet .cc-sbox__v{
  margin-top: 6px;
  font: 900 16px/1.05 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: rgba(255,255,255,0.96);
}

@media (max-width: 420px){
  /* Keep the 3 stats on one line; shrink typography rather than stacking */
  #sheet .cc-stravaBoxes{ grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  #sheet .cc-sbox{ min-height: 52px; padding: 9px 8px; }
  #sheet .cc-sbox__k{ font-size: 9px; letter-spacing: 0.14em; }
  #sheet .cc-sbox__v{ font-size: 13px; }
}

/* Mobile: single column stats */
@media (max-width: 420px){
  #sheet{ width: calc(100vw - 18px); margin-bottom: 74px; }
  #sheet .sheetGrid{ grid-template-columns: 1fr; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  #sheet{ transition: none; }
}


/* Stat pink outline hover */
@media (hover:hover){
  #sheet .stat:hover{
    box-shadow: 0 0 0 4px rgba(232,0,111,0.16);
  }
}


/* Force stat card text to white (override any legacy rules) */
#sheet .stat, #sheet .stat *{ color: rgba(255,255,255,0.96) !important; }
#sheet .statLabel{ color: rgba(255,255,255,0.78) !important; }
#sheet .statValue{ color: rgba(255,255,255,0.98) !important; }
#sheet .statValue small{ color: rgba(255,255,255,0.92) !important; }



/* Allow collected badge to overflow the sheet boundary */
#sheet{ overflow: visible !important; }


/* Collected ribbon (replaces badge) */
#sheet .sheetTop{ position: relative; }
.cc-collected-ribbon{
  position: absolute;
  top: 10px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(232,0,111,0.92);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.98);
  box-shadow: 0 16px 44px rgba(0,0,0,0.45), 0 0 0 4px rgba(232,0,111,0.18);
  font: 900 12px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  z-index: 30;
  pointer-events: none;
}
.cc-collected-ribbon__dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.20);
}
.cc-collected-ribbon__txt{ white-space: nowrap; }
@media (max-width: 420px){
  .cc-collected-ribbon{ top: 8px; right: 10px; padding: 8px 10px; font-size: 11px; }
}


@media (max-width: 420px){
  #sheet .sheetTop{ padding-right: 140px; }
}


@media (max-width: 420px){
  #sheet .sheetTop .gradeBadge{ margin-top: 34px; }
}


/* Phones: keep the grade pill right-justified in the header */
@media (max-width: 420px){
  #sheet .sheetTop .gradeBadge,
  .cc-header-right .gradeBadge{ margin-left: auto !important; margin-right: 0 !important; align-self: flex-end !important; }
}

/* Header right rail (grade badge lives here) */
#sheet .sheetTop{ position: relative; }
.cc-header-right{
  margin-left: auto;
  display:flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
#sheet .sheetTop .gradeBadge{ margin-top: 0 !important; }

/* Fix overlap: stack Collected + grade in the right rail */
#sheet .sheetTop{ display:flex; align-items:flex-start; }
.cc-collected-ribbon{ position: static !important; top: auto !important; right: auto !important; margin: 0 !important; }
.cc-header-right{ margin-left: auto; display:flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.cc-header-right .gradeBadge{ margin-top: 0 !important; }


/* Hide stray grade legend text ("10%+") if present */
#sheet .legend,
#sheet .gradeLegend,
#sheet .gradeKey,
#sheet .minmax,
#sheet .sheetFoot,
#sheet .sheetBottom,
#sheet .sheetExtra{
  display: none !important;
}


/* Desktop: sheet should hug content, and never fill the whole left column */
@media (min-width: 900px){
  #sheetWrap{
    left: 16px;
    right: auto;
    top: 72px;
    bottom: calc(16px + 92px); /* reserve for toolbar */
    width: 420px;
    pointer-events: none;
  }

  #sheet{
    pointer-events: auto;
    width: 420px !important;
    margin: 0 !important;

    /* Key behaviour:
       - default: content-driven height (no dead space)
       - safety: if content is taller than the available viewport, scroll inside */
    height: fit-content;
    max-height: calc(100vh - 72px - 16px - 92px);
    overflow: auto;
  }
}


/* Desktop width target */
@media (min-width: 900px){
  #sheetWrap{ width: 450px !important; }
  #sheet{ width: 450px !important; }
}

/* Desktop: ensure height is content-driven (override any earlier desktop blocks) */
@media (min-width: 900px){
  #sheet{
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}


/* Fix: sheetTop shouldn't create square-corner overlay */
#sheet .sheetTop{
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  overflow: hidden; /* clip header background to rounded corners */
}




/* ─────────────────────────────────────────────────────────────
   Elevation profile — refined
   - no extra background blocks (use sheet surface)
   - title typography matches stat labels
   - thinner stroke
   - bolder pink fill
   ───────────────────────────────────────────────────────────── */

#sheet .profile,
#sheet .profileHead,
#sheet #profileSvg{
  background: transparent !important;
}

/* Pink outline stays */
#sheet .profile{
  border: 1px solid rgba(232,0,111,0.55) !important;
}

/* Title typography to match stat labels */
#sheet .profileTitle{
  font: 800 10px/1.1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial !important;
  letter-spacing: 0.16em !important;
  text-transform: uppercase !important;
  color: rgba(255,255,255,0.78) !important;
}
#sheet .profileMeta{
  font: 800 12px/1.1 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  color: rgba(255,255,255,0.78) !important;
}

/* SVG styling */
#sheet #profileSvg .profileAxis{
  stroke: rgba(255,255,255,0.20) !important;
}
#sheet #profileSvg .profileStroke{
  stroke: rgba(255,255,255,0.92) !important;
  stroke-width: 2.2 !important;
}
#sheet #profileSvg .profileStrokeTicked{
  stroke: rgba(232,0,111,0.95) !important;
  stroke-width: 2.6 !important;
}
#sheet #profileSvg text,
#sheet #profileSvg .profileMinMax{
  fill: rgba(255,255,255,0.78) !important;
}

/* Bolder pink under-fill (override gradient stops) */
#sheet #profileSvg #ccPinkFade stop[offset="0%"]{
  stop-color: rgba(232,0,111,0.62) !important;
}
#sheet #profileSvg #ccPinkFade stop[offset="100%"]{
  stop-color: rgba(232,0,111,0.18) !important;
}




/* Add breathing room below profile (evens bottom margin visually) */
#sheet .sheetBody{ padding-bottom: 14px; }

/* ── Sheet: Hit list CTA under elevation profile ───────────────────────────── */
#sheet .cc-hit-cta{
  width: 100%;
  margin-top: 0px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(232,0,111,0.92);
  color: rgba(255,255,255,0.98);

  font: 900 13px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: 0.01em;
  cursor: pointer;
}
#sheet .cc-hit-cta:hover{ background: rgba(232,0,111,0.98); }
#sheet .cc-hit-cta:active{ transform: translateY(1px); }
#sheet .cc-hit-cta:focus-visible{ outline: 3px solid rgba(232,0,111,0.45); outline-offset: 2px; }
#sheet .cc-hit-cta[style*="display:none"],
#sheet .cc-hit-cta[hidden]{ display: none !important; }

/* When CTA is in “Remove from hit list” state */
#sheet .cc-hit-cta.is-remove{
  /* Match the dark card surface used by stats/profile boxes */
  background: rgba(255,255,255,0.03);
  border-color: rgba(232,0,111,0.78);
  color: rgba(255,255,255,0.96);
}
#sheet .cc-hit-cta.is-remove:hover{
  background: rgba(255,255,255,0.05);
}

/* ── Climb exception actions (selection drawer) ───────────────── */
#sheet .cc-exception-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 8px;
}
#sheet .cc-exc-badge{
  display: inline-block;
  font: 700 10px/1.1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  padding: 3px 8px;
  border-radius: 999px;
  margin-right: 4px;
  margin-bottom: 4px;
  color: rgba(255,255,255,0.96);
}
#sheet .cc-exc-badge.cc-exc-collected{
  background: rgba(46,204,113,0.22);
  border: 1px solid rgba(46,204,113,0.55);
  color: #2ecc71;
}
#sheet .cc-exc-badge.cc-exc-declined{
  background: rgba(180,180,180,0.22);
  border: 1px solid rgba(180,180,180,0.55);
  color: rgba(255,255,255,0.60);
}
#sheet .cc-exc-badge.cc-exc-flagged{
  background: rgba(180,180,180,0.22);
  border: 1px solid rgba(180,180,180,0.55);
  color: rgba(255,255,255,0.60);
}
#sheet .cc-exc-btn{
  font: 600 11px/1.1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.88);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#sheet .cc-exc-btn:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.20);
}
#sheet .cc-exc-btn:active{
  transform: translateY(1px);
}
#sheet .cc-exc-btn:focus-visible{
  outline: 2px solid rgba(232,0,111,0.55);
  outline-offset: 2px;
}
#sheet .cc-exc-btn.cc-exc-collect{
  border-color: rgba(46,204,113,0.50);
  color: #2ecc71;
}
#sheet .cc-exc-btn.cc-exc-decline{
  border-color: rgba(231,76,60,0.50);
  color: #e74c3c;
}
#sheet .cc-exc-btn.cc-exc-flag{
  border-color: rgba(243,156,18,0.50);
  color: #f39c12;
}
#sheet .cc-exc-btn.cc-exc-clear{
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.65);
}

/* Drawer search */
#drawer #search-wrap{ justify-content: flex-start; }
#drawer .search-inner{ max-width: none; }
#drawer #search-box{
  width: 100%;
  max-width: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}
#drawer #search-box:focus{ border-color: rgba(232,0,111,0.75); }
#drawer #search-icon{ color: rgba(255,255,255,0.45); }


/* Topbar no-search (keep spacing tidy) */
#topbar{ justify-content: space-between; }


/* Topbar climb count */
.top-counts{
  flex-shrink: 0;
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 18px;
  border: 1px solid rgba(232,0,111,0.65);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  font: 800 12px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
@media (max-width: 420px){
  .top-counts{ padding: 0 10px; font-size: 11px; }
}

#topbar .ccLogo{opacity:1 !important; visibility:visible !important;}

#topbar #logo{display:flex !important;}
#topbar .ccLogo{display:block !important;}

#topbar .ccLogo{opacity:1 !important; visibility:visible !important; display:block !important;}

.leaflet-top.leaflet-right{
  padding-top: calc(var(--bar-h) + env(safe-area-inset-top) + 10px);
  padding-right: 10px; 
}

.leaflet-top.leaflet-left{
  padding-top: calc(var(--bar-h) + env(safe-area-inset-top) + 10px);
  padding-left: 10px;
}

/* Keep the top bar and bottom dock clear of the notch and home indicator (0 on normal browsers) */
#topbar {
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
}
#radiusBar { bottom: calc(14px + env(safe-area-inset-bottom)); }
