/* ========== СТИЛИ ДЛЯ МАГАЗИНА ========== */

/* Оверлей магазина */
#shopOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

#shopWindow {
  background: white;
  width: 90%;
  max-width: 1000px;
  height: 80vh;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

/* Заголовок магазина */
.shop-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shop-header h2 {
  margin: 0;
  font-size: 28px;
}

.coins-timer-container {
  display: flex;
  gap: 15px;
  align-items: center;
}

.coin-icon {
  font-size: 20px;
}

.shop-coins {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: bold;
}

.crystal-icon {
  font-size: 20px;
}

.shop-crystals {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: bold;
}

/* Раньше обратный отсчёт показывался отдельной строкой НАД кнопкой (#coinTimer) — теперь
   кнопка сама превращается в таймер, пока клейм недоступен (см. updateCoinTimer() в
   js/shop.js), и в "🪙 Получить +N" когда готово — один и тот же слот, а не две
   отдельные надписи. Размер — как у #openBuyCoinsBtn (padding/font-size те же), чтобы
   обе кнопки в шапке магазина были одного размера. */
#claimCoinsBtn {
  padding: 8px 14px;
  background: rgba(76, 175, 80, 0.9);
  color: white;
  /* Прозрачная, а не убранная — #openBuyCoinsBtn рядом имеет border:1px solid той же
     толщины; без неё общая высота (border учитывается в layout) отличалась бы на
     пару пикселей, и кнопки визуально были бы чуть разного размера. */
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  transition: all 0.3s;
  white-space: nowrap;
}

#claimCoinsBtn:hover:not(:disabled) {
  background: rgba(76, 175, 80, 1);
  transform: scale(1.05);
}

#claimCoinsBtn:disabled {
  background: rgba(255, 255, 255, 0.2);
  cursor: not-allowed;
  opacity: 0.5;
}

#openBuyCoinsBtn {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  transition: all 0.3s;
  white-space: nowrap;
}

#openBuyCoinsBtn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
}

.close-shop-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.3s;
}

.close-shop-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Контейнер магазина */
.shop-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Превью персонажа */
.shop-preview {
  width: 280px;
  background: linear-gradient(180deg, #f5f7fa 0%, #c3cfe2 100%);
  border-left: 2px solid #ddd;
  padding: 20px;
  display: flex !important; /* Принудительно показываем */
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

.shop-preview h4 {
  margin: 0 0 15px 0;
  font-size: 18px;
  color: #333;
  text-align: center;
  font-weight: 600;
  display: none; /* Скрываем заголовок */
}

.preview-character {
  position: relative;
  width: 240px;
  height: 500px; /* Увеличил высоту чтобы голова влезла */
  background: transparent; /* Прозрачный фон */
  border-radius: 0; /* Убрал скругление */
  box-shadow: none; /* Убрал тень */
  overflow: visible; /* Показываем всё */
  margin-bottom: 15px;
  border: none; /* Убрал рамку */
}

.preview-character .playerModel {
  position: absolute;
  bottom: 0; /* Прижат к низу */
  left: 50%;
  transform: translateX(-50%) scale(0.65); /* Чуть увеличил масштаб */
  transform-origin: bottom center;
  width: 332px;
  height: 729px;
}

.preview-character .layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 332px;
  height: 729px;
  object-fit: contain;
  pointer-events: none;
}

.preview-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: white;
  font-size: 14px;
  gap: 15px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Сумма за ещё не купленные вещи в ТЕКУЩЕЙ примерке (может копить сразу из
   нескольких категорий — см. showCategory/getPreviewUnownedTotal в shop.js).
   Пусто/скрыто, если все примеренные вещи уже куплены — "Применить" тогда просто
   наденет их бесплатно. */
.preview-total-cost {
  width: 100%;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
}

.preview-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.preview-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  text-align: center;
}

.apply-btn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
}

