/* PREMIER TREASURE CHEST GAME - PIRATE THEME */

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

.premier-treasure-scene {
    position: relative;
    padding: 3rem 2rem;
    background: 
        linear-gradient(to bottom, rgba(0,0,0,0.7), rgba(0,0,0,0.9)),
        url('https://images.unsplash.com/photo-1518709268805-4e9042af9f23?w=1200') center/cover;
    border-radius: 20px;
    overflow: hidden;
    min-height: 400px;
}

/* Sand/beach effect at bottom */
.premier-treasure-scene::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, 
        rgba(194, 154, 108, 0.4),
        rgba(194, 154, 108, 0.2),
        transparent
    );
    pointer-events: none;
}

/* Chests container */
.premier-treasure-chests {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

/* Individual chest */
.premier-chest-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.premier-chest-wrapper:hover:not(.opening) {
    transform: translateY(-10px) scale(1.05);
}

/* Chest base structure - Using YOUR images */
.premier-chest-base {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Chest image - closed by default */
.premier-chest-img {
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('https://premierwincompetitions.co.uk/uploads/chest-closed.png') center/contain no-repeat;
    transition: all 0.5s ease;
}

/* When chest is opening/opened */
.premier-chest-wrapper.premier-opening .premier-chest-img {
    background-image: url('https://premierwincompetitions.co.uk/uploads/chest-opened.png');
}

.premier-chest-wrapper.premier-winner .premier-chest-img {
    background-image: url('https://premierwincompetitions.co.uk/uploads/chest-opened.png');
    filter: drop-shadow(0 0 20px rgba(255,215,0,0.5));
}

/* Chest lock overlay */
.premier-chest-lock {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #FFD700, #B8860B);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 3px 10px rgba(0,0,0,0.5),
        inset 0 -2px 4px rgba(0,0,0,0.3);
    z-index: 2;
    transition: all 0.3s ease;
}

.premier-chest-lock i {
    color: #654321;
    font-size: 20px;
}

/* Open chest animation */
.premier-chest-wrapper.premier-opening .premier-chest-lock {
    transform: translate(-50%, -50%) rotate(90deg);
    opacity: 0;
}

.premier-chest-wrapper.premier-opening .premier-chest-image {
    animation: chestOpen 0.8s ease forwards;
}

@keyframes chestOpen {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(-2deg); }
    100% { transform: scale(1.05) rotate(0deg); }
}

/* Glow effect */
.premier-chest-glow {
    position: absolute;
    inset: -30px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.premier-chest-wrapper:hover .premier-chest-glow {
    opacity: 1;
}

/* Treasure reveal */
.premier-treasure-reveal {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    display: none;
}

.premier-treasure-reveal.show {
    display: block;
    animation: treasureReveal 0.5s ease;
}

@keyframes treasureReveal {
    from {
        transform: translate(-50%, 100px) scale(0);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Gold coins effect */
.premier-gold-coins {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
    display: none;
}

.premier-chest-wrapper.premier-winner .premier-gold-coins {
    display: block;
}

.premier-coin {
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #FFD700, #FFA500);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    animation: coinFountain 1.5s ease-out forwards;
}

@keyframes coinFountain {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) scale(1) rotate(720deg);
        opacity: 0;
    }
}

.premier-coin:nth-child(1) { --x: -60px; --y: -100px; animation-delay: 0s; }
.premier-coin:nth-child(2) { --x: 60px; --y: -120px; animation-delay: 0.1s; }
.premier-coin:nth-child(3) { --x: -40px; --y: -110px; animation-delay: 0.2s; }
.premier-coin:nth-child(4) { --x: 40px; --y: -90px; animation-delay: 0.3s; }
.premier-coin:nth-child(5) { --x: 0; --y: -130px; animation-delay: 0.4s; }
.premier-coin:nth-child(6) { --x: -80px; --y: -80px; animation-delay: 0.5s; }
.premier-coin:nth-child(7) { --x: 80px; --y: -85px; animation-delay: 0.6s; }
.premier-coin:nth-child(8) { --x: -20px; --y: -115px; animation-delay: 0.7s; }

/* Prize display */
.premier-prize-display {
    background: rgba(0,0,0,0.8);
    border: 2px solid #FFD700;
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

.premier-prize-icon {
    font-size: 48px;
    color: #FFD700;
    margin-bottom: 10px;
}

.premier-prize-text {
    font-size: 20px;
    color: #FFD700;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* Empty chest */
.premier-empty-display {
    background: rgba(0,0,0,0.6);
    border: 2px solid #666;
    border-radius: 10px;
    padding: 15px;
}

.premier-empty-icon {
    font-size: 36px;
    color: #666;
}

.premier-empty-text {
    font-size: 16px;
    color: #999;
}

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

.premier-tries-label {
    color: #FFD700;
    font-size: 18px;
    margin-right: 10px;
}

.premier-tries-count {
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255,215,0,0.5);
}

/* Results section */
.premier-treasure-results {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0,0,0,0.6);
    border-radius: 12px;
    border: 2px solid rgba(255,215,0,0.3);
}

.premier-results-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.premier-result-item {
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
}

.premier-result-item.winner {
    background: rgba(255,215,0,0.2);
    border: 1px solid #FFD700;
    color: #FFD700;
}

.premier-result-item.loser {
    background: rgba(255,255,255,0.1);
    border: 1px solid #666;
    color: #999;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .premier-treasure-container {
        padding: 1rem;
    }
    
    .premier-treasure-scene {
        padding: 2rem 1rem;
        min-height: auto;
    }
    
    .premier-treasure-chests {
        gap: 2rem;
    }
    
    .premier-chest-wrapper {
        width: 140px;
        height: 140px;
    }
    
    .premier-chest-lock {
        width: 35px;
        height: 35px;
    }
    
    .premier-chest-lock i {
        font-size: 18px;
    }
    
    .premier-prize-icon {
        font-size: 36px;
    }
    
    .premier-prize-text {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .premier-treasure-chests {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .premier-chest-wrapper {
        width: 120px;
        height: 120px;
    }
    
    .premier-tries-count {
        font-size: 24px;
    }
}