/* ===== Rosto do Guardião do Tapajós (tablet) ===== */
:root {
  --fundo: #0a1f38;
  --ciano: #3ee6ff;
  --ciano-claro: #c9fcff;
  --verde: #3ddc84;
  --laranja: #ff9f43;
  --roxo: #8e7dff;
  --amarelo: #ffd43b;
  --rosa: #ff6fa8;
  --escuro: #10243f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--fundo);
  color: #fff;
  font-family: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--fundo);
  box-shadow: inset 0 0 18vmin rgba(0, 0, 0, .55);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- Área do rosto ---------- */
#area-rosto {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modo-jogo #area-rosto,
.modo-final #area-rosto { flex: 0 0 34%; }

#rosto {
  --olhar-x: 0;
  --olhar-y: 0;
  --escala: 1vmin;
  font-size: var(--escala);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7em;
}
.modo-espera #rosto, .modo-desligado #rosto { margin-top: -10vh; }
.modo-jogo #rosto,
.modo-final #rosto { --escala: .48vmin; }

/* Olhos */
.olhos {
  display: flex;
  gap: 16em;
  transform: translate(calc(var(--olhar-x) * 3em), calc(var(--olhar-y) * 2.5em));
  transition: transform .45s ease;
}
.olho {
  position: relative;
  width: 26em;
  height: 32em;
  border-radius: 13em;
  background: radial-gradient(circle at 50% 45%, #e8feff 0%, #7ff3ff 45%, #22c8e6 100%);
  box-shadow: 0 0 3em rgba(62, 230, 255, .9), 0 0 9em rgba(62, 230, 255, .45);
  overflow: hidden;
  transition: transform .09s ease-in, background .4s, box-shadow .4s, opacity .6s;
}
.piscando .olho { transform: scaleY(.06); }

.pupila {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14em;
  height: 14em;
  margin: -7em 0 0 -7em;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #0d3157 0%, #06182c 100%);
  transform: translate(calc(var(--olhar-x) * 5em), calc(var(--olhar-y) * 6em));
  transition: transform .45s ease, width .3s, height .3s, margin .3s;
}
.brilho {
  position: absolute;
  width: 5em;
  height: 5em;
  border-radius: 50%;
  background: #fff;
  top: 2em;
  left: 2.2em;
}
.brilho.b2 { width: 2.2em; height: 2.2em; top: 8em; left: 8.5em; opacity: .8; }

/* Pálpebras (criam as expressões) */
.palpebra-cima,
.palpebra-baixo {
  position: absolute;
  left: -25%;
  top: 0;
  width: 150%;
  height: 100%;
  background: var(--fundo);
  transition: transform .35s ease;
}
.palpebra-cima { transform: translateY(-105%); }
.palpebra-baixo { border-radius: 50% 50% 0 0; transform: translateY(105%); }

.feliz .palpebra-baixo { transform: translateY(58%); }
.feliz .olho { box-shadow: 0 0 2em rgba(62, 230, 255, .55); }
.triste .olho.esq .palpebra-cima { transform: translateY(-62%) rotate(-16deg); }
.triste .olho.dir .palpebra-cima { transform: translateY(-62%) rotate(16deg); }
.surpreso .olho { height: 36em; }
.surpreso .pupila { width: 11em; height: 11em; margin: -5.5em 0 0 -5.5em; }
.ouvindo .olho {
  background: radial-gradient(circle at 50% 45%, #f0fff4 0%, #8dffbf 45%, #2ed47a 100%);
  box-shadow: 0 0 3em rgba(61, 220, 132, .9), 0 0 9em rgba(61, 220, 132, .45);
}
.modo-desligado .olho { transform: scaleY(.05); opacity: .35; }

/* Bochechas */
.bochechas {
  position: absolute;
  left: -8em;
  right: -8em;
  top: 29em;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.bochechas span {
  width: 13em;
  height: 6.5em;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 111, 168, .85), rgba(255, 111, 168, 0));
  opacity: .4;
  transition: opacity .4s;
}
.feliz .bochechas span { opacity: 1; }
.modo-desligado .bochechas span { opacity: 0; }

/* Boca de LEDs */
.boca { display: flex; gap: 1.4em; height: 10em; align-items: center; }
.led {
  display: block;
  width: 3.4em;
  height: 3.4em;
  border-radius: 1em;
  background: var(--ciano);
  box-shadow: 0 0 1.6em rgba(62, 230, 255, .9);
  transition: transform .09s linear, background .3s, opacity .6s;
}
.ouvindo .led { background: var(--verde); box-shadow: 0 0 1.6em rgba(61, 220, 132, .9); }
.modo-desligado .led { opacity: .12; }

/* ---------- Legenda (o que o robô está falando) ---------- */
#legenda {
  position: absolute;
  left: 50%;
  bottom: 17vh;
  max-width: 88vw;
  padding: 1.6vmin 3.2vmin;
  border-radius: 3vmin;
  background: rgba(255, 255, 255, .96);
  color: var(--escuro);
  font-size: clamp(18px, 3.6vmin, 40px);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 1vmin 4vmin rgba(0, 0, 0, .4);
  opacity: 0;
  transform: translate(-50%, 20px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
#legenda.visivel { opacity: 1; transform: translate(-50%, 0); }
.modo-intro #legenda { bottom: 6vh; }
.modo-jogo #legenda, .modo-final #legenda { display: none; }

/* ---------- Botão começar ---------- */
#btn-comecar {
  position: absolute;
  left: 50%;
  bottom: 4vh;
  display: none;
  border: 0;
  border-radius: 99px;
  padding: 2vmin 5vmin;
  font-size: clamp(20px, 4.4vmin, 48px);
  font-weight: 800;
  white-space: nowrap;
  color: var(--escuro);
  background: linear-gradient(180deg, #fff27a, #ffc93b);
  box-shadow: 0 .8vmin 0 #d99a00, 0 0 5vmin rgba(255, 212, 59, .6);
  animation: pulsar-centro 1.6s ease-in-out infinite;
}
.modo-espera #btn-comecar,
.modo-desligado #btn-comecar { display: block; }

/* ---------- Painel do jogo ---------- */
#painel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 1.4vmin;
  padding: 0 3vmin 3vmin;
}
.modo-jogo #painel { display: flex; }

.cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 2vmin; }
#num-pergunta { font-size: clamp(16px, 3vmin, 30px); font-weight: 700; color: var(--amarelo); }
#bolinhas { display: flex; gap: 1.2vmin; }
.bolinha { width: 2.6vmin; height: 2.6vmin; border-radius: 50%; background: rgba(255, 255, 255, .22); }
.bolinha.atual { background: var(--amarelo); box-shadow: 0 0 1.5vmin var(--amarelo); animation: pulsar 1.2s infinite; }
.bolinha.bom { background: var(--verde); }
.bolinha.ruim { background: var(--laranja); }

