/* The landing-page game: canvas plus HTML HUD layered on top. */

.game {
  position: relative;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 44px);
  height: calc(100svh - 44px);
  min-height: 460px;
  overflow: hidden;
  background: #0b0a2e;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* The canvas and its overlay HUD; the control bar sits below, never on the street. */
.game__stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }

.game__canvas {
  position: absolute;
  inset: 0 auto auto 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: pan-y;
  cursor: pointer;
}
.game.is-playing .game__canvas { cursor: crosshair; }

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
.hud a, .hud button, .toast { pointer-events: auto; }

.hud__top { text-align: center; }

/* UTAH PRIDE, each letter its own color, bouncing in a wave. */
.title {
  margin: 0;
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: clamp(38px, 13.5vw, 96px);
  line-height: 1.08;
  letter-spacing: 0.02em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 0.45em;
}
.title__word { display: inline-flex; }
.title__word > span {
  display: inline-block;
  color: var(--c);
  text-shadow:
    -3px 0 0 var(--ink), 3px 0 0 var(--ink), 0 -3px 0 var(--ink), 0 3px 0 var(--ink),
    5px 5px 0 var(--ink);
  animation: title-bounce 1.2s steps(6) infinite;
  animation-delay: calc(var(--i) * -0.12s);
}
.title__word > span:nth-child(6n + 1) { --c: var(--red); }
.title__word > span:nth-child(6n + 2) { --c: var(--orange); }
.title__word > span:nth-child(6n + 3) { --c: var(--yellow); }
.title__word > span:nth-child(6n + 4) { --c: var(--green); }
.title__word > span:nth-child(6n + 5) { --c: #5aa2ff; }
.title__word > span:nth-child(6n + 6) { --c: #c26bff; }
.title__word + .title__word > span:nth-child(1) { --c: #c26bff; }
.title__word + .title__word > span:nth-child(2) { --c: var(--pink); }
.title__word + .title__word > span:nth-child(3) { --c: var(--red); }
.title__word + .title__word > span:nth-child(4) { --c: var(--orange); }
.title__word + .title__word > span:nth-child(5) { --c: var(--yellow); }

@keyframes title-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.12em); }
}

.title.is-wiggle { animation: wiggle 0.3s steps(3); }
@keyframes wiggle {
  33% { transform: rotate(-3deg); }
  66% { transform: rotate(3deg); }
}

.title.is-deseret .title__word > span { font-family: "Noto Sans Deseret", var(--font-body); font-weight: 700; }

.game.is-paradise .title__word > span {
  --c: var(--gold) !important;
  color: var(--gold);
  background: linear-gradient(180deg, #fffbe0 0%, var(--gold) 45%, #ff9ad5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(3px 0 0 var(--ink)) drop-shadow(-3px 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 -3px 0 var(--ink)) drop-shadow(4px 4px 0 #c2185b);
}

.hud__sub {
  margin: 6px 0 10px;
  font-family: var(--font-pixel);
  font-size: 8px;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--white);
  text-shadow: 2px 2px 0 var(--ink);
}

.meter {
  position: relative;
  height: 18px;
  max-width: 320px;
  margin: 0 auto;
  background: rgba(7, 11, 31, 0.7);
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 2px var(--white);
}
.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--rainbow);
  transition: width 0.25s steps(4);
}
.meter__label {
  position: relative;
  display: block;
  font-family: var(--font-pixel);
  font-size: 8px;
  line-height: 12px;
  color: var(--white);
  text-shadow: 1px 1px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
}
.game.is-paradise .hud__sub,
.game.is-paradise .stats,
.game.is-paradise .prompt span {
  background: rgba(7, 11, 31, 0.6);
  padding: 3px 6px;
}
.game.is-paradise .hud__sub { display: table; margin-inline: auto; }
.game.is-paradise .meter__fill { background: linear-gradient(90deg, #fff4c2, var(--gold), #ff9ad5, var(--gold), #fff4c2); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.stats {
  display: flex;
  justify-content: space-between;
  max-width: 320px;
  margin: 6px auto 0;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--white);
  text-shadow: 1px 1px 0 var(--ink);
}

/* One fixed-height line: the blinking prompt, or the road-trip button. Fixed so
   the game's flight area doesn't jump when it changes. */
.hud__slot { height: 40px; margin-top: 8px; display: flex; align-items: center; justify-content: center; }
.hud__trip { min-height: 36px; padding: 6px 12px; font-size: 10px; pointer-events: auto; animation: trip-pulse 1s steps(2) infinite; }
.hud__trip[hidden] { display: none; }
@keyframes trip-pulse { 50% { box-shadow: 4px 4px 0 var(--ink), 0 0 0 3px var(--yellow); } }
.prompt {
  margin: 0;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 10px;
  line-height: 1.6;
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
}
.prompt span { animation: blink 1s steps(2) infinite; }
.game.is-playing .prompt:not(.is-hint) { visibility: hidden; }
.game.is-trip-ready .prompt { display: none; }
@keyframes blink { 50% { opacity: 0; } }

