:root {
  color-scheme: dark;
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #f7f8ff;
  --muted: #aeb8d2;
  --surface: #11172a;
  --surface-strong: #171f37;
  --line: rgba(191, 205, 255, .16);
  --focus: #a6c4ff;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  background: #070b14;
  color: var(--ink);
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

html {
  scrollbar-color: #47557a #080d19;
  scrollbar-width: thin;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #080d19; }
::-webkit-scrollbar-thumb {
  border: 2px solid #080d19;
  border-radius: 10px;
  background: linear-gradient(#53658f, #344261);
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 14% 0%, rgba(72, 105, 255, .20), transparent 34rem),
    radial-gradient(circle at 88% 100%, rgba(210, 76, 255, .12), transparent 36rem),
    linear-gradient(155deg, #11182c 0%, #080c17 58%, #060911 100%);
}

::selection {
  background: #9eb8ff;
  color: #091022;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(26px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 18px 2px 30px;
}

.hero-copy { max-width: 720px; }

h1 {
  margin: 0;
  font-size: clamp(2.45rem, 5.4vw, 4.9rem);
  line-height: .92;
  letter-spacing: -.04em;
}

.lede {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.16rem);
  line-height: 1.55;
}

.status {
  flex: 0 0 auto;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 15, 28, .72);
  color: #ced7ee;
  font-size: .88rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #67eaa0;
  box-shadow: 0 4px 14px rgba(84, 234, 155, .45);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.game-card {
  --accent: #83a7ff;
  --surface-top: rgba(21, 29, 51, .94);
  position: relative;
  display: grid;
  grid-template-rows: 216px 1fr;
  min-height: 390px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg, var(--surface-top), rgba(11, 16, 30, .98));
  box-shadow: 0 18px 52px rgba(0, 0, 0, .30);
  transform: translateZ(0);
  transition:
    transform 260ms var(--ease-out),
    border-color 180ms ease,
    box-shadow 260ms var(--ease-out);
}

.game-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px rgba(255, 255, 255, .08);
}

.game-card.block { --accent: #ffcf3f; }
.game-card.royal { --accent: #d59bff; }
.game-card.subway { --accent: #ffb85c; }
.game-card.stumble { --accent: #62e4ff; }

.art {
  position: relative;
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  contain: paint;
  /* Scenes size their pieces from the art height so they compose at every breakpoint. */
  container-type: size;
}

.art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.07), transparent 24%),
    linear-gradient(transparent 64%, rgba(5, 9, 20, .28));
}

.card-body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  padding: 22px 24px 24px;
}

.tag {
  margin: 0 0 7px;
  color: color-mix(in srgb, var(--accent) 80%, white);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.card-body h2 {
  margin: 0;
  font-size: clamp(1.62rem, 3vw, 2.2rem);
  line-height: 1.04;
  letter-spacing: -.032em;
}

.card-body p:not(.tag) {
  max-width: 52ch;
  margin: 10px 0 20px;
  color: #b6c0d9;
  line-height: 1.5;
}

.play {
  display: inline-flex;
  width: fit-content;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  align-self: end;
  padding: 10px 15px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .085);
  color: #f8f9ff;
  font-weight: 830;
  transition: background 160ms ease, color 160ms ease;
}

.play-arrow {
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 200ms var(--ease-out);
}

