:root {
  color-scheme: light;
  font-family: Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: #212121;
  background: #fafafa;
}

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

.banner {
  min-height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: #000;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 2px 5px #0004;
}

.scoreboard {
  margin: 30px auto;
  width: min(1360px, calc(100% - 32px));
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 5px 10px #0002, 0 3px 14px #0001;
}

h1 {
  margin: 0;
  padding: 22px 12px 10px;
  text-align: center;
  font-size: clamp(21px, 3vw, 32px);
  line-height: 1.35;
}

#score-status {
  margin: 8px 12px 13px;
  text-align: center;
  color: #606060;
  font-size: 14px;
}

.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  text-align: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

th, td { padding: 0 6px; }
th {
  height: 54px;
  border-bottom: 1px solid #d6d6d6;
  font-weight: 600;
  white-space: nowrap;
}
td {
  height: 49px;
  border-bottom: 1px solid #e6e6e6;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f6f6f6; }

.school-cell {
  min-width: 128px;
  white-space: nowrap;
}
.team-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 1px 0 #e6e6e6;
}
tbody tr:hover .team-cell { background: #f6f6f6; }

th button {
  position: relative;
  border: 0;
  padding: 8px 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
th button::after {
  position: absolute;
  top: 50%;
  left: calc(100% + 1px);
  transform: translateY(-50%);
  font-size: 10px;
  content: '↓';
  visibility: hidden;
}
th[aria-sort] button::after { visibility: visible; }
th[aria-sort="ascending"] button::after { content: '↑'; }

.case-columns { border-inline: 1px solid #e6e6e6; }
.case-group { height: 32px; }
.case-headers th { height: 30px; min-width: 49px; font-size: 12px; }
.case-headers button::after { font-size: 9px; }

.rank {
  display: inline-block;
  min-width: 34px;
  padding: 4px 8px;
  border-radius: 1em;
  background: #795548;
  color: #fff;
  font-weight: 500;
}
.rank[data-place="1"] { background: #ffeb3b; color: #212121; }
.rank[data-place="2"], .rank[data-place="3"] { background: #757575; }
.rank[data-place="11"], .rank[data-place="12"] { background: #eee; color: #333; }

.team-name {
  position: relative;
  display: inline-block;
  font-weight: 600;
  white-space: nowrap;
}
.team-id {
  position: absolute;
  z-index: 1;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  visibility: hidden;
  padding: 5px 9px;
  border-radius: 4px;
  background: #424242;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
}
.team-name:hover .team-id, .team-name:focus .team-id { visibility: visible; }
.total { font-weight: 700; }
.pending { color: #696969; }
.score-detail {
  position: relative;
  display: inline-block;
  padding: 3px 0;
  cursor: help;
}
.score-badge {
  position: absolute;
  top: -4px;
  right: -12px;
  padding-inline: 2px;
  border-radius: 3px;
  background: #fff1cc;
  color: #744900;
  font-size: 9px;
  font-weight: 700;
}
#score-tooltip {
  position: fixed;
  z-index: 5;
  width: max-content;
  max-width: min(330px, calc(100vw - 16px));
  padding: 8px 12px;
  border-radius: 4px;
  background: #333;
  color: #fff;
  box-shadow: 0 2px 8px #0003;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
  pointer-events: none;
}

@media (max-width: 680px) {
  .banner { min-height: 54px; padding-inline: 16px; }
  .scoreboard { width: calc(100% - 24px); margin-block: 16px; }
}
