/* ============================================================================
   Mapa do Código — a moldura do jogo e a interface por cima dele
   O mundo é um canvas ampliado sem suavização (assets/mundo/mundo.js).
   As caixas seguem a referência do mapa: azul-marinho, borda luminosa,
   cantos chanfrados, letra mono. Os painéis são HTML de verdade.
   ========================================================================== */
.mundo {
  --mn-fundo: rgba(8, 12, 32, .92);
  --mn-borda: #2f7bff;
  --mn-texto: #eef2ff;
  position: relative; height: min(80vh, 780px); min-height: 440px;
  /* clip (e não só hidden): o foco do teclado não consegue rolar a moldura */
  background: #2462bc; overflow: hidden; overflow: clip; isolation: isolate;
  border-bottom: 3px solid #12224a; user-select: none; -webkit-user-select: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  /* arrastar na vertical rola a página; toque parado é "andar até aqui" */
  touch-action: pan-y;
}
.mundo[hidden] { display: none; }
.mundo-tela { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; cursor: grab; }
.mundo.vendo-tudo .mundo-tela { image-rendering: auto; }
/* o cabeçalho do site é fixo (cinema.css): o mapa começa logo abaixo dele */
.mundo-na-pagina { margin-top: var(--cx-nav-h, 76px); }
/* tela cheia: por cima do cabeçalho (z 110), por baixo da missão (z 200) */
.mundo.mundo-cheio { position: fixed; inset: 0; height: 100%; min-height: 0; margin: 0; z-index: 150; border: 0; touch-action: none; }
html.mundo-travado, html.mundo-travado body { overflow: hidden; }
.mundo button { font: inherit; }

/* a caixa padrão: chanfro nos cantos, borda dupla com brilho */
.mundo-caixa {
  background: var(--mn-fundo); color: var(--mn-texto);
  border: 2px solid var(--cor, var(--mn-borda)); border-radius: 5px;
  box-shadow: inset 0 0 0 2px #060a1c, inset 0 0 0 3px color-mix(in srgb, var(--cor, var(--mn-borda)) 35%, transparent),
              0 0 14px color-mix(in srgb, var(--cor, var(--mn-borda)) 40%, transparent), 0 4px 0 rgba(0,0,0,.35);
}

