:root {
  --arena: #141619;      /* page */
  --backdrop: #23272C;   /* panels */
  --steel: #3A4047;      /* borders, giant letters */
  --chalk: #F2F4F5;      /* text */
  --mute: #A3ABB3;       /* secondary text */
  --lime: #C6F432;       /* actions */
  --lime-press: #B2DD22;
  --board: #0A2C6E;      /* finish board */
  --glow: #4FD8FF;
  --alert: #FF6B6B;
  --font: "Archivo", "Arial", system-ui, sans-serif;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--arena);
  color: var(--chalk);
  font: 400 17px/1.5 var(--font);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 8px var(--gutter) 32px; }
a { color: var(--chalk); text-underline-offset: 3px; text-decoration-color: var(--lime); }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the wide, heavy uppercase voice of race branding */
.display, .section-title, .instruction, .board-label, .wordmark, .btn, .topstrip, .howto strong, .step-label, .kicker {
  font-family: var(--font);
  font-stretch: 125%;
  text-transform: uppercase;
}

/* ---------- top of page ---------- */
.topstrip {
  margin: 0;
  background: var(--lime);
  color: var(--arena);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .06em;
  text-align: center;
  padding: 7px var(--gutter);
}
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; width: 100%; margin: 0 auto;
  padding: 16px var(--gutter);
}
.wordmark {
  color: var(--chalk); text-decoration: none;
  font-weight: 800; font-size: 19px; letter-spacing: -.01em;
}
.wordmark span { color: var(--lime); }
.wordmark.small { font-size: 15px; }
.masthead-link { color: var(--mute); font-size: 15px; text-decoration: none; }
.masthead-link:hover { color: var(--chalk); }

.screen { display: flex; flex-direction: column; gap: 22px; }

/* ---------- intro ---------- */
.hero { position: relative; padding: 28px 0 8px; display: flex; flex-direction: column; gap: 16px; isolation: isolate; }
.backdrop {
  position: absolute; z-index: -1; right: -12px; top: -6px; margin: 0;
  font: 800 150px/0.8 var(--font); font-stretch: 125%;
  color: var(--backdrop); letter-spacing: -.04em;
  pointer-events: none; user-select: none;
}
.kicker { margin: 0; color: var(--lime); font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.display {
  margin: 0;
  font-weight: 800; font-size: clamp(44px, 13vw, 64px); line-height: .92; letter-spacing: -.02em;
}
.lede { margin: 0; font-size: 18px; color: var(--chalk); max-width: 32ch; }

.howto {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0;
  border-top: 1px solid var(--steel);
  counter-reset: how;
}
.howto li {
  display: grid; grid-template-columns: 44px 1fr; column-gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--steel);
  color: var(--mute); font-size: 16px;
  counter-increment: how;
}
.howto li::before {
  content: counter(how);
  grid-row: span 2;
  font: 800 34px/1 var(--font); font-stretch: 125%; color: var(--lime);
}
.howto strong { display: block; color: var(--chalk); font-weight: 800; font-size: 15px; letter-spacing: .02em; }

.privacy-line { margin: 0; color: var(--mute); font-size: 15px; }
.privacy-line.done { color: var(--chalk); font-weight: 600; }
.fineprint { margin: 0; color: var(--mute); font-size: 14px; }

