/* ============================================================
 * style.css — Interface mobile-first
 * Paleta inspirada em Pokémon Yellow / Game Boy Color:
 * verde-oliva do GB + amarelo Pikachu como cor de destaque.
 * Tudo posicionado sobre o canvas, com safe-area para notch.
 * ============================================================ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --gb0: #0f380f;   /* tinta escura   */
  --gb1: #306230;   /* verde médio    */
  --gb2: #8bac0f;   /* verde claro    */
  --gb3: #9bbc0f;   /* tela do GB     */
  --amarelo: #f8d030;
  --amarelo-esc: #b88c08;
  --papel: #f8f8e8;
  --tinta: #182818;
  --moldura: #0a1208;

  /* espaçamentos respeitando notch / barra de gestos */
  --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: "Courier New", ui-monospace, monospace;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--moldura);
  color: var(--papel);
  font-family: var(--fonte);
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- palco ---------- */
#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #060a06;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #060a06;
}

/* ============================================================
 * HUD superior
 * ============================================================ */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(6px + var(--sa-t)) calc(8px + var(--sa-r)) 6px calc(8px + var(--sa-l));
  z-index: 6;
  pointer-events: none;
  transition: opacity .2s;
}

#hudLeft {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(10, 18, 10, .78);
  border: 2px solid var(--gb1);
  border-radius: 999px;
  padding: 4px 11px;
  backdrop-filter: blur(3px);
  min-width: 0;
}

#hudPlace {
  font-size: clamp(10px, 3vw, 13px);
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--amarelo);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

#hudBar {
  width: clamp(44px, 14vw, 90px);
  height: 8px;
  border: 2px solid var(--gb1);
  background: #0a120a;
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}
#hudBarFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gb2), var(--amarelo));
  transition: width .45s cubic-bezier(.2, .9, .3, 1);
}
#hudCount {
  font-size: clamp(9px, 2.6vw, 12px);
  color: var(--gb3);
  white-space: nowrap;
}

#hudRight { pointer-events: auto; }
#btnMenu {
  width: 42px; height: 42px;
  font-size: 20px;
  line-height: 1;
  color: var(--papel);
  background: rgba(10, 18, 10, .8);
  border: 2px solid var(--gb1);
  border-radius: 12px;
  font-family: var(--fonte);
  cursor: pointer;
  backdrop-filter: blur(3px);
}
#btnMenu:active { background: var(--gb1); transform: scale(.94); }

/* ---------- minimapa ---------- */
#minimapWrap {
  position: absolute;
  top: calc(54px + var(--sa-t));
  right: calc(8px + var(--sa-r));
  z-index: 6;                      /* acima do objetivo (5), abaixo da foto (7) */
  pointer-events: auto;
  cursor: pointer;
  background: rgba(10, 18, 10, .82);
  border: 2px solid var(--gb1);
  border-radius: 6px;
  padding: 3px;
  line-height: 0;
  backdrop-filter: blur(3px);
}
#minimap {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 3px;
}
#minimapTag {
  display: none;
  font-size: 20px;
  line-height: 1;
}
/* recolhido: vira um ícone pequeno, sem sumir de vez */
#minimapWrap.closed { padding: 6px 8px; }
#minimapWrap.closed #minimap { display: none; }
#minimapWrap.closed #minimapTag { display: block; }

/* o minimapa aberto ocupa o canto direito: o chip de objetivo e o
   toast precisam recuar, senão ficam por baixo dele */
body.mini-open #objective { right: calc(8px + var(--sa-r) + 124px); }
body.mini-open #toast { top: calc(150px + var(--sa-t)); }

/* ---------- chip de objetivo ---------- */
#objective {
  position: absolute;
  top: calc(52px + var(--sa-t));
  left: calc(8px + var(--sa-l));
  right: calc(8px + var(--sa-r));
  z-index: 5;
  pointer-events: none;
  display: flex;
  justify-content: flex-start;
}
#objectiveText {
  display: inline-block;
  max-width: 100%;
  background: rgba(10, 18, 10, .8);
  border: 2px solid var(--amarelo-esc);
  border-left-width: 5px;
  color: var(--papel);
  font-size: clamp(10px, 2.9vw, 13px);
  line-height: 1.3;
  padding: 5px 10px;
  border-radius: 4px;
  backdrop-filter: blur(3px);
}
#objectiveText.pulse { animation: pulse .7s ease-out 2; }
@keyframes pulse {
  0%, 100% { border-left-color: var(--amarelo-esc); }
  50% { border-left-color: var(--amarelo); box-shadow: 0 0 12px rgba(248, 208, 48, .5); }
}

