/**
 * Flirtam — Christmas Hats v2.3
 * Позиция/размер/угол — только inline из positions.php + render.php.
 * Здесь: overflow и сброс конфликтов темы.
 */

.ch-hat-wrap,
.ch-hat-frame,
.ch-hat-float {
  box-sizing: border-box !important;
}

.ch-hat-wrap {
  display: inline-block !important;
  position: relative !important;
  overflow: visible !important;
  vertical-align: middle !important;
  line-height: 0 !important;
}

.ch-hat-frame.avatar-has-hat,
.ch-hat-frame.avatar_color.avatar-has-hat {
  overflow: visible !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  flex: none !important;
}

.avatar-hat-stack {
  display: block !important;
  position: relative !important;
  flex: 0 0 auto !important;
  overflow: visible !important;
  line-height: 0 !important;
  z-index: 1 !important;
}

.ch-hat-float {
  position: absolute !important;
  pointer-events: none !important;
  z-index: 100 !important;
}

/* Тема не должна менять размер/поворот шапки */
html body .ch-hat-float > img.christmas-hat-avatar,
html body img.christmas-hat-avatar.christmas-hat-1,
html body img.christmas-hat-avatar.christmas-hat-2,
html body img.christmas-hat-avatar.christmas-hat-3,
html body img.christmas-hat-avatar.christmas-hat-4,
html body img.christmas-hat-avatar.christmas-hat-5,
html body img.christmas-hat-avatar.christmas-hat-6,
html body img.christmas-hat-avatar.christmas-hat-7,
html body img.christmas-hat-avatar.christmas-hat-8 {
  pointer-events: none !important;
  z-index: 100 !important;
}

html body .ch-hat-frame .avatar-hat-stack > img.avatar,
html body .ch-hat-frame .avatar-hat-stack > .avatar-o {
  object-fit: cover !important;
  display: block !important;
  position: relative !important;
  z-index: 2 !important;
}

.ch-hats-shop-preview {
  overflow: visible !important;
  padding: 16px 0 12px !important;
  min-height: 130px !important;
}

.ch-hats-shop-row { position: relative !important; margin: 0 !important; padding: 0 !important; }
.ch-hats-shop-row .ch-hats-shop-scroll {
  height: 72px !important;
  white-space: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 6px 40px !important;
  border-top: 1px solid #e1e8ef !important;
  border-bottom: 1px solid #e1e8ef !important;
}
.ch-hats-shop-row .ch-hat-shop-item {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 58px !important;
  height: 58px !important;
  margin: 0 4px !important;
  cursor: pointer !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
}
.ch-hats-shop-row .ch-hat-shop-item.ch-hat-shop-item-active {
  outline: 2px solid #e91e8c !important;
  background: rgba(233, 30, 140, 0.1) !important;
}
.ch-hats-shop-row .ch-hat-shop-item img {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  object-fit: contain !important;
  display: block !important;
  transform: none !important;
}

html body .avatar_optimize:has(.ch-hat-wrap),
html body .avatar_optimize:has(.avatar-has-hat),
html body .panel-avatar-box,
html body .ms-avatar-outer:has(.ch-hat-wrap),
html body .modern-dating-grid .list .user-avatar-mini:has(.ch-hat-wrap),
html body .list.ls_dtm {
  overflow: visible !important;
}

/* Профиль: border=1 давал bottom:7px на рамку — шапка оставалась на месте, казалась ниже */
html body .avatar_optimize .ch-hat-wrap .ch-hat-frame {
  bottom: 0 !important;
  top: auto !important;
}

html body.night_mode .ch-hat-frame.avatar_color.avatar-has-hat[style*="linear-gradient"],
html body.night_mode .ch-hat-frame.avatar_color.avatar-has-hat[style*="background"] {
  background-color: transparent !important;
}

html body .ms-avatar-outer:has(.ch-hat-wrap) {
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: visible !important;
}

html body .ms-avatar-outer .ch-hat-wrap .ch-hat-frame {
  border-radius: 14px !important;
}

html body .ms-avatar-outer .ch-hat-wrap .ch-hat-frame img.avatar,
html body .ms-avatar-outer .ch-hat-wrap .ch-hat-frame .avatar-o {
  border-radius: 12px !important;
}

.p-story-add-wrap .christmas-hat-avatar,
.us-story-inner .christmas-hat-avatar,
.p-story-inner .christmas-hat-avatar {
  display: none !important;
}

/* Гостевая: убрать «кольцо» вокруг шапки */
body.gb-guestbook .comments-list-avatar .ch-hat-wrap,
body.gb-guestbook .comments-list-avatar .ch-hat-float,
body.gb-guestbook .comments-list-avatar .ch-hat-float img.christmas-hat-avatar {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent !important;
}

body.gb-guestbook .comments-list-avatar .ch-hat-wrap img.avatar {
  border: none !important;
  box-shadow: none !important;
}

@media screen and (max-width: 900px) {
  html body .ls_dtm .avatar_optimize,
  html body .avatar_optimize:has(.ch-hat-wrap) {
    left: 0 !important;
    top: 0 !important;
    width: 150px !important;
    height: auto !important;
    min-height: 150px !important;
    margin-top: -75px !important;
    padding-top: 22px !important;
    overflow: visible !important;
    text-align: center !important;
  }

  html body .avatar_optimize #avatar_upgrade,
  html body .avatar_optimize > a {
    position: static !important;
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
  }
}

/* Купленная шапка торчит над кругом — даём место в горизонтальных лентах */
html body .online_vidjet:has(.avatar-has-hat) {
  height: 150px !important;
  padding-top: 28px !important;
  box-sizing: border-box !important;
}
html body .widget-online-item:has(.avatar-has-hat) {
  margin-top: 0 !important;
}
html body .wg-vip-scroll:has(.avatar-has-hat) {
  padding-top: 26px !important;
  box-sizing: border-box !important;
}
html body .wg-vip-item:has(.avatar-has-hat) {
  overflow: visible !important;
}
html body .comments-list-avatar:has(.avatar-has-hat),
html body .comments-reply-avatar:has(.avatar-has-hat),
html body .chat-avatar:has(.avatar-has-hat),
html body .mess_mod_avatar:has(.avatar-has-hat) {
  overflow: visible !important;
  padding-top: 8px !important;
}
