:root {
  --fundo: #16121f;
  --cartao: #221c30;
  --borda: #362d4a;
  --texto: #f3eefb;
  --suave: #a99dbf;
  --destaque: #ff5c8a;
  --destaque-2: #ff9f5c;
  --raio: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

.topo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top)) 16px 8px;
}
.topo h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.02em; }
.topo h1 span { color: var(--destaque); }
.restante { margin: 0; color: var(--suave); font-size: 0.85rem; }
.topo-direita { display: flex; align-items: center; gap: 10px; }
.conta-botao { border: 1px solid var(--borda); background: var(--cartao); border-radius: 999px; width: 36px; height: 36px; font-size: 1rem; }
.botao-google { display: flex; justify-content: center; min-height: 44px; margin: 8px 0 12px; }
.link.perigo { color: #ff8a8a; }

main { padding: 0 16px; max-width: 560px; margin: 0 auto; }

.aba { display: none; }
.aba.ativa { display: block; }
h2 { margin: 12px 0 4px; font-size: 1.25rem; }
.sub { margin: 0 0 16px; color: var(--suave); line-height: 1.4; }

.temas { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tema {
  border: 1px solid var(--borda);
  background: var(--cartao);
  color: var(--texto);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
}
.tema.ativa { border-color: var(--destaque); background: color-mix(in srgb, var(--destaque) 18%, var(--cartao)); }

.chips { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.chips .tema { flex: 0 0 auto; font-size: 0.85rem; padding: 6px 12px; }
.rotulo-chips { margin: 0 0 6px; font-size: 0.8rem; color: var(--suave); }

.lido summary { cursor: pointer; color: var(--suave); }
.lido ul { margin: 8px 0; padding-left: 18px; line-height: 1.45; }
.lido li b { color: var(--destaque-2); font-weight: 600; }
.lido button { margin-top: 4px; }

.campo {
  width: 100%;
  background: var(--cartao);
  border: 1px solid var(--borda);
  color: var(--texto);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  margin-bottom: 12px;
  resize: vertical;
}
.campo::placeholder { color: var(--suave); }

.upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
  border: 2px dashed var(--borda);
  border-radius: var(--raio);
  margin-bottom: 12px;
  color: var(--suave);
  padding: 12px;
  text-align: center;
}
.upload img { max-height: 260px; max-width: 100%; border-radius: 10px; }

.aviso { color: var(--suave); font-size: 0.8rem; margin: 0 0 12px; line-height: 1.4; }

.botao {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--destaque), var(--destaque-2));
}
.botao:disabled { opacity: 0.6; }

