/* Compact directions leave the map and the original five-item menu available. */
.route-box.route-compact {
  position: fixed;
  inset: auto 12px calc(var(--main-menu-bottom, var(--menu-bottom, 68px)) + 88px);
  z-index: 80;
  display: grid;
  gap: 12px;
  width: auto;
  max-height: max(
    128px,
    calc(
      100dvh - var(--main-menu-top, 0px) - var(--main-menu-bottom, var(--menu-bottom, 68px)) - 172px
    )
  );
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--color-border) var(--color-surface);
}
.route-compact .route-head {
  position: sticky;
  top: 0;
  z-index: 1;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
}
.route-compact .route-to {
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.route-compact .route-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  background: var(--color-surface);
}
.route-compact .route-close svg {
  width: 20px;
  height: 20px;
}
.route-compact .route-summary {
  flex-wrap: wrap;
  gap: 8px 16px;
  min-height: 28px;
  font-variant-numeric: tabular-nums;
}
.route-compact .route-time {
  color: var(--map-route-label);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}
.route-compact .route-distance {
  color: var(--color-muted);
  font-size: 15px;
}
.route-compact .route-google,
.route-compact .route-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.route-compact .route-google {
  color: var(--color-on-primary);
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.route-compact .route-retry {
  justify-self: start;
  color: var(--color-text);
  background: var(--color-surface);
  cursor: pointer;
}
.route-compact .route-close:hover,
.route-compact .route-retry:hover {
  background: var(--color-bg);
}
.route-compact .route-google:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.route-compact :is(button, a):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}
.route-compact .route-problem {
  width: 100%;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.route-compact .route-map-notice {
  font-size: 13px;
  line-height: 1.5;
}
.route-point {
  display: block;
  width: 18px;
  height: 18px;
  border: 3px solid var(--color-surface);
  border-radius: 50%;
  background: var(--map-route-line);
}
.route-point-start {
  width: 14px;
  height: 14px;
  background: var(--map-route-casing);
}
@media (min-width: 761px) {
  .route-box.route-compact {
    inset: auto auto 80px calc(var(--main-menu-left, var(--menu-left, 84px)) + 24px);
    width: 360px;
    max-width: calc(100dvw - var(--main-menu-left, var(--menu-left, 84px)) - 48px);
    max-height: calc(100dvh - 160px);
  }
}
@media (max-width: 760px) and (min-height: 521px) {
  /* Keep every map tool available above the full-width directions card. */
  .map-routing .maplibregl-ctrl-bottom-right {
    top: 72px;
    right: 12px;
    bottom: auto;
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }
  .map-routing .maplibregl-ctrl-bottom-right > .maplibregl-ctrl {
    float: none;
    clear: none;
    margin: 0;
  }
}
@media (max-width: 760px) and (max-height: 520px) {
  .route-box.route-compact {
    right: 76px;
    top: auto;
    bottom: calc(var(--main-menu-bottom, var(--menu-bottom, 68px)) + 76px);
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    padding: 8px;
    max-height: calc(100dvh - var(--main-menu-bottom, var(--menu-bottom, 68px)) - 140px);
  }
  .route-compact .route-head {
    grid-column: 1 / -1;
    min-height: 44px;
  }
  .route-compact .route-summary {
    align-items: center;
    flex-wrap: wrap;
    gap: 0 8px;
    min-height: 44px;
  }
  .route-compact .route-time {
    font-size: 18px;
  }
  .route-compact .route-distance {
    font-size: 13px;
    white-space: nowrap;
  }
  .route-compact .route-google {
    padding: 8px;
    font-size: 13px;
    max-width: 240px;
  }
  .route-compact .route-map-notice,
  .route-compact .route-summary:has(.route-problem) {
    grid-column: 1 / -1;
  }
}
@media (min-width: 480px) and (max-width: 760px) and (max-height: 520px) {
  .route-box.route-compact {
    width: min(360px, calc(100dvw - 208px));
  }
}
