@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --ink: #101826;
  --ink-raised: #16202f;
  --gold: #C9A227;
  --teal: #2DD4BF;
  --paper: #EDEAE1;
  --slate: #7C8698;
  --line: #232f42;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: 'JetBrains Mono', monospace;
  min-height: 100vh;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

header.board-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.wordmark {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 0.01em;
  color: var(--paper);
  margin: 0;
}

.wordmark span { color: var(--gold); }

.period {
  color: var(--slate);
  font-size: 13px;
}

.actions a {
  color: var(--teal);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid transparent;
}
.actions a:hover, .actions a:focus-visible { border-bottom-color: var(--teal); }

.row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.row.rank-1 { padding: 20px 0; }
.row.rank-2, .row.rank-3 { padding: 17px 0; }

.rank-num {
  font-size: 15px;
  color: var(--slate);
  text-align: right;
}
.row.rank-1 .rank-num { color: var(--gold); font-size: 20px; font-weight: 700; }
.row.rank-2 .rank-num, .row.rank-3 .rank-num { color: var(--paper); font-size: 16px; }

.contender {
  min-width: 0;
}

.contender .name {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--paper);
  margin: 0 0 6px;
}
.row.rank-1 .contender .name { font-size: 22px; }

.bar-track {
  position: relative;
  height: 8px;
  background: var(--ink-raised);
  border-radius: 2px;
  /* no overflow:hidden here - the bar-marker avatar needs to sit on the track's edge */
}
.bar-fill {
  height: 100%;
  background: var(--slate);
  border-radius: 2px;
  transition: width 0.6s ease;
}
.row.rank-1 .bar-fill { background: var(--gold); }
.row.rank-2 .bar-fill, .row.rank-3 .bar-fill { background: var(--teal); }

.avatar {
  display: inline-block;
  vertical-align: middle;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
  background: var(--ink-raised);
}
.row.rank-1 .contender > .name .avatar { width: 28px; height: 28px; }

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  color: var(--slate);
  border: 1px solid var(--line);
}

/* Marker: the participant's image riding at the tip of their bar, race-position style */
.bar-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.bar-marker .avatar {
  margin-right: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 1px var(--slate);
}
.row.rank-1 .bar-marker .avatar {
  width: 24px;
  height: 24px;
  box-shadow: 0 0 0 1px var(--gold);
}

.figure {
  text-align: right;
  white-space: nowrap;
}
.figure .amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--paper);
}
.row.rank-1 .figure .amount { font-size: 20px; color: var(--gold); }
.figure .count {
  display: block;
  font-size: 11px;
  color: var(--slate);
  margin-top: 2px;
}

.ticker-wrap {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.ticker-label {
  font-size: 11px;
  color: var(--slate);
  margin-bottom: 10px;
}
.ticker-item {
  font-size: 13px;
  color: var(--paper);
  padding: 6px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dotted var(--line);
}
.ticker-item .who { color: var(--teal); }
.ticker-item .amt { color: var(--slate); }

.empty {
  color: var(--slate);
  font-size: 13px;
  padding: 24px 0;
}

/* Entry form */
.form-card {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 24px;
  background: var(--ink-raised);
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--slate);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--paper);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 2px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}
.submit-btn {
  background: var(--gold);
  color: var(--ink);
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 2px;
  cursor: pointer;
}
.submit-btn:hover, .submit-btn:focus-visible { background: #DDB840; }
.status-msg { font-size: 13px; margin-top: 12px; }
.status-msg.ok { color: var(--teal); }
.status-msg.err { color: #E8735C; }

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

@media (max-width: 480px) {
  .wordmark { font-size: 24px; }
  .row { grid-template-columns: 26px 1fr auto; gap: 10px; }
}
