/* ==========================================================================
   Kiya! Let's Play and Learn: the homepage
   Same candy look as the games: Luckiest Guy for the fun words, Fredoka for
   the rest, white-rimmed frosted buttons, a bright morning sky.
   ========================================================================== */
@font-face { font-family: "Luckiest Guy"; src: url("fonts/luckiest-guy-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --ink: #4a2a78;
  --ink-soft: #7a5aa6;
  --pink: #ff5fa2;
  --blue: #2fb4ee;
  --orange: #ff9a3c;
  --yellow: #ffd23f;
  --green: #27c46b;
  --purple: #9b6bff;
  --fun: "Luckiest Guy", "Comic Sans MS", "Trebuchet MS", sans-serif;
  --ui: "Fredoka", "Comic Sans MS", "Trebuchet MS", sans-serif;
  --top: max(12px, env(safe-area-inset-top));
  --left: max(12px, env(safe-area-inset-left));
  --right: max(12px, env(safe-area-inset-right));
  --bottom: max(12px, env(safe-area-inset-bottom));
  --logo: clamp(54px, 10.5vmin, 124px);
  --buddy: clamp(130px, 30vh, 280px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui); font-weight: 600; color: var(--ink);
  background: #9fdcff;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }

/* --------------------------------------------------------------------------
   The sky: sun, clouds, floating letters and numbers, hills with flowers
   -------------------------------------------------------------------------- */
.sky {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: linear-gradient(180deg, #74c8f6 0%, #a7e0ff 46%, #d9f3ff 78%, #eefaff 100%);
}
.sun {
  position: absolute; right: 7vmin; top: 6vmin; width: 17vmin; height: 17vmin; min-width: 90px; min-height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fff7c2 0 18%, #ffe169 46%, #ffc93a 70%);
  box-shadow: 0 0 0 1.4vmin rgba(255,228,110,0.35), 0 0 7vmin rgba(255,214,90,0.55);
}
.sun i {
  position: absolute; inset: -55%; border-radius: 50%; z-index: -1;
  background: repeating-conic-gradient(rgba(255,236,150,0.55) 0 9deg, rgba(255,236,150,0) 9deg 24deg);
  -webkit-mask: radial-gradient(circle, transparent 30%, #000 34%, transparent 70%);
          mask: radial-gradient(circle, transparent 30%, #000 34%, transparent 70%);
  animation: spin 40s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cloud {
  position: absolute; width: 150px; height: 46px; border-radius: 999px; background: #fff; opacity: 0.92;
  box-shadow: 34px -22px 0 6px #fff, 80px -12px 0 -2px #fff, inset 0 -8px 0 rgba(160,210,240,0.35);
  animation: drift linear infinite;
}
.cloud.cl1 { top: 15%; left: -200px; animation-duration: 70s; animation-delay: -18s; }
.cloud.cl2 { top: 34%; left: -200px; transform: scale(0.7); animation-duration: 95s; animation-delay: -60s; opacity: 0.8; }
.cloud.cl3 { top: 8%; left: -200px; transform: scale(1.15); animation-duration: 120s; animation-delay: -85s; }
@keyframes drift { from { translate: 0 0; } to { translate: calc(100vw + 420px) 0; } }

.bubbles { position: absolute; inset: 0; }
.bub {
  position: absolute; left: var(--x); bottom: -90px;
  width: var(--s); height: var(--s); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--fun); font-size: calc(var(--s) * 0.5); line-height: 1; padding-top: 0.12em;
  color: hsl(var(--h) 75% 58%);
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.95) 0 9%, rgba(255,255,255,0.35) 22%, rgba(255,255,255,0.12) 60%);
  border: 2px solid rgba(255,255,255,0.75);
  box-shadow: inset 0 -6px 12px hsla(var(--h), 80%, 70%, 0.35);
  opacity: 0.62;
  animation: rise var(--dur) linear infinite, sway 3.4s ease-in-out infinite;
  animation-delay: var(--delay), var(--delay);
}
@keyframes rise { from { bottom: -90px; } to { bottom: calc(100% + 90px); } }
@keyframes sway { 0%, 100% { transform: translateX(-12px) rotate(-10deg); } 50% { transform: translateX(12px) rotate(10deg); } }

.hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 24vh; min-height: 120px; }
.hills .h-back { fill: #93e283; }
.hills .h-front { fill: #5fce6c; }
.flowers { position: absolute; left: 0; right: 0; bottom: 0; height: 9vh; }
.fl {
  position: absolute; left: var(--x); bottom: var(--y); width: 9px; height: 9px; border-radius: 50%;
  background: #ffe36b;
  box-shadow: 0 -7px 0 hsl(var(--h) 90% 72%), 0 7px 0 hsl(var(--h) 90% 72%), -7px 0 0 hsl(var(--h) 90% 72%), 7px 0 0 hsl(var(--h) 90% 72%);
  animation: nod 2.6s ease-in-out infinite; animation-delay: var(--d);
}
@keyframes nod { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.topbar {
  position: fixed; z-index: 10; top: var(--top); left: var(--left); right: var(--right);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none;
}
.tb-left, .tb-right { display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.chip {
  position: relative; height: 46px; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px 0 10px; border-radius: 999px; cursor: pointer;
  font-family: var(--ui); font-weight: 700; font-size: 15px; color: var(--ink);
  border: 3px solid #fff; background: rgba(255,255,255,0.86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 4px 0 rgba(155,107,255,0.3), 0 8px 18px rgba(40,20,100,0.18);
  transition: transform .15s;
}
.chip .ic { font-size: 19px; line-height: 1; }
.chip b { font-family: var(--fun); font-weight: 400; font-size: 18px; padding-top: 3px; color: var(--pink); }
.chip.round { width: 50px; height: 50px; padding: 0; justify-content: center; }
.chip.round .ic { font-size: 23px; }
button.chip:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(155,107,255,0.3); }
.chip.stat { cursor: default; padding: 0 12px 0 9px; }
#coins-chip b { color: #e08a00; }
#streak-chip b { color: #ff6a2b; }
#streak-chip:not(.lit) .flame { filter: grayscale(1) opacity(0.6); }
#streak-chip:not(.lit) b { color: #a99bbd; }
#lang-btn b { font-size: 16px; }
#lang-btn.flip .ic { animation: roll .6s cubic-bezier(.2,1.4,.4,1); }
@keyframes roll { from { transform: rotate(-360deg) scale(.6); } to { transform: none; } }

#sound-btn.muted { background: rgba(230,225,240,0.9); }
#sound-btn .hint {
  position: absolute; left: 0; top: calc(100% + 8px);
  white-space: nowrap; padding: 6px 12px; border-radius: 999px;
  background: var(--pink); color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(255,95,162,0.4);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
#sound-btn.blocked { animation: ring 1.4s ease-out infinite; }
#sound-btn.blocked .hint { opacity: 1; animation: nudge 1.4s ease-in-out infinite; }
#sound-btn .hint::before { content: ""; position: absolute; left: 18px; top: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: var(--pink); }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255,95,162,0.55), 0 4px 0 rgba(155,107,255,0.3); } 100% { box-shadow: 0 0 0 16px rgba(255,95,162,0), 0 4px 0 rgba(155,107,255,0.3); } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* --------------------------------------------------------------------------
   Stage: the hero (logo + character) and the game cards
   -------------------------------------------------------------------------- */
.stage {
  position: relative; z-index: 1; height: 100%;
  display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.3fr);
  align-items: center; gap: 2.5vw;
  max-width: 1360px; margin: 0 auto;
  padding: calc(var(--top) + 58px) max(var(--right), 3.5vw) var(--bottom) max(var(--left), 3.5vw);
}
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; height: 100%; }

/* ---- logo ---- */
.logo {
  position: relative; margin: 0; font-size: var(--logo); line-height: 1; font-weight: 400;
  display: flex; flex-direction: column; align-items: center;
  animation: logo-in .8s cubic-bezier(.2,1.5,.4,1) backwards;
}
@keyframes logo-in { from { transform: scale(.4) translateY(-30px); opacity: 0; } }
.rainbow { position: absolute; left: 50%; top: -0.32em; translate: -50% 0; width: 2.5em; height: 1.25em; overflow: hidden; z-index: -1; }
.rainbow i {
  position: absolute; inset: 0 0 -1.25em 0; border-radius: 50%;
  background: radial-gradient(circle, transparent 41%, #b388ff 41% 47%, #5fc8ff 47% 53%, #6fe08a 53% 59%, #ffe066 59% 65%, #ffb15c 65% 71%, #ff7eb9 71% 77%, transparent 77%);
  opacity: 0.9;
}
.kiya { display: flex; gap: 0.02em; font-family: var(--fun); position: relative; }
.kl {
  display: inline-block; cursor: pointer; padding-top: 0.08em;
  color: var(--c); -webkit-text-stroke: 0.075em #fff; paint-order: stroke fill;
  text-shadow: 0 0.06em 0 var(--d), 0 0.13em 0.18em rgba(60,20,120,0.28);
  transform: rotate(var(--r));
  animation: bob 2.6s ease-in-out infinite; animation-delay: calc(var(--i) * -0.32s);
}
.kl:nth-child(1) { --c: #ff5fa2; --d: #c93478; --r: -8deg; }
.kl:nth-child(2) { --c: #ffc928; --d: #d99200; --r: 5deg; }
.kl:nth-child(3) { --c: #2fc46b; --d: #198a49; --r: -4deg; }
.kl:nth-child(4) { --c: #2fb4ee; --d: #1679b5; --r: 7deg; }
.kl:nth-child(5) { --c: #9b6bff; --d: #6a3fd0; --r: 10deg; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -0.06em; } }
.kl.boing { animation: boing .7s cubic-bezier(.2,1.6,.4,1); }
@keyframes boing { 0% { scale: 1; } 25% { scale: 1.35 0.7; } 50% { scale: 0.85 1.25; } 75% { scale: 1.08 0.94; } 100% { scale: 1; } }
.ribbon {
  margin-top: -0.06em; font-family: var(--fun); font-size: 0.3em; letter-spacing: 0.02em; color: #fff;
  padding: 0.38em 1em 0.24em; border-radius: 999px; border: 0.12em solid #fff; white-space: nowrap;
  background: linear-gradient(90deg, #ff5fa2, #b06bff 50%, #2fb4ee);
  box-shadow: 0 0.16em 0 #7b4fd0, 0 0.4em 0.7em rgba(60,20,120,0.25);
  transform: rotate(-2deg);
  text-shadow: 0 0.06em 0 rgba(80,30,140,0.5);
}
.spark { position: absolute; color: #fff; font-family: var(--ui); font-size: 0.24em; text-shadow: 0 0 0.3em #fff7b0; animation: twinkle 2s ease-in-out infinite; }
.spark.s1 { left: -0.35em; top: 0.05em; }
.spark.s2 { right: -0.4em; top: -0.1em; font-size: 0.3em; color: #ffe46b; animation-delay: -.7s; }
.spark.s3 { right: -0.15em; bottom: 0.15em; animation-delay: -1.3s; }
@keyframes twinkle { 0%, 100% { opacity: .2; scale: .6; } 50% { opacity: 1; scale: 1.2; } }

/* ---- the character(s) ---- */
.buddy { position: relative; margin-top: clamp(56px, 10vh, 86px); display: flex; flex-direction: column; align-items: center; }
.crew {
  position: relative; z-index: 2; display: flex; align-items: flex-end; justify-content: center;
  border: 0; background: none; padding: 0; cursor: pointer; height: var(--buddy);
}
.who {
  display: block; height: 100%; width: auto; pointer-events: none;
  filter: drop-shadow(0 6px 6px rgba(40,20,100,0.18));
  animation: idle 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -0.45s);
  transform-origin: 50% 100%;
}
@keyframes idle { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-4px) scale(1.01, 0.99); } }
.crew.family .who { height: 74%; margin: 0 -3.5%; }
.crew.family .who:nth-child(1), .crew.family .who:nth-child(5) { height: 82%; z-index: 1; }
.crew.family .who:nth-child(3) { height: 92%; z-index: 3; }
.crew.family .who:nth-child(2), .crew.family .who:nth-child(4) { z-index: 2; }
.crew.hop .who { animation: hop .6s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--i) * 0.05s); }
@keyframes hop { 0% { transform: translateY(0) scale(1.1, .88); } 40% { transform: translateY(-18%) scale(.95, 1.06); } 100% { transform: none; } }
.mound {
  position: relative; z-index: 1; margin-top: -2.2vh; width: calc(var(--buddy) * 1.05); height: calc(var(--buddy) * 0.16);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #8ee27f, #4fbf5e 70%);
  box-shadow: inset 0 -6px 0 rgba(30,120,50,0.25), 0 10px 18px rgba(30,90,50,0.18);
}
.crew.family + .mound { width: calc(var(--buddy) * 1.75); }

.speech {
  position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 6px);
  width: max-content; max-width: min(300px, 80vw); text-align: center;
  padding: 9px 15px; border-radius: 20px; border: 3px solid #fff;
  background: #fff; color: var(--ink); font-size: 16px; font-weight: 700; line-height: 1.25;
  box-shadow: 0 5px 0 rgba(155,107,255,0.28), 0 10px 22px rgba(40,20,100,0.18);
  transform-origin: 50% 100%; transform: translateX(-50%) scale(0); opacity: 0;
  transition: transform .35s cubic-bezier(.2,1.5,.4,1), opacity .2s;
  pointer-events: none;
}
.speech::after {
  content: ""; position: absolute; left: 50%; bottom: -14px; width: 22px; height: 16px; margin-left: -11px; background: #fff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.speech.show { transform: translateX(-50%) scale(1); opacity: 1; }

/* ---- game cards ---- */
.games {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 2.2vw, 26px);
  align-content: center; min-height: 0;
}
.game-card {
  position: relative; display: flex; flex-direction: column; text-align: left; overflow: hidden;
  border: 4px solid #fff; border-radius: 30px; padding: 0; cursor: pointer; color: #fff;
  min-height: 0; height: clamp(300px, 64vh, 470px);
  box-shadow: 0 8px 0 var(--edge), 0 18px 32px rgba(40,20,100,0.26);
  transition: transform .2s cubic-bezier(.2,1.4,.4,1), box-shadow .2s;
  animation: card-in .6s cubic-bezier(.2,1.4,.4,1) backwards; animation-delay: calc(.15s + var(--i) * .1s);
}
@keyframes card-in { from { transform: translateY(40px) scale(.85); opacity: 0; } }
.game-card:active { transform: translateY(6px) scale(.98); box-shadow: 0 2px 0 var(--edge), 0 8px 16px rgba(40,20,100,0.2); }
@media (hover: hover) {
  .game-card:hover { transform: translateY(-4px) rotate(-1deg) scale(1.02); }
  .game-card:hover .gc-pic { transform: scale(1.04); }
}
.g-letters { --edge: #8340d0; background: linear-gradient(160deg, #ff86c8 0%, #d377f3 45%, #9a6bff 100%); }
.g-math { --edge: #1580b0; background: linear-gradient(160deg, #4fe4ad 0%, #2bc6c6 45%, #2ba1ec 100%); }

.gc-art {
  position: relative; flex: 0 0 44%; min-height: 0;
  background:
    radial-gradient(60% 70% at 30% 60%, rgba(255,255,255,0.45), rgba(255,255,255,0) 70%),
    radial-gradient(circle at 85% 15%, rgba(255,255,255,0.25) 0 12%, transparent 13%);
}
.gc-pic { position: absolute; inset: 0; transition: transform .3s cubic-bezier(.2,1.4,.4,1); }

/* ---- Letter Quest: the six world bosses take turns ---- */
.art-letters::before { /* the glow behind the boss takes the colour of that boss's world */
  content: ""; position: absolute; right: -4%; top: -6%; width: 70%; height: 112%; border-radius: 50%;
  background: radial-gradient(circle, var(--glow, #fff2a8) 0%, rgba(255,255,255,0) 68%); opacity: .85;
  transition: background .6s;
}
.la-tiles { position: absolute; left: 6%; top: 10%; display: flex; gap: 4px; z-index: 2; }
.la-tiles b {
  display: grid; place-items: center; width: clamp(32px, 4.6vmin, 46px); aspect-ratio: 1; border-radius: 12px;
  font-family: var(--fun); font-weight: 400; font-size: clamp(20px, 3vmin, 30px); padding-top: 0.12em;
  border: 3px solid #fff; color: #b0560c;
  background: linear-gradient(180deg, #ffe680, #ffc21f); box-shadow: 0 4px 0 #d98b16, 0 8px 12px rgba(120,40,0,0.25);
  transform: rotate(calc((var(--k) - 1.5) * 6deg));
  animation: tile 1.8s ease-in-out infinite; animation-delay: calc(var(--k) * -0.3s);
}
.la-tiles b.flip { animation: flip .34s ease-in-out, tile 1.8s ease-in-out .34s infinite; }
@keyframes flip { 0% { transform: rotate(calc((var(--k) - 1.5) * 6deg)) rotateY(0); } 50% { transform: rotate(calc((var(--k) - 1.5) * 6deg)) rotateY(90deg); } 100% { transform: rotate(calc((var(--k) - 1.5) * 6deg)) rotateY(0); } }
@keyframes tile { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
.la-stage { position: absolute; right: 2%; bottom: 6%; height: 84%; width: 46%; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; z-index: 1; }
.la-boss { height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 6px 8px rgba(40,20,100,0.28)); animation: boss-bob 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes boss-bob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-6px) scale(.98, 1.03); } }
.la-stage.out .la-boss { animation: boss-out .23s ease-in forwards; }
@keyframes boss-out { to { transform: translateY(14px) scale(.2, .2) rotate(-25deg); opacity: 0; } }
.la-stage.in .la-boss { animation: boss-in .55s cubic-bezier(.2,1.6,.4,1), boss-bob 1.6s ease-in-out .55s infinite; }
@keyframes boss-in { 0% { transform: scale(.2, 1.4) translateY(30px); opacity: 0; } 60% { transform: scale(1.15, .88); opacity: 1; } 100% { transform: none; } }
.la-stage.bonk .la-boss { animation: bonk .38s ease-out; }
@keyframes bonk { 0% { transform: scale(1.25, .7); } 40% { transform: scale(.9, 1.15) rotate(8deg); } 100% { transform: none; } }
.la-pop { position: absolute; left: 50%; bottom: 30%; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; }
.la-stage.in .la-pop { animation: pop-ring .6s ease-out; }
@keyframes pop-ring { from { box-shadow: 0 0 0 0 rgba(255,255,255,.9); } to { box-shadow: 0 0 0 70px rgba(255,255,255,0); } }
.la-name {
  position: absolute; left: 6%; bottom: 31%; z-index: 2; max-width: 50%;
  font-size: 12.5px; font-weight: 700; line-height: 1.15; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.92); color: #7a3fc4; box-shadow: 0 3px 0 rgba(120,50,200,0.3);
}
.la-name.in { animation: name-in .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes name-in { from { transform: translateX(-12px) scale(.7); opacity: 0; } }
.la-crowns { position: absolute; left: 6%; bottom: 11%; display: flex; gap: 3px; z-index: 2; }
.la-crowns i { font-style: normal; font-size: 13px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,0.3); filter: grayscale(.7) opacity(.75); transition: transform .3s cubic-bezier(.2,1.6,.4,1), background .3s; }
.la-crowns i.on { background: #fff; filter: none; transform: scale(1.3) translateY(-3px); box-shadow: 0 3px 0 rgba(120,50,200,0.35); }

/* ---- Easy Math: Pak Guru, the chalkboard, answer chips, floating numbers ---- */
.art-math::before { content: ""; position: absolute; right: -6%; top: -4%; width: 66%; height: 110%; border-radius: 50%; background: radial-gradient(circle, rgba(255,250,200,.85), rgba(255,255,255,0) 66%); }
.ma-float { position: absolute; inset: 0; overflow: hidden; }
.ma-float i {
  position: absolute; left: var(--x); bottom: -30px; font-style: normal;
  font-family: var(--fun); font-size: 20px; width: 30px; height: 30px; display: grid; place-items: center; padding-top: 3px;
  border-radius: 50%; color: hsl(var(--h) 80% 50%); background: rgba(255,255,255,0.55); border: 2px solid rgba(255,255,255,0.8);
  animation: num-rise var(--t) linear infinite; animation-delay: calc(var(--d) * -1);
}
@keyframes num-rise { 0% { transform: translateY(0) rotate(-12deg); opacity: 0; } 12% { opacity: .9; } 85% { opacity: .8; } 100% { transform: translateY(-250px) rotate(12deg); opacity: 0; } }
.ma-board {
  position: absolute; left: 6%; top: 10%; z-index: 2; width: 54%; min-height: 34%;
  display: flex; align-items: center; justify-content: center; padding: 6px 10px;
  border-radius: 12px; border: 5px solid #b97a3d;
  background: radial-gradient(120% 90% at 30% 20%, #2f7a5a, #1f5a43);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.15), 0 5px 0 #8a5426, 0 10px 16px rgba(0,40,30,0.3);
  transform: rotate(-3deg);
}
.ma-sum { font-family: var(--fun); font-weight: 400; font-size: clamp(22px, 3.6vmin, 34px); color: #f6fbff; letter-spacing: .03em; padding-top: 4px; white-space: nowrap; text-shadow: 0 0 6px rgba(255,255,255,0.35); }
.ma-sum .ch { display: inline-block; white-space: pre; animation: chalk .18s ease-out; }
@keyframes chalk { from { transform: scale(1.6); opacity: 0; } }
.ma-sum .q { display: inline-block; color: #ffe066; margin-left: .2em; animation: q-wobble .8s ease-in-out infinite; }
@keyframes q-wobble { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg) scale(1.1); } }
.ma-sum .a { display: inline-block; color: #8dffb8; margin-left: .2em; animation: chalk .3s cubic-bezier(.2,1.6,.4,1); }
.ma-chips { position: absolute; left: 6%; bottom: 10%; z-index: 2; display: flex; gap: 6px; }
.ma-chips b {
  display: grid; place-items: center; min-width: clamp(34px, 5vmin, 46px); height: clamp(34px, 5vmin, 46px); padding: 3px 6px 0; border-radius: 12px;
  font-family: var(--fun); font-weight: 400; font-size: clamp(19px, 2.9vmin, 26px); color: #1f9fd8;
  background: #fff; border: 3px solid #fff; box-shadow: 0 4px 0 #9ed7ee;
  transform: scale(0); transition: transform .3s cubic-bezier(.2,1.6,.4,1), background .25s, color .25s, opacity .25s;
}
.ma-chips b.in { transform: scale(1); }
.ma-chips b.right { background: #3fd67e; color: #fff; box-shadow: 0 4px 0 #1e9a52, 0 0 0 5px rgba(255,255,255,0.5); transform: scale(1.18) translateY(-4px); }
.ma-chips b.right::after { content: "✓"; position: absolute; margin: -38px 0 0 30px; font-size: 16px; color: #fff; background: #1e9a52; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-family: var(--ui); }
.ma-chips b.dim { opacity: .45; transform: scale(.9); }
.ma-guru { position: absolute; right: 2%; bottom: 0; height: 96%; width: 40%; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; z-index: 1; }
.ma-guru img { height: 100%; width: auto; max-width: 125%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 6px 8px rgba(0,40,70,0.28)); transform-origin: 50% 100%; animation: guru 2.2s ease-in-out infinite; }
@keyframes guru { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(3deg) translateY(-4px); } }
.ma-guru.laugh img { animation: laugh .5s ease-in-out 2; }
@keyframes laugh { 0%, 100% { transform: none; } 25% { transform: scale(1.06, .94) rotate(-4deg); } 75% { transform: scale(.96, 1.06) rotate(4deg); } }
.ma-ho { position: absolute; top: 2%; right: 30%; font-family: var(--fun); font-size: 15px; color: #fff; background: #ff6aa8; border: 2px solid #fff; padding: 4px 8px 1px; border-radius: 12px; transform: scale(0) rotate(-8deg); pointer-events: none; }
.ma-guru.laugh .ma-ho { animation: ho 1.1s cubic-bezier(.2,1.6,.4,1); }
@keyframes ho { 0% { transform: scale(0) rotate(-8deg); } 20%, 80% { transform: scale(1) rotate(-8deg); } 100% { transform: scale(0) rotate(-8deg); } }

/* the cards breathe a little, and the Play button glows, so the page never sits still */
.games .game-card:not(.more):not(.nope) { animation: card-in .6s cubic-bezier(.2,1.4,.4,1) backwards calc(.15s + var(--i) * .1s), card-float 4.2s ease-in-out calc(1s + var(--i) * -2.1s) infinite; }
@keyframes card-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.game-card:not(.soon) .gc-play { animation: play-glow 1.8s ease-in-out infinite; }
@keyframes play-glow { 0%, 100% { box-shadow: 0 5px 0 #d9822b, 0 8px 14px rgba(120,50,0,0.25), 0 0 0 0 rgba(255,230,120,0.6); } 50% { box-shadow: 0 5px 0 #d9822b, 0 8px 14px rgba(120,50,0,0.25), 0 0 0 9px rgba(255,230,120,0); } }
.gc-shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.4) 50%, transparent 60%);
  transform: translateX(-120%); animation: shine 4.5s ease-in-out infinite; animation-delay: calc(1.2s + var(--i) * 1.6s);
}
@keyframes shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

.gc-body { position: relative; flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 6px clamp(14px, 1.8vw, 22px) clamp(14px, 2vh, 20px); min-height: 0; }
.gc-kicker { align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,0.26); }
.gc-title { font-family: var(--fun); font-size: clamp(26px, 3.6vmin, 38px); line-height: 0.95; padding-top: 4px; text-shadow: 0 3px 0 rgba(60,20,120,0.28); }
.gc-title small { display: block; font-size: 0.5em; opacity: 0.9; }
.g-math .gc-title { text-shadow: 0 3px 0 rgba(0,70,110,0.28); }
.gc-desc { font-size: clamp(13px, 1.9vmin, 16px); line-height: 1.25; opacity: 0.96; }
.gc-prog { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.gc-line { white-space: nowrap; }
.gc-bar { flex: 1; height: 9px; border-radius: 99px; background: rgba(255,255,255,0.3); overflow: hidden; }
.gc-bar i { display: block; height: 100%; border-radius: 99px; background: #fff; }
.gc-play {
  margin-top: auto; align-self: stretch; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--fun); font-size: clamp(20px, 2.8vmin, 26px); padding: 10px 12px 6px; border-radius: 999px;
  color: #8a3f00; border: 3px solid #fff;
  background: linear-gradient(180deg, #ffe680, #ffb21f);
  box-shadow: 0 5px 0 #d9822b, 0 8px 14px rgba(120,50,0,0.25);
}
.game-card.soon .gc-play { color: #6b5a86; background: linear-gradient(180deg, #ffffff, #e6defa); box-shadow: 0 5px 0 #b8a7e0, 0 8px 14px rgba(40,20,100,0.18); }
.game-card.soon .gc-art, .game-card.soon .gc-desc, .game-card.soon .gc-prog { opacity: 0.9; }
.gc-new {
  position: absolute; right: 12px; top: 12px; z-index: 2;
  font-family: var(--fun); font-size: 17px; padding: 12px 8px 8px; border-radius: 50%; min-width: 58px; text-align: center;
  color: #fff; background: radial-gradient(circle at 35% 30%, #ff8a8a, #ff3b5c);
  border: 3px solid #fff; box-shadow: 0 4px 0 #c2183c; transform: rotate(14deg);
  animation: new-pulse 1.4s ease-in-out infinite;
}
@keyframes new-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.12; } }
.gc-ribbon {
  position: absolute; z-index: 2; top: 26px; right: -46px; width: 190px; text-align: center; transform: rotate(35deg);
  font-family: var(--fun); font-size: 14px; padding: 7px 0 4px; color: #6a3a00;
  background: repeating-linear-gradient(-45deg, #ffd23f 0 12px, #ffbf1a 12px 24px);
  border-top: 3px solid #fff; border-bottom: 3px solid #fff; box-shadow: 0 4px 10px rgba(40,20,100,0.25);
}
.game-card.nope { animation: nope .5s ease-in-out; }
@keyframes nope { 0%, 100% { transform: none; } 20% { transform: translateX(-10px) rotate(-2deg); } 40% { transform: translateX(9px) rotate(2deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.game-card.chosen { transform: scale(1.05); box-shadow: 0 8px 0 var(--edge), 0 0 0 8px rgba(255,255,255,0.6), 0 24px 40px rgba(40,20,100,0.3); z-index: 3; }

.game-card.more {
  grid-column: 1 / -1; height: auto; min-height: 0; flex-direction: row; align-items: center; gap: 12px;
  padding: 10px 18px; border-radius: 22px; color: var(--ink);
  border: 3px dashed rgba(255,255,255,0.95); background: rgba(255,255,255,0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 5px 0 rgba(155,107,255,0.25), 0 10px 20px rgba(40,20,100,0.12); --edge: rgba(155,107,255,0.25);
}
.mo-ic { font-size: 30px; animation: tile 2s ease-in-out infinite; }
.mo-text { display: flex; flex-direction: column; }
.mo-text b { font-family: var(--fun); font-weight: 400; font-size: 18px; padding-top: 3px; color: var(--purple); }
.mo-text span { font-size: 14px; color: var(--ink-soft); }

/* --------------------------------------------------------------------------
   Confetti and the colour wipe into a game
   -------------------------------------------------------------------------- */
.confetti { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.confetti i {
  position: fixed; width: 10px; height: 14px; border-radius: 3px; margin: -7px 0 0 -5px;
  animation: fly 1.05s cubic-bezier(.15,.7,.4,1) forwards;
}
@keyframes fly { to { transform: translate(var(--dx), calc(var(--dy) + 120px)) rotate(var(--r)); opacity: 0; } }
.wipe {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background: #fff; clip-path: circle(0 at var(--x, 50%) var(--y, 50%));
}
.wipe.go { pointer-events: auto; animation: wipe .8s cubic-bezier(.6,0,.3,1) .15s forwards; }
.wipe.w-letters { background: radial-gradient(circle at var(--x) var(--y), #ff86c8, #9a6bff 80%); }
.wipe.w-math { background: radial-gradient(circle at var(--x) var(--y), #4fe4ad, #2ba1ec 80%); }
.wipe b {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--fun); font-weight: 400; font-size: clamp(40px, 9vmin, 90px); color: #fff; text-align: center; line-height: 1;
  text-shadow: 0 0.06em 0 rgba(60,20,120,0.3), 0 0.15em 0.4em rgba(40,20,100,0.25);
  opacity: 0; animation: wipe-title .5s cubic-bezier(.2,1.5,.4,1) .55s forwards;
}
.wipe b small { font-size: 0.45em; }
@keyframes wipe-title { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: none; } }
@keyframes wipe { to { clip-path: circle(150% at var(--x, 50%) var(--y, 50%)); } }

/* --------------------------------------------------------------------------
   Short landscape phones
   -------------------------------------------------------------------------- */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --logo: clamp(42px, 13vh, 70px); --buddy: clamp(100px, 36vh, 170px); }
  .stage { padding-top: calc(var(--top) + 50px); grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.35fr); }
  .chip { height: 40px; font-size: 14px; }
  .chip.round { width: 42px; height: 42px; }
  .game-card { height: calc(100vh - var(--top) - 50px - 70px - var(--bottom)); min-height: 210px; border-radius: 22px; }
  .gc-art { flex-basis: 44%; }
  .la-tiles b { width: 26px; font-size: 16px; border-radius: 8px; border-width: 2px; }
  .la-name { display: none; }
  .la-crowns i { width: 18px; height: 18px; font-size: 10px; }
  .la-stage { bottom: 6%; height: 90%; }
  .ma-board { top: 8%; min-height: 0; border-width: 3px; padding: 2px 6px; }
  .ma-sum { font-size: 17px; }
  .ma-chips b { min-width: 26px; height: 26px; font-size: 15px; border-width: 2px; border-radius: 8px; }
  .ma-chips b.right::after { display: none; }
  .gc-desc { display: none; }
  .gc-title { font-size: 24px; }
  .gc-play { font-size: 18px; padding: 7px 10px 4px; }
  .game-card.more { padding: 6px 14px; }
  .mo-ic { font-size: 22px; }
  .mo-text span { display: none; }
  .speech { font-size: 14px; padding: 7px 11px; }
  .buddy { margin-top: 46px; }
}

/* --------------------------------------------------------------------------
   Portrait (phones held upright): everything stacks and the page scrolls
   -------------------------------------------------------------------------- */
@media (orientation: portrait) {
  :root { --logo: clamp(52px, 15vw, 92px); --buddy: clamp(120px, 23vh, 210px); }
  body { overflow-x: hidden; overflow-y: auto; }
  .sky { position: fixed; }
  .stage {
    display: flex; flex-direction: column; align-items: stretch; height: auto; min-height: 100%;
    gap: 18px; padding: calc(var(--top) + 66px) 16px calc(var(--bottom) + 20px);
  }
  .hero { height: auto; }
  .logo { margin-top: 6px; }
  .speech { font-size: 15px; }
  .buddy { margin-top: 64px; }
  .chip .lbl { display: none; }
  .chip { padding: 0 11px 0 9px; }
  #grownups-btn { width: 46px; padding: 0; justify-content: center; }
  .games { grid-template-columns: 1fr; gap: 16px; }
  .game-card { flex-direction: row; height: auto; min-height: 168px; border-radius: 26px; }
  .gc-art { flex: 0 0 44%; }
  .la-tiles { left: 8%; top: 8%; gap: 3px; }
  .la-tiles b { width: 27px; font-size: 16px; border-radius: 8px; border-width: 2px; }
  .la-stage { right: 0; left: 0; width: auto; bottom: 30px; height: 62%; }
  .la-name { display: none; }
  .la-crowns { left: 50%; translate: -50% 0; bottom: 6px; gap: 1px; }
  .la-crowns i { width: 19px; height: 19px; font-size: 10px; }
  .art-letters::before { right: 0; top: 10%; width: 100%; height: 80%; }
  .ma-board { left: 6%; top: 7%; width: 88%; min-height: 0; border-width: 3px; padding: 3px 6px; }
  .ma-sum { font-size: 19px; }
  .ma-guru { right: 0; width: 56%; height: 58%; }
  .ma-chips { left: 6%; bottom: 8px; flex-direction: column; gap: 3px; }
  .ma-chips b { min-width: 30px; height: 26px; font-size: 15px; border-width: 2px; border-radius: 8px; box-shadow: 0 2px 0 #9ed7ee; }
  .ma-chips b.right { transform: scale(1.1) translateX(3px); }
  .ma-chips b.right::after { display: none; }
  .ma-ho { right: 6%; top: -4px; font-size: 12px; }
  .gc-body { padding: 12px 14px 14px 4px; gap: 4px; }
  .gc-title { font-size: 27px; }
  .gc-desc { font-size: 13.5px; }
  .gc-play { font-size: 18px; padding: 8px 8px 5px; margin-top: 6px; }
  .game-card.soon .gc-play { font-size: 15px; }
  .gc-new { right: 8px; top: 8px; min-width: 50px; font-size: 14px; padding: 10px 6px 6px; }
  .gc-ribbon { top: 18px; right: -52px; font-size: 12px; width: 170px; }
}
@media (orientation: portrait) and (max-width: 360px) {
  .tb-right #lang-btn { padding: 0 9px 0 7px; }
  .chip.stat { padding: 0 8px 0 7px; }
}

/* --------------------------------------------------------------------------
   Calmer for players who asked their device for less motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .bubbles, .cloud { display: none; }
}
