@font-face { font-family: Chango; src: url(/fonts/chango-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Racing Sans One"; src: url(/fonts/racing-sans-one-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Lexend; font-weight: 500; src: url(/fonts/lexend-latin-500-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Lexend; font-weight: 700; src: url(/fonts/lexend-latin-700-normal.woff2) format("woff2"); font-display: swap; }

:root {
  --plum: #4a1338; --pink: #ec4899; --night: #140a33; --gold: #ffc93c;
  --seam: clamp(8px, 1vw, 14px);
  --lean: 6.5deg;
  --bleed: 5.8vh;               /* how far the lean pushes a panel's corners sideways: tan(6.5deg) x half the height, plus a little */
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; background: #fff; color: #fff; font: 500 18px/1.4 Lexend, system-ui, sans-serif; }

header {
  position: fixed; z-index: 2; inset: 0 0 auto; display: flex; justify-content: space-between; align-items: baseline; gap: 24px;
  padding: max(16px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 0 max(22px, env(safe-area-inset-left)); pointer-events: none;
}
h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--plum); pointer-events: auto; paint-order: stroke fill; -webkit-text-stroke: 6px #fff; }
h1 a { color: inherit; text-decoration: none; }
h1 a:focus-visible { outline: 4px solid var(--pink); outline-offset: 4px; border-radius: 6px; }
#hint { margin: 0; font-size: 15px; text-align: right; paint-order: stroke fill; -webkit-text-stroke: 5px var(--night); }
@media (hover: none) { body:not(.pad) #hint { display: none; } }

main { height: 100vh; height: 100dvh; overflow: hidden; }
.games { display: flex; gap: var(--seam); height: 100%; margin: 0 calc(var(--bleed) * -1); padding: 0; list-style: none; }
.game { position: relative; flex: 1 1 0; min-width: 0; min-height: 0; transition: flex-grow .4s cubic-bezier(.2, .9, .25, 1); }
.game.on { flex-grow: 1.22; }
.game a { position: absolute; inset: 0; overflow: hidden; transform: skewX(calc(var(--lean) * -1)); color: inherit; text-decoration: none; outline: 0; }
.game a > img {
  position: absolute; inset: 0 auto auto calc(var(--bleed) * -1); width: calc(100% + var(--bleed) * 2); height: 100%;
  object-fit: cover; transform: skewX(var(--lean)); transition: filter .3s;
}
/* The other worlds step back while one is picked */
.games:has(.on) .game:not(.on) a > img { filter: brightness(.88) saturate(.8); }
.game a::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.game a:focus-visible::after { box-shadow: inset 0 0 0 8px var(--ring); }

.words {
  position: absolute; inset: auto 0 clamp(24px, 7vh, 84px); padding: 0 calc(var(--bleed) + 16px); transform: skewX(var(--lean));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.title { display: block; paint-order: stroke fill; line-height: .95; text-wrap: balance; }
.about { max-width: 27em; margin: 18px 0 20px; text-wrap: balance; }
.play { font-weight: 700; font-size: 24px; line-height: 1; padding: 16px 46px; }
.game a:active .play { transform: translateY(4px); }

/* Each game keeps its own lettering, and the same button it has on its start screen */
.sparkle { --ring: var(--pink); color: var(--plum); }
.sparkle img { object-position: 50% 50%; }
.sparkle a::before { content: ""; position: absolute; z-index: 1; inset: 52% 0 0; background: linear-gradient(transparent, #fbb6dd 85%); }
.sparkle .words { z-index: 1; }
.sparkle .title { font: 400 clamp(30px, 4.1vw, 84px)/.95 Chango, system-ui, sans-serif; color: var(--pink); -webkit-text-stroke: .14em #fff; filter: drop-shadow(0 .06em 0 #f9a8d4); }
.sparkle .play { border-radius: 999px; background: linear-gradient(#f9a8d4, var(--pink)); color: var(--plum); box-shadow: 0 6px 0 #be185d; }
.fightrix { --ring: var(--gold); }
.fightrix img { object-position: 46% 50%; }
.fightrix a::before { content: ""; position: absolute; z-index: 1; inset: 45% 0 0; background: linear-gradient(transparent, rgba(20, 10, 51, .78) 60%); }
.fightrix .words { z-index: 1; }
.fightrix .title { font: 400 clamp(44px, 6.3vw, 124px)/.95 "Racing Sans One", system-ui, sans-serif; color: var(--gold); -webkit-text-stroke: .1em var(--night); }
.fightrix .play { border-radius: 12px; background: #22c55e; color: var(--night); box-shadow: 0 6px 0 #15803d; }
.arch { --ring: #fff; color: #e9f9df; }
.arch a > img { object-position: 50% 50%; }
.arch a::before { content: ""; position: absolute; z-index: 1; inset: 45% 0 0; background: linear-gradient(transparent, rgba(13, 42, 31, .82) 60%); }
.arch .words { z-index: 1; }
.arch .title img { display: block; width: clamp(200px, 25vw, 520px); height: auto; filter: drop-shadow(0 4px 0 rgba(13, 42, 31, .8)); }
.arch .play { border-radius: 14px; background: #ffd24a; color: #2b2204; box-shadow: 0 6px 0 #c98a12; }

/* Picking a game: one squishes, one strikes, and one twangs like a bowstring */
@media (prefers-reduced-motion: no-preference) {
  .sparkle.on .title { animation: squish .6s; }
  .fightrix.on .title { animation: strike .32s cubic-bezier(.2, 1.4, .4, 1); }
  .arch.on .title { animation: twang .5s; }
}
@keyframes squish {
  0%, 100% { transform: none; }
  20% { transform: scale(1.12, .8) translateY(8%); }
  45% { transform: scale(.94, 1.1); }
  70% { transform: scale(1.04, .96); }
}
@keyframes twang {
  0%, 100% { transform: none; }
  22% { transform: translateY(7%) scaleY(.9); }
  42% { transform: translateY(-6%) scaleY(1.06); }
  62% { transform: translateY(3%); }
  82% { transform: translateY(-1.5%); }
}
@keyframes strike {
  0% { transform: translateX(-.7em) skewX(-24deg) scale(1.08); }
  100% { transform: none; }
}

/* Phones held upright: the worlds stack */
@media (max-aspect-ratio: 1/1) {
  :root { --lean: 4deg; --bleed: 4vw; }
  .games { flex-direction: column; margin: calc(var(--bleed) * -1) 0; height: calc(100% + var(--bleed) * 2); }
  .game a { transform: skewY(calc(var(--lean) * -1)); }
  .game a > img { inset: calc(var(--bleed) * -1) auto auto 0; width: 100%; height: calc(100% + var(--bleed) * 2); transform: skewY(var(--lean)); }
  .words { transform: skewY(var(--lean)); padding: 0 24px; bottom: calc(var(--bleed) + 1.6vh); }
  .sparkle .title { font-size: clamp(28px, 8.6vw, 76px); }
  .fightrix .title { font-size: clamp(38px, 12vw, 104px); }
  .arch .title img { width: clamp(190px, 46vw, 440px); }
  .about { font-size: 16px; margin: 8px 0 12px; }
  .play { font-size: 18px; padding: 10px 34px; }
  #hint { color: var(--plum); -webkit-text-stroke-color: #fff; }
}
@media (max-aspect-ratio: 1/1) and (max-height: 900px) { .about { display: none; } .title { margin-bottom: 10px; } }
/* Phones held sideways */
@media (max-height: 480px) {
  h1 { font-size: 18px; }
  #hint, .about { display: none; }
  .title { margin-bottom: 14px; }
  .sparkle .title { font-size: clamp(26px, 4vw, 52px); }
  .fightrix .title { font-size: clamp(36px, 5.8vw, 72px); }
  .arch .title img { width: clamp(160px, 22vw, 300px); }
  .play { font-size: 18px; padding: 11px 32px; }
}
@media (prefers-reduced-motion: reduce) { .game, .game img { transition: none; } }
