:root {
  --ink: #f6f1ff;
  --dim: #a89fc4;
  --night: #0b0716;
  --r: 28px;
  --ease: cubic-bezier(.2, .9, .25, 1.15);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100svh;
  background: var(--night);
  color: var(--ink);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; letter-spacing: .02em; }

/* ---------- background layers ---------- */
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.aurora { position: fixed; inset: -20%; z-index: 0; filter: blur(70px) saturate(140%); opacity: .55; pointer-events: none; }
.aurora i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; mix-blend-mode: screen; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: radial-gradient(circle, #7b2ff7 0, transparent 60%); left: -10%; top: -10%; }
.aurora i:nth-child(2) { background: radial-gradient(circle, #ff3d81 0, transparent 60%); right: -15%; top: 20%; animation-duration: 28s; animation-delay: -8s; }
.aurora i:nth-child(3) { background: radial-gradient(circle, #00d4c8 0, transparent 60%); left: 10%; bottom: -25%; animation-duration: 32s; animation-delay: -14s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12vw, 8vh) scale(1.2); }
  100% { transform: translate(-8vw, 14vh) scale(.9); }
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .08; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
header, main, footer, .marquee { position: relative; z-index: 2; }

/* ---------- hero ---------- */
.hero {
  min-height: 92svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: max(env(safe-area-inset-top), 32px) 22px 72px;
}
.kicker { font-size: 13px; color: var(--dim); display: flex; align-items: center; gap: 10px; opacity: 0; animation: up .8s .1s var(--ease) forwards; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #3dffa2; box-shadow: 0 0 0 0 #3dffa288; animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px #3dffa200; } 100% { box-shadow: 0 0 0 0 #3dffa200; } }

.title {
  font-size: clamp(88px, 30vw, 300px);
  font-weight: 800; line-height: .82; letter-spacing: -.06em;
  margin: 18px 0 22px -0.04em;
  display: flex;
}
.title span {
  display: inline-block;
  background: linear-gradient(120deg, #fff 10%, #ffd166 35%, #ff3d81 60%, #7b2ff7 85%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: drop .9s var(--ease) both, shimmer 8s linear infinite;
  transform-origin: 50% 100%;
}
.title span:nth-child(1) { animation-delay: .15s, 0s; }
.title span:nth-child(2) { animation-delay: .25s, -.4s; }
.title span:nth-child(3) { animation-delay: .35s, -.8s; }
.title span:nth-child(4) { animation-delay: .45s, -1.2s; }
.title .bang { animation: drop .9s .65s var(--ease) both, shimmer 8s -1.6s linear infinite, wobble 3.2s 1.8s ease-in-out infinite; }
.title span.boing { animation: boing .7s var(--ease), shimmer 8s linear infinite; }
@keyframes drop { 0% { transform: translateY(-120%) scaleY(1.3); opacity: 0; } 60% { transform: translateY(6%) scaleY(.85); opacity: 1; } 100% { transform: none; } }
@keyframes shimmer { to { background-position: -300% 0; } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 10% { transform: rotate(14deg); } 20% { transform: rotate(-10deg); } 30% { transform: rotate(5deg); } 40% { transform: rotate(0); } }
@keyframes boing { 0% { transform: none; } 30% { transform: translateY(-18%) scale(1.1, .9); } 60% { transform: translateY(3%) scale(.95, 1.08); } 100% { transform: none; } }

.lead { font-size: clamp(19px, 5vw, 26px); line-height: 1.35; max-width: 30ch; color: #e3dcf7; opacity: 0; animation: up .9s .8s var(--ease) forwards; }
@keyframes up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.scroll-cue { position: absolute; bottom: 22px; left: 50%; translate: -50% 0; width: 30px; height: 48px; border: 2px solid #ffffff55; border-radius: 20px; opacity: 0; animation: up .8s 1.3s forwards; }
.scroll-cue span { position: absolute; left: 50%; top: 9px; width: 4px; height: 9px; margin-left: -2px; border-radius: 2px; background: #fff; animation: wheel 1.8s infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(16px); } }

/* ---------- marquee ---------- */
.marquee { overflow: hidden; border-block: 1px solid #ffffff1f; background: #ffffff08; backdrop-filter: blur(6px); transform: rotate(-2deg) scale(1.05); margin: 0 0 40px; }
.track { display: flex; gap: 18px; white-space: nowrap; padding: 14px 0; width: max-content; font-size: 14px; color: #ffd166; animation: marquee 26s linear infinite; }
.track span { color: var(--ink); text-transform: uppercase; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- cards ---------- */
.games { display: grid; gap: 22px; padding: 10px 16px 40px; max-width: 1240px; margin: 0 auto; perspective: 1200px; }
.card {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative; display: flex; flex-direction: column;
  border-radius: var(--r); overflow: hidden; isolation: isolate;
  color: inherit; text-decoration: none;
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--a) 35%, transparent), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, color-mix(in srgb, var(--b) 18%, transparent), transparent 60%),
    var(--bg);
  border: 1px solid color-mix(in srgb, var(--a) 30%, #ffffff10);
  box-shadow: 0 20px 50px -20px color-mix(in srgb, var(--a) 60%, transparent);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform .5s var(--ease), box-shadow .4s;
  opacity: 0; translate: 0 60px; scale: .94;
}
.card.in { opacity: 1; translate: 0 0; scale: 1; transition: transform .5s var(--ease), box-shadow .4s, opacity .8s, translate .9s var(--ease), scale .9s var(--ease); }
.card.tilting { transition: transform .08s linear, box-shadow .4s; }
.card::before { /* animated rim light */
  content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: inherit; padding: 2px;
  background: conic-gradient(from var(--spin, 0deg), transparent 0 70%, var(--a) 80%, var(--b) 88%, transparent 95%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 5s linear infinite; opacity: .9;
}
@property --spin { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --spin: 360deg; } }
.shine { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(400px circle at var(--mx) var(--my), #ffffff2a, transparent 45%); opacity: 0; transition: opacity .3s; }
.card:hover .shine, .card.tilting .shine { opacity: 1; }
.card:active { scale: .97; transition: scale .15s; }

.body { position: relative; z-index: 2; padding: 24px 22px 24px; transform: translateZ(40px); }
.icon { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 24px -6px #000a; margin-bottom: 16px; animation: bob 4s ease-in-out infinite; }
.card:nth-child(2n) .icon { animation-delay: -2s; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }
.tag { font-size: 12px; color: var(--a); text-transform: uppercase; margin-bottom: 6px; }
.card h2 { font-size: clamp(36px, 10vw, 52px); font-weight: 800; letter-spacing: -.03em; line-height: 1; margin-bottom: 12px; }
.card p:not(.tag) { color: #ddd6ef; line-height: 1.5; font-size: 16.5px; max-width: 46ch; }
.play {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 22px;
  padding: 13px 22px; border-radius: 99px; font-weight: 700; font-size: 17px;
  color: #120c1f; background: linear-gradient(100deg, var(--a), var(--b));
  box-shadow: 0 8px 26px -8px var(--a);
  transition: gap .3s var(--ease), transform .3s var(--ease);
}
.play::after { content: "→"; transition: transform .3s var(--ease); }
.card:hover .play { gap: 16px; }
.card:hover .play::after { transform: translateX(3px); }

/* media / per-game ornaments */
.poster { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.15); transition: transform 1.2s var(--ease); }
.card.in .poster img { transform: scale(1.02); }
.card:hover .poster img { transform: scale(1.08); }
.poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, var(--bg)); }

.steam { position: absolute; right: 24px; top: 0; width: 120px; height: 100%; pointer-events: none; z-index: 1; }
.steam i { position: absolute; bottom: 30%; left: 50%; width: 46px; height: 46px; border-radius: 50%; background: #ffffff30; filter: blur(8px); animation: steam 4s ease-in infinite; }
.steam i:nth-child(2) { animation-delay: -1.3s; left: 30%; }
.steam i:nth-child(3) { animation-delay: -2.6s; left: 65%; }
@keyframes steam { 0% { transform: translateY(0) scale(.4); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-260px) scale(2.2); opacity: 0; } }

.flakes, .crumbs, .board { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.flakes {
  background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(3px 3px at 80px 120px, #fffc, transparent), radial-gradient(2px 2px at 150px 60px, #fff9, transparent), radial-gradient(3px 3px at 200px 170px, #fff, transparent);
  background-size: 240px 220px; animation: snow 9s linear infinite; opacity: .7;
}
@keyframes snow { to { background-position: 40px 220px, -30px 220px, 20px 220px, -20px 220px; } }
.crumbs {
  background-image: radial-gradient(3px 3px at 30px 40px, #ff5d6c, transparent), radial-gradient(3px 3px at 110px 90px, #fff, transparent), radial-gradient(3px 3px at 170px 30px, #3dffa2, transparent), radial-gradient(3px 3px at 60px 160px, #ffd166, transparent);
  background-size: 220px 200px; animation: snow 12s linear infinite; opacity: .55;
}
.board {
  background: conic-gradient(#ffffff0d 25%, transparent 0 50%, #ffffff0d 0 75%, transparent 0) 0 0 / 56px 56px;
  -webkit-mask: radial-gradient(circle at 90% 10%, #000, transparent 70%); mask: radial-gradient(circle at 90% 10%, #000, transparent 70%);
  animation: slide 14s linear infinite;
}
@keyframes slide { to { background-position: 112px 56px; } }

/* ---------- footer ---------- */
.foot { text-align: center; padding: 30px 22px calc(40px + env(safe-area-inset-bottom)); color: var(--dim); font-size: 13px; line-height: 1.7; }
.foot .dim { opacity: .55; }

/* ---------- confetti from taps ---------- */
.spark { position: fixed; z-index: 50; width: 8px; height: 8px; border-radius: 2px; pointer-events: none; }

/* ---------- larger screens ---------- */
@media (min-width: 720px) {
  .hero { padding-inline: 6vw; }
  .games { grid-template-columns: repeat(2, 1fr); padding-inline: 4vw; gap: 28px; }
  .card:first-child { grid-column: 1 / -1; flex-direction: row; }
  .card:first-child .poster { flex: 1.3; aspect-ratio: auto; min-height: 380px; }
  .card:first-child .poster::after { background: linear-gradient(90deg, transparent 50%, var(--bg)); }
  .card:first-child .body { flex: 1; align-self: center; padding: 36px; }
  .body { padding: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .card { opacity: 1; translate: none; scale: none; }
}
