/* ────────────────────────────────────────────────────────────────
   P2P MARKET STYLES
   Стили для модального окна «Рынок»: вкладки, фильтры, сетки лотов,
   карточки персонажей, модалка ввода цены продажи.
   ──────────────────────────────────────────────────────────────── */

/* ====== Контейнер контента (как в инвентаре/кошельке) ====== */
#market-modal .market-modal-content {
  display: flex;
  flex-direction: column;
  height: 95vh;
  max-height: 95vh;
  padding: 0 22px 22px;
  padding-top: 20%;
  color: #f4e9c1;
  font-family: 'Cinzel', Georgia, serif;
  overflow: hidden;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#market-modal .market-modal-content::-webkit-scrollbar {
  display: none;
}

/* ====== Вкладки рынка ====== */
.market-tabs {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 6px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.market-tab {
  flex: 1 1 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #d2b48c;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-tab:hover {
  color: #ffd700;
}

.market-tab.active {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.5), rgba(218, 165, 32, 0.35));
  border-color: rgba(255, 215, 0, 0.7);
  color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25), inset 0 0 8px rgba(255, 215, 0, 0.15);
}

/* ====== Инфо-полоса ====== */
.market-info-bar {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 10px;
  font-size: 0.8rem;
  color: #e8d9a0;
}

.market-info-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.market-info-item img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.market-info-label {
  color: #b8a878;
}

.market-info-item b,
.market-info-item span {
  color: #ffd700;
  font-weight: 700;
}

/* ====== Содержимое вкладок ====== */
.market-tab-content {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.market-tab-content.active {
  display: flex;
}

/* ====== Фильтры ====== */
.market-filters {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.market-filter-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  color: #ffd700;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffd700' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}

.market-filter-select option {
  background: #1a1a2e;
  color: #ffd700;
}

.market-sort-group {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.market-sort-group::-webkit-scrollbar {
  display: none;
}

.market-sort-btn {
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #d2b48c;
  transition: all 0.15s ease;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-sort-btn:hover {
  border-color: rgba(255, 215, 0, 0.6);
  color: #ffd700;
}

.market-sort-btn.active {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.5), rgba(218, 165, 32, 0.35));
  border-color: rgba(255, 215, 0, 0.7);
  color: #ffd700;
}

/* ====== Сетки лотов ====== */
.market-lots-grid,
.market-sell-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(400px, auto);
  gap: 10px;
  align-content: start;
  padding: 4px 2px 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.market-lots-grid::-webkit-scrollbar,
.market-sell-grid::-webkit-scrollbar {
  display: none;
}

/* ====== Карточка лота ====== */
.market-lot-card,
.market-sell-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(40, 40, 60, 0.95));
  border: 2px solid rgba(139, 69, 19, 0.6);
  border-radius: 12px;
  padding: 8px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.market-lot-card:hover,
.market-sell-card:not(.locked):hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

/* Редкость через border-color задаётся инлайн из getRarityColor().
   Доп. свечение для Legendary. */
.market-lot-card.rarity-Legendary,
.market-sell-card.rarity-Legendary {
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.18) inset;
}

/* ── Hero-структура (как в инвентаре) ──
   Переопределяем .inventory-hero-card-стили под 2-колоночную сетку рынка. */
.market-lot-card .hero-card-image,
.market-sell-card .hero-card-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, rgba(0,0,0,0.3), rgba(0,0,0,0.6));
  border-radius: 8px;
}

.market-lot-card .hero-card-image img,
.market-sell-card .hero-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.market-lot-card:hover .hero-card-image img,
.market-sell-card:not(.locked):hover .hero-card-image img {
  transform: scale(1.05);
}

.market-lot-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: #ffd700;
  opacity: 0.5;
}

