/* =========================================================
   Mundo de Blocos — coletar, criar e construir
   (src/minigames/block-world.js)
   ========================================================= */

.game-stage--blocks { background: #5caeff; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.game-stage--blocks .game-canvas { image-rendering: pixelated; }

/* z-index 1: abaixo da barra do topo do palco (pontos, som, tela cheia, pausa, sair). */
.mb-hud { position: absolute; inset: 0; z-index: 1; pointer-events: none; color: #f6f8ff; font-family: var(--font-body); }
.mb-hud button, .mb-hud input, .mb-panel { pointer-events: auto; }
.mb-icon { width: 28px; height: 28px; image-rendering: pixelated; pointer-events: none; }
.mb-icon--big { width: 40px; height: 40px; }
.mb-icon--tiny { width: 18px; height: 18px; }

/* ---------- topo ---------- */
.mb-top {
  position: absolute; top: calc(var(--stage-hud, 52px) + 2px); left: 8px; right: 8px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.mb-left { display: grid; gap: 5px; justify-items: start; min-width: 0; }
.mb-hearts { display: flex; gap: 1px; padding: 3px 8px; border-radius: var(--r-pill); background: rgba(10,14,40,.55); font-size: .9rem; line-height: 1; }
.mb-heart.is-empty { opacity: .55; }
.mb-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: min(64vw, 340px);
  padding: 4px 10px; border-radius: var(--r-pill); color: #f6f8ff;
  background: rgba(10,14,40,.66); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(6px);
  font: 700 .78rem var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mb-chip--quest { cursor: pointer; background: rgba(60,40,110,.72); border-color: rgba(255,214,90,.55); }
.mb-chip--quest span { overflow: hidden; text-overflow: ellipsis; }
/* Troca de visão: sempre à mão, as duas opções escritas (a escolhida acesa). */
.mb-viewswitch {
  display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--r-pill);
  background: rgba(10,14,40,.66); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(6px);
}
.mb-viewswitch__opt {
  min-height: 32px; padding: 3px 11px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: transparent; color: #dbe4ff; font: 800 .78rem var(--font-display); white-space: nowrap;
  transition: background var(--t-fast, .12s), color var(--t-fast, .12s), transform var(--t-fast, .12s);
}
.mb-viewswitch__opt:active { transform: scale(.95); }
.mb-viewswitch__opt.is-on { background: #58e6ff; color: #082033; box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); cursor: default; }
.mb-viewswitch__opt:focus-visible { outline: 2px solid #ffe27a; outline-offset: 1px; }
.mb-viewfade { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; animation: mb-viewfade .42s ease-out forwards; }
@keyframes mb-viewfade { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .mb-viewfade { animation-duration: .01s; } }
.mb-right { display: grid; gap: 6px; justify-items: end; flex: none; }
.mb-siderow { display: flex; gap: 6px; }
.mb-round {
  width: 42px; height: 42px; border-radius: 12px; border: 2px solid rgba(255,255,255,.3);
  background: rgba(10,14,40,.66); font-size: 1.15rem; cursor: pointer; backdrop-filter: blur(6px);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); transition: transform var(--t-fast, .12s);
}
.mb-round:active { transform: scale(.94); }
.mb-round.is-on { background: rgba(88,230,255,.5); }

/* ---------- baixo: andar, pular e a barra ---------- */
.mb-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 6px; padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
.mb-controls { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.mb-pad { display: flex; gap: 8px; align-items: flex-end; }
.mb-key {
  width: 58px; height: 58px; border-radius: 16px; border: 2px solid rgba(255,255,255,.4);
  background: rgba(10,14,40,.42); color: #fff; font: 800 1.5rem var(--font-display); cursor: pointer;
  backdrop-filter: blur(4px); touch-action: none; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25);
}
.mb-key.is-on { background: rgba(88,230,255,.55); transform: scale(.95); }
.mb-key--small { width: 46px; height: 46px; font-size: 1.2rem; }
.mb-key--jump { width: 66px; height: 66px; background: rgba(34,197,94,.5); border-color: #bbf7d0; }
.mb-action {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 14px 4px 6px; margin-bottom: 8px;
  border-radius: var(--r-pill); border: 2px solid #ffe08a; background: rgba(120,60,10,.75); color: #fff;
  font: 800 .9rem var(--font-display); cursor: pointer;
}
.mb-hotbar {
  display: grid; grid-template-columns: repeat(9, minmax(0, 46px)); gap: 3px; justify-content: center;
  margin: 0 auto; padding: 4px; border-radius: 12px; background: rgba(10,14,40,.62); border: 1px solid rgba(255,255,255,.18);
}
.mb-slot {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: 0;
  border-radius: 8px; border: 2px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); cursor: pointer;
}
.mb-slot.is-selected { border-color: #ffe27a; background: rgba(255,226,122,.28); box-shadow: 0 0 0 2px rgba(255,226,122,.35); }
.mb-slot__n { position: absolute; right: 2px; bottom: 0; font: 800 .72rem var(--font-display); color: #fff; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.mb-slot--bar .mb-icon { width: 70%; height: 70%; }

/* ---------- visão de cima: joystick ---------- */
.game-stage--blocks-top { background: #2f6fb0; }
.mb-stick {
  position: relative; flex: none; width: 118px; height: 118px; border-radius: 50%; touch-action: none; cursor: pointer;
  border: 2px solid rgba(255,255,255,.4); background: radial-gradient(circle, rgba(10,14,40,.2), rgba(10,14,40,.5));
  backdrop-filter: blur(4px); pointer-events: auto;
}
.mb-stick[hidden] { display: none; }
.mb-stick.is-on { border-color: #bbf7d0; }
.mb-stick__knob {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #bbf7d0 60%, #22c55e); box-shadow: 0 4px 10px rgba(0,0,0,.4);
  pointer-events: none; transition: transform .06s linear;
}
.mb-pad[hidden] { display: none; }
.mb-field__title { margin: 2px 0 -4px; width: 100%; text-align: left; font: 700 .82rem var(--font-display); }

/* ---------- avisos ---------- */
.mb-toast {
  position: absolute; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; width: max-content; max-width: min(92%, 420px); padding: 8px 14px;
  border-radius: 16px; background: rgba(10,14,40,.84); border: 2px solid #9fffe0; backdrop-filter: blur(8px);
  font: 700 .88rem var(--font-display); box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.mb-toast.is-showing { animation: mb-pop .4s cubic-bezier(.2,1.5,.4,1); }
@keyframes mb-pop { from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.88); } }
.mb-fade { position: absolute; inset: 0; background: #05060f; opacity: 0; transition: opacity .6s ease; }
.mb-fade.is-on { opacity: .92; }

.mb-emotes { position: absolute; right: 8px; top: calc(var(--stage-hud, 52px) + 108px); display: grid; gap: 4px; }
.mb-emote { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: rgba(10,14,40,.55); font-size: 1.1rem; cursor: pointer; }

/* ---------- painéis ---------- */
.mb-panel {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 56px 10px 12px;
  background: rgba(6,10,26,.55); backdrop-filter: blur(3px); overflow-y: auto;
}
.mb-panel__card {
  display: grid; gap: 10px; justify-items: center; width: min(100%, 560px); max-height: 100%; padding: 14px;
  border-radius: 20px; color: #f6f8ff; text-align: center; overflow: hidden;
  background: linear-gradient(180deg, rgba(58,44,104,.97), rgba(22,20,52,.97));
  border: 2px solid rgba(255,255,255,.2); box-shadow: 0 18px 50px rgba(0,0,0,.5), inset 0 -4px 0 rgba(0,0,0,.2);
}
.mb-panel--bag .mb-panel__card, .mb-panel--quests .mb-panel__card { align-content: start; justify-items: stretch; height: 100%; grid-template-rows: auto auto 1fr; }
.mb-panel--quests .mb-panel__card { grid-template-rows: auto 1fr; }
.mb-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mb-panel__title { margin: 0; font: 800 1.2rem var(--font-display); }
.mb-panel__sub { margin: 0; font-size: .86rem; color: #d6d9ee; }
.mb-panel__hint { margin: 4px 0; font-size: .78rem; color: #c9cde6; text-align: center; }
.mb-panel__body { display: grid; gap: 8px; align-content: start; overflow-y: auto; min-height: 0; padding-bottom: 6px; }
.mb-panel__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.mb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  border-radius: 12px; border: 2px solid rgba(255,255,255,.3); background: rgba(255,255,255,.14);
  color: #fff; font: 700 .95rem var(--font-display); cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2);
}
.mb-btn:active { transform: scale(.96); }
.mb-btn:disabled { opacity: .45; cursor: default; }
.mb-btn--go { background: linear-gradient(135deg, #86efac, #22c55e); color: #052e16; border-color: #bbf7d0; font-size: 1.02rem; }
.mb-btn--danger { background: rgba(239,68,68,.75); border-color: #fecaca; }
.mb-btn--ghost { background: transparent; }
.mb-btn--small { min-height: 38px; padding: 4px 12px; font-size: .85rem; }

.mb-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.mb-tab {
  flex: none; min-height: 36px; padding: 4px 12px; border-radius: var(--r-pill); border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #e5e7f6; font: 700 .82rem var(--font-display); cursor: pointer;
}
.mb-tab.is-on { background: #ffe27a; color: #3a2a00; border-color: #fff3b8; }

.mb-inv { display: grid; gap: 4px; }
.mb-inv__label { margin: 4px 0 0; font: 700 .74rem var(--font-display); color: #c9cde6; text-align: left; }
.mb-inv__row { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.mb-inv__row--bar .mb-slot { background: rgba(255,226,122,.12); }
.mb-inv .mb-icon { width: 72%; height: 72%; }
.mb-slot.is-bar.is-selected, .mb-inv .mb-slot.is-selected { border-color: #58e6ff; box-shadow: 0 0 0 3px rgba(88,230,255,.45); }

.mb-recipes { display: grid; gap: 6px; }
.mb-recipe {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); text-align: left; opacity: .72;
}
.mb-recipe.is-ok { opacity: 1; background: rgba(134,239,172,.14); border-color: rgba(134,239,172,.45); }
.mb-recipe__out { position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: rgba(0,0,0,.25); }
.mb-recipe__info { display: grid; gap: 4px; min-width: 0; }
.mb-recipe__name { font: 800 .9rem var(--font-display); }
.mb-recipe__ins { display: flex; flex-wrap: wrap; gap: 4px; }
.mb-ing { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px 1px 2px; border-radius: var(--r-pill); background: rgba(239,68,68,.22); font: 700 .72rem var(--font-display); }
.mb-ing.is-have { background: rgba(134,239,172,.25); }
.mb-ing--station { padding: 2px 8px; }

.mb-allgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; }
.mb-allgrid .mb-icon { width: 72%; height: 72%; }

.mb-quests { display: grid; gap: 10px; text-align: left; }
.mb-chapter { display: grid; gap: 4px; }
.mb-chapter__title { margin: 0; font: 800 .95rem var(--font-display); color: #ffe27a; }
.mb-quest { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; padding: 6px 8px 8px; border-radius: 10px; background: rgba(255,255,255,.07); font-size: .84rem; overflow: hidden; }
.mb-quest.is-done { background: rgba(134,239,172,.16); color: #dcfce7; }
.mb-quest__pts { font: 800 .78rem var(--font-display); color: #ffe27a; }
.mb-quest__bar { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p, 0) * 100%); background: #58e6ff; }

/* ---------- começo: mundos ---------- */
.mb-intro__art { font-size: 3.4rem; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); }
.mb-intro__art--spin { animation: mb-spin 2.4s linear infinite; }
@keyframes mb-spin { to { transform: rotate(360deg); } }
.mb-worlds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.mb-world {
  display: grid; gap: 6px; align-content: space-between; justify-items: center; min-height: 128px; padding: 10px 6px;
  border-radius: 16px; background: linear-gradient(180deg, #5fbf4a 0 16px, #8a5a34 16px); border: 2px solid rgba(0,0,0,.35);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.25);
}
.mb-world.is-empty { background: rgba(255,255,255,.07); border-style: dashed; border-color: rgba(255,255,255,.3); }
.mb-world__name { margin-top: 12px; font: 800 .92rem var(--font-display); text-shadow: 0 2px 3px rgba(0,0,0,.5); word-break: break-word; }
.mb-world__mode { font: 700 .74rem var(--font-display); color: #f1f5ff; }
.mb-world__actions { display: flex; gap: 4px; }
.mb-world .mb-btn { min-height: 38px; padding: 4px 10px; font-size: .85rem; }
.mb-tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; text-align: left; font-size: .84rem; }
.mb-tips li { padding: 6px 10px; border-radius: 12px; background: rgba(255,255,255,.08); }
.mb-field { display: grid; gap: 4px; width: 100%; text-align: left; font: 700 .82rem var(--font-display); }
.mb-input { min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 2px solid rgba(255,255,255,.3); background: rgba(0,0,0,.25); color: #fff; font: 700 1rem var(--font-body); }
.mb-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.mb-mode { display: grid; gap: 4px; padding: 10px; border-radius: 14px; border: 2px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #fff; text-align: left; cursor: pointer; font-size: .78rem; }
.mb-mode strong { font: 800 1rem var(--font-display); }
.mb-mode.is-on { border-color: #ffe27a; background: rgba(255,226,122,.18); }
.mb-team { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mb-team__chip { padding: 3px 10px; border-radius: var(--r-pill); border: 2px solid; font: 700 .82rem var(--font-display); background: rgba(255,255,255,.08); }
.mb-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
.mb-stat { display: grid; gap: 1px; padding: 8px 4px; border-radius: 14px; background: rgba(255,255,255,.1); }
.mb-stat strong { font: 800 1.2rem var(--font-display); color: #ffe27a; }
.mb-stat span { font-size: .66rem; color: #cbd5e1; }

@media (max-width: 420px) {
  .mb-key { width: 52px; height: 52px; }
  .mb-key--jump { width: 60px; height: 60px; }
  .mb-hotbar { grid-template-columns: repeat(9, minmax(0, 1fr)); width: 100%; }
  .mb-worlds { grid-template-columns: 1fr; }
  .mb-world { min-height: 0; grid-template-columns: 1fr auto; justify-items: start; align-items: center; background: linear-gradient(90deg, #5fbf4a 0 10px, #8a5a34 10px); padding-left: 18px; }
  .mb-world__name { margin-top: 0; }
  .mb-world__actions, .mb-world.is-empty .mb-btn { grid-column: 2; grid-row: 1 / span 2; }
  .mb-summary { grid-template-columns: repeat(2, 1fr); }
  .mb-modes { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .mb-toast.is-showing, .mb-intro__art--spin { animation: none; }
}
