:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #182033;
  --muted: #697386;
  --line: #dce3ef;
  --primary: #2457d6;
  --primary-soft: #e8eefc;
  --gold: #f3b51b;
  --silver: #a7b1c2;
  --bronze: #c5783c;
  --fourth: #5a8fcb;
  --fifth: #8f6ad8;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
    url("assets/page-background.jpg") center / cover fixed;
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.topbar {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  gap: 0;
  padding: 0;
  background: #111827;
  border-bottom: 1px solid var(--line);
}

.title-block {
  position: relative;
  grid-column: 2;
  overflow: hidden;
  text-align: center;
}

.title-block::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 34%;
  transform: translateX(-140%) skewX(-18deg);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.34),
    transparent
  );
  animation: titleLightSweep 3.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes titleLightSweep {
  0%,
  25% {
    transform: translateX(-140%) skewX(-18deg);
  }

  75%,
  100% {
    transform: translateX(340%) skewX(-18deg);
  }
}

.title-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 10px 0 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
}

.school-name {
  margin: 4px 0 0;
  color: var(--text);
  font-size: clamp(16px, 2.4vw, 24px);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.school-name.chinese {
  margin-top: 0;
  color: var(--text);
  font-size: clamp(26px, 4.8vw, 48px);
  letter-spacing: 0;
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.site-footer {
  padding: 22px 16px;
  background: #05070d;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.data-status {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.grade-filter {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: clamp(2px, 1vw, 12px);
  margin: 0 0 28px;
  width: 100%;
}

.grade-button {
  position: relative;
  flex: 0 1 calc((100% - 72px) / 7);
  display: inline-grid;
  place-items: center;
  width: clamp(42px, 13vw, 178px);
  max-width: 178px;
  aspect-ratio: 1.56;
  border: 0;
  background: transparent;
  color: #0b1d39;
  padding: 0;
  font: inherit;
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 800;
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

.grade-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grade-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}

.grade-button:hover,
.grade-button:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.08);
  outline: none;
}

.grade-button.active {
  color: #0f3f8f;
  filter: drop-shadow(0 8px 14px rgba(235, 181, 52, 0.35)) brightness(1.08);
}

.level-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: -10px 0 28px;
}