/* ============================================================
 * Caixa de diálogo — pequena, sempre no rodapé,
 * deixando o mapa visível acima dela.
 * ============================================================ */
#dialogue {
  position: absolute;
  left: calc(8px + var(--sa-l));
  right: calc(8px + var(--sa-r));
  bottom: calc(8px + var(--sa-b));
  z-index: 8;
  background: var(--papel);
  color: var(--tinta);
  border: 3px solid var(--tinta);
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px var(--papel), inset 0 0 0 4px #c8c8a8,
              0 6px 18px rgba(0, 0, 0, .5);
  padding: 12px 14px 10px;
  display: none;
  transform: translateY(14px);
  opacity: 0;
  transition: transform .16s ease-out, opacity .16s ease-out;
  cursor: pointer;
}
#dialogue.visible { display: block; transform: translateY(0); opacity: 1; }

/* retrato do falante — sprite ampliado no canto da caixa */
#dlgFace {
  position: absolute;
  left: 12px;
  bottom: 10px;
  width: 46px;
  height: 46px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #d8d8c0;
  border: 2px solid var(--tinta);
  border-radius: 6px;
  display: none;
}
#dialogue.comFace #dlgFace { display: block; }
/* com retrato, o texto abre espaço à esquerda */
#dialogue.comFace #dlgText { margin-left: 56px; }

#dlgName {
  position: absolute;
  top: -13px;
  left: 14px;
  background: var(--tinta);
  color: var(--amarelo);
  font-size: clamp(9px, 2.6vw, 11px);
  font-weight: bold;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 999px;
  max-width: calc(100% - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dlgText {
  margin: 4px 0 0;
  font-size: clamp(13px, 3.8vw, 17px);
  line-height: 1.45;
  min-height: 2.6em;      /* altura estável: a caixa não "pula" entre falas */
  letter-spacing: .2px;
}

/* ---------- estilo por falante ---------- */
/* NARRADOR: a voz do mundo — caixa escura, texto em itálico, sem retrato */
#dialogue.narrador {
  background: #16201a;
  color: #e6efd8;
  border-color: #0a1208;
  box-shadow: inset 0 0 0 2px #16201a, inset 0 0 0 4px #2a3a2a,
              0 6px 18px rgba(0, 0, 0, .5);
}
#dialogue.narrador #dlgText { font-style: italic; margin-left: 0; }
#dialogue.narrador #dlgName { background: #0a1208; color: var(--gb3); }

/* PLACA: cara de sinalização — centralizada, versalete, borda dupla marcada */
#dialogue.placa {
  background: #e8e4cf;
  border-color: #4a4636;
  box-shadow: inset 0 0 0 3px #e8e4cf, inset 0 0 0 6px #b8a860,
              0 6px 18px rgba(0, 0, 0, .5);
}
#dialogue.placa #dlgText {
  text-align: center;
  font-variant: small-caps;
  letter-spacing: 1px;
  margin-left: 0;
}
#dialogue.placa #dlgName { background: #7a4a20; color: #f8e8c0; }

/* DIÁRIO: mensagem do sistema (área bloqueada) */
#dialogue.sistema { background: #101c22; color: #cfe4ee; border-color: #06121a; }
#dialogue.sistema #dlgText { margin-left: 0; }
#dialogue.sistema #dlgName { background: #06121a; color: #7fd8f0; }

/* saída da conversa — alvo de toque confortável no canto da caixa */
#dlgClose {
  position: absolute;
  top: -14px;
  right: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-family: var(--fonte);
  font-size: 15px;
  font-weight: bold;
  line-height: 1;
  color: var(--papel);
  background: var(--tinta);
  border: 2px solid var(--papel);
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}
#dlgClose:active { background: var(--gb1); transform: scale(.92); }
/* na escolha "Seguir viagem / Saber mais" o ✕ seria um terceiro
   alvo competindo com botões que já significam sair e continuar */
#dialogue.choosing #dlgClose { display: none; }

#dlgNext {
  position: absolute;
  right: 12px;
  bottom: 6px;
  font-size: 13px;
  color: var(--gb1);
  opacity: 0;
  animation: bob .9s infinite;
}
#dialogue.ready #dlgNext { opacity: 1; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* escolhas (ex.: "saber mais") */
#dlgChoices { display: none; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
/* o retrato é ancorado no canto inferior esquerdo da caixa: sem esta
   margem ele cobre o primeiro botão — o mesmo recuo que #dlgText já usa */
