/* OrthoPhonix LAB landing page: "Night lab" (plan 01, Design; Documentation/01-site.md).
 * Dark by design. The game colours live only here (the CSP allows no inline styles). */

@font-face {
  font-family: "Cinzel";
  src: url(/assets/fonts/cinzel.woff2?v=d562489615) format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pixelify Title";
  src: url(/assets/fonts/pixelify-title.woff2?v=139ba65273) format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens (contrast pairs are checked by tools/test_build.py) ---------- */

:root {
  --night-0: #05081a;
  --night-1: #0b1033;
  --night-2: #1a1f5c;
  --card: #161a40;
  --pearl: #f4efe6;
  --pearl-dim: #b9b4c9;
  --gold: #f2c14e;
  --aurora-teal: 43 212 189;
  --aurora-violet: 122 92 255;
  --aurora-rose: 214 80 220;

  --serif: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;

  --gutter: 16px;
  --max: 640px;
  --radius: 20px;
  --logo-box: 64px;
  --gap: 24px;
  --ease-out: cubic-bezier(0.2, 0.75, 0.2, 1);

  color-scheme: dark;
}

.sky__world--bananamax,
.game--bananamax {
  --accent: #ffc83d;
  --accent-2: #ff7a1a;
  --ink: #1a0f00;
}

.sky__world--middleway,
.game--middleway {
  --accent: #a98bff;
  --accent-2: #f2c14e;
  --ink: #0b0620;
}

.sky__world--tetherbeat,
.game--tetherbeat {
  --accent: #e42fcd;
  --accent-2: #3ff3ff;
  --ink: #12001a;
}

@media (min-width: 640px) {
  :root { --gutter: 32px; --max: 780px; }
}

/* Three columns. The art is 16:9 when the window is tall enough, and gives up height (never the text) when it
 * isn't, so the three cards and their Play buttons fit a landscape tablet (about 1280 x 625). --hero-h and --body-h
 * are the measured heights of the masthead and of a card's text (Documentation/01-site.md, "Fold"). */
@media (min-width: 1024px) {
  :root {
    --max: 1240px;
    --logo-box: 72px;
    --hero-h: 128px;
    --body-h: 242px;
    --card-w: calc((min(100vw - 2 * var(--gutter), var(--max)) - 2 * var(--gap)) / 3);
    --art-h: clamp(128px, 100vh - var(--hero-h) - var(--body-h) - 18px, var(--card-w) * 0.5625);
  }
  @supports (height: 100dvh) {
    :root { --art-h: clamp(128px, 100dvh - var(--hero-h) - var(--body-h) - 18px, var(--card-w) * 0.5625); }
  }
  :root:lang(fr) { --body-h: 298px; }
}

/* A big desktop window: wider cards. */
@media (min-width: 1600px) and (min-height: 900px) {
  :root { --max: 1440px; }
}

/* ---------- Base ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--night-0);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  isolation: isolate;
  color: var(--pearl);
  background: var(--night-0);
  font: 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- The night sky: gradient, aurora, stars (all CSS, behind everything) ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(90% 55% at 50% -8%, var(--night-2) 0%, rgb(26 31 92 / 0) 70%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-0) 78%);
}

/* Aurora: two soft veils drifting against each other. */
.sky::before,
.sky::after {
  content: "";
  position: absolute;
  left: -30%;
  right: -30%;
  top: -18vh;
  height: 82vh;
  will-change: transform;
}

.sky::before {
  background:
    radial-gradient(30% 38% at 24% 48%, rgb(var(--aurora-teal) / 0.2), transparent 72%),
    radial-gradient(26% 34% at 47% 34%, rgb(var(--aurora-violet) / 0.24), transparent 72%),
    radial-gradient(24% 30% at 74% 46%, rgb(var(--aurora-rose) / 0.12), transparent 72%);
  animation: aurora-a 52s ease-in-out infinite alternate;
}

.sky::after {
  background:
    radial-gradient(34% 22% at 34% 56%, rgb(var(--aurora-teal) / 0.14), transparent 75%),
    radial-gradient(30% 24% at 66% 40%, rgb(var(--aurora-violet) / 0.16), transparent 75%);
  /* Faint vertical rays, like the folds of an aurora curtain. */
  -webkit-mask-image: repeating-linear-gradient(96deg, #000 0 14px, rgb(0 0 0 / 0.55) 22px, #000 34px, rgb(0 0 0 / 0.7) 47px, #000 60px);
  mask-image: repeating-linear-gradient(96deg, #000 0 14px, rgb(0 0 0 / 0.55) 22px, #000 34px, rgb(0 0 0 / 0.7) 47px, #000 60px);
  animation: aurora-b 68s ease-in-out infinite alternate;
}

.sky__stars {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 40%, rgb(0 0 0 / 0.25) 80%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 40%, rgb(0 0 0 / 0.25) 80%, transparent 100%);
}

.sky__stars::before,
.sky__stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}

.sky__stars::before {
  background-image:
    radial-gradient(1px 1px at 17px 23px, rgb(255 255 255 / 0.9), transparent),
    radial-gradient(0.8px 0.8px at 61px 148px, rgb(255 255 255 / 0.75), transparent),
    radial-gradient(1.2px 1.2px at 104px 62px, rgb(255 255 255 / 0.95), transparent),
    radial-gradient(0.7px 0.7px at 150px 201px, rgb(255 255 255 / 0.7), transparent),
    radial-gradient(1px 1px at 189px 33px, rgb(255 255 255 / 0.85), transparent),
    radial-gradient(0.8px 0.8px at 233px 118px, rgb(255 255 255 / 0.7), transparent),
    radial-gradient(1px 1px at 40px 240px, rgb(255 255 255 / 0.8), transparent),
    radial-gradient(0.6px 0.6px at 211px 252px, rgb(255 255 255 / 0.6), transparent),
    radial-gradient(0.6px 0.6px at 88px 103px, rgb(255 255 255 / 0.6), transparent),
    radial-gradient(1.1px 1.1px at 258px 180px, rgb(255 226 160 / 0.9), transparent);
  background-size: 271px 271px;
  animation: twinkle 5.5s ease-in-out infinite alternate;
}

.sky__stars::after {
  background-image:
    radial-gradient(1.4px 1.4px at 31px 77px, rgb(214 255 250 / 0.95), transparent),
    radial-gradient(0.8px 0.8px at 142px 19px, rgb(255 255 255 / 0.7), transparent),
    radial-gradient(1.1px 1.1px at 205px 166px, rgb(255 255 255 / 0.85), transparent),
    radial-gradient(0.9px 0.9px at 330px 90px, rgb(255 255 255 / 0.75), transparent),
    radial-gradient(1.2px 1.2px at 377px 301px, rgb(230 220 255 / 0.9), transparent),
    radial-gradient(0.8px 0.8px at 96px 350px, rgb(255 255 255 / 0.65), transparent),
    radial-gradient(0.7px 0.7px at 270px 232px, rgb(255 255 255 / 0.6), transparent),
    radial-gradient(0.6px 0.6px at 12px 210px, rgb(255 255 255 / 0.55), transparent),
    radial-gradient(1.5px 1.5px at 350px 370px, rgb(255 214 120 / 0.8), transparent);
  background-size: 397px 397px;
  animation: twinkle 7.5s ease-in-out -3s infinite alternate;
}

/* Each game's light: a glow in its colours under its card, lit while the card is hovered or focused. */
.sky__world {
  position: absolute;
  left: 50%;
  top: 8vh;
  width: 70vw;
  height: 92vh;
  margin-left: -35vw;
  background:
    radial-gradient(42% 46% at 50% 40%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 72%),
    radial-gradient(34% 30% at 50% 78%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 74%);
  opacity: 0;
  transition: opacity 0.7s var(--ease-out);
}

@media (min-width: 1024px) {
  .sky__world--bananamax { left: 20%; }
  .sky__world--tetherbeat { left: 80%; }
}

body:has(.game--bananamax:focus-within) .sky__world--bananamax,
body:has(.game--middleway:focus-within) .sky__world--middleway,
body:has(.game--tetherbeat:focus-within) .sky__world--tetherbeat { opacity: 1; }

@media (hover: hover) {
  body:has(.game--bananamax:hover) .sky__world--bananamax,
  body:has(.game--middleway:hover) .sky__world--middleway,
  body:has(.game--tetherbeat:hover) .sky__world--tetherbeat { opacity: 1; }
}

/* A shooting star now and then, high in the sky. */
.sky__comet {
  position: absolute;
  top: 9vh;
  left: 62%;
  width: 140px;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgb(255 244 214 / 0.95));
  opacity: 0;
  transform: rotate(158deg) translateX(0);
  animation: comet 17s linear 3.5s infinite;
}

