/* MarsGPS — dark map UI */

/* MarsGPS palette: warm black chrome (contrast against the red ground) with a copper accent inside the panels.
   Map overlays (route bubbles, pins, grade colours) stay cool blue/white on purpose: they sit on red terrain. */
:root {
  --gm-surface: #141110;
  --gm-surface-elevated: #201b18;
  --gm-surface-hover: #29221e;
  --gm-border: #3a302a;
  --gm-text-primary: #f3ede7;
  --gm-text-secondary: #a99c92;
  --gm-accent: #ff9a5c;
  --gm-accent-solid: #c1440e; /* the favicon red */
  --gm-accent-tint: rgba(255, 154, 92, 0.14);
  --gm-red: #ea4335;
  --gm-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0807;
  color: var(--gm-text-primary);
  font-family: -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Full-Bleed Map Viewport */
.gm-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#mars-map-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#mars-map-canvas:active {
  cursor: grabbing;
}

/* Directions panel (left on desktop; a bottom sheet with the trip card pinned to the top on phones) */
.gm-directions-drawer {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 392px;
  max-width: calc(100vw - 24px);
  background: var(--gm-surface);
  border: 3px solid var(--gm-border);
  border-radius: 16px;
  box-shadow: var(--gm-shadow), 0 0 0 1px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}

.gm-drawer-header {
  padding: 12px 12px 8px 16px;
}

.gm-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gm-logo-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gm-logo-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--gm-text-primary);
  letter-spacing: -0.01em;
}

.gm-logo-text {
  font-weight: 700;
  letter-spacing: -0.035em;
}

.gm-logo-text span {
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-left: 0.04em;
  color: #f0703a;
  background: linear-gradient(180deg, #ff9a5c, #e2502a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gm-round-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--gm-text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.gm-round-btn:hover {
  background: var(--gm-surface-hover);
  color: var(--gm-text-primary);
}

/* Start and destination */
.gm-trip {
  margin: 0 12px;
  padding: 6px 4px 6px 10px;
  background: var(--gm-surface-elevated);
  border-radius: 12px;
}

.gm-waypoints-grid {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gm-connector-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 16px;
  flex-shrink: 0;
}

.gm-origin-ring {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #4cd07a;
}

.gm-dotted-stem {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 2px 0;
}

.gm-dotted-stem span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gm-text-secondary);
}

.gm-inputs-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gm-input {
  width: 100%;
  background: transparent;
  color: var(--gm-text-primary);
  border: none;
  border-radius: 6px;
  padding: 7px 6px;
  font-size: 14px;
  outline: none;
  text-overflow: ellipsis;
}

.gm-input + .gm-input {
  border-top: 1px solid var(--gm-border);
  border-radius: 0 0 6px 6px;
}

.gm-input:focus {
  background: var(--gm-surface-hover);
}

.gm-swap-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  color: var(--gm-text-secondary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.gm-swap-btn:hover {
  background: var(--gm-surface-hover);
  color: var(--gm-text-primary);
}

.gm-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 16px;
  overscroll-behavior: contain;
}

/* Travel modes, each with its time for this route */
.gm-travel-modes {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.gm-mode-tab {
  background: transparent;
  color: var(--gm-text-secondary);
  border: 1px solid var(--gm-border);
  border-radius: 999px;
  padding: 4px 6px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  white-space: nowrap;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.gm-mode-tab:hover {
  background: var(--gm-surface-hover);
}

.gm-mode-tab svg {
  width: 17px;
  height: 17px;
  flex: none;
  margin-right: 1px;
}

.gm-mode-time {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gm-text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.gm-mode-unit {
  font-size: 10.5px;
  line-height: 1.2;
}

.gm-mode-tab.active {
  background: var(--gm-accent-tint);
  border-color: var(--gm-accent);
  color: var(--gm-accent);
}

.gm-mode-tab.active .gm-mode-time {
  color: var(--gm-accent);
}

/* Helicopter view */
.gm-flyover {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #caa07a 0%, #b88661 28%, #6b4433 29%, #3d2a22 100%);
  isolation: isolate;
}

.gm-flyover canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}

.gm-flyover.no-webgl {
  display: none;
}

.gm-fly-tags {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.gm-fly-tag {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(20, 16, 14, 0.74);
  white-space: nowrap;
  will-change: transform;
}

.gm-fly-place {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.93);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  will-change: transform;
}

.gm-fly-chip {
  position: absolute;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(20, 16, 14, 0.6);
  border-radius: 8px;
  padding: 2px 6px;
  pointer-events: none;
  max-width: 62%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-fly-chip:empty {
  display: none;
}

.gm-fly-tl {
  left: 8px;
  top: 8px;
}

.gm-fly-tr {
  left: 8px;
  bottom: 8px;
}

.gm-fly-br {
  right: 8px;
  bottom: 8px;
  max-width: 48%;
}

.gm-fly-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #f3dcc2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: opacity 0.3s;
}

.gm-fly-status.hidden {
  opacity: 0;
}

.gm-fly-expand {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 16, 14, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.gm-flyover.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 90;
  border-radius: 0;
  aspect-ratio: auto;
  /* plain dark under the canvas: iOS Safari tints its bars from this and keeps the tint after full screen closes */
  background: #141110;
}

.gm-flyover.fullscreen .gm-fly-expand {
  top: calc(10px + env(safe-area-inset-top));
  right: 10px;
  width: 40px;
  height: 40px;
}

/* Elevation profile */
.gm-elevation-section {
  margin-top: 10px;
}

.gm-elev-canvas-wrap {
  height: 92px;
  width: 100%;
  position: relative;
}

#elevation-profile-canvas,
#elevation-marker-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#elevation-profile-canvas {
  cursor: ew-resize;
  touch-action: pan-y;
}

#elevation-marker-canvas {
  pointer-events: none;
}

