.map-listing-popup-host,
:is([class$="-balloon"], [class*="-balloon "], [class*="-balloon__layout"], [class*="-balloon__content"]):has(.map-listing-popup-host),
.map-listing-popup {
    border-radius: var(--brand-card-radius);
}
.map-listing-popup {
    width: var(--listing-balloon-width, min(280px, calc(100vw - 72px)));
    color: #131d31;
    background: #fff;
    font: 400 14px/1.35 Roboto, sans-serif;
}
/* Keep the native desktop balloon sized to the live width of the listing. */
[class*="-balloon__layout"]:has(.map-listing-popup:not(.map-listing-popup--compact)) {
    width: max-content;
}
[class*="-balloon__content"] > *:has(.map-listing-popup:not(.map-listing-popup--compact)) {
    /* Yandex Maps writes the initial width on this wrapper inline. Обёртка — элемент <ymaps>, а не <div>.
       Размер карточки меняется вместе с картой (окно, полоса прокрутки), а Яндекс свои inline-размеры
       не пересчитывает — без этого правая часть карточки с кнопкой «Подробнее» обрезалась. */
    width: max-content !important;
    height: auto !important;
}
[class*="-balloon__close"] + [class*="-balloon__content"]:has(.map-listing-popup:not(.map-listing-popup--compact)) {
    margin-right: 22px;
}
[class*="-balloon__layout"]:has(.map-listing-popup-host) [class*="-balloon__close-button"]:not(:hover):not(:focus-visible) {
    opacity: .65;
}
.map-listing-popup [hidden] { display: none !important; }
.map-listing-popup__frame {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    box-sizing: border-box;
    height: var(--listing-balloon-height);
    min-height: 0;
    padding: 10px;
    border-radius: inherit;
}
.map-listing-popup__frame:has(.map-listing-popup__sidebar:not([hidden])) {
    grid-template-columns: minmax(170px, .55fr) minmax(0, 1fr);
}
.map-listing-popup__content { display: contents; }
.map-listing-popup__sidebar,
.map-listing-popup__preview {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.map-listing-popup__sidebar {
    grid-row: span 2;
    border-inline-end: 1px solid var(--brand-dropdown-border, #e2e7ef);
    padding-inline-end: 8px;
}
.map-listing-popup__heading {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.25;
    font-weight: var(--brand-font-weight-emphasis);
    white-space: normal;
    overflow: visible;
}
.map-listing-popup__heading b {
    display: grid;
    flex: none;
    place-items: center;
    box-sizing: border-box;
    inline-size: max-content;
    min-inline-size: 26px;
    aspect-ratio: 1;
    padding-inline: 4px;
    border-radius: 50%;
    background: #edf3fe;
    color: var(--brand-primary);
    font-size: 14px;
    font-weight: var(--brand-font-weight-emphasis);
    line-height: 1;
}
.map-listing-popup__choices,
.map-listing-popup__details {
    padding: 0;
    margin: 0;
    list-style: none;
}
.map-listing-popup__choices {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}
.map-listing-popup__choices li + li { border-top: 1px solid #e8ebf1; }
.map-listing-popup__choices button {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 5px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    text-align: start;
    cursor: pointer;
}
.map-listing-popup__choices button:hover { background: #f5f8fe; }
.map-listing-popup__choices button[aria-current] {
    border-color: var(--brand-primary);
    background: #edf3fe;
}
.map-listing-popup__choices button:focus-visible {
    outline: 2px solid var(--brand-focus);
    outline-offset: -2px;
}
.map-listing-popup__thumbnail,
.map-listing-popup__media {
    display: grid;
    place-items: center;
    background: #edf1f7;
}
.map-listing-popup__thumbnail { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 9px; }
.map-listing-popup__thumbnail img,
.map-listing-popup__cover { display: block; width: 100%; height: 100%; object-fit: cover; }
.map-listing-popup__choices strong,
.map-listing-popup__choices small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.map-listing-popup__choices strong { font-weight: var(--brand-font-weight-emphasis); }
.map-listing-popup__choices small,
.map-listing-popup__address,
.map-listing-popup__additional { color: #505e75; }
.map-listing-popup__preview {
    overflow: auto;
    overscroll-behavior: contain;
    padding-inline: 10px 2px;
}
.map-listing-popup__choices,
.map-listing-popup__preview,
.map-listing-popup--compact .map-listing-popup__content {
    scrollbar-width: none;
}
.map-listing-popup__choices::-webkit-scrollbar,
.map-listing-popup__preview::-webkit-scrollbar,
.map-listing-popup--compact .map-listing-popup__content::-webkit-scrollbar {
    display: none;
}
.map-listing-popup__preview > * { flex-shrink: 0; }
.map-listing-popup__media {
    position: relative;
    aspect-ratio: 1.64 / 1;
    max-height: min(215px, 34dvh);
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 8px;
}
.map-listing-popup__cover { position: absolute; inset: 0; }
.map-listing-popup__placeholder { color: #617189; }
.map-listing-popup__media .add-to-favorites .material-icons {
    width: 24px;
    height: 24px;
    overflow: hidden;
    font-size: 0;
    background: currentColor;
    mask: url('/img/favorite_white.png') center / contain no-repeat;
}
.map-listing-popup__media .add-to-favorites .material-icons:last-child {
    mask-image: url('/img/favorite_border_black.png');
}
.map-listing-popup__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    margin: 0 0 5px;
    font-size: 18px;
    line-height: 1.25;
    font-weight: var(--brand-font-weight-emphasis);
    white-space: normal;
    overflow-wrap: anywhere;
}
.map-listing-popup__preview p { margin: 0 0 6px; }
.map-listing-popup__details { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 6px; }
.map-listing-popup__description,
.map-listing-popup__additional { overflow-wrap: anywhere; }
.map-listing-popup__footer,
.map-listing-popup__prices { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.map-listing-popup__footer {
    grid-column: -2 / -1;
    padding: 6px 2px 0;
    border-top: 1px solid var(--brand-dropdown-border, #e2e7ef);
    justify-content: space-between;
}
.map-listing-popup__prices strong {
    font-size: 20px;
    font-weight: var(--brand-font-weight-emphasis);
    color: var(--brand-primary);
}
.map-listing-popup__prices span { padding-inline-start: 10px; border-inline-start: 1px solid #c5ccd9; }
.map-listing-popup__footer a { min-width: 0; white-space: normal; text-align: center; }

.map-listing-popup:not(.map-listing-popup--compact) .map-listing-popup__footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-inline-start: 10px;
}
.map-listing-popup:not(.map-listing-popup--compact) .map-listing-popup__prices {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.map-listing-popup:not(.map-listing-popup--compact) .map-listing-popup__prices span {
    padding-inline-start: 0;
    border-inline-start: 0;
}
.map-listing-popup:not(.map-listing-popup--compact) .map-listing-popup__footer a { grid-column: 2; }

.map-listing-popup--compact .map-listing-popup__frame,
.map-listing-popup--compact .map-listing-popup__frame:has(.map-listing-popup__sidebar:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
}
.map-listing-popup--compact .map-listing-popup__content {
    display: block;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}
.map-listing-popup--compact .map-listing-popup__sidebar { padding: 0; border: 0; }
.map-listing-popup--compact .map-listing-popup__heading { margin: 0 0 6px; }
.map-listing-popup--compact .map-listing-popup__choices { display: flex; gap: 6px; padding-bottom: 6px; }
.map-listing-popup--compact .map-listing-popup__choices li { flex: 0 0 min(230px, 83%); }
.map-listing-popup--compact .map-listing-popup__choices li + li { border-top: 0; }
.map-listing-popup--compact .map-listing-popup__choices button { grid-template-columns: 44px minmax(0, 1fr); }
.map-listing-popup--compact .map-listing-popup__preview { overflow: visible; padding: 5px 0 0; }
.map-listing-popup--compact .map-listing-popup__footer {
    flex-wrap: nowrap;
    gap: 6px;
}
.map-listing-popup--compact .map-listing-popup__prices {
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}
.map-listing-popup--compact .map-listing-popup__prices strong { font-size: 18px; }
.map-listing-popup--compact .map-listing-popup__prices span {
    padding-inline-start: 0;
    border: 0;
    font-size: 12px;
}
.map-listing-popup--compact .map-listing-popup__footer a {
    flex: none;
    margin-inline-start: auto;
    padding-inline: 9px;
    font-size: 13px;
}
