/**
 * Rahyab mobile shell — reference-matched layout (≤900px).
 * Physical search order LTR: mark → input → mic → avatar (even in RTL).
 * Desktop (≥901px) unchanged.
 */

@media (max-width: 900px) {
  html.consumer-ui,
  html.consumer-ui body {
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  /* —— Bottom nav: compact centered floating pill —— */
  html.consumer-ui .mobile-bottom-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2px;
    direction: ltr;
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(var(--m-gutter), env(safe-area-inset-bottom, 0px));
    z-index: calc(var(--z-controls) + 2);
    width: max-content;
    max-width: calc(
      100vw
      - max(var(--m-gutter), env(safe-area-inset-left, 0px))
      - max(var(--m-gutter), env(safe-area-inset-right, 0px))
      - 72px
    );
    height: var(--m-bottom-nav-h);
    min-height: var(--m-bottom-nav-h);
    padding: 3px 5px;
    margin: 0;
    box-sizing: border-box;
    border: 1px solid var(--m-border);
    border-radius: 999px;
    background: var(--m-surface);
    box-shadow: var(--m-shadow-float);
    pointer-events: auto;
    transform: translateX(-50%);
  }

  html.consumer-ui .mobile-bottom-nav-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--m-text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    flex: 0 0 auto;
    min-height: 0;
    min-width: 0;
    padding: 2px 10px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1.1;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 160ms var(--ease-standard);
  }

  html.consumer-ui .mobile-bottom-nav-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    padding: 4px 12px;
    border-radius: 999px;
    box-sizing: content-box;
    color: inherit;
    transition: background-color 160ms var(--ease-standard), color 160ms var(--ease-standard);
  }

  html.consumer-ui .mobile-bottom-nav-btn[aria-current='page'],
  html.consumer-ui .mobile-bottom-nav-btn.is-active {
    color: var(--m-primary);
    font-weight: 600;
  }

  html.consumer-ui .mobile-bottom-nav-btn[aria-current='page'] svg,
  html.consumer-ui .mobile-bottom-nav-btn.is-active svg {
    background: var(--m-selected);
    color: var(--m-primary);
  }

  html.consumer-ui .mobile-bottom-nav-btn:focus-visible {
    outline: 2px solid var(--m-primary);
    outline-offset: 2px;
  }

  html.consumer-ui:has(#liveNavHud:not([hidden])) .mobile-bottom-nav,
  html.consumer-ui.keyboard-open .mobile-bottom-nav,
  html.consumer-ui:has(.search-omnibox.is-suggest-open) .mobile-bottom-nav {
    display: none;
  }

  html.consumer-ui:has(#liveNavHud:not([hidden])) .mobile-dirs-fab,
  html.consumer-ui.keyboard-open .mobile-dirs-fab,
  html.consumer-ui:has(.search-omnibox.is-suggest-open) .mobile-dirs-fab {
    display: none;
  }

  /* —— Search capsule: physical LTR order —— */
  html.consumer-ui .search-chrome-float,
  html.consumer-ui[dir='rtl'] .search-chrome-float,
  html.consumer-ui[dir='ltr'] .search-chrome-float,
  html.consumer-ui.left-panel-collapsed .search-chrome-float {
    top: max(var(--m-gutter), env(safe-area-inset-top, 0px)) !important;
    left: max(var(--m-gutter), env(safe-area-inset-left, 0px)) !important;
    right: max(var(--m-gutter), env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    pointer-events: none !important;
    z-index: var(--z-search);
  }

  html.consumer-ui .search-chrome-float .search-chrome {
    pointer-events: auto;
    width: 100%;
    min-height: var(--m-search-h);
    padding: 0;
    border-radius: var(--m-search-radius);
    background: var(--m-surface);
    border: 1px solid var(--m-border);
    box-shadow: var(--m-shadow-float);
    align-items: center;
  }

  html.consumer-ui .search-chrome-float .nav-menu-fab,
  html.consumer-ui.left-panel-collapsed .search-chrome-float .nav-menu-fab {
    display: none !important;
  }

  html.consumer-ui .search-chrome-float .search-omnibox,
  html.consumer-ui .search-chrome-float .search-pill {
    background: transparent;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    min-height: var(--m-search-h);
  }

  html.consumer-ui .search-chrome-float .search-pill,
  html.consumer-ui[dir='rtl'] .search-chrome-float .search-pill,
  html.consumer-ui[dir='ltr'] .search-chrome-float .search-pill {
    --search-pill-h: var(--m-search-h);
    height: var(--m-search-h);
    direction: ltr !important;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 6px 0 4px;
  }

  /* Keep physical DOM order: mic → input → pin → account (also in RTL). */
  html.consumer-ui[dir='rtl'] .search-chrome-float .search-pill > .search-voice-btn,
  html.consumer-ui[dir='rtl'] .search-chrome-float .search-pill > input#search,
  html.consumer-ui[dir='rtl'] .search-chrome-float .search-pill > .search-clear,
  html.consumer-ui[dir='rtl'] .search-chrome-float .search-pill > .mobile-search-mark,
  html.consumer-ui[dir='rtl'] .search-chrome-float .search-pill > .search-account-fab {
    order: 0 !important;
  }

  html.consumer-ui .search-chrome-float .search-pill-mark,
  html.consumer-ui .search-chrome-float .search-pill-mark-glyph {
    display: none !important;
  }

  html.consumer-ui .search-chrome-float .search-voice-btn:focus-visible,
  html.consumer-ui .search-chrome-float .search-account-fab:focus-visible {
    outline: 2px solid var(--m-primary);
    outline-offset: 2px;
  }

  html.consumer-ui .search-chrome-float .search-pill input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    font-weight: 400;
    color: var(--m-text);
    background: transparent;
    border: 0;
    outline: none;
    padding: 0 4px;
  }

  html.consumer-ui[dir='rtl'] .search-chrome-float .search-pill input {
    direction: rtl;
    text-align: right;
  }

  html.consumer-ui[dir='ltr'] .search-chrome-float .search-pill input {
    direction: ltr;
    text-align: left;
  }

  html.consumer-ui .search-chrome-float .search-pill input::placeholder {
    color: var(--m-text-secondary);
  }

  html.consumer-ui .search-chrome-float .search-clear {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--m-text-secondary);
  }

  html.consumer-ui .search-chrome-float .search-voice-btn {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--m-text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
  }

  html.consumer-ui .search-chrome-float .search-voice-btn.is-listening {
    color: #c62828;
    background: rgba(198, 40, 40, 0.08);
  }

  html.consumer-ui .search-chrome-float .search-voice-btn:disabled {
    opacity: 0.45;
  }

  html.consumer-ui .search-chrome-float .search-account-fab {
    position: static;
    transform: none;
    display: grid !important;
    place-items: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--m-text-secondary);
    flex: 0 0 auto;
    cursor: pointer;
    padding: 0;
  }

  /* Signed-out: clear circular login affordance (no permanent blue ring). */
  html.consumer-ui .search-chrome-float .search-account-fab:not(.is-signed-in) {
    color: var(--m-text);
  }

  html.consumer-ui .search-chrome-float .search-account-fab:not(.is-signed-in) .search-account-login-icon {
    width: 34px;
    height: 34px;
    padding: 6px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 1.5px solid rgba(48, 56, 62, 0.28);
    background: #f4f6f7;
  }

  html.consumer-ui .search-chrome-float .search-account-fab img,
  html.consumer-ui .search-chrome-float .search-account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }

  html.consumer-ui .search-chrome-float .search-account-icon {
    width: 22px;
    height: 22px;
  }

  html.consumer-ui .search-chrome-float .search-pill-icon,
  html.consumer-ui .search-chrome-float .search-pill-directions,
  html.consumer-ui .search-chrome-float .search-pill-divider {
    display: none !important;
  }

  html.consumer-ui.search-chrome-docked .search-chrome-float,
  html.consumer-ui.directions-panel-open .search-chrome-float,
  html.consumer-ui.library-panel-open .search-chrome-float,
  html.consumer-ui.contribute-panel-open .search-chrome-float {
    display: none !important;
  }

  /* —— Category chips (same horizontal inset as search bar) —— */
  html.consumer-ui .search-category-strip,
  html.consumer-ui.left-panel-collapsed .search-category-strip {
    top: calc(max(var(--m-gutter), env(safe-area-inset-top, 0px)) + var(--m-search-h) + 8px) !important;
    bottom: auto !important;
    left: max(var(--m-gutter), env(safe-area-inset-left, 0px)) !important;
    right: max(var(--m-gutter), env(safe-area-inset-right, 0px)) !important;
    max-width: none !important;
    width: auto !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 6px;
    min-height: var(--m-chip-h);
    max-height: var(--m-chip-h);
    overflow: hidden;
    padding: 0;
    /* Match page dir so RTL starts chips on the right (Google Maps). */
    direction: inherit !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: var(--z-chrome);
  }

  html.consumer-ui .search-category-strip[hidden],
  html.consumer-ui.left-panel-collapsed .search-category-strip[hidden],
  html.consumer-ui.directions-panel-open .search-category-strip,
  html.consumer-ui.place-panel-open .search-category-strip,
  html.consumer-ui.library-panel-open .search-category-strip,
  html.consumer-ui.contribute-panel-open .search-category-strip,
  html.consumer-ui:has(.search-omnibox.is-suggest-open) .search-category-strip {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html.consumer-ui .search-category-strip-scroll {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    direction: inherit;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding-block: 0;
    /* Soft fade on the scroll-end edge so more chips are discoverable. */
    mask-image: none;
    -webkit-mask-image: none;
  }

  html.consumer-ui .search-category-strip-scroll::-webkit-scrollbar {
    display: none;
  }

  html.consumer-ui .search-category-strip.is-overflowing .search-category-strip-scroll {
    mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 36px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 36px), transparent 100%);
  }

  html.consumer-ui[dir='rtl'] .search-category-strip.is-overflowing .search-category-strip-scroll {
    mask-image: linear-gradient(to left, #000 0%, #000 calc(100% - 36px), transparent 100%);
    -webkit-mask-image: linear-gradient(to left, #000 0%, #000 calc(100% - 36px), transparent 100%);
  }

  html.consumer-ui .search-category-strip .search-category-more {
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
    margin: 0;
  }

  html.consumer-ui .search-category-strip .search-category-chip,
  html.consumer-ui .search-category-strip .search-category-more {
    box-sizing: border-box;
    min-height: var(--m-chip-h);
    height: var(--m-chip-h);
    max-height: var(--m-chip-h);
    padding: 0 10px;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    border-radius: 999px;
    background: var(--m-surface);
    color: var(--m-text);
    border: 1px solid rgba(16, 24, 40, 0.12);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  }

  html.consumer-ui .search-category-strip .search-category-chip.active,
  html.consumer-ui .search-category-strip .search-category-more.is-open,
  html.consumer-ui .search-category-strip .search-category-more.has-selection {
    background: var(--m-selected);
    color: var(--m-primary);
    border-color: transparent;
    box-shadow: none;
  }

  html.consumer-ui .search-category-strip .chip-icon {
    display: inline-flex;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    color: var(--m-text);
  }

  html.consumer-ui .search-category-strip .chip-icon svg {
    width: 16px;
    height: 16px;
    display: block;
  }

  html.consumer-ui .search-category-strip .chip-label {
    overflow: visible;
    max-width: none;
    white-space: nowrap;
    line-height: 1.2;
  }

  html.consumer-ui .search-category-more-card {
    position: fixed !important;
    inset-inline: 10px !important;
    bottom: var(--af-bottom-chrome) !important;
    top: auto !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(72vh, calc(100dvh - var(--af-bottom-chrome) - 96px)) !important;
    border-radius: var(--m-sheet-radius) !important;
    box-shadow: var(--m-shadow-sheet) !important;
    z-index: calc(var(--z-menu) + 2) !important;
    padding-bottom: 12px;
    display: flex !important;
    flex-direction: column;
    background: var(--m-surface);
  }

  html.consumer-ui .search-category-more-card[hidden] {
    display: none !important;
  }

  html.consumer-ui .search-category-more-card:not([hidden])::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    margin: 10px auto 4px;
    border-radius: 999px;
    background: #d0d5dd;
  }

  /* —— Floating controls (reference hierarchy) —— */
  html.consumer-ui .map-controls-br {
    right: max(var(--m-gutter), env(safe-area-inset-right, 0px));
    bottom: calc(var(--af-bottom-chrome) + 12px + var(--af-sheet-clearance, 0px) + var(--m-dirs-fab) + 10px);
    gap: 10px;
    z-index: var(--z-controls);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  html.consumer-ui .map-controls-br .map-ctrl-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: transparent;
    box-shadow: none;
    border: 0;
    padding: 0;
  }

  html.consumer-ui .map-controls-br .map-ctrl-tilt,
  html.consumer-ui .map-controls-br .map-ctrl-zoom,
  html.consumer-ui #ctrlFullscreen {
    display: none !important;
  }

  html.consumer-ui .map-controls-br #ctrlLocate,
  html.consumer-ui .map-controls-br .map-ctrl-compass {
    width: var(--m-ctrl);
    height: var(--m-ctrl);
    min-width: var(--m-ctrl);
    min-height: var(--m-ctrl);
    border-radius: 50%;
    border: 1px solid var(--m-border);
    background: var(--m-surface);
    color: var(--m-text);
    box-shadow: var(--m-shadow-float);
  }

  html.consumer-ui .map-controls-br .map-ctrl-compass:not(.is-rotated):not(.is-pitched) {
    display: none;
  }

  html.consumer-ui #ctrlLocate.is-loading {
    opacity: 0.65;
  }

  html.consumer-ui #ctrlLocate.is-denied,
  html.consumer-ui #ctrlLocate.is-unavailable {
    color: var(--af-err);
  }

  /* Layers: upper-right cyan circle below chips */
  html.consumer-ui .layers-control-bl {
    position: fixed;
    left: auto !important;
    right: max(var(--m-gutter), env(safe-area-inset-right, 0px)) !important;
    top: calc(
      max(var(--m-gutter), env(safe-area-inset-top, 0px)) + var(--m-search-h) + 8px + 44px + 10px
    ) !important;
    bottom: auto !important;
    width: var(--m-ctrl);
    height: var(--m-ctrl);
    min-width: var(--m-ctrl);
    min-height: var(--m-ctrl);
    padding: 0;
    margin: 0;
    border-radius: 50%;
    border: 0;
    background: var(--m-selected);
    box-shadow: var(--m-shadow-float);
    z-index: var(--z-controls);
    display: grid;
    place-items: center;
    overflow: hidden;
  }

  html.consumer-ui .layers-control-bl .layers-thumb,
  html.consumer-ui .layers-control-bl > span[data-i18n],
  html.consumer-ui .layers-control-bl > span:not(.layers-thumb):not(.layers-tools-icon) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  html.consumer-ui .layers-control-bl .layers-tools-icon {
    display: grid;
    place-items: center;
    width: var(--m-icon);
    height: var(--m-icon);
    color: var(--m-primary);
  }

  html.consumer-ui .layers-control-bl .layers-tools-icon svg {
    width: var(--m-icon);
    height: var(--m-icon);
  }

  /* Directions FAB — match Locate: white circle, dark icon */
  html.consumer-ui .mobile-dirs-fab {
    position: fixed;
    right: max(var(--m-gutter), env(safe-area-inset-right, 0px));
    bottom: calc(var(--af-bottom-chrome) + 12px + var(--af-sheet-clearance, 0px));
    width: var(--m-ctrl);
    height: var(--m-ctrl);
    min-width: var(--m-ctrl);
    min-height: var(--m-ctrl);
    border: 1px solid var(--m-border);
    border-radius: 50%;
    background: var(--m-surface);
    color: var(--m-text);
    box-shadow: var(--m-shadow-float);
    z-index: var(--z-controls);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
  }

  html.consumer-ui .mobile-dirs-fab svg {
    width: var(--m-icon);
    height: var(--m-icon);
    display: block;
  }

  html.consumer-ui .mobile-dirs-fab:active {
    background: #f2f2f2;
  }

  html.consumer-ui .mobile-dirs-fab:focus-visible {
    outline: 2px solid var(--m-primary);
    outline-offset: 3px;
  }

  html.consumer-ui.directions-panel-open .mobile-dirs-fab,
  html.consumer-ui.place-panel-open .mobile-dirs-fab,
  html.consumer-ui.library-panel-open .mobile-dirs-fab,
  html.consumer-ui.contribute-panel-open .mobile-dirs-fab {
    display: none;
  }

  html.consumer-ui .layers-menu {
    left: 10px !important;
    right: 10px !important;
    bottom: var(--af-bottom-chrome) !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(70vh, calc(100dvh - var(--af-bottom-chrome) - 80px));
    border-radius: var(--m-sheet-radius);
    border: 1px solid var(--m-border);
    box-shadow: var(--m-shadow-sheet);
    padding: 8px 12px 12px;
    overflow: auto;
    background: var(--m-surface);
  }

  html.consumer-ui .layers-menu:not([hidden])::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    margin: 4px auto 10px;
    border-radius: 999px;
    background: #d0d5dd;
  }

  html.consumer-ui .layers-menu .map-tools-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 0 0 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--m-border);
  }

  html.consumer-ui .layers-menu .map-tools-btn {
    appearance: none;
    border: 1px solid var(--m-border);
    border-radius: 14px;
    background: var(--m-surface);
    color: var(--m-text);
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
  }

  html.consumer-ui .layers-menu .map-tools-btn[aria-pressed='true'] {
    background: var(--m-selected);
    color: var(--m-primary);
    border-color: transparent;
  }

  html.consumer-ui .layers-menu > button[aria-pressed='true'] {
    background: var(--m-selected);
    color: var(--m-primary);
  }

  /* Hide MapLibre attribution "i" chip on mobile home (clutters FAB stack) */
  html.consumer-ui .maplibregl-ctrl-bottom-right,
  html.consumer-ui .maplibregl-ctrl-attrib {
    display: none !important;
  }

  /* Sheets — float above compact bottom nav with matching corner radius */
  html.consumer-ui .side-panel-stack,
  html.consumer-ui[dir='rtl'] .side-panel-stack,
  html.consumer-ui[dir='ltr'] .side-panel-stack {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    top: auto !important;
    bottom: var(--af-bottom-chrome) !important;
    max-height: min(
      72vh,
      calc(100dvh - max(12px, env(safe-area-inset-top)) - var(--af-bottom-chrome) - 56px)
    );
    border-radius: var(--m-sheet-radius);
    box-shadow: var(--m-shadow-sheet);
    background: var(--m-surface);
    z-index: var(--z-panel);
    overflow: hidden;
  }

  html.consumer-ui.directions-panel-open .side-panel-stack {
    max-height: min(48vh, calc(100dvh - var(--af-bottom-chrome) - 120px)) !important;
  }

  html.consumer-ui .map-pick-hud {
    top: calc(max(12px, env(safe-area-inset-top)) + var(--m-search-h, 54px) + 10px);
    z-index: calc(var(--z-toast) + 2);
  }

  html.consumer-ui.place-panel-open .side-panel-stack,
  html.consumer-ui:has(#placeDetail:not([hidden])) .side-panel-stack {
    max-height: min(78vh, calc(100dvh - var(--af-bottom-chrome) - 64px)) !important;
  }

  /* While picking OD on the map, shrink the sheet so the map is tappable */
  html.consumer-ui.map-pick-active.directions-panel-open .side-panel-stack,
  html.consumer-ui.map-pick-active.place-panel-open .side-panel-stack,
  html.consumer-ui.map-pick-active:has(#placeDetail:not([hidden])) .side-panel-stack {
    max-height: min(26vh, 200px) !important;
  }

  html.consumer-ui.library-panel-open .side-panel-stack,
  html.consumer-ui.contribute-panel-open .side-panel-stack {
    bottom: var(--af-bottom-chrome) !important;
    max-height: min(72vh, calc(100dvh - var(--af-bottom-chrome) - 64px)) !important;
  }

  html.consumer-ui .nav-rail-edge-toggle,
  html.consumer-ui .side-panel-expand-tab,
  html.consumer-ui .side-panel-collapse,
  html.consumer-ui .side-panel-collapse:not([hidden]) {
    display: none !important;
  }

  html.consumer-ui .nav-rail {
    bottom: var(--af-bottom-chrome);
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  html.consumer-ui.directions-panel-open .directions-panel .panel-inner {
    padding: 6px 16px 16px;
  }

  html.consumer-ui.directions-panel-open .directions-panel .panel-inner::before {
    width: 36px;
    height: 4px;
    margin: 4px auto 10px;
    background: #d0d5dd;
  }

  html.consumer-ui.directions-panel-open .directions-panel #message {
    display: none !important;
  }

  html.consumer-ui.directions-panel-open .directions-panel .route-actions .primary,
  html.consumer-ui.directions-panel-open .directions-panel .route-actions .primary#route {
    background: var(--m-primary);
    color: #fff;
  }

  /* OD suggest flow */
  html.consumer-ui.directions-panel-open.od-suggest-open .directions-panel .panel-inner {
    max-height: min(72vh, calc(100dvh - var(--af-bottom-chrome) - 72px));
  }

  html.consumer-ui.directions-panel-open .directions-panel .od-chip {
    flex-wrap: wrap;
    align-items: center;
  }

  html.consumer-ui.directions-panel-open .directions-panel .od-suggest-list {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    width: 100% !important;
    flex: 1 0 100%;
    max-height: min(42vh, 320px);
    margin: 4px 0 0;
    border: 0;
    border-top: 1px solid var(--m-border);
    border-radius: 0;
    box-shadow: none;
    background: var(--m-surface);
    overflow: auto;
  }

  html.consumer-ui.directions-panel-open .od-stack.has-od-suggest::before {
    display: none;
  }

  html.consumer-ui.directions-panel-open .od-stack.has-od-suggest.od-suggest-origin > .od-chip.dest,
  html.consumer-ui.directions-panel-open .od-stack.has-od-suggest.od-suggest-origin > .via-stops-list,
  html.consumer-ui.directions-panel-open .od-stack.has-od-suggest.od-suggest-origin > .via-stops-actions,
  html.consumer-ui.directions-panel-open .od-stack.has-od-suggest.od-suggest-origin .swap-btn {
    display: none !important;
  }

  html.consumer-ui.directions-panel-open .od-stack.has-od-suggest.od-suggest-dest > .od-row,
  html.consumer-ui.directions-panel-open .od-stack.has-od-suggest.od-suggest-dest > .via-stops-list,
  html.consumer-ui.directions-panel-open .od-stack.has-od-suggest.od-suggest-dest > .via-stops-actions {
    display: none !important;
  }

  html.consumer-ui.directions-panel-open.od-suggest-open .directions-panel .route-profile-switch,
  html.consumer-ui.directions-panel-open.od-suggest-open .directions-panel .route-actions {
    display: none !important;
  }

  html.consumer-ui .account-sheet-card.account-sheet-gmaps {
    border-radius: 0;
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    height: 100%;
  }

  @media (max-height: 500px) and (orientation: landscape) {
    html.consumer-ui .side-panel-stack {
      max-height: min(88vh, calc(100dvh - var(--af-bottom-chrome) - 12px)) !important;
    }

    html.consumer-ui .search-category-strip {
      display: none !important;
    }
  }
}

