:root {
  color-scheme: dark;
  --bg: #071611;
  --row: rgba(20, 55, 45, 0.82);
  --row-alt: rgba(32, 84, 67, 0.76);
  --ink: #effff7;
  --muted: #b7d2c7;
  --line: rgba(157, 255, 198, 0.26);
  --glow: #9dff62;
  --cyan: #65f2d1;
  --gold: #f6f06a;
  --silver: #d5e8e0;
  --bronze: #ffbd74;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 4%, rgba(139, 255, 92, 0.24), transparent 24rem),
    radial-gradient(circle at 84% 18%, rgba(36, 199, 159, 0.18), transparent 26rem),
    linear-gradient(135deg, #08100f 0%, #0d1e1a 48%, #05110d 100%);
  color: var(--ink);
  font-size: 0.875rem;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 0 18%, rgba(119, 255, 90, 0.1) 18% 19%, transparent 19% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 0.0625rem, transparent 0.0625rem 3.5rem);
  mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, 0.42));
  content: "";
}

button {
  font: inherit;
}

button {
  cursor: pointer;
}

main {
  height: 100vh;
  width: 100%;
  margin: 0;
}

.leaderboard-section,
.rules-section {
  display: flex;
  flex-direction: column;
  width: min(68rem, calc(100vw - 2.5rem));
  height: 100vh;
  margin: 0 auto;
  padding: 2rem 0 0;
}

.scoreboard-hero {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 0.625rem;
}

.event-kicker {
  margin: 0 0 0.15rem;
  color: #d7f9e9;
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 0 0 1rem rgba(101, 242, 209, 0.42);
}

.scoreboard-hero h1 {
  margin: 0;
  color: var(--glow);
  font-size: clamp(2.4rem, 6vw, 4.75rem);
  font-style: italic;
  font-weight: 950;
  line-height: 0.9;
  text-shadow:
    0 0 0.75rem rgba(157, 255, 98, 0.52),
    0.18rem 0.18rem 0 rgba(0, 0, 0, 0.55);
}

.event-meta {
  display: grid;
  justify-items: end;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 800;
}

.event-meta strong {
  color: var(--cyan);
  font-size: 1.25rem;
}

.table-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 0.0625rem solid rgba(157, 255, 198, 0.36);
  border-radius: 0.5rem;
  background: rgba(3, 13, 10, 0.55);
  box-shadow:
    0 1.5rem 4rem rgba(0, 0, 0, 0.38),
    0 0 2rem rgba(66, 255, 155, 0.12);
}

.table-fixed {
  flex: 0 0 auto;
  background: transparent;
}

.table-scroll {
  flex: 1;
  max-height: none;
  overflow: auto;
  scrollbar-color: rgba(157, 255, 198, 0.3) transparent;
  scrollbar-width: thin;
}

body.presentation-mode .leaderboard-section {
  width: min(92vw, 82rem);
  padding: 2.2rem 0;
}

body.presentation-mode th,
body.presentation-mode td {
  height: 4rem;
  padding: 0 1.25rem;
}

body.presentation-mode thead th {
  font-size: 0.9rem;
}

body.presentation-mode .team-name,
body.presentation-mode .score {
  font-size: 1.25rem;
}

.table-scroll::-webkit-scrollbar {
  width: 0.5rem;
  height: 0.5rem;
}

.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
  border: 0.125rem solid transparent;
  border-radius: 62.4375rem;
  background: rgba(157, 255, 198, 0.28);
  background-clip: content-box;
}

.table-scroll:hover::-webkit-scrollbar-thumb {
  background: rgba(157, 255, 198, 0.44);
  background-clip: content-box;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 0.3125rem;
  min-width: 0;
}

.col-rank {
  width: 5.25rem;
}

.col-team {
  width: 34%;
}

.col-members {
  width: 44%;
}

.col-score {
  width: 8.5rem;
}

