/* ============================================================
   CORES DO APP
   ============================================================ */
:root {
  --bg: #1F2328;
  --card: #282D34;
  --border: #373E47;
  --emerald: #10B981;
  --amber: #F59E0B;
  --red: #EF4444;
  --text: #F3F4F6;
  --muted: #9CA3AF;
}

/* ============================================================
   BASE (página inteira, ocupa a tela do iPhone certinho)
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, 'Segoe UI', system-ui, sans-serif; }
body {
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; height: 100dvh;
  padding-top: env(safe-area-inset-top);
}
button { font: inherit; }
.escondido { display: none !important; }
.cinza { color: var(--muted); font-size: 0.85rem; }
.erro { color: var(--red); font-size: 0.85rem; min-height: 1em; }

/* ============================================================
   TOPO: título, dias seguidos e abas
   ============================================================ */
header {
  padding: 10px 12px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.topo { display: flex; justify-content: space-between; align-items: center; }
header h1 { font-size: 1.05rem; color: var(--emerald); }
.streak { font-size: 0.85rem; color: var(--amber); font-weight: 600; }
.abas { display: flex; gap: 5px; }
.aba {
  flex: 1; background: var(--bg); color: var(--muted); border: 1px solid var(--border);
  padding: 8px 2px; border-radius: 8px; cursor: pointer; font-size: 0.76rem; white-space: nowrap;
}
.aba.ativa { background: var(--emerald); color: #081c15; font-weight: 700; border-color: var(--emerald); }
.bolinha { background: var(--amber); color: #1F2328; border-radius: 999px; padding: 0 6px; font-size: 0.7rem; font-weight: 700; }

/* ============================================================
   ÁREA CENTRAL
   ============================================================ */
main {
  flex: 1; overflow: hidden; display: flex; flex-direction: column;
  max-width: 760px; width: 100%; margin: 0 auto; padding: 12px;
}
.tela { display: flex; flex-direction: column; gap: 10px; flex: 1; overflow: hidden; }

/* Seletores de cenário e nível (fonte 16px para o iPhone não dar zoom) */
.seletores { display: flex; gap: 8px; }
select, input {
  flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  padding: 10px; border-radius: 8px; font-size: 16px; outline: none;
}
.seletores select { background: var(--card); }

/* ============================================================
   CONVERSA
   ============================================================ */
.chat {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px;
}
.msg { max-width: 88%; padding: 11px 14px; border-radius: 12px; line-height: 1.45; font-size: 0.95rem; }
.msg.aluno { align-self: flex-end; background: var(--emerald); color: #091e16; font-weight: 500; }
.msg.tutor { align-self: flex-start; background: #1a1d21; border: 1px solid var(--border); }
.borrado { filter: blur(6px); cursor: pointer; transition: filter 0.25s ease; user-select: none; -webkit-user-select: none; }
.borrado.revelado { filter: none; user-select: auto; -webkit-user-select: auto; }
.traducao { color: var(--emerald); font-size: 0.83rem; margin-top: 4px; }
.botoes-msg { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dica { font-size: 0.72rem; color: var(--muted); width: 100%; }
.btn-mini {
  background: var(--border); color: var(--text); border: none; padding: 7px 10px;
  border-radius: 6px; cursor: pointer; font-size: 0.8rem;
}
.correcao {
  margin-top: 8px; background: rgba(0,0,0,0.25); border-left: 3px solid var(--amber);
  padding: 9px 11px; border-radius: 6px; font-size: 0.87rem; color: var(--text); font-weight: 400;
}
.correcao strong { color: var(--amber); display: block; margin-bottom: 4px; }

/* ============================================================
   RODAPÉ COM O BOTÃO DO MICROFONE
   ============================================================ */
footer {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card);
  border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 6px;
}
#btnGravar {
  background: var(--emerald); color: #081c15; border: none; padding: 15px 38px;
  border-radius: 999px; font-size: 1.05rem; font-weight: 700; cursor: pointer; transition: all 0.2s;
  -webkit-user-select: none; user-select: none;
}
#btnGravar.gravando { background: var(--red); color: white; transform: scale(1.04); box-shadow: 0 0 20px rgba(239,68,68,0.4); }
#btnGravar:disabled { opacity: 0.5; }
#status { font-size: 0.8rem; color: var(--muted); text-align: center; }

/* ============================================================
   REVISÃO (cartões)
   ============================================================ */
.revisao {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px 14px;
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
.cartao {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 24px 18px;
  width: 100%; max-width: 480px; min-height: 170px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px;
}
.cartao .rotulo { font-size: 0.82rem; color: var(--muted); }
.cartao .pergunta { font-size: 1.15rem; font-weight: 600; }
.cartao .resposta { font-size: 1.25rem; color: var(--emerald); font-weight: 700; }
.cartao .explica { font-size: 0.87rem; color: var(--muted); }
.cartao .errado { font-size: 0.8rem; color: var(--red); text-decoration: line-through; }
.botoes-srs { display: flex; gap: 8px; width: 100%; max-width: 480px; }
.btn-srs { flex: 1; padding: 13px 8px; border-radius: 10px; border: none; font-weight: 700; cursor: pointer; }
.btn-errei { background: var(--red); color: white; }
.btn-bom { background: var(--amber); color: #1F2328; }
.btn-facil { background: var(--emerald); color: #081c15; }
.btn-mostrar { background: var(--border); color: var(--text); width: 100%; max-width: 480px; padding: 13px; border-radius: 10px; border: none; font-weight: 600; cursor: pointer; }
.contador { font-size: 0.8rem; color: var(--muted); }

/* ============================================================
   LISTAS (caderno e conta)
   ============================================================ */
.lista { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; padding-bottom: env(safe-area-inset-bottom); }
.item-erro {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; font-size: 0.86rem; position: relative;
}
.item-erro .errado { color: var(--red); text-decoration: line-through; font-size: 0.8rem; padding-right: 28px; }
.item-erro .certo { color: var(--emerald); font-weight: 600; margin: 3px 0; }
.item-erro .pt { color: var(--text); font-size: 0.8rem; }
.item-erro .explica { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.item-erro .apagar {
  position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 1rem; padding: 2px 6px;
}
.vazio { color: var(--muted); font-size: 0.87rem; text-align: center; padding: 20px; }

/* Painéis da aba Conta */
.painel {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.painel h3 { font-size: 0.95rem; color: var(--emerald); }
.btn { background: var(--emerald); color: #081c15; border: none; padding: 11px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.btn-sair { background: var(--border); color: var(--text); margin-top: 4px; }
.linha-form { display: flex; flex-direction: column; gap: 8px; }

/* Cada usuário na lista do admin */
.usuario-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px;
}
.usuario-item .nome { font-weight: 600; }
.usuario-item .selo { font-size: 0.72rem; color: var(--muted); margin-left: 6px; }
.usuario-item .bloqueado { color: var(--red); }
.usuario-item .acoes { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   TELA DE LOGIN
   ============================================================ */
#telaLogin {
  position: fixed; inset: 0; background: var(--bg); z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.caixa-login {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px;
  width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px;
}
.caixa-login h2 { color: var(--emerald); font-size: 1.1rem; }
.caixa-login button { background: var(--emerald); color: #081c15; border: none; padding: 12px; border-radius: 8px; font-weight: 700; cursor: pointer; }
