/* ============================================
   PW MARKETPLACE — Imperfect World Theme
   Matching: imperfectworld.com.br/fundador/
   ============================================ */

/* ---- CSS Variables ---- */
:root {
  --font-title: 'Cinzel', serif;
  --font-body: 'Poppins', sans-serif;

  --gold: #ffd700;
  --gold-dark: #b8860b;
  --gold-light: #ffe44d;
  --purple: #8b5cf6;
  --purple-dark: #7c3aed;
  --purple-light: #a78bfa;
  --blue: #2563eb;
  --blue-light: #60a5fa;
  --bg-dark: #0a0612;
  --bg-card: #130d22;
  --bg-card-hover: #1a1230;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(139, 92, 246, 0.15);
  --border-strong: rgba(139, 92, 246, 0.3);
  --glow-purple: rgba(139, 92, 246, 0.4);
  --glow-gold: rgba(255, 215, 0, 0.4);

  --green: #22c55e;
  --red: #ef4444;
  --cyan: #22d3ee;

  /* Legacy compat aliases */
  --market-bg: var(--bg-dark);
  --market-surface: var(--bg-card);
  --market-line: var(--border);
  --market-line-strong: var(--border-strong);
  --market-text: var(--text-primary);
  --market-muted: var(--text-muted);
  --market-gold: var(--gold);
  --market-cyan: var(--cyan);
  --market-violet: var(--purple-light);
  --market-green: var(--green);
  --market-danger: var(--red);
  --slot-size: 66px;
  --slot-radius: 12px;
}

/* ---- Market Listing Grid ---- */
.market-shell .lcard,
.market-listing-card {
  overflow: hidden;
  position: relative;
}

.market-shell .grid,
#listingsGrid.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 22px 18px;
  align-items: start;
}

.market-filter-bar {
  margin-bottom: 16px;
  padding: 18px 20px;
}

.market-filter-main {
  display: flex;
  gap: 16px;
  align-items: end;
}

.market-search-box {
  flex: 1;
}

.market-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.market-search-input-wrap i {
  color: var(--gold);
}

.market-search-input-wrap input {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.market-search-input-wrap input:focus {
  border: none;
  box-shadow: none;
}

.market-toggle {
  min-width: 245px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(34, 197, 94, 0.08);
  cursor: pointer;
}

.market-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  flex: 0 0 auto;
}

.market-toggle span {
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
}

.market-toggle.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(148, 163, 184, 0.06);
}

.market-filter-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  font-size: 0.8rem;
}

.market-filter-hint {
  color: var(--text-muted);
}

.market-filter-stats {
  color: var(--gold);
  font-weight: 700;
}

.market-listing-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 10%, rgba(139, 92, 246, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(139, 92, 246, 0.06), transparent 22%);
  pointer-events: none;
}

.market-listing-card {
  min-height: 340px;
  padding: 0;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.38);
  transition: transform 0.4s, box-shadow 0.4s, border-color 0.4s;
}

.market-listing-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.15);
}

.market-listing-card.is-targeted {
  position: relative;
  border-color: rgba(255, 215, 0, 0.55);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.14), transparent 36%),
    var(--bg-card);
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.18), 0 18px 44px rgba(255, 215, 0, 0.18);
  animation: marketTargetPulse 1.9s ease-in-out 2;
}

.market-listing-card.is-targeted::after {
  content: 'Anuncio compartilhado';
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.92);
  color: #241400;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.22);
}

@keyframes marketTargetPulse {
  0% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.24), 0 12px 24px rgba(0, 0, 0, 0.36);
  }
  50% {
    transform: translateY(-4px);
    box-shadow: 0 0 0 8px rgba(255, 215, 0, 0.06), 0 20px 42px rgba(255, 215, 0, 0.16);
  }
  100% {
    transform: translateY(0);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.18), 0 18px 44px rgba(255, 215, 0, 0.18);
  }
}

