* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #ede9fe; color: #3b0764;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#app { max-width: 720px; height: 100%; margin: 0 auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; position: relative; }
header { display: flex; justify-content: space-between; align-items: center; }
h1 { font-size: 1.5rem; margin: 0; }
#pontos { display: flex; gap: 6px; }
#pontos i { width: 14px; height: 14px; border-radius: 50%; background: #c4b5fd; }
#pontos i.on { background: #7c3aed; }

#palco { flex: 1; min-height: 0; position: relative; }
#papel { height: 100%; position: relative; background: #fff; border-radius: 20px; box-shadow: 0 4px 0 #c4b5fd; }
#desenho { position: absolute; inset: 8px; }
#desenho svg { width: 100%; height: 100%; }
#mascote { position: absolute; right: 6px; bottom: 6px; width: 96px; height: 96px; transition: transform .2s; }
#mascote.fala { transform: translateY(-4px) rotate(-3deg); }
#boca { transform-box: fill-box; transform-origin: center; transform: scaleY(.15); }

/* traço: etapa atual se desenha, as anteriores ficam cinza */
#desenho g { display: none; }
#desenho g.feito, #desenho g.atual { display: inline; }
#desenho path, #desenho circle { stroke-dasharray: 1; stroke-dashoffset: 1; }
#desenho g.feito path, #desenho g.feito circle { stroke: #c4c4c4; stroke-dashoffset: 0; }
#desenho g.atual path, #desenho g.atual circle { stroke: #7c3aed; animation: tracar 1.2s ease-out forwards; animation-delay: calc(var(--i) * .45s); }
@keyframes tracar { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { #desenho g.atual path, #desenho g.atual circle { animation-duration: .01s; } }

#fala { min-height: 3.6em; margin: 0; font-size: 1.15rem; line-height: 1.3; text-align: center; }
nav { display: flex; gap: 10px; }
button { font: inherit; font-weight: 700; border: 0; border-radius: 16px; background: #7c3aed; color: #fff; min-height: 56px; padding: 0 20px; box-shadow: 0 4px 0 #5b21b6; cursor: pointer; }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #5b21b6; }
button[disabled] { opacity: .4; }
#voltar, #ouvir { background: #a78bfa; box-shadow: 0 4px 0 #7c3aed; min-width: 64px; }
#proximo { flex: 1; font-size: 1.2rem; }

#inicio, #fim { position: absolute; inset: 0; background: #ede9fe; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 1.8rem; font-weight: 800; text-align: center; }
#inicio p, #fim p { margin: 0; }
.pequeno { font-size: 1.1rem; font-weight: 500; }
#inicio button, #fim button { font-size: 1.5rem; min-height: 68px; padding: 0 40px; }
[hidden] { display: none !important; }
