/* Game Card & Modal Styling */

/* Card on Home Screen */
.game-card {
    background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.game-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.2) 0%, transparent 70%);
    animation: pulseGlow 4s infinite ease-in-out;
    pointer-events: none;
}

@keyframes pulseGlow {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.game-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.game-icon {
    font-size: 40px;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

.game-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(to right, #fff, #b388ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-desc {
    font-size: 14px;
    color: #b3b3b3;
    margin-bottom: 15px;
}

.game-play-btn {
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.game-play-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

/* Full Screen Modal */
#game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f0518;
    z-index: 10000;
    display: none;
    flex-direction: column;
}

.game-header {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.game-score-container {
    font-size: 20px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-game-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    opacity: 0.7;
}

.close-game-btn:hover {
    opacity: 1;
}

/* Canvas Area */
#game-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a0b2e 0%, #000 100%);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Overlays */
#game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.overlay-content {
    text-align: center;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#game-title-text {
    font-size: 36px;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 0 0 20px #7c3aed;
}

#final-score {
    font-size: 24px;
    margin-bottom: 30px;
    color: #ddd;
    line-height: 1.5;
}

.start-btn {
    background: #FFD700;
    color: #000;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: 900;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

.tutorial-text {
    margin-top: 20px;
    color: #888;
    font-size: 14px;
}

/* Inline Close Button (in overlay) */
.close-game-btn-inline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 14px;
    margin-top: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-game-btn-inline:active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Game Start Rewards Display */
.game-start-rewards {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
    animation: fadeSlideUp 0.5s ease-out 0.3s both;
}

.game-start-rewards .reward-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Game Result Screen - Enhanced */
.game-result-loading {
    text-align: center;
}

.loading-spinner-game {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #FFD700;
    border-radius: 50%;
    animation: spinLoader 1s linear infinite;
    margin: 0 auto 15px;
}

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

.loading-text {
    color: #aaa;
    font-size: 16px;
}

.game-result-icon {
    font-size: 64px;
    animation: iconBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 10px;
}

@keyframes iconBounce {
    0% {
        transform: scale(0) rotate(-20deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.2) rotate(10deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.game-result-title {
    font-size: 32px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 30px rgba(124, 58, 237, 0.8);
    margin-bottom: 5px;
    animation: fadeSlideUp 0.5s ease-out 0.1s both;
}

.game-result-subtitle {
    font-size: 16px;
    color: #b3b3b3;
    margin-bottom: 20px;
    animation: fadeSlideUp 0.5s ease-out 0.2s both;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-result-coins {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    animation: fadeSlideUp 0.5s ease-out 0.3s both;
}

.coin-icon-animated {
    font-size: 48px;
    animation: coinSpin 1s ease-out, coinGlow 2s infinite;
}

@keyframes coinSpin {
    0% {
        transform: rotateY(0deg) scale(0);
    }

    50% {
        transform: rotateY(540deg) scale(1.2);
    }

    100% {
        transform: rotateY(720deg) scale(1);
    }
}

@keyframes coinGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.9));
    }
}

.coin-value-animated {
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    animation: valuePopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.4s both;
}

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

    70% {
        transform: scale(1.2);
    }

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

.game-result-balance {
    font-size: 16px;
    color: #888;
    margin-bottom: 25px;
    animation: fadeSlideUp 0.5s ease-out 0.5s both;
}

.game-result-balance span {
    color: #fff;
    font-weight: bold;
}

.game-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    animation: fadeSlideUp 0.5s ease-out 0.6s both;
}

.game-play-again-btn {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(124, 58, 237, 0.4);
    transition: all 0.3s ease;
}

.game-play-again-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

.game-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 14px 28px;
    border-radius: 50px;
    color: #aaa;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-close-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

/* Confetti */
.game-confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 100;
}

.game-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    border-radius: 2px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Premium Play Button Variant */
.game-play-btn.premium-btn {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
}

.game-play-again-btn.premium {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
}