.shop-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #141415;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  padding: var(--pages-frame-pad-top-shop, clamp(16px, 5vw, 70px))
    var(--pages-frame-pad-x, clamp(10px, 2.5vw, 44px))
    var(--pages-frame-pad-bottom-shop, clamp(14px, 3vw, 50px));
}

.shop-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #EDEDED;
  white-space: nowrap;
}

/* ── Content area ── */
.shop-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 12px 8px;
  overflow-y: auto;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

.shop-tabs-wrap {
  flex-shrink: 0;
  margin-bottom: 3px;
}

.shop-tabs {
  display: flex;
  gap: 3px;
  overflow-x: hidden;
  padding-bottom: 2px;
}

.shop-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border: none;
  background: url("/shop/shop-tabs.png") center / 100% 100% no-repeat;
  color: #EDEDED;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
  transition: filter 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.shop-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.shop-tab-icon img {
  object-fit: contain;
}

.shop-tab-icon--avatar img {
  width: 32px;
  height: 32px;
}

.shop-tab-icon--frame img {
  width: 34px;
  height: 34px;
}

.shop-tab-icon--grave img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.shop-tab-icon--emoji img {
  width: 32px;
  height: 32px;
}

.shop-tab-icon--gem img {
  width: 30px;
  height: 30px;
}

.shop-tab-label {
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.shop-tab:not(.active) {
  filter: grayscale(1);
}

.shop-tab:hover:not(.active) {
  filter: grayscale(1) brightness(1.06);
}

.shop-tab.active {
  border: none;
  background: url("/shop/shop-tabs.png") center / 100% 100% no-repeat;
  color: #f0c15a;
  filter: none;
}

.shop-subtabs {
  display: flex;
  gap: 8px;
  flex: 1;
}

.shop-avatar-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
  flex-shrink: 0;
  padding: 6px;
}

.shop-avatar-filters[hidden] {
  display: none !important;
}

.shop-emoji-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
  padding: 12px;
}

.shop-emoji-filters[hidden] {
  display: none !important;
}

.shop-gif-preview,
.shop-sticker-preview {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.shop-gif-preview img,
.shop-sticker-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.shop-category-filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shop-category-label {
  font-size: 12px;
  font-weight: 700;
  color: #ececec;
  white-space: nowrap;
}

.shop-category-select {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: none;
  background: url("/shop/shop-gender.png") center / 100% 100% no-repeat;
  color: #EDEDED;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  max-width: 40%;
}

.shop-category-select:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.shop-category-select option {
  background: #1C1C1E;
  color: #EDEDED;
}

.shop-subtab {
  flex: 1;
  padding: 12px 12px;
  border: none;
  background: url("/shop/shop-gender.png") center / 100% 100% no-repeat;
  background-size: cover;
  color: #EDEDED;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

#avatarSubtabs .shop-subtab {
  border: none;
  box-shadow: none;
  background: url("/shop/shop-gender.png") center / 100% 100% no-repeat;
  transition: filter 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

#avatarSubtabs .shop-subtab:hover:not(.active) {
  filter: brightness(1.06);
  border: none;
  box-shadow: none;
  background: url("/shop/shop-gender.png") center / 100% 100% no-repeat;
}

#avatarSubtabs .shop-subtab.active {
  border: none;
  color: #f0c15a;
  background: url("/shop/shop-gender.png") center / 100% 100% no-repeat;
}

.shop-subtab:hover:not(.active) {
  background: linear-gradient(180deg, #333335 0%, #232325 100%);
  border-color: #444;
}

.shop-subtab.active {
  color: #eace1e;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 8px;
}

.shop-catalog {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shop-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 4px 2px 10px;
  font-family: 'Iranian Sans', Tahoma, serif;
  font-size: 13px;
  color: #f0e6d8;
}

.shop-pagination[hidden] {
  display: none !important;
}

.shop-pagination button:not(.shop-page-nav-btn) {
  min-width: 72px;
  padding: 8px 14px;
  border: 1px solid #2B2B2D;
  background: #1C1C1E;
  color: #e0474b;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
}

.shop-pagination .shop-page-nav-btn {
  min-width: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  font-size: 0;
  line-height: 0;
  color: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.shop-pagination .shop-page-nav-btn--prev {
  background: url("/shop/shop-previous.png") center / contain no-repeat;
}

.shop-pagination .shop-page-nav-btn--next {
  background: url("/shop/shop-next.png") center / contain no-repeat;
}

.shop-pagination .shop-page-nav-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.shop-pagination .shop-page-nav-btn:disabled {
  filter: grayscale(100%) opacity(0.45);
  cursor: not-allowed;
}

.shop-pagination button:not(.shop-page-nav-btn):hover:not(:disabled) {
  background: #232325;
}

.shop-pagination button:not(.shop-page-nav-btn):disabled {
  filter: grayscale(100%);
  opacity: 0.45;
  cursor: not-allowed;
}

#shopPageLabel {
  flex: 1;
  text-align: center;
  font-weight: 600;
}

.shop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px;
  border: none;
  background: url(/shop/shop-items.png) !important;
  background-size: cover !important;
  cursor: pointer;
  text-align: center;
  color: #EDEDED;
  font-family: inherit;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.shop-card:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #B80E13;
  background: #232325;
}

