/* Perk Reveal Page Styles */

#perk-reveal-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem;
}

#perk-reveal-page.active {
    display: flex;
}

/* Screen shake animation for mythic reveals */
#perk-reveal-page.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-4px, -4px); }
    20%, 40%, 60%, 80% { transform: translate(4px, 4px); }
}

.perk-reveal-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    width: 100%;
}

.perk-reveal-title {
    font-size: 3.5rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.perk-reveal-subtitle {
    font-size: 1.6rem;
    color: #e0e0e0;
    font-style: italic;
    animation: pulse-hint 2s ease-in-out infinite;
}

.perk-reveal-btn-top {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Perk Cards Container */
#perk-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto 2rem;
    padding: 0 2rem;
    justify-items: center;
    min-height: 0;
    flex: 1;
}

/* Individual Perk Card */
.perk-card {
    perspective: 1000px;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 3/2;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    overflow: visible;
}

.perk-card:hover {
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .perk-card {
        width: 100%;
    }
}

.perk-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

.perk-card.flipped .perk-card-inner {
    transform: rotateY(180deg);
}

.perk-card.instant .perk-card-inner {
    transition: none;
}

.perk-card-front,
.perk-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    top: 0;
    left: 0;
}

/* Card Back (face-down) */
.perk-card-front {
    background: linear-gradient(135deg, #2d3561 0%, #1f2544 100%);
    border: 2px solid #4a5568;
    transition: box-shadow 0.3s, border-color 0.3s;
    justify-content: center;
}

/* Card Front (revealed) */
.perk-card-back {
    transform: rotateY(180deg);
    position: relative;
    justify-content: flex-start;
    gap: 0.8rem;
    padding: 1.8rem 2rem;
}

.perk-card-back .perk-name {
    font-size: 1.6rem !important;
    font-weight: bold !important;
    color: #fff;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.1;
    width: 100%;
}

.perk-card-back .perk-card-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    width: 100%;
    padding: 0;
}

.perk-card-back .perk-card-emoji {
    font-size: 2.5rem;
    opacity: 0.9;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.perk-card-back .perk-description {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.95);
    text-align: left;
    line-height: 1.6;
    padding: 0 2rem;
    max-width: 100%;
    flex: 1;
}

/* Hover glow hints for rarity (Hearthstone style) */
.perk-card:not(.flipped):hover .perk-card-front.common-hint {
    box-shadow: 0 0 30px rgba(117, 117, 117, 0.6);
    border-color: #757575;
}

.perk-card:not(.flipped):hover .perk-card-front.uncommon-hint {
    box-shadow: 0 0 30px rgba(56, 142, 60, 0.6);
    border-color: #388e3c;
}

.perk-card:not(.flipped):hover .perk-card-front.rare-hint {
    box-shadow: 0 0 35px rgba(142, 36, 170, 0.7);
    border-color: #8e24aa;
}

.perk-card:not(.flipped):hover .perk-card-front.mythic-hint {
    box-shadow: 0 0 40px rgba(245, 124, 0, 0.8);
    border-color: #f57c00;
}

.card-back-pattern {
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px);
    border-radius: 8px;
}

/* Rarity-based styling */
.perk-common .perk-card-back {
    background: linear-gradient(135deg, #616161 0%, #424242 100%);
    border: 2px solid #757575;
    box-shadow: 0 0 20px rgba(117, 117, 117, 0.4);
}

.perk-uncommon .perk-card-back {
    background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    border: 2px solid #388e3c;
    box-shadow: 0 0 25px rgba(56, 142, 60, 0.5);
}

.perk-rare .perk-card-back {
    background: linear-gradient(135deg, #7b1fa2 0%, #4a148c 100%);
    border: 2px solid #8e24aa;
    box-shadow: 0 0 30px rgba(142, 36, 170, 0.6);
}

.perk-mythic .perk-card-back {
    background: linear-gradient(135deg, #ef6c00 0%, #e65100 100%);
    border: 2px solid #f57c00;
    box-shadow: 0 0 40px rgba(245, 124, 0, 0.8);
    animation: mythic-glow 2s ease-in-out infinite;
}

@keyframes mythic-glow {
    0%, 100% { box-shadow: 0 0 40px rgba(245, 124, 0, 0.8); }
    50% { box-shadow: 0 0 60px rgba(245, 124, 0, 1); }
}

/* Perk Content */
.perk-rarity-badge {
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    white-space: nowrap;
}

/* Particle Effects */
.particle-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: particle-burst 1s ease-out forwards;
}

.particle-rare {
    background: #8e24aa;
    box-shadow: 0 0 10px #8e24aa;
}

.particle-mythic {
    background: #f57c00;
    box-shadow: 0 0 12px #f57c00;
}

@keyframes particle-burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Controls */
.perk-reveal-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 0;
    width: 100%;
}

.perk-reveal-btn {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.perk-reveal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#perk-reveal-skip {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);

#perk-reveal-continue {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: #fff;
    border: 2px solid #48bb78;
    box-shadow: 0 4px 16px rgba(72, 187, 120, 0.4);
}

#perk-reveal-continue:hover:not(:disabled) {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.6);
}

#perk-reveal-continue.pulse {
    animation: pulse-button 1.5s ease-in-out infinite;
}

@keyframes pulse-button {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(72, 187, 120, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 24px rgba(72, 187, 120, 0.7);
        transform: scale(1.08);
    }
}

/* Responsive */
@media (max-width: 768px) {
    #perk-cards-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .perk-card {
        height: 350px;
    }

    .perk-reveal-title {
        font-size: 2rem;
    }

    .perk-reveal-header {
        margin-bottom: 1rem;
    }

    .perk-reveal-btn-top {
        position: static;
        margin-top: 1rem;
        width: 100%;
    }

    .perk-reveal-controls {
        flex-direction: column;
        width: 100%;
    }

    .perk-reveal-btn {
        width: 100%;
    }
}