.mundo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 9px 16px; border-radius: 4px; cursor: pointer; text-decoration: none;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700;
  background: #121a40; color: #e6ecff; border: 2px solid #34427a; box-shadow: 0 3px 0 #050816;
  transition: transform .12s ease, border-color .12s ease;
}
.mundo-btn:hover { transform: translateY(-1px); border-color: #6ee7ff; }
.mundo-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #050816; }
.mundo-btn.forte { background: #ffd43b; color: #1a1405; border-color: #ffe98a; box-shadow: 0 3px 0 #8a6a10; }
.mundo-btn:focus-visible, .mundo-ex:focus-visible, .mundo-fechar:focus-visible, .mundo-botoes button:focus-visible, .mundo-prox:focus-visible, .mundo-passos button:focus-visible { outline: 3px solid #6ee7ff; outline-offset: 2px; }

/* ---------- placar (em cima, à esquerda) ---------- */
.mundo-hud {
  position: absolute; left: 14px; top: 14px; z-index: 3; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 12px; min-width: 250px; pointer-events: none;
}
.mundo-logo {
  flex-shrink: 0; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 6px;
  border: 2px solid #3aa8ff; background: #0b1636; color: #8fd0ff; font-weight: 800; font-size: 14px;
  box-shadow: 0 0 10px rgba(58,168,255,.45) inset;
}
.mundo-hud-txt b { display: block; font-size: 17px; color: #fff; letter-spacing: .01em; }
.mundo-hud-txt small { display: block; font-size: 11.5px; color: #9ad0ff; margin-top: 1px; }
.mundo-hud-prog { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11.5px; color: #aab5d3; }
.mundo-hud-prog b { display: inline; color: #ffd43b; font-size: 13px; }
.mundo-barra { display: block; flex: 1; min-width: 90px; height: 8px; border-radius: 2px; background: #02040e; border: 1px solid #2c375c; overflow: hidden; }
.mundo-barra > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3aa8ff, #ffd43b); transition: width .6s ease; }

/* ---------- a próxima etapa (em cima, à direita) ---------- */
.mundo-prox {
  position: absolute; right: 14px; top: 14px; z-index: 3; max-width: min(360px, calc(100% - 330px));
  display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px; cursor: pointer; text-align: left;
}
.mundo-prox-ic { flex-shrink: 0; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 6px; border: 2px solid #3aa8ff; background: #0b1636; font-size: 18px; }
.mundo-prox-txt { min-width: 0; }
.mundo-prox-txt b { display: block; font-size: 14.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mundo-prox-txt small { display: block; font-size: 12px; color: #ffe98a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mundo-prox:hover { filter: brightness(1.15); }

/* ---------- o lema (embaixo, à esquerda) ---------- */
.mundo-lema { position: absolute; left: 14px; bottom: 14px; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px; pointer-events: none; }
.mundo-lema span { font-size: 26px; }
.mundo-lema p { margin: 0; font-size: 11.5px; line-height: 1.45; color: #dfe6fb; }

/* ---------- ver mapa e tela cheia (embaixo, à direita) ---------- */
.mundo-botoes { position: absolute; right: 14px; bottom: 14px; z-index: 3; display: flex; gap: 8px; }
.mundo-botoes button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 18px; cursor: pointer; font-size: 15px; font-weight: 700; }
.mundo-botoes .ic { font-size: 20px; }
.mundo-botoes #mundoCheio { padding: 8px 14px; font-size: 18px; }
.mundo-botoes button[aria-pressed="true"] { --cor: #ffd43b; }
.mundo-botoes button:hover { filter: brightness(1.2); }

/* com diálogo ou painel aberto, o que fica embaixo sai da frente */
.mundo.com-janela .mundo-passos, .mundo.com-janela .mundo-lema, .mundo.com-janela .mundo-balao, .mundo.com-janela .mundo-botoes { display: none; }

/* ---------- andar pelo caminho: anterior · entrar · próxima ---------- */
.mundo-passos { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; display: flex; gap: 8px; align-items: center; }
.mundo-passos button { min-width: 50px; min-height: 48px; padding: 8px 14px; cursor: pointer; font-size: 15px; font-weight: 700; -webkit-tap-highlight-color: transparent; }
.mundo-passos .mundo-a { background: #ffd43b; color: #1a1405; border: 2px solid #ffe98a; border-radius: 4px; box-shadow: 0 3px 0 #8a6a10, 0 0 14px rgba(255,212,59,.4); min-width: 116px; }
.mundo-passos .mundo-a:disabled { opacity: .5; cursor: default; box-shadow: none; }

/* ---------- quem fala: o close do rosto (o corpo inteiro está de pé no mapa) ---------- */
.mundo-rosto {
  display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; overflow: hidden;
  background: radial-gradient(ellipse at 50% 96%, color-mix(in srgb, var(--cor, #3aa8ff) 32%, transparent), transparent 68%), #0c1028;
}
.mundo-rosto .pc3 { width: 100%; height: 100%; aspect-ratio: auto; }
.mundo-rosto .pc3-rosto > img { object-position: 50% 25%; }
.mundo-rosto.ic { display: grid; place-items: center; font-size: 34px; background: #0c1028; }

/* ---------- etapas com vários capítulos (torres Pro e Ultra) ---------- */
.mundo-grupo { margin: 0 12px 8px; border-radius: 4px; background: #0d1434; border: 2px solid #222d58; }
.mundo-grupo summary { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 10px 12px; cursor: pointer; color: #fff; font-size: 13.5px; }
.mundo-grupo summary small { font-size: 11px; color: #aab5d3; }
.mundo-grupo .mundo-lista { margin: 0 8px 10px; }

/* ---------- etiqueta da etapa ---------- */
.mundo-etiqueta {
  position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; text-align: center;
  padding: 7px 12px 8px; border-radius: 3px; background: rgba(8,12,32,.94); color: #fff;
  border: 2px solid var(--cor, #6ee7ff); box-shadow: 0 0 12px color-mix(in srgb, var(--cor, #6ee7ff) 40%, transparent), 0 4px 0 rgba(0,0,0,.4); white-space: nowrap;
}
.mundo-etiqueta::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 10px; height: 10px; background: rgba(8,12,32,.94); border-right: 2px solid var(--cor, #6ee7ff); border-bottom: 2px solid var(--cor, #6ee7ff); transform: translateX(-50%) rotate(45deg); }
.mundo-etiqueta small { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--cor, #6ee7ff); }
.mundo-etiqueta b { display: block; font-size: 13.5px; font-family: 'Inter', system-ui, sans-serif; }
.mundo-etiqueta span { display: block; font-size: 11px; color: #c9d3ef; margin-top: 2px; }
.mundo-etiqueta[hidden] { display: none; }

/* ---------- o balão do mestre da ilha ---------- */
.mundo-balao {
  position: absolute; left: 50%; top: 92px; z-index: 4; transform: translate(-50%, -8px); opacity: 0;
  width: min(520px, calc(100% - 28px)); display: flex; gap: 14px; align-items: center; padding: 12px 16px 12px 12px; cursor: pointer;
  background: var(--mn-fundo); color: var(--mn-texto); border: 2px solid var(--cor); border-radius: 4px;
  box-shadow: inset 0 0 0 2px #060a1c, 0 0 16px color-mix(in srgb, var(--cor) 45%, transparent), 0 5px 0 rgba(0,0,0,.35);
  transition: opacity .35s ease, transform .35s ease;
}
.mundo-balao.mostra { opacity: 1; transform: translate(-50%, 0); }
.mundo-balao[hidden] { display: none; }
.mundo-balao .mundo-rosto { flex-shrink: 0; width: 64px; height: 70px; border: 2px solid var(--cor); border-radius: 3px; }
.mundo-balao p { margin: 6px 0 0; font-size: 14px; line-height: 1.5; }
.mundo-nome {
  display: inline-block; padding: 2px 12px; border: 2px solid var(--cor); border-radius: 3px; background: #0a0f28;
  color: color-mix(in srgb, var(--cor) 55%, #ffffff); font-size: 14px; font-weight: 800; letter-spacing: .02em;
}

/* ---------- diálogo (embaixo, como nos jogos) ---------- */
.mundo-dialogo {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; width: min(800px, calc(100% - 28px));
  display: flex; gap: 16px; align-items: flex-start; padding: 16px 18px 14px 14px;
  background: var(--mn-fundo); color: var(--mn-texto); border: 2px solid var(--cor, #3aa8ff); border-radius: 4px;
  box-shadow: inset 0 0 0 2px #060a1c, inset 0 0 0 3px color-mix(in srgb, var(--cor, #3aa8ff) 35%, transparent), 0 0 20px color-mix(in srgb, var(--cor, #3aa8ff) 45%, transparent), 0 6px 0 rgba(0,0,0,.4);
}
.mundo-dialogo[hidden] { display: none; }
.mundo-dlg-rosto { flex-shrink: 0; width: 88px; height: 96px; border: 2px solid var(--cor, #3aa8ff); border-radius: 3px; overflow: hidden; box-shadow: 0 0 10px color-mix(in srgb, var(--cor, #3aa8ff) 45%, transparent); }
.mundo-fala { flex: 1; min-width: 0; }
.mundo-fala p { font-size: 15px; line-height: 1.6; min-height: 3.2em; margin: 8px 0 0; color: #f4f6ff; }
.mundo-acoes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 8px; }
@media (max-width: 560px) {
  .mundo-dlg-rosto { width: 60px; height: 66px; }
  .mundo-fala p { font-size: 13.5px; }
  .mundo-balao .mundo-rosto { width: 48px; height: 53px; }
  .mundo-balao p { font-size: 12.5px; }
}

/* ---------- painel da etapa ---------- */
.mundo-painel {
  position: absolute; right: 14px; top: 14px; bottom: 14px; z-index: 6; width: min(440px, calc(100% - 28px));
  overflow-y: auto; overscroll-behavior: contain; padding: 0 0 16px; border-radius: 4px;
  background: rgba(8,12,32,.97); color: #dfe6fb; border: 2px solid #2f7bff;
  box-shadow: inset 0 0 0 2px #060a1c, 0 0 22px rgba(47,123,255,.35), 0 10px 30px rgba(0,0,0,.55);
  scrollbar-width: thin; user-select: text; -webkit-user-select: text;
}
.mundo-painel[hidden] { display: none; }
.mundo-painel-topo { position: sticky; top: 0; z-index: 1; display: flex; gap: 12px; align-items: center; padding: 14px 14px 12px; background: linear-gradient(180deg, color-mix(in srgb, var(--cor) 22%, #0a0f2a), #0a0f2a); border-bottom: 2px solid #1d2750; }
.mundo-painel-rosto { flex-shrink: 0; width: 64px; height: 70px; border: 2px solid var(--cor); border-radius: 3px; overflow: hidden; box-shadow: 0 0 10px color-mix(in srgb, var(--cor) 45%, transparent); }
.mundo-painel-tit { flex: 1; min-width: 0; }
.mundo-painel-tit small { display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--cor); }
.mundo-painel-tit h3 { font-family: 'Inter', system-ui, sans-serif; font-size: 18px; color: #fff; margin: 3px 0; line-height: 1.25; }
.mundo-painel-est { font-size: 11.5px; color: #aab5d3; }
.mundo-fechar { width: 40px; height: 40px; flex-shrink: 0; border-radius: 4px; border: 2px solid #2c375c; background: #121a40; color: #fff; cursor: pointer; font-size: 15px; }
.mundo-painel-fala { margin: 14px 16px 10px; font-family: 'Inter', system-ui, sans-serif; font-size: 14px; line-height: 1.6; color: #c9d3ef; }
.mundo-painel-fala b { color: #fff; }
.mundo-painel-barra { height: 10px; margin: 0 16px 12px; border-radius: 2px; background: #02040e; border: 1px solid #2c375c; overflow: hidden; }
.mundo-painel-barra > i { display: block; height: 100%; }
.mundo-lista { list-style: none; margin: 0 12px; padding: 0; display: grid; gap: 6px; }
.mundo-ex {
  width: 100%; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; text-align: left;
  min-height: 44px; padding: 8px 10px; border-radius: 4px; cursor: pointer;
  background: #0f1738; color: #dfe6fb; border: 2px solid #222d58; font-family: 'Inter', system-ui, sans-serif; font-size: 13.5px;
}
.mundo-ex:hover:not(:disabled) { border-color: #6ee7ff; }
.mundo-ex .n { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #0a0f26; border: 2px solid #2c375c; font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; }
.mundo-ex small { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #ffd43b; }
.mundo-ex.feito .n { background: #ffd43b; border-color: #fff3b0; color: #3a2a04; }
.mundo-ex.atual { border-color: #ffd43b; }
.mundo-ex:disabled { opacity: .6; cursor: default; }
.mundo-painel-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 16px 0; }
.mundo-painel-acoes .mundo-btn.forte { flex: 1 1 100%; }
.mundo-link { font-size: 12px; color: #9ad0ff; text-decoration: underline; text-underline-offset: 3px; }
.mundo-cert-mapa { margin: 14px 14px 6px; padding: 14px; border-radius: 4px; border: 2px dashed #ffd43b; background: rgba(255,212,59,.06); }
.mundo-cert-mapa.ganho { border-style: solid; background: rgba(255,212,59,.13); }
.mundo-cert-mapa b { color: #ffe98a; }
.mundo-cert-mapa p { font-family: 'Inter', system-ui, sans-serif; font-size: 13.5px; line-height: 1.55; color: #dfe6fb; margin: 6px 0 10px; }
.mundo-cert-mapa .mundo-painel-barra { margin: 0 0 6px; }
.mundo-cert-mapa small { font-size: 11.5px; color: #aab5d3; }
.mundo-certs { list-style: none; margin: 10px 14px 0; padding: 0; display: grid; gap: 8px; }
.mundo-certs li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; background: #0f1738; border: 2px solid #222d58; }
.mundo-certs .ic { font-size: 20px; }
.mundo-certs .t { flex: 1; min-width: 0; }
.mundo-certs .t b { display: block; color: #fff; font-size: 14px; }
.mundo-certs .t small { font-size: 11px; color: #aab5d3; }
.mundo-certs .mundo-btn { min-height: 36px; padding: 6px 10px; font-size: 11.5px; }
.mundo-sem { font-size: 11px; color: #7f8ea5; }

/* ---------- avisos ---------- */
.mundo-toast {
  position: absolute; left: 50%; top: 96px; z-index: 7; transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 4px; background: #0a0f28; color: #fff; border: 2px solid #ffd43b; box-shadow: 0 0 14px rgba(255,212,59,.35);
  font-size: 13px; transition: opacity .25s ease, transform .25s ease; max-width: calc(100% - 28px);
}
.mundo-toast.mostra { opacity: 1; transform: translate(-50%, 0); }
.mundo-carregando { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; gap: 10px; background: #0a1430; color: #aab5d3; font-size: 13px; }
.mundo-carregando i { width: 12px; height: 12px; background: #6ee7ff; animation: mundoPisca 1s steps(2) infinite; }
.mundo-carregando[hidden] { display: none; }
@keyframes mundoPisca { 50% { opacity: .2; } }

/* ---------- celular ---------- */
@media (max-width: 900px) {
  .mundo-lema { display: none; }
  .mundo-prox { max-width: calc(100% - 300px); }
}
@media (max-width: 760px) {
  .mundo { height: min(76vh, 660px); min-height: 420px; }
  .mundo-hud { left: 8px; top: 8px; min-width: 0; padding: 7px 10px 7px 8px; gap: 8px; }
  .mundo-logo { width: 32px; height: 32px; font-size: 11px; }
  .mundo-hud-txt b { font-size: 13.5px; }
  .mundo-hud-txt small { display: none; }
  .mundo-hud-prog { margin-top: 4px; }
  .mundo-barra { min-width: 60px; }
  .mundo-prox { left: 8px; right: 8px; top: auto; bottom: 72px; max-width: none; padding: 7px 12px 7px 8px; }
  .mundo-prox-ic { width: 30px; height: 30px; font-size: 15px; }
  .mundo-prox-txt b { font-size: 12.5px; }
  .mundo-prox-txt small { font-size: 11px; }
  .mundo-botoes { right: 8px; top: 8px; bottom: auto; }
  .mundo-botoes button { min-height: 44px; padding: 6px 12px; font-size: 13px; }
  .mundo-botoes .t, .mundo-botoes button > span:last-child:not(.ic) { display: none; }
  .mundo-passos { bottom: 12px; }
  .mundo-balao { top: auto; bottom: 128px; }
  .mundo-dialogo { bottom: 8px; width: calc(100% - 16px); padding: 12px; gap: 10px; }
  .mundo-painel { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 82%; }
  .mundo-toast { top: 64px; }
}

/* ---------- a missão, aberta por cima do mapa ---------- */
.mundo-missao { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: #060913; }
.mundo-missao[hidden] { display: none; }
.mundo-missao-barra { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: #0a0f28; border-bottom: 2px solid #2f7bff; box-shadow: 0 0 14px rgba(47,123,255,.35); }
.mundo-missao-barra b { color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'JetBrains Mono', monospace; }
.mundo-missao iframe { flex: 1; width: 100%; border: 0; background: #060913; }

@media (prefers-reduced-motion: reduce) {
  .mundo-carregando i { animation: none; }
  .mundo-barra > i, .mundo-toast, .mundo-balao { transition: none; }
}