#tela-pergunta { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 1.6vmin; }
#painel.feedback #tela-pergunta { display: none; }

#texto-pergunta {
  margin: 0;
  font-size: clamp(20px, 4.3vmin, 48px);
  line-height: 1.15;
  font-weight: 800;
  text-align: center;
}

#opcoes {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5vmin;
}
.opcao {
  --cor: var(--roxo);
  --sombra: #5f50d6;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1vmin;
  min-height: 0;
  padding: 2vmin;
  border: .7vmin solid var(--cor);
  border-radius: 3.5vmin;
  background: #fff;
  color: var(--escuro);
  font-size: clamp(18px, 3.8vmin, 42px);
  font-weight: 800;
  line-height: 1.1;
  box-shadow: 0 1.2vmin 0 var(--sombra);
  transition: transform .15s, opacity .3s, box-shadow .2s;
}
.opcao.op2 { --cor: var(--laranja); --sombra: #d07418; }
.opcao:active { transform: translateY(.8vmin); box-shadow: 0 .4vmin 0 var(--sombra); }
.opcao .emoji { font-size: clamp(36px, 9vmin, 110px); line-height: 1; }
.opcao .num {
  position: absolute;
  top: 1.4vmin;
  left: 1.4vmin;
  width: 5vmin;
  height: 5vmin;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--cor);
  color: #fff;
  font-size: 3.2vmin;
}
.opcao.apagada { opacity: .25; transform: scale(.95); }
.opcao.escolhida { transform: scale(1.04); }
.opcao.escolhida.boa { box-shadow: 0 0 0 1vmin var(--verde), 0 0 6vmin var(--verde); }
.opcao.escolhida.ruim { box-shadow: 0 0 0 1vmin var(--laranja), 0 0 6vmin var(--laranja); }

#linha-mic { display: flex; align-items: center; justify-content: center; gap: 2vmin; min-height: 9vmin; }
#linha-mic[hidden] { display: none; }
#btn-mic {
  display: flex;
  align-items: center;
  gap: 1.2vmin;
  border: 0;
  border-radius: 99px;
  padding: 1.4vmin 4vmin;
  font-size: clamp(18px, 3.6vmin, 38px);
  font-weight: 800;
  background: var(--verde);
  color: #08301a;
  box-shadow: 0 .8vmin 0 #23a35c;
}
#btn-mic.ativo { background: #ff4d6d; color: #fff; box-shadow: 0 0 0 0 rgba(255, 77, 109, .7); animation: onda-mic 1.2s infinite; }
#ouvi { font-size: clamp(16px, 3vmin, 30px); color: var(--ciano-claro); font-style: italic; max-width: 50%; }

