* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    margin-bottom: 5px;
    color: #2c3e50;
}

.subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 20px;
    font-style: italic;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

#toggle-btn {
    padding: 8px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

#toggle-btn:hover {
    background-color: #2980b9;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#speed-slider {
    width: 150px;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 20px;
}

.tournament-stats, .player-stats {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

h2 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.2rem;
}

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

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

th {
    background-color: #f1f1f1;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
}

/* Cross-reference chart (matchup grid) */
.matchup-grid-container {
    max-width: 1200px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    overflow-x: auto;
}

.grid-legend {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

.legend-color.win {
    background-color: rgba(46, 204, 113, 0.3);
}

.legend-color.draw {
    background-color: rgba(241, 196, 15, 0.3);
}

.legend-color.loss {
    background-color: rgba(231, 76, 60, 0.3);
}

.grid-container {
    display: grid;
    grid-template-columns: 150px repeat(10, minmax(45px, 1fr));
    gap: 1px;
    background-color: #ddd;
    border: 1px solid #ddd;
    font-size: 0.85rem;
}

.grid-header, .grid-cell {
    padding: 8px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.grid-header {
    background-color: #f1f1f1;
    font-weight: bold;
}

.grid-header.player-name {
    justify-content: flex-start;
}

.grid-header.diagonal {
    background-color: #e0e0e0;
}

.grid-cell.win {
    background-color: rgba(46, 204, 113, 0.3);
}

.grid-cell.draw {
    background-color: rgba(241, 196, 15, 0.3);
}

.grid-cell.loss {
    background-color: rgba(231, 76, 60, 0.3);
}

.grid-cell.no-result {
    background-color: white;
}