/* Структура мобильного приложения: одна верхняя панель, три настоящих раздела
   в bottom navigation и отдельные действия поверх карты. */
@media (max-width: 760px) {
  body {
    background: var(--map-bg);
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
  }

  button,
  summary,
  input,
  select,
  a {
    touch-action: manipulation;
  }

  #topbar {
    position: fixed;
    z-index: 1200;
    top: calc(8px + env(safe-area-inset-top));
    right: 12px;
    left: 12px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 2px;
    min-height: 52px;
    padding: 3px 4px;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-float);
  }

  .brand-block,
  #searchbox {
    min-width: 0;
  }

  .brand-block,
  .brand-block #brand {
    width: 42px;
    height: 44px;
  }

  #brand {
    justify-content: center;
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
  }

  #brand img {
    width: 29px;
    height: 29px;
  }

  .brand-name,
  .brand-caption,
  #topbtns {
    display: none;
  }

  #search-form {
    min-height: 44px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
  }

  #search-form:focus-within {
    background: var(--tint);
    box-shadow: none;
  }

  #search {
    padding-inline: 11px 6px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 560;
  }

  #search::placeholder {
    color: var(--muted);
    opacity: 1;
  }

  #search-submit {
    min-width: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: transparent;
    color: var(--accent-ink);
  }

  #search-submit:active {
    background: var(--accent-bg);
  }

  #search-submit span {
    display: none;
  }

  #search-submit .search-submit-icon {
    display: block;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
  }

  #search-results {
    top: 55px;
    right: -4px;
    left: -48px;
    max-height: min(56dvh, 430px);
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
  }

  #search-results button {
    min-height: 52px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.4;
  }

  #wrap {
    flex: 1;
    min-height: 100dvh;
  }

  #map-hint {
    top: calc(72px + env(safe-area-inset-top));
    display: flex;
    min-height: 34px;
    align-items: center;
    gap: 7px;
    max-width: calc(100% - 48px);
    padding: 7px 12px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    background: rgb(255 255 255 / 96%);
    color: var(--ink-soft);
    box-shadow: var(--shadow-sm);
    font-size: 11.5px;
    font-weight: 700;
    text-overflow: ellipsis;
  }

  #map-hint[hidden] {
    display: none;
  }

  #map-hint > span {
    width: 7px;
    height: 7px;
    flex: none;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 3px rgb(33 102 209 / 17%);
  }

  .map-action {
    position: fixed;
    z-index: 1150;
    right: 14px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink-soft);
    box-shadow: var(--shadow-float);
  }

  .map-action svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.9;
  }

  .map-action:active {
    background: var(--accent-bg);
    color: var(--accent-ink);
    transform: scale(.96);
  }

  #mobile-actions {
    position: fixed;
    z-index: 1550;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-height: calc(70px + env(safe-area-inset-bottom));
    padding: 5px 10px calc(5px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    background: var(--surface);
    box-shadow: 0 -10px 28px rgb(15 39 64 / 14%);
  }

  #mobile-actions button {
    min-width: 0;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 3px 8px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }

  #mobile-actions button svg {
    width: 42px;
    height: 30px;
    padding: 5px 10px;
    border-radius: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  #mobile-actions button:active {
    background: var(--tint);
  }

  #mobile-actions button.is-active,
  #mobile-actions button[aria-current="page"] {
    color: var(--accent-ink);
    font-weight: 760;
  }

  #mobile-actions button.is-active svg,
  #mobile-actions button[aria-current="page"] svg {
    background: var(--accent-bg);
  }

  #mobile-locate.is-loading svg {
    animation: mobile-location-pulse 1s ease-in-out infinite;
  }

  #sidebar {
    position: fixed;
    z-index: 1500;
    inset: 0;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: var(--canvas);
    box-shadow: none;
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.2, .8, .25, 1);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar::before,
  #sidebar #verdict {
    display: none;
  }

  .sidebar-head {
    min-height: calc(64px + env(safe-area-inset-top));
    justify-content: flex-start;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .sidebar-head > div {
    min-width: 0;
  }

  .sidebar-eyebrow {
    display: none;
  }

  .sidebar-title {
    margin: 0;
    font-size: 20px;
    font-weight: 720;
    letter-spacing: -.02em;
  }

  #sidebar-close {
    order: -1;
    display: grid;
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 14px;
  }

  .sidebar-body {
    padding: 10px 0 calc(94px + env(safe-area-inset-bottom));
    scrollbar-gutter: auto;
  }

  #sidebar-backdrop {
    display: none;
  }

  #sidebar.open ~ #map-hint,
  #mobile-result:not([hidden]) ~ #map-hint,
  body:has(#modal:not([hidden])) #map-hint {
    display: none;
  }

  .leaflet-touch .leaflet-control-layers-toggle {
    width: 46px;
    height: 46px;
    background-size: 22px 22px !important;
  }

  .leaflet-control-layers {
    margin-bottom: calc(78px + env(safe-area-inset-bottom)) !important;
    border: 1px solid var(--line) !important;
    border-radius: 15px !important;
    box-shadow: var(--shadow-float) !important;
  }

  .leaflet-control-zoom {
    display: none;
  }

  .leaflet-bottom.leaflet-right .leaflet-control-attribution {
    margin-bottom: calc(74px + env(safe-area-inset-bottom));
    border-radius: 7px 0 0 7px;
    background: rgb(255 255 255 / 88%) !important;
    font-size: 8px !important;
  }
}

@media (max-width: 760px) and (max-height: 650px) {
  #map-hint {
    display: none;
  }
}

@keyframes mobile-location-pulse {
  50% {
    transform: scale(.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  #mobile-locate.is-loading svg {
    animation: none;
  }
}
