/* Shared "sticker" look for fractionGates, multipleTrains and fractionMachine:
   full-bleed illustrated scenes, thick ink outlines, flat colours and hard drop shadows. */
.mpg-game {
    --ink: #2b2540;
    --paper: #fffaf0;
    --sun: #ffc83d;
    --mint: #2ec4a6;
    --berry: #ff5d73;
    --sky: #4aa8ff;
    --grape: #7b5cff;
    position: fixed;
    inset: 0;
    z-index: 1;
    box-sizing: border-box;
    padding-top: 68px;
    overflow: hidden;
    direction: rtl;
    color: var(--ink);
    font-family: 'Rubik','Heebo','Segoe UI',Arial,sans-serif;
    font-weight: 800;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
}
.mpg-game *, .mpg-game *::before, .mpg-game *::after { box-sizing: border-box; }

/* top strip: stage badge + stars on one side, task bubble on the other */
.mpg-top {
    position: relative;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px clamp(10px,2.4vw,26px) 8px;
}
.mpg-stage { display: flex; align-items: center; gap: 8px; }
.mpg-stage-num {
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border: 3px solid var(--ink); border-radius: 50%;
    background: var(--sun);
    box-shadow: 0 4px 0 var(--ink);
    font-size: 21px; line-height: 1;
}
.mpg-stage-name {
    padding: 4px 12px 5px;
    border: 3px solid var(--ink); border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 4px 0 var(--ink);
    font-size: clamp(13px,1.8vw,17px);
    white-space: nowrap;
}
.mpg-stars { display: flex; gap: 3px; margin-inline-start: 4px; direction: rtl; }
.mpg-stars i {
    width: 20px; height: 20px;
    background: rgba(43,37,64,.22);
    clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
    transition: transform .3s cubic-bezier(.3,1.8,.5,1), background .3s;
}
.mpg-stars i.on { background: var(--sun); transform: scale(1.25) rotate(-8deg); filter: drop-shadow(0 2px 0 var(--ink)); }

.mpg-task {
    position: relative;
    max-width: 52vw;
    padding: 7px 16px 8px;
    border: 3px solid var(--ink); border-radius: 18px;
    background: #fff;
    box-shadow: 0 4px 0 var(--ink);
    font-size: clamp(15px,2.3vw,22px);
    line-height: 1.15;
    text-align: center;
}
.mpg-task:after {
    content: ''; position: absolute; bottom: -12px; right: 22px;
    width: 18px; height: 14px;
    background: #fff;
    border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
    transform: skewX(35deg) rotate(12deg);
}
.mpg-task.pop { animation: mpgPop .4s ease; }

.mpg-scene { position: relative; flex: 1; min-height: 0; }

/* chunky sticker button */
.mpg-btn {
    display: inline-grid; place-items: center;
    min-width: 46px; min-height: 46px;
    padding: 4px 10px;
    border: 3px solid var(--ink); border-radius: 14px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 5px 0 var(--ink);
    font: 800 22px/1 'Rubik','Heebo',sans-serif;
    cursor: pointer;
    transition: transform .08s, box-shadow .08s, filter .2s;
}
.mpg-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.mpg-btn:focus-visible { outline: 4px solid var(--sky); outline-offset: 2px; }
.mpg-btn:disabled { filter: grayscale(1) opacity(.45); cursor: default; transform: none; box-shadow: 0 5px 0 var(--ink); }
.mpg-btn.sun { background: var(--sun); }
.mpg-btn.mint { background: var(--mint); color: #fff; }
.mpg-btn.grape { background: var(--grape); color: #fff; }
.mpg-btn.berry { background: var(--berry); color: #fff; }
.mpg-btn.sel { background: var(--grape); color: #fff; transform: translateY(2px); box-shadow: 0 3px 0 var(--ink); }

.mpg-card {
    border: 3px solid var(--ink); border-radius: 20px;
    background: #fff;
    box-shadow: 0 6px 0 var(--ink);
}
.mpg-frac { display: inline-grid; grid-template-rows: auto 4px auto; place-items: center; min-width: 1.2em; line-height: 1; direction: ltr; }
.mpg-frac > i { width: 110%; height: 4px; border-radius: 3px; background: currentColor; }
.mpg-frac > b { font: inherit; line-height: 1.04; }

.mpg-locked { pointer-events: none; }
.mpg-shake { animation: mpgShake .42s ease; }

/* floating feedback sticker (CurriculumMiniGame.toast) */
.cmg-toast {
    position: fixed; z-index: 40; left: 50%; top: 46%;
    padding: 8px 20px 10px;
    border: 3px solid #2b2540; border-radius: 16px;
    color: #2b2540; background: #ffc83d;
    box-shadow: 0 5px 0 #2b2540;
    font: 800 clamp(20px,3vw,28px)/1.1 'Rubik','Heebo',sans-serif;
    pointer-events: none;
    animation: mpgToast 1s ease forwards;
}
.cmg-toast.bad { background: #ff5d73; color: #fff; }

@keyframes mpgPop { 40% { transform: scale(1.12) rotate(-2deg); } }
@keyframes mpgShake { 20% { transform: translateX(-8px) rotate(-1deg); } 45% { transform: translateX(8px) rotate(1deg); } 70% { transform: translateX(-4px); } }
@keyframes mpgToast { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.5) rotate(-6deg); } 20%,70% { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(-3deg); } 100% { opacity: 0; transform: translate(-50%,-90%) scale(.9) rotate(-3deg); } }

@media (max-width: 680px) {
    .mpg-game { padding-top: 62px; }
    .mpg-top { flex-wrap: wrap; justify-content: center; padding: 4px 8px 10px; gap: 6px 10px; }
    .mpg-task { max-width: 94vw; order: 2; }
    .mpg-stage-num { width: 34px; height: 34px; font-size: 17px; }
    .mpg-stars i { width: 16px; height: 16px; }
    .mpg-btn { min-width: 40px; min-height: 40px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
    .mpg-game *, .mpg-game *::before, .mpg-game *::after, .cmg-toast { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
