/* ============================================================
   NINJI — Collectibles System
   ============================================================ */

/* ---- Rarity colors ---------------------------------------- */
:root {
    --rarity-normal: #9CA3AF;
    --rarity-normal-soft: #E5E7EB;
    --rarity-normal-glow: rgba(156, 163, 175, 0.5);

    --rarity-uncommon: #22C55E;
    --rarity-uncommon-soft: #D1FAE5;
    --rarity-uncommon-glow: rgba(34, 197, 94, 0.5);

    --rarity-rare: #3B82F6;
    --rarity-rare-soft: #DBEAFE;
    --rarity-rare-glow: rgba(59, 130, 246, 0.55);

    --rarity-epic: #A855F7;
    --rarity-epic-soft: #EDE9FE;
    --rarity-epic-glow: rgba(168, 85, 247, 0.6);

    --rarity-legendary: #F59E0B;
    --rarity-legendary-soft: #FEF3C7;
    --rarity-legendary-glow: rgba(245, 158, 11, 0.7);

    --rarity-nsr-start: #FF6B9D;
    --rarity-nsr-mid: #C084FC;
    --rarity-nsr-end: #F59E0B;
    --rarity-nsr-glow: rgba(255, 107, 157, 0.7);
}

/* ---- Page layout ------------------------------------------ */
/* Hero is a full-bleed sibling of .collectibles-page (renders before it
   in the template). body already has padding-top: var(--navbar-height)
   to offset the fixed navbar, so hero naturally sits flush against it. */
.collectibles-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

/* ---- Dopamine hero (tied to nav bar, full-bleed) ---------- */
.collectibles-hero {
    position: relative;
    width: 100%;
    margin: 0 0 2rem;
    padding: 3.2rem 1.5rem 3.6rem;
    text-align: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 184, 208, 0.55) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(192, 132, 252, 0.45) 0%, transparent 50%),
        linear-gradient(135deg, #FF6B9D 0%, #FF85B5 35%, #D488F5 70%, #A78BFA 100%);
    color: #fff;
    box-shadow: 0 10px 30px -10px rgba(168, 85, 247, 0.35);
}

/* Soft shimmer sweep across the hero */
.collectibles-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        115deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 40%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: hero-shimmer 6s linear infinite;
    pointer-events: none;
    mix-blend-mode: overlay;
}

@keyframes hero-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.collectibles-hero__inner {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    z-index: 2;
}

.collectibles-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.4rem 0.95rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.35);
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.collectibles-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1.1;
    margin: 0 0 0.6rem;
    color: #fff;
    text-shadow: 0 2px 12px rgba(218, 32, 120, 0.3);
    font-weight: 800;
}

.collectibles-hero__accent {
    background: linear-gradient(90deg, #FCD34D 0%, #FFF 50%, #FCD34D 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: hero-accent-shine 3s linear infinite;
    filter: drop-shadow(0 2px 6px rgba(252, 211, 77, 0.55));
}

@keyframes hero-accent-shine {
    0%   { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

.collectibles-hero p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.5;
}

.collectibles-hero p strong {
    color: #FCD34D;
    font-weight: 700;
}

.collectibles-hero__disclaimer {
    margin-top: 0.8rem !important;
    font-size: 0.78rem !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-style: italic;
    max-width: 520px;
    line-height: 1.45;
}

/* Floating sparkles */
.collectibles-hero__sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.hero-sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
    opacity: 0;
    animation: hero-sparkle-twinkle 3s ease-in-out infinite;
}

.hero-sparkle--1 { top: 18%; left:  8%; animation-delay: 0.0s; width: 8px; height: 8px; }
.hero-sparkle--2 { top: 32%; left: 88%; animation-delay: 0.4s; width: 12px; height: 12px; }
.hero-sparkle--3 { top: 68%; left: 14%; animation-delay: 0.9s; width: 10px; height: 10px; }
.hero-sparkle--4 { top: 78%; left: 82%; animation-delay: 1.3s; width: 8px;  height: 8px; }
.hero-sparkle--5 { top: 12%; left: 55%; animation-delay: 1.7s; width: 14px; height: 14px; }
.hero-sparkle--6 { top: 50%; left:  4%; animation-delay: 2.1s; width: 10px; height: 10px; }
.hero-sparkle--7 { top: 85%; left: 48%; animation-delay: 2.4s; width: 9px;  height: 9px; }
.hero-sparkle--8 { top: 25%; left: 28%; animation-delay: 2.7s; width: 7px;  height: 7px; }

@keyframes hero-sparkle-twinkle {
    0%, 100% { opacity: 0; transform: scale(0.4); }
    50%      { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .collectibles-hero::before,
    .collectibles-hero__accent,
    .hero-sparkle { animation: none; }
}

/* ---- Progress panels (collection % + XP) ------------------ */
.progress-panels {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
    max-width: 960px;
    margin: 0 auto 2.2rem;
}

@media (max-width: 720px) {
    .progress-panels { grid-template-columns: 1fr; }
}

.progress-panel {
    background: #fff;
    border: 1px solid rgba(255, 107, 157, 0.12);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.3rem 1.2rem;
    box-shadow: 0 4px 14px -8px rgba(255, 107, 157, 0.2);
}

/* XP panel gets a slightly warmer accent background to nudge the eye */
.progress-panel--xp {
    background: linear-gradient(135deg, #FFF9FC 0%, #FFF5F9 100%);
    border-color: rgba(192, 132, 252, 0.18);
    position: relative;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.55rem;
    gap: 1rem;
}

.progress-label span:last-child {
    color: var(--color-primary);
}

.xp-label__icon {
    display: inline-flex;
    vertical-align: middle;
    margin-right: 4px;
    color: var(--color-primary);
}

.progress-bar {
    background: var(--color-primary-light);
    height: 14px;
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-purple) 100%);
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(255, 107, 157, 0.4);
}

/* XP bar — animated diagonal stripes over the gradient fill */
.progress-bar--xp { height: 16px; }

.progress-fill--xp {
    background:
        linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.18) 0%,
            rgba(255, 255, 255, 0.18) 25%,
            transparent              25%,
            transparent              50%,
            rgba(255, 255, 255, 0.18) 50%,
            rgba(255, 255, 255, 0.18) 75%,
            transparent              75%,
            transparent              100%
        ),
        linear-gradient(90deg, #FF6B9D 0%, #C084FC 70%, #A78BFA 100%);
    background-size: 32px 32px, 100% 100%;
    animation: xp-stripes 1.6s linear infinite;
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.5);
}

@keyframes xp-stripes {
    0%   { background-position: 0 0, 0 0; }
    100% { background-position: 32px 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    .progress-fill--xp { animation: none; }
}

.xp-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.xp-meta span:first-child {
    font-family: var(--font-heading, inherit);
    font-weight: 700;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

.xp-reward-flash {
    margin-top: 0.8rem;
    background: linear-gradient(135deg, #FFE8F1 0%, #F3E8FF 100%);
    border: 1px dashed var(--color-primary);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    text-align: center;
}

/* ---- Category filter (Profielfoto's / Ninji Pets) -------- */
.category-filter {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0 auto 1.8rem;
    padding: 0.3rem;
    max-width: fit-content;
    background: var(--color-primary-light);
    border-radius: var(--radius-full);
}

.category-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    border: 0;
    cursor: pointer;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-primary);
    background: transparent;
    transition: background 0.18s, color 0.18s, transform 0.18s;
}

.category-tab:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

.category-tab.is-active {
    background: #fff;
    color: var(--color-primary-hover);
    box-shadow: 0 2px 8px rgba(255, 107, 157, 0.22);
}

.category-tab__icon {
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
}

.category-tab--locked .category-tab__soon {
    display: inline-block;
    font-size: 0.62rem;
    background: var(--color-primary);
    color: #fff;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-left: 0.1rem;
}

/* Panel visibility is controlled by [hidden] + .is-active */
.category-panel[hidden] { display: none; }

/* ---- Ninji Pets coming-soon teaser ----------------------- */
.category-panel--locked { max-width: 720px; margin-left: auto; margin-right: auto; }

.pets-teaser {
    background: linear-gradient(135deg, #F3E8FF 0%, #FFE8F1 100%);
    border: 2px dashed rgba(192, 132, 252, 0.55);
    border-radius: var(--radius-lg);
    padding: 2.4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.pets-teaser::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(192, 132, 252, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255, 107, 157, 0.15) 0%, transparent 45%);
    pointer-events: none;
}

.pets-teaser > * { position: relative; }

.pets-teaser__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(90deg, var(--color-primary), var(--color-purple));
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-full);
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.pets-teaser__icon {
    color: var(--color-primary);
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: center;
}

