.mg{--ink:#16120d;--panel:#221b13;--brass:#d9ae52;--cream:#f1e6c8;--mute:#a8987a;--g0:#38b59a;--g1:#e0563f;--g2:#7f9bff;background:var(--ink);color:var(--cream);border-radius:14px;padding:12px;font-family:ui-serif,Georgia,'Times New Roman',serif;border:2px solid #3a2f1e;box-shadow:0 0 0 2px #0c0a07}
.mg button{font:inherit;color:var(--cream);background:#2d2418;border:2px solid #5a4824;border-radius:10px;min-height:46px;min-width:46px;padding:0 14px;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.mg button:focus-visible{outline:3px solid var(--cream);outline-offset:2px}
.mg button:active:not(:disabled){transform:translateY(1px);background:#3b2f1e}
.mg button:disabled{opacity:.45;cursor:not-allowed}
.mg h2{font-size:2rem;letter-spacing:.04em;color:var(--brass);text-align:center;margin:.2rem 0}
.mg h3{font-size:.95rem;color:var(--brass);margin:14px 0 6px;letter-spacing:.06em;text-transform:uppercase}
.mg-sub{text-align:center;color:var(--mute);font-size:.95rem;line-height:1.4;margin:0 0 12px}
.mg-big{display:block;width:100%;min-height:58px!important;font-size:1.25rem!important;background:var(--brass)!important;color:#241a08!important;border-color:#f3d27a!important;font-weight:700}
.mg-row{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.mg-row button{flex:1 1 140px}
#mg-stats{font-size:.85rem;color:var(--mute);line-height:1.4;margin:6px 0}
#mg-levels{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}
#mg-levels h3{grid-column:1/-1;display:flex;justify-content:space-between;align-items:baseline}
#mg-levels h3 span{font-size:.72rem;color:var(--mute);letter-spacing:.04em;text-transform:none}
.mg-lv{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:4px 0!important;min-height:52px!important}
.mg-lv b{font-size:1.05rem}
.mg-lv i{font-style:normal;font-size:.62rem;color:var(--brass);letter-spacing:.08em}
.mg-lv.done{border-color:var(--brass)}
.mg-lv.gold{background:#3b2f14}
.mg-lv.next{border-color:var(--cream);box-shadow:0 0 0 2px var(--brass);animation:mgPulse 1.6s ease-in-out infinite}
@keyframes mgPulse{50%{box-shadow:0 0 0 5px rgba(217,174,82,.25)}}
.mg-logo{display:block;margin:2px auto 0;width:84px;height:84px}
#mg-hintbtn[hidden]{display:none}
#mg-res-stars .pop{display:inline-block;animation:mgStar .45s cubic-bezier(.2,1.6,.4,1) both}
@keyframes mgStar{from{transform:scale(.2) rotate(-40deg);opacity:0}to{transform:none;opacity:1}}
.mg-hud{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.mg-hud .mg-stat{flex:1;text-align:center;font-size:.9rem;line-height:1.25}
.mg-hud .mg-stat small{display:block;color:var(--mute);font-size:.75rem}
#mg-level{font-weight:700;color:var(--brass)}
.mg-field{position:relative;display:flex;justify-content:center;touch-action:none;user-select:none;-webkit-user-select:none}
#mg-canvas{display:block;border-radius:10px;touch-action:none;cursor:pointer;max-width:100%}
#mg-hint{margin:8px 0 0;min-height:2.6em;font-size:.9rem;color:var(--cream);line-height:1.3;text-align:center}
.mg-ctl{display:flex;gap:8px;margin-top:8px}
.mg-ctl{flex-wrap:wrap}
.mg-ctl button{flex:1 1 0;padding:0 4px;font-size:.9rem}
.mg-logo .arm{transform-origin:50px 78px;animation:mgSwing 1.6s ease-in-out infinite alternate}
@keyframes mgSwing{from{transform:rotate(-24deg)}to{transform:rotate(24deg)}}
#mg-sw-help{font-size:.8rem;color:var(--mute);text-align:center;margin:8px 0 0}
.mg{padding-bottom:calc(12px + env(safe-area-inset-bottom))}
.mg-result{position:absolute;inset:0;background:rgba(14,11,7,.88);border-radius:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:18px;text-align:center;animation:mgIn .22s ease-out}
.mg-result[hidden]{display:none}
.mg-result h2{margin:0}
.mg-result[data-kind=lose] h2{color:#ef7a64}
#mg-res-stars{font-size:2.2rem;color:var(--brass);letter-spacing:.2em;min-height:1.2em}
#mg-res-text{font-size:.95rem;line-height:1.4;color:var(--cream);max-width:26ch}
.mg-result .mg-big{max-width:240px}
.mg-result button[hidden]{display:none}
@keyframes mgIn{from{opacity:0;transform:scale(.97)}to{opacity:1;transform:none}}
.mg-learn{font-size:.9rem;line-height:1.5;color:#3a3a3a;margin-top:1rem}
@media (prefers-reduced-motion:reduce){.mg-result,.mg-lv.next,#mg-res-stars .pop{animation:none}.mg-logo .arm{animation:none!important}.mg button{transition:none}}
.mg{background:radial-gradient(120% 80% at 50% 0,#2a2114 0,var(--ink) 62%)}
.mg-big{box-shadow:0 3px 0 #8a6a28,0 6px 14px rgba(0,0,0,.35)}
.mg-result{background:radial-gradient(circle at 50% 40%,rgba(48,36,20,.94),rgba(12,9,5,.94));backdrop-filter:blur(2px)}
#mg-title[hidden],#mg-play[hidden]{display:none!important}
/* full screen: the stage is .game-wrap */
html.pip-immersive .game-wrap,html.pip-native .game-wrap,.game-wrap:fullscreen{display:flex;flex-direction:column;overflow:hidden;padding:6px}
html.pip-immersive .mg-learn,html.pip-native .mg-learn,html.pip-immersive .playyard-ad,html.pip-immersive .below-content,html.pip-immersive .bottom-ad-section,html.pip-immersive .hub-bar,html.pip-immersive #mg-sw-help,html.pip-native #mg-sw-help,.game-wrap:fullscreen .mg-learn{display:none!important}
html.pip-immersive .mg,html.pip-native .mg,.game-wrap:fullscreen .mg{flex:1;min-height:0;display:flex;flex-direction:column;border-radius:10px;padding:8px 8px calc(8px + env(safe-area-inset-bottom))}
html.pip-immersive #mg-play:not([hidden]),html.pip-native #mg-play:not([hidden]),.game-wrap:fullscreen #mg-play:not([hidden]){flex:1;min-height:0;display:flex;flex-direction:column}
html.pip-immersive #mg-title:not([hidden]),html.pip-native #mg-title:not([hidden]),.game-wrap:fullscreen #mg-title:not([hidden]){flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain}
html.pip-immersive .mg-field,html.pip-native .mg-field,.game-wrap:fullscreen .mg-field{flex:1;min-height:0;align-items:center;overflow:hidden}
html.pip-immersive #mg-hint,html.pip-native #mg-hint{margin:4px 0 0;min-height:1.3em;font-size:.85rem}
html.pip-immersive .mg-logo{width:56px;height:56px}
@media (orientation:landscape) and (max-height:520px){
html.pip-immersive #mg-play:not([hidden]),html.pip-native #mg-play:not([hidden]){display:grid;grid-template-columns:minmax(0,1fr) 210px;grid-template-rows:auto 1fr auto;gap:6px 10px}
html.pip-immersive #mg-play .mg-field,html.pip-native #mg-play .mg-field{grid-column:1;grid-row:1/4}
html.pip-immersive #mg-play .mg-hud,html.pip-native #mg-play .mg-hud{grid-column:2;grid-row:1;margin:0}
html.pip-immersive #mg-play #mg-hint,html.pip-native #mg-play #mg-hint{grid-column:2;grid-row:2;overflow:hidden}
html.pip-immersive #mg-play .mg-ctl,html.pip-native #mg-play .mg-ctl{grid-column:2;grid-row:3;margin:0}
}
html.pip-immersive .game-wrap,html.pip-native .game-wrap{padding:0}
html.pip-immersive .mg,html.pip-native .mg{padding:2px 2px calc(2px + env(safe-area-inset-bottom));border-width:0;border-radius:0;box-shadow:none}
html.pip-immersive .mg-hud,html.pip-native .mg-hud{margin-bottom:2px}
@media (orientation:landscape) and (max-height:520px){
html.pip-immersive #mg-play:not([hidden]),html.pip-native #mg-play:not([hidden]){grid-template-columns:minmax(0,1fr) 190px;gap:4px 8px}
html.pip-immersive .mg,html.pip-native .mg{padding:0 4px calc(0px + env(safe-area-inset-bottom))}
}
