:root {
  --cream: #fff7e6;
  --cream2: #ffeccc;
  --ink: #3b2a22;
  --ink2: #6b5244;
  --red: #e5262b;
  --red2: #b3161b;
  --green: #4cc35a;
  --green2: #2c8f3a;
  --blue: #3d8bfd;
  --blue2: #2459b8;
  --gold: #ffd23f;
  --gold2: #d99a00;
  --purple: #8a5cf6;
  --pink: #ff7ab6;
  --night: #2b1d3a;
  --shadow: 0 6px 0 rgba(59, 42, 34, 0.35), 0 14px 30px rgba(0, 0, 0, 0.25);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a1424; }
body {
  font-family: Fredoka, 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--ink);
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}
#app { position: fixed; inset: 0; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#bubbles, #hud, #ui, #toasts, #touch { position: absolute; inset: 0; pointer-events: none; }
#ui > * , #hud > *, #bubbles > * { pointer-events: auto; }
#fade { position: absolute; inset: 0; background: #120c1a; opacity: 0; pointer-events: none; transition: opacity 0.35s ease; z-index: 50; }
#fade.on { opacity: 1; }
.hidden { display: none !important; }

/* ---------------- botões e painéis ---------------- */
.btn {
  font: inherit; font-weight: 600; font-size: 18px;
  border: 3px solid var(--ink); border-radius: 16px;
  background: var(--cream); color: var(--ink);
  padding: 10px 18px; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transform: translateY(0); transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; touch-action: manipulation;
}
.btn:hover { filter: brightness(1.06); }
.btn:active, .btn.on { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.red { background: var(--red); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.gold { background: var(--gold); }
.btn.purple { background: var(--purple); color: #fff; }
.btn.pink { background: var(--pink); color: #fff; }
.btn.small { font-size: 15px; min-height: 38px; padding: 6px 12px; border-radius: 12px; }
.btn.big { font-size: 22px; min-height: 60px; padding: 12px 26px; }
.btn.focus { outline: 4px solid var(--gold); outline-offset: 2px; }

.panel {
  background: var(--cream); border: 4px solid var(--ink); border-radius: 26px;
  box-shadow: var(--shadow); padding: 18px 20px; position: relative;
}
.panel h2 { margin: 0 0 10px; font-size: 26px; text-align: center; }
.panel h3 { margin: 8px 0; font-size: 19px; }
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 12, 28, 0.55); padding: calc(10px + var(--safe-t)) calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l));
  z-index: 20; animation: fadein 0.2s ease;
}
.overlay.clear { background: transparent; pointer-events: none; }
.overlay.clear > * { pointer-events: auto; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
.pop { animation: pop 0.28s ease-out both; }
.close-x { position: absolute; top: -14px; right: -14px; width: 44px; height: 44px; border-radius: 50%; padding: 0; min-height: 0; font-size: 22px; z-index: 2; }

/* ---------------- ecrã inicial ---------------- */
.title-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.logo { text-align: center; line-height: 0.95; filter: drop-shadow(0 6px 0 rgba(0,0,0,0.25)); }
.logo .l1 { font-size: clamp(40px, 8vw, 84px); font-weight: 700; color: var(--red); -webkit-text-stroke: 3px #fff; paint-order: stroke fill; letter-spacing: 1px; }
.logo .l1 span:nth-child(5n+1) { color: #e5262b; } .logo .l1 span:nth-child(5n+2) { color: #3d8bfd; } .logo .l1 span:nth-child(5n+3) { color: #ffcc1a; }
.logo .l1 span:nth-child(5n+4) { color: #4cc35a; } .logo .l1 span:nth-child(5n) { color: #e5262b; }
.logo .l2 { font-size: clamp(18px, 3.4vw, 34px); font-weight: 700; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; margin-top: 6px; }
.menu-col { display: flex; flex-direction: column; gap: 10px; width: min(360px, 90vw); }
.menu-col .btn { width: 100%; }
.menu-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.version { position: absolute; bottom: calc(6px + var(--safe-b)); right: calc(10px + var(--safe-r)); color: rgba(255,255,255,0.7); font-size: 12px; }

.worlds { width: min(640px, 94vw); max-height: 84vh; display: flex; flex-direction: column; }
.worlds .list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 4px 8px; touch-action: pan-y; }
.world-item { display: flex; align-items: center; gap: 12px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 8px 10px; }
.world-item canvas { width: 64px; height: 64px; background: linear-gradient(#bfe6ff, #e8f7ff); border-radius: 12px; border: 2px solid var(--ink); flex: none; }
.world-item .info { flex: 1; min-width: 0; }
.world-item .name { font-size: 20px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-item .meta { font-size: 14px; color: var(--ink2); }
.world-item .acts { display: flex; gap: 6px; }
.empty { text-align: center; color: var(--ink2); padding: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 14px; }
.field input[type=text] { font: inherit; font-size: 22px; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); width: 100%; user-select: text; -webkit-user-select: text; }
.err { color: var(--red2); font-weight: 600; min-height: 22px; }

.chars { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.char-card { background: #fff; border: 4px solid var(--ink); border-radius: 22px; width: 170px; padding: 8px; cursor: pointer; text-align: center; transition: transform 0.12s; box-shadow: 0 5px 0 var(--ink); }
.char-card:hover { transform: translateY(-4px); }
.char-card.sel { background: #fff3c4; outline: 5px solid var(--gold); }
.char-card canvas { width: 150px; height: 170px; display: block; margin: 0 auto; }
.char-card .cn { font-size: 24px; font-weight: 700; }
.pad-row { align-items: flex-start; }
.pad-box { flex: 1; min-width: 0; font-size: 14px; }
.pad-status { font-weight: 700; }
.pad-help { color: #6b5244; margin: 4px 0; font-size: 13px; }
.pad-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.pad-wiz { text-align: center; width: min(420px, 92vw); }
.pad-wiz-msg { font-size: 20px; margin: 10px 0 14px; line-height: 1.5; }
.pad-wiz-msg b { font-size: 26px; color: var(--red2); }
.keypick { text-align: center; margin: 6px 0 2px; }
.keypick .keyrow { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.keybtn { min-width: 52px; font-size: 20px; font-weight: 700; background: #fff; }
.keybtn.other { font-size: 15px; }
.keybtn.sel { background: var(--gold); outline: 3px solid var(--ink); }
@media (max-height: 520px) { .char-card { width: 132px; } .char-card canvas { width: 116px; height: 128px; } .char-card .cn { font-size: 19px; } }

.options .row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 10px 0; font-size: 18px; }
.options input[type=range] { width: 160px; accent-color: var(--red); }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; }
.seg button { font: inherit; border: 0; background: #fff; padding: 6px 10px; cursor: pointer; font-weight: 600; color: var(--ink); }
.seg button.on { background: var(--gold); }

/* ---------------- HUD ---------------- */
#hud { z-index: 5; }
.hud-top { position: absolute; top: calc(8px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud-left, .hud-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; pointer-events: none; }
.chip { background: rgba(255, 247, 230, 0.92); border: 3px solid var(--ink); border-radius: 999px; padding: 2px 12px 2px 6px; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 6px; box-shadow: 0 3px 0 rgba(59,42,34,0.4); height: 38px; }
.chip .ic { font-size: 20px; width: 26px; text-align: center; }
.chip.moons .ic { color: #ffd23f; text-shadow: 0 0 6px #fff59a; }
.lvl { display: flex; align-items: center; gap: 6px; }
.lvl .badge { width: 44px; height: 44px; border-radius: 50%; background: var(--red); color: #fff; border: 3px solid var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; line-height: 0.9; box-shadow: 0 3px 0 rgba(59,42,34,0.4); }
.lvl .badge small { font-size: 10px; } .lvl .badge b { font-size: 18px; }
.xpbar { width: 130px; height: 16px; background: rgba(255,255,255,0.85); border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; position: relative; }
.xpbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #7ee06f, #3fbf4f); transition: width 0.3s; }
.xpbar span { position: absolute; inset: 0; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.hearts { display: flex; gap: 2px; font-size: 22px; filter: drop-shadow(0 2px 0 rgba(59,42,34,0.6)); }
.hud-btn { pointer-events: auto; width: 46px; height: 46px; border-radius: 14px; padding: 0; font-size: 22px; min-height: 0; }
.hud-kingdom { position: absolute; left: 50%; top: calc(54px + var(--safe-t)); transform: translateX(-50%); color: #fff; font-weight: 700; font-size: 15px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; white-space: nowrap; opacity: 0.95; pointer-events: none; }
.hud-timer { position: absolute; left: 50%; top: calc(8px + var(--safe-t)); transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 14px; padding: 4px 14px; font-weight: 700; font-size: 22px; pointer-events: none; }
.hud-timer.warn { background: var(--red); animation: pulse 0.5s infinite alternate; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.08); } }
.hud-goal { position: absolute; left: 50%; top: calc(52px + var(--safe-t)); transform: translateX(-50%); background: rgba(255,247,230,0.95); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 12px; font-weight: 600; font-size: 15px; white-space: nowrap; pointer-events: none; }
.hud-air { position: absolute; left: 50%; bottom: calc(18% + var(--safe-b)); transform: translateX(-50%); width: 120px; height: 14px; border: 3px solid var(--ink); border-radius: 8px; background: #fff; overflow: hidden; }
.hud-air i { display: block; height: 100%; background: #6fd3ff; }
.boss-bar { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); width: min(420px, 70vw); text-align: center; color: #fff; font-weight: 700; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; font-size: 18px; pointer-events: none; }
.boss-bar .bar { height: 18px; margin-top: 4px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; overflow: hidden; }
.boss-bar .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff5a5a, #e5262b); transition: width 0.25s; }

/* ---------------- toque ---------------- */
#touch { z-index: 6; display: none; }
#touch.show { display: block; }
.t-stick { position: absolute; left: calc(18px + var(--safe-l)); bottom: calc(18px + var(--safe-b)); width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,0.18); border: 3px solid rgba(255,255,255,0.55); pointer-events: auto; touch-action: none; }
.t-knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(255,255,255,0.75); border: 3px solid rgba(59,42,34,0.6); pointer-events: none; }
.t-btns { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); width: 210px; height: 190px; pointer-events: none; }
.t-btn { position: absolute; border-radius: 50%; border: 3px solid rgba(59,42,34,0.7); background: rgba(255,255,255,0.7); font: inherit; font-weight: 700; color: var(--ink); pointer-events: auto; touch-action: none; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.t-btn.on { background: rgba(255, 210, 63, 0.95); transform: scale(0.94); }
.t-jump { width: 92px; height: 92px; right: 0; bottom: 0; font-size: 38px; background: rgba(229, 38, 43, 0.82); color: #fff; }
.t-throw { width: 70px; height: 70px; right: 104px; bottom: 6px; font-size: 30px; }
.t-interact { width: 74px; height: 74px; right: 52px; bottom: 104px; font-size: 26px; background: rgba(76, 195, 90, 0.9); color: #fff; }
.t-interact small { font-size: 10px; margin-top: 2px; max-width: 66px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.t-pause { position: absolute; top: calc(8px + var(--safe-t)); right: calc(10px + var(--safe-r)); width: 46px; height: 46px; border-radius: 14px; border: 3px solid var(--ink); background: var(--cream); font-weight: 700; pointer-events: auto; display: none; }

/* ---------------- toasts e balões ---------------- */
#toasts { z-index: 30; display: flex; flex-direction: column; align-items: center; padding-top: calc(70px + var(--safe-t)); gap: 6px; }
.toast { background: rgba(255,247,230,0.97); border: 3px solid var(--ink); border-radius: 16px; padding: 8px 16px; font-weight: 600; font-size: 17px; box-shadow: 0 4px 0 rgba(59,42,34,0.4); animation: pop 0.25s ease-out; max-width: 86vw; text-align: center; }
.toast.big { font-size: 24px; background: var(--gold); }
.toast.bad { background: #ffd9d6; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: all 0.4s; }
.bubble { position: absolute; transform: translate(-50%, -100%); background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 8px 14px; font-size: 17px; font-weight: 500; max-width: min(320px, 70vw); box-shadow: 0 4px 0 rgba(59,42,34,0.35); z-index: 8; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -12px; margin-left: -10px; border: 10px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
.bubble .who { font-weight: 700; color: var(--red2); font-size: 14px; }
.bubble.choice { cursor: pointer; background: #fff7d1; font-weight: 600; transition: transform 0.12s, background 0.12s; animation: pop 0.3s ease-out both; }
.bubble.choice:hover, .bubble.choice.focus { background: var(--gold); transform: translate(-50%, -100%) scale(1.06); }
#bubbles > .choice-row { pointer-events: none; }
.choice-row { position: absolute; left: 50%; bottom: calc(28px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 16px; width: min(900px, 94vw); z-index: 9; }
.choice-row .bubble.choice { position: relative; transform: none; max-width: min(300px, 44vw); pointer-events: auto; }
.choice-row .bubble.choice:hover, .choice-row .bubble.choice.focus { transform: scale(1.06); }
.choice-row .bubble::after { bottom: auto; top: -12px; border-top: 0; border-bottom: 10px solid var(--ink); }
.bubble.think { border-style: dashed; }
.sign-box { position: absolute; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); width: min(620px, 92vw); z-index: 12; }
.sign-box .panel { padding: 14px 18px 12px; font-size: 19px; }
.sign-box .who { font-weight: 700; color: var(--red2); margin-bottom: 4px; }
.sign-box .next { text-align: right; font-size: 14px; color: var(--ink2); margin-top: 6px; }
.sign-box .opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------------- cartas de nível ---------------- */
.levelup { flex-direction: column; gap: 14px; }
.levelup .title { color: #fff; font-size: clamp(30px, 6vw, 52px); font-weight: 700; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; animation: pop 0.4s ease-out both; text-align: center; }
.levelup .sub { color: #fff; font-size: 18px; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; font-weight: 600; }
.cards { display: flex; gap: clamp(14px, 4vw, 40px); }
.card {
  width: clamp(150px, 26vw, 210px); height: clamp(230px, 42vw, 310px); max-height: 62vh; gap: 4px; border: 5px solid var(--ink); border-radius: 22px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 14px 10px; color: #fff;
  box-shadow: 0 8px 0 var(--ink); animation: cardin 0.55s cubic-bezier(.2,1.4,.4,1) both; position: relative; overflow: hidden;
  transition: transform 0.15s;
}
.card:hover, .card.focus { transform: translateY(-8px) rotate(-1.5deg); }
.card.speed { background: linear-gradient(160deg, #46b8ff, #2459b8); }
.card.jump { background: linear-gradient(160deg, #7ee06f, #2c8f3a); animation-delay: 0.12s; }
.card .cpic { width: 66%; aspect-ratio: 1; height: auto; flex: none; filter: drop-shadow(0 5px 0 rgba(0,0,0,0.25)); }
.card.jump .cpic { animation: hop 0.8s ease-in-out infinite; }
@media (max-height: 460px) {
  .levelup { gap: 6px; } .levelup .title { font-size: 28px; -webkit-text-stroke-width: 3px; } .levelup .sub { font-size: 14px; }
  .card { height: 64vh; padding: 6px 8px; } .card .cpic { width: 42%; } .card .cname { font-size: 15px; }
  .card .clvl { font-size: 11px; } .card .ceff { font-size: 11px; padding: 2px 6px; border-width: 2px; }
  .levelup .none-card { font-size: 14px; padding: 4px 12px; min-height: 0; }
}
@keyframes hop { 0%, 100% { transform: translateY(8px) scale(1, 0.97); } 50% { transform: translateY(-16px); } }
.card .clvl { font-size: 14px; font-weight: 700; background: rgba(0,0,0,0.25); border-radius: 10px; padding: 2px 8px; }
.card.maxed { filter: grayscale(0.7); opacity: 0.75; cursor: default; }
.card.maxed:hover { transform: none; }
.levelup .none-card { background: #fff; font-size: 17px; padding: 8px 18px; align-self: center; }
.levelup .none-card.focus { outline: 4px solid var(--gold); }
.card .cico { font-size: clamp(56px, 10vw, 84px); filter: drop-shadow(0 4px 0 rgba(0,0,0,0.25)); animation: bob 1.2s ease-in-out infinite alternate; }
.card .cname { font-size: clamp(17px, 3vw, 23px); line-height: 1.05; font-weight: 700; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-align: center; }
.card .ceff { background: rgba(255,255,255,0.92); color: var(--ink); border-radius: 12px; padding: 4px 8px; font-weight: 600; font-size: 13px; text-align: center; border: 3px solid var(--ink); }
.card::before { content: ''; position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,0.45) 50%, transparent 60%); animation: shine 2.4s infinite; }
.card.chosen { animation: chosen 0.6s ease-in forwards; }
.card.gone { animation: gone 0.4s ease-in forwards; }
@keyframes cardin { from { transform: translateY(80px) rotateY(90deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bob { to { transform: translateY(-8px); } }
@keyframes shine { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
@keyframes chosen { 40% { transform: scale(1.15); } 100% { transform: scale(0.2) translateY(-200px); opacity: 0; } }
@keyframes gone { to { transform: translateY(60px); opacity: 0; } }

/* ---------------- lojas ---------------- */
.shop { width: min(960px, 96vw); height: min(640px, 92vh); display: flex; flex-direction: column; padding: 14px; }
.shop-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.shop-head h2 { margin: 0; flex: 1; text-align: left; font-size: 24px; }
.shop-body { flex: 1; display: flex; gap: 12px; min-height: 0; }
.shop-preview { width: 34%; min-width: 180px; background: linear-gradient(#cfeeff, #fff3d9); border: 3px solid var(--ink); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 8px; }
.shop-preview canvas { width: 100%; flex: 1; min-height: 0; }
.shop-preview .pname { font-weight: 700; font-size: 18px; text-align: center; }
.shop-preview .perk { font-size: 14px; text-align: center; color: var(--ink2); min-height: 36px; }
.shop-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; align-content: start; padding: 4px; touch-action: pan-y; }
.item { background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 6px; text-align: center; cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.item canvas { width: 92px; height: 92px; }
.item .iname { font-size: 13px; font-weight: 600; line-height: 1.1; min-height: 29px; display: flex; align-items: center; }
.item .price { font-weight: 700; font-size: 15px; }
.item.sel { outline: 4px solid var(--gold); background: #fff8d6; }
.item.owned .price { color: var(--green2); }
.item.equipped::after { content: '✓'; position: absolute; top: 4px; right: 6px; background: var(--green); color: #fff; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.item.locked { opacity: 0.55; }
.item .tag { position: absolute; top: 4px; left: 4px; font-size: 11px; background: var(--ink); color: #fff; border-radius: 8px; padding: 1px 6px; }
.shop-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.shop-foot .msg { flex: 1; font-weight: 600; min-width: 140px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs .btn { min-height: 36px; font-size: 15px; padding: 4px 12px; }
.tabs .btn.on { background: var(--gold); }
@media (max-width: 700px), (max-height: 480px) {
  .shop-body { flex-direction: row; }
  .shop-preview { width: 30%; min-width: 120px; }
  .item canvas { width: 70px; height: 70px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}

/* ---------------- pausa ---------------- */
.pause { width: min(440px, 92vw); }
.pause .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 8px 0 14px; font-size: 16px; }
.pause .stats b { font-size: 18px; }
.mapsel { width: min(900px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
.mapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; padding: 4px; touch-action: pan-y; }
.kcard { border: 3px solid var(--ink); border-radius: 16px; padding: 8px; cursor: pointer; text-align: center; color: #fff; font-weight: 700; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 4px 0 var(--ink); position: relative; }
.kcard .kn { -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; font-size: 17px; }
.kcard .km { font-size: 14px; background: rgba(255,255,255,0.9); color: var(--ink); border-radius: 10px; padding: 2px 6px; }
.kcard.locked { filter: grayscale(1) brightness(0.7); cursor: not-allowed; }
.kcard.here { outline: 4px solid var(--gold); }
.chal-list { overflow-y: auto; max-height: 56vh; display: flex; flex-direction: column; gap: 6px; touch-action: pan-y; }
.chal { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 10px; }
.chal .ci { font-size: 24px; } .chal .ct { flex: 1; } .chal .ct b { display: block; } .chal .ct small { color: var(--ink2); }
.chal.done { background: #e9ffe3; }

/* ---------------- construção ---------------- */
.build-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l)); background: rgba(255,247,230,0.96); border-top: 4px solid var(--ink); display: flex; flex-direction: column; gap: 6px; z-index: 9; }
.build-bar .row { display: flex; gap: 6px; align-items: center; overflow-x: auto; touch-action: pan-x; padding-bottom: 2px; }
.build-bar .bi { flex: none; width: 70px; background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 2px; text-align: center; cursor: pointer; position: relative; }
.build-bar .bi canvas { width: 60px; height: 50px; }
.build-bar .bi small { display: block; font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build-bar .bi .n { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border: 2px solid var(--ink); border-radius: 10px; font-size: 12px; font-weight: 700; padding: 0 5px; }
.build-bar .bi.sel { background: #fff3c4; outline: 3px solid var(--gold); }
.build-bar .bi.zero { opacity: 0.45; }
.build-top { position: absolute; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 9; flex-wrap: wrap; justify-content: center; }

/* ---------------- Peach ---------------- */
.happy-meter { position: absolute; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%); background: rgba(255,247,230,0.95); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px; display: flex; gap: 8px; align-items: center; font-weight: 700; z-index: 7; }
.happy-meter .hb { width: 160px; height: 14px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; overflow: hidden; }
.happy-meter .hb i { display: block; height: 100%; background: linear-gradient(90deg, #ffb3d1, #ff4f8b); transition: width 0.4s; }

@media (max-height: 460px) {
  .chip { height: 32px; font-size: 15px; } .lvl .badge { width: 38px; height: 38px; } .xpbar { width: 90px; }
  .t-stick { width: 128px; height: 128px; } .t-jump { width: 80px; height: 80px; } .t-throw { width: 60px; height: 60px; right: 90px; } .t-interact { width: 64px; height: 64px; bottom: 90px; right: 44px; }
  .panel { padding: 12px 14px; } .panel h2 { font-size: 22px; }
}

/* ---------------- 3D: arranque, joystick, botão agachar ---------------- */
#boot { position: absolute; inset: 0; z-index: 60; background: radial-gradient(circle at 50% 40%, #ff6b6b, #c41e25 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity 0.5s; }
#boot.gone { opacity: 0; pointer-events: none; }
#boot .boot-logo { font-size: clamp(40px, 9vw, 80px); font-weight: 700; color: #fff; -webkit-text-stroke: 3px #3b2a22; paint-order: stroke fill; }
#boot .boot-bar { width: min(320px, 70vw); height: 16px; border-radius: 10px; background: rgba(255,255,255,0.3); border: 3px solid #3b2a22; overflow: hidden; }
#boot .boot-bar i { display: block; height: 100%; width: 5%; background: #ffd23f; transition: width 0.3s; }
#boot .boot-msg { color: #fff; font-weight: 600; }
.joy-base { position: fixed; z-index: 6; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255,255,255,0.18); border: 3px solid rgba(255,255,255,0.6); pointer-events: none; display: none; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,0.8); border: 3px solid rgba(59,42,34,0.6); }
.t-crouch { width: 64px; height: 64px; right: 112px; bottom: 84px; font-size: 26px; }
.t-btns { width: 230px; height: 220px; }
.t-interact { right: 6px; bottom: 112px; }
#touch.show .t-pause { display: none; }
.hint-keys { position: absolute; left: calc(10px + var(--safe-l)); bottom: calc(8px + var(--safe-b)); color: #fff; font-size: 13px; font-weight: 600; -webkit-text-stroke: 2.5px rgba(40,25,30,0.8); paint-order: stroke fill; pointer-events: none; opacity: 0.85; }
