/* =============================================================
   estilo.css — visual minimalista de ficção científica.
   Celular (em pé) é o padrão; PC (deitado) muda no fim do arquivo.
   ============================================================= */

:root {
  --fundo: #04060c;
  --vidro: rgba(9, 15, 28, 0.62);
  --vidro-forte: rgba(9, 15, 28, 0.82);
  --borda: rgba(120, 200, 255, 0.16);
  --borda-forte: rgba(120, 220, 255, 0.45);
  --texto: #d9e6ff;
  --suave: #7d90b2;
  --ciano: #5fe3ff;
  --erro: #ff7a85;
  --raio: 12px;
  --fonte: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* cores das naves */
  --azul: #4da3ff;
  --vermelho: #ff5a5f;
  --amarelo: #ffd23f;
  --verde: #3ee08f;
  --branco: #e8f0ff;

  /* cores de status */
  --st-morto: #9aa0aa;
  --st-evolucao: #c08a5a;
  --st-prosperando: #4fa8ff;
  --st-saudavel: #4fe08a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--fonte);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#tela {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;          /* o jogo cuida dos toques */
}

/* ---------- elementos comuns ---------- */
.painel {
  background: var(--vidro);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.logo, .titulo-jogo {
  margin: 0;
  font-weight: 300;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--texto);
}
.logo span, .titulo-jogo span { font-weight: 700; color: var(--ciano); }

/* ---------- botões de som (música / efeitos) ---------- */
.botoes-som { display: flex; gap: 6px; }
.btn-som {
  width: 32px; height: 32px; padding: 0;
  border-radius: 50%;
  border: 1px solid var(--borda);
  background: var(--vidro);
  color: var(--ciano);
  display: grid; place-items: center;
  transition: color .2s, border-color .2s;
}
.btn-som svg { width: 17px; height: 17px; }
.btn-som .risco { display: none; }
.btn-som.desligado { color: var(--suave); border-color: rgba(125, 144, 178, 0.25); }
.btn-som.desligado .risco { display: block; }
.btn-som.desligado .onda { display: none; }
#tela-inicial .botoes-som {
  position: fixed; z-index: 3;
  top: max(14px, env(safe-area-inset-top)); right: 14px;
}
.lado-direito { display: flex; align-items: center; gap: 10px; }

/* =============================================================
   TELA INICIAL
   ============================================================= */
#tela-inicial {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: max(28px, env(safe-area-inset-top)) 16px 24px;
}

.logo {
  font-size: clamp(22px, 7vw, 40px);
  line-height: 1.15;
  margin: 8px 0 clamp(70px, 16vh, 150px);
  text-shadow: 0 0 24px rgba(95, 227, 255, 0.25);
}

.cartao {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rotulo {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--suave);
  margin-top: 8px;
}

#campo-nome {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--raio);
  border: 1px solid var(--borda);
  background: var(--vidro);
  outline: none;
  font-size: 16px;             /* evita zoom automático no iPhone */
  transition: border-color .2s, box-shadow .2s;
}
#campo-nome:focus { border-color: var(--borda-forte); box-shadow: 0 0 0 3px rgba(95, 227, 255, 0.12); }

.escolha-nave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opcao-nave {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 8px;
  border-radius: var(--raio);
  border: 1px solid var(--borda);
  background: var(--vidro);
  font-size: 12px;
  color: var(--suave);
  transition: border-color .2s, color .2s, background .2s, transform .1s;
}
.opcao-nave canvas { width: 72px; height: 54px; }
.opcao-nave[aria-checked="true"] {
  border-color: var(--cor-escolhida, var(--ciano));
  color: var(--texto);
  background: rgba(20, 34, 60, 0.75);
  box-shadow: 0 0 18px -6px var(--cor-escolhida, var(--ciano));
}
.opcao-nave:active { transform: scale(0.97); }

.escolha-cor { display: flex; gap: 12px; }
.opcao-cor {
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 2px solid transparent;
  background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
  transition: transform .15s, border-color .15s;
}
.opcao-cor[data-cor="azul"] { --c: var(--azul); }
.opcao-cor[data-cor="vermelho"] { --c: var(--vermelho); }
.opcao-cor[data-cor="amarelo"] { --c: var(--amarelo); }
.opcao-cor[data-cor="verde"] { --c: var(--verde); }
.opcao-cor[data-cor="branco"] { --c: var(--branco); }
.opcao-cor[aria-checked="true"] { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 16px -2px var(--c); }

