/* the games to play while a book is made (static/games.js), for the website's show and the app */
.wg { width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center; color: #fff; }
.wg-tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.wg-tab { display: flex; align-items: center; gap: 6px; border: 0; border-radius: 99px; padding: 6px 14px 6px 6px; background: rgba(255,255,255,.12); color: #fff;
  font: 700 1.02rem var(--round, system-ui); cursor: pointer; }
.wg-tab img { width: 34px; height: 34px; object-fit: contain; }
.wg-tab.on { background: var(--sun, #ffd65c); color: var(--ink, #352363); }
.wg-tab:focus-visible, .wg-hole:focus-visible, .wg-card:focus-visible, .wg-again:focus-visible { outline: 4px solid var(--sun, #ffd65c); outline-offset: 2px; }
.wg-box { width: 100%; display: flex; justify-content: center; }
.wg-stage { position: relative; width: 100%; width: min(100%, max(300px, calc((100vh - 250px) * 1.333))); aspect-ratio: 4 / 3; border-radius: 20px; overflow: hidden;
  background: #2a1c55 center / cover no-repeat; box-shadow: inset 0 0 0 4px rgba(255,255,255,.15), 0 12px 30px rgba(0,0,0,.35); touch-action: none; user-select: none; }
.wg-stage button { cursor: pointer; }
.wg-hud { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; justify-content: space-between; z-index: 6; pointer-events: none; }
.wg-hud span { background: rgba(28,18,64,.75); color: #fff; border-radius: 99px; padding: 5px 12px; font: 700 1.05rem var(--round, system-ui); }
.wg-hud .low { background: var(--coral, #ff7aa2); }
.wg-end { position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(28,18,64,.6); text-align: center; animation: wg-in .4s cubic-bezier(.2,1.5,.4,1); }
.wg-end > div { background: var(--cream, #fff8ec); color: var(--ink, #352363); border-radius: 22px; padding: 16px 22px; max-width: 86%; }
.wg-end h3 { margin: 0 0 4px; font: 700 1.6rem var(--round, system-ui); }
.wg-end p { margin: 0 0 12px; font-weight: 700; color: var(--purple, #7f52aa); }
.wg-again { border: 0; border-radius: 99px; padding: 12px 24px; background: var(--sun, #ffd65c); color: var(--ink, #352363); font: 700 1.15rem var(--round, system-ui); box-shadow: 0 5px 0 var(--sun-d, #c9931a); }
@keyframes wg-in { from { opacity: 0; transform: scale(.7); } }
.wg-plus { position: absolute; z-index: 7; font: 700 1.6rem var(--round, system-ui); color: #fff; text-shadow: 0 2px 0 #c9931a, 0 0 10px rgba(0,0,0,.4); pointer-events: none; animation: wg-plus .8s ease-out forwards; }
@keyframes wg-plus { to { transform: translateY(-50px) scale(1.3); opacity: 0; } }
.wg-burst { position: absolute; left: 50%; top: 50%; z-index: 9; font-size: 26px; pointer-events: none; animation: wg-burst .9s ease-out forwards; }
@keyframes wg-burst { to { left: calc(50% + var(--dx)); top: calc(50% + var(--dy)); opacity: 0; transform: scale(.5) rotate(200deg); } }
/* bop the mole */
.wg-moles { position: absolute; left: 4%; right: 4%; top: 18%; bottom: 3%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 2% 3%; align-items: end; }
.wg-hole { position: relative; border: 0; background: none; padding: 0; width: 100%; min-width: 0; aspect-ratio: 512 / 374; border-radius: 30%; }
.wg-hole .hb, .wg-hole .hf { position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.wg-hole .hb { z-index: 0; } .wg-hole .hf { z-index: 2; clip-path: inset(60% 0 0 0); }
.wg-hole .pit { position: absolute; z-index: 1; left: 14%; right: 14%; bottom: 38%; height: 190%; overflow: hidden; pointer-events: none; }
.wg-hole .mole { position: absolute; left: 0; right: 0; bottom: 0; transform: translateY(105%); transition: transform .16s cubic-bezier(.3,1.6,.5,1); }
.wg-hole .mole img { display: block; width: 100%; }
.wg-hole .mole b { position: absolute; left: 50%; top: 66%; translate: -50% -50%; font-size: 16px; font-size: clamp(16px, 4.2vw, 30px); line-height: 1; }
.wg-hole.up .mole { transform: translateY(-22%); }
.wg-hole.gold .mole img { filter: drop-shadow(0 0 10px #ffd65c) drop-shadow(0 0 4px #fff); }
.wg-hole.bonk .mole { transform: translateY(18%) scale(1.08, .82); transition-duration: .08s; }
.wg-hole.bonk::after { content: "💫"; position: absolute; z-index: 3; left: 50%; top: -40%; translate: -50% 0; font-size: 20px; font-size: clamp(20px, 5vw, 36px); }
.wg-mallet { position: absolute; z-index: 5; width: 17%; pointer-events: none; opacity: 0; transform-origin: 75% 90%; }
.wg-mallet.swing { animation: wg-swing .4s ease-out; }
@keyframes wg-swing { 0% { opacity: 1; transform: rotate(-55deg); } 45% { opacity: 1; transform: rotate(25deg); } 100% { opacity: 0; transform: rotate(15deg); } }
/* pet pairs */
.wg-pairs { position: absolute; left: 5%; right: 5%; top: 15%; bottom: 4%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 3%; place-items: center; }
.wg-card { height: 100%; aspect-ratio: 377 / 560; max-width: 100%; min-width: 0; border: 0; padding: 0; background: none; perspective: 600px; border-radius: 10%; }
.wg-card .pin { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s cubic-bezier(.3,1.4,.5,1); transform-style: preserve-3d; }
.wg-card.up .pin, .wg-card.got .pin { transform: rotateY(180deg); }
.wg-card .pb, .wg-card .pf { position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10%; }
.wg-card .pb { object-fit: cover; filter: drop-shadow(0 4px 4px rgba(0,0,0,.3)); }
.wg-card .pf { transform: rotateY(180deg); background: var(--cream, #fff8ec); border: 3px solid #fff; box-shadow: 0 4px 8px rgba(0,0,0,.3); display: grid; place-items: center; overflow: hidden; }
.wg-card .pf img { width: 86%; height: 86%; object-fit: contain; }
.wg-card.got .pf { background: #dff7ea; border-color: #7fd8a8; }
.wg-card.no .pin { animation: wg-nope .4s; }
@keyframes wg-nope { 25% { translate: -6px 0; } 75% { translate: 6px 0; } }
/* star catch */
.wg-fall { position: absolute; left: 0; top: 0; width: 10%; pointer-events: none; z-index: 2; will-change: transform; }
.wg-fall.gold { filter: drop-shadow(0 0 12px #fff) drop-shadow(0 0 6px #ffd65c); width: 12%; }
.wg-nest { position: absolute; bottom: 2%; width: 24%; z-index: 3; translate: -50% 0; transition: left .12s linear; pointer-events: none; }
.wg-nest img.n { width: 100%; display: block; position: relative; z-index: 2; }
.wg-nest img.pal { position: absolute; width: 56%; left: 22%; bottom: 52%; z-index: 1; transition: transform .2s; }
.wg-nest.yum img.pal { transform: translateY(-14%) rotate(-6deg) scale(1.08); }
.wg-hint { position: absolute; left: 50%; top: 45%; translate: -50% -50%; z-index: 4; font: 700 1.2rem var(--round, system-ui); color: #fff; background: rgba(28,18,64,.7); padding: 8px 14px; border-radius: 14px; pointer-events: none; text-align: center; }
@media (prefers-reduced-motion: reduce) { .wg-hole .mole, .wg-card .pin { transition-duration: .01s; } }
/* old Android WebViews (before Chrome 88) don't know aspect-ratio: keep the game boards their shape */
@supports not (aspect-ratio: 1 / 1) {
  .wg-stage { height: 0; padding-top: 75%; }
  .wg-hole { height: 0; padding-top: 73%; }
  .wg-card { width: 66%; }
}
