@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600;900&family=Work+Sans:wght@400;500;600&display=swap');

:root {
  --areia: #F2E9D8;
  --tinta: #16232E;
  --oceano: #0F4C5C;
  --oceano-escuro: #0A3540;
  --onda: #8FC1A9;
  --sol: #F2542D;
  --dourado: #E8A33D;
  --branco: #FFFDF8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--areia);
  color: var(--tinta);
  font-family: 'Work Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.tela {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tela[hidden] { display: none; }

/* ---------- Autenticação ---------- */
#tela-auth {
  justify-content: center;
  padding: 32px 20px;
  background: var(--oceano);
}

.auth-caixa {
  width: 100%;
  max-width: 380px;
  background: var(--branco);
  border-radius: 20px;
  padding: 32px 28px;
}

.auth-titulo {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 34px;
  line-height: 1.05;
  margin: 0 0 4px;
  color: var(--oceano);
}

.auth-subtitulo {
  margin: 0 0 24px;
  color: #5b6b73;
  font-size: 15px;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.campo label {
  font-size: 13px;
  font-weight: 600;
  color: var(--oceano);
}

.campo input,
.campo textarea {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 1.5px solid #dcd2bd;
  border-radius: 12px;
  background: var(--areia);
  color: var(--tinta);
}

.campo input:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--oceano);
}

.botao {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.botao-primario {
  background: var(--sol);
  color: var(--branco);
}
.botao-primario:hover { background: #d9401c; }

.botao-secundario {
  background: var(--onda);
  color: var(--oceano-escuro);
}

.botao-fantasma {
  background: transparent;
  color: var(--oceano);
  text-decoration: underline;
  font-weight: 500;
  padding: 8px 0;
}

.auth-alternar {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: #5b6b73;
}
.auth-alternar button {
  background: none;
  border: none;
  color: var(--sol);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.mensagem {
  font-size: 14px;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.mensagem.erro { background: #fbe1db; color: #a12f12; }
.mensagem.sucesso { background: #e4f0e9; color: #2a6a4a; }
.mensagem[hidden] { display: none; }

/* ---------- App principal ---------- */
#tela-app {
  width: 100%;
  align-items: center;
}

.topo {
  width: 100%;
  background: var(--oceano);
  color: var(--branco);
  padding: 22px 20px 46px;
  position: relative;
}

.topo-linha {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.saudacao { font-size: 14px; opacity: 0.85; margin: 0; }
.saudacao strong { color: var(--dourado); }

.streak-pill {
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.economia-bloco {
  max-width: 420px;
  margin: 18px auto 0;
  text-align: center;
}

.economia-rotulo {
  font-size: 13px;
  letter-spacing: 0.02em;
  opacity: 0.8;
  margin: 0;
}

.economia-numero {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 52px;
  margin: 4px 0 0;
  color: var(--dourado);
}

.onda-divisora {
  display: block;
  width: 100%;
  margin-top: -1px;
}

.conteudo {
  width: 100%;
  max-width: 420px;
  padding: 0 20px 40px;
  margin-top: -28px;
}

.cartao {
  background: var(--branco);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 16px;
}

.cartao-titulo {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 16px;
  color: var(--oceano);
}

.resposta-ia {
  background: var(--areia);
  border-left: 4px solid var(--sol);
  border-radius: 0 12px 12px 0;
  padding: 16px;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.linha-botoes {
  display: flex;
  gap: 10px;
}
.linha-botoes .botao { flex: 1; }

.historico-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #ece4d3;
  font-size: 14px;
}
.historico-item:last-child { border-bottom: none; }

.historico-info strong { display: block; }
.historico-info span { color: #5b6b73; font-size: 13px; }

.selo {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.selo-resistiu { background: #e4f0e9; color: #2a6a4a; }
.selo-comprou { background: #fbe1db; color: #a12f12; }

.rodape-acoes {
  text-align: center;
  margin-top: 8px;
}

/* ---------- Toggle / Ranking ---------- */
.toggle-linha {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.toggle-linha label { font-size: 14px; font-weight: 500; }

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-trilho {
  position: absolute;
  inset: 0;
  background: #dcd2bd;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-trilho::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: var(--branco);
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-trilho { background: var(--onda); }
.toggle input:checked + .toggle-trilho::before { transform: translateX(18px); }

.ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #ece4d3;
  font-size: 14px;
}
.ranking-item:last-child { border-bottom: none; }
.ranking-item.voce { background: #f5efe0; border-radius: 10px; padding: 10px 8px; }

.ranking-posicao {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--oceano);
  width: 28px;
  flex-shrink: 0;
}

.ranking-info { flex: 1; }
.ranking-info strong { display: block; }
.ranking-info span { color: #5b6b73; font-size: 12px; }

.ranking-pontos {
  font-weight: 600;
  color: var(--sol);
  white-space: nowrap;
}

@media (min-width: 460px) {
  .economia-numero { font-size: 60px; }
}
