:root {
  color-scheme: dark;
  --night: #070d17;
  --panel: #0e1a2c;
  --surface: #122239;
  --line: #223e57;
  --white: #f0f6fc;
  --muted: #a7bdd0;
  --cyan: #80e6f0;
  --gold: #ffdc93;
  --ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --numbers: system-ui, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--ui);
  color: var(--white);
  background: var(--night);
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 12% -10%, #142b48, transparent 58%),
    radial-gradient(ellipse at 90% 54%, #0e243b, transparent 68%),
    var(--night);
}
button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
[hidden] { display: none !important; }
.stage { max-width: 2140px; margin: auto; padding: 10px clamp(16px, 2.35vw, 50px) 15px; }
.masthead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 2vw, 42px);
  padding-block: 1px 8px;
  border-bottom: 1px solid #345a776b;
}
.brand-mark { display: block; width: clamp(143px, 15.6vw, 260px); border-radius: 4px; }
.brand-mark img { display: block; width: 100%; height: auto; }
.challenge-title { min-width: 0; margin: 0; }
.challenge-title img {
  display: block;
  margin-inline: auto;
  width: min(100%, clamp(405px, 40vw, 738px));
  height: auto;
  filter: drop-shadow(0 5px 14px #040712bc);
}
.toolbar { display: flex; gap: clamp(8px, 1vw, 18px); align-items: center; }
.connection { display: inline-flex; align-items: center; gap: 7px; font-size: .83rem; color: #c3e9df; white-space: nowrap; }
.connection-indicator { width: 7px; height: 7px; border-radius: 50%; background: #76e6b8; box-shadow: 0 0 10px #57e6b277; }
.connection:not([data-state="live"]) { color: #f4d19d; }
.connection:not([data-state="live"]) .connection-indicator { background: #ffc26e; box-shadow: none; }
.toolbar-button {
  display: inline-flex; align-items: center; gap: 7px;
  color: #deedfa; border: 1px solid #45627c; background: #142238;
  min-height: 38px; padding: 0 11px; border-radius: 5px; font-size: .84rem;
  font-weight: 650; text-decoration: none; white-space: nowrap;
  transition: background .18s, border-color .18s;
}
.toolbar-button:hover { border-color: var(--cyan); background: #20364c; }
.toolbar-button svg { width: 17px; height: 17px; }
.toolbar-button-main { background: #8ee3ec; border-color: #b5edf5; color: #0c2635; }
.toolbar-button-main:hover { background: #b5edf5; color: #081f2a; }
.content {
  display: grid;
  grid-template-columns: minmax(250px, .49fr) minmax(0, 1fr);
  gap: clamp(11px, 1.25vw, 26px);
  padding-top: 13px;
}
.event {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: clamp(480px, 81svh, 880px);
  border: 1px solid #42819873;
  border-radius: 7px;
  overflow: hidden;
  background: #071020 url("/assets/arena-tech.webp") left 56% / cover no-repeat;
  box-shadow: 0 16px 42px #03061195;
}
.event::before {
  position: absolute;
  z-index: -1;
  content: "";
  inset: 0;
  background: linear-gradient(180deg, #06101cf2, #070e1c00 41%, transparent 73%, #020e1cea 100%);
}
.event::after {
  position: absolute;
  z-index: -1;
  content: "";
  inset: 7px;
  border: 1px solid #9ce5ee36;
  border-radius: 3px;
  pointer-events: none;
}
.event-heading { display: grid; justify-items: center; gap: 9px; padding: clamp(16px, 2.1vw, 38px) clamp(13px, 1.2vw, 24px) 0; }
.event-heading h2 { margin: 0; width: 100%; }
.title-art { display: block; width: 100%; max-width: 490px; height: auto; margin-inline: auto; filter: drop-shadow(0 5px 12px #02050caa); }
.slogan {
  margin: 0; padding: 5px 10px;
  border-top: 1px solid #ffd48b75;
  color: #f4e8d7; font-size: clamp(.82rem, 1.15vw, 1.35rem); font-weight: 650;
  text-align: center; letter-spacing: .065em;
}
.slogan em { color: var(--gold); font-style: normal; }
.event-rules {
  display: flex; justify-content: center; gap: clamp(7px, 1.27vw, 24px);
  margin: 0 7px 7px; padding: 12px 6px;
  border-top: 1px solid #63a6bf73; background: #081426e0;
}
.event-rules > div { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.event-rules > div + div { border-left: 1px solid #4c85a16b; padding-left: clamp(7px, 1.27vw, 24px); }
.event-rules strong { color: var(--gold); font: 710 clamp(1.3rem, 2.25vw, 2.85rem)/1 var(--numbers); font-variant-numeric: tabular-nums; }
.event-rules span { color: #dcecf8; font-size: clamp(.72rem, 1vw, 1.08rem); }
.leaderboard {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  border: 1px solid #477793;
  border-radius: 7px;
  overflow: hidden;
  background: linear-gradient(170deg, #142941, #0c1829 74%);
  box-shadow: 0 16px 42px #03061190;
}
.leaderboard::before {
  position: absolute;
  content: "";
  inset: 0 auto auto 0;
  width: 40%;
  height: 2px;
  background: linear-gradient(90deg, #8aeef6, #55d1ec13);
  pointer-events: none;
}
.board-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 18px;
  min-height: 69px;
  padding: clamp(10px, 1vw, 22px) clamp(12px, 1.6vw, 29px);
}
.board-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 11px; }
.board-title-line h2 {
  margin: 0; color: #f3f8fe;
  font-size: clamp(1.52rem, 2.6vw, 3.3rem); font-weight: 750; letter-spacing: .035em; line-height: 1.12;
}
.board-head p { margin: 5px 0 0; color: #b5cadd; font-size: clamp(.73rem, 1vw, 1.1rem); line-height: 1.32; }
.demo-label { padding: 2px 6px; border: 1px solid #d4ae685c; border-radius: 3px; background: #59442444; color: #ffe2b1; font-size: .7rem; white-space: nowrap; }
.period-picker {
  display: flex; align-items: stretch; gap: 4px; padding: 3px;
  border: 1px solid #3a627d; border-radius: 6px; background: #0a1627;
}
.period-picker button {
  min-width: clamp(46px, 6vw, 95px);
  padding: 7px 9px; border: 1px solid transparent; border-radius: 4px;
  color: #bacde0; background: transparent; font-size: clamp(.8rem, 1.13vw, 1.15rem); font-weight: 600;
  white-space: nowrap;
}
.period-picker button:hover { color: #e8faff; background: #183347; }
.period-picker button[aria-pressed="true"] { color: #d1faff; border-color: #7fe7edab; background: #1b4960; box-shadow: 0 0 12px #20b8d12c; }
table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.col-rank { width: 15%; }.col-name { width: 30%; }.col-age { width: 13%; }.col-score { width: 16%; }.col-time { width: 26%; }
th {
  height: clamp(26px, 4.2svh, 43px);
  color: #b4d1e3; background: #0e1e31; border-top: 1px solid var(--line); border-bottom: 1px solid #32536c;
  font-size: clamp(.75rem, 1vw, 1.04rem); font-weight: 620; text-align: center;
}
td {
  height: clamp(39px, 6.3svh, 69px); padding: 1px 3px;
  text-align: center; white-space: nowrap;
  background: var(--surface); border-bottom: 1px solid #25445eaa;
}
tbody tr:nth-child(even) td { background: #101f34; }
tbody tr.ranked-1 td { background: #2d2a29; border-bottom-color: #ae87505b; }
tbody tr.ranked-1 td:first-child { box-shadow: inset 2px 0 #f7bd5f; }
tbody tr.ranked-2 td { background: #1a2d42; }
tbody tr.ranked-3 td { background: #22273a; }
.rank-chip {
  display: inline-grid; place-items: center; vertical-align: middle;
  color: #b6cce0; font: 700 clamp(1.03rem, 1.55vw, 1.95rem)/1 var(--numbers); font-variant-numeric: tabular-nums;
}
.ranked-1 .rank-chip { --medal: url("/assets/medal-gold.webp"); }
.ranked-2 .rank-chip { --medal: url("/assets/medal-silver.webp"); }
.ranked-3 .rank-chip { --medal: url("/assets/medal-bronze.webp"); }
:is(.ranked-1, .ranked-2, .ranked-3) .rank-chip {
  position: relative;
  width: clamp(35px, 5.65svh, 62px); aspect-ratio: 1;
  background: var(--medal) center / contain no-repeat;
  color: #40200e; font-size: clamp(13px, 1.92svh, 23px); font-weight: 825;
}
:is(.ranked-1, .ranked-2, .ranked-3) .rank-number { position: absolute; left: 50%; top: 64%; transform: translate(-50%, -50%); }
.ranked-2 .rank-chip { color: #243445; }
.student { overflow: hidden; text-overflow: ellipsis; font-size: clamp(1.06rem, 1.65vw, 2.1rem); font-weight: 660; }
.student .row-demo { display: inline-block; margin-left: 5px; color: #e9bf8c; font-size: .56em; font-weight: 480; }
.age { color: #bdcfdf; font-size: clamp(.75rem, 1.18vw, 1.4rem); font-variant-numeric: tabular-nums; }
.score { color: #a3f2f7; font: 740 clamp(1.23rem, 2.15vw, 2.7rem)/1 var(--numbers); font-variant-numeric: tabular-nums; }
.ranked-1 .score { color: var(--gold); }
.score small { margin-left: .25em; font: 500 .51em var(--ui); }
.duration { color: #e6eff8; font: 600 clamp(.83rem, 1.47vw, 1.78rem)/1 var(--numbers); font-variant-numeric: tabular-nums; }
.duration small { color: #aabfd2; font-size: .64em; font-weight: 550; }
.placeholder td { height: clamp(150px, 33svh, 320px); color: #bed0df; white-space: normal; font-size: .93rem; }
.placeholder a { color: var(--cyan); text-underline-offset: 3px; }
.board-foot {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  margin-top: auto; padding: 8px clamp(10px, 1.5vw, 28px);
  color: #adc1d3; font-size: clamp(.68rem, .92vw, .9rem); font-variant-numeric: tabular-nums;
}
.board-foot time { flex-shrink: 0; }
.noscript { padding: 1rem; text-align: center; }

@media (max-width: 960px) {
  .content { grid-template-columns: 1fr; gap: 10px; }
  .event { grid-row: 2; min-height: 250px; background-size: auto 157%; background-position: right 58%; }
  .event::before { background: linear-gradient(90deg, #071021 28%, #07102100 78%); }
  .event-heading { justify-items: start; padding: 19px 14px 0; }
  .title-art { width: min(66%, 360px); margin-inline: 0; }
  .event-rules { width: fit-content; margin-left: auto; }
}
@media (max-width: 760px) {
  .stage { padding: 9px 10px 14px; }
  .masthead { grid-template-columns: minmax(0, 1fr) auto; column-gap: 7px; row-gap: 8px; }
  .challenge-title { grid-column: 1 / -1; grid-row: 2; }
  .challenge-title img { width: min(95%, 485px); }
  .toolbar { grid-column: 2; grid-row: 1; gap: 5px; }
  .brand-mark { width: clamp(110px, 31vw, 165px); }
  .toolbar-button { padding-inline: 6px; gap: 3px; min-height: 32px; font-size: .73rem; }
  .toolbar-button svg { width: 13px; height: 13px; }
  .connection { font-size: .72rem; gap: 5px; }
  .connection-indicator { width: 5px; height: 5px; }
  .content { padding-top: 9px; }
  .board-head { padding: 10px 9px; gap: 7px; }
  .board-title-line { gap: 4px 6px; }
  .board-title-line h2 { font-size: 1.38rem; }
  .board-head p { font-size: .69rem; }
  .period-picker button { min-width: 42px; padding: 5px 4px; }
  .event { min-height: clamp(174px, 46vw, 275px); }
  .event-rules { padding: 6px 9px; }
  .event-rules strong { font-size: 1.28rem; }
  .event-rules span { font-size: .68rem; }
  td { height: 42px; }
  .student { font-size: 1rem; }
  .rank-chip { font-size: 1.04rem; }
  :is(.ranked-1, .ranked-2, .ranked-3) .rank-chip { width: 36px; }
}
@media (max-width: 370px) {
  #fullscreen-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .period-picker button { min-width: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