/* Interactive phone layouts. These rules never participate in desktop layout. */
@media (max-width: 900px) {
  html.consumer-ui {
    --m-gutter: 14px;
    --m-primary: #087f83;
    --m-selected: #e4f3f1;
    --m-nav-bg: #ffffff;
    --m-text: #203438;
    --m-text-secondary: #627579;
    --m-border: #e5ecec;
    --m-search-radius: 22px;
    --m-shadow-float: 0 3px 14px rgb(24 49 54 / 10%);
    --m-shadow-sheet: 0 -4px 24px rgb(24 49 54 / 8%);
    --m-chip-h: 34px;
    --mobile-viewport-height: 100dvh;
    --mobile-viewport-top: 0px;
    --mobile-keyboard-inset: 0px;
  }

  html.consumer-ui body {
    overscroll-behavior: none;
  }

  html.consumer-ui button,
  html.consumer-ui a,
  html.consumer-ui input {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  html.consumer-ui button:focus-visible,
  html.consumer-ui a:focus-visible {
    outline: 3px solid var(--m-primary);
    outline-offset: 2px;
  }

  html.consumer-ui button:active:not(:disabled) {
    filter: brightness(0.94);
  }

  html.consumer-ui .search-chrome-float .search-pill {
    flex-flow: row nowrap !important;
    overflow: hidden;
  }

  html.consumer-ui #searchChromeFloat #searchChrome,
  html.consumer-ui #searchChromeFloat #searchOmnibox {
    width: 100%;
    max-width: none;
  }

  html.consumer-ui #searchChrome [hidden],
  html.consumer-ui #sidePanelStack [hidden],
  html.consumer-ui #layersMenu [hidden] {
    display: none !important;
  }

  html.consumer-ui .search-chrome-float .search-pill input#search {
    width: 0;
    height: var(--m-search-h);
    min-height: 0;
    flex: 1 1 0;
    padding: 0 6px;
    margin: 0;
    border-radius: 0;
  }

  html.consumer-ui .search-chrome-float .search-clear,
  html.consumer-ui .search-chrome-float .search-voice-btn,
  html.consumer-ui .search-chrome-float .search-account-fab {
    position: static !important;
    transform: none !important;
    width: 44px;
    height: 48px;
    flex: 0 0 44px;
    min-width: 44px;
    margin: 0;
    align-self: center;
  }

  html.consumer-ui .search-category-strip .chip-label {
    font-size: 12px;
  }

  html.consumer-ui .search-category-strip-scroll {
    overscroll-behavior-inline: contain;
    padding-block: 0;
  }

  html.consumer-ui .mobile-bottom-nav-btn svg {
    padding-inline: 12px;
  }

  /* One viewport-filling search surface, including the on-screen keyboard. */
  html.consumer-ui.mobile-search-active .search-chrome-float {
    display: flex !important;
    inset: var(--mobile-viewport-top) 0 auto !important;
    height: var(--mobile-viewport-height);
    max-height: var(--mobile-viewport-height);
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: var(--m-surface);
    pointer-events: auto !important;
    z-index: 40;
    box-sizing: border-box;
  }

  html.consumer-ui.mobile-search-active .search-chrome-float .search-chrome,
  html.consumer-ui.mobile-search-active .search-chrome-float .search-omnibox {
    height: 100%;
    max-height: none;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    padding: 0;
    align-items: stretch;
  }

  html.consumer-ui.mobile-search-active .search-chrome-float .search-pill {
    flex-shrink: 0;
    background: #f1f5f6;
    border-radius: 28px;
    padding: 0 4px;
    border: 0;
  }

  /* Chevron back control removed from the omnibox; pin mark closes search. */
  html.consumer-ui .mobile-search-back {
    display: none !important;
  }

  html.consumer-ui.mobile-search-active .search-account-fab,
  html.consumer-ui.mobile-search-active .local-conditions-card,
  html.consumer-ui.mobile-search-active .mobile-bottom-nav,
  html.consumer-ui.mobile-search-active .side-panel-stack,
  html.consumer-ui.mobile-search-active .map-controls-br,
  html.consumer-ui.mobile-search-active .layers-control-bl,
  html.consumer-ui.mobile-search-active .mobile-dirs-fab,
  html.consumer-ui.mobile-search-active .search-category-strip {
    display: none !important;
  }

  html.consumer-ui.mobile-search-active .search-chrome-float .search-suggest {
    position: static;
    flex: 0 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 0;
    box-shadow: none;
    margin: 12px 0 0;
    padding: 0;
    border-radius: 0;
  }

  html.consumer-ui.mobile-search-active .search-suggest-list {
    max-height: none;
    overflow: visible;
  }

  html.consumer-ui.mobile-search-active .search-suggest-row,
  html.consumer-ui.mobile-search-active .search-suggest-home {
    min-height: 64px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--m-border);
  }

  html.consumer-ui.mobile-search-active .search-suggest-title,
  html.consumer-ui.mobile-search-active .search-suggest-text {
    font-size: 16px;
    line-height: 1.6;
  }

  html.consumer-ui.mobile-search-active .search-suggest-sub {
    font-size: 13px;
    line-height: 1.6;
  }

  html.consumer-ui .mobile-search-status {
    margin: 24px 16px;
    color: var(--m-text-secondary);
    font-size: 15px;
    line-height: 1.8;
    text-align: center;
  }

  html.consumer-ui .mobile-search-status.is-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--m-selected);
    border-top-color: var(--m-primary);
    border-radius: 50%;
    margin-inline-end: 10px;
    vertical-align: middle;
    animation: mobile-search-spin 800ms linear infinite;
  }

  @keyframes mobile-search-spin { to { transform: rotate(360deg); } }

  /* A single measured sheet; only its content scrolls. */
  html.consumer-ui.mobile-sheet-active #sidePanelStack.side-panel-stack {
    height: var(--mobile-sheet-height) !important;
    max-height: var(--mobile-sheet-max) !important;
    bottom: calc(var(--af-bottom-chrome) + var(--mobile-keyboard-inset)) !important;
    justify-content: flex-start;
    border-radius: var(--m-sheet-radius);
    background: var(--m-surface);
    overflow: hidden;
    transition: height 240ms cubic-bezier(0.2, 0, 0, 1);
    isolation: isolate;
  }

  html.consumer-ui.mobile-sheet-dragging #sidePanelStack {
    transition: none;
    user-select: none;
  }

  html.consumer-ui .mobile-sheet-toolbar {
    position: relative;
    flex: 0 0 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 28px;
    max-height: 28px;
    background: var(--m-surface);
    touch-action: none;
    cursor: grab;
    z-index: 2;
  }

  html.consumer-ui .mobile-sheet-handle {
    width: 120px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    border-radius: 14px;
    touch-action: none;
    cursor: inherit;
  }

  html.consumer-ui .mobile-sheet-handle span {
    width: 44px;
    height: 5px;
    background: #9aa0a6;
    border-radius: 999px;
    box-shadow: 0 0.5px 0 rgb(255 255 255 / 70%) inset;
  }

  /* Sheet-top ✕ removed — dismiss via search clear / place actions instead. */
  html.consumer-ui .mobile-sheet-close,
  html.consumer-ui .mobile-sheet-toolbar > .mobile-sheet-close {
    display: none !important;
  }

  html.consumer-ui.mobile-sheet-active #sidePanelStack > .side-panel-card:not([hidden]) {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
    border-radius: 0 !important;
    overflow: hidden !important;
  }

  html.consumer-ui.mobile-sheet-active #sidePanelStack .search-panel-inner,
  html.consumer-ui.mobile-sheet-active #sidePanelStack .panel-inner {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding-block: 12px;
    padding-bottom: 20px;
  }

  html.consumer-ui.mobile-sheet-active #sidePanelStack .panel-inner::before,
  html.consumer-ui.mobile-sheet-active #sidePanelStack .panel-toolbar,
  html.consumer-ui.mobile-sheet-active .contribute-close {
    display: none !important;
  }

  /* No floating ✕ on the place photo — sheet handle + search clear dismiss. */
  html.consumer-ui .place-detail-close-overlay,
  html.consumer-ui.mobile-sheet-active .place-detail-close-overlay,
  html.consumer-ui.place-panel-open .place-detail-close-overlay {
    display: none !important;
  }

  html.consumer-ui.mobile-sheet-active .directions-panel .section-title {
    padding: 0;
    margin-bottom: 16px;
    font-size: 20px;
  }

  html.consumer-ui.mobile-sheet-active .directions-panel .od-edit,
  html.consumer-ui .user-library-filter,
  html.consumer-ui .add-place-dialog input,
  html.consumer-ui .add-place-dialog textarea {
    font-size: 16px;
  }

  html.consumer-ui.mobile-sheet-active .directions-panel .od-chip {
    min-height: 56px;
  }

  html.consumer-ui.mobile-sheet-active .directions-panel .od-clear,
  html.consumer-ui.mobile-sheet-active .directions-panel .swap-btn {
    min-width: 44px;
    min-height: 44px;
  }

  html.consumer-ui.mobile-sheet-active .directions-panel .via-stops-actions .secondary,
  html.consumer-ui .route-profile-btn,
  html.consumer-ui .place-text-link,
  html.consumer-ui .text-btn {
    min-height: 44px;
  }

  html.consumer-ui.mobile-sheet-active .directions-panel #message.error:not(:empty) {
    display: block !important;
    font-size: 14px;
    line-height: 1.7;
  }

  html.consumer-ui.mobile-sheet-active .place-hero {
    height: auto;
    min-height: 220px;
    max-height: 280px;
    aspect-ratio: 16 / 9;
  }

  html.consumer-ui.mobile-sheet-active .place-hero.has-photo {
    min-height: 240px;
    max-height: 300px;
    aspect-ratio: 16 / 10;
  }

  html.consumer-ui.mobile-sheet-active .place-hero:has(.place-hero-img[hidden]) {
    display: none;
  }

  html.consumer-ui.mobile-sheet-active .place-detail-main {
    padding: 4px 20px 2px;
  }

  /* Names: label start, value pinned to the trailing edge */
  html.consumer-ui.mobile-sheet-active .place-detail-names {
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 10px 16px;
    width: 100%;
  }

  html.consumer-ui.mobile-sheet-active .place-detail-names dd,
  html.consumer-ui.mobile-sheet-active .place-detail-names .place-detail-name-value {
    justify-self: end;
    text-align: end;
  }

  /* No phantom flex gap when optional blocks are empty/hidden */
  html.consumer-ui.mobile-sheet-active .place-detail-body:empty,
  html.consumer-ui.mobile-sheet-active .place-detail-body[hidden],
  html.consumer-ui.mobile-sheet-active .place-facts[hidden],
  html.consumer-ui.mobile-sheet-active .place-detail-names-wrap[hidden],
  html.consumer-ui.mobile-sheet-active .place-detail-contact-actions[hidden] {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
  }

  html.consumer-ui.mobile-sheet-active .place-detail-footer-links {
    margin-top: 4px;
    padding-top: 4px;
    padding-bottom: 0;
  }

  html.consumer-ui.mobile-sheet-active .place-detail-scroll {
    flex: 0 1 auto;
    min-height: 0;
  }

  html.consumer-ui.mobile-sheet-active .place-detail-name {
    font-size: 23px;
    line-height: 1.5;
  }

  /* Compact Google Maps–style action chips: fit Directions/Save/Nearby/Share */
  html.consumer-ui.mobile-sheet-active .place-action-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    padding: 6px 0 10px;
    -webkit-overflow-scrolling: touch;
  }

  html.consumer-ui.mobile-sheet-active .place-action-row::-webkit-scrollbar {
    display: none;
  }

  html.consumer-ui.mobile-sheet-active .place-round-action {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
    min-height: 34px;
    height: 34px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    border: 1px solid var(--m-border);
    border-radius: 17px;
    background: #fff;
    color: var(--m-primary);
    box-shadow: none;
  }

  html.consumer-ui.mobile-sheet-active .place-round-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    display: grid;
    place-items: center;
  }

  html.consumer-ui.mobile-sheet-active .place-round-icon svg {
    width: 16px;
    height: 16px;
    display: block;
  }

  html.consumer-ui.mobile-sheet-active .place-round-action.is-primary {
    background: var(--m-primary);
    color: #fff;
    border-color: var(--m-primary);
  }

  html.consumer-ui.mobile-sheet-active #placeDetail .place-round-icon {
    color: inherit;
    background: transparent;
    border: 0;
  }

  html.consumer-ui.mobile-sheet-active .place-round-label {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    color: inherit;
    white-space: nowrap;
  }

  /* Destination + Origin stay first so OD is always visible */
  html.consumer-ui.mobile-sheet-active #placeDetailDest,
  html.consumer-ui.mobile-sheet-active #placeDetailOrigin {
    padding-inline: 10px;
  }

  html.consumer-ui.mobile-sheet-active .user-library,
  html.consumer-ui.mobile-sheet-active .contribute-panel {
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  html.consumer-ui.mobile-sheet-active .user-library-head .section-title {
    font-size: 24px;
    margin: 0 0 8px;
  }

  html.consumer-ui.mobile-sheet-active .user-library-empty {
    padding: 24px 16px;
    background: #f3f7f8;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.8;
  }

  /* Reserve the actual sheet height, not a desktop fallback. */
  html.consumer-ui #mapControlsBr {
    bottom: calc(var(--af-bottom-chrome) + var(--af-sheet-clearance, 0px) + var(--mobile-pin-clearance, 0px) + 12px + var(--m-dirs-fab) + 10px) !important;
  }

  html.consumer-ui.mobile-sheet-active #mapControlsBr {
    bottom: calc(var(--af-bottom-chrome) + var(--af-sheet-clearance, 0px) + 12px) !important;
  }

  html.consumer-ui.mobile-sheet-expanded #mapControlsBr,
  html.consumer-ui.mobile-sheet-expanded #layersControlBl,
  html.consumer-ui.keyboard-open #mapControlsBr,
  html.consumer-ui.keyboard-open #layersControlBl {
    display: none !important;
  }

  html.consumer-ui #layersControlBl {
    top: calc(max(var(--m-gutter), env(safe-area-inset-top)) + var(--m-search-h) + 8px + 44px + 10px) !important;
    bottom: auto !important;
  }

  html.consumer-ui .maplibregl-ctrl-bottom-left {
    margin-bottom: calc(var(--af-bottom-chrome) + var(--af-sheet-clearance, 0px) + 10px) !important;
  }

  html.consumer-ui.keyboard-open,
  html.consumer-ui.mobile-search-active,
  html.consumer-ui:has(#liveNavHud:not([hidden])) {
    --af-bottom-chrome: 0px;
  }

  /* Layers and categories are dismissible sheets with one scrim and focus scope. */
  html.consumer-ui .mobile-map-scrim {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: rgb(20 34 39 / 32%);
    z-index: 29;
  }

  html.consumer-ui.mobile-overlay-open #layersMenu,
  html.consumer-ui.mobile-overlay-open #searchCategoryMoreCard {
    z-index: 30 !important;
    bottom: 0 !important;
    max-height: calc(var(--mobile-viewport-height) - 40px);
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  html.consumer-ui .mobile-layers-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: 8px;
    margin-bottom: 12px;
  }

  html.consumer-ui .mobile-layers-head h2 {
    font-size: 20px;
    margin: 0;
  }

  html.consumer-ui .layers-menu > button {
    min-height: 52px;
    font-size: 15px;
    border-radius: 14px;
  }

  html.consumer-ui .layers-menu .map-tools-btn {
    min-height: 72px;
    font-size: 14px;
    gap: 8px;
  }

  html.consumer-ui .search-category-more-item,
  html.consumer-ui #searchCategoryMoreClose {
    min-height: 44px;
    min-width: 44px;
  }

  html.consumer-ui.account-sheet-open .nav-rail {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html.consumer-ui .account-sheet-card.account-sheet-gmaps {
    max-height: var(--mobile-viewport-height, 100dvh);
    height: var(--mobile-viewport-height, 100dvh);
    overflow: hidden;
  }

  html.consumer-ui .mobile-account-close.account-gmaps-close {
    position: absolute;
    inset-inline-end: 8px;
    top: max(8px, env(safe-area-inset-top));
    z-index: 3;
  }

  html.consumer-ui .account-gmaps-settings-panel.mobile-account-tools {
    border-top: 0;
    margin-top: 0;
    padding: 0 0 8px;
  }

  html.consumer-ui .account-settings-pref {
    min-height: 64px;
    padding-block: 12px;
    padding-inline: 68px 16px;
  }

  html.consumer-ui .account-settings-toggle-row {
    padding-block: 14px;
    padding-inline: 68px 20px;
  }

  html.consumer-ui .account-settings-action {
    padding-block: 14px 16px;
    padding-inline: 68px 20px;
  }

  html.consumer-ui dialog.add-place-dialog,
  html.consumer-ui dialog.add-place-cat-dialog,
  html.consumer-ui dialog.place-report-dialog,
  html.consumer-ui dialog.legal-doc-dialog,
  html.consumer-ui dialog.settings-choice-dialog {
    width: calc(100vw - 16px);
    max-width: 560px;
    max-height: calc(var(--mobile-viewport-height) - 24px);
    margin: auto;
    border-radius: 24px;
    overscroll-behavior: contain;
  }

  html.consumer-ui .legal-doc-body,
  html.consumer-ui .settings-choice-list {
    max-height: calc(var(--mobile-viewport-height) - 96px);
  }

  html.consumer-ui.keyboard-open dialog[open] {
    top: calc(var(--mobile-viewport-top) + 12px);
    bottom: auto;
    margin-block: 0;
  }

  html.consumer-ui dialog input,
  html.consumer-ui dialog textarea,
  html.consumer-ui dialog select {
    font-size: 16px;
  }

  html.consumer-ui dialog button {
    min-height: 44px;
  }

  html.consumer-ui #droppedPinCard {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(var(--af-bottom-chrome) + 12px);
    width: auto;
    max-width: none;
    transform: none;
    border-radius: 22px;
    padding: 16px;
  }

  html.consumer-ui #droppedPinCard .dropped-pin-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
  }

  html.consumer-ui #droppedPinCard .dropped-pin-action {
    min-height: 44px;
    flex-shrink: 0;
    font-size: 14px;
    padding-inline: 16px;
  }

  html.consumer-ui #droppedPinClose {
    min-width: 44px;
    min-height: 44px;
  }

  html.consumer-ui.mobile-pin-open .mobile-dirs-fab {
    display: none;
  }

  html.consumer-ui.mobile-pin-open #mapControlsBr {
    bottom: calc(var(--af-bottom-chrome) + var(--mobile-pin-clearance) + 12px) !important;
  }

  html.consumer-ui #chromeToast {
    bottom: calc(var(--af-bottom-chrome) + var(--mobile-keyboard-inset) + 16px);
    max-width: calc(100vw - 32px);
  }

  html.consumer-ui.mobile-sheet-active:not(.mobile-sheet-expanded) #chromeToast {
    top: calc(max(12px, env(safe-area-inset-top)) + var(--m-search-h) + 12px);
    bottom: auto;
  }

  html.consumer-ui .mobile-account-close[hidden],
  html.consumer-ui .mobile-search-status[hidden],
  html.consumer-ui .mobile-sheet-toolbar[hidden],
  html.consumer-ui .mobile-map-scrim[hidden],
  html.consumer-ui .mobile-layers-head[hidden] {
    display: none !important;
  }

  @media (max-height: 500px) and (orientation: landscape) {
    html.consumer-ui.mobile-sheet-active #sidePanelStack.side-panel-stack {
      width: min(400px, 52vw) !important;
      left: 0 !important;
      right: auto !important;
      border-radius: 20px;
    }
    html.consumer-ui[dir='rtl'].mobile-sheet-active #sidePanelStack.side-panel-stack {
      left: auto !important;
      right: 0 !important;
    }
    html.consumer-ui.mobile-sheet-active:not(.mobile-search-active) #searchChromeFloat {
      display: none !important;
    }
    html.consumer-ui.mobile-sheet-active #layersControlBl {
      display: none !important;
    }
    html.consumer-ui.mobile-sheet-active #mapControlsBr {
      display: flex !important;
      bottom: calc(var(--af-bottom-chrome) + 12px) !important;
    }
    html.consumer-ui[dir='rtl'].mobile-sheet-active #mapControlsBr {
      right: auto;
      left: max(12px, env(safe-area-inset-left));
    }
    html.consumer-ui.mobile-sheet-active .maplibregl-ctrl-bottom-right,
    html.consumer-ui.mobile-sheet-active .maplibregl-ctrl-bottom-left {
      display: none;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html.consumer-ui #sidePanelStack,
    html.consumer-ui .mobile-bottom-nav-btn svg {
      transition: none !important;
    }
    html.consumer-ui .mobile-search-status.is-loading::before {
      animation: none;
    }
  }
}