thead th {
  height: 2.6rem;
  background: linear-gradient(180deg, #5ff5d5 0%, #24c79b 100%);
  color: #06130f;
  font-size: 0.8rem;
  font-weight: 950;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

thead th:first-child {
  border-radius: 0.35rem 0 0 0.35rem;
}

thead th:last-child {
  border-radius: 0 0.35rem 0.35rem 0;
}

th,
td {
  height: 3.2rem;
  padding: 0 1rem;
  border-top: 0.0625rem solid rgba(187, 255, 211, 0.18);
  border-bottom: 0.0625rem solid rgba(187, 255, 211, 0.18);
  background: var(--row);
  vertical-align: middle;
}

td:first-child {
  border-left: 0.0625rem solid rgba(187, 255, 211, 0.18);
  border-radius: 0.35rem 0 0 0.35rem;
}

td:last-child {
  border-right: 0.0625rem solid rgba(187, 255, 211, 0.18);
  border-radius: 0 0.35rem 0.35rem 0;
}

tbody tr:nth-child(even) td {
  background: var(--row-alt);
}

tbody tr.top-1 td,
tbody tr.top-2 td,
tbody tr.top-3 td {
  background: linear-gradient(180deg, rgba(0, 172, 94, 0.95), rgba(2, 109, 64, 0.92));
  border-color: rgba(157, 255, 98, 0.42);
}

tbody tr.rank-up td {
  animation: rankRise 1.45s ease both;
}

tbody tr {
  cursor: default;
  transition:
    filter 160ms ease,
    transform 160ms ease;
}

tbody tr:hover {
  filter: brightness(1.12);
}

.rank {
  width: 5.25rem;
  color: #ecfff4;
  font-size: 1.1rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-shadow: 0 0 0.5rem rgba(157, 255, 98, 0.32);
}

.rank-up-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  margin-left: 0.35rem;
  border: 0.0625rem solid rgba(157, 255, 98, 0.56);
  border-radius: 62.4375rem;
  background: rgba(157, 255, 98, 0.2);
  color: var(--glow);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1.5;
  animation: rankBadge 1.55s ease both;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.medal {
  display: none;
  width: 0.4rem;
  height: 1.8rem;
  border-radius: 62.4375rem;
}

tr.top-1 .medal,
tr.top-2 .medal,
tr.top-3 .medal {
  display: inline-block;
}

tr.top-1 .medal {
  background: var(--gold);
}

tr.top-2 .medal {
  background: var(--silver);
}

tr.top-3 .medal {
  background: var(--bronze);
}

.team-name {
  overflow: hidden;
  color: #ffffff;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-list {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tbody tr.top-1 .member-list,
tbody tr.top-2 .member-list,
tbody tr.top-3 .member-list {
  color: #e7fff4;
}

.score {
  color: #f7fff9;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  white-space: nowrap;
  text-shadow: 0 0 0.75rem rgba(157, 255, 98, 0.32);
}

.score.count-up {
  color: var(--glow);
  animation: scoreFlash 1.1s ease both;
}

.empty-state {
  height: 7.5rem;
  color: var(--muted);
  text-align: center;
}

.rules-card {
  border: 0.0625rem solid rgba(157, 255, 198, 0.36);
  border-radius: 0.5rem;
  background: rgba(8, 28, 22, 0.86);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.38);
  padding: 2.125rem 2.375rem;
}

.rules-card h1 {
  margin: 0 0 1.125rem;
  color: var(--glow);
  font-size: 2rem;
  line-height: 1.25;
}

.rules-content {
  max-width: 56.25rem;
  color: #e8fff4;
  font-size: 1.0625rem;
  line-height: 1.9;
  white-space: pre-wrap;
}

@keyframes scoreFlash {
  0% {
    color: var(--glow);
    text-shadow:
      0 0 0.35rem rgba(157, 255, 98, 0.92),
      0 0 1.5rem rgba(101, 242, 209, 0.54);
    transform: scale(1.18);
  }
  58% {
    color: #ffffff;
    transform: scale(1);
  }
  100% {
    color: #f7fff9;
    text-shadow: 0 0 0.75rem rgba(157, 255, 98, 0.32);
    transform: scale(1);
  }
}

@keyframes rankRise {
  0% {
    background-color: rgba(157, 255, 98, 0.34);
    box-shadow: inset 0 0 0 rgba(157, 255, 98, 0);
    transform: translateY(0.45rem);
  }
  28% {
    box-shadow: inset 0 0 2.2rem rgba(157, 255, 98, 0.25);
    transform: translateY(-0.18rem);
  }
  100% {
    background-color: inherit;
    box-shadow: inset 0 0 0 rgba(157, 255, 98, 0);
    transform: translateY(0);
  }
}

@keyframes rankBadge {
  0% {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.88);
  }
  22% {
    opacity: 1;
    transform: translateY(-0.2rem) scale(1.04);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-0.6rem) scale(1);
  }
}

@media (max-width: 47.5rem) {
  .leaderboard-section,
  .rules-section {
    width: calc(100vw - 1.5rem);
  }

  .scoreboard-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .event-meta {
    justify-items: start;
  }

  .col-members {
    width: 36%;
  }

  th,
  td {
    padding: 0 0.625rem;
  }

  .rules-card {
    padding: 1.5rem 1.25rem;
  }
}