.shop-card:disabled {
  opacity: 0.72;
  cursor: default;
}

.shop-card.is-iap-ready {
  opacity: 1;
  cursor: pointer;
}

.shop-card.is-iap-ready:hover {
  transform: translateY(-1px);
  border-color: #B80E13;
  background: #232325;
}

.shop-card.is-owned {
  opacity: 1;
  cursor: pointer;
}

.shop-card.is-owned:hover {
  transform: translateY(-1px);
  border-color: #3d7a4a;
  background: #1a261c;
}

.shop-card.is-active {
  border-color: #B80E13;
  background: #2a1416;
}

.shop-card-badge.is-active-badge {
  color: #e0474b;
}

.shop-card-visual {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px auto;
  overflow: visible;
}

.shop-card-skeleton {
  position: absolute;
  inset: 0;
  display: none;
  background: linear-gradient(90deg, #1a1a1c 0%, #2e2e32 45%, #1a1a1c 90%);
  background-size: 200% 100%;
  animation: shop-card-shimmer 1.15s ease-in-out infinite;
}

.shop-card-visual.is-loading .shop-card-skeleton {
  display: block;
}

.shop-card-visual.is-loading > img,
.shop-card-visual.is-loading > .shop-emoji-preview {
  opacity: 0;
}

.shop-card-visual > img,
.shop-card-visual > .shop-emoji-preview {
  position: relative;
  z-index: 1;
  transition: opacity 0.2s ease;
}

.shop-card-visual > img.shop-frame {
  z-index: 2;
}

.shop-card-visual:not(.is-loading) > img,
.shop-card-visual:not(.is-loading) > .shop-emoji-preview {
  opacity: 1;
}

.shop-card-visual:has(.shop-avatar) .shop-card-skeleton {
  width: 56px;
  height: 56px;
  inset: auto;
  border-radius: 50%;
}

.shop-card-visual--emoji .shop-card-skeleton {
  width: 52px;
  height: 52px;
  inset: auto;
}

@keyframes shop-card-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.shop-card-visual img.shop-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(90% * var(--avatar-frame-scale, 1.32));
  height: calc(90% * var(--avatar-frame-scale, 1.32));
  max-width: none;
  max-height: none;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
}

.shop-card-visual img.shop-avatar,
.shop-card-visual video.shop-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.shop-card-visual.has-frame img.shop-avatar,
.shop-card-visual.has-frame video.shop-avatar {
  width: var(--avatar-frame-face, 95%);
  height: var(--avatar-frame-face, 95%);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.shop-card-visual img.shop-frame-only {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.shop-card-visual img.shop-gem-pack {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.shop-card-visual img.shop-grave {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.shop-purchase-visual .preview-grave {
  width: 96px;
  height: 96px;
  border-radius: 50% !important;
  object-fit: cover;
}

.shop-card-visual--emoji {
  width: 64px;
  height: 64px;
}

.shop-emoji-preview {
  width: 52px;
  height: 52px;
  display: block;
}

.shop-emoji-preview svg {
  width: 100% !important;
  height: 100% !important;
}

.shop-emoji-preview--modal {
  width: 72px;
  height: 72px;
  margin: 0 auto;
}

.shop-card-name {
  font-size: 10px;
  color: #fff;
  display: none;
}

.shop-card[data-type="gem_package"] .shop-card-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 4px 2px;
}

.shop-card-category {
  font-size: 10px;
  font-weight: 600;
  color: #b8c0cc;
  line-height: 1.3;
  display: none;
}

.shop-card-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #C9C9C9;
  font-weight: 700;
}

.shop-card-price img {
  width: 16px;
  height: 16px;
}

.shop-card-price.toman {
  color: #e0474b;
}

.shop-card-badge {
  font-size: 11px;
  color: #86efac;
  font-weight: 700;
}

.shop-empty,
.shop-loading,
.shop-error {
  text-align: center;
  color: #d0d0d0;
  padding: 32px 12px;
  grid-column: 1 / -1;
}

#shopPurchaseModal .shop-purchase-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 12px 0 18px;
}

#shopPurchaseModal .shop-purchase-visual {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

#shopPurchaseModal .shop-purchase-visual img.preview-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% * var(--avatar-frame-scale, 1.52));
  height: calc(100% * var(--avatar-frame-scale, 1.52));
  max-width: none;
  max-height: none;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
}

