:root {
  color-scheme: dark;
  --page-black: #030609;
  --surface: rgba(6, 11, 17, 0.84);
  --surface-strong: rgba(8, 14, 21, 0.94);
  --surface-hover: rgba(15, 23, 34, 0.94);
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text-primary: #f7f8fa;
  --text-secondary: #a6adb8;
  --text-muted: #79828e;
  --blue: #3478ff;
  --blue-bright: #4d82ff;
  --purple: #8b5cf6;
  --orange: #ff9f0a;
  --green: #32c94b;
  --gold: #ffd21c;
  --silver: #d6dbe2;
  --bronze: #f07818;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page-black);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page-black);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.leaderboard-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
}

.leaderboard-page::before,
.leaderboard-page::after {
  position: fixed;
  z-index: -2;
  inset: 0;
  content: "";
  pointer-events: none;
}

.leaderboard-page::before {
  /* Exact, locally served copy of the specified Unsplash image:
     https://images.unsplash.com/photo-1509023464722-18d996393ca8 */
  background-image: url("/leaderboard/background.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.leaderboard-page::after {
  z-index: -1;
  background: rgba(0, 0, 0, 0.6);
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff;
  color: #07101c;
  font-weight: 700;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid #70a0ff;
  outline-offset: 3px;
}

.top-navigation {
  height: 64px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(1, 4, 7, 0.84);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.top-navigation__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1448px;
  height: 100%;
  margin-inline: auto;
  padding-inline: clamp(18px, 2.6vw, 38px);
}

.brand {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.brand-gradient {
  background: linear-gradient(100deg, #5f8cff 0%, #9b5cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.top-navigation__actions {
  display: flex;
  align-items: center;
  gap: 19px;
}

.about-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 44px;
  gap: 9px;
  border: 1px solid rgba(52, 120, 255, 0.85);
  border-radius: 8px;
  background: rgba(9, 15, 28, 0.78);
  color: #79a0ff;
  cursor: pointer;
  font-weight: 500;
  transition:
    border-color 170ms ease,
    background-color 170ms ease,
    color 170ms ease;
}

.about-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.about-button:hover,
.about-button[aria-expanded="true"] {
  border-color: #6697ff;
  background: rgba(24, 39, 72, 0.84);
  color: #a9c2ff;
}

.account-link {
  display: grid;
  width: 35px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: var(--text-secondary);
}

.account-link:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.09);
}

.account-link svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.leaderboard-shell {
  width: 100%;
  max-width: 1448px;
  margin-inline: auto;
  padding: 27px clamp(18px, 2.6vw, 38px) 34px;
}

.leaderboard-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 356px);
  align-items: end;
  gap: 18px;
  max-width: 1372px;
  min-height: 96px;
  margin-inline: auto;
  padding-bottom: 19px;
}

.leaderboard-heading > div:first-child {
  min-width: 0;
}

.leaderboard-heading h1 {
  margin: 0;
  font-size: clamp(37px, 3.1vw, 45px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.07;
  white-space: nowrap;
}

.leaderboard-heading h1 > span:last-child {
  margin-left: 7px;
}

.leaderboard-heading p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.4;
}

.period-selector {
  position: absolute;
  top: 140px;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 335px;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(4, 8, 14, 0.88);
  transform: translateX(-7%);
}

.period-selector button {
  min-width: 0;
  border: 0;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition:
    color 170ms ease,
    background 170ms ease,
    box-shadow 170ms ease;
}

.period-selector button:last-child {
  border-right: 0;
}

.period-selector button[aria-pressed="true"] {
  border: 1px solid #3269f0;
  border-radius: 10px;
  background: linear-gradient(105deg, rgba(31, 77, 203, 0.78), rgba(94, 55, 191, 0.68));
  box-shadow: inset 0 0 18px rgba(59, 130, 246, 0.18);
  color: #fff;
  font-weight: 600;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 356px);
  gap: 18px;
  width: 100%;
  max-width: 1372px;
  margin-inline: auto;
}

.leaderboard-primary {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 17px;
}

.glass-card {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.summary-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 128px;
  overflow: hidden;
  border-radius: 14px;
}

.summary-stat {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  min-width: 0;
  padding: 20px 20px;
}

.summary-stat:not(:last-child)::after {
  position: absolute;
  top: 23px;
  right: 0;
  width: 1px;
  height: 82px;
  background: var(--border-strong);
  content: "";
}

.stat-icon {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 7%, rgba(6, 11, 17, 0.78));
}

