/* Mappy Mascot Character · Animated, friendly, interactive cartoon companion */
.mappy-helper {
  margin-top: 18px;
  margin-bottom: 24px;
  min-width: 0;
}
.mappy-content {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  position: relative;
  min-width: 0;
  cursor: pointer;
}
.mappy-content[hidden],
.mappy-restore[hidden] {
  display: none !important;
}

/* Portrait */
.mappy-portrait {
  position: relative;
  display: block;
  flex: 0 0 144px;
  height: 160px;
  overflow: visible;
  isolation: isolate;
}
.mappy-portrait::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 14px;
  width: 116px;
  height: 12px;
  background: radial-gradient(ellipse at center, rgba(16, 68, 38, 0.22) 0%, rgba(16, 68, 38, 0.06) 55%, transparent 75%);
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}
.mappy-portrait img {
  display: block;
  position: relative;
  z-index: 2;
  width: 144px;
  height: 160px;
  max-width: none;
  left: 0;
  top: 0;
  object-fit: contain;
  object-position: bottom;
  transform-origin: 50% 90%;
  animation: mappy-breathe 3.8s ease-in-out infinite;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 10px rgba(19, 111, 56, 0.08));
}

/* Speech Bubble (Cartoonish, cute, friendly) */
.mappy-bubble {
  position: relative;
  flex: 1;
  max-width: 360px;
  min-width: 0;
  margin-bottom: 14px;
  padding: 14px 18px;
  border: 1.5px solid #cae8d1;
  border-radius: 20px;
  background: #f0f8f2;
  color: #143c2d;
  box-shadow: 0 6px 20px rgba(19, 111, 56, 0.07);
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s ease;
  user-select: none;
}
.mappy-bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  top: calc(50% - 7px);
  width: 13px;
  height: 13px;
  background: #f0f8f2;
  border-left: 1.5px solid #cae8d1;
  border-bottom: 1.5px solid #cae8d1;
  transform: rotate(45deg);
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

body.page-home .home-hero .mappy-helper .mappy-bubble p {
  order: 0;
  margin: 0;
  max-width: none;
  font-size: 14.5px;
  line-height: 1.48;
  font-weight: 600;
  color: #143c2d;
  overflow-wrap: normal;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(0);
  opacity: 1;
}
.mappy-bubble p.is-switching {
  opacity: 0;
  transform: translateY(4px);
}

/* Close button permanently hidden as requested ("чтобы нельзя было закрыть") */
.mappy-dismiss {
  display: none !important;
}

/* Restore button */
.mappy-restore {
  border: 1px solid #cfdfd1;
  background: #eef6ec;
  color: #136f38;
  border-radius: 20px;
  padding: 8px 14px;
  min-height: 44px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.mappy-dismiss:focus-visible,
.mappy-restore:focus-visible,
.mappy-success-link:focus-visible {
  outline: 3px solid #136f38;
  outline-offset: 3px;
}

/* Hover effects */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .mappy-content:hover .mappy-portrait img {
    animation: mappy-happy-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 1 both !important;
  }
  .mappy-content:hover .mappy-portrait::after {
    transform: scale(0.85);
    opacity: 0.6;
  }
  .mappy-content:hover .mappy-bubble {
    border-color: #9fe0b3;
    box-shadow: 0 8px 24px rgba(19, 111, 56, 0.12);
    transform: translateY(-2px) scale(1.015);
    background: #e3f5e7;
  }
  .mappy-content:hover .mappy-bubble::before {
    border-left-color: #9fe0b3;
    border-bottom-color: #9fe0b3;
    background: #e3f5e7;
  }
}

/* Reaction on tip change */
.mappy-content.mappy-react .mappy-portrait img {
  animation: mappy-squash-nod 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) 1 !important;
}
.mappy-content.mappy-react .mappy-portrait::after {
  animation: mappy-shadow-react 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) 1;
}
.mappy-content.mappy-react .mappy-bubble {
  animation: mappy-bubble-pulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 1;
}

