@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Lilita One";
  src: url("fonts/lilita-one.woff2") format("woff2");
  font-display: swap;
}

:root {
  --sky-top: #4fc3f7;
  --sky-mid: #8fdcfa;
  --sky-bottom: #d9f6fd;
  --ink: #0b2a17;
  --text: #17331f;
  --muted: #45604d;
  --card: #ffffff;
  --gold: #fbbf24;
  --grass: #3fbf5c;
  --grass-dark: #1f8a3f;
  --link: #127a3a;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sy: 0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 500 17px/1.6 "Fredoka", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--text);
  background: var(--sky-bottom);
  overflow-x: hidden;
}
a { color: var(--link); font-weight: 600; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; width: 100%; }
.fun { font-family: "Lilita One", "Fredoka", sans-serif; font-weight: 400; letter-spacing: 0.5px; }

/* ---------- Sky (fixed background) ---------- */
.sky {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-mid) 45%, var(--sky-bottom));
}
.sun {
  position: absolute; top: -140px; right: -120px; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, #fffbe6 0 22%, rgba(255, 244, 179, 0.75) 32%, rgba(255, 244, 179, 0) 68%);
  transform: translateY(calc(var(--sy) * 0.08px));
}
.sun::before {
  content: ""; position: absolute; inset: -40%; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.22) 0 8deg, rgba(255, 255, 255, 0) 8deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 62%);
  mask: radial-gradient(circle, #000 20%, transparent 62%);
  animation: spin 80s linear infinite;
}
.cloud-lane { position: absolute; left: 0; right: 0; transform: translateY(calc(var(--sy) * var(--p, 0.1) * -1px)); }
.cloud {
  position: absolute; left: 0; width: 180px; height: 56px; border-radius: 60px;
  background: #fff; opacity: 0.92;
  box-shadow: inset 0 -8px 0 rgba(160, 205, 230, 0.35);
  animation: drift var(--dur, 90s) linear infinite;
  animation-delay: var(--delay, 0s);
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: #fff; border-radius: 50%;
}
.cloud::before { width: 84px; height: 84px; left: 26px; top: -42px; }
.cloud::after { width: 62px; height: 62px; left: 92px; top: -28px; }
.bubble {
  position: absolute; bottom: -40px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.15) 60%, rgba(255, 255, 255, 0) 70%);
  animation: rise var(--dur, 18s) linear infinite; animation-delay: var(--delay, 0s);
}

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  transition: background 0.3s, box-shadow 0.3s, backdrop-filter 0.3s;
}
.top.scrolled { background: rgba(255, 255, 255, 0.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 4px 18px rgba(11, 42, 23, 0.1); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Lilita One", "Fredoka", sans-serif; font-weight: 400; font-size: 22px; color: var(--ink); text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 11px; box-shadow: 0 3px 0 rgba(11, 42, 23, 0.25); transition: transform 0.4s var(--spring); }
.brand:hover img { transform: rotate(-10deg) scale(1.12); }
.top nav { display: flex; align-items: center; gap: 6px; }
.top nav a { color: var(--ink); text-decoration: none; padding: 6px 12px; border-radius: 999px; transition: background 0.2s, transform 0.2s var(--spring); }
.top nav a:hover { background: rgba(255, 255, 255, 0.7); transform: translateY(-2px); }
.counter {
  display: inline-flex; align-items: center; gap: 6px; margin-right: 6px;
  background: var(--ink); color: #fde047; border-radius: 999px; padding: 4px 12px 4px 6px;
  font-family: "Lilita One", "Fredoka", sans-serif; font-size: 18px; min-width: 70px;
}
.counter .coin { width: 26px; height: 27px; background-size: 130px 27px; }
.counter.bump { animation: bump 0.4s var(--spring); }

/* ---------- Coins (sprite strip of 5 spin frames) ---------- */
.coin {
  display: inline-block; width: 64px; height: 66px;
  background: url("images/coin-spin.png") 0 0 / 320px 66px no-repeat;
  animation: coinspin 0.7s steps(5) infinite;
}

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 24px; align-items: center; padding: 20px 0 40px; }
.title {
  font-family: "Lilita One", "Fredoka", sans-serif; font-weight: 400;
  font-size: clamp(60px, 10vw, 112px); line-height: 0.92; margin: 0 0 18px;
  color: #f4fff6; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink);
}
.title .row { display: block; white-space: nowrap; }
.title .row.gold { color: var(--gold); }
.title .l { display: inline-block; animation: dropin 0.8s var(--spring) both, wave 4s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms), calc(1.2s + var(--i) * 120ms); }
.tagline { font-size: 20px; color: var(--ink); max-width: 32ch; margin: 0 0 26px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.store-btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; text-decoration: none; border: 0; cursor: pointer; font: inherit;
  padding: 14px 24px; border-radius: 18px; font-weight: 700; text-align: left;
  box-shadow: 0 6px 0 #000; transition: transform 0.25s var(--spring), box-shadow 0.2s;
}
.store-btn small { display: block; font-weight: 600; opacity: 0.75; font-size: 12px; }
.store-btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 60px; left: -80px;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: shine 3.2s ease-in-out infinite;
}
.store-btn:hover { transform: translateY(-3px) scale(1.03); }
.store-btn:active { transform: translateY(4px) scale(0.97); box-shadow: 0 2px 0 #000; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.facts li {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.8); border-radius: 999px; padding: 6px 14px 6px 8px;
  font-size: 15px; font-weight: 700; color: var(--ink); box-shadow: 0 3px 0 rgba(11, 42, 23, 0.12);
  animation: popin 0.6s var(--spring) both; animation-delay: calc(0.9s + var(--i) * 0.12s);
}
.facts svg { width: 22px; height: 22px; }

