/* Movimento e navegação compartilhados pela landing, páginas públicas e app da instância paga.
   Usa os tokens que as duas folhas já definem (--tarmac, --sky, --cloud, --paper, --line, --muted).
   Só transform e opacity são animados. Com movimento reduzido, nada se move. */

:root{--motion-route:220ms;--motion-step:140ms;--motion-ease:cubic-bezier(.2,.7,.2,1)}

/* ===== Introdução da marca (frontend/intro.js) ===== */
/* Enquanto o módulo carrega, uma cortina na cor de fundo evita ver o conteúdo "piscar". Se o módulo falhar,
   a cortina some sozinha em 2,6 s: a introdução nunca prende a página. */
html.intro-on::before{content:"";position:fixed;inset:0;z-index:2147483000;background:var(--cloud);animation:intro-failsafe .2s 2.6s forwards}
@keyframes intro-failsafe{to{opacity:0;visibility:hidden}}
.intro{position:fixed;inset:0;z-index:2147483001;background:var(--cloud);overflow:hidden;cursor:pointer}
.intro-art{position:absolute;inset:0}
.intro-trail{position:absolute;inset:0}
.intro-trail path{fill:none;stroke:var(--sky);stroke-width:2;stroke-dasharray:7 9;stroke-linecap:round;opacity:.55}
.intro-cover{position:absolute;top:0;left:0;width:100vw;height:100vh;background:var(--cloud)}
.intro-logo{position:absolute;left:50%;top:50%;width:min(220px,52vw);height:auto;opacity:0;transform:translate(-50%,-50%)}
.intro-plane{position:absolute;left:0;top:0;width:44px;height:44px;color:var(--tarmac)}
.intro-plane svg{width:100%;height:100%;fill:var(--paper);stroke:currentColor;stroke-width:1.6;stroke-linejoin:round}
.intro-skip{position:absolute;right:16px;bottom:calc(16px + env(safe-area-inset-bottom));min-height:44px;padding:10px 16px;border:1px solid var(--line);border-radius:999px;background:var(--paper);color:var(--tarmac);font:inherit;font-size:15px;font-weight:600;cursor:pointer}
.intro-skip:focus-visible{outline:3px solid var(--sky);outline-offset:2px}

/* ===== Transições entre páginas ===== */
/* Entre documentos (landing → termos → app): View Transitions nativas; navegadores sem suporte trocam direto. */
@media (prefers-reduced-motion:no-preference){
 @view-transition{navigation:auto}
 ::view-transition-old(root),::view-transition-new(root){animation-duration:var(--motion-route);animation-timing-function:var(--motion-ease)}
}
/* Dentro do app (rotas por hash): entrada curta da tela; próxima questão só com opacidade, sem distrair. */
@keyframes route-enter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes step-enter{from{opacity:.35}to{opacity:1}}
.route-enter{animation:route-enter var(--motion-route) var(--motion-ease)}
.step-enter{animation:step-enter var(--motion-step) ease-out}

/* Barra de carregamento no topo: aparece só se a tela demora mais de 150 ms; um avião pequeno cruza a faixa. */
.route-progress{position:fixed;top:0;left:0;right:0;z-index:60;height:3px;pointer-events:none;opacity:0;transition:opacity .15s ease-out}
.route-progress.on{opacity:1}
.route-progress-track{position:absolute;inset:0;background:linear-gradient(90deg,var(--sky) 0 50%,transparent 50% 100%);background-size:14px 3px;opacity:.45}
.route-progress-plane{position:absolute;top:-8px;left:0;width:18px;height:18px;color:var(--tarmac);animation:route-fly 1.1s linear infinite}
.route-progress-plane svg{width:100%;height:100%;fill:var(--paper);stroke:currentColor;stroke-width:1.8;transform:rotate(45deg)}
@keyframes route-fly{from{transform:translateX(-24px)}to{transform:translateX(100vw)}}
.route-progress:not(.on) .route-progress-plane{animation-play-state:paused}

