/* Mini Mart Boss 3D - stage and in-game UI. Everything is scoped under #stage so site styles never leak in. */
html.pip-big, html.pip-big body { overflow: hidden; }
#stage { --green:#2fa66b; --green-d:#1d7a4d; --orange:#ff9f43; --ink:#23304f; --cream:#fff6e0; --dockh:108px;
  position: relative; width: min(100%, calc(78vh * 0.5625)); width: min(100%, calc(78svh * 0.5625)); aspect-ratio: 9 / 16; margin: 0 auto; overflow: hidden;
  border-radius: 14px; background: linear-gradient(#cfe9ff, #eaf6ff); color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Verdana, system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; line-height: 1.25; }
#stage.is-big { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; z-index: 99999; }
#stage *, #stage *::before, #stage *::after { box-sizing: border-box; }
#stage #app { position: absolute; inset: 0; }
#stage #app canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#stage #ui { position: absolute; inset: 0; pointer-events: none; }
#stage #ui button, #stage #ui .sheet, #stage #ui .screen, #stage #ui .dock { pointer-events: auto; }
#stage button { font-family: inherit; cursor: pointer; touch-action: manipulation; color: inherit; }
#stage button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
#stage [hidden] { display: none !important; }

#stage #loader { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: linear-gradient(#2fa66b, #8fe0b3); }
#stage .load-in { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff; text-shadow: 0 3px 0 rgba(10,60,35,.45); text-align: center; padding: 0 18px; }
#stage .load-in b { font-size: clamp(20px, 6vw, 30px); letter-spacing: 2px; }
#stage .spinner { width: 42px; height: 42px; border-radius: 50%; border: 6px solid rgba(255,255,255,.35); border-top-color: #ffd23f; animation: mmspin .8s linear infinite; }
@keyframes mmspin { to { transform: rotate(360deg); } }
#stage #ctxlost { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(20,32,70,.88); color: #fff; font-weight: 700; }

/* HUD */
#stage .hud { position: absolute; left: 0; right: 0; top: 0; padding: max(8px, env(safe-area-inset-top)) 8px 0; pointer-events: none; }
#stage .hud-top { display: flex; gap: 6px; align-items: stretch; }
#stage .chip { background: rgba(35,48,79,.72); color: #fff; border-radius: 12px; padding: 4px 10px; display: flex; flex-direction: column; justify-content: center; min-height: 44px; min-width: 0; }
#stage .chip.cash { flex: 1 1 auto; }
#stage .chip b { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#stage .chip span { font-size: 11px; opacity: .85; white-space: nowrap; }
#stage .chip.rep { flex-direction: row; align-items: center; gap: 6px; }
#stage .face { font-style: normal; font-weight: 800; font-size: 15px; }
#stage .bar { display: block; width: 34px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.25); overflow: hidden; opacity: 1; }
#stage .bar > span { display: block; height: 100%; background: #6ee7a0; width: 60%; }
#stage .chip.star b { font-size: 16px; }
#stage .icon { width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: rgba(35,48,79,.72); color: #fff; font-weight: 800; font-size: 16px; letter-spacing: 1px; }
#stage .hud-sub { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
#stage .evchip, #stage .goalchip { padding: 4px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; color: #fff; background: #ff5a3c; }
#stage .goalchip { background: rgba(47,166,107,.92); }
#stage .hint-bubble { position: absolute; left: 12px; right: 12px; top: 112px; background: var(--cream); color: var(--ink); border-radius: 12px; padding: 8px 12px; font-size: 14px; font-weight: 700; text-align: center; box-shadow: 0 3px 0 rgba(0,0,0,.25); pointer-events: none; }
#stage .toast { position: absolute; left: 14px; right: 14px; top: 70px; z-index: 6; background: rgba(35,48,79,.92); color: #fff; padding: 8px 12px; border-radius: 12px; font-size: 14px; text-align: center; pointer-events: none; }
#stage .floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#stage .float { position: absolute; transform: translate(-50%, -50%); font-weight: 800; font-size: 15px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.45); white-space: nowrap; animation: mmfloat 1s ease-out forwards; }
#stage .float.coin { color: #ffe27a; }
#stage .float.bad { color: #ff9a8a; font-size: 13px; }
@keyframes mmfloat { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -48px; } }