.apply-btn:hover {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.reset-btn {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  color: white;
}

.reset-btn:hover {
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

/* Боковая панель */
.shop-sidebar {
  width: 200px;
  background: #f5f5f5;
  padding: 15px;
  overflow-y: auto;
  border-right: 1px solid #ddd;
}

.shop-category-btn {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 8px;
  background: white;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: all 0.3s;
  color: #333;
}

.shop-category-btn:hover {
  background: #e8e8e8;
  transform: translateX(5px);
}

.shop-category-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  font-weight: bold;
}

/* Контент магазина */
#shopContent {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

#shopContent h3 {
  margin: 0 0 20px 0;
  font-size: 24px;
  color: #333;
}

/* ПРАВИЛЬНЫЙ ПОРЯДОК СЛОЁВ ОДЕЖДЫ */
.layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.layer-base {
  z-index: 1;
}

.layer-down {
  z-index: 2; /* Штаны внизу */
}

.layer-boots {
  z-index: 3; /* Ботинки */
}

.layer-up {
  z-index: 4; /* Футболка ПОВЕРХ штанов */
}

.layer-hair {
  z-index: 5; /* Волосы */
}

.layer-hat {
  z-index: 6; /* Шапка */
}

.layer-accs {
  z-index: 7; /* Аксессуары сверху */
}

/* Сетка предметов */
.inventory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px 10px;
}

.inventory-filter-btn {
  padding: 5px 10px;
  border: 1px solid #d0d5e5;
  border-radius: 14px;
  background: white;
  color: #555;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.inventory-filter-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.inventory-filter-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.shop-items-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 колонки — 8 карточек в 2 ряда */
  gap: 10px;
  padding: 10px;
}

/* Карточка предмета */
.shop-item-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.shop-item-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.item-image {
  position: relative;
  width: 100%;
  height: 100px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Превью вещи в карточке — вписываем по обеим сторонам (object-fit:contain), т.к. после
   обрезки по реальным границам вещи (см. computeOpaqueBBox в avatar.js) пропорции у
   разных категорий очень разные: шорты широкие и низкие, футболка высокая, кепка широкая.
   min-height:0 обязателен: без него флекс-контейнер .item-image не может сжать
   .item-image-mount ниже "естественного" размера канваса, и превью раздувается на
   весь блок вместо того чтобы вписаться в 200px высоты карточки. */
.item-image-mount {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.item-image .raster-item {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-image .raster-item-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

/* Категория 'mouth' — не картинка вещи, а выражение лица, показываем эмодзи-иконкой
   вместо превью (см. mountItemThumbnail в js/shop.js). */
.item-mouth-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  line-height: 1;
}

.item-name {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  text-align: center;
  margin-bottom: 4px;
}

.item-info {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.item-color-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #555;
  margin-bottom: 4px;
}

.item-color-input {
  width: 22px;
  height: 16px;
  padding: 1px;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
}

.item-price {
  font-size: 12px;
  font-weight: bold;
  color: #FFA500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.item-btn {
  padding: 4px 6px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  transition: all 0.3s;
}

.buy-btn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
}

.buy-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  transform: scale(1.05);
}

.buy-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.equip-btn {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  color: white;
}

.equip-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #1976D2, #0D47A1);
  transform: scale(1.05);
}

/* Без этого disabled-кнопка (например .room-place-decor-btn, когда игрок не
   стоит физически в управляемой комнате) выглядит как обычная активная —
   этот файл грузится позже style.css и переопределяет его правило того же имени. */
.item-btn:disabled {
  background: #ccc !important;
  color: #888;
  cursor: not-allowed;
  transform: none !important;
}

