#shop-v2-overlay {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 18, 0.72);
  backdrop-filter: blur(10px);
}

.shop-v2 {
  width: min(1240px, calc(100vw - 28px));
  height: min(820px, calc(100vh - 28px));
  display: grid;
  grid-template-rows: 68px 54px minmax(0, 1fr);
  grid-template-columns: 218px minmax(0, 1fr) 0;
  overflow: hidden;
  color: #eef4ff;
  background: #111820;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.48);
  transition: grid-template-columns 0.24s ease;
  --shop-accent: #8aa4ff;
  --shop-accent-strong: #6d84e8;
  --shop-accent-soft: rgba(138, 164, 255, 0.14);
  --shop-accent-border: rgba(138, 164, 255, 0.36);
}

.shop-v2:has(.shop-v2-drawer.open) {
  grid-template-columns: 218px minmax(0, 1fr) 330px;
}

.shop-v2-top {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(90deg, #121824, #182033 54%, #121a2c);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.shop-v2-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.shop-v2-brand i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #06121f;
  background: linear-gradient(135deg, #aab8ff, #7d8ee8);
  border-radius: 8px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.shop-v2-brand h2,
.shop-v2-brand p {
  margin: 0;
}

.shop-v2-brand h2 {
  font-size: 19px;
  line-height: 1.1;
}

.shop-v2-brand p {
  color: #a7b4c6;
  font-size: 12px;
}

.shop-v2-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  min-width: 0;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.shop-v2-search input {
  width: 100%;
  min-width: 0;
  color: #fff;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
}

.shop-v2-search input::placeholder {
  color: #8e9caf;
}

.shop-v2-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.shop-v2-balance {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  color: #06121f;
  font-weight: 800;
  background: linear-gradient(135deg, #aab8ff, #7d8ee8);
  border-radius: 8px;
}

.shop-v2-close,
.shop-v2-icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #eef4ff;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
}

.shop-v2-tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 9px 14px;
  background: #0d131c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
}

.shop-v2-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  color: #aeb9ca;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
}

.shop-v2-tabs button i {
  color: #7f8da3;
  font-size: 13px;
}

.shop-v2-tabs button:hover {
  color: #edf2ff;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

.shop-v2-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(138, 164, 255, 0.28), rgba(138, 164, 255, 0.13));
  border-color: var(--shop-accent-border);
  box-shadow: inset 0 -2px 0 var(--shop-accent);
}

.shop-v2-tabs button.active i {
  color: var(--shop-accent);
}

.shop-v2-side {
  min-width: 0;
  overflow: auto;
  padding: 14px 12px;
  background: #101722;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-v2-side.hidden {
  display: none;
}

.shop-v2-side h3,
.shop-v2-section-title h3 {
  margin: 0;
  font-size: 13px;
  color: #dce7f5;
}

.shop-v2-side h3 {
  margin-bottom: 10px;
}

.shop-v2-categories {
  display: grid;
  gap: 4px;
}

.shop-v2-categories button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 10px 0 13px;
  color: #aeb9ca;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.shop-v2-categories button::before {
  content: "";
  width: 3px;
  height: 16px;
  margin-right: 9px;
  background: transparent;
  border-radius: 999px;
}

.shop-v2-categories button:hover {
  color: #edf2ff;
  background: rgba(255, 255, 255, 0.045);
}

.shop-v2-categories button.active {
  color: #ffffff;
  background: var(--shop-accent-soft);
  border-color: rgba(138, 164, 255, 0.18);
}

.shop-v2-categories button.active::before {
  background: var(--shop-accent);
}

.shop-v2-category-group {
  display: grid;
  gap: 2px;
}