.pets-teaser h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    margin: 0 0 0.6rem;
    color: var(--color-text);
}

.pets-teaser__lead {
    color: var(--color-text);
    max-width: 520px;
    margin: 0 auto 1.2rem;
    line-height: 1.55;
}

.pets-teaser__lead strong { color: var(--color-primary); }

.pets-teaser__features {
    list-style: none;
    padding: 0;
    margin: 0 auto 1.6rem;
    max-width: 420px;
    text-align: left;
    display: grid;
    gap: 0.55rem;
}

.pets-teaser__features li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.92rem;
}

.pets-teaser__bullet {
    display: inline-flex;
    color: var(--color-primary);
    font-size: 1.1rem;
}

.pets-teaser .btn[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
    background: linear-gradient(90deg, var(--color-primary), var(--color-purple));
}

/* ---- Crates section --------------------------------------- */
.crates-section {
    background: linear-gradient(135deg, #FFE8F1 0%, #FFF5F9 100%);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 3rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.crates-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 120%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 107, 157, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 50%, rgba(192, 132, 252, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.crates-section h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    position: relative;
}

.crates-section__subtitle {
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    position: relative;
}

.crates-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    position: relative;
}

.crate-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.5rem 1.25rem;
    min-width: 180px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    border: 2px solid var(--color-primary-light);
}

.crate-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.crate-visual {
    margin-bottom: 1rem;
    animation: crate-bobble 2s ease-in-out infinite;
}

.crate-box {
    width: 80px;
    height: 70px;
    margin: 0 auto;
    position: relative;
    perspective: 200px;
}

.crate-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55px;
    background: linear-gradient(135deg, #FF6B9D 0%, #D44A7A 100%);
    border-radius: 8px 8px 12px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    box-shadow: 0 4px 0 #A83E66, 0 6px 12px rgba(0,0,0,0.15);
}

.crate-lid {
    position: absolute;
    top: 0;
    left: -4px;
    right: -4px;
    height: 22px;
    background: linear-gradient(135deg, #FF85B0 0%, #E85490 100%);
    border-radius: 10px 10px 4px 4px;
    box-shadow: 0 2px 0 #C24078, 0 4px 8px rgba(0,0,0,0.1);
    z-index: 2;
}

.crate-lid::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 5px;
    background: #F7B731;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.crate-card h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.crate-card .btn {
    width: 100%;
}

@keyframes crate-bobble {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-6px) rotate(2deg); }
}

/* ---- Collection grid -------------------------------------- */
.collection-section h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.collection-section__subtitle {
    color: var(--color-text-light);
    text-align: center;
    margin-bottom: 2.5rem;
}

.rarity-group {
    margin-bottom: 3rem;
}

.rarity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--color-primary-light);
}

.rarity-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.rarity-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.75;
}

.rarity-count {
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.rarity-count strong {
    color: var(--color-primary);
}

/* Rarity color classes */
.rarity-badge.rarity-normal { background: var(--rarity-normal); }
.rarity-badge.rarity-uncommon { background: var(--rarity-uncommon); }
.rarity-badge.rarity-rare { background: var(--rarity-rare); }
.rarity-badge.rarity-epic { background: var(--rarity-epic); }
.rarity-badge.rarity-legendary { background: var(--rarity-legendary); }
.rarity-badge.rarity-ninji_super_rare {
    background: linear-gradient(135deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end));
    animation: nsr-shimmer 3s ease-in-out infinite;
    background-size: 200% 200%;
}

@keyframes nsr-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Collectibles grid */
.collectibles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.25rem;
}

.collectible-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem 0.75rem;
    text-align: center;
    position: relative;
    transition: var(--transition);
    border: 3px solid transparent;
    cursor: default;
}

.collectible-card.unlocked {
    box-shadow: var(--shadow-card);
}

.collectible-card.unlocked:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.collectible-card.locked {
    background: #F4F4F6;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
    opacity: 0.85;
}

.collectible-card.active-pfp {
    background: linear-gradient(135deg, #FFE8F1 0%, white 100%);
    box-shadow: 0 0 0 4px var(--color-primary-light), var(--shadow-lg);
    transform: translateY(-3px);
}

/* Rarity borders */
.collectible-card.rarity-border-normal { border-color: var(--rarity-normal-soft); }
.collectible-card.rarity-border-uncommon { border-color: var(--rarity-uncommon-soft); }
.collectible-card.rarity-border-rare { border-color: var(--rarity-rare-soft); }
.collectible-card.rarity-border-epic { border-color: var(--rarity-epic-soft); }
.collectible-card.rarity-border-legendary { border-color: var(--rarity-legendary-soft); }
.collectible-card.rarity-border-ninji_super_rare {
    border-image: linear-gradient(135deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end)) 1;
    border-image-slice: 1;
    border-radius: 0; /* border-image requires this */
}

