/* App de inglês — visual. Mobile primeiro; claro e escuro automáticos. */
:root {
  --fundo: #f7f4ee;
  --cartao: #ffffff;
  --cartao-2: #f1ede5;
  --linha: #e6e0d4;
  --texto: #1f2430;
  --texto-2: #5b6170;
  --texto-3: #8a8f9c;
  --primaria: #4f46e5;
  --primaria-suave: #eceafd;
  --ok: #16a34a;
  --ok-suave: #e3f6ea;
  --erro: #dc2626;
  --erro-suave: #fde8e8;
  --aviso: #d97706;
  --aviso-suave: #fdf1df;

  --falar: #f0605a;   --falar-suave: #fde9e7;
  --ouvir: #8b5cf6;   --ouvir-suave: #f0eafe;
  --ler: #2f80ed;     --ler-suave: #e6f0fd;
  --escrever: #e59a1d; --escrever-suave: #fcf1dd;
  --revisar: #16a37a; --revisar-suave: #e1f5ee;

  --raio: 18px;
  --raio-p: 12px;
  --sombra: 0 1px 2px rgba(31, 36, 48, .05), 0 6px 20px rgba(31, 36, 48, .06);
  --sombra-forte: 0 10px 40px rgba(31, 36, 48, .16);
  --nav-h: 68px;
  --fonte: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #14161c;
    --cartao: #1d2028;
    --cartao-2: #252935;
    --linha: #2e3340;
    --texto: #eef0f5;
    --texto-2: #b3b8c5;
    --texto-3: #7d8394;
    --primaria: #8b85ff;
    --primaria-suave: #2a2850;
    --ok-suave: #173326; --erro-suave: #3a1d1f; --aviso-suave: #3a2c17;
    --falar-suave: #3a2322; --ouvir-suave: #2c2343; --ler-suave: #1c2b40;
    --escrever-suave: #3a2f19; --revisar-suave: #163329;
    --sombra: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --sombra-forte: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--fonte);
  background: var(--fundo);
  color: var(--texto);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primaria); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
.mudo { color: var(--texto-2); }
.mudo-3 { color: var(--texto-3); font-size: .9rem; }
.pequeno { font-size: .88rem; }
.oculto { display: none !important; }

/* ---------- Estrutura ---------- */
.tela {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 18px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: entrar .25s ease;
}
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topo { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.topo .titulo { flex: 1; min-width: 0; }
.topo .titulo .mudo-3 { margin-top: 2px; }
.voltar {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--cartao);
  box-shadow: var(--sombra); display: grid; place-items: center; flex: none;
}
.avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 0; padding: 0;
  background: var(--primaria-suave); color: var(--primaria); font-weight: 800; display: grid; place-items: center; flex: none;
}

/* ---------- Navegação inferior ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--cartao) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--linha);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-itens { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--texto-3); font-size: .72rem; font-weight: 700;
}
.nav a svg { width: 24px; height: 24px; transition: transform .15s; }
.nav a.ativo { color: var(--cor, var(--primaria)); }
.nav a.ativo svg { transform: translateY(-1px) scale(1.08); }

/* ---------- Cartões ---------- */
.cartao {
  background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra);
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.cartao.plano { box-shadow: none; border: 1px solid var(--linha); }
.cartao-cor { background: var(--suave); box-shadow: none; }

.atalho {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--raio);
  background: var(--cartao); box-shadow: var(--sombra); text-decoration: none; color: inherit; border: 0; width: 100%; text-align: left;
  transition: transform .12s;
}
.atalho:active { transform: scale(.98); }
.atalho .icone {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--suave); color: var(--cor);
}
.atalho .icone svg { width: 26px; height: 26px; }
.atalho .meio { flex: 1; min-width: 0; }
.atalho .meio h3 { margin-bottom: 2px; }
.atalho .fim { color: var(--texto-3); display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; }
.atalho.feito .icone { background: var(--ok-suave); color: var(--ok); }

.cor-falar { --cor: var(--falar); --suave: var(--falar-suave); }
.cor-ouvir { --cor: var(--ouvir); --suave: var(--ouvir-suave); }
.cor-ler { --cor: var(--ler); --suave: var(--ler-suave); }
.cor-escrever { --cor: var(--escrever); --suave: var(--escrever-suave); }
.cor-revisar { --cor: var(--revisar); --suave: var(--revisar-suave); }
.cor-primaria { --cor: var(--primaria); --suave: var(--primaria-suave); }