.block-art {
  background:
    radial-gradient(circle at 72% 17%, rgba(96, 213, 255, .23), transparent 25%),
    radial-gradient(circle at 18% 74%, rgba(85, 77, 255, .3), transparent 34%),
    linear-gradient(155deg, #153d9b, #0b1c54 72%, #07143a);
}

.block-frame {
  position: absolute;
  z-index: 1;
  inset: 15px 17px 12px;
  border-radius: 18px;
  border: 1px solid rgba(168, 204, 255, .22);
  background:
    linear-gradient(rgba(164, 197, 255, .13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(164, 197, 255, .13) 1px, transparent 1px),
    linear-gradient(145deg, rgba(54, 101, 208, .34), rgba(4, 17, 57, .42));
  background-size: 34px 34px, 34px 34px, auto;
  box-shadow:
    inset 0 1px rgba(255,255,255,.09),
    inset 0 -18px 35px rgba(1,7,27,.24),
    0 18px 34px rgba(2, 8, 31, .24);
  transform: perspective(500px) rotateX(3deg);
}

.block-art {
  --b: 26.5cqh;
  --g: 1cqh;
}

.block-art span {
  position: absolute;
  z-index: 4;
  width: var(--b);
  height: var(--b);
  border-radius: calc(var(--b) * .22);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .55),
    inset 0 -8px 14px rgba(18, 29, 62, .18),
    0 11px 22px rgba(1, 7, 28, .32);
  transition: translate 320ms var(--ease-out), filter 220ms ease, box-shadow 320ms var(--ease-out);
}

.block-art span::before {
  content: "";
  position: absolute;
  inset: 5px 6px auto;
  height: 18%;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,.54), rgba(255,255,255,.14));
  opacity: .78;
}

.block-art span::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
}

.block-art span:nth-of-type(-n+3) { background: linear-gradient(145deg, #ffe15c, #ffb928 62%, #e59616); }
.block-art span:nth-of-type(n+4) { background: linear-gradient(145deg, #ff7068, #ff443e 60%, #d82b31); }
.block-art span:nth-of-type(1) { left: 16%; top: 30%; }
.block-art span:nth-of-type(2) { left: calc(16% + var(--b) + var(--g)); top: 30%; }
.block-art span:nth-of-type(3) { left: calc(16% + var(--b) + var(--g)); top: calc(30% + var(--b) + var(--g)); }
.block-art span:nth-of-type(4) { right: 19%; top: 17%; }
.block-art span:nth-of-type(5) { right: calc(19% + var(--b) + var(--g)); top: calc(17% + var(--b) + var(--g)); }
.block-art span:nth-of-type(6) { right: 19%; top: calc(17% + var(--b) + var(--g)); }

.block-glint {
  position: absolute;
  z-index: 5;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  border-radius: 3px;
  background: rgba(225, 244, 255, .95);
  box-shadow: 0 0 18px rgba(170, 224, 255, .8);
}
.glint-a { left: 12%; top: 20%; }
.glint-b { right: 12%; bottom: 18%; width: 7px; height: 7px; opacity: .72; }

.royal-art {
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 224, 120, .9), rgba(255, 190, 75, .18) 16%, transparent 29%),
    linear-gradient(160deg, #3926a6 0%, #7046d9 52%, #2a145f 100%);
}

.royal-art::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: -8%;
  right: -8%;
  bottom: -26px;
  height: 92px;
  border-radius: 50% 50% 0 0 / 35% 35% 0 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.17), transparent 42%),
    linear-gradient(#8b5ee0, #47287d);
  box-shadow: inset 0 12px 26px rgba(255,255,255,.08);
}

.royal-palace {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 36px;
  width: 230px;
  height: 112px;
  transform: translateX(-50%);
  opacity: .34;
}

.royal-palace::before {
  content: "";
  position: absolute;
  left: 38px;
  right: 38px;
  bottom: 0;
  height: 62px;
  border-radius: 13px 13px 0 0;
  background: #2f176b;
  box-shadow: inset 0 1px rgba(255,255,255,.22);
}

.royal-palace i {
  position: absolute;
  bottom: 0;
  width: 54px;
  height: 84px;
  border-radius: 26px 26px 5px 5px;
  background: #351970;
}
.royal-palace i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -18px;
  width: 36px;
  height: 36px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 7px 16px 7px 16px;
  background: #4b2793;
}
.royal-palace i:nth-child(1) { left: 3px; }
.royal-palace i:nth-child(2) { left: 50%; height: 104px; transform: translateX(-50%); }
.royal-palace i:nth-child(3) { right: 3px; }

.royal-art { --gem: 32cqh; }