.gm-profile-ends {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--gm-text-secondary);
  white-space: nowrap;
}

.gm-profile-ends b {
  color: var(--gm-text-primary);
  font-weight: 600;
}

.gm-prof-live {
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-profile-source {
  font-size: 10.5px;
  color: var(--gm-text-secondary);
  opacity: 0.75;
  margin-top: 1px;
}

/* The two routes */
.gm-route-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.gm-route-card {
  text-align: left;
  border: 1px solid var(--gm-border);
  border-radius: 12px;
  padding: 8px 10px 8px;
  background: transparent;
  color: var(--gm-text-primary);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  transition: background 0.15s, border-color 0.15s;
}

.gm-route-card:hover {
  background: var(--gm-surface-hover);
}

.gm-route-card.selected {
  border-color: var(--gm-accent);
  background: var(--gm-accent-tint);
}

.gm-rc-k {
  font-size: 11px;
  color: var(--gm-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.gm-rc-k i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: #a99c92;
}

.gm-route-card.selected .gm-rc-k {
  color: var(--gm-accent);
}

.gm-route-card.selected .gm-rc-k i {
  background: var(--gm-accent);
}

.gm-rc-big {
  font-size: 12px;
  color: var(--gm-text-secondary);
  white-space: nowrap;
}

.gm-rc-time {
  font-size: 21px;
  font-weight: 650;
  color: var(--gm-text-primary);
  font-variant-numeric: tabular-nums;
}

.gm-rc-sub {
  font-size: 11.5px;
  color: var(--gm-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-route-why,
.gm-route-fact {
  font-size: 12px;
  line-height: 1.45;
  color: var(--gm-text-secondary);
  margin: 9px 2px 0;
}

.gm-route-why {
  padding: 8px 10px;
  border-left: 3px solid #4f8ff7;
  background: rgba(79, 143, 247, 0.08);
  border-radius: 0 8px 8px 0;
  color: var(--gm-text-primary);
}

.gm-route-fact {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.gm-fact-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.gm-fact-row svg {
  flex: none;
  margin-top: 1px;
  color: var(--gm-accent);
}

.gm-route-why b,
.gm-route-fact strong {
  color: var(--gm-text-primary);
  font-weight: 600;
}

.gm-route-why:empty,
.gm-route-fact:empty {
  display: none;
}

/* Folded rows: steps, avoid options, famous drives */
.gm-folds {
  margin-top: 12px;
  border-top: 1px solid var(--gm-border);
}

.gm-fold,
.gm-fold-row {
  border-bottom: 1px solid var(--gm-border);
}

.gm-fold summary {
  list-style: none;
  display: flex;
  align-items: center;
  padding: 11px 2px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gm-text-primary);
}

.gm-fold summary::-webkit-details-marker {
  display: none;
}

.gm-fold summary::after {
  content: "›";
  color: var(--gm-text-secondary);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s;
}

.gm-fold[open] summary::after {
  transform: rotate(90deg);
}

.gm-fold-meta {
  margin-left: auto;
  margin-right: 10px;
  font-size: 12px;
  color: var(--gm-text-secondary);
}

.gm-fold-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 2px;
  font-size: 13px;
  color: var(--gm-text-primary);
}

.gm-avoid-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.gm-pill-toggle {
  position: relative;
  cursor: pointer;
}

.gm-pill-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gm-pill-toggle span {
  display: inline-block;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--gm-border);
  color: var(--gm-text-secondary);
  user-select: none;
}

.gm-pill-toggle input:checked + span {
  background: var(--gm-accent-tint);
  border-color: transparent;
  color: var(--gm-accent);
}

.gm-pill-toggle input:focus-visible + span {
  outline: 2px solid var(--gm-accent);
  outline-offset: 1px;
}

.gm-presets-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 12px;
}

.gm-chip {
  background: var(--gm-surface-elevated);
  color: var(--gm-text-primary);
  border: 1px solid var(--gm-border);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.gm-chip:hover {
  background: var(--gm-surface-hover);
  border-color: var(--gm-accent);
}

/* Turn-by-turn steps */
.gm-steps-list {
  padding: 0 0 10px;
}

.gm-step-row {
  display: flex;
  gap: 12px;
  padding: 9px 4px;
  cursor: pointer;
  border-radius: 8px;
}

.gm-step-row:hover {
  background: var(--gm-surface-hover);
}

.gm-step-icon {
  width: 22px;
  height: 22px;
  color: var(--gm-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.gm-step-content {
  flex: 1;
  min-width: 0;
}

.gm-step-primary {
  font-size: 13px;
  font-weight: 500;
  color: var(--gm-text-primary);
}

.gm-step-secondary {
  font-size: 12px;
  color: var(--gm-text-secondary);
  margin-top: 2px;
}

.gm-step-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--gm-text-secondary);
}

.gm-step-line {
  flex: 1;
  height: 1px;
  background: var(--gm-border);
}

.gm-layers-btn {
  display: none;
}

/* Floating Bottom-Center Place Sheet (knowledge card) */
.gm-place-card {
  position: absolute;
  bottom: 24px;
  left: 420px;
  width: 440px;
  max-width: calc(100vw - 440px);
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 16px;
  box-shadow: var(--gm-shadow);
  padding: 14px;
  display: flex;
  gap: 14px;
  z-index: 15;
}

.gm-place-media {
  width: 124px;
  height: 124px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #201b18;
  border: 1px solid var(--gm-border);
}

#place-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#place-photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}

.gm-place-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.gm-place-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.gm-place-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gm-text-primary);
}

