:root {
  --ink: #000000;
  --chalk: #ffffff;
  --turf: #12703c;
  --turf-mow: #0e5f32;
  --turf-bright: #2fae5f;
  --muted: rgba(255, 255, 255, 0.62);
  --rule: rgba(255, 255, 255, 0.16);

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --text: "Barlow", system-ui, sans-serif;
  --p: 0; /* progress 0..1, set from app.js */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--chalk);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 36px 16px 28px;
  min-height: 100vh;
  min-height: 100svh; /* avoids mobile browser toolbar overflow */
  display: flex;
  flex-direction: column;
}

h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  flex-wrap: nowrap;          /* logo always stays left of the titles */
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--chalk);
}
.logo { flex: none; width: 56px; height: 56px; border-radius: 50%; display: block; }
.titles {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.masthead h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1.1;
}
.masthead p { margin: 0; color: var(--muted); font-size: 0.95rem; text-align: right; }

/* Small screens: title and subtitle stack, still beside the logo */
@media (max-width: 480px) {
  .titles { flex-direction: column; align-items: flex-start; gap: 2px; }
  .masthead p { text-align: left; }
}

/* ---------- Score ---------- */
.score { margin: 36px 0 28px; text-align: center; }
.amount {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3.2rem, 15vw, 5rem);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--chalk);
}
.amount.positive { color: var(--turf-bright); }
.caption { margin: 12px auto 0; font-size: 0.95rem; color: var(--muted); max-width: 40ch; }
.caption strong { color: var(--chalk); font-weight: 600; }

/* ---------- Pitch ---------- */
.match { margin-bottom: 52px; }

.track {
  position: relative;
  height: 10px;
  margin: 0 11px 0 24px; /* room for the marker; extra on the left for the "behind" spot */
  border-radius: 999px;
  background: var(--rule);
}
.track::before, .track::after { /* end ticks */
  content: "";
  position: absolute;
  top: -8px;
  width: 2px;
  height: 26px;
  background: var(--chalk);
  border-radius: 1px;
}
.track::before { left: -1px; }
.track::after { right: -1px; }

.fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--p) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--turf), var(--turf-bright));
  transition: width 1s cubic-bezier(.2, .8, .2, 1);
}
.marker {
  position: absolute;
  top: 50%;
  left: calc(var(--p) * 100%);
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--chalk);
  border: 4px solid var(--turf-bright);
  box-shadow: 0 0 0 6px rgba(47, 174, 95, 0.2);
  transition: left 1s cubic-bezier(.2, .8, .2, 1);
}
/* Balance below zero: park the marker just left of the Last Field Rental tick */
.track.behind .marker { left: -10px; }

.ends {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  font-weight: 600;
  font-size: 0.85rem;
}
.ends span:first-child { color: var(--muted); }
.ends span:last-child { text-align: right; }

/* ---------- Recent donations ---------- */
.recent { margin-bottom: 44px; }
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list li {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.list .name { font-weight: 600; font-size: 1.05rem; }
.list .date {
  flex: none;
  width: 3.6em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.list li.empty { color: var(--muted); }
.list li:nth-child(2) { opacity: 0.92; }
.list li:nth-child(3) { opacity: 0.84; }
.list li:nth-child(4) { opacity: 0.76; }
.list li:nth-child(5) { opacity: 0.68; }
.list li:nth-child(6) { opacity: 0.6; }
.list li:nth-child(7) { opacity: 0.51; }
.list li:nth-child(8) { opacity: 0.42; }
.list li:nth-child(9) { opacity: 0.33; }
.list li:nth-child(10) { opacity: 0.25; }

/* ---------- Donate ---------- */
.donate { margin-bottom: 36px; }
.donate-options { display: grid; gap: 10px; margin-top: 12px; }
@media (min-width: 600px) {
  .donate-options { grid-template-columns: 1fr 1fr; }
  .donate-options .donate-btn { padding: 16px 14px; }
}

.donate-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 16px 18px;
  border: 2px solid var(--chalk);
  border-radius: 4px;
  background: transparent;
  color: var(--chalk);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.donate-btn .label { font-weight: 600; font-size: 1.05rem; }
.donate-btn .handle { font-size: 0.9rem; color: var(--muted); overflow-wrap: break-word; }
.donate-btn .hint { font-size: 0.85rem; font-weight: 600; color: var(--turf-bright); min-height: 1.2em; }
.donate-btn.venmo { background: var(--turf); border-color: var(--turf); }
.donate-btn.venmo .handle { color: rgba(255, 255, 255, .8); }
@media (hover: hover) {
  .donate-btn:hover { background: var(--chalk); color: var(--ink); border-color: var(--chalk); }
  .donate-btn:hover .handle { color: rgba(0, 0, 0, .65); }
}
.donate-btn:focus-visible { outline: 3px solid var(--turf-bright); outline-offset: 3px; }

/* ---------- Footer ---------- */
footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
.error { color: var(--chalk); }
.sheet-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 28px;
  padding: 18px;
  border: 2px solid var(--turf-bright);
  border-radius: 4px;
  color: var(--chalk);
  text-align: center;
  text-decoration: none;
}
.sheet-link .label {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1.1;
}
.sheet-link .sub { font-size: 0.9rem; color: var(--muted); }
@media (hover: hover) {
  .sheet-link:hover { background: var(--turf-bright); color: var(--ink); }
  .sheet-link:hover .sub { color: rgba(0, 0, 0, .7); }
}
.sheet-link:focus-visible { outline: 3px solid var(--turf-bright); outline-offset: 3px; }

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