:root {
  --navy: #0b1a4a;
  --blue: #1b5cff;
  --red: #ff3b3b;
  --yellow: #ffd23f;
  --white: #ffffff;
  --font: 'Lilita One', 'Arial Rounded MT Bold', 'Arial Black', system-ui, sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --pad: clamp(86px, 24vmin, 132px);
  --backdrop: rgba(0, 0, 0, 0.88); /* behind every popup, so the game fades right back */
  --outline: 3px 3px 0 var(--navy), -3px 3px 0 var(--navy), 3px -3px 0 var(--navy), -3px -3px 0 var(--navy),
    0 4px 0 var(--navy), 4px 0 0 var(--navy), -4px 0 0 var(--navy), 0 -4px 0 var(--navy), 0 9px 0 rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #8ed2fb;
  color: var(--white);
  font-family: var(--font);
  letter-spacing: 0.02em;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

[hidden] { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

kbd {
  font-family: var(--font);
  background: rgba(255, 255, 255, 0.9);
  color: var(--navy);
  border-radius: 6px;
  padding: 0 7px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

/* ---------- Buttons ---------- */
button { font-family: var(--font); cursor: pointer; }
.btn {
  font-size: 24px;
  padding: 12px 30px;
  border-radius: 999px;
  border: 4px solid var(--navy);
  background: var(--yellow);
  color: var(--navy);
  box-shadow: 0 6px 0 var(--navy);
  letter-spacing: 0.04em;
  transition: transform 0.06s, box-shadow 0.06s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--navy); }
.btn-alt { background: var(--white); }
.btn-play {
  font-size: clamp(30px, 8vmin, 46px);
  padding: 14px 64px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.06); } }

.icon-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 3px solid var(--white);
  background: rgba(11, 26, 74, 0.72);
  color: var(--white);
  font-size: 20px;
  line-height: 1;
  padding: 0;
  touch-action: manipulation;
}

