/* ==========================================================================
   抽卡结果弹窗
   ========================================================================== */

.gacha-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9997;
  padding: 20px;
  overflow: hidden;
}

.gacha-modal.show {
  display: flex;
  animation: gachaFadeIn 0.24s ease;
}

@keyframes gachaFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.gacha-modal-box {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(168deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 22px;
  padding: 30px 26px 22px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
  position: relative;
  text-align: center;
  animation: gachaPop 0.36s cubic-bezier(0.2, 1.32, 0.5, 1);
}

@keyframes gachaPop {
  from { opacity: 0; transform: scale(0.84) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

body.dark .gacha-modal-box {
  background: linear-gradient(168deg, #1e293b 0%, #0f172a 100%);
  color: #e2e8f0;
}

.gacha-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: #64748b;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}

.gacha-close:hover {
  background: rgba(0, 0, 0, 0.12);
}

/* ---------- 标题 ---------- */

.gacha-title {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 22px;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #42a5f5, #7e57c2, #42a5f5);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gachaShine 3s linear infinite;
}

@keyframes gachaShine {
  to { background-position: 200% center; }
}

/* ---------- 卡面 ---------- */

.gacha-cards {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.gacha-cards.one {
  grid-template-columns: 1fr;
  max-width: 220px;
  margin-left: auto;
  margin-right: auto;
}

.gacha-cards.ten {
  grid-template-columns: repeat(5, 1fr);
}

.gacha-card {
  position: relative;
  border-radius: 12px;
  padding: 14px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.6) rotateY(80deg);
  animation: gachaCardIn 0.42s cubic-bezier(0.2, 1.3, 0.5, 1) forwards;
}

.gacha-cards.one .gacha-card {
  padding: 26px 16px 22px;
  gap: 8px;
}

@keyframes gachaCardIn {
  to { opacity: 1; transform: scale(1) rotateY(0); }
}

/* 稀有度配色 */

.gacha-card.N {
  background: linear-gradient(160deg, #f1f5f9, #e2e8f0);
  border: 1.5px solid #cbd5e1;
}

.gacha-card.R {
  background: linear-gradient(160deg, #e3f2fd, #d0e7fb);
  border: 1.5px solid #64b5f6;
}

.gacha-card.SR {
  background: linear-gradient(160deg, #f3e5f5, #e1bee7);
  border: 1.5px solid #ba68c8;
  box-shadow: 0 0 16px rgba(186, 104, 200, 0.35);
}

.gacha-card.SSR {
  background: linear-gradient(160deg, #fff9c4, #ffe082);
  border: 2px solid #ffb300;
  box-shadow: 0 0 26px rgba(255, 179, 0, 0.65);
}

body.dark .gacha-card.N {
  background: linear-gradient(160deg, #293548, #1f2937);
  border-color: #475569;
}
body.dark .gacha-card.R {
  background: linear-gradient(160deg, #1e3a5f, #172b47);
  border-color: #3b82f6;
}
body.dark .gacha-card.SR {
  background: linear-gradient(160deg, #3b2350, #2a1938);
  border-color: #a855f7;
}
body.dark .gacha-card.SSR {
  background: linear-gradient(160deg, #4a3a10, #33270a);
  border-color: #f59e0b;
}

/* SSR 光效 */

.gacha-card-glow {
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.45) 0%, transparent 65%);
  opacity: 0;
  pointer-events: none;
}

.gacha-card.SSR .gacha-card-glow {
  opacity: 1;
  animation: gachaGlow 2.4s ease-in-out infinite;
}

.gacha-card.SR .gacha-card-glow {
  opacity: 0.5;
  animation: gachaGlow 3.2s ease-in-out infinite;
}

@keyframes gachaGlow {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 0.85; transform: scale(1.15); }
}

.gacha-card-icon {
  font-size: 26px;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.gacha-cards.one .gacha-card-icon {
  font-size: 56px;
}

.gacha-card.SSR .gacha-card-icon {
  animation: gachaIconPulse 1.1s ease-in-out infinite;
}

@keyframes gachaIconPulse {
  50% { transform: scale(1.18); }
}

.gacha-card-rarity {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

.gacha-card.N .gacha-card-rarity   { color: #94a3b8; }
.gacha-card.R .gacha-card-rarity   { color: #2563eb; }
.gacha-card.SR .gacha-card-rarity  { color: #9333ea; }
.gacha-card.SSR .gacha-card-rarity { color: #d97706; }

.gacha-card-name {
  font-size: 11px;
  line-height: 1.35;
  font-weight: 600;
  position: relative;
  z-index: 1;
  color: var(--text, #334155);
}

body.dark .gacha-card-name {
  color: #e2e8f0;
}

.gacha-cards.one .gacha-card-name {
  font-size: 15px;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.gacha-card.SSR .gacha-card-name {
  background: linear-gradient(90deg, #d97706, #f59e0b, #d97706);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gachaShine 2s linear infinite;
}

/* ---------- 底部 ---------- */

.gacha-footer {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  margin-bottom: 16px;
}

.gacha-footer b {
  color: var(--primary, #1565C0);
  font-size: 14.5px;
}

.gacha-ok {
  width: 100%;
  padding: 13px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #42a5f5, #1e88e5);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.gacha-ok:hover {
  opacity: 0.9;
}

/* ---------- 抽卡中动画 ---------- */

.gacha-loading {
  padding: 40px 0 30px;
}

.gacha-spin {
  font-size: 62px;
  line-height: 1;
  display: inline-block;
  animation: gachaSpin 0.55s linear infinite;
}

@keyframes gachaSpin {
  0%   { transform: rotate(0) scale(1); }
  50%  { transform: rotate(180deg) scale(1.12); }
  100% { transform: rotate(360deg) scale(1); }
}

.gacha-loading-text {
  margin-top: 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  letter-spacing: 1px;
}

/* ---------- 彩带 ---------- */

.gacha-confetti {
  position: absolute;
  top: -14px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.95;
  animation: gachaConfetti linear forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes gachaConfetti {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(88vh) rotate(720deg); opacity: 0; }
}

/* ---------- 移动端 ---------- */

@media (max-width: 520px) {
  .gacha-cards.ten {
    grid-template-columns: repeat(3, 1fr);
  }
  .gacha-modal-box {
    padding: 26px 16px 18px;
  }
  .gacha-title {
    font-size: 18px;
  }
  .gacha-footer {
    gap: 14px;
    font-size: 12px;
  }
}