/* bottom dock */
#stage .dock { position: absolute; left: 0; right: 0; bottom: 0; height: var(--dockh); padding: 6px 8px max(6px, env(safe-area-inset-bottom)); background: rgba(35,48,79,.82); display: flex; flex-direction: column; gap: 6px; z-index: 4; }
#stage .actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: 1 1 auto; }
#stage .act { border: 0; border-radius: 10px; background: #ffd23f; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 2px 2px; box-shadow: 0 3px 0 #b8941a; }
#stage .act b { font-size: 14px; } #stage .act small { font-size: 10px; opacity: .8; }
#stage .act.promo { background: #ff8a5c; box-shadow: 0 3px 0 #b8512e; }
#stage .act.pulse { animation: mmpulse .35s; }
@keyframes mmpulse { 50% { transform: scale(1.08); } }
#stage .tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#stage .tab { border: 0; border-radius: 10px; background: rgba(255,255,255,.14); color: #fff; font-weight: 700; font-size: 14px; min-height: 44px; }
#stage .tab.on { background: var(--green); }

/* sheets */
#stage .sheet { position: absolute; left: 0; right: 0; bottom: var(--dockh); max-height: 46%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; background: rgba(255,246,224,.97); border-radius: 16px 16px 0 0; padding: 8px 10px 10px; z-index: 3; box-shadow: 0 -4px 14px rgba(0,0,0,.25); }
#stage .sheet-x { position: sticky; top: 0; float: right; min-height: 44px; min-width: 64px; border: 0; border-radius: 10px; background: #e5dcc0; font-weight: 700; z-index: 1; }
#stage h4 { font-size: 15px; margin: 4px 0 6px; line-height: 44px; }
#stage .row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid rgba(35,48,79,.12); clear: both; }
#stage .row .rt { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
#stage .row b { font-size: 14px; white-space: pre; } #stage .row .lv { font-size: 11px; color: #5a6684; font-weight: 700; }
#stage .row small { flex-basis: 100%; font-size: 11px; color: #5a6684; }
#stage .row small.now { color: #1d7a4d; font-weight: 700; }
#stage .row.dept-row { background: rgba(47,166,107,.1); border-radius: 8px; padding-left: 6px; }
#stage .buy { flex: 0 0 auto; min-width: 84px; min-height: 44px; border: 0; border-radius: 10px; background: #cfd5e3; color: #6a7389; font-weight: 800; font-size: 14px; padding: 0 10px; box-shadow: 0 3px 0 #a8afc2; }
#stage .buy.ready { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-d); }
#stage .buy:disabled { cursor: default; }
#stage .card-s { padding: 4px 0 8px; font-size: 13px; clear: both; } #stage .card-s p { margin: 3px 0; }
#stage .card-s .buy { width: 100%; margin-top: 6px; }
#stage .mis { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; margin: 4px 0; border-radius: 8px; background: rgba(35,48,79,.07); }
#stage .mis.ok { background: rgba(47,166,107,.25); } #stage .mis i { font-style: normal; font-weight: 800; }
#stage .muted { color: #6a7389; font-size: 12px; }