/* ---------- Title ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--st) + 22px) calc(var(--sr) + 20px) calc(var(--sb) + 22px) calc(var(--sl) + 20px);
  text-align: center;
}
.screen.center { justify-content: center; background: var(--backdrop); }

.title {
  pointer-events: none;
  /* A black tint over the game behind it (often live and busy): darkest behind the
     logo and the card, lighter through the middle so the action still shows. */
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.74), rgba(0, 0, 0, 0.52) 30%, rgba(0, 0, 0, 0.4) 52%, rgba(0, 0, 0, 0.74) 82%);
}
.title > * { pointer-events: auto; }
.title-head, .title-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.logo {
  display: flex;
  flex-direction: column;
  font-size: clamp(54px, 15vmin, 120px);
  line-height: 0.86;
  color: var(--yellow);
  text-shadow: var(--outline);
  transform: rotate(-4deg);
  filter: drop-shadow(0 0.04em 0.14em rgba(0, 0, 0, 0.75)); /* stands out from whatever's behind */
}
.logo span:last-child { color: var(--white); margin-left: 0.4em; }
/* A ninja's red headband tied round "NINJA", its tails flying off the end. */
.logo-ninja { position: relative; align-self: flex-start; }
.logo-ninja::before,
.logo-ninja::after { content: ''; position: absolute; z-index: -1; }
.logo-ninja::before {
  left: -0.14em;
  right: -0.1em;
  top: 0.3em;
  height: 0.3em;
  background: var(--red);
  border: 0.05em solid var(--navy);
  border-radius: 0.06em;
  box-shadow: 0 0.05em 0 var(--navy);
}
.logo-ninja::after {
  right: -0.5em;
  top: 0.24em;
  width: 0.46em;
  height: 0.42em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 36'%3E%3Cg fill='%23ff3b3b' stroke='%230b1a4a' stroke-width='3' stroke-linejoin='round'%3E%3Cpath d='M2 9C14 3 23 14 38 5l-2 9C22 22 14 11 2 17Z'/%3E%3Cpath d='M2 19c10-2 20 11 34 7l-3 8c-13 2-21-8-31-7Z'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
  animation: flutter 0.9s ease-in-out infinite;
  transform-origin: left center;
}
@keyframes flutter { 50% { transform: rotate(-7deg) scaleX(0.92); } }
.logo-star {
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.08em;
  vertical-align: 0.12em;
  fill: #eef2f8;
  stroke: var(--navy);
  stroke-width: 1.6;
  stroke-linejoin: round;
  filter: drop-shadow(0 0.04em 0 var(--navy));
  animation: spin 3s linear infinite;
}
.logo-star circle { fill: var(--navy); stroke: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.how, .best { font-size: clamp(15px, 3.8vmin, 20px); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.best { color: var(--yellow); min-height: 1em; }
.touch-only { display: none; }
.is-touch .touch-only { display: inline; }
.is-touch .kbd-only { display: none; }
.rotate-hint { display: none; font-size: 15px; opacity: 0.9; }
.is-touch .rotate-hint { display: block; }

@media (orientation: landscape) {
  .title {
    align-items: flex-start;
    justify-content: center;
    gap: 5vh;
    padding-left: calc(var(--sl) + 6vw);
    /* (menu on the left, so darkest there; a lighter tint over the action on the right) */
    background: linear-gradient(to right, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.58) 42%, rgba(0, 0, 0, 0.36) 68%, rgba(0, 0, 0, 0.3));
  }
  .title-head, .title-foot { align-items: flex-start; text-align: left; }
  .is-touch .rotate-hint { display: none; }
}

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.hud-top {
  position: absolute;
  top: calc(var(--st) + 10px);
  left: calc(var(--sl) + 12px);
  right: calc(var(--sr) + 12px);
  display: flex;
  align-items: center;
  gap: 10px;
}
.pill {
  flex: none;
  background: rgba(11, 26, 74, 0.72);
  border: 3px solid var(--white);
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 22px;
  min-width: 84px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.progress {
  position: relative;
  flex: 1;
  max-width: 460px;
  height: 14px;
  margin: 0 auto;
  background: rgba(11, 26, 74, 0.5);
  border: 3px solid var(--white);
  border-radius: 99px;
}
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--yellow); border-radius: 99px; }
.progress-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: #ff6b1a;
  border: 3px solid var(--white);
}
.kbd-hint {
  position: absolute;
  bottom: calc(var(--sb) + 18px);
  left: 0;
  right: 0;
  text-align: center;
  font-size: 17px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
  animation: fadeout 1s 6s forwards;
}
.is-touch .kbd-hint { display: none; }
@keyframes fadeout { to { opacity: 0; } }

.hud-extra { display: flex; gap: inherit; }
.icon-btn svg { width: 56%; height: 56%; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.icon-btn svg circle { fill: currentColor; stroke: none; }
.flying .hud-extra { display: none; }

@media (max-width: 520px) {
  .pill { font-size: 18px; min-width: 64px; padding: 2px 10px; }
  .icon-btn { width: 38px; height: 38px; font-size: 17px; }
  .hud-top { gap: 6px; }
  /* No room left in the bar on a phone held upright: hang them underneath it. */
  .hud-extra { position: absolute; top: calc(100% + 8px); right: 0; flex-direction: column; gap: 8px; }
}

/* ---------- Show-off moves ---------- */
/* Centred between the pads, level with them. (In the HUD, not the touch layer, so
   tapping one never counts as a run or a jump.) */
.moves {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sb) + 22px + (var(--pad) - var(--move)) / 2);
  --move: clamp(40px, 11vmin, 52px);
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}
.move-btn {
  pointer-events: auto;
  position: relative;
  width: var(--move);
  height: var(--move);
  padding: 0;
  border-radius: 50%;
  border: 3px solid var(--white);
  background: rgba(11, 26, 74, 0.55);
  font-size: calc(var(--move) * 0.48);
  line-height: 1;
  touch-action: none;
  transition: transform 0.06s;
}
.move-btn:active { transform: scale(0.88); background: var(--yellow); }
.move-btn kbd {
  position: absolute;
  right: -6px;
  bottom: -6px;
  font-size: 12px;
  padding: 0 5px;
}
.is-touch .move-btn kbd { display: none; }
.flying .moves { display: none; }