.gm-place-subtitle {
  font-size: 12px;
  color: var(--gm-text-secondary);
  margin-top: 1px;
}

.gm-close-btn {
  background: transparent;
  color: var(--gm-text-secondary);
  border: none;
  cursor: pointer;
  padding: 2px;
}

.gm-close-btn:hover {
  color: var(--gm-text-primary);
}

.gm-place-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
  font-size: 11px;
  color: var(--gm-accent);
}

.gm-place-desc {
  font-size: 12px;
  color: var(--gm-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gm-place-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.gm-pill-action {
  background: var(--gm-surface-elevated);
  color: var(--gm-accent);
  border: 1px solid var(--gm-border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.gm-pill-action:hover {
  background: var(--gm-accent-tint);
  border-color: var(--gm-accent);
}

/* Floating Top-Right Layers Bar & MOLA Scale Legend */
.gm-top-right-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 15;
}

.gm-layer-switcher {
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 999px;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  box-shadow: var(--gm-shadow);
}

.gm-layer-btn {
  background: transparent;
  color: var(--gm-text-secondary);
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.gm-layer-btn.active {
  background: var(--gm-accent-solid);
  color: #ffffff;
}

.gm-globe-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--gm-text-primary);
  border-left: 1px solid var(--gm-border);
  cursor: pointer;
}

.gm-hardware-toggle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: var(--gm-text-secondary);
  border: none;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.gm-hardware-toggle-btn:hover {
  background: rgba(251, 188, 4, 0.14);
}

.gm-hardware-toggle-btn.active {
  background: var(--gm-accent-tint);
  color: var(--gm-accent);
}

.gm-hardware-drawer {
  width: 300px;
  max-height: 330px;
  background: rgba(20, 17, 16, 0.96);
  border: 1px solid var(--gm-border);
  border-radius: 12px;
  box-shadow: var(--gm-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.gm-hardware-drawer.hidden {
  display: none;
}

.gm-hardware-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--gm-border);
}

.gm-hardware-title {
  font-size: 13px;
  font-weight: 600;
  color: #fdd663;
}

.gm-hardware-subtitle {
  font-size: 11px;
  color: var(--gm-text-secondary);
  margin-top: 1px;
}

.gm-hardware-list {
  overflow-y: auto;
  max-height: 270px;
  padding: 4px 0;
}

.gm-hardware-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(58, 48, 42, 0.45);
  transition: background 0.12s;
}

.gm-hardware-item:last-child {
  border-bottom: none;
}

.gm-hardware-item:hover {
  background: var(--gm-surface-hover);
}

.gm-hardware-item.selected {
  background: rgba(251, 188, 4, 0.14);
  border-left: 3px solid #fbbc04;
}

.gm-hw-item-main {
  min-width: 0;
  flex: 1;
}

.gm-hw-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--gm-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-hw-item-meta {
  font-size: 10.5px;
  color: var(--gm-text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-hw-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.gm-hw-badge.active {
  background: rgba(129, 201, 149, 0.16);
  color: #81c995;
  border: 1px solid rgba(129, 201, 149, 0.4);
}

.gm-hw-badge.historic {
  background: rgba(253, 214, 99, 0.14);
  color: #fdd663;
  border: 1px solid rgba(253, 214, 99, 0.35);
}

.gm-mola-legend {
  background: rgba(20, 17, 16, 0.92);
  border: 1px solid var(--gm-border);
  border-radius: 999px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--gm-text-secondary);
  box-shadow: var(--gm-shadow);
}

.gm-mola-bar {
  width: 96px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    #342220 0%,
    #563026 18%,
    #804430 35%,
    #a65a3a 50%,
    #c47448 64%,
    #d8905c 76%,
    #e4ae7e 88%,
    #faeee2 100%
  );
}

/* Bottom-right zoom stack & scale footer. The stack is as wide as the footer line, so the empty space above the
   footer and left of the zoom pill would swallow pin drags and taps on the map: only the pill and the footer take
   the pointer. */
.gm-bottom-right-stack {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 15;
  pointer-events: none;
}

.gm-bottom-right-stack > * {
  pointer-events: auto;
}

.gm-zoom-pill {
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 8px;
  box-shadow: var(--gm-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gm-icon-ctrl {
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--gm-text-primary);
  border: none;
  border-bottom: 1px solid var(--gm-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

.gm-icon-ctrl:last-child {
  border-bottom: none;
}

.gm-icon-ctrl:hover {
  background: var(--gm-surface-hover);
}

.gm-telemetry-footer {
  background: rgba(20, 17, 16, 0.9);
  border: 1px solid var(--gm-border);
  border-radius: 6px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--gm-text-secondary);
  font-variant-numeric: tabular-nums;
}

.gm-scale-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gm-scale-line {
  width: 64px;
  height: 5px;
  border-bottom: 2px solid var(--gm-text-primary);
  border-left: 2px solid var(--gm-text-primary);
  border-right: 2px solid var(--gm-text-primary);
}


/* =========================================================================
   MarsGPS additions: brand mark, loading chip, about sheet, phone bottom sheet
   ========================================================================= */
.gm-viewport {
  height: 100dvh;
}

#mars-map-canvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.gm-logo-mark {
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.gm-sheet-handle {
  display: none;
}


.gm-loading {
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: var(--gm-surface-elevated);
  color: var(--gm-text-secondary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--gm-border);
  box-shadow: var(--gm-shadow);
  pointer-events: none;
  white-space: nowrap;
}

.gm-about {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.gm-about-card {
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px 22px 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--gm-text-primary);
  box-shadow: var(--gm-shadow);
}

.gm-about-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.gm-about-card h2 {
  font-size: 18px;
  font-weight: 600;
}

.gm-about-card h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gm-text-secondary);
  margin: 14px 0 4px;
}

.gm-about-card p,
.gm-about-card ul {
  margin: 6px 0;
  color: #e2d8d0;
}

.gm-about-card ul {
  padding-left: 18px;
}

.gm-about-card a {
  color: var(--gm-accent);
}

.gm-about-foot {
  color: var(--gm-text-secondary) !important;
  font-size: 12px;
  margin-top: 14px !important;
}

/* Full-screen flyover sits above everything (the panel is its stacking context) */
body.fly-full .gm-directions-drawer {
  z-index: 100;
}

/* Mars time rides in the map footer */
.gm-telemetry-footer .gm-mars-now {
  font-variant-numeric: tabular-nums;
}

/* Phones: the panel is a bottom sheet (peek / half / full, height in --sheet-h set by app.js), the trip card is
   pinned to the top, and one round button opens the map layers. */
@media (max-width: 760px) {
  :root {
    --sheet-h: 57dvh;
  }

  .gm-directions-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: var(--sheet-h);
    border-radius: 18px 18px 0 0;
    border-width: 1px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transition: height 0.28s ease;
  }

  .gm-directions-drawer.dragging {
    transition: none;
  }

  .gm-sheet-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 24px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0;
    cursor: grab;
    touch-action: none;
  }

  .gm-sheet-handle span {
    width: 38px;
    height: 5px;
    border-radius: 3px;
    background: #5a4d45;
  }

  .gm-drawer-header {
    display: none;
  }

  .gm-trip {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    left: 10px;
    right: 62px;
    z-index: 25;
    margin: 0;
    padding: 3px 2px 3px 10px;
    background: rgba(20, 17, 16, 0.95);
    border: 1px solid var(--gm-border);
    box-shadow: var(--gm-shadow);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  /* 16 px stops iOS Safari zooming the page when an input gets focus */
  .gm-input {
    font-size: 16px;
    padding: 6px 4px;
  }

  .gm-drawer-body {
    padding: 0 12px 16px;
  }

  .gm-travel-modes {
    gap: 5px;
  }

  .gm-mode-tab {
    padding: 4px 4px;
  }

  .gm-flyover {
    aspect-ratio: 16 / 9;
  }

  .gm-elev-canvas-wrap {
    height: 70px;
  }

  .gm-layers-btn {
    display: grid;
    place-items: center;
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--gm-border);
    background: rgba(20, 17, 16, 0.95);
    color: var(--gm-text-primary);
    box-shadow: var(--gm-shadow);
    z-index: 25;
    cursor: pointer;
  }

  .gm-layers-btn[aria-expanded="true"] {
    color: var(--gm-accent);
  }

  /* The layer bar drops down under the layers button */
  .gm-top-right-controls {
    display: none;
    top: calc(90px + env(safe-area-inset-top)); /* opens below the trip card (10 px + ~70 px tall) */
    right: 10px;
    left: 10px;
  }

  .gm-top-right-controls.open {
    display: flex;
  }

  .gm-layer-switcher {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0;
    padding: 3px;
    border-radius: 999px;
    max-width: 100%;
    margin-left: auto;
  }
  .gm-layer-btn {
    padding: 8px 9px;
    font-size: 12px;
  }
  .gm-long {
    display: none;
  }
  .gm-globe-toggle {
    padding: 0 7px;
    font-size: 12px;
    gap: 4px;
  }
  .gm-hardware-toggle-btn {
    padding: 6px 9px 6px 8px;
  }
  .gm-hardware-toggle-btn span {
    display: none;
  }

  .gm-mola-legend {
    display: none;
  }

  .gm-hardware-drawer {
    width: min(360px, calc(100vw - 20px));
    max-height: 36dvh;
  }

  .gm-hardware-list {
    max-height: calc(36dvh - 60px);
  }

  .gm-place-card {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    bottom: calc(var(--sheet-h) + 10px);
    padding: 10px 12px;
    gap: 10px;
  }

  .gm-directions-drawer.sheet-full ~ .gm-place-card {
    display: none;
  }

  .gm-place-media {
    width: 64px;
    height: 64px;
  }

  .gm-place-desc {
    display: none;
  }

  .gm-place-actions {
    margin-top: 6px;
  }

  .gm-bottom-right-stack {
    display: none;
  }

  .gm-loading {
    bottom: calc(var(--sheet-h) + 10px);
  }
}


/* Rover-track readout: sol and odometer at the hovered / tapped point of a driven path */
.gm-track-tip {
  position: absolute;
  z-index: 6;
  transform: translate(-50%, calc(-100% - 12px));
  background: rgba(20, 17, 16, 0.94);
  border: 1px solid rgba(255, 213, 74, 0.55);
  color: #ffe08a;
  font: 500 12px/1.3 -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.gm-track-tip.hidden {
  display: none;
}

/* Right-click / long-press menu on the map */
.gm-map-menu {
  position: fixed;
  z-index: 40;
  min-width: 210px;
  padding: 6px;
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 12px;
  box-shadow: var(--gm-shadow);
  display: flex;
  flex-direction: column;
}
.gm-map-menu.hidden {
  display: none;
}
.gm-map-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--gm-text-primary);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.gm-map-menu button:hover,
.gm-map-menu button:focus-visible {
  background: var(--gm-surface-hover);
  outline: none;
}
.gm-map-menu button svg {
  flex: none;
}
.gm-map-menu-coords {
  padding: 6px 10px 3px;
  margin-top: 4px;
  border-top: 1px solid var(--gm-border);
  color: var(--gm-text-secondary);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
