/* =============================================================
   estilo.css — Visual da interface (menus, barra, batalha)
   ============================================================= */
:root {
  --madeira: #8d5a3b;
  --madeira-escura: #5d3a24;
  --papel: #fff8e7;
  --papel-escuro: #f1e3c4;
  --tinta: #3b2a1e;
  --tinta-suave: #7a6552;
  --verde: #4caf50;
  --verde-escuro: #2e7d32;
  --vermelho: #e5533d;
  --dourado: #f2c94c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #1f3d1c;
  font-family: 'Fredoka', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  color: var(--tinta);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body { display: flex; align-items: center; justify-content: center; }

#tela {
  position: relative;
  width: min(100vw, calc(100vh * 5 / 3));
  width: min(100vw, calc(100dvh * 5 / 3)); /* no celular, desconta a barra do navegador */
  aspect-ratio: 5 / 3;
  container-type: inline-size;
  overflow: hidden;
  font-size: clamp(11px, 1.55cqw, 17px);
}

#jogo { position: absolute; inset: 0; }
#jogo canvas { display: block; }

.escondido { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

/* ---------- HUD (topo) ---------- */
#hud {
  position: absolute;
  top: 0.6em; left: 0.8em; right: 0.8em;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}
#hud > * { pointer-events: auto; display: flex; gap: 0.4em; }

.hud-info span, .hud-botoes button {
  background: var(--papel);
  border: 3px solid var(--madeira);
  border-radius: 0.7em;
  padding: 0.2em 0.7em;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}
.hud-botoes button:hover { background: #fff; transform: translateY(-1px); }
#hud-hora { min-width: 5.2em; text-align: center; font-variant-numeric: tabular-nums; }
#hud-hora.tarde { background: #ffd9cf; border-color: var(--vermelho); animation: pulsar 1.2s infinite; }
@keyframes pulsar { 50% { opacity: 0.6; } }

/* ---------- Dica de interação ---------- */
#dica {
  position: absolute;
  left: 50%;
  bottom: 6.7em;
  transform: translateX(-50%);
  background: rgba(59, 42, 30, 0.88);
  color: #fff;
  padding: 0.35em 0.9em 0.35em 0.4em;
  border-radius: 2em;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.tecla-e {
  background: var(--dourado);
  color: var(--tinta);
  border-radius: 50%;
  width: 1.6em; height: 1.6em;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

/* ---------- Barra de itens ---------- */
#hotbar {
  position: absolute;
  left: 50%;
  bottom: 0.5em;
  transform: translateX(-50%);
  display: flex;
  gap: 0.35em;
  align-items: flex-end;
  background: rgba(93, 58, 36, 0.85);
  padding: 0.35em;
  border-radius: 0.8em;
  border: 3px solid var(--madeira-escura);
}
.slot {
  position: relative;
  width: 3.3em; height: 3.3em;
  background: var(--papel);
  border: 3px solid var(--papel-escuro);
  border-radius: 0.5em;
  padding: 0;
  display: grid;
  place-items: center;
}
.slot img { width: 85%; height: 85%; }
.slot.ativo { border-color: var(--dourado); box-shadow: 0 0 0 2px var(--dourado); transform: translateY(-3px); }
.slot .qtd {
  position: absolute; right: 0.15em; bottom: 0;
  font-weight: 700; font-size: 0.85em;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff;
}
.slot .tecla {
  position: absolute; left: 0.25em; top: 0;
  font-size: 0.7em; color: var(--tinta-suave);
}
.hotbar-nome {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.2em;
  color: #fff;
  font-size: 0.8em;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}
.hotbar-vazia { color: #fff; padding: 0.4em 0.8em; }

/* ---------- Toast (aviso rápido) ---------- */
#toast {
  position: absolute;
  top: 3.6em;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  background: var(--papel);
  border: 3px solid var(--madeira);
  border-radius: 0.8em;
  padding: 0.5em 1em;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  animation: descer 0.25s ease-out;
  pointer-events: none;
  z-index: 20;
}
@keyframes descer { from { transform: translate(-50%, -1em); opacity: 0; } }

/* ---------- Janelas (modal) ---------- */
#modal {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 8, 0.55);
  display: grid;
  place-items: center;
  z-index: 10;
}
.painel {
  position: relative;
  background: var(--papel);
  border: 4px solid var(--madeira);
  border-radius: 1em;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
  width: min(52em, 90%);
  max-height: 90%;
  overflow: auto;
  padding: 1em 1.3em;
  animation: aparecer 0.18s ease-out;
}
#modal.pequeno .painel { width: min(26em, 90%); text-align: center; }
#modal.revelar .painel { width: min(26em, 90%); text-align: center; overflow: hidden; }
@keyframes aparecer { from { transform: scale(0.92); opacity: 0; } }