/* ---------- buttons: square, loud ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  font-weight: 800; font-size: 16px; letter-spacing: .03em; line-height: 1;
  border-radius: 2px;
  padding: 19px 24px;
  width: 100%;
  min-height: 56px;
}
.btn-primary { background: var(--lime); color: var(--arena); }
.btn-primary:hover { background: var(--lime-press); }
.btn-primary:disabled { background: var(--steel); color: var(--mute); cursor: progress; }
.btn-quiet { background: transparent; color: var(--chalk); box-shadow: inset 0 0 0 2px var(--steel); }
.btn-quiet:hover { box-shadow: inset 0 0 0 2px var(--chalk); }

/* ---------- capture ---------- */
#screen-capture { gap: 14px; }
.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  counter-reset: step;
}
.step { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.step-thumb {
  width: min(100%, 78px); aspect-ratio: 3 / 4;
  background: var(--backdrop);
  box-shadow: inset 0 0 0 2px var(--steel);
  background-size: cover; background-position: center;
  display: grid; place-items: center;
  font: 800 28px var(--font); font-stretch: 125%; color: var(--steel);
}
.step-thumb::before { counter-increment: step; content: counter(step); }
.step.has-photo .step-thumb::before { content: ""; }
.step.has-photo .step-thumb { transform: scaleX(-1); }
.step.current .step-thumb { box-shadow: inset 0 0 0 3px var(--lime); color: var(--lime); }
.step.bad .step-thumb { box-shadow: inset 0 0 0 3px var(--alert); }
.step-label { font-weight: 700; font-size: 11px; letter-spacing: .04em; color: var(--mute); }
.step.current .step-label { color: var(--chalk); }

.instruction { margin: 0; font-weight: 800; font-size: 22px; line-height: 1.05; text-align: center; letter-spacing: -.01em; }

.viewfinder {
  position: relative;
  aspect-ratio: 3 / 4;
  height: min(50dvh, calc((100vw - 2 * var(--gutter)) * 4 / 3), 600px);
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}
.viewfinder video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.viewfinder .oval { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.camera-error { position: absolute; inset: 0; margin: 0; padding: 24px; display: grid; place-items: center; text-align: center; color: var(--chalk); }

.capture-actions { display: flex; justify-content: center; }
.shutter {
  width: 76px; height: 76px; border-radius: 50%;
  border: 4px solid var(--lime); background: transparent; cursor: pointer;
  box-shadow: inset 0 0 0 6px var(--arena), inset 0 0 0 40px var(--chalk);
  transition: transform .08s ease-out;
}
.shutter:active { transform: scale(.94); }
.shutter:disabled { opacity: .35; cursor: default; }

.ready { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
#ts-widget:empty { display: none; }
#ts-widget { display: flex; justify-content: center; min-height: 0; }

.error { margin: 0; padding: 10px 14px; border-left: 4px solid var(--alert); background: rgba(255, 107, 107, .12); color: var(--chalk); font-weight: 600; }

/* ---------- the finish board ---------- */
.board {
  position: relative;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(79, 216, 255, .18), transparent 60%),
    var(--board);
  border: 6px solid #05070A;
  padding: 26px 22px 24px;
  text-align: center;
}
.board-label { margin: 0; font-weight: 800; font-size: 15px; letter-spacing: .06em; color: var(--chalk); }
.board-figure {
  margin: 6px 0 2px;
  font: 800 clamp(84px, 30vw, 136px)/.95 var(--font); font-stretch: 100%;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 0 18px rgba(79, 216, 255, .75), 0 0 2px rgba(255, 255, 255, .9);
}
#screen-search .board-figure { font-size: clamp(56px, 18vw, 84px); }
.board-sub { margin: 0; color: rgba(242, 244, 245, .78); font-size: 15px; }
.track { margin: 18px auto 0; height: 4px; max-width: 80%; background: rgba(79, 216, 255, .18); overflow: hidden; }
.track span { display: block; height: 100%; width: 35%; background: var(--glow); box-shadow: 0 0 10px var(--glow); animation: run 1.3s ease-in-out infinite; }
.track.done span { width: 100%; animation: none; }
@keyframes run { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- results ---------- */
.section-title { margin: 0 0 4px; font-weight: 800; font-size: 20px; line-height: 1.1; letter-spacing: -.005em; }
.section-title.big { font-size: 30px; }
.group-note { margin: 0 0 12px; color: var(--mute); font-size: 15px; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.grid a { display: block; overflow: hidden; background: var(--backdrop); aspect-ratio: 2 / 3; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid a:hover img { opacity: .9; }
.empty p { margin: 6px 0 0; color: var(--mute); }

/* ---------- shout-out ---------- */
.shout {
  background: var(--backdrop);
  border-left: 4px solid var(--lime);
  padding: 20px 18px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.shout .section-title { margin: 0; }
.shout-lede { margin: 0; color: var(--chalk); }
.shout-lede b { color: var(--lime); font-weight: 700; }
.shout-caption {
  margin: 0; padding: 12px 14px;
  background: var(--arena); border: 1px dashed var(--steel);
  color: var(--mute); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.copy-status { margin: -4px 0 0; min-height: 1.2em; font-size: 14px; color: var(--lime); text-align: center; }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--steel);
  padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 14px; color: var(--mute);
}
.foot a:not(.wordmark) { color: var(--mute); }
.foot p { margin: 0; font-size: 12px; }

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .backdrop { font-size: 190px; }
}
/* short phones: keep the shutter on screen */
@media (max-height: 720px) {
  #screen-capture { gap: 10px; }
  .masthead { padding: 10px var(--gutter); }
  .step-thumb { width: min(100%, 54px); font-size: 22px; }
  .instruction { font-size: 18px; }
  .viewfinder { height: min(40dvh, calc((100vw - 2 * var(--gutter)) * 4 / 3)); }
  .error { padding: 8px 12px; font-size: 15px; }
  .shutter { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .track span { animation: none; width: 100%; opacity: .5; }
  .shutter { transition: none; }
}
