/* Direction: timing tower for the room, control room for the admin.
   Palette, cut corners and type from the Deckhouse identity; composition is the race board, not the site. */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/onest-cyrillic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/onest-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/static/fonts/unbounded-cyrillic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/static/fonts/unbounded-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/static/fonts/roboto-mono-cyrillic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/static/fonts/roboto-mono-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #08090C;
  --panel: #101116;
  --panel-2: #15171E;
  --line: #23252F;
  --text: #FFFFFF;
  --muted: #9A9EAD;
  --muted-2: #8A8FA3;
  --blue: #004DF2;
  --brand: #0A6EFF;
  --blue-text: #6EA8FF;
  --lime: #C8FF50;
  --lime-ink: #00210A;
  --red: #FC4257;
  --danger-text: #C92230;
  --paper: #FFFFFF;
  --surface: #F6F6FD;
  --ink: #000000;
  --text-2: #42424C;
  --text-3: #6E7084;
  --display: "Unbounded", "Arial Black", sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Roboto Mono", ui-monospace, "SFMono-Regular", monospace;
  --board-width: 1280px;
  --admin-width: 1080px;
  color-scheme: light;
  scrollbar-color: #4A4D5C var(--bg);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; }
form { margin: 0; }
:focus-visible { outline: 3px solid var(--blue-text); outline-offset: 3px; }
::selection { background: var(--lime); color: var(--ink); }
input { caret-color: var(--blue); accent-color: var(--blue); }
a, button { text-underline-offset: 3px; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #4A4D5C; border: 3px solid var(--bg); border-radius: 8px; }

.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 20;
  padding: 10px 16px;
  background: var(--lime);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
  text-decoration: none;
}
.brand-logo { display: block; height: 30px; width: 30px; flex: none; }
.brand__name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
}
.topbar .brand { color: var(--brand); }
.topbar .brand__name { color: var(--text); }
.admin-app .brand { color: var(--blue); }
.admin-app .brand__name { color: var(--ink); }
.state .brand { color: var(--blue); }
.state .brand__name { color: var(--ink); }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(200, 255, 80, .16);
  flex: none;
}
.dot--pulse { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(200, 255, 80, .16); }
  50% { box-shadow: 0 0 0 9px rgba(200, 255, 80, 0); }
}

/* ---------- public board ---------- */
.board-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar__inner {
  max-width: var(--board-width);
  margin: 0 auto;
  padding: 0 36px;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}
.topbar__meta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__live {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--lime);
  white-space: nowrap;
}
.topbar__live span { color: var(--muted); font-weight: 600; }

.board {
  width: 100%;
  max-width: var(--board-width);
  margin: 0 auto;
  padding: 44px 36px 20px;
  flex: 1;
}
.board__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--blue);
}
.board__title {
  font-family: var(--display);
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: .95;
  text-transform: uppercase;
  text-wrap: balance;
}
.board__sub {
  max-width: 32ch;
  text-align: right;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}