/* Image container */
.collectible-image {
    width: 100px;
    height: 100px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.collectible-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Placeholder backgrounds per rarity */
.collectible-placeholder.rarity-normal { background: linear-gradient(135deg, #B3BAC4, var(--rarity-normal)); }
.collectible-placeholder.rarity-uncommon { background: linear-gradient(135deg, #4ADE80, var(--rarity-uncommon)); }
.collectible-placeholder.rarity-rare { background: linear-gradient(135deg, #60A5FA, var(--rarity-rare)); }
.collectible-placeholder.rarity-epic { background: linear-gradient(135deg, #C084FC, var(--rarity-epic)); }
.collectible-placeholder.rarity-legendary { background: linear-gradient(135deg, #FBBF24, var(--rarity-legendary)); }
.collectible-placeholder.rarity-ninji_super_rare {
    background: linear-gradient(135deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end));
    background-size: 200% 200%;
    animation: nsr-shimmer 3s ease-in-out infinite;
}

.collectible-image.locked {
    background: #D4D4D8;
    color: #71717A;
    text-shadow: none;
    font-size: 2.4rem;
}

/* Active badge on card */
.active-pfp-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--color-primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 6px rgba(255,107,157,0.4);
}

.collectible-name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    min-height: 1.2em;
}

.collectible-card.locked .collectible-name {
    color: var(--color-text-muted);
    letter-spacing: 0.15em;
}

.collectible-rarity {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.collectible-rarity.rarity-normal { color: var(--rarity-normal); }
.collectible-rarity.rarity-uncommon { color: var(--rarity-uncommon); }
.collectible-rarity.rarity-rare { color: var(--rarity-rare); }
.collectible-rarity.rarity-epic { color: var(--rarity-epic); }
.collectible-rarity.rarity-legendary { color: var(--rarity-legendary); }
.collectible-rarity.rarity-ninji_super_rare {
    background: linear-gradient(135deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-weight: 800;
}

.set-pfp-btn {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.45rem 0.9rem;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}

.set-pfp-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: scale(1.05);
}

.set-pfp-btn.active {
    background: var(--color-primary);
    color: white;
    cursor: default;
}

.set-pfp-btn.active:hover {
    transform: none;
}

/* ---- Crate opening modal ---------------------------------- */
.crate-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30, 10, 40, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.crate-modal.open {
    display: flex;
    animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.crate-modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    text-align: center;
    color: white;
}

/* Crate animation stage */
.crate-animation {
    height: 280px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crate-opening-box {
    width: 140px;
    height: 120px;
    position: relative;
    z-index: 5;
    /* Shake animation applied via .crate-modal.rarity-xxx scoping below */
}

.crate-animation.opened .crate-opening-box {
    animation: none;
}

.crate-opening-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 95px;
    background: linear-gradient(135deg, #FF6B9D 0%, #D44A7A 100%);
    border-radius: 10px 10px 14px 14px;
    box-shadow: 0 6px 0 #A83E66, 0 10px 24px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.crate-question {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
    animation: question-pulse 1.5s ease-in-out infinite;
}

.crate-animation.opened .crate-question {
    opacity: 0;
    transition: opacity 0.3s;
}

@keyframes question-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.crate-opening-lid {
    position: absolute;
    top: 0;
    left: -8px;
    right: -8px;
    height: 38px;
    background: linear-gradient(135deg, #FF85B0 0%, #E85490 100%);
    border-radius: 14px 14px 6px 6px;
    box-shadow: 0 3px 0 #C24078, 0 6px 12px rgba(0,0,0,0.15);
    z-index: 2;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.crate-opening-lid::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 8px;
    background: #F7B731;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.crate-animation.opened .crate-opening-lid {
    transform: translateY(-140px) rotate(-25deg);
}

@keyframes crate-shake {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-6px) rotate(-4deg); }
    75% { transform: translateX(6px) rotate(4deg); }
}

/* Burst particles on open */
.crate-burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
}

.crate-animation.opened .crate-burst {
    animation: burst-flash 0.9s ease-out forwards;
}

.crate-burst::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,183,77,0.6) 35%, transparent 70%);
    transform: translate(-50%, -50%);
}

.crate-animation.opened .crate-burst::before {
    animation: burst-expand 0.9s ease-out forwards;
}

@keyframes burst-flash {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes burst-expand {
    0% { width: 20px; height: 20px; opacity: 0; }
    40% { opacity: 1; }
    100% { width: 500px; height: 500px; opacity: 0; }
}

/* Result reveal */
.crate-result {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    transition: opacity 0.5s 0.2s ease, transform 0.6s 0.2s var(--bounce);
}

.crate-result.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.result-card {
    background: white;
    color: var(--color-text);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.15;
    pointer-events: none;
}

.result-card.rarity-normal::before { background: radial-gradient(circle at 50% 0%, var(--rarity-normal) 0%, transparent 60%); }
.result-card.rarity-uncommon::before { background: radial-gradient(circle at 50% 0%, var(--rarity-uncommon) 0%, transparent 60%); }
.result-card.rarity-rare::before { background: radial-gradient(circle at 50% 0%, var(--rarity-rare) 0%, transparent 60%); }
.result-card.rarity-epic::before { background: radial-gradient(circle at 50% 0%, var(--rarity-epic) 0%, transparent 60%); }
.result-card.rarity-legendary::before { background: radial-gradient(circle at 50% 0%, var(--rarity-legendary) 0%, transparent 60%); }
.result-card.rarity-ninji_super_rare::before {
    background: conic-gradient(from 0deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end), var(--rarity-nsr-start));
    opacity: 0.25;
    animation: nsr-rotate 4s linear infinite;
}

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

.result-image {
    width: 140px;
    height: 140px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-rarity {
    display: inline-block;
    padding: 0.3rem 0.9rem;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: white;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.result-rarity.rarity-normal { background: var(--rarity-normal); }
.result-rarity.rarity-uncommon { background: var(--rarity-uncommon); }
.result-rarity.rarity-rare { background: var(--rarity-rare); }
.result-rarity.rarity-epic { background: var(--rarity-epic); }
.result-rarity.rarity-legendary { background: var(--rarity-legendary); }
.result-rarity.rarity-ninji_super_rare {
    background: linear-gradient(135deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end));
    background-size: 200% 200%;
    animation: nsr-shimmer 2s ease-in-out infinite;
}

.result-name {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.result-description {
    color: var(--color-text-light);
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.result-actions .btn {
    min-width: 140px;
}

/* Empty state */
.empty-collection {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-light);
}

.empty-collection__icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

/* ---- Navbar profile picture circle ------------------------ */
.navbar-pfp {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--color-primary);
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(255,107,157,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    color: white;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.navbar-pfp img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.navbar-pfp.rarity-ninji_super_rare {
    border-image: linear-gradient(135deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end)) 1;
    border-image-slice: 1;
    border-radius: 0;
}

/* Crate count badge on navbar link */
.crate-badge {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    margin-left: 0.35rem;
    vertical-align: middle;
    animation: crate-badge-pulse 2s ease-in-out infinite;
}

@keyframes crate-badge-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(255,107,157,0.5); }
    50% { transform: scale(1.1); box-shadow: 0 0 8px rgba(255,107,157,0.6); }
}

/* ---- Account page profile picture picker ------------------ */
.pfp-section__current {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #FFE8F1 0%, white 100%);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.pfp-current-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--color-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: white;
    background: var(--color-primary-light);
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.pfp-current-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pfp-current-avatar.no-pic {
    background: #F3F4F6;
    color: var(--color-text-muted);
    border-color: #E5E7EB;
    font-size: 2rem;
}

.pfp-current-info h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}

.pfp-current-info p {
    color: var(--color-text-light);
    font-size: 0.85rem;
    margin: 0;
}

.pfp-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

.pfp-picker-item {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    background: #F9F9FB;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.pfp-picker-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pfp-picker-item:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-md);
}

.pfp-picker-item.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-light);
}

.pfp-picker-item.remove {
    background: #F3F4F6;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    border: 2px dashed #D1D5DB;
}

.pfp-picker-item.remove:hover {
    background: #FEE2E2;
    color: #EF4444;
    border-color: #EF4444;
}

.pfp-picker-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-text-light);
}

.pfp-picker-empty a {
    color: var(--color-primary);
    font-weight: 700;
}

/* ---- Responsive ------------------------------------------- */
@media (max-width: 640px) {
    .collectibles-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.75rem;
    }

    .collectible-image {
        width: 80px;
        height: 80px;
        font-size: 1.6rem;
    }

    .crates-grid {
        flex-direction: column;
        align-items: stretch;
    }

    .crate-card {
        min-width: auto;
    }

    .rarity-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .result-image {
        width: 110px;
        height: 110px;
        font-size: 2.4rem;
    }
}

/* ============================================================
   PUBLIC FUNNEL (anonymous / logged-out visitors)
   ============================================================ */

.collectibles-funnel {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: var(--navbar-height);
}

/* ---- Hero ------------------------------------------------- */
.funnel-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #FFE8F1 0%, #FFF5F9 50%, #F3E8FF 100%);
    padding: 4rem 1.5rem 5rem;
    border-radius: var(--radius-lg);
    margin: 1.5rem 1rem 3rem;
    text-align: center;
}

.funnel-hero::before,
.funnel-hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
    pointer-events: none;
}

.funnel-hero::before {
    width: 320px;
    height: 320px;
    background: var(--rarity-nsr-start);
    top: -80px;
    left: -80px;
}

.funnel-hero::after {
    width: 280px;
    height: 280px;
    background: var(--rarity-nsr-mid);
    bottom: -80px;
    right: -80px;
}

.funnel-hero__inner {
    position: relative;
    z-index: 1;
    max-width: 780px;
    margin: 0 auto;
}

.funnel-hero__badge {
    display: inline-block;
    background: white;
    color: var(--color-primary);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-card);
}