/* Retorno depois da escolha */
#tela-feedback {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vmin;
  text-align: center;
}
#painel.feedback #tela-feedback { display: flex; }
#fb-titulo { margin: 0; font-size: clamp(30px, 7.5vmin, 84px); font-weight: 800; line-height: 1; }
#painel.boa #fb-titulo { color: var(--verde); }
#painel.ruim #fb-titulo { color: var(--laranja); }
#fb-texto { margin: 0; max-width: 92%; font-size: clamp(20px, 4.6vmin, 50px); font-weight: 700; line-height: 1.2; }
#btn-continuar {
  border: .4vmin solid rgba(255, 255, 255, .5);
  border-radius: 99px;
  padding: 1.2vmin 4vmin;
  font-size: clamp(18px, 3.4vmin, 34px);
  font-weight: 800;
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

/* ---------- Final ---------- */
#final {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6vmin;
  padding: 0 3vmin 3vmin;
  text-align: center;
}
.modo-final #final { display: flex; }
#final h2 {
  margin: 0;
  font-size: clamp(26px, 6.4vmin, 72px);
  line-height: 1.05;
  color: var(--amarelo);
  text-shadow: 0 .5vmin 0 rgba(0, 0, 0, .3);
}
#final-estrelas { font-size: clamp(30px, 7vmin, 80px); letter-spacing: .5vmin; }
#final-titulo { margin: 0; font-size: clamp(20px, 4.6vmin, 50px); font-weight: 800; }
.olhe-tv { margin: 0; font-size: clamp(16px, 3.2vmin, 32px); opacity: .85; }
#btn-denovo {
  border: 0;
  border-radius: 99px;
  padding: 1.6vmin 5vmin;
  font-size: clamp(20px, 4vmin, 44px);
  font-weight: 800;
  color: var(--escuro);
  background: linear-gradient(180deg, #fff27a, #ffc93b);
  box-shadow: 0 .8vmin 0 #d99a00;
}

/* ---------- Discretos: conexão e painel do Ramon ---------- */
#status-dot {
  position: absolute;
  top: 1.8vmin;
  left: 1.8vmin;
  width: 1.4vmin;
  height: 1.4vmin;
  border-radius: 50%;
  background: #888;
  opacity: .6;
}
#status-dot.st-online { background: var(--verde); }
#status-dot.st-local { background: var(--amarelo); }
#status-dot.st-offline { background: #ff4d6d; }

#btn-config {
  position: absolute;
  top: .6vmin;
  right: .6vmin;
  width: 8vmin;
  height: 8vmin;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 3.6vmin;
  opacity: .22;
  transition: opacity .3s, transform .8s;
  -webkit-touch-callout: none;
}
#btn-config.segurando { opacity: 1; transform: rotate(180deg) scale(1.3); }

#config {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vmin;
  background: rgba(2, 10, 22, .75);
}
#config[hidden] { display: none; }
.cfg-caixa {
  width: min(720px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 0 20px 18px;
  border-radius: 16px;
  background: #fff;
  color: var(--escuro);
  font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
}
.cfg-caixa header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 8px;
  background: #fff;
}
.cfg-caixa h3 { margin: 0; font-size: 22px; }
.cfg-caixa h4 { margin: 16px 0 6px; font-size: 17px; }
.cfg-caixa button {
  margin: 4px 4px 4px 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #e8eef7;
  color: var(--escuro);
  font-size: 16px;
  font-weight: 700;
}
.cfg-caixa button.primario { background: #1f6feb; color: #fff; }
#cfg-frases button { display: block; width: 100%; text-align: left; font-weight: 500; }
.cfg-caixa textarea, .cfg-caixa input:not([type=checkbox]), .cfg-caixa select {
  width: 100%;
  padding: 8px;
  border: 1px solid #c5d0de;
  border-radius: 8px;
  font: inherit;
}
.cfg-caixa label { display: block; margin: 8px 0; }
.cfg-caixa input[type=checkbox] { margin-right: 8px; transform: scale(1.3); }
.cfg-caixa small { display: block; color: #5a6b80; }
#cfg-status { margin: 4px 0; }

/* ---------- Animações ---------- */
@keyframes pulsar { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes pulsar-centro {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.06); }
}
@keyframes onda-mic {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, .7); }
  100% { box-shadow: 0 0 0 4vmin rgba(255, 77, 109, 0); }
}
