body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #eee;
}

p {
    margin-top: 0.3em
}

.nav-bar {
    display: flex;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: #202833;
    border-bottom: 1px solid #10161d;
}

.nav-bar a {
    color: #dbe5f0;
    text-decoration: none;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
}

.nav-bar a:hover {
    background: #2e3a49;
}

.nav-bar a[aria-current="page"] {
    background: #3a4f67;
    color: #fff;
    font-weight: 600;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.is-loading,
body.is-loading * {
    cursor: progress !important;
}

.page {
    width: 100%;
    margin: 0;
    padding: 1rem;
}

.controls {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    align-items: center;
    background: white;
    border: 1px solid #ddd;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.summary {
    background: white;
    border: 1px solid #ddd;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.summary>section+section {
    margin-top: 0.9rem;
}

.main-content {
    display: grid;
    grid-template-columns: minmax(0, 450px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    min-height: 0;
}

.matches-panel {
    min-width: 0;
}

.matches-table-wrap {
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}

.matches-table {
    min-width: max-content;
}

.matches-table th,
.matches-table td {
    text-align: center;
}

.team-rollup-table th,
.team-rollup-table td {
    text-align: center;
}

.team-rollup-table th:first-child,
.team-rollup-table td:first-child {
    text-align: left;
}

.matches-table th:nth-child(2),
.matches-table td:nth-child(2),
.matches-table th:nth-child(3),
.matches-table td:nth-child(3),
.matches-table th:nth-child(4),
.matches-table td:nth-child(4) {
    white-space: nowrap;
}

.matches-table .video-col,
.matches-table .match-video-cell {
    width: 2.3rem;
    min-width: 2.3rem;
    max-width: 2.3rem;
    text-align: center;
}

.match-video-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 2px solid #3f57b8;
    text-decoration: none;
    line-height: 1;
    background: transparent;
    color: #3f57b8;
    position: relative;
}

.match-video-link:hover {
    background: rgba(63, 87, 184, 0.08);
}

.match-video-icon {
    width: 0;
    height: 0;
    border-top: 0.22rem solid transparent;
    border-bottom: 0.22rem solid transparent;
    border-left: 0.36rem solid currentColor;
    margin-left: 0.08rem;
}

.matches-filter {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    align-items: center;
    background: white;
    border: 1px solid #ddd;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.matches-filter label {
    margin: 0;
}

.matches-filter select,
.matches-filter input {
    width: 100%;
    box-sizing: border-box;
}

.matches-filter button {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.6rem;
}

.main-content .summary {
    margin-bottom: 0;
}

@media (min-width: 901px) {
    .main-content {
        height: calc(100dvh - 5rem);
        overflow: hidden;
        align-items: stretch;
    }

    .matches-panel {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
    }

    .matches-table-wrap {
        flex: 1;
        max-height: 100%;
    }

    .summary-panel {
        height: 100%;
        min-height: 0;
        overflow-y: auto;
    }
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.progress-list {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
    max-height: 180px;
    overflow: auto;
}

.progress-list li {
    margin: 0.2rem 0;
}

.spinner {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

.spinner.hidden {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #ddd;
}

.predictions,
.tournament-predictions {
    border-collapse: collapse;
    border-spacing: 0;
}

th,
td {
    border-bottom: 1px solid #eee;
    text-align: left;
    padding: 0.5rem;
}

.predictions .alliance-split {
    border-right: 1px solid #ddd;
    padding-right: 0.75rem;
}

.predictions .alliance-split-next {
    padding-left: 0.75rem;
}

.predictions .alliance-total {
    font-weight: 700;
}

.predictions .alliance-totals-row td {
    border-top: 2px solid #d6d6d6;
    background: #fbfbfb;
}

.predictions tbody tr.alliance-subheader-row td {
    border-top: 2px solid #bdbdbd;
    font-weight: 700;
}

.tournament-predictions .alliance-split {
    border-right: 1px solid #ddd;
    padding-right: 0.75rem;
}

.tournament-predictions .alliance-split-next {
    padding-left: 0.75rem;
}

.tournament-predictions .alliance-total {
    font-weight: 700;
}


.tournament-predictions tbody td.match-col {
    background: #f7f7f7;
}

.tournament-predictions tbody tr.alliance-subheader-row td {
    border-top: 2px solid #bdbdbd;
    font-weight: 700;
}

.tournament-predictions .match-col {
    text-align: left;
}

.tournament-predictions th,
.tournament-predictions td {
    text-align: center;
}

.tournament-predictions .alliance-team {
    margin-right: 0;
    min-width: 4.2ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.predictions th,
.predictions td {
    text-align: center;
}

tr:hover {
    background: #f1f6ff;
    cursor: pointer;
}

tr.selected-match {
    background: #fff59d;
}

tr.selected-match:hover {
    background: #ffe97f;
}

.team {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border: 1px solid #ddd;
    margin-right: 0.25rem;
    border-radius: 4px;
    background: #fafafa;
    font-family: "Bebas Neue", sans-serif;
    font-weight: 400;
}

.alliance-team {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border: 1px solid #ddd;
    margin-right: 0.25rem;
    border-radius: 4px;
    background: #fafafa;
    font-family: "Bebas Neue", sans-serif;
    font-weight: 400;
    text-decoration: none;
}

.alliance-red {
    color: #b00020;
}

.alliance-blue {
    color: #0047ab;
}

.placeholder {
    color: #666;
}

.trend-grid-wrap {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.trend-card {
    border: 1px solid #ddd;
    padding: 0;
    padding-top: 0.5rem;
    background: #fff;
}

.trend-card-head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
}

.trend-card h4 {
    margin: 0;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.trend-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
    margin-bottom: 0;
}

.trend-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.trend-legend-swatch {
    width: 28px;
    height: 10px;
    display: inline-block;
}

.trend-legend-team {
    font-weight: 600;
}

.trend-chart-wrap {
    position: relative;
    width: 100%;
    height: 176px;
}

.trend-chart {
    width: 100%;
    height: 100%;
    display: block;
    background: #fafafa;
}

.trend-axis {
    stroke: #666;
    stroke-width: 1;
}

.trend-grid {
    stroke: #ddd;
    stroke-width: 1;
}

.trend-axis-label {
    fill: #555;
    font-size: 9px;
}

.sortable-header {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.sortable-header:hover {
    text-decoration: underline;
}

.sortable-header .sort-indicator {
    display: inline-block;
    width: 1ch;
}

.competition-paths {
    overflow: hidden;
    padding: 0;
}

.competition-paths-header {
    margin-bottom: 0.5rem;
}

.competitor-performance-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.competitor-performance-title-row .page-section-heading {
    margin-right: 0.5rem;
}

.competitor-performance-title-row #updateCompetitorStatsStatus {
    margin-left: 0.25rem;
}

.page-section-heading {
    margin: 0;
    margin-top: 1.5rem;
    font-size: 1em;
}

#competitionPathsContainer {
    height: calc(100vh - 7rem);
    min-height: 420px;
    overflow: hidden;
    position: relative;
}

#competitionPathsContainer .mermaid {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

#competitionPathsContainer svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

#competitionPathsContainer svg .node rect,
#competitionPathsContainer svg .cluster rect,
#competitionPathsContainer svg .edgeLabel rect {
    stroke: #000 !important;
}

#competitionPathsContainer svg .node rect,
#competitionPathsContainer svg .cluster rect {
    rx: 10;
    ry: 10;
}

#competitionPathsContainer svg .cluster-label {
    font-size: 150% !important;
    font-weight: bold;
}

#competitionPathsContainer svg .cluster-label text,
#competitionPathsContainer svg .cluster-label span,
#competitionPathsContainer svg .cluster-label p {
    font-size: inherit !important;
}

h1,
h2,
h3,
h4 {
    margin-top: 2em;
    margin-bottom: 0.5em;
}

h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
    margin-top: 0;
}

h3 {
    font-size: 1em
}