/* =============================================================
   ARCADE — game select screen
   One screen. The chosen game's key art fills it; its accent
   colour runs through the title wipe, the Play button and the
   selected tile. Each game sets --acc on body[data-game].
   ============================================================= */

:root {
  --bg: #0A0B08;
  --bg-2: #14150F;
  --ink: #F2F0EA;
  --dim: rgba(242, 240, 234, 0.72);
  --faint: rgba(242, 240, 234, 0.16);
  --line: rgba(242, 240, 234, 0.22);

  --display: 'Archivo', 'Arial Black', system-ui, sans-serif;
  --body: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --gut: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --snap: cubic-bezier(0.7, 0, 0.2, 1);

  --acc: #C9E82A;
  --acc-ink: #11120C;
  --acc-glow: rgba(201, 232, 42, 0.35);
}
body[data-game="turbo"] {
  --acc: #FF4B2B;
  --acc-ink: #160806;
  --acc-glow: rgba(255, 75, 43, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: dark; }
body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }

kbd {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 26px; padding: 0 7px;
  font: 700 11px/1 var(--mono);
  color: var(--ink);
  background: rgba(242, 240, 234, 0.08);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 5px;
}

.skip {
  position: fixed; left: var(--gut); top: 12px; z-index: 50;
  padding: 10px 14px; border-radius: 6px;
  background: var(--acc); color: var(--acc-ink); font-weight: 700;
  transform: translateY(-160%);
}
.skip:focus-visible { transform: none; }

/* ================= top bar ================= */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  height: 68px; padding: 0 var(--gut);
  background: linear-gradient(to bottom, rgba(10, 11, 8, 0.82), rgba(10, 11, 8, 0));
}
.mark { display: flex; align-items: center; gap: 12px; margin-right: auto; min-height: 44px; }
.mark__sg {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 7px;
  background: var(--acc); color: var(--acc-ink);
  font: 900 14px/1 var(--display); font-stretch: 110%;
  transition: background-color 0.4s var(--ease), transform 0.2s var(--ease);
}
.mark:hover .mark__sg { transform: translateY(-2px) rotate(-4deg); }
.mark__word {
  font: 800 15px/1 var(--display); font-stretch: 125%;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.bar__nav { display: flex; gap: 6px; }
.bar__nav a {
  position: relative; display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 12px;
  font-size: 15px; font-weight: 500; color: var(--dim);
  transition: color 0.2s;
}
.bar__nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 9px; height: 2px;
  background: var(--acc); transform: scaleX(0); transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.bar__nav a:hover { color: var(--ink); }
.bar__nav a:hover::after { transform: scaleX(1); }

.bar__snd {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--line);
  transition: background-color 0.2s, transform 0.12s;
}
.bar__snd:hover { background: rgba(242, 240, 234, 0.08); }
.bar__snd:active { transform: scale(0.94); }
.bar__snd svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bar__snd .snd-body { fill: var(--ink); }
.bar__snd .snd-off { display: none; }
.bar__snd[aria-pressed="false"] .snd-on { display: none; }
.bar__snd[aria-pressed="false"] .snd-off { display: inline; }
.bar__snd[aria-pressed="false"] svg { opacity: 0.6; }

/* ================= stage ================= */
.stage {
  position: relative;
  min-height: 100svh;
  min-height: max(100svh, 640px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px;
  padding: 120px var(--gut) clamp(32px, 6vh, 64px);
  isolation: isolate;
  overflow: hidden;
}

.art { position: absolute; inset: 0; z-index: -2; overflow: hidden; background: var(--bg); }
.art__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 60% 40%;
  opacity: 0; transform: scale(1.08);
  transition: opacity 0.7s var(--ease), transform 9s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.art__img.is-on { opacity: 1; transform: scale(1); }

.scrim {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10, 11, 8, 0.92) 0%, rgba(10, 11, 8, 0.62) 34%, rgba(10, 11, 8, 0) 62%),
    linear-gradient(0deg, rgba(10, 11, 8, 0.96) 0%, rgba(10, 11, 8, 0.4) 30%, rgba(10, 11, 8, 0) 52%);
}