.market-lot-card .hero-card-body,
.market-sell-card .hero-card-body {
  padding: 10px 4px 4px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.market-lot-card .hero-card-name,
.market-sell-card .hero-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-lot-card .hero-card-role,
.market-sell-card .hero-card-role {
  font-size: 0.72rem;
  color: #aaa;
  text-align: center;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: -2px;
}

.market-lot-card .hero-card-passive,
.market-sell-card .hero-card-passive {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
}

  .market-lot-card .hero-card-passive .passive-name,
  .market-sell-card .hero-card-passive .passive-name {
    color: #ccc;
    font-size: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .market-lot-card .hero-card-passive .passive-bonus,
  .market-sell-card .hero-card-passive .passive-bonus {
    font-weight: 700;
    color: #FFD700;
    font-size: inherit;
    flex-shrink: 0;
    margin-left: 6px;
  }

.market-lot-card .hero-card-stats,
.market-sell-card .hero-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-top: 2px;
}

.market-lot-card .hero-card-stats .hero-stat,
.market-sell-card .hero-card-stats .hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 2px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.market-lot-card .hero-card-stats .hero-stat span:first-child,
.market-sell-card .hero-card-stats .hero-stat span:first-child {
  font-size: 0.58rem;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 1px;
}

.market-lot-card .hero-card-stats .hero-stat span:last-child,
.market-sell-card .hero-card-stats .hero-stat span:last-child {
  font-weight: 700;
  font-size: 0.78rem;
  color: #fff;
}

.market-lot-card .hero-card-power,
.market-sell-card .hero-card-power {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 5px;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
  border-radius: 6px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  margin-top: 2px;
}

.market-lot-card .hero-card-power span,
.market-sell-card .hero-card-power span {
  font-size: 0.7rem;
  color: #ccc;
}

.market-lot-card .hero-card-power strong,
.market-sell-card .hero-card-power strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: #FFD700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.market-lot-seller {
  font-size: 0.68rem;
  color: #b8a878;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 0;
}

.market-lot-bottom {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.market-lot-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.market-lot-price img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.market-lot-buy-btn,
.market-lot-cancel-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.45), rgba(218, 165, 32, 0.4));
  border: 1px solid rgba(255, 215, 0, 0.6);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-lot-buy-btn:hover,
.market-lot-cancel-btn:hover {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.65), rgba(218, 165, 32, 0.6));
  border-color: rgba(255, 215, 0, 0.9);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
  transform: scale(1.03);
}

.market-lot-buy-btn:active,
.market-lot-cancel-btn:active {
  transform: scale(0.96);
}

.market-lot-buy-btn:disabled {
  background: linear-gradient(135deg, rgba(80, 80, 80, 0.4), rgba(100, 100, 100, 0.4));
  border-color: rgba(150, 150, 150, 0.4);
  color: #888;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  text-shadow: none;
}

.market-lot-cancel-btn {
  background: linear-gradient(135deg, rgba(120, 30, 30, 0.4), rgba(150, 50, 50, 0.35));
  border-color: rgba(255, 107, 107, 0.5);
  color: #ff8585;
}

.market-lot-cancel-btn:hover {
  background: linear-gradient(135deg, rgba(150, 40, 40, 0.6), rgba(180, 60, 60, 0.5));
  border-color: rgba(255, 107, 107, 0.85);
  box-shadow: 0 0 12px rgba(255, 80, 80, 0.3);
}