.stage { position: relative; height: 500px; }
.stage .platform { position: absolute; left: 50%; bottom: 40px; width: 330px; transform: translateX(-50%); }
.stage .shadow {
  position: absolute; left: 50%; bottom: 104px; width: 150px; height: 18px; margin-left: -75px; border-radius: 50%;
  background: rgba(11, 42, 23, 0.28); animation: shadow 1.1s infinite;
}
.mascot {
  position: absolute; left: 50%; bottom: 100px; width: 240px; margin-left: -120px;
  background: none; border: 0; padding: 0; cursor: pointer; transform-origin: 50% 100%;
  animation: bounce 1.1s infinite; -webkit-tap-highlight-color: transparent;
}
.mascot img { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 10px rgba(11, 42, 23, 0.2)); pointer-events: none; }
.mascot.super { animation: superjump 1s cubic-bezier(0.3, 0, 0.4, 1); }
.stage .coin { position: absolute; animation: coinspin 0.7s steps(5) infinite, float 3.2s ease-in-out infinite; }
.stage .c1 { left: 6%; top: 14%; }
.stage .c2 { right: 4%; top: 30%; animation-delay: 0s, -1.1s; transform: scale(0.8); }
.stage .c3 { left: 18%; top: 52%; animation-delay: 0s, -2s; }
.hint {
  position: absolute; right: 6%; top: 4%; background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 16px;
  font-family: "Lilita One", "Fredoka", sans-serif; font-size: 18px; box-shadow: 0 4px 0 rgba(11, 42, 23, 0.15);
  animation: popin 0.6s var(--spring) 1.6s both, nudge 2.4s ease-in-out 2.4s infinite;
}
.hint::after { content: ""; position: absolute; left: 22px; bottom: -9px; border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; }