.tryon-btn {
  background: linear-gradient(135deg, #9C27B0, #7B1FA2);
  color: white;
}

.tryon-btn:hover {
  background: linear-gradient(135deg, #7B1FA2, #6A1B9A);
  transform: scale(1.05);
}

.unequip-btn {
  background: linear-gradient(135deg, #FF9800, #F57C00);
  color: white;
}

.unequip-btn:hover {
  background: linear-gradient(135deg, #F57C00, #E65100);
  transform: scale(1.05);
}

.sell-btn {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  color: white;
  font-size: 12px;
}

.sell-btn:hover {
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
  transform: scale(1.05);
}

.owned-btn {
  background: #e0e0e0;
  color: #666;
  cursor: not-allowed;
}

/* Сообщение когда нет предметов */
.no-items {
  text-align: center;
  color: #999;
  font-size: 16px;
  padding: 40px;
  grid-column: 1 / -1;
}

/* Пагинация */
#pagination {
  grid-column: 1 / -1;
  margin-top: 20px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pagination-btn {
  padding: 10px 20px; /* Увеличен размер */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px; /* Увеличен шрифт */
  font-weight: 500;
  transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pagination-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 8px; /* Увеличен отступ */
}

.pagination-number {
  width: 40px; /* Увеличен размер */
  height: 40px;
  padding: 0;
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px; /* Увеличен шрифт */
  font-weight: 500;
  transition: all 0.3s;
}

.pagination-number:hover {
  background: #f0f0ff;
  transform: translateY(-2px);
}

.pagination-number.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  cursor: default;
}

.pagination-dots {
  color: #999;
  padding: 0 5px;
  font-size: 18px;
}

/* Скроллбары */
.shop-sidebar::-webkit-scrollbar,
#shopContent::-webkit-scrollbar {
  width: 8px;
}

.shop-sidebar::-webkit-scrollbar-track,
#shopContent::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.shop-sidebar::-webkit-scrollbar-thumb,
#shopContent::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.shop-sidebar::-webkit-scrollbar-thumb:hover,
#shopContent::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Адаптив */
@media (max-width: 768px) {
  #shopWindow {
    width: 95%;
    height: 90vh;
  }
  
  .shop-sidebar {
    width: 150px;
    padding: 10px;
  }
  
  .shop-category-btn {
    font-size: 12px;
    padding: 10px;
  }
  
  .shop-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
  
  #coinsDisplay {
    top: 5px;
    right: 5px;
    padding: 8px 15px;
    font-size: 16px;
  }

  /* Раньше это правило стояло СНАРУЖИ media-блока (сразу после закрывающей `}` выше) —
     то есть действовало всегда, а не только на мобильных, и всё равно проигрывало
     !important у базового правила .shop-preview (display:flex !important, строка ~150,
     "принудительно показываем" — актуально для десктопа). На мобильном экране превью
     персонажа (фикс. 280px) вместе с сайдбаром (150px) не оставляли места #shopContent
     вообще. Теперь правило внутри @media и тоже с !important — оно позже в файле и с
     тем же приоритетом, поэтому корректно перебивает базовое на узких экранах. */
  .shop-preview {
    display: none !important;
  }

  /* Ещё уже (реальный телефон, не просто узкое окно десктопа) — боковой сайдбар
     категорий (даже сжатый до 150px выше) съедает слишком много ширины, оставляя
     карточкам вещей место всего под один столбец. Переносим категории в
     горизонтальную прокручиваемую ленту НАД контентом (а не сбоку) — тогда вещам
     достаётся вся ширина экрана, и в неё стабильно помещается 2 колонки (не
     auto-fill/minmax — та на реальных телефонных 360-414px то и дело схлопывалась
     обратно в 1 колонку в зависимости от точной ширины, см. правило чуть выше). */
  @media (max-width: 480px) {
    .shop-container {
      flex-direction: column;
    }

    .shop-sidebar {
      width: 100%;
      display: flex;
      flex-direction: row;
      overflow-x: auto;
      overflow-y: hidden;
      flex-wrap: nowrap;
      border-right: none;
      border-bottom: 1px solid #ddd;
      padding: 8px;
      gap: 6px;
      -webkit-overflow-scrolling: touch;
    }

    .shop-category-btn {
      width: auto;
      flex: 0 0 auto;
      white-space: nowrap;
      margin-bottom: 0;
    }

    .shop-category-btn:hover {
      transform: none; /* translateX(5px) из десктопной версии двигал бы кнопку поперёк ленты */
    }

    #shopContent {
      padding: 10px;
    }

    .shop-items-grid {
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }

    /* .shop-header ниже уже позволяет себе перенос (flex-wrap:wrap), но порядок в
       DOM — h2, .coins-timer-container, .close-shop-btn — переносил их по одному
       элементу в строку (заголовок, потом блок монет сам разваливался на 2 строки
       переносом ВНУТРИ себя, потом крестик закрытия отдельной строкой в самом
       низу) — 4 строки итого, и крестик неожиданно оказывался не сверху, где его
       ищут интуитивно, а где-то внизу под донатом. order переставляет крестик
       СРАЗУ за заголовком (та же строка — оба узкие, влезают с space-between),
       а flex-basis:100% у блока монет принудительно уводит его на вторую строку
       целиком, а не по кусочкам. */
    .shop-header h2 {
      order: 0;
    }

    .close-shop-btn {
      order: 1;
    }

    .coins-timer-container {
      order: 2;
      flex-basis: 100%;
      justify-content: flex-start;
    }
  }

  /* .shop-header (заголовок + .coins-timer-container с монетами/таймером/кнопкой
     покупки монет + крестик закрытия) — flex-row без переноса и без сокращения
     отступов, так и не была тронута мобильным блоком выше. На узких экранах она
     одна давала ~200px горизонтального переполнения всего #shopWindow. */
  .shop-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }

  .shop-header h2 {
    font-size: 20px;
  }

  .coins-timer-container {
    gap: 8px;
    flex-wrap: wrap;
  }

  /* 5 колонок (.purchase-history-row) не помещаются на узком экране — стек в один
     столбец, как и остальные таблично-подобные списки в проекте на мобильном. */
  .purchase-history-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Капча */
