.card {
  --rarity-soft: color-mix(in srgb, var(--rarity) 35%, transparent);
  --rarity-faint: color-mix(in srgb, var(--rarity) 14%, transparent);
  height: 130px;
  padding: 7px 9px 9px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-bottom: 3px solid var(--rarity);
  background:
    radial-gradient(120% 80% at 50% 38%, var(--rarity-soft) 0%, transparent 62%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #262c3b 0%, #1a1f2a 55%, color-mix(in srgb, var(--rarity) 22%, #161a23) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -18px 24px -14px var(--rarity-soft), 0 2px 6px rgba(0,0,0,.4);
  isolation: isolate;
}
.card > .badges, .card > .art, .card > .weapon, .card > .skin { position: relative; z-index: 2; }
.card .art { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 0; }
.card .art svg, .card svg.item-art {
  width: 100%;
  height: auto;
  max-height: 100%;
  fill: initial;
  opacity: 1;
  filter: drop-shadow(0 0 6px var(--rarity-faint));
}
.card .weapon {
  font-size: 10.5px;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: rgba(214, 220, 233, .62);
}
.card .skin {
  font-size: 13px;
  font-weight: 700;
  color: #f1f3f8;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.card .badges { position: absolute; top: 5px; right: 5px; z-index: 3; }
.badge {
  font-size: 9.5px;
  letter-spacing: .4px;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(8, 10, 14, .72);
  border: 1px solid rgba(255,255,255,.1);
  color: #c9cfdb;
}
.badge.st { color: #ff8a3d; border-color: rgba(207, 106, 50, .55); text-shadow: 0 0 6px rgba(255, 120, 40, .6); }

.fx-frame {
  position: absolute;
  inset: 4px;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(var(--rarity), var(--rarity)) top left / 10px 1px,
    linear-gradient(var(--rarity), var(--rarity)) top left / 1px 10px,
    linear-gradient(var(--rarity), var(--rarity)) top right / 10px 1px,
    linear-gradient(var(--rarity), var(--rarity)) top right / 1px 10px;
  background-repeat: no-repeat;
  opacity: .55;
}

.fx-pattern {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
}
.rarity-restricted .fx-pattern {
  background: radial-gradient(circle at 1px 1px, rgba(255,255,255,.09) 1px, transparent 1.5px) 0 0 / 8px 8px;
  mask-image: radial-gradient(90% 70% at 50% 40%, #000, transparent);
}
.rarity-classified .fx-pattern {
  background:
    linear-gradient(60deg, transparent 47%, var(--rarity-faint) 49%, transparent 51%) 0 0 / 22px 38px,
    linear-gradient(-60deg, transparent 47%, var(--rarity-faint) 49%, transparent 51%) 0 0 / 22px 38px;
  mask-image: radial-gradient(95% 75% at 50% 40%, #000, transparent);
  opacity: .9;
}

.fx-sheen {
  position: absolute;
  inset: -40% -60%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.0) 44%, rgba(255,255,255,.22) 49%, rgba(255,235,250,.08) 52%, transparent 58%);
  mix-blend-mode: screen;
  animation: fx-sheen 3.6s ease-in-out infinite;
  animation-delay: var(--fx-delay, 0s);
}
.rarity-covert .fx-sheen {
  background: linear-gradient(105deg, transparent 40%, rgba(255,80,80,.0) 44%, rgba(255,140,140,.28) 48%, rgba(120,200,255,.16) 51%, rgba(200,120,255,.12) 53%, transparent 58%);
}
.rarity-gold .fx-sheen {
  background: linear-gradient(105deg, transparent 38%, rgba(255,230,150,.0) 43%, rgba(255,240,180,.42) 48%, rgba(255,200,80,.18) 52%, transparent 58%);
  animation-duration: 2.8s;
}
@keyframes fx-sheen {
  0%, 18% { transform: translateX(-38%); }
  62%, 100% { transform: translateX(38%); }
}

.fx-embers { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.fx-embers i {
  position: absolute;
  bottom: -4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ff7a5c;
  box-shadow: 0 0 6px 1px rgba(255, 90, 60, .8);
  opacity: 0;
  animation: fx-ember 2.6s linear infinite;
}
@keyframes fx-ember {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  15% { opacity: .9; }
  100% { transform: translate(var(--dx, 6px), -120px) scale(.3); opacity: 0; }
}

.rarity-gold.card {
  background:
    radial-gradient(120% 85% at 50% 40%, rgba(255, 205, 90, .38) 0%, transparent 60%),
    repeating-conic-gradient(from 0deg at 50% 45%, rgba(255,215,120,.05) 0 8deg, transparent 8deg 16deg),
    linear-gradient(180deg, #2e2818 0%, #1d1a12 55%, #4a3812 100%);
  border-color: rgba(255, 210, 120, .22);
  border-bottom-color: var(--gold);
}
.fx-sparkles { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.fx-sparkles i {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #fff6d6;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 3px #ffd56a);
  opacity: 0;
  animation: fx-twinkle 2.2s ease-in-out infinite;
}
@keyframes fx-twinkle {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(90deg); }
}

.card.gold-hidden .skin { color: var(--gold); text-align: left; font-size: 13px; }
.card.gold-hidden .art svg { filter: drop-shadow(0 0 10px rgba(255, 200, 80, .55)); }

.card[data-context="reel"] .fx-embers i:nth-child(n+4) { display: none; }
.card[data-context="reel"] .fx-sparkles i:nth-child(n+4) { display: none; }

.card:is([data-context="inventory"], [data-context="gallery"], [data-context="preview"]) { transition: transform .18s ease, box-shadow .18s ease; }
.card:is([data-context="inventory"], [data-context="gallery"], [data-context="preview"]):hover {
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), inset 0 -18px 24px -14px var(--rarity-soft), 0 6px 18px color-mix(in srgb, var(--rarity) 35%, transparent);
}

.reel-viewport {
  height: 156px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.55), transparent 18%, transparent 82%, rgba(0,0,0,.55)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.015) 0 1px, transparent 1px 40px),
    #090b10;
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 0 40px rgba(0,0,0,.8);
}
.reel-track { top: 12px; }
.reel-marker {
  width: 3px;
  margin-left: -1.5px;
  z-index: 5;
  background: linear-gradient(180deg, #ffd27a, #f5a623 30%, #f5a623 70%, #ffd27a);
  box-shadow: 0 0 6px #f5a623, 0 0 18px rgba(245, 166, 35, .7), 0 0 40px rgba(245, 166, 35, .35);
}
.reel-marker::before, .reel-marker::after { left: -8.5px; border-width: 10px; filter: drop-shadow(0 0 4px #f5a623); }

.card.fx-winner {
  z-index: 4;
  animation: fx-winner-pop .45s cubic-bezier(.2, 1.6, .4, 1) forwards, fx-winner-glow 1.4s ease-in-out .45s infinite;
}
.card.fx-winner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--rarity);
  box-shadow: 0 0 14px var(--rarity), inset 0 0 14px var(--rarity-soft);
  pointer-events: none;
  z-index: 4;
}
.fx-winner-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 260px;
  height: 260px;
  margin: -130px 0 0 -130px;
  z-index: -1;
  pointer-events: none;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rarity) 45%, transparent) 0 6deg, transparent 6deg 22deg);
  mask-image: radial-gradient(circle, #000 15%, transparent 65%);
  animation: fx-spin 7s linear infinite;
  opacity: .8;
}
@keyframes fx-winner-pop { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes fx-winner-glow {
  0%, 100% { box-shadow: 0 0 10px var(--rarity-soft), inset 0 -18px 24px -14px var(--rarity-soft); }
  50% { box-shadow: 0 0 26px var(--rarity), inset 0 -18px 24px -10px var(--rarity); }
}
@keyframes fx-spin { to { transform: rotate(360deg); } }

.result {
  position: relative;
  min-height: 210px;
  padding: 10px;
  isolation: isolate;
}
.result .card {
  width: 270px;
  flex: 0 0 270px;
  height: 196px;
  box-shadow: 0 0 34px var(--rarity-soft), inset 0 -24px 30px -16px var(--rarity-soft);
  animation: fx-card-in .55s cubic-bezier(.18, 1.4, .4, 1);
}
.result .card .skin { font-size: 15px; }
.result-info { position: relative; z-index: 2; max-width: 360px; }
.result-info .result-rarity {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--rarity) 22%, transparent);
  border-left: 3px solid var(--rarity);
  font-size: 12px;
}
.result-info .result-name {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.15;
  text-shadow: 0 0 18px var(--rarity-soft, transparent), 0 2px 4px rgba(0,0,0,.6);
}
.result-info.rarity-gold .result-name {
  background: linear-gradient(90deg, #fff1c4, #e4ae39 35%, #fff6da 50%, #e4ae39 65%, #fff1c4);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: fx-gold-text 2.4s linear infinite;
}
@keyframes fx-gold-text { to { background-position: -200% 0; } }
@keyframes fx-card-in {
  0% { transform: scale(.6) rotateY(70deg); opacity: 0; filter: brightness(3); }
  60% { filter: brightness(1.4); }
  100% { transform: none; opacity: 1; filter: none; }
}

.fx-result-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 640px;
  height: 640px;
  margin: -320px 0 0 -320px;
  z-index: -1;
  pointer-events: none;
  background: repeating-conic-gradient(from 0deg, var(--fx-color) 0 5deg, transparent 5deg 18deg);
  mask-image: radial-gradient(circle, #000 8%, transparent 60%);
  opacity: 0;
  animation: fx-rays-in 4s ease-out forwards, fx-spin 12s linear infinite;
}
@keyframes fx-rays-in { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: .9; } 70% { opacity: .55; } 100% { opacity: 0; } }