/* Quiet surfaces and one accent colour throughout the phone experience. */
@media (max-width: 900px) {
  html.consumer-ui .mobile-search-mark {
    display: grid;
    place-items: center;
    width: 30px;
    flex: 0 0 30px;
    color: var(--m-primary);
    pointer-events: none;
  }

  /* No leading chrome while searching — the old back chevron is gone. */
  html.consumer-ui.mobile-search-active .mobile-search-mark {
    display: none !important;
  }

  /* ✕ is shown while search is focused (syncSearchClearUi); honor [hidden] when truly dismissed. */
  html.consumer-ui.mobile-search-active .search-chrome-float .search-clear[hidden] {
    display: none !important;
  }

  html.consumer-ui.mobile-search-active .search-chrome-float .search-clear:not([hidden]) {
    display: grid !important;
  }

  html.consumer-ui .search-chrome-float .search-chrome {
    border-color: rgb(255 255 255 / 90%);
  }

  html.consumer-ui .search-chrome-float .search-account-fab:not(.is-signed-in) .search-account-login-icon {
    width: 32px;
    height: 32px;
    padding: 6px;
    background: var(--m-selected);
    color: var(--m-primary);
    border: 0;
  }

  html.consumer-ui .search-category-strip .search-category-chip,
  html.consumer-ui .search-category-strip .search-category-more {
    border-color: rgb(255 255 255 / 88%);
    box-shadow: 0 2px 8px rgb(24 49 54 / 8%);
    font-weight: 500;
  }

  html.consumer-ui .search-category-strip .chip-icon {
    color: var(--m-primary);
  }

  html.consumer-ui #layersControlBl {
    background: white;
    border: 1px solid var(--m-border);
  }

  html.consumer-ui .mobile-dirs-fab {
    border-radius: 50%;
    box-shadow: var(--m-shadow-float);
  }

  html.consumer-ui .mobile-bottom-nav {
    border-color: rgb(255 255 255 / 88%);
    box-shadow: var(--m-shadow-float);
  }

  html.consumer-ui .mobile-bottom-nav-btn {
    gap: 1px;
    font-size: 10.5px;
    padding: 2px 10px;
  }

  html.consumer-ui .mobile-bottom-nav-btn svg {
    padding: 4px 12px;
  }

  html.consumer-ui .mobile-sheet-handle span {
    width: 44px;
    height: 5px;
    background: #9aa0a6;
  }

  html.consumer-ui.mobile-search-active .search-chrome-float .search-pill {
    background: #f2f6f6;
  }

  html.consumer-ui.mobile-search-active .search-suggest-row {
    border-bottom-color: #edf2f2;
    padding-block: 16px;
  }

  html.consumer-ui.mobile-search-active .search-suggest-icon.is-place-pin,
  html.consumer-ui.mobile-search-active .search-suggest-icon.is-place-pin .location-pin-svg {
    color: var(--m-primary);
  }

  html.consumer-ui #appPanel .od-stack {
    border-color: var(--m-border);
    border-radius: 18px;
    background: #f7f9f9;
  }

  html.consumer-ui #appPanel .od-stack::before {
    background: #cedcdd;
  }

  html.consumer-ui #appPanel .od-chip {
    min-height: 56px;
    padding-block: 8px;
  }

  html.consumer-ui #appPanel .od-chip.dest {
    border-color: var(--m-border);
  }

  html.consumer-ui #appPanel .od-edit {
    font-size: 16px;
    font-weight: 400;
    color: var(--m-text);
  }

  html.consumer-ui #appPanel .swap-btn {
    color: var(--m-primary);
    border-color: var(--m-border);
    box-shadow: 0 2px 6px rgb(24 49 54 / 5%);
  }

  html.consumer-ui #appPanel .route-profile-switch {
    background: #f0f5f5;
    border-radius: 16px;
    padding: 4px;
    margin-block: 12px;
  }

  html.consumer-ui #appPanel .route-profile-btn {
    border: 0;
    border-radius: 12px;
    color: var(--m-text-secondary);
  }

  html.consumer-ui #appPanel .route-profile-btn.is-active {
    color: var(--m-primary);
    background: white;
    box-shadow: 0 1px 4px rgb(24 49 54 / 8%);
  }

  html.consumer-ui #appPanel #route {
    border-radius: 16px;
    min-height: 50px;
    font-weight: 600;
  }

  html.consumer-ui #appPanel #route:disabled {
    background: #e8efef;
    color: #6f8184;
    opacity: 1;
  }

  html.consumer-ui #appPanel #addViaStop,
  html.consumer-ui #placeDetail .place-text-link:not(#placeDetailReport),
  html.consumer-ui #userLibrary .text-btn {
    color: var(--m-primary);
  }

  html.consumer-ui #userLibrary .user-library-head {
    padding: 4px 20px 20px;
  }

  html.consumer-ui #userLibrary .user-library-block {
    padding: 18px 20px;
    border-color: var(--m-border);
  }

  html.consumer-ui #userLibrary .user-library-filter {
    background: #f3f7f7;
    border: 1px solid var(--m-border);
    border-radius: 14px;
    min-height: 48px;
  }

  html.consumer-ui #userLibrary .user-library-empty {
    margin-top: 16px;
    padding-block: 32px;
    text-align: center;
    background: #f5f8f8;
    color: var(--m-text-secondary);
  }

  html.consumer-ui #contributePanel .contribute-head {
    background: white;
    padding: 4px 20px 20px;
    border-color: var(--m-border);
  }

  html.consumer-ui #contributePanel .contribute-profile {
    padding-inline-end: 0;
  }

  html.consumer-ui #contributePanel .contribute-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--m-selected);
    color: var(--m-primary);
    border: 0;
    box-shadow: none;
  }

  html.consumer-ui #contributePanel .contribute-chip-btn {
    color: var(--m-primary);
    border-color: #c7dfde;
    min-height: 44px;
  }

  html.consumer-ui #contributePanel .contribute-progress {
    background: #f5f8f8;
    border-radius: 16px;
  }

  html.consumer-ui #contributePanel .contribute-progress-fill {
    background: var(--m-primary);
  }

  html.consumer-ui #contributePanel .contribute-tab[aria-selected='true'] {
    color: var(--m-primary);
    border-bottom-color: var(--m-primary);
  }

  html.consumer-ui #contributePanel .contribute-actions {
    padding: 8px 16px;
  }

  html.consumer-ui #contributePanel .contribute-action {
    min-height: 64px;
  }

  html.consumer-ui #contributePanel .contribute-action-icon {
    color: var(--m-primary);
    background: var(--m-selected);
    border-radius: 14px;
  }

  html.consumer-ui #accountSheet .account-sheet-backdrop {
    backdrop-filter: none;
    background: rgba(32, 33, 36, 0.4);
  }

  html.consumer-ui #accountSheetCard.account-sheet-gmaps {
    background: #f1f3f4;
    border: 0;
    box-shadow: none;
    border-radius: 0;
  }

  html.consumer-ui #accountSheetCard .account-gmaps-profile-card {
    border-radius: 28px;
  }

  html.consumer-ui #accountSheetCard .account-gmaps-name {
    font-size: 1.05rem;
    color: var(--m-text);
  }

  html.consumer-ui #accountSheetCard .account-gmaps-email {
    font-size: 0.8rem;
    color: var(--m-text-secondary);
  }

  html.consumer-ui #accountSheetCard .account-gmaps-pill-card,
  html.consumer-ui #accountSheetCard .account-gmaps-pill {
    border-radius: 999px;
    background: #fff;
  }

  html.consumer-ui #googleSignInHost:empty {
    display: none;
  }

  html.consumer-ui .mobile-google-status {
    display: none;
  }

  html.consumer-ui #accountGuest:has(#googleSignInHost:empty):has(#accountAuthError[hidden]) .mobile-google-status {
    display: block;
    margin: 24px 0 0;
    padding: 14px;
    border-radius: 14px;
    background: #f5f8f8;
    color: var(--m-text-secondary);
    font-size: 14px;
    text-align: center;
  }

  html.consumer-ui #layersMenu .map-tools-btn {
    background: #f5f8f8;
    border-color: transparent;
    border-radius: 16px;
    color: var(--m-text);
  }
}