/* ---------- Header: the language switch ---------- */

/* The switch floats in the masthead's top right corner: it takes no height of its own. */
.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 48px;
  width: min(100% - 2 * var(--gutter) + 16px, var(--max) + 16px);
  margin-inline: auto;
  pointer-events: none;
}

.lang { pointer-events: auto; }

.lang {
  display: flex;
  align-items: center;
}

.lang a {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  color: var(--pearl-dim);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-decoration: none;
  transition: color 0.2s;
}

.lang a + a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  bottom: 15px;
  width: 1px;
  background: rgb(185 180 201 / 0.35);
}

.lang a:hover { color: var(--pearl); }

.lang a[aria-current="page"] { color: var(--gold); }

.lang a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

/* ---------- Masthead: the wordmark under a gold glow, the tagline tucked under it ---------- */

.hero {
  position: relative;
  padding: 44px var(--gutter) 20px;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -24px 0 -12px;
  z-index: -1;
  background:
    radial-gradient(30% 46% at 50% 44%, rgb(242 193 78 / 0.13), transparent 75%),
    radial-gradient(48% 70% at 50% 40%, rgb(26 31 92 / 0.55), transparent 80%);
  pointer-events: none;
}

.hero__mark {
  position: relative;
  width: min(86vw, 400px);
  margin: 0 auto;
  font-size: 1rem;
}

