/* mundo.css — página do Oftalmo World: palco em escala inteira, controle de toque e telas DOM.
   Estilo dos menus = estilo do site (Inter, #0071E3, #1D1D1F, #F5F5F7, #0B0D12, cartões
   brancos arredondados). A fonte Inter vem do próprio site (pasta do Oftalmo Kart) — nenhuma
   requisição externa. */

@font-face {
  font-family: 'Inter';
  src: url('../../kart/assets/fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --azul: #0071E3;
  --azul-escuro: #0058B0;
  --tinta: #1D1D1F;
  --claro: #F5F5F7;
  --noite: #0B0D12;
  --turquesa: #18B0B0;
  --coral: #E86858;
  --ouro: #F8C830;
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  --fonte: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--noite); color: var(--tinta);
  font-family: var(--fonte);
  /* nada de rolagem, zoom, seleção ou menu de toque-longo acidental */
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ---------- Palco: canvas no centro, faixas laterais decoradas ---------- */
#palco {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background-color: #10192B;
  /* faixas: céu noturno da ilha com pontinhos de pixel e um brilho turquesa suave */
  background-image:
    radial-gradient(circle at 50% 50%, rgba(24, 176, 176, .18), rgba(24, 176, 176, 0) 60%),
    radial-gradient(rgba(168, 224, 248, .22) 1px, transparent 1.5px),
    radial-gradient(rgba(248, 200, 48, .14) 1px, transparent 1.5px),
    linear-gradient(180deg, #172748 0%, #10192B 55%, #0B0D12 100%);
  background-size: 100% 100%, 24px 24px, 40px 40px, 100% 100%;
  background-position: 0 0, 0 0, 12px 20px, 0 0;
}
#tela {
  display: block; flex: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #78C8F8;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 12px 40px rgba(0, 0, 0, .45);
}
#app[data-tela="titulo"] #tela,
#app[data-tela="mapa"] #tela,
#app[data-tela="carregando"] #tela { filter: saturate(.9) brightness(.85); }