.fx-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 3px solid var(--fx-color);
  box-shadow: 0 0 20px var(--fx-color);
  pointer-events: none;
  z-index: 3;
  animation: fx-ring 1s ease-out forwards;
}
@keyframes fx-ring { from { transform: scale(.3); opacity: 1; } to { transform: scale(12); opacity: 0; } }

.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.fx-canvas.fx-fullscreen { position: fixed; z-index: 50; }

.fx-flash {
  position: fixed;
  inset: 0;
  z-index: 49;
  pointer-events: none;
  background: radial-gradient(circle at 50% 35%, rgba(255, 240, 190, .95), rgba(228, 174, 57, .55) 40%, rgba(80, 50, 0, 0) 75%);
  animation: fx-flash 1.1s ease-out forwards;
}
@keyframes fx-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

.fx-shake { animation: fx-shake .55s cubic-bezier(.36, .07, .19, .97); }
@keyframes fx-shake {
  10%, 90% { transform: translate(-1px, 1px); }
  20%, 80% { transform: translate(3px, -2px); }
  30%, 50%, 70% { transform: translate(-5px, 2px); }
  40%, 60% { transform: translate(5px, -1px); }
}

.feed li {
  position: relative;
  overflow: hidden;
  padding: 7px 10px 7px 12px;
  border-radius: 3px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--rarity) 26%, rgba(10,12,18,.9)) 0%, rgba(10, 12, 18, .78) 70%);
  border-left: 3px solid var(--rarity);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.feed .feed-who { text-shadow: 0 1px 2px #000; }
.feed .feed-item { color: color-mix(in srgb, var(--rarity) 75%, #fff); text-shadow: 0 0 8px var(--rarity-soft, transparent); }
.feed li { --rarity-soft: color-mix(in srgb, var(--rarity) 45%, transparent); }
.fx-feed-icon { margin-right: 5px; color: var(--rarity); filter: drop-shadow(0 0 4px var(--rarity)); }
.feed li.fx-feed-hot::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.18) 48%, transparent 62%);
  transform: translateX(-100%);
  animation: fx-feed-shimmer 2.6s ease-in-out infinite;
}
.feed li.rarity-gold {
  background: linear-gradient(90deg, rgba(228, 174, 57, .42), rgba(40, 30, 8, .85) 75%);
  border-left-width: 4px;
  box-shadow: 0 0 14px rgba(228, 174, 57, .45), inset 0 0 0 1px rgba(255, 215, 120, .25);
}
.feed li.rarity-gold .feed-item { color: #ffe3a0; }
.feed li.rarity-covert { box-shadow: 0 0 10px rgba(235, 75, 75, .35), inset 0 0 0 1px rgba(255, 120, 120, .15); }
@keyframes fx-feed-shimmer { 0%, 25% { transform: translateX(-100%); } 75%, 100% { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  .fx-sheen, .fx-embers, .fx-sparkles, .fx-winner-rays, .fx-result-rays, .fx-ring, .fx-flash { display: none; }
  .card.fx-winner, .result .card, .result-info.rarity-gold .result-name, .feed li.fx-feed-hot::after, .fx-shake { animation: none; }
}