/* Floating +1 and burst coins */
.fly { position: fixed; z-index: 50; pointer-events: none; }
.plus { position: fixed; z-index: 50; pointer-events: none; font-family: "Lilita One", "Fredoka", sans-serif; font-size: 30px; color: #fde047; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 140%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 16px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); transition: transform 0.45s var(--spring);
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Sections ---------- */
section { padding: 56px 0; position: relative; }
h2 {
  font-family: "Lilita One", "Fredoka", sans-serif; font-weight: 400; text-align: center;
  font-size: clamp(36px, 5.6vw, 52px); line-height: 1.05; margin: 0 0 10px; color: #fff;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink);
}
.lead { text-align: center; color: var(--ink); font-size: 18px; margin: 0 auto 30px; max-width: 46ch; }

/* Meet the Bros */
.bros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; max-width: 860px; margin: 0 auto; }
.bro { text-align: center; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
.bro .hop { display: block; width: 104px; margin: 0 auto; transform-origin: 50% 100%; animation: hop 1.5s infinite; animation-delay: calc(var(--i) * -0.37s); }
.bro.yay .hop { animation: yay 0.9s var(--spring); }
.bro svg { width: 104px; height: 104px; display: block; overflow: visible; }
.bro .eyes { transform-origin: 50% 60%; transform-box: fill-box; animation: blink 4s infinite; animation-delay: calc(var(--i) * 0.9s); }
.bro .ledge { display: block; height: 22px; width: 130px; margin: -4px auto 0; border-radius: 12px; background: linear-gradient(#7fe07a 0 48%, #7a4a27 48%); box-shadow: 0 6px 12px rgba(11, 42, 23, 0.18); }
.bro b { display: block; margin-top: 12px; font-family: "Lilita One", "Fredoka", sans-serif; font-weight: 400; font-size: 24px; color: var(--ink); }
.bro small { display: block; color: var(--muted); font-size: 14px; font-weight: 600; }

/* Feature cards */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  background: var(--card); border-radius: 26px; padding: 24px;
  box-shadow: 0 6px 0 rgba(31, 138, 63, 0.25), 0 14px 30px rgba(11, 42, 23, 0.08);
  transition: transform 0.35s var(--spring), box-shadow 0.3s;
}
.feature:hover { transform: translateY(-8px) rotate(-1deg); box-shadow: 0 10px 0 rgba(31, 138, 63, 0.25), 0 22px 40px rgba(11, 42, 23, 0.14); }
.badge {
  width: 64px; height: 60px; display: grid; place-items: center; margin-bottom: 12px;
  border-radius: 46% 54% 48% 52% / 58% 56% 44% 42%;
  animation: blob 6s ease-in-out infinite; animation-delay: calc(var(--d, 0) * -1s);
}
.badge svg { width: 36px; height: 36px; transition: transform 0.4s var(--spring); }
.feature:hover .badge svg { transform: scale(1.25) rotate(-12deg); }
.feature h3 { margin: 0 0 6px; font-size: 20px; color: var(--ink); }
.feature p { margin: 0; color: var(--muted); font-size: 16px; }

/* Gallery */
.gallery { display: flex; gap: 18px; justify-content: safe center; overflow-x: auto; scroll-snap-type: x mandatory; padding: 18px 8px 26px; margin: 0 -8px; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery figure { margin: 0; flex: 0 0 186px; scroll-snap-align: center; text-align: center; }
.gallery .shot { transform: rotate(var(--r, 0deg)); transition: transform 0.4s var(--spring); }
.gallery figure:hover .shot { transform: rotate(0) translateY(-14px) scale(1.06); }
.gallery img { width: 100%; height: auto; display: block; border-radius: 28px; border: 6px solid #0b1210; box-shadow: 0 14px 28px rgba(11, 42, 23, 0.25); }
.gallery figcaption { margin-top: 14px; font-family: "Lilita One", "Fredoka", sans-serif; font-size: 20px; color: var(--ink); }

/* How to play */
.how { max-width: 680px; margin: 0 auto; padding: 0; list-style: none; display: grid; gap: 14px; }
.how li {
  display: flex; align-items: center; gap: 16px; background: var(--card); border-radius: 22px; padding: 16px 20px;
  box-shadow: 0 5px 0 rgba(31, 138, 63, 0.22);
}
.how .step { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 18px; background: #dcfce7; display: grid; place-items: center; position: relative; }
.how .step svg { width: 38px; height: 38px; }
.how .step em {
  position: absolute; top: -8px; left: -8px; width: 26px; height: 26px; border-radius: 50%; background: var(--grass); color: #fff;
  font-style: normal; font-family: "Lilita One", "Fredoka", sans-serif; font-size: 15px; display: grid; place-items: center; box-shadow: 0 2px 0 var(--grass-dark);
}
.how li:hover .step svg { animation: wiggle 0.6s ease-in-out; }

/* Bottom hills */
.hills { position: relative; height: 220px; margin-top: 30px; overflow: hidden; }
.hills svg { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; }
.hills .back { transform: translateY(calc(var(--hp, 0) * 30px)); }
.hills .mid { transform: translateY(calc(var(--hp, 0) * 15px)); }
.hills .peek { position: absolute; bottom: 92px; left: 14%; width: 70px; transform-origin: 50% 100%; animation: hop 1.3s infinite; }
.hills .peek svg { position: static; width: 70px; height: 70px; overflow: visible; }
.hills .coin { position: absolute; bottom: 110px; right: 18%; animation: coinspin 0.7s steps(5) infinite, float 3s ease-in-out infinite; }

footer { background: var(--grass-dark); color: #e9fbe9; padding: 18px 0 28px; font-size: 15px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; }
footer a { color: #fff; margin-right: 18px; }
main { flex: 1 0 auto; }
body.text-page footer { margin-top: 40px; }
body.text-page > .wrap { flex: 1 0 auto; }

/* Text pages (privacy, support) */
.page {
  max-width: 720px; margin: 12px auto 0; background: var(--card); border-radius: 28px;
  padding: 30px clamp(18px, 5vw, 44px); box-shadow: 0 7px 0 rgba(31, 138, 63, 0.22), 0 18px 40px rgba(11, 42, 23, 0.1);
}
.page h1 { font-family: "Lilita One", "Fredoka", sans-serif; font-weight: 400; font-size: clamp(32px, 6vw, 44px); line-height: 1.1; margin: 0 0 8px; color: var(--ink); }
.page h2 { text-align: left; font-family: inherit; font-weight: 700; font-size: 20px; margin: 28px 0 6px; color: var(--ink); -webkit-text-stroke: 0; text-shadow: none; }
.page .meta { color: var(--muted); margin-top: 0; }

/* ---------- Scroll reveal ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(40px) scale(0.94); transition: opacity 0.6s ease, transform 0.8s var(--spring); transition-delay: calc(var(--d, 0) * 90ms); }
.js [data-reveal].in { opacity: 1; transform: none; }

/* ---------- Keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { from { transform: translateX(-260px) scale(var(--s, 1)); } to { transform: translateX(calc(100vw + 60px)) scale(var(--s, 1)); } }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 50% { transform: translate(22px, -55vh); } 100% { transform: translate(-10px, -110vh); opacity: 0; } }
@keyframes coinspin { to { background-position: -320px 0; } }
.counter .coin { animation-name: coinspin-sm; }
@keyframes coinspin-sm { to { background-position: -130px 0; } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -16px; } }
@keyframes bounce {
  0% { transform: translateY(0) scale(1.14, 0.86); animation-timing-function: ease-out; }
  12% { transform: translateY(-12%) scale(0.92, 1.1); animation-timing-function: ease-out; }
  50% { transform: translateY(-62%) scale(1, 1); animation-timing-function: ease-in; }
  88% { transform: translateY(-6%) scale(0.95, 1.06); animation-timing-function: ease-in; }
  100% { transform: translateY(0) scale(1.14, 0.86); }
}
@keyframes shadow {
  0%, 100% { transform: scale(1.1); opacity: 1; animation-timing-function: ease-out; }
  50% { transform: scale(0.55); opacity: 0.45; animation-timing-function: ease-in; }
}
@keyframes superjump {
  0% { transform: translateY(0) scale(1.25, 0.75); }
  15% { transform: translateY(-20%) scale(0.85, 1.2); }
  50% { transform: translateY(-120%) rotate(360deg) scale(1.05); }
  85% { transform: translateY(-6%) rotate(360deg) scale(0.95, 1.08); }
  100% { transform: translateY(0) rotate(360deg) scale(1.14, 0.86); }
}
@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1.12, 0.88); animation-timing-function: ease-out; }
  14% { transform: translateY(-8px) scale(0.94, 1.08); animation-timing-function: ease-out; }
  50% { transform: translateY(-38px) scale(1, 1); animation-timing-function: ease-in; }
  86% { transform: translateY(-4px) scale(0.97, 1.04); }
}
@keyframes yay {
  0% { transform: scale(1.2, 0.8); }
  40% { transform: translateY(-70px) rotate(-200deg) scale(1.1); }
  70% { transform: translateY(-20px) rotate(-360deg); }
  100% { transform: translateY(0) rotate(-360deg) scale(1); }
}
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes dropin { 0% { transform: translateY(-120px) scale(0.6); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes wave { 0%, 80%, 100% { transform: translateY(0); } 88% { transform: translateY(-10px) rotate(-3deg); } }
@keyframes popin { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes nudge { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes shine { 0%, 55% { left: -80px; } 100% { left: 110%; } }
@keyframes bump { 50% { transform: scale(1.25); } }
@keyframes blob {
  0%, 100% { border-radius: 46% 54% 48% 52% / 58% 56% 44% 42%; }
  50% { border-radius: 56% 44% 54% 46% / 46% 52% 48% 54%; }
}
@keyframes wiggle { 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }

/* ---------- Small screens ---------- */
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 4px; }
  .tagline { margin-left: auto; margin-right: auto; }
  .cta-row, .facts { justify-content: center; }
  .stage { height: 420px; }
  .stage .platform { width: 280px; }
  .mascot { width: 200px; margin-left: -100px; }
  .stage .shadow { bottom: 92px; }
  .mascot { bottom: 88px; }
  .features { grid-template-columns: 1fr 1fr; }
  .bros { grid-template-columns: 1fr 1fr; row-gap: 34px; }
  .gallery { justify-content: flex-start; }
  .brand span { display: none; }
  .top nav a { padding: 6px 8px; font-size: 15px; }
}
@media (max-width: 520px) {
  .features { grid-template-columns: 1fr; }
  .feature { display: grid; grid-template-columns: 64px 1fr; column-gap: 14px; align-items: start; padding: 18px; }
  .feature .badge { grid-row: span 2; margin: 0; }
  .hero .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
.page { animation: pagein 0.7s var(--spring) both; }
@keyframes pagein { from { opacity: 0; transform: translateY(30px) scale(0.97); } to { opacity: 1; transform: none; } }

b, strong, h3 { font-weight: 700; }

/* Music button: the game's own speaker icon */
.sound {
  position: relative; width: 40px; height: 40px; margin-right: 4px; border: 0; border-radius: 13px; cursor: pointer;
  background: var(--ink); display: grid; place-items: center; box-shadow: 0 3px 0 #000;
  transition: transform 0.25s var(--spring);
}
.sound svg { width: 24px; height: 24px; }
.sound .waves { display: none; }
.sound.playing .waves { display: inline; animation: pulse 0.5s ease-in-out infinite alternate; transform-origin: 40% 50%; transform-box: fill-box; }
.sound.playing .mute { display: none; }
.sound:hover { transform: translateY(-2px) scale(1.06); }
.sound:active { transform: translateY(2px) scale(0.95); }
.sound:not(.playing)::after {
  content: "♪"; position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); color: var(--ink); font-size: 12px; line-height: 18px; text-align: center; font-weight: 700;
  animation: nudge 1.6s ease-in-out infinite;
}
@keyframes pulse { from { opacity: 0.55; } to { opacity: 1; } }
@media (max-width: 420px) { .counter { min-width: 0; } .top nav a { padding: 6px 6px; } }
