    body { overflow: hidden; }

    #map {
      position: fixed;
      top: 70px; left: 0; right: 0; bottom: 0;
      z-index: 0;
    }

    /* Layer toggle — desktop */
    #layer-toggle {
      position: fixed;
      bottom: 24px;
      right: 12px;
      z-index: 600;
    }
    #btn-layer { display: none; }  /* hidden on desktop */
    #layer-btns-desktop {
      display: flex;
      gap: 4px;
    }
    .layer-btn {
      padding: 5px 10px;
      font-size: 0.68rem;
      font-weight: 600;
      letter-spacing: 0.4px;
      text-transform: uppercase;
      cursor: pointer;
      border: 1.5px solid rgba(255,255,255,0.18);
      border-radius: 7px;
      background: rgba(17, 22, 13, 0.92);
      color: var(--text-secondary);
      backdrop-filter: blur(8px);
      box-shadow: 0 2px 10px rgba(0,0,0,0.45);
      transition: background 0.15s, color 0.15s, border-color 0.15s;
    }
    .layer-btn:hover {
      background: var(--forest);
      color: #fff;
      border-color: var(--accent-dim);
    }
    .layer-btn.active {
      background: var(--forest);
      color: #fff;
      border-color: var(--accent-dim);
    }

    /* Units toggle — stacked above the layer-toggle on desktop, standalone on mobile.
       Fires `setUnits('mi'|'km')` in globals.js → unitschange event → everything rerenders. */
    #units-toggle {
      position: fixed;
      bottom: 68px;
      right: 12px;
      z-index: 600;
      display: flex;
      gap: 4px;
    }
    .unit-btn {
      padding: 5px 10px;
      font-size: 0.68rem;
      font-weight: 700;
      letter-spacing: 0.4px;
      text-transform: uppercase;
      cursor: pointer;
      border: 1.5px solid rgba(255,255,255,0.18);
      border-radius: 7px;
      background: rgba(17, 22, 13, 0.92);
      color: var(--text-secondary);
      backdrop-filter: blur(8px);
      box-shadow: 0 2px 10px rgba(0,0,0,0.45);
      transition: background 0.15s, color 0.15s, border-color 0.15s;
      min-width: 34px;
    }
    .unit-btn:hover {
      background: var(--forest);
      color: #fff;
      border-color: var(--accent-dim);
    }
    .unit-btn.active {
      background: var(--forest);
      color: #fff;
      border-color: var(--accent-dim);
    }
    /* Mobile-only single cycling button (init.js keeps its text in sync). */
    #btn-units-mobile { display: none; }

    /* Leaflet default zoom control (+/-) sits at top-left, under the sidebar on desktop.
       Its white rounded edge peeks out past the sidebar's corners — hide it on desktop.
       Restored on mobile where the sidebar is a bottom sheet. */
    .leaflet-top.leaflet-left { display: none; }
    @media (max-width: 768px) {
      .leaflet-top.leaflet-left { display: block; }
    }

    /* Sidebar */
    #sidebar {
      position: fixed;
      top: calc(70px + 12px);
      left: 12px;
      width: 310px;
      max-height: calc(100vh - 70px - 24px);
      overflow: hidden;
      z-index: 500;
      background: rgba(17, 22, 13, 0.97);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border-radius: 12px;
      border: 1px solid var(--border);
      box-shadow: var(--shadow-lg);
      display: flex;
      flex-direction: column;
      isolation: isolate; /* clips backdrop-filter to border-radius (fixes white corner leak) */
    }

    /* Tab bar — never scrolls */
    .sb-tabs {
      display: flex;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    .sb-tab {
      flex: 1;
      padding: 0.6rem 0.5rem;
      font-size: 0.72rem;
      font-weight: 700;
      text-align: center;
      cursor: pointer;
      color: var(--text-secondary);
      border: none;
      background: transparent;
      transition: color 0.15s;
      border-bottom: 2.5px solid transparent;
      margin-bottom: -1px;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }
    .sb-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
    .sb-tab:hover:not(.active) { color: var(--text-primary); }

    /* Tab panes */
    .tab-pane { display: none; }
    .tab-pane.active { display: block; }

    /* Tools empty state */
    #tools-empty {
      padding: 2rem 1rem 1.5rem;
      text-align: center;
      color: var(--text-muted);
      font-size: 0.78rem;
      line-height: 1.65;
    }
    #tools-empty .tei { font-size: 1.8rem; margin-bottom: 0.5rem; }

    #sidebar-inner {
      overflow-y: auto;
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      /* Hide scrollbar — all browsers */
      scrollbar-width: none;
      -ms-overflow-style: none;
    }
    #sidebar-inner::-webkit-scrollbar { display: none; }

    .sb-section {
      padding: 0.75rem 0.85rem;
      border-bottom: 2px solid rgba(255,255,255,0.18);
    }
    .sb-section:last-child { border-bottom: none; }
    /* Tools-tab sections use an even more prominent separator */
    #tab-tools .sb-section {
      border-bottom: 3px solid rgba(255,255,255,0.22);
    }
    #tab-tools .sb-section:last-child { border-bottom: none; }
    /* Fuel legend rows — tighter vertical rhythm */
    .fuel-legend-row { padding: 0 !important; line-height: 1.2; }
    .fuel-legend-row + .fuel-legend-row { margin-top: 0.05rem; }

    .sb-title {
      font-size: 0.68rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-secondary);
      margin-bottom: 0.35rem;
    }

    /* Point input rows */
    .point-row {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      margin-bottom: 0.3rem;
    }

    .point-dot {
      width: 24px; height: 24px;
      border-radius: 50%;
      flex-shrink: 0;
      font-size: 0.65rem;
      font-weight: 700;
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .point-dot.a { background: var(--forest); }
    .point-dot.b { background: rgb(180, 90, 40); }

    .input-wrap {
      position: relative;
      flex: 1;
    }

    .input-wrap input {
      width: 100%;
      padding: 0.3rem 0.55rem;
      border: 1px solid var(--border);
      border-radius: 6px;
      font-size: 0.83rem;
      outline: none;
      transition: border-color 0.15s, box-shadow 0.15s;
      background: var(--bg-input);
      color: var(--text-primary);
    }
    .input-wrap input::placeholder { color: rgb(60, 60, 75); }
    .input-wrap input:focus,
    .input-wrap input.has-value {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(0,122,255,0.12);
    }

    /* Autocomplete Dropdown */
    .ac-dropdown {
      position: absolute;
      top: calc(100% + 3px);
      left: 0; right: 0;
      background: var(--bg-elevated);
      border: 1px solid var(--border-focus);
      border-radius: 6px;
      list-style: none;
      z-index: 1000;
      max-height: 190px;
      overflow-y: auto;
      box-shadow: var(--shadow-lg);
      display: none;
    }
    .ac-dropdown.open { display: block; }
    .ac-dropdown li {
      padding: 0.48rem 0.65rem;
      font-size: 0.8rem;
      cursor: pointer;
      border-bottom: 1px solid var(--border);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      color: var(--text-primary);
      transition: background 0.1s;
    }
    .ac-dropdown li:last-child { border-bottom: none; }
    .ac-dropdown li:hover,
    .ac-dropdown li.highlighted { background: var(--accent-dim); }

    .pick-btn {
      padding: 0.3rem 0.42rem;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--bg-input);
      cursor: pointer;
      font-size: 0.78rem;
      color: var(--text-secondary);
      transition: all 0.12s;
      flex-shrink: 0;
      line-height: 1;
    }
    .pick-btn:hover, .pick-btn.active {
      background: var(--accent-dim);
      border-color: var(--accent);
      color: var(--accent);
    }

    .rm-btn {
      padding: 0.3rem 0.42rem;
      border: 1px solid transparent;
      border-radius: 6px;
      background: transparent;
      cursor: pointer;
      font-size: 0.82rem;
      color: var(--text-muted);
      transition: all 0.12s;
      flex-shrink: 0;
      line-height: 1;
    }
    .rm-btn:hover { color: var(--error); border-color: rgba(220,80,60,0.3); background: rgba(220,80,60,0.08); }

    #add-wp-btn {
      width: 100%;
      padding: 0.28rem;
      background: transparent;
      border: 1px dashed var(--border);
      border-radius: 6px;
      color: var(--text-muted);
      font-size: 0.78rem;
      cursor: pointer;
      transition: all 0.12s;
    }
    #add-wp-btn { margin-bottom: 0.2rem; }
    #add-wp-btn:hover { border-color: var(--accent); color: var(--accent); }
    #add-wp-btn:disabled { opacity: 0.3; cursor: default; }

    /* Buttons */
    #calc-btn {
      width: 100%;
      padding: 0.5rem;
      background: var(--grad-accent);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      box-shadow: 0 2px 12px rgba(212,128,46,0.3);
    }
    #calc-btn:hover:not(:disabled) {
      filter: brightness(1.1);
      box-shadow: 0 4px 20px rgba(212,128,46,0.5);
      transform: translateY(-1px);
    }
    #calc-btn:disabled { opacity: 0.35; cursor: not-allowed; }

    #reset-btn {
      width: 100%;
      margin-top: 0.3rem;
      padding: 0.5rem;
      background: rgba(220, 38, 38, 0.05);
      color: var(--text-secondary);
      border: 1px solid rgba(220, 38, 38, 0.18);
      border-radius: 8px;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
      box-shadow: 0 2px 10px rgba(220, 38, 38, 0.08);
    }
    #reset-btn:hover {
      background: rgba(220, 38, 38, 0.1);
      border-color: rgba(220, 38, 38, 0.4);
      color: #f87171;
      box-shadow: 0 4px 18px rgba(220, 38, 38, 0.22);
      transform: translateY(-1px);
    }

    /* Results */
    #result-section { display: none; }
    #result-section.visible { display: block; }

    .results-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 0.35rem;
      position: relative;
    }
    .results-header .sb-title { margin-bottom: 0; }
    #diff-stat {
      display: none;
      align-items: center;
      gap: 0.3rem;
    }
    #r-diff-badge {
      font-size: 0.68rem;
      font-weight: 700;
      letter-spacing: 0.3px;
      padding: 0.1rem 0.55rem;
      border-radius: 20px;
    }
    .stats-row {
      display: flex;
      justify-content: space-between;
      margin-bottom: 0.35rem;
    }
    #diff-popover {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      width: 180px;
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: 7px;
      padding: 0.5rem 0.6rem;
      font-size: 0.62rem;
      color: var(--text-secondary);
      line-height: 1.5;
      box-shadow: 0 4px 16px rgba(0,0,0,0.35);
      z-index: 99;
    }
    #diff-popover.open { display: block; }
    .diff-info-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      border: 1.5px solid var(--text-muted);
      font-size: 0.55rem;
      font-weight: 700;
      color: var(--text-muted);
      cursor: pointer;
      line-height: 1;
      flex-shrink: 0;
      vertical-align: middle;
      margin-left: 2px;
    }
    .stat { text-align: center; }
    .stat-num { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
    .stat-num.accent { background: var(--grad-accent); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
    .stat-num.accent.lg { font-size: 1.55rem; line-height: 1.1; }
    .stat-lbl { font-size: 0.62rem; color: var(--text-secondary); margin-top: 0.05rem; }

    .offroad-bar {
      height: 4px;
      background: var(--border);
      border-radius: 3px;
      overflow: hidden;
      margin: 0.25rem 0 0.1rem;
    }
    .offroad-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--forest), var(--accent));
      border-radius: 3px;
      transition: width 0.6s cubic-bezier(.4,0,.2,1);
    }
    .terrain-comp-bar {
      height: 3px;
      border-radius: 2px;
      overflow: hidden;
      margin-bottom: 0.25rem;
      display: flex;
      opacity: 0.85;
    }
    .terrain-comp-bar span {
      display: block;
      height: 100%;
      transition: width 0.6s cubic-bezier(.4,0,.2,1);
    }

    .terrain-section { margin-top: 0.2rem; }
    .terrain-group { margin-bottom: 0.1rem; }
    .terrain-subs { padding-left: 1.1rem; margin-top: 0.15rem; display: flex; flex-direction: column; gap: 0.1rem; }
    .terrain-sub-item {
      display: flex;
      align-items: center;
      gap: 0.38rem;
      font-size: 0.7rem;
      color: var(--text-muted);
      padding: 0.04rem 0;
    }
    .terrain-sub-item .sub-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; opacity: 0.75; }
    .terrain-sub-item .sub-km { margin-left: auto; font-weight: 600; color: var(--text-secondary); }

    .cat-item {
      display: flex;
      align-items: center;
      gap: 0.42rem;
      font-size: 0.75rem;
      color: var(--text-secondary);
      padding: 0.06rem 0;
    }
    .cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .cat-km { margin-left: auto; font-weight: 600; color: var(--text-primary); }
    .cat-item-combined {
      display: flex;
      gap: 0.6rem;
      font-size: 0.75rem;
      color: var(--text-secondary);
      padding: 0.06rem 0;
    }
    .cat-half {
      display: flex;
      align-items: center;
      gap: 0.42rem;
      flex: 1;
      min-width: 0;
    }
    .cat-half-km { margin-left: auto; font-weight: 600; color: var(--text-primary); white-space: nowrap; }

    /* Tiny slider switch — same visual language as .poi-switch (bg-surface
       track, accent when ON) but scaled down to 22×12px so it fits inline
       with 0.68rem tier text in the "🚿 Fords N" row without growing it. */
    .tiny-switch {
      position: relative;
      display: inline-block;
      width: 22px;
      height: 12px;
      flex-shrink: 0;
    }
    .tiny-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
    .tiny-switch-track {
      position: absolute;
      inset: 0;
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
    }
    .tiny-switch-track::before {
      content: '';
      position: absolute;
      height: 8px;
      width: 8px;
      left: 1px;
      top: 50%;
      transform: translateY(-50%);
      background: var(--text-secondary);
      border-radius: 50%;
      transition: transform 0.15s, background 0.15s;
    }
    .tiny-switch input:checked + .tiny-switch-track {
      background: var(--accent-dim);
      border-color: var(--accent);
    }
    .tiny-switch input:checked + .tiny-switch-track::before {
      transform: translate(10px, -50%);
      background: var(--accent);
    }
    .tiny-switch input:focus-visible + .tiny-switch-track {
      outline: 2px solid var(--accent);
      outline-offset: 1px;
    }

    /* Location button */
    #loc-btn {
      width: 100%;
      padding: 0.5rem;
      border: 1px solid rgba(0, 122, 255, 0.3);
      border-radius: 8px;
      background: rgba(0, 122, 255, 0.07);
      cursor: pointer;
      font-size: 0.85rem;
      font-weight: 700;
      color: #60a5fa;
      transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
      line-height: 1;
      box-shadow: 0 2px 10px rgba(0, 122, 255, 0.12);
    }
    #loc-btn:hover {
      filter: brightness(1.15);
      box-shadow: 0 4px 18px rgba(0, 122, 255, 0.32);
      transform: translateY(-1px);
    }
    #loc-btn.active {
      background: rgba(0, 122, 255, 0.15);
      border-color: rgba(0, 122, 255, 0.5);
      box-shadow: 0 4px 18px rgba(0, 122, 255, 0.32);
    }

    /* Difficulty selector */
    .ride-select {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.35rem;
      margin-bottom: 0.75rem;
    }
    .ride-btn {
      padding: 0.52rem 0.4rem;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: var(--bg-input);
      color: var(--text-secondary);
      font-size: 0.8rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.12s;
      text-align: center;
      letter-spacing: 0.1px;
    }
    .ride-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
    .ride-btn.active.easy     { background: rgba(34,197,94,0.12);  border-color: #22c55e; color: #4ade80; font-weight: 600; }
    .ride-btn.active.moderate { background: rgba(234,179,8,0.12);  border-color: #eab308; color: #facc15; font-weight: 600; }
    .ride-btn.active.hard     { background: rgba(239,68,68,0.12);  border-color: #ef4444; color: #f87171; font-weight: 600; }
    .ride-btn.active.extreme  { background: rgba(80,80,80,0.18);   border-color: #666;    color: #d1d5db; font-weight: 600; }

    /* Compact grade table */
    .grade-table {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 0.28rem 0.6rem;
      font-size: 0.73rem;
      line-height: 1.5;
      padding-top: 0.1rem;
    }
    .grade-table .gt-label { font-weight: 600; color: var(--text-primary); }
    .grade-table .gt-pct   { color: var(--text-muted); }

    /* Rideability badge in results */
    .diff-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-top: 0.5rem;
      padding-top: 0.5rem;
      border-top: 1px solid var(--border);
      flex-wrap: wrap;
    }
    .diff-label {
      font-size: 0.67rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      color: var(--text-secondary);
      white-space: nowrap;
    }
    .diff-badge {
      display: inline-block;
      padding: 0.15rem 0.6rem;
      border-radius: 20px;
      font-size: 0.75rem;
      font-weight: 700;
      letter-spacing: 0.3px;
    }
    .diff-badge.Easy        { background: rgba(34,197,94,0.12);  color: #4ade80; border: 1px solid rgba(34,197,94,0.35); }
    .diff-badge.Moderate    { background: rgba(234,179,8,0.12);  color: #facc15; border: 1px solid rgba(234,179,8,0.35); }
    .diff-badge.Challenging { background: rgba(249,115,22,0.12); color: #fb923c; border: 1px solid rgba(249,115,22,0.35); }
    .diff-badge.Unknown     { background: var(--border);         color: var(--text-secondary); border: 1px solid var(--border); }
    .diff-detail { font-size: 0.71rem; color: var(--text-secondary); }
.diff-subtitle {
      font-size: 0.71rem;
      color: var(--text-muted);
      margin-bottom: 0.75rem;
      line-height: 1.45;
    }

    /* Elevation map markers — kill Leaflet's default white box */
    .elev-marker-icon { background: none !important; border: none !important; box-shadow: none !important; }

    /* Elevation profile */
    #elev-section { display: block; }
    #elev-section.visible { display: block; }
    .elev-stats {
      display: flex;
      justify-content: space-between;
      font-size: 0.68rem;
      color: var(--text-secondary);
      margin-bottom: 0.25rem;
    }
    .elev-stats span strong { color: var(--text-primary); font-size: 0.75rem; }
    #elev-chart {
      width: 100%;
      height: 90px;
      display: block;
      border-radius: 6px;
      overflow: hidden;
    }

    #gpx-btn, #save-btn {
      width: 100%;
      margin-top: 0;
      padding: 0.5rem;
      border: none;
      border-radius: 8px;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      text-align: center;
      text-decoration: none;
      transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
      display: block;
    }
    #gpx-btn {
      background: var(--grad-accent);
      color: white;
      box-shadow: 0 2px 10px rgba(212, 128, 46, 0.28);
    }
    #gpx-btn:hover {
      filter: brightness(1.1);
      box-shadow: 0 4px 18px rgba(212, 128, 46, 0.45);
      transform: translateY(-1px);
      color: white;
    }
    #save-btn {
      background: rgba(48, 100, 60, 0.15);
      color: var(--sage);
      border: 1px solid rgba(48, 100, 60, 0.35) !important;
      box-shadow: none;
    }
    #save-btn:hover {
      background: rgba(48, 100, 60, 0.28);
      color: #a3d9a5;
      border-color: rgba(48, 100, 60, 0.6) !important;
      transform: translateY(-1px);
    }

    /* Fuel range input */
    .fuel-input-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      margin-bottom: 0.3rem;
    }
    .fuel-input-row input[type="number"] {
      width: 68px;
      padding: 0.32rem 0.45rem;
      font-size: 0.82rem;
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: 6px;
      color: var(--text-primary);
      text-align: center;
      flex-shrink: 0;
      -moz-appearance: textfield;
      appearance: textfield;
    }
    .fuel-input-row input[type="number"]::-webkit-inner-spin-button,
    .fuel-input-row input[type="number"]::-webkit-outer-spin-button,
    #rt-km::-webkit-inner-spin-button,
    #rt-km::-webkit-outer-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }
    .fuel-input-row .fuel-unit {
      font-size: 0.78rem;
      color: var(--text-secondary);
    }
    .fuel-check-row {
      display: flex;
      align-items: center;
      gap: 0.42rem;
      font-size: 0.77rem;
      color: var(--text-secondary);
      padding: 0.18rem 0;
      cursor: pointer;
      user-select: none;
    }
    .fuel-check-row input[type="checkbox"] {
      margin-left: auto;
      accent-color: var(--accent);
      cursor: pointer;
      width: 13px;
      height: 13px;
      flex-shrink: 0;
    }
    .fuel-info-btn {
      background: none;
      border: none;
      color: var(--text-secondary);
      font-size: 0.78rem;
      cursor: pointer;
      padding: 0;
      line-height: 1;
    }
    .fuel-info-btn:hover { color: var(--accent); }

    /* Fuel info card (inline, ⓘ triggered) */
    #fuel-info {
      display: none;
      background: rgba(20,26,16,0.97);
      border: 1px solid var(--border);
      border-radius: 9px;
      padding: 0.75rem 0.85rem;
      margin-top: 0.5rem;
      font-size: 0.74rem;
      color: var(--text-secondary);
      line-height: 1.55;
    }
    #fuel-info.open { display: block; }
    #fuel-info p { margin: 0 0 0.4rem; }
    #fuel-info p:last-child { margin-bottom: 0; }

    /* Backend status */
    #backend-status {
      font-size: 0.7rem;
      padding: 0.35rem 0.65rem;
      border-radius: 5px;
      margin-bottom: 0.5rem;
      display: none;
    }
    #backend-status.ok  { background: rgba(48,100,60,0.15); color: var(--sage);  border: 1px solid rgba(48,100,60,0.3); display:block; }
    #backend-status.err { background: rgba(180,60,40,0.12); color: #d4614a; border: 1px solid rgba(180,60,40,0.3); display:block; }

    /* Loading Overlay */
    #map-loading {
      position: fixed;
      top: 70px; left: 0; right: 0; bottom: 0;
      background: rgba(11, 14, 9, 0.82);
      backdrop-filter: blur(5px);
      z-index: 400;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 1rem;
    }
    #map-loading.visible { display: flex; }

    /* Round 14 round 4 (2026-04-29) — small inline spinner used during
       recalcs / splices instead of the blocking full-screen #map-loading
       overlay. Lives in the fuel-section button + (later) other tool
       sections that fire background recalcs. Show via JS by setting
       display:inline-block on #auto-fuel-spinner (etc.). */
    .route-busy-spinner {
      display: inline-block;
      width: 14px; height: 14px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: gora-spin 0.8s linear infinite;
      vertical-align: middle;
      flex-shrink: 0;
    }
    @keyframes gora-spin {
      to { transform: rotate(360deg); }
    }
    .spin-logo {
      width: 220px; height: auto;
    }
    #map-loading p { color: var(--text-secondary); font-size: 0.92rem; text-align: center; }
    #loading-queue {
      font-size: 0.78rem;
      color: var(--accent);
      text-align: center;
      min-height: 1.1rem;
      margin-top: -0.4rem;
    }
    #loading-timer { font-size: 0.8rem; color: var(--text-secondary); margin-top: -0.5rem; }
    #cancel-btn {
      margin-top: 0.5rem;
      padding: 0.45rem 1.2rem;
      background: transparent;
      border: 1px solid var(--border);
      border-radius: 7px;
      color: var(--text-secondary);
      font-size: 0.85rem;
      cursor: pointer;
      transition: all 0.15s;
    }
    #cancel-btn:hover {
      border-color: var(--error);
      color: var(--error);
    }

    .navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; }
    .tier-breakdown { font-size: 0.68rem; color: var(--text-secondary); margin: 0.4rem 0 0; line-height: 1.8; }
    .tier-breakdown span { margin-right: 0.5rem; }

    /* ── Mobile bottom-sheet sidebar ── */
    .sidebar-drag-handle {
      display: none;
      height: 28px;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
    }
    .sidebar-drag-handle::before {
      content: '';
      display: block;
      width: 36px; height: 4px;
      background: rgba(255, 255, 255, 0.18);
      border-radius: 2px;
    }

    #sidebar-toggle-btn { display: none; }
    #sidebar-backdrop   { display: none; }

    @media (max-width: 768px) {
      #sidebar {
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0;
        width: 100% !important;
        max-height: 80vh;
        border-radius: 16px 16px 0 0 !important;
        border-left: none;
        border-right: none;
        border-bottom: none !important;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 600;
        /* keep overflow hidden for the border-radius clip */
      }
      #sidebar.mobile-open {
        transform: translateY(0);
      }
      #sidebar-inner {
        max-height: calc(80vh - 30px);
        border-radius: 0;
        padding-bottom: 2rem;
      }
      .sidebar-drag-handle { display: flex; }

      #sidebar-toggle-btn {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        position: fixed;
        bottom: 1.5rem;
        left: 50%;
        transform: translateX(-50%);
        z-index: 550;
        background: var(--grad-accent);
        color: white;
        border: none;
        border-radius: 50px;
        padding: 0.78rem 1.6rem;
        font-size: 0.9rem;
        font-weight: 700;
        cursor: pointer;
        box-shadow: 0 4px 22px rgba(212, 128, 46, 0.52);
        transition: opacity 0.2s, box-shadow 0.2s, transform 0.2s;
        white-space: nowrap;
      }
      #sidebar-toggle-btn:hover {
        box-shadow: 0 6px 28px rgba(212, 128, 46, 0.65);
      }
      #sidebar-toggle-btn.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateX(-50%) translateY(8px);
      }

      /* Backdrop overlay — tap outside to close */
      #sidebar-backdrop {
        display: block;
        visibility: hidden;
        position: fixed;
        top: 70px; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 580;
        opacity: 0;
        transition: opacity 0.3s;
      }
      #sidebar-backdrop.visible {
        visibility: visible;
        opacity: 1;
      }

      /* Mobile: single emoji button, desktop buttons hidden */
      #layer-toggle {
        top: 80px;
        right: 0.75rem;
        bottom: unset;
      }
      #layer-btns-desktop { display: none; }
      /* Mobile: layer toggle moves to top-right, so units toggle claims the
         bottom-right slot alone (no stacking offset needed). */
      #units-toggle {
        bottom: 0.75rem;
        right: 0.75rem;
      }
      /* Mobile: hide the two-pill desktop toggle, show the single cycling button. */
      #btn-units-km, #btn-units-mi { display: none; }
      #btn-units-mobile {
        display: inline-block;
        padding: 8px 14px;
        font-size: 0.75rem;
        min-width: 44px;
      }
      #btn-layer {
        display: block;
        padding: 7px 10px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        border: 1.5px solid rgba(255,255,255,0.18);
        border-radius: 8px;
        background: rgba(17, 22, 13, 0.92);
        color: var(--text-secondary);
        backdrop-filter: blur(8px);
        box-shadow: 0 2px 10px rgba(0,0,0,0.45);
      }

      /* iOS Safari zooms into any input with font-size < 16px and then stays
         zoomed. Override every input rule in this file here so there is no
         cascade fight — this block is last and wins regardless of specificity. */
      input, select, textarea,
      .input-wrap input,
      .fuel-input-row input[type="number"],
      input[type="number"],
      input[type="text"] {
        font-size: 16px !important;
      }
    }

    /* ── Pick-mode instruction chip ──────────────────────────────────────── */
    #pick-chip {
      position: fixed;
      bottom: 5.2rem;
      left: 50%;
      transform: translateX(-50%) translateY(14px);
      opacity: 0;
      pointer-events: none;
      z-index: 560;
      background: rgba(17, 22, 13, 0.96);
      border: 1px solid var(--border-focus);
      border-radius: 50px;
      padding: 0.55rem 0.75rem 0.55rem 1rem;
      display: flex;
      align-items: center;
      gap: 0.55rem;
      font-size: 0.82rem;
      color: var(--text-primary);
      box-shadow: 0 4px 22px rgba(0,0,0,0.55);
      backdrop-filter: blur(10px);
      white-space: nowrap;
      transition: opacity 0.2s, transform 0.2s;
    }
    #pick-chip.visible {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(-50%) translateY(0);
    }
    #pick-chip-cancel {
      background: rgba(220,38,38,0.12);
      border: 1px solid rgba(220,38,38,0.28);
      border-radius: 20px;
      padding: 0.18rem 0.6rem;
      font-size: 0.75rem;
      color: #f87171;
      cursor: pointer;
      transition: background 0.15s;
    }
    #pick-chip-cancel:hover { background: rgba(220,38,38,0.22); }

    /* ── Long-press ripple ───────────────────────────────────────────────── */
    #longpress-ripple {
      position: fixed;
      width: 56px; height: 56px;
      border-radius: 50%;
      border: 2.5px solid var(--accent);
      background: rgba(212,128,46,0.14);
      pointer-events: none;
      z-index: 710;
      transform: translate(-50%, -50%) scale(0);
      opacity: 0;
    }
    #longpress-ripple.animate {
      animation: lp-pop 0.5s ease-out forwards;
    }
    @keyframes lp-pop {
      0%   { transform: translate(-50%,-50%) scale(0);   opacity: 1; }
      55%  { transform: translate(-50%,-50%) scale(1.1); opacity: 0.85; }
      100% { transform: translate(-50%,-50%) scale(1.9); opacity: 0; }
    }

    /* ── Roundtrip mode toggle ───────────────────────────────────────────── */
    .mode-toggle {
      display: flex;
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      overflow: hidden;
      margin-bottom: 0.75rem;
    }
    .mode-toggle button {
      flex: 1;
      padding: 0.45rem 0.5rem;
      background: none;
      border: none;
      border-radius: 0;
      color: var(--text-secondary);
      font-size: 0.82rem;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }
    .mode-toggle button.active {
      background: var(--accent);
      color: #fff;
    }
    /* ── POI toggle sliders (Near Start/End + Near Day Marker) ───────────── */
    .poi-toggle-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      margin-bottom: 0.35rem;
    }
    .poi-toggle-label {
      font-size: 0.82rem;
      color: var(--text-secondary);
      font-weight: 500;
      cursor: pointer;
      user-select: none;
      flex: 1;
    }
    .poi-switch {
      position: relative;
      display: inline-block;
      width: 34px;
      height: 18px;
      flex-shrink: 0;
    }
    .poi-switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    .poi-switch-slider {
      position: absolute;
      cursor: pointer;
      top: 0; left: 0; right: 0; bottom: 0;
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 18px;
      transition: background 0.15s, border-color 0.15s;
    }
    .poi-switch-slider::before {
      content: "";
      position: absolute;
      height: 12px;
      width: 12px;
      left: 2px;
      top: 50%;
      transform: translateY(-50%);
      background: var(--text-secondary);
      border-radius: 50%;
      transition: transform 0.15s, background 0.15s;
    }
    .poi-switch input:checked + .poi-switch-slider {
      background: var(--accent-dim);
      border-color: var(--accent);
    }
    .poi-switch input:checked + .poi-switch-slider::before {
      transform: translate(16px, -50%);
      background: var(--accent);
    }
    /* ── Roundtrip panel ─────────────────────────────────────────────────── */
    #rt-panel { display: none; }
    #rt-panel .rt-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.55rem;
    }
    #rt-panel label {
      font-size: 0.78rem;
      color: var(--text-secondary);
      width: 70px;
      flex-shrink: 0;
    }
    #rt-panel input[type=number] {
      flex: 1;
      padding: 0.38rem 0.6rem;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: var(--bg-surface);
      color: var(--text-primary);
      font-size: 0.9rem;
    }
    .dir-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.3rem;
      margin-top: 0.25rem;
    }
    .dir-grid button {
      padding: 0.38rem 0;
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 7px;
      color: var(--text-secondary);
      font-size: 0.82rem;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s, color 0.15s, border-color 0.15s;
    }
    .dir-grid button.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }
    .dir-grid .dir-center {
      background: none;
      border: none;
      font-size: 1.1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: default;
      pointer-events: none;
    }
    #rt-loc-btn {
      width: 100%;
      padding: 0.5rem;
      border: 1px solid rgba(0, 122, 255, 0.3);
      border-radius: 8px;
      background: rgba(0, 122, 255, 0.07);
      cursor: pointer;
      font-size: 0.85rem;
      font-weight: 700;
      color: #60a5fa;
      transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
      line-height: 1;
      box-shadow: 0 2px 10px rgba(0, 122, 255, 0.12);
      margin-bottom: 0.55rem;
    }
    #rt-loc-btn:hover {
      filter: brightness(1.15);
      box-shadow: 0 4px 18px rgba(0, 122, 255, 0.32);
      transform: translateY(-1px);
    }
    #rt-calc-btn {
      width: 100%;
      margin-top: 0.75rem;
      padding: 0.5rem;
      background: var(--grad-accent);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      box-shadow: 0 2px 12px rgba(212,128,46,0.3);
    }
    #rt-calc-btn:hover:not(:disabled) {
      filter: brightness(1.1);
      box-shadow: 0 4px 20px rgba(212,128,46,0.5);
      transform: translateY(-1px);
    }
    #rt-calc-btn:disabled { opacity: 0.35; cursor: not-allowed; }
    #rt-reset-btn {
      width: 100%;
      margin-top: 0.3rem;
      padding: 0.5rem;
      background: rgba(220, 38, 38, 0.05);
      color: var(--text-secondary);
      border: 1px solid rgba(220, 38, 38, 0.18);
      border-radius: 8px;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
      box-shadow: 0 2px 10px rgba(220, 38, 38, 0.08);
    }
    #rt-reset-btn:hover {
      background: rgba(220, 38, 38, 0.1);
      border-color: rgba(220, 38, 38, 0.4);
      color: #f87171;
      box-shadow: 0 4px 18px rgba(220, 38, 38, 0.22);
      transform: translateY(-1px);
    }

    /* ── FAB "ready to calculate" pulse ─────────────────────────────────── */
    @keyframes fab-pulse {
      0%, 100% { box-shadow: 0 4px 22px rgba(212,128,46,0.52); }
      50%       { box-shadow: 0 6px 32px rgba(212,128,46,0.88); }
    }
    @media (max-width: 768px) {
      #sidebar-toggle-btn.fab-ready {
        animation: fab-pulse 2s ease-in-out infinite;
      }
    }

    /* ── Waypoint drag-to-reorder (long-press 400ms on any dot) ────────── */
    /* touch-action:none prevents browser scroll hijacking the long-press on
       touch devices — dot is a 24px target, scroll from any other element. */
    .point-dot.wp-dot-draggable { touch-action: none; }
    /* Empty-slot dot (Felix 2026-04-28 round 6): row exists in DOM but no
       waypoint has been chosen yet. Faded so it reads as a placeholder + the
       "+" glyph signals "fill me". */
    .point-dot.empty-slot {
      opacity: 0.45;
      font-weight: 500;
      background: var(--bg-surface, #1a2628) !important;
      color: var(--text-secondary, #9aa6a3);
      border: 1px dashed var(--border, #2a3a3d);
    }
    .point-row.wp-dragging { opacity: 0.4; }
    .wp-drop-indicator {
      height: 2px;
      background: var(--accent, #2bc48a);
      margin: 2px 0;
      border-radius: 1px;
      pointer-events: none;
    }
    body.wp-drag-active {
      user-select: none;
      -webkit-user-select: none;
      cursor: grabbing;
    }

/* ── GPX Upload Feature (Phase 1, locked 2026-04-27) ─────────────────────── */
/* Subtle link above the Start waypoint input — discoverable but not pushy. */
.upload-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.45rem 0.7rem;
  margin: 0 0 0.5rem;
  background: rgba(43, 196, 138, 0.06);
  border: 1px dashed rgba(43, 196, 138, 0.35);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  text-align: left;
}
.upload-link:hover {
  background: rgba(43, 196, 138, 0.12);
  border-color: var(--accent, #2bc48a);
  color: var(--text-primary);
}
.upload-link-action {
  font-weight: 700;
  color: var(--accent, #2bc48a);
}

/* Upload modal */
.upload-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.upload-modal-card {
  background: #1a1f14;
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 480px;
  width: 100%;
  padding: 1.4rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  max-height: 92vh;
  overflow-y: auto;
}
.upload-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.upload-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.upload-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}
.upload-modal-close:hover { color: var(--text-primary); }
.upload-modal-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1.6rem 1rem;
  text-align: center;
  background: #0f1409;
  transition: border-color 0.18s, background 0.18s;
  cursor: pointer;
}
.upload-dropzone.dragging {
  border-color: var(--accent, #2bc48a);
  background: rgba(43, 196, 138, 0.08);
}
.upload-dropzone.loading {
  opacity: 0.6;
  pointer-events: none;
}
.upload-dropzone-icon { font-size: 1.8rem; margin-bottom: 0.5rem; }
.upload-dropzone-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.upload-dropzone-or {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0.4rem 0;
}
.upload-browse-btn {
  background: var(--grad-accent, #2bc48a);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.upload-browse-btn:hover { filter: brightness(1.1); }
.upload-status {
  margin-top: 0.85rem;
  min-height: 1.1em;
  font-size: 0.78rem;
  text-align: center;
  color: var(--text-muted);
}
.upload-status.info  { color: var(--text-secondary); }
.upload-status.error { color: #ff6b6b; }
.upload-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.upload-modal-formats {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.upload-modal-formats code {
  background: rgba(255, 255, 255, 0.07);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  margin: 0 0.1rem;
}
.upload-cancel-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.upload-cancel-btn:hover { border-color: var(--accent, #2bc48a); color: var(--text-primary); }

/* ── Track List Sidebar (Phase 2 — multi-track GPX support, 2026-04-28) ── */
/* Appears as a new sb-section above #ab-panel after a multi-track upload.
   Each item is one <trk> from the GPX file (e.g. TET sections). Clicking
   loads that section as the active route via /section/{index} endpoint. */
#track-list-panel .track-list-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}
#track-list-panel .track-list-filename {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#track-list-panel .track-list-summary {
  font-size: 0.72rem;
  color: var(--text-muted);
}
#track-list-panel .track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}
#track-list-panel .track-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s, color 0.15s;
}
#track-list-panel .track-list-item:last-child { border-bottom: none; }
#track-list-panel .track-list-item:hover {
  background: rgba(43, 196, 138, 0.08);
}
#track-list-panel .track-list-item.active {
  background: rgba(43, 196, 138, 0.18);
  color: var(--accent, #2bc48a);
  font-weight: 700;
  border-left: 3px solid var(--accent, #2bc48a);
  padding-left: calc(0.7rem - 3px);
}
#track-list-panel .track-list-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#track-list-panel .track-list-km {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
#track-list-panel .track-list-item.active .track-list-km {
  color: var(--accent, #2bc48a);
}
#track-list-panel .track-list-hint {
  margin: 0.6rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.45;
}
/* GPX-edit v1: multi-select checkbox row inside #track-list-panel.
   The <label class="track-list-row"> wraps the checkbox + name + km so the
   whole row is the click target. */
#track-list-panel .track-list-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  cursor: pointer;
  user-select: none;
}
#track-list-panel .track-list-cb {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--accent, #2bc48a);
}
#track-list-panel .track-list-cb:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}
#track-list-panel .track-list-cb:disabled + .track-list-name,
#track-list-panel .track-list-cb:disabled ~ .track-list-km {
  opacity: 0.45;
}
#track-list-panel .track-list-cb:checked ~ .track-list-name {
  color: var(--accent, #2bc48a);
  font-weight: 600;
}
#track-list-panel .track-list-item.single { cursor: default; }
#track-list-panel #track-use-btn {
  margin-top: 0.7rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--accent, #2bc48a);
  color: #06180f;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s, transform 0.06s;
}
#track-list-panel #track-use-btn:hover:not(:disabled) {
  background: #3ed0a3;
}
#track-list-panel #track-use-btn:active:not(:disabled) {
  transform: scale(0.98);
}
#track-list-panel #track-use-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
/* Eraser controls (Felix 2026-04-28 round 8) — sit in their own sb-section
   directly under Calculate/Reset. Match the same width / padding / font as
   #calc-btn + #reset-btn so the row reads as primary route actions. */
#erase-section { display: flex; flex-direction: column; gap: 0.3rem; }
#erase-btn {
  width: 100%;
  padding: 0.5rem;
  background: rgba(220, 38, 38, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s, transform 0.1s, background 0.15s, color 0.15s, border-color 0.15s;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.08);
}
#erase-btn:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.4);
  color: #f87171;
  box-shadow: 0 4px 18px rgba(220, 38, 38, 0.22);
  transform: translateY(-1px);
}
#erase-btn.active {
  background: #dc3c3c;
  color: #fff;
  border-color: #dc3c3c;
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.45);
}
#erase-btn:disabled { opacity: 0.35; cursor: not-allowed; }

#erase-undo-btn {
  width: 100%;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s, transform 0.1s, color 0.15s, border-color 0.15s;
}
#erase-undo-btn:hover {
  color: var(--accent, #2bc48a);
  border-color: var(--accent, #2bc48a);
  transform: translateY(-1px);
}
/* While erase mode is active, map cursor becomes a crosshair so the brush
   circle (rendered in Leaflet on top) is the obvious target. */
body.erase-mode-active #map,
body.erase-mode-active .leaflet-container {
  cursor: crosshair !important;
}

/* "Try GoraAdv routing" button — shown only when backbone is active. Styled
   subtle (secondary), not the primary CTA — Calculate stays primary. */
#try-goraadv-btn {
  margin-top: 0.4rem;
  width: 100%;
  padding: 0.5rem 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
#try-goraadv-btn:hover {
  color: var(--accent, #2bc48a);
  border-color: var(--accent, #2bc48a);
  background: rgba(43, 196, 138, 0.06);
}
