* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.serif {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
}

.sum {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── страница голосования ─────────────────────────────────────────── */

.vote {
  max-width: 30rem;
  margin: 0 auto;
  padding: 40px 20px calc(40px + env(safe-area-inset-bottom));
}

.vote h1 {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}

.lede {
  color: var(--muted);
  margin: 0 0 32px;
  font-size: 15px;
  max-width: 26rem;
}

.names > .name { margin-bottom: 10px; }

.name {
  display: block;
  min-height: 72px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 200ms ease;
}

.name:active { background: var(--paper); }

.name .right { margin-left: 16px; }

.name .who {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 27px;
  line-height: 1.1;
}

.name .sum {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 17px;
  color: var(--muted);
}

/* Лидер помечен и рамкой, и подписью — не только цветом. */
.name.leads { border-color: var(--accent); }
.name.leads .sum { color: var(--accent); }
.name .crown {
  display: none;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.name.leads .crown { display: block; }

.name .right { text-align: right; }

.vote footer {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.vote footer p { margin: 0 0 6px; }
.vote footer b { color: var(--ink); font-weight: 400; }

/* ── табло ────────────────────────────────────────────────────────── */

.board {
  height: 100vh;
  padding: 5vh 4vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 2vh;
  margin-bottom: 3vh;
  border-bottom: 1px solid var(--line);
}

.board h1 {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
  font-size: 4.4vh;
  line-height: 1;
  margin: 0;
  letter-spacing: -0.015em;
}

.board .total {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 2.6vh;
  color: var(--muted);
}
.board .total b { color: var(--ink); font-weight: 400; font-size: 3.4vh; }

.stage {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-height: 0;
}

.rows {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 0;
  padding-top: 5vh; /* место для суммы над самым высоким столбцом */
}

.col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0 1vh;
}

.track {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
}

/* Сумма едет вместе с верхом столбца. */
.col .amt {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin-bottom: 0.8vh;
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 3vh;
  line-height: 1;
  text-align: center;
  color: var(--muted);
  transition: bottom 900ms cubic-bezier(.22,.61,.36,1);
}
.col.leads .amt { color: var(--accent); }

.bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: var(--wash);
  border-top: 4px solid var(--muted);
  transition: height 900ms cubic-bezier(.22,.61,.36,1);
}

.col.leads .bar {
  background: var(--accent-wash);
  border-top-color: var(--accent);
}

.col .who {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 3.6vh;
  line-height: 1.1;
  padding-top: 1.6vh;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.aside {
  width: 26vw;
  max-width: 38vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: 4vh;
  padding-left: 4vh;
  border-left: 1px solid var(--line);
}

.photo {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  border-radius: 3px;
  background: var(--card);
}

.qrbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding-top: 2.5vh;
  text-align: center;
}

.qr {
  width: 20vh;
  height: 20vh;
  margin-bottom: 1.4vh;
  background: #fff;
  padding: 0.8vh;
  border: 1px solid var(--line);
}

.board .call {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 2.6vh;
  line-height: 1.25;
}

.board .addr {
  color: var(--muted);
  font-size: 1.7vh;
  margin-top: 0.6vh;
}

.stale {
  margin-top: 2vh;
  font-size: 1.9vh;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.6vh 1.2vh;
  border-radius: 3px;
}
.stale:not(.on) { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .bar, .name { transition: none; }
}

/* ── выбор суммы и способа оплаты ─────────────────────────────────── */

.picker {
  padding: 18px 20px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  margin-bottom: 22px;
}

.chips { display: block; }

.chip {
  display: inline-block;
  min-height: 44px;
  margin: 0 8px 8px 0;
  padding: 10px 16px;
  font: 400 17px/1 Georgia, "Iowan Old Style", "Times New Roman", serif;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.custom {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.custom input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font: 400 19px/1 Georgia, "Iowan Old Style", "Times New Roman", serif;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* Карточка клички теперь кнопка внутри формы. */
.name-form { margin: 0 0 10px; }

.name-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
}

button.name {
  width: 100%;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

button.name[disabled] {
  opacity: 0.45;
  cursor: default;
}
