/* Each extension belongs to its native button. Neighbours divide their shared gap. */
#open-info,
.map-btn:not(.tv-launch),
.drawing-dock button,
.sheet:not(#nav-panel) :is(.sheet-close, .appearance-quick, .waypoint-trigger, .primary, .secondary, .quiet-button),
.mode-pills button,
.favorites-types button,
.appearance-setting button,
.waypoint-pages .icon-btn,
.waypoint-search-head .icon-btn,
#waypoint-map-pick .icon-btn,
.search-pages button,
.lane-links button,
.city-shortcuts button,
.tv-panel :is(.tv-icon, .tv-show, .tv-pref, .tv-filters button),
.native-flow-dialog button {
  position: relative;
}

#open-info::before,
#country-view::before,
.map-tools .map-btn::before,
.drawing-dock button::before,
.sheet:not(#nav-panel) :is(.sheet-close, .appearance-quick, .waypoint-trigger, .primary, .secondary, .quiet-button)::before,
.mode-pills button::before,
.favorites-types button::before,
.appearance-setting button::before,
.waypoint-pages .icon-btn::before,
.waypoint-search-head .icon-btn::before,
#waypoint-map-pick .icon-btn::before,
.search-pages button::before,
.lane-links button::before,
.city-shortcuts button::before,
.tv-panel :is(.tv-icon, .tv-show, .tv-pref, .tv-filters button)::before,
.native-flow-dialog button::before {
  content: "";
  position: absolute;
  inset: var(--tap-inset, -4px -3px);
}

/* The split controls share their centre edge; the outer edges can claim map space. */
.map-tools { gap: 12px; }
.map-tools .map-btn-pair { overflow: visible; }
.map-tools .map-btn-pair > :first-child { border-radius: 12px 12px 0 0; --tap-inset: -6px -9px 0; }
.map-tools .map-btn-pair > :last-child { border-radius: 0 0 12px 12px; --tap-inset: 0 -9px -6px; }
.map-tools .compass-btn { --tap-inset: -3px -6px -6px; }
#country-view { --tap-inset: -6px -3px -3px -9px; }
.map-tools > .tv-launch { position: relative; --tap-inset: -6px -7px; }
@media (max-height: 680px) and (orientation: portrait), (max-height: 480px) and (orientation: landscape) {
  .map-tools > .tv-launch { position: absolute; right: 56px; --tap-inset: -4px -5px; }
}
#open-info { --tap-inset: -7px -6px -7px -10px; }
.sheet-close, .waypoint-search-head .icon-btn, #waypoint-map-pick .icon-btn {
  --tap-inset: -8px;
}
#open-draw { --tap-inset: -5px 0 -5px -5px; }
#open-saved { --tap-inset: -5px -5px -5px 0; }

#planner .section-title { column-gap: 12px; }
#planner :is(.appearance-quick,.waypoint-trigger) { --tap-inset: -6px -5px; }
.trip-fields { grid-template-columns: 19px minmax(0, 1fr) 48px; }
.trip-entry { position: relative; min-height: 44px; }
.trip-entry label::before { content: ""; position: absolute; inset: 0; cursor: text; }
.trip-entry input { position: relative; }
.trip-fields .swap-control { width: 48px; min-height: 52px; }
#via-input { min-height: 44px; }

.sheet:not(#nav-panel) .primary { --tap-inset: -4px -3px; }
.city-shortcuts button, .route-option { --tap-inset: -3px -2px; }
.route-option::before { content: ""; position: absolute; inset: var(--tap-inset); }
.mode-pills button, .favorites-types button, .appearance-setting button, .tv-filters button {
  --tap-inset: -5px -1px;
}
#info-panel .info-tabs input { inset: -5px 0; height: calc(100% + 10px); }
#info-panel .info-tabs { margin-block: 6px; }
.draw-edit, .file-actions { column-gap: 8px; }
.draw-edit button, .file-actions button { --tap-inset: -4px -4px; }

#waypoint-list li { grid-template-columns: minmax(0, 1fr) repeat(3, 48px); }
#favorites-list li { grid-template-columns: minmax(0, 1fr) repeat(2, 48px); }
#waypoint-list button, #favorites-list button, .waypoint-add, .favorite-add {
  min-height: 48px;
}
.waypoint-pages { min-height: 46px; }
.waypoint-pages .icon-btn { --tap-inset: -6px -8px; }
.waypoint-search-head { min-height: 46px; }
#waypoint-editor .waypoint-search-head .icon-btn { --tap-inset: -4px -8px; }
.search-pages, .lane-links { min-height: 44px; align-items: center; }
.search-pages button, .lane-links button { --tap-inset: -6px -3px; }
.search-popover .search-hit, #search-results > button, .search-popover .pick-map { min-height: 44px; }

.saved-actions { row-gap: 12px; }
.saved-actions .quiet-button { --tap-inset: -5px -2px; }
.saved-row .saved-actions { row-gap: 12px; }
.saved-row .saved-actions .quiet-button { min-height: 34px; }
.tv-panel .tv-head, .tv-panel .tv-read-controls { column-gap: 10px; }
.tv-panel .tv-icon { --tap-inset: -5px; }
.tv-panel .tv-show, .native-flow-dialog button { --tap-inset: -4px -3px; }
.tv-panel .tv-pref { --tap-inset: -4px 0; }

@media (max-width: 700px) {
  .trip-fields { grid-template-columns: 14px minmax(0, 1fr) 48px; }
  .map-tools:not(:has(.tv-launch)) { gap: 11px; }
}
@media (max-width: 360px), (max-height: 480px) and (orientation: landscape) {
  #planner .section-title { column-gap: 10px; }
  .trip-entry { min-height: 40px; }
  #waypoint-list button, #favorites-list button, .waypoint-add, .favorite-add { min-height: 44px; }
  .tv-panel .tv-pref { --tap-inset: -2px 0; }
  .tv-panel .tv-icon { --tap-inset: -3px -5px; }
}
.tv-layer .tv-pin {
  width: var(--traffic-pin-size);
  height: var(--traffic-pin-size);
  top: calc(var(--traffic-pin-size) / -2);
  left: calc(var(--traffic-pin-size) / -2);
}
@container (max-width: 276px) {
  #planner-title { min-width: 0; white-space: normal; font-size: 20px; }
}