/* Entrance */
.mappy-enter .mappy-portrait img {
  animation: mappy-arrive 0.7s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
.mappy-enter .mappy-bubble {
  animation: mappy-speak 0.4s 0.17s ease-out both;
}

/* Keyframe animations */
@keyframes mappy-breathe {
  0%, 100% {
    transform: translateY(0) scale(1, 1);
  }
  50% {
    transform: translateY(-5px) scale(1.018, 1.012);
  }
}
@keyframes mappy-happy-bounce {
  0% { transform: translateY(0) scale(1, 1); }
  30% { transform: translateY(-10px) scale(0.97, 1.05); }
  60% { transform: translateY(2px) scale(1.03, 0.97); }
  80% { transform: translateY(-3px) scale(0.99, 1.01); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes mappy-squash-nod {
  0% { transform: scale(1, 1); }
  25% { transform: translateY(4px) scale(1.05, 0.94); }
  55% { transform: translateY(-6px) scale(0.97, 1.04); }
  80% { transform: translateY(1px) scale(1.01, 0.99); }
  100% { transform: scale(1, 1); }
}
@keyframes mappy-shadow-react {
  0%, 100% { transform: scale(1); opacity: 1; }
  25% { transform: scale(1.08); opacity: 1; }
  55% { transform: scale(0.88); opacity: 0.65; }
}
@keyframes mappy-bubble-pulse {
  0% { transform: scale(0.97); }
  50% { transform: scale(1.025); }
  100% { transform: scale(1); }
}
@keyframes mappy-arrive {
  0% { opacity: 0; transform: translateY(20px) scale(0.92); }
  65% { opacity: 1; transform: translateY(-3px) scale(1.02); }
  100% { opacity: 1; transform: none; }
}
@keyframes mappy-speak {
  from { opacity: 0; transform: translateX(-7px); }
  to { opacity: 1; transform: none; }
}

/* Catalog & Submission Scenes */
.mappy-scene {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  min-width: 0;
  align-self: center;
}
.mappy-scene::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 24% 2% 2%;
  background: #f0f5e9;
  border-radius: 48% 52% 46% 54% / 56% 44% 56% 44%;
  transform: rotate(-7deg);
}
.mappy-scene::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 28%;
  height: 33%;
  left: 0;
  bottom: 5%;
  border-radius: 5% 95% 5% 95%;
  background: #e2ebd8;
  transform: rotate(-16deg);
}
:is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state {
  display: grid !important;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  align-items: center;
  gap: 36px;
  max-width: none;
  padding: 34px 36px !important;
  text-align: left !important;
  background: #fff;
  border: 1px solid #dfeade;
  border-radius: 22px;
}
:is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state .mappy-empty-image {
  position: relative;
  display: block;
  width: 250px;
  height: 274px;
  max-width: 100%;
  object-fit: contain;
  margin: 0;
}
:is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state h2 {
  font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.2;
  margin: 0 0 14px;
  color: #173e2b;
}
:is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state p {
  max-width: 480px;
  margin: 0 0 24px !important;
  font-size: 16px;
  line-height: 1.65;
  color: #617367;
}
:is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state .empty-actions {
  justify-content: flex-start !important;
}

.flash-message.mappy-submission {
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
  gap: 36px;
  padding: 28px 44px;
  margin: 12px 0;
  background: #fff;
  border: 1px solid #d9e8da;
  border-radius: 22px;
  box-shadow: 0 8px 30px rgba(24, 77, 43, 0.04);
  color: #173e2b;
}
.mappy-success-image {
  display: block;
  width: 204px;
  height: 224px;
  max-width: 100%;
  object-fit: contain;
}
.mappy-success-copy h2 {
  margin: 12px 0 10px;
  font-size: clamp(23px, 2.4vw, 32px);
  line-height: 1.2;
  font-weight: 750;
  color: #173e2b;
}
.mappy-success-copy .flash-message__text {
  margin: 0;
  max-width: 520px;
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
  color: #617367;
}
.mappy-success-check {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: #dff6e4;
  border-radius: 50%;
  color: #087a42;
}
.mappy-success-link {
  display: inline-flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 20px;
  padding: 10px 18px;
  border-radius: 10px;
  background: #087a42;
  color: white;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.mappy-success-link:hover {
  background: #075f34;
  color: #fff;
}
.flash-message.mappy-submission > .flash-message__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  margin: 0;
  font-size: 24px;
  color: #47715a;
}

/* Mobile */
@media (max-width: 767px) {
  body.page-home .home-hero-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  body.page-home .home-hero-grid > .home-hero-copy,
  body.page-home .home-hero-grid > .home-hero-visual {
    display: contents;
  }
  body.page-home .home-hero-grid > .home-hero-visual::before,
  body.page-home .home-hero-grid > .home-hero-visual::after {
    content: none;
    display: none;
  }
  body.page-home .home-hero-grid .home-hero-copy > .home-redesign-eyebrow {
    order: 0;
    align-self: flex-start;
    margin: 0;
  }
  body.page-home .home-hero-grid .home-hero-copy > h1 {
    order: 1;
    margin: 0;
  }
  body.page-home .home-hero .home-hero-grid .home-hero-copy > p:not(.home-hero-eyebrow) {
    order: 2;
    margin: 0 0 4px;
  }
  body.page-home .home-hero-grid .home-hero-visual > .home-hero-slider,
  body.page-home .home-hero-grid .home-hero-visual > .home-hero-slide-grid {
    order: 3;
    width: 100%;
    margin: 0;
    max-width: none;
  }
  body.page-home .home-hero-grid .home-hero-slide-grid {
    grid-template-rows: repeat(2, clamp(64px, 19vw, 102px));
    gap: 7px;
  }
  body.page-home .home-hero-grid .home-hero-copy > .mappy-helper {
    order: 4;
    margin-top: 0;
    margin-bottom: 20px;
  }
  body.page-home .home-hero-grid .home-hero-copy > .home-redesign-actions {
    order: 5;
    margin: 0;
    gap: 8px;
  }
  body.page-home .home-hero-grid > .home-hero-search-area {
    order: 6;
    margin-top: 8px;
  }
  body.page-home .home-hero-grid .home-hero-visual > .home-hero-stats {
    order: 7;
    margin-top: 0;
  }
  .mappy-content {
    gap: 12px;
  }
  .mappy-portrait {
    flex-basis: 112px;
    height: 124px;
  }
  .mappy-portrait::after {
    bottom: 1px;
    left: 10px;
    width: 92px;
    height: 10px;
  }
  .mappy-portrait img {
    width: 112px;
    height: 124px;
    left: 0;
    top: 0;
  }
  .mappy-bubble {
    max-width: none;
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 17px;
  }
  body.page-home .home-hero .mappy-helper .mappy-bubble p {
    font-size: 13px;
    line-height: 1.48;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 24px 20px !important;
    text-align: center !important;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state .mappy-scene {
    width: 220px;
    max-width: 100%;
    margin: auto;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state .mappy-empty-image {
    width: 184px;
    height: 202px;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state h2 {
    font-size: 25px;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state .empty-actions {
    justify-content: center !important;
  }
  .flash-message.mappy-submission {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 24px 22px;
    text-align: center;
  }
  .mappy-submission .mappy-scene {
    width: 190px;
    margin: auto;
  }
  .mappy-success-image {
    width: 160px;
    height: 175px;
  }
  .mappy-success-check {
    width: 34px;
    height: 34px;
    margin: auto;
  }
  .mappy-success-copy h2 {
    font-size: 25px;
    margin-top: 10px;
  }
  .mappy-success-link {
    width: 100%;
  }
}

@media (max-width: 359px) {
  .mappy-portrait {
    flex-basis: 92px;
    height: 102px;
  }
  .mappy-portrait::after {
    left: 8px;
    width: 76px;
    height: 8px;
  }
  .mappy-portrait img {
    width: 92px;
    height: 102px;
    left: 0;
    top: 0;
  }
  .mappy-bubble {
    padding: 10px 12px;
  }
  .mappy-bubble p {
    font-size: 12.5px;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mappy-helper *,
  .mappy-helper *::before {
    animation: none !important;
    transition: none !important;
  }
}

@media (min-width: 768px) and (max-width: 1100px) {
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state {
    grid-template-columns: 1fr;
    gap: 18px;
    text-align: center !important;
    padding: 24px !important;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state .mappy-scene {
    width: 220px;
    max-width: 100%;
    margin: auto;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state .mappy-empty-image {
    width: 184px;
    height: 202px;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state p {
    margin: 0 auto 24px !important;
  }
  :is(.page-place_list, .page-place_new) .catalog-empty-state.mappy-empty-state .empty-actions {
    justify-content: center !important;
  }
}