.funnel-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 5.5vw, 4rem);
    line-height: 1.05;
    margin: 0 0 1rem;
    color: var(--color-text);
}

.funnel-hero__accent {
    background: linear-gradient(135deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: nsr-shimmer 4s ease-in-out infinite;
}

.funnel-hero__lead {
    font-size: 1.15rem;
    color: var(--color-text-light);
    margin: 0 auto 2rem;
    max-width: 580px;
    line-height: 1.55;
}

.funnel-hero__cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.btn.btn-xl {
    padding: 1.05rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: var(--radius-full);
}

.funnel-hero__login {
    color: var(--color-text-light);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border-bottom: 1px dashed var(--color-text-light);
    padding-bottom: 2px;
    transition: color 0.2s;
}

.funnel-hero__login:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.funnel-hero__stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 107, 157, 0.15);
}

.funnel-hero__stats > div {
    text-align: center;
}

.funnel-hero__stats strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-primary);
    line-height: 1;
}

.funnel-hero__stats span {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    margin-top: 0.3rem;
}

/* ---- Compact hero (single-panel funnel) ------------------- */
.funnel-hero--compact {
    padding-bottom: 2.5rem;
}

.funnel-hero--compact .funnel-hero__inner {
    max-width: 920px;
}

.funnel-hero__crates {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: clamp(220px, 36vw, 420px);
    height: auto;
    z-index: 1;
    pointer-events: none;
    filter: drop-shadow(0 8px 20px rgba(200, 80, 140, 0.22));
}

/* ---- Embedded carousel (inside hero) ---------------------- */
.funnel-carousel--embedded {
    margin-top: 2rem;
    padding: 0.5rem 0;
}

.funnel-carousel--embedded .funnel-carousel__track {
    gap: 1rem;
    animation-duration: 35s;
}

.mystery-card--sm {
    flex: 0 0 140px;
    padding: 0.9rem 0.75rem;
    border-width: 2px;
}

.mystery-card--sm .mystery-card__image {
    width: 82px;
    height: 82px;
    margin-bottom: 0.65rem;
}

.mystery-card--sm .mystery-question {
    font-size: 2.75rem;
}

.mystery-card--sm .mystery-card__label {
    margin-bottom: 0;
}

.mystery-card--sm .rarity-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
}

/* ---- Section headers -------------------------------------- */
.funnel-section-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 0 1.5rem;
}

.funnel-section-header h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    margin: 0 0 0.75rem;
}

.funnel-section-header__accent {
    color: var(--color-primary);
}

.funnel-section-header p {
    color: var(--color-text-light);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto;
}

/* ---- Mystery carousel ------------------------------------- */
.funnel-carousel-section {
    padding: 3rem 0;
    overflow: hidden;
}

.funnel-carousel {
    position: relative;
    overflow: hidden;
    padding: 1.5rem 0;
    mask-image: linear-gradient(90deg, transparent 0%, black 8%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 8%, black 92%, transparent 100%);
}

.funnel-carousel__track {
    display: flex;
    gap: 1.5rem;
    width: max-content;
    animation: funnel-scroll 30s linear infinite;
}

.funnel-carousel:hover .funnel-carousel__track {
    animation-play-state: paused;
}

@keyframes funnel-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.mystery-card {
    flex: 0 0 220px;
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    border: 3px solid transparent;
    transition: transform 0.3s ease;
}

.mystery-card:hover {
    transform: translateY(-6px) rotate(-1deg);
}

.mystery-card__glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.4;
    background: radial-gradient(circle at 50% 30%, currentColor 0%, transparent 60%);
}

.mystery-card__image {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
}

.mystery-question {
    position: relative;
    z-index: 1;
    font-family: var(--font-heading);
    font-size: 4.5rem;
    font-weight: 900;
    color: rgba(0,0,0,0.15);
    animation: mystery-pulse 2s ease-in-out infinite;
}

@keyframes mystery-pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50%      { transform: scale(1.05); opacity: 0.7; }
}

.mystery-card__label {
    margin-bottom: 0.5rem;
}

.mystery-card__count {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-weight: 600;
}

/* Rarity glow colors for mystery cards */
.rarity-card-normal            { color: var(--rarity-normal); border-color: var(--rarity-normal-soft); }
.rarity-card-uncommon          { color: var(--rarity-uncommon); border-color: var(--rarity-uncommon-soft); }
.rarity-card-rare              { color: var(--rarity-rare); border-color: var(--rarity-rare-soft); }
.rarity-card-epic              { color: var(--rarity-epic); border-color: var(--rarity-epic-soft); }
.rarity-card-legendary         { color: var(--rarity-legendary); border-color: var(--rarity-legendary-soft); }
.rarity-card-ninji_super_rare  {
    color: var(--rarity-nsr-start);
    border-image: linear-gradient(135deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end)) 1;
    border-image-slice: 1;
}