#dialogue.comFace #dlgChoices { margin-left: 56px; }
#dialogue.choosing #dlgChoices { display: flex; }
#dialogue.choosing #dlgNext { display: none; }
#dlgChoices button {
  flex: 1;
  font-family: var(--fonte);
  font-size: clamp(11px, 3.2vw, 14px);
  font-weight: bold;
  padding: 9px 6px;
  border: 3px solid var(--tinta);
  border-radius: 8px;
  background: #e4e4d0;
  color: var(--tinta);
  cursor: pointer;
}
#dlgChoices button.sel {
  background: var(--amarelo);
  box-shadow: inset 0 0 0 2px var(--papel);
}
/* Saída para o relatório em texto. Cai numa linha própria abaixo das
 * escolhas e usa borda pontilhada: não é uma terceira opção da conversa,
 * é uma porta para fora do jogo. As setas do teclado continuam
 * alternando só entre os dois botões — aqui se chega por toque ou TAB. */
#dlgChoices a.linkOut {
  flex: 1 0 100%;
  font-family: var(--fonte);
  font-size: clamp(10px, 3vw, 13px);
  text-align: center;
  text-decoration: none;
  padding: 8px 6px;
  border: 2px dashed var(--amarelo);
  border-radius: 8px;
  background: rgba(10, 18, 10, .55);
  color: var(--amarelo);
  cursor: pointer;
}

/* Ponte para a tese que originou o capítulo/ficha, no Diário e na ficha.
 * Mesma borda pontilhada do #linkOut, pela mesma razão: sinaliza porta
 * para fora do jogo, e não mais um item da lista. */
a.linkTese {
  display: block;
  margin: 8px 0 4px;
  padding: 7px 9px;
  font-family: var(--fonte);
  font-size: clamp(10px, 2.9vw, 12px);
  font-weight: bold;
  text-decoration: none;
  border: 2px dashed var(--amarelo-esc);
  border-radius: 8px;
  background: rgba(10, 18, 10, .06);
  color: var(--amarelo-esc);
}
a.linkTese span {
  display: block;
  margin-top: 3px;
  font-weight: normal;
  font-style: italic;
  opacity: .82;
}
a.linkTese:hover, a.linkTese:focus {
  background: rgba(248, 208, 48, .16);
  border-style: solid;
}

/* ============================================================
 * Foto — cartão acima do diálogo, nunca cobrindo a tela toda
 * ============================================================ */
#photoPanel {
  position: absolute;
  left: 50%;
  bottom: calc(50% - 4px);
  transform: translate(-50%, 50%) scale(.92);
  width: min(340px, 76vw);
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  border: 3px solid var(--tinta);
  border-radius: 8px;
  padding: 7px 8px 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 7;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .55);
}
#photoPanel.visible { opacity: 1; transform: translate(-50%, 50%) scale(1); }
#photoImg {
  width: 100%;
  display: block;
  border: 2px solid var(--tinta);
  max-height: min(34vh, 220px);
  object-fit: cover;
  background: #111;
}
#photoCap {
  margin: 5px 2px 2px;
  font-size: clamp(9px, 2.6vw, 11px);
  line-height: 1.35;
  font-style: italic;
}

/* ---------- toast ---------- */
#toast {
  position: absolute;
  left: 50%;
  top: calc(96px + var(--sa-t));
  transform: translate(-50%, -8px);
  background: rgba(10, 18, 10, .94);
  border: 2px solid var(--amarelo);
  color: var(--papel);
  font-size: clamp(11px, 3vw, 14px);
  padding: 9px 16px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  max-width: 84vw;
  text-align: center;
  z-index: 9;
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
 * Controles de toque
 * ============================================================ */
#touch {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: min(230px, 34vh);
  z-index: 6;
  display: none;                 /* ligado por JS em telas de toque */
  pointer-events: none;
}
body.touch #touch { display: block; }
/* com o Diário aberto, o HUD sai da frente */
body.panel #hud, body.panel #objective,
body.ficha #hud, body.ficha #objective { opacity: 0; pointer-events: none; }
/* título e encerramento são telas cheias: nada de HUD por cima */
body.title #hud, body.title #objective,
body.title #dialogue, body.title #photoPanel,
body.title #minimapWrap, body.panel #minimapWrap,
body.ficha #minimapWrap { display: none; }
body.dialog #touch,
body.panel #touch,
body.ficha #touch,
body.title #touch { display: none; }

