body.uptrail-route-explorer {
  overflow: hidden !important;
  overscroll-behavior: none;
}

body.uptrail-route-tab-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.route-explorer-page[hidden] {
  display: none !important;
}

.route-explorer-page {
  --explorer-ink: #172044;
  --explorer-muted: #747b9a;
  --explorer-panel: rgba(249, 249, 253, .94);
  --explorer-line: rgba(27, 36, 75, .1);
  position: fixed;
  inset: 0;
  z-index: 100000;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: var(--explorer-ink);
  font-family: "Plus Jakarta Sans", sans-serif;
  background: #dce9df;
}

.admin-bar .route-explorer-page {
  top: var(--wp-admin--admin-bar--height, 32px);
  height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px));
}

.route-explorer-toolbar {
  position: absolute;
  z-index: 12;
  top: 12px;
  right: 18px;
  left: 18px;
  display: grid;
  grid-template-columns: 190px minmax(300px, 1fr) 130px;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 7px 9px;
  background: rgba(250, 251, 253, .9);
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 17px;
  box-shadow: 0 15px 45px rgba(31, 45, 75, .16);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.route-explorer-back {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 4px 7px;
  color: var(--explorer-ink);
  font-size: .68rem;
  font-weight: 800;
	font-family: inherit;
	cursor: pointer;
	text-align: left;
	background: transparent;
	border: 0;
}

.route-explorer-back img {
  width: 78px;
  height: 31px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(12%) sepia(23%) saturate(1774%) hue-rotate(191deg) brightness(87%);
}

.route-explorer-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  color: var(--explorer-ink);
}

.route-explorer-picker > span {
  color: var(--explorer-muted);
  font-size: .63rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.route-explorer-picker select {
  width: 100%;
  min-height: 38px;
  padding: 0 40px 0 13px;
  color: var(--explorer-ink);
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  background: rgba(229, 231, 240, .62);
  border: 1px solid rgba(27, 36, 75, .08);
  border-radius: 11px;
}

.route-explorer-download {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  color: #fff !important;
  font-size: .7rem;
  background: #0baf7d;
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(11, 175, 125, .23);
}

.route-explorer-download span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #0b7257;
  background: #fff;
  border-radius: 50%;
}

.route-explorer-stage,
.route-explorer-map {
  position: absolute;
  inset: 0;
}

.route-explorer-map {
  background: #d8e6d4;
}

/* Mapbox CSS is loaded on demand after this file, so keep the fullscreen geometry authoritative. */
.route-explorer-stage > .route-explorer-map {
  position: absolute;
  inset: 0;
}

.route-explorer-map .mapboxgl-ctrl-top-right {
  top: 76px;
  right: 8px;
}

.route-explorer-map .mapboxgl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(27, 36, 75, .08);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(28, 45, 71, .18);
}

.route-explorer-map .mapboxgl-ctrl-attrib {
  font-size: 9px;
}

.route-explorer-recorder,
.route-explorer-info,
.route-explorer-missing {
  position: absolute;
  z-index: 8;
  left: 50%;
  width: min(410px, calc(100% - 32px));
  margin: 0;
  transform: translateX(-50%);
  background: var(--explorer-panel);
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(31, 43, 77, .2);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}

.route-explorer-recorder.tour-route-live {
  top: 80px;
  padding: 14px;
  color: var(--explorer-ink);
  background: var(--explorer-panel);
  border-color: rgba(255, 255, 255, .82);
}

.route-explorer-recorder > header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.route-explorer-recorder > header span,
.route-explorer-recorder > header strong {
  display: block;
}

.route-explorer-recorder > header span {
  margin-bottom: 3px;
  color: var(--explorer-muted);
  font-size: .53rem;
  font-weight: 900;
  letter-spacing: .11em;
}

.route-explorer-recorder > header strong {
  color: var(--explorer-ink);
  font-size: .78rem;
  line-height: 1.35;
}

.route-explorer-recorder > header b {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: #bc6c27;
  font-size: .56rem;
  background: #faeadf;
  border-radius: 999px;
  text-transform: uppercase;
}