/* Control bar under the canvas. */
.game__bar {
  flex: none;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 6px var(--gutter) 8px;
  background: var(--ink);
  border-top: 3px solid transparent;
  border-image: var(--rainbow) 1;
}
.game__bar .px-btn { min-height: 40px; padding: 6px 10px; font-size: 11px; box-shadow: 3px 3px 0 #000; }
.bar__icon { width: 44px; padding: 0 !important; font-family: var(--font-body) !important; font-size: 18px !important; }
.bar__icon[aria-pressed="false"] { opacity: 0.85; text-decoration: line-through; }
.bar__secrets { font-variant-numeric: tabular-nums; }
.bar__secrets.is-bump { animation: bump 0.5s steps(4); }
@keyframes bump { 50% { transform: scale(1.2); background: var(--yellow); } }
.bar__shop { flex: 0 1 auto; }

/* Secret and fact toasts: small, under the HUD, never block taps, fade on their own. */
.toasts {
  width: min(340px, 100%);
  margin: 6px auto 0;
  display: grid;
  gap: 6px;
  pointer-events: none;
}
.toast {
  padding: 8px 10px 8px 12px;
  background: rgba(7, 11, 31, 0.86);
  color: var(--white);
  border-left: 6px solid transparent;
  border-image: var(--rainbow-v) 1;
  font-size: 13px;
  line-height: 1.4;
  animation: toast-in 0.25s steps(4);
}
.toast--fact { font-size: 12px; border-image: none; border-left-color: var(--trans-blue); }
.toast__kicker { display: block; font-family: var(--font-pixel); font-size: 7px; color: var(--yellow); margin-bottom: 4px; }
.toast__title { display: block; font-family: var(--font-pixel); font-size: 9px; line-height: 1.4; margin-bottom: 3px; color: var(--pink); }
.toast p { margin: 0; }
.toast.is-out { animation: toast-out 0.2s steps(3) forwards; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-8px); opacity: 0; } }

/* The secrets log. */
.secrets-log {
  width: min(520px, calc(100% - 24px));
  max-height: min(80vh, 720px);
  padding: 0;
  background: var(--navy-deep);
  color: var(--white);
  border: var(--border-px);
  box-shadow: 6px 6px 0 var(--pink);
  overscroll-behavior: contain;
}
.secrets-log::backdrop { background: rgba(7, 11, 31, 0.7); }
.secrets-log__head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 12px 16px; background: var(--ink); border-bottom: 3px solid var(--pink); z-index: 1; }
.secrets-log__title { margin: 0; font-family: var(--font-pixel); font-size: 13px; }
.secrets-log__close { width: 40px; height: 40px; border: 0; background: none; font-family: var(--font-pixel); font-size: 13px; cursor: pointer; }
.secrets-log__how { margin: 12px 16px 4px; font-size: 14px; opacity: 0.85; }
.secrets-log .spark { color: var(--yellow); }
.secrets-log__group { margin: 16px 16px 6px; font-family: var(--font-pixel); font-size: 9px; color: var(--trans-blue); text-transform: uppercase; }
.secrets-log ul { list-style: none; margin: 0; padding: 0 16px 16px; display: grid; gap: 8px; }
.secrets-log li { padding: 10px 12px; border: 2px solid #2b3566; background: #0f1a42; font-size: 14px; line-height: 1.45; }
.secrets-log li.is-found { border-color: var(--yellow); }
.secrets-log li strong { display: block; font-family: var(--font-pixel); font-size: 9px; line-height: 1.5; margin-bottom: 4px; color: var(--yellow); }
.secrets-log li:not(.is-found) strong { color: #8a93b0; }
.secrets-log li p { margin: 0; }

/* Ultra gay mode: the whole scene cycles through the rainbow. */
.game.is-ultra .game__canvas { animation: ultra 3s linear infinite; }
@keyframes ultra {
  from { filter: hue-rotate(0deg) saturate(1.4); }
  to { filter: hue-rotate(360deg) saturate(1.4); }
}

/* Ticker between the game and the shop: swipe here to scroll on phones. */
.ticker {
  display: block;
  height: 44px;
  overflow: hidden;
  background: var(--rainbow);
  border-block: 3px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 38px;
  white-space: nowrap;
}
.ticker__track { display: inline-flex; animation: ticker 22s linear infinite; }
.ticker__track > span { padding-right: 0; text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6); }
@keyframes ticker { to { transform: translateX(-50%); } }

@media (min-width: 760px) {
  .toasts { width: 400px; }
  .hud__sub { font-size: 10px; }
  .meter, .stats { max-width: 420px; }
  .stats { font-size: 10px; }
  .prompt { font-size: 14px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .title { font-size: clamp(28px, 7vw, 56px); }
  .hud__sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .title__word > span, .ticker__track, .prompt span { animation: none; }
}

/* Social card capture (?og): just the scene and the title. */
.game.is-og .game__bar, .game.is-og .stats, .game.is-og .hud__slot, .game.is-og .meter, .game.is-og .toasts { display: none; }
