/* Нижняя мобильная навигация + sheet аккаунта */

.mobile-bottom-stack {
  display: none;
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + constant(safe-area-inset-bottom));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  z-index: 900;
  border-radius: var(--radius-m);
  flex-direction: column;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: stretch;
  padding-bottom: 0;
  background: #1f1f1ff0;
  border-top: 0px solid var(--color-line, rgba(255, 255, 255, 0.08));
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mobile-rail {
  display: flex;
  align-items: stretch;
  min-height: 65px;
}

.mobile-rail__item {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  margin: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--color-text-3, #9aa0a6);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-rail__item:hover,
.mobile-rail__item:focus-visible,
.mobile-rail__item.is-active {
  color: var(--color-text, #f2f2f2);
}

.mobile-rail__item.is-active {
  color: var(--color-brand, #c9a227);
}

.mobile-rail__icon {
  font-size: 18px;
  line-height: 1;
}

.mobile-rail__label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-chat__mobile-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-danger, #f4511e);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.site-chat__mobile-badge.d-none,
.site-chat__mobile-badge[hidden] {
  display: none !important;
}

.mobile-account {
  position: fixed;
  inset: 0;
  z-index: 920;
  display: none;
  align-items: flex-end;
}

.mobile-account.is-open {
  display: flex;
}

.mobile-account[hidden]:not(.is-open) {
  display: none !important;
}

.mobile-account__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.mobile-account__sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: min(72vh, 520px);
  overflow: auto;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: var(--color-surface, #161616);
  border: 1px solid var(--color-line, rgba(255, 255, 255, 0.08));
  border-bottom: 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  color: var(--color-text, #f2f2f2);
  animation: mobile-account-up 0.28s ease both;
}

.mobile-account__handle {
  width: 36px;
  height: 4px;
  margin: 2px auto 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.mobile-account__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.mobile-account__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-surface-2, #222);
}

.mobile-account__hello {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-3, #9aa0a6);
}

.mobile-account__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.mobile-account__close {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-3, #9aa0a6);
  cursor: pointer;
}

.mobile-account__close:hover {
  background: var(--color-surface-2, #222);
  color: var(--color-text, #f2f2f2);
}

.mobile-account__guest {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.mobile-account__lead {
  margin: 0;
  color: var(--color-text-3, #9aa0a6);
  font-size: 14px;
  line-height: 1.45;
}

.mobile-account__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-account__link,
.mobile-account__logout {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--color-text, #f2f2f2);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}

.mobile-account__link:hover,
.mobile-account__logout:hover {
  background: var(--color-surface-2, #222);
}

.mobile-account__link .fal,
.mobile-account__logout .fal {
  width: 18px;
  text-align: center;
  color: var(--color-text-3, #9aa0a6);
}

.mobile-account__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-danger, #f4511e);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.mobile-account__logout {
  margin-top: 10px;
  border-top: 1px solid var(--color-line, rgba(255, 255, 255, 0.08));
  border-radius: 0 0 12px 12px;
  color: var(--color-danger, #f4511e);
}

@keyframes mobile-account-up {
  from { transform: translateY(16px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

@media (max-width: 1080px) {
  .mobile-bottom-stack {
    display: flex;
  }

  /* 10 + ~60 rail + 10 + safe-area */
  body {
    padding-bottom: calc(80px + constant(safe-area-inset-bottom));
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  body.is-mobile-account-open,
  body.is-mobile-filters-open {
    overflow: hidden;
  }

  /* В бургер-меню оставляем только GetBonus — аккаунт в нижней панели */
  .ui-header.is-nav-open .ui-header__tools {
    grid-template-columns: 1fr;
  }

  .ui-header.is-nav-open .ui-dropdown--profile,
  .ui-header.is-nav-open .ui-header__tools > .ui-btn[data-modal-open="loginModal"] {
    display: none !important;
  }

  .ui-header.is-nav-open .ui-dropdown--bonus {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1081px) {
  .mobile-bottom-stack,
  .mobile-account {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-account__sheet {
    animation: none;
  }
}
