/* 3D Flip Card & Loot Box Reveal Styles - COMPACT & PREMIUM REDESIGN */

.perspective-container {
    perspective: 1500px;
    width: 280px;
    height: 360px;
    position: relative;
    z-index: 1;
    opacity: 0;
}

.perspective-container.rank-1 {
    width: 320px;
    height: 420px;
    order: 2;
    z-index: 10;
}

.perspective-container.rank-2 {
    order: 1;
}

.perspective-container.rank-3 {
    order: 3;
}

.card-3d-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.perspective-container:hover .card-3d-wrapper {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.85), rgba(20, 20, 30, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
}

.face-front {
    z-index: 2;
    transform: rotateY(0deg);
}

.face-back {
    transform: rotateY(180deg);
    background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.1), transparent 60%), linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* PREMIUM TONES */
.perspective-container.tone-gold .face-front {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(0, 0, 0, 0.8) 60%);
    border: 1px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2), 0 25px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 215, 0, 0.1);
}

.perspective-container.tone-gold .face-front::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.4), transparent 70%);
    pointer-events: none;
    mix-blend-mode: overlay;
}

.perspective-container.tone-silver .face-front {
    background: linear-gradient(135deg, rgba(224, 231, 255, 0.15), rgba(0, 0, 0, 0.8) 60%);
    border: 1px solid rgba(224, 231, 255, 0.5);
    box-shadow: 0 0 30px rgba(224, 231, 255, 0.15), 0 25px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(224, 231, 255, 0.1);
}

.perspective-container.tone-silver .face-front::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(224, 231, 255, 0.4), transparent 70%);
    pointer-events: none;
    mix-blend-mode: overlay;
}

.perspective-container.tone-bronze .face-front {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(0, 0, 0, 0.8) 60%);
    border: 1px solid rgba(205, 127, 50, 0.5);
    box-shadow: 0 0 30px rgba(205, 127, 50, 0.15), 0 25px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(205, 127, 50, 0.1);
}

.perspective-container.tone-bronze .face-front::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(205, 127, 50, 0.4), transparent 70%);
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* Inner Content */
.card-modern-inner {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    visibility: visible !important;
    opacity: 1 !important;
}

.card-modern-header {
    width: 100%;
    position: relative;
    z-index: 5;
    padding-bottom: 0.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-modern-stats {
    width: 100%;
    position: relative;
    z-index: 5;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* BACK FACE BANNER */
.back-banner-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    filter: blur(12px) brightness(0.4);
    z-index: 0;
}

.card-modern-header .back-banner-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.9) 100%);
}

/* ANIMATIONS */
.reveal-pending {
    opacity: 0 !important;
    transform: translateY(-500px) scale(0.5) !important;
    pointer-events: none;
}

.reveal-spin {
    animation: spinReveal 1.2s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes spinReveal {
    0% {
        opacity: 0;
        transform: translateY(-500px) rotateY(-1080deg) scale(0.5);
        filter: blur(10px);
    }

    60% {
        opacity: 1;
        transform: translateY(20px) rotateY(-180deg) scale(1.1);
        filter: blur(0px);
    }

    80% {
        transform: translateY(-10px) rotateY(-20deg) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateY(0) rotateY(0deg) scale(1);
        filter: blur(0px);
    }
}

.flash-effect::after {
    content: '';
    position: absolute;
    inset: -150%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.3) 30%, transparent 60%);
    opacity: 0;
    z-index: 100;
    pointer-events: none;
    mix-blend-mode: screen;
    border-radius: 50%;
    animation: flashBang 0.6s ease-out forwards;
}

@keyframes flashBang {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    15% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(2.5);
    }
}

/* CONFETTI */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    opacity: 1;
    z-index: 1000;
    pointer-events: none;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

@keyframes confettiExplosion {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(calc(var(--confetti-x) * 0.7), calc(var(--confetti-y) * 0.7)) rotate(360deg) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translate(var(--confetti-x), calc(var(--confetti-y) + 600px)) rotate(1080deg) scale(0.5);
        opacity: 0;
    }
}

/* LAYOUT ELEMENTS */
.rank-watermark {
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 6rem;
    font-weight: 900;
    opacity: 0.05;
    line-height: 1;
    pointer-events: none;
    z-index: 0;
    color: white;
}

.rank-badge-modern {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.25rem 0.7rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.1em;
}

.rank-badge-gold {
    background: linear-gradient(135deg, #ffd700, #b8860b);
    border-color: #ffd700;
    color: #000;
}

.rank-badge-silver {
    background: linear-gradient(135deg, #e0e0e0, #a9a9a9);
    border-color: #e0e0e0;
    color: #000;
}

.rank-badge-bronze {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    border-color: #cd7f32;
    color: #fff;
}

.avatar-container-modern {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    padding: 3px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.avatar-container-modern.avatar-gold {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #ffd700, transparent);
    border-color: #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
}

.avatar-image-modern {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0, 0, 0, 0.5);
}

.channel-name-gradient {
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(to bottom, #fff, #ccc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    color: white;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.channel-name-gold {
    background: linear-gradient(to bottom, #ffd700, #fff8dc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
    color: #ffd700;
}

.stat-item-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    padding: 0.5rem 0.2rem;
    height: 100%;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item-modern:last-child {
    border-right: none;
}

.stat-label-modern {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stat-value-modern {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.stat-unit {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-left: 2px;
}