.stat-icon svg {
  width: 37px;
  height: 37px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.stat-icon--blue {
  color: #4d82ff;
}

.stat-icon--purple {
  color: #a158e8;
}

.stat-icon--orange {
  color: #ff9800;
}

.summary-stat > div {
  min-width: 0;
}

.summary-label {
  margin: 0 0 2px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-value {
  display: block;
  min-height: 35px;
  overflow: hidden;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  letter-spacing: -0.025em;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-context {
  display: block;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-card {
  min-height: 120px;
  padding: 20px 24px 16px;
  border-radius: 14px;
}

.progress-copy,
.progress-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.progress-copy p,
.progress-scale span {
  margin: 0;
}

.progress-heading {
  color: var(--text-secondary);
  font-size: 16px;
}

.progress-heading strong {
  color: var(--text-primary);
  font-weight: 650;
}

.progress-heading em,
.progress-comparison em {
  color: var(--blue-bright);
  font-style: normal;
}

.progress-comparison {
  flex: none;
  color: var(--text-secondary);
  font-size: 14px;
}

.rank-progress {
  height: 16px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(99, 111, 128, 0.32);
}

.rank-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4d82ff 0%, #684fe8 100%);
  box-shadow: 0 0 16px rgba(77, 130, 255, 0.32);
  transition: width 300ms ease;
}

.progress-scale {
  color: var(--text-secondary);
  font-size: 13px;
}

.ranking-card {
  overflow: visible;
  border-radius: 13px;
}

.table-scroll {
  overflow: visible;
  border-radius: inherit;
}

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

.ranking-card th {
  height: 43px;
  padding: 0 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
}

.ranking-card th:nth-child(1) {
  width: 92px;
  padding-left: 22px;
}

.ranking-card th:nth-child(2) {
  width: 140px;
}

.ranking-card th:nth-child(3) {
  width: 176px;
}

.ranking-card th:nth-child(4) {
  width: auto;
}

.ranking-card th:nth-child(5) {
  width: 148px;
  text-align: center;
}

.ranking-card th:nth-child(6) {
  width: 128px;
  padding-right: 24px;
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

.ranking-card td {
  position: relative;
  height: 48px;
  padding: 0 13px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--text-secondary);
  font-size: 15px;
  white-space: nowrap;
}

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

.ranking-card tbody tr:not(.current-row):not(.loading-row):hover td {
  background: rgba(148, 163, 184, 0.045);
}

.ranking-card td:first-child {
  padding-left: 22px;
}

.ranking-card td:nth-child(3) {
  color: var(--text-primary);
  font-weight: 500;
}

.ranking-card td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-card td:nth-child(5) {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ranking-card td:last-child {
  padding-right: 24px;
  text-align: right;
}

.rank-cell {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.rank-crown {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.rank-placeholder {
  width: 22px;
}

.rank-1 {
  color: var(--gold);
}

.rank-2 {
  color: var(--silver);
}

.rank-3 {
  color: var(--bronze);
}

.username-wrap {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
}

.username {
  overflow: hidden;
  text-overflow: ellipsis;
}

.patron-wrap {
  position: relative;
  display: inline-flex;
  flex: none;
}

.patron-badge {
  display: grid;
  width: 19px;
  height: 19px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #3269f0;
  color: #fff;
  cursor: help;
  font-size: 11px;
  line-height: 1;
}

.patron-tooltip {
  position: absolute;
  z-index: 40;
  top: calc(100% + 11px);
  left: 50%;
  width: max-content;
  max-width: min(220px, calc(100vw - 24px));
  padding: 7px 9px;
  border: 1px solid rgba(52, 120, 255, 0.8);
  border-radius: 7px;
  background: #071226;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
  color: #89a9ff;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -3px);
  transition:
    opacity 120ms ease 160ms,
    transform 120ms ease 160ms;
}

.patron-tooltip::before {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-top: 1px solid rgba(52, 120, 255, 0.8);
  border-left: 1px solid rgba(52, 120, 255, 0.8);
  background: #071226;
  content: "";
  transform: translate(-50%, 5px) rotate(45deg);
}

.patron-badge:hover + .patron-tooltip,
.patron-badge:focus-visible + .patron-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.points-pill {
  display: inline-flex;
  width: 91px;
  height: 31px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b46e00;
  border-radius: 999px;
  background: rgba(111, 60, 0, 0.44);
  color: #fff;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.top-three-row .points-pill {
  border-color: #ffae1a;
  background: linear-gradient(180deg, #ffad15, #fb8800);
}

.current-row td {
  border-top: 1px solid rgba(52, 120, 255, 0.72);
  border-bottom: 1px solid rgba(52, 120, 255, 0.72) !important;
  background: rgba(15, 43, 90, 0.3);
}

.current-row td:first-child {
  border-left: 1px solid rgba(52, 120, 255, 0.72);
  border-radius: 8px 0 0 8px;
}

.current-row td:last-child {
  border-right: 1px solid rgba(52, 120, 255, 0.72);
  border-radius: 0 8px 8px 0;
}

.current-row .rank-cell,
.current-row td:nth-child(3),
.current-row .username {
  color: #4d82ff;
}

.current-row .points-pill {
  border-color: #4d82ff;
  background: linear-gradient(180deg, #377cff, #4d5feb);
  box-shadow: 0 0 13px rgba(52, 120, 255, 0.2);
}

.mobile-row-details {
  display: none;
}

.empty-table {
  height: 150px !important;
  color: var(--text-secondary) !important;
  text-align: center !important;
  white-space: normal !important;
}

.leaderboard-sidebar {
  min-width: 0;
  padding-top: 287px;
}

.school-card {
  overflow: hidden;
  border-radius: 14px;
}

.school-card__header {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 76px;
  padding: 0 25px;
  border-bottom: 1px solid var(--border);
}

.school-card__header svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.school-card__header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.school-table th {
  height: 47px;
  padding: 0 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}

.school-table th:first-child,
.school-table td:first-child {
  width: 65px;
  padding-left: 25px;
}

.school-table th:last-child,
.school-table td:last-child {
  width: 92px;
  padding-right: 24px;
  text-align: right;
}

.school-table td {
  height: 59px;
  padding: 0 13px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--text-secondary);
  font-size: 14px;
}

.school-table td:nth-child(2) {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-table tbody tr:nth-child(1) td:first-child {
  color: var(--gold);
}

.school-table tbody tr:nth-child(2) td:first-child {
  color: var(--silver);
}

.school-table tbody tr:nth-child(3) td:first-child {
  color: var(--bronze);
}

.school-view-button {
  display: flex;
  width: calc(100% - 48px);
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 18px 24px;
  border: 1px solid rgba(52, 120, 255, 0.72);
  border-radius: 7px;
  background: rgba(10, 18, 33, 0.46);
  color: #5f8cff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.school-view-button:hover {
  background: rgba(52, 120, 255, 0.12);
  border-color: #6697ff;
}

.school-notice {
  margin: -4px 24px 18px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.leaderboard-note {
  display: flex;
  min-height: 54px;
  align-items: end;
  justify-content: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.leaderboard-note svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.leaderboard-note i {
  width: 1px;
  height: 20px;
  margin-inline: 10px;
  background: var(--border-strong);
}

.about-popover {
  position: fixed;
  z-index: 200;
  top: 77px;
  right: max(18px, calc((100vw - 1448px) / 2 + 37px));
  width: 334px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: rgba(8, 14, 21, 0.97);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.about-popover::before {
  position: fixed;
  top: 71px;
  right: max(71px, calc((100vw - 1448px) / 2 + 91px));
  width: 15px;
  height: 15px;
  border-top: 1px solid var(--border-strong);
  border-left: 1px solid var(--border-strong);
  background: rgba(8, 14, 21, 0.97);
  content: "";
  transform: rotate(45deg);
}

.about-popover__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 13px;
}

.about-popover__heading h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.about-popover__heading button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 27px;
  font-weight: 300;
}

.about-popover__heading button:hover {
  background: rgba(148, 163, 184, 0.09);
  color: #fff;
}

.scoring-list {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0 19px 14px;
  list-style: none;
}

.scoring-list li {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
  column-gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.scoring-list li strong {
  grid-column: 2;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
}

.rule-icon {
  display: grid;
  grid-row: 1 / span 2;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.rule-icon--clock {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

.rule-icon--attempt,
.rule-icon--rishai {
  color: var(--blue-bright);
}

.rule-icon--correct {
  color: var(--green);
}

.rule-icon--incorrect {
  color: var(--orange);
}

.about-detail {
  padding: 14px 21px 10px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.48;
}

.about-detail p {
  margin: 0 0 9px;
}

.about-detail strong {
  color: var(--text-primary);
  font-weight: 600;
}

.about-motivation {
  margin: 0;
  padding: 15px 26px 17px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.about-motivation span {
  color: var(--blue-bright);
}

.about-backdrop {
  position: fixed;
  z-index: 190;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
}

.skeleton-value,
.skeleton-line,
.loading-bar {
  overflow: hidden;
  border-radius: 5px;
  background: linear-gradient(
    100deg,
    rgba(148, 163, 184, 0.08) 20%,
    rgba(148, 163, 184, 0.18) 40%,
    rgba(148, 163, 184, 0.08) 60%
  );
  background-size: 200% 100%;
  animation: shimmer 1.35s linear infinite;
}

.skeleton-value {
  width: 92px;
  height: 27px;
  margin-block: 4px;
}

.skeleton-line {
  display: inline-block;
  width: min(260px, 45%);
  height: 15px;
}

.loading-row td {
  height: 48px;
  padding-inline: 22px;
}

.loading-bar {
  display: block;
  width: 100%;
  height: 14px;
}

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

[hidden] {
  display: none !important;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 1180px) {
  .summary-stat {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 11px;
    padding-inline: 14px;
  }

  .stat-icon {
    width: 58px;
    height: 58px;
  }

  .stat-icon svg {
    width: 30px;
    height: 30px;
  }

  .summary-value {
    font-size: 23px;
  }

  .leaderboard-heading,
  .leaderboard-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 999px) {
  .leaderboard-shell {
    padding-top: 24px;
  }

  .leaderboard-heading {
    display: flex;
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding-bottom: 18px;
  }

  .leaderboard-heading h1 {
    white-space: normal;
  }

  .period-selector {
    position: static;
    width: min(100%, 420px);
    transform: none;
  }

  .leaderboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .leaderboard-sidebar {
    padding-top: 0;
  }

  .school-card {
    max-width: none;
  }

  .about-popover {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: min(82vh, 680px);
    border-radius: 17px;
  }

  .about-popover::before {
    display: none;
  }

  .about-popover__heading {
    position: sticky;
    z-index: 1;
    top: 0;
    background: rgba(8, 14, 21, 0.98);
  }
}

@media (max-width: 760px) {
  .top-navigation__inner {
    padding-inline: 16px;
  }

  .brand {
    font-size: 21px;
  }

  .about-button {
    width: 104px;
  }

  .top-navigation__actions {
    gap: 8px;
  }

  .leaderboard-shell {
    padding: 21px 16px 28px;
  }

  .leaderboard-heading h1 {
    font-size: clamp(32px, 10vw, 41px);
  }

  .leaderboard-heading h1 > span:last-child {
    display: block;
    margin-left: 0;
  }

  .leaderboard-heading p {
    font-size: 15px;
  }

  .period-selector {
    width: 100%;
  }

  .summary-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-stat {
    min-height: 108px;
  }

  .summary-stat:nth-child(2)::after {
    display: none;
  }

  .summary-stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .progress-card {
    padding-inline: 17px;
  }

  .progress-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .progress-comparison {
    white-space: normal;
  }

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

  .ranking-card table {
    table-layout: auto;
  }

  .ranking-card th,
  .ranking-card td {
    padding-inline: 9px;
  }

  .ranking-card th:nth-child(1),
  .ranking-card td:nth-child(1) {
    width: 72px;
    padding-left: 13px;
  }

  .ranking-card th:nth-child(3) {
    width: auto;
  }

  .ranking-card th:nth-child(6),
  .ranking-card td:nth-child(6) {
    width: 104px;
    padding-right: 13px;
  }

  .secondary-column {
    display: none;
  }

  .rank-cell {
    gap: 7px;
  }

  .rank-crown,
  .rank-placeholder {
    width: 18px;
  }

  .points-pill {
    width: 80px;
    height: 30px;
    font-size: 14px;
  }

  .mobile-row-details {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
    white-space: normal;
  }

  .mobile-row-details summary {
    width: fit-content;
    color: #7fa3ff;
    cursor: pointer;
  }

  .mobile-row-details p {
    margin: 3px 0 0;
    line-height: 1.4;
  }

  .leaderboard-note {
    align-items: center;
    flex-wrap: wrap;
    padding-top: 19px;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .summary-card {
    grid-template-columns: 1fr;
  }

  .summary-stat {
    grid-template-columns: 58px minmax(0, 1fr);
    min-height: 92px;
  }

  .summary-stat:not(:last-child)::after {
    top: auto;
    right: 15px;
    bottom: 0;
    left: 15px;
    width: auto;
    height: 1px;
  }

  .summary-stat:nth-child(2)::after {
    display: block;
  }

  .summary-stat:nth-child(-n + 2) {
    border-bottom: 0;
  }

  .school-card__header,
  .school-table th:first-child,
  .school-table td:first-child {
    padding-left: 17px;
  }

  .school-table th:last-child,
  .school-table td:last-child {
    padding-right: 17px;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass-card,
  .about-popover,
  .top-navigation {
    background: #080e15;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  .glass-card {
    background: rgba(6, 11, 17, 0.96);
  }
}