/* ---------- ponte para o relatório em texto ---------- */
/* Só na tela de título: no encerramento (que reusa `body.title`) o
 * palco é do "FIM DA MISSÃO", e um toque perdido no link tiraria o
 * jogador do jogo. `renderTitle` reserva a faixa de baixo do canvas
 * para este link — ver o clamp da dica em js/game.js. */
#linkDoc { display: none; }
body.title:not(.ending) #linkDoc {
  display: flex;
  align-items: center;
  position: absolute;
  left: 50%;
  bottom: calc(10px + var(--sa-b));
  transform: translateX(-50%);
  min-height: 40px;
  padding: 0 16px;
  max-width: 90vw;
  font-family: var(--fonte);
  font-size: clamp(11px, 3vw, 14px);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  background: rgba(10, 18, 10, .9);
  border: 2px solid var(--amarelo);
  border-radius: 8px;
  color: var(--amarelo);
  pointer-events: auto;
  z-index: 9;
}

#pad {
  position: absolute;
  left: calc(14px + var(--sa-l));
  bottom: calc(16px + var(--sa-b));
  width: min(150px, 38vw);
  height: min(150px, 38vw);
  pointer-events: auto;
  touch-action: none;
  opacity: .95;
}
#pad .cap {
  position: absolute;
  /* contraste alto: o direcional aparece tanto sobre asfalto quanto grama */
  background: rgba(14, 22, 14, .92);
  border: 3px solid var(--gb3);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .55);
  border-radius: 8px;
  width: 33.4%;
  height: 33.4%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gb3);
  font-size: clamp(13px, 4.4vw, 20px);
  line-height: 1;
  transition: background .08s, color .08s;
}
#pad .cap.up::before    { content: "▲"; }
#pad .cap.down::before  { content: "▼"; }
#pad .cap.left::before  { content: "◀"; }
#pad .cap.right::before { content: "▶"; }
#pad .cap.up    { left: 33.3%; top: 0; }
#pad .cap.down  { left: 33.3%; bottom: 0; }
#pad .cap.left  { left: 0; top: 33.3%; }
#pad .cap.right { right: 0; top: 33.3%; }
#pad .cap.mid   { left: 33.3%; top: 33.3%; border-radius: 3px; border-color: var(--gb1); }
#pad .cap.on { background: var(--amarelo); border-color: var(--papel); color: var(--tinta); }

#actions {
  position: absolute;
  right: calc(16px + var(--sa-r));
  bottom: calc(22px + var(--sa-b));
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: auto;
}
#actions button {
  width: min(74px, 19vw);
  height: min(74px, 19vw);
  border-radius: 50%;
  font-family: var(--fonte);
  font-size: clamp(16px, 5vw, 22px);
  font-weight: bold;
  color: var(--tinta);
  background: var(--amarelo);
  border: 3px solid var(--moldura);
  box-shadow: 0 4px 0 var(--amarelo-esc);
  cursor: pointer;
  touch-action: none;
}
#actions #btnB {
  width: min(58px, 15vw);
  height: min(58px, 15vw);
  background: var(--gb2);
  box-shadow: 0 4px 0 var(--gb1);
  font-size: clamp(13px, 4vw, 18px);
}
#actions button:active,
#actions button.on { transform: translateY(4px); box-shadow: none; }

/* O A acende quando há algo interagível bem à frente do jogador: é o elo
   entre o alvo marcado no mapa e o botão embaixo do polegar. */
#actions #btnA.hint {
  animation: btnAHint .9s ease-in-out infinite;
  border-color: var(--papel);
}
@keyframes btnAHint {
  0%, 100% { box-shadow: 0 4px 0 var(--amarelo-esc), 0 0 0 0 rgba(248, 208, 48, .55); }
  50%      { box-shadow: 0 4px 0 var(--amarelo-esc), 0 0 0 10px rgba(248, 208, 48, 0); }
}
@media (prefers-reduced-motion: reduce) {
  #actions #btnA.hint { animation: none; box-shadow: 0 4px 0 var(--amarelo-esc), 0 0 0 4px rgba(248, 208, 48, .5); }
}

/* ============================================================
 * Painel (Diário de Bordo / álbum)
 * ============================================================ */
