/* Pokopaldea — UI ao estilo Pokopia: pílulas roxas, cartões creme, botões de brinquedo. */
:root {
  --ink: #3a3266;
  --ink-soft: #6b6399;
  --purple: #5b50d6;
  --purple-dark: #3f369e;
  --lavender: #cfc8ff;
  --cream: #fffaf0;
  --paper: #ffffff;
  --green: #45c46b;
  --green-dark: #2f9a50;
  --yellow: #ffd23f;
  --yellow-dark: #e0a800;
  --red: #ff5a5f;
  --red-dark: #c93a3f;
  --blue: #3fa9f5;
  --blue-dark: #2479c2;
  --shadow: 0 6px 0 rgba(40, 30, 90, .18), 0 10px 24px rgba(40, 30, 90, .18);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --u: min(1vw, 1vh * 1.4); /* unidade responsiva */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd3f4; }
body {
  font-family: 'Fredoka', system-ui, sans-serif; color: var(--ink);
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none;
}
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 62%, rgba(40, 30, 90, .22) 100%); }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui .passthru { pointer-events: none; }
#ui .passthru > * { pointer-events: auto; }
#fade { position: fixed; inset: 0; background: #fffaf0; opacity: 0; pointer-events: none; transition: opacity .35s ease; z-index: 50; }
#fade.on { opacity: 1; pointer-events: auto; }

/* ---------- Boot ---------- */
#boot { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: linear-gradient(#8fd3f4, #c9efff 60%, #d8f5c4); transition: opacity .5s; }
#boot.gone { opacity: 0; pointer-events: none; }
.boot-logo { font-size: 64px; font-weight: 700; color: #fff; letter-spacing: 1px;
  -webkit-text-stroke: 3px var(--purple-dark); paint-order: stroke fill; text-shadow: 0 6px 0 var(--purple-dark); }
