:root {
    --color-background: #111827;
    --color-surface: #1F2937;
    --color-border: #374151;
    --color-primary: #EF4444;
    --color-success: #10B981;
    --color-text-primary: #F9FAFB;
    --color-text-secondary: #9CA3AF;
    --font-family: 'Poppins', sans-serif;
}
body {
    background-color: var(--color-background);
    color: var(--color-text-primary);
    font-family: var(--font-family);
    margin: 0;
}
.main-container {
    max-width: 95%;
    margin: 2rem auto;
    padding: 0 1rem;
}
.main-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--color-text-primary);
}
.back-button { 
    display: inline-flex; 
    align-items: center;
    gap: 8px;
    margin-bottom: 2rem; 
    padding: 10px 20px; 
    background-color: var(--color-surface); 
    color: var(--color-text-primary); 
    text-decoration: none; 
    border-radius: 8px;
    border: 1px solid var(--color-border);
    transition: background-color 0.3s, border-color 0.3s;
    font-weight: 500;
}
.back-button:hover { background-color: var(--color-border); }
.bracket-wrapper { width: 100%; }
.bracket-container {
    display: flex;
    gap: 50px;
    padding: 20px;
    overflow-x: auto;
    background-color: var(--color-background);
    border-radius: 8px;
}
.round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 300px;
}
.round-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: var(--color-primary);
}
.match {
    background-color: var(--color-surface);
    border-radius: 8px;
    margin-bottom: 50px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.match::after {
    content: '';
    position: absolute;
    right: -27px;
    top: 50%;
    width: 25px;
    height: 2px;
    background-color: var(--color-border);
}
.round:last-child .match::after { display: none; }
.match:nth-of-type(odd)::before {
    content: '';
    position: absolute;
    right: -27px;
    top: 50%;
    width: 2px;
    height: calc(50% + 25px);
    background-color: var(--color-border);
}
.match:nth-of-type(even)::before {
    content: '';
    position: absolute;
    right: -27px;
    bottom: 50%;
    width: 2px;
    height: calc(50% + 25px);
    background-color: var(--color-border);
}
.team {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: #374151;
    transition: all 0.2s;
}
.team:first-of-type { border-radius: 8px 8px 0 0; }
.team:last-of-type { border-radius: 0 0 8px 8px; }
.team + .team { border-top: 1px solid var(--color-surface); }
.team img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    background-color: #4B5563;
}
.team.winner { background-color: var(--color-success); font-weight: 600; }
.team.loser { opacity: 0.5; }
.team-name { flex-grow: 1; }
.team-score { font-weight: 700; font-size: 1.1rem; }
.tba, .bye { color: var(--color-text-secondary); font-style: italic; padding: 0.75rem; }
.placeholder-message {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: var(--color-text-secondary);
    background-color: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: 12px;
}


.team-clickable {
    display: flex;
    align-items: center;
    flex-grow: 1;
    text-decoration: none;
    color: var(--color-text-primary);
    cursor: pointer;
    border-radius: 4px;
    padding: 4px;
    transition: background-color 0.2s;
}
.team-clickable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}


.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    background-color: var(--color-surface);
    margin: auto;
    padding: 2rem;
    border: 1px solid var(--color-border);
    width: 90%;
    max-width: 700px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.modal-close {
    color: #aaa;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover, .modal-close:focus { color: var(--color-text-primary); }
.stats-content {
    margin-top: 1.5rem;
}
.stats-table {
    width: 100%;
    border-collapse: collapse;
}
.stats-table th, .stats-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.stats-table th {
    background-color: #374151;
    font-weight: 600;
}
.stats-table tbody tr:hover {
    background-color: #374151;
}
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
