/* A2I portal. Colours are tokens; dark mode redefines them. */
:root {
  color-scheme: light;
  --bg: #f7f5ff;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --line: #e1e4ea;
  --text: #12151c;
  --text-2: #4a5160;
  --muted: #6b7280;
  --brand: #5b3fe0;
  --brand-ink: #ffffff;
  --brand-soft: #efebff;
  --accent: #e8590c;
  --good: #0f8a4f;
  --good-soft: #e5f5ec;
  --warn: #b26b00;
  --warn-soft: #fdf3e1;
  --bad: #c92a2a;
  --bad-soft: #fdecec;
  --info: #1c6fc2;
  --info-soft: #e6f0fb;
  --gold: #c99400;
  --silver: #8a94a3;
  --bronze: #b0652d;
  --hero-from: #2a1d7a;
  --hero-to: #8a73f5;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;
  --grid: #e7e9ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 15.5px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 72px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > * { min-width: 0; }
h1, h2, h3 { overflow-wrap: anywhere; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; font-family: "Sora", "Inter", system-ui, sans-serif; }
h1 { font-size: 1.9rem; margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 32px 0 12px; }
h3 { font-size: 1.05rem; margin: 18px 0 8px; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.1rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 800; letter-spacing: .02em; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a, .navright a { color: var(--text-2); padding: 7px 11px; border-radius: 8px; font-weight: 500; }
.nav a:hover, .navright a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { color: var(--brand); background: var(--brand-soft); }
.navright { display: flex; gap: 6px; align-items: center; }
.navright a.btn { color: var(--brand-ink); padding: 6px 13px; }
.navright a.btn:hover { background: var(--brand); }

/* ---------- buttons and forms ---------- */
.btn, button { font: inherit; font-weight: 600; font-size: .93rem; border-radius: 9px; padding: 8px 15px; cursor: pointer;
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center;
  gap: 6px; text-decoration: none; line-height: 1.3; }
.btn:hover, button:hover { filter: brightness(1.06); text-decoration: none; }
.btn.ghost, button.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-2); }
.btn.danger, button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm, button.sm { padding: 4px 10px; font-size: .82rem; border-radius: 7px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local],
input[type=file], input[type=month], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; width: 100%; max-width: 100%; }
textarea { min-height: 120px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
label { display: block; font-weight: 600; font-size: .85rem; color: var(--text-2); margin: 12px 0 5px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
form.inline { display: inline; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }

/* ---------- cards, pills, flashes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .78rem;
  font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill.live, .pill.open, .pill.scored { background: var(--good-soft); color: var(--good); }
.pill.live::before, .pill.open::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: pulse 1.6s infinite; }
.pill.frozen, .pill.queued, .pill.upcoming { background: var(--info-soft); color: var(--info); }
.pill.running, .pill.ended, .pill.draft { background: var(--warn-soft); color: var(--warn); }
.pill.failed { background: var(--bad-soft); color: var(--bad); }
.pill.finished, .pill.closed { background: var(--surface-2); color: var(--text-2); }
.pill.final { background: var(--accent); color: #fff; }
@keyframes pulse { 50% { opacity: .35; } }
.flash { padding: 12px 16px; border-radius: 10px; margin: 0 0 16px; font-weight: 500; }
.flash.ok { background: var(--good-soft); color: var(--good); }
.flash.err { background: var(--bad-soft); color: var(--bad); }
.flash.info { background: var(--info-soft); color: var(--info); }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
table.lb td.rank { width: 64px; white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
table.lb tr.r1 td.rank { color: var(--gold); }
table.lb tr.r2 td.rank { color: var(--silver); }
table.lb tr.r3 td.rank { color: var(--bronze); }
table.lb td.team { font-weight: 650; }
table.lb td.team .members { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
table.lb td.main { font-weight: 800; }
table.lb tr.mine { background: var(--brand-soft); }
table.lb tr.flash-up { animation: flashup 2s; }
@keyframes flashup { from { background: var(--good-soft); } }
.up { color: var(--good); font-size: .78rem; font-weight: 700; margin-left: 6px; }
.down { color: var(--bad); font-size: .78rem; font-weight: 700; margin-left: 6px; }

/* ---------- home ---------- */
.hero { background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: #fff; padding: 56px 0 64px; }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); margin: 0 0 12px; font-weight: 800; letter-spacing: -.02em; }
.hero p.lead { font-size: 1.15rem; opacity: .9; max-width: 640px; margin: 0 0 24px; }
.hero .btn { background: #fff; color: #2a1d7a; border-color: #fff; border-radius: 999px; padding: 11px 22px; }
.hero .btn.ghost { border-radius: 999px; padding: 11px 22px; }
.hero .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.hero-stats { display: flex; gap: 36px; margin-top: 36px; flex-wrap: wrap; }
.hero-stats div strong { display: block; font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero-stats div span { opacity: .8; font-size: .9rem; }
.live-card { margin-top: -36px; position: relative; }
.live-card .emoji { font-size: 2.4rem; line-height: 1; }
.comp-card { display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.comp-card:hover { text-decoration: none; border-color: var(--brand); }
.comp-card .emoji { font-size: 1.8rem; }
.comp-card h3 { margin: 0; }
.comp-card .meta { color: var(--muted); font-size: .85rem; }
.podium-mini { display: flex; flex-direction: column; gap: 3px; font-size: .88rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 40px 0 14px; }
.section-head h2 { margin: 0; }

/* ---------- countdown ---------- */
.countdown { display: inline-flex; gap: 6px; font-variant-numeric: tabular-nums; }
.countdown .u { background: var(--surface-2); border-radius: 8px; padding: 4px 8px; text-align: center; min-width: 48px; }
.countdown .u b { display: block; font-size: 1.25rem; line-height: 1.1; }
.countdown .u i { font-style: normal; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cd-label { font-size: .82rem; color: var(--muted); margin-bottom: 4px; }

/* ---------- competition header ---------- */
.comp-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.comp-head .wrap { padding-top: 28px; }
.comp-head .title { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.comp-head .emoji { font-size: 2.6rem; line-height: 1; }
.comp-head h1 { margin: 0; }
.comp-head .tagline { color: var(--text-2); margin: 6px 0 0; }
.tabs { display: flex; gap: 2px; margin-top: 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.facts { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 16px; color: var(--text-2); font-size: .9rem; }
.facts b { color: var(--text); }

.prose { max-width: 780px; }
.prose h1 { font-size: 1.5rem; } .prose h2 { font-size: 1.25rem; } .prose h3 { font-size: 1.05rem; }
.prose table { margin: 12px 0; font-size: .92rem; }
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .88em; }
.prose pre { background: var(--surface-2); padding: 14px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--brand); margin: 12px 0; padding: 4px 16px; color: var(--text-2); }
pre.log { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 12px; border-radius: 10px; font-size: .82rem; }

.rounds { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.round-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); }
.round-box h3 { margin: 0 0 6px; font-size: 1rem; }
.round-box dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; font-size: .85rem; }
.round-box dt { color: var(--muted); }
.round-box dd { margin: 0; }

/* ---------- results ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end; margin: 8px 0 28px; }
.podium .p { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; text-align: center; box-shadow: var(--shadow); }
.podium .p .medal { font-size: 2.2rem; }
.podium .p .name { font-weight: 800; font-size: 1.1rem; margin-top: 4px; }
.podium .p .score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-2); }
.podium .p .who { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.podium .p .award { display: inline-block; margin-top: 6px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.podium .first { padding-top: 30px; border-color: var(--gold); border-width: 2px; }
.podium .first .award { color: var(--gold); } .podium .second .award { color: var(--silver); } .podium .third .award { color: var(--bronze); }
@media (max-width: 640px) { .podium { grid-template-columns: 1fr; } .podium .first { order: -1; } }
.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; display: block; }
.gallery figcaption { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.writeup { border-left: 3px solid var(--brand); }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .series path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .lbl { font-size: 11.5px; fill: var(--text-2); font-weight: 600; }
.chart .bar { fill: var(--series-1); }
.chart .bar:hover, .chart .bar.hl { fill-opacity: .8; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: .8rem; box-shadow: 0 4px 16px rgba(0,0,0,.12); white-space: nowrap; z-index: 5; display: none; }
.tip .k { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--text-2); margin-bottom: 8px; }
.legend .k { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile .v { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--muted); font-size: .82rem; }

/* ---------- big screen ---------- */
body.screen { background: var(--bg); }
.screen-wrap { max-width: 1600px; margin: 0 auto; padding: 28px 36px; }
.screen-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.screen-title { font-size: clamp(1.6rem, 3.2vw, 3rem); font-weight: 800; margin: 0; }
.screen-sub { color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.4rem); }
.screen .countdown .u { min-width: clamp(60px, 6vw, 100px); }
.screen .countdown .u b { font-size: clamp(1.6rem, 3.5vw, 3.4rem); }
.banner { margin: 18px 0; padding: 14px 20px; border-radius: var(--radius); font-size: clamp(1rem, 1.5vw, 1.4rem); font-weight: 700; text-align: center; }
.banner.frozen { background: var(--info-soft); color: var(--info); }
.banner.revealed { background: var(--warn-soft); color: var(--warn); }
.screen table.lb { font-size: clamp(1rem, 1.6vw, 1.6rem); }
.screen table.lb td { padding: clamp(10px, 1.2vw, 16px) 14px; }
.screen table.lb th { font-size: clamp(.72rem, .95vw, 1rem); }
tr.reveal-hidden { opacity: 0; transform: translateY(12px); }
tr.reveal-in { opacity: 1; transform: none; transition: opacity .9s, transform .9s; }

footer.site { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .85rem; background: var(--surface); }

@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 1.5rem; }
  .topbar .wrap { gap: 4px 8px; padding-top: 8px; padding-bottom: 8px; }
  .logo { flex: 1; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -11px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
  .comp-head .emoji { font-size: 2rem; }
  .comp-head .title > .row { flex-wrap: nowrap; }
  .facts { gap: 12px; }
  .hide-sm { display: none; }
  .hero { padding: 40px 0 56px; }
  .hero-stats { gap: 22px; }
  .screen-wrap { padding: 16px; }
  .card { padding: 16px; }
  th, td { padding: 8px 8px; }
}

:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; background: #fff; padding: 12px; border: 2px solid var(--brand); }
.skip-link:focus { top: 8px; }
.grid { grid-template-columns: repeat(auto-fill,minmax(min(300px,100%),1fr)); }
@media(prefers-reduced-motion:reduce) {
 .pill.live::before, .pill.open::before, table.lb tr.flash-up { animation: none; }
 tr.reveal-hidden { opacity: 1; transform: none; }
 tr.reveal-in { transition: none; }
}