.route-explorer-recorder > header b[data-status="recording"] { color: #087554; background: #dff5ed; }
.route-explorer-recorder > header b[data-status="paused"] { color: #b35b1e; background: #fff0df; }

.route-explorer-recorder .tour-route-live-metrics {
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.route-explorer-recorder .tour-route-live-metrics span {
  min-height: 58px;
  padding: 9px 7px;
  color: var(--explorer-ink);
  text-align: center;
  background: rgba(229, 231, 240, .68);
  border: 0;
  border-radius: 10px;
}

.route-explorer-recorder .tour-route-live-metrics span:nth-child(4) {
  grid-column: span 3;
  min-height: 46px;
}

.route-explorer-recorder .tour-route-live-metrics strong {
  color: var(--explorer-ink);
  font-size: .83rem;
}

.route-explorer-recorder .tour-route-live-metrics small {
  color: var(--explorer-muted);
  font-size: .5rem;
}

.route-explorer-recorder .tour-route-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 9px;
}

.route-explorer-recorder .tour-route-actions button {
  min-height: 44px;
  color: #fff;
  background: #10b981;
  border-radius: 10px;
}

.route-explorer-recorder .tour-route-actions button[data-track-finish] {
  width: 46px;
  overflow: hidden;
  color: transparent;
  background: #ef3f46;
  border-radius: 50%;
}

.route-explorer-recorder .tour-route-actions button[data-track-finish]::after {
  color: #fff;
  content: "■";
}

.route-explorer-recorder .tour-route-status {
  min-height: 0;
  margin: 7px 0 0;
  color: var(--explorer-muted);
}

.route-explorer-recorder .tour-route-status:empty { display: none; }

.route-explorer-recorder .tour-route-strava {
  grid-template-columns: 32px 1fr;
  gap: 8px;
  margin-top: 9px;
  padding: 9px;
  background: rgba(255, 244, 238, .78);
  border-color: rgba(252, 76, 2, .18);
  border-radius: 10px;
}

.route-explorer-recorder .strava-mark {
  width: 32px;
  height: 32px;
  font-size: .8rem;
  border-radius: 8px;
}

.route-explorer-recorder .tour-route-strava p { margin: 1px 0 2px; font-size: .56rem; }
.route-explorer-recorder .tour-route-strava small { display: none; }
.route-explorer-recorder .tour-route-strava a,
.route-explorer-recorder .tour-route-strava .strava-device-action { font-size: .56rem; }

.route-explorer-info {
  bottom: 18px;
  overflow: hidden;
}

.route-explorer-info > summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.route-explorer-info > summary::-webkit-details-marker { display: none; }
.route-explorer-info > summary span { color: var(--explorer-muted); font-size: .5rem; font-weight: 900; letter-spacing: .1em; }
.route-explorer-info > summary strong { grid-column: 1; color: var(--explorer-ink); font-size: .72rem; }
.route-explorer-info > summary i { grid-row: 1 / 3; grid-column: 2; color: #ef7e34; font-style: normal; transition: transform .2s ease; }
.route-explorer-info[open] > summary i { transform: rotate(180deg); }

.route-explorer-info__body {
  padding: 0 12px 12px;
}

.route-explorer-info .tour-route-stats {
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.route-explorer-info .tour-route-stats > div {
  padding: 8px 10px;
  background: rgba(229, 231, 240, .7);
  border: 0;
  border-radius: 9px;
}

.route-explorer-info .tour-route-stats strong { font-family: inherit; font-size: .72rem; }
.route-explorer-info .tour-route-stats span { margin: 0; font-size: .5rem; }
.route-explorer-info .tour-route-elevation { margin-top: 7px; padding: 8px 10px; background: rgba(229, 231, 240, .66); border: 0; border-radius: 9px; }
.route-explorer-info .tour-route-elevation canvas { height: 82px; }
.route-explorer-info .tour-route-history { margin-top: 7px; }
.route-explorer-info .tour-route-history summary { padding: 8px 10px; }

.route-explorer-missing {
  top: 50%;
  padding: 20px;
  text-align: center;
  transform: translate(-50%, -50%);
}

.route-explorer-missing strong { display: block; margin-bottom: 5px; }
.route-explorer-missing p { margin: 0; color: var(--explorer-muted); font-size: .68rem; line-height: 1.55; }

.route-peak-marker {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  cursor: pointer;
  background: #f36a2f;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(26, 35, 60, .42);
}

.route-peak-marker span { width: 3px; height: 3px; background: #fff; border-radius: 50%; }
.route-peak-marker.is-active { width: 23px; height: 23px; background: #ef3f46; box-shadow: 0 0 0 7px rgba(239, 63, 70, .2), 0 5px 14px rgba(26, 35, 60, .4); }

.route-end-marker {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #fff;
  font-size: .68rem;
  font-weight: 900;
  background: #09a77c;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 5px 15px rgba(22, 34, 61, .35);
}

.route-end-marker--finish { background: #ef3f46; }
.route-user-marker { width: 22px; height: 22px; background: #38bdf8; border: 4px solid #fff; border-radius: 50%; box-shadow: 0 0 0 6px rgba(56, 189, 248, .28), 0 5px 14px rgba(22, 34, 61, .4); }

@media (max-width: 700px) {
  .route-explorer-toolbar {
    top: 8px;
    right: 8px;
    left: 8px;
    grid-template-columns: 1fr auto;
    gap: 6px;
    min-height: 98px;
    padding: 7px;
    border-radius: 14px;
  }

  .route-explorer-back { min-height: 44px; }
  .route-explorer-back img { width: 68px; height: 27px; }
  .route-explorer-back span { font-size: .59rem; }
  .route-explorer-download { min-height: 44px; padding: 0 10px; }
  .route-explorer-picker { grid-column: 1 / -1; grid-template-columns: 1fr; gap: 3px; }
  .route-explorer-picker > span { display: none; }
  .route-explorer-picker select { min-height: 44px; font-size: .68rem; text-align: center; }
  .route-explorer-map .mapboxgl-ctrl-top-right { top: 114px; }
  .route-explorer-map .mapboxgl-ctrl button { width: 44px; height: 44px; }
  .route-explorer-recorder { top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 10px !important; }
  .route-explorer-recorder > header { margin-bottom: 7px; }
  .route-explorer-recorder .tour-route-live-metrics span { min-height: 48px; padding: 7px 4px; }
  .route-explorer-recorder .tour-route-live-metrics span:nth-child(4) { display: none; }
  .route-explorer-recorder .tour-route-actions button { min-height: 44px; }
  .route-explorer-recorder .tour-route-strava { margin-top: 7px; padding: 7px; }
  .route-explorer-info { top: 114px; bottom: auto; width: calc(100% - 20px); }
  .route-explorer-info:not([open]) { width: auto; min-width: 230px; }
  .route-explorer-info__body { max-height: 38dvh; overflow: auto; }
  .route-explorer-info .tour-route-elevation canvas { height: 72px; }
  .route-explorer-missing { width: calc(100% - 28px); }
}

@media (prefers-reduced-motion: reduce) {
  .route-explorer-info > summary i { transition: none; }
}