/* Mystery image background per rarity (subtle tint) */
.rarity-card-normal           .mystery-card__image { background: linear-gradient(135deg, #F3F4F6, var(--rarity-normal-soft)); }
.rarity-card-uncommon         .mystery-card__image { background: linear-gradient(135deg, #F3F4F6, var(--rarity-uncommon-soft)); }
.rarity-card-rare             .mystery-card__image { background: linear-gradient(135deg, #F3F4F6, var(--rarity-rare-soft)); }
.rarity-card-epic             .mystery-card__image { background: linear-gradient(135deg, #F3F4F6, var(--rarity-epic-soft)); }
.rarity-card-legendary        .mystery-card__image { background: linear-gradient(135deg, #F3F4F6, var(--rarity-legendary-soft)); }
.rarity-card-ninji_super_rare .mystery-card__image {
    background: conic-gradient(from 0deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end), var(--rarity-nsr-start));
    animation: nsr-rotate 6s linear infinite;
}
.rarity-card-ninji_super_rare .mystery-question {
    color: rgba(255,255,255,0.85);
}

@keyframes nsr-rotate {
    to { transform: rotate(1turn); }
}
.rarity-card-ninji_super_rare .mystery-card__image {
    transform-origin: center;
}

/* ---- Steps section ---------------------------------------- */
.funnel-steps-section {
    padding: 3rem 1.5rem;
}

.funnel-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.funnel-step {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 2px solid var(--color-primary-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.funnel-step:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.funnel-step__number {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #D44A7A);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 #A83E66, 0 6px 12px rgba(0,0,0,0.1);
}

.funnel-step__icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.funnel-step h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin: 0 0 0.6rem;
}

.funnel-step p {
    color: var(--color-text-light);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0;
}

/* ---- Rarities breakdown ----------------------------------- */
.funnel-rarities-section {
    padding: 3rem 1.5rem;
}

.funnel-rarities {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.funnel-rarity {
    display: grid;
    grid-template-columns: 160px 1fr 100px;
    align-items: center;
    gap: 1rem;
    background: white;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    box-shadow: var(--shadow-card);
}

.funnel-rarity__bar {
    height: 10px;
    border-radius: var(--radius-full);
    background: #F3F4F6;
    overflow: hidden;
    position: relative;
}

.funnel-rarity__fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
}

.rarity-fill-normal           { width: 85%; background: var(--rarity-normal); }
.rarity-fill-uncommon         { width: 65%; background: var(--rarity-uncommon); }
.rarity-fill-rare             { width: 45%; background: var(--rarity-rare); }
.rarity-fill-epic             { width: 28%; background: var(--rarity-epic); }
.rarity-fill-legendary        { width: 14%; background: var(--rarity-legendary); }
.rarity-fill-ninji_super_rare {
    width: 6%;
    background: linear-gradient(90deg, var(--rarity-nsr-start), var(--rarity-nsr-mid), var(--rarity-nsr-end));
    background-size: 200% 100%;
    animation: nsr-shimmer 3s ease-in-out infinite;
}

.funnel-rarity__count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-light);
    text-align: right;
}

/* ---- Final CTA -------------------------------------------- */
.funnel-final-cta {
    margin: 3rem 1rem 4rem;
    padding: 4rem 1.5rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #FF6B9D 0%, #C084FC 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
    color: white;
}

.funnel-final-cta::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.2), transparent);
    pointer-events: none;
}

.funnel-final-cta__inner {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
}

.funnel-final-cta h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    margin: 0 0 0.75rem;
    color: white;
}

.funnel-final-cta .funnel-hero__accent {
    background: linear-gradient(135deg, #FFE8B0, #FFF);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.funnel-final-cta p {
    font-size: 1.05rem;
    opacity: 0.95;
    margin: 0 0 1.75rem;
}

.funnel-final-cta .btn-primary {
    background: white;
    color: var(--color-primary);
    box-shadow: 0 4px 0 rgba(0,0,0,0.12);
}

.funnel-final-cta .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0,0,0,0.12);
}

.funnel-final-cta__small {
    margin-top: 1rem !important;
    font-size: 0.85rem !important;
    opacity: 0.8 !important;
}

/* ---- Responsive ------------------------------------------- */
@media (max-width: 768px) {
    .funnel-hero {
        padding: 3rem 1rem 3.5rem;
        margin: 1rem 0.5rem 2rem;
    }

    .funnel-hero--compact {
        padding-bottom: 2rem;
    }

    .funnel-hero__stats {
        gap: 1.5rem;
    }

    .funnel-hero__stats strong {
        font-size: 1.5rem;
    }

    .funnel-hero__crates {
        width: 180px;
        bottom: -6px;
        right: -6px;
        opacity: 0.92;
    }

    .funnel-steps {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .mystery-card {
        flex: 0 0 180px;
        padding: 1.25rem 1rem;
    }

    .mystery-card--sm {
        flex: 0 0 120px;
        padding: 0.75rem 0.6rem;
    }

    .mystery-card--sm .mystery-card__image {
        width: 70px;
        height: 70px;
    }

    .mystery-card--sm .mystery-question {
        font-size: 2.25rem;
    }

    .mystery-card__image {
        width: 110px;
        height: 110px;
    }

    .mystery-question {
        font-size: 3.5rem;
    }

    .funnel-rarity {
        grid-template-columns: 110px 1fr 75px;
        gap: 0.75rem;
        padding: 0.6rem 0.9rem;
    }

    .funnel-final-cta {
        margin: 2rem 0.5rem 3rem;
        padding: 3rem 1.25rem;
    }
}

/* =====================================================================
   RARITY-TIERED CRATE OPENING ANIMATIONS
   Six escalating tiers: normal → uncommon → rare → epic → legendary → NSR
   Each tier adds visual layers: aura, light-pillar, shockwaves, particles,
   banner, flash. Timing tuned to build anticipation for higher rarities.
===================================================================== */

/* ---- Modal backdrop darkens with rarity ---- */
.crate-modal.rarity-epic            { background: rgba(25, 10, 35, 0.93); }
.crate-modal.rarity-legendary       { background: rgba(15,  8, 20, 0.96); transition: background 1s ease; }
.crate-modal.rarity-ninji_super_rare{ background: rgba(5,   0, 12, 0.98); transition: background 1s ease; }

/* ---- Full-screen flash overlay (legendary + NSR only) ---- */
.crate-flash {
    position: fixed;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
}
.crate-modal.rarity-legendary.opened .crate-flash      { animation: crate-flash-gold 0.5s ease-out forwards; animation-delay: 0.05s; }
.crate-modal.rarity-ninji_super_rare.opened .crate-flash { animation: crate-flash-nsr  1.0s ease-out forwards; animation-delay: 0s; }

@keyframes crate-flash-gold {
    0%   { opacity: 0; background: white; }
    40%  { opacity: 0.75; background: #FFF4CC; }
    100% { opacity: 0; background: white; }
}
@keyframes crate-flash-nsr {
    0%   { opacity: 0; background: white; }
    20%  { opacity: 0.95; background: white; }
    50%  { opacity: 0.6; background: #FFD4F0; }
    75%  { opacity: 0.35; background: #E0D4FF; }
    100% { opacity: 0; background: white; }
}

/* ---- Aura (pulsing halo under the crate) ---- */
.crate-aura {
    position: absolute;
    top: 50%; left: 50%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.6);
    z-index: 0;
}
/* Normal: no aura */
/* Uncommon: gentle green pulse */
.crate-modal.rarity-uncommon .crate-aura {
    background: radial-gradient(circle, var(--rarity-uncommon-glow) 0%, rgba(34,197,94,0.2) 40%, transparent 70%);
    animation: aura-breathe 1.6s ease-in-out infinite;
    opacity: 1;
}
/* Rare: stronger blue */
.crate-modal.rarity-rare .crate-aura {
    width: 260px; height: 260px;
    background: radial-gradient(circle, var(--rarity-rare-glow) 0%, rgba(59,130,246,0.25) 45%, transparent 75%);
    animation: aura-breathe-strong 1.3s ease-in-out infinite;
    opacity: 1;
    filter: blur(4px);
}
/* Epic: purple swirl */
.crate-modal.rarity-epic .crate-aura {
    width: 360px; height: 360px;
    background: radial-gradient(circle, var(--rarity-epic-glow) 0%, rgba(168,85,247,0.4) 30%, transparent 70%);
    animation: aura-swirl-epic 1.2s ease-in-out infinite;
    opacity: 1;
    filter: blur(10px);
}
/* Legendary: growing gold aura */
.crate-modal.rarity-legendary .crate-aura {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(255,215,0,0.7) 0%, rgba(255,160,0,0.5) 25%, rgba(255,200,50,0.2) 55%, transparent 85%);
    animation: aura-grow-gold 2.5s ease-in-out infinite;
    opacity: 1;
    filter: blur(14px);
}
/* NSR: no aura — uses constant confetti loop instead (see .confetti-loop below) */
.crate-modal.rarity-ninji_super_rare .crate-aura { display: none; }

@keyframes aura-breathe {
    0%,100% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.85); }
    50%     { opacity: 0.8;  transform: translate(-50%, -50%) scale(1.05); }
}
@keyframes aura-breathe-strong {
    0%,100% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.85); }
    50%     { opacity: 0.95; transform: translate(-50%, -50%) scale(1.15); }
}
@keyframes aura-swirl-epic {
    0%,100% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.9)  rotate(0deg); }
    50%     { opacity: 1;   transform: translate(-50%, -50%) scale(1.15) rotate(180deg); }
}
@keyframes aura-grow-gold {
    0%      { opacity: 0.5; transform: translate(-50%, -50%) scale(0.7)  rotate(0deg); }
    60%     { opacity: 1;   transform: translate(-50%, -50%) scale(1.15) rotate(200deg); }
    100%    { opacity: 0.7; transform: translate(-50%, -50%) scale(1.3)  rotate(360deg); }
}
/* ---- Constant confetti loop (NSR only, full-modal) ---- */
.confetti-loop {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
}
.crate-modal.rarity-ninji_super_rare .confetti-loop { opacity: 1; }

.confetti-piece {
    position: absolute;
    top: -40px;
    --fall-dur: 3s;
    --fall-delay: 0s;
    --sway: 0px;
    --rot-start: 0deg;
    --rot-end: 720deg;
    animation: confetti-fall var(--fall-dur) linear var(--fall-delay) infinite;
    will-change: transform, opacity;
}
.confetti-piece--rect   { width: 10px; height: 16px; border-radius: 1px; }
.confetti-piece--ribbon { width: 6px;  height: 22px; border-radius: 2px; }
.confetti-piece--circle { width: 10px; height: 10px; border-radius: 50%; }

