/* My Doodle World mini-game kit: the frame, buttons and the cheer. Self-hosted font, no third parties. */
@font-face { font-family: "MDW Fredoka"; src: url(fonts/Fredoka-Bold.ttf) format("truetype"); font-weight: 400 800; font-display: swap; }
:root {
  --ink: #1A1A1A; --paper: #FFFDF7; --cream: #FFF4DE; --red: #E8452C; --orange: #FF8A3D; --yellow: #FFC531;
  --green: #3BB273; --teal: #2EC4B6; --blue: #3A86FF; --purple: #9B6BDF; --pink: #FF7AB6;
  --zone: #FFE7A3; --hit: 64px;
}
html, body { margin: 0; height: 100%; }
[hidden] { display: none !important; }
body.mg-page { background: var(--paper); color: var(--ink); font-family: "MDW Fredoka", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.mg { position: fixed; inset: 0; display: flex; flex-direction: column; background: radial-gradient(circle at 50% 0%, #fff 0, var(--paper) 55%), var(--paper); }
.mg-bar { display: flex; align-items: center; gap: 12px; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
.mg-title { flex: 1; margin: 0; font-size: clamp(18px, 3.4vw, 28px); line-height: 1.1; font-weight: 700; text-align: center; letter-spacing: .01em; }
.mg-rounds { display: flex; gap: 6px; }
.mg-dot { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; }
.mg-dot.is-done { background: var(--yellow); }
.mg-dot.is-now { transform: scale(1.25); }
.mg-btn { width: var(--hit); height: var(--hit); min-width: var(--hit); border-radius: 50%; border: 4px solid var(--ink); background: #fff; color: var(--ink);
  display: grid; place-items: center; padding: 10px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .12s ease, box-shadow .12s ease; font: inherit; }
.mg-btn svg { width: 100%; height: 100%; }
.mg-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.mg-btn:focus-visible, .mg-target:focus-visible { outline: 5px solid var(--blue); outline-offset: 3px; }
.mg-btn--big { width: 84px; height: 84px; }
.mg-btn--next { background: var(--green); color: #fff; }
.mg-btn--again { background: var(--yellow); }
.mg-btn--home { background: #fff; }
.mg-stage { position: relative; flex: 1; min-height: 0; margin: 0 max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.mg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mg-card { background: #fff; border: 4px solid var(--ink); border-radius: 28px; box-shadow: 0 6px 0 var(--ink); }

/* a speech-free prompt: a picture of what to do */
.mg-ask { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 8px; background: #fff; border: 4px solid var(--ink); border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink); font-size: 22px; font-weight: 700; }
.mg-ask img { width: 46px; height: 46px; object-fit: contain; }

/* the cheer */
.mg-cheer { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(255, 253, 247, .82); animation: mg-fade .3s ease both; }
.mg-cheer__card { position: relative; background: #fff; border: 5px solid var(--ink); border-radius: 36px; box-shadow: 0 8px 0 var(--ink);
  padding: 22px 26px 24px; display: grid; justify-items: center; gap: 10px; width: min(92vw, 420px); box-sizing: border-box; animation: mg-pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.mg-cheer__dood { height: 120px; width: auto; animation: mg-bob 1.6s ease-in-out infinite; }
.mg-cheer__h { margin: 0; font-size: 34px; font-weight: 700; }
.mg-stars { display: flex; gap: 8px; }
.mg-star { width: 64px; height: 64px; display: block; fill: #EDE7DA; opacity: .55; }
.mg-star.is-on { fill: var(--yellow); opacity: 1; animation: mg-starpop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.mg-cheer__row { display: flex; gap: 16px; margin-top: 6px; }
.mg-cheer__sticker { display: flex; align-items: center; gap: 10px; background: var(--cream); border: 3px dashed var(--ink); border-radius: 18px; padding: 6px 14px 6px 6px; font-size: 18px; }
.mg-cheer__sticker img { width: 54px; height: 54px; object-fit: contain; animation: mg-wiggle 1.2s ease-in-out 2; }
.mg-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mg-confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border: 2px solid var(--ink); border-radius: 3px; animation: mg-fall 2.6s ease-in forwards; transform: rotate(var(--r)); }

/* shared bits for templates */
.mg-sparkle { position: absolute; width: 90px; height: 90px; margin: -45px 0 0 -45px; pointer-events: none; border-radius: 50%;
  border: 5px dashed var(--yellow); animation: mg-ring .6s ease-out forwards; }
.mg-ripple { position: absolute; width: 60px; height: 60px; margin: -30px 0 0 -30px; pointer-events: none; border-radius: 50%; border: 4px solid rgba(26,26,26,.25); animation: mg-ring .5s ease-out forwards; }
.mg-hint { animation: mg-hint 1.2s ease-in-out 3; }
.mg-hand { position: absolute; width: 70px; height: 70px; pointer-events: none; z-index: 20; animation: mg-handtap 1.1s ease-in-out 3 both; }

@keyframes mg-fade { from { opacity: 0; } }
@keyframes mg-pop { from { transform: scale(.6); opacity: 0; } }
@keyframes mg-bob { 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes mg-starpop { 0% { transform: scale(0) rotate(-40deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes mg-wiggle { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes mg-fall { to { transform: translateY(110vh) rotate(calc(var(--r) + 540deg)); } }
@keyframes mg-ring { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@keyframes mg-hint { 50% { transform: scale(1.12); filter: drop-shadow(0 0 10px var(--yellow)); } }
@keyframes mg-handtap { 0%, 100% { transform: translate(10px, 10px); } 50% { transform: translate(0, 0) scale(.92); } }
@keyframes mg-shake { 25% { transform: translateX(-6px) rotate(-3deg); } 75% { transform: translateX(6px) rotate(3deg); } }

/* calm motion: the device asked for less movement (or the grown-ups turned it on) */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; } }
.mg-calm *, .mg-calm *::before, .mg-calm *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }

/* the scene box shared by Find it, Match the shadow and Sticker scene */
.mg-scene { position: relative; box-sizing: border-box; margin: 0 auto; border: 4px solid var(--ink); border-radius: 26px; overflow: hidden; box-shadow: 0 6px 0 var(--ink); }
.mg-scene__art, .mg-scene__decor { position: absolute; transform: translate(-50%, -50%); height: auto; pointer-events: none; -webkit-user-drag: none; }

/* who's talking (the round's host, or the game's resident, or Dood): their face on the speaker button in the bar (tap: say
   it again). Their line is only heard (and told to a screen reader): never words on screen */
.mg-btn--say { position: relative; padding: 4px; overflow: visible; background: #FFF4DE; }
.mg-btn--say .mg-host { position: absolute; left: 6px; top: 5px; width: calc(100% - 12px); height: calc(100% - 10px); object-fit: contain; pointer-events: none; }
.mg-say__badge { position: absolute; right: -8px; bottom: -8px; width: 30px; height: 30px; box-sizing: border-box; padding: 4px; border-radius: 50%;
  background: var(--yellow); border: 3px solid var(--ink); display: grid; place-items: center; pointer-events: none; }
.mg-say__badge svg { width: 100%; height: 100%; }
.mg-btn--show { background: #DDF4FF; padding: 8px; }
.mg-btn--show.is-on { background: var(--yellow); }
/* a phone: no room for the title next to four buttons, and nothing depends on reading it (it stays for screen readers) */
@media (max-width: 560px) {
  .mg-bar { gap: 8px; }
  .mg-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mg-rounds { margin-left: auto; }
}

/* Show me: the helper hand (Grok's static/world/hands/<pose>.png, or the code-drawn stand-in) does one move on the board.
   It is placed in code so its fingertip (46% across, 12% down) touches the target. */
.mg-showhand { position: fixed; left: 0; top: 0; z-index: 58; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  filter: drop-shadow(0 6px 0 rgba(26, 26, 26, .22)); will-change: transform; }
.mg-showhand.is-in { opacity: 1; }
.mg-showhand > svg, .mg-showhand > img { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 46% 12%; transition: transform .18s ease; }
.mg-showhand.is-down > svg, .mg-showhand.is-down > img { transform: scale(.88) translateY(4%); }
.mg-showghost { position: fixed; z-index: 57; pointer-events: none; transform: translate(-50%, -50%) rotate(-4deg); height: auto; object-fit: contain;
  filter: drop-shadow(0 8px 0 rgba(26, 26, 26, .25)); }
.mg-showghost.is-down { transform: translate(-50%, -50%); filter: drop-shadow(0 0 10px var(--yellow)); }
.mg-showarrow { position: fixed; left: 0; top: 0; z-index: 56; pointer-events: none; overflow: visible; }
.mg-demo-lifted { opacity: .3 !important; }
.mg-demo-fit { filter: drop-shadow(0 0 10px var(--yellow)) drop-shadow(0 0 4px var(--yellow)); }
.mg-demo-found img { filter: drop-shadow(0 0 0 #FFC531) drop-shadow(0 0 10px #FFC531); }
.mg-demo-off { opacity: 0 !important; }
.mg-demo-press { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.mg-calm .mg-showhand, .mg-calm .mg-showhand > svg, .mg-calm .mg-showhand > img { transition: none; }

/* a letter drawn in the kit's font (art "text:s"; docs/learning.md): crayon colour, ink outline, house style */
.mg-glyph { display: block; font-family: "MDW Fredoka", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif; font-weight: 700;
  line-height: 1; text-align: center; color: var(--ink); -webkit-text-stroke: .045em var(--ink); paint-order: stroke fill;
  pointer-events: none; user-select: none; }
