/* Game Highscores Styles */
.highscore-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    padding: 15px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.highscore-modal {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s ease;
    border: 2px solid rgba(139, 92, 246, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.highscore-leaderboard-modal {
    max-width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.highscore-modal-title {
    color: white;
    text-align: center;
    margin: 0 0 20px 0;
    font-size: 26px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #ec4899, #f472b6, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.highscore-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    box-sizing: border-box;
    margin-bottom: 15px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

.highscore-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.highscore-warning {
    background: rgba(251, 191, 36, 0.15);
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 12px 15px;
    color: #fbbf24;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.highscore-modal-actions {
    display: flex;
    gap: 10px;
}

.highscore-btn {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.highscore-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.highscore-btn:active {
    transform: translateY(0);
}

.highscore-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.highscore-btn-primary {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 50%, #fbbf24 100%);
    color: white;
}

.highscore-btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
    display: block;
    margin: 0 auto;
}

.highscore-success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid rgba(236, 72, 153, 0.4);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
}

.highscore-success-message.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.highscore-success-content {
    text-align: center;
    color: white;
}

.highscore-success-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

.highscore-success-content h3 {
    margin: 0 0 15px 0;
    font-size: 28px;
    background: linear-gradient(135deg, #ec4899, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.highscore-success-content p {
    margin: 0 0 25px 0;
    font-size: 18px;
    color: #e2e8f0;
}

.highscore-loading {
    text-align: center;
    color: #94a3b8;
    padding: 60px 20px;
    font-size: 18px;
}

/* TABLEAU OPTIMISÉ MOBILE */
.highscore-table-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 0;
    margin-bottom: 20px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

/* Indicateur de scroll dynamique sur mobile */
.highscore-table-container::after {
    content: attr(data-scroll-hint);
    display: none;
    text-align: center;
    padding: 10px;
    color: #64748b;
    font-size: 12px;
    font-style: italic;
    background: rgba(0, 0, 0, 0.3);
    position: sticky;
    bottom: 0;
    backdrop-filter: blur(4px);
}

.highscore-leaderboard-modal {
    max-width: 900px; /* Largeur max cohérente avec les cards */
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.highscore-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: white;
    min-width: 600px;
    font-size: 15px;
}

.highscore-table thead {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    position: sticky;
    top: 0;
    z-index: 10;
}

.highscore-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.highscore-table th:first-child {
    padding-left: 20px;
    border-radius: 12px 0 0 0;
    width: 80px;
}

.highscore-table th:last-child {
    padding-right: 20px;
    border-radius: 0 12px 0 0;
}

.highscore-table tbody tr {
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.highscore-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.highscore-table tbody tr:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: scale(1.01);
}

.highscore-table td {
    padding: 14px 12px;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.highscore-table td:first-child {
    padding-left: 20px;
    font-size: 18px;
    font-weight: 700;
}

.highscore-table td:nth-child(2) {
    min-width: 140px;
}

.highscore-table td:nth-child(3) {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    font-weight: 700;
    min-width: 100px;
}

.highscore-table td:last-child {
    padding-right: 20px;
    color: #94a3b8;
    font-size: 13px;
    min-width: 100px;
}

/* Ligne du joueur actuel */
.highscore-current-player {
    background: linear-gradient(90deg, rgba(236, 72, 153, 0.25), rgba(139, 92, 246, 0.25)) !important;
    border-left: 4px solid #ec4899;
}

.highscore-current-player td {
    color: #fbbf24 !important;
    font-weight: 700;
}

/* Style pour les 3 premières places */
.highscore-table tbody tr:nth-child(1) {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1)) !important;
}

.highscore-table tbody tr:nth-child(1) td:first-child {
    font-size: 24px;
}

.highscore-table tbody tr:nth-child(2) {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1)) !important;
}

.highscore-table tbody tr:nth-child(2) td:first-child {
    font-size: 22px;
}

.highscore-table tbody tr:nth-child(3) {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1)) !important;
}

.highscore-table tbody tr:nth-child(3) td:first-child {
    font-size: 20px;
}

/* RESPONSIVE MOBILE */
@media (max-width: 768px) {
    .highscore-modal-overlay {
        padding: 10px;
    }
    
    .highscore-modal {
        padding: 20px 15px;
        border-radius: 16px;
    }
    
    .highscore-leaderboard-modal {
        max-width: 100%;
        max-height: 88vh;
    }
    
    .highscore-modal-title {
        font-size: 22px;
        margin-bottom: 16px;
    }
    
    /* Tableau optimisé */
    .highscore-table-container {
        max-height: 55vh;
        border-radius: 12px;
    }
    
    /* Afficher l'indicateur de scroll sur mobile */
    .highscore-table-container::after {
        display: block;
    }
    
    .highscore-table {
        font-size: 14px;
        min-width: 550px;
    }
    
    .highscore-table th {
        padding: 12px 8px;
        font-size: 12px;
    }
    
    .highscore-table td {
        padding: 12px 8px;
    }
    
    .highscore-table th:first-child,
    .highscore-table td:first-child {
        padding-left: 12px;
        width: 60px;
        font-size: 16px;
    }
    
    .highscore-table td:nth-child(2) {
        min-width: 120px;
    }
    
    .highscore-table td:nth-child(3) {
        min-width: 90px;
    }
    
    .highscore-table td:last-child {
        padding-right: 12px;
        min-width: 85px;
        font-size: 11px;
    }
    
    .highscore-table tbody tr:nth-child(1) td:first-child,
    .highscore-table tbody tr:nth-child(2) td:first-child,
    .highscore-table tbody tr:nth-child(3) td:first-child {
        font-size: 18px;
    }
    
    .highscore-btn {
        width: 100%;
        padding: 16px;
        font-size: 16px;
    }
    
    .highscore-success-message {
        padding: 30px 20px;
    }
    
    .highscore-success-icon {
        font-size: 48px;
    }
    
    .highscore-success-content h3 {
        font-size: 24px;
    }
    
    .highscore-success-content p {
        font-size: 16px;
    }
}

/* Ultra petit écran */
@media (max-width: 480px) {
    .highscore-table {
        font-size: 13px;
        min-width: 520px;
    }
    
    .highscore-modal-title {
        font-size: 20px;
    }
}

/* Scrollbar personnalisée */
.highscore-table-container::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.highscore-table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.highscore-table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 4px;
}

.highscore-table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
}

/* Desktop large - limiter la largeur max */
@media (min-width: 1400px) {
    .highscore-leaderboard-modal {
        max-width: 1000px;
    }
}

/* Sélecteur de difficulté pour TicTacToe */
.highscore-difficulty-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.highscore-difficulty-btn {
    padding: 10px 16px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.highscore-difficulty-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: #8b5cf6;
    transform: translateY(-2px);
}

.highscore-difficulty-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    border-color: #a855f7;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

@media (max-width: 768px) {
    .highscore-difficulty-selector {
        gap: 6px;
    }
    
    .highscore-difficulty-btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1;
        min-width: 70px;
    }
}