/* Cases page + Unlock modal */
html {
  scrollbar-gutter: stable;
}
.cases-page {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  padding-left: clamp(12px, 1.5vw, 28px);
  padding-right: clamp(12px, 1.5vw, 28px);
}
.cases-header .lead {
  margin-bottom: 1rem;
}
.cases-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.cases-filter__btn {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #c8c8d0;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}
.cases-filter__btn.is-active {
  background: #0A84FF;
  border-color: #0A84FF;
  color: #fff;
}
.cases-group.is-hidden,
.cases-card.is-hidden {
  display: none !important;
}
.cases-group {
  margin-bottom: 28px;
}
.cases-group__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: #d7dbe0;
  letter-spacing: 0.02em;
}
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.cases-card {
  background: #1b1f24;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cases-card__media {
  display: grid;
  place-items: center;
  min-height: 168px;
  background: linear-gradient(180deg, #4a4a4a 0%, #6e6e6e 100%);
  padding: 16px;
}
.cases-card__media img {
  max-width: 78%;
  max-height: 128px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.cases-card--case .cases-card__media img {
  max-width: 82%;
  max-height: 132px;
}
.cases-card--capsule .cases-card__media {
  min-height: 168px;
  padding: 14px;
}
.cases-card--capsule .cases-card__media img {
  max-width: 78%;
  max-height: 128px;
}
.cases-card--collection .cases-card__media img {
  max-width: 92%;
  max-height: 152px;
}
/* SVG set icons (e.g. Graphic Design) render tiny — scale them up */
.cases-card--collection .cases-card__media img[src$=".svg"],
.cases-card--collection .cases-card__media img[src*="set_graphic_design"],
.cases-card--collection .cases-card__media img[src*="set_icons/"] {
  max-width: 100%;
  max-height: 160px;
  width: 150px;
  height: 150px;
  transform: scale(1.15);
}
.cases-card__body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.cases-card__body h3 {
  margin: 0;
  font-size: 1.05rem;
}
.cases-card__desc {
  margin: 0;
  color: #9aa3ad;
  font-size: 0.85rem;
  flex: 1;
}
.cases-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.case-unlock {
  position: fixed;
  inset: 0;
  z-index: 53000;
  display: block;
  padding: clamp(8px, 1.2vw, 18px);
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  /* Preview grid cards */
  --skin-card-w: 172px;
  --skin-card-gap: 10px;
  --skin-card-media-h: 132px;
  --skin-card-img-h: 112px;
  --skin-card-meta-h: 42px;
  --skin-card-bar-h: 4px;
  --skin-card-h: calc(var(--skin-card-media-h) + var(--skin-card-bar-h) + var(--skin-card-meta-h));
  /* Spin reel cards (larger) */
  --reel-card-w: 232px;
  --reel-card-gap: 12px;
  --reel-card-media-h: 196px;
  --reel-card-img-h: 164px;
  --reel-card-meta-h: 48px;
  --reel-card-bar-h: 4px;
  --reel-card-h: calc(var(--reel-card-media-h) + var(--reel-card-bar-h) + var(--reel-card-meta-h));
  contain: layout;
}
.case-unlock[hidden] { display: none !important; }
.case-unlock__panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Stable width between preview/spin — prevents CLS */
  width: min(1680px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
  height: min(92vh, 860px);
  max-height: min(92vh, 860px);
  overflow: hidden;
  overflow-anchor: none;
  contain: layout size;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 38%, rgba(12, 16, 22, 0.28) 100%),
    rgba(18, 24, 32, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  box-shadow:
    0 30px 100px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(28px) saturate(1.45);
  -webkit-backdrop-filter: blur(28px) saturate(1.45);
  padding: 22px clamp(16px, 2vw, 28px) 18px;
  color: #e8e8ea;
  scrollbar-width: none;
}
.case-unlock__panel::-webkit-scrollbar { display: none; width: 0; height: 0; }
.case-unlock__panel--spin { /* same size as default panel */ }
.case-unlock__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.case-unlock__stage,
.case-unlock__spin,
.case-unlock__reveal {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.case-unlock__stage[hidden],
.case-unlock__spin[hidden],
.case-unlock__reveal[hidden] {
  display: none !important;
}
.case-unlock__contains {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.case-unlock__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--skin-card-w));
  gap: var(--skin-card-gap);
  justify-content: center;
  align-content: start;
  margin-bottom: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.case-unlock__grid::-webkit-scrollbar { display: none; width: 0; height: 0; }
.case-unlock__close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: #9aa3ad;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.case-unlock__hero {
  text-align: center;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.case-unlock__eyebrow {
  color: #9aa3ad;
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.case-unlock__hero h2 {
  margin: 0 0 12px;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  min-height: 1.3em;
}
.case-unlock__case-art {
  display: grid;
  place-items: center;
  width: min(320px, 100%);
  height: 120px;
  min-height: 120px;
  margin: 0 auto 8px;
  background:
    radial-gradient(ellipse at center, rgba(80,100,120,0.35) 0%, rgba(10,12,16,0.1) 70%),
    linear-gradient(180deg, #3a424c 0%, #252b33 100%);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 12px;
  box-sizing: border-box;
}
.case-unlock__case-art img {
  width: 140px;
  height: 100px;
  max-width: 100%;
  max-height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.4));
}
.case-unlock__price {
  color: #ffd76a;
  font-weight: 700;
  min-height: 1.25em;
}
.case-unlock__contains-head {
  display: flex;
  justify-content: space-between;
  color: #9aa3ad;
  font-size: 0.85rem;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.case-drop {
  width: var(--skin-card-w);
  height: var(--skin-card-h);
  background: #1a1a1b;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.case-drop__media {
  flex: 0 0 var(--skin-card-media-h);
  height: var(--skin-card-media-h);
  display: grid;
  place-items: center;
  padding: 10px;
  background: linear-gradient(180deg, #4a4a4a 0%, #6e6e6e 100%);
  box-sizing: border-box;
}
.case-drop__media img {
  max-width: 100%;
  max-height: var(--skin-card-img-h);
  object-fit: contain;
}
.case-drop__media--special {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 220, 120, 0.55) 0%, rgba(180, 120, 20, 0.35) 42%, rgba(40, 28, 8, 0.95) 78%),
    linear-gradient(180deg, #c9a227 0%, #5a3d0a 100%);
}
.case-drop__media--special img {
  max-height: calc(var(--skin-card-img-h) + 8px);
  filter: drop-shadow(0 8px 16px rgba(228, 174, 57, 0.45));
}
.case-drop--special .case-drop__weapon,
.case-drop--special .case-drop__pattern {
  color: #f6d56a;
}
.stattrak-label,
.is-stattrak,
#revealName.is-stattrak {
  color: #cf6a32 !important;
}
.stattrak-label {
  font-weight: 700;
}
.case-unlock__reveal-stage--special {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 220, 120, 0.45) 0%, rgba(180, 120, 20, 0.28) 42%, rgba(40, 28, 8, 0.92) 78%),
    linear-gradient(180deg, #c9a227 0%, #5a3d0a 100%) !important;
}
.case-unlock__reveal-stage--special img {
  filter: drop-shadow(0 14px 24px rgba(228, 174, 57, 0.35));
}
.case-reel__item--special .case-reel__item-media {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 220, 120, 0.55) 0%, rgba(180, 120, 20, 0.35) 42%, rgba(40, 28, 8, 0.95) 78%),
    linear-gradient(180deg, #c9a227 0%, #5a3d0a 100%);
}
.case-reel__item--special .case-reel__item-media img {
  max-height: var(--reel-card-img-h);
  filter: drop-shadow(0 10px 18px rgba(228, 174, 57, 0.35));
}
.case-drop__bar {
  flex: 0 0 var(--skin-card-bar-h);
  height: var(--skin-card-bar-h);
  background: var(--rarity, #4b69ff);
}
.case-drop__meta {
  flex: 0 0 var(--skin-card-meta-h);
  height: var(--skin-card-meta-h);
  padding: 6px 8px 8px;
  background: #1a1a1b;
  box-sizing: border-box;
}
.case-drop__weapon {
  font-size: 0.74rem;
  color: #b8bec6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-drop__pattern {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-unlock__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 42px;
  align-items: center;
  flex: 0 0 auto;
}
.case-unlock__status {
  margin: 10px 0 0;
  color: #ffb4b4;
  text-align: center;
}

/* CS2-style horizontal reel — centered, shorter strip, larger cards */
.case-unlock__spin {
  padding: 0;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.case-unlock__spin[hidden] { display: none !important; }
.case-unlock__spin-head {
  text-align: center;
  margin-bottom: 6px;
  flex: 0 0 auto;
}
.case-unlock__spin-head h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
}
.case-unlock__spin-hint {
  margin: 8px 0 0;
  text-align: center;
  color: #9aa3ad;
  font-size: 0.9rem;
  flex: 0 0 auto;
}

.case-reel {
  position: relative;
  width: min(1100px, 94%);
  margin: 0 auto;
  flex: 0 0 auto;
}
.case-reel__viewport {
  position: relative;
  height: calc(var(--reel-card-h) + 56px);
  overflow: hidden;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.08) 0%, rgba(8, 10, 14, 0.18) 72%),
    rgba(12, 16, 22, 0.22);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.case-reel__track {
  position: absolute;
  left: 0;
  top: 28px;
  display: flex;
  align-items: stretch;
  height: var(--reel-card-h);
  will-change: transform;
  transform: translate3d(0,0,0);
}
.case-reel__item {
  flex: 0 0 auto;
  width: var(--reel-card-w);
  height: var(--reel-card-h);
  margin-right: var(--reel-card-gap);
  display: flex;
  flex-direction: column;
  background: rgba(16, 18, 22, 0.92);
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(0,0,0,0.28);
  box-sizing: border-box;
}
.case-reel__item-media {
  flex: 0 0 var(--reel-card-media-h);
  height: var(--reel-card-media-h);
  display: grid;
  place-items: center;
  padding: 10px;
  background: linear-gradient(180deg, #4a4a4a 0%, #6e6e6e 100%);
  box-sizing: border-box;
}
.case-reel__item-media img {
  max-width: 100%;
  max-height: var(--reel-card-img-h);
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.35));
  pointer-events: none;
  user-select: none;
}
.case-reel__item-bar {
  flex: 0 0 var(--reel-card-bar-h);
  height: var(--reel-card-bar-h);
  background: var(--rarity, #4b69ff);
}
.case-reel__item-meta {
  flex: 0 0 var(--reel-card-meta-h);
  height: var(--reel-card-meta-h);
  padding: 6px 8px 8px;
  background: #121417;
  box-sizing: border-box;
}
.case-reel__item-weapon {
  font-size: 0.78rem;
  color: #a8b0b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-reel__item-pattern {
  font-size: 0.88rem;
  font-weight: 650;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-reel__item.is-winner { }
.case-reel__item--special .case-reel__item-media {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 220, 120, 0.55) 0%, rgba(180, 120, 20, 0.35) 42%, rgba(40, 28, 8, 0.95) 78%),
    linear-gradient(180deg, #c9a227 0%, #5a3d0a 100%);
}
.case-reel__item--special .case-reel__item-media img {
  max-height: var(--reel-card-img-h);
  filter: drop-shadow(0 10px 18px rgba(228, 174, 57, 0.35));
}
.case-reel__item--special .case-reel__item-weapon {
  color: #e4ae39;
}
.case-reel__item--special .case-reel__item-pattern {
  color: #f6d56a;
}

.case-reel__marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent 0%, #f0c75e 12%, #f0c75e 88%, transparent 100%);
  box-shadow: 0 0 10px rgba(240, 199, 94, 0.55);
  z-index: 5;
  pointer-events: none;
}
.case-reel__lens {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(300px, 46vw);
  height: min(300px, 46vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    inset 0 0 40px rgba(255,255,255,0.06),
    0 0 0 9999px rgba(6, 8, 12, 0.22);
  z-index: 3;
  pointer-events: none;
}
.case-reel__fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 72px;
  z-index: 4;
  pointer-events: none;
}
.case-reel__fade--left {
  left: 0;
  background: linear-gradient(90deg, rgba(10,12,16,0.92), transparent);
}
.case-reel__fade--right {
  right: 0;
  background: linear-gradient(270deg, rgba(10,12,16,0.92), transparent);
}