#shopPurchaseModal .shop-purchase-visual img.preview-avatar,
#shopPurchaseModal .shop-purchase-visual video.preview-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50% !important;
  object-fit: cover;
  background: #000;
  position: relative;
  z-index: 1;
}

#shopPurchaseModal .shop-purchase-visual.has-frame img.preview-avatar,
#shopPurchaseModal .shop-purchase-visual.has-frame video.preview-avatar {
  width: var(--avatar-frame-face, 95%);
  height: var(--avatar-frame-face, 95%);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

video.preview-avatar.avatar-media--video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

#shopPurchaseModal .shop-purchase-visual img.preview-frame-only,
#shopPurchaseModal .shop-purchase-visual img.preview-gem {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

#shopPurchaseModal .shop-purchase-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #f0f0f0;
}

#shopPurchaseModal .shop-purchase-name:empty {
  display: none;
}

#shopPurchaseModal .shop-purchase-price {
  margin: 0;
  font-size: 15px;
  color: #e8e8e8;
}

.shop-purchase-btn {
  width: 100%;
  padding: 14px;
  border: none;
  background: linear-gradient(180deg, #2477c4 0%, #18558c 100%);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.shop-purchase-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.shop-purchase-msg {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: #ffb4b4;
  min-height: 1.2em;
}

.shop-coming-soon {
  text-align: center;
  color: #c8c8c8;
  font-size: 13px;
  margin: 0 0 12px;
  flex-shrink: 0;
}

.shop-gems-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.shop-gems-toolbar[hidden] {
  display: none !important;
}

.shop-gems-history-btn {
  border: 1px solid #3a3a3c;
  border-radius: 999px;
  background: linear-gradient(180deg, #2f2f31 0%, #1d1d1f 100%);
  color: #f2f2f2;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.shop-gems-history-btn:hover {
  border-color: #e0474b;
  background: linear-gradient(180deg, #3a3a3c 0%, #242426 100%);
}

.shop-gems-history-modal {
  max-width: 420px;
  width: min(92vw, 420px);
}

@media (max-width: 360px) {
  .shop-grid {
    gap: 8px;
  }

  .shop-pagination button:not(.shop-page-nav-btn) {
    min-width: 0;
    flex: 1 1 auto;
    padding: 8px 10px;
    font-size: 12px;
  }

  .shop-pagination .shop-page-nav-btn {
    min-width: 40px;
    width: 40px;
    height: 40px;
  }

  #shopPurchaseModal .shop-purchase-visual {
    width: min(100px, 28vw);
    height: min(100px, 28vw);
  }
}

.shop-gems-history-body {
  max-height: min(60vh, 420px);
  overflow-y: auto;
  padding: 4px 2px 2px;
}

.shop-gems-history-empty {
  margin: 12px 0;
  text-align: center;
  color: #c8c8c8;
  font-size: 14px;
}

.shop-gems-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-gems-history-item {
  border: 1px solid #2f2f31;
  background: linear-gradient(180deg, #232325 0%, #18181a 100%);
  padding: 12px;
}

.shop-gems-history-main,
.shop-gems-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shop-gems-history-meta {
  margin-top: 8px;
}

.shop-gems-history-title {
  font-size: 14px;
  font-weight: 700;
  color: #f3f3f3;
}

.shop-gems-history-date,
.shop-gems-history-price {
  font-size: 12px;
  color: #bdbdbd;
}

.shop-gems-history-gems {
  font-size: 13px;
  font-weight: 700;
  color: #7fd0ff;
}

.shop-gems-history-bonus {
  color: #9be29b;
  font-weight: 600;
}
