
  /* Form fields include their padding in their width, as they did in quirks mode (pages had no doctype). */
  :where(input:not([type=image]), textarea) { box-sizing: border-box; }

  /* ── Inter (self-hosted: CSP font-src is 'self') ─────────────────────────
     Variable weight, split by script; the browser fetches only the subsets a page
     uses. Cyrillic for Ukrainian, latin-ext for Polish/Lithuanian/… place names. */
  @font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900;
    src: url(/lib/fonts/inter/inter-cyrillic-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
  @font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900;
    src: url(/lib/fonts/inter/inter-latin-ext-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
  @font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900;
    src: url(/lib/fonts/inter/inter-latin-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

  /* ── Design tokens ─────────────────────────────────────────────────────────
     Light values on :root; dark values apply automatically via prefers-color-scheme
     (unless the user forced light) and explicitly via [data-theme='dark'] (the toggle
     in the footer, persisted in localStorage).
     Palette: Ukrainian blue (--brand) is the primary colour, yellow (--ua-yellow) is the
     accent reserved for what must stand out — the army fundraisers above all. */
  :root {
    color-scheme: light;
    --bg:#fff; --surface:#f1f3f7; --surface-2:#fafbfc; --surface-3:#f6f7f9; --surface-blue:#f2f6fc;
    --text:#0f172a; --text-muted:#5b6474; --text-subtle:#626c7d; --text-soft:#626c7d;
    --border:#d5dae3; --border-light:#e7eaf0; --border-faint:#eef0f4; --border-mid:#dde2ea;
    --btn-primary-bg:#0057b7; --btn-secondary-text:#334155; --menu-bg:#fff; --menu-hover:#f1f3f7;
    --info-bg:#e6eef8; --info-border:#b9cde8; --info-text:#0f3e78;
    --repair-bg:#f2f6fc; --repair-border:#d6e3f5; --repair-text:#0f3e78; --repair-title:#0057b7;
    --ok-bg:#f0fdf4; --ok-border:#bbf7d0; --ok-text:#166534; --ok-strong:#1a7f4b;
    --err-bg:#fef2f2; --err-border:#fecaca; --err-text:#991b1b; --badge-bg:#fdecea; --badge-text:#a32d2d;
    --row-warn-bg:#fdf5e4; --row-strava-bg:#fde8df; --seg-highlight-bg:#fef9c3;
    --accent-strava:#fc4c02; --accent-amber:#9f580a; --accent-blue:#0057b7; --on-accent-blue:#fff; --accent-purple:#7c3aed;
    --warn-text:#b45309;
    --brand:#0057b7; --brand-hover:#004a9c; --brand-soft:#e6eef8;
    --ua-yellow:#ffd500; --ua-yellow-ink:#1f1a00; --ua-yellow-soft:#fff4b8;
    --st-visited:#0057b7; --st-review:#ffd500; --st-review-text:#6b5800; --st-review-soft:#fff4b8; --st-unvisited:#e2e6ed;
    --radius:10px; --radius-lg:16px;
  }
  [data-theme='dark'] {
    color-scheme: dark;
    --bg:#0e1420; --surface:#161e2c; --surface-2:#121a27; --surface-3:#121a27; --surface-blue:#161e2c;
    --text:#e6eaf2; --text-muted:#9aa6ba; --text-subtle:#8d99ad; --text-soft:#7d899c;
    --border:#2f3b4f; --border-light:#2a3547; --border-faint:#222c3c; --border-mid:#2f3b4f;
    --btn-primary-bg:#1f6fd1; --btn-secondary-text:#c3cbd8; --menu-bg:#161e2c; --menu-hover:#1d2738;
    --info-bg:#15294a; --info-border:#234476; --info-text:#9cc6ff;
    --repair-bg:#15294a; --repair-border:#234476; --repair-text:#c6dcfb; --repair-title:#9cc6ff;
    --ok-bg:#0f2a1c; --ok-border:#1f5135; --ok-text:#86efac; --ok-strong:#4ade80;
    --err-bg:#2a1416; --err-border:#5b2327; --err-text:#fca5a5; --badge-bg:#3a1c1c; --badge-text:#fca5a5;
    --row-warn-bg:#2e2510; --row-strava-bg:#2e1c14; --seg-highlight-bg:#3a3411;
    --accent-strava:#fb6a37; --accent-amber:#d99a4e; --accent-blue:#7db4ff; --on-accent-blue:#0b1b33; --accent-purple:#a78bfa;
    --warn-text:#fbbf24;
    --brand:#1f6fd1; --brand-hover:#2a7fe6; --brand-soft:#15294a;
    --ua-yellow:#ffd500; --ua-yellow-ink:#1f1a00; --ua-yellow-soft:#3a3310;
    --st-visited:#3d8bf0; --st-review:#ffd500; --st-review-text:#ffe45c; --st-review-soft:#3a3310; --st-unvisited:#2a3547;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
      color-scheme: dark;
      --bg:#0e1420; --surface:#161e2c; --surface-2:#121a27; --surface-3:#121a27; --surface-blue:#161e2c;
      --text:#e6eaf2; --text-muted:#9aa6ba; --text-subtle:#8d99ad; --text-soft:#7d899c;
      --border:#2f3b4f; --border-light:#2a3547; --border-faint:#222c3c; --border-mid:#2f3b4f;
      --btn-primary-bg:#1f6fd1; --btn-secondary-text:#c3cbd8; --menu-bg:#161e2c; --menu-hover:#1d2738;
      --info-bg:#15294a; --info-border:#234476; --info-text:#9cc6ff;
      --repair-bg:#15294a; --repair-border:#234476; --repair-text:#c6dcfb; --repair-title:#9cc6ff;
      --ok-bg:#0f2a1c; --ok-border:#1f5135; --ok-text:#86efac; --ok-strong:#4ade80;
      --err-bg:#2a1416; --err-border:#5b2327; --err-text:#fca5a5; --badge-bg:#3a1c1c; --badge-text:#fca5a5;
      --row-warn-bg:#2e2510; --row-strava-bg:#2e1c14; --seg-highlight-bg:#3a3411;
      --accent-strava:#fb6a37; --accent-amber:#d99a4e; --accent-blue:#7db4ff; --on-accent-blue:#0b1b33; --accent-purple:#a78bfa;
      --warn-text:#fbbf24;
      --brand:#1f6fd1; --brand-hover:#2a7fe6; --brand-soft:#15294a;
      --ua-yellow:#ffd500; --ua-yellow-ink:#1f1a00; --ua-yellow-soft:#3a3310;
      --st-visited:#3d8bf0; --st-review:#ffd500; --st-review-text:#ffe45c; --st-review-soft:#3a3310; --st-unvisited:#2a3547;
    }
  }
  body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; padding: 32px 24px; max-width: 760px; margin: 0 auto; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
  button, input, select, textarea { font-family: inherit; }
  h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
  h2, h3 { letter-spacing: -0.01em; }
  .sub { font-size: 14px; color: var(--text-muted); margin: 0 0 28px; line-height: 1.5; }
  .slogan { font-size: 14px; font-style: italic; color: var(--accent-blue); margin: -8px 0 4px; }
  .sub-sep { white-space: pre; }
  .sub-link { color: var(--accent-blue); text-decoration: none; white-space: nowrap; font-weight: 500; }
  .sub-link:hover { text-decoration: underline; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .section-label { font-size: 11px; font-weight: 500; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; }
  hr { border: none; border-top: 1px solid var(--border-faint); margin: 20px 0; }
  .mini-progress-track { height: 4px; background: var(--border-faint); border-radius: 2px; overflow: hidden; }
  .mini-progress-fill { height: 100%; width: 35%; background: var(--brand); border-radius: 2px; animation: mini-progress-slide 1.1s ease-in-out infinite; }
  @keyframes mini-progress-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(285%); } }
  @keyframes kpi-spin { to { transform: rotate(360deg); } }
  .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 24px; }
  .kpi { background: var(--surface); border-radius: 8px; padding: 12px 16px; }
  .kpi .val { font-size: 22px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
  .kpi .val.good { color: var(--ok-strong); }
  .kpi .lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
  .drop-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
  .drop-badge { background: var(--badge-bg); color: var(--badge-text); border-radius: 6px; padding: 5px 12px; font-size: 13px; }
  .tip { background: var(--info-bg); border: 1px solid var(--info-border); border-radius: 10px; padding: 14px 18px; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 24px; }
  .tip-text { font-size: 14px; color: var(--info-text); line-height: 1.6; }
  .tip-text a { color: var(--info-text); font-weight: 500; }
  .upload-hero { border: 1px solid var(--border-light); border-radius: 20px; padding: 22px; background: linear-gradient(180deg,var(--bg),var(--surface-2)); box-shadow: 0 12px 30px rgba(15,23,42,0.06); margin-bottom: 24px; }
  .upload-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
  .upload-step { display: flex; gap: 10px; align-items: center; background: var(--surface-blue); border: 1px solid var(--border-light); border-radius: 12px; padding: 10px 12px; color: var(--text-muted); font-size: 13px; line-height: 1.35; }
  .upload-step-num { width: 24px; height: 24px; border-radius: 999px; background: var(--btn-primary-bg); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; font-weight: 600; }
  .upload-error { border: 1px solid var(--err-border); background: var(--err-bg); color: var(--err-text); border-radius: 12px; padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; font-size: 13px; line-height: 1.45; }
  .upload-error[hidden] { display: none; }
  .upload-error strong { display: block; color: var(--err-text); margin-bottom: 2px; }
  .upload-error-icon { width: 22px; height: 22px; border-radius: 999px; background: #dc2626; color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; font-weight: 700; }
  .repair-summary { border: 1px solid var(--repair-border); background: var(--repair-bg); color: var(--repair-text); border-radius: 12px; padding: 14px 16px; margin: 0 0 18px; font-size: 13px; line-height: 1.55; }
  .repair-summary-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--repair-title); margin-bottom: 6px; }
  .repair-summary-list { margin: 0; padding-left: 18px; }
  .redraw-guide { border: 1px solid var(--border-light); background: var(--surface-2); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
  .redraw-guide-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 10px; }
  .redraw-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .redraw-step { border: 1px solid var(--border-light); border-radius: 10px; padding: 9px; background: var(--menu-bg); color: var(--text-muted); font-size: 12px; line-height: 1.35; }
  .redraw-step strong { display: block; color: var(--text); margin-bottom: 2px; }
  .redraw-step.active { border-color: var(--brand); background: var(--repair-bg); color: var(--repair-title); }
  .redraw-step.active strong { color: var(--repair-title); }
  .redraw-summary { border: 1px solid var(--ok-border); background: var(--ok-bg); color: var(--ok-text); border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 13px; line-height: 1.45; }
  .redraw-summary[hidden] { display: none; }
  .reprocess-panel { border: 1px solid var(--border-light); background: var(--surface-2); border-radius: 12px; padding: 16px; margin: 16px 0 24px; }
  .reprocess-panel[hidden] { display: none; }
  .more-fixes-body { padding: 4px 0 14px; }
  .more-fixes-intro { font-size: 13px; color: var(--btn-secondary-text); margin: 0 0 12px; }
  .more-fixes-group { padding: 10px 0; border-top: 1px solid var(--border-faint); }
  .more-fixes-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
  .more-fixes-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 6px; }
  .more-fixes-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-soft); }
  .more-fixes-row select, .more-fixes-row input[type=number] { font-size: 13px; padding: 6px 8px; min-width: 120px; }
  .more-fixes-row input[type=number] { min-width: 80px; width: 90px; }
  .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .submit-hint { font-size: 13px; color: var(--text-subtle); }
  #submit-btn:not(:disabled) + .submit-hint { display: none; }
  /* Bottom action panel on the result page: one row of buttons, wraps when it can't fit. */
  .result-action-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: center; background: var(--surface-3); border: 1px solid var(--border-light); border-radius: 12px; padding: 12px 14px; margin: 20px 0 24px; }
  .result-action-bar .btn-primary, .result-action-bar .btn-secondary, .result-action-bar .btn-strava { padding: 9px 16px; font-size: 13px; white-space: nowrap; }
  /* Download format dropdown (FIT / GPX / TCX) */
  .result-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  .result-header-actions { display: flex; align-items: center; gap: 8px; }
  .result-header-actions .btn-primary, .result-header-actions .btn-strava { padding: 7px 14px; font-size: 13px; white-space: nowrap; }
  .result-header-actions .dl-menu-items { left: auto; right: 0; }
  /* Phone-only pieces of the result page; their rules sit in the max-width: 600px block. */
  .rs-oneline, .seg-more-btn { display: none; }
  @keyframes kpi-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
  .dl-menu { position: relative; display: inline-block; }
  .dl-menu-trigger { display: inline-flex; align-items: center; gap: 6px; }
  .dl-caret { font-size: 11px; line-height: 1; }
  .dl-menu-items { position: absolute; top: calc(100% + 6px); left: 0; min-width: 150px; background: var(--menu-bg); border: 1px solid var(--border-light); border-radius: 10px; box-shadow: 0 10px 28px rgba(15,23,42,.16); padding: 6px; z-index: 1000; display: flex; flex-direction: column; gap: 2px; }
  .dl-menu-items.dl-menu-items-up { top: auto; bottom: calc(100% + 6px); }
  .dl-menu-items[hidden] { display: none; }
  .dl-menu-item { display: block; padding: 9px 12px; border-radius: 7px; font-size: 13px; color: var(--text); text-decoration: none; white-space: nowrap; }
  .dl-menu-item:hover, .dl-menu-item:focus { background: var(--menu-hover); }
  .dl-menu-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
  .progress-wrap { margin-top: 14px; display: none; position: relative; }
  .progress-bar-track { height: 80px; background: #f3f4f6; border-radius: 16px; overflow: hidden; position: relative; }
  .progress-bar-fill { height: 100%; width: 0%; background: transparent; position: relative; transition: width 0.3s ease; }
  .progress-bar-fill::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: var(--brand); border-radius: 2px; }
  #progress-road { position: absolute; bottom: 4px; left: 0; right: 0; pointer-events: none; }
  .progress-bike { position: absolute; bottom: 6px; left: 10%; transition: left 0.3s ease, bottom 0.3s ease; transform: translateX(-50%); pointer-events: none; z-index: 2; }
  @keyframes wheel-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
  .progress-bike .wheel { animation: wheel-spin 0.5s linear infinite; transform-origin: center; transform-box: fill-box; }
  .cyclist-waiting { display: none; }
  .progress-bike.waiting .cyclist-riding { display: none; }
  .progress-bike.waiting .cyclist-waiting { display: block; }
  .progress-bike.ready .wheel { animation: none; }
  @keyframes smoke-rise { 0% { opacity: 0.75; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-13px) scale(2); } }
  @keyframes arm-raise { 0%,100% { transform: rotate(0deg); } 40%,60% { transform: rotate(-18deg); } }
  @keyframes jump-on-bike { 0% { transform: translateX(-50%) translateY(0); } 40% { transform: translateX(-50%) translateY(-14px) rotate(-6deg); } 100% { transform: translateX(-50%) translateY(0) rotate(0deg); } }
  .progress-bike.jumping { animation: jump-on-bike 0.45s ease-out; }
  .progress-bike.waiting .sp1 { animation: smoke-rise 2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
  .progress-bike.waiting .sp2 { animation: smoke-rise 2s ease-out 0.65s infinite; transform-box: fill-box; transform-origin: center; }
  .progress-bike.waiting .sp3 { animation: smoke-rise 2s ease-out 1.3s infinite; transform-box: fill-box; transform-origin: center; }
  .progress-bike.waiting .arm-smoke { animation: arm-raise 2.5s ease-in-out infinite; transform-box: fill-box; transform-origin: 0% 0%; }
  .progress-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
  @keyframes patch-slide { 0%{left:-45%;width:45%} 100%{left:100%;width:45%} }
  .patch-progress-track { height:4px; background:#e5e7eb; border-radius:2px; overflow:hidden; position:relative; width:200px; display:none; }
  .patch-progress-fill { position:absolute; top:0; left:0; height:100%; background:var(--brand); border-radius:2px; animation:patch-slide 1.2s ease-in-out infinite; }
  @keyframes routeScroll { from { background-position: 0 0; } to { background-position: 16px 0; } }
  .auto-route-progress { height:5px; background:#e5e7eb; border-radius:3px; overflow:hidden; margin:4px 0 0; display:none; }
  .auto-route-progress-fill { height:100%; background: repeating-linear-gradient(90deg,#f59e0b 0,#f59e0b 8px,#fcd34d 8px,#fcd34d 16px); background-size:16px 100%; animation: routeScroll 0.6s linear infinite; }
  .wind-chip { background:#f0f9ff; border:1px solid #bae6fd; border-radius:4px; font-size:11px; color:#0369a1; padding:2px 7px; display:inline-flex; gap:4px; align-items:center; margin-top:4px; }
  .btn-primary { background: var(--btn-primary-bg); color: #fff; border: none; border-radius: var(--radius); padding: 11px 20px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
  .btn-primary:hover { background: var(--brand-hover); }
  .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; background: var(--btn-primary-bg); }
  .btn-secondary { background: transparent; color: var(--btn-secondary-text); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 20px; font-size: 14px; font-weight: 500; text-decoration: none; display: inline-block; }
  .btn-secondary:hover { background: var(--menu-hover); }
  .page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
  .page-header-left { display: flex; align-items: center; gap: 10px; }
  .icon-wrap { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-mid); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .lang-toggle { display: flex; gap: 4px; }
  .lang-btn { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border-mid); background: var(--menu-bg); color: var(--btn-secondary-text); cursor: pointer; text-decoration: none; }
  .lang-btn.active { background: var(--btn-primary-bg); color: #fff; border-color: var(--btn-primary-bg); }
  .lang-more { position: relative; }
  .lang-more-btn { font-family: inherit; line-height: inherit; white-space: nowrap; }
  .lang-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 1000; min-width: 160px; display: flex; flex-direction: column; padding: 4px; background: var(--menu-bg); border: 1px solid var(--border-mid); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
  .lang-menu[hidden] { display: none; }
  .lang-item { font-size: 13px; padding: 7px 10px; border-radius: 6px; color: var(--btn-secondary-text); text-decoration: none; white-space: nowrap; }
  .lang-item:hover, .lang-item:focus-visible { background: var(--menu-hover); }
  .lang-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
  .lang-item.active { font-weight: 600; }
  @media (max-width: 600px) { .lang-menu { position: fixed; left: 16px; right: 16px; top: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); min-width: 0; } .lang-item { padding: 12px 14px; font-size: 15px; } }
  .hdr-panel { display: contents; }
  .hdr-btn, .hdr-nav { display: none; }
  .theme-toggle { background: var(--menu-bg); border: 1px solid var(--border-mid); border-radius: 6px; color: var(--text-muted); cursor: pointer; padding: 3px 8px; display: inline-flex; align-items: center; line-height: 1; }
  .theme-toggle:hover { color: var(--text); }
  .success-header { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
  .icon-ok { width: 32px; height: 32px; border-radius: 50%; background: #d4edda; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  label { font-size: 13px; color: var(--text-muted); display: block; margin-bottom: 6px; }
  .field { margin-bottom: 20px; }
  input[type=text] { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: 14px; outline: none; background: var(--bg); color: var(--text); }
  input[type=text]:focus { border-color: var(--text-soft); }
  /* Base select: one look everywhere (as input[type=text], at the filter-bar control height). Compact
     contexts below override padding / height on purpose. */
  select { border: 1px solid var(--border); border-radius: var(--radius); padding: 0 8px; height: 36px; box-sizing: border-box; font-family: inherit; font-size: 14px; background-color: var(--bg); color: var(--text); }
  select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
  input[type=text]:focus-visible, input[type=number]:focus-visible, .picker-coord-input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
  input[type=number] { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: 14px; outline: none; width: 100px; background: var(--bg); color: var(--text); }
  input[type=number]:focus { border-color: var(--text-soft); }
  .threshold-row { display: flex; align-items: center; gap: 10px; }
  .threshold-unit { font-size: 14px; color: var(--text-muted); }
  .threshold-hint { font-size: 12px; color: var(--text-soft); }
  .upload-area { border: 1.5px dashed var(--border); border-radius: 14px; padding: 24px; text-align: center; cursor: pointer; background: var(--surface-2); transition: background 0.15s; }
  .upload-area:hover { background: var(--menu-hover); }
  .file-hint { font-size: 12px; color: var(--text-subtle); margin-top: 6px; }
  /* File-upload drop-zone + Get-corrupted-activity-from-Strava CTA, side by side. */
  .upload-row { display: flex; align-items: stretch; gap: 12px; }
  .upload-row .upload-area { flex: 1; min-width: 0; }
  .strava-fix-cta-btn { flex: 0 0 200px; display: flex; align-items: center; justify-content: center; text-align: center; white-space: normal; }
  .captcha-row { display: flex; align-items: center; gap: 10px; }
  .captcha-q { font-size: 15px; font-weight: 500; background: var(--surface); border: 1px solid var(--border-mid); border-radius: 8px; padding: 8px 14px; white-space: nowrap; }
  .captcha-row input { max-width: 80px; }
  .err { font-size: 13px; color: #c0392b; margin-top: 6px; display: none; }
  #file-name { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--info-text); display: none; overflow-wrap: anywhere; }
  .upload-change { display: none; margin-top: 4px; font-size: 12px; color: var(--accent-blue); text-decoration: underline; }
  .upload-area.has-file .upload-click, .upload-area.has-file .file-hint { display: none; }
  .upload-area.has-file #file-name { margin-top: 0; font-size: 15px; font-weight: 600; }
  .upload-area.has-file .upload-change { display: block; }
  .only-touch { display: none; }
  @media (pointer: coarse) { .only-fine { display: none; } .only-touch { display: inline; } }
  table { border-collapse: collapse; width: 100%; margin-top: 10px; font-size: 0.9em; }
  th, td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
  th { background: var(--menu-hover); }
  tr:nth-child(even) { background: var(--surface-2); }
  tr[data-seg] { cursor: pointer; }
  tr[data-seg].seg-highlight { background: var(--seg-highlight-bg) !important; }
  .stat-kpi { display: inline-block; background:var(--surface); border:1px solid var(--border-mid); border-radius:6px; padding:12px 24px; margin:6px; text-align:center; }
  .stat-kpi .val { font-size:2em; font-weight:bold; }
  .stat-kpi .lbl { font-size:0.8em; color:var(--text-muted); }
  /* Fundraiser bar: full-bleed yellow strip at the top of the page. The body is the
     centred column, so the yellow is extended sideways with a clipped box-shadow
     instead of 100vw (which adds a horizontal scrollbar on desktop). */
  .ua-donate-bar { position: relative; margin: -32px 0 24px; padding: 6px 0; background: var(--ua-yellow); color: var(--ua-yellow-ink);
    box-shadow: 0 0 0 100vmax var(--ua-yellow); clip-path: inset(0 -100vmax); }
  .ua-donate-bar .dw-slide { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 12px; min-height: 36px; padding: 0 40px; color: inherit; text-decoration: none; font-size: 14px; line-height: 1.35; text-align: center; }
  .ua-donate-bar .dw-slide.dw-hidden { display: none; }
  .ua-donate-bar .dw-slide:hover .ua-donate-cta { background: #000; }
  .ua-flag { flex: none; width: 20px; height: 14px; border-radius: 2px; background: linear-gradient(#0057b7 50%, #ffd500 50%); box-shadow: 0 0 0 1px var(--ua-yellow-ink); }
  .ua-donate-org { font-weight: 400; }
  .ua-donate-cta { flex: none; background: var(--ua-yellow-ink); color: var(--ua-yellow); border-radius: 999px; padding: 5px 12px; font-weight: 600; white-space: nowrap; }
  .ua-donate-bar .dw-dots { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; gap: 0; }
  .ua-donate-bar .dw-dot { width: 22px; height: 28px; border: none; background: none; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
  .ua-donate-bar .dw-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgba(31,26,0,.3); }
  .ua-donate-bar .dw-dot-active::before { background: var(--ua-yellow-ink); }
  .dw-carousel { position: relative; }
  .dw-hidden { display: none; }
  /* Fundraiser cards near the bottom of the page. */
  .ua-donate-cards { margin: 32px 0 8px; }
  .ua-donate-cards-title { font-size: 13px; font-weight: 600; color: var(--btn-secondary-text); margin: 0 0 10px; }
  .ua-donate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
  .ua-donate-card { display: flex; gap: 12px; align-items: center; background: var(--menu-bg); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 10px; color: var(--text); text-decoration: none; }
  .ua-donate-card:hover { border-color: var(--border); }
  .ua-donate-card img { flex: none; width: 104px; height: 58px; object-fit: cover; border-radius: 8px; background: var(--surface); }
  .ua-donate-card-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; line-height: 1.35; }
  .ua-donate-card-cta { flex: none; background: var(--ua-yellow); color: var(--ua-yellow-ink); border-radius: var(--radius); padding: 10px 14px; font-weight: 600; font-size: 14px; }
  .contact-footer { margin-top: 24px; margin-bottom: 16px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text); }
  .contact-footer a:hover { opacity: 0.65; }
  .footer-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; }
  .footer-nav a { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted, #888); text-decoration: none; padding: 6px 4px; font-size: 13px; }
  .footer-nav a:hover { color: var(--text); opacity: 1; }
  .footer-nav svg { flex: none; }
  .strava-compat-logo { display: flex; justify-content: center; margin-top: 10px; }
  .strava-compat-logo img { display: block; }
  .city-wrap { position: relative; display: inline-block; width: 280px; }
  .city-wrap input[type=text] { width: 100%; box-sizing: border-box; }
  .city-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: var(--menu-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.1); z-index: 100; display: none; max-height: 220px; overflow-y: auto; margin-top: 2px; }
  .city-item { padding: 8px 12px; font-size: 14px; cursor: pointer; }
  .city-item:hover { background: var(--menu-hover); }
  .field-hint { font-size: 12px; color: var(--text-soft); margin-top: 5px; }
  .loop-finish-label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--btn-secondary-text); cursor: pointer; margin-top: 6px; }
  #map { width: 100%; height: 420px; border-radius: 12px; border: 1px solid var(--border-mid); margin-bottom: 8px; }
  .map-fullscreen { position: fixed !important; top: 0; left: 0; width: 100vw !important; height: 100dvh !important; z-index: 9000; border-radius: 0 !important; margin: 0 !important; border: none !important; }
  .map-fs-btn { position: absolute; top: 10px; right: 10px; z-index: 600; background: var(--menu-bg); border: 1px solid var(--border); border-radius: 6px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
  .map-fullscreen .map-fs-btn { z-index: 9001; }
  .map-fs-btn:hover { background: var(--menu-hover); }
  /* Both bottom-left buttons sit above Leaflet's scale control, which covers anything under it. */
  .map-free-redraw-btn { position: absolute; left: 10px; bottom: 56px; z-index: 600; opacity: .12; background: linear-gradient(#005BBB 50%, #FFD500 50%); border: 1px solid #ccc; border-radius: 4px; width: 30px; height: 20px; cursor: pointer; padding: 0; }
  .map-free-redraw-btn:hover { opacity: .35; }
  @media (max-width: 1023px) { .map-free-redraw-btn { display: none; } }
  .map-trim-btn { position: absolute; left: 50px; bottom: 56px; z-index: 600; background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 2px 8px; font-size: 12px; cursor: pointer; }
  @media (max-width: 1023px) { .map-trim-btn { display: none; } }
  .map-hint-banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1200; background: #2563eb; color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 13px; line-height: 1.4; box-shadow: 0 2px 8px rgba(0,0,0,.25); max-width: 92%; text-align: center; pointer-events: none; }
  .redraw-log { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 1200; background: rgba(31,41,55,.92); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 12px; line-height: 1.4; max-width: 92%; text-align: center; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
  .map-undo-btn { position: absolute; top: 84px; right: 10px; z-index: 700; background: #f59e0b; color: #fff; border: none; border-radius: 6px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
  .map-undo-btn:hover { background: #d97706; }
  #map.map-fullscreen .map-undo-btn, #map.map-fullscreen .redraw-log { z-index: 9002; }
  .wpt-marker { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .wpt-hit { display: flex; align-items: center; justify-content: center; }
  .wpt-menu { position: fixed; z-index: 10001; background: var(--menu-bg); color: var(--text); border: 1px solid var(--border-mid); border-radius: 10px; padding: 10px 12px; box-shadow: 0 4px 14px rgba(0,0,0,.18); font-size: 13px; width: 260px; max-width: calc(100vw - 16px); box-sizing: border-box; cursor: default; }
  .wpt-menu-docked { position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: none; z-index: 1300; }
  #map.map-fullscreen .wpt-menu-docked { z-index: 9003; }
  .wpt-menu-open .map-hint-banner, .wpt-menu-open .redraw-log { display: none; }
  .wpt-menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 600; }
  .wpt-menu-close { background: none; border: none; color: var(--text-muted); font-size: 16px; width: 32px; height: 32px; margin: -6px -6px -6px 0; cursor: pointer; }
  .wpt-seg { display: flex; border: 1px solid var(--border-mid); border-radius: 8px; overflow: hidden; }
  .wpt-seg button { flex: 1; min-height: 36px; background: none; border: none; color: inherit; font: inherit; cursor: pointer; }
  .wpt-seg button + button { border-left: 1px solid var(--border-mid); }
  .wpt-seg button[aria-pressed='true'] { background: #fef3c7; color: #92400e; font-weight: 600; }
  .wpt-seg button[data-act='roads'][aria-pressed='true'] { background: #ffedd5; color: #9a3412; }
  .wpt-menu-help { font-size: 12px; color: var(--text-muted); line-height: 1.35; margin: 6px 0 8px; }
  .wpt-menu-actions { display: flex; gap: 6px; }
  .wpt-menu-actions button { min-height: 36px; min-width: 44px; border: 1px solid var(--border-mid); border-radius: 8px; background: none; color: inherit; font: inherit; font-size: 16px; cursor: pointer; }
  .wpt-menu-actions button:disabled { opacity: .35; cursor: default; }
  .wpt-menu-actions .wpt-menu-delete { flex: 1; font-size: 13px; color: #dc2626; border-color: #fca5a5; }
  .wpt-stop { border-top: 1px solid var(--border-mid); padding-top: 8px; margin-bottom: 8px; }
  .wpt-menu-head + .wpt-stop { border-top: none; padding-top: 0; }
  .wpt-stop-title { font-weight: 600; margin-bottom: 6px; }
  .wpt-stop-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .wpt-stop-row input { min-height: 36px; box-sizing: border-box; border: 1px solid var(--border-mid); border-radius: 8px; background: var(--menu-bg); color: inherit; font: inherit; font-size: 16px; padding: 0 6px; }
  .wpt-stop-min { width: 72px; }
  .wpt-stop-or { color: var(--text-muted); }
  .wpt-stop-clear { min-height: 36px; min-width: 36px; margin-left: auto; border: 1px solid var(--border-mid); border-radius: 8px; background: none; color: inherit; cursor: pointer; }
  .wpt-stop-clear:disabled { opacity: .35; cursor: default; }
  .wpt-stop-badge span { display: inline-block; white-space: nowrap; background: #1e3a8a; color: #fff; font-size: 11px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 9px; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
  @media (pointer: coarse) { .wpt-seg button, .wpt-menu-actions button, .wpt-stop-row input, .wpt-stop-clear { min-height: 44px; } }
  .redraw-guide-more { display: inline-block; margin-top: 8px; font-size: 12px; }
  .wpt-mid { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; cursor: grab; }
  .wpt-mid-dot { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,.85); border: 1.5px solid #f97316; color: #c2410c; font: 600 13px/14px sans-serif; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
  .wpt-mid:hover .wpt-mid-dot { background: #fff7ed; }
  .map-crosshair-btn { position: absolute; top: 124px; right: 10px; z-index: 700; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--menu-bg); color: var(--text); border: 1px solid var(--border-mid); border-radius: 8px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
  .map-crosshair-btn[aria-pressed='true'] { background: #2563eb; color: #fff; border-color: #2563eb; }
  .map-crosshair { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; z-index: 650; pointer-events: none; border: 2px solid #2563eb; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
  .map-crosshair::before, .map-crosshair::after { content: ''; position: absolute; background: #2563eb; }
  .map-crosshair::before { left: 50%; top: -10px; bottom: -10px; width: 2px; margin-left: -1px; }
  .map-crosshair::after { top: 50%; left: -10px; right: -10px; height: 2px; margin-top: -1px; }
  .map-crosshair-add { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); z-index: 700; min-height: 40px; padding: 0 16px; border: none; border-radius: 20px; background: #2563eb; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.3); white-space: nowrap; }
  #map.map-fullscreen .map-crosshair-btn, #map.map-fullscreen .map-crosshair, #map.map-fullscreen .map-crosshair-add { z-index: 9002; }
  #map.map-fullscreen .redraw-log { bottom: var(--fs-panel-h, 12px); }
  .map-fullscreen-panel .draw-phase, .map-fullscreen-panel .preview-phase { width: 100%; }
  .map-fullscreen-panel .draw-phase > div:first-child { flex-wrap: nowrap; }
  .map-fullscreen-panel .draw-phase button, .map-fullscreen-panel .preview-phase button { flex: 1; min-height: 40px; font-size: 14px !important; }
  .map-fullscreen-panel { border-radius: 14px 14px 0 0; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .map-fullscreen-panel::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--border-mid); margin: -2px auto 8px; }
  .map-fullscreen-panel:has(.preview-phase) { max-height: 60vh; }
  @media (max-width: 640px) {
    .map-hint-banner { top: 6px; left: 48px; right: 64px; transform: none; max-width: none; padding: 5px 8px; font-size: 11px; line-height: 1.3; }
    .wpt-menu-docked { padding: 8px 10px; }
    .wpt-menu-docked .wpt-menu-head { margin-bottom: 6px; }
    .wpt-menu-docked .wpt-menu-help { font-size: 11px; margin: 4px 0 6px; }
  }
  .map-fullscreen-panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 9001; background: var(--menu-bg); border-top: 1px solid var(--border-mid); padding: 10px 14px; max-height: 40vh; overflow-y: auto; box-shadow: 0 -2px 8px rgba(0,0,0,.15); }
  .map-fullscreen-panel .seg-row { flex-direction: column; align-items: stretch; border-bottom: none; padding: 0; }
  .map-legend { background: var(--menu-bg); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; box-shadow: 0 1px 4px rgba(0,0,0,.15); font-size: 12px; line-height: 1.6; min-width: 150px; }
  .map-legend-header { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; padding: 0; margin: 0; font: inherit; cursor: pointer; color: inherit; }
  .map-legend-icon { flex-shrink: 0; display: block; }
  .map-legend-chevron { flex-shrink: 0; transition: transform .15s ease; }
  .map-legend.collapsed .map-legend-chevron { transform: rotate(-90deg); }
  .map-legend-body { margin-top: 6px; }
  .map-legend.collapsed { min-width: 0; }
  .map-legend.collapsed .map-legend-body { display: none; }
  .mymap-progress { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1000; width: min(320px, calc(100% - 120px)); background: var(--menu-bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: 12px; pointer-events: none; }
  .mymap-progress[hidden] { display: none; }
  .leaflet-container path.leaflet-interactive:focus, .leaflet-container path.leaflet-interactive:focus-visible { outline: none; }
  .mymap-progress-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-weight: 600; }
  .mymap-progress-count { font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .mymap-progress-track { position: relative; height: 6px; background: var(--border-faint); border-radius: 3px; overflow: hidden; }
  .mymap-progress-bar { height: 100%; width: 0; background: var(--accent-blue); border-radius: 3px; transition: width .25s ease; }
  .mymap-progress.indeterminate .mymap-progress-bar { width: 35%; transition: none; animation: mini-progress-slide 1.1s ease-in-out infinite; }
  .map-legend label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; margin-bottom: 4px; }
  .map-legend-count { font-weight: 400; color: var(--text-subtle); }
  .map-legend-items { display: flex; flex-direction: column; gap: 2px; }
  .map-legend-item { display: flex; align-items: center; gap: 6px; }
  .sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; flex-shrink: 0; }
  #segment-panel { border: 1px solid var(--border-faint); border-radius: 8px; padding: 12px 16px; }
  .seg-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-faint); font-size: 13px; flex-wrap: wrap; gap: 6px; }
  .seg-auto-badge { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: var(--ok-bg); color: var(--ok-strong); white-space: nowrap; }
  .seg-auto-badge[hidden] { display: none; }
  .seg-row-actions { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
  .seg-row.preview-mode { flex-direction: column; align-items: stretch; }
  .seg-row:last-child { border-bottom: none; }
  .seg-done { color: var(--ok-strong); font-weight: 500; font-size: 13px; }
  details.tech-details { margin-bottom: 24px; border: 1px solid var(--border-faint); border-radius: 8px; padding: 0 14px; }
  details.tech-details summary { font-size: 13px; color: var(--btn-secondary-text); cursor: pointer; padding: 10px 0; user-select: none; list-style: none; display: flex; align-items: center; gap: 6px; }
  details.tech-details summary::before { content: '▶'; font-size: 9px; color: var(--text-soft); transition: transform 0.15s; }
  details[open].tech-details summary::before { transform: rotate(90deg); }
  details.tech-details summary:hover { color: var(--text); }
  details.tech-details > div { padding: 4px 0 14px; }
  .city-input-row { display: flex; align-items: flex-start; gap: 8px; }
  .map-pick-btn { flex-shrink: 0; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--menu-bg); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
  .map-pick-btn:hover { background: var(--menu-hover); border-color: var(--text-soft); }
  .map-pick-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 10000; }
  .modal-box { background: var(--menu-bg); border-radius: 12px; padding: 24px; width: 90%; max-width: 640px; box-shadow: 0 8px 32px rgba(0,0,0,.2); display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow-y: auto; }
  .modal-header { display: flex; align-items: center; justify-content: space-between; }
  .modal-box:focus { outline: none; }
  .modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-subtle); padding: 0 4px; line-height: 1; }
  .modal-close:hover { color: var(--text); }
  .fit-confirm-overlay { background: rgba(15,23,42,.48); padding: 18px; }
  .fit-confirm-box { max-width: 460px; gap: 12px; border: 1px solid rgba(148,163,184,.25); box-shadow: 0 24px 60px rgba(15,23,42,.24); }
  .fit-confirm-title { font-size: 17px; font-weight: 600; margin: 0; color: var(--text); }
  .fit-confirm-message { color: var(--text-muted); font-size: 14px; line-height: 1.55; white-space: pre-line; max-height: 60vh; overflow-y: auto; }
  .fit-confirm-actions { justify-content: flex-end; margin-top: 4px; }
  .btn-danger { background: #dc2626; color: #fff; border: 1px solid #dc2626; border-radius: 8px; padding: 10px 18px; font-size: 14px; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: opacity .15s; }
  .btn-danger:hover { opacity: .88; }
  /* Small button: replaces the inline padding/font-size pair on .btn-secondary / .btn-danger. */
  .btn-sm, .btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 4px 10px; font-size: 12px; }
  /* A captioned control: label above (11px, muted, no colon). */
  .ffx-field { display: inline-flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-muted); min-width: 0; }
  /* Status chips: the four locality / region statuses, one look wherever they appear. */
  .ffx-status { display: inline-block; padding: 0 8px; border-radius: 9px; font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap; color: var(--ffx-st-fg); background: var(--ffx-st-bg); }
  .ffx-status--visited { --ffx-st-fg: var(--st-visited); --ffx-st-bg: color-mix(in srgb, var(--st-visited) 16%, transparent); }
  .ffx-status--review { --ffx-st-fg: var(--st-review-text); --ffx-st-bg: var(--st-review-soft); }
  .ffx-status--declined { --ffx-st-fg: #dc2626; --ffx-st-bg: color-mix(in srgb, #dc2626 14%, transparent); }
  .ffx-status--not-visited { --ffx-st-fg: var(--text-muted); --ffx-st-bg: var(--st-unvisited); }
  /* A status used as a filter (region popup): the status colours as a button, outlined while on. */
  .strava-rp-filter.ffx-status, .strava-rp-filter.ffx-status.active { padding: 3px 10px; border-color: transparent; color: var(--ffx-st-fg); background: var(--ffx-st-bg); font-size: 12px; line-height: 1.4; }
  .strava-rp-filter.ffx-status.active { box-shadow: inset 0 0 0 1.5px var(--ffx-st-fg); font-weight: 600; }
  .strava-rp-filter.ffx-status .strava-rp-filter-n { color: inherit; opacity: .8; }
  /* The one filter chip. Multi-select chips (.ffx-chip--multi) show a check when on; single-select groups use
     role=radiogroup / aria-checked. The older class names share this look so each tab's markup stays as it is. */
  .ffx-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .ffx-chip, .strava-filter-pill, .strava-album-lvl-pill, .strava-rp-filter, .strava-metric-pills button { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 500; line-height: 1.4; border: 1px solid var(--border-mid); background: var(--surface); color: var(--text-muted); width: auto; margin: 0; }
  .ffx-chip:hover, .strava-filter-pill:hover, .strava-album-lvl-pill:hover, .strava-rp-filter:hover, .strava-metric-pills button:hover { border-color: var(--brand); }
  .ffx-chip:focus-visible, .strava-album-lvl-pill:focus-visible, .strava-rp-filter:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
  .ffx-chip[aria-pressed=true], .ffx-chip[aria-checked=true], .ffx-chip.active,
  .strava-filter-pill.active, .strava-album-lvl-pill.active, .strava-rp-filter.active, .strava-metric-pills button[aria-pressed=true],
  .strava-album-mode-btn.on, .strava-layout-mode.active { border-color: var(--brand); background: var(--brand-soft); color: var(--info-text); }
  .ffx-chip--multi[aria-pressed=true]::before { content: '\2713'; font-size: 11px; font-weight: 700; }
  .ffx-chip--strong { font-weight: 700; }
  /* Country picker (FfxUi.countryPickerHtml): a button with the chosen country, a searchable list under it. */
  .ffx-picker { position: relative; display: inline-block; max-width: 100%; }
  .ffx-picker-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 36px; box-sizing: border-box; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
  .ffx-picker-btn:hover { border-color: var(--brand); }
  .ffx-picker-btn:focus-visible, .ffx-picker-opt:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
  .ffx-picker-cur { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ffx-picker-n { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
  .ffx-picker-pop { position: absolute; left: 0; top: calc(100% + 4px); z-index: 1000; display: flex; flex-direction: column; width: min(380px, 92vw); max-height: min(70vh, 480px); border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
  .ffx-picker-pop[hidden], .ffx-picker-opt[hidden], .ffx-picker-group[hidden], .ffx-picker-sep[hidden], .ffx-picker-none[hidden] { display: none; }
  .ffx-picker-head { padding: 8px; border-bottom: 1px solid var(--border-light); }
  .ffx-picker-search { width: 100%; box-sizing: border-box; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }
  .ffx-picker-legend { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
  .ffx-picker-list { overflow-y: auto; padding: 4px 0; }
  .ffx-picker-opt { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 12px; border: none; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
  .ffx-picker-opt .ffx-picker-lbl { flex: 1; min-width: 0; }
  .ffx-picker-opt:hover { background: var(--menu-hover); }
  .ffx-picker-opt.active { background: var(--brand-soft); color: var(--info-text); font-weight: 600; }
  .ffx-picker-sep { margin: 4px 0; border: 0; border-top: 1px solid var(--border-light); }
  .ffx-picker-group { padding: 6px 12px 2px; font-size: 11px; font-weight: 600; color: var(--text-muted); }
  .ffx-picker-none { margin: 0; padding: 10px 12px; font-size: 13px; color: var(--text-muted); }
  .strava-album-countries { margin: 0 0 8px; }
  /* The Active row under a filter bar: removable chips, then Reset. */
  .ffx-active { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
  .ffx-active[hidden] { display: none; }
  .ffx-active-lbl { font-size: 11px; color: var(--text-muted); margin-right: 2px; }
  .ffx-chip--removable { color: var(--text); }
  .ffx-active-reset { padding: 3px 6px; border: none; background: none; color: var(--info-text); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
  .ffx-picker--multi .ffx-picker-opt::before { content: ''; display: inline-block; flex: none; width: 14px; font-size: 12px; font-weight: 700; }
  .ffx-picker--multi .ffx-picker-opt.active::before { content: '\2713'; }
  /* The Filters button and its panel: a popover under the button on a desktop, a sheet along the bottom of a phone. */
  .ffx-filters-wrap { position: relative; }
  .ffx-filters-btn { flex: 0 0 auto; width: auto; height: 36px; padding: 0 14px; font-size: 13px; }
  .ffx-filters-panel { display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 1000; flex-wrap: wrap; gap: 10px; align-items: flex-end; width: max-content; max-width: 92vw; padding: 12px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
  .ffx-filters-panel.open { display: flex; }
  @media (max-width: 767px) {
    .ffx-filters-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 80vh; overflow-y: auto; border-radius: 12px 12px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
    .ffx-filters-btn { height: 44px; }
  }
  .strava-album-sortrow { display: inline-flex; gap: 6px; align-items: center; }
  .strava-album-sort-dir { width: 36px; height: 36px; padding: 0; }
  @media (max-width: 767px) {
    .ffx-picker-pop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 80vh; border-radius: 12px 12px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
    .ffx-picker-opt { min-height: 44px; }
    .ffx-picker-btn { height: 44px; }
  }
  .ffx-chip-n { color: var(--text-muted); font-variant-numeric: tabular-nums; }
  #picker-map { width: 100%; height: 360px; border-radius: 8px; border: 1px solid var(--border-mid); }
  .picker-coords-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .picker-coord-input { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; width: 120px; outline: none; font-family: monospace; background: var(--bg); color: var(--text); }
  .picker-coord-input:focus { border-color: var(--text-soft); }
  .modal-actions { display: flex; gap: 8px; }
  .toast-notification { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); right: calc(24px + env(safe-area-inset-right, 0px)); background: #16a34a; color: #fff; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 99999; transition: opacity 0.5s ease, transform 0.5s ease; }
  .toast-notification.toast-out { opacity: 0; transform: translateY(8px); }
  /* Strava Localities Explorer activity list (strava-activities.js renderList) */
  .strava-locality-summary { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
  .strava-row-active { background: var(--row-strava-bg); }
  /* Pending-confirmation badge — centroid-radius-only localities nobody has confirmed/
     declined yet (see GetLocalitySummaries.PendingCount). Reuses the same warning-toned
     badge palette as .drop-badge for visual consistency. */
  .strava-pending-badge { background: var(--st-review); color: var(--ua-yellow-ink); border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 600; }
  /* New-locality badge — a locality this activity is the athlete's first-ever confirmed
     visit to (see GetNewLocalityCounts). Green success tone (same as .toast-notification)
     rather than .strava-pending-badge's amber, so new and pending read as visually distinct. */
  /* GPS-needs-fix chip — the track teleports (TrackAnomalyDetector), so the row isn't analyzed;
     a button opening the GPS popup (strava-activities-gpsfix.js). Error palette, like the popup's lines. */
  .strava-gps-chip { background: var(--err-bg); color: var(--err-text); border: 1px solid var(--err-border); border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 600; cursor: pointer; width: auto; margin: 2px 0 0; line-height: 1.5; white-space: nowrap; }
  .strava-gps-chip:hover { filter: brightness(0.97); }
  a.strava-gps-chip { display: inline-block; text-decoration: none; }
  .strava-gps-chip-replaced { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
  .strava-gps-card p { font-size: 13px; margin: 0 0 6px; }
  .strava-gps-card ol { font-size: 13px; margin: 4px 0 0; padding-left: 20px; }
  .strava-gps-card li { margin-bottom: 4px; }
  .strava-gps-map { height: 300px; width: 100%; border-radius: 8px; margin: 8px 0 4px; }
  .strava-gps-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
  .strava-gps-legend i { display: inline-block; width: 16px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
  .strava-gps-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
  .strava-gps-actions > * { width: auto; }
  .strava-new-badge { background: #dcfce7; color: #166534; border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 600; }
  /* Leaflet's own stylesheet (leaflet-1.9.4.css) loads AFTER this bundle (see PageLayout.Render
     — HeadExtra, which carries the leaflet <link>, is appended after this <style> block), so
     its .leaflet-div-icon rule (white box + border) would otherwise win the cascade over an
     equal-specificity override here. !important resets it so the new-locality star marker
     (makeNewLocalityMarker) renders as just the bare SVG, not a square badge. */
  .leaflet-div-icon.strava-new-locality-marker { background: transparent !important; border: none !important; }
  /* Balloon/pill-style filter buttons — the shared class for the amber pill look already
     used inline for the locality type-pills (populateLocalityTypePills); pulled out into a
     class here so the activity list's Analyzed filter can reuse the exact same convention. */
  /* An activity's name opens it (Details, or Analyze for a new one): a button that reads as a link. The Strava
     mark after it links to the activity on Strava. */
  .strava-name-btn { display: inline; width: auto; padding: 0; border: none; background: none; font: inherit; font-weight: 600; color: var(--accent-blue); text-align: left; cursor: pointer; }
  .strava-name-btn:hover:not(:disabled) { text-decoration: underline; }
  .strava-name-btn:disabled { color: var(--text-muted); cursor: default; }
  .strava-source-link { display: inline-block; margin-left: 6px; vertical-align: -1px; line-height: 0; }
  .strava-no-gps { display: inline-block; margin-left: 6px; vertical-align: -2px; color: var(--text-muted); }
  /* The activity table's column picker: a tick shows a column, the arrows move it. */
  .strava-columns-panel { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: 10px; background: var(--menu-bg); display: flex; flex-direction: column; gap: 4px; max-width: 360px; }
  .strava-columns-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
  .strava-columns-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
  .strava-columns-move { display: inline-flex; gap: 4px; }
  .strava-columns-move button { width: 28px; height: 28px; padding: 0; font-size: 14px; line-height: 1; }
  .strava-columns-reset { align-self: flex-start; width: auto; margin-top: 6px; padding: 4px 10px; font-size: 12px; }
  /* Activities table on desktop: the title gets room (and wraps to a few lines), the per-type counts hug their
     digits, and the checkbox column stays pinned while the wide table scrolls sideways. */
  @media (min-width: 601px) {
    #strava-activity-list { overflow-x: auto; }
    table.strava-activity-table .strava-col-name { min-width: 300px; }
    table.strava-activity-table th.strava-th-narrow, table.strava-activity-table td.strava-td-narrow { padding-left: 8px; padding-right: 8px; }
    table.strava-activity-table td.strava-td-narrow, table.strava-activity-table th.strava-th-narrow { width: 1%; text-align: center; }
    table.strava-activity-table th.strava-th-narrow { font-size: 13px; }
    table.strava-activity-table tr > :nth-child(1) { position: sticky; left: 0; z-index: 2; background: var(--bg); width: 40px; min-width: 40px; box-sizing: border-box; }
  }
  .strava-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; color: var(--text-muted); }
  .strava-icon-btn:hover { color: var(--text); }
  /* Next to an analyzed row's name once it has an active share link: link icon + how often the shared page was opened. */
  .strava-shared-mark { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; vertical-align: -2px; color: #2563eb; font-size: 11px; font-weight: 600; }
  /* Get-corrupted-activity-from-Strava picker (strava-fix-picker.js) */
  .strava-fix-picker-list { display: flex; flex-direction: column; }
  .strava-fix-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
  .strava-fix-row:last-child { border-bottom: none; }
  .strava-fix-row-info { flex: 1; min-width: 0; }
  .strava-fix-row-pick { width: 20px; height: 20px; flex: none; margin: 0; cursor: pointer; }
  .strava-fix-row-pick:disabled { cursor: default; opacity: .35; }
  .strava-fix-merge-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border-light); }
  .strava-fix-merge-hint { flex: 1 1 200px; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
  .strava-fix-merge-btn { flex: none; }
  .strava-fix-row-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
  .strava-fix-row-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
  .strava-fix-row-declined { font-size: 12px; color: #c0392b; margin-top: 2px; }
  .strava-fix-row-btn { flex-shrink: 0; }
  .strava-fix-empty { color: var(--text-muted); font-size: 14px; padding: 8px 0; }
  /* Get-corrupted-activity-from-Strava track preview (strava-fix-picker.js) */
  .strava-fix-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
  .strava-fix-preview-name { font-weight: 600; font-size: 16px; color: var(--text); }
  .strava-fix-preview-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .strava-fix-preview-badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-mid); color: var(--text-muted); }
  #strava-fix-preview-map { height: 240px; border-radius: 8px; margin: 10px 0; border: 1px solid var(--border-light); }
  .strava-fix-preview-stats { display: flex; gap: 20px; flex-wrap: wrap; margin: 10px 0; }
  .strava-fix-preview-stat .val { font-size: 18px; font-weight: 600; color: var(--text); }
  .strava-fix-preview-stat .lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
  .strava-fix-preview-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
  .fit-confirm-box.strava-fix-preview-box { max-width: 560px; }
  /* Your activities / Your localities tabs */
  .strava-tabs { display: flex; gap: 4px; margin-top: 14px; border-bottom: 1px solid var(--border-light); }
  /* The tab bar's row: the tabs, then Search (Ctrl/⌘-K) on the same underline. */
  .strava-tabs-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 14px; border-bottom: 1px solid var(--border-light); }
  .strava-tabs-row > .strava-tabs { flex: 1 1 auto; min-width: 0; margin-top: 0; border-bottom: none; }
  .strava-search-btn { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; margin: 0 0 5px; padding: 5px 10px; border: 1px solid var(--border-mid); border-radius: 8px; background: none; color: var(--text-muted); font-size: 13px; cursor: pointer; }
  .strava-settings-gear svg { display: block; }
  .strava-guide-help { text-decoration: none; }
  .strava-guide-help svg { display: block; }
  .strava-tabs-more { position: relative; }
  .strava-tabs-more[hidden] { display: none; }
  .strava-tabs-more .strava-tab-count { position: absolute; top: -7px; right: -7px; min-width: 16px; margin: 0; padding: 0 4px; line-height: 16px; font-size: 10px; }
  .strava-search-btn:hover { color: var(--text); border-color: var(--text-muted); }
  .strava-search-kbd { font: 11px/1 inherit; padding: 2px 5px; border: 1px solid var(--border-light); border-radius: 4px; background: var(--surface-2); }
  .strava-search-overlay { align-items: flex-start; padding-top: 10vh; }
  .modal-box.strava-search-box { display: grid; grid-template-columns: 1fr auto; align-items: center; max-width: 560px; padding: 12px; gap: 8px; }
  .strava-search-cancel { border: none; background: none; padding: 8px 4px; color: var(--accent-blue); font-size: 14px; cursor: pointer; }
  .strava-search-input { width: 100%; box-sizing: border-box; font-size: 16px; padding: 10px 12px; }
  .strava-search-results { grid-column: 1 / -1; align-self: start; max-height: 60vh; overflow-y: auto; }
  .strava-search-list { list-style: none; margin: 0; padding: 0; }
  .strava-search-group { padding: 8px 8px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
  .strava-search-item { display: flex; flex-direction: column; gap: 2px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
  .strava-search-item.active, .strava-search-item:hover { background: var(--menu-hover); }
  .strava-search-name { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }
  .strava-search-name img { flex: 0 0 auto; }
  .strava-search-meta { font-size: 12px; color: var(--text-muted); }
  .strava-search-empty { margin: 8px; font-size: 13px; color: var(--text-muted); }
  @media (max-width: 600px) {
    .strava-search-btn { padding: 6px 8px; }
    .strava-search-btn-label, .strava-search-kbd { display: none; }
    .strava-search-overlay { padding-top: 0; }
    .modal-box.strava-search-box { width: 100%; max-width: none; height: 100dvh; max-height: none; border-radius: 0; padding: calc(8px + env(safe-area-inset-top)) 12px 12px; grid-template-rows: auto 1fr; align-content: start; }
    .strava-search-results { max-height: none; flex: 1 1 auto; }
  }
  @media (hover: none) and (pointer: coarse) { .strava-search-kbd { display: none; } }
  .strava-tab-btn { padding: 8px 14px; font-size: 14px; }
  .strava-tab-icon { vertical-align: -3px; margin-right: 6px; }
  /* One tab look (main tabs, region popup, Progress, Album levels, share page): muted text, brand underline and
     accent-blue text while selected. The state is .active (or the Album's older .on) with aria-selected. */
  .ffx-tab, .strava-tab-btn, .strava-rp-tab, .strava-layout-tab, .strava-album-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; font-weight: 500; color: var(--text-muted); cursor: pointer; }
  .ffx-tab:hover, .strava-tab-btn:hover, .strava-rp-tab:hover, .strava-layout-tab:hover, .strava-album-tab:hover { color: var(--text); }
  .ffx-tab.active, .ffx-tab[aria-selected=true], .strava-tab-btn.active, .strava-rp-tab.active, .strava-layout-tab.active, .strava-album-tab.on { color: var(--accent-blue); border-bottom-color: var(--brand); }
  .ffx-tab:focus-visible, .strava-tab-btn:focus-visible, .strava-rp-tab:focus-visible, .strava-layout-tab:focus-visible, .strava-album-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
  .ffx-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-light); overflow-x: auto; scrollbar-width: none; }
  .strava-tab-count { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--st-review); color: var(--ua-yellow-ink); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
  .strava-tab-count[hidden] { display: none; }
  /* A filter input with a visible caption above it — placeholder-only inputs lose their meaning
     once they hold a value (the localities/regions ride-length filter starts at 20). */
  /* An Export ▾ style dropdown: a <details> whose panel floats under its summary. */
  .strava-menu { position: relative; }
  .strava-menu > summary { list-style: none; cursor: pointer; }
  .strava-menu > summary::-webkit-details-marker { display: none; }
  .strava-menu-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 1000; display: flex; flex-direction: column; gap: 6px; min-width: 220px; padding: 10px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
  .strava-menu-panel .btn-secondary { text-align: left; }
/* Localities Explorer: first-run card (shown while nothing is analyzed yet) and the analysis view's Back link */
.strava-onboarding { margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--border-light); border-left: 4px solid var(--brand); border-radius: 8px; background: var(--surface-2); }
.strava-onboarding[hidden] { display: none; }
.strava-onboarding-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.strava-onboarding h2 { margin: 0; font-size: 16px; }
.strava-onboarding ol { margin: 8px 0 12px; padding-left: 20px; font-size: 13px; line-height: 1.5; }
.strava-onboarding-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); }
.strava-onboarding-guide { color: var(--info-text); }
.strava-onboarding-dismiss { border: none; background: none; cursor: pointer; font-size: 20px; line-height: 1; color: var(--text-muted); padding: 0 4px; }
.strava-back-link { border: none; background: none; padding: 4px 0; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-blue); }
.strava-back-link:hover { text-decoration: underline; }
/* Localities Explorer: description options behind one Customize link, the Saved status and the left-anchored ... menu */
.strava-sticky-actions { position: sticky; bottom: 0; z-index: 500; background: var(--surface); padding: 10px 0; border-top: 1px solid var(--border-light); }
.strava-nearby-alert > summary { color: #92400e; }
.strava-section-summary { cursor: pointer; font-weight: 600; font-size: 15px; display: list-item; margin-bottom: 4px; }
.strava-desc-options { margin-top: 8px; }
.strava-desc-options > summary { cursor: pointer; font-size: 12px; color: var(--text-muted); }
.strava-desc-options-body { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: 8px; font-size: 12px; }
.strava-desc-option-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.strava-desc-option-row label { display: flex; gap: 4px; align-items: center; margin: 0; cursor: pointer; font-weight: normal; }
.strava-desc-option-label { min-width: 90px; font-weight: 600; color: var(--text-muted); }
.strava-saved-status { font-size: 13px; font-weight: 600; color: #16a34a; }
.strava-saved-status[hidden] { display: none; }
.strava-menu-panel-left { left: 0; right: auto; }
/* Coverage → List: the Group by region switch, and visited localities nested under their region rows */
.strava-places-group-label { margin: 0; white-space: nowrap; }
.strava-places-locality-row td { font-size: 13px; }
  .strava-sort-th { cursor: pointer; user-select: none; }
  /* Desktop widths as classes, not an inline width style — an inline width would out-
     specificity the mobile media query below and never actually go full-width on a narrow
     screen (this bit us: inline beats any external selector regardless of !important-free
     specificity tricks). */
  .strava-filter-w160 { width: 160px; }
  .strava-filter-w150 { width: 150px; }
  .strava-filter-w110 { width: 110px; }
  /* One control height across the filter bar. Without it the default `align-items: stretch`
     stretched the title box and sport select to the height of the captioned km fields. */
  #strava-filter-bar { align-items: flex-end; }
  #strava-filter-bar .strava-filter-field { margin-bottom: 0; }
  #strava-filter-bar input[type=text], #strava-filter-bar input[type=number], #strava-filter-bar select { height: 36px; box-sizing: border-box; }
  #strava-filter-analyzed-pills, #strava-filter-visibility-pills { height: 36px; }
  .share-bar { display: flex; align-items: center; gap: 8px; margin: 20px 0 8px; flex-wrap: wrap; }
  .share-label { font-size: 12px; color: var(--text-subtle); font-weight: 500; margin-right: 2px; white-space: nowrap; }
  .share-btn { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: none; cursor: pointer; text-decoration: none; transition: opacity 0.15s, transform 0.1s; flex-shrink: 0; }
  .share-btn:hover { opacity: 0.82; transform: scale(1.08); }
  .share-x { background: #000; color: #fff; }
  .share-fb { background: #1877f2; color: #fff; }
  .share-threads { background: #000; color: #fff; }
  .share-ig { background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); color: #fff; }
  .share-strava { background: #fc4c02; color: #fff; }
  .btn-strava { background: #cf3d00; color: #fff; border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
  .btn-strava:hover { opacity: 0.87; }
  /* Strava's own Connect with Strava button image (brand guidelines: the official asset, 48 px tall) on a bare button. */
  .strava-connect-official { background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; border-radius: 4px; }
  .strava-connect-official img { height: 48px; width: auto; display: block; }
  .strava-connect-official:hover { opacity: 0.9; }
  .strava-connect-official:focus-visible { outline: 2px solid #fc4c02; outline-offset: 2px; }
  .strava-connect-official:disabled { opacity: 0.5; cursor: default; }
  /* The Strava Localities Explorer's wide multi-column tables (Activities: 12 columns,
     Localities/Regions overview: 8 columns) have nothing else to shrink into below ~700px —
     the existing generic `table { font-size: 0.78em }` mobile rule just squeezes numbers
     unreadably instead of actually fitting. Scope by id (these ids only exist on
     /strava/activities) so it can't affect any other page's tables. A min-width on the table
     forces genuine horizontal scroll instead of wrapping/squishing cell content. */
  @media (max-width: 900px) {
    #strava-activity-list, #strava-localities-list, #strava-regions-list, #strava-places-list {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    #strava-activity-list table, #strava-localities-list table, #strava-regions-list table, #strava-places-list table {
      min-width: 700px;
    }
  }
  @media (max-width: 600px) {
    body { padding: 16px 14px; }
    h1 { font-size: 20px; }
    .ua-donate-bar { margin-top: -16px; margin-bottom: 16px; }
    .ua-donate-bar .dw-slide { padding: 4px 0; font-size: 13px; }
    .ua-donate-org, .ua-donate-bar .dw-dots { display: none; }
    .ua-donate-card img { width: 80px; height: 45px; }
    .page-header { flex-wrap: wrap; gap: 8px; }
    /* Header on a phone: the language and theme buttons fold behind one button, the site links behind another (header-chrome.js). */
    .page-header:not(.result-header) { flex-wrap: nowrap; }
    .page-header-left { min-width: 0; flex: 1 1 auto; }
    .lang-toggle { position: relative; flex: none; }
    .hdr-btn { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-height: 44px; min-width: 44px; box-sizing: border-box; padding: 0 10px; font: inherit; font-size: 13px; border-radius: 6px; border: 1px solid var(--border-mid); background: var(--menu-bg); color: var(--btn-secondary-text); cursor: pointer; }
    .hdr-btn[aria-expanded='true'] { background: var(--menu-hover); }
    .hdr-panel { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 1000; width: max-content; max-width: calc(100vw - 28px); flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--menu-bg); border: 1px solid var(--border-mid); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
    .hdr-panel.open { display: flex; }
    .hdr-nav:not([hidden]) { display: flex; flex-direction: column; position: absolute; right: 0; top: calc(100% + 6px); z-index: 1000; min-width: 230px; padding: 4px; background: var(--menu-bg); border: 1px solid var(--border-mid); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
    .hdr-nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 15px; }
    .hdr-nav a:hover, .hdr-nav a:focus-visible { background: var(--menu-hover); }
    .sub-sep { display: none; }
    .sub-connected { display: block; margin-top: 2px; font-size: 13px; }
    .result-header-right { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
    .result-header-right { width: auto; margin-left: auto; }
    /* Result page: the header's Download (+ Strava preview) become a bar pinned to the bottom, within thumb
       reach. It is the only Download on a phone: the bottom action bar's copy is hidden below. The menu opens
       upward; the bar goes away while the full-screen redraw sheet is open. */
    .result-header-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; gap: 10px; box-sizing: border-box;
      padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--menu-bg);
      border-top: 1px solid var(--border-light); box-shadow: 0 -2px 10px rgba(15,23,42,.12); }
    .result-header-actions .dl-menu { flex: 1 1 0; min-width: 0; }
    .result-header-actions .dl-menu-trigger, .result-header-actions .btn-strava { width: 100%; box-sizing: border-box; justify-content: center; min-height: 44px; padding: 8px 12px; }
    .result-header-actions .btn-strava { flex: 1 1 0; min-width: 0; }
    .result-header-actions .dl-menu-items { left: 0; right: auto; top: auto; bottom: calc(100% + 8px); }
    body:has(.result-header-actions) { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
    body:has(#map.map-fullscreen) .result-header-actions { display: none; }
    .result-action-bar > .dl-menu { display: none; }
    /* Map first: it comes right after the title, the summary and stat tiles follow it. */
    .result-flow { display: flex; flex-direction: column; }
    .result-map-wrap { order: 1; }
    .result-stats-wrap { order: 2; margin-top: 18px; }
    #map { height: 55vh; height: 55svh; min-height: 320px; }
    /* What was fixed: closed, it is its one-line summary (result-mobile.js collapses it). */
    #repair-summary:not([open]) summary:has(.rs-oneline) .rs-title { display: none; }
    #repair-summary:not([open]) .rs-oneline { display: inline; font-size: 13px; font-weight: 500; color: var(--text); }
    /* Localities tile while loading: a shimmering block, not an ellipsis next to a spinner. */
    .kpi-skeleton { display: inline-block; min-width: 34px; height: 22px; border-radius: 6px; color: transparent; overflow: hidden; user-select: none;
      background: linear-gradient(90deg, var(--border-faint) 25%, var(--border-light) 50%, var(--border-faint) 75%); background-size: 200% 100%; animation: kpi-shimmer 1.2s linear infinite; }
    .kpi-skeleton + #locality-spinner { display: none; }
    /* One compact row per damaged segment: label, then Draw + Auto-route side by side and an ellipsis button for the rest. */
    .seg-row { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0; }
    .seg-row-actions { justify-content: flex-start; gap: 8px; }
    .seg-row-actions > button[data-role=draw], .seg-row-actions > [id^=auto-btn-] { flex: 1 1 calc(50% - 30px); min-width: 0; width: auto; }
    .seg-row-actions > .seg-more-btn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; order: 2; width: 44px; padding: 4px 0; font-size: 18px; line-height: 1;
      background: var(--surface-3); border: 1px solid var(--border-light); border-radius: 8px; color: var(--text); cursor: pointer; }
    .seg-row-actions > .seg-more-btn[aria-expanded=true] { background: var(--border-faint); }
    .seg-row:not(.seg-more-open) .seg-row-actions > [id^=simple-btn-], .seg-row:not(.seg-more-open) .seg-merge-actions > * { display: none; }
    .seg-row-actions > [id^=simple-btn-], .seg-merge-actions > * { flex: 1 1 calc(50% - 4px); order: 3; width: auto; }
    .seg-row:not(:has([id^=simple-btn-], .seg-merge-actions > *)) .seg-more-btn,
    .seg-row:has(.draw-phase, .preview-phase) .seg-more-btn { display: none; }
    .upload-hero { padding: 16px; border-radius: 14px; }
    /* The three steps cost ~90 px above the upload box on a phone (the guide link says the same). */
    .upload-steps { display: none; }
    .upload-row { flex-direction: column; }
    .strava-fix-cta-btn { flex-basis: auto; }
    .redraw-steps { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .city-wrap { width: 100%; }
    .city-input-row { width: 100%; }
    .city-input-row .city-wrap { flex: 1; }
    input[type=text] { width: 100%; box-sizing: border-box; }
    .threshold-row { flex-wrap: wrap; }
    .captcha-row { flex-wrap: wrap; }
    #map { height: 280px; }
    table { font-size: 0.78em; }
    th, td { padding: 4px 6px; }
    .actions { flex-direction: column; }
    .btn-primary, .btn-secondary { width: 100%; text-align: center; box-sizing: border-box; }
    .result-action-bar { flex-direction: column; }
    .result-action-bar .btn-primary, .result-action-bar .btn-secondary, .result-action-bar .btn-strava { width: 100%; text-align: center; justify-content: center; box-sizing: border-box; }
    .stat-kpi { padding: 8px 12px; margin: 3px; }
    .modal-box { padding: 16px; box-sizing: border-box; }
    #picker-map { height: 240px; }
    /* Strava Localities Explorer: the filter bar's <select>/number inputs don't get the
       generic `input[type=text] { width: 100% }` rule above, so on a narrow screen they
       stayed at their desktop fixed widths (150px/110px) and just wrapped into a cramped,
       uneven row instead of stacking cleanly like the text filter already does. */
    .strava-filter-w160, .strava-filter-w150, .strava-filter-w110 { width: 100%; box-sizing: border-box; }
    /* Two captioned number filters per row — a full-width row each made the filter bar a screen tall. */
    .strava-filter-field { width: calc(50% - 5px); box-sizing: border-box; }
    /* The global `input[type=number] { width: 100px }` out-specifies the width classes above. */
    .strava-filter-field input[type=number] { width: 100%; box-sizing: border-box; }
    /* Keep the region / locality name readable; the rest of the table scrolls sideways. */
    .strava-places-table td:first-child { min-width: 150px; }
    /* The grouped tree is slim (Km and Last visit drop out here): it fits the screen, so no forced
       700px scroll width; a long name wraps and the to-review chip goes under it. */
    #strava-places-list table.strava-places-tree { min-width: 0; }
    .strava-places-tree td:first-child { min-width: 0; }
    /* Flat list: the first column is just the # rank; the name is the second one. */
    .strava-places-flat td:first-child { min-width: 0; }
    .strava-places-flat td:nth-child(2) { min-width: 150px; }
    .strava-places-tree .strava-region-review-chip { display: table; margin: 3px 0 0; }
    .strava-places-tree .strava-cov-cell { min-width: 84px; }
    .strava-places-tree .strava-cov-bar-sm { min-width: 0; }
    /* Same `.btn-secondary { width: 100% }` trap for the Coverage list's Details / Map buttons: in a
       nowrap cell each took the whole cell width and Map spilled past the table edge. */
    .strava-places-actions .btn-secondary { width: auto; }
    /* Same trap in the Get-corrupted-activity-from-Strava picker: the per-row Fix button
       is a `.btn-secondary`, so the generic 100% width squeezed the info column to a sliver
       (meta text wrapping one word per line, name hidden). Keep it a compact button. */
    .strava-fix-row-btn { width: auto; padding: 8px 16px; }
    .strava-fix-row-meta { overflow-wrap: anywhere; }
  }
  /* Localities Explorer on phones. The tab strip scrolls sideways instead of wrapping. */
  .strava-tabs { overflow-x: auto; scrollbar-width: none; }
  .strava-tabs::-webkit-scrollbar { display: none; }
  .strava-tab-btn { flex: 0 0 auto; white-space: nowrap; }
  .strava-places-actions { display: flex; gap: 6px; }
  /* Region coats of arms (scripts/fetch-region-wiki.py): inline before a name, by a popup title, in a map tooltip. */
  .strava-coa { display: inline-block; vertical-align: middle; margin-right: 5px; width: auto; }
  .strava-coa--unvisited { filter: grayscale(1); opacity: .45; }
  .strava-level-sw { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 4px; vertical-align: middle; margin-right: 6px; }
  .strava-path { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; }
  .strava-path-step { display: inline-flex; align-items: center; }
  .strava-path-step .strava-coa { margin-right: 4px; }
  .strava-path-sep { color: var(--text-muted); }
  .strava-path-link { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
  .strava-path-link:hover, .strava-path-link:focus-visible { color: var(--accent, #fc4c02); text-decoration: underline; }
  .strava-coa-empty { box-sizing: border-box; border: 1px dashed var(--border-mid, rgba(127,127,127,.5)); border-radius: 2px 2px 40% 40%; opacity: .6; }
  /* A region's flag standing in for a coat of arms (a flag image): outlined, a white field would vanish. */
  .strava-coa--flag { outline: 1px solid rgba(127, 127, 127, .35); outline-offset: -1px; }
  /* Partly covered area: grey copy underneath, colour copy clipped to the bottom --coa-fill share. */
  .strava-coa-part { position: relative; display: inline-block; }
  .strava-coa-part img.strava-coa { display: block; margin: 0; width: auto; }
  .strava-coa-part img.strava-coa-base { filter: grayscale(1); opacity: .45; }
  .strava-coa-part img.strava-coa-color { position: absolute; left: 0; top: 0; clip-path: inset(calc((1 - var(--coa-fill)) * 100%) 0 0 0); }
  .strava-popup-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 16px; margin: 0; }
  .strava-popup-title .strava-coa { margin-right: 6px; }
  .strava-coa-tip { display: flex; gap: 8px; align-items: flex-start; }
  .strava-coa-tip .strava-coa { margin: 0; }
  /* Hover preview of a coat of arms at its stored size (strava-activities-popups.js); above the modal overlay. */
  .strava-coa-preview { display: none; position: fixed; z-index: 10050; pointer-events: none; padding: 8px; background: var(--surface); border: 1px solid var(--border-mid); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
  .strava-coa-preview img { display: block; height: 160px; width: auto; }
  .strava-coa-preview-art { position: relative; }
  .strava-coa-preview .pv-color { display: none; position: absolute; left: 0; top: 0; clip-path: inset(calc((1 - var(--coa-fill)) * 100%) 0 0 0); }
  .strava-coa-preview[data-mode='part'] .pv-color { display: block; }
  .strava-coa-preview[data-mode='grey'] .pv-base, .strava-coa-preview[data-mode='part'] .pv-base { filter: grayscale(1); opacity: .45; }
  /* The credit line that must go with a credited coat of arms (heraldry.com.ua, scripts/heraldry-permission.md). */
  .strava-coa-captioned { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin-right: 6px; }
  .strava-coa-captioned .strava-coa { margin: 0; }
  .strava-coa-credit { font-size: 9px; line-height: 1.2; color: var(--text-muted); text-align: center; max-width: 135px; margin-top: 2px; }
  /* Leaflet tooltips are nowrap: let the credit under the coat of arms wrap onto two lines instead of running on. */
  .leaflet-tooltip .strava-coa-credit { white-space: normal; max-width: 120px; }
  .strava-coa-preview .strava-coa-credit { font-size: 11px; max-width: 190px; margin-top: 6px; }
  .strava-coa-link { display: inline-block; }
  /* Locality/region Details popup (strava-activities-popups.js, .strava-pa-*): title, stat cards and
     toolbar stay put, only the table scrolls under its sticky header. */
  .modal-box.strava-pa-box { overflow: hidden; gap: 12px; }
  .strava-pa-box > * { flex-shrink: 0; }
  .strava-pa-box > .strava-details-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .strava-pa-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
  .strava-pa-kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 7px 10px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface-2); }
  .strava-pa-kpi b { font-size: 15px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .strava-pa-kpi span { font-size: 11px; color: var(--text-muted); }
  .strava-pa-kpi-wide { grid-column: span 2; }
  .strava-pa-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); }
  .strava-pa-private { display: flex; gap: 5px; align-items: center; cursor: pointer; white-space: nowrap; }
  .strava-pa-table { margin-top: 0; }
  .strava-pa-colbar { display: flex; justify-content: flex-end; margin: 0 0 6px; }
  .strava-columns-btn { width: auto; padding: 4px 10px; font-size: 12px; }
  .strava-pa-table thead th { position: sticky; top: 0; z-index: 1; white-space: nowrap; box-shadow: inset 0 -1px 0 var(--border); }
  /* The editor's localities tables sit on the page, not in a scrolling popup: the header scrolls with them. */
  .strava-loc-table-page thead th { position: static; }
  .strava-pa-table tbody tr:not(.strava-pa-year):hover td { background: var(--menu-hover); }
  .strava-pa-box a, .strava-pa-box a:visited { color: var(--accent-blue); }
  .strava-pa-num { text-align: right; font-variant-numeric: tabular-nums; }
  .strava-pa-rank { color: var(--text-muted); }
  .strava-pa-name { width: 100%; max-width: 0; }
  .strava-pa-name-rich { max-width: none; white-space: normal; }
  .strava-pa-name-inner { display: flex; align-items: center; gap: 4px; overflow: hidden; white-space: nowrap; }
  .strava-pa-name-inner a, .strava-pa-name-text { overflow: hidden; text-overflow: ellipsis; }
  .strava-pa-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
  .strava-pa-km { position: relative; white-space: nowrap; min-width: 84px; }
  .strava-pa-bar { position: absolute; left: 0; top: 22%; bottom: 22%; border-radius: 0 3px 3px 0; background: var(--accent-blue); opacity: .18; pointer-events: none; }
  .strava-pa-km-val { position: relative; }
  .strava-pa-year th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); background: var(--surface-2); padding: 6px 10px 3px; }
  .strava-pa-actions { white-space: nowrap; text-align: right; }
  .strava-pa-actions-inline { display: inline-flex; gap: 4px; align-items: center; }
  .strava-pa-actions .strava-icon-btn { width: 28px; height: 28px; }
  .strava-pa-del { border: none; background: none; cursor: pointer; color: var(--text-subtle); font-size: 17px; line-height: 1; padding: 0 4px; }
  .strava-pa-del:hover, .strava-pa-del:focus-visible { color: #dc2626; }
  .strava-pa-menu { display: none; position: relative; text-align: left; }
  .strava-pa-menu > summary { list-style: none; cursor: pointer; padding: 4px 12px; font-size: 18px; line-height: 1; border: 1px solid var(--border-mid); border-radius: 6px; }
  .strava-pa-menu > summary::-webkit-details-marker { display: none; }
  .strava-pa-menu-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 2; display: flex; flex-direction: column; min-width: 190px; padding: 4px; background: var(--menu-bg); border: 1px solid var(--border-mid); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
  .strava-pa-menu-item { text-align: left; background: none; border: none; border-radius: 6px; padding: 11px 12px; font-size: 14px; color: var(--text); cursor: pointer; }
  .strava-pa-menu-item:hover { background: var(--menu-hover); }
  .strava-pa-menu-danger { color: #dc2626; }
  /* Region popup (strava-activities-regionmap.js, .strava-rp-*): fixed header, tabs, one pane fills the rest. */
  .modal-box.strava-rp-box { height: 85vh; gap: 10px; }
  .strava-rp-coverage { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
  .strava-rp-cov-head b { font-size: 16px; }
  .strava-rp-cov-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .strava-rp-cov-item { display: inline-flex; align-items: center; gap: 5px; border: none; background: none; padding: 0; font-size: 12px; color: var(--text-muted); cursor: pointer; }
  .strava-rp-cov-item b { color: var(--text); }
  .strava-rp-cov-item:hover { color: var(--text); text-decoration: underline; }
  .strava-rp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(15,23,42,.18); }
  .strava-rp-cov-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; }
  .strava-rp-next { font-size: 12px; font-weight: 500; color: var(--text-muted); }
  .strava-rp-barwrap { position: relative; }
  .strava-rp-coverage .strava-cov-bar { height: 12px; border-radius: 6px; }
  /* Milestone ticks under the bar: a line through it and the % + date reached. */
  .strava-rp-milestones { position: relative; height: 30px; font-size: 11px; color: var(--text-muted); }
  .strava-rp-milestones:empty { display: none; }
  .strava-rp-tick { position: absolute; top: -16px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; line-height: 1.25; white-space: nowrap; }
  .strava-rp-tick::before { content: ''; display: block; height: 16px; border-left: 1.5px solid var(--text-muted); }
  .strava-rp-tick.is-edge { transform: translateX(-80%); }
  .strava-rp-tick-pct { font-weight: 600; color: var(--text); }
  @media (max-width: 600px) { .strava-rp-tick:not(.is-latest) .strava-rp-tick-pct, .strava-rp-tick:not(.is-latest) .strava-rp-tick-date { display: none; } }
  /* Tiles under the legend: coats of arms, people, first → last visit. */
  .strava-rp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-top: 4px; }
  .strava-rp-tile { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--menu-hover); min-width: 0; }
  .strava-rp-tile[hidden] { display: none; }
  .strava-rp-tile b { font-size: 15px; color: var(--text); font-weight: 600; }
  .strava-rp-tile-label, .strava-rp-tile-sub { font-size: 12px; color: var(--text-muted); }
  .strava-rp-tile .strava-cov-bar-sm { margin: 3px 0 1px; }
  .strava-rp-shield { display: inline-block; width: 9px; height: 11px; margin-right: 5px; background: #f59e0b; clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); }
  .strava-cov-coa { background: #f59e0b; }
  /* Every coat of arms of an area collected: gold bar with a halo, and the gold shield seal beside the figures (same rule as the Album tile's gold halo). */
  .strava-coa-complete .strava-cov-coa { background: #facc15; box-shadow: 0 0 6px 1px rgba(250,204,21,.7); }
  .strava-coa-seal { vertical-align: -2px; filter: drop-shadow(0 0 3px rgba(250,204,21,.8)); }
  .strava-coa-badge { background: none; border: 0; pointer-events: none; filter: drop-shadow(0 0 4px rgba(13,148,136,.9)); }
  .strava-rp-tile.coa-complete { border-color: #e0a81a; box-shadow: 0 0 8px rgba(250,204,21,.5); }
  .strava-album-tile.complete::after { content: ''; position: absolute; top: 4px; right: 4px; width: 14px; height: 17px; background: #facc15; clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); filter: drop-shadow(0 0 3px rgba(250,204,21,.9)); pointer-events: none; }
  .strava-cov-coa-todo { background: repeating-linear-gradient(45deg, var(--text-muted) 0 2px, transparent 2px 5px); opacity: .55; }
  .strava-cov-people { background: #16a34a; }
  /* Narrower tiles than the other popups: an oblast's seven (districts, hromadas, share of rides) stay on one row and leave the map its height. */
  .strava-rp-box .strava-pa-kpis { margin-top: 0; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .strava-rp-tabs { flex: 0 0 auto; display: flex; gap: 4px; border-bottom: 1px solid var(--border-light); overflow-x: auto; scrollbar-width: none; }
  .strava-rp-tab { flex: 0 0 auto; white-space: nowrap; padding: 6px 12px; font-size: 13px; }
  .strava-rp-box .strava-rp-pane { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 8px; }
  .strava-rp-box .strava-rp-pane.active { display: flex; }
  .strava-rp-pane .strava-details-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  /* Side column (coverage + tiles) and main column (tabs + panes): side by side on a wide screen, one column below it. */
  .strava-rp-body, .strava-rp-side, .strava-rp-main { display: contents; }
  .strava-rp-maxbtn { display: none; margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text-subtle); padding: 0 6px; line-height: 1; }
  .strava-rp-maxbtn:hover { color: var(--text); }
  @media (min-width: 901px) {
    .modal-box.strava-rp-box { max-width: 1240px; width: 96vw; transition: max-width .15s; }
    .modal-box.strava-rp-box.strava-rp-max { max-width: none; width: 98vw; height: 96vh; }
    .strava-rp-body { display: grid; grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr); gap: 16px; flex: 1 1 auto; min-height: 0; }
    .strava-rp-max .strava-rp-body { grid-template-columns: minmax(280px, 3fr) minmax(0, 9fr); }
    .strava-rp-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding-right: 4px; }
    .strava-rp-main { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
    .strava-rp-maxbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; }
  }
  .strava-rp-filters { display: flex; flex-wrap: wrap; gap: 6px; }
  .strava-rp-gpx-menu { margin-left: auto; }
  .strava-rp-gpx { display: inline-flex; align-items: center; gap: 5px; width: auto; padding: 4px 10px; font-size: 12px; }
  /* Region popup: share of the unit's people living in visited localities. */
  .strava-rp-people-note { color: var(--text-muted); cursor: help; }
  .strava-album-coas { display: block; font-size: 11px; color: var(--text-muted); }
  .strava-coa-marker { background: none; border: 0; }
  .strava-album-missing-toggle { border: 0; background: none; padding: 0; color: var(--primary, #2563eb); cursor: pointer; font-size: inherit; text-decoration: underline; }
  .strava-album-missing-hint { font-size: 12px; color: var(--text-muted); margin: 0 0 6px; }
  .strava-album-missing-list { columns: 2 260px; margin: 0; padding-left: 18px; font-size: 13px; }
  .strava-album-missing-list li { break-inside: avoid; margin-bottom: 3px; }
  .strava-album-missing-list a { font-size: 11px; margin-left: 4px; }
  .strava-album-missing-visited { color: #16a34a; }
  .strava-coa-milestones { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
  .strava-coa-milestone { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #fef3c7; color: #92400e; }
  .strava-coa-milestone small { font-size: .85em; }
  .strava-coa-milestone.next { background: var(--surface); color: var(--text-muted); border: 1px dashed var(--border); }
  .strava-coa-latest { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; }
  .strava-coa-latest-item { display: inline-flex; align-items: center; gap: 4px; }
  .strava-recap-settlement-coas { margin: 6px 0 10px; }
  /* A place card's Wikipedia excerpt (locality / region popup header). */
  .strava-wiki-excerpt { margin: 4px 0 0; max-width: 680px; font-size: 13px; line-height: 1.45; color: var(--text); }
  .strava-wiki-excerpt a { white-space: nowrap; }
  .strava-wiki-licence { display: block; font-size: 10px; color: var(--text-muted); }
  /* Progress layout (strava-activities-progress-layout.js): Dashboard / Tabs, Customize. */
  .strava-layout-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
  .strava-layout-modes { display: inline-flex; padding: 3px; gap: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border-mid); }
  .strava-layout-mode { border: none; background: none; padding: 5px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
  .strava-layout-mode.active { font-weight: 600; }
  .strava-layout-edit, .strava-layout-reset { width: auto; padding: 5px 12px; font-size: 13px; }
  .strava-layout-hidden { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 12px; color: var(--text-muted); }
  .strava-layout-hidden-note { display: block; margin: -4px 0 10px; padding: 0; border: none; background: none; font-size: 12px; color: var(--accent-blue); cursor: pointer; }
  .strava-layout-tabs { display: flex; gap: 4px; margin: 0 0 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border-light); }
  .strava-layout-tab { flex: 0 0 auto; padding: 8px 12px; font-size: 13px; white-space: nowrap; }
  /* With a mouse a sideways-scrolling strip with no scrollbar hides the tabs past the edge (a wheel scrolls
     the page): wrap them onto more rows instead. Touch screens keep the one swipeable row. */
  @media (hover: hover) and (pointer: fine) {
    .strava-layout-tabs { flex-wrap: wrap; overflow-x: visible; row-gap: 2px; }
  }
  #strava-progress-grid [data-tile] { position: relative; min-width: 0; }
  /* One look for every Progress tile (the cards the explorer's other modules add use the same classes), its heading row
     with an optional scope chip (the selected year, or All time), and the stat blocks inside. */
  .strava-progress-tile, .strava-collection-card { padding: 14px; border-radius: 10px; background: var(--surface-2); min-width: 0; }
  .strava-progress-tile-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .strava-progress-tile-title { flex: 1; min-width: 0; font-weight: 600; }
  .strava-progress-tile-head select { width: auto; max-width: 55%; margin: 0; height: auto; padding: 2px 8px; font-size: 13px; }
  .strava-tile-chip { flex: none; width: auto; margin: 0; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border-mid); background: none; color: var(--text-muted); font-size: 11px; line-height: 1.6; }
  button.strava-tile-chip { cursor: pointer; }
  button.strava-tile-chip:hover { color: var(--text); border-color: var(--accent-blue); }
  .strava-tile-chip:empty { display: none; }
  .strava-progress-tile-head .strava-tile-expand { flex: none; width: auto; margin: 0; padding: 2px 8px; font-size: 13px; line-height: 1.4; min-height: 0; }
  a.strava-progress-act { color: var(--accent-blue); text-decoration: none; }
  a.strava-progress-act:hover { text-decoration: underline; }
  .strava-progress-stats { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0 0 8px; }
  .strava-stat { min-width: 90px; }
  .strava-stat b { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; }
  .strava-stat span, .strava-stat small { display: block; font-size: 12px; color: var(--text-muted); }
  .strava-stat-up b { color: #16a34a; }
  .strava-stat-down b { color: #dc2626; }
  button.strava-stat { width: auto; margin: 0; padding: 4px 10px; border: 1px solid transparent; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
  button.strava-stat:hover { background: var(--menu-hover); }
  button.strava-stat[aria-pressed=true] { border-color: var(--accent-blue); background: var(--menu-hover); }
  .strava-metric-pills { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
  /* Calendar: the cells share the tile's width (the grid scrolls sideways on a phone instead of shrinking them). */
  .strava-cal { overflow-x: auto; max-width: 100%; padding-bottom: 4px; }
  .strava-cal-grid { display: grid; gap: 2px; grid-template-rows: auto repeat(7, auto); min-width: calc(var(--weeks, 53) * 12px + 28px); }
  .strava-cal-cell { aspect-ratio: 1; min-height: 0; border-radius: 2px; background: var(--border); }
  button.strava-cal-cell { width: auto; margin: 0; padding: 0; border: none; cursor: pointer; }
  button.strava-cal-cell:hover, button.strava-cal-cell:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 1px; }
  .strava-cal-month, .strava-cal-weekday { font-size: 10px; line-height: 1; color: var(--text-muted); white-space: nowrap; }
  .strava-cal-weekday { align-self: center; }
  .strava-cal-detail:empty { display: none; }
  .strava-tile-edit, .strava-tile-detail { display: none; }
  .strava-progress-editing .strava-tile-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: -6px -6px 10px; padding: 4px 6px; border-radius: 7px; background: var(--menu-hover); font-size: 12px; }
  .strava-progress-editing [data-tile] { outline: 1px dashed var(--border-mid); outline-offset: 2px; cursor: grab; }
  .strava-tile-edit-title { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
  .strava-tile-grip { color: var(--text-muted); cursor: grab; }
  .strava-tile-edit button { border: 1px solid var(--border-mid); background: var(--menu-bg); color: var(--text); border-radius: 5px; padding: 2px 7px; min-width: 28px; min-height: 26px; font-size: 12px; cursor: pointer; }
  .strava-tile-sizes { display: inline-flex; gap: 2px; }
  .strava-tile-edit button[aria-pressed=true] { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
  .strava-tile-dragging { opacity: .4; }
  .strava-tile-drop { box-shadow: 0 0 0 2px var(--accent-blue); }
  #strava-progress-grid .strava-tile-hidden { display: none !important; }
  #strava-progress-grid .strava-tile-size-s { grid-column: auto !important; }
  #strava-progress-grid .strava-tile-size-l { grid-column: 1 / -1 !important; }
  @media (min-width: 760px) { #strava-progress-grid .strava-tile-size-m { grid-column: span 2 !important; } }
  /* Tabs: only the active tile, full width, a taller chart, its detail section below. */
  #strava-progress-grid.strava-progress-tabs-mode [data-tile]:not(.strava-tile-active) { display: none !important; }
  #strava-progress-grid.strava-progress-tabs-mode .strava-tile-active { grid-column: 1 / -1 !important; }
  .strava-progress-tabs-mode .strava-tile-active div[style*='height:240px'] { height: 420px !important; }
  .strava-progress-tabs-mode .strava-tile-active ul[style*='max-height'], .strava-progress-tabs-mode .strava-tile-active ol[style*='max-height'] { max-height: none !important; }
  .strava-progress-tabs-mode .strava-tile-detail { display: block; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light); font-size: 13px; }
  .strava-tile-detail:empty { display: none !important; }
  .strava-detail-title { margin: 0 0 6px; font-weight: 600; font-size: 13px; }
  .strava-detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .strava-detail-table th, .strava-detail-table td { padding: 4px 8px; border-bottom: 1px solid var(--border-light); text-align: left; vertical-align: top; }
  /* Number and year columns take only what their content (or the longest header word) needs, so the text
     columns get the rest and a phone doesn't spread a lone number across half the screen. */
  .strava-detail-table td.num, .strava-detail-table th.num { width: 1%; text-align: right; font-variant-numeric: tabular-nums; }
  .strava-detail-table td.num { white-space: nowrap; }
  .strava-detail-table .yr { width: 1%; white-space: nowrap; }
  @media (max-width: 600px) {
    .strava-detail-table { font-size: 12px; }
    .strava-detail-table th, .strava-detail-table td { padding: 4px 5px; }
  }
  .strava-detail-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 12px; }
  .strava-detail-stats b { display: block; font-size: 20px; }
  .strava-detail-stats span { font-size: 12px; color: var(--text-muted); }
  .strava-recap-months { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-muted); }
  .strava-recap-months b { color: var(--text); font-size: 14px; }
  /* Progress → Year in localities, Namesakes. */
  .strava-collection-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .strava-collection-title { flex: 1; font-weight: 600; }
  .strava-collection-head select { width: auto; height: auto; padding: 2px 8px; font-size: 13px; }
  .strava-collection-empty, .strava-collection-lead { margin: 0 0 8px; font-size: 13px; color: var(--text-muted); }
  .strava-recap-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 10px; }
  .strava-recap-stat b { display: block; font-size: 26px; line-height: 1.1; }
  .strava-recap-stat span { font-size: 12px; color: var(--text-muted); }
  .strava-recap-sub { margin: 4px 0 6px; font-size: 12px; color: var(--text-muted); }
  .strava-recap-coas { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
  .strava-recap-line { margin: 0 0 6px; font-size: 13px; }
  .strava-recap-place, .strava-namesake-open { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: none; background: none; color: var(--accent-blue); font: inherit; cursor: pointer; text-align: left; }
  .strava-recap-share { width: auto; margin-top: 4px; }
  .strava-namesakes { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; }
  .strava-namesakes > li { padding: 4px 0; border-bottom: 1px solid var(--border-light); }
  .strava-namesakes summary { cursor: pointer; }
  .strava-namesakes ul { list-style: none; margin: 6px 0 2px; padding-left: 14px; }
  .strava-namesakes ul li { padding: 2px 0; }
  .strava-namesakes-x { color: var(--text-muted); }
  .strava-namesakes-where { font-size: 12px; color: var(--text-muted); }
  .strava-namesakes-more { width: auto; padding: 4px 10px; font-size: 12px; }
  /* Coverage → Album: coats of arms, grey until visited. */
  .strava-album-count { font-size: 15px; }
  .strava-album-count b { font-size: 22px; }
  .strava-album-sub { display: block; font-size: 12px; color: var(--text-muted); }
  /* One search box with a mode switch, one filter row with small labels, then the count and the territory chips. */
  .strava-album-searchrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
  .strava-album-searchbox { position: relative; display: flex; align-items: center; flex: 1 1 260px; max-width: 560px; height: 36px; box-sizing: border-box; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
  .strava-album-searchbox:focus-within { border-color: var(--text-soft); outline: 2px solid var(--brand); outline-offset: 1px; }
  .strava-album-searchbox input { flex: 1; min-width: 0; width: auto; height: 100%; box-sizing: border-box; padding: 0 6px 0 10px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
  .strava-album-searchbox input::-webkit-search-cancel-button { display: none; }
  .strava-album-searchclear { flex: none; min-width: 32px; min-height: 32px; border: none; background: none; color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 6px; }
  .strava-album-searchclear:hover, .strava-album-searchclear:focus-visible { color: var(--text); background: var(--border-light); }
  /* The search mode is a suffix inside the box: two small toggles after the text. */
  .strava-album-mode { flex: none; display: inline-flex; align-self: stretch; overflow: hidden; border-left: 1px solid var(--border-mid); border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0; }
  .strava-album-mode-btn { padding: 0 10px; border: none; border-radius: 0; background: transparent; color: var(--text-muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
  .strava-album-mode-btn:last-child { border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0; }
  .strava-album-mode-btn + .strava-album-mode-btn { border-left: 1px solid var(--border-light); }
  .strava-album-mode-btn.on { font-weight: 600; }
  .strava-album-filtertoggle { display: none; padding: 7px 12px; border: 1px solid var(--border-mid); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; }
  .strava-album-filterbox { margin: 0 0 6px; }
  .strava-album-filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; }
  .strava-album-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .strava-album-lbl { font-size: 11px; color: var(--text-muted); }
  .strava-album-filters select { width: auto; max-width: 240px; font-size: 13px; }
  .strava-album-summary { margin: 6px 0 12px; }
  .strava-album-crumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
  .strava-album-crumb:empty { display: none; }
  .strava-album-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border-mid); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12px; cursor: pointer; }
  .strava-album-chip:hover { border-color: var(--brand); }
  .strava-album-reset { padding: 3px 6px; border: none; background: none; color: var(--info-text); font-size: 12px; cursor: pointer; text-decoration: underline; }
  /* An empty search on the coat of arms: a few charges to start from. */
  .strava-album-try { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 10px; font-size: 12px; color: var(--text-muted); }
  .strava-album-try[hidden] { display: none; }
  .strava-album-try-btn { padding: 3px 10px; border: 1px solid var(--border-mid); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12px; cursor: pointer; }
  .strava-album-try-btn:hover, .strava-album-try-btn:focus-visible { border-color: var(--brand); }
  /* The public page (/coats-of-arms): counts as chips, a legend, the search row kept in view, the Strava pitch and the
     folded About the collection after the results. */
  .coa-stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
  .coa-stats:empty { display: none; }
  .coa-stat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--border-mid); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
  button.coa-stat { cursor: pointer; font-family: inherit; }
  button.coa-stat:hover, button.coa-stat:focus-visible { border-color: var(--brand); }
  button.coa-stat.on { border-color: var(--brand); background: var(--brand-soft); color: var(--info-text); font-weight: 600; }
  .strava-album-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 0; font-size: 11px; color: var(--text-muted); }
  .strava-album-legend-corner { display: inline-flex; gap: 2px; }
  .strava-album-legend-corner i { width: 9px; height: 9px; clip-path: polygon(0 0, 100% 0, 0 100%); }
  .strava-album--public .strava-album-searchrow { position: sticky; top: 0; z-index: 20; padding: 8px 0; margin-bottom: 4px; background: var(--bg); }
  .coa-cta { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 24px 0 12px; padding: 12px 16px; border: 1px solid var(--border-mid); border-radius: 10px; background: var(--surface); }
  .coa-cta p { margin: 0; flex: 1 1 280px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
  .coa-cta .btn-strava { margin: 0; }
  /* The default view's first page, rendered by the server (CoaFirstPage) until the script draws it: the block above it
     holds the height of the controls the script puts there, so the cards stay where they are when it does. */
  /* Heights measured from the script's own controls at each width (the pills wrap into more rows as the page narrows). */
  .strava-album-prerender { --coa-chrome-h: 275px; }
  @media (max-width: 1099px) { .strava-album-prerender { --coa-chrome-h: 303px; } }
  @media (max-width: 899px) { .strava-album-prerender { --coa-chrome-h: 316px; } }
  @media (max-width: 767px) { .strava-album-prerender { --coa-chrome-h: 372px; } }
  @media (max-width: 600px) { .strava-album-prerender { --coa-chrome-h: 225px; } }
  @media (max-width: 440px) { .strava-album-prerender { --coa-chrome-h: 238px; } }
  .strava-album-prerender-chrome { min-height: var(--coa-chrome-h, 275px); display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 12px; box-sizing: border-box; }
  .strava-album-prerender .strava-album-open[disabled] { cursor: progress; opacity: 1; color: inherit; }
  .coa-about { margin: 0 0 24px; font-size: 13px; color: var(--text-muted); line-height: 1.6; max-width: 760px; }
  .coa-about summary { cursor: pointer; color: var(--text); font-weight: 500; padding: 4px 0; }
  .coa-about p { margin: 8px 0 0; }
  @media (max-width: 600px) {
    /* One row of country pills that scrolls sideways instead of three rows of them above the coats of arms. */
    .strava-album--public .strava-album-countries { flex-wrap: nowrap !important; }
  }
  @media (max-width: 600px) {
    .strava-album-filtertoggle { display: inline-flex; align-items: center; box-sizing: border-box; height: 36px; padding-top: 0; padding-bottom: 0; }
    @media (pointer: coarse) { .strava-album-filtertoggle { height: 44px; } }
    .strava-album-filterbox { display: none; }
    .strava-album-filterbox.open { display: block; }
    .strava-album-searchbox { flex: 1 1 0; min-width: 0; }
    .strava-album-mode-btn { max-width: 96px; padding: 0 6px; font-size: 11px; line-height: 1.15; white-space: normal; }
    .strava-album-field { flex: 1 1 140px; }
    .strava-album-filters select { width: 100%; max-width: none; }
  }
  .strava-album-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
  .strava-album-group-title small { font-weight: 400; font-size: 12px; color: var(--text-muted); }
  .strava-album-group { margin: 0 0 18px; }
  .strava-album-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; font-weight: 600; }
  .strava-album-group-title span { font-weight: 400; font-size: 12px; color: var(--text-muted); }
  .strava-album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .strava-album-tile { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--border-light); border-radius: 10px; background: var(--surface-2); }
  .strava-album-open { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 10px 6px 8px; border: none; background: none; color: var(--text); cursor: pointer; text-align: center; }
  .strava-album-img { display: flex; align-items: center; justify-content: center; height: 64px; }
  .strava-album-img img { max-height: 64px; max-width: 80px; }
  .strava-album-tile:not(.visited) .strava-album-img, .strava-album-tile:not(.visited) .strava-album-extras, .strava-album-big:not(.visited) img { filter: grayscale(1); opacity: .45; }
  .strava-album-tile.grey .strava-album-img, .strava-album-tile.grey .strava-album-extras, .strava-album-big.grey img { filter: grayscale(1); opacity: .45; }
  .strava-album-tile.colour .strava-album-img, .strava-album-tile.colour .strava-album-extras, .strava-album-big.colour img { filter: none; opacity: 1; }
  /* A place's other images (flag, emblem / seal) beside its main one: small, in a row below it, so one tile shows all of them (#1112 phase 3). */
  .strava-album-extras { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 8px; min-height: 26px; }
  .strava-album-mini { max-height: 24px; max-width: 40px; }
  .strava-album-img .strava-coa-part, .strava-album-big .strava-coa-part { margin: 0; }
  .strava-album-img .strava-coa-part img.strava-coa { max-height: 64px; max-width: 80px; }
  .strava-album-tile:not(.visited) .strava-album-name { color: var(--text-muted); }
  .strava-album-shield { width: 40px; height: 48px; }
  .strava-album-shield path { fill: var(--border-light); stroke: var(--border-mid); stroke-width: 1.5; }
  .strava-album-shield text { font-size: 18px; font-weight: 600; fill: var(--text-muted); }
  .strava-album-name { font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
  .strava-album-kind { font-size: 10px; line-height: 1.2; color: var(--text-muted); text-transform: lowercase; }
  .strava-album-when { font-size: 11px; color: var(--text-muted); }
  .strava-album-tile.visited .strava-album-when { color: var(--st-visited); }
  .strava-album-tile.complete { border-color: #e0a81a; background: linear-gradient(180deg, rgba(255,196,40,.14), transparent 70%), var(--surface-2); }
  .strava-album-tile.complete .strava-album-img { position: relative; }
  .strava-album-tile.complete .strava-album-img::before { content: ''; position: absolute; width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle, rgba(255,196,40,.75) 0%, rgba(255,196,40,.35) 40%, rgba(255,196,40,0) 70%); }
  .strava-album-tile.complete .strava-album-img > * { position: relative; }
  .strava-album-tile.complete .strava-album-coas { color: #8a5a00; font-weight: 500; }
  .strava-album-tile.complete .strava-album-coas::before { content: '\2713 '; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .strava-album-tile.complete .strava-album-coas { color: #f2c14e; } }
  [data-theme='dark'] .strava-album-tile.complete .strava-album-coas { color: #f2c14e; }
  .strava-album-credit { display: block; padding: 0 6px 6px; font-size: 9px; line-height: 1.2; color: var(--text-muted); text-align: center; }
  /* Level colours: the corner, a stack of several levels' tiles, the tags marker, the level listbox, a stack's tabs. */
  .strava-album-corner { position: absolute; top: 0; left: 0; width: 19px; height: 19px; overflow: hidden; border-top-left-radius: 9px; pointer-events: none; }
  .strava-album-corner i { position: absolute; top: 0; left: 0; clip-path: polygon(0 0, 100% 0, 0 100%); }
  .strava-album-stackn { position: absolute; top: 6px; right: 6px; min-width: 18px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; background: rgba(37,99,235,.14); color: var(--accent-blue); pointer-events: none; }
  .strava-album-tags { position: absolute; bottom: 5px; right: 6px; display: inline-flex; color: var(--text-muted); }
  /* A place with other images too (seal, flag): +1 bottom left; the larger view has a row of kinds to switch between. */
  .strava-album-stack { position: relative; display: flex; }
  .strava-album-stack > .strava-album-tile { position: relative; z-index: 2; flex: 1; min-width: 0; }
  .strava-album-stack::before, .strava-album-stack::after { content: ''; position: absolute; inset: 0; border: 1px solid var(--border-mid); border-radius: 10px; background: var(--surface-2); }
  .strava-album-stack::before { transform: translate(3px, 3px); z-index: 1; }
  .strava-album-stack::after { transform: translate(6px, 6px); z-index: 0; opacity: .75; }
  .strava-album-stack[data-n='2']::after { display: none; }
  .strava-album-lvl { display: flex; flex-wrap: wrap; gap: 6px; }
  .strava-album-lvl-pill.active { font-weight: 600; }
  .strava-album-lvl-pill .strava-level-sw, .strava-album-tab .strava-level-sw { margin-right: 0; }
  .strava-album-lbl .strava-level-sw, .strava-album-chip .strava-level-sw { margin-right: 4px; }
  .strava-album-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; border-bottom: 1px solid var(--border-light); }
  .strava-album-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 13px; }
  .strava-album-path { margin: 0 0 8px; font-size: 12px; color: var(--text-muted); }
  .strava-album-searchable { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 12px; color: var(--text-muted); }
  .strava-album-empty { font-size: 13px; color: var(--text-muted); }
  /* Notes of the coat-of-arms search (coa-search.js): the words it did not understand. */
  .strava-album-tag-note { margin: 0 0 8px; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
  .strava-album-possible > summary { cursor: pointer; margin: 0 0 8px; font-size: 15px; font-weight: 600; }
  .strava-album-possible > summary span { font-weight: 400; font-size: 12px; color: var(--text-muted); }
  .strava-album-possible { border-top: 1px solid var(--border-light); padding-top: 10px; }
  /* Feedback on search results (coa-feedback.js). */
  .strava-album-tile { position: relative; }
  .coa-fb-flag { position: absolute; top: 2px; right: 2px; min-width: 32px; min-height: 32px; border: none; border-radius: 6px; background: var(--surface); color: var(--text-muted); font-size: 14px; line-height: 1; cursor: pointer; opacity: 0; }
  .strava-album-tile:hover .coa-fb-flag, .coa-fb-flag:focus-visible, .strava-album-tile:focus-within .coa-fb-flag { opacity: 1; }
  @media (hover: none), (pointer: coarse) { .coa-fb-flag { opacity: .85; } }
  .coa-fb-flag:hover { color: var(--text); background: var(--border-light); }
  .coa-fb-pop { position: fixed; z-index: 10050; width: 300px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border-mid); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.25); font-size: 13px; }
  .coa-fb-pop *, .coa-fb-inline * { box-sizing: border-box; }
  .coa-fb-title { margin: 0 0 8px; font-size: 14px; }
  .coa-fb-options { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; }
  .coa-fb-option { display: flex; align-items: flex-start; gap: 6px; padding: 4px 2px; cursor: pointer; }
  .coa-fb-option.coa-fb-sent { color: var(--text-muted); cursor: default; }
  .coa-fb-pop input[type=text], .coa-fb-pop select, .coa-fb-inline input[type=text], .coa-fb-inline select { width: 100%; padding: 6px 8px; margin: 0 0 6px; font-size: 13px; }
  .coa-fb-pop label[for], .coa-fb-inline label[for] { display: block; margin: 0 0 4px; font-weight: 600; }
  .coa-fb-inline { width: 100%; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); text-align: left; display: flex; flex-direction: column; gap: 6px; }
  .coa-fb-saved { margin: 0 0 8px; font-size: 12px; color: var(--text-muted); }
  .coa-fb-saved summary { cursor: pointer; }
  .coa-fb-saved-list { margin: 4px 0 0; padding-left: 18px; }
  .coa-fb-status { min-height: 16px; margin: 4px 0; font-size: 12px; color: var(--text-muted); }
  .coa-fb-done .coa-fb-status { color: var(--st-visited); }
  .coa-fb-actions { display: flex; gap: 8px; }
  .coa-fb-actions button { width: auto; padding: 6px 14px; }
  .coa-fb-missing-note { margin: 10px 0 0; font-size: 12px; color: var(--text-muted); }
  @media (max-width: 600px) { .coa-fb-pop { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-width: none; } }
  .modal-box.strava-album-box { max-width: 360px; align-items: stretch; }
  .strava-album-box .modal-close { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -8px -8px -8px 0; font-size: 28px; }
  .strava-album-big { display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .strava-album-big img { max-height: 220px; max-width: 100%; }
  .strava-album-big .strava-album-shield { width: 120px; height: 144px; }
  .strava-album-kinds { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .strava-album-kindbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px 4px 6px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 12px; cursor: pointer; }
  .strava-album-kindbtn.on { border-color: var(--accent-blue); box-shadow: inset 0 0 0 1px var(--accent-blue); }
  .strava-album-big .strava-album-kindbtn img { max-height: 24px; max-width: 36px; }
  .strava-album-big-when { margin: 0; text-align: center; font-size: 13px; color: var(--text-muted); }
  .strava-album-big-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .strava-album-big-actions .btn-secondary, .strava-album-big-actions .btn-primary { width: auto; max-width: 100%; text-decoration: none; white-space: nowrap; }
  .modal-box.strava-album-box { gap: 8px; padding: 16px 20px; }
  .strava-album-icon { flex: none; vertical-align: -3px; }
  .strava-album-big-actions .btn-secondary, .strava-album-big-actions .btn-primary, .coa-fb-suggest, .coa-fb-notarms { display: inline-flex; align-items: center; gap: 5px; }
  .strava-album-big-when .strava-album-icon { vertical-align: -3px; margin-right: 2px; }
  .strava-album-stage { position: relative; }
  .strava-album-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: .5px solid var(--border-strong); color: var(--text-primary); cursor: pointer; }
  .strava-album-nav[hidden] { display: none; }
  .strava-album-prev.strava-album-nav { left: -6px; }
  .strava-album-next.strava-album-nav { right: -6px; }
  .strava-album-pos { position: absolute; right: 2px; bottom: 2px; font-size: 11px; color: var(--text-muted); }
  .strava-album-navrow { display: none; gap: 6px; }
  .strava-album-navrow button { flex: 1; width: auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 12px; font-size: 13px; min-height: 0; }
  @media (max-width: 600px) {
    .strava-album-nav { display: none !important; }
    .strava-album-navrow { display: flex; }
    .strava-album-big-actions .strava-album-icon + span { display: none; }
    .strava-album-big-actions .btn-secondary, .strava-album-big-actions .btn-primary { padding: 7px 12px; }
  }
  .strava-album-big-actions { gap: 6px; }
  .strava-album-big-actions .btn-secondary, .strava-album-big-actions .btn-primary { padding: 5px 12px; font-size: 13px; min-height: 0; line-height: 1.3; }
  .coa-fb-hint { margin: 0; font-size: 12px; color: var(--text-muted); }
  .coa-fb-inline { gap: 4px; padding-top: 8px; }
  .coa-fb-inline .coa-fb-title { margin: 0; }
  .coa-fb-inline input[type=text], .coa-fb-inline select { padding: 4px 8px; margin: 0; }
  .coa-fb-inline .coa-fb-status { margin: 0; min-height: 0; }
  .coa-fb-inline .coa-fb-actions button { padding: 4px 12px; font-size: 13px; }
  .modal-box.strava-card-box { max-width: 380px; align-items: stretch; }
  .strava-card-preview { display: flex; justify-content: center; align-items: center; min-height: 200px; }
  .strava-card-preview img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 12px; }
  .strava-card-status { font-size: 13px; color: var(--text-muted); margin: 0; }
  .strava-card-status--error { color: #dc2626; }
  .strava-card-hint { font-size: 12px; color: var(--text-muted); margin: 8px 0; text-align: center; }
  .strava-card-actions { display: flex; justify-content: center; gap: 8px; }
  .strava-card-actions .btn-secondary, .strava-card-actions .btn-primary { width: auto; text-decoration: none; }
  /* The activity Details popup maximized (the region popup's button, wide screens only; its max-width is set inline, hence !important). */
  @media (min-width: 901px) {
    .modal-box.strava-pa-box.strava-rp-max { max-width: none !important; width: 98vw; height: 96vh; max-height: 96vh; }
  }
  .strava-rp-filter.active { font-weight: 600; }
  .strava-rp-filter-n { color: var(--text-muted); font-variant-numeric: tabular-nums; }
  .strava-rp-loc-table .strava-icon-btn { width: 28px; height: 28px; }
  .strava-rp-loc-name { border: none; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
  .strava-rp-loc-name:hover, .strava-rp-loc-name:focus-visible { color: var(--accent-blue); text-decoration: underline; }
  /* Coverage bar (C.coverageBarHtml): visited, then needs review; the track is the not-visited part. */
  .strava-cov-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--st-unvisited); }
  .strava-cov-bar-sm { height: 6px; min-width: 90px; margin: 2px 0 3px; }
  .strava-cov-seg { height: 100%; }
  .strava-cov-confirmed { background: var(--st-visited); }
  .strava-cov-pending { background: var(--st-review); }
  .strava-cov-text { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .strava-cov-cell { min-width: 110px; }
  .strava-ad-status-unvisited { color: var(--text-muted); background: var(--menu-hover); }
  /* Coverage list region row: the name opens the region popup; the N-to-review chip opens it on Needs review. */
  .strava-region-name-btn { border: none; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
  .strava-region-name-btn:hover, .strava-region-name-btn:focus-visible { color: var(--accent-blue); text-decoration: underline; }
  .strava-region-review-chip { display: inline-block; margin-left: 6px; padding: 0 7px; border: none; border-radius: 9px; font-size: 11px; font-weight: 600; line-height: 18px; color: var(--st-review-text); background: var(--st-review-soft); cursor: pointer; white-space: nowrap; vertical-align: middle; }
  .strava-region-review-chip:hover { background: var(--st-review); color: var(--ua-yellow-ink); }
  .strava-places-tree-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
  .strava-places-tree-head .strava-places-summary { margin: 0 !important; }
  th.strava-coa-busy::after { content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 6px; border: 2px solid var(--border-mid); border-top-color: var(--text-muted); border-radius: 50%; animation: kpi-spin .8s linear infinite; vertical-align: -1px; }
  .strava-mymap-hint-more { display: none; }
  .strava-places-tools-more > summary { display: none; list-style: none; }
  .strava-places-tools-more > summary::-webkit-details-marker { display: none; }
  .strava-places-tree-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
  .strava-places-sort { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin: 0; }
  .strava-places-sort select { width: auto; height: auto; padding: 2px 6px; font-size: 12px; }
  .strava-places-sort-dir { border: 1px solid var(--border-mid); background: none; border-radius: 5px; padding: 1px 6px; font-size: 11px; cursor: pointer; color: var(--text); }
  .strava-places-actions .strava-icon-btn { width: 30px; height: 28px; }
  .strava-places-group-label select { width: auto; }
  .strava-places-country-row td { font-weight: 600; }
  .strava-places-country-row .strava-cov-text, .strava-places-country-row .strava-region-review-chip { font-weight: 600; }
  /* Region popup: drill-down path, flag by a country title, the next-level tab. */
  .strava-rp-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; font-size: 12px; margin: -4px 0 -6px; }
  .strava-rp-crumb { border: none; background: none; padding: 0; font: inherit; color: var(--accent-blue); cursor: pointer; }
  .strava-rp-crumb:hover { text-decoration: underline; }
  .strava-rp-crumb-sep { color: var(--text-muted); }
  .strava-rp-flag { display: inline-flex; margin-right: 6px; }
  .strava-rp-flag img { height: 24px; width: auto; border-radius: 3px; }
  .strava-rp-cov-static { cursor: default; }
  .strava-rp-cov-static:hover { text-decoration: none; color: var(--text-muted); }
  .strava-rp-child-table .strava-region-review-chip { margin-left: 6px; }
  .strava-rp-child-unvisited td { color: var(--text-muted); }
  .strava-rp-child-unvisited .strava-region-name-btn { color: var(--text-muted); }
  /* Popup back arrow: phones only (see the max-width: 600px block). The page behind an open popup doesn't scroll. */
  .modal-back { display: none; }
  html.strava-modal-open, html.strava-modal-open body { overflow: hidden; }
  .modal-overlay, .modal-box, .strava-details-body { overscroll-behavior: contain; }
  /* Activity Details popup extras (strava-activities-popups.js, .strava-ad-*). */
  .strava-pa-kpis.strava-ad-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .strava-ad-section-title { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 6px; }
  .strava-ad-firsts { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; border-left: 3px solid var(--st-visited); background: var(--surface-2); font-size: 13px; }
  .strava-ad-strip-wrap { margin-bottom: 14px; }
  .strava-ad-strip { position: relative; height: 16px; border-radius: 4px; background: var(--border-light); overflow: hidden; }
  .strava-ad-seg { position: absolute; top: 0; bottom: 0; cursor: pointer; border-right: 1px solid var(--menu-bg); transition: filter .1s; }
  .strava-ad-seg-confirmed { background: var(--st-visited); }
  .strava-ad-seg-pending { background: var(--st-review); }
  .strava-ad-seg-declined { background: #9ca3af; }
  .strava-ad-seg.strava-ad-hl { filter: brightness(1.35); box-shadow: inset 0 0 0 2px var(--text); z-index: 1; }
  .strava-ad-strip-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
  .strava-ad-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
  .strava-ad-grid-single { grid-template-columns: 1fr; }
  .strava-ad-grid:empty { display: none; }
  .strava-ad-map { height: 230px; border-radius: 8px; border: 1px solid var(--border-light); }
  .strava-ad-regions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; max-height: 230px; overflow-y: auto; }
  .strava-ad-regions li { position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; font-size: 13px; background: var(--surface-2); }
  .strava-ad-regions li > * { position: relative; }
  .strava-ad-regions li > .strava-pa-bar { position: absolute; top: 0; bottom: 0; border-radius: 6px; opacity: .12; }
  .strava-ad-regions .strava-coa { margin: 0; }
  .strava-ad-region-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .strava-ad-region-level { font-size: 11px; color: var(--text-muted); }
  .strava-ad-region-km { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-muted); }
  .strava-ad-table-toolbar { margin-bottom: 6px; }
  .strava-ad-table-toolbar .strava-ad-section-title { margin: 0; }
  .strava-ad-status-cell { white-space: nowrap; }
  .strava-ad-status { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; }
  .strava-ad-status-confirmed { color: var(--info-text); background: var(--brand-soft); }
  .strava-ad-status-pending { color: var(--ua-yellow-ink); background: var(--st-review); }
  .strava-ad-status-declined { color: var(--text-muted); background: var(--menu-hover); }
  .strava-ad-decide { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
  .strava-ad-confirm { width: 24px; height: 22px; padding: 0; border-radius: 5px; border: 1px solid var(--st-visited); background: none; color: var(--st-visited); cursor: pointer; font-size: 12px; line-height: 1; }
  .strava-ad-confirm:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
  .strava-ad-decline { border-color: var(--border-mid); color: var(--text-muted); }
  .strava-ad-decline:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
  .strava-pa-table tbody tr.strava-ad-hl td { background: var(--menu-hover); }
  .strava-ad-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border-light); }
  .strava-ad-action { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 6px 12px; font-size: 13px; }
  .strava-ad-action-danger { margin-left: auto; color: #dc2626; }
  /* The footer's ⋯ menu (Delete): pushed to the right end, opening upwards since the footer is at the bottom. */
  .strava-ad-more { margin-left: auto; }
  .strava-ad-more > summary { height: 100%; box-sizing: border-box; }
  .strava-ad-more-panel { top: auto; bottom: calc(100% + 4px); min-width: 200px; }
  .strava-ad-more-panel .strava-ad-action-danger { margin-left: 0; justify-content: flex-start; }
  .strava-places-actions .btn-secondary { white-space: nowrap; }
  .strava-icon-btn-label { display: none; }
  .strava-sort-bar { display: none; align-items: center; gap: 8px; font-size: 13px; }
  .strava-sort-bar label { margin: 0; color: var(--text-muted); white-space: nowrap; }
  .strava-sort-bar select { flex: 1; min-width: 0; }
  /* Medium windows: the per-type counts make the table wider than the window, and the row's summary line already
     gives their totals. Sorting by them stays possible through the sort bar. */
  table.strava-activity-table td.strava-col-startDate { white-space: nowrap; }
  @media (min-width: 601px) and (max-width: 1199px) {
    table.strava-activity-table .strava-col-extra { display: none; }
    table.strava-activity-table .strava-col-name { min-width: 220px; }
    .strava-sort-bar { display: flex; }
    .strava-sort-bar select { flex: 0 1 auto; }
  }
  @media (max-width: 600px) {
  }
  /* A tab bar with more tabs than fit fades at the edge that has more, so it reads as scrollable. */
  .strava-tabs.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
  .strava-tabs.more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
  .strava-tabs.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
  .strava-pending-action { padding: 2px 10px; font-size: 12px; border-radius: 5px; border: 1px solid var(--border-mid); background: none; cursor: pointer; }
  .strava-pending-confirm { color: var(--st-visited); }
  .strava-pending-decline { color: #dc2626; }
  .strava-pending-reason { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
  .strava-pending-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 0 6px; }
  .strava-pending-bulk { display: inline-flex; flex-wrap: wrap; gap: 6px; }
  .strava-pending-bulk .btn-secondary { width: auto; padding: 4px 10px; font-size: 12px; }
  .strava-keyboard-hint, .strava-pending-swipe { font-size: 11px; color: var(--text-muted); margin: 0 0 8px; }
  .strava-pending-swipe { display: none; }
  #strava-pending-list tr[data-idx] { transition: transform .15s ease-out; touch-action: pan-y; }
  #strava-pending-list tr.strava-pending-swipe-yes { background: color-mix(in srgb, var(--st-visited) 18%, transparent); transition: none; }
  #strava-pending-list tr.strava-pending-swipe-no { background: rgba(220, 38, 38, .14); transition: none; }
  /* Touch screens: no keyboard to use the J/K/Y/N hint with (swipe instead), and finger-sized Confirm / Decline. */
  @media (hover: none) and (pointer: coarse) {
    .strava-keyboard-hint { display: none; }
    .strava-pending-swipe { display: block; }
    .strava-pending-action { min-height: 40px; padding: 8px 16px; font-size: 14px; }
  }
  /* Touch screens (iPhone pass): finger-sized targets (44 pt) for the controls that were 17-37 px tall, and 16 px
     fields: iOS Safari zooms the page when a focused field is smaller, and doesn't zoom back out. The fields need
     !important because the 12-14 px sizes are set by id and class rules all over the explorer. */
  @media (pointer: coarse) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]), select, textarea { font-size: 16px !important; }
    .lang-btn, .theme-toggle { min-height: 44px; box-sizing: border-box; display: inline-flex; align-items: center; }
    .theme-toggle { min-width: 44px; justify-content: center; }
    .share-btn { width: 44px; height: 44px; }
    .footer-nav a { min-height: 44px; display: inline-flex; align-items: center; }
    .strava-tab-btn, .strava-search-btn, .strava-layout-mode, .strava-filters-toggle, #strava-demo-exit,
    #strava-progress-year-prev, #strava-progress-year-next, #segment-panel .btn-secondary { min-height: 44px; box-sizing: border-box; }
    .strava-search-btn { min-width: 44px; justify-content: center; }
    #strava-progress-year-prev, #strava-progress-year-next { width: auto; min-width: 56px; }
    .btn-primary, .btn-strava, .btn-secondary, .strava-pending-bulk .btn-secondary { min-height: 44px; box-sizing: border-box; }
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=hidden]), select { min-height: 44px; box-sizing: border-box; }
    details > summary { min-height: 44px; box-sizing: border-box; }
    .sub-link, .redraw-guide-more { display: inline-block; padding: 12px 0; margin: -12px 0; }
    .strava-album-filtertoggle { min-height: 44px; }
    /* The mode toggles fill the search box, which takes the 44 px, so the row stays one height. */
    .strava-album-searchbox { height: 44px; }
    .strava-album-mode-btn { min-height: 0; }
    [id$='-pills'] button, .strava-album-country-pill, .strava-album-lvl-pill, .strava-album-chip, .strava-album-more-countries { min-height: 40px; }
    /* Link-like text buttons: a taller hit area without taller rows (padding cancelled by the negative margin). */
    .strava-name-btn.strava-details-btn, .strava-progress-act { display: inline-block; padding: 10px 0; margin: -10px 0; }
  }
  /* Narrow screens without a coarse pointer (narrow desktop windows, emulators) still need 16 px fields. */
  @media (max-width: 600px) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]), select, textarea { font-size: 16px !important; }
  }
  /* Touch screens (iPhone pass 2): checkboxes are a 22 px box in a 44 px tall label row (the whole row is the tap
     target), and small inline buttons get an invisible 44 px hit area (::after, centred, no visual change). */
  @media (pointer: coarse) {
    label:has(> input[type=checkbox]) { display: flex; align-items: center; gap: 10px; min-height: 44px; }
    label:has(> input[type=checkbox]) > input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 0; }
    .map-legend label { margin-bottom: 0; }
    .map-legend-body { max-height: 50vh; overflow-y: auto; }
    .strava-next-skip, .strava-next-skip-coa, .sx-dot, .strava-places-sort-dir, .strava-region-toggle, .strava-region-name-btn,
    .map-legend-header, button.strava-tile-chip, button.ffx-status { position: relative; }
    .strava-next-skip::after, .strava-next-skip-coa::after, .sx-dot::after, .strava-places-sort-dir::after, .strava-region-toggle::after,
    .strava-region-name-btn::after, .map-legend-header::after, button.strava-tile-chip::after, button.ffx-status::after {
      content: ''; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: 44px; transform: translate(-50%, -50%);
    }
  }
  /* Narrow screens: the activity and Needs review tables become one card per row (.strava-card-table).
     Each value cell shows its column name from data-label; the header row is hidden, the per-type count
     columns (.strava-col-extra) are dropped, and the row buttons show their text next to the icon. */
  @media (max-width: 600px) {
    #strava-activity-list table.strava-card-table, #strava-pending-list table.strava-card-table { min-width: 0; font-size: 13px; }
    .strava-card-table, .strava-card-table tbody { display: block; border: none; }
    .strava-card-table tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: 8px; }
    .strava-card-table tr:has(th) { display: none; }
    /* Details popup: full screen, actions behind the ⋯ menu. */
    .modal-box.strava-pa-box { box-sizing: border-box; width: 100%; max-width: none !important; height: 100dvh; max-height: none; border-radius: 0; padding: 14px 12px; }
    .strava-pa-actions-inline { display: none; }
    .strava-pa-hide-phone { display: none; }
    .strava-ad-grid { grid-template-columns: 1fr; }
    /* The New badge as a green dot, so the name keeps the room. */
    .strava-pa-name-inner .strava-new-badge { flex: 0 0 auto; font-size: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; background: #16a34a; }
    .strava-ad-map { height: 180px; }
    .strava-ad-decide button { width: 30px; height: 28px; }
    .strava-pa-kpis.strava-ad-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
    .strava-ad-kpis .strava-pa-kpi { padding: 4px 6px; }
    .strava-ad-kpis .strava-pa-kpi b { font-size: 12px; }
    .strava-ad-actions { flex-wrap: nowrap; gap: 4px; padding-top: 8px; }
    .strava-ad-action { flex: 1 1 0; min-width: 0; justify-content: center; padding: 4px; font-size: 11px; line-height: 1.2; text-align: center; min-height: 38px; }
    .strava-ad-action svg { display: none; }
    .strava-ad-action-danger { margin-left: 0; }
    .strava-ad-more { flex: 0 0 44px; margin-left: 0; }
    .strava-ad-more > summary { width: 100%; }
    .strava-ad-more-panel .strava-ad-action { flex: none; font-size: 13px; padding: 8px 12px; }
    .strava-pa-menu { display: inline-block; }
    .strava-pa-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
    .strava-pa-kpi { padding: 5px 8px; }
    .strava-pa-kpi b { font-size: 13px; }
    .strava-pa-kpi span { font-size: 10px; }
    .strava-pa-date { font-size: 12px; }
    /* My map: the five lines of explanation fold behind an ⓘ. */
    .strava-mymap-hint { display: none; }
    .strava-mymap-hint-more { display: block; margin: 0 0 8px; font-size: 12px; color: var(--text-muted); }
    .strava-mymap-hint-more > summary { cursor: pointer; min-height: 32px; line-height: 32px; }
    .strava-mymap-hint-more p { margin: 4px 0 0; }
    /* Coverage tree: each row stacks (name + review chip and the map button on top, the progress bar full width, the
       activity count under it) instead of squeezing four columns into 400 px. */
    .strava-places-tools-more > summary { display: list-item; cursor: pointer; font-size: 13px; color: var(--accent-blue); min-height: 32px; line-height: 32px; }
    .strava-places-tools-more[open] > summary { margin-bottom: 4px; }
    .strava-places-tree-head { display: block; }
    .strava-places-tree-tools { display: flex; }
    table.strava-places-tree, .strava-places-tree tbody { display: block; width: 100%; }
    .strava-places-tree tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
    .strava-places-tree tr:has(th) { display: none; }
    .strava-places-tree td { display: block; padding: 0; border: none; min-width: 0; }
    .strava-places-tree td:nth-child(1) { grid-column: 1; grid-row: 1; }
    .strava-places-tree td:nth-child(7) { grid-column: 2; grid-row: 1; }
    .strava-places-tree td.strava-cov-cell:nth-child(2) { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
    .strava-places-tree td.strava-places-act-cell { grid-column: 1 / -1; grid-row: 3; font-size: 12px; color: var(--text-muted); }
    .strava-places-tree td.strava-places-act-cell::before { content: attr(data-label) ': '; }
    .strava-places-tree td[colspan] { grid-column: 1 / -1; }
    .strava-card-table th { display: none; }
    .strava-card-table td { display: block; padding: 0; border: none; }
    .strava-card-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-muted); }
    .strava-card-table .strava-col-extra, .strava-card-table td.strava-zero { display: none; }
    /* Last analyzed: one muted line at the foot of the card instead of a grid cell. */
    .strava-card-table td.strava-col-lastAnalyzedAt { grid-column: 1 / -1; order: 11; font-size: 11px; color: var(--text-muted); }
    .strava-card-table td.strava-col-lastAnalyzedAt::before { display: inline; margin-right: 4px; font-size: 11px; }
    /* The activity list is the compact card: title, one meta line (date · distance; the urban % is already in the
       title's summary line), then the to-review / new / COAs counts inline. Last analyzed stays in the details popup. */
    .strava-activity-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 0; padding: 8px 12px; margin-bottom: 8px; }
    .strava-activity-table td { flex: 0 0 auto; }
    .strava-activity-table td.strava-col-name { flex: 1 1 100%; box-sizing: border-box; max-width: 100%; }
    .strava-activity-table td.strava-col-startDate, .strava-activity-table td.strava-col-distanceKm { order: 1; font-size: 13px; color: var(--text-muted); }
    .strava-activity-table td.strava-col-distanceKm { order: 2; }
    .strava-activity-table td.strava-col-startDate::before, .strava-activity-table td.strava-col-distanceKm::before { display: none; }
    .strava-activity-table td.strava-col-distanceKm::before { display: inline; content: '·'; margin: 0 6px; }
    .strava-activity-table td.strava-col-urbanPct, .strava-activity-table td.strava-col-lastAnalyzedAt { display: none; }
    .strava-activity-table td.strava-col-pendingCount, .strava-activity-table td.strava-col-newLocalityCount, .strava-activity-table td.strava-col-newCoaCount {
      order: 3; margin: 2px 12px 0 0; font-size: 12px; font-weight: 600; }
    .strava-activity-table td.strava-col-pendingCount { margin-left: 0; }
    .strava-activity-table td.strava-col-pendingCount::before, .strava-activity-table td.strava-col-newLocalityCount::before, .strava-activity-table td.strava-col-newCoaCount::before {
      display: inline; margin-right: 4px; font-size: 12px; font-weight: 400; }
    .strava-activity-table td.strava-col-startDate { margin-right: 0; }
    .strava-card-table .strava-col-name, .strava-card-table .strava-col-activity { grid-column: 1 / -1; order: -1; padding-right: 28px; }
    .strava-card-table .strava-col-select { position: absolute; top: 10px; right: 12px; }
    .strava-icon-btn-label { display: inline; font-size: 12px; white-space: nowrap; }
    /* Column headers are hidden on the cards, so the list sorts from this bar instead. */
    .strava-sort-bar { display: flex; width: 100%; }
    /* Tighter tab padding so all four tabs (Activities … Progress) fit a phone width without scrolling. */
    .strava-tabs { gap: 0; }
    .strava-tab-btn { padding: 8px 9px; font-size: 13px; }
    /* Narrow phones: icon-only tabs (the label stays for screen readers) so every tab and the Needs review count are in view. */
    @media (max-width: 480px) {
      .strava-tab-btn { padding: 8px 8px; }
      .strava-tab-icon { margin-right: 0; }
      .strava-tab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
      .strava-tab-btn .strava-tab-count { margin-left: 3px; padding: 0 5px; }
      .strava-tabs-row { gap: 4px; }
    }
    .strava-sort-bar .strava-sort-dir-btn { width: 44px; flex: 0 0 44px; padding: 6px 0; }
    .strava-card-table .strava-col-actions { display: flex; gap: 8px; grid-column: 1 / -1; order: 10; }
    .strava-card-table .strava-col-actions .strava-pending-action { flex: 1; }
    /* Full-screen popups on phones are app screens: a sticky app bar (back arrow named after where it goes,
       title) instead of the close button and the breadcrumb; Back and the iPhone's edge swipe do the same. */
    .modal-box.strava-pa-box { padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
    .strava-pa-box > .modal-header { position: sticky; top: 0; z-index: 1001; min-height: 52px; margin: 0 -12px; padding: env(safe-area-inset-top) 12px 0 4px;
      gap: 2px; justify-content: flex-start; background: var(--menu-bg); border-bottom: 1px solid var(--border-light); }
    .strava-pa-box > .modal-header > h2 { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; font-size: 17px !important; font-weight: 600; }
    .strava-pa-box > .modal-header > h2 > :not(.strava-coa):not(img):not(.strava-rp-flag) { flex-shrink: 1; }
    .strava-pa-box > .modal-header .strava-coa { width: auto; height: 28px !important; max-height: 28px; }
    .strava-pa-box > .modal-header .strava-rp-flag img { height: 18px; }
    .strava-pa-box > .modal-header .strava-coa-credit { display: none; }
    .strava-pa-box .modal-close { display: none; }
    .strava-pa-box .modal-back { display: inline-flex; align-items: center; flex: 0 1 auto; min-width: 44px; max-width: 42%; height: 44px; padding: 0 6px 0 0;
      border: none; background: none; color: var(--accent-blue); font: inherit; font-size: 15px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .strava-pa-box .modal-back svg { flex: 0 0 auto; }
    .modal-back-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .strava-pa-box > .strava-popup-subtitle { margin: 0 !important; }
    /* Region popup: one scroll for the whole screen. The header (place line, coverage, numbers) scrolls away,
       the tabs stick under the app bar, and the active tab's list grows with the page instead of scrolling
       inside a box — no scroll-inside-scroll on a phone. The map is as tall as the screen below the tabs. */
    .modal-box.strava-rp-box { overflow-y: auto; -webkit-overflow-scrolling: touch; gap: 10px; }
    .strava-rp-box > .strava-rp-crumbs { display: none; }
    .strava-rp-box .strava-rp-tabs { position: sticky; top: 52px; z-index: 1000; margin: 0 -12px; padding: 0 8px; background: var(--menu-bg); }
    .strava-rp-tab { min-height: 44px; padding: 0 10px; font-size: 14px; }
    .strava-rp-box .strava-rp-pane { flex: 0 0 auto; min-height: auto; }
    .strava-rp-box .strava-rp-pane .strava-details-body { overflow: visible; }
    /* Fills the rest of the first screen under the header, so the region is centred where it can be seen
       (the map's fullscreen button gives the whole screen). */
    .strava-rp-box .strava-rp-pane-map { flex: 1 0 auto; min-height: 300px; }
    .strava-rp-cov-item { min-height: 32px; font-size: 13px; }
    .strava-rp-filter { min-height: 36px; padding: 4px 12px; font-size: 13px; }
  }