@media (min-width: 901px) {
  .mobile-google-status,
  .mobile-search-mark,
  .mobile-search-back,
  #mobileSearchMark,
  .mobile-search-status,
  .mobile-sheet-toolbar,
  .mobile-layers-head,
  .mobile-map-scrim,
  .mobile-account-tools,
  .mobile-account-close,
  html.consumer-ui .mobile-bottom-nav,
  html.consumer-ui .search-account-fab,
  html.consumer-ui .search-voice-btn,
  html.consumer-ui .search-pill-mark,
  html.consumer-ui .search-pill-mark-glyph,
  html.consumer-ui .mobile-dirs-fab,
  html.consumer-ui .layers-tools-icon,
  html.consumer-ui .layers-menu .map-tools-section {
    display: none !important;
  }
}

/* ——— Final mobile lock: beat leftover consumer-layout leaks ——— */
@media (max-width: 900px) {
  html.consumer-ui .side-panel-stack,
  html.consumer-ui.place-panel-open .side-panel-stack,
  html.consumer-ui.directions-panel-open .side-panel-stack,
  html.consumer-ui.library-panel-open .side-panel-stack,
  html.consumer-ui.contribute-panel-open .side-panel-stack,
  html.consumer-ui:has(#placeDetail:not([hidden])) .side-panel-stack {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    top: auto !important;
    bottom: calc(var(--af-bottom-chrome) + var(--mobile-keyboard-inset, 0px)) !important;
    border-radius: var(--m-sheet-radius) !important;
  }

  html.consumer-ui.mobile-sheet-active #sidePanelStack.side-panel-stack {
    bottom: calc(var(--af-bottom-chrome) + var(--mobile-keyboard-inset, 0px)) !important;
  }

  html.consumer-ui.mobile-sheet-active .directions-panel .panel-inner::before {
    display: none !important;
  }

  html.consumer-ui.mobile-search-active .search-omnibox.is-suggest-open {
    max-height: none !important;
    border-radius: 0 !important;
    margin-top: 0 !important;
  }

  html.consumer-ui.mobile-search-active .search-chrome-float:has(.is-suggest-open) .search-chrome {
    flex-direction: column !important;
    border-radius: 0 !important;
  }

  html.consumer-ui .search-chrome-float .nav-menu-fab {
    display: none !important;
  }

  html.consumer-ui .layers-control-bl {
    left: auto !important;
    right: max(var(--m-gutter), env(safe-area-inset-right, 0px)) !important;
    bottom: auto !important;
    top: calc(max(var(--m-gutter), env(safe-area-inset-top, 0px)) + var(--m-search-h, 54px) + 8px) !important;
  }

  html.consumer-ui .map-pick-hud {
    top: calc(
      max(var(--m-gutter), env(safe-area-inset-top, 0px))
      + var(--m-search-h, 54px)
      + 12px
    ) !important;
    z-index: calc(var(--z-search, 40) + 2) !important;
  }

  html.consumer-ui .map-pick-hud-cancel {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
  }

  html.consumer-ui.mobile-sheet-active .place-round-icon {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html.consumer-ui.mobile-sheet-active .place-detail-names .place-detail-name-value {
    direction: auto;
    unicode-bidi: plaintext;
  }

  html.consumer-ui.mobile-sheet-active .place-detail-names dt {
    text-align: start;
  }

  html.consumer-ui.mobile-sheet-active .side-panel-card.search-panel,
  html.consumer-ui.mobile-sheet-active .side-panel-card.directions-panel,
  html.consumer-ui.mobile-sheet-active .side-panel-card {
    height: auto !important;
    max-height: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}
