:root {
  --pico-font-size: 100% !important;
}

main.container-fluid {
  padding-inline: 0.5rem;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

hgroup * {
  margin-bottom: 0.5rem;
}

.controls label {
  display: block;
  margin: 0 0 0.5rem;
  white-space: nowrap;
}

.controls select {
  padding: 0.25rem 0.4rem;
}

.tabs {
  display: flex;
  justify-content: flex-start;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.tabs button {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.8rem;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--pico-muted-color);
  border-bottom: 2px solid transparent;
}

.tabs button[aria-current="true"] {
  color: var(--pico-primary);
  border-bottom-color: var(--pico-primary);
}

.cards {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  min-height: 0;
}

.col-charts {
  flex: 1 1 0;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.col-side {
  flex: 0 0 auto;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.cards article {
  margin: 0;
  padding: 0.75rem 1rem;
  max-width: 100%;
}

.cards details {
  margin: 0;
  border: 0;
  padding: 0;
}

.leaderboard-card table {
  width: 100%;
}

.cards summary {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.cards details:not([open]) > summary {
  margin-bottom: 0;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--pico-card-background-color);
}

td.rank {
  width: 3rem;
  color: var(--pico-muted-color);
}

td.time,
td.ratio {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.ratio {
  color: var(--pico-muted-color);
}

td {
  padding: 0.25rem 0.5rem;
}

#rows tr {
  cursor: pointer;
}

#rows tr.hovered td {
  background: color-mix(in oklab, var(--pico-primary) 18%, transparent);
}

.chart-card svg .domain,
.chart-card svg .tick line {
  stroke: currentColor;
  stroke-opacity: 0.3;
}

.chart-card svg .tick text {
  fill: currentColor;
}

.chart-plot path {
  fill: none;
}

.chart-plot .hl line {
  stroke-dasharray: 5 3;
  stroke-width: 1;
}

.chartwrap {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.chart-plot {
  flex: 1 1 0;
  min-width: 0;
}

.chart-plot path,
.chart-plot .marks,
.chart-plot .hl {
  transition:
  opacity 0.12s ease,
  filter 0.12s ease;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 500px;
  overflow-y: auto;
  font-size: 0.72rem;
}

.legend-actions {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
  position: sticky;
  top: 0;
  background: var(--pico-card-background-color);
}

.legend-actions button {
  width: auto;
  margin: 0;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.legend span.off {
  opacity: 0.4;
}

.legend span.off i {
  filter: grayscale(1);
}

.legend i {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 2px;
  flex: none;
}

/* must match LABEL_FONT in the script (it canvas-measures labels at this size) */
svg {
  font-size: 13px;
}

#heatmap {
  overflow-x: auto;
}

#heatmap svg {
  display: block;
  fill: currentColor;
}

#heatmap svg:not(:last-child) {
  margin-bottom: 1rem;
}

#heatmap svg text {
  font-variant-numeric: tabular-nums;
}

#heatmap text[data-student] {
  cursor: pointer;
}

@media (max-width: 1024px) {
  main.container-fluid {
    height: auto;
    overflow: visible;
  }

  .cards {
    flex-direction: column;
    flex: 0 0 auto;
  }

  .col {
    width: 100%;
  }

  .col-charts {
    overflow-y: visible;
    padding-right: 0;
  }

  .col-side {
    order: -1;
    overflow: visible;
  }

  .table-scroll {
    max-height: 32em;
    overflow-y: auto;
  }
}

#scores-view {
  overflow: auto;
  min-height: 0;
}

body.scores-active main.container-fluid {
  height: 100dvh;
  overflow: hidden;
}

body.scores-active #scores-view {
  flex: 1 1 0;
}

.scores-table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.scores-table th,
.scores-table td {
  padding: 0.25rem 0.25rem;
  white-space: wrap;
}

.scores-table td.sc,
.scores-table th.sc {
  padding-inline: 0.3rem;
}

.scores-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  text-align: center;
  background: var(--pico-card-background-color);
}

.scores-table thead tr:nth-child(2) th {
  top: 1.7rem;
}

.scores-table td.sc {
  text-align: right;
}

.scores-table .exgroup {
  border-left: 1px solid var(--pico-muted-border-color);
}

.scores-table th.student,
.scores-table td.student {
  position: sticky;
  left: 0;
  z-index: 10;
  text-align: left;
}

.scores-table thead th.student {
  z-index: 20;
}

/* hack: the frozen column needs an opaque base, with the stripe re-layered on for odd rows */
.scores-table.striped tbody tr td.student {
  background-color: var(--pico-background-color);
}

.scores-table.striped tbody tr:nth-child(odd) td.student {
  background-image: linear-gradient(
    var(--pico-table-row-stripped-background-color),
    var(--pico-table-row-stripped-background-color)
  );
}

.scores-table td.tot {
  font-weight: 600;
}

.scores-table td.muted {
  color: var(--pico-muted-color);
}