.hero__mark img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 14px rgb(242 193 78 / 0.32)) drop-shadow(0 0 2px rgb(242 193 78 / 0.25));
}

/* One glint runs across the letters as the page opens (the wordmark itself is the mask). */
.hero__mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 42%, rgb(255 255 255 / 0.9) 50%, transparent 58%) no-repeat;
  background-size: 300% 100%;
  background-position: 150% 0;
  -webkit-mask: url(/assets/img/brand/wordmark-1024.webp?v=b2f5a944bb) center / 100% 100% no-repeat;
  mask: url(/assets/img/brand/wordmark-1024.webp?v=b2f5a944bb) center / 100% 100% no-repeat;
  animation: glint 1.5s ease-in-out 0.45s both;
  pointer-events: none;
}

.tagline {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -0.5em auto 0;
  max-width: 36ch;
  text-wrap: balance;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.05rem, 0.9rem + 1vw, 1.4rem);
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: var(--pearl);
  text-shadow: 0 0 18px rgb(242 193 78 / 0.18);
}

/* Two gold sparks around the tagline (the emblem's spark). They flank the whole text block, so a tagline
   that wraps (a phone, or a larger Chrome text size) stays centred between them on both lines. */
.tagline::before,
.tagline::after {
  content: "";
  flex: none;
  width: 0.62em;
  height: 0.62em;
  margin: 0 0.7em;
  background: var(--gold);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  opacity: 0.9;
}

/* From here the wordmark clears the language switch, so it moves up beside it. */
@media (min-width: 720px) {
  .hero { padding: 14px var(--gutter) 22px; }
  .hero__mark { width: 440px; }
}