.fechar {
  position: absolute; top: 0.4em; right: 0.5em;
  background: none; border: none;
  font-size: 1.2em; color: var(--tinta-suave);
}
.painel h1, .painel h2 { margin: 0 0 0.3em; }
.painel h2 { font-size: 1.5em; }
.sub { color: var(--tinta-suave); margin: 0 0 0.8em; }
.centro { text-align: center; margin: 0.6em 0; }
.linha-botoes { display: flex; gap: 0.6em; justify-content: center; flex-wrap: wrap; margin-top: 0.9em; }
.pergunta { font-size: 1.15em; font-weight: 600; margin: 0.6em 0; }

.btn {
  background: var(--papel-escuro);
  border: 3px solid var(--madeira);
  border-radius: 0.7em;
  padding: 0.35em 1em;
  font-weight: 600;
  box-shadow: 0 3px 0 var(--madeira-escura);
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--madeira-escura); }
.btn.principal { background: var(--verde); border-color: var(--verde-escuro); color: #fff; box-shadow: 0 3px 0 #1b5e20; }
.btn.perigo { background: var(--vermelho); border-color: #a3301f; color: #fff; box-shadow: 0 3px 0 #7a2416; }

.tipo {
  display: inline-block;
  color: #fff;
  font-size: 0.75em;
  font-weight: 600;
  padding: 0.05em 0.5em;
  border-radius: 1em;
  margin: 0 0.1em;
}

/* ---------- Loja ---------- */
.lista-loja { display: grid; gap: 0.5em; }
.item-loja {
  display: flex; align-items: center; gap: 0.8em;
  background: #fff;
  border: 2px solid var(--papel-escuro);
  border-radius: 0.7em;
  padding: 0.4em 0.7em;
}
.item-loja img { width: 3.6em; height: 3.6em; }
.item-loja .info { flex: 1; }
.item-loja small { display: block; color: var(--tinta-suave); }

/* ---------- Cartões de criatura ---------- */
.grade-criaturas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5em, 1fr));
  gap: 0.6em;
}
.cartao {
  position: relative;
  background: #fff;
  border: 3px solid var(--papel-escuro);
  border-radius: 0.8em;
  padding: 0.4em;
  text-align: center;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.15em;
}
.cartao:hover { border-color: var(--madeira); }
.cartao img { width: 5.5em; height: 5.5em; }
.cartao small { color: var(--tinta-suave); }
.cartao.selecionado { border-color: var(--verde); box-shadow: 0 0 0 3px var(--verde); }
.cartao.desativado { opacity: 0.5; cursor: not-allowed; }
.cartao .selo {
  position: absolute; top: 0.3em; left: 0.3em;
  background: var(--dourado); border-radius: 1em;
  font-size: 0.7em; font-weight: 700; padding: 0 0.5em;
}
.cartao .brilho { position: absolute; top: 0.2em; right: 0.3em; }
.cartao .nota { color: var(--vermelho); font-weight: 600; }