/* ================= info ================= */
.info { max-width: 640px; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.meta__n { font: 500 13px/1 var(--mono); color: var(--dim); margin-right: 6px; }
.meta__n b { color: var(--acc); font-weight: 700; font-size: 15px; transition: color 0.4s; }
.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px;
  border-radius: 99px;
  font-size: 13px; font-weight: 600;
  background: var(--acc); color: var(--acc-ink);
  transition: background-color 0.4s var(--ease), color 0.4s;
}
.chip--ghost { background: rgba(242, 240, 234, 0.1); color: var(--ink); border: 1px solid var(--line); }

/* the title and its wipe: a block of the game's colour sweeps across
   and the new name is swapped in under it */
.title {
  position: relative; display: inline-block;
  font: 900 clamp(64px, 9.4vw, 156px)/0.86 var(--display);
  font-stretch: 125%;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  margin-left: -0.04em;
  text-shadow: 0 6px 40px rgba(0, 0, 0, 0.45);
}
.title__txt { display: inline-block; }
.title::after {
  content: ""; position: absolute; inset: -0.04em -0.06em;
  background: var(--acc);
  transform: scaleX(0); transform-origin: left;
  pointer-events: none;
}
.title.wipe::after { animation: wipe 0.46s var(--snap) both; }
@keyframes wipe {
  0%   { transform: scaleX(0); transform-origin: left; }
  45%  { transform: scaleX(1); transform-origin: left; }
  55%  { transform: scaleX(1); transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}

.pitch {
  max-width: 34ch; margin-top: 22px;
  font-size: clamp(17px, 1.35vw, 20px); line-height: 1.45;
  color: var(--dim);
}

.go { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 32px; }

.play {
  position: relative;
  display: inline-flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 22px 0 26px;
  background: var(--acc); color: var(--acc-ink);
  font: 800 18px/1 var(--display); font-stretch: 112%;
  text-transform: uppercase; letter-spacing: 0.04em;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  box-shadow: 0 0 0 0 var(--acc-glow);
  transition: transform 0.14s var(--ease), filter 0.2s, background-color 0.4s var(--ease);
}
.play svg { width: 22px; height: 22px; fill: currentColor; transition: transform 0.25s var(--ease); }
.play:hover { transform: translateY(-2px); filter: brightness(1.08); }
.play:hover svg { transform: translateX(3px); }
.play:active { transform: translateY(1px) scale(0.985); filter: brightness(0.95); }
.play__key {
  margin-left: 6px; color: var(--acc-ink);
  background: rgba(0, 0, 0, 0.12); border-color: rgba(0, 0, 0, 0.25);
}
.play::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
}
.play:hover::before { transform: translateX(120%); transition: transform 0.6s var(--ease); }

.best { font-size: 15px; color: var(--dim); }
.best b { color: var(--ink); font: 700 17px/1 var(--mono); }

.keys { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 30px; }
.keys li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--dim); }
.caps { display: inline-flex; gap: 4px; }
.caps .wide { min-width: 58px; }

.warn {
  margin-top: 22px; max-width: 40ch;
  padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--acc); color: var(--ink);
  background: rgba(10, 11, 8, 0.6); font-size: 15px;
}

/* fields under the title slide while the name wipes */
.meta, .pitch, .go, .keys { transition: opacity 0.2s, transform 0.2s var(--ease); }
.swapping .meta, .swapping .pitch, .swapping .go, .swapping .keys { opacity: 0; transform: translateY(8px); }

/* ================= shelf ================= */
.shelf { display: grid; justify-items: end; gap: 14px; }
.shelf__hint { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.shelf__hint kbd { min-width: 24px; height: 24px; }
.shelf__hint kbd + kbd { margin-left: -2px; }
.shelf__row { display: flex; gap: 14px; }

.tile {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: baseline;
  width: clamp(210px, 15vw, 240px);
  padding: 6px 6px 12px; gap: 2px 10px;
  border-radius: 12px; text-align: left;
  background: rgba(10, 11, 8, 0.55);
  border: 1px solid var(--faint);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform 0.22s var(--ease), border-color 0.3s, background-color 0.3s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--line); }
.tile:active { transform: translateY(0) scale(0.98); }
.tile__pic {
  grid-column: 1 / -1; display: block; overflow: hidden;
  aspect-ratio: 16 / 9; border-radius: 8px; margin-bottom: 8px;
  background: var(--bg-2);
}
.tile__pic img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(0.5) brightness(0.7);
  transition: transform 0.5s var(--ease), filter 0.3s;
}
.tile:hover .tile__pic img { transform: scale(1.03); filter: saturate(0.8) brightness(0.85); }
.tile__name { white-space: nowrap; padding-left: 6px; font: 800 15px/1.2 var(--display); font-stretch: 110%; text-transform: uppercase; letter-spacing: 0.02em; }
.tile__sub { padding-right: 6px; font-size: 13px; color: var(--dim); }

