@font-face {
  font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-cyrillic.woff2) format('woff2');
  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(/fonts/onest-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

:root {
  --bg: #ffffff;
  --alt: #f2f3f7;
  --text: #1a1f36;
  --muted: #6b7089;
  --line: #e3e5ec;
  --accent: #2447f5;
  --accent-hover: #1a38d6;
  --on-accent: #ffffff;
  --danger: #e5383b;
  --danger-bg: #fdecec;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 10px;
  --r-lg: 18px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12162b;
    --alt: #1c2140;
    --text: #eef0f7;
    --muted: #9ea3bd;
    --line: #2a3057;
    --accent: #6f86ff;
    --accent-hover: #8a9bff;
    --on-accent: #0d1024;
    --danger: #ff6b6e;
    --danger-bg: #3a1a26;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.5 var(--font);
}
h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
[hidden], .hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.err { color: var(--danger); font-size: 15px; white-space: pre-line; }
.err:empty { display: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button, .btn {
  font: 600 16px/1 var(--font);
  color: var(--text);
  background: var(--alt);
  border: 0;
  border-radius: var(--r-sm);
  padding: 13px 20px;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover, .btn:hover { background: var(--line); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary, button.ok { background: var(--accent); color: var(--on-accent); }
button.primary:hover, button.ok:hover { background: var(--accent-hover); }
button.danger { background: var(--danger-bg); color: var(--danger); }
button.danger:hover { background: var(--danger-bg); filter: brightness(0.96); }
button.sm { padding: 8px 12px; min-height: 36px; font-size: 14px; }

input, textarea, select {
  font: 400 17px/1.3 var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  min-height: 48px;
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 150px; resize: vertical; font-size: 15px; line-height: 1.55; }
label { display: block; font-size: 15px; font-weight: 500; margin-bottom: 6px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 16px; cursor: pointer; }
label.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--accent); }

.page { max-width: 720px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 480px) { .page { padding: 0 16px; } }

.head { padding: 40px 0 8px; }
.status { font-size: 15px; font-weight: 600; color: var(--muted); }
.status.open { color: var(--accent); }
.status .t { font-weight: 400; font-variant-numeric: tabular-nums; }
.head h1 { font-size: clamp(34px, 8vw, 52px); margin: 14px 0 10px; }
.head .sub { font-size: 18px; color: var(--muted); max-width: 32em; }

.how { margin-top: 18px; font-size: 16px; max-width: 36em; }

.finder {
  position: sticky; top: 0; z-index: 3;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 14px 0; margin-top: 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.grades { display: flex; gap: 6px; }
.grades button { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.grades button[aria-pressed='true'] { background: var(--text); color: var(--bg); }
.finder input { flex: 1; min-width: 160px; min-height: 40px; padding: 8px 12px; background: var(--alt); border-color: transparent; }
.finder input:focus { background: var(--bg); border-color: var(--accent); }

@media (max-width: 480px) { .finder { position: static; } }

.grade { margin-top: 34px; }
.grade-head { display: flex; align-items: baseline; gap: 14px; padding-bottom: 8px; }
.grade-num {
  font-size: clamp(72px, 18vw, 104px); font-weight: 800; line-height: 0.85;
  letter-spacing: -0.05em; font-variant-numeric: tabular-nums;
}
.grade-cap { font-size: 16px; color: var(--muted); line-height: 1.3; }
.grade-cap b { display: block; color: var(--text); font-size: 18px; font-weight: 600; }

.cand {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: 76px 1fr 30px; gap: 14px; align-items: center;
  margin: 0; padding: 16px 14px 16px 10px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  font-weight: 400; font-size: 17px;
  cursor: pointer;
  transition: color 0.2s var(--ease-out), background-color 0.15s;
}
.cand::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--accent); border-radius: var(--r-sm);
  transform: scaleX(0); transform-origin: left center;
  transition: transform 0.34s var(--ease-out);
}
.cand:hover { background: var(--alt); }
.cand:active .dot { transform: scale(0.88); }
.cand input { position: absolute; opacity: 0; pointer-events: none; }
.cand .cl { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.cand .nm { font-size: 19px; font-weight: 600; line-height: 1.25; }
.cand .sl { font-size: 15px; color: var(--muted); margin-top: 3px; transition: color 0.2s; }
.cand .dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.cand .dot svg { width: 16px; height: 16px; }
.cand .dot path {
  fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 16; stroke-dashoffset: 16;
}
.cand:hover .dot { border-color: var(--muted); }
.cand:has(input:checked) { color: var(--on-accent); border-top-color: transparent; background: transparent; }
.cand:has(input:checked)::before { transform: scaleX(1); }
.cand:has(input:checked) + .cand { border-top-color: transparent; }
.cand:has(input:checked) .sl { color: var(--on-accent); opacity: 0.8; }
.cand:has(input:checked) .dot { background: var(--on-accent); border-color: var(--on-accent); animation: dot-pop 0.42s var(--ease-spring); }
.cand:has(input:checked) .dot path { stroke-dashoffset: 0; transition: stroke-dashoffset 0.26s var(--ease-out) 0.14s; }
.cand:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) {
  .cand { grid-template-columns: 58px 1fr 28px; gap: 12px; padding: 14px 10px 14px 6px; }
  .cand .cl { font-size: 28px; }
  .cand .nm { font-size: 18px; }
}

.empty { padding: 40px 0; color: var(--muted); font-size: 17px; }

.bar-bottom {
  position: sticky; bottom: 0; z-index: 3;
  margin-top: 28px; padding: 14px 0 max(14px, env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.bar-row { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; }
.bar-row .choice { flex: 1 1 200px; min-width: 0; }
.bar-row .choice .k { font-size: 13px; color: var(--muted); }
.bar-row .choice .v { font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .choice .v.none { color: var(--muted); font-weight: 400; }
.bar-row button { padding-inline: 28px; }
.bar-bottom .err { margin-top: 8px; }
@media (max-width: 480px) { .bar-row button { flex: 1 1 100%; } }

.state { padding: 56px 0 40px; }
.state h2 { font-size: clamp(30px, 7vw, 44px); margin-bottom: 12px; }
.state p { font-size: 18px; color: var(--muted); max-width: 30em; }
.state .check {
  width: 64px; height: 64px; border-radius: 50%; margin-bottom: 22px;
  background: var(--accent); display: grid; place-items: center;
}
.state .check svg { width: 30px; height: 30px; }
.state .check path { fill: none; stroke: var(--on-accent); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

.results { padding: 36px 0 20px; border-top: 1px solid var(--line); margin-top: 20px; }
.results h2 { font-size: 30px; }
.results .total { color: var(--muted); margin: 6px 0 16px; }
.tally { list-style: none; margin: 0; padding: 0; }
.tally li {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 6px 14px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.tally .cl { font-size: 24px; font-weight: 800; letter-spacing: -0.04em; }
.tally .who { font-weight: 600; }
.tally .n { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.tally .n span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.tally .line { grid-column: 2 / 3; height: 6px; border-radius: 3px; background: var(--accent); min-width: 3px; }
.tally li:not(.lead) .line { opacity: 0.35; }

.footnote { padding: 24px 0 44px; font-size: 14px; color: var(--muted); max-width: 36em; }

dialog {
  border: 0; border-radius: var(--r-lg);
  background: var(--bg); color: var(--text);
  padding: 26px; width: min(420px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(18, 22, 43, 0.55); }
dialog .k { font-size: 15px; color: var(--muted); }
dialog .who { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 2px; }
dialog .note { margin-top: 14px; font-size: 15px; color: var(--muted); }
dialog .actions { display: flex; gap: 10px; margin-top: 24px; }
dialog .actions button { flex: 1; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nudge { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { clip-path: inset(100% 0 0 0); transform: translateY(0.2em); } to { clip-path: inset(0); transform: none; } }
@keyframes dot-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pop-in { 0% { transform: scale(0.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes ring { from { transform: scale(1); opacity: 0.7; } to { transform: scale(2.4); opacity: 0; } }
@keyframes draw { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

.head > * { animation: rise 0.6s var(--ease-out) both; }
.head > :nth-child(2) { animation-delay: 70ms; }
.head > :nth-child(3) { animation-delay: 140ms; }
#ballot.enter .how { animation: rise 0.6s var(--ease-out) 0.2s both; }
#ballot.enter .finder { animation: rise 0.6s var(--ease-out) 0.26s both; }
#ballot.enter .bar-bottom { animation: fade 0.5s ease 0.4s both; }
.grade.in .grade-num { animation: reveal 0.7s var(--ease-out) both; animation-delay: calc(300ms + var(--i, 0) * 45ms); }
.grade.in .grade-cap { animation: fade 0.5s ease both; animation-delay: calc(420ms + var(--i, 0) * 45ms); }
.cand.in { animation: rise 0.5s var(--ease-out) both; animation-delay: calc(360ms + var(--i, 0) * 45ms); }
.grade.swap .grade-num, .cand.swap { animation: nudge 0.24s var(--ease-out) both; }

.bar-row .choice .v.bump { animation: nudge 0.26s var(--ease-out); }
.err.shake { animation: shake 0.36s ease; }

dialog[open] { animation: pop 0.26s var(--ease-out); }
dialog[open]::backdrop { animation: fade 0.2s ease; }

.state .check { position: relative; animation: pop-in 0.5s var(--ease-spring) both; }
.state .check::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ring 0.9s ease-out 0.2s both;
}
.state .check path { stroke-dasharray: 30; animation: draw 0.4s var(--ease-out) 0.3s both; }
.state h2 { animation: rise 0.55s var(--ease-out) 0.15s both; }
.state p { animation: rise 0.55s var(--ease-out) 0.22s both; }

.tally .line { transform-origin: left center; animation: grow 0.8s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }
.tally li { animation: fade 0.4s ease both; animation-delay: calc(var(--i, 0) * 50ms); }

[data-panel]:not(.hidden) { animation: fade 0.25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast { animation: toast-in 0.25s var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row select { width: auto; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.mt { margin-top: 18px; }

.top { padding: 22px 0; border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; gap: 12px 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.top h1 { font-size: 24px; }

.pill { font-weight: 600; font-size: 15px; color: var(--muted); }
.pill.open { color: var(--accent); }
.pill.closed { color: var(--danger); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; margin: 20px 0 24px; }
.nav button { background: none; min-height: 40px; padding: 9px 14px; font-weight: 500; color: var(--muted); }
.nav button:hover { background: var(--alt); color: var(--text); }
.nav button.active { background: var(--text); color: var(--bg); }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; margin-bottom: 18px; }
.card h2 { font-size: 20px; margin-bottom: 16px; }
.card > .row:first-child { margin-bottom: 16px; }
.card > .row:first-child h2 { margin-bottom: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.cols > .card { margin-bottom: 0; }
.cols > div > .card:last-child { margin-bottom: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; background: var(--alt); border-radius: var(--r-lg); margin-bottom: 18px; }
.tile { padding: 20px 22px; }
.tile + .tile { border-left: 1px solid var(--line); }
.tile .k { font-size: 14px; color: var(--muted); }
.tile .v { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .v.small { font-size: 21px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.tile .s { font-size: 14px; color: var(--muted); margin-top: 2px; }
@media (max-width: 600px) { .tile + .tile { border-left: 0; border-top: 1px solid var(--line); } }

.bars { display: flex; flex-direction: column; }
.bar { display: grid; grid-template-columns: 2em 1fr auto; gap: 4px 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.bar:first-child { border-top: 0; }
.bar .place { font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.bar .body { min-width: 0; }
.bar .label { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .label b { font-weight: 600; }
.bar .track { height: 6px; background: var(--alt); border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 3px; min-width: 3px; opacity: 0.4; transition: width 0.4s; }
.bar.lead .fill { opacity: 1; }
.bar.lead .place { color: var(--accent); }
.bar .num { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 64px; }
.bar .num span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }

.timeline { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 6px; border-bottom: 1px solid var(--line); }
.timeline div { flex: 1; min-width: 4px; max-width: 26px; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.timeline-axis { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 14px; }
td.actions { white-space: nowrap; text-align: right; }
td input { min-height: 38px; padding: 7px 10px; font-size: 15px; }
.table-wrap { overflow-x: auto; }

.big-state { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 8px; }
.big-state.open { color: var(--accent); }
.big-state.closed { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: var(--r-sm);
  font-size: 15px; font-weight: 500; z-index: 100; max-width: calc(100vw - 32px);
}
.login { max-width: 380px; margin: 80px auto; }
.login h2 { font-size: 24px; margin-bottom: 18px; }
#app main { padding-bottom: 48px; }

.log td { font-size: 14px; vertical-align: top; }
.log td .small { font-size: 12px; margin-top: 2px; max-width: 28ch; overflow-wrap: anywhere; }
.log tr.flagged td { background: var(--danger-bg); }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.flag { color: var(--danger); font-weight: 600; }
.num-big { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.row .search { width: auto; flex: 1 1 220px; min-height: 42px; }