/* Three columns: a fixed masthead height (--hero-h), which the cards' art is sized against. */
@media (min-width: 1024px) {
  .hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: var(--hero-h);
    padding: 6px var(--gutter) 14px;
  }
  .hero__mark { width: 344px; }
  .tagline { max-width: none; font-size: 1.3rem; }
}

/* A tall window has room for a bigger masthead. */
@media (min-width: 1024px) and (min-height: 860px) {
  :root { --hero-h: 204px; }
  .hero__mark { width: 520px; }
  .tagline { font-size: 1.6rem; }
}

/* A phone on its side: a smaller wordmark so the first card shows under it. */
@media (max-height: 480px) and (orientation: landscape) and (max-width: 1023.98px) {
  .hero { padding-top: 6px; padding-bottom: 14px; }
  .hero__mark { width: 280px; }
}

/* ---------- Games ---------- */

.games {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  width: min(100% - 2 * var(--gutter), var(--max));
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

@media (min-width: 1024px) {
  .games { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.games > li {
  position: relative;
  z-index: 0;
  display: flex;
  animation: rise 0.7s var(--ease-out) both;
}

.games > li:nth-child(2) { animation-delay: 0.1s; }
.games > li:nth-child(3) { animation-delay: 0.2s; }

.game {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--card)) 0%, var(--card) 46%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
    0 24px 48px -28px color-mix(in srgb, var(--accent) 65%, transparent),
    0 0 56px -18px color-mix(in srgb, var(--accent-2) 30%, transparent);
  transition: transform 0.3s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

/* Rim light: a hairline that runs from the accent at the top to the second colour at the bottom. */
.game::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(165deg, var(--accent), transparent 38%, transparent 62%, var(--accent-2));
  opacity: 0.75;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  transition: opacity 0.4s;
}

/* The card's light spilling on the floor below it. */
.game::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: calc(100% + 2px);
  height: 40px;
  z-index: -1;
  background: radial-gradient(50% 60% at 50% 0%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 100%);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.4s;
}

.game__art {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background:
    radial-gradient(70% 90% at 50% 30%, color-mix(in srgb, var(--accent) 22%, var(--night-1)), var(--night-1));
}

.game__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out);
}

/* The art melts into the card where the logo sits. */
.game__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, color-mix(in srgb, var(--accent) 4%, var(--card)) 0%, rgb(22 26 64 / 0.42) 17%, transparent 40%);
}

@media (min-width: 1024px) {
  .game__art { aspect-ratio: auto; height: var(--art-h); flex: none; }
}

.game__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 0 20px 20px;
}

.game__title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: var(--logo-box);
  margin: calc(var(--logo-box) / -2) 0 0;
  font-size: 1rem;
  pointer-events: none;
}

.game__logo {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 4px 8px rgb(5 8 26 / 0.7)) drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 35%, transparent));
}

.game--middleway .game__logo { height: 82%; }

/* Tetherbeat's logo is live text, as its own title screen draws it. */
.game__wordmark {
  font-family: "Pixelify Title", ui-monospace, "Cascadia Mono", monospace;
  font-weight: 700;
  font-size: calc(var(--logo-box) * 0.6);
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #eaf6ff;
  -webkit-text-stroke: 0.16em rgba(228, 47, 205, 0.85);
  paint-order: stroke fill;
  text-shadow: 0 0 18px rgb(228 47 205 / 0.6), 0 3px 8px rgb(5 8 26 / 0.8);
}

.game__pitch {
  margin: 8px 0 0;
  color: var(--pearl-dim);
  max-width: 62ch;
  text-wrap: pretty;
}

.game__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.game__chips li,
.game__badge {
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.game__chips li {
  padding: 4px 9px;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--pearl-dim);
}

/* Chip 3 sits on the art, top right. */
.game__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 5px 11px 5px 9px;
  border: 1px solid rgb(244 239 230 / 0.16);
  border-radius: 999px;
  background: rgb(5 8 26 / 0.66);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--pearl);
  pointer-events: none;
}