.resultado { margin: 20px 0; display: grid; gap: 12px; }
.cartao {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 14px;
}
.cartao .rotulo { font-size: 0.8rem; color: var(--suave); text-transform: uppercase; letter-spacing: 0.05em; }
.cartao .frase { font-size: 1.05rem; line-height: 1.45; margin: 6px 0 8px; }
.cartao .porque { color: var(--suave); font-size: 0.85rem; line-height: 1.4; margin: 0 0 10px; }
.acoes { display: flex; gap: 8px; }
.acoes button {
  flex: 1;
  border: 1px solid var(--borda);
  background: transparent;
  color: var(--texto);
  border-radius: 10px;
  padding: 9px;
  font: inherit;
  font-size: 0.9rem;
}
.acoes button.reportar { flex: 0 0 44px; }
.acoes button.principal { border: 0; color: #fff; background: linear-gradient(135deg, var(--destaque), var(--destaque-2)); font-weight: 700; }

.acoes button.perigo { color: #ff8a8a; }

.pessoa { display: flex; gap: 8px; }
.pessoa select { flex: 1; }
.pessoa .editar { flex: 0 0 48px; height: 48px; border: 1px solid var(--borda); background: var(--cartao); border-radius: 12px; }

.placar { display: flex; gap: 8px; margin-bottom: 12px; }
.placar span { flex: 1; text-align: center; background: var(--cartao); border: 1px solid var(--borda); border-radius: 12px; padding: 10px 4px; font-weight: 700; font-size: 0.9rem; }
.licao h3 { margin: 6px 0; font-size: 1.15rem; }
.licao .texto { line-height: 1.5; color: var(--suave); }
.licao .pergunta { font-weight: 700; line-height: 1.4; }
.respostas { display: grid; gap: 8px; margin-bottom: 12px; }
.resposta {
  text-align: left;
  border: 1px solid var(--borda);
  background: var(--fundo);
  color: var(--texto);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  line-height: 1.4;
}
.resposta.certa { border-color: #4cd18a; background: color-mix(in srgb, #4cd18a 15%, var(--fundo)); }
.resposta.errada { border-color: #ff8a8a; background: color-mix(in srgb, #ff8a8a 12%, var(--fundo)); }
.resposta:disabled { color: var(--texto); }
.licao .explicacao { line-height: 1.45; color: var(--suave); }

.link { display: block; margin: 10px auto 0; background: none; border: 0; color: var(--suave); font: inherit; font-size: 0.9rem; text-decoration: underline; }
.botao.secundario { background: transparent; border: 1px solid var(--borda); margin-top: 8px; }

.beneficios { padding-left: 20px; line-height: 1.6; color: var(--suave); margin: 4px 0 12px; }
.preco { display: grid; gap: 2px; text-align: center; background: var(--cartao); border: 1px solid var(--borda); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.preco strong { font-size: 1.2rem; color: var(--destaque); }
.preco small { color: var(--suave); }
#dialogo-planos .acoes { margin-top: 8px; }

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--fundo);
  overflow-y: auto;
  padding: calc(16px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.onboarding > * { max-width: 520px; margin-left: auto; margin-right: auto; }
.onboarding h2 { font-size: 1.6rem; margin-top: 28px; }
.onboarding h2 span { color: var(--destaque); }
.onb-topo { display: flex; align-items: center; gap: 12px; }
.onb-barra { flex: 1; height: 6px; border-radius: 999px; background: var(--borda); overflow: hidden; }
.onb-barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--destaque-2), var(--destaque)); }
.onb-pular { margin: 0; }
.onb-opcoes { display: grid; gap: 10px; margin: 16px auto 20px; }
.onb-opcao { text-align: left; border: 1px solid var(--borda); background: var(--cartao); color: var(--texto); border-radius: 14px; padding: 14px; font: inherit; }
.onb-opcao.ativa { border-color: var(--destaque); background: color-mix(in srgb, var(--destaque) 18%, var(--cartao)); }
.destaque-onb { background: var(--cartao); border: 1px solid var(--borda); border-radius: 14px; padding: 14px; line-height: 1.5; margin: 16px auto 24px; }
.onb-idade { margin-bottom: 8px; }
.onboarding .aviso a { color: var(--suave); }

/* ---------- microinterações ---------- */
.aba.ativa { animation: aba-entra 0.18s ease-out; }
@keyframes aba-entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.status-carregando { margin: 0; text-align: center; color: var(--suave); font-size: 0.9rem; }
.esqueleto { display: grid; gap: 8px; padding: 14px; border-radius: var(--raio); border: 1px solid var(--borda); background: var(--cartao); }
.esqueleto i {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--borda) 25%, color-mix(in srgb, var(--borda) 50%, var(--texto) 12%) 50%, var(--borda) 75%);
  background-size: 200% 100%;
  animation: brilho 1.2s linear infinite;
}
.esqueleto i.curta { width: 55%; }
@keyframes brilho { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Resultado entra em cascata; a barra do termômetro enche. */
.resultado > * { animation: entra 0.35s ease-out both; }
.resultado > :nth-child(2) { animation-delay: 0.08s; }
.resultado > :nth-child(3) { animation-delay: 0.16s; }
.resultado > :nth-child(4) { animation-delay: 0.24s; }
.resultado > :nth-child(5) { animation-delay: 0.32s; }
.resultado > :nth-child(n + 6) { animation-delay: 0.4s; }
@keyframes entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.termometro .barra i { transform-origin: left; animation: enche 0.9s 0.2s ease-out both; }
@keyframes enche { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.acoes button.feito { border-color: #4cd18a; color: #4cd18a; }

/* Confete do treino */
.confete { position: fixed; top: 40%; left: 50%; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; z-index: 40; animation: confete 0.9s ease-out forwards; }
@keyframes confete { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .aba.ativa, .resultado > *, .termometro .barra i, .esqueleto i, .cartao-print { animation: none !important; }
  .confete { display: none; }
}

.faixa-instalar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--cartao);
  border: 1px solid var(--destaque);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
  font-size: 0.85rem;
  animation: entra 0.3s ease-out both;
}
.faixa-instalar[hidden] { display: none; }
.faixa-instalar span { flex: 1; line-height: 1.3; }
.faixa-instalar button { border: 0; border-radius: 10px; padding: 8px 12px; font: inherit; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--destaque), var(--destaque-2)); }
.faixa-instalar #dispensar-instalar { background: none; color: var(--suave); padding: 8px; }