@keyframes confetti-fall {
    0% {
        transform: translateY(0) translateX(0) rotate(var(--rot-start));
        opacity: 0;
    }
    8% { opacity: 1; }
    92% { opacity: 1; }
    100% {
        transform: translateY(115vh) translateX(var(--sway)) rotate(var(--rot-end));
        opacity: 0;
    }
}

/* ---- Rarity-scoped crate shake (single long keyframe with intensity ramp) ---- */
.crate-modal.rarity-normal .crate-opening-box           { animation: crate-shake-normal 1.4s ease-in-out 1 forwards; }
.crate-modal.rarity-uncommon .crate-opening-box         { animation: crate-shake-uncommon 1.6s ease-in-out 1 forwards; }
.crate-modal.rarity-rare .crate-opening-box             { animation: crate-shake-rare 2.0s ease-in-out 1 forwards; }
.crate-modal.rarity-epic .crate-opening-box             { animation: crate-shake-epic 2.8s ease-in-out 1 forwards; }
.crate-modal.rarity-legendary .crate-opening-box        { animation: crate-shake-legendary 3.5s ease-in-out 1 forwards; }
.crate-modal.rarity-ninji_super_rare .crate-opening-box { animation: crate-shake-nsr 4.5s linear 1 forwards; }

/* After opening, freeze */
.crate-animation.opened .crate-opening-box { animation: none !important; }

@keyframes crate-shake-normal {
    0%, 100% { transform: translateX(0) rotate(0); }
    30%      { transform: translateX(-5px) rotate(-3deg); }
    70%      { transform: translateX(5px) rotate(3deg); }
}
@keyframes crate-shake-uncommon {
    0%,100% { transform: translateX(0) rotate(0); }
    20%     { transform: translateX(-5px) rotate(-3deg); }
    45%     { transform: translateX(6px)  rotate(4deg); }
    70%     { transform: translateX(-5px) rotate(-3deg); }
    90%     { transform: translateX(5px)  rotate(3deg); }
}
@keyframes crate-shake-rare {
    0%,98%,100% { transform: translateX(0) rotate(0); }
    10% { transform: translateX(-3px) rotate(-2deg); }
    25% { transform: translateX(4px)  rotate(2deg); }
    45% { transform: translateX(-5px) rotate(-3deg); }
    65% { transform: translateX(6px)  rotate(3deg); }
    80% { transform: translateX(-8px) rotate(-5deg); }
    92% { transform: translateX(8px)  rotate(5deg); }
}
@keyframes crate-shake-epic {
    0%,98%,100% { transform: translateX(0) rotate(0) scale(1); }
    8%  { transform: translateX(-2px) rotate(-1deg); }
    18% { transform: translateX(3px)  rotate(1deg); }
    30% { transform: translateX(-4px) rotate(-2deg); }
    42% { transform: translateX(5px)  rotate(2deg) scale(1.02); }
    55% { transform: translateX(-7px) rotate(-4deg); }
    67% { transform: translateX(7px)  rotate(4deg) scale(1.04); }
    80% { transform: translateX(-10px) rotate(-6deg); }
    92% { transform: translateX(11px) rotate(6deg) scale(1.06); }
}
@keyframes crate-shake-legendary {
    0%,99%,100% { transform: translateX(0) rotate(0) scale(1); }
    6%  { transform: translateX(-2px) rotate(-1deg); }
    12% { transform: translateX(3px)  rotate(1deg); }
    22% { transform: translateX(-4px) rotate(-2deg) scale(1.02); }
    32% { transform: translateX(5px)  rotate(2deg); }
    44% { transform: translateX(-7px) rotate(-4deg) scale(1.04); }
    56% { transform: translateX(8px)  rotate(4deg); }
    68% { transform: translateX(-11px) rotate(-6deg) scale(1.07); }
    79% { transform: translateX(12px)  rotate(6deg); }
    88% { transform: translateX(-15px) rotate(-9deg) scale(1.12); }
    95% { transform: translateX(15px)  rotate(9deg) scale(1.15); }
}
@keyframes crate-shake-nsr {
    0%,99%,100% { transform: translateX(0) rotate(0) scale(1); filter: hue-rotate(0deg) brightness(1); }
    5%  { transform: translateX(-2px) rotate(-1deg); filter: hue-rotate(30deg); }
    12% { transform: translateX(3px)  rotate(2deg); filter: hue-rotate(70deg); }
    20% { transform: translateX(-4px) rotate(-2deg) scale(1.02); filter: hue-rotate(120deg); }
    28% { transform: translateX(5px)  rotate(3deg); filter: hue-rotate(170deg); }
    38% { transform: translateX(-7px) rotate(-4deg) scale(1.04); filter: hue-rotate(220deg); }
    48% { transform: translateX(8px)  rotate(4deg); filter: hue-rotate(260deg); }
    58% { transform: translateX(-11px) rotate(-6deg) scale(1.08); filter: hue-rotate(310deg); }
    68% { transform: translateX(13px)  rotate(7deg); filter: hue-rotate(360deg) brightness(1.2); }
    78% { transform: translateX(-16px) rotate(-10deg) scale(1.14); filter: hue-rotate(180deg) brightness(1.4); }
    88% { transform: translateX(18px)  rotate(11deg) scale(1.18); filter: hue-rotate(320deg) brightness(1.5); }
    95% { transform: translateX(-20px) rotate(-12deg) scale(1.22); filter: hue-rotate(60deg)  brightness(1.6); }
}