.shop-v2-category-parent span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-v2-category-children {
  display: grid;
  gap: 2px;
  margin: 0 0 4px 18px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-v2-categories .shop-v2-category-child {
  min-height: 30px;
  padding-left: 10px;
  font-size: 12px;
  color: #94a3b8;
}

.shop-v2-categories .shop-v2-category-child::before {
  width: 2px;
  height: 12px;
  margin-right: 8px;
}

.shop-v2-category-group.open .shop-v2-category-parent {
  color: #edf2ff;
}

.shop-v2-main {
  min-width: 0;
  overflow: auto;
  padding: 14px;
  background: #0f151d;
}

.shop-v2-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

.shop-v2-section-title span {
  color: #7f90a5;
  font-size: 12px;
}

.shop-v2-featured,
.shop-v2-grid {
  display: grid;
  gap: 10px;
}

.shop-v2-featured {
  grid-template-columns: repeat(4, minmax(142px, 1fr));
  margin-bottom: 16px;
}

.shop-v2-grid {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

.shop-v2-item {
  min-width: 0;
  min-height: 158px;
  display: grid;
  grid-template-rows: 88px minmax(0, 1fr) 28px;
  gap: 7px;
  padding: 8px;
  background: #18222d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.shop-v2-item:hover,
.shop-v2-item.selected {
  transform: translateY(-2px);
  background: #1d2a36;
  border-color: var(--shop-accent-border);
}

.shop-v2-item.featured {
  grid-template-rows: 94px minmax(0, 1fr) 28px;
}

.shop-v2-item-media {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #203149, #14243a);
  border-radius: 8px;
}

.shop-v2-item-media img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: auto;
}

.shop-v2-item-body {
  min-width: 0;
}

.shop-v2-item-body strong {
  display: block;
  color: #f4f7fb;
  font-size: 12px;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.shop-v2-item footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.shop-v2-item footer b {
  color: var(--shop-accent);
  font-size: 12px;
}

.shop-v2-item footer b.locked {
  color: #ff7d7d;
}

.shop-v2-drawer {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #141d27;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0;
  pointer-events: none;
}

.shop-v2-drawer.open {
  opacity: 1;
  pointer-events: auto;
}

.shop-v2-drawer-head {
  display: flex;
  justify-content: flex-end;
  padding: 12px;
}

.shop-v2-preview {
  margin: 0 14px 12px;
  display: grid;
  place-items: center;
  min-height: 160px;
  background: linear-gradient(135deg, #27394a, #1d2b22);
  border-radius: 8px;
}

.shop-v2-preview img {
  width: 116px;
  height: 116px;
  object-fit: contain;
}

.shop-v2-detail {
  min-height: 0;
  overflow: auto;
  padding: 0 16px 14px;
}

.shop-v2-detail h3 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.15;
}

.shop-v2-meta,
.shop-v2-owned,
.shop-v2-desc {
  color: #a9b6c7;
  font-size: 13px;
}

.shop-v2-desc {
  line-height: 1.45;
  margin: 14px 0;
}

.shop-v2-pricebox {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.shop-v2-pricebox span {
  display: block;
  color: #8493a7;
  font-size: 11px;
}

.shop-v2-pricebox strong {
  display: block;
  margin-top: 3px;
  color: var(--shop-accent);
  font-size: 16px;
}

.shop-v2-qty {
  display: grid;
  grid-template-columns: 38px minmax(48px, 1fr) 38px;
  gap: 8px;
  margin-bottom: 10px;
}

.shop-v2-qty button,
.shop-v2-quick button,
.shop-v2-buy,
.shop-v2-secondary {
  min-height: 38px;
  color: #fff;
  background: #223140;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
}

.shop-v2-qty input {
  min-width: 0;
  color: #fff;
  text-align: center;
  background: #101820;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.shop-v2-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.shop-v2-buy {
  width: 100%;
  min-height: 46px;
  margin-bottom: 8px;
  color: #06121f;
  background: linear-gradient(135deg, #aab8ff, #7d8ee8);
  font-weight: 900;
}

.shop-v2-buy.locked,
.shop-v2-buy:disabled {
  color: #f8d5d5;
  background: #63313a;
  cursor: not-allowed;
}

.shop-v2-buy.busy {
  opacity: 0.68;
}

.shop-v2-secondary {
  width: 100%;
}

.shop-v2-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shop-v2-empty {
  margin-top: 18px;
  padding: 22px;
  color: #9dacbf;
  text-align: center;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 8px;
}

.shop-v2-empty.hidden {
  display: none;
}

.shop-v2-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 18px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  color: #10151a;
  background: #aab8ff;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-weight: 800;
}

.shop-v2-toast.error {
  color: #fff;
  background: #c44d58;
}

.shop-v2-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.shop-v2-skeleton {
  min-height: 190px;
  background: linear-gradient(90deg, #17212b, #223140, #17212b);
  background-size: 220% 100%;
  border-radius: 8px;
  animation: shopV2Pulse 1.1s linear infinite;
}

.shop-v2-skeleton.wide {
  min-height: 190px;
}

@keyframes shopV2Pulse {
  to {
    background-position: -220% 0;
  }
}

@media (max-width: 860px) {
  .shop-v2,
  .shop-v2:has(.shop-v2-drawer.open) {
    width: 100vw;
    height: 100vh;
    grid-template-rows: auto auto 1fr;
    grid-template-columns: 1fr;
    border-radius: 0;
  }

  .shop-v2-top {
    grid-template-columns: 1fr auto;
  }

  .shop-v2-search {
    grid-column: 1 / -1;
    order: 3;
  }

  .shop-v2-side {
    display: none;
  }

  .shop-v2-main {
    grid-column: 1;
  }

  .shop-v2-featured {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .shop-v2-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }

  .shop-v2-drawer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 72vh;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.45);
  }
}