/* ---------- Início ---------- */
.cartao-print {
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 4px;
  text-align: left;
  border: 0;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 12px;
  color: #fff;
  font: inherit;
  background: linear-gradient(135deg, var(--destaque), var(--destaque-2));
  box-shadow: 0 10px 30px rgb(255 92 138 / 0.25);
}
.cartao-print .icone { font-size: 1.8rem; }
.cartao-print b { font-size: 1.25rem; }
.cartao-print small { opacity: 0.9; line-height: 1.35; }
.atalhos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.atalhos button {
  display: grid;
  gap: 4px;
  justify-items: start;
  text-align: left;
  border: 1px solid var(--borda);
  background: var(--cartao);
  color: var(--texto);
  border-radius: 16px;
  padding: 14px;
  font: inherit;
  font-size: 0.92rem;
}
.atalhos button span { font-size: 1.4rem; }
.atalhos button.destaque { border-color: var(--destaque); }
.pessoas-recentes { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; scrollbar-width: none; }
.pessoa-chip { flex: 0 0 auto; border: 1px solid var(--borda); background: var(--cartao); color: var(--texto); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 0.9rem; }
.inicio-treino { width: 100%; display: grid; gap: 2px; text-align: left; color: var(--texto); font: inherit; margin-bottom: 12px; }
.inicio-treino b { font-size: 1.05rem; }
.inicio-treino small { color: var(--suave); }
.faixa-plano { width: 100%; border: 1px dashed var(--borda); background: transparent; color: var(--suave); border-radius: 12px; padding: 10px; font: inherit; font-size: 0.85rem; }