.boot-bar { width: min(320px, 70vw); height: 18px; border-radius: 99px; background: rgba(255,255,255,.7); border: 3px solid var(--purple-dark); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 5%; background: linear-gradient(90deg, var(--green), #9be15d); transition: width .2s; }
.boot-msg { font-weight: 600; color: var(--purple-dark); }

/* ---------- Logo Pokopaldea ---------- */
.logo { position: relative; display: inline-block; padding: 18px 34px 22px; }
.logo::before { content: ''; position: absolute; inset: 0; border-radius: 48% 52% 44% 56% / 58% 46% 54% 42%;
  background: radial-gradient(circle at 30% 30%, #d8f59a, #a6e05a 60%, #86c843); border: 5px solid #fff; box-shadow: var(--shadow); z-index: -1;
  background-size: 18px 18px, cover; }
.logo .word { font-size: clamp(42px, 9vw, 96px); font-weight: 700; line-height: 1; white-space: nowrap; letter-spacing: -1px; }
.logo .word span { display: inline-block; -webkit-text-stroke: 6px #fff; paint-order: stroke fill; filter: drop-shadow(0 4px 0 rgba(60,40,140,.35)); transform-origin: 50% 80%; }
.logo .word span:nth-child(odd) { transform: rotate(-4deg) translateY(2px); }
.logo .word span:nth-child(even) { transform: rotate(3deg) translateY(-2px); }
.logo .sub { display: block; text-align: center; font-weight: 600; color: #fff; -webkit-text-stroke: 4px var(--purple-dark); paint-order: stroke fill; font-size: clamp(14px, 2.4vw, 22px); margin-top: 4px; }

/* ---------- Botões de brinquedo ---------- */
.btn { --c: var(--purple); --cd: var(--purple-dark); appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  color: #fff; background: var(--c); border-radius: 999px; padding: 14px 30px; font-size: 22px; min-width: 200px;
  box-shadow: 0 6px 0 var(--cd), 0 10px 20px rgba(40,30,90,.25); transition: transform .08s, box-shadow .08s, filter .15s; position: relative; }
.btn:hover { filter: brightness(1.07); }
.btn:active, .btn.pressed { transform: translateY(5px); box-shadow: 0 1px 0 var(--cd), 0 4px 10px rgba(40,30,90,.25); }
.btn.green { --c: var(--green); --cd: var(--green-dark); }
.btn.yellow { --c: var(--yellow); --cd: var(--yellow-dark); color: var(--ink); }
.btn.red { --c: var(--red); --cd: var(--red-dark); }
.btn.blue { --c: var(--blue); --cd: var(--blue-dark); }
.btn.white { --c: #fff; --cd: #c9c2f0; color: var(--purple-dark); }
.btn.small { font-size: 16px; padding: 9px 18px; min-width: 0; }
.btn[disabled] { filter: grayscale(.8) brightness(.95); opacity: .6; pointer-events: none; }
.btn .ico { margin-right: 8px; }

/* ---------- Ecrãs ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
.screen.top { justify-content: flex-start; padding-top: calc(18px + var(--safe-t)); }
.title-buttons { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-top: 10px; }
.legal { position: absolute; bottom: calc(8px + var(--safe-b)); left: 0; right: 0; text-align: center; font-size: 12px; color: rgba(40,30,90,.65); padding: 0 16px; }
.banner { background: var(--purple); color: #fff; font-weight: 600; font-size: clamp(20px, 3.4vw, 30px); padding: 10px 30px; border-radius: 999px; box-shadow: var(--shadow); border: 4px solid #fff; text-align: center; }
.banner small { display: block; font-size: 60%; font-weight: 500; opacity: .9; }

/* etiquetas sobre os modelos 3D (posicionadas por JS) */
.tag3d { position: absolute; transform: translate(-50%, 0); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nametag { background: #fff; color: var(--purple-dark); border: 4px solid var(--purple); font-weight: 700; font-size: clamp(16px, 2.4vw, 24px);
  padding: 6px 20px; border-radius: 999px; box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; }
.nametag.sel { background: var(--yellow); border-color: var(--yellow-dark); color: var(--ink); }
.pick-zone { position: absolute; cursor: pointer; border-radius: 30px; }

/* ---------- Cartão de estatísticas ---------- */
.card { background: var(--cream); border: 5px solid #fff; border-radius: 28px; box-shadow: var(--shadow), inset 0 0 0 3px var(--lavender); padding: 18px 22px; color: var(--ink); }
.stat-card { position: absolute; right: calc(16px + var(--safe-r)); top: 50%; transform: translateY(-50%); width: min(360px, 92vw); max-height: 92vh; overflow: auto; }
.stat-card h2 { margin: 0 0 4px; font-size: 30px; }
/* o botão "Selecionar" fica sempre à vista no fundo do cartão (nos telemóveis o cartão faz scroll) */
.stat-card .card-actions { position: sticky; bottom: -12px; margin: 10px -16px -12px; padding: 10px 16px 12px; background: linear-gradient(transparent, var(--cream) 30%); display: flex; justify-content: center; }
.stat-card .dex { color: var(--ink-soft); font-weight: 500; font-size: 14px; }
.types { display: flex; gap: 6px; margin: 6px 0 10px; flex-wrap: wrap; }
.type { color: #fff; font-weight: 600; font-size: 13px; padding: 3px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: .5px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); }
.stat-row { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: 8px; margin: 6px 0; font-weight: 600; font-size: 15px; }
.stat-bar { height: 14px; border-radius: 99px; background: #ece6ff; overflow: hidden; box-shadow: inset 0 2px 0 rgba(0,0,0,.06); }
.stat-bar i { display: block; height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.2,.9,.3,1.2); }
.moves { margin: 10px 0 14px; display: grid; gap: 6px; }
.move-line { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 6px 10px; font-weight: 600; font-size: 15px; border: 2px solid #eee8ff; }
.move-line .lvl { margin-left: auto; font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.move-line.locked { opacity: .65; }
.move-line.master { border-color: #ffd23f; background: #fff8dc; }
.card-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.blurb { font-size: 14px; color: var(--ink-soft); margin: 4px 0 8px; line-height: 1.35; }

/* ---------- HUD ---------- */
.hud-top { position: absolute; top: calc(10px + 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; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-left { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hud-clock { font-size: 14px; padding: 3px 12px; }
.pill { background: rgba(255,255,255,.92); border: 3px solid #fff; box-shadow: var(--shadow); border-radius: 999px; padding: 6px 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.round-btn { width: 54px; height: 54px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 5px 0 #c9c2f0, 0 8px 16px rgba(40,30,90,.2); font-size: 26px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.round-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c9c2f0; }
.team-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); display: flex; gap: 8px; padding: 8px 12px; background: rgba(255,255,255,.85); border-radius: 999px; box-shadow: var(--shadow); border: 3px solid #fff; }
.team-slot { width: 58px; height: 58px; border-radius: 50%; background: #efeaff; border: 3px solid #fff; box-shadow: inset 0 0 0 2px var(--lavender); position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.team-slot img { width: 64px; height: 64px; margin-top: -8px; pointer-events: none; image-rendering: auto; }
.team-slot.active { background: #fff3c4; box-shadow: inset 0 0 0 3px var(--yellow-dark), 0 0 0 3px #fff, 0 0 14px #ffd23f; }
.team-slot.fainted img { filter: grayscale(1) opacity(.55); }
.team-slot .hpmini { position: absolute; left: 6px; right: 6px; bottom: -5px; height: 6px; background: #fff; border-radius: 9px; overflow: hidden; border: 1px solid #ddd; }
.team-slot .hpmini i { display: block; height: 100%; background: var(--green); }
.team-slot .lv { position: absolute; top: -6px; right: -8px; background: var(--purple); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 6px; border: 2px solid #fff; }
.team-slot.empty { opacity: .45; cursor: default; }
.auto-toggle { position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; }

/* controlos de toque */
.joy { position: absolute; left: 0; bottom: 0; width: 45vw; height: 60vh; }
.joy-base { position: absolute; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.35); border: 4px solid rgba(255,255,255,.8); transform: translate(-50%, -50%); pointer-events: none; }
.joy-knob { position: absolute; width: 62px; height: 62px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.act-btns { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; align-items: flex-end; }
.act-btn { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: var(--purple); color: #fff; font-size: 30px; box-shadow: 0 6px 0 var(--purple-dark), 0 10px 18px rgba(40,30,90,.25); display: flex; align-items: center; justify-content: center; }
.act-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--purple-dark); }

/* prompt flutuante sobre criaturas / NPCs */
.float-prompt { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: auto; }
.float-prompt .btn { font-size: 18px; padding: 8px 18px; min-width: 0; }
.float-prompt .who { background: var(--green); color: #fff; font-weight: 600; font-size: 13px; padding: 2px 12px; border-radius: 99px; border: 2px solid #fff; }

/* toasts */
.toasts { position: absolute; top: calc(74px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; z-index: 10; }
.toast { background: var(--purple); color: #fff; font-weight: 600; padding: 9px 22px; border-radius: 999px; border: 3px solid #fff; box-shadow: var(--shadow); animation: toastIn .3s cubic-bezier(.2,1.4,.4,1); font-size: 17px; text-align: center; max-width: 90vw; }
.toast.gold { background: var(--yellow); color: var(--ink); }
.toast.green { background: var(--green); }
@keyframes toastIn { from { transform: translateY(-14px) scale(.8); opacity: 0; } }

/* diálogo estilo Pokopia */
.dialog { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--safe-b)); width: min(760px, 94vw); background: #fff; border-radius: 34px; border: 5px solid var(--lavender);
  box-shadow: var(--shadow); padding: 22px 30px 26px; font-size: clamp(17px, 2.2vw, 22px); line-height: 1.4; font-weight: 500; cursor: pointer; min-height: 110px; }
.dialog .speaker { position: absolute; top: -18px; left: 40px; background: var(--green); color: #fff; font-weight: 600; padding: 3px 18px; border-radius: 99px; border: 3px solid #fff; font-size: 16px; }
.dialog .next { position: absolute; right: 22px; bottom: 12px; width: 18px; height: 18px; background: var(--yellow); border-radius: 50%; animation: bob 1s infinite; }
.dialog.purple { background: var(--purple); color: #fff; border-color: #fff; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.choices { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* painéis (Box, menu) */
.overlay { position: absolute; inset: 0; background: rgba(40, 30, 90, .35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.panel { width: min(860px, 96vw); max-height: 92vh; overflow: auto; }
.panel h2 { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.panel h2 .x { margin-left: auto; }
.grid-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.slot { background: #fff; border-radius: 20px; border: 3px solid #eee8ff; padding: 6px 4px 8px; text-align: center; cursor: pointer; position: relative; min-height: 112px; }
.slot img { width: 76px; height: 76px; display: block; margin: 0 auto; }
.slot .nm { font-weight: 600; font-size: 13px; }
.slot .lv { font-size: 12px; color: var(--ink-soft); }
.slot.sel { border-color: var(--yellow-dark); background: #fff8dc; }
.slot.empty { background: #f4f1ff; border-style: dashed; cursor: default; }
.section-label { font-weight: 700; color: var(--purple); margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; }

/* barra de XP / vida */
.bar { height: 12px; border-radius: 99px; background: #ece6ff; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width .45s ease; }
.bar.hp i { background: linear-gradient(90deg, #45c46b, #8fe36a); }
.bar.hp.mid i { background: linear-gradient(90deg, #f5b700, #ffd23f); }
.bar.hp.low i { background: linear-gradient(90deg, #ff5a5f, #ff8a65); }
.bar.xp i { background: linear-gradient(90deg, #3fa9f5, #8fd3f4); }

@media (max-width: 720px), (max-height: 520px) {
  .btn { font-size: 18px; padding: 11px 22px; min-width: 160px; }
  .team-slot { width: 46px; height: 46px; }
  .team-slot img { width: 52px; height: 52px; }
  .stat-card { right: 50%; transform: translate(50%, 0); top: auto; bottom: calc(8px + var(--safe-b)); max-height: 58vh; padding: 12px 16px; }
  .stat-card h2 { font-size: 24px; }
  .act-btn { width: 64px; height: 64px; font-size: 26px; }
}

/* ---------- Batalha ---------- */
.battle-ui { position: absolute; inset: 0; pointer-events: none; }
.battle-ui > * { pointer-events: auto; }
.bt-card { position: absolute; display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.95); border: 4px solid #fff; border-radius: 26px;
  box-shadow: var(--shadow), inset 0 0 0 3px var(--lavender); padding: 8px 16px 10px 8px; width: min(330px, 46vw); }
.bt-card.me { left: calc(12px + var(--safe-l)); top: calc(12px + var(--safe-t)); }
.bt-card.foe { right: calc(12px + var(--safe-r)); top: calc(12px + var(--safe-t)); }
.bt-card img { width: 64px; height: 64px; border-radius: 50%; background: #efeaff; flex: none; }
.bt-card .info { flex: 1; min-width: 0; }
.bt-card .nm { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-card .nm .lv { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.bt-card .types { margin: 2px 0 5px; } .bt-card .type { font-size: 10px; padding: 1px 8px; }
.bt-card .hpnum { font-size: 12px; color: var(--ink-soft); font-weight: 600; text-align: right; margin-top: 1px; }
.bt-card .bar.xp { height: 6px; margin-top: 3px; }
.bt-card .chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.bt-card .chips span { background: #fff3c4; border-radius: 99px; padding: 1px 8px; font-size: 11px; font-weight: 600; }
.bt-msg { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0; transition: all .25s;
  background: var(--purple); color: #fff; font-weight: 600; font-size: clamp(16px, 2.3vw, 22px); padding: 14px 30px; border-radius: 999px; border: 4px solid #fff; box-shadow: var(--shadow);
  max-width: 92vw; text-align: center; cursor: pointer; }
.bt-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.bt-panel { position: absolute; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); width: min(720px, 96vw); display: none; flex-direction: column; gap: 8px; align-items: stretch; }
.bt-panel.show { display: flex; animation: toastIn .25s; }
.bt-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bt-move { --tc: #999; appearance: none; border: 4px solid #fff; border-radius: 22px; padding: 10px 14px; text-align: left; cursor: pointer; font: inherit; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 85%, #fff), var(--tc)); box-shadow: 0 5px 0 color-mix(in srgb, var(--tc) 60%, #000), var(--shadow); }
.bt-move b { display: block; font-size: 19px; text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.bt-move small { font-size: 12px; font-weight: 600; opacity: .95; }
.bt-move.good small::before { content: '⬆ '; } .bt-move.bad { filter: saturate(.7); }
.bt-move:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--tc) 60%, #000); }
.bt-master { appearance: none; border: 4px solid #fff; border-radius: 22px; padding: 10px 16px; cursor: pointer; font: inherit; color: var(--ink); text-align: left; position: relative;
  background: linear-gradient(90deg, #ffe680, #ffd23f, #ffb347); box-shadow: 0 5px 0 #c98a00, var(--shadow); }
.bt-master b { font-size: 19px; display: block; } .bt-master small { font-weight: 600; }
.bt-master[disabled] { filter: grayscale(.7); opacity: .75; }
.bt-master.ready { animation: glow 1.2s infinite; }
.bt-master .pips { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: flex; gap: 5px; }
.bt-master .pips i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.6); border: 2px solid #c98a00; }
.bt-master .pips i.on { background: #fff; box-shadow: 0 0 8px #fff; }
@keyframes glow { 50% { box-shadow: 0 5px 0 #c98a00, 0 0 26px #ffd23f; } }
.bt-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btn.pulse { animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.master-banner { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%) rotate(-3deg); font-size: clamp(30px, 6vw, 60px); font-weight: 700; color: #fff;
  -webkit-text-stroke: 7px #c98a00; paint-order: stroke fill; text-align: center; animation: masterIn 1.1s ease-out; pointer-events: none; }
.master-banner small { display: block; font-size: 40%; -webkit-text-stroke: 4px var(--purple-dark); }
@keyframes masterIn { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-10deg); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15) rotate(-3deg); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.mini-hp { position: fixed; transform: translate(-50%, -100%); background: rgba(255,255,255,.92); border-radius: 12px; padding: 3px 8px 5px; font-size: 11px; font-weight: 700; color: var(--ink); width: 104px; text-align: center; pointer-events: none; z-index: 15; box-shadow: 0 3px 10px rgba(40,30,90,.2); }
.mini-hp .bar { height: 7px; margin-top: 2px; }
@media (max-width: 720px), (max-height: 520px) {
  .bt-card { padding: 5px 10px 6px 5px; width: 47vw; border-radius: 18px; }
  .bt-card img { width: 42px; height: 42px; }
  .bt-card .nm { font-size: 14px; } .bt-card .types { display: none; }
  .bt-move { padding: 7px 10px; border-radius: 16px; } .bt-move b { font-size: 15px; } .bt-move small { font-size: 10px; }
  .bt-master b { font-size: 15px; }
}

@media (max-width: 560px) {
  .team-bar { gap: 5px; padding: 6px 8px; }
  .auto-toggle { left: 50%; top: -50px; transform: translateX(-50%); }
}

.keys-tip { position: absolute; left: calc(12px + var(--safe-l)); bottom: calc(96px + var(--safe-b)); font-size: 13px; font-weight: 500; transition: opacity .8s; pointer-events: none; }
.keys-tip.gone { opacity: 0; }
.bt-auto { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); }

/* ---------- Mundos guardados (pedido do Lucas) ---------- */
.wd-panel { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.wd-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.wd-tip { font-size: 14px; color: var(--ink-soft); flex: 1; min-width: 200px; }
.wd-empty { text-align: center; padding: 28px 10px; color: var(--ink-soft); font-size: 17px; line-height: 1.5; }
.wd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.wd-card { background: #fff; border: 4px solid #eee8ff; border-radius: 22px; padding: 10px 12px 12px; position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wd-card.current { border-color: var(--yellow-dark); background: #fffbea; }
.wd-badge { position: absolute; top: -12px; right: 14px; background: var(--yellow); color: var(--ink); font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; border: 3px solid #fff; }
.wd-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wd-trainer { width: 52px; height: 52px; border-radius: 50%; background: #efeaff; flex: none; object-fit: cover; }
.wd-name-txt { font-weight: 700; font-size: 20px; color: var(--purple-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wd-team { display: flex; gap: 4px; flex-wrap: wrap; min-height: 44px; }
.wd-mon { width: 44px; height: 44px; border-radius: 50%; background: #f4f1ff; position: relative; }
.wd-mon img { width: 48px; height: 48px; margin: -2px; display: block; }
.wd-mon span { position: absolute; right: -4px; bottom: -3px; background: var(--purple); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 0 5px; border: 2px solid #fff; }
.wd-meta { font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.wd-actions { display: flex; gap: 8px; margin-top: auto; }
.wd-actions .wd-play { flex: 1; }
.wd-actions .btn { min-width: 0; }
.wd-name { width: min(460px, calc(100vw - 32px)); text-align: center; }
.wd-name h2 { margin: 0 0 12px; font-size: 22px; }
.wd-input { width: 100%; box-sizing: border-box; font: inherit; font-size: 22px; font-weight: 600; color: var(--ink); text-align: center; padding: 12px 16px; border-radius: 18px; border: 4px solid var(--lavender); background: #fff; outline: none; }
.wd-input:focus { border-color: var(--purple); }
.wd-hint { font-size: 14px; color: var(--ink-soft); margin: 8px 0 14px; }
.wd-hint.bad { color: var(--red-dark, #c0392b); font-weight: 700; }
.wd-name.shake { animation: wdShake .35s; }
@keyframes wdShake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
.btn small.wd-cont { display: block; font-size: 13px; font-weight: 600; opacity: .9; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px auto 0; }
@media (max-width: 560px) {
  .wd-grid { grid-template-columns: 1fr; }
  .wd-tip { min-width: 0; flex-basis: 100%; }
  .wd-top .wd-new { width: 100%; }
}
