.dashboard-main {
    max-width: 1500px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
}

.dashboard-h1 {
    color: var(--text-primary) !important;
    font-size: 3rem !important;
}

.dashboard-sub {
    font-size: 1rem !important;
    margin-bottom: 0rem !important;
}

.highlight-name {
    color: var(--primary-purple);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

/* Boutons */
.mode-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.btn-mode {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1.1rem;
}

/* Bouton Classé */
.btn-mode.ranked {
    background: linear-gradient(135deg, var(--button-gradient-start), var(--button-gradient-end));
    color: var(--background-card);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    width:fit-content;
}

.btn-mode.ranked:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

/* Bouton Normal */
.btn-mode.normal {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    width: fit-content;
}
.btn-mode.normal:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px) scale(1.05);
    color: #fff;
    border-color: #fff;
}

/* Bouton Tournois */
.btn-mode.tournament {
    background: linear-gradient(135deg, rgb(166, 0, 231), rgb(255, 0, 128));
    color: var(--text-primary);
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.4);
    width:fit-content;
}

.btn-mode.tournament:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 0 30px rgba(255, 0, 128, 0.6);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Cartes */
.dash-card {
    background: var(--background-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.dash-card h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.history-card h3 {
    margin-bottom: 1rem;
}

/* Historique */
.card-header-tabs {
    display: flex;
    gap: 10px;
    margin: 0 auto 5px auto;
    padding-bottom: 10px;
    align-items: center;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: 0.3s;
}

.tab-btn.active {
    background: rgba(255, 215, 0, 0.1);
    color: var(--primary-purple);
}

.match-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.2);
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 8px;
    border-left: 3px solid transparent;
}

.match-item.win { border-left-color: #2ecc71; }
.match-item.loss { border-left-color: #e74c3c; }

.match-result { font-weight: 900; width: 20px; }
.match-item.win .match-result { color: #2ecc71; }
.match-item.loss .match-result { color: #e74c3c; }

.match-info { display: flex; flex-direction: column; font-size: 0.9rem; }
.match-info .vs { color: var(--text-secondary); font-size: 0.8rem; }
.match-info .score { color: #fff; font-weight: bold; }

.elo-change { font-weight: bold; color: #2ecc71; }
.elo-change.text-red { color: #e74c3c; }

.history-more {
    text-align: center;
    display: block;
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
}
.history-more:hover { text-decoration: underline; }

/* Stats */
.winrate-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Pie Chart */
.progress-circle {
    width: 120px;
    aspect-ratio: 1;
    position: relative;
    display: inline-grid;
    place-content: center;
    margin: 5px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 50%;
}
.progress-circle:before {
    content: "";
    position: absolute;
    border-radius: 50%;
    inset: 0;
    background: conic-gradient(var(--c) calc(var(--p)*1%), #2c3e50 0);
    -webkit-mask: radial-gradient(farthest-side,#0000 calc(99% - var(--b)),#000 calc(100% - var(--b)));
            mask: radial-gradient(farthest-side,#0000 calc(99% - var(--b)),#000 calc(100% - var(--b)));
}
.stat-value { color: #fff; font-size: 1.5rem; z-index: 2; }
.stat-label { color: var(--text-secondary); margin-top: 5px; font-size: 0.9rem; }

.mini-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    text-align: center;
}
.mini-stat {
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 8px;
}
.mini-stat .val { display: block; font-size: 1.2rem; font-weight: bold; color: #fff; }
.mini-stat .lbl { font-size: 0.8rem; color: var(--text-secondary); }

/* Rank */

/* Conteneur scroll */
.leaderboard-container {
    height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding-right: 5px;
    min-width: 300px;

    scrollbar-width: thin;
    scrollbar-color: var(--primary-purple) rgba(0,0,0,0.3);
}

.leaderboard-container::-webkit-scrollbar {
    width: 6px;
}
.leaderboard-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
}
.leaderboard-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-purple);
    border-radius: 3px;
}

/* Ligne du classement */
.rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 0.9rem;

    cursor: pointer;
}

.rank-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.rank-row:active {
    transform: scale(0.98);
}

/* Infos Utilisateur */
.rank-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    margin-left: 10px;
}

.mini-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.2);
}

.r-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    text-align: left;

}

.rank-pos {
    font-weight: bold;
    color: var(--text-secondary);
    width: 30px;
    text-align: center;
}

.rank-elo {
    font-weight: bold;
    color: var(--primary-purple);
}
.rank-elo small {
    color: var(--text-secondary);
    font-weight: normal;
    font-size: 0.75rem;
}

/* Top 1 du classement */
.rank-row.rank-1 {
    position: sticky;
    top: 0;
    z-index: 10;
    
    background: var(--background-card);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 3px solid var(--primary-purple);
    margin-bottom: 12px;
}

.rank-row.rank-1 .r-name,
.rank-row.rank-1 .rank-pos,
.rank-row.rank-1 .rank-elo small {
    text-shadow: none;
}

.rank-row.rank-1 .rank-elo {
    color: red;
}

.crown-icon {
    color: var(--primary-purple);
}

/* Utilisateur connecté */
.rank-row.is-me {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid var(--primary-purple);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

/* Si utilisateur connecté est top 1 */
.rank-row.rank-1.is-me {
    background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%);
}

.history-content {
    max-height: 250px;
    overflow-y: auto;
        scrollbar-width: thin;
    scrollbar-color: var(--primary-purple) rgba(0,0,0,0.3);
}

/* utilisateurs en ligne */
.live-dot {
    width: 10px; height: 10px; background-color: #2ecc71; border-radius: 50%;
    display: inline-block; box-shadow: 0 0 10px #2ecc71; animation: pulseLive 1.5s infinite;
}

.online-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.articles-button {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s;
}

.articles-button:hover {
    text-decoration: underline;
}

@keyframes pulseLive {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(46, 204, 113, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* Responsive */
@media (max-width: 1530px) {
    .dashboard-grid {
        grid-template-columns: repeat(2,1fr);
        width: 100%;
    }

    .dashboard-main {
        width: 100%;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .dashboard-h1 {
        font-size: clamp(1.8rem, 5vw, 2.5rem) !important;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .mode-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-mode {
        justify-content: center;
        margin:auto;
    }

    .dash-card {
        width: 100%;
    }

    .dashboard-grid {
        width: 100%;
    }

    .dashboard-main {
        width: 100%;
    }
}