.game__badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.game__badge--web::before {
  background: transparent;
  border: 1.5px solid var(--accent-2);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent-2) 70%, transparent);
}

.game__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
}

.play {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff) 0%, var(--accent) 55%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.4),
    inset 0 -2px 0 color-mix(in srgb, var(--accent-2) 55%, transparent),
    0 10px 26px -10px color-mix(in srgb, var(--accent) 80%, transparent);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.3s, filter 0.3s;
}

.play::before {
  content: "";
  width: 0.62em;
  height: 0.72em;
  background: currentColor;
  clip-path: polygon(8% 0, 100% 50%, 8% 100%);
}

/* The Play link covers the whole card, so a tap anywhere on it plays. */
.play::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: var(--radius);
}

.play:focus-visible { outline-offset: 4px; }

.manual {
  position: relative;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 10px;
  color: var(--pearl-dim);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.manual:hover {
  color: var(--pearl);
  text-decoration-color: var(--accent);
}

/* A portrait tablet (and a phone on its side): the art sits beside the text, so the three cards stack on one
 * screen instead of one card per screen. */
@media (min-width: 640px) and (max-width: 1023.98px) {
  .games { grid-auto-rows: 1fr; }

  .game { flex-direction: row; }

  .game__art {
    flex: 0 0 44%;
    aspect-ratio: auto;
    min-height: 236px;
    border-radius: var(--radius) 0 0 var(--radius);
  }

  .game__art::after {
    background: linear-gradient(270deg, color-mix(in srgb, var(--accent) 6%, var(--card)) 0%, rgb(22 26 64 / 0.5) 16%, transparent 42%);
  }

  .game__body { padding: 18px 22px 18px 6px; }

  .game__title {
    height: 60px;
    margin: 0 0 0 -22px;
  }

  .game__badge { right: auto; left: 12px; }

  .game__actions { padding-top: 14px; }
}

/* Hover and keyboard focus: the card lifts and glows brighter, its art leans in. */
.game:focus-within,
.game:hover {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
    0 28px 60px -26px color-mix(in srgb, var(--accent) 90%, transparent),
    0 0 80px -14px color-mix(in srgb, var(--accent-2) 45%, transparent);
}

.game:focus-within::before,
.game:hover::before { opacity: 1; }

.game:focus-within::after,
.game:hover::after { opacity: 1; }

.game:focus-within { transform: translateY(-4px); }
.game:focus-within .game__art img { transform: scale(1.04); }

@media (hover: hover) {
  .game:hover { transform: translateY(-4px); }
  .game:hover .game__art img { transform: scale(1.04); }
  .game:hover .play { filter: brightness(1.06); }
}

.game:active { transform: translateY(-1px); }

/* ---------- Play anywhere ---------- */

.install {
  display: grid;
  gap: 24px;
  width: min(100% - 2 * var(--gutter), var(--max));
  margin: 56px auto 0;
  padding: 28px 24px;
  border: 1px solid rgb(244 239 230 / 0.1);
  border-radius: 24px;
  background:
    radial-gradient(60% 120% at 0% 0%, rgb(var(--aurora-teal) / 0.08), transparent 70%),
    radial-gradient(60% 120% at 100% 100%, rgb(var(--aurora-violet) / 0.1), transparent 70%),
    rgb(11 16 51 / 0.72);
}

.install__heading {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: 0.03em;
  color: var(--pearl);
}

.install__body {
  margin: 8px 0 0;
  color: var(--pearl-dim);
  max-width: 46ch;
}

.install__steps {
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

/* Each step: a gold numbered coin, a short title, then the detail. */
.install__steps > li {
  position: relative;
  padding-left: 56px;
  counter-increment: step;
}

.install__steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -6px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe49a, var(--gold) 60%, #c8952a);
  box-shadow: 0 0 0 4px rgb(242 193 78 / 0.12), 0 0 18px rgb(242 193 78 / 0.35);
  color: var(--night-1);
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
}

/* A faint gold thread runs from each coin to the next: down the left on a phone, across on a wide screen. */
.install__steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 42px;
  bottom: -16px;
  width: 2px;
  background: linear-gradient(rgb(242 193 78 / 0.5), rgb(242 193 78 / 0.12));
}

