/* Unified user header — used on the launcher and inside every game.
 *
 * Expected HTML (avatar-container is optional, used in slots for dropdown menu):
 *
 *     <div class="user-bar">
 *       <a   class="back-btn"     id="backBtn"      href="../">←</a>      <!-- in games -->
 *       <img class="user-avatar"  id="userAvatar">
 *       <span class="user-name"   id="userName"></span>
 *       <span class="user-balance">💎 <span id="userBalance">0</span></span>
 *       <button class="top-up-btn bonus-btn" id="bonusBtn">🎁</button>
 *       <button class="top-up-btn"           id="topUpBtn">+</button>
 *     </div>
 */
.user-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border-radius: 999px;
    padding: 6px 8px 6px 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
}

.user-bar .back-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding-bottom: 2px;
    transition: background 0.15s, transform 0.15s;
}
.user-bar .back-btn:hover  { background: rgba(255, 255, 255, 0.16); }
.user-bar .back-btn:active { transform: scale(0.9); }

.user-bar .user-avatar,
.user-bar #userAvatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.user-bar .user-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.92;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.user-bar .user-balance,
.user-bar #balance {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    font-size: 13px;
    color: #ffd980;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 165, 0, 0.10));
    border: 1px solid rgba(255, 215, 0, 0.25);
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
    text-shadow: none;
}
.user-bar .user-balance .currency,
.user-bar #balance .currency {
    font-size: 13px;
    margin: 0;
}

.user-bar .top-up-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s;
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.user-bar .top-up-btn:active { transform: scale(0.92); }

.user-bar .top-up-btn.bonus-btn,
.user-bar #bonusBtn {
    background: linear-gradient(135deg, #f9a825, #e65100);
    box-shadow: 0 2px 10px rgba(249, 168, 37, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-size: 16px;
}
.user-bar .top-up-btn.lb-btn,
.user-bar #leaderboardBtn {
    background: linear-gradient(135deg, #29b6f6, #0277bd);
    box-shadow: 0 2px 10px rgba(41, 182, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-size: 15px;
}

/* Pulse when claimable */
.user-bar .top-up-btn.pulse {
    animation: userBarPulse 2s ease-in-out infinite;
}
@keyframes userBarPulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(249, 168, 37, 0.45); }
    50%      { box-shadow: 0 0 18px 4px rgba(255, 215, 0, 0.7); }
}