.market-listing-card.rarity-common {
  background:
    radial-gradient(circle at 50% 0%, rgba(148, 163, 184, 0.08), transparent 35%),
    var(--bg-card);
}

.market-listing-card.rarity-rare {
  background:
    radial-gradient(circle at 50% 0%, rgba(96, 165, 250, 0.1), transparent 35%),
    var(--bg-card);
  border-color: rgba(96, 165, 250, 0.2);
}

.market-listing-card.rarity-epic {
  background:
    radial-gradient(circle at 50% 0%, rgba(167, 139, 250, 0.12), transparent 35%),
    var(--bg-card);
  border-color: rgba(167, 139, 250, 0.2);
}

.market-listing-card.rarity-legendary {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.1), transparent 35%),
    var(--bg-card);
  border-color: rgba(255, 215, 0, 0.2);
}

.market-card-beams {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 5%, rgba(139, 92, 246, 0.2), transparent 26%);
  mask: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.2) 62%, transparent 100%);
  opacity: 0.5;
}

.market-card-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 340px;
  padding: 134px 18px 16px;
  text-align: center;
}

.market-card-orb {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 2;
  width: 108px;
  height: 108px;
  margin-left: -54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(167, 139, 250, 0.4), rgba(139, 92, 246, 0.3) 56%, rgba(60, 40, 120, 0.5) 100%);
  border: 4px solid rgba(19, 13, 34, 0.96);
  box-shadow:
    0 0 0 3px rgba(139, 92, 246, 0.18),
    0 12px 24px rgba(0, 0, 0, 0.42),
    0 0 20px rgba(139, 92, 246, 0.15);
}

.market-card-orb.rarity-epic,
.market-card-orb.rarity-legendary {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 231, 130, 0.5), rgba(255, 215, 0, 0.3) 56%, rgba(184, 134, 11, 0.5) 100%);
  box-shadow:
    0 0 0 3px rgba(255, 215, 0, 0.18),
    0 12px 24px rgba(0, 0, 0, 0.42),
    0 0 20px rgba(255, 215, 0, 0.15);
}

.market-card-orb .market-item-art {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: none;
  background: transparent;
}

.market-card-orb .market-item-art img {
  padding: 12px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.38));
}

.market-listing-card-top {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.market-item-art,
.inventory-detail-art {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(139, 92, 246, 0.1), transparent 60%),
    var(--bg-card);
  border: 1px solid var(--border);
}

.market-item-art {
  width: 72px;
  height: 72px;
}

.market-item-art img,
.inventory-detail-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 10px;
}

.market-badges,
.item-chip-row,
.role-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.market-card-title {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 1.02rem;
  line-height: 1.15;
  font-family: var(--font-title);
  color: var(--text-primary);
}

.market-badges-centered {
  justify-content: center;
  margin-bottom: 10px;
}

.market-card-divider {
  width: 100%;
  height: 1px;
  margin: 4px 0 10px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.2), transparent);
}

.market-card-description {
  min-height: 50px;
  margin-top: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-secondary);
}

.market-pill,
.item-chip,
.role-chip,
.inventory-usage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.73rem;
}

.market-pill {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.3);
  color: var(--blue-light);
  font-weight: 700;
}

.market-pill-owned {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--green);
}

.market-price-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.market-price-row .lcard-price {
  font-size: 1.35rem;
}

.market-price-row-centered {
  justify-content: center;
  width: 100%;
  margin-top: auto;
  text-align: center;
}

.market-price-block {
  width: 100%;
}

.market-card-price {
  font-size: 1.75rem;
  font-family: var(--font-title);
  color: var(--gold);
  text-shadow: 0 0 18px var(--glow-gold);
}

.market-listing-card.rarity-common .market-card-price,
.market-listing-card.rarity-rare .market-card-price,
.market-listing-card.rarity-epic .market-card-price {
  color: var(--gold);
  text-shadow: 0 0 18px var(--glow-gold);
}

.market-card-seller {
  margin-top: 4px;
  color: var(--text-muted);
}

