#line-legend {
    position: absolute;
    left: 18px;
    bottom: 56px;
    z-index: 1000;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.25);
    border-radius: 10px;
    padding: 10px 12px;
    min-width: 220px;
    max-width: 460px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.18);
    backdrop-filter: saturate(120%) blur(6px);
    font-size: 12px;
    display: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease;
  }
  .legend-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
  }
  .legend-title + #line-legend-list { margin-top: 4px; }
  #line-legend-list {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(8, auto);
    gap: 8px 10px;
  }
  .legend-chip {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 999px;
    padding: 4px 8px;
    background: #fff;
    cursor: pointer;
  }
  .legend-chip:hover { background: #f5f5f5; }
  .legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,0.25); }
  .legend-label { font-weight: 700; color: #333; }
  
  #legend-toggle {
    position: absolute;
    left: 18px;
    bottom: 18px;
    z-index: 1001;
    border: 1px solid rgba(0,0,0,0.25);
    background: rgba(255,255,255,0.95);
    color: #111;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    cursor: pointer;
  }
  
  #line-legend.open, #line-legend.open { display: block; }
  .open#line-legend { opacity: 1; transform: translateY(0); }
  .open + #line-legend { opacity: 1; transform: translateY(0); }
  .iso-tip {
    background: rgba(0,0,0,0.85);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    font-family: "Funnel Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  }
  html, body, #map {
    height: 100%;
    margin: 0;
  }
  
  html, body, #map, input, button, label, .iso-label span {
    font-family: "Funnel Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  }
  
  /* Link styles */
  a {
    color: #007cba;
    text-decoration: none;
  }
  
  a:hover {
    color: #005a8b;
    text-decoration: underline;
  }
  
  a:visited {
    color: #007cba;
  }
  
  /* Grayscale basemap - apply filter to the pane to avoid tile seams */
  .leaflet-tile-pane {
    filter: grayscale(1) contrast(1.05) brightness(0.35);
  }
  .leaflet-tile {
    filter: none !important; /* prevent per-tile filtering that causes white seams */
    background: transparent;
  
  }
  .leaflet-container {
    background: #484848; /* hide any subpixel gaps with dark backdrop */
  }
  .leaflet-container img.leaflet-tile {
    mix-blend-mode: normal !important;
    image-rendering: -moz-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    transform: translateZ(0);
  }
  .isochrone-band path {
    mix-blend-mode: multiply;
  }
  
  .iso-label span {
    background: rgba(255,255,255,0.85);
    color: #111;
    border: 1px solid #000;
    border-radius: 12px;
    padding: 4px 12px;
    font-size: 13px;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    user-select: none;
    white-space: nowrap;
  }
  
  .user-marker {
    width: 20px;
    height: 20px;
    border: 2px solid #000;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 3px rgba(0,160,255,0.20);
  }
  .user-marker .user-marker-inner {
    position: absolute;
    top: 50%; left: 50%;
    width: 6px; height: 6px;
    margin-left: -3px; margin-top: -3px;
    background: #00a0ff;
    border-radius: 50%;
  }
  
  #search-container {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: min(520px, calc(100vw - 200px));
    max-width: calc(100% - 80px);
    margin-left: 0;
  }
  
  #search-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,0.25);
    border-radius: 10px;
    font-size: 14px;
    box-sizing: border-box;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  }
  
  #search-input:focus {
    outline: none;
    border-color: #007cba;
  }
  
  #search-panel-results {
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(0,0,0,0.25);
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 260px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  }
  
  #search-panel-results.has-results {
    display: block;
  }
  
  .search-result {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
  }
  
  .search-result:hover {
    background-color: #f5f5f5;
  }
  
  .search-result:last-child {
    border-bottom: none;
  }
  
  .search-result-name {
    font-weight: bold;
    color: #333;
  }
  
  .search-result-address {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
  }
  
  #marker-controls {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(0,0,0,0.3);
    border-radius: 12px;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    min-width: 280px;
    max-width: 320px;
    width: 320px;
    backdrop-filter: saturate(120%) blur(8px);
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
  }
  
  #marker-actions {
    display: flex;
    gap: 5px;
    padding: 16px 16px 8px 16px;
    flex-shrink: 0;
  }
  
  #marker-controls-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px 16px;
  }
  
  
  #marker-actions button {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(0,0,0,0.25);
    border-radius: 8px;
    background: rgba(255,255,255,0.9);
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  }
  
  #marker-actions button:hover:not(:disabled) {
    background: #f5f5f5;
  }
  
  #marker-actions button:disabled {
    background: #f9f9f9;
    color: #999;
    cursor: not-allowed;
  }
  
  #place-marker-center {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
  }
  #walk-settings input[type="range"],
  #commute-settings input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #007cba 0%, #007cba 0%, #ddd 0%, #ddd 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
  }
  
  #walk-settings input[type="range"]::-webkit-slider-thumb,
  #commute-settings input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  }
  
  #walk-settings input[type="range"]::-moz-range-thumb,
  #commute-settings input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  }
  
  #marker-manage {
    max-width: 100%;
    width: 100%;
  }
  
  #marker-address {
    display: inline-block;
    max-width: 100%;
    width: 100%;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
  }
  
  #about .about-text {
    max-width: 100%;
    width: 100%;
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
    font-size: 12px;
  }
  
  #marker-manage {
    margin-top: 8px;
  }
  
  #marker-manage > div {
    font-size: 12px;
    color: #333;
    margin-bottom: 4px;
  }
  
  #marker-manage > div:last-child {
    margin-bottom: 0;
  }
  
  #walk-settings,
  #commute-settings {
    margin-top: 8px;
  }
  
  #walk-settings label,
  #commute-settings label {
    font-size: 12px;
    color: #333;
    display: block;
    margin-bottom: 4px;
  }
  
  #about {
    margin-top: 10px;
  }
  
  #about > div:first-child {
    font-size: 12px;
    color: #333;
    font-weight: 700;
    margin-bottom: 4px;
  }
  
  #data-sources {
    margin-top: 10px;
  }
  
  #data-sources > div:first-child {
    font-size: 12px;
    color: #333;
    font-weight: 700;
    margin-bottom: 4px;
  }
  
  /* Inspiration section */
  #inspiration {
    margin-top: 10px;
  }
  
  #inspiration > div:first-child {
    font-size: 12px;
    color: #333;
    font-weight: 700;
    margin-bottom: 4px;
  }
  
  #place-marker-center:hover:not(:disabled) {
    background: #000 !important;
  }
  
  .leaflet-top.leaflet-left .zoom-pill {
    position: absolute;
    top: 14px;
    left: 14px;
    margin: 0;
    z-index: 1000;
  }
  .zoom-pill {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.25);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    backdrop-filter: saturate(120%) blur(6px);
  }
  .zoom-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.25);
    background: rgba(255,255,255,0.95);
    color: #111;
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: background-color .15s ease, transform .08s ease, box-shadow .15s ease, color .15s ease;
  }
  .zoom-btn:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  }
  .zoom-btn:active { 
    transform: translateY(1px); 
    background: #ececec; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  }
  .zoom-btn:focus { 
    outline: none; 
    box-shadow: 0 0 0 2px rgba(0,0,0,0.12); 
  }
  
  #mobile-menu-toggle {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(0,0,0,0.25);
    background: rgba(255,255,255,0.95);
    color: #111;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: saturate(120%) blur(6px);
  }
  
  #mobile-menu-toggle:hover {
    background: #f5f5f5;
  }
  
  @media (min-width: 769px) {
    #marker-controls {
      max-width: 320px;
      width: 320px;
    }
    
    #search-container {
      max-width: calc(100% - 360px);
    }
  }
  
  @media (max-width: 768px) {
    #marker-controls {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(255,255,255,0.98);
      z-index: 1000;
      padding: 20px;
      overflow-y: auto;
      backdrop-filter: saturate(120%) blur(8px);
    }
    
    #marker-controls.mobile-open {
      display: block;
    }
    
    #mobile-menu-toggle {
      display: flex;
    }
    
    #search-container {
      width: min(calc(100vw - 140px), calc(100% - 120px));
      max-width: none;
    }
    
    #line-legend {
      left: 10px;
      right: 10px;
      bottom: 80px;
      min-width: auto;
      max-width: none;
    }
    
    #legend-toggle {
      left: 10px;
      bottom: 10px;
    }
    
    #marker-controls {
      min-width: auto;
      max-width: none;
      width: auto;
      border-radius: 0;
      border: none;
      box-shadow: none;
      max-height: 100vh;
    }
    
    #marker-actions {
      flex-direction: column;
      gap: 10px;
      padding: 20px 20px 10px 20px;
    }
    
    #marker-controls-content {
      padding: 0 20px 20px 20px;
    }
    
    #marker-actions button {
      padding: 14px 16px;
      font-size: 14px;
    }
    
    #marker-controls::before {
      content: "✕";
      position: absolute;
      top: 20px;
      right: 20px;
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(0,0,0,0.1);
      border-radius: 50%;
      font-size: 20px;
      cursor: pointer;
      z-index: 1001;
    }
    
    #marker-controls::before:hover {
      background: rgba(0,0,0,0.2);
    }
  }
  
  @media (max-width: 480px) {
    #search-container {
      width: min(calc(100vw - 180px), calc(100% - 200px));
      top: 10px;
    }
    
    #mobile-menu-toggle {
      width: 40px;
      height: 40px;
      font-size: 16px;
    }
    
    #marker-controls {
      padding: 15px;
    }
    
    #marker-actions button {
      padding: 12px 14px;
      font-size: 13px;
    }
  }
  