/* PREMIER JOKER GAME - FIXED POSITIONING */

.premier-joker-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.premier-joker-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

/* FIXED: Card wrapper with absolute height */
.premier-joker-card {
    position: relative;
    width: 100%;
    height: 150px; /* FIXED HEIGHT - no aspect ratio */
    cursor: pointer;
    /* Prevent double-tap zoom on mobile */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.premier-joker-card:hover:not(.premier-flipped) {
    transform: translateY(-5px);
}

/* FIXED: Card inner absolutely positioned */
.premier-card-inner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    z-index: 1;
}

.premier-joker-card.premier-flipped .premier-card-inner {
    transform: rotateY(180deg);
    z-index: 10; /* Bring flipped card to front */
}

/* FIXED: Both faces absolutely positioned */
.premier-card-face, 
.premier-card-reveal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden; /* Prevent content overflow */
}

/* Card front - elegant black and gold design */
.premier-card-face {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    border: 3px solid #FFD700;
}

.premier-card-face::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 215, 0, 0.05) 10px,
        rgba(255, 215, 0, 0.05) 20px
    );
}

.premier-card-pattern {
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
}

.premier-card-face i {
    font-size: 2.5rem;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    z-index: 1;
}

/* Card back - white background */
.premier-card-reveal {
    background: white;
    transform: rotateY(180deg);
    border: 3px solid #DDD;
}

/* Winner card */
.premier-joker-card.premier-winner-card .premier-card-reveal {
    background: white;
    border-color: #FFD700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

/* Joker found display - contained within card */
.premier-joker-found {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    width: 100%;
    height: 100%;
}

/* Joker image */
.premier-joker-img {
    width: 80px;
    height: auto;
    max-height: 80px;
    object-fit: contain;
    margin: 0 auto;
}

.premier-joker-label {
    font-size: 14px;
    font-weight: bold;
    color: #FFD700;
    margin: 5px 0;
}

.premier-prize-text {
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

/* Regular card display */
.premier-regular-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 10px;
}

.premier-regular-card.red-suit {
    color: #DC143C;
}

.premier-regular-card.black-suit {
    color: #000;
}

.premier-card-value {
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
}

.premier-card-suit {
    font-size: 40px;
    line-height: 1;
    margin-top: 5px;
}

/* Flipping state */
.premier-joker-card.premier-flipping {
    pointer-events: none;
}

/* Auto revealed cards */
.premier-joker-card.premier-auto-revealed {
    opacity: 0.5;
}

/* Tries counter */
.premier-joker-info {
    text-align: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.premier-joker-tries {
    font-size: 18px;
    color: white;
}

.premier-joker-count {
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
    margin-left: 10px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .premier-joker-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 15px;
    }
    
    .premier-joker-card {
        height: 120px;
    }
    
    .premier-card-face i {
        font-size: 2rem;
    }
    
    .premier-joker-img {
        width: 60px;
        max-height: 60px;
    }
    
    .premier-card-value {
        font-size: 24px;
    }
    
    .premier-card-suit {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    .premier-joker-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }
    
    .premier-joker-card {
        height: 100px;
    }
    
    .premier-joker-container {
        padding: 1rem;
    }
    
    .premier-joker-img {
        width: 50px;
        max-height: 50px;
    }
}