.board__sub b { color: var(--text); font-weight: 600; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 34px 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-head h2 {
  font-size: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  text-transform: inherit;
}
.section-head__count { font-family: var(--mono); color: var(--muted-2); }

.track__list { display: grid; gap: 8px; }
.track__row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto 96px;
  align-items: center;
  gap: 20px;
  min-height: 92px;
  padding-right: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.track__pos {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -.02em;
}
.track__name {
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.track__time {
  font-family: var(--mono);
  font-size: clamp(34px, 4.4vw, 52px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--lime);
  white-space: nowrap;
}
.track__state {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--lime);
}
.track__empty {
  padding: 22px 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 15px;
}

.ranking__head, .rank {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 150px 104px;
  align-items: center;
  gap: 20px;
}
.ranking__head {
  padding: 10px 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-2);
  border-bottom: 1px solid var(--line);
}
.ranking__head span:nth-child(3),
.ranking__head span:nth-child(4) { text-align: right; }
.ranking__list { display: grid; }
.rank {
  min-height: 66px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  transition: background .15s ease;
}
.rank:hover { background: var(--panel-2); }
.rank__pos {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -.02em;
  color: var(--blue-text);
}
.rank__name {
  font-size: clamp(17px, 1.8vw, 21px);
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.rank__time {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.rank__finish {
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
  color: var(--muted-2);
  white-space: nowrap;
}
.rank--first {
  position: relative;
  margin: 10px 0 4px;
  min-height: 82px;
  padding: 16px 20px;
  background: var(--blue);
  color: #fff;
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 0 100%);
}
.rank--first:hover { background: var(--blue); }
.rank--first .rank__pos { color: #fff; font-size: 28px; }
.rank--first .rank__name { font-size: clamp(20px, 2.2vw, 27px); }
.rank--first .rank__time { color: var(--lime); font-size: 28px; }
.rank--first .rank__finish { color: #E4EDFE; }

.empty-board {
  position: relative;
  overflow: hidden;
  margin-top: 10px;
  padding: 40px 28px 42px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 16px;
}
.empty-board strong { color: var(--text); font-weight: 600; }
.empty-board p { position: relative; max-width: 56ch; }
.empty-board__zero {
  position: absolute;
  right: 18px;
  bottom: -48px;
  font-family: var(--display);
  font-size: 220px;
  font-weight: 900;
  font-style: italic;
  line-height: .8;
  color: #11213F;
  pointer-events: none;
}

.board-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: var(--board-width);
  width: 100%;
  margin: 0 auto;
  padding: 22px 36px 26px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 12px;
}

/* ---------- admin ---------- */
.admin-app {
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  border-bottom: 1px solid #E3E5EF;
}
.admin-topbar__inner {
  max-width: var(--admin-width);
  margin: 0 auto;
  padding: 0 32px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.admin-topbar__left { display: flex; align-items: center; gap: 18px; }
.admin-tag {
  padding: 5px 10px;
  background: var(--ink);
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.admin-topbar__right { display: flex; align-items: center; gap: 18px; }
.admin-topbar__email { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }

.console {
  width: 100%;
  max-width: var(--admin-width);
  margin: 0 auto;
  padding: 40px 32px 8px;
  flex: 1;
}
.console__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--blue);
}
.console__title {
  font-family: var(--display);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: .95;
  text-transform: uppercase;
}
.console__sub { max-width: 32ch; text-align: right; color: var(--text-3); font-size: 14px; }

.launch {
  margin-top: 26px;
  padding: 24px;
  background: var(--blue);
  color: #fff;
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 0 100%);
}
.launch__label {
  display: block;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--lime);
}
.launch__row { display: flex; gap: 12px; flex-wrap: wrap; }
.field {
  flex: 1 1 260px;
  min-width: 0;
  height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}