/* Бейдж "Ожидает" для лотов в моих лотах (visibleAt ещё не наступил) */
.market-lot-pending {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffd700;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 8px;
  border: 1px solid rgba(255, 215, 0, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ====== Карточка персонажа во вкладке «Продать» ======
   Базовые стили .market-sell-card объединены с .market-lot-card выше.
   Здесь — только специфичное для sell: состояние locked (Trade Lock). */
.market-sell-card.locked {
  opacity: 0.7;
  filter: grayscale(0.4);
}

.market-sell-cooldown {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.62);
  border-radius: 10px;
  text-align: center;
  z-index: 2;
}

.market-sell-cooldown-icon {
  font-size: 1.8rem;
  color: #ff8585;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}

.market-sell-cooldown-text {
  font-size: 0.74rem;
  color: #ffb0b0;
  line-height: 1.3;
  font-family: 'Cinzel', serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.market-sell-cooldown-timer {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffd700;
  font-family: 'Cinzel', serif;
}

.market-sell-btn {
  margin-top: auto;
  width: 100%;
  background: linear-gradient(135deg, rgba(11, 90, 184, 0.4), rgba(32, 130, 218, 0.35));
  border: 1px solid rgba(0, 191, 255, 0.6);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #7fd4ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-sell-btn:hover {
  background: linear-gradient(135deg, rgba(11, 90, 184, 0.6), rgba(32, 130, 218, 0.55));
  border-color: rgba(0, 191, 255, 0.9);
  transform: scale(1.03);
}

.market-sell-btn:active {
  transform: scale(0.96);
}

.market-sell-hint {
  flex-shrink: 0;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 8px;
  font-size: 0.75rem;
  color: #d8c89a;
  text-align: center;
  line-height: 1.4;
}

.market-sell-hint b {
  color: #ffd700;
}

/* ====== Пагинация ====== */
.market-pagination {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 10px 0 2px;
  min-height: 44px;
}

.market-pagination:empty {
  display: none;
}

.market-page-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffd700;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-page-btn:hover:not(:disabled) {
  border-color: rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}

.market-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.market-page-info {
  font-size: 0.75rem;
  color: #d2b48c;
  white-space: nowrap;
}

/* ====== Состояния загрузки / пусто / ошибка ====== */
.market-loading,
.market-empty,
.market-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #c0c0c0;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
}

.market-error {
  color: #ff6b6b;
}

/* ====== Модалка ввода цены ====== */
.market-price-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.market-price-overlay.active {
  display: flex;
  animation: marketFadeIn 0.2s ease;
}

.market-price-box {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: linear-gradient(135deg, rgba(45, 33, 12, 0.98), rgba(65, 48, 16, 0.98));
  border: 2px solid rgba(255, 215, 0, 0.6);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 24px rgba(255, 215, 0, 0.25);
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: marketPopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.market-price-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: #ffd700;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  transition: transform 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-price-close:hover {
  color: #ff8585;
  transform: scale(1.15);
}

.market-price-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  text-align: center;
  margin-bottom: 2px;
}

.market-price-character {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  min-height: 60px;
}

.market-price-character img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
}

.market-price-character-name {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.market-price-character-rarity {
  font-size: 0.7rem;
  color: #d2b48c;
  text-transform: uppercase;
}

.market-price-label {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: #e8d9a0;
  display: block;
}

.market-price-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  padding: 10px 12px;
  color: #ffd700;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.market-price-input:focus {
  border-color: rgba(255, 215, 0, 0.9);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}

.market-price-warning {
  font-size: 0.72rem;
  color: #ffb0b0;
  line-height: 1.4;
  background: rgba(120, 30, 30, 0.25);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
}

.market-price-warning b {
  color: #ffd700;
}

.market-price-submit {
  width: 100%;
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.5), rgba(218, 165, 32, 0.45));
  border: 1px solid rgba(255, 215, 0, 0.7);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-price-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.7), rgba(218, 165, 32, 0.65));
  border-color: rgba(255, 215, 0, 1);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

.market-price-submit:active:not(:disabled) {
  transform: scale(0.97);
}

.market-price-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes marketFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes marketPopIn {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ====== Кастомный toast рынка ====== */
.market-toast {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(45, 33, 12, 0.97), rgba(65, 48, 16, 0.97));
  border: 2px solid rgba(255, 215, 0, 0.65);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 22px rgba(255, 215, 0, 0.3);
  z-index: 70;
  cursor: pointer;
  opacity: 0;
  animation: marketToastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  -webkit-tap-highlight-color: transparent;
}

.market-toast.hiding {
  animation: marketToastOut 0.35s ease forwards;
}

.market-toast--error {
  background: linear-gradient(135deg, rgba(50, 12, 12, 0.97), rgba(70, 18, 18, 0.97));
  border-color: rgba(255, 107, 107, 0.65);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 22px rgba(255, 80, 80, 0.3);
}