.captcha-container {
  margin: 15px 0;
}

.captcha-container label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.captcha-display {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  background: white;
  padding: 10px;
  border-radius: 8px;
  border: 2px solid #ddd;
}

#captchaCanvas {
  width: 200px;
  height: 60px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 6px;
  cursor: not-allowed;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  overflow: hidden;
}

#captchaCanvas svg {
  display: block;
}

.refresh-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#captchaInput {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: bold;
}

#captchaInput:focus {
  outline: none;
  border-color: #667eea;
}

/* Кнопка "Забыли пароль" */
.forgot-password-btn {
  background: none;
  border: none;
  color: #667eea;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 10px;
  transition: color 0.3s;
}

.forgot-password-btn:hover {
  color: #764ba2;
}

/* Форма восстановления пароля */
#forgotPasswordForm h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 20px;
}

.info-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
  text-align: center;
  line-height: 1.4;
}

.back-btn {
  background: #e0e0e0;
  color: #333;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
  transition: all 0.3s;
}

.back-btn:hover {
  background: #d0d0d0;
  transform: translateX(-3px);
}

/* УСИЛЕННЫЕ СТИЛИ ДЛЯ ОШИБОК - ГАРАНТИРОВАННОЕ ОТОБРАЖЕНИЕ */
.error-msg {
  color: #d32f2f !important;
  font-size: 14px !important;
  margin-top: 10px !important;
  display: none !important;
  padding: 10px !important;
  background: #ffebee !important;
  border: 2px solid #d32f2f !important;
  border-radius: 6px !important;
  text-align: center !important;
  font-weight: 500 !important;
}

.success-msg {
  color: #388e3c !important;
  font-size: 14px !important;
  margin-top: 10px !important;
  display: none !important;
  padding: 10px !important;
  background: #e8f5e9 !important;
  border: 2px solid #388e3c !important;
  border-radius: 6px !important;
  text-align: center !important;
  font-weight: 500 !important;
}

