/* Light route workspace. Load after routes.css and the shared theme tokens.
   The existing IDs, hidden states, and map-provider colors stay functional. */
.app-shell.mode-route {
  grid-template-columns: 64px minmax(0, 1fr);
}

.route-screen {
  color-scheme: light;
  grid-template-columns: 320px minmax(0, 1fr);
  background: var(--canvas, #f0f1f4);
  color: var(--ink, #17181b);
}

.route-tools {
  gap: 20px;
  padding: 28px 22px;
  background: var(--surface, #ffffff);
  border-color: var(--line, #e3e4e8);
  scrollbar-color: #b4b6bf transparent;
  overscroll-behavior: contain;
}

.route-kicker,
.route-card-top,
.route-detail-top {
  color: var(--muted, #71747c);
  font-size: 12px;
}

.route-kicker { letter-spacing: .12em; }
.route-header h1 {
  margin: 12px 0;
  color: var(--ink, #17181b);
  font-size: 38px;
  line-height: 1.2;
  letter-spacing: -.05em;
}
.route-header h1 em { color: var(--accent, #3d36ed); }
.route-header p {
  display: block;
  color: var(--muted, #71747c);
  font-size: 14px;
  line-height: 1.75;
}

.route-back {
  min-height: 44px;
  padding: 8px 0;
  color: var(--accent, #3d36ed);
  font-size: 13px;
  line-height: 1.5;
}

.route-control-card,
.route-detail {
  padding: 20px;
  border: 1px solid var(--line, #e3e4e8);
  border-radius: var(--radius-card, 24px);
  background: var(--surface-soft, #f8f8fa);
  box-shadow: none;
}
.route-card-top { margin-bottom: 12px; }
.route-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-raised, #f4f4f6);
  color: var(--accent, #3d36ed);
  font-size: 21px;
}
.route-control-card > strong {
  color: var(--ink, #17181b);
  font-size: 18px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}
.route-control-card > p {
  min-height: 0;
  margin: 10px 0 18px;
  color: var(--muted, #71747c);
  font-size: 13px;
  line-height: 1.7;
}
.route-import {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px dashed #c9cbd2;
  border-radius: var(--radius-control, 14px);
  background: var(--surface, #ffffff);
  color: var(--ink, #17181b);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.route-import:hover { background: var(--surface-raised, #f4f4f6); }

.route-place-form { gap: 9px; }
.route-place-form label {
  color: var(--ink, #17181b);
  font-size: 13px;
  line-height: 1.5;
}
.route-place-form > div { gap: 8px; }
.route-place-form input {
  min-height: 48px;
  padding-inline: 14px;
  border: 1px solid var(--line, #e3e4e8);
  border-radius: var(--radius-control, 14px);
  background: var(--canvas, #f0f1f4);
  color: var(--ink, #17181b);
  font-size: 16px;
}
.route-place-form input::placeholder { color: var(--muted, #71747c); opacity: .85; }
.route-place-form input:focus { border-color: var(--accent, #3d36ed); }
.route-place-form button {
  min-width: 60px;
  min-height: 48px;
  padding-inline: 14px;
  border-radius: var(--radius-control, 14px);
  background: var(--accent, #3d36ed);
  color: var(--accent-ink, #ffffff);
  font-size: 13px;
}
.route-place-form button:hover { background: #514af2; }
.route-place-form p {
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.6;
}

.route-stats { gap: 8px; }
.route-stats > div {
  min-height: 78px;
  padding: 13px 5px;
  border: 1px solid var(--line, #e3e4e8);
  border-radius: 16px;
  background: var(--surface-soft, #f8f8fa);
}
.route-stats span {
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.4;
}
.route-stats strong {
  margin-top: 9px;
  color: var(--ink, #17181b);
  font-size: 17px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.route-detail-top {
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.5;
  letter-spacing: .02em;
}
.route-detail-top span:last-child {
  padding: 4px 8px;
  border-radius: 7px;
  background: #eeecff;
  color: var(--accent, #3d36ed);
}
.route-detail > strong {
  margin-top: 14px;
  color: var(--ink, #17181b);
  font-size: 16px;
}
.route-detail > p:not(.route-detail-coordinates) {
  margin: 10px 0 16px;
  color: var(--muted, #71747c);
  font-size: 13px;
  line-height: 1.75;
}
.route-detail-facts { gap: 7px; }
.route-detail-facts > div {
  padding: 11px 4px;
  border-radius: 10px;
  background: var(--canvas, #f0f1f4);
}
.route-detail-facts span { color: var(--muted, #71747c); font-size: 12px; }
.route-detail-facts strong {
  margin-top: 7px;
  color: var(--ink, #17181b);
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
.route-detail-highlights { gap: 7px; margin-top: 14px; }
.route-detail-highlights span {
  padding: 6px 9px;
  border: 1px solid var(--line, #e3e4e8);
  background: var(--surface-raised, #f4f4f6);
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.4;
}
.route-detail-coordinates {
  padding-top: 12px;
  border-color: var(--line, #e3e4e8);
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.route-progress { padding-inline: 2px; }
.route-progress > div { color: var(--muted, #71747c); font-size: 12px; }
.route-progress strong { color: var(--accent, #3d36ed); }
.route-progress progress {
  height: 8px;
  background: var(--surface-raised, #f4f4f6);
  accent-color: var(--accent, #3d36ed);
}
.route-progress progress::-webkit-progress-bar { background: var(--surface-raised, #f4f4f6); }
.route-progress progress::-webkit-progress-value { background: var(--accent, #3d36ed); }
.route-progress progress::-moz-progress-bar { background: var(--accent, #3d36ed); }

.route-actions { gap: 8px; margin-top: 0; }
.route-start,
.route-stop {
  min-height: 50px;
  padding: 12px 17px;
  border-radius: var(--radius-control, 14px);
  background: var(--accent, #3d36ed);
  color: var(--accent-ink, #ffffff);
  font-size: 15px;
  line-height: 1.5;
}
.route-start:hover { background: #514af2; }
.route-stop { background: #bd5948; color: #ffffff; }
.route-stop:hover { background: #aa4c3d; }
.route-clear {
  min-width: 44px;
  min-height: 44px;
  padding: 10px 8px;
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.5;
}
.route-location-message {
  padding: 13px 14px;
  border: 1px solid #edc5ba;
  border-radius: 14px;
  background: #fff3ec;
  color: #a34b2e;
  font-size: 13px;
  line-height: 1.65;
}
.route-privacy {
  display: block;
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.7;
}

/* The map owns a stacking context. Every control occupies a grid cell so GPS,
   IP lookup, navigation, zoom, and provider warnings cannot cover each other. */
.route-map-shell {
  --map-gutter: 16px;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: auto auto auto minmax(118px, 1fr) auto auto auto;
  align-content: stretch;
  gap: 8px;
  min-height: 440px;
  padding: var(--map-gutter);
  background: var(--canvas, #f0f1f4);
}
.route-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    repeating-radial-gradient(ellipse at 24% 36%, transparent 0 23px, #8992a41c 24px 25px, transparent 26px 48px),
    repeating-radial-gradient(ellipse at 94% 100%, transparent 0 31px, #b2bac51a 32px 33px, transparent 34px 65px),
    #f4f5f7;
}
.route-map-heading,
.route-tile-notice,
.route-preview-warning,
.route-map-empty,
.route-map-nav,
.route-zoom,
.route-ip-locate,
.route-locate,
.route-status {
  position: relative;
  inset: auto;
  z-index: 2;
  min-width: 0;
  margin: 0;
  transform: none;
  box-shadow: none;
  backdrop-filter: none;
}
.route-map-heading {
  grid-area: 1 / 1 / 2 / -1;
  align-items: flex-start;
  gap: 10px;
}
.route-map-heading > div {
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line, #e3e4e8);
  border-radius: 14px;
  background: #fffffff2;
  box-shadow: none;
  backdrop-filter: blur(12px);
}
.route-map-heading > div span {
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .04em;
}
.route-map-heading > div strong {
  color: var(--ink, #17181b);
  font-size: 15px;
  line-height: 1.4;
}
.route-live {
  flex: none;
  padding: 10px 11px;
  border: 1px solid var(--line, #e3e4e8);
  border-radius: 999px;
  background: #fffffff2;
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.5;
  box-shadow: none;
}
.route-live.active { color: var(--accent, #3d36ed); }
.route-tile-notice,
.route-preview-warning {
  grid-column: 1 / -1;
  width: auto;
  max-width: none;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.6;
}
.route-tile-notice {
  grid-row: 2;
  border: 1px solid #e9d5a5;
  background: #fff8eaf2;
  color: #86652b;
}
.route-preview-warning {
  grid-row: 3;
  border: 1px solid #ebc6b7;
  background: #fff1eaf2;
  color: #9d4e32;
  font-weight: 600;
}
.route-map-empty {
  grid-area: 4 / 1 / 5 / 6;
  align-self: center;
  justify-self: center;
  width: min(300px, 100%);
  padding: 14px 10px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink, #17181b);
}
.route-map-empty span {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border: 1px solid #d2cff9;
  border-radius: 50%;
  background: #eeedff;
  color: var(--accent, #3d36ed);
  font-size: 28px;
}
.route-map-empty strong { font-size: 16px; line-height: 1.5; }
.route-map-empty p {
  margin-top: 7px;
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.6;
}
.route-map-nav {
  grid-area: 5 / 1 / 6 / -1;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--accent, #3d36ed);
  border-radius: var(--radius-control, 14px);
  background: var(--accent, #3d36ed);
  color: var(--accent-ink, #ffffff);
  font-size: 13px;
  line-height: 1.5;
}
.route-map-nav:hover { background: #514af2; }
.route-map-nav.active { border-color: #bd5948; background: #bd5948; color: #ffffff; }
.route-map-nav.active:hover { background: #aa4c3d; }
.route-zoom {
  grid-area: 4 / 6 / 5 / 7;
  align-self: end;
  justify-self: end;
  width: 46px;
  border: 1px solid var(--line, #e3e4e8);
  border-radius: var(--radius-control, 14px);
  background: var(--surface, #ffffff);
}
.route-zoom button {
  width: 44px;
  height: 44px;
  background: var(--surface, #ffffff);
  color: var(--ink, #17181b);
  font-size: 24px;
}
.route-zoom button + button { border-color: var(--line, #e3e4e8); }
.route-zoom button:hover { background: var(--surface-raised, #f4f4f6); }
.route-locate,
.route-ip-locate {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e3e4e8);
  border-radius: var(--radius-control, 14px);
  background: #fffffff2;
  color: var(--ink, #17181b);
  font-size: 12px;
  line-height: 1.5;
}
.route-locate { grid-area: 6 / 1 / 7 / 4; gap: 7px; }
.route-ip-locate { grid-area: 6 / 4 / 7 / 7; }
.route-locate:hover,
.route-ip-locate:hover { background: #f1f0ff; }
.route-status {
  grid-area: 7 / 1 / 8 / -1;
  width: 100%;
  max-width: none;
  padding: 10px 12px;
  border: 1px solid var(--line, #e3e4e8);
  border-radius: 12px;
  background: #fffffff2;
  color: var(--muted, #71747c);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.route-status[data-tone="warning"] { border-color: #e6c898; background: #fff6e9f2; color: #8b5e24; }
.route-status[data-tone="error"] { border-color: #e6bcb2; background: #fff0ebf2; color: #aa4634; }

.route-screen button:focus-visible,
.route-screen input:focus-visible,
.route-import:focus-visible,
.route-control-card:focus-within .route-import {
  outline: 2px solid var(--accent, #3d36ed);
  outline-offset: 3px;
}

/* Phones and tablets share a map-first, single-pane flow. The 720px parent
   shell includes its 64px navigation rail on widths from 681px to 1199px. */
@media (max-width: 1199px) {
  .route-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .route-map-shell {
    order: 0;
    flex: none;
    height: clamp(460px, 61vh, 560px);
    height: clamp(460px, 61svh, 560px);
    min-height: 460px;
    border-bottom: 1px solid var(--line, #e3e4e8);
  }
  .route-tools {
    order: 1;
    flex: none;
    overflow: visible;
    gap: 20px;
    padding: 28px;
    border: 0;
  }
  .route-header h1 { font-size: 34px; }
  .route-header h1 br { display: none; }
  .route-header p { display: block; }
  .route-actions { flex-direction: row; align-items: center; }
  .route-start,
  .route-stop { flex: 1; }
  .route-clear { flex: none; }
  .route-privacy { display: block; }
}

@media (max-width: 680px) {
  .app-shell.mode-route { display: block; }
  .route-map-shell {
    --map-gutter: 12px;
    height: auto;
    min-height: 440px;
    grid-template-rows: auto auto auto minmax(118px, 1fr) auto auto auto;
  }
  .route-tools {
    gap: 18px;
    padding: 24px 18px max(28px, env(safe-area-inset-bottom, 0px));
  }
  .route-header h1 { margin-block: 9px 12px; font-size: 32px; }
  .route-header p { font-size: 14px; }
  .route-control-card,
  .route-detail { padding: 18px; }
  .route-stats > div { min-height: 76px; padding: 13px 5px; }
  .route-stats strong { margin-top: 8px; font-size: 16px; }
  .route-map-heading { gap: 8px; }
  .route-map-heading > div { padding: 9px 11px; }
  .route-map-heading > div strong { font-size: 14px; }
  .route-live { padding: 9px 10px; }
  .route-map-empty { padding-block: 12px; }
  .route-map-empty strong { font-size: 15px; }
  .route-progress { margin-top: 0; }
}

@media (max-width: 359px) {
  .route-map-heading { flex-wrap: wrap; }
  .route-map-heading > div { flex: 1 1 100%; }
  .route-live { padding: 5px 9px; }
  .route-map-shell { min-height: 480px; }
  .route-tools { padding-inline: 14px; }
  .route-control-card,
  .route-detail { padding: 15px; }
  .route-stats strong { font-size: 15px; }
  .route-actions { flex-direction: column; align-items: stretch; }
  .route-clear { align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  .route-screen *,
  .route-screen *::before,
  .route-screen *::after { scroll-behavior: auto; transition: none; }
}
@media (min-width:1200px) {
  .app-shell.mode-route { grid-template-columns: 76px minmax(0,1fr); }
}