.barra-hp {
  width: 90%; height: 0.5em;
  background: #5a4636;
  border-radius: 1em;
  overflow: hidden;
}
.barra-hp > div { height: 100%; background: #5cc04a; border-radius: 1em; }
.barra-hp.media > div { background: #f2c230; }
.barra-hp.baixa > div { background: #e5533d; }

/* ---------- Estufa ---------- */
.cruzamento {
  display: flex; align-items: center; justify-content: center; gap: 0.6em;
  margin: 0.4em 0;
}
.slot-cruza {
  width: 7em; height: 7em;
  border: 3px dashed var(--madeira);
  border-radius: 0.8em;
  display: grid; place-items: center;
  color: var(--tinta-suave);
  background: #fff;
}
.slot-cruza span { font-size: 2.6em; }
.slot-cruza.cheio { border-style: solid; }
.slot-cruza img { width: 6.4em; height: 6.4em; }
.cruzamento .x { font-size: 2em; font-weight: 700; color: var(--madeira); }

/* ---------- Ficha da criatura ---------- */
.ficha { display: flex; gap: 1.2em; align-items: center; flex-wrap: wrap; justify-content: center; }
.ficha-arte {
  background: radial-gradient(circle, #fff 30%, #e6f4d6 100%);
  border-radius: 1em;
  border: 3px solid var(--papel-escuro);
  padding: 0.5em;
}
.ficha.brilhante .ficha-arte { background: radial-gradient(circle, #fffbe0 30%, #ffe27a 100%); border-color: var(--dourado); }
.ficha-arte img { width: 12em; height: 12em; display: block; }
.ficha-info { flex: 1; min-width: 16em; }
.ficha-info p { margin: 0.25em 0; }
.stats { width: 100%; border-collapse: collapse; margin: 0.5em 0; }
.stats td { padding: 0.15em 0.3em; }
.stats td:first-child { width: 6.5em; color: var(--tinta-suave); }
.stats td:last-child { width: 3em; text-align: right; font-weight: 700; }
.barrinha { height: 0.55em; background: var(--papel-escuro); border-radius: 1em; overflow: hidden; }
.barrinha > div { height: 100%; background: var(--verde); border-radius: 1em; }
.mutacao { color: #8e44ad; font-weight: 600; }
.novidade { color: var(--verde-escuro); font-weight: 700; }

/* ---------- Revelação (colheita) ---------- */
.revelacao { position: relative; }
.revelacao > * { position: relative; }
.revelacao .raios {
  position: absolute;
  left: 50%; top: 42%;
  width: 34em; height: 34em;
  margin: -17em 0 0 -17em;
  background: repeating-conic-gradient(rgba(242, 201, 76, 0.22) 0 10deg, transparent 10deg 20deg);
  border-radius: 50%;
  animation: girar 12s linear infinite;
}
.revelacao.brilhante .raios { background: repeating-conic-gradient(rgba(255, 215, 0, 0.5) 0 10deg, transparent 10deg 20deg); }
@keyframes girar { to { transform: rotate(360deg); } }
.revelacao img.surgir { width: 12em; height: 12em; animation: surgir 0.9s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes surgir { from { transform: scale(0) rotate(-25deg); opacity: 0; } }
.revelacao h2 { font-size: 2em; margin: 0; }

.boas-vindas ul { text-align: left; line-height: 1.6; padding-left: 1.2em; }
.controles {
  background: var(--papel-escuro);
  border-radius: 0.7em;
  padding: 0.5em 0.9em;
  font-size: 0.9em;
  line-height: 1.6;
}
kbd {
  background: #fff;
  border: 2px solid var(--madeira);
  border-bottom-width: 3px;
  border-radius: 0.35em;
  padding: 0 0.35em;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9em;
}

/* ---------- Batalha ---------- */
#batalha-ui {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 26%;
  background: var(--papel);
  border-top: 5px solid var(--madeira);
  display: flex;
  gap: 1em;
  padding: 0.8em 1.2em;
}
#batalha-msg {
  flex: 1;
  font-size: 1.3em;
  font-weight: 600;
  display: flex;
  align-items: center;
}
#batalha-ui.so-msg { cursor: pointer; }
#batalha-ui.so-msg #batalha-msg::after { content: ' ▼'; color: var(--tinta-suave); font-size: 0.7em; margin-left: 0.4em; animation: piscar 0.8s infinite; }
@keyframes piscar { 50% { opacity: 0.2; } }
#batalha-ui.so-msg #batalha-botoes { display: none; }
#batalha-botoes {
  flex: 1.3;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4em;
  align-content: center;
  overflow: auto;
}
.btn-golpe {
  --cor: #8a7a6a;
  position: relative;
  background: #fff;
  border: 3px solid var(--cor);
  border-left-width: 0.6em;
  border-radius: 0.6em;
  padding: 0.3em 0.6em 0.3em 1.6em;
  text-align: left;
  font-weight: 600;
}
.btn-golpe:hover:not(:disabled) { background: var(--papel-escuro); }
.btn-golpe .n {
  position: absolute; left: 0.45em; top: 50%; transform: translateY(-50%);
  font-size: 0.75em; color: var(--tinta-suave);
}
.btn-golpe.secundario { --cor: var(--madeira); background: var(--papel-escuro); }

/* ---------- Coisas das janelas novas ---------- */
#hud-area { font-size: 0.9em; }
.painel h3 { margin: 0.9em 0 0.4em; font-size: 1.1em; }
.vazio { color: var(--tinta-suave); font-style: italic; margin: 0.3em 0; }
.aviso-verde {
  background: #e3f5dc;
  border: 2px solid var(--verde);
  border-radius: 0.6em;
  padding: 0.4em 0.7em;
  font-weight: 600;
}

.abas { display: flex; gap: 0.4em; margin-bottom: 0.7em; }
.aba {
  background: var(--papel-escuro);
  border: 3px solid var(--madeira);
  border-radius: 0.7em 0.7em 0.2em 0.2em;
  padding: 0.25em 1em;
  font-weight: 600;
  opacity: 0.7;
}
.aba.ativa { background: #fff; opacity: 1; }

.icone-grande { font-size: 2.2em; width: 1.6em; text-align: center; }
.item-loja .btn { white-space: nowrap; }
.item-loja.comprado { background: #eef8e8; }
.feito { color: var(--verde-escuro); font-weight: 700; white-space: nowrap; }
.bloqueado { color: var(--tinta-suave); font-size: 0.85em; text-align: right; max-width: 11em; }
.local { font-size: 0.8em; color: var(--tinta-suave); margin-left: 0.4em; }

.lista-pedidos { display: grid; gap: 0.6em; }
.pedido {
  display: flex; align-items: center; gap: 0.8em;
  background: #fffdf3;
  border: 2px dashed var(--madeira);
  border-radius: 0.7em;
  padding: 0.5em 0.8em;
}
.pedido .info { flex: 1; }
.pedido p { margin: 0.15em 0; }
.pedido small { color: var(--tinta-suave); }
.pedido.feito { opacity: 0.6; border-style: solid; }

.chips { display: flex; flex-wrap: wrap; gap: 0.35em; }
.chip {
  background: #fff;
  border: 2px solid var(--papel-escuro);
  border-radius: 1em;
  padding: 0.15em 0.7em;
  font-size: 0.9em;
}
.chip.ouro { background: #fff6d6; border-color: var(--dourado); font-weight: 600; }
.chip.apagado { color: var(--tinta-suave); }

.cartao.desconhecido { cursor: default; background: var(--papel-escuro); }
.silhueta { width: 2.1em; height: 2.1em; display: grid; place-items: center; font-size: 2.6em; opacity: 0.6; }

/* ---------- Tela de título e conta ---------- */
#modal.titulo { background: radial-gradient(circle at 50% 30%, #3f7f3a 0%, #1f3d1c 75%); }
#modal.titulo .painel { width: min(30em, 92%); text-align: center; }
.titulo-jogo h1 { font-size: 3em; margin: 0.1em 0; }
.titulo-criaturas { display: flex; justify-content: center; gap: 0.3em; }
.titulo-criaturas img { width: 4.5em; height: 4.5em; animation: pular 1.6s ease-in-out infinite; }
.titulo-criaturas img:nth-child(2) { animation-delay: 0.2s; }
.titulo-criaturas img:nth-child(3) { animation-delay: 0.4s; }
.titulo-criaturas img:nth-child(4) { animation-delay: 0.6s; }
@keyframes pular { 50% { transform: translateY(-0.4em); } }
.btn.grande { font-size: 1.3em; padding: 0.4em 2em; margin: 0.4em 0; }

.conta-box {
  background: var(--papel-escuro);
  border-radius: 0.8em;
  padding: 0.6em 0.9em;
  margin: 0.8em 0 0.4em;
  font-size: 0.92em;
}
.conta-box p { margin: 0.2em 0; }
.conta-box .linha-botoes { margin-top: 0.5em; }

#hud-nuvem { cursor: help; }

.form-conta { display: grid; gap: 0.6em; text-align: left; }
.form-conta label { display: grid; gap: 0.2em; font-weight: 600; }
.form-conta input {
  font: inherit;
  padding: 0.45em 0.6em;
  border: 3px solid var(--papel-escuro);
  border-radius: 0.6em;
  background: #fff;
  user-select: text;
  -webkit-user-select: text;
}
.form-conta input:focus { outline: none; border-color: var(--verde); }
.form-conta .erro { color: var(--vermelho); font-weight: 600; min-height: 1.2em; margin: 0; }
.form-conta a { color: var(--verde-escuro); font-weight: 700; }

.escolha-save { display: grid; gap: 0.6em; margin-top: 0.6em; }
.opcao-save {
  display: grid;
  grid-template-columns: 2.4em 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  text-align: left;
  background: #fff;
  border: 3px solid var(--papel-escuro);
  border-radius: 0.8em;
  padding: 0.5em 0.8em;
}
.opcao-save:hover { border-color: var(--verde); }
.opcao-save span { grid-row: span 2; font-size: 1.8em; }
.opcao-save small { color: var(--tinta-suave); }

/* ---------- Inventário ---------- */
#modal.inventario .painel { min-height: 75%; }
.inventario-topo { display: flex; align-items: baseline; gap: 0.8em; }
.inventario-topo small { color: var(--tinta-suave); }
.grade-itens {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5em, 1fr));
  gap: 0.5em;
}
.cartao.item { position: relative; padding: 0.5em 0.4em; }
.cartao.item img { width: 3.4em; height: 3.4em; }
.cartao.item b { font-size: 0.9em; line-height: 1.15; }
.icone-item { font-size: 2.3em; line-height: 1.3; }
.qtd-item {
  position: absolute; top: 0.3em; right: 0.4em;
  background: var(--madeira); color: #fff;
  border-radius: 1em; padding: 0 0.45em;
  font-size: 0.8em; font-weight: 700;
}
.cartao.sem-clique { cursor: default; }
.cartao.sem-clique:hover { border-color: var(--papel-escuro); }

/* ---------- Estufa: cruzar × fundir ---------- */
.opcoes-estufa { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6em; margin: 0.6em 0; }
.opcao-estufa {
  display: flex; flex-direction: column; align-items: center; gap: 0.3em;
  background: #fff;
  border: 2px solid var(--papel-escuro);
  border-radius: 0.7em;
  padding: 0.5em;
  text-align: center;
}
.opcao-estufa small { color: var(--tinta-suave); }
.aviso-vermelho {
  background: #fde6e1;
  border: 2px solid var(--vermelho);
  border-radius: 0.6em;
  padding: 0.4em 0.7em;
  font-weight: 600;
}

/* ---------- Nível do fazendeiro ---------- */
#hud-nivel {
  --xp: 0%;
  background: linear-gradient(to right, #ffe08a var(--xp), var(--papel) var(--xp)) !important;
  cursor: help;
}
.barra-xp {
  position: relative;
  height: 1.3em;
  background: var(--papel-escuro);
  border-radius: 1em;
  overflow: hidden;
  margin: 0.3em 0;
}
.barra-xp > div { height: 100%; background: linear-gradient(to right, #f2c94c, #f5a623); }
.barra-xp span {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 0.8em; font-weight: 700;
}
.subiu-nivel { position: relative; text-align: center; }
.subiu-nivel > * { position: relative; }
.subiu-nivel .raios {
  position: absolute; left: 50%; top: 40%;
  width: 30em; height: 30em; margin: -15em 0 0 -15em;
  background: repeating-conic-gradient(rgba(242, 201, 76, 0.3) 0 10deg, transparent 10deg 20deg);
  border-radius: 50%;
  animation: girar 12s linear infinite;
}
.subiu-nivel h2 { font-size: 2.4em; margin: 0.1em 0; animation: surgir 0.7s cubic-bezier(0.2, 1.6, 0.4, 1); }
.bloqueado small { color: var(--tinta-suave); }

/* ---------- Minimapa ---------- */
#moldura-mapa {
  position: absolute;
  border: 4px solid var(--madeira);
  border-radius: 0.5em;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), inset 0 0 0 2px rgba(255, 255, 255, 0.3);
  pointer-events: none;
  box-sizing: content-box;
  transform: translate(-4px, -4px);
}
#moldura-mapa span {
  position: absolute;
  left: 50%; top: 100%;
  transform: translate(-50%, 4px);
  background: var(--papel);
  border: 3px solid var(--madeira);
  border-radius: 0.6em;
  padding: 0 0.6em;
  font-size: 0.8em;
  font-weight: 600;
  white-space: nowrap;
}
.hud-botoes button.ativo { background: var(--dourado); }

/* ---------- Nome completo e código ---------- */
.nome-especie { margin: 0 0 0.3em !important; color: var(--tinta-suave); font-size: 0.9em; }
.codigo {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--papel-escuro);
  border-radius: 0.4em;
  padding: 0 0.4em;
  font-weight: 700;
  letter-spacing: 0.05em;
  user-select: text;
  -webkit-user-select: text;
}

/* ---------- Ordem da equipe ---------- */
.ordem-equipe { display: flex; gap: 0.4em; margin-top: 0.2em; }
.ordem-equipe button {
  background: var(--papel-escuro);
  border: 2px solid var(--madeira);
  border-radius: 0.5em;
  padding: 0 0.7em;
  font-weight: 700;
}
.ordem-equipe button:hover:not(:disabled) { background: var(--dourado); }

/* ---------- Resumo do tempo fora ---------- */
.resumo-fora ul { line-height: 1.7; padding-left: 1.2em; }

/* =============================================================
   Celular e telas pequenas
   ============================================================= */

/* Topo compacto: quando a área do jogo fica estreita (menos de 900px de largura) */
@media (max-width: 899px), (max-height: 539px) {
  #hud { top: 0.4em; left: 0.4em; right: 0.4em; gap: 0.3em; }
  #hud > * { gap: 0.25em; }
  .hud-info span, .hud-botoes button {
    border-width: 2px;
    border-radius: 0.6em;
    padding: 0.15em 0.45em;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  }
  #hud-hora { min-width: 4.6em; }
  #hud-area { max-width: 9em;overflow: hidden; text-overflow: ellipsis; }
  .hud-botoes .rotulo { display: none; } /* "🎒 Inventário" vira só 🎒 */
  #toast { top: 2.8em; }
  #batalha-ui { gap: 0.6em; padding: 0.5em 0.7em; }
  #batalha-msg { flex: 0.8; font-size: 1.15em; }
}

/* Tela de toque (a classe .toque é posta pelo ui.js): alvos maiores pro dedo */
.toque .hud-info span, .toque .hud-botoes button {
  min-height: max(2.1em, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.toque .hud-botoes button { min-width: max(2.6em, 36px); }
.toque .slot { width: max(3.3em, 42px); height: max(3.3em, 42px); }
.toque .slot .tecla { display: none; }
.toque #dica {
  min-height: 40px;
  padding: 0.3em 1.1em 0.3em 0.35em;
  bottom: calc(max(3.3em, 42px) + 3.6em);
}
.toque .tecla-e { width: 1.9em; height: 1.9em; }
.toque .fechar { min-width: 40px; min-height: 40px; top: 0.1em; right: 0.1em; }
.toque .btn, .toque .aba { min-height: 36px; }
.toque #batalha-botoes { grid-template-columns: repeat(3, 1fr); } /* 6 botões em 2 linhas */
.toque .btn-golpe { min-height: 36px; padding: 0.15em 0.5em; line-height: 1.15; }
.toque .btn-golpe .n { display: none; }
.toque .so-teclado { display: none; }
.so-toque { display: none; }
.toque .so-toque { display: block; }

/* Celular em pé: tampa o jogo e pede pra virar */
#girar { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  #girar {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    padding: 24px;
    background: radial-gradient(circle at 50% 40%, #3f7f3a 0%, #1f3d1c 75%);
    color: #fff;
    text-align: center;
    font-size: 22px;
  }
  #girar p { margin: 0; font-weight: 700; font-size: 1.3em; }
  #girar small { opacity: 0.8; font-size: 0.75em; }
  #tela { visibility: hidden; }
}
.girar-icone { font-size: 4em; animation: virar 2.4s ease-in-out infinite; }
@keyframes virar {
  0%, 20% { transform: rotate(0); }
  50%, 75% { transform: rotate(-90deg); }
  100% { transform: rotate(0); }
}