#panel, #ficha {
  position: absolute;
  inset: 0;
  background: #070d07;
  z-index: 12;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(12px + var(--sa-t)) calc(12px + var(--sa-r)) calc(24px + var(--sa-b)) calc(12px + var(--sa-l));
  touch-action: pan-y;
}
#ficha { z-index: 13; }   /* acima do painel: pode ser aberta a partir dele */
#panel.visible, #ficha.visible { display: block; }
#panelInner, #fichaInner { max-width: 720px; margin: 0 auto; }

#panel h2 {
  margin: 0 0 4px;
  font-size: clamp(15px, 4.4vw, 20px);
  color: var(--amarelo);
  letter-spacing: 1px;
}
#panel .sub {
  margin: 0 0 14px;
  font-size: clamp(10px, 3vw, 12px);
  color: var(--gb2);
}
#panel h3 {
  margin: 18px 0 8px;
  font-size: clamp(12px, 3.4vw, 15px);
  color: var(--gb3);
  border-bottom: 2px solid var(--gb1);
  padding-bottom: 4px;
}
#panel ul { list-style: none; margin: 0; padding: 0; }

#panel li.ch {
  border-left: 4px solid #3a4a3a;
  padding: 7px 10px;
  margin-bottom: 7px;
  background: rgba(255, 255, 255, .03);
  border-radius: 0 5px 5px 0;
  opacity: .5;
}
#panel li.ch.done { border-left-color: var(--gb2); opacity: 1; }
#panel li.ch.next {
  border-left-color: var(--amarelo);
  opacity: 1;
  background: rgba(248, 208, 48, .09);
}
#panel li.ch b { font-size: clamp(12px, 3.4vw, 14px); display: block; }
#panel li.ch .meta { font-size: clamp(9px, 2.6vw, 11px); color: #9ab08a; }
#panel li.ch p { margin: 5px 0 0; font-size: clamp(10px, 3vw, 12px); line-height: 1.45; color: #d6e6c4; }
#panel li.ch .tasks { margin: 6px 0 0; padding: 0; }
#panel li.ch .tasks li {
  font-size: clamp(10px, 2.9vw, 12px);
  color: #a8bd98;
  padding: 2px 0;
}
#panel li.ch .tasks li.ok { color: var(--gb2); }

#album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 7px;
}
#album .slot {
  aspect-ratio: 4 / 3;
  border: 2px solid var(--gb1);
  border-radius: 4px;
  background: #0d160d center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #46583f;
  font-size: 20px;
}

#panel .stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
#panel .stat {
  flex: 1 1 90px;
  background: rgba(255, 255, 255, .04);
  border: 2px solid var(--gb1);
  border-radius: 6px;
  padding: 7px 9px;
}
#panel .stat b { display: block; font-size: clamp(15px, 5vw, 20px); color: var(--amarelo); }
#panel .stat span { font-size: clamp(9px, 2.6vw, 11px); color: #9ab08a; }

#mapaGrande {
  border: 2px solid var(--gb1);
  border-radius: 5px;
  background: #0d160d;
  padding: 4px;
  overflow-x: auto;
}
#mapaGrande img {
  display: block;
  width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#panel .legenda {
  margin: 6px 0 0;
  font-size: clamp(9px, 2.7vw, 11px);
  color: #9ab08a;
}

#panel .closeBtn, #ficha .closeBtn {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  font-family: var(--fonte);
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: bold;
  color: var(--tinta);
  background: var(--amarelo);
  border: 3px solid var(--moldura);
  border-radius: 8px;
  cursor: pointer;
}

/* ---------- lista de fichas no Diário ---------- */
#panel .fichaList { list-style: none; margin: 0; padding: 0; }
#panel li.fi {
  border-left: 4px solid #3a4a3a;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, .03);
  border-radius: 0 5px 5px 0;
  font-size: clamp(11px, 3.2vw, 14px);
  opacity: .5;
}
#panel li.fi.done { border-left-color: var(--amarelo); opacity: 1; cursor: pointer; }
#panel li.fi.done:active { background: rgba(248, 208, 48, .12); }
#panel li.fi .meta { display: block; font-size: clamp(9px, 2.6vw, 11px); color: #9ab08a; }