.market-card-actions {
  margin-top: 14px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.btn-market-buy {
  min-width: 124px;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-dark));
  background-size: 200% auto;
  border: none;
  color: #0f0825;
  font-family: var(--font-title);
  font-weight: 700;
  text-shadow: none;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.btn-market-buy:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.5);
  background-position: right center;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.role-card {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  align-items: center;
  width: 100%;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: linear-gradient(135deg, rgba(19, 13, 34, 0.95), rgba(26, 18, 48, 0.9));
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: transform 0.3s ease, border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.role-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--role-accent, var(--purple)), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.role-card::after {
  content: "";
  position: absolute;
  inset: auto -18% -42% auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--role-accent, rgba(139, 92, 246, 0.3)), transparent 70%);
  opacity: 0.18;
  transition: opacity 0.3s;
}

.role-card:hover,
.role-card.selected {
  transform: translateY(-3px);
  border-color: var(--role-accent, var(--border-strong));
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15), 0 12px 28px rgba(0, 0, 0, 0.5);
}

.role-card:hover::before,
.role-card.selected::before {
  opacity: 1;
}

.role-card:hover::after,
.role-card.selected::after {
  opacity: 0.35;
}

.role-card.selected {
  border-color: var(--role-accent, var(--gold));
  box-shadow: 0 0 0 1px var(--role-accent, var(--border-strong)), 0 0 24px rgba(139, 92, 246, 0.2), 0 12px 32px rgba(0, 0, 0, 0.5);
}

.role-card-portrait {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 6, 18, 0.8);
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.role-card:hover .role-card-portrait,
.role-card.selected .role-card-portrait {
  border-color: var(--role-accent, var(--border-strong));
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.2), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.role-card-portrait img.role-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.role-card:hover .role-card-portrait img.role-art {
  transform: scale(1.08);
}

.role-card-portrait img.role-icon {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(10, 6, 18, 0.92);
  padding: 3px;
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.role-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-title);
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255, 215, 0, 0.15);
  line-height: 1.2;
  margin-bottom: 4px;
}

.role-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.15);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.role-empty,
.inventory-empty-state {
  border-radius: 12px;
  padding: 24px;
  border: 1px dashed rgba(139, 92, 246, 0.25);
  color: var(--text-muted);
  text-align: center;
  background: rgba(19, 13, 34, 0.5);
  font-size: 0.88rem;
}

/* ---- Sell Card Upgraded ---- */
.sell-card-upgraded {
  border: 1px solid rgba(139, 92, 246, 0.12);
  background: linear-gradient(180deg, rgba(19, 13, 34, 0.98), rgba(10, 6, 18, 0.95));
}

.sell-card-upgraded h3 {
  font-size: 1.3rem;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.12);
}

.sell-card-upgraded .form-group > label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--purple-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sell-card-upgraded .form-group > label::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--purple);
  flex-shrink: 0;
}

.sell-card-upgraded .divider {
  margin: 20px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.2), rgba(255, 215, 0, 0.1), transparent);
}

.sell-card-upgraded .hint {
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.1);
  margin-top: 14px;
}

.sell-card-upgraded .form-group > small {
  display: block;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 215, 0, 0.04);
  border-left: 3px solid rgba(255, 215, 0, 0.25);
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.sell-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.sell-fields-grid .form-group {
  margin-bottom: 0;
}

/* ---- Inventory ---- */
.inventory-showcase {
  display: flex;
  justify-content: center;
  margin: 18px 0 22px;
}

.inventory-window {
  position: relative;
  width: min(100%, 388px);
  min-height: 500px;
  padding: 74px 20px 28px;
  background: url('/img/inventario.png') center / 100% 100% no-repeat;
  filter: drop-shadow(0 20px 32px rgba(0, 0, 0, 0.34));
  display: flex;
  flex-direction: column;
}
.inventory-window::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 8%, rgba(139, 92, 246, 0.18), transparent 20%),
    linear-gradient(180deg, rgba(139, 92, 246, 0.04), transparent 16%, rgba(10, 6, 18, 0.18) 58%, rgba(10, 6, 18, 0.4));
  pointer-events: none;
}

