:root {
  color-scheme: light;
  --ink: #20252d;
  --muted: #68717e;
  --line: #dfe3e8;
  --line-strong: #c9d0d8;
  --wash: #f5f7f9;
  --panel: #ffffff;
  --blue: #1769aa;
  --blue-dark: #0f4778;
  --blue-soft: #e8f2fa;
  --gold: #d8a126;
  --silver: #9aa2ad;
  --bronze: #b86d45;
  --green: #1f8a4c;
  --red: #c43b3b;
  --purple: #8f3bb8;
  --orange: #d96f11;
  --header-height: 68px;
  --content-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #fff;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

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

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  color: var(--blue-dark);
}

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  height: var(--header-height);
  border-top: 3px solid var(--blue);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.nav-shell {
  display: flex;
  width: min(calc(100% - 40px), var(--content-width));
  height: 100%;
  margin: 0 auto;
  align-items: center;
  gap: 34px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  min-width: 188px;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}

.brand:hover {
  color: var(--ink);
}

.brand img {
  width: 43px;
  height: 43px;
  object-fit: contain;
}

.brand span {
  display: grid;
  line-height: 1.05;
}

.brand b {
  font-size: 19px;
  font-weight: 750;
}

.brand small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.nav-links {
  display: flex;
  height: 100%;
  align-items: stretch;
  gap: 5px;
}

.nav-links a {
  position: relative;
  display: grid;
  min-width: 72px;
  padding: 0 14px;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
}

.nav-links a.active::after {
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 3px;
  background: var(--blue);
  content: "";
}

.nav-links .nav-external {
  margin-left: 10px;
  color: var(--blue);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 0;
  color: var(--blue);
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

#app {
  min-height: calc(100vh - 172px);
  outline: none;
}

.page-shell {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 48px 0 70px;
}

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

.page-heading h1,
.page-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 31px;
  line-height: 1.2;
  font-weight: 730;
}

.page-heading p,
.section-heading p {
  max-width: 680px;
  margin: 9px 0 0;
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.source-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.source-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px #e4f4eb;
}

.hero-band {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.hero-inner {
  position: relative;
  display: grid;
  width: min(calc(100% - 40px), var(--content-width));
  min-height: 280px;
  margin: 0 auto;
  padding: 54px 0 45px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 60px;
}

.hero-copy h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.22;
  font-weight: 760;
}

.hero-copy h1 span {
  display: block;
  margin-top: 7px;
  color: var(--blue);
  font-size: 21px;
  font-weight: 650;
}