/* ---------- Touch pads ---------- */
#touch { position: absolute; inset: 0; z-index: 2; display: flex; touch-action: none; }
.zone { flex: 1; position: relative; touch-action: none; }
.pad {
  position: absolute;
  bottom: calc(var(--sb) + 22px);
  width: var(--pad);
  height: var(--pad);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 5px 0 rgba(11, 26, 74, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: clamp(16px, 4.5vmin, 22px);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.05s, background 0.05s;
  pointer-events: none;
}
.pad svg { width: 42%; height: auto; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.zone-jump .pad { left: calc(var(--sl) + 22px); }
.zone-run .pad { right: calc(var(--sr) + 22px); }
.pad.on { background: var(--yellow); color: var(--navy); text-shadow: none; transform: scale(0.92); }

/* ---------- Course flyover ---------- */
#flyover { position: absolute; inset: 0; z-index: 2; cursor: pointer; touch-action: none; }
.fly-caption {
  position: absolute;
  left: calc(var(--sl) + 24px);
  bottom: calc(var(--sb) + 26px);
  text-shadow: var(--outline);
  pointer-events: none;
}
.fly-name { font-size: clamp(34px, 9vmin, 64px); line-height: 1; color: var(--yellow); text-transform: uppercase; transform-origin: left bottom; }
.fly-name.pop { animation: fly-pop 0.35s ease-out; }
.fly-sub { margin-top: 6px; font-size: clamp(18px, 4.6vmin, 28px); font-variant-numeric: tabular-nums; }
.fly-skip {
  position: absolute;
  right: calc(var(--sr) + 20px);
  bottom: calc(var(--sb) + 26px);
  background: rgba(11, 26, 74, 0.72);
  border: 3px solid var(--white);
  border-radius: 999px;
  padding: 6px 18px;
  font-size: clamp(17px, 4.2vmin, 22px);
  pointer-events: none;
}
@keyframes fly-pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
.flying #hud-time, .flying #hud-wipeouts, .flying #btn-restart, .flying .kbd-hint { display: none; }

/* ---------- Pop-ups ---------- */
#fade { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
#fade.show { animation: flash 0.45s ease-out; }
@keyframes flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }

#banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 30%;
  z-index: 4;
  text-align: center;
  font-size: clamp(56px, 15vmin, 128px);
  color: var(--yellow);
  text-shadow: var(--outline);
  pointer-events: none;
  opacity: 0;
}
#banner.show { animation: pop var(--dur, 0.9s) ease-out forwards; }
#banner.wipe { color: var(--white); --navy: #b3121c; }
#banner.go { color: #7dff9a; }
@keyframes pop {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  14% { transform: scale(1.18) rotate(-3deg); opacity: 1; }
  28% { transform: scale(1) rotate(-3deg); }
  78% { opacity: 1; }
  100% { transform: scale(1.04) rotate(-3deg); opacity: 0; }
}

#quip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sb) + 30px);
  z-index: 4;
  width: max-content; /* (otherwise it wraps at half the screen width) */
  max-width: min(56vw, 440px);
  transform: translate(-50%, 10px);
  background: var(--white);
  color: var(--navy);
  border: 3px solid var(--navy);
  border-radius: 18px;
  padding: 8px 16px;
  font-size: clamp(15px, 4vmin, 21px);
  box-shadow: 0 5px 0 var(--navy);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
