/* Scoped styles for the Trader Game popup */

#game-popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 25, 47, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#game-popup-container.visible {
    display: flex;
    opacity: 1;
}

#game-popup-container .game-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

#game-popup-container canvas {
    background-color: #1A1E2C;
    border: 1px solid #3A3F51;
    width: 100%;
    height: auto;
    display: block;
}

#game-popup-container .game-close-button {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 35px;
    height: 35px;
    background: #FF6584;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease;
}

#game-popup-container .game-close-button:hover {
    transform: scale(1.1) rotate(90deg);
}

/* --- Button Styles --- */
#game-popup-container #startGameBtn, 
#game-popup-container #nextGameBtn {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
    color: #EAEAEA;
    border: none;
    border-radius: 10px;
    transition: all 0.2s ease-in-out;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

#game-popup-container #startGameBtn {
    display: block;
    top: 58%;
    padding: 18px 40px;
    font-size: 24px;
    background: linear-gradient(145deg, #00BFFF, #008fbf);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 191, 255, 0.4);
}

#game-popup-container #startGameBtn:hover {
    transform: translate(-50%, -52%);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 30px rgba(0, 191, 255, 0.6);
}

#game-popup-container #startGameBtn:active {
    transform: translate(-50%, -49%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#game-popup-container #nextGameBtn {
    display: none;
    top: 88%;
    padding: 15px 35px;
    font-size: 22px;
}

#game-popup-container #nextGameBtn.party {
    background: linear-gradient(145deg, #00BFFF, #008fbf);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 191, 255, 0.4);
}

#game-popup-container #nextGameBtn.sad {
    background: linear-gradient(145deg, #555, #333);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#game-popup-container #nextGameBtn:hover {
    transform: translate(-50%, -52%);
}

/* --- Live PnL Popup --- */
#game-popup-container .live-pnl-popup {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(26, 30, 44, 0.85);
    border-radius: 8px;
    padding: 8px 16px;
    font-family: monospace;
    text-align: center;
    display: none;
    transition: all 0.3s ease;
    z-index: 10;
    border: 1px solid #3A3F51;
    pointer-events: none;
}

#game-popup-container .live-pnl-popup.visible { display: block; }
#game-popup-container .pnl-value { font-size: 28px; font-weight: bold; transition: all 0.2s ease-in-out; }
#game-popup-container .entry-price { font-size: 12px; color: #aaa; }
#game-popup-container .pnl-profit { color: #2E8B57; }
#game-popup-container .pnl-loss { color: #FF6347; }
#game-popup-container .pnl-profit.tier-1 { text-shadow: 0 0 5px rgba(46, 139, 87, 0.5); }
#game-popup-container .pnl-profit.tier-2 { font-size: 32px; text-shadow: 0 0 10px rgba(46, 139, 87, 0.7); }
#game-popup-container .pnl-profit.tier-3 { font-size: 40px; text-shadow: 0 0 20px rgba(46, 139, 87, 1); }
#game-popup-container .pnl-loss.tier-1 { animation: shake 0.8s infinite; }
#game-popup-container .pnl-loss.tier-2 { font-size: 32px; animation: shake 0.5s infinite; }
#game-popup-container .pnl-loss.tier-3 { font-size: 40px; animation: shake 0.3s infinite; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* --- Media Queries for Responsiveness --- */
@media (max-width: 800px) {
    #game-popup-container #startGameBtn {
        padding: 14px 30px;
        font-size: 20px;
    }
    #game-popup-container #nextGameBtn {
        padding: 12px 28px;
        font-size: 18px;
    }
    #game-popup-container .pnl-value {
        font-size: 22px;
    }
    #game-popup-container .pnl-loss.tier-2, #game-popup-container .pnl-profit.tier-2 { font-size: 26px; }
    #game-popup-container .pnl-loss.tier-3, #game-popup-container .pnl-profit.tier-3 { font-size: 32px; }
}

@media (max-width: 480px) {
    #game-popup-container #startGameBtn {
        padding: 12px 25px;
        font-size: 18px;
    }
    #game-popup-container #nextGameBtn {
        padding: 10px 22px;
        font-size: 16px;
    }
}