.inventory-window-header,
.inventory-window-tabs,
.inventory-window-body,
.inventory-inspector {
  position: relative;
  z-index: 1;
}

.inventory-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -10px 26px 10px 12px;
  padding: 8px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(10, 6, 18, 0.6), rgba(19, 13, 34, 0.4));
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 215, 0, 0.1);
}

.inventory-window-title-group {
  min-width: 0;
  flex: 1;
  text-align: center;
}

.inventory-window-kicker,
.inventory-eyebrow {
  color: var(--gold-light);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 2px;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.inventory-window-title {
  color: var(--gold);
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.6);
}

.inventory-usage {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 6, 18, 0.78);
  border: 1px solid var(--border);
  color: var(--gold);
  font-size: 0.74rem;
}

.inventory-window-tabs {
  display: flex;
  gap: 4px;
  margin: 0 28px 8px 10px;
}

.inventory-window-tab {
  min-width: 70px;
  padding: 4px 10px 5px;
  border-radius: 7px 7px 0 0;
  border: 1px solid var(--border);
  background: rgba(19, 13, 34, 0.9);
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
}

.inventory-window-tab.active {
  color: var(--gold);
  background: rgba(139, 92, 246, 0.15);
}

.inventory-window-body {
  display: block;
  margin: 0 14px;
}

.inventory-grid-shell {
  min-width: 0;
  width: max-content;
  max-height: calc(4 * var(--inventory-cell, 36px) + 3 * var(--inventory-gap, 1px));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--purple) rgba(10, 6, 18, 0.6);
}

.inventory-grid {
  --inventory-gap: 1px;
  --inventory-cell: 36px;
  display: grid;
  grid-template-columns: repeat(8, var(--inventory-cell));
  grid-auto-rows: var(--inventory-cell);
  gap: var(--inventory-gap);
  width: max-content;
}

.inventory-slot {
  position: relative;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: var(--inventory-cell);
  height: var(--inventory-cell);
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(19, 13, 34, 0.88), rgba(10, 6, 18, 0.94));
  box-shadow: inset 0 0 0 1px rgba(10, 6, 18, 0.96), inset 0 1px 0 rgba(139, 92, 246, 0.08);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.inventory-slot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(139, 92, 246, 0.1);
  pointer-events: none;
}

.inventory-slot:hover,
.inventory-slot.selected {
  transform: translateY(-1px);
  filter: brightness(1.12);
}

.inventory-slot.selected {
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.62), 0 0 16px rgba(255, 215, 0, 0.26);
}

.inventory-slot.empty {
  position: relative;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: var(--inventory-cell);
  height: var(--inventory-cell);
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(34, 21, 13, 0.88), rgba(10, 6, 18, 0.94));
  box-shadow: inset 0 0 0 1px rgba(10, 6, 18, 0.96), inset 0 1px 0 rgba(139, 92, 246, 0.08);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.inventory-slot.empty::after {
  border: 1px solid rgba(139, 92, 246, 0.06);
}

.inventory-slot.empty:hover {
  transform: none;
}

.inventory-slot img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
  display: block;
}

.inventory-slot-count,
.inventory-slot-pos {
  position: absolute;
  z-index: 2;
  font-size: 0.58rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.inventory-slot-count { right: 3px; bottom: 3px; color: var(--gold); }
.inventory-slot-pos { left: 3px; top: 3px; color: rgba(167, 139, 250, 0.4); }

.inventory-slot.rarity-common { box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08); }
.inventory-slot.rarity-rare { box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.16); }
.inventory-slot.rarity-epic { box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.16); }
.inventory-slot.rarity-legendary { box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.22); }

.inventory-inspector {
  margin: 14px 12px 0 10px;
  min-height: 142px;
  padding: 12px 14px 0;
  color: var(--text-secondary);
  margin-top: auto;
}