/* ---- Light pillar (beam shooting up from crate) ---- */
.crate-light-pillar {
    position: absolute;
    left: 50%;
    bottom: 45%;
    width: 60px;
    height: 0;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    z-index: 1;
}
/* Normal + uncommon: no pillar */
.crate-modal.rarity-rare .crate-animation.opened .crate-light-pillar {
    background: linear-gradient(to top, transparent, var(--rarity-rare) 40%, transparent);
    animation: pillar-shoot 0.9s ease-out forwards;
}
.crate-modal.rarity-epic .crate-animation.opened .crate-light-pillar {
    width: 100px;
    background: linear-gradient(to top, transparent, var(--rarity-epic) 35%, rgba(168,85,247,0.4) 70%, transparent);
    animation: pillar-shoot-strong 1.2s ease-out forwards;
    filter: blur(1px);
}
.crate-modal.rarity-legendary .crate-animation.opened .crate-light-pillar {
    width: 180px;
    background: linear-gradient(to top, transparent 0%, rgba(255,215,0,0.3) 8%, #FFD700 30%, rgba(255,180,40,0.7) 70%, transparent 100%);
    animation: pillar-shoot-massive 1.6s ease-out forwards;
    filter: blur(2px) brightness(1.3);
}
.crate-modal.rarity-ninji_super_rare .crate-animation.opened .crate-light-pillar {
    width: 260px;
    background: linear-gradient(to top, transparent 0%, white 5%, var(--rarity-nsr-start) 20%, var(--rarity-nsr-mid) 45%, var(--rarity-nsr-end) 70%, transparent 100%);
    animation: pillar-shoot-nsr 2s ease-out forwards;
    filter: blur(3px) brightness(1.4);
}

@keyframes pillar-shoot {
    0%   { height: 0; opacity: 0; }
    30%  { height: 320px; opacity: 0.9; }
    100% { height: 400px; opacity: 0; }
}
@keyframes pillar-shoot-strong {
    0%   { height: 0; opacity: 0; }
    25%  { height: 420px; opacity: 1; }
    100% { height: 500px; opacity: 0; }
}
@keyframes pillar-shoot-massive {
    0%   { height: 0; opacity: 0; }
    20%  { height: 520px; opacity: 1; }
    65%  { height: 620px; opacity: 0.85; }
    100% { height: 720px; opacity: 0; }
}
@keyframes pillar-shoot-nsr {
    0%   { height: 0; opacity: 0; }
    15%  { height: 700px; opacity: 1; }
    50%  { height: 820px; opacity: 1; }
    100% { height: 900px; opacity: 0; }
}

/* ---- Shockwave rings ---- */
.crate-shockwaves {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
.shockwave {
    position: absolute;
    top: 50%; left: 50%;
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 3px solid white;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
}

/* Hide shockwaves on lower tiers */
.crate-modal.rarity-normal .shockwave,
.crate-modal.rarity-uncommon .shockwave { display: none; }
.crate-modal.rarity-rare .shockwave--3,
.crate-modal.rarity-rare .shockwave--4,
.crate-modal.rarity-rare .shockwave--5 { display: none; }
.crate-modal.rarity-epic .shockwave--4,
.crate-modal.rarity-epic .shockwave--5 { display: none; }
.crate-modal.rarity-legendary .shockwave--5 { display: none; }

/* Color shockwaves per rarity */
.crate-modal.rarity-rare      .shockwave { border-color: var(--rarity-rare); border-width: 3px; }
.crate-modal.rarity-epic      .shockwave { border-color: var(--rarity-epic); border-width: 3px; box-shadow: 0 0 12px var(--rarity-epic-glow); }
.crate-modal.rarity-legendary .shockwave { border-color: var(--rarity-legendary); border-width: 4px; box-shadow: 0 0 18px var(--rarity-legendary-glow); }
.crate-modal.rarity-ninji_super_rare .shockwave             { border-width: 4px; }
.crate-modal.rarity-ninji_super_rare .shockwave--1          { border-color: var(--rarity-nsr-start); box-shadow: 0 0 20px var(--rarity-nsr-start); }
.crate-modal.rarity-ninji_super_rare .shockwave--2          { border-color: var(--rarity-nsr-mid);   box-shadow: 0 0 20px var(--rarity-nsr-mid); }
.crate-modal.rarity-ninji_super_rare .shockwave--3          { border-color: var(--rarity-nsr-end);   box-shadow: 0 0 20px var(--rarity-nsr-end); }
.crate-modal.rarity-ninji_super_rare .shockwave--4          { border-color: var(--rarity-nsr-start); box-shadow: 0 0 20px var(--rarity-nsr-start); }
.crate-modal.rarity-ninji_super_rare .shockwave--5          { border-color: var(--rarity-nsr-mid);   box-shadow: 0 0 20px var(--rarity-nsr-mid); }

.crate-animation.opened .shockwave--1 { animation: shockwave-ring 1.3s ease-out 0.00s forwards; }
.crate-animation.opened .shockwave--2 { animation: shockwave-ring 1.3s ease-out 0.18s forwards; }
.crate-animation.opened .shockwave--3 { animation: shockwave-ring 1.3s ease-out 0.36s forwards; }
.crate-animation.opened .shockwave--4 { animation: shockwave-ring 1.4s ease-out 0.55s forwards; }
.crate-animation.opened .shockwave--5 { animation: shockwave-ring 1.5s ease-out 0.75s forwards; }

@keyframes shockwave-ring {
    0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(0); }
    100% { opacity: 0;   transform: translate(-50%, -50%) scale(7); }
}

/* ---- Rarity banner (LEGENDARY!! / NINJI SUPER RARE!!) ----
   NOTE: deliberately NO text-shadow — the base color uses background-clip: text
   with -webkit-text-fill-color: transparent. A dark text-shadow would render as
   a dirty offset silhouette. All glow comes from filter: drop-shadow() layers. */
.crate-rarity-banner {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 2.4rem;
    letter-spacing: 0.18em;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}
/* Normal through epic: no banner */
.crate-modal.rarity-normal .crate-rarity-banner,
.crate-modal.rarity-uncommon .crate-rarity-banner,
.crate-modal.rarity-rare .crate-rarity-banner,
.crate-modal.rarity-epic .crate-rarity-banner { display: none; }

/* Legendary: molten-gold shimmer with layered bright halo (no dark edge) */
.crate-modal.rarity-legendary .crate-rarity-banner {
    background: linear-gradient(110deg,
        #FFF8DC 0%,
        #FFE066 12%,
        #FFD700 28%,
        #FFB800 45%,
        #FFD700 62%,
        #FFE066 80%,
        #FFF8DC 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter:
        drop-shadow(0 0 6px rgba(255, 235, 120, 1))
        drop-shadow(0 0 14px rgba(255, 200, 40, 0.95))
        drop-shadow(0 0 28px rgba(255, 170, 0, 0.75))
        drop-shadow(0 0 46px rgba(255, 215, 0, 0.45));
}

/* NSR: rainbow shimmer with multi-color halo (no dark edge) */
.crate-modal.rarity-ninji_super_rare .crate-rarity-banner {
    font-size: 2.5rem;
    background: linear-gradient(110deg,
        #FFE8F5 0%,
        var(--rarity-nsr-start) 18%,
        var(--rarity-nsr-mid) 42%,
        #FFFFFF 52%,
        var(--rarity-nsr-mid) 62%,
        var(--rarity-nsr-end) 82%,
        #FFE8F5 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter:
        drop-shadow(0 0 8px rgba(255, 255, 255, 0.95))
        drop-shadow(0 0 16px rgba(255, 107, 157, 0.95))
        drop-shadow(0 0 28px rgba(192, 132, 252, 0.8))
        drop-shadow(0 0 50px rgba(245, 158, 11, 0.55));
}

.crate-modal.rarity-legendary .crate-animation.opened .crate-rarity-banner,
.crate-modal.rarity-ninji_super_rare .crate-animation.opened .crate-rarity-banner {
    animation: banner-punch 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               banner-shimmer 2.2s ease-in-out 0.7s infinite;
}

@keyframes banner-punch {
    0%   { transform: translate(-50%, -50%) scale(0)   rotate(-12deg); opacity: 0; }
    40%  { transform: translate(-50%, -50%) scale(1.3) rotate(4deg);   opacity: 1; }
    65%  { transform: translate(-50%, -50%) scale(0.94) rotate(-2deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1)   rotate(0);      opacity: 1; }
}
@keyframes banner-shimmer {
    0%,100% { background-position: 0% 50%; }
    50%     { background-position: 100% 50%; }
}

/* ---- Banner sparkles (legendary + NSR only) ---- */
.banner-sparkles {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 480px;
    max-width: 92vw;
    height: 170px;
    pointer-events: none;
    opacity: 0;
    z-index: 21;
    display: none;
}
.crate-modal.rarity-legendary .banner-sparkles,
.crate-modal.rarity-ninji_super_rare .banner-sparkles { display: block; }
.crate-modal.rarity-legendary.opened .banner-sparkles,
.crate-modal.rarity-ninji_super_rare.opened .banner-sparkles { opacity: 1; transition: opacity 0.4s 0.3s ease-out; }

.banner-sparkle {
    position: absolute;
    width: 22px;
    height: 22px;
    /* 4-point star shape with tight waist — classic sparkle */
    clip-path: polygon(50% 0%, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0% 50%, 42% 42%);
    transform: scale(0) rotate(0deg);
    opacity: 0;
}

/* Rarity-specific sparkle color + glow */
.crate-modal.rarity-legendary .banner-sparkle {
    background: radial-gradient(circle, #FFFBEB 0%, #FFD700 45%, #FFA500 80%, transparent 95%);
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.95))
            drop-shadow(0 0 14px rgba(255, 180, 0, 0.6));
}
.crate-modal.rarity-ninji_super_rare .banner-sparkle {
    background: radial-gradient(circle, #FFFFFF 0%, #FFD4F0 40%, var(--rarity-nsr-mid) 75%, transparent 95%);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 1))
            drop-shadow(0 0 14px rgba(255, 107, 157, 0.7));
}

/* 10 sparkles positioned around the banner, each twinkles with different timing */
.banner-sparkle--1  { top: 8%;   left: 6%;   width: 26px; height: 26px; animation: sparkle-twinkle 1.6s ease-in-out 0.00s infinite; }
.banner-sparkle--2  { top: 22%;  left: 92%;  width: 18px; height: 18px; animation: sparkle-twinkle 1.4s ease-in-out 0.25s infinite; }
.banner-sparkle--3  { top: 72%;  left: 8%;   width: 20px; height: 20px; animation: sparkle-twinkle 1.5s ease-in-out 0.55s infinite; }
.banner-sparkle--4  { top: 80%;  left: 86%;  width: 24px; height: 24px; animation: sparkle-twinkle 1.3s ease-in-out 0.90s infinite; }
.banner-sparkle--5  { top: 5%;   left: 42%;  width: 16px; height: 16px; animation: sparkle-twinkle 1.7s ease-in-out 0.40s infinite; }
.banner-sparkle--6  { top: 90%;  left: 55%;  width: 22px; height: 22px; animation: sparkle-twinkle 1.5s ease-in-out 0.15s infinite; }
.banner-sparkle--7  { top: 18%;  left: 76%;  width: 14px; height: 14px; animation: sparkle-twinkle 1.2s ease-in-out 0.75s infinite; }
.banner-sparkle--8  { top: 55%;  left: 2%;   width: 20px; height: 20px; animation: sparkle-twinkle 1.6s ease-in-out 1.10s infinite; }
.banner-sparkle--9  { top: 38%;  left: 98%;  width: 16px; height: 16px; animation: sparkle-twinkle 1.4s ease-in-out 0.60s infinite; }
.banner-sparkle--10 { top: 62%;  left: 48%;  width: 18px; height: 18px; animation: sparkle-twinkle 1.3s ease-in-out 1.30s infinite; }

@keyframes sparkle-twinkle {
    0%, 100% { transform: scale(0)   rotate(0deg);   opacity: 0; }
    40%      { transform: scale(1.2) rotate(140deg); opacity: 1; }
    60%      { transform: scale(1.2) rotate(220deg); opacity: 1; }
    90%      { transform: scale(0.3) rotate(330deg); opacity: 0.4; }
}

/* ---- Particles (JS-spawned individual elements) ---- */
.crate-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}
.crate-particle {
    position: absolute;
    top: 50%; left: 50%;
    pointer-events: none;
    opacity: 0;
    --angle: 0deg;
    --dist: 200px;
    --delay: 0s;
    --dur: 1.2s;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0) scale(0.3);
}
.crate-animation.opened .crate-particle {
    animation: particle-fly var(--dur) cubic-bezier(0.2, 0.7, 0.4, 1) var(--delay) forwards;
}

@keyframes particle-fly {
    0%   { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0) scale(0.3); }
    18%  { opacity: 1; }
    85%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(var(--dist) * -1)) scale(1); }
}