.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lista { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Destaque do dia ---------- */
.heroi {
  border-radius: 24px; padding: 20px; color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #c026d3 100%);
  box-shadow: 0 12px 30px rgba(79, 70, 229, .3);
  display: flex; flex-direction: column; gap: 14px;
}
.heroi .linha-sup { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.heroi .tema { font-size: 1.35rem; font-weight: 800; }
.heroi .chip { background: rgba(255,255,255,.2); color: #fff; }
.heroi .barra { background: rgba(255,255,255,.25); }
.heroi .barra > i { background: #fff; }
.heroi button.trocar { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .85rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--cartao-2); color: var(--texto-2); font-size: .82rem; font-weight: 700; white-space: nowrap;
}
.chip svg { width: 16px; height: 16px; }
.chip.cor { background: var(--suave); color: var(--cor); }

.barra { height: 10px; border-radius: 999px; background: var(--cartao-2); overflow: hidden; }
.barra > i { display: block; height: 100%; border-radius: inherit; background: var(--cor, var(--primaria)); transition: width .4s ease; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px; border-radius: 14px; border: 0;
  background: var(--cor, var(--primaria)); color: #fff; font-weight: 800; font-size: 1rem;
  transition: transform .1s, opacity .15s; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }
.btn.sec { background: var(--cartao-2); color: var(--texto); }
.btn.suave { background: var(--suave, var(--primaria-suave)); color: var(--cor, var(--primaria)); }
.btn.contorno { background: transparent; color: var(--texto); box-shadow: inset 0 0 0 1.5px var(--linha); }
.btn.bloco { width: 100%; }
.btn.peq { min-height: 38px; padding: 7px 14px; font-size: .9rem; border-radius: 11px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }

.icone-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--cartao-2); color: var(--texto-2);
  display: inline-grid; place-items: center; flex: none;
}
.icone-btn svg { width: 20px; height: 20px; }
.icone-btn.ativo { background: var(--suave); color: var(--cor); }

/* Microfone grande */
.mic {
  width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--cor, var(--falar)); color: #fff;
  display: grid; place-items: center; box-shadow: 0 8px 24px color-mix(in srgb, var(--cor, var(--falar)) 45%, transparent);
  position: relative; flex: none;
}
.mic svg { width: 36px; height: 36px; }
.mic.gravando::before, .mic.gravando::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid var(--cor, var(--falar)); opacity: .6; animation: pulso 1.4s ease-out infinite;
}
.mic.gravando::after { animation-delay: .7s; }
@keyframes pulso { from { transform: scale(.9); opacity: .7; } to { transform: scale(1.35); opacity: 0; } }
.mic.peq { width: 60px; height: 60px; }
.mic.peq svg { width: 26px; height: 26px; }

