:root {
  --bg: #1B1C21;
  --panel: #202129;
  --card: #2D2E37;
  --line: #2D2E37;
  --line-strong: #3D3E42;
  --text: #EDEDED;
  --muted: #9B9C9E;
  --dim: #5F5F66;
  --accent: #402FFF;
  --accent-soft: rgba(64, 47, 255, 0.2);
  --red: #EC1D35;
  --light: #EDEDED;
  --gold: #F2C94C;
  --silver: #C8C9CA;
  --bronze: #C98A5E;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --sans: Inter, system-ui, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.4;
}

h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; }

.container {
  width: 100%;
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 50px;
}

main { flex: 1; }

/* ── Шапка ─────────────────────────────────────────────── */

.topbar {
  margin: 10px 10px 0;
  padding: 22px 0;
  background: var(--light);
  border-radius: 12px;
}

.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar__logo { display: flex; flex: 0 1 auto; min-width: 0; }
.topbar__logo img { display: block; width: auto; height: 44px; max-width: 100%; }

.live {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 10px 16px;
  background: var(--bg);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

.live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
}

.live__label { text-transform: uppercase; letter-spacing: 0.06em; }
.live__time { color: var(--muted); }
.live__time:empty { display: none; }

.live[data-state='live'] .live__dot {
  background: var(--red);
  animation: pulse 1.6s ease-out infinite;
}

.live[data-state='offline'] .live__dot { background: var(--muted); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(236, 29, 53, 0.6); }
  100% { box-shadow: 0 0 0 9px rgba(236, 29, 53, 0); }
}

/* ── Заголовок ─────────────────────────────────────────── */

.hero { padding: 64px 0 40px; }

.chip {
  display: inline-block;
  padding: 8px 16px;
  background: var(--light);
  border-radius: 6px;
  color: var(--accent);
  font-size: 14px;
}

.hero h1 {
  margin-top: 24px;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.hero__lead {
  margin-top: 20px;
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.5;
}

/* ── Переключатель соревнований ────────────────────────── */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }

.tab {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 24px;
  border: 0;
  border-radius: 6px;
  background: var(--card);
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.tab:hover { opacity: 0.8; }
.tab[aria-selected='true'] { background: var(--accent); opacity: 1; }
.tab:focus-visible, a:focus-visible { outline: 2px solid var(--light); outline-offset: 2px; }
.tab__count { font-family: var(--sans); font-size: 13px; opacity: 0.7; }

/* ── Блок соревнования ─────────────────────────────────── */

.board { padding: 40px 0 100px; }

.board__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.board__head h2 {
  max-width: 900px;
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 500;
  line-height: 1.35;
}

.board__source {
  flex: none;
  padding-top: 4px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  text-underline-offset: 3px;
}

.board__source:hover { color: var(--text); }

.notice {
  margin-top: 24px;
  padding: 14px 20px;
  border-left: 3px solid var(--red);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
}

.stats {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  margin-top: 32px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat { padding: 24px 28px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { padding-left: 0; border-left: 0; }

.stat dt {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat dd {
  margin-top: 10px;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 500;
  line-height: 1.1;
}

.stat__sub { margin-top: 8px; color: var(--muted); font-family: var(--sans); font-size: 13px; }

.progress { height: 4px; margin-top: 14px; border-radius: 2px; background: var(--card); overflow: hidden; }
.progress span { display: block; width: 0; height: 100%; border-radius: 2px; background: var(--accent); transition: width 1s linear; }

.last { margin-top: 20px; color: var(--muted); font-family: var(--sans); font-size: 14px; }
.last b { color: var(--text); font-family: var(--mono); font-weight: 500; }

/* ── Таблица ───────────────────────────────────────────── */

.table-wrap { margin-top: 28px; overflow-x: auto; }

.lb { width: 100%; border-collapse: separate; border-spacing: 0; }

.lb th {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
  vertical-align: bottom;
  white-space: nowrap;
}

.lb td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

.lb tbody tr { background: var(--bg); }
.lb tbody tr:hover { background: var(--panel); }

.lb .c-place { width: 1%; padding-left: 0; text-align: left; }
.lb .c-name { text-align: left; }
.lb .c-total { width: 1%; padding-right: 0; }
.lb td.c-total { font-size: 20px; font-weight: 700; white-space: nowrap; }

.place {
  display: inline-block;
  min-width: 48px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.place--1 { background: var(--gold); color: var(--bg); font-weight: 700; }
.place--2 { background: var(--silver); color: var(--bg); font-weight: 700; }
.place--3 { background: var(--bronze); color: var(--bg); font-weight: 700; }

.name { display: block; font-size: 16px; font-weight: 500; overflow-wrap: break-word; }
.name__sub { display: block; margin-top: 2px; color: var(--muted); font-family: var(--sans); font-size: 12px; }

.letter { display: block; color: var(--text); font-family: var(--mono); font-size: 16px; letter-spacing: 0; }
.pname { display: block; margin-top: 4px; letter-spacing: 0.04em; text-transform: none; }

.val { display: block; font-size: 16px; font-weight: 500; white-space: nowrap; }
.meta { display: block; margin-top: 3px; color: var(--muted); font-family: var(--sans); font-size: 11px; white-space: nowrap; }

.is-zero .val, .is-fail .val { color: var(--muted); }
.is-none .val { color: var(--dim); }
.is-hidden .val { color: var(--gold); }

.flash { animation: flash 2.4s ease-out; }

@keyframes flash {
  0%, 25% { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
  100% { background: transparent; box-shadow: inset 0 -2px 0 transparent; }
}

.empty { padding: 48px 0; color: var(--muted); font-family: var(--sans); text-align: center; }

/* ── Подвал ────────────────────────────────────────────── */

.footer {
  padding: 32px 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
}

.footer__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

[hidden] { display: none !important; }

/* ── Адаптив ───────────────────────────────────────────── */

@media (max-width: 1000px) {
  .container { padding: 0 28px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stat--timer { grid-column: 1 / -1; padding-right: 0; border-bottom: 1px solid var(--line); }
  .stat--timer + .stat { padding-left: 0; border-left: 0; }
  .pname { display: none; }
}

@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .topbar { margin: 8px 8px 0; padding: 14px 0; }
  .topbar__logo img { height: 30px; }
  .live { padding: 8px 12px; font-size: 12px; }
  .hero { padding: 40px 0 28px; }
  .tab { flex: 1 1 0; justify-content: center; padding: 12px 14px; }
  .tab__count { display: none; }
  .board { padding: 28px 0 64px; }
  .board__head { flex-direction: column; gap: 8px; }
  .stat { padding: 18px 14px; }
  .lb th, .lb td { padding: 12px 5px; }
  .lb th { font-size: 10px; letter-spacing: 0.04em; }
  .lb td.c-total { font-size: 15px; }
  .letter { font-size: 14px; }
  .place { min-width: 34px; padding: 4px 6px; font-size: 13px; }
  .name { font-size: 13px; }
  .val { font-size: 13px; }
  .meta { display: none; }
}

@media (max-width: 420px) {
  .live__time { display: none; }
  .stat dt { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .live[data-state='live'] .live__dot, .flash { animation: none; }
  .progress span { transition: none; }
}