/* Particle shapes */
.crate-particle--dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 10px rgba(255,255,255,0.9);
}
.crate-particle--spark {
    width: 4px; height: 18px;
    background: linear-gradient(to bottom, white 0%, rgba(255,255,255,0.3) 60%, transparent 100%);
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(255,255,255,0.8);
}
.crate-particle--star {
    width: 18px; height: 18px;
    background: #FFD700;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: 0 0 14px rgba(255,215,0,0.9);
}
.crate-particle--conf-a { width: 10px; height: 14px; background: var(--rarity-nsr-start); box-shadow: 0 0 8px var(--rarity-nsr-start); }
.crate-particle--conf-b { width: 10px; height: 14px; background: var(--rarity-nsr-mid);   box-shadow: 0 0 8px var(--rarity-nsr-mid); }
.crate-particle--conf-c { width: 10px; height: 14px; background: var(--rarity-nsr-end);   box-shadow: 0 0 8px var(--rarity-nsr-end); }

/* Rarity-specific particle tint */
.crate-modal.rarity-uncommon .crate-particle--dot { background: #86EFAC; box-shadow: 0 0 10px var(--rarity-uncommon-glow); }
.crate-modal.rarity-rare .crate-particle--dot     { background: #93C5FD; box-shadow: 0 0 10px var(--rarity-rare-glow); }
.crate-modal.rarity-rare .crate-particle--spark   { background: linear-gradient(to bottom, white, var(--rarity-rare), transparent); }
.crate-modal.rarity-epic .crate-particle--dot     { background: #D8B4FE; box-shadow: 0 0 12px var(--rarity-epic-glow); }
.crate-modal.rarity-epic .crate-particle--spark   { background: linear-gradient(to bottom, white, var(--rarity-epic), transparent); }
.crate-modal.rarity-epic .crate-particle--star    { background: var(--rarity-epic); box-shadow: 0 0 14px var(--rarity-epic-glow); }
.crate-modal.rarity-legendary .crate-particle--dot   { background: #FDE68A; box-shadow: 0 0 14px var(--rarity-legendary-glow); }
.crate-modal.rarity-legendary .crate-particle--spark { background: linear-gradient(to bottom, white, var(--rarity-legendary), transparent); }
.crate-modal.rarity-legendary .crate-particle--star  { background: #FFD700; box-shadow: 0 0 16px rgba(255,215,0,0.9); }

/* ---- Result card enhancements for legendary + NSR ---- */
.result-card.rarity-legendary {
    box-shadow:
        0 0 0 2px rgba(245,158,11,0.35),
        0 0 40px rgba(245,158,11,0.5),
        0 10px 40px rgba(245,158,11,0.25);
}
.result-card.rarity-ninji_super_rare {
    box-shadow:
        0 0 60px rgba(255,107,157,0.5),
        0 0 100px rgba(192,132,252,0.35),
        0 10px 50px rgba(245,158,11,0.25);
}

/* Shine sweep on the result card */
.result-card.rarity-legendary::after,
.result-card.rarity-ninji_super_rare::after {
    content: '';
    position: absolute;
    top: 0; left: -120%;
    width: 80%;
    height: 100%;
    background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,0.55) 50%, transparent 100%);
    pointer-events: none;
    z-index: 3;
    transform: skewX(-18deg);
}
.crate-result.revealed .result-card.rarity-legendary::after {
    animation: card-shine 2.2s ease-in-out 0.4s 2;
}
.crate-result.revealed .result-card.rarity-ninji_super_rare::after {
    animation: card-shine 1.9s ease-in-out 0.3s infinite;
}
@keyframes card-shine {
    0%   { left: -120%; }
    100% { left: 130%; }
}

/* NSR result image gets spinning conic border */
.result-card.rarity-ninji_super_rare .result-image {
    border: 4px solid transparent;
    background: white;
    background-clip: padding-box;
    position: relative;
    box-shadow: 0 0 30px rgba(255,107,157,0.7);
}
.result-card.rarity-ninji_super_rare .result-image::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
        var(--rarity-nsr-start),
        var(--rarity-nsr-mid),
        var(--rarity-nsr-end),
        var(--rarity-nsr-start));
    z-index: -1;
    animation: border-spin 2.5s linear infinite;
}
@keyframes border-spin { to { transform: rotate(360deg); } }

/* Reduced motion: disable heavy animations */
@media (prefers-reduced-motion: reduce) {
    .crate-aura,
    .crate-light-pillar,
    .crate-shockwaves,
    .crate-flash,
    .banner-sparkles,
    .banner-sparkle,
    .confetti-loop,
    .confetti-piece,
    .crate-particle { animation: none !important; opacity: 0 !important; }
    .crate-rarity-banner { animation: none !important; transform: translate(-50%, -50%) scale(1) !important; }
    .crate-opening-box { animation: crate-shake 0.3s ease-in-out 1 !important; }
}