.tile.is-on {
  border-color: var(--acc);
  background: rgba(10, 11, 8, 0.72);
  box-shadow: 0 0 0 1px var(--acc), 0 18px 50px -18px var(--acc-glow);
}
.tile.is-on .tile__pic img { filter: none; }
.tile.is-on::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 3px;
  background: var(--acc); border-radius: 3px 3px 0 0;
  animation: bar-in 0.35s var(--ease) both;
}
@keyframes bar-in { from { transform: scaleX(0); } }

/* ================= load and launch ================= */
.is-loading .art__img.is-on { opacity: 0; transform: scale(1.12); }
.is-loading .title__txt { clip-path: inset(0 100% 0 0); }
.is-loading .meta, .is-loading .pitch, .is-loading .go, .is-loading .keys { opacity: 0; transform: translateY(14px); }
.is-loading .shelf { opacity: 0; transform: translateY(24px); }
.is-loading .bar { opacity: 0; }

.title__txt { transition: clip-path 0.7s var(--snap) 0.15s; clip-path: inset(0 0 0 0); }
.meta  { transition-delay: 0.1s; }
.pitch { transition-delay: 0.3s; }
.go    { transition-delay: 0.4s; }
.keys  { transition-delay: 0.5s; }
body:not(.is-loading):not(.swapping) .meta,
body:not(.is-loading):not(.swapping) .pitch,
body:not(.is-loading):not(.swapping) .go,
body:not(.is-loading):not(.swapping) .keys { transition-duration: 0.5s; }
.swapping .meta, .swapping .pitch, .swapping .go, .swapping .keys { transition-delay: 0s; }
.shelf { transition: opacity 0.6s var(--ease) 0.45s, transform 0.6s var(--ease) 0.45s; }
.bar { transition: opacity 0.6s var(--ease); }
.is-loading .art__img { transition-duration: 0s; }

.launching .art__img.is-on { transform: scale(1.06); filter: brightness(1.3); transition: transform 0.3s var(--ease), filter 0.3s; }
.launching .info, .launching .shelf { opacity: 0; transform: translateY(-10px); transition: opacity 0.22s, transform 0.22s; }

/* ================= tablet and phone ================= */
@media (max-width: 1080px) {
  .stage { grid-template-columns: 1fr; align-content: end; gap: 36px; padding-top: 108px; }
  .shelf { justify-items: start; }
  .scrim {
    background:
      linear-gradient(90deg, rgba(10, 11, 8, 0.85) 0%, rgba(10, 11, 8, 0.3) 60%, rgba(10, 11, 8, 0) 100%),
      linear-gradient(0deg, rgba(10, 11, 8, 0.98) 0%, rgba(10, 11, 8, 0.7) 45%, rgba(10, 11, 8, 0) 75%);
  }
}

@media (max-width: 720px) {
  .bar { gap: 8px; height: 60px; }
  .bar__nav a { padding: 0 8px; font-size: 14px; }
  .bar__nav a:nth-child(2) { display: none; }
  .mark__word { display: none; }

  .stage {
    min-height: 100svh;
    padding: 0 var(--gut) 28px;
    align-content: end;
  }
  .art { bottom: auto; height: 50svh; }
  .art__img { object-position: 50% 40%; }
  .scrim {
    bottom: auto; height: 50svh;
    background: linear-gradient(0deg, var(--bg) 0%, rgba(10, 11, 8, 0.4) 40%, rgba(10, 11, 8, 0.15) 100%);
  }
  .stage::before { content: ""; height: calc(50svh - 200px); }
  .title { font-size: clamp(52px, 15vw, 84px); }
  .pitch { margin-top: 16px; font-size: 17px; }
  .go { margin-top: 24px; }
  .play { width: 100%; justify-content: center; }
  .play__key { display: none; }
  .keys { margin-top: 22px; gap: 10px 18px; }
  .shelf { justify-items: stretch; }
  .shelf__hint { display: none; }
  .shelf__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { width: auto; }
  .tile__sub { display: none; }
}

@media (pointer: coarse) {
  .keys { display: none; }
  .play__key, .shelf__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .art__img, .art__img.is-on { transform: none; }
}