.error-msg.show,
.success-msg.show {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Анимация появления */
@keyframes errorSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== ВКЛАДКА «ВНЕШНОСТЬ» ========== */
/* 3 строки: кожа — одна на всю ширину (широкая палитра из 6 кружков, тесно вдвоём
   в узкой колонке), глаза+румяна — рядом (обе просто один цветовой квадрат), рот —
   снова на всю ширину (3 варианта в ряд). Раньше была сетка 2×2 без разбора — кожа
   с румянами оказывались через клетку друг от друга, что было неудобно листать. */
.appearance-shop {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px 0;
  max-width: 480px;
}

.appearance-block-full {
  grid-column: 1 / -1;
}

.appearance-block {
  background: #f7f7fb;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.appearance-block h4 {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  flex-wrap: wrap;
}

.appearance-price {
  font-size: 12px;
  color: #666;
  font-weight: normal;
  background: white;
  padding: 2px 8px;
  border-radius: 20px;
}

.appearance-block .skin-swatches {
  justify-content: center;
  margin-bottom: 10px;
}

.appearance-block .skin-swatch {
  width: 24px;
  height: 24px;
}

.appearance-block .eye-color-input {
  width: 48px !important;
  height: 32px !important;
  margin: 0 auto 10px !important;
}

.appearance-block .item-btn {
  width: 100%;
  padding: 7px;
  font-size: 13px;
}

/* Блок "Рот" (бывшая отдельная вкладка магазина) — те же карточки, что и в обычном
   магазине (.shop-item-card из createShopItemCard), сжатые под размер ОДНОЙ ячейки
   2×2-сетки (в обычном магазине карточка ~140px, тут вдвое теснее) — уменьшенная
   картинка/иконка и шрифты, кнопки без внутреннего текста, только иконки. Вариантов
   рта ровно 3 — 2 в первом ряду мини-сетки, 1 во втором. */
.appearance-mouth-grid {
  /* 3 варианта рта — по одному в ряд (не 2×2): при 2 колонках получались 2 РЯДА
     карточек, а это ровно вдвое выше остальных 3 блоков "Внешности" — вся сетка
     4 карточек переставала помещаться и снова требовала скролл (см. чат). */
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0;
}

.appearance-mouth-grid .item-image {
  height: 32px;
}

.appearance-mouth-grid .item-mouth-icon {
  font-size: 18px;
}

.appearance-mouth-grid .item-info {
  padding: 3px;
}

.appearance-mouth-grid .item-name {
  display: none; /* нет места — иконка + подсказка (title) на карточке заменяют подпись */
}

.appearance-mouth-grid .item-price {
  font-size: 9px;
  margin-bottom: 2px;
}

/* Кнопки в ряд, не столбиком — и, главное, без переноса текста: "👁️ Примерить" на
   таком узком поле переносился на 2 строки и раздувал карточку вдвое по высоте
   (28px вместо ~14px на одну строку) — это и было настоящей причиной скролла. */
.appearance-mouth-grid .item-actions {
  flex-direction: row;
  gap: 2px;
}

.appearance-mouth-grid .item-btn {
  flex: 1;
  padding: 2px 1px;
  font-size: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appearance-block-mouth {
  text-align: left;
}

/* ========== ПОКУПКА МОНЕТ ========== */

.purchase-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 0;
}

.purchase-price-preview {
  font-size: 20px;
  font-weight: 700;
  color: #2ecc71;
  margin: 4px 0;
}

.purchase-price-preview.purchase-price-invalid {
  color: #e74c3c;
  font-size: 13px;
  font-weight: 500;
}

/* Общий класс на всех кнопках оплаты (Stripe/Revolut/крипта/...) — раньше размер
   (padding/ширина) был задан только по id Stripe-кнопки, остальные провайдеры
   молча наследовали мелкий дефолт .item-btn (padding:4px 6px, font-size:10px) и
   визуально выглядели тоньше/мельче на фоне неё. */
.purchase-pay-btn {
  width: 100%;
  padding: 12px;
  font-size: 13px;
}

/* :first-of-type, не :first-child — кнопка Stripe не первый ребёнок .purchase-box
   (перед ней label/input/подсказки/дисклеймер), но первая среди <button> в нём. */
.purchase-pay-btn:first-of-type {
  margin-top: 10px;
}

.purchase-paypal-container {
  margin-top: 10px;
  min-height: 45px;
}

/* Панель выбора банка Modena — раскрывается под кнопкой (см. toggleModenaMethods
   в js/purchase.js), логотипы банков рядами, а не единый чекаут как у остальных
   провайдеров (у Modena нет готовой hosted-страницы со всеми способами сразу). */
/* Grid, не flex — с flex все 9 способов (Swedbank/SEB/LHV/Luminor/Coop/Citadele/
   Revolut/N26/карта) утрамбовывались в одну сплющенную строку (сжимались вместо
   переноса, раз в родителе хватало ширины). minmax гарантирует минимальный размер
   кнопки — при нехватке ширины сама распределяет по нескольким строкам. */
.purchase-modena-methods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  background: #f7f7f7;
  border-radius: 8px;
}