/* Controles — consulta rápida no meio da partida */
#panel .ctrlList { list-style: none; margin: 0; padding: 0; }
#panel .ctrlList li {
  padding: 7px 10px;
  margin-bottom: 5px;
  background: rgba(255, 255, 255, .03);
  border-left: 4px solid var(--gb2);
  border-radius: 0 5px 5px 0;
  font-size: clamp(11px, 3.2vw, 14px);
}
#panel .ctrlList b { color: var(--amarelo); }
#panel .ctrlList .meta { display: block; font-size: clamp(9px, 2.6vw, 11px); color: #9ab08a; }

/* ---------- ficha ---------- */
.fichaHead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
#fichaFace {
  width: 56px; height: 56px; flex: none;
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #0d160d; border: 2px solid var(--gb1); border-radius: 6px;
}
#ficha h2 { margin: 0; font-size: clamp(15px, 4.6vw, 21px); color: var(--amarelo); letter-spacing: 1px; }
#ficha .sub { margin: 2px 0 0; font-size: clamp(10px, 3vw, 12px); color: var(--gb2); }

.fichaFoto { margin-bottom: 12px; }
.fichaFoto img {
  width: 100%; display: block; border: 2px solid var(--gb1); border-radius: 5px;
  max-height: 34vh; object-fit: cover;
}
.fichaFoto span { display: block; margin-top: 5px; font-size: clamp(9px, 2.7vw, 11px); font-style: italic; color: #9ab08a; }

.fichaDados { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.fichaDados tr { border-bottom: 1px solid #24331f; }
.fichaDados th {
  text-align: left; font-weight: normal; vertical-align: top;
  padding: 8px 10px 8px 0; color: #cfe0bd; font-size: clamp(11px, 3.1vw, 13px);
}
.fichaDados th { width: 52%; }
.fichaDados td {
  text-align: right; vertical-align: top;
  padding: 8px 0; color: var(--amarelo); font-weight: bold; font-size: clamp(12px, 3.4vw, 15px);
}
.fichaResumo {
  margin: 0 0 6px; padding: 10px 12px; border-left: 4px solid var(--gb1);
  background: rgba(255, 255, 255, .03); border-radius: 0 5px 5px 0;
  font-size: clamp(11px, 3.1vw, 13px); line-height: 1.5; color: #d6e6c4;
}
#panel .row { display: flex; gap: 8px; }
#panel .row button {
  flex: 1;
  margin-top: 10px;
  padding: 10px;
  font-family: var(--fonte);
  font-size: clamp(11px, 3.1vw, 13px);
  color: var(--papel);
  background: #1a2a1e;
  border: 2px solid var(--gb1);
  border-radius: 7px;
  cursor: pointer;
}
#panel .row button:active { background: var(--gb1); }

/* ============================================================
 * Paisagem em telas baixas: encolhe HUD e diálogo,
 * afasta os controles das bordas laterais.
 * ============================================================ */
@media (orientation: landscape) and (max-height: 480px) {
  #objective { top: calc(46px + var(--sa-t)); }
  /* aqui sobra largura e falta altura: o toast não precisa descer para
     escapar do minimapa (a largura já o afasta), e descer o faria bater
     na faixa com o nome do local, desenhada no meio do canvas */
  body.mini-open #toast { top: calc(90px + var(--sa-t)); }
  #minimapWrap { top: calc(48px + var(--sa-t)); }
  #dialogue { left: calc(14px + var(--sa-l)); right: calc(14px + var(--sa-r)); bottom: calc(6px + var(--sa-b)); padding: 9px 12px 8px; }
  #dlgText { min-height: 2.4em; font-size: clamp(12px, 3.4vh, 16px); }
  #photoPanel { width: min(300px, 42vw); bottom: calc(50% + 6px); }
  #photoImg { max-height: 28vh; }
  #touch { height: 100%; }
  #pad { width: min(128px, 26vh); height: min(128px, 26vh); bottom: calc(10px + var(--sa-b)); }
  #actions { bottom: calc(14px + var(--sa-b)); }
  #actions button { width: min(62px, 15vh); height: min(62px, 15vh); }
  #actions #btnB { width: min(50px, 12vh); height: min(50px, 12vh); }
}

/* ---------- telas grandes: moldura de console ---------- */
@media (min-width: 900px) and (min-height: 620px) {
  #dialogue {
    left: 50%;
    transform: translateX(-50%) translateY(14px);
    width: min(760px, 82vw);
    right: auto;
    bottom: 22px;
  }
  #dialogue.visible { transform: translateX(-50%) translateY(0); }
  #objective { left: 50%; transform: translateX(-50%); right: auto; justify-content: center; }
}