.btn-pausa {
  position: absolute; top: calc(8px + var(--sa-t)); right: calc(8px + var(--sa-r));
  width: 56px; height: 56px; border-radius: 14px; border: 0;
  background: rgba(11, 13, 18, .45); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.btn-pausa span { width: 14px; height: 16px; border-left: 5px solid #fff; border-right: 5px solid #fff; }
.btn-pausa:focus-visible { outline: 3px solid var(--azul); }

/* ---------- Controle de toque ---------- */
#controle {
  flex: none; position: relative;
  touch-action: none;
  color: #fff;
}
#controle[hidden] { display: none; }

/* retrato: corpo de portátil embaixo da tela */
#app[data-modo="retrato"] #controle {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  padding: 10px calc(14px + var(--sa-r)) calc(12px + var(--sa-b)) calc(14px + var(--sa-l));
  background: linear-gradient(180deg, #E9ECF1 0%, #D7DCE4 100%);
  border-top: 4px solid #0B0D12;
  color: var(--tinta);
}
#app[data-modo="retrato"] #palco { flex: none; }
#app[data-modo="retrato"] .btn-pausa { display: none; }

.ctl-topo {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex: none;
}
.ctl-marca {
  font-weight: 800; font-size: 11px; letter-spacing: .22em; color: #7890A0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctl-pilula {
  min-height: 48px; min-width: 56px; padding: 0 14px; border-radius: 999px;
  border: 0; font: 600 13px var(--fonte); cursor: pointer;
  background: #C3CAD5; color: #284078;
}
.ctl-pilula[data-ligado="1"] { background: var(--turquesa); color: #fff; }
.ctl-pilula[data-ligado="1"]::before { content: '✓ '; }
.ctl-pausa { letter-spacing: -1px; font-size: 14px; }

.ctl-corpo {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

/* direcional (uma única zona; o JS decide a direção pelo ângulo) */
.cruz {
  --t: min(42vw, 44vh, 188px);
  position: relative; width: var(--t); height: var(--t); flex: none;
  touch-action: none;
}
.cruz-h, .cruz-v {
  position: absolute; background: #2B3444; border-radius: 12px;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .35), 0 3px 0 rgba(0, 0, 0, .15);
}
.cruz-h { left: 0; right: 0; top: 33%; bottom: 33%; }
.cruz-v { top: 0; bottom: 0; left: 33%; right: 33%; }
.seta { position: absolute; width: 0; height: 0; border: 9px solid transparent; opacity: .75; }
.s-esq { left: 7%; top: 50%; margin-top: -9px; border-right-color: #fff; border-left-width: 0; }
.s-dir { right: 7%; top: 50%; margin-top: -9px; border-left-color: #fff; border-right-width: 0; }
.s-cima { top: 7%; left: 50%; margin-left: -9px; border-bottom-color: #fff; border-top-width: 0; }
.s-baixo { bottom: 7%; left: 50%; margin-left: -9px; border-top-color: #fff; border-bottom-width: 0; }
.cruz[data-esq="1"] .s-esq, .cruz[data-dir="1"] .s-dir,
.cruz[data-cima="1"] .s-cima, .cruz[data-baixo="1"] .s-baixo { opacity: 1; border-width: 11px; }
.cruz[data-esq="1"] .s-esq, .cruz[data-dir="1"] .s-dir { margin-top: -11px; }
.cruz[data-cima="1"] .s-cima, .cruz[data-baixo="1"] .s-baixo { margin-left: -11px; }
.cruz[data-esq="1"] .s-esq { border-right-color: var(--ouro); border-left-width: 0; }
.cruz[data-dir="1"] .s-dir { border-left-color: var(--ouro); border-right-width: 0; }
.cruz[data-cima="1"] .s-cima { border-bottom-color: var(--ouro); border-top-width: 0; }
.cruz[data-baixo="1"] .s-baixo { border-top-color: var(--ouro); border-bottom-width: 0; }

/* botões de ação em arco, como num portátil */
.botoes {
  --b: min(21vw, 22vh, 84px);
  position: relative; flex: none;
  width: calc(var(--b) * 2.25); height: calc(var(--b) * 2.2);
}
.bt {
  position: absolute; width: var(--b); height: var(--b); min-width: 56px; min-height: 56px;
  border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  font: 800 12px var(--fonte); letter-spacing: .02em; color: #fff; text-transform: uppercase;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .28), 0 4px 0 rgba(0, 0, 0, .18);
  touch-action: none;
}
.bt b { pointer-events: none; }
.bt-pulo { right: 0; bottom: 0; background: var(--azul); width: calc(var(--b) * 1.12); height: calc(var(--b) * 1.12); font-size: 14px; }
.bt-giro { left: 0; bottom: calc(var(--b) * .18); background: var(--turquesa); }
.bt-correr { right: calc(var(--b) * .2); top: 0; background: #E86858; }
.bt[data-ativo="1"] { transform: translateY(3px) scale(.96); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3); filter: brightness(1.15); }
#app[data-correr-sempre="1"] .bt-correr { background: #7890A0; }

/* paisagem (toque): tudo translúcido por cima da tela, deixando o meio livre */
#app[data-modo="paisagem"] #controle {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
}
#app[data-modo="paisagem"] .ctl-topo { display: none; }
#app[data-modo="paisagem"] .ctl-corpo {
  position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  align-items: flex-end;
  padding: 0 calc(10px + var(--sa-r)) calc(10px + var(--sa-b)) calc(10px + var(--sa-l));
}
#app[data-modo="paisagem"] .cruz { --t: min(46vh, 176px); pointer-events: auto; opacity: .62; }
#app[data-modo="paisagem"] .botoes { --b: min(24vh, 80px); pointer-events: auto; opacity: .7; }
#app[data-modo="paisagem"] .cruz-h, #app[data-modo="paisagem"] .cruz-v { background: rgba(16, 24, 32, .75); }

/* ---------- Telas (menus DOM no estilo do site) ---------- */
.tela {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(16px + var(--sa-t)) calc(16px + var(--sa-r)) calc(16px + var(--sa-b)) calc(16px + var(--sa-l));
  background: rgba(11, 13, 18, .62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  overflow-y: auto; touch-action: pan-y;
}
.tela[hidden] { display: none; }
.tela-leve { background: rgba(11, 13, 18, .35); }

.cartao {
  width: min(100%, 380px);
  background: #fff; color: var(--tinta);
  border-radius: 22px; padding: 22px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  text-align: center;
}
.cartao-mini { width: min(100%, 320px); }
.cartao h2 { margin: 0 0 12px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.carregando { margin: 0; font-weight: 600; }

.acoes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.acoes-col { flex-direction: column; }
.btn {
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0;
  font: 600 16px var(--fonte); cursor: pointer;
  background: var(--claro); color: var(--tinta);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn:hover { background: #E8E8ED; }
.btn-primario { background: var(--azul); color: #fff; }
.btn-primario:hover { background: var(--azul-escuro); }
.btn-link { background: transparent; color: var(--azul); }
.btn:focus-visible, .heroi:focus-visible, .link-btn:focus-visible, .voltar:focus-visible { outline: 3px solid var(--ouro); outline-offset: 2px; }

/* título */
#tela-titulo { background: linear-gradient(180deg, rgba(11, 13, 18, .55), rgba(11, 13, 18, .82)); color: #fff; justify-content: space-evenly; }
.titulo-topo {
  position: absolute; top: calc(10px + var(--sa-t)); left: calc(12px + var(--sa-l)); right: calc(12px + var(--sa-r));
  display: flex; justify-content: space-between; align-items: center;
}
.voltar, .link-btn {
  color: #fff; text-decoration: none; font: 600 14px var(--fonte);
  background: rgba(255, 255, 255, .12); border: 0; border-radius: 999px; padding: 10px 14px; cursor: pointer;
}
.logo-jogo { display: flex; flex-direction: column; align-items: center; line-height: .9; margin-top: 36px; }
.logo-l1, .logo-l2 {
  font-weight: 900; letter-spacing: .04em;
  font-size: clamp(34px, 11vw, 64px);
  color: #F8F8F8;
  text-shadow: 0 4px 0 #008890, 0 8px 0 #182848, 0 10px 24px rgba(0, 0, 0, .4);
}
.logo-l2 { color: var(--ouro); text-shadow: 0 4px 0 #C88818, 0 8px 0 #182848, 0 10px 24px rgba(0, 0, 0, .4); }
.logo-sub { margin-top: 14px; font-weight: 600; font-size: 15px; letter-spacing: .3em; text-transform: uppercase; color: #68D8D0; }
.titulo-chamada { margin: 6px 0 0; font-size: 15px; font-weight: 500; color: rgba(255, 255, 255, .85); }
.herois { display: flex; gap: 12px; width: min(100%, 420px); }
.heroi {
  flex: 1; min-height: 150px; border-radius: 20px; border: 0; cursor: pointer;
  background: #fff; color: var(--tinta);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 12px 8px; font-family: var(--fonte);
  box-shadow: 0 6px 0 #0058B0, 0 12px 28px rgba(0, 0, 0, .35);
  transition: transform .12s;
}
.heroi[data-heroi="rafaela"] { box-shadow: 0 6px 0 #983848, 0 12px 28px rgba(0, 0, 0, .35); }
.heroi:active { transform: translateY(3px); }
.heroi-sprite { width: 96px; height: 96px; image-rendering: pixelated; }
.heroi-nome { font-weight: 700; font-size: 17px; }
.heroi-desc { font-size: 13px; color: #6E6E73; }
.titulo-rodape { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .65); }

/* mapa */
.cartao-mapa { width: min(100%, 560px); }
.mapa-topo { display: flex; justify-content: space-between; align-items: baseline; }
.mapa-topo h2 { margin: 0; }
.mapa-olhinhos { font-weight: 600; color: #2878D8; font-size: 14px; }
.mapa {
  position: relative; margin-top: 12px; aspect-ratio: 32 / 14; width: 100%;
  border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, #78C8F8 0%, #A8E0F8 60%, #58A8A0 60%, #38A048 100%);
}
.mapa svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.no {
  position: absolute; transform: translate(-50%, -50%);
  width: 44px; height: 44px; min-width: 44px; border-radius: 50%; border: 3px solid #101820;
  background: #B0C8D8; color: #101820; font: 800 15px var(--fonte); cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.no[data-estado="aberto"] { background: var(--ouro); }
.no[data-estado="feito"] { background: #60C850; }
.no[data-estado="travado"] { background: #7890A0; color: #D0D8E0; cursor: default; }
.no[data-sel="1"] { box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--azul); }
.no-casa { border-radius: 10px; background: #fff; }
.no-castelo { border-radius: 8px; background: #702838; color: #fff; }
.mapa-info { min-height: 40px; margin: 12px 0 0; font-size: 15px; }

/* fim de fase */
.fim-selo {
  display: inline-block; margin: 0 0 8px; padding: 4px 12px; border-radius: 999px;
  background: #E5F6F6; color: #008890; font-weight: 700; font-size: 13px;
}
.fim-selo.secreta { background: #FFF6D6; color: #8A5A00; }
.fim-texto { margin: 0; color: #424245; }
.fim-numeros { list-style: none; padding: 0; margin: 16px 0 0; display: flex; gap: 10px; }
.fim-numeros li { flex: 1; background: var(--claro); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; }
.fim-numeros span { font-size: 12px; color: #6E6E73; }
.fim-numeros b { font-size: 22px; }

/* opções */
.opcao {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 52px; padding: 0 4px; border-bottom: 1px solid #E8E8ED; font-size: 16px; text-align: left; cursor: pointer;
}
.opcao input { width: 26px; height: 26px; accent-color: var(--azul); }
#op-tela-cheia { margin-top: 14px; }
.opcao-dica { font-size: 13px; color: #6E6E73; margin: 12px 0 0; }
.creditos { margin: 14px 0 0; font-size: 12px; color: #6E6E73; }
.creditos a { color: var(--azul); }

.aviso {
  position: absolute; left: 50%; top: calc(12px + var(--sa-t)); transform: translateX(-50%); z-index: 30;
  background: rgba(11, 13, 18, .85); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px;
}

@media (max-height: 560px) {
  .logo-jogo { margin-top: 28px; }
  .logo-l1, .logo-l2 { font-size: clamp(28px, 9vh, 48px); }
  .logo-sub { margin-top: 8px; font-size: 12px; }
  .heroi { min-height: 0; padding: 8px; flex-direction: row; gap: 10px; }
  .heroi-sprite { width: 64px; height: 64px; }
  .heroi-desc { display: none; }
  .titulo-chamada { display: none; }
  .cartao { padding: 16px; }
  .acoes-col { flex-direction: row; }
}

/* retrato: a tela do jogo desce abaixo do entalhe (safe-area) */
#app[data-modo="retrato"] { padding-top: var(--sa-t); background: #0B0D12; }
/* botão de ação montado na Lulu = LÍNGUA (cor rosada, rótulo trocado pelo JS) */
.bt-correr[data-modo="lingua"] { background: #F07890 !important; }
.bt-correr[data-modo="lingua"]::after {
  content: ''; position: absolute; left: 50%; bottom: 14%; width: 12px; height: 8px; margin-left: -6px;
  background: #F8C8D0; border-radius: 0 0 8px 8px; pointer-events: none;
}
.no[data-estado="breve"] { background: #FFF6D6; color: #8A5A00; border-style: dashed; cursor: default; }
.logo-jogo.com-pixel { margin-top: 44px; }
.logo-pixel { display: block; image-rendering: pixelated; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .35)); }
.ctl-pausa { min-width: 56px; min-height: 56px; width: 56px; padding: 0; }

/* ---------- Mapa jogável (Parte C): canvas em pixel + barras finas por cima ---------- */
#mapa-tela { position: absolute; image-rendering: pixelated; z-index: 2; touch-action: none; cursor: pointer; }
#mapa-tela[hidden] { display: none; }
.tela-mapa { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; justify-content: space-between; padding: 0; }
.tela-mapa .mapa-barra { pointer-events: auto; }
.mapa-barra {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: calc(8px + var(--sa-t)) calc(10px + var(--sa-r)) 8px calc(10px + var(--sa-l));
}
.mapa-barra-base {
  padding: 10px calc(12px + var(--sa-r)) calc(10px + var(--sa-b)) calc(12px + var(--sa-l));
  background: rgba(11, 13, 18, .72); color: #fff;
}
.mapa-barra-topo .link-btn { min-height: 48px; background: rgba(11, 13, 18, .6); }
.mapa-olhinhos { background: rgba(11, 13, 18, .6); color: #fff; border-radius: 999px; padding: 8px 12px; font-weight: 600; font-size: 13px; }
.mapa-barra-base .mapa-info { margin: 0; min-height: 0; font-size: 14px; flex: 1; }
.mapa-barra-base .btn { min-width: 112px; min-height: 52px; }
.mapa-barra-base .btn:disabled { opacity: .45; }
/* no retrato o mapa fica no palco e as barras não podem cobrir o controle */
#app[data-modo="retrato"] .tela-mapa { bottom: auto; height: var(--altura-palco, 60vh); }
.cartao-final { width: min(100%, 420px); }
.creditos-final { font-size: 12px; color: #6E6E73; margin: 14px 0 0; line-height: 1.5; }
.creditos-final a { color: var(--azul); }
.ctl-pilula { min-height: 56px; }
.btn-pausa[hidden] { display: none; }
/* no mapa só o direcional e o PULAR (= entrar) valem; os outros botões ficam apagados */
#app[data-controle-mapa="1"] .bt-giro, #app[data-controle-mapa="1"] .bt-correr,
#app[data-controle-mapa="1"] #ctl-correr-sempre, #app[data-controle-mapa="1"] #ctl-pausa { opacity: .25; pointer-events: none; }
#app[data-controle-mapa="1"] .bt-pulo b { font-size: 0; }
#app[data-controle-mapa="1"] .bt-pulo b::after { content: 'ENTRAR'; font-size: 14px; }
#app[data-controle-mapa="1"] .ctl-marca { color: #284078; letter-spacing: .08em; }
/* mapa com faixa lateral (paisagem/computador): informação e "Jogar" na faixa da direita,
   em coluna, longe da ilha e acima dos botões de toque */
#app[data-mapa-lateral="1"] .tela-mapa .mapa-barra-base {
  position: absolute; right: 0; top: calc(64px + var(--sa-t)); bottom: auto;
  width: calc(var(--faixa-mapa) - 8px); flex-direction: column; align-items: stretch; gap: 8px;
  background: rgba(11, 13, 18, .72); border-radius: 16px 0 0 16px; padding: 12px 12px 12px 14px;
}
#app[data-mapa-lateral="1"] .tela-mapa .mapa-barra-base .mapa-info { font-size: 13px; line-height: 1.35; }
#app[data-mapa-lateral="1"] .tela-mapa .mapa-barra-topo .mapa-olhinhos { display: none; }
#app[data-mapa-lateral="1"] .tela-mapa .mapa-barra-base::before {
  content: attr(data-olhinhos); font-size: 12px; font-weight: 600; color: #68D8D0;
}
.btn-revanche { background: #702838; color: #fff; min-height: 52px; }
.btn-revanche:hover { background: #983848; }
.btn-revanche[hidden] { display: none; }
#app[data-mapa-lateral="1"] .tela-mapa .mapa-barra-base .btn { min-height: 48px; font-size: 15px; }
/* paisagem: no mapa os botões de ação apagados saem de vez (o painel de informação fica livre) */
#app[data-modo="paisagem"][data-controle-mapa="1"] .bt-giro,
#app[data-modo="paisagem"][data-controle-mapa="1"] .bt-correr { display: none; }
.mapa-barra-base .mapa-info { min-width: 0; }
#app[data-modo="retrato"] .tela-mapa .mapa-barra-base { flex-wrap: wrap; }
#app[data-modo="retrato"] .tela-mapa .mapa-barra-base .mapa-info { flex-basis: 100%; }
#app[data-modo="retrato"] .tela-mapa .mapa-barra-base .btn { flex: 1; min-height: 48px; }
