/* Root Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #f43f5e;
    --background: #0f0f0f;
    --surface: #1a1a1a;
    --text: #e5e5e5;
    --text-light: #a3a3a3;
    --border: #333;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Press Start 2P', cursive;
    background: var(--background);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
}
a {
    color: var(--primary);
    text-decoration: none;
}

h3 {
    margin-bottom: 10px;
}

/* Particle Background */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.6;
}

/* Header & Navigation */
.header {
    background: rgba(26, 26, 26, 0.95);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.7),
                0 2px 4px -1px rgba(0, 0, 0, 0.5);
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    color: var(--primary);
    font-size: 1.2rem;
    text-decoration: none;
}
.nav-links {
    display: flex;
    gap: 1.5rem;
}
.nav-link {
    color: var(--text);
    font-weight: 500;
    position: relative;
    padding: 0.5rem 1rem;
    transition: color 0.3s;
    font-size: 0.8rem;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary);
    transition: width 0.3s ease;
}
.nav-link:hover {
    color: var(--primary);
}
.nav-link:hover::after {
    width: 100%;
}
.nav-link.active {
    color: var(--primary);
}
.nav-link.active::after {
    width: 100%;
    background: var(--primary);
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Card Styles */
.card {
    background: rgba(26, 26, 26, 0.95);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.7),
                0 4px 6px -2px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: transform 0.3s ease;
    color: var(--text);
    margin-bottom: 2rem;
}
.card:hover {
    transform: translateY(-2px);
}
.card-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 1rem;
    color: white;
    text-align: center;
}
.card-title {
    font-size: 1rem;
    margin: 0;
}
.card-content {
    padding: 1rem;
    max-height: 80vh;
    overflow-y: auto;
}

/* Leaderboard Styles */
.leaderboard-table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
}
.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
    width: 60px; /* Thinner rank column */
    text-align: center;
}
.leaderboard-table th:nth-child(2),
.leaderboard-table td:nth-child(2) {
    width: 250px; /* Match player-name width */
}
.leaderboard-table th:not(:first-child):not(:nth-child(2)),
.leaderboard-table td:not(:first-child):not(:nth-child(2)) {
    width: calc((100% - 310px) / 4); /* Adjusted for new name width */
    text-align: center;
}
.leaderboard-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-dark);
}
.leaderboard-table th {
    background: rgba(0, 0, 0, 0.5);
    padding: 0.75rem;
    font-weight: 600;
}
.leaderboard-table tr {
    background: rgba(17, 24, 39, 0.6);
    transition: transform 0.2s;
}
.leaderboard-table tr:hover {
    transform: translateX(4px);
    background: rgba(17, 24, 39, 0.8);
}
.leaderboard-table td {
    padding: 1rem;
    border: none;
}
.leaderboard-table td:first-child {
    border-radius: 8px 0 0 8px;
}
.leaderboard-table td:last-child {
    border-radius: 0 8px 8px 0;
}
.player-name {
    width: 250px;
    padding: 0 2rem;
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-name:hover {
    text-decoration: underline;
}
.streak-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 80px;
    padding-right: 25px;
    border-radius: 4px;
}

/* Custom scrollbar */
.leaderboard-table::-webkit-scrollbar {
    width: 8px;
}
.leaderboard-table::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.leaderboard-table::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.leaderboard-table::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Rank Badge */
.rank-badge {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    margin: 0 auto;
}
.rank-1 { background: #f1c40f; color: #000; }
.rank-2 { background: #bdc3c7; color: #000; }
.rank-3 { background: #e67e22; color: #000; }

/* Winstreak Animation */
.streak-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 80px;
    padding-right: 25px;
}

.streak-number {
    font-size: 1rem;
    color: var(--text);
    text-align: right;
    min-width: 20px;
    font-weight: 500;
    line-height: 1;
}

.fire-icon {
    position: absolute;
    right: 0;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-4px);
}

.fire-icon::after {
    content: '🔥';
    font-size: 1.2rem;
    transition: all 0.3s ease;
    line-height: 1;
}

/* Winstreak opacity and glow levels */
.streak-0 .fire-icon::after { 
    opacity: 0.7; 
    filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.3));
    animation: streakPulse 5s infinite;
}
.streak-1 .fire-icon::after { 
    opacity: 0.75; 
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.4));
    animation: streakPulse 4s infinite;
}
.streak-2 .fire-icon::after { 
    opacity: 0.8; 
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.45));
    animation: streakPulse 3s infinite;
}
.streak-3 .fire-icon::after { 
    opacity: 0.85; 
    filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.5));
    animation: streakPulse 2.75s infinite;
}
.streak-4 .fire-icon::after { 
    opacity: 0.9; 
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
    animation: streakPulse 2.5s infinite;
}
.streak-5 .fire-icon::after { 
    opacity: 0.95; 
    filter: drop-shadow(0 0 7px rgba(239, 68, 68, 0.7));
    animation: streakPulse 2.25s infinite;
}