.level-button {
  border: 1px solid rgba(255, 210, 92, 0.5);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: #f6e7b0;
  padding: 9px 15px;
  font: inherit;
  font-size: clamp(12px, 1.3vw, 15px);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.level-button:hover,
.level-button:focus-visible {
  transform: translateY(-1px);
  border-color: #f3b51b;
  outline: none;
}

.level-button.active {
  border-color: #f3b51b;
  background: linear-gradient(135deg, #f3b51b, #fff0a8, #c78a16);
  color: #071327;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.summary {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 1.5vw, 18px);
  overflow: visible;
  padding-bottom: 0;
  margin-bottom: 34px;
}

.medal {
  position: relative;
  flex: 0 1 clamp(62px, 17vw, 190px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(62px, 17vw, 190px);
  height: clamp(62px, 17vw, 190px);
  padding: clamp(24px, 6.2vw, 70px) clamp(8px, 3.8vw, 42px) clamp(8px, 3.5vw, 40px);
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  text-align: center;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.medal::before {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}

.medal:hover,
.medal:focus-visible {
  transform: translateY(-2px);
  filter: drop-shadow(0 14px 18px rgba(31, 45, 70, 0.18));
  outline: none;
}

.medal span {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: clamp(1px, 0.4vw, 4px);
  color: var(--muted);
  font-size: clamp(8px, 1.5vw, 15px);
  font-weight: 700;
}

.medal strong {
  position: relative;
  z-index: 1;
  font-size: clamp(15px, 4vw, 38px);
  line-height: 1;
}

.gold::before {
  background-image: url("assets/medal-frame-1.png");
}

.silver::before {
  background-image: url("assets/medal-frame-2.png");
}

.bronze::before {
  background-image: url("assets/medal-frame-3.png");
}

.fourth::before {
  background-image: url("assets/medal-frame-4.png");
}

.fifth::before {
  background-image: url("assets/medal-frame-5.png");
}

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

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

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

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

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

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.rank-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: #eef3fb;
  border-bottom: 1px solid var(--line);
}

.rank-results-header h2 {
  margin-bottom: 0;
}

.rank-result-list {
  display: grid;
  max-height: min(62vh, 620px);
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.rank-result-list::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.rank-result-item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.rank-result-item:last-child {
  border-bottom: 0;
}

.empty-state {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-weight: 700;
}

.student-grid > .empty-state {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 18, 32, 0.48);
}

.modal-panel {
  width: min(920px, 100%);
  max-height: min(86vh, 760px);
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(12, 18, 32, 0.28);
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading p {
  margin-bottom: 2px;
  color: var(--muted);
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.student-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 158px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.student-card:hover,
.student-card:focus-visible {
  transform: translateY(-2px);
  border-color: #b7c7ef;
  box-shadow: 0 14px 30px rgba(31, 45, 70, 0.12);
  outline: none;
}

.avatar-frame {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 112px;
  height: 112px;
  justify-self: center;
  flex: 0 0 auto;
}

.avatar-window {
  display: inline-grid;
  place-items: center;
  width: 82%;
  height: 82%;
  margin-top: -9%;
  overflow: hidden;
  border-radius: 50%;
  background: var(--primary-soft);
}

.avatar,
.avatar-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.08);
  background: var(--primary-soft);
}

.avatar-initials {
  color: var(--primary);
  font-size: 18px;
  font-weight: 900;
}

.frame-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

.student-name {
  display: block;
  margin: 0 0 3px;
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.16;
}

.class-name {
  display: block;
}

.class-name,
.medal-summary,
.award-total {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
}

.medal-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  margin-top: 4px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.medal-summary span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.medal-summary img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.award-total {
  margin-top: 3px;
  font-weight: 700;
}

.ghost-button {
  grid-column: 3;
  justify-self: end;
  margin-right: clamp(12px, 3vw, 32px);
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--primary);
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--primary);
}

.ghost-button.small {
  padding: 7px 11px;
  font-size: 14px;
}

.profile {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  margin-bottom: 20px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: center;
}

.profile > * {
  margin-left: auto;
  margin-right: auto;
}

.profile .avatar-frame {
  width: min(320px, 62vw);
  height: min(320px, 62vw);
}

.profile .avatar-initials {
  font-size: 24px;
}

.profile h2 {
  margin-bottom: 8px;
  font-size: 30px;
}

.detail-back {
  display: block;
  margin: 0 auto 18px;
}

.level-group {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.level-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #eef3fb;
  border-bottom: 1px solid var(--line);
}

.level-title h3 {
  margin-bottom: 0;
}

.level-title span {
  color: var(--muted);
  font-weight: 700;
}

.award-item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.award-item:last-child {
  border-bottom: 0;
}

.rank-badge {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  justify-content: center;
  min-width: 78px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.rank-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 38%;
  transform: translateX(-140%) skewX(-22deg);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.82),
    transparent
  );
  animation: badgeLightSweep 1.45s ease-in-out infinite;
  pointer-events: none;
}

@keyframes badgeLightSweep {
  0% {
    transform: translateX(-140%) skewX(-22deg);
  }

  100% {
    transform: translateX(280%) skewX(-22deg);
  }
}

.rank-gold {
  background: var(--gold);
}

.rank-silver {
  background: var(--silver);
}

.rank-bronze {
  background: var(--bronze);
}

.rank-fourth {
  background: var(--fourth);
}

.rank-fifth {
  background: var(--fifth);
}

.award-name {
  margin: 0 0 4px;
  font-weight: 800;
}

.award-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.award-year {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 820px) {
  .section-heading,
  .topbar,
  .profile {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    display: flex;
    align-items: center;
    text-align: center;
    padding: 0;
  }

  .title-block {
    width: 100%;
  }

  .ghost-button {
    align-self: center;
  }

  .award-item {
    grid-template-columns: 1fr;
  }

  .rank-results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .rank-result-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  main {
    width: min(100% - 22px, 1160px);
    margin-top: 18px;
  }

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

  .summary {
    gap: clamp(3px, 1vw, 8px);
  }

  .student-grid {
    grid-template-columns: 1fr;
  }

  .student-card {
    grid-template-columns: 94px 1fr;
  }

  .avatar-frame {
    width: 94px;
    height: 94px;
  }
}