.field::placeholder { color: var(--text-3); }
.field:focus { outline: 3px solid var(--lime); outline-offset: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn--start { background: var(--lime); color: var(--lime-ink); }
.btn--start:hover { background: #B7F03E; }
.btn--start:active { background: #A8E42F; }
.btn--stop { min-height: 36px; padding: 0 18px; background: #fff; color: var(--ink); font-size: 11px; }
.btn--stop:hover { background: var(--surface); }
.btn--ghost {
  min-height: 34px;
  padding: 0 14px;
  border-color: #D9DCEA;
  color: var(--text-2);
  background: transparent;
  font-size: 11px;
}
.btn--ghost:hover { border-color: var(--text-3); color: var(--ink); }
.btn--danger {
  min-height: 34px;
  padding: 0 14px;
  border-color: var(--red);
  color: var(--danger-text);
  background: transparent;
  font-size: 11px;
}
.btn--danger:hover { background: #FFF2F0; }
.btn svg { flex: none; }

.console__section { margin-top: 14px; }
.console .section-head { color: var(--text-3); }
.console .section-head__count { color: var(--text-3); }

.runlist { display: grid; gap: 8px; }
.run {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  background: var(--ink);
  color: #fff;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}
.run__pos {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  font-style: italic;
}
.run__name { font-size: 16px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.run__time {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--lime);
  white-space: nowrap;
}
.run__action { padding-right: 16px; }

.resultlist { display: grid; gap: 1px; }
.result {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 110px 76px;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--surface);
}
.result:hover { background: #ECEDF8; }
.result__pos {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 800;
  font-style: italic;
  color: var(--blue);
}
.result__name { font-size: 15px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.result__time {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.result__delete { text-align: right; }
.link-danger {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--danger-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-danger:hover { color: #91141F; }
.empty-note {
  padding: 24px 20px;
  background: var(--surface);
  color: var(--text-3);
  font-size: 14px;
}
.admin-foot {
  width: 100%;
  max-width: var(--admin-width);
  margin: 34px auto 0;
  padding: 20px 32px;
  border-top: 1px solid #E3E5EF;
  color: var(--text-3);
  font-size: 12px;
}

/* ---------- flash and states ---------- */
.flash {
  max-width: var(--admin-width);
  margin: 18px auto 0;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
}
.flash--ok { background: var(--lime); color: var(--lime-ink); }
.flash--err { background: #FFF2F0; color: var(--danger-text); border: 1px solid #F3C8C4; }

.state {
  min-height: calc(100vh - 40px);
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
}
.state__title {
  font-family: var(--display);
  font-size: clamp(36px, 7vw, 64px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: .95;
  text-transform: uppercase;
}
.state__text { max-width: 52ch; color: var(--text-2); font-size: 17px; }
.state__link { color: var(--brand, #0A6EFF); font-weight: 600; }

@media (max-width: 760px) {
  .brand-logo { height: 26px; width: 26px; }
  .topbar__inner { padding: 0 18px; min-height: 64px; grid-template-columns: auto auto; gap: 12px; }
  .topbar__meta { display: none; }
  .topbar__live span { display: none; }
  .board { padding: 30px 18px 16px; }
  .board__head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .board__sub { text-align: left; max-width: 40ch; }
  .track__row { grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; min-height: 78px; padding-right: 14px; }
  .track__time { font-size: 32px; }
  .track__state { grid-column: 2 / 4; justify-content: flex-start; margin-top: -8px; padding-bottom: 10px; }
  .ranking__head { display: none; }
  .rank { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 6px 10px; padding: 13px 14px; }
  .rank__pos { grid-row: 1 / 3; }
  .rank__time { text-align: left; font-size: 20px; }
  .rank__finish { grid-column: 2 / 4; text-align: left; }
  .rank--first { padding: 14px; }
  .rank--first .rank__pos { font-size: 24px; }
  .rank--first .rank__time { font-size: 24px; }
  .board-foot { padding-left: 18px; padding-right: 18px; }
  .admin-topbar { padding: 0; }
  .admin-topbar__inner { padding: 0 18px; }
  .admin-topbar__email { display: none; }
  .console { padding: 30px 18px 8px; }
  .console__head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .console__sub { text-align: left; }
  .launch { padding: 18px; }
  .launch__row { flex-direction: column; }
  .field { flex: 0 0 auto; width: 100%; height: 50px; }
  .btn--start { width: 100%; }
  .run { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; padding-right: 12px; }
  .run__time { font-size: 24px; }
  .run__action { grid-column: 2 / 4; justify-self: end; padding: 0 0 10px; }
  .result { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 6px 10px; }
  .result__time { grid-column: 2 / 3; text-align: left; }
  .result__delete { grid-column: 3 / 4; grid-row: 1 / 3; }
  .admin-foot { padding-left: 18px; padding-right: 18px; }
  .flash { margin-top: 12px; }
}

@media (max-width: 420px) {
  .brand__name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dot--pulse { animation: none; }
  * { transition: none !important; }
}