@keyframes streakPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Admin Panel Styles */
/*.admin-section {
    background: rgba(17, 24, 39, 0.95);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.admin-card {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

/* Improved Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-label {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-select, .form-input {
    background: rgb(40, 40, 40);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 100%;
}

select option {
    background: rgb(40, 40, 40);
}

.form-select:focus, .form-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Player List Styles */
.player-list {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.5rem;
}

.player-list-item {
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Button Improvements */
.btn-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.matches-table-container {
    max-height: 600px;
    overflow-y: auto;
    margin-top: 1rem;
}

.matches-table {
    width: 100%;
    border-collapse: collapse;
}

.matches-table th,
.matches-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.matches-table th {
    background: rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 0;
    z-index: 1;
}

.matches-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-secondary {
    background: #4b5563;
    color: white;
}

.btn-secondary:hover {
    background: #374151;
}

.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-dark);
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

#match-manager-tbody {
    width: 100%;
}

.match-manager-table {
    width: 100%;
    margin-top: 20px;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.7rem;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}
.btn-danger {
    background: var(--secondary);
    color: white;
}
.btn-danger:hover {
    background: #e11d48;
    transform: translateY(-1px);
}
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.6rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}
.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    .card-title {
        font-size: 1rem;
    }
    .leaderboard-table {
        font-size: 0.8rem;
    }
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem;
    }
    .leaderboard-table th:first-child,
    .leaderboard-table td:first-child {
        width: 50px;
    }
    .leaderboard-table th:nth-child(2),
    .leaderboard-table td:nth-child(2) {
        width: auto;
    }
    .form-input, .btn {
        font-size: 0.6rem;
    }
}

/* Information Tab Styling */
.info-content {
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.5;
}
.info-content p {
    margin-bottom: 1rem;
}
.highlight {
    color: var(--primary);
}

/* Modal and Profile Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-dark);
    padding: 2rem;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Profile Stats and Layout */
.profile-container {
    padding: 2rem;
    color: var(--text);
}

.profile-header {
    background: rgba(17, 24, 39, 0.6);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #fff;
    text-align: center;
}

.profile-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #9ca3af;
    font-size: 0.875rem;
}