.inventory-inspector-main,
.inventory-inspector-empty {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.inventory-inspector-empty .inventory-detail-art { opacity: 0.5; }
.inventory-inspector-summary { min-width: 0; }
.inventory-inspector .item-chip-row { gap: 6px; }

.inventory-detail-art {
  width: 56px;
  height: 56px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 34%, rgba(139, 92, 246, 0.08), transparent 52%),
    var(--bg-card);
}

.inventory-detail-art img { padding: 6px; }

.inventory-detail-name {
  font-size: 0.98rem;
  font-family: var(--font-title);
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.15;
}

.inventory-detail-description {
  color: var(--text-secondary);
  line-height: 1.45;
  font-size: 0.8rem;
  margin: 12px 0 10px;
  min-height: 44px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inventory-meta-line { color: var(--text-muted); font-size: 0.7rem; margin-bottom: 8px; }
.inventory-tooltip-chip-row { margin-top: 8px; }

/* Trade restriction chips */
.item-chip-bound {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.item-chip-tradeable {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #4ade80;
}
.inventory-bound-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0;
  color: #f87171;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inventory-slot.slot-bound {
  border-color: rgba(239, 68, 68, 0.5) !important;
  opacity: 0.6;
}
.inventory-slot.slot-bound::after {
  content: '\f023';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  inset: auto;
  border: none;
  top: 2px;
  right: 3px;
  font-size: 0.5rem;
  color: #f87171;
}

.hover-item-tooltip {
  position: fixed;
  z-index: 1400;
  width: min(380px, calc(100vw - 24px));
  padding: 0;
  border-radius: 4px;
  border: 1px solid #5a4a2a;
  background: linear-gradient(180deg, #1a1206 0%, #0e0b04 100%);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.85), 0 0 4px rgba(200, 165, 80, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.1s ease, transform 0.1s ease;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 0.82rem;
  color: #d4cbb8;
  line-height: 1.45;
}

.hover-item-tooltip.visible { opacity: 1; transform: translateY(0); }

/* PW Tooltip internal styles */
.pw-tooltip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(200, 165, 80, 0.15);
}

.pw-tooltip-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(0,0,0,0.4);
  border: 1px solid #5a4a2a;
}

.pw-tooltip-icon img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 2px; image-rendering: pixelated; }

.pw-tooltip-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f0e6cc;
  line-height: 1.3;
}

.pw-tooltip-type {
  padding: 3px 12px;
  color: #a09880;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pw-tooltip-count {
  padding: 2px 12px 4px;
  color: #c8b080;
  font-size: 0.78rem;
}

.pw-tooltip-divider {
  height: 1px;
  margin: 0 12px;
  background: linear-gradient(90deg, transparent, rgba(200, 165, 80, 0.3), transparent);
}

.pw-tooltip-desc {
  padding: 8px 12px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #d4cbb8;
  max-height: 260px;
  overflow-y: auto;
}

.pw-tooltip-stats {
  padding: 8px 12px 4px;
}

.pw-tooltip-loading {
  padding: 8px 12px 2px;
  color: #c8b080;
  font-size: 0.76rem;
  font-style: italic;
}

.pw-tooltip-desc span { display: inline; }

.pw-tooltip-footer {
  padding: 4px 12px 6px;
  font-size: 0.65rem;
  color: #6a6050;
  text-align: right;
  border-top: 1px solid rgba(200, 165, 80, 0.1);
}

/* PW-style stat rows for inspector */
.inventory-tooltip-stats-block { margin-top: 8px; }

.pw-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid rgba(200, 165, 80, 0.08);
}

.pw-stat-label {
  color: #a09880;
  font-size: 0.8rem;
}

.pw-stat-value {
  color: #f0e6cc;
  font-size: 0.8rem;
  font-weight: 600;
}