.install__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pearl);
}

.install__text {
  margin: 4px 0 0;
  color: var(--pearl-dim);
}

/* Step 2: one row per kind of device. */
.install__ways {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
}

/* A phone: the device name sits above its path. */
.install__ways > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  align-items: baseline;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgb(244 239 230 / 0.05);
}

.install__ways dt {
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 700;
}

.install__ways dd {
  margin: 0;
  color: var(--pearl);
  font-size: 0.92rem;
  line-height: 1.4;
}

@media (min-width: 480px) {
  .install__ways > div { grid-template-columns: 6.4em minmax(0, 1fr); gap: 10px; }
}

@media (min-width: 640px) {
  .install { padding: 32px; }
}

@media (min-width: 900px) {
  .install { padding: 36px 40px; }
  .install__steps { grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr); gap: 36px; }
  .install__steps > li { padding: 58px 0 0; }
  .install__steps > li::before { top: 0; }
  .install__steps > li:not(:last-child)::after {
    left: 52px;
    right: -24px;
    top: 19px;
    bottom: auto;
    width: auto;
    height: 2px;
    background: linear-gradient(90deg, rgb(242 193 78 / 0.5), rgb(242 193 78 / 0.12));
  }
}

/* ---------- Footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 28px;
  width: min(100% - 2 * var(--gutter), var(--max));
  margin: 44px auto 0;
  padding: 20px 0 max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid rgb(244 239 230 / 0.08);
  color: var(--pearl-dim);
  font-size: 0.9rem;
  text-align: center;
}

.foot p { margin: 0; }

.foot ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot a,
.foot__lang a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--pearl-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.foot a:hover { color: var(--pearl); }

.foot__lang a[aria-current="page"] { color: var(--gold); }

/* ---------- 404 ---------- */

.lost__main {
  width: min(100% - 2 * var(--gutter), 880px);
  margin: 0 auto;
  padding-top: 56px;
  text-align: center;
}

.lost__mark {
  display: inline-block;
  width: min(72vw, 320px);
  border-radius: 8px;
}

.lost__mark img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 12px rgb(242 193 78 / 0.3));
}

.lost__panes {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

@media (min-width: 720px) {
  .lost__panes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.lost__pane {
  padding: 28px 24px;
  border: 1px solid rgb(244 239 230 / 0.1);
  border-radius: var(--radius);
  background: rgb(22 26 64 / 0.78);
}

.lost__pane h1,
.lost__pane h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.03em;
}

.lost__pane p {
  margin: 10px 0 0;
  color: var(--pearl-dim);
}

.lost__games {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.lost__games a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--pearl);
  font-weight: 600;
  text-decoration: none;
}

.lost__games a:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.lost__home {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--gold);
  font-weight: 600;
  text-underline-offset: 5px;
}

/* ---------- Motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes glint {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}

@keyframes comet {
  0% { opacity: 0; transform: rotate(158deg) translateX(0); }
  0.6% { opacity: 1; }
  4.5% { opacity: 0; transform: rotate(158deg) translateX(46vw); }
  100% { opacity: 0; transform: rotate(158deg) translateX(46vw); }
}

@keyframes twinkle {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

@keyframes aurora-a {
  from { transform: translate3d(-4%, 0, 0) rotate(-2deg); }
  to { transform: translate3d(5%, 3vh, 0) rotate(2deg); }
}

@keyframes aurora-b {
  from { transform: translate3d(6%, 2vh, 0) skewX(-6deg); }
  to { transform: translate3d(-5%, -1vh, 0) skewX(6deg); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .hero__mark::after,
  .sky__comet { display: none; }
  .game:hover,
  .game:focus-within,
  .game:active,
  .game:hover .game__art img,
  .game:focus-within .game__art img { transform: none; }
}