.gem {
  position: absolute;
  z-index: 4;
  width: var(--gem);
  height: var(--gem);
  transform: rotate(45deg);
  border-radius: calc(var(--gem) * .26);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.65),
    inset -8px -10px 18px rgba(19, 17, 75, .18),
    0 16px 26px rgba(26, 10, 70, .28);
  transition: translate 320ms var(--ease-out);
}

.gem::before {
  content: "";
  position: absolute;
  inset: 10% 44% 44% 10%;
  border-radius: 8px 4px 6px 4px;
  background: rgba(255,255,255,.55);
  filter: blur(.2px);
}

.gem::after {
  content: "";
  position: absolute;
  inset: 11%;
  border-radius: calc(var(--gem) * .17);
  border: 1px solid rgba(255,255,255,.2);
}

.g1 { left: 18%; top: 40%; background: linear-gradient(145deg, #75f3ff, #29bde4 65%, #2384cb); }
.g2 { right: 18%; top: 36%; background: linear-gradient(145deg, #ff8aa5, #ff4770 62%, #d72f67); }
.g3 { left: calc(50% - var(--gem) / 2); top: 56%; background: linear-gradient(145deg, #8cf2a7, #47d673 62%, #269e5d); }

.crown-mark {
  position: absolute;
  z-index: 5;
  left: calc(50% - 19cqh);
  top: 15%;
  width: 38cqh;
  height: 30cqh;
  transition: translate 320ms var(--ease-out);
  fill: #ffd64a;
  stroke: #fff3ac;
  stroke-width: 4;
  stroke-linejoin: round;
  filter:
    drop-shadow(0 4px 0 rgba(161, 92, 23, .52))
    drop-shadow(0 10px 16px rgba(46, 18, 86, .3));
}

.subway-art {
  perspective: 400px;
  background:
    radial-gradient(circle at 63% 26%, rgba(255,230,155,.84), transparent 11%),
    linear-gradient(#ffb866 0 38%, #546986 39% 41%, #1c2942 42% 100%);
}

.cityline {
  position: absolute;
  z-index: 1;
  inset: 42px 0 auto;
  height: 82px;
  opacity: .78;
}

.cityline i {
  position: absolute;
  bottom: 0;
  width: 48px;
  background: linear-gradient(180deg, #273b58, #17253f);
  box-shadow: inset 0 1px rgba(255,255,255,.08);
}
.cityline i::after {
  content: "";
  position: absolute;
  inset: 10px 8px;
  background:
    radial-gradient(circle, #ffd37a 0 2px, transparent 2.5px) 0 0 / 16px 19px;
  opacity: .65;
}
.cityline i:nth-child(1) { left: 3%; height: 52px; }
.cityline i:nth-child(2) { left: 15%; height: 76px; width: 56px; }
.cityline i:nth-child(3) { left: 29%; height: 62px; width: 44px; }
.cityline i:nth-child(4) { left: 45%; height: 84px; width: 62px; }
.cityline i:nth-child(5) { right: 27%; height: 58px; width: 50px; }
.cityline i:nth-child(6) { right: 13%; height: 75px; width: 54px; }
.cityline i:nth-child(7) { right: 1%; height: 46px; width: 38px; }

/* The bed starts on the horizon band at every art height; rails converge on it. */
.track-bed {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -8px;
  width: 62%;
  height: calc(60% + 8px);
  transform: translateX(-50%);
  clip-path: polygon(36% 0, 64% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(180deg, rgba(255, 196, 128, .16), transparent 26%),
    linear-gradient(180deg, #25334a, #0c1528);
  box-shadow: inset 0 18px 22px rgba(255,255,255,.04);
}

/* Each sleeper is a full-bed layer whose top edge carries the tie; it travels the bed in
   perspective. Paused by default (the still frame is the stream), running on hover/focus. */
.track-bed i {
  position: absolute;
  inset: 0;
  transform-origin: 50% 0;
  animation: sleeperRun 1.15s cubic-bezier(.55, .06, .92, .52) infinite paused;
  animation-delay: calc(var(--k) * -164ms);
}
.track-bed i::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 0;
  height: max(4px, 3.4cqh);
  border-radius: 999px;
  background: linear-gradient(#6d7a93, #303b52);
  box-shadow: inset 0 1px rgba(255, 255, 255, .1);
}
.track-bed i:nth-child(1) { --k: 0; }
.track-bed i:nth-child(2) { --k: 1; }
.track-bed i:nth-child(3) { --k: 2; }
.track-bed i:nth-child(4) { --k: 3; }
.track-bed i:nth-child(5) { --k: 4; }
.track-bed i:nth-child(6) { --k: 5; }
.track-bed i:nth-child(7) { --k: 6; }

.train-light {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 27%;
  width: 20cqh;
  height: 15.5cqh;
  transform: translateX(-50%);
  border-radius: 9px 9px 4px 4px;
  background: linear-gradient(#25364e, #15263e);
  box-shadow: 0 5px 15px rgba(5,10,24,.3);
}
.train-light::before,
.train-light::after {
  content: "";
  position: absolute;
  bottom: 18%;
  width: 18%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffe79b;
  box-shadow: 0 0 12px rgba(255,224,126,.65);
  transition: box-shadow 260ms ease, background 260ms ease;
}
.train-light::before { left: 18%; }
.train-light::after { right: 18%; }

.track-bed .rail {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, #6f7d93 0%, #c9d3e1 48%, #f3f6fb 100%);
}
.track-bed .r1 { clip-path: polygon(41.4% 0, 43.1% 0, 26% 100%, 19.5% 100%); }
.track-bed .r2 { clip-path: polygon(56.9% 0, 58.6% 0, 80.5% 100%, 74% 100%); }

.runner {
  position: absolute;
  z-index: 5;
  left: calc(50% - 31px);
  bottom: 15px;
  width: 62px;
  height: 78px;
  border-radius: 25px 25px 20px 20px;
  transform-origin: 50% 100%;
  background:
    linear-gradient(90deg, transparent 44%, rgba(255,255,255,.18) 45% 51%, transparent 52%),
    linear-gradient(155deg, #ff6e5c, #e83d3c 68%, #a82839);
  color: transparent;
  box-shadow: inset 0 -10px 16px rgba(60,12,33,.18), 0 16px 26px rgba(0, 0, 0, .3);
  transition: transform 260ms var(--ease-out);
}

.runner::before {
  content: "";
  position: absolute;
  left: 12px;
  top: -20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd3a8, #eda17c);
  box-shadow: inset -5px -5px 8px rgba(114,58,50,.12);
}
.runner::after {
  content: "";
  position: absolute;
  left: 7px;
  top: -22px;
  width: 40px;
  height: 16px;
  border-radius: 18px 18px 7px 7px;
  transform: rotate(-7deg);
  background: linear-gradient(#2c4464, #17283f);
  box-shadow: 7px 7px 0 -3px #66e1dc;
}
.runner i,
.runner b {
  position: absolute;
  bottom: -18px;
  width: 17px;
  height: 28px;
  border-radius: 8px;
  background: #192741;
}
.runner i { left: 7px; transform: rotate(8deg); transform-origin: 50% 0; }
.runner b { right: 7px; transform: rotate(-8deg); transform-origin: 50% 0; }

.stumble-art {
  background:
    radial-gradient(circle at 78% 16%, rgba(255,255,255,.5), transparent 18%),
    linear-gradient(#42d5ff 0 45%, #9cf27f 46% 100%);
}

.cloud {
  position: absolute;
  z-index: 1;
  width: 82px;
  height: 26px;
  border-radius: 30px;
  background: rgba(239, 252, 255, .72);
  box-shadow: 0 8px 20px rgba(41,132,183,.13);
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  bottom: 3px;
  border-radius: 50%;
  background: inherit;
}
.cloud::before { left: 13px; width: 32px; height: 32px; }
.cloud::after { right: 10px; width: 40px; height: 40px; }
.cloud-a { left: 8%; top: 24px; transform: scale(.8); }
.cloud-b { right: 7%; top: 46px; transform: scale(.54); opacity: .62; }

.course-lane {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -18px;
  width: 72%;
  height: 152px;
  transform: translateX(-50%);
  clip-path: polygon(33% 0, 67% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(90deg, transparent 48%, rgba(255,255,255,.16) 49% 51%, transparent 52%),
    linear-gradient(#75d95b, #4bb044);
  box-shadow: inset 0 14px 20px rgba(255,255,255,.1);
}

.platform {
  position: absolute;
  z-index: 4;
  height: 34px;
  border-radius: 14px;
  transform: rotate(-8deg);
  background: linear-gradient(#ff8ac8, #f056a8 62%, #bc3f86);
  box-shadow: 0 10px 18px rgba(104, 26, 82, .28), inset 0 2px rgba(255,255,255,.42);
}
.platform::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  box-shadow: inset 0 2px rgba(255,255,255,.5);
}

.p1 { width: 180px; left: 8%; bottom: 60px; }
.p2 {
  width: 220px;
  right: 5%;
  top: 62px;
  transform: rotate(10deg);
  background: linear-gradient(#ffe174, #ffc942 64%, #dc9824);
  box-shadow: 0 10px 18px rgba(125, 91, 18, .26), inset 0 2px rgba(255,255,255,.46);
}

.bean {
  position: absolute;
  z-index: 5;
  left: 49%;
  bottom: 54px;
  width: 70px;
  height: 88px;
  border-radius: 45% 45% 38% 38%;
  background: linear-gradient(150deg, #847bff 0 22%, #6559f3 58%, #463bcc 100%);
  color: transparent;
  box-shadow: inset -9px -12px 18px rgba(37,26,128,.22), 0 15px 24px rgba(34, 23, 109, .28);
  transform-origin: 50% 100%;
  transition: transform 260ms var(--ease-out);
}

.bean::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 18px;
  width: 40px;
  height: 20px;
  border-radius: 13px;
  background: linear-gradient(145deg, #f4ffff, #b6effb);
  box-shadow: inset 0 -4px 6px rgba(76,160,196,.17), 0 2px 0 rgba(255,255,255,.25);
}

.bean::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 10px;
  width: 18px;
  height: 30px;
  border-radius: 50%;
  transform: rotate(26deg);
  background: linear-gradient(90deg, rgba(255,255,255,.34), transparent);
}

.bean i,
.bean b {
  position: absolute;
  bottom: -15px;
  width: 23px;
  height: 28px;
  border-radius: 13px;
  background: #4a40c8;
}
.bean i { left: 5px; transform: rotate(8deg); transform-origin: 50% 0; }
.bean b { right: 5px; transform: rotate(-8deg); transform-origin: 50% 0; }
.bean em {
  position: absolute;
  left: -13px;
  top: 42px;
  width: 18px;
  height: 38px;
  border-radius: 12px;
  transform: rotate(18deg);
  transform-origin: 50% 8%;
  background: #5d52dd;
  box-shadow: 80px -1px 0 #4f44d1;
}

.footer {
  margin: 22px 2px 0;
  color: #8793ae;
  font-size: .86rem;
  line-height: 1.45;
}

@media (hover: hover) and (pointer: fine) {
  .game-card:hover {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--accent) 38%, transparent);
    box-shadow: 0 26px 62px rgba(0, 0, 0, .36);
  }

  .game-card:hover .play { background: color-mix(in srgb, var(--accent) 18%, rgba(255, 255, 255, .09)); }
  .game-card:hover .play-arrow { transform: translateX(3px) rotate(45deg); }
}

.game-card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-color: transparent;
}

.game-card:focus-visible .play { background: color-mix(in srgb, var(--accent) 18%, rgba(255, 255, 255, .09)); }

.game-card.pressed {
  transform: scale(.985);
  transition-duration: 90ms;
}

@media (max-width: 760px) {
  .shell { padding-inline: max(14px, env(safe-area-inset-left)); }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding-top: 12px;
    padding-bottom: 24px;
  }

  h1 { font-size: clamp(2.6rem, 15vw, 4rem); }
  .lede { margin-top: 14px; font-size: 1rem; }
  .status { min-height: 40px; padding: 8px 12px; }

  .grid { grid-template-columns: 1fr; gap: 16px; }

  .game-card {
    grid-template-rows: 172px 1fr;
    min-height: 0;
    border-radius: 20px;
  }

  .card-body { padding: 18px 18px 20px; }
  .card-body p:not(.tag) { margin-bottom: 18px; }
  .play { min-height: 46px; }
  .footer { margin-top: 18px; padding-bottom: 4px; }
  .runner { scale: .84; }
  .bean { scale: .86; }
}

@media (max-width: 360px) {
  .shell { padding-inline: 12px; }
  .game-card { grid-template-rows: 154px 1fr; }
  .card-body { padding-inline: 16px; }
  .runner { scale: .76; }
  .bean { scale: .78; }
}

/* ---------------------------------------------------------------------------
   Motion pass 3
   Arrival: the title settles, the cards rise as a list and each scene plays its
   signature beat once (gated by the .arrive class, removed by app.js once the
   sequence has finished). Preview: hovering or keyboard-focusing a card lets its
   scene play its own game. Animations use the individual translate/rotate/scale
   properties so they compose with each piece's resting transform.
   --------------------------------------------------------------------------- */

.grid > .game-card:nth-child(1) { --d: 120ms; }
.grid > .game-card:nth-child(2) { --d: 200ms; }
.grid > .game-card:nth-child(3) { --d: 280ms; }
.grid > .game-card:nth-child(4) { --d: 360ms; }

.block-frame { overflow: hidden; }
.block-frame::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(196, 224, 255, .2), transparent);
  transform: skewX(-14deg);
  opacity: 0;
  pointer-events: none;
}

.cloud { transition: translate 1.4s var(--ease-out); }
.platform { transition: rotate 700ms var(--ease-out); }
.track-bed i { animation-play-state: var(--live, paused); }

@media (prefers-reduced-motion: no-preference) {
  .arrive .hero-copy > *,
  .arrive .status { animation: heroIn 680ms var(--ease-out) backwards; }
  .arrive .lede { animation-delay: 70ms; }
  .arrive .status { animation-delay: 140ms; }

  .arrive .game-card { animation: cardIn 620ms var(--ease-out) var(--d) backwards; }

  /* Block Grid: both pieces drop into the grid and settle; the glints answer. */
  .arrive .block-art span { animation: pieceDrop 620ms linear calc(var(--d) + 200ms) backwards; }
  .arrive .block-art span:nth-of-type(n+4) { animation-delay: calc(var(--d) + 290ms); }
  .arrive .block-glint { animation: glintIn 520ms var(--ease-out) calc(var(--d) + 600ms) backwards; }

  /* Royal Garden: the gems pop in a quick chain, then the crown lands. */
  .arrive .gem { animation: gemPop 520ms cubic-bezier(.34, 1.45, .64, 1) calc(var(--d) + 180ms) backwards; }
  .arrive .g3 { animation-delay: calc(var(--d) + 240ms); }
  .arrive .g2 { animation-delay: calc(var(--d) + 300ms); }
  .arrive .crown-mark { animation: crownLand 640ms linear calc(var(--d) + 400ms) backwards; }

  /* Metro Dash: the runner steps up onto the line as the train's lights flicker on. */
  .arrive .runner { animation: runnerIn 560ms var(--ease-out) calc(var(--d) + 200ms) backwards; }
  .arrive .train-light::before,
  .arrive .train-light::after { animation: lightsOn 620ms linear calc(var(--d) + 380ms) backwards; }

  /* Tumble Dash: the bean drops onto the course and squashes; the scenery swings in. */
  .arrive .bean { animation: beanDrop 680ms linear calc(var(--d) + 220ms) backwards; }
  .arrive .cloud { animation: cloudIn 760ms var(--ease-out) calc(var(--d) + 120ms) backwards; }
  .arrive .platform { animation: platformSwing 720ms var(--ease-out) calc(var(--d) + 160ms) backwards; }
}

/* Previews loop only while a card is hovered or keyboard-focused. */
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .game-card:is(:hover, :focus-visible) { --live: running; }

  /* Block Grid: the L-piece is picked up over its slot; a light pass crosses the board. */
  .game-card.block:is(:hover, :focus-visible) .block-art span:nth-of-type(-n+3) {
    translate: 0 -12%;
    filter: brightness(1.07) saturate(1.06);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, .55),
      inset 0 -8px 14px rgba(18, 29, 62, .18),
      0 20px 26px rgba(1, 7, 28, .42);
  }
  .game-card.block:is(:hover, :focus-visible) .block-frame::after { animation: sheen 950ms var(--ease-out) both; }
  .game-card.block:is(:hover, :focus-visible) .block-glint { animation: twinkle 1.5s ease-in-out infinite; }
  .game-card.block:is(:hover, :focus-visible) .glint-b { animation-delay: -.75s; }

  /* Royal Garden: the gems lift apart and gleam; the crown rises into its halo. */
  .game-card.royal:is(:hover, :focus-visible) .g1 { translate: -5% -10%; }
  .game-card.royal:is(:hover, :focus-visible) .g2 { translate: 5% -8%; }
  .game-card.royal:is(:hover, :focus-visible) .g3 { translate: 0 -12%; }
  .game-card.royal:is(:hover, :focus-visible) .crown-mark { translate: 0 -9%; }
  .game-card.royal:is(:hover, :focus-visible) .gem::before { animation: gleam 1.6s ease-in-out infinite; }
  .game-card.royal:is(:hover, :focus-visible) .g2::before { animation-delay: -.55s; }
  .game-card.royal:is(:hover, :focus-visible) .g3::before { animation-delay: -1.1s; }

  /* Metro Dash: the sleepers stream underfoot, the runner strides, the train closes in. */
  .game-card.subway:is(:hover, :focus-visible) .runner { animation: runBob 190ms ease-in-out infinite alternate; }
  .game-card.subway:is(:hover, :focus-visible) .runner i { animation: legSwing 190ms ease-in-out infinite alternate; }
  .game-card.subway:is(:hover, :focus-visible) .runner b { animation: legSwing 190ms ease-in-out infinite alternate-reverse; }
  .game-card.subway:is(:hover, :focus-visible) .train-light::before,
  .game-card.subway:is(:hover, :focus-visible) .train-light::after {
    background: #fff6cf;
    box-shadow: 0 0 16px 3px rgba(255, 230, 140, .85);
  }

  /* Tumble Dash: the bean waddles forward, the clouds drift and the bar tips. */
  .game-card.stumble:is(:hover, :focus-visible) .bean { animation: waddle 760ms linear infinite; }
  .game-card.stumble:is(:hover, :focus-visible) .bean i { animation: legSwing 380ms ease-in-out infinite alternate; }
  .game-card.stumble:is(:hover, :focus-visible) .bean b { animation: legSwing 380ms ease-in-out infinite alternate-reverse; }
  .game-card.stumble:is(:hover, :focus-visible) .bean em { animation: armSwing 380ms ease-in-out infinite alternate; }
  .game-card.stumble:is(:hover, :focus-visible) .cloud-a { translate: 14px 0; }
  .game-card.stumble:is(:hover, :focus-visible) .cloud-b { translate: -12px 0; }
  .game-card.stumble:is(:hover, :focus-visible) .p2 { rotate: -5deg; }
}

@keyframes heroIn {
  from { opacity: 0; translate: 0 14px; filter: blur(6px); }
  to { opacity: 1; translate: 0 0; filter: blur(0); }
}

@keyframes cardIn {
  from { opacity: 0; translate: 0 22px; scale: .97; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}

@keyframes pieceDrop {
  0% { opacity: 0; translate: 0 -160%; animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  52% { opacity: 1; translate: 0 5%; animation-timing-function: cubic-bezier(0, 0, .4, 1); }
  76% { translate: 0 -3%; animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  100% { translate: 0 0; }
}

@keyframes glintIn {
  0% { opacity: 0; scale: 0; }
  60% { scale: 1.45; }
  100% { scale: 1; }
}

@keyframes gemPop {
  from { opacity: 0; scale: .3; }
  to { opacity: 1; scale: 1; }
}

@keyframes crownLand {
  0% { opacity: 0; translate: 0 -55%; rotate: -9deg; animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  50% { opacity: 1; translate: 0 6%; rotate: 3deg; animation-timing-function: cubic-bezier(0, 0, .4, 1); }
  78% { translate: 0 -3%; rotate: -1deg; animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  100% { translate: 0 0; rotate: 0deg; }
}

@keyframes runnerIn {
  from { opacity: 0; translate: 0 28%; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes lightsOn {
  0% { opacity: 0; }
  28% { opacity: .95; }
  38% { opacity: .15; }
  54% { opacity: 1; }
  66% { opacity: .45; }
  100% { opacity: 1; }
}

@keyframes beanDrop {
  0% { opacity: 0; translate: 0 -75%; transform: scale(.94, 1.08); animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  44% { opacity: 1; translate: 0 0; transform: scale(1.16, .82); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  68% { translate: 0 -7%; transform: scale(.96, 1.05); animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  84% { translate: 0 0; transform: scale(1.05, .95); animation-timing-function: ease-out; }
  100% { translate: 0 0; transform: scale(1, 1); }
}

@keyframes cloudIn {
  from { opacity: 0; translate: -36px 0; }
  to { translate: 0 0; }
}

@keyframes platformSwing {
  from { opacity: 0; rotate: -18deg; }
  to { opacity: 1; rotate: 0deg; }
}

@keyframes sleeperRun {
  from { transform: translateY(0) scale(.3, .45); opacity: .4; }
  to { transform: translateY(100%) scale(1.08, 1.5); opacity: 1; }
}

@keyframes sheen {
  0% { opacity: 0; transform: translateX(0) skewX(-14deg); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateX(380%) skewX(-14deg); }
}

@keyframes twinkle {
  0%, 100% { scale: 1; opacity: 1; }
  50% { scale: .55; opacity: .55; }
}

@keyframes gleam {
  0%, 100% { opacity: .55; }
  50% { opacity: .95; }
}

@keyframes runBob {
  from { translate: 0 0; }
  to { translate: 0 -3px; }
}

@keyframes legSwing {
  from { rotate: -15deg; }
  to { rotate: 15deg; }
}

@keyframes armSwing {
  from { rotate: -10deg; }
  to { rotate: 12deg; }
}

@keyframes waddle {
  0%, 50%, 100% { rotate: 0deg; translate: 0 0; }
  25% { rotate: -5deg; translate: 0 -6px; }
  75% { rotate: 5deg; translate: 0 -6px; }
}

@keyframes fadeIn {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .game-card,
  .play,
  .play-arrow,
  .block-art span,
  .gem { transition-duration: 80ms; }
  .game-card:hover { transform: none; }
  .arrive .game-card { animation: fadeIn 240ms ease-out var(--d) backwards; }
}

/* Page continuity: launcher ⇄ game navigations cross-fade (each game page opts in too). */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: pageOut 160ms cubic-bezier(.5, 0, .75, 0) both; }
::view-transition-new(root) { animation: pageIn 340ms var(--ease-out) both; }

@keyframes pageOut { to { opacity: 0; scale: .985; } }
@keyframes pageIn { from { opacity: 0; scale: 1.012; } }

@keyframes pageFade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root) { animation: pageFade 120ms linear reverse both; }
  ::view-transition-new(root) { animation: pageFade 160ms linear both; }
}