/* ===== Botão Voltar (frontend/back-nav.js) ===== */
/* No app, o visual vem de .back-button em styles.css; aqui ficam o ícone e a versão das páginas públicas. */
.back-button{display:inline-flex;align-items:center;gap:6px;min-height:44px;min-width:44px;text-decoration:none}
.back-button .back-icon{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.back-button:focus-visible{outline:3px solid var(--sky);outline-offset:2px}
.page-back .back-button,.legal .back-button{margin:0 0 20px;padding:8px 16px 8px 10px;border:1px solid var(--line);border-radius:10px;background:var(--paper);color:var(--tarmac);font-weight:600}
.page-back .back-button:hover,.legal .back-button:hover{border-color:var(--sky)}

@media (prefers-reduced-motion:reduce){
 .route-enter,.step-enter{animation:none}
 .route-progress-plane{animation:none;left:50%}
 html.intro-on::before{display:none}
}

/* ===== Copiloto (tutor de IA) ===== */
.copiloto-launcher{position:fixed;right:24px;bottom:24px;z-index:40;display:flex;align-items:center;gap:8px;min-height:56px;padding:6px 18px 6px 6px;border:0;border-radius:999px;background:var(--tarmac,#072B5F);color:#fff;font:600 15px/1 var(--font,system-ui);box-shadow:0 8px 24px #0B224033;cursor:pointer}
.copiloto-launcher:hover{background:var(--tarmac-2,#0E3A78)}
.copiloto-launcher:focus-visible,.copiloto-chip:focus-visible,.copiloto-icon-button:focus-visible{outline:3px solid var(--sky,#1D5FA8);outline-offset:3px}
.copiloto-launcher[hidden],body.copiloto-open .copiloto-launcher{display:none}
.copiloto-mascot{display:inline-flex;width:44px;height:44px;flex:none;border-radius:50%;background:#fff}
.copiloto-mascot svg{width:100%;height:100%}
.copiloto-mascot-small{width:40px;height:40px;background:var(--sky-soft,#E3EEFA)}
.copiloto-mascot-tiny{width:28px;height:28px;background:var(--sky-soft,#E3EEFA)}
.copiloto-panel{position:fixed;right:24px;bottom:24px;z-index:41;display:flex;flex-direction:column;width:min(420px,calc(100vw - 32px));height:min(640px,calc(100dvh - 48px));border:1px solid var(--line,#D3DDEA);border-radius:16px;background:var(--paper,#fff);color:var(--ink,#0B2240);box-shadow:0 18px 48px #0B224033;overflow:hidden}
.copiloto-panel[hidden]{display:none}
.copiloto-header{display:flex;align-items:center;gap:10px;padding:12px 10px 12px 14px;border-bottom:1px solid var(--line-soft,#E8ECF1);background:var(--cloud,#F6F5F2)}
.copiloto-heading{flex:1;min-width:0}
.copiloto-heading h2{margin:0;font:600 18px/1.2 var(--font-display,system-ui);color:var(--tarmac,#072B5F)}
.copiloto-about{margin:2px 0 0;font-size:13px;color:var(--muted,#56657A);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.copiloto-icon-button{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border:0;border-radius:10px;background:transparent;color:var(--tarmac,#072B5F);cursor:pointer}
.copiloto-icon-button:hover{background:var(--sky-soft,#E3EEFA)}
.copiloto-icon-button .icon svg{width:20px;height:20px}
.copiloto-log{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:12px;overscroll-behavior:contain}
.copiloto-msg{display:flex;gap:8px;align-items:flex-start;max-width:100%}
.copiloto-user{justify-content:flex-end}
.copiloto-text{min-width:0;padding:10px 12px;border-radius:14px;font-size:15px;line-height:1.5;overflow-wrap:anywhere}
.copiloto-assistant .copiloto-text{background:var(--sky-soft,#E3EEFA);border-top-left-radius:4px}
.copiloto-user .copiloto-text{background:var(--tarmac,#072B5F);color:#fff;border-top-right-radius:4px;white-space:pre-wrap}
.copiloto-error .copiloto-text{background:var(--amber-soft,#FCEFE0)}
.copiloto-text p{margin:0 0 8px}.copiloto-text p:last-child{margin-bottom:0}
.copiloto-text ul,.copiloto-text ol{margin:0 0 8px;padding-left:20px}
.copiloto-text code{font-family:inherit;font-weight:600;color:var(--tarmac,#072B5F)}
.copiloto-note{margin:6px 0 0;font-size:14px;color:var(--amber,#8A4A12)}
.copiloto-notice{padding:12px 14px;border:1px solid var(--line,#D3DDEA);border-radius:12px;background:var(--paper,#fff);font-size:14px;line-height:1.45}
.copiloto-notice ul{margin:8px 0;padding-left:18px}.copiloto-notice li{margin-bottom:4px}
.copiloto-typing{display:inline-flex;gap:4px;padding:4px 0}
.copiloto-typing i{width:7px;height:7px;border-radius:50%;background:var(--sky,#1D5FA8);opacity:.35}
.copiloto-quick{display:flex;gap:8px;padding:0 14px 8px;overflow-x:auto}
.copiloto-chip{flex:none;min-height:36px;padding:6px 12px;border:1px solid var(--line,#D3DDEA);border-radius:999px;background:var(--paper,#fff);color:var(--tarmac,#072B5F);font:500 14px/1 var(--font,system-ui);cursor:pointer}
.copiloto-chip:hover{border-color:var(--sky,#1D5FA8)}
.copiloto-form{padding:10px 14px 4px;border-top:1px solid var(--line-soft,#E8ECF1)}
.copiloto-form textarea{width:100%;box-sizing:border-box;min-height:52px;max-height:140px;resize:vertical;padding:10px 12px;border:1px solid var(--control,#75869A);border-radius:10px;font:16px/1.4 var(--font,system-ui);color:var(--ink,#0B2240)}
.copiloto-form textarea:focus-visible{outline:3px solid var(--sky,#1D5FA8);outline-offset:1px}
.copiloto-form-row{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-top:8px}
.copiloto-counter{margin-right:auto;font-size:12px;color:var(--muted,#56657A)}
.copiloto-send,.copiloto-stop{min-height:44px}
.copiloto-quota{margin:0;padding:4px 14px 12px;font-size:13px;color:var(--muted,#56657A)}
.copiloto-quota:empty{display:none}
@media (prefers-reduced-motion:no-preference){
 .copiloto-typing i{animation:copiloto-dot 1.2s infinite ease-in-out}
 .copiloto-typing i:nth-child(2){animation-delay:.15s}.copiloto-typing i:nth-child(3){animation-delay:.3s}
 .copiloto-panel{animation:copiloto-in .18s ease-out}
}
@keyframes copiloto-dot{0%,80%,100%{opacity:.35;transform:none}40%{opacity:1;transform:translateY(-3px)}}
@keyframes copiloto-in{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
/* Até 1023 px o botão fica no cabeçalho (círculo de 44 px, como Ajuda e WhatsApp). */
.copiloto-launcher-compact{position:static;order:2;flex:none;width:44px;height:44px;min-height:44px;padding:0;justify-content:center;border:1px solid var(--control,#75869A);border-radius:50%;background:var(--sky-soft,#E3EEFA);box-shadow:none}
.copiloto-launcher-compact:hover{background:var(--navy-soft,#E8F0FA)}
.copiloto-launcher-compact .copiloto-launcher-label{display:none}
.copiloto-launcher-compact .copiloto-mascot{width:40px;height:40px;background:transparent}
/* Celular: tela cheia, do tamanho da área visível (encolhe com o teclado). */
@media (max-width:767px){
 .copiloto-panel{top:var(--copiloto-top,0);left:0;right:0;bottom:auto;width:100%;height:var(--copiloto-vh,100dvh);border:0;border-radius:0;padding-bottom:env(safe-area-inset-bottom)}
 .copiloto-header{padding-top:calc(10px + env(safe-area-inset-top))}
 .copiloto-quick{flex-wrap:wrap;overflow:visible}
 .copiloto-chip{min-height:44px}
 .copiloto-form-row{margin-top:6px}
 .copiloto-form textarea{min-height:48px}
 html.copiloto-lock,html.copiloto-lock body{overflow:hidden;overscroll-behavior:none}
 .copiloto-keyboard .copiloto-quick,.copiloto-keyboard .copiloto-quota{display:none}
}
@media print{.copiloto-launcher,.copiloto-panel{display:none!important}}

/* ===== WhatsApp do professor (ao lado da Ajuda) ===== */
.whatsapp-button{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;margin-top:8px;padding:10px 12px;border:1px solid var(--line,#D3DDEA);border-radius:var(--r-control,10px);background:var(--paper,#fff);color:#146C43;font-size:15px;font-weight:600;text-decoration:none;box-sizing:border-box}
.whatsapp-button:hover{border-color:#1F8A55;background:#EAF7EF}
.whatsapp-button:focus-visible{outline:3px solid var(--sky,#1D5FA8);outline-offset:2px}
.whatsapp-button .icon{display:inline-flex;width:22px;height:22px}.whatsapp-button .icon svg{width:100%;height:100%}
@media (max-width:1023px){
 .whatsapp-button{order:2;flex:none;width:44px;height:44px;margin:0;padding:0;justify-content:center;border-color:var(--control,#75869A);border-radius:50%}
 .whatsapp-button .help-label{display:none}
}