#quip::before { content: '🎙️ '; }
#quip.show { opacity: 1; transform: translate(-50%, 0); }
@media (orientation: portrait) {
  #quip { bottom: auto; top: calc(var(--st) + 66px); max-width: 86vw; }
}
/* (Sideways, the commentator sits just above the show-off buttons.) */
@media (orientation: landscape) {
  #quip { bottom: calc(var(--sb) + 22px + var(--pad) + 10px); }
}
/* (clear of the leaderboard and share buttons hanging down the right) */
@media (max-width: 520px) { #quip { max-width: calc(100vw - 2 * (var(--sr) + 62px)); } }

/* ---------- Cards ---------- */
.card {
  width: min(92vw, 420px);
  max-height: 100%;
  overflow: auto;
  background: var(--white);
  color: var(--navy);
  border: 5px solid var(--navy);
  border-radius: 26px;
  padding: 16px 22px 22px;
  box-shadow: 0 10px 0 var(--navy);
  pointer-events: auto;
}
.card h2 { margin: 0; font-size: clamp(34px, 9vmin, 46px); font-weight: normal; color: var(--blue); }
.medal { font-size: 46px; line-height: 1; }
.medal-label { font-size: 18px; color: #6b7597; }
.big-time { font-size: clamp(48px, 13vmin, 68px); line-height: 1.05; font-variant-numeric: tabular-nums; }
.big-time small { font-size: 0.45em; margin-left: 4px; }
.new-best { color: #fff; background: var(--red); display: inline-block; border-radius: 99px; padding: 2px 12px; margin-bottom: 4px; }
.stats { display: flex; justify-content: center; gap: 28px; margin: 8px 0 14px; }
.stats span { display: block; font-size: 15px; color: #6b7597; }
.stats b { font-size: 26px; font-weight: normal; }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.row .btn { font-size: 20px; padding: 10px 20px; }

@media (max-height: 430px) {
  .medal { font-size: 34px; }
  .card { padding: 10px 18px 16px; }
  .stats { margin: 4px 0 10px; }
}

/* ---------- Ad placeholders ---------- */
.screen.ad { gap: 14px; }
.ad-label { font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.7; }
.ad-box {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 3px dashed rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  font-size: 22px;
}
.ad-video { width: min(86vw, 560px); aspect-ratio: 16 / 9; max-height: 52vh; background: #000; }
.ad-video small { font: 14px system-ui, sans-serif; opacity: 0.6; }
.ad-why { font: 15px/1.4 system-ui, -apple-system, sans-serif; opacity: 0.8; max-width: 440px; }
.ad-next { font-size: 20px; }
.ad-next.small { font-size: 14px; color: #6b7597; }
.queue-ad { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0; }
.queue-ad .ad-label { color: #6b7597; opacity: 1; font-size: 11px; }
.ad-small { width: min(100%, 300px); aspect-ratio: 300 / 250; max-height: 34vh; border-color: #c5cce0; color: #9aa3c0; background: #f3f6ff; font-size: 18px; }
@media (max-height: 500px) { .ad-small { aspect-ratio: 320 / 100; } }

/* ---------- Contestant sign-up ---------- */
.profile-card {
  width: min(92vw, 380px);
  padding: 14px 18px 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  touch-action: manipulation;
}
.pc-label { font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); }
.pc-name { font-size: clamp(28px, 8vmin, 38px); line-height: 1.05; word-break: break-word; }
.pc-email { font-size: 15px; color: #6b7597; margin-bottom: 8px; word-break: break-all; }
.pc-email.no-prize { color: #b3121c; }
.promo {
  margin-top: 10px;
  font-size: clamp(19px, 5.2vmin, 30px);
  letter-spacing: 0.02em;
  text-shadow: 2px 2px 0 var(--navy), -2px 2px 0 var(--navy), 2px -2px 0 var(--navy), -2px -2px 0 var(--navy), 0 4px 0 var(--navy);
}
.promo b { font-weight: normal; color: var(--yellow); }
.live-pill {
  margin-top: 10px;
  padding: 5px 14px 5px 12px;
  border-radius: 999px;
  border: 3px solid var(--white);
  background: rgba(200, 20, 31, 0.88);
  font-size: clamp(15px, 4vmin, 19px);
  letter-spacing: 0.04em;
}
.live-pill i { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--white); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.pc-perks { margin: -2px 0 10px; padding: 6px 10px; border-radius: 12px; background: #fff4c7; font: 14px/1.35 system-ui, -apple-system, sans-serif; color: var(--navy); }
.profile-card .btn-play { margin-top: 6px; align-self: stretch; animation: none; font-size: clamp(22px, 6vmin, 30px); padding: 12px 20px; }
.profile-card label { font-size: 17px; margin-top: 6px; }
.profile-card label small { font-size: 13px; color: #6b7597; }
.profile-card input {
  font: 18px system-ui, -apple-system, sans-serif; /* 16px+ stops iOS zooming in on focus */
  padding: 10px 12px;
  border: 3px solid var(--navy);
  border-radius: 12px;
  color: var(--navy);
  background: #f3f6ff;
  width: 100%;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}
.profile-card input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(27, 92, 255, 0.25); }
.profile-card input[aria-invalid='true'] { border-color: #d11a2a; }
.field-error { min-height: 0; font: 14px system-ui, sans-serif; color: #d11a2a; }
.small-print { margin: 4px 0 0; font: 13px/1.35 system-ui, -apple-system, sans-serif; color: #4a5578; }
.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 6px;
  font: 14px/1.35 system-ui, -apple-system, sans-serif;
  color: var(--navy);
  cursor: pointer;
}
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--blue); }
.check small { color: #6b7597; }
.check.disabled { opacity: 0.45; cursor: default; }
.prize-note {
  margin: 4px 0 0;
  padding: 6px 10px;
  border-radius: 10px;
  background: #fff4cc;
  font: 13px/1.35 system-ui, -apple-system, sans-serif;
  color: #6b4d00;
}
.prize-note.ok { background: #e3f8e9; color: #146c2e; }
.link-btn {
  background: none;
  border: none;
  padding: 6px 0 0;
  font: 15px system-ui, -apple-system, sans-serif;
  color: var(--blue);
  text-decoration: underline;
  align-self: center;
  touch-action: manipulation;
}

/* Keep the form reachable on short screens (and above the on-screen keyboard). */
.title.form-mode { overflow-y: auto; touch-action: pan-y; }
@media (orientation: portrait) {
  .title.form-mode { justify-content: flex-start; gap: 14px; }
  .title.form-mode .logo { font-size: clamp(40px, 11vmin, 70px); }
}
@media (orientation: landscape) {
  .title.form-mode { justify-content: flex-start; }
  .title.form-mode .title-head { flex-direction: row; align-items: center; gap: 16px; }
  .title.form-mode .logo { font-size: clamp(32px, 8vh, 56px); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .title .how, .title .best { display: none; }
  .title.form-mode .promo { display: none; }
}

/* ---------- Results + leaderboard ---------- */
.results-card { width: min(94vw, 440px); touch-action: pan-y; }
.res-board { margin-top: 14px; border-top: 3px dashed #d5dbee; padding-top: 10px; }
.res-board h3, .board-card h3 { margin: 0 0 6px; font-weight: normal; font-size: 22px; color: var(--navy); }
.board-card { position: relative; width: min(92vw, 400px); touch-action: pan-y; }
.board { list-style: none; margin: 0; padding: 0; text-align: left; }
.board-note { margin: 0 0 8px; font: 14px/1.4 system-ui, -apple-system, sans-serif; color: #4a5680; }
.board-note .lead { font-weight: 700; color: var(--navy); }
.board li {
  display: grid;
  grid-template-columns: 2.2em 14px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 17px;
}
.board li:nth-child(odd) { background: #f3f6ff; }
.board li.me { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--navy); }
.board-share { display: block; width: fit-content; margin: 12px auto 0; font-size: 18px; padding: 8px 20px; }
.board li.gap { background: none; justify-content: center; display: block; text-align: center; color: #9aa3c0; padding: 0; }
.board .rank { color: #6b7597; text-align: right; }
.board .swatch { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--navy); }
.board .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .t { font-variant-numeric: tabular-nums; }
.board .tries { font: 13px system-ui, -apple-system, sans-serif; color: #6b7597; white-space: nowrap; }
.board li.me .tries { color: var(--navy); }
.board-status { font: 14px system-ui, sans-serif; color: #6b7597; min-height: 1em; }

@media (orientation: landscape) and (min-width: 640px) {
  .results-card { width: min(94vw, 780px); display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
  .res-board { margin-top: 0; border-top: none; border-left: 3px dashed #d5dbee; padding: 0 0 0 18px; }
}

/* Short landscape phones: name and email side by side so the whole form fits. */
@media (orientation: landscape) and (max-height: 500px) {
  .title.form-mode { gap: 8px; padding-top: calc(var(--st) + 10px); padding-bottom: calc(var(--sb) + 10px); }
  .title.form-mode .logo { font-size: 30px; }
  #profile-form {
    width: min(64vw, 560px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
    row-gap: 2px;
    padding: 10px 14px 12px;
  }
  #profile-form > * { grid-column: 1 / -1; }
  #profile-form label[for='pf-name'] { grid-area: 2 / 1; }
  #profile-form #pf-name { grid-area: 3 / 1; }
  #profile-form #pf-name-error { grid-area: 4 / 1; }
  #profile-form label[for='pf-email'] { grid-area: 2 / 2; }
  #profile-form #pf-email { grid-area: 3 / 2; }
  #profile-form #pf-email-error { grid-area: 4 / 2; }
  #profile-form label { margin-top: 2px; font-size: 15px; }
  #profile-form .check { font-size: 12px; margin-top: 2px; }
  #profile-form input { padding: 7px 10px; font-size: 16px; }
  #profile-form .btn-play { padding: 8px 20px; font-size: 22px; }
  .profile-card .small-print, .profile-card .prize-note { font-size: 12px; }
}

/* ---------- Queue ---------- */
.queue-card { width: min(92vw, 400px); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.queue-pos { font-size: clamp(26px, 7vmin, 36px); }
.queue-pos b { color: var(--blue); font-weight: normal; }
.queue-sub { margin: 0; font: 15px/1.4 system-ui, -apple-system, sans-serif; color: #4a5578; }
.queue-splash { font-size: 40px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(8deg); } }
.hud-players { font-size: 18px; min-width: 0; }
@media (max-width: 520px) { .hud-players { display: none; } }

/* ---------- Sharing ---------- */
.challenge {
  font: 15px/1.35 system-ui, -apple-system, sans-serif;
  color: var(--navy);
  background: #fff;
  border: 3px solid var(--navy);
  border-radius: 14px;
  padding: 6px 12px;
  max-width: min(88vw, 380px);
  box-shadow: 0 4px 0 var(--navy);
}
/* Up top, clear of the thumbs on RUN and JUMP (and below the commentator in portrait). */
.share-pill {
  position: absolute;
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  top: calc(var(--st) + 64px);
  z-index: 6;
  font: clamp(16px, 4.6vw, 20px) var(--font);
  white-space: nowrap;
  padding: 10px 20px;
  border-radius: 999px;
  border: 3px solid var(--navy);
  background: var(--yellow);
  color: var(--navy);
  box-shadow: 0 5px 0 var(--navy);
  animation: pulse 1s ease-in-out infinite;
  touch-action: none;
}
@media (orientation: portrait) { .share-pill { top: calc(var(--st) + 148px); } }
.modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--st) + 12px) 12px calc(var(--sb) + 12px);
  background: var(--backdrop);
  touch-action: pan-y;
}
.share-card {
  position: relative;
  width: min(94vw, 460px);
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.share-card img { width: 100%; max-height: 52vh; object-fit: contain; border-radius: 14px; background: #eef3ff; }
.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--navy);
  background: #fff;
  color: var(--navy);
  font-size: 16px;
  z-index: 1;
}
.socials { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.social {
  font: 15px var(--font);
  letter-spacing: 0.03em;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--navy);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.social.x { background: #000; }
.social.facebook { background: #1877f2; }
.social.whatsapp { background: #25d366; }
.social.reddit { background: #ff4500; }
.social.telegram { background: #27a7e7; }
.social.copy { background: #fff; color: var(--navy); }
.share-hint { margin: 0; font: 13px system-ui, sans-serif; color: #6b7597; text-align: center; }
.share-perk { margin: 0; padding: 6px 12px; border-radius: 12px; background: #fff4c7; font: 13px/1.35 system-ui, sans-serif; color: var(--navy); text-align: center; }
@media (orientation: landscape) and (max-height: 500px) {
  .share-card { width: min(96vw, 760px); display: grid; grid-template-columns: auto 1fr; align-items: center; }
  .share-card img { max-height: 80vh; width: auto; grid-row: span 3; }
}