/* full screens */
#stage .screen { position: absolute; inset: 0; z-index: 10; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; background: rgba(24,40,38,.78); display: flex; padding: 14px; }
#stage .card { margin: auto; width: 100%; max-width: 340px; background: var(--cream); border-radius: 18px; padding: 16px 14px; box-shadow: 0 6px 0 rgba(0,0,0,.25); text-align: center; }
#stage .card h2.logo { font-size: 30px; line-height: 1.05; color: var(--green-d); text-shadow: 0 2px 0 #fff; margin-bottom: 4px; }
#stage .card h3 { font-size: 20px; margin-bottom: 4px; }
#stage .sub { font-size: 13px; color: #4a5775; margin: 4px 0 8px; }
#stage .chipline { font-size: 12px; font-weight: 800; color: var(--green-d); margin: 4px 0 8px; }
#stage .bigcash { font-size: 30px; font-weight: 900; color: var(--green-d); margin: 6px 0; }
#stage .stars { font-size: 34px; color: #f5b301; letter-spacing: 4px; }
#stage .big { display: block; width: 100%; min-height: 48px; margin: 8px 0 0; border: 0; border-radius: 12px; background: #e5dcc0; color: var(--ink); font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 #b9ae8c; }
#stage .big.primary { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-d); }
#stage .big.danger { background: #e5624b; color: #fff; box-shadow: 0 3px 0 #a53b28; }
#stage .big.mini { width: auto; min-width: 74px; margin: 0; min-height: 44px; font-size: 14px; padding: 0 12px; }
#stage .big:disabled { opacity: .5; cursor: default; }
#stage .srow { display: flex; gap: 8px; align-items: center; justify-content: space-between; text-align: left; padding: 8px 0; border-top: 1px solid rgba(35,48,79,.12); }
#stage .srow b { font-size: 14px; display: block; } #stage .srow b i { font-style: normal; font-size: 11px; color: #5a6684; }
#stage .srow small { display: block; font-size: 11px; color: #5a6684; margin-top: 2px; }
#stage .srow.locked { opacity: .6; } #stage .srow.daily { background: rgba(255,159,67,.2); border-radius: 10px; padding: 8px; }
#stage .tick { font-size: 12px; font-weight: 800; color: var(--green-d); }
#stage .opts { display: flex; gap: 4px; }

@media (max-height: 520px) { #stage { --dockh: 96px; } #stage .hint-bubble { top: 96px; } }
@media (prefers-reduced-motion: reduce) { #stage .float, #stage .act.pulse, #stage .spinner { animation-duration: .01s; } }

.mm-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: .75rem 0 .25rem; }
.mm-bar .btn { min-height: 44px; min-width: 44px; }
.mm-keys { text-align: center; font-size: .8rem; color: #64748b; margin: .25rem 0 0; }
.mm-guide { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.6; }
.mm-guide h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.mm-guide h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.mm-guide p { margin-bottom: .5rem; font-size: .95rem; }

/* next purchase chip and ready badges */
#stage .nextchip { position: relative; overflow: hidden; min-height: 44px; padding: 4px 12px; border: 0; border-radius: 12px; font-size: 12px; font-weight: 800; color: #fff; background: rgba(35,48,79,.78); text-align: left; }
#stage .nextchip::before { content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: var(--p, 0%); background: #ffd23f; transition: width .3s; }
#stage .nextchip.ready { background: #1d7a4d; }
#stage .nextchip[hidden] { display: none; }
#stage .tab { position: relative; }
#stage .tab.rdy::after { content: ""; position: absolute; top: 5px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: #ffd23f; box-shadow: 0 0 0 2px rgba(35,48,79,.9); animation: mmrdy 1.4s ease-in-out infinite; }
@keyframes mmrdy { 50% { transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { #stage .tab.rdy::after { animation: none; } #stage .nextchip::before { transition: none; } }

/* Full screen on phones (shell immersive and native): the board fills the stage under the dock. */
body:has(.pip-bar) .mm-bar { display: none; }
html.pip-immersive .game-wrap { display: flex; flex-direction: column; }
html.pip-immersive .game-wrap > .mm-bar, html.pip-immersive .game-wrap > .mm-keys, html.pip-immersive .game-wrap > noscript { display: none; }
html.pip-immersive #stage { flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; aspect-ratio: auto; height: auto; margin: 0; border-radius: 0; }
html.pip-immersive #stage .dock { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
@media (orientation: landscape) and (max-height: 520px) {
  html.pip-immersive #stage { --dockh: 92px; }
  html.pip-immersive #stage .sheet { max-height: 62%; }
  html.pip-immersive #stage .hint-bubble { top: 52px; }
}

/* Finish: soft vignette and a warm light wash over the 3D scene, drawn once by the compositor. */
#stage #app::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 38%, rgba(255,244,214,.10) 0%, rgba(255,244,214,0) 55%, rgba(20,40,60,.22) 100%); }
#stage .act { transition: transform .12s ease-out, box-shadow .12s ease-out; }
#stage .act:active, #stage .tab:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
