* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(to bottom right, #f8fafc, #f1f5f9);
    min-height: 100vh;
    padding: 40px 20px;
    color: #1e293b;
}

.container {
    max-width: min(1500px, calc(100vw - 24px));
    margin: 0 auto;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    color: #1e293b;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 10px;
    font-size: 1rem;
}

/* grid view hyperlink */
.gridlink {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1rem;
}

/* League Selector */
.league-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.league-btn {
    padding: 12px 24px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.league-btn:hover {
    background: #f1f5f9;
}

.league-btn.active {
    background: linear-gradient(to right, #2563eb, #1d4ed8);
    color: white;
    border-color: #1d4ed8;
}

.league-btn.active.nl {
    background: linear-gradient(to right, #dc2626, #b91c1c);
    border-color: #b91c1c;
}

/* Selectors */
.selectors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.selector-group {
    display: flex;
    flex-direction: column;
}

.selector-group label {
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.selector-group select {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    color: #1e293b;
}

.selector-group select:hover {
    border-color: #94a3b8;
}

.selector-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Compare Button */
.compare-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(to right, #2563eb, #1d4ed8);
    color: white;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    margin-bottom: 30px;
}

.compare-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.compare-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Results */
.results {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 40px;
    animation: slideIn 0.3s ease-out;
}

.results.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Team Headers */
.team-headers {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    margin-bottom: 40px;
    align-items: start;
}

.team-header {
    text-align: center;
}

.logo-placeholder {
    width: 120px;
    height: 120px;
    background: #e2e8f0;
    border-radius: 8px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

.team-header h2 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 5px;
}

.team-header p {
    color: #64748b;
    font-size: 0.9rem;
}

/* Tiebreaker Rows */
.tiebreaker-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    padding: 25px 0;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
}

.tiebreaker-row:last-of-type {
    border-bottom: none;
}

.record {
    text-align: center;
    font-size: 1.8rem;
    font-weight: bold;
    color: #475569;
    padding: 10px;
}

.record.winner {
    color: #15803d;
    font-weight: 900;
    font-size: 2rem;
}

.label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Winner Box */
.winner-box {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(to right, #f0fdf4, #dcfce7);
    border: 2px solid #86efac;
    border-radius: 8px;
    text-align: center;
}

.winner-label {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 10px;
}

.winner-name {
    font-size: 2rem;
    font-weight: 900;
    color: #166534;
    margin-bottom: 10px;
}

.winner-method {
    font-size: 0.95rem;
    color: #64748b;
}

.winner-method strong {
    font-weight: 700;
    color: #166534;
}

.team-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 0 auto 20px;
    display: none;
}

.matrix-section {
    margin-top: 32px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 28px;
}

.matrix-header {
    margin-bottom: 18px;
}

.matrix-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.matrix-header p {
    color: #64748b;
    line-height: 1.5;
}

.matrix-wrapper {
    overflow-x: visible;
}

.tiebreaker-matrix {
    display: grid;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.matrix-cell {
    min-height: 58px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
}

.matrix-corner {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
}

.matrix-team-header,
.matrix-side-header {
    background: #eff6ff;
    flex-direction: column;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
}

.matrix-side-header {
    background: #f1f5f9;
}

.matrix-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.matrix-winner-cell {
    appearance: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.matrix-winner-cell:hover {
    transform: translateY(-1px);
    border-color: #60a5fa;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.matrix-diagonal {
    background: #e2e8f0;
    color: #94a3b8;
    font-size: 1rem;
    font-weight: 700;
}

.matrix-empty {
    color: #94a3b8;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.winner-logo {
    width: 30px;
    height: 30px;
}

@media (max-width: 768px) {
    body {
        padding: 24px 12px;
    }

    h1 {
        font-size: 2rem;
    }

    .selectors {
        grid-template-columns: 1fr;
    }

    .results,
    .matrix-section {
        padding: 20px;
    }

    .matrix-wrapper {
        overflow-x: auto;
    }

    .tiebreaker-matrix {
        min-width: max-content;
    }

    .team-headers,
    .tiebreaker-row {
        gap: 16px;
    }

    .team-logo {
        width: 72px;
        height: 72px;
    }

    .matrix-cell {
        min-height: 54px;
    }

    .matrix-logo {
        width: 24px;
        height: 24px;
    }
}
