:root {
  --paper: #f6f0e0;
  --cream: #efe6cf;
  --cream-2: #e3d8bb;
  --ink: #291f7f;
  --ink-2: #2f2baa;
  --blue: #393fd4;
  --blue-hi: #485aff;
  --blue-lt: #6a82ff;
  --gold: #e8b84a;
  --gold-2: #b98a2a;
  --red: #c8423a;
  --px: 'Press Start 2P', ui-monospace, Menlo, monospace;
  --body: 'VT323', ui-monospace, Menlo, monospace;
  --brand: 'ES Rebond Grotesque', 'Nunito', system-ui, sans-serif;
}
@font-face { font-family: 'ES Rebond Grotesque'; src: url('fonts/ESRebondGrotesque-Bold.woff2') format('woff2'); font-weight: 700 800; font-display: swap; }
@font-face { font-family: 'ES Rebond Grotesque'; src: url('fonts/ESRebondGrotesque-Medium.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--cream); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  font-size: 21px;
  line-height: 1.1;
  background: var(--cream);
  background-image: radial-gradient(#e0d5b7 1px, transparent 1px);
  background-size: 8px 8px;
}
a { color: var(--blue); }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: var(--ink);
  border-bottom: 4px solid var(--blue-lt);
}
.brand { display: flex; align-items: center; font-family: var(--brand); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; color: #fff; text-decoration: none; line-height: 1; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-logo + .brand-word { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  font-family: var(--px); font-size: 12px; text-decoration: none;
  color: var(--ink); background: var(--paper);
  border: 3px solid var(--ink); border-radius: 8px;
  padding: 0.9em 1.2em;
  box-shadow: 0 4px 0 #000a;
  white-space: nowrap;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #000a; }
.btn.gold { background: var(--gold); box-shadow: 0 4px 0 var(--ink); }

.wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.title { margin: 6px 0 4px; text-align: center; font-family: var(--px); font-weight: 400; line-height: 1.3; text-shadow: 0 0.12em 0 #b2c9fe; }
.title .l1 { display: block; font-size: clamp(11px, 3.4vw, 16px); color: var(--blue); text-shadow: none; }
.title .l2 { display: block; font-size: clamp(22px, 7.4vw, 40px); }

.challenge { background: var(--ink); color: var(--paper); border-radius: 12px; overflow: hidden; border: 3px solid var(--ink); box-shadow: 0 6px 0 #0003; }
.challenge-card { width: 100%; height: auto; display: block; background: var(--blue); aspect-ratio: 1200 / 630; }
.challenge-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.challenge-kicker { margin: 0; font-family: var(--px); font-size: 11px; color: #ff6b5a; }
.challenge-line { margin: 0; font-size: 24px; color: #c9d2ff; }
.challenge-line b { color: #fff; font-weight: 400; }

.me { background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; padding: 12px 14px; box-shadow: 0 4px 0 var(--ink); }
.me b { font-family: var(--px); font-weight: 400; font-size: 0.7em; color: var(--blue); }

.prize { margin: 0; font-size: 19px; color: var(--ink-2); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.prize b { font-family: var(--px); font-weight: 400; font-size: 10px; background: var(--gold); color: var(--ink); padding: 0.45em 0.6em; border-radius: 4px; border: 2px solid var(--ink); }

.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.board li {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 10px 14px 10px 10px;
  box-shadow: 0 3px 0 var(--ink);
}
.board li.empty, .board li.gap { display: block; text-align: center; color: var(--ink-2); box-shadow: none; }
.board li.gap { background: none; border: 0; padding: 0; }
.board li.prize-row { background: #fff7dc; border-color: var(--gold-2); }
.board li.you { background: #e6edff; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-lt), 0 3px 0 var(--ink); }
.board li.rival { box-shadow: 0 0 0 3px #ff6b5a, 0 3px 0 var(--ink); }
.rank { font-family: var(--px); font-size: 13px; text-align: center; color: var(--ink-2); }
.rank.medal-1, .rank.medal-2, .rank.medal-3 {
  width: 40px; height: 40px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px solid var(--ink); color: var(--ink); font-size: 14px;
}
.rank.medal-1 { background: #e8b84a; }
.rank.medal-2 { background: #c9ced1; }
.rank.medal-3 { background: #c98a4b; }
.who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.who b { font-family: var(--px); font-weight: 400; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.who small { font-family: var(--px); font-size: 8px; color: var(--blue); }
.tag { font-style: normal; font-family: var(--px); font-size: 8px; background: var(--blue); color: #fff; padding: 0.3em 0.5em; border-radius: 3px; vertical-align: middle; }
.tag.red { background: #c8423a; }
.pts { font-family: var(--px); font-size: 18px; color: var(--ink); }

.how { background: var(--paper); border: 2px dashed var(--cream-2); border-radius: 10px; padding: 14px 16px; }
.how h2 { margin: 0 0 10px; font-family: var(--px); font-weight: 400; font-size: 11px; color: var(--blue); }
.how ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.how li b { font-family: var(--px); font-weight: 400; font-size: 10px; }
.how li span { color: var(--ink-2); margin: 0 6px; }
.how p { margin: 0; color: var(--ink-2); }

.cta {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  text-decoration: none; color: #fff;
  background: linear-gradient(135deg, var(--blue-hi), var(--blue) 55%, var(--ink-2));
  border: 3px solid var(--ink); border-radius: 12px; padding: 18px;
  box-shadow: 0 5px 0 var(--ink);
  font-family: var(--brand);
}
.cta-line { font-weight: 700; font-size: 20px; line-height: 1.25; }
.cta { position: relative; overflow: hidden; padding-right: 110px; }
.cta-mascot { position: absolute; right: 10px; bottom: 0; width: 92px; height: auto; }
.cta-fine { font-size: 13px; color: #c9d2ff; }
.me small { font-size: 0.85em; color: var(--ink-2); }
.cta-btn { font-weight: 800; font-size: 16px; background: #fff; color: var(--blue); border-radius: 999px; padding: 0.5em 1.1em; }
.who .tag { align-self: flex-start; margin-top: 2px; }

/* Event boards */
.board-tabs { display: flex; gap: 8px; justify-content: center; }
.board-tabs a {
  font-family: var(--px); font-size: 11px; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 3px solid var(--ink); border-radius: 8px; padding: 0.8em 1.1em;
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-tabs a.on { background: var(--event, var(--gold)); box-shadow: 0 4px 0 var(--ink); }
.event-status { margin: 0; text-align: center; font-size: 22px; color: var(--ink-2); }
.event-status b { font-weight: 400; color: var(--blue); }