.hero-copy p {
  max-width: 680px;
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-mark {
  width: 148px;
  height: 148px;
  padding: 13px;
  border: 1px solid rgba(23, 105, 170, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 44px rgba(25, 58, 85, 0.12);
  object-fit: contain;
}

.metric-strip {
  position: relative;
  display: grid;
  width: min(calc(100% - 40px), var(--content-width));
  margin: -1px auto 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #fff;
  grid-template-columns: repeat(4, 1fr);
}

.metric {
  min-width: 0;
  padding: 20px 24px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 740;
}

.metric span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.home-content {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 48px 0 70px;
}

.section-block + .section-block {
  margin-top: 55px;
  padding-top: 46px;
  border-top: 1px solid var(--line);
}

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

.section-heading h2 {
  font-size: 24px;
}

.section-heading a {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
}

.chart-panel {
  min-height: 330px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#fff, #fcfdfe);
}

.medal-chart {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.chart-scroller {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.chart-legend {
  display: flex;
  padding: 17px 0 8px;
  justify-content: center;
  gap: 24px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: #fff;
  content: "";
  vertical-align: -1px;
}

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

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

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

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  color: #343a43;
  background: #fff;
  font-size: 12px;
  font-weight: 750;
}

.data-table tbody tr:nth-child(odd) {
  background: var(--wash);
}

.data-table tbody tr:hover {
  background: var(--blue-soft);
}

.team-name {
  max-width: 290px;
  font-weight: 650;
}

.member-list {
  display: flex;
  min-width: 230px;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.member-list .unknown {
  color: var(--muted);
}

.medal {
  white-space: nowrap;
  font-weight: 750;
}

.medal.gold {
  color: #9c6b00;
}

.medal.silver {
  color: #68707a;
}

.medal.bronze {
  color: #99502d;
}

.source-link {
  white-space: nowrap;
  font-size: 12px;
}

.filters {
  display: flex;
  margin-bottom: 28px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  align-items: end;
  gap: 14px;
}

.filter-group {
  display: grid;
  min-width: 148px;
  gap: 5px;
}

.filter-group.grow {
  min-width: 230px;
  flex: 1;
}

.filter-group span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.filter-group select,
.filter-group input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.season-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 36px;
}

.season-layout > *,
.training-layout > * {
  min-width: 0;
}

.season-nav {
  align-self: start;
  border-top: 1px solid var(--line);
}

.season-nav button {
  display: flex;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  justify-content: space-between;
  text-align: left;
}

.season-nav button::after {
  content: "›";
}

.season-nav button.active {
  color: var(--ink);
  font-weight: 750;
}

.season-section + .season-section {
  margin-top: 32px;
}

.season-section h2 {
  margin: 0 0 9px;
  font-size: 21px;
  line-height: 1.3;
}

.season-section .contest-caption {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.honor-table {
  min-width: 760px;
}

.rating-group + .rating-group {
  margin-top: 34px;
}

.rating-group h2 {
  margin: 0 0 11px;
  font-size: 21px;
}

.rating-table {
  min-width: 720px;
  table-layout: fixed;
}

.rating-table td,
.rating-table th {
  text-align: center;
}

.rating-table .rating-team {
  width: 210px;
  color: var(--ink);
}

.rating-table .handle {
  font-weight: 750;
}

.rating-table .handle.red {
  color: #e11d28;
}

.rating-table .handle.orange {
  color: var(--orange);
}

.rating-table .handle.purple {
  color: var(--purple);
}

.rating-table .handle.blue {
  color: #1359b7;
}

.rating-table .handle.gray {
  color: var(--muted);
  font-weight: 600;
}

.score-chart {
  display: grid;
  margin-top: 42px;
  padding-top: 38px;
  border-top: 1px solid var(--line);
  gap: 20px;
}

.score-chart h2 {
  margin: 0;
  font-size: 24px;
}

.bar-list {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(170px, 260px) minmax(220px, 1fr) 58px;
  align-items: center;
  gap: 13px;
  font-size: 12px;
}

.bar-label {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 20px;
  background: #edf0f3;
}

.bar-fill {
  min-width: 4px;
  height: 100%;
  background: var(--blue);
}

.bar-row:nth-child(2n) .bar-fill {
  background: var(--bronze);
}

.bar-row:nth-child(3n) .bar-fill {
  background: #5b8c76;
}

.bar-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.notice-band {
  margin-bottom: 26px;
  padding: 12px 15px;
  border-left: 3px solid var(--gold);
  color: #66552a;
  background: #fff9e9;
  font-size: 13px;
}

.training-layout {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 38px;
}

.training-dates {
  align-self: start;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.training-dates button {
  display: grid;
  width: 100%;
  min-height: 46px;
  padding: 6px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  font-size: 10px;
}

.training-dates button:last-child {
  border-bottom: 0;
}

.training-dates button.active {
  color: #fff;
  background: var(--blue);
  font-weight: 700;
}

.training-title {
  margin-bottom: 20px;
  text-align: center;
}

.training-title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

.training-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.standings-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
}

.standings-caption {
  padding: 7px 9px;
  color: #5b6570;
  background: #e8eaed;
  font-size: 12px;
  font-weight: 700;
}

.standings {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.standings th,
.standings td {
  height: 48px;
  padding: 4px 5px;
  border-right: 1px solid #d8dce0;
  border-bottom: 1px solid #d8dce0;
  text-align: center;
}

.standings th {
  height: 29px;
  background: #fff;
  font-weight: 750;
}

.standings .rank-cell {
  width: 38px;
}

.standings .who-cell {
  width: 200px;
  text-align: left;
}

.standings .solved-cell,
.standings .penalty-cell {
  width: 56px;
}

.standings tbody tr:nth-child(even) {
  background: #f5f6f7;
}

.standings tbody tr.highlight {
  background: #e9f2fb;
}

.problem-cell strong {
  display: block;
  color: var(--green);
  font-size: 12px;
}

.problem-cell small {
  display: block;
  color: #303740;
  font-size: 10px;
}

.problem-cell.failed strong {
  color: var(--red);
}

.problem-cell.first {
  background: #a8eeb8;
}

.rank-chart-wrap {
  margin-top: 36px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.rank-chart {
  display: block;
  width: 100%;
  min-width: 820px;
  height: auto;
}

.empty-state {
  padding: 56px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.loading-state {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 70px auto;
}

.loading-line {
  display: block;
  width: 48%;
  height: 16px;
  margin-bottom: 16px;
  background: #eef1f4;
}

.loading-line.short {
  width: 30%;
}

.site-footer {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.site-footer div {
  display: flex;
  justify-content: space-between;
}

.site-footer p {
  margin: 5px 0 0;
}

@media (max-width: 820px) {
  :root {
    --header-height: 62px;
  }

  .nav-shell {
    width: min(calc(100% - 28px), var(--content-width));
  }

  .brand {
    min-width: 0;
  }

  .brand img {
    width: 38px;
    height: 38px;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    left: 0;
    display: none;
    height: auto;
    padding: 8px 14px 14px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 14px 28px rgba(25, 41, 55, 0.11);
    flex-wrap: wrap;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    height: 42px;
    flex: 1 0 30%;
  }

  .nav-links a.active::after {
    right: 18px;
    left: 18px;
  }

  .nav-links .nav-external {
    margin-left: 0;
  }

  .hero-inner {
    min-height: 250px;
    padding: 38px 0 34px;
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 24px;
  }

  .hero-copy h1 {
    font-size: 29px;
  }

  .hero-copy h1 span {
    font-size: 17px;
  }

  .hero-mark {
    width: 88px;
    height: 88px;
    padding: 8px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

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

  .page-shell {
    padding-top: 34px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .season-layout,
  .training-layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .season-nav,
  .training-dates {
    display: flex;
    overflow-x: auto;
  }

  .season-nav button {
    width: auto;
    min-width: 118px;
    border-right: 1px solid var(--line);
  }

  .training-dates button {
    width: 110px;
    min-width: 110px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .filters {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .filter-group,
  .filter-group.grow {
    min-width: 0;
    flex: 1 1 180px;
  }

  .bar-row {
    grid-template-columns: minmax(100px, 150px) minmax(160px, 1fr) 46px;
  }
}

@media (max-width: 520px) {
  .hero-inner,
  .home-content,
  .metric-strip,
  .page-shell,
  .site-footer {
    width: min(calc(100% - 28px), var(--content-width));
  }

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

  .hero-mark {
    display: none;
  }

  .hero-copy p {
    font-size: 14px;
  }

  .metric {
    padding: 16px;
  }

  .metric strong {
    font-size: 23px;
  }

  .home-content {
    padding-top: 36px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .page-heading h1,
  .page-heading h2 {
    font-size: 27px;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 105px minmax(120px, 1fr) 42px;
    gap: 8px;
  }

  .site-footer div {
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
