/* ═══════════════════════════════════════════════════════════════
   RALLY RACING MASTERS — Gacha & Collection Book Styles v1.0
   Crate opening, reward reveal, collection grid, character details
   ═══════════════════════════════════════════════════════════════ */

/* ── RARITY COLORS ── */
:root {
  --rarity-common: #888888;
  --rarity-uncommon: #22c55e;
  --rarity-rare: #3b82f6;
  --rarity-epic: #a855f7;
  --rarity-legendary: #ffd700;
  --rarity-mythic: #ef4444;
}

/* ═══════════════════════════
   GACHA OVERLAY (full-screen)
   ═══════════════════════════ */
.gacha-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(4,4,10,.97);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
}
.gacha-overlay.show {
  display: flex;
  animation: gachaFadeIn .4s ease forwards;
}
@keyframes gachaFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Phase 1: Anticipation ── */
.gacha-chest-container {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 200px; height: 200px;
}
.gacha-chest-img {
  width: 140px; height: 140px; object-fit: contain;
  filter: drop-shadow(0 0 20px var(--chest-glow, #a855f7));
  animation: chestPulse 1.2s ease-in-out infinite;
  z-index: 2; position: relative;
}
@keyframes chestPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px var(--chest-glow, #a855f7)); }
  50%      { transform: scale(1.06); filter: drop-shadow(0 0 35px var(--chest-glow, #a855f7)); }
}

/* ── Floating particles (anticipation) ── */
.gacha-particles {
  position: absolute; inset: -60px; pointer-events: none; z-index: 1;
}
.gacha-particle {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: var(--chest-glow, #a855f7);
  opacity: 0;
  animation: particleFloat 2.5s linear infinite;
}
@keyframes particleFloat {
  0%   { opacity: 0; transform: translateY(80px) scale(.5); }
  20%  { opacity: .8; }
  80%  { opacity: .4; }
  100% { opacity: 0; transform: translateY(-120px) scale(0); }
}

/* ── Phase 2: Shake ── */
.gacha-chest-img.shaking {
  animation: chestShake 0.08s linear infinite;
}
@keyframes chestShake {
  0%   { transform: translate(-2px, 0) rotate(-1deg); }
  25%  { transform: translate(2px, -1px) rotate(1deg); }
  50%  { transform: translate(-3px, 1px) rotate(-1.5deg); }
  75%  { transform: translate(3px, 0) rotate(1.5deg); }
  100% { transform: translate(-1px, -1px) rotate(-0.5deg); }
}
.gacha-chest-img.shaking-intense {
  animation: chestShakeIntense 0.05s linear infinite;
}
@keyframes chestShakeIntense {
  0%   { transform: translate(-5px, 0) rotate(-3deg); }
  25%  { transform: translate(5px, -3px) rotate(3deg); }
  50%  { transform: translate(-6px, 2px) rotate(-4deg); }
  75%  { transform: translate(6px, 0) rotate(4deg); }
  100% { transform: translate(-3px, -2px) rotate(-2deg); }
}

/* Light rays */
.gacha-rays {
  position: absolute; inset: -100px;
  pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity .5s ease;
}
.gacha-rays.active { opacity: 1; }
.gacha-ray {
  position: absolute; top: 50%; left: 50%;
  width: 4px; height: 200px;
  transform-origin: center bottom;
  background: linear-gradient(to top, var(--chest-glow, #a855f7), transparent);
  opacity: .3;
}

/* ── Phase 3: Burst ── */
.gacha-burst {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 10;
  display: none;
}
.gacha-burst.active {
  display: block;
  animation: burstFlash .5s ease forwards;
}
@keyframes burstFlash {
  0%   { background: var(--chest-glow, #a855f7); opacity: .8; }
  50%  { background: #fff; opacity: .5; }
  100% { background: transparent; opacity: 0; }
}
.burst-particle {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--chest-glow, #a855f7);
  top: 50%; left: 50%;
  animation: burstParticle .8s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes burstParticle {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: var(--bp-dir) scale(0); }
}

/* ── Phase 4: Card Reveal ── */
.gacha-reveal-area {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap;
  padding: 20px; max-width: 600px;
  min-height: 240px;
}

.gacha-card {
  width: 110px; height: 156px;
  perspective: 600px;
  cursor: pointer;
}
.gacha-card-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .6s cubic-bezier(.34,1.56,.64,1);
  transform-style: preserve-3d;
}
.gacha-card.flipped .gacha-card-inner {
  transform: rotateY(180deg);
}

.gacha-card-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
}

/* Card back */
.gacha-card-back {
  background: rgba(255,255,255,.04);
  border: 2px solid rgba(255,255,255,.08);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.gacha-card-back::before {
  content: '?';
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 42px; font-weight: 700;
  color: rgba(255,255,255,.15);
}
.gacha-card-back::after {
  content: ''; position: absolute; inset: 6px;
  border: 1px dashed rgba(255,255,255,.06);
  border-radius: 8px;
}

/* Card front */
.gacha-card-front {
  transform: rotateY(180deg);
  background: rgba(12,10,24,.95);
  border: 2px solid var(--card-rarity-color, #888);
  box-shadow: 0 0 18px color-mix(in srgb, var(--card-rarity-color, #888) 40%, transparent),
              inset 0 1px 0 rgba(255,255,255,.06);
  padding: 10px 6px 8px;
}
.gacha-card-front .card-image {
  width: 72px; height: 72px; object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
  margin-bottom: 4px;
}
.gacha-card-front .card-name {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 10px; font-weight: 700; color: #fff;
  text-align: center; text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.2;
  max-height: 26px; overflow: hidden;
}
.gacha-card-front .card-rarity {
  font-size: 8px; font-weight: 600;
  color: var(--card-rarity-color, #888);
  text-transform: uppercase; letter-spacing: .5px;
  margin-top: 2px;
}
.gacha-card-front .card-amount {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 20px; font-weight: 800; color: #fff;
  margin-top: 6px;
}
.gacha-card-front .card-amount-label {
  font-size: 10px; color: rgba(255,255,255,.5);
  text-transform: uppercase; letter-spacing: .3px;
}

/* NEW badge */
.gacha-card-new {
  position: absolute; top: 6px; right: 6px;
  background: #22c55e; color: #fff;
  font-size: 8px; font-weight: 800;
  padding: 2px 5px; border-radius: 4px;
  letter-spacing: .5px;
  animation: newBadgePulse 1.5s ease infinite;
  z-index: 3;
}
@keyframes newBadgePulse {
  0%, 100% { box-shadow: 0 0 4px rgba(34,197,94,.4); }
  50%      { box-shadow: 0 0 12px rgba(34,197,94,.7); }
}

/* Mythic card sparkle */
.gacha-card.mythic-card .gacha-card-front::before {
  content: ''; position: absolute; inset: -2px;
  border-radius: 14px; z-index: -1;
  background: conic-gradient(#ef4444, #ffd700, #ef4444, #ff6b6b, #ef4444);
  animation: mythicRotate 3s linear infinite;
}
@keyframes mythicRotate {
  to { transform: rotate(360deg); }
}

/* ── Phase 5: Summary ── */
.gacha-summary {
  text-align: center; margin-top: 24px;
}
.gacha-summary-text {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 14px; color: rgba(255,255,255,.5);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 16px;
}
.gacha-summary-btns {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.gacha-btn {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; border: none; cursor: pointer;
  padding: 12px 28px; border-radius: 12px;
  min-width: 44px; min-height: 44px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.gacha-btn:active { transform: scale(.96); }
.gacha-btn-primary {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 16px rgba(168,85,247,.35);
}
.gacha-btn-primary:hover { box-shadow: 0 6px 24px rgba(168,85,247,.5); }
.gacha-btn-secondary {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
}
.gacha-btn-secondary:hover { background: rgba(255,255,255,.1); }

/* ═══════════════════════════
   CRATE SHOP
   ═══════════════════════════ */
.crate-shop-overlay {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(6,6,12,.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: none; flex-direction: column;
  overflow: hidden;
}
.crate-shop-overlay.show {
  display: flex;
  animation: gachaFadeIn .4s ease forwards;
}

.crate-shop-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; flex-shrink: 0;
  background: linear-gradient(180deg, rgba(10,10,18,.95), rgba(10,10,18,.85));
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative;
}
.crate-shop-header::after {
  content: ''; position: absolute; bottom: 0; left: 20px; right: 20px; height: 1px;
  background: linear-gradient(90deg, transparent, #a855f7, transparent);
  opacity: .4;
}
.crate-shop-header h2 {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 18px; font-weight: 800; color: #fff;
  margin: 0; letter-spacing: .6px; text-transform: uppercase;
}
.crate-shop-close {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  color: rgba(255,255,255,.5); font-size: 22px; cursor: pointer;
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.crate-shop-close:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Balance bar */
.crate-shop-balance {
  display: flex; gap: 14px; padding: 12px 20px;
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.balance-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 20px; padding: 6px 14px;
}
.balance-pill img { width: 20px; height: 20px; }
.balance-pill span {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 14px; font-weight: 700; color: #fff;
}

/* Pity display */
.pity-bar {
  display: flex; gap: 12px; padding: 8px 20px;
  font-size: 11px; color: rgba(255,255,255,.4);
  background: rgba(168,85,247,.04);
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.pity-item { display: flex; align-items: center; gap: 4px; }
.pity-item .pity-dot { width: 6px; height: 6px; border-radius: 50%; }

/* Crate grid */
.crate-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; padding: 20px;
  overflow-y: auto; flex: 1;
  -webkit-overflow-scrolling: touch;
}
.crate-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px; padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; cursor: pointer;
  transition: transform .5s cubic-bezier(.34,1.56,.64,1),
              box-shadow .2s ease, border-color .2s ease;
  position: relative; overflow: hidden;
}
.crate-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg,rgba(255,255,255,.06) 0%,transparent 40%,transparent 60%,rgba(255,255,255,.03) 100%);
  pointer-events: none;
}
.crate-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--crate-accent, #a855f7);
  box-shadow: 0 8px 30px color-mix(in srgb, var(--crate-accent, #a855f7) 25%, transparent);
}
.crate-card:active { transform: scale(.97); }
.crate-card-img {
  width: 80px; height: 80px; object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.4));
  margin-bottom: 10px;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.crate-card:hover .crate-card-img { transform: scale(1.1) rotate(-3deg); }
.crate-card-name {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 14px; font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: .4px;
  margin-bottom: 4px;
}
.crate-card-guaranteed {
  font-size: 10px; color: var(--crate-accent, #a855f7);
  margin-bottom: 8px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px;
}
.crate-card-pool {
  font-size: 10px; color: rgba(255,255,255,.35);
  margin-bottom: 12px;
}

/* Buy buttons */
.crate-buy-row {
  display: flex; flex-direction: column; gap: 6px; width: 100%;
}
.crate-buy-btn {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 12px; font-weight: 700;
  border: none; border-radius: 10px;
  padding: 10px 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 44px;
  transition: transform .12s ease, box-shadow .12s ease;
  text-transform: uppercase; letter-spacing: .3px;
}
.crate-buy-btn:active { transform: scale(.95); }
.crate-buy-btn img { width: 16px; height: 16px; }
.crate-buy-btn.buy-single {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  box-shadow: 0 3px 12px rgba(168,85,247,.3);
}
.crate-buy-btn.buy-ten {
  background: rgba(255,215,0,.12);
  border: 1px solid rgba(255,215,0,.25);
  color: #ffd700;
}
.crate-buy-btn.buy-ten:hover { background: rgba(255,215,0,.2); }
.crate-buy-ten-discount {
  font-size: 9px; color: #22c55e;
  background: rgba(34,197,94,.15);
  padding: 1px 4px; border-radius: 3px;
  margin-left: 4px;
}

/* Silhouette previews */
.crate-preview-row { display: flex; gap: 4px; margin-bottom: 8px; }
.crate-preview-silhouette {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: rgba(255,255,255,.15);
}

/* ═══════════════════════════
   COLLECTION BOOK
   ═══════════════════════════ */
.collection-overlay {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(6,6,12,.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: none; flex-direction: column;
  overflow: hidden;
}
.collection-overlay.show {
  display: flex;
  animation: gachaFadeIn .4s ease forwards;
}
.collection-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; flex-shrink: 0;
  background: linear-gradient(180deg, rgba(10,10,18,.95), rgba(10,10,18,.85));
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative;
}
.collection-header::after {
  content: ''; position: absolute; bottom: 0; left: 20px; right: 20px; height: 1px;
  background: linear-gradient(90deg, transparent, #ffd700, transparent);
  opacity: .4;
}
.collection-header-left { display: flex; align-items: center; gap: 14px; }
.collection-header h2 {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 18px; font-weight: 800; color: #fff;
  margin: 0; letter-spacing: .6px; text-transform: uppercase;
}
.collection-close {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  color: rgba(255,255,255,.5); font-size: 22px; cursor: pointer;
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.collection-close:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Progress ring */
.collection-progress-ring { width: 44px; height: 44px; flex-shrink: 0; }
.collection-progress-ring svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.progress-ring-bg { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 3; }
.progress-ring-fill {
  fill: none; stroke: #ffd700; stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset .6s cubic-bezier(.34,1.56,.64,1);
}
.collection-progress-text {
  font-size: 11px; color: rgba(255,255,255,.5); margin-top: 2px;
}

/* Filter tabs */
.collection-filters { display: flex; flex-direction: column; gap: 0; flex-shrink: 0; }
.collection-element-tabs {
  display: flex; overflow-x: auto; gap: 0; padding: 0 16px;
  background: rgba(255,255,255,.015);
  border-bottom: 1px solid rgba(255,255,255,.04);
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.collection-element-tabs::-webkit-scrollbar { display: none; }
.element-tab {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,.4);
  text-transform: uppercase; letter-spacing: .4px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  min-height: 44px; display: flex; align-items: center; gap: 4px;
  transition: color .15s ease, border-color .15s ease;
}
.element-tab:hover { color: rgba(255,255,255,.7); }
.element-tab.active { color: #fff; border-bottom-color: #a855f7; }
.element-tab .tab-count {
  font-size: 9px; color: rgba(255,255,255,.25);
  background: rgba(255,255,255,.04);
  padding: 1px 5px; border-radius: 8px;
}
.collection-rarity-tabs {
  display: flex; overflow-x: auto; gap: 0; padding: 0 16px;
  background: rgba(255,255,255,.01);
  border-bottom: 1px solid rgba(255,255,255,.04);
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.collection-rarity-tabs::-webkit-scrollbar { display: none; }
.rarity-tab {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.35);
  text-transform: uppercase; letter-spacing: .3px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  min-height: 44px; display: flex; align-items: center; gap: 4px;
  transition: color .15s ease, border-color .15s ease;
}
.rarity-tab:hover { color: rgba(255,255,255,.6); }
.rarity-tab.active { color: #fff; border-bottom-color: var(--tab-rarity-color, #a855f7); }
.rarity-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* Character grid */
.collection-grid-container {
  flex: 1; overflow-y: auto; padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}
.collection-cell {
  display: flex; flex-direction: column; align-items: center;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 12px; padding: 10px 6px 8px;
  cursor: pointer; position: relative;
  transition: transform .5s cubic-bezier(.34,1.56,.64,1),
              border-color .2s ease, box-shadow .2s ease;
}
.collection-cell:hover {
  transform: translateY(-3px);
  border-color: var(--cell-rarity, rgba(255,255,255,.1));
  box-shadow: 0 6px 20px color-mix(in srgb, var(--cell-rarity, #888) 20%, transparent);
}
.collection-cell:active { transform: scale(.95); }
.collection-cell-img {
  width: 56px; height: 56px; object-fit: contain;
  margin-bottom: 4px; transition: transform .2s ease;
}
.collection-cell:hover .collection-cell-img { transform: scale(1.08); }

/* Locked state */
.collection-cell.locked .collection-cell-img {
  filter: grayscale(1) brightness(.4); opacity: .4;
}
.collection-cell.locked { cursor: default; }
.collection-cell.locked:hover { transform: none; border-color: rgba(255,255,255,.05); box-shadow: none; }
.lock-icon {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  font-size: 20px; opacity: .3; pointer-events: none;
}
.collection-cell-name {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 9px; font-weight: 600; color: rgba(255,255,255,.7);
  text-align: center; text-transform: uppercase;
  letter-spacing: .2px; line-height: 1.2;
  max-height: 22px; overflow: hidden;
}
.collection-cell.locked .collection-cell-name { color: rgba(255,255,255,.2); }
.collection-cell-stars {
  font-size: 8px; color: rgba(255,215,0,.6);
  margin-top: 2px; letter-spacing: 1px;
}
.collection-cell.locked .collection-cell-stars { opacity: .2; }
.collection-cell-rarity-strip {
  position: absolute; bottom: 0; left: 8px; right: 8px; height: 2px;
  border-radius: 1px; background: var(--cell-rarity, #888); opacity: .5;
}
.collection-cell.locked .collection-cell-rarity-strip { opacity: .15; }
.collection-cell-dupe {
  position: absolute; top: 4px; right: 4px;
  background: rgba(168,85,247,.8); color: #fff;
  font-size: 8px; font-weight: 800;
  padding: 1px 4px; border-radius: 4px; letter-spacing: .3px;
}
.collection-cell-check {
  position: absolute; top: 4px; left: 4px;
  color: #22c55e; font-size: 12px;
}

/* ── Family Sets ── */
.collection-families { padding: 16px 16px 0; }
.family-set {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.04);
  border-radius: 12px; padding: 12px; margin-bottom: 10px;
}
.family-set-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.family-set-name {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 12px; font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: .3px;
}
.family-set-progress { font-size: 10px; color: rgba(255,255,255,.4); }
.family-set-progress.complete { color: #22c55e; }
.family-set-bar {
  height: 3px; background: rgba(255,255,255,.06);
  border-radius: 2px; overflow: hidden; margin-bottom: 8px;
}
.family-set-bar-fill {
  height: 100%; background: linear-gradient(90deg, #a855f7, #ffd700);
  border-radius: 2px; transition: width .6s cubic-bezier(.34,1.56,.64,1);
}
.family-set-bar-fill.complete { background: #22c55e; }
.family-set-icons { display: flex; gap: 6px; flex-wrap: wrap; }
.family-set-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  object-fit: contain; padding: 3px;
}
.family-set-icon.locked {
  filter: grayscale(1) brightness(.3); opacity: .3;
}

/* ═══════════════════════════
   CHARACTER DETAIL MODAL
   ═══════════════════════════ */
.char-detail-backdrop {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(4,4,10,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.char-detail-backdrop.show {
  display: flex;
  animation: gachaFadeIn .3s ease forwards;
}
.char-detail-modal {
  background: rgba(14,12,28,.95);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px; padding: 24px 20px;
  max-width: 360px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  position: relative;
  animation: modalSlideUp .4s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(.95); }
  to   { opacity: 1; transform: none; }
}
.char-detail-close {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.5); font-size: 18px;
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.char-detail-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.char-detail-image {
  width: 120px; height: 120px; object-fit: contain;
  display: block; margin: 0 auto 16px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.5));
}
.char-detail-name {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 20px; font-weight: 800; color: #fff;
  text-align: center; text-transform: uppercase;
  letter-spacing: .6px; margin-bottom: 4px;
}
.char-detail-rarity {
  text-align: center; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}
.char-detail-element {
  text-align: center; font-size: 11px; color: rgba(255,255,255,.4);
  text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px;
}
.char-detail-family {
  text-align: center; font-size: 10px; color: rgba(255,255,255,.3);
  text-transform: uppercase; letter-spacing: .3px; margin-bottom: 12px;
}
.char-detail-role {
  text-align: center; font-size: 11px; color: rgba(168,85,247,.7);
  font-weight: 600; text-transform: uppercase; margin-bottom: 12px;
}
.char-detail-lore {
  font-size: 12px; color: rgba(255,255,255,.45);
  line-height: 1.6; text-align: center; font-style: italic;
  margin-bottom: 16px; padding: 12px;
  background: rgba(255,255,255,.02); border-radius: 10px;
  border: 1px solid rgba(255,255,255,.04);
}
.char-detail-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 16px;
}
.char-stat {
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.04);
  border-radius: 8px; padding: 8px 10px;
}
.char-stat-label {
  font-size: 9px; color: rgba(255,255,255,.35);
  text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px;
}
.char-stat-bar {
  height: 3px; background: rgba(255,255,255,.06);
  border-radius: 2px; overflow: hidden;
}
.char-stat-bar-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, #a855f7, #ffd700);
  transition: width .4s ease;
}
.char-stat-value {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 14px; font-weight: 700; color: #fff;
  float: right; margin-top: -14px;
}
.char-detail-dupes {
  text-align: center; font-size: 12px; color: rgba(255,255,255,.4); margin-bottom: 8px;
}
.char-detail-power {
  text-align: center; font-size: 11px; color: rgba(168,85,247,.6); margin-bottom: 8px;
}
.char-detail-set-bonus {
  background: rgba(34,197,94,.06);
  border: 1px solid rgba(34,197,94,.15);
  border-radius: 10px; padding: 10px 12px;
  text-align: center; margin-top: 12px;
}
.char-detail-set-bonus-title {
  font-family: var(--font-display, 'Oswald', system-ui);
  font-size: 11px; font-weight: 700; color: #22c55e;
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px;
}
.char-detail-set-bonus-desc { font-size: 10px; color: rgba(255,255,255,.4); }

/* ═══════════════════════════
   MULTI-REVEAL (10x pull)
   ═══════════════════════════ */
.gacha-multi-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 8px; padding: 16px; max-width: 580px;
}
@media (max-width: 500px) {
  .gacha-multi-grid { grid-template-columns: repeat(3, 1fr); }
  .gacha-card { width: 90px; height: 130px; }
  .gacha-card-front .card-image { width: 52px; height: 52px; }
  .gacha-card-front .card-name { font-size: 8px; }
}
@media (max-width: 380px) {
  .crate-shop-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .collection-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}

/* "TAP TO SKIP" hint */
.gacha-skip-hint {
  position: absolute; bottom: 40px; left: 0; right: 0;
  text-align: center;
  font-size: 11px; color: rgba(255,255,255,.25);
  text-transform: uppercase; letter-spacing: .5px;
  animation: hintPulse 2s ease infinite;
  pointer-events: none;
}
@keyframes hintPulse {
  0%, 100% { opacity: .25; }
  50%      { opacity: .5; }
}
