:root {
  --bg: #f6f7fb;
  --panel: rgba(255, 255, 255, 0.88);
  --text: #172033;
  --muted: #657085;
  --school-muted: #9aa4b5;
  --line: #e7eaf2;
  --primary: #4757ff;
  --primary-dark: #303bd2;
  --gold: #f8c84c;
  --silver: #cbd2df;
  --bronze: #d89b65;
  --shadow: 0 18px 50px rgba(20, 30, 60, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% -10%, rgba(71, 87, 255, 0.22), transparent 32rem),
    radial-gradient(circle at 90% 0%, rgba(248, 200, 76, 0.24), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header,
main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 18px;
}

.brand {
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 10px;
}

.nav a {
  border-radius: 16px;
  color: var(--muted);
  padding: 11px 14px;
  text-decoration: none;
}

.nav a[aria-current="page"],
.nav a:hover {
  background: rgba(71, 87, 255, 0.1);
  color: var(--primary-dark);
}

main {
  padding-bottom: 54px;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 24px;
  align-items: stretch;
  padding: 18px 0 0;
}

.title-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
}

.history-heading {
  margin-top: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin: 10px 0;
  max-width: 780px;
  font-size: clamp(36px, 7vw, 72px);
  line-height: 0.94;
  letter-spacing: 0;
}

.subtitle {
  margin: 0;
  max-width: 670px;
  color: var(--muted);
  font-size: 14.5px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0;
  padding: 18px;
}

.stat {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.stat dt {
  display: block;
  margin: 0;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
}

.stat dd {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 26px 0;
}

.podium-card {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  padding: 24px;
}

.podium-card::after {
  position: absolute;
  right: -30px;
  bottom: -70px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(71, 87, 255, 0.1);
  content: "";
}

.rank-badge {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  font-weight: 900;
}

.rank-1 .rank-badge {
  border-color: #edb91f;
  background: var(--gold);
}

.rank-2 .rank-badge {
  border-color: #b6bfcc;
  background: var(--silver);
}

.rank-3 .rank-badge {
  border-color: #bf7d45;
  background: var(--bronze);
}

.podium h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.school,
.school-under-name {
  color: var(--school-muted);
}

.podium .school {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.podium-points {
  margin: 18px 0 0;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  margin-bottom: 18px;
}

.search {
  flex: 1;
}

.sort-control {
  width: min(220px, 100%);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(71, 87, 255, 0.12);
}

.table-card {
  overflow: hidden;
  margin-bottom: 54px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.78);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tr:hover td {
  background: rgba(71, 87, 255, 0.04);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.rank-cell {
  width: 80px;
  font-weight: 900;
}

.name-cell {
  width: 260px;
}

.name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.school-under-name {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
}

.activity-cell {
  min-width: 320px;
}

.activity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.activity-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid rgba(71, 87, 255, 0.14);
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(71, 87, 255, 0.06);
  font-size: 12px;
  line-height: 1.1;
}

.activity-label {
  color: #3f4a5f;
  font-weight: 700;
}

.activity-points {
  color: var(--primary-dark);
  font-weight: 900;
  white-space: nowrap;
}

.no-activity {
  font-size: 12px;
}

.pill {
  display: inline-flex;
  flex: 0 0 auto;
  min-width: max-content;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(71, 87, 255, 0.1);
  color: var(--primary-dark);
  font-weight: 900;
  white-space: nowrap;
}

.points-cell {
  width: 128px;
  min-width: 128px;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  text-decoration: none;
}

.history-item:hover {
  border-color: rgba(71, 87, 255, 0.36);
}

.history-item strong {
  font-size: 18px;
}

.history-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .hero,
  .podium {
    grid-template-columns: 1fr;
  }

  .controls,
  .history-item {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-control {
    width: 100%;
  }

  .table-scroll {
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 4px 14px;
    padding: 16px 18px;
  }

  tbody tr + tr {
    border-top: 1px solid var(--line);
  }

  td {
    border-bottom: 0;
    padding: 0;
  }

  .rank-cell {
    grid-column: 1;
    grid-row: 1 / span 3;
  }

  .name-cell {
    grid-column: 2;
    width: auto;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .activity-cell {
    grid-column: 2 / -1;
    grid-row: 2;
    min-width: 0;
    padding-top: 6px;
  }

  .activity-chip {
    font-size: 12px;
  }

  .points-cell {
    grid-column: 3;
    grid-row: 1;
    width: auto;
    min-width: max-content;
    white-space: nowrap;
  }
}