.case-reel.is-spinning .case-reel__track {
  filter: saturate(1.05);
}
.case-reel.is-landed .case-reel__item.is-winner {
  animation: caseReelLand 0.4s ease;
}
@keyframes caseReelLand {
  0% { transform: scale(1); }
  40% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

.case-unlock__reveal {
  text-align: center;
  padding: 4px 4px 0;
  animation: caseRevealIn 0.45s ease;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
}
.case-unlock__reveal-head {
  flex: 0 0 auto;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
}
.case-unlock__reveal-topline {
  display: inline-flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  max-width: 100%;
}
.case-unlock__reveal-case-icon {
  flex: 0 0 36px;
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  margin-top: 2px;
  object-fit: contain;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  padding: 2px;
  box-sizing: border-box;
}
.case-unlock__reveal-case-icon[hidden] {
  display: none !important;
}
.case-unlock__reveal-titles {
  min-width: 0;
}
.case-unlock__reveal-label {
  color: #9aa3ad;
  font-size: 0.88rem;
  margin-bottom: 2px;
}
.case-unlock__reveal h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.25;
}
.case-unlock__reveal-case-name {
  margin-top: 4px;
  color: #9aa3ad;
  font-size: 0.88rem;
}
.case-unlock__reveal-stage {
  position: relative;
  min-height: 0;
  width: 100%;
  margin: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #4a4a4a 0%, #6e6e6e 55%, #7a7a7a 100%);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 28px 24px;
  box-sizing: border-box;
  overflow: hidden;
}
.case-unlock__reveal-stage::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--rarity, #8847ff);
  border-radius: 8px 0 0 8px;
}
.case-unlock__reveal-stage > img {
  max-width: min(100%, 860px);
  max-height: min(60vh, 580px);
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(0,0,0,0.45));
}
.case-unlock__reveal-footer {
  width: 100%;
  margin-top: 0;
  padding-top: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.case-unlock__reveal-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 8px 18px;
  text-align: left;
  width: min(100%, 760px);
  margin: 0;
  font-size: 0.9rem;
  flex: 1 1 auto;
}
.case-unlock__reveal-stats div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.case-unlock__reveal-stats span { color: #8b939c; }
.case-unlock__actions--reveal {
  flex: 0 0 auto;
  justify-content: flex-end;
  margin-top: 0;
  padding-top: 0;
  align-self: flex-end;
  min-width: max-content;
}

@keyframes caseRevealIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 700px) {
  .case-unlock {
    --skin-card-w: 156px;
    --skin-card-media-h: 120px;
    --skin-card-img-h: 100px;
    --skin-card-meta-h: 40px;
    --reel-card-w: 168px;
    --reel-card-h: 210px;
    --reel-card-img-h: 148px;
  }
  .case-unlock__grid {
    grid-template-columns: repeat(auto-fill, var(--skin-card-w));
  }
  .case-reel {
    width: min(100%, 92%);
  }
  .case-unlock__reveal-stage {
    min-height: 0;
    padding: 18px 14px;
  }
  .case-unlock__reveal-stage > img {
    max-height: min(36vh, 300px);
  }
  .case-unlock__reveal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .case-unlock__reveal-stats {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .case-unlock__actions--reveal {
    justify-content: flex-end;
    min-width: 0;
  }
}
