@font-face {
  font-family: 'Sofia Sans Extra Condensed';
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url('/fonts/sofia-sans-extra-condensed-cyrillic-wght-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Sofia Sans Extra Condensed';
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url('/fonts/sofia-sans-extra-condensed-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Sofia Sans Extra Condensed';
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url('/fonts/sofia-sans-extra-condensed-latin-wght-normal.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+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/golos-text-cyrillic-wght-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/golos-text-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/golos-text-latin-wght-normal.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+2212, U+FEFF, U+FFFD;
}

:root {
  --field: #1f3bff;
  --deep: #1730d6;
  --ink: #050b3d;
  --paper: #ffffff;
  --signal: #ffe14a;
  --mist: #d3d9ff;
  --line: rgb(255 255 255 / 0.28);
  --alarm: #b3122a;

  --display: 'Sofia Sans Extra Condensed', 'Arial Narrow', sans-serif;
  --text: 'Golos Text', system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 1180px;
}

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

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

body {
  margin: 0;
  background: var(--field);
  color: var(--paper);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ol,
ul,
fieldset {
  margin: 0;
  padding: 0;
}

fieldset {
  border: 0;
  min-width: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

dialog :focus-visible {
  outline-color: var(--field);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

.top,
main,
.foot {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 18px;
}

.wordmark {
  font-family: var(--display);
  font-weight: 900;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.langs {
  display: flex;
}

.langs button {
  background: none;
  border: 0;
  padding: 8px 9px;
  color: var(--mist);
  font-weight: 500;
  border-radius: 6px;
}

.langs button[aria-pressed='true'] {
  color: var(--paper);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.button-signal {
  background: var(--signal);
  color: var(--ink);
}

.button-signal:hover {
  background: var(--paper);
}

.button-ink {
  background: var(--ink);
  color: var(--paper);
}

.button-ink:hover {
  background: var(--field);
}

.button:disabled {
  opacity: 0.55;
  cursor: progress;
}

/* Hero */

.hero {
  padding-block: clamp(28px, 7vw, 84px) clamp(28px, 5vw, 56px);
}

.hero h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(64px, 15.5vw, 216px);
  line-height: 0.84;
  letter-spacing: -0.012em;
  text-transform: uppercase;
  text-wrap: balance;
  max-width: 11ch;
}

.lede {
  margin-top: clamp(20px, 3vw, 32px);
  max-width: 46ch;
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--mist);
}

.notice {
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  font-weight: 600;
}

/* Board */

.board-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.segmented {
  display: flex;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.segmented button {
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  color: var(--mist);
}

.segmented button[aria-pressed='true'] {
  background: var(--paper);
  color: var(--ink);
}

.rows {
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: 2.6ch minmax(0, 1fr) auto auto;
  grid-template-areas: 'rank who amount raise';
  align-items: center;
  column-gap: clamp(12px, 2vw, 28px);
  padding-block: 16px;
  border-top: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 1px solid var(--line);
}

.rank {
  grid-area: rank;
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  color: var(--mist);
  font-variant-numeric: tabular-nums;
}

.who {
  grid-area: who;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  text-decoration: none;
  min-width: 0;
}

.avatar {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: var(--paper);
  color: var(--field);
  font-family: var(--display);
  font-weight: 900;
  font-size: 28px;
  line-height: 1;
  text-transform: uppercase;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.who-text {
  min-width: 0;
}

.name {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  overflow-wrap: break-word;
}

.who:hover .name {
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.12em;
}

.meta {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--mist);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount {
  grid-area: amount;
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  color: var(--signal);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.raise {
  grid-area: raise;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  white-space: nowrap;
}

.raise:hover {
  border-color: var(--paper);
}

/* The podium: second and third speak louder, first owns the billboard. */

.row.rank-2 .name,
.row.rank-3 .name,
.row.rank-2 .amount,
.row.rank-3 .amount,
.row.rank-2 .rank,
.row.rank-3 .rank {
  font-size: clamp(40px, 5.4vw, 68px);
}

.row.rank-2,
.row.rank-3 {
  padding-block: 22px;
}

.row.rank-2 .avatar,
.row.rank-3 .avatar {
  width: 60px;
  height: 60px;
}

.row.rank-1 {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'rank amount'
    'who who'
    'raise raise';
  row-gap: clamp(10px, 2vw, 20px);
  margin-bottom: 10px;
  padding: clamp(18px, 3vw, 36px);
  border: 0;
  border-radius: 18px;
  background: var(--signal);
  color: var(--ink);
}

.row.rank-1 + .row {
  border-top: 0;
}

.row.rank-1 .rank,
.row.rank-1 .amount {
  font-size: clamp(34px, 4.4vw, 56px);
  color: var(--ink);
}

.row.rank-1 .rank::before {
  content: '№';
}

.row.rank-1 .who {
  grid-template-columns: minmax(0, 1fr);
  row-gap: 12px;
}

.row.rank-1 .avatar {
  width: 64px;
  height: 64px;
  background: var(--ink);
  color: var(--signal);
}

.row.rank-1 .name {
  font-weight: 900;
  font-size: clamp(64px, 13.5vw, 190px);
  line-height: 0.86;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.row.rank-1 .meta {
  margin-top: 12px;
  font-size: 16px;
  color: var(--ink);
  white-space: normal;
  max-width: 60ch;
}

.row.rank-1 .raise {
  justify-self: start;
  border-color: var(--ink);
}

.row.rank-1 .raise:hover {
  background: var(--ink);
  color: var(--signal);
}

.row.rank-1 :focus-visible {
  outline-color: var(--field);
}

/* Unsold slots are offers, not blanks. */

.row.vacant {
  border-style: dashed;
}

.row.vacant.rank-1 {
  background: none;
  color: var(--paper);
  border: 2px dashed var(--signal);
}

.row.vacant.rank-1 .rank {
  color: var(--signal);
}

.row.vacant .name {
  color: var(--mist);
}

.row.vacant.rank-1 .name {
  color: var(--paper);
}

.row.vacant.rank-1 .raise {
  background: var(--signal);
  border-color: var(--signal);
  color: var(--ink);
  font-weight: 700;
  padding: 12px 22px;
}

.row.just-paid {
  animation: flash 1.6s ease-out 2;
}

@keyframes flash {
  0% {
    box-shadow: 0 0 0 0 var(--paper);
  }
  40% {
    box-shadow: 0 0 0 10px rgb(255 255 255 / 0.5);
  }
  100% {
    box-shadow: 0 0 0 0 rgb(255 255 255 / 0);
  }
}

.board-foot {
  margin-top: 14px;
  font-size: 14px;
  color: var(--mist);
}

/* Rules */

.rules {
  padding-block: clamp(48px, 8vw, 96px) 32px;
  max-width: 62ch;
}

.rules h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1;
  margin-bottom: 16px;
}

.rules ul {
  padding-left: 1.1em;
  color: var(--mist);
}

.rules li + li {
  margin-top: 8px;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding-block: 24px 40px;
  font-size: 14px;
  color: var(--mist);
  border-top: 1px solid var(--line);
}

/* Dialog */

dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
}

dialog::backdrop {
  background: rgb(5 11 61 / 0.72);
}

#bid-form,
#pay-step,
#claim-form {
  display: grid;
  gap: 18px;
  padding: clamp(20px, 5vw, 32px);
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: 44px;
  line-height: 0.92;
  text-transform: uppercase;
}

.close {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #eceefb;
  font-size: 24px;
  line-height: 1;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span,
.field > label,
.field > legend {
  font-weight: 600;
  font-size: 14px;
}

.field > legend {
  margin-bottom: 6px;
}

.field input[type='text'],
.amount-input {
  width: 100%;
  border: 1.5px solid #b9bfe6;
  border-radius: 12px;
  background: var(--paper);
  padding: 12px 14px;
  font-size: 17px;
}

.field input[type='text']:focus-visible,
.amount-input:focus-within {
  outline: 3px solid var(--field);
  outline-offset: 1px;
  border-color: var(--field);
}

.amount-input {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 40px;
  line-height: 1;
  padding-block: 8px;
}

.amount-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  padding: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}

.amount-input input::-webkit-outer-spin-button,
.amount-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice label {
  position: relative;
  display: block;
}

.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.choice span {
  display: block;
  text-align: center;
  padding: 12px;
  border: 1.5px solid #b9bfe6;
  border-radius: 12px;
  font-weight: 600;
}

.choice input:checked + span {
  background: var(--field);
  border-color: var(--field);
  color: var(--paper);
}

.choice input:focus-visible + span {
  outline: 3px solid var(--field);
  outline-offset: 2px;
}

.preview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #eceefb;
}

.preview .avatar {
  background: var(--field);
  color: var(--paper);
}

.preview strong {
  display: block;
  overflow-wrap: anywhere;
}

.preview span:not(.avatar) {
  display: block;
  font-size: 14px;
  color: #454b78;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.chips button {
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: none;
  padding: 7px 14px;
  font-weight: 600;
  font-size: 14px;
}

.chips button:hover {
  background: var(--signal);
}

.hint {
  min-height: 1.5em;
  font-weight: 600;
  color: var(--field);
}

.error {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fde8eb;
  color: var(--alarm);
  font-weight: 600;
}

#claim-form {
  padding: 0;
}

.pay-amount {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(48px, 13vw, 72px);
  line-height: 0.95;
}

.pay-qr {
  width: min(260px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  justify-self: center;
  border: 1.5px solid #b9bfe6;
  border-radius: 12px;
  padding: 8px;
}

.pay-details {
  white-space: pre-line;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pay-done {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--signal);
  font-weight: 600;
}

.amount-input.unit-after {
  flex-direction: row-reverse;
}

.amount-input.unit-after span {
  white-space: nowrap;
}

#bid-submit,
#claim-submit {
  padding-block: 16px;
  font-size: 18px;
}

.small {
  font-size: 13px;
  color: #454b78;
}

/* Phones */

@media (max-width: 640px) {
  .wordmark {
    font-size: 26px;
  }

  .top .button {
    padding: 10px 16px;
  }

  .langs button {
    padding: 8px 6px;
  }

  .row {
    grid-template-columns: 2.2ch minmax(0, 1fr) auto;
    grid-template-areas:
      'rank who who'
      '. amount raise';
    row-gap: 10px;
  }

  .row.vacant .amount {
    display: none;
  }

  .row.vacant .raise {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .rank,
  .name,
  .amount {
    font-size: 28px;
  }

  .row.rank-2 .avatar,
  .row.rank-3 .avatar {
    width: 48px;
    height: 48px;
  }

  .segmented button {
    padding: 8px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .row.just-paid {
    animation: none;
    outline: 3px solid var(--paper);
  }
}