/* ---------- Formulários ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > span { font-weight: 700; font-size: .92rem; }
input[type=text], input[type=email], textarea, select {
  width: 100%; border: 1.5px solid var(--linha); background: var(--cartao); border-radius: var(--raio-p);
  padding: 12px 14px; outline: none; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--cor, var(--primaria)); }
textarea { min-height: 180px; resize: vertical; line-height: 1.55; }

.opcoes { display: grid; gap: 10px; }
.opcoes.colunas-3 { grid-template-columns: repeat(3, 1fr); }
.opcao {
  border: 1.5px solid var(--linha); background: var(--cartao); border-radius: 14px; padding: 12px 14px;
  text-align: left; display: flex; flex-direction: column; gap: 2px; transition: border-color .15s, background .15s;
}
.opcao b { font-size: 1rem; }
.opcao small { color: var(--texto-2); font-size: .82rem; line-height: 1.35; }
.opcao.sel { border-color: var(--primaria); background: var(--primaria-suave); }
.opcao.certa { border-color: var(--ok); background: var(--ok-suave); }
.opcao.errada { border-color: var(--erro); background: var(--erro-suave); }

/* ---------- Conversa ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; }
.balao { max-width: 86%; padding: 12px 15px; border-radius: 20px; position: relative; animation: entrar .2s ease; }
.balao.ia { align-self: flex-start; background: var(--cartao); box-shadow: var(--sombra); border-bottom-left-radius: 6px; }
.balao.eu { align-self: flex-end; background: var(--falar); color: #fff; border-bottom-right-radius: 6px; }
.balao .acoes { display: flex; gap: 6px; margin-top: 8px; }
.balao .acoes button { border: 0; background: var(--cartao-2); color: var(--texto-2); border-radius: 999px; padding: 4px 10px; font-size: .8rem; font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.balao .acoes svg { width: 14px; height: 14px; }
.balao .trad { margin-top: 6px; font-size: .9rem; color: var(--texto-2); font-style: italic; }
.balao.parcial { opacity: .65; }
.digitando { display: inline-flex; gap: 4px; padding: 4px 2px; }
.digitando i { width: 8px; height: 8px; border-radius: 50%; background: var(--texto-3); animation: pula 1s infinite; }
.digitando i:nth-child(2) { animation-delay: .15s; } .digitando i:nth-child(3) { animation-delay: .3s; }
@keyframes pula { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.painel-mic {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 15;
  background: linear-gradient(to top, var(--fundo) 70%, transparent);
  padding: 22px 18px 12px;
}
.painel-mic .dentro { max-width: 680px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 18px; }
.com-painel { padding-bottom: calc(var(--nav-h) + 150px + env(safe-area-inset-bottom)); }

/* ---------- Leitura ---------- */
.texto-leitura { font-size: 1.12rem; line-height: 1.75; display: flex; flex-direction: column; gap: 14px; }
.texto-leitura .p { margin: 0; }
.pal { border-radius: 5px; padding: 0 1px; cursor: pointer; transition: background .12s; }
.pal:hover { background: var(--ler-suave); }
.pal.salva { background: var(--escrever-suave); box-shadow: inset 0 -2px 0 var(--escrever); }
.pal.tocando { background: var(--ler-suave); }

/* Pronúncia: palavras coloridas */
.pron { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 1.08rem; font-weight: 600; }
.pron .ok { color: var(--ok); }
.pron .falta { color: var(--erro); text-decoration: underline wavy; text-underline-offset: 4px; }
.nota-circulo {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 900; font-size: 1.2rem; color: var(--cor); background: var(--suave);
}
.nota-boa { --cor: var(--ok); --suave: var(--ok-suave); }
.nota-media { --cor: var(--aviso); --suave: var(--aviso-suave); }
.nota-baixa { --cor: var(--erro); --suave: var(--erro-suave); }

/* Escuta: falas */
.fala { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; transition: background .2s; }
.fala.atual { background: var(--ouvir-suave); }
.fala .quem { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; background: var(--cartao-2); color: var(--texto-2); }
.fala .quem.b { background: var(--ouvir-suave); color: var(--ouvir); }
.fala .en { font-weight: 600; }
.fala .pt { color: var(--texto-2); font-size: .9rem; }
.borrado { filter: blur(6px); user-select: none; }

/* Passos (etapas) */
.passos { display: flex; gap: 6px; }
.passos i { flex: 1; height: 6px; border-radius: 999px; background: var(--linha); }
.passos i.feito { background: var(--cor, var(--primaria)); }
.passos i.atual { background: color-mix(in srgb, var(--cor, var(--primaria)) 50%, var(--linha)); }

/* Correções */
.correcao { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--cartao-2); }
.correcao .de { color: var(--erro); text-decoration: line-through; text-decoration-thickness: 2px; }
.correcao .para { color: var(--ok); font-weight: 700; }
.correcao .por { color: var(--texto-2); font-size: .92rem; }
del.dif { color: var(--erro); background: var(--erro-suave); text-decoration-thickness: 2px; border-radius: 4px; padding: 0 2px; }
ins.dif { color: var(--ok); background: var(--ok-suave); text-decoration: none; border-radius: 4px; padding: 0 2px; font-weight: 700; }