.mmr-chart-container {
    background: rgba(17, 24, 39, 0.6);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mmr-chart-container h3 {
    color: #fff;
    font-size: 1.25rem;
    margin: 0;
    padding: 0;
}

.mmr-history {
    margin-top: 0.5rem;
    max-height: 100px;
    overflow-y: auto;
}

.mmr-change-entry {
    display: flex;
    justify-content: space-between;
    padding: 0.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s;
}

.mmr-change-entry:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mmr-change-entry.win {
    color: #4ade80;
}

.mmr-change-entry.loss {
    color: #ef4444;
}

.badge-collection {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin: 1rem 0;
}

.badge {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.badge:hover {
    transform: scale(1.1);
}

.achievements-section {
    margin-top: 2rem;
}

.achievements-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.achievement-card {
    background: rgba(17, 24, 39, 0.6);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.achievement-card.unlocked {
    background: linear-gradient(45deg, rgba(37, 99, 235, 0.2), rgba(37, 99, 235, 0.3));
    border: 1px solid rgba(37, 99, 235, 0.4);
}

.achievement-card.locked {
    opacity: 0.8;
    background: rgba(17, 24, 39, 0.4);
}

.achievement-card.locked .achievement-badge {
    opacity: 0.7;
}

.achievement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.achievement-badge {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.achievement-info {
    flex: 1;
}

.achievement-info h4 {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
}

.achievement-info p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: #9ca3af;
}

.achievement-requirement {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.75rem 0 0.25rem 0;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Update fire icon for winstreak */


.rank-circle {
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    line-height: 30px;
    text-align: center;
    font-weight: bold;
    color: #fff;
}

.rank-gold {
    background-color: #FFD700; /* Gold */
}

.rank-silver {
    background-color: #C0C0C0; /* Silver */
}

.rank-bronze {
    background-color: #CD7F32; /* Bronze */
}

.match-recording-form {
    background: rgba(17, 24, 39, 0.6);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.player-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.score-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
}

.achievement-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(37, 99, 235, 0.5);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    animation: slideIn 0.5s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.achievement-notification .achievement-badge {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.match-recording-container {
    background: rgba(17, 24, 39, 0.8);
    border-radius: 12px;
    padding: 2rem;
    margin: 1rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.vs-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
}

.mmr-difference {
    font-size: 0.7rem;
    color: var(--text-light);
}

.preview-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.mmr-changes {
    display: flex;
    justify-content: space-around;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.form-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem;
    border-radius: 4px;
    width: 100%;
    font-size: 0.8rem;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.match-preview {
    text-align: center;
    margin-top: 1rem;
}

.match-form-container {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.player-selections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.player-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.score-input {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.match-preview {
    background: rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.preview-box {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.mmr-changes {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.match-manager-content {
    width: 90%;
    max-width: 900px;
    margin: 0 auto;
    background: rgb(40, 40, 40);
}

.match-table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
}

.match-table th, .match-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.score-input {
    width: 60px;
    margin: 0 5px;
    padding: 2px 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.match-manager-table td {
    vertical-align: middle;
    padding: 8px;
}

.tournament-bracket {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    width: 100%;
    overflow-x: auto;
    margin-top: 2rem;
}

.tournament-rounds {
    display: flex;
    justify-content: flex-start;
    gap: 4rem;
    width: fit-content;
    min-width: min-content;
    align-items: center;
}

.tournament-round {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 400px;
    position: relative;
    min-width: 250px;
    padding: 1rem;
}

.tournament-round:not(:first-child) {
    padding-top: 2rem;
}

.tournament-match {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    position: relative;
    margin: 1rem 0;
    min-width: 200px;
}

/* Connector lines */
.tournament-match::after,
.tournament-match::before {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
}

.tournament-match::after {
    right: -4rem;
    top: 50%;
    width: 4rem;
    height: 2px;
    transform: translateY(-50%);
}

.tournament-match::before {
    right: -4rem;
    top: 50%;
    height: calc(200% + 2rem);
    width: 2px;
    transform: translateY(-25%);
}

/* Hide connectors for last round and last match in round */
.tournament-round:last-child .tournament-match::after,
.tournament-round:last-child .tournament-match::before,
.tournament-match:last-child::before {
    display: none;
}

.tournament-player {
    padding: 0.75rem;
    margin: 0.25rem 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.tournament-player.winner {
    background: rgba(37, 99, 235, 0.3);
}

.tournament-player:hover {
    background: rgba(255, 255, 255, 0.15);
}

.score {
    font-weight: bold;
    margin-left: 1rem;
}

.tournament-controls {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.player-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.player-checkbox-wrapper {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.player-checkbox-wrapper input[type="checkbox"] {
    margin-right: 0.5rem;
}

.tournament-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}


/* Add this new keyframes animation for the glow effect */
@keyframes streakGlow {
    0% { filter: drop-shadow(0 0 5px var(--glow-color)); }
    50% { filter: drop-shadow(0 0 15px var(--glow-color)); }
    100% { filter: drop-shadow(0 0 5px var(--glow-color)); }
}

/* Update the streak container styles */
.streak-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 80px;
    padding-right: 25px;
    border-radius: 4px;
}

/* Add streak-specific glow levels */
.streak-1 .fire-icon::after {
    --glow-color: rgba(255, 165, 0, 0.3);
    animation: streakGlow 3s infinite;
}

.streak-2 .fire-icon::after {
    --glow-color: rgba(255, 165, 0, 0.4);
    animation: streakGlow 2.5s infinite;
}

.streak-3 .fire-icon::after {
    --glow-color: rgba(255, 165, 0, 0.5);
    animation: streakGlow 2s infinite;
}

.streak-4 .fire-icon::after {
    --glow-color: rgba(255, 165, 0, 0.6);
    animation: streakGlow 1.5s infinite;
}

.streak-5 .fire-icon::after {
    --glow-color: rgba(255, 165, 0, 0.7);
    animation: streakGlow 1s infinite;
}

.tournament-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-height: 400px;
}

.tournament-match {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    min-width: 200px;
}

.tournament-player {
    padding: 0.5rem;
    margin: 0.25rem 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.tournament-player:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tournament-player.winner {
    background: rgba(37, 99, 235, 0.3);
}

.tournament-message {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.6);
}
.tournament-match::after {
    content: '';
    position: absolute;
    right: -2rem;
    top: 50%;
    width: 2rem;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
}
.tournament-round:last-child .tournament-match::after {
    display: none;
}

/* Add this new class */
.truncate-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px; /* Adjust this value based on your layout */
    display: inline-block;
}

.mmr-history-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mmr-history-entry .match-date {
    font-size: 0.9em;
    color: #888;
    margin: 0;
}

.mmr-history-entry .match-result {
    margin: 2px 0;
}

.mmr-history-entry .mmr-change {
    font-weight: bold;
}

.mmr-change.positive {
    color: #4ade80;
}

.mmr-change.negative {
    color: #f87171;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
}

.stat-value {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: bold;
}

.stat-value.highlight {
    color: var(--primary);
}

.tournament-player .player-name {
    max-width: 230px;
    padding: 0px;
    color: #fff;
    text-overflow: none;
    overflow: visible;
    white-space: nowrap;
}

.tournament-tag {
    color: gold;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 0.5rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
}

/* MMR History Styles */
.mmr-history-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0;
}

.mmr-history-container h3 {
    margin: 0;
    padding: 0;
    font-size: 1rem;
    color: var(--text);
}

.mmr-details {
    max-height: 200px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    margin-top: 0.5rem;
}

/* Customize scrollbar */
.mmr-details::-webkit-scrollbar {
    width: 6px;
}

.mmr-details::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.mmr-details::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.mmr-history-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mmr-history-entry:first-child {
    padding-top: 0;
}

#mmrHistoryChart {
    margin: 0;
    padding: 0;
    height: auto;
}