.market-toast-status {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.28), rgba(255, 215, 0, 0.05));
  border: 1.5px solid rgba(255, 215, 0, 0.7);
  color: #ffd700;
}

.market-toast--error .market-toast-status {
  background: radial-gradient(circle, rgba(255, 107, 107, 0.28), rgba(255, 107, 107, 0.05));
  border-color: rgba(255, 107, 107, 0.7);
  color: #ff8585;
}

.market-toast-status svg {
  width: 20px;
  height: 20px;
}

.market-toast-content {
  min-width: 0;
  flex: 1;
}

.market-toast-title {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.3px;
}

.market-toast--error .market-toast-title {
  color: #ff8585;
}

.market-toast-message {
  font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  color: #e8e8e8;
  line-height: 1.3;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  margin-top: 2px;
  word-wrap: break-word;
}

@keyframes marketToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-24px) scale(0.92); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes marketToastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  to   { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(0.96); }
}

/* ====== Адаптивность ====== */
@media (max-width: 768px) {
  #market-modal .market-modal-content {
    padding: 0 16px 18px;
    padding-top: 18%;
  }

  .market-tab {
    font-size: 0.78rem;
    padding: 7px 8px;
  }

  .market-info-bar {
    gap: 10px;
    font-size: 0.72rem;
    padding: 6px 10px;
  }

  .market-lot-card .hero-card-name,
  .market-sell-card .hero-card-name {
    font-size: 0.82rem;
  }

  .market-lot-card .hero-card-stats .hero-stat span:last-child,
  .market-sell-card .hero-card-stats .hero-stat span:last-child {
    font-size: 0.72rem;
  }
}

@media (max-width: 480px) {
  #market-modal .market-modal-content {
    padding: 0 10px 14px;
    padding-top: 16%;
    height: 96vh;
    max-height: 96vh;
  }

  .market-tabs {
    gap: 4px;
    padding: 5px;
  }

  .market-tab {
    font-size: 0.72rem;
    padding: 7px 6px;
  }

  .market-lots-grid,
  .market-sell-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(400px, auto); 
    gap: 8px;
  }

  .market-lot-card,
  .market-sell-card {
    padding: 6px;
  }

  .market-lot-card .hero-card-body,
  .market-sell-card .hero-card-body {
    padding: 8px 2px 2px;
    gap: 4px;
  }

  .market-lot-card .hero-card-name,
  .market-sell-card .hero-card-name {
    font-size: 0.78rem;
  }

  .market-lot-card .hero-card-role,
  .market-sell-card .hero-card-role {
    font-size: 0.66rem;
  }

  .market-lot-card .hero-card-passive,
  .market-sell-card .hero-card-passive {
    font-size: 0.66rem;
    padding: 4px 6px;
  }

  .market-lot-card .hero-card-stats .hero-stat span:first-child,
  .market-sell-card .hero-card-stats .hero-stat span:first-child {
    font-size: 0.52rem;
  }

  .market-lot-card .hero-card-stats .hero-stat span:last-child,
  .market-sell-card .hero-card-stats .hero-stat span:last-child {
    font-size: 0.7rem;
  }

  .market-lot-card .hero-card-power strong,
  .market-sell-card .hero-card-power strong {
    font-size: 0.82rem;
  }

  .market-lot-price {
    font-size: 0.88rem;
  }

  .market-lot-buy-btn,
  .market-lot-cancel-btn,
  .market-sell-btn {
    font-size: 0.72rem;
    padding: 6px 8px;
  }

  .market-sort-btn {
    font-size: 0.7rem;
    padding: 5px 8px;
  }

  .market-info-bar {
    gap: 8px;
    font-size: 0.68rem;
    padding: 5px 8px;
  }

  .market-toast {
    top: 52px;
    padding: 10px 14px;
    gap: 10px;
    min-width: 210px;
  }

  .market-toast-status { width: 30px; height: 30px; }
  .market-toast-status svg { width: 18px; height: 18px; }
  .market-toast-title { font-size: 0.76rem; }
  .market-toast-message { font-size: 0.72rem; }
}