/* Revisão */
.flash {
  min-height: 300px; border-radius: 24px; background: var(--cartao); box-shadow: var(--sombra-forte);
  padding: 26px 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
}
.flash .frente { font-size: 1.7rem; font-weight: 800; line-height: 1.25; }
.flash .verso { font-size: 1.2rem; font-weight: 700; color: var(--revisar); }
.flash .ex { color: var(--texto-2); font-style: italic; }
.flash .nota-c { color: var(--texto-2); font-size: .9rem; background: var(--cartao-2); padding: 8px 12px; border-radius: 10px; }
.notas-fsrs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.notas-fsrs button { border: 0; border-radius: 14px; padding: 10px 4px; font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.notas-fsrs button small { font-weight: 700; opacity: .75; font-size: .75rem; }
.r1 { background: var(--erro-suave); color: var(--erro); }
.r2 { background: var(--aviso-suave); color: var(--aviso); }
.r3 { background: var(--ok-suave); color: var(--ok); }
.r4 { background: var(--primaria-suave); color: var(--primaria); }

/* Gráfico de barras simples */
.grafico { display: flex; align-items: flex-end; gap: 5px; height: 110px; }
.grafico .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.grafico .col i { width: 100%; border-radius: 6px 6px 3px 3px; background: var(--primaria); min-height: 3px; opacity: .85; }
.grafico .col.hoje i { opacity: 1; background: var(--falar); }
.grafico .col small { font-size: .68rem; color: var(--texto-3); font-weight: 700; }
.numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.numero { background: var(--cartao); border-radius: 16px; padding: 14px 10px; text-align: center; box-shadow: var(--sombra); }
.numero b { display: block; font-size: 1.5rem; font-weight: 900; line-height: 1.1; }
.numero span { font-size: .78rem; color: var(--texto-2); font-weight: 700; }

/* ---------- Avisos, modal, carregando ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--texto); color: var(--fundo); padding: 12px 18px; border-radius: 14px; z-index: 100;
  font-weight: 700; font-size: .95rem; box-shadow: var(--sombra-forte); max-width: calc(100% - 32px); animation: entrar .2s ease;
}
.fundo-modal {
  position: fixed; inset: 0; background: rgba(15, 17, 23, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--cartao); width: 100%; max-width: 680px; border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  max-height: 85vh; overflow: auto; animation: subir .25s ease;
}
@keyframes subir { from { transform: translateY(40px); opacity: .5; } }
.modal .puxador { width: 40px; height: 5px; border-radius: 9px; background: var(--linha); align-self: center; margin-top: -8px; }
@media (min-width: 700px) { .fundo-modal { align-items: center; } .modal { border-radius: 24px; } }

.carregando { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 10px; color: var(--texto-2); text-align: center; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--linha); border-top-color: var(--cor, var(--primaria)); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.esqueleto { background: linear-gradient(90deg, var(--cartao-2) 25%, var(--linha) 50%, var(--cartao-2) 75%); background-size: 200% 100%; animation: brilho 1.3s infinite; border-radius: 10px; height: 16px; }
@keyframes brilho { to { background-position: -200% 0; } }

.vazio { text-align: center; padding: 30px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--texto-2); }
.vazio .grande { font-size: 3rem; line-height: 1; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 22px; gap: 22px; text-align: center;
  background: radial-gradient(1200px 500px at 50% -10%, var(--primaria-suave), transparent 70%);
}
.logo { width: 88px; height: 88px; border-radius: 26px; display: grid; place-items: center; font-size: 2.6rem;
  background: linear-gradient(135deg, #4f46e5, #c026d3); color: #fff; box-shadow: 0 14px 34px rgba(79, 70, 229, .35); }
.login .habilidades { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.login .caixa { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.erro-msg { color: var(--erro); font-weight: 700; font-size: .92rem; }

.separador { height: 1px; background: var(--linha); margin: 4px 0; }
.linha-flex { display: flex; align-items: center; gap: 10px; }
.linha-flex .cresce { flex: 1; min-width: 0; }
.velocidade { display: inline-flex; background: var(--cartao-2); border-radius: 10px; padding: 3px; }
.velocidade button { border: 0; background: transparent; border-radius: 8px; padding: 4px 9px; font-weight: 800; font-size: .8rem; color: var(--texto-2); }
.velocidade button.sel { background: var(--cartao); color: var(--texto); box-shadow: var(--sombra); }
.pilha { display: flex; flex-direction: column; gap: 18px; }
.pilha:empty { display: none; }
.toast { text-align: center; }