.botao-decolar {
  margin-top: 18px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px 20px;
  border-radius: 999px;
  border: 1px solid var(--borda-forte);
  background: linear-gradient(180deg, rgba(95, 227, 255, 0.22), rgba(95, 227, 255, 0.06));
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.3em;
  box-shadow: 0 0 30px -10px var(--ciano);
  transition: transform .1s, box-shadow .2s;
}
.botao-decolar svg { width: 26px; height: 26px; color: var(--ciano); }
.botao-decolar:hover { box-shadow: 0 0 36px -6px var(--ciano); }
.botao-decolar:active { transform: scale(0.98); }
.botao-decolar:disabled { opacity: .5; cursor: wait; }

.erro { min-height: 1.2em; margin: 2px 0 0; color: var(--erro); font-size: 14px; }
.ajuda { margin: 6px 0 0; color: var(--suave); font-size: 14px; line-height: 1.45; }

/* =============================================================
   TELA DO JOGO — celular em pé (padrão)
   Topo / espaço (com slots à direita) / status / chat
   ============================================================= */
#tela-jogo {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
  pointer-events: none;        /* cliques passam para o canvas... */
}
#tela-jogo .painel, #tela-jogo button, #tela-jogo input { pointer-events: auto; }  /* ...menos nos painéis */

.topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.titulo-jogo { font-size: 15px; letter-spacing: 0.26em; }
.online { font-size: 12px; color: var(--suave); display: flex; align-items: center; gap: 6px; }
.online i { width: 7px; height: 7px; border-radius: 50%; background: var(--verde); box-shadow: 0 0 8px var(--verde); }
.online b { color: var(--texto); font-family: var(--mono); }

#area-espaco { position: relative; flex: 1; min-height: 0; }

/* Coluna de slots + escudo + laser */
#painel-nave {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 6px;
}
.mini-rotulo { font-size: 9px; letter-spacing: 0.18em; color: var(--suave); }
.slots { display: flex; flex-direction: column; gap: 5px; }
.slot {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--borda);
  background: rgba(0, 0, 0, 0.25);
  display: grid; place-items: center;
  padding: 0;
}
.slot small { position: absolute; top: 1px; left: 4px; font-size: 9px; color: var(--suave); font-family: var(--mono); }
.slot.ativo { border-color: var(--ciano); box-shadow: 0 0 12px -3px var(--ciano), inset 0 0 8px -4px var(--ciano); }
.slot .meteoro-icone { width: 18px; height: 18px; border-radius: 45% 55% 50% 45%; }

.escudo { display: flex; gap: 4px; }
.escudo i {
  width: 10px; height: 12px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: var(--ciano);
  box-shadow: 0 0 6px var(--ciano);
  transition: background .2s, opacity .2s;
}
.escudo i.vazio { background: rgba(125, 144, 178, 0.3); }

.botao-laser {
  display: none;               /* só aparece em telas de toque */
  margin-top: 6px;
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(255, 90, 110, 0.6);
  background: radial-gradient(circle, rgba(255, 70, 90, 0.35), rgba(60, 10, 20, 0.5));
  color: #ffd0d6;
  flex-direction: column; align-items: center; justify-content: center;
  font-size: 8px; letter-spacing: 0.12em;
  padding: 0;
}
.botao-laser svg { width: 22px; height: 22px; }
.botao-laser:active { transform: scale(0.94); background: rgba(255, 70, 90, 0.6); }
body.toque .botao-laser { display: flex; }

.dica-controles { display: none; }

/* Celular em pé: coluna de slots mais estreita para sobrar espaço ao planeta */
@media (orientation: portrait), (max-width: 699px) {
  .slot { width: 34px; height: 34px; }
  .slots { gap: 4px; }
  .botao-laser { width: 50px; height: 50px; }
  #painel-nave { padding: 6px 5px; }
}