.pw-stat-value.pw-refine { color: #ffdc50; font-size: 0.9rem; }
.pw-stat-value.pw-creator { color: #8080ff; font-style: italic; }
.pw-stat-value.pw-req { font-size: 0.72rem; color: #c8a060; }
.pw-stat-value.pw-addons { font-size: 0.72rem; color: #80d080; }
.pw-stat-value.pw-class { font-size: 0.72rem; color: #c8c0ff; }

.pw-addons-block {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.pw-addon-line {
  font-size: 0.75rem;
  color: #80d080;
  padding: 1px 0;
  line-height: 1.3;
}
.pw-addon-line.pw-addon-socket { color: #60c0e0; }
.pw-addon-line.pw-addon-special { color: #ffdc50; }

.pw-gems-row {
  display: flex;
  gap: 6px;
  padding: 6px 0 4px;
  flex-wrap: wrap;
}

.pw-gem-slot {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  border: 1px solid #5a4a2a;
  overflow: hidden;
  background: rgba(0,0,0,0.3);
}

.pw-gem-slot.pw-gem-filled { border-color: #c8a550; }

.pw-gem-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  image-rendering: pixelated;
}

.pw-gem-slot.pw-gem-empty {
  background: repeating-linear-gradient(45deg, rgba(40,30,10,0.4), rgba(40,30,10,0.4) 3px, rgba(60,50,20,0.3) 3px, rgba(60,50,20,0.3) 6px);
}

/* PW description block shared by inspector and marketplace cards */
.pw-desc-block {
  font-size: 0.82rem;
  line-height: 1.55;
  color: #d4cbb8;
}

.pw-desc-block span { display: inline; }

.inventory-detail-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 220px;
  margin: 0 auto 16px;
}

.inventory-detail-name { font-size: 1.25rem; color: var(--text-primary); margin-bottom: 8px; }

.inventory-detail-description {
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 0.9rem;
  margin: 12px 0 14px;
}

.rarity-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid currentColor;
  opacity: 0.85;
}

.rarity-common .rarity-tag, .rarity-tag.rarity-common { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }
.rarity-rare .rarity-tag, .rarity-tag.rarity-rare { background: rgba(96, 165, 250, 0.14); color: #60a5fa; }
.rarity-epic .rarity-tag, .rarity-tag.rarity-epic { background: rgba(167, 139, 250, 0.14); color: #a78bfa; }
.rarity-legendary .rarity-tag, .rarity-tag.rarity-legendary { background: rgba(255, 215, 0, 0.16); color: #ffd700; }

.sell-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.buy-role-panel { margin-top: 12px; }
#buyModalDesc { color: var(--text-muted); line-height: 1.5; }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .inventory-showcase { justify-content: center; }
}

@media (max-width: 700px) {
  .container { padding: 18px 14px 28px; }
  .market-filter-main,
  .market-filter-meta { flex-direction: column; align-items: stretch; }
  .market-toggle { min-width: 0; }
  .market-search-input-wrap { flex-wrap: wrap; }
  .role-grid { grid-template-columns: 1fr; }
  .sell-fields-grid { grid-template-columns: 1fr; }
  .inventory-window { width: min(100%, 372px); padding: 68px 14px 22px; }
  .inventory-window-header { margin: 0 20px 10px 8px; }
  .inventory-window-tabs { margin: 0 20px 8px 7px; gap: 3px; }
  .inventory-window-tab { min-width: 0; flex: 1; padding-left: 6px; padding-right: 6px; font-size: 0.66rem; }
  .inventory-window-body { grid-template-columns: minmax(0, 1fr) 20px; gap: 8px; margin: 0 8px; }
  .inventory-grid { --inventory-cell: 33px; }
  .inventory-slot img { padding: 4px; }
  .inventory-inspector { margin: 12px 8px 0; padding: 8px 8px 0; }
  .inventory-inspector-main, .inventory-inspector-empty { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; }
  .inventory-detail-art { width: 48px; height: 48px; }
  .market-listing-card-top { grid-template-columns: 60px 1fr; }
  .market-item-art { width: 60px; height: 60px; }
}