/* v139: GPS button feedback and the coarse-area hint. */
html body.map-shell .map-panel .recenter-button.is-locating { color: var(--shell-accent, #0b4fb3); pointer-events: none; }
html body.map-shell .map-panel .recenter-button.is-locating svg { animation: v139-gps-pulse 1s ease-in-out infinite; transform-origin: 50% 50%; }
html body.map-shell .map-panel .recenter-button.is-locating::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: v139-gps-spin .8s linear infinite;
}
@keyframes v139-gps-spin { to { transform: rotate(360deg); } }
@keyframes v139-gps-pulse { 50% { opacity: .45; transform: scale(.88); } }
@media (prefers-reduced-motion: reduce) {
  html body.map-shell .map-panel .recenter-button.is-locating svg,
  html body.map-shell .map-panel .recenter-button.is-locating::after { animation-duration: 2.4s; }
}
.coarse-area-hint .coarse-area-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.coarse-area-hint .coarse-area-actions button { min-height: 44px; }
.coarse-area-hint .coarse-area-actions button.secondary { background: transparent; box-shadow: none; }
/* QA mobile v139: an open map popup ("Você está aqui", a stop) no longer hides the GPS button; real dialogs and panels still do. */
html body.map-shell:has(.maplibregl-popup):not(:has(dialog[open])):not(.map-shell-planner-open, .map-shell-arrivals-open, .map-shell-menu-open, .origin-picking, .travel-active, .journey-navigation-active) .map-panel .recenter-button:not(.is-locating) { visibility: visible; pointer-events: auto; }
/* QA mobile v139: marker popups ("Você está aqui", destino) focus their close button on open; the tiny × and its stray focus ring sat over the text. */
html body.map-shell .maplibregl-popup-content:has(> .maplibregl-popup-close-button) { padding-right: 40px; }
html body.map-shell .maplibregl-popup-close-button { top: 50%; right: 4px; width: 32px; height: 32px; margin-top: -16px; padding: 0; display: grid; place-items: center; border-radius: 10px; font: 400 20px/1 system-ui, sans-serif; color: var(--muted); }
html body.map-shell .maplibregl-popup-close-button:focus-visible { outline: 2px solid var(--shell-accent, var(--navy)); outline-offset: -2px; }
/* QA desktop v139: "Ver pontos desta região" had the browser's default gray button; both actions now share the app's button shape and fill the row when they wrap. */
.coarse-area-hint .coarse-area-actions button { flex: 1 1 180px; margin: 0; padding: 10px 16px; white-space: nowrap; border-radius: 12px; font: 700 14px/1.2 'DM Sans', sans-serif; cursor: pointer; }
.coarse-area-hint .coarse-area-actions [data-use-coarse-area] { border: 1px solid var(--shell-accent, var(--navy)); background: var(--shell-accent, var(--navy)); color: var(--paper, #fff); }
.coarse-area-hint .coarse-area-actions [data-use-coarse-area]:hover { filter: brightness(1.08); }
.coarse-area-hint .coarse-area-actions button:focus-visible { outline: 3px solid var(--shell-accent, var(--navy)); outline-offset: 2px; }
/* QA mobile v139: at 320–360 px the two coarse-area actions wrapped into two rows and "Informar endereço" fell below the
 * panel's fold (panel max-height ≈ 37% of the screen). Keep them side by side, a little more compact. */
@media (max-width: 360px) {
  body.map-shell .coarse-area-hint { padding-top: 8px; }
  body.map-shell .coarse-area-hint h2 { margin-bottom: 2px; }
  body.map-shell .coarse-area-hint p { font-size: 12.5px; line-height: 1.4; }
  body.map-shell .coarse-area-hint .coarse-area-actions { flex-wrap: nowrap; margin-top: 8px; }
  body.map-shell .coarse-area-hint .coarse-area-actions button { flex: 1 1 0; min-width: 0; padding: 6px 8px; font-size: 13px; }
}

/* v146: GPS precision guide — the phone sends only its approximate location (±2 km) or the signal is weak.
 * Same card as "Quase lá", left-aligned so the settings steps read as a list; violet tokens in both themes. */
html body.map-shell .coarse-area-hint .coarse-area-actions [data-choose-origin]:not(.secondary) { border: 1px solid var(--l360-blue); background: var(--l360-blue); color: var(--l360-on-primary, #fff); }
html body.map-shell .coarse-area-hint .coarse-area-actions button.secondary { border: 1px solid var(--line); color: var(--night-link, var(--l360-blue)); }
html body.map-shell .gps-precision-card { padding: 14px 2px 4px; text-align: left; }
html body.map-shell .gps-precision-card .gps-precision-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
html body.map-shell .gps-precision-card .gps-precision-icon { flex: 0 0 34px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--l360-blue-soft); color: var(--l360-blue); }
html body.map-shell .gps-precision-card .gps-precision-icon svg { width: 20px; height: 20px; }
html body.map-shell .gps-precision-card h2 { margin: 0; font-size: 17px; line-height: 1.25; }
html body.map-shell .gps-precision-card > p { max-width: none; margin: 0 0 10px; font-size: 13px; line-height: 1.45; }
html body.map-shell .gps-precision-steps { display: grid; gap: 8px; margin: 0 0 10px; padding: 10px 12px; list-style: none; counter-reset: gps-step; border-radius: 12px; background: var(--l360-blue-soft); }
html body.map-shell .gps-precision-steps li { counter-increment: gps-step; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; color: var(--l360-ink); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
html body.map-shell .gps-precision-steps li::before { content: counter(gps-step); display: grid; place-items: center; width: 20px; height: 20px; margin-top: 0; border-radius: 50%; background: var(--l360-blue); color: #fff; font: 700 11px/1 'DM Sans', sans-serif; }
html body.map-shell .gps-precision-steps strong { color: var(--l360-blue-strong); font-weight: 700; }
html body.map-shell .gps-precision-retry { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
html body.map-shell .gps-precision-retry span { color: var(--muted); font-size: 12.5px; }
html body.map-shell .gps-precision-retry button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: 0; padding: 8px 14px; border: 1px solid var(--l360-blue-soft-2); border-radius: 999px; background: var(--l360-paper); color: var(--l360-blue); font: 700 13px/1.2 'DM Sans', sans-serif; cursor: pointer; }
html body.map-shell .gps-precision-retry button svg { width: 16px; height: 16px; }
html body.map-shell .gps-precision-retry button:focus-visible { outline: 3px solid var(--shell-accent, var(--l360-blue)); outline-offset: 2px; }
/* Both actions side by side (two short lines at most) so the guide fits above the map buttons. */
html body.map-shell .gps-precision-card .coarse-area-actions { flex-wrap: nowrap; margin-top: 0; }
html body.map-shell .gps-precision-card .coarse-area-actions button { flex: 1 1 0; min-width: 0; padding: 8px 10px; white-space: normal; font-size: 13px; line-height: 1.2; }
html body.map-shell .coarse-area-hint:not(.gps-precision-card) .gps-precision-retry { justify-content: center; margin: 10px 0 0; }
/* The guide needs the room; a 2 km area on the map does not. */
@media (max-width: 600px) {
  html body.map-shell.gps-precision-guide:not(.install-banner-open) .app-shell .control-panel { max-height: min(60dvh, calc(100dvh - var(--shell-top) - var(--shell-bottom) - 12px)); }
}
/* Short phones: the guide scrolls inside the panel; the zoom and Círculo buttons it would half-cover step aside
 * (pinch still zooms; the GPS button stays). */
@media (max-width: 600px) and (max-height: 720px) {
  html body.map-shell.gps-precision-guide .map-panel :is(.circle-pill, .maplibregl-ctrl-top-right, .traffic-button) { visibility: hidden; }
}
@media (max-width: 360px) {
  html body.map-shell .gps-precision-card { padding-top: 10px; }
  html body.map-shell .gps-precision-card .gps-precision-icon { flex-basis: 30px; width: 30px; height: 30px; }
  html body.map-shell .gps-precision-card h2 { font-size: 16px; }
  html body.map-shell .gps-precision-card > p { margin-bottom: 8px; font-size: 12.5px; line-height: 1.4; }
  html body.map-shell .gps-precision-steps { gap: 6px; margin-bottom: 8px; padding: 8px 10px; }
  html body.map-shell .gps-precision-steps li { font-size: 12px; line-height: 1.4; }
  html body.map-shell .gps-precision-retry { margin-bottom: 8px; }
  html body.map-shell .gps-precision-retry span { display: none; }
}
/* Note above the stop list after "Ver pontos desta região" with an approximate-only phone. */
html body.map-shell .gps-precision-note { margin: 0 0 10px; border: 1px solid var(--l360-blue-soft-2); border-radius: 12px; background: var(--l360-blue-soft); color: var(--l360-ink); }
html body.map-shell .gps-precision-note summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; cursor: pointer; font-size: 12.5px; line-height: 1.35; list-style: none; }
html body.map-shell .gps-precision-note summary::-webkit-details-marker { display: none; }
html body.map-shell .gps-precision-note summary svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--l360-blue); }
html body.map-shell .gps-precision-note summary b { color: var(--l360-blue-strong); }
html body.map-shell .gps-precision-note summary:focus-visible { outline: 3px solid var(--shell-accent, var(--l360-blue)); outline-offset: 2px; border-radius: 12px; }
html body.map-shell .gps-precision-note > p { margin: 0; padding: 0 12px 8px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
html body.map-shell .gps-precision-note .gps-precision-steps { margin: 0 12px 8px; padding: 0; background: none; }
html body.map-shell .gps-precision-note .gps-precision-retry { margin: 0; padding: 0 12px 10px; }
:root[data-theme=dark] body.map-shell .gps-precision-card .gps-precision-icon { background: var(--l360-selected); color: var(--l360-link); }
:root[data-theme=dark] body.map-shell .gps-precision-steps { background: var(--l360-raised); }
:root[data-theme=dark] body.map-shell .gps-precision-steps li::before { background: var(--l360-button); }
:root[data-theme=dark] body.map-shell .gps-precision-steps strong,
:root[data-theme=dark] body.map-shell .gps-precision-note summary b,
:root[data-theme=dark] body.map-shell .gps-precision-note summary svg { color: var(--l360-link); }
:root[data-theme=dark] body.map-shell .gps-precision-retry button { border-color: var(--l360-line); background: transparent; color: var(--l360-link); }
:root[data-theme=dark] body.map-shell .gps-precision-note { border-color: var(--l360-line); background: var(--l360-selected); }
:root[data-theme=dark] body.map-shell .gps-precision-note .gps-precision-steps { background: none; }
:root[data-theme=dark] body.map-shell .coarse-area-hint .coarse-area-actions :is([data-choose-origin]:not(.secondary), [data-use-coarse-area]) { border-color: var(--l360-button); background: var(--l360-button); color: #fff; }