/* Painéis recolhíveis (status e chat) */
.cabecalho-painel {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: none; border: 0;
  font-size: 11px; letter-spacing: 0.2em; color: var(--suave);
  text-align: left;
  white-space: nowrap;
}
.cabecalho-painel .seta {
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--suave); border-bottom: 1.5px solid var(--suave);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s;
}
.recolhido .cabecalho-painel .seta { transform: rotate(-135deg) translateY(-2px); }
.recolhido .corpo-painel { display: none; }
.corpo-painel { padding: 0 10px 9px; }

.selo-status {
  font-size: 11px; letter-spacing: 0.14em;
  padding: 2px 8px; border-radius: 999px;
  color: #0a0f1a;
  background: var(--cor-status, var(--st-morto));
  box-shadow: 0 0 12px -2px var(--cor-status, var(--st-morto));
}

.indicadores { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.indicador { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 2px 7px; font-size: 12px; }
.indicador svg { width: 16px; height: 16px; grid-row: span 2; }
.indicador .nome { color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.indicador .valor { font-family: var(--mono); color: var(--texto); }
.indicador .barra { grid-column: 2 / 4; height: 3px; border-radius: 3px; background: rgba(125, 144, 178, 0.18); overflow: hidden; }
.indicador .barra i { display: block; height: 100%; width: 0; background: var(--cor-barra, var(--ciano)); transition: width .6s ease; }

/* Chat */
.mensagens {
  list-style: none; margin: 0; padding: 0;
  max-height: 74px; overflow-y: auto;
  font-size: 13px; line-height: 1.35;
  scrollbar-width: thin;
}
.mensagens li { word-wrap: break-word; }
.mensagens .nome { font-weight: 600; }
.mensagens .sistema { color: var(--suave); font-style: italic; font-size: 12px; }
.form-chat { display: flex; gap: 6px; margin-top: 6px; }
.form-chat input {
  flex: 1; min-width: 0;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--borda);
  background: rgba(0, 0, 0, 0.3);
  outline: none;
  font-size: 16px;
}
.form-chat input:focus { border-color: var(--borda-forte); }
.form-chat button {
  width: 38px; border-radius: 9px;
  border: 1px solid var(--borda); background: rgba(95, 227, 255, 0.1);
  display: grid; place-items: center; color: var(--ciano);
}
.form-chat button svg { width: 18px; height: 18px; }

/* Avisos rápidos (toasts) */
.avisos {
  position: fixed; left: 50%; top: 50px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  pointer-events: none; z-index: 5;
}
.aviso {
  padding: 7px 14px; border-radius: 999px;
  background: var(--vidro-forte); border: 1px solid var(--borda-forte);
  font-size: 13px;
  animation: aviso 3s ease forwards;
}
@keyframes aviso { 0% { opacity: 0; transform: translateY(-6px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

.reconectando {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 12px 20px; border-radius: var(--raio);
  background: var(--vidro-forte); border: 1px solid var(--borda-forte);
  letter-spacing: 0.15em;
}

/* Botão "?" (Como jogar) — mesmo formato dos botões de som */
.btn-ajuda { font-size: 15px; font-weight: 600; line-height: 1; }

/* Setinha de tendência da temperatura */
.tendencia { font-style: normal; font-size: 9px; margin-right: 3px; vertical-align: 1px; }
.tendencia.sobe { color: #ff9a6b; }
.tendencia.desce { color: #6fc8ff; }

/* Aviso "o planeta vai regredir" (aparece mesmo com o painel recolhido) */
.alerta-status {
  margin: 0 8px 8px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 90, 95, 0.55);
  background: rgba(120, 20, 30, 0.38);
  display: flex; flex-direction: column; gap: 2px;
  animation: alerta-pulsa 1.4s ease-in-out infinite;
}
.alerta-status b { font-size: 12.5px; color: #ffd0d6; font-weight: 600; }
.alerta-status span { font-size: 11.5px; color: #ffb3bb; line-height: 1.35; }
@keyframes alerta-pulsa {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 90, 95, 0); border-color: rgba(255, 90, 95, 0.45); }
  50% { box-shadow: 0 0 14px rgba(255, 90, 95, 0.45); border-color: rgba(255, 90, 95, 0.9); }
}

/* Tutorial "Como jogar" */
.tutorial {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(2, 4, 10, 0.55);
  pointer-events: auto;
}
.cartao-tutorial {
  width: min(420px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 18px 18px 14px;
  background: var(--vidro-forte);
  border-color: var(--borda-forte);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: tut-entra .25s ease;
}
@keyframes tut-entra { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.tut-passo { font-size: 10.5px; letter-spacing: 0.22em; color: var(--suave); }
.cartao-tutorial h2 { margin: 6px 0 10px; font-size: 19px; font-weight: 600; color: var(--ciano); letter-spacing: 0.02em; }
.tut-texto { font-size: 14px; line-height: 1.5; }
.tut-texto p { margin: 0 0 10px; }
.tut-texto b { color: #fff; font-weight: 600; }
.tut-texto kbd {
  font-family: var(--mono); font-size: 12px;
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--borda-forte); background: rgba(95, 227, 255, 0.08);
}
.tut-escada { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 11px; color: var(--suave); }
.tut-escada span {
  padding: 2px 7px; border-radius: 999px; letter-spacing: 0.06em; font-weight: 600;
  color: var(--cor); border: 1px solid var(--cor);
}
.tut-lista { margin: 0 0 10px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tut-meteoros li { display: flex; gap: 10px; align-items: flex-start; }
.tut-meteoro {
  flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8, var(--cor) 45%, #0008);
  box-shadow: 0 0 8px var(--cor);
}
.tut-pontos { display: flex; justify-content: center; gap: 7px; margin: 4px 0 12px; }
.tut-pontos i { width: 7px; height: 7px; border-radius: 50%; background: rgba(125, 144, 178, 0.35); transition: background .2s, transform .2s; }
.tut-pontos i.ativo { background: var(--ciano); transform: scale(1.25); }
.tut-botoes { display: flex; gap: 8px; }
.tut-btn {
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--borda); background: rgba(95, 227, 255, 0.06);
  font-size: 14px;
}
.tut-btn.fraco { border-color: transparent; background: none; color: var(--suave); padding-left: 4px; }
.tut-btn.forte {
  margin-left: auto; padding: 9px 22px;
  border-color: var(--borda-forte); background: rgba(95, 227, 255, 0.18);
  color: var(--ciano); font-weight: 600;
}
.tut-btn:hover { border-color: var(--borda-forte); }
.tut-btn.fraco:hover { color: var(--texto); border-color: transparent; }

/* =============================================================
   PC / TELA DEITADA
   Espaço ocupa tudo; status no canto superior esquerdo,
   chat no inferior esquerdo, slots + escudo na direita.
   ============================================================= */
@media (orientation: landscape) and (min-width: 700px) {
  #tela-inicial { justify-content: center; padding-left: max(5vw, 24px); }
  .logo { margin-bottom: 26px; }

  #tela-jogo { display: block; padding: 0; }
  .topo { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); justify-content: center; gap: 22px; }
  .titulo-jogo { font-size: 16px; }

  #area-espaco { position: absolute; inset: 0; }

  #painel-nave { right: 16px; top: 50%; transform: translateY(-50%); padding: 10px 8px; gap: 6px; }
  .slot { width: 46px; height: 46px; }
  .slot .meteoro-icone { width: 22px; height: 22px; }

  #painel-status { position: absolute; top: 16px; left: 16px; width: 248px; }
  .indicadores { grid-template-columns: 1fr; gap: 7px; }
  .cabecalho-painel { cursor: default; }
  #painel-status .cabecalho-painel .seta, #painel-chat .cabecalho-painel .seta { display: none; }
  .recolhido .corpo-painel { display: block; }

  #painel-chat { position: absolute; bottom: 16px; left: 16px; width: 300px; }
  .mensagens { max-height: 150px; }

  .dica-controles {
    display: block;
    position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
    font-size: 12px; color: var(--suave); white-space: nowrap;
    opacity: .75;
  }
  .dica-controles b { color: var(--texto); font-weight: 600; }
  body.toque .dica-controles { display: none; }
}

/* Celulares deitados (tela baixa): tudo mais compacto */
@media (orientation: landscape) and (max-height: 500px) {
  #painel-status { width: 210px; }
  .indicadores { gap: 4px; }
  .indicador { font-size: 11px; }
  .mensagens { max-height: 60px; }
  #painel-chat { width: 240px; }
  .slot { width: 34px; height: 34px; }
  .slots { gap: 4px; }
  .botao-laser { width: 48px; height: 48px; }
}