/* ---------- boas-vindas com demonstração em loop (6 s) ---------- */
.onboarding.boas-vindas h2 { font-size: 1.75rem; line-height: 1.15; margin-top: 18px; }
.demo { position: relative; display: grid; gap: 8px; margin: 18px auto 14px; padding: 14px; border-radius: 20px;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--destaque) 16%, var(--cartao)), var(--cartao)); border: 1px solid var(--borda); }
.demo-tel { position: relative; overflow: hidden; display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: #0e0b15; }
.demo-msg { max-width: 80%; padding: 7px 11px; border-radius: 14px; font-size: 0.82rem; line-height: 1.3; }
.demo-msg.eu { justify-self: end; background: var(--destaque); color: #fff; border-bottom-right-radius: 4px; }
.demo-msg.ela { justify-self: start; background: #2c2540; border-bottom-left-radius: 4px; }
.demo-scan { position: absolute; left: 0; right: 0; height: 36px; top: -40px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--destaque-2) 45%, transparent), transparent); animation: demo-scan 6s infinite; }
.demo-lido { justify-self: center; font-size: 0.75rem; color: var(--destaque-2); opacity: 0; animation: demo-lido 6s infinite; }
.demo-termo { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--suave); }
.demo-termo div { height: 8px; border-radius: 999px; background: var(--borda); overflow: hidden; }
.demo-termo i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--destaque-2), var(--destaque)); animation: demo-termo 6s infinite; }
.demo-termo b { font-weight: 400; opacity: 0; animation: demo-fogo 6s infinite; }
.demo-resp { padding: 8px 11px; border-radius: 12px; background: var(--fundo); border: 1px solid var(--borda); font-size: 0.82rem; line-height: 1.35; opacity: 0; }
.demo-resp small { display: block; font-size: 0.68rem; color: var(--suave); text-transform: uppercase; letter-spacing: 0.04em; }
.demo-resp.r1 { animation: demo-r1 6s infinite; }
.demo-resp.r2 { animation: demo-r2 6s infinite; }
.demo-resp.r3 { animation: demo-r3 6s infinite; }
@keyframes demo-scan { 0%, 8% { top: -40px; opacity: 0; } 10% { opacity: 1; } 28% { top: 100%; opacity: 1; } 29%, 100% { top: 100%; opacity: 0; } }
@keyframes demo-lido { 0%, 28% { opacity: 0; } 32%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes demo-termo { 0%, 32% { width: 0; } 45%, 90% { width: 62%; } 96%, 100% { width: 0; } }
@keyframes demo-fogo { 0%, 44% { opacity: 0; } 48%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes demo-r1 { 0%, 48% { opacity: 0; transform: translateY(8px); } 54%, 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
@keyframes demo-r2 { 0%, 56% { opacity: 0; transform: translateY(8px); } 62%, 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
@keyframes demo-r3 { 0%, 64% { opacity: 0; transform: translateY(8px); } 70%, 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
.selos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.selos span { font-size: 0.75rem; color: var(--suave); background: var(--cartao); border: 1px solid var(--borda); border-radius: 999px; padding: 5px 10px; }
.contador { text-align: center; color: var(--destaque-2); font-size: 0.85rem; margin: 0 0 12px; }
@media (prefers-reduced-motion: reduce) {
  .demo *, .demo-scan { animation: none !important; }
  .demo-lido, .demo-termo b, .demo-resp { opacity: 1; }
  .demo-termo i { width: 62%; }
}

.rodape { text-align: center; font-size: 0.8rem; margin: 24px 0 8px; }
.rodape a { color: var(--suave); }

.dialogo {
  width: min(92vw, 440px);
  background: var(--fundo);
  color: var(--texto);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 16px;
}
.dialogo::backdrop { background: rgb(0 0 0 / 0.6); }
.dialogo h2 { margin-top: 0; }
.opcao { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.termometro .barra { height: 10px; border-radius: 999px; background: var(--borda); overflow: hidden; margin: 10px 0 8px; }
.termometro .barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--destaque-2), var(--destaque)); }
.termometro .momento { margin: 0 0 6px; font-weight: 700; }
.termometro .porque { margin: 0; }

.colar { margin-bottom: 12px; color: var(--suave); }
.colar summary { padding: 4px 0 10px; cursor: pointer; }

.dica { border-left: 3px solid var(--destaque-2); padding: 10px 12px; color: var(--suave); line-height: 1.45; }
.erro { color: #ff8a8a; }

.carregando { display: flex; gap: 6px; justify-content: center; padding: 24px; }
.carregando i { width: 9px; height: 9px; border-radius: 50%; background: var(--destaque); animation: pulo 0.9s infinite ease-in-out; }
.carregando i:nth-child(2) { animation-delay: 0.15s; }
.carregando i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulo { 0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

.abas {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: color-mix(in srgb, var(--fundo) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--borda);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.abas button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: 0;
  color: var(--suave);
  font: inherit;
  font-size: 0.75rem;
  padding: 6px 0;
}
.abas button span { font-size: 1.35rem; }
.abas button.ativa { color: var(--texto); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--texto);
  color: var(--fundo);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}
.toast.visivel { opacity: 1; transform: translateX(-50%) translateY(0); }
