#mb{--ink:#0c1013;--panel:#141b20;--line:#26333b;--brass:#c9964a;--beam:#ffb347;--text:#e6ecee;--mute:#93a3ac;
  color:var(--text);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom)}
#mb *{box-sizing:border-box}
.mb-bar{display:flex;align-items:center;gap:.4rem;margin:0 0 .5rem}
.mb-bar button,.mb-tilt{min-height:44px;min-width:44px;padding:0 .8rem;border:1px solid var(--line);border-radius:6px;background:var(--panel);color:var(--text);font:600 .85rem system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.mb-bar button:active,.mb-tilt:active{background:#1d2830}
#mb-lvl{flex:1;text-align:center;font-size:.8rem;color:var(--mute);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mb-stage{position:relative;width:min(100%,calc((100svh - 230px) * 100 / 170));min-width:240px;margin:0 auto;aspect-ratio:100/170;background:var(--ink);border:1px solid var(--line);border-radius:6px;overflow:hidden}
#mb-canvas{display:block;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;outline:none}
.mb-ui{position:absolute;inset:0;display:none;flex-direction:column;align-items:center;justify-content:center;gap:.65rem;padding:1rem;background:rgba(10,13,16,.93);overflow-y:auto;text-align:center}
.mb-ui.on{display:flex}
.mb-ui h1{margin:0;font-size:2rem;letter-spacing:.02em;color:var(--beam)}
.mb-ui h2{margin:0;font-size:1.5rem;color:var(--text)}
.mb-ui .sub,.mb-ui .stat{margin:0;color:var(--mute);font-size:.9rem;line-height:1.4}
.mb-ui .big{margin:0;font-size:2.4rem;font-weight:700;color:var(--beam)}
.mb-btn{min-height:48px;width:min(100%,260px);border:1px solid var(--line);border-radius:6px;background:var(--panel);color:var(--text);font:600 1rem system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.mb-btn.primary{background:var(--beam);border-color:var(--beam);color:#1a1209}
.mb-btn:focus-visible,.mb-bar button:focus-visible,.mb-lv:focus-visible,.mb-tilt:focus-visible{outline:2px solid var(--beam);outline-offset:2px}
.mb-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:.4rem;width:100%}
.mb-lv{min-height:52px;border:1px solid var(--line);border-radius:6px;background:var(--panel);color:var(--text);cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font:inherit;touch-action:manipulation}
.mb-lv:disabled{opacity:.4;cursor:default}
.mb-lv small{font-size:.6rem;color:var(--mute)}
.mb-dots{display:inline-flex;gap:3px}
.mb-dots i{width:8px;height:8px;border-radius:50%;border:1px solid #4a5a64;display:block}
.mb-dots i.on{background:var(--beam);border-color:var(--beam)}
.mb-tilt{display:block;width:min(100%,calc((100svh - 230px) * 100 / 170));min-width:240px;margin:.5rem auto 0;min-height:52px;font-size:1rem;color:var(--beam)}
@media (prefers-reduced-motion:reduce){#mb *{transition:none!important;animation:none!important}}

.mb-logo{width:min(70%,220px);height:auto;margin-bottom:-.2rem}
.mb-lv.cur{border-color:var(--beam);box-shadow:0 0 0 1px var(--beam) inset}
.mb-pop .mb-dots{gap:8px}
.mb-pop .mb-dots i{width:20px;height:20px;border-width:2px}
.mb-pop .mb-dots i.on{animation:mbpop .5s cubic-bezier(.2,1.6,.4,1) both}
.mb-pop .mb-dots i.on:nth-child(2){animation-delay:.18s}
.mb-pop .mb-dots i.on:nth-child(3){animation-delay:.36s}
@keyframes mbpop{0%{transform:scale(0);opacity:0}100%{transform:scale(1);opacity:1}}
.mb-ui.on>*{animation:mbin .25s ease-out both}
@keyframes mbin{0%{opacity:0;transform:translateY(6px)}100%{opacity:1;transform:none}}
.mb-ui{padding-top:max(1rem,env(safe-area-inset-top))}
.mb-ui{justify-content:flex-start}.mb-ui>:first-child{margin-top:auto}.mb-ui>:last-child{margin-bottom:auto}

/* Full screen (shell stage = .game-wrap): fill the stage, board as large as its aspect allows. */
html.pip-immersive .game-wrap,html.pip-native .game-wrap,.game-wrap:fullscreen{--mbh:calc(var(--pip-vvh,100dvh) - var(--pip-dock-h,52px) - 8px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 132px)}
html.pip-immersive .game-wrap,html.pip-native .game-wrap{padding:0;max-width:none}
html.pip-immersive .game-wrap #mb,html.pip-native .game-wrap #mb{padding:0 4px;min-height:0}
html.pip-immersive .mb-stage,html.pip-native .mb-stage,.game-wrap:fullscreen .mb-stage{min-width:0;width:min(100%,calc(var(--mbh) * 100 / 170))}
html.pip-immersive .mb-tilt,html.pip-native .mb-tilt,.game-wrap:fullscreen .mb-tilt{min-width:0;width:min(100%,calc(var(--mbh) * 100 / 170))}
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive .game-wrap,html.pip-native .game-wrap{--mbh:calc(var(--pip-vvh,100dvh) - 8px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))}
  html.pip-immersive .game-wrap #mb,html.pip-native .game-wrap #mb{display:grid;grid-template-columns:auto minmax(130px,220px);grid-template-rows:auto 1fr;gap:.5rem 1rem;justify-content:center;align-items:start}
  html.pip-immersive .mb-stage,html.pip-native .mb-stage{grid-column:1;grid-row:1/3;margin:0}
  html.pip-immersive .mb-bar,html.pip-native .mb-bar{grid-column:2;grid-row:1;flex-direction:column;align-items:stretch;margin:0}
  html.pip-immersive .mb-tilt,html.pip-native .mb-tilt{grid-column:2;grid-row:2;width:100%;align-self:stretch;margin:0;min-height:96px}
}