.purchase-modena-method-btn {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px;
  min-height: 56px;
  cursor: pointer;
  transition: border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.purchase-modena-method-btn:hover:not(:disabled) {
  border-color: #4CAF50;
}

.purchase-modena-method-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.purchase-modena-method-btn img {
  height: 44px;
  max-width: 100%;
  display: block;
}

.purchase-unavailable {
  color: #999;
  font-size: 13px;
  text-align: center;
}

/* ========== ИСТОРИЯ ПОКУПОК МОНЕТ ========== */

.purchase-history-section {
  width: 100%;
  margin-top: 20px;
  border-top: 1px solid #eee;
  padding-top: 16px;
}

/* Второй .purchase-box подряд (обмен кристаллов на монеты) — без своей верхней
   границы слился бы визуально с блоком доната выше него в один сплошной кусок. */
.purchase-convert-box {
  border-top: 1px solid #eee;
  padding-top: 16px;
}

.purchase-crystals-balance {
  font-size: 14px;
  margin: 0 0 6px;
}

.purchase-vip-perks {
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 13px;
  color: #555;
}

.purchase-vip-perks li {
  margin: 2px 0;
}

.purchase-history-total {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin: 0 0 10px;
}

.purchase-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.purchase-history-row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.7fr 0.8fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: #f7f8fc;
  border-radius: 6px;
  font-size: 12px;
}

.purchase-status-completed {
  color: #2ecc71;
  font-weight: 600;
}

.purchase-status-pending {
  color: #e6a817;
  font-weight: 600;
}

.error-msg.show,
.success-msg.show {
  animation: errorSlideIn 0.3s ease-out;
}
/* Количество одинаковых декораций: бейдж на карточке инвентаря и строка в магазине */
.item-count-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #2196F3;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
}

.item-owned-count {
  font-size: 10px;
  color: #666;
  min-height: 12px;
}

/* ===== Новинки / Акции / Аукцион ===== */
.shop-category-btn-special {
  border-left: 4px solid #f59e0b;
}

.item-sale-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  z-index: 2;
}

.item-sale-badge.auction-badge { background: #f59e0b; }

.item-sale-timer,
.auction-timer {
  font-size: 10px;
  font-weight: 700;
  color: #c62828;
  text-align: center;
  min-height: 12px;
}

.shop-item-card.expired { opacity: 0.55; }

.auction-rules-hint {
  margin: -8px 0 12px;
  font-size: 12px;
}

.auction-card .item-name {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: #333;
}

.auction-bid {
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  color: #333;
}

.auction-leader {
  font-size: 10px;
  color: #666;
  text-align: center;
  min-height: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auction-leader.me { color: #2e7d32; font-weight: 700; }

.auction-bid-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.auction-bid-input {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  padding: 3px 4px;
  font-size: 11px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.auction-bid-btn { width: 100%; }

.auction-bid.no-bids {
  font-size: 10px;
  font-weight: 600;
  color: #666;
}
