/* ============================================================
   番茄岛 · 品质流光 & 皮肤闪耀
   普通：纸感；稀有：流光；史诗：极光；传说：全息星屑
   ============================================================ */

/* ---------- collection quality ---------- */
.collection-perk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  margin-top: 7px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--rarity-color) 25%, var(--line));
  border-radius: 99px;
  background: color-mix(in srgb, var(--rarity-soft) 70%, transparent);
  color: var(--rarity-color);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.collection-perk i {
  font-style: normal;
  font-size: 9px;
}

.collection-card[data-rarity="rare"] {
  border-color: color-mix(in srgb, var(--rarity-color) 22%, var(--line));
}

.collection-card[data-rarity="epic"] {
  border-color: color-mix(in srgb, var(--rarity-color) 36%, var(--line));
  box-shadow:
    0 7px 22px rgba(75, 52, 28, 0.045),
    0 0 24px color-mix(in srgb, var(--rarity-color) 9%, transparent);
}

.collection-card[data-rarity="epic"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--rarity-color) 75%, #fff),
    transparent 30%,
    color-mix(in srgb, var(--skin-aura-b, #9adcf0) 65%, transparent) 58%,
    transparent 84%,
    color-mix(in srgb, var(--rarity-color) 60%, transparent)
  );
  opacity: 0.62;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.collection-card[data-rarity="legendary"] {
  border-color: color-mix(in srgb, var(--rarity-color) 52%, var(--line));
  box-shadow:
    0 10px 30px rgba(75, 52, 28, 0.07),
    0 0 34px color-mix(in srgb, var(--rarity-color) 13%, transparent);
}

.collection-card[data-rarity="legendary"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 7;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(
    from 12deg,
    color-mix(in srgb, var(--rarity-color) 85%, #fff),
    color-mix(in srgb, var(--skin-aura-b, #b9a7ff) 75%, transparent),
    color-mix(in srgb, var(--rarity-color) 30%, transparent),
    color-mix(in srgb, var(--skin-aura-c, #ffe8ad) 80%, transparent),
    color-mix(in srgb, var(--rarity-color) 85%, #fff)
  );
  opacity: 0.95;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: rarity-border-hue 9s linear infinite;
}

.collection-card[data-rarity="legendary"] .collection-name-row h3 {
  background: linear-gradient(100deg, var(--text) 5%, var(--rarity-color) 44%, var(--skin-aura-b, #b9a7ff) 64%, var(--text) 95%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: rarity-title-flow 8s linear infinite;
}

.collection-card[data-rarity="epic"] .card-rarity {
  box-shadow: 0 0 14px color-mix(in srgb, var(--rarity-color) 18%, transparent);
}

.card-rarity.rarity-legendary {
  background: linear-gradient(110deg, #fff2b7, #ffc6de 48%, #b8efff);
  color: #5a3a12;
  box-shadow: 0 0 14px rgba(255, 200, 110, 0.3);
}

.card-rarity.rarity-epic {
  box-shadow: 0 0 12px rgba(154, 91, 189, 0.18);
}

/* ---------- rare/epic/legendary skin previews ---------- */
.skin-preview {
  isolation: isolate;
}

.skin-preview::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 48%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to top, color-mix(in srgb, var(--p-accent) 24%, transparent), transparent);
}

.skin-preview--rare::after {
  opacity: 0.28;
}

.skin-preview--epic::after {
  height: 60%;
  opacity: 0.52;
  background:
    radial-gradient(ellipse 90% 100% at 72% 100%, color-mix(in srgb, var(--p-accent) 38%, transparent), transparent 67%),
    radial-gradient(ellipse 70% 80% at 20% 100%, color-mix(in srgb, var(--p-primary) 18%, transparent), transparent 67%);
}

.skin-preview--legendary::after {
  height: 72%;
  opacity: 0.78;
  background:
    radial-gradient(ellipse 60% 100% at 16% 100%, rgba(255, 206, 121, 0.4), transparent 62%),
    radial-gradient(ellipse 60% 100% at 52% 100%, rgba(255, 129, 181, 0.34), transparent 62%),
    radial-gradient(ellipse 65% 100% at 88% 100%, rgba(132, 231, 215, 0.4), transparent 66%);
  mix-blend-mode: screen;
}

.skin-shine {
  position: absolute;
  inset: -35% -20%;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-70%) rotate(12deg);
  background: linear-gradient(
    108deg,
    transparent 36%,
    rgba(255, 255, 255, 0.1) 44%,
    rgba(255, 255, 255, 0.55) 49%,
    color-mix(in srgb, var(--p-primary) 20%, #fff) 52%,
    transparent 64%
  );
  filter: none;
  mix-blend-mode: soft-light;
}

.skin-preview--rare .skin-shine {
  opacity: 0.7;
  animation: preview-shine 8.5s ease-in-out infinite;
}

.skin-preview--epic .skin-shine {
  opacity: 0.9;
  animation: preview-shine 6.5s ease-in-out infinite;
}

.skin-preview--legendary .skin-shine {
  opacity: 1;
  animation: preview-shine 5s ease-in-out infinite;
}

.skin-starfield {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.85;
}

.skin-starfield i {
  position: absolute;
  left: var(--sx);
  top: var(--sy);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fffceb;
  box-shadow:
    0 0 6px #fff,
    0 0 13px var(--p-accent);
  opacity: 0;
  animation: preview-star 3.4s ease-in-out var(--sd) infinite;
}

.skin-starfield i:nth-child(3n) {
  width: 7px;
  height: 1.4px;
  border-radius: 99px;
  background: var(--p-accent);
}

.skin-holo {
  position: absolute;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.11;
  background: conic-gradient(
    from 40deg,
    transparent,
    rgba(255, 126, 157, 0.6),
    transparent 32%,
    rgba(142, 227, 201, 0.55),
    transparent 61%,
    rgba(185, 167, 255, 0.55),
    transparent 88%
  );
  mix-blend-mode: color-dodge;
  animation: preview-holo 12s linear infinite;
}

.skin-preview--legendary .skin-holo {
  opacity: 0.18;
}

.skin-preview--epic .preview-chrome,
.skin-preview--legendary .preview-chrome {
  border-bottom-color: rgba(80, 60, 40, 0.12);
}

.skin-preview--legendary .preview-timer-ring {
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--p-primary) 10%, transparent),
    0 0 18px color-mix(in srgb, var(--p-primary) 28%, transparent);
}

/* ---------- effect previews: new types ---------- */
.effect-fireflies {
  background:
    radial-gradient(ellipse 70% 70% at 50% 52%, rgba(30, 38, 28, 0.88), transparent 72%),
    linear-gradient(145deg, #1d2b24, #3a4030);
}

.effect-fireflies .effect-preview-bg {
  border-color: rgba(239, 215, 120, 0.28);
}

.effect-fireflies .fx-shape {
  box-shadow: 0 0 9px var(--c), 0 0 19px color-mix(in srgb, var(--c) 55%, transparent);
  animation: firefly-float 4.4s ease-in-out var(--d) infinite;
}

.effect-aurora {
  background:
    radial-gradient(ellipse 80% 50% at 50% 38%, rgba(42, 138, 136, 0.45), transparent 64%),
    linear-gradient(145deg, #132b35, #203e4e 54%, #2d2949);
}

.effect-aurora .effect-preview-bg {
  inset: 22% 15% 30%;
  width: auto;
  height: auto;
  border-radius: 48%;
  border-color: rgba(144, 239, 219, 0.28);
  filter: blur(0.2px);
}

.fx-shape.shape-aurora {
  width: calc(var(--s) * 6);
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--c), transparent);
  opacity: 0.6;
  transform: rotate(calc(var(--r) * -0.4));
  animation: aurora-ribbon 5s ease-in-out var(--d) infinite;
}

.effect-butterflies {
  background:
    radial-gradient(ellipse 60% 70% at 35% 35%, rgba(246, 184, 213, 0.45), transparent 60%),
    radial-gradient(ellipse 60% 55% at 70% 65%, rgba(154, 220, 240, 0.42), transparent 62%),
    linear-gradient(145deg, #f4edf5, #dae8f1);
}

.fx-shape.shape-butterfly {
  width: calc(var(--s) * 2.1);
  height: calc(var(--s) * 1.45);
  border-radius: 0;
  background: linear-gradient(135deg, var(--c), rgba(255, 255, 255, 0.82));
  clip-path: polygon(50% 48%, 2% 2%, 18% 48%, 2% 98%, 50% 60%, 98% 98%, 82% 48%, 98% 2%);
  box-shadow: 0 0 8px color-mix(in srgb, var(--c) 55%, transparent);
  animation: butterfly-flutter 4.2s ease-in-out var(--d) infinite;
}

.effect-goldrain {
  background:
    radial-gradient(ellipse 70% 75% at 50% 44%, rgba(255, 231, 164, 0.5), transparent 66%),
    linear-gradient(145deg, #fff5d8, #ead2a5);
}

.effect-goldrain .effect-preview-bg {
  border-color: rgba(185, 128, 42, 0.24);
}

.effect-goldrain .fx-shape {
  background: linear-gradient(to bottom, #fff7c9, var(--c));
  box-shadow: 0 0 8px color-mix(in srgb, var(--c) 65%, transparent);
  animation: gold-rain 3.5s linear var(--d) infinite;
}

.effect-meteor {
  background:
    radial-gradient(ellipse 65% 60% at 64% 20%, rgba(173, 203, 255, 0.35), transparent 55%),
    linear-gradient(145deg, #14182e, #282344 60%, #1b2140);
}

.effect-meteor .effect-preview-bg {
  border-color: rgba(188, 213, 255, 0.25);
}

.fx-shape.shape-ray.effect-meteor,
.effect-meteor .fx-shape {
  width: 2px;
  height: calc(var(--s) * 4.6);
  background: linear-gradient(to top, transparent, var(--c) 48%, #fff);
  box-shadow: 0 0 8px var(--c);
  transform: rotate(calc(38deg + var(--r) * 0.08));
  animation: meteor-fall 3s ease-in var(--d) infinite;
}

@keyframes rarity-border-hue {
  to { filter: hue-rotate(360deg); }
}

@keyframes rarity-title-flow {
  to { background-position: 220% 0; }
}

@keyframes preview-shine {
  0%, 18% { transform: translateX(-75%) rotate(12deg); opacity: 0; }
  42% { opacity: 0.72; }
  62% { opacity: 0.2; }
  82%, 100% { transform: translateX(80%) rotate(12deg); opacity: 0; }
}

@keyframes preview-star {
  0%, 100% { transform: scale(0.35) rotate(0deg); opacity: 0; }
  45% { transform: scale(1.3) rotate(35deg); opacity: 1; }
  70% { opacity: 0.3; }
}

@keyframes preview-holo {
  to { transform: rotate(360deg); }
}

@keyframes firefly-float {
  0%, 100% { transform: translate(0, 7px) scale(0.6); opacity: 0.15; }
  45% { transform: translate(5px, -8px) scale(1.2); opacity: 0.95; }
  70% { transform: translate(-3px, -2px) scale(0.9); opacity: 0.55; }
}

@keyframes aurora-ribbon {
  0%, 100% { transform: translateX(-8px) rotate(calc(var(--r) * -0.4)) scaleY(0.6); opacity: 0.2; }
  50% { transform: translateX(8px) rotate(calc(var(--r) * -0.4)) scaleY(1.4); opacity: 0.8; }
}

@keyframes butterfly-flutter {
  0%, 100% { transform: translate(0, 3px) rotate(var(--r)) scaleX(0.55) scaleY(0.8); opacity: 0.35; }
  50% { transform: translate(6px, -7px) rotate(calc(var(--r) + 14deg)) scaleX(1.1) scaleY(1); opacity: 0.95; }
}

@keyframes gold-rain {
  0% { transform: translateY(-12px) rotate(var(--r)); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translateY(24px) rotate(calc(var(--r) + 50deg)); opacity: 0; }
}

@keyframes meteor-fall {
  0% { transform: translate(18px, -16px) rotate(calc(38deg + var(--r) * 0.08)); opacity: 0; }
  22% { opacity: 0.9; }
  100% { transform: translate(-24px, 22px) rotate(calc(38deg + var(--r) * 0.08)); opacity: 0; }
}

/* ---------- gacha result rarity treatments ---------- */
.gacha-result-card.rarity-epic {
  box-shadow: 0 0 22px color-mix(in srgb, var(--rarity-color) 10%, transparent);
}

.gacha-result-card.rarity-legendary {
  border-color: color-mix(in srgb, var(--rarity-color) 55%, var(--line));
  box-shadow:
    0 8px 20px rgba(50, 30, 15, 0.08),
    0 0 22px color-mix(in srgb, var(--rarity-color) 16%, transparent);
}

.gacha-result-card.rarity-legendary .result-art {
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 232, 164, 0.6), transparent 38%),
    radial-gradient(circle at 75% 60%, rgba(255, 175, 210, 0.5), transparent 42%),
    radial-gradient(circle at 55% 90%, rgba(157, 224, 255, 0.45), transparent 45%),
    var(--surface-2);
}

.gacha-result-card.rarity-legendary h3 {
  background: linear-gradient(100deg, var(--text), var(--rarity-color) 55%, var(--skin-aura-b, #b9a7ff));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

@media (max-width: 620px) {
  .collection-perk {
    font-size: 7px;
  }

  .skin-shine {
    filter: blur(2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skin-shine,
  .skin-starfield i,
  .skin-holo,
  .collection-card[data-rarity="legendary"]::before,
  .collection-card[data-rarity="legendary"] .collection-name-row h3,
  .effect-aurora .fx-shape,
  .effect-butterflies .fx-shape,
  .effect-fireflies .fx-shape,
  .effect-goldrain .fx-shape,
  .effect-meteor .fx-shape {
    animation: none !important;
  }
}
