:root {
  --fundo: #f5f7fb;
  --papel: #ffffff;
  --campo: #ffffff;
  --barra: #f8fafc;
  --tinta: #1f2937;
  --suave: #6b7280;
  --linha: #e5e7eb;
  --azul: #163a7a;
  --azul-claro: #e3eaf8;
  --botao: #163a7a;
  --destaque: #ef4b4b;
  --turquesa: #14bfc4;
  --verde: #15803d;
  --verde-claro: #dcfce7;
  --vermelho: #dc2626;
  --vermelho-claro: #fee2e2;
  --laranja: #c2410c;
  --laranja-claro: #ffedd5;
  --raio: 14px;
  color-scheme: light;
}
html[data-tema="escuro"] {
  --fundo: #0b1120;
  --papel: #131c2e;
  --campo: #0f1726;
  --barra: #0f1726;
  --tinta: #e5e7eb;
  --suave: #94a3b8;
  --linha: #24324a;
  --azul: #8fb4ff;
  --azul-claro: #1c2d4d;
  --botao: #2f5fd0;
  --verde: #4ade80;
  --verde-claro: #12351f;
  --vermelho: #f87171;
  --vermelho-claro: #3b1414;
  --laranja: #fb923c;
  --laranja-claro: #3a2210;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fundo); color: var(--tinta);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: .95rem; }
a { color: var(--azul); }
.suave { color: var(--suave); }
.pequena { font-size: .88rem; }
.erro { color: var(--vermelho); min-height: 1.2em; margin: .4em 0 0; }

/* Topo e abas */
.topo { position: sticky; top: 0; z-index: 10; background: var(--papel); border-bottom: 1px solid var(--linha);
  display: flex; align-items: center; gap: 12px; padding: 6px 16px; }
.logo-topo { height: 40px; width: auto; display: block; }
.logo-grande { width: min(340px, 90%); height: auto; display: block; margin: 0 auto 6px; }
.abas { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
.abas button { border: 0; background: transparent; padding: 8px 12px; border-radius: 999px; font: inherit;
  font-size: .95rem; color: var(--suave); white-space: nowrap; cursor: pointer; }
.abas button.ativa { background: var(--azul-claro); color: var(--azul); font-weight: 600; }
.topo-direita { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.icone { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--linha); background: var(--papel);
  font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; padding: 0; }
.icone.ativa { background: var(--azul-claro); border-color: var(--azul); }
.relogio { font-size: .85rem; font-weight: 700; color: var(--azul); background: var(--azul-claro); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 110px; }
@media (max-width: 760px) {
  .topo { flex-wrap: wrap; }
  .abas { order: 3; flex-basis: 100%; }
  .logo-topo { height: 34px; }
}

/* Peças comuns */
.cartao { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 16px; }
.grade { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.linha { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.linha.entre { justify-content: space-between; }
.coluna-dupla { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .coluna-dupla { grid-template-columns: 1fr; } }
.botao { border: 1px solid var(--linha); background: var(--papel); color: var(--tinta); border-radius: 10px;
  padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.botao:hover { border-color: var(--suave); }
.botao.primario { background: var(--botao); border-color: var(--botao); color: #fff; }
.botao.perigo { color: var(--vermelho); }
.botao.leve { background: transparent; }
.botao.pequeno { padding: 5px 10px; font-size: .88rem; }
.botao.grande { padding: 14px 22px; font-size: 1.1rem; }
.botao.whats { background: #25d366; border-color: #25d366; color: #05361a; }
.botao:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--linha); border-radius: 10px; padding: 9px 12px; font: inherit; background: var(--campo); color: var(--tinta); }
textarea { min-height: 90px; resize: vertical; }
label { font-size: .9rem; color: var(--suave); display: block; margin: 8px 0 4px; }
.pilula { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--azul-claro); color: var(--azul); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.pilula.pendente { background: var(--laranja-claro); color: var(--laranja); }
.pilula.bloqueado { background: var(--vermelho-claro); color: var(--vermelho); }
.pilula.liberado { background: var(--verde-claro); color: var(--verde); }

/* Entrada */
.entrada { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: var(--fundo); overflow-y: auto; }
.entrada-cartao { width: min(400px, 100%); display: grid; gap: 12px; text-align: center; }
#form-entrada, #entrada-espera { display: grid; gap: 10px; }
.troca-modo { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--fundo); padding: 4px; border-radius: 12px; margin-bottom: 10px; }
.troca-modo button { border: 0; background: transparent; padding: 8px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--suave); cursor: pointer; }
.troca-modo button.ativa { background: var(--papel); color: var(--azul); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Listas laterais (cadernos, aulas) */
.lista { display: grid; gap: 4px; }
.lista button { text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--tinta); }
.lista button.ativa { background: var(--azul-claro); color: var(--azul); font-weight: 600; }
.caderno-escolha { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.caderno-escolha button { flex: 1; min-width: 140px; padding: 14px; border-radius: var(--raio); border: 2px solid var(--linha);
  background: var(--papel); color: var(--tinta); font: inherit; font-weight: 700; cursor: pointer; }
.caderno-escolha button.ativa { border-color: var(--azul); color: var(--azul); }

/* Editor com marca-texto */
.barra-marca { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px; border: 1px solid var(--linha);
  border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--barra); }
.barra-marca .cor { border: 1px solid rgba(0,0,0,.12); border-radius: 999px; padding: 4px 10px; font-size: .82rem; font-weight: 600; cursor: pointer; color: #1f2937; }
.editor { min-height: 320px; border: 1px solid var(--linha); border-radius: 0 0 10px 10px; padding: 14px; background: var(--campo);
  outline: none; font-size: 1.05rem; line-height: 1.8; white-space: pre-wrap; }
.editor.leitura { border-radius: 10px; min-height: 160px; }
.editor.leitura:empty::before { content: attr(data-vazio); color: var(--suave); }
.editor:focus { border-color: var(--azul); }
mark.mk { border-radius: 4px; padding: 0 2px; color: #1f2937; }
.estado-salvo { font-size: .85rem; color: var(--suave); }

/* Favoritos */
.fav { border: 0; background: transparent; font-size: 1.25rem; cursor: pointer; padding: 2px 4px; line-height: 1; }
.botao-favoritos { position: fixed; right: 18px; bottom: 18px; z-index: 20; width: 58px; height: 58px; border-radius: 50%;
  border: 3px solid var(--papel); background: var(--destaque); color: #fff; font-size: 1.5rem; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.botao-favoritos.ativa { outline: 3px solid var(--turquesa); }

/* Verbos e pronomes */
.tabela-rolagem { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--papel); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); background: var(--papel); }
tr.verbo { cursor: pointer; }
tr.verbo:hover td { background: var(--azul-claro); }
tr.verbo.aberto td { background: var(--azul-claro); }
tr.trancado td { opacity: .42; }
tr.trancado .borrado { filter: blur(5px); user-select: none; }
tr.trancado .acao-dono { opacity: 1; }
tr.detalhe > td { background: var(--fundo); padding: 14px; }
td .som { border: 0; background: var(--azul-claro); color: var(--azul); border-radius: 999px; width: 30px; height: 30px; cursor: pointer; font-size: .9rem; }
.pron { color: var(--suave); font-style: italic; font-size: .9rem; }
.caixa-pronome { display: inline-block; border: 2.5px solid var(--destaque); border-radius: 5px; padding: 0 6px; font-weight: 800; line-height: 1.4; }
.final-s { color: var(--destaque); font-weight: 800; }
.regra { border-left: 4px solid var(--destaque); background: var(--papel); padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 8px 0; }
.lista-pronomes { display: flex; gap: 8px; flex-wrap: wrap; }
.pronome { border: 1px solid var(--linha); background: var(--campo); color: var(--tinta); border-radius: 12px; padding: 8px 12px; cursor: pointer;
  display: grid; justify-items: center; gap: 2px; font: inherit; min-width: 78px; }
.pronome > span { font-size: 1.2rem; font-weight: 700; }
.pronome small { color: var(--suave); font-size: .75rem; }
.conj { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 8px; }
.conj .tempo { background: var(--papel); border: 1px solid var(--linha); border-radius: 10px; padding: 10px 12px; }
.conj .linha-pron { padding: 4px 6px; font-size: 1.08rem; border-radius: 6px; cursor: pointer; }
.conj .linha-pron:hover { background: var(--azul-claro); }

/* Treino de fala */
.fala-titulo { font-size: 1.6rem; font-weight: 800; text-align: center; margin: 4px 0 14px; }
.texto-fala { font-size: clamp(1.6rem, 4.2vw, 2.6rem); line-height: 1.7; padding: 24px; text-align: left; }
.texto-fala .pal { padding: 0 3px; border-radius: 6px; transition: background .15s, color .15s; }
.texto-fala .pal.certa { color: var(--verde); }
.texto-fala .pal.errada { color: var(--vermelho); background: var(--vermelho-claro); text-decoration: underline wavy; }
.texto-fala .pal.cursor { background: #fde68a; color: #1f2937; box-shadow: 0 0 0 2px #f59e0b; }
.texto-fala .pal.corrigida { color: var(--verde); background: var(--verde-claro); }
.microfone { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--botao); color: #fff; font-size: 2rem; cursor: pointer; }
.microfone.ouvindo { background: var(--vermelho); animation: pulso 1.2s infinite; }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 100% { box-shadow: 0 0 0 22px rgba(220,38,38,0); } }
.ouvido { min-height: 1.5em; color: var(--suave); text-align: center; font-style: italic; }
.placar { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.placar span { padding: 4px 12px; border-radius: 999px; font-weight: 700; }
.placar .ok { background: var(--verde-claro); color: var(--verde); }
.placar .no { background: var(--vermelho-claro); color: var(--vermelho); }

/* Revisão */
.palavra-revisao { font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 800; text-align: center; margin: 8px 0; }
.resultado-ok { color: var(--verde); font-weight: 700; }
.resultado-no { color: var(--vermelho); font-weight: 700; }

/* Vídeos */
.video-caixa { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; }
.video-caixa iframe, .video-caixa video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Exercícios */
.pergunta { font-size: 1.3rem; font-weight: 700; }
.opcoes { display: grid; gap: 8px; }
.opcoes .botao { text-align: left; }
.opcoes .botao.certa { background: var(--verde-claro); border-color: var(--verde); color: var(--verde); }
.opcoes .botao.errada { background: var(--vermelho-claro); border-color: var(--vermelho); color: var(--vermelho); }

/* Configurações */
.tempo-grande { font-size: 2rem; font-weight: 800; color: var(--azul); }
.lista-tempo { display: grid; gap: 4px; margin-top: 8px; }
.lista-tempo div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--linha); padding: 3px 0; }

/* Cadernos no estilo Notas */
.cadernos-topo { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.aba-caderno { flex: 1; min-width: 120px; padding: 12px; border-radius: 12px 12px 4px 4px; border: 2px solid var(--linha);
  border-bottom: 6px solid var(--cor); background: var(--papel); color: var(--tinta); font: inherit; font-weight: 700; cursor: pointer; }
.aba-caderno.ativa { background: var(--cor); color: #fff; border-color: var(--cor); }
.notas { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; }
@media (max-width: 800px) { .notas { grid-template-columns: 1fr; } }
.nota { border-top: 6px solid var(--cor); padding: 12px; }
.titulo-nota { font-size: 1.3rem !important; font-weight: 800; border: 0 !important; background: transparent !important; padding: 4px 2px !important; flex: 1; min-width: 180px; }
.barra-nota { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linha); margin-bottom: 8px; }
.barra-nota .grupo { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; padding-right: 6px; border-right: 1px solid var(--linha); }
.barra-nota .grupo:last-child { border-right: 0; }
.barra-nota button { border: 1px solid var(--linha); background: var(--papel); color: var(--tinta); border-radius: 8px; padding: 5px 9px;
  font: inherit; font-size: .86rem; cursor: pointer; }
.barra-nota button.perigo { color: var(--vermelho); }
.barra-nota .modo.ativa { background: var(--cor); color: #fff; border-color: var(--cor); }
.barra-nota .cor { color: #1f2937; border-radius: 999px; font-weight: 600; }
.ponto-cor { width: 24px; height: 24px; padding: 0 !important; border-radius: 50% !important; border: 2px solid var(--papel) !important; box-shadow: 0 0 0 1px var(--linha); }
.ponto-cor.ativa { box-shadow: 0 0 0 2px var(--tinta); }
.papel { position: relative; border-radius: 8px; background-color: var(--campo);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--linha) 31px, var(--linha) 32px);
  box-shadow: inset 34px 0 0 -32px rgba(239,75,75,.55); }
.nota-texto { position: relative; z-index: 1; min-height: 62vh; padding: 0 16px 32px 44px; font-size: 1.12rem; line-height: 32px; outline: none; white-space: pre-wrap; word-break: break-word; }
.nota-texto ul, .nota-texto ol { margin: 0; padding-left: 1.4em; }
.nota-desenho { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; }
.papel.desenhando .nota-desenho { pointer-events: auto; touch-action: none; cursor: crosshair; }
.papel.lendo .nota-texto { cursor: help; }
.raios { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.raio { position: absolute; pointer-events: auto; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 50%; background: #fde047;
  font-size: 10px; line-height: 17px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.papel.desenhando .raios { display: none; }
.resultado-busca { display: grid; gap: 2px; width: 100%; text-align: left; border: 1px solid var(--linha); background: var(--campo); color: var(--tinta);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font: inherit; cursor: pointer; }
.resultado-busca small { color: var(--suave); }

/* Capítulos */
.texto-capitulo { font-size: clamp(1.2rem, 3vw, 1.55rem); line-height: 1.8; }
.texto-capitulo p { margin: 0 0 .8em; }
.texto-capitulo .som { vertical-align: middle; margin-right: 4px; }
.pal-cap { cursor: pointer; border-radius: 4px; padding: 0 1px; }
.pal-cap:hover { background: #fde68a; color: #1f2937; }

/* O aluno vê o conteúdo do professor, mas não as ferramentas de editar */
.aluno #dica-nova, .aluno #video-novo, .aluno #cor-nova, .aluno #cor-padrao,
.aluno #video-lista [data-apagar], .aluno #dica-lista [data-apagar], .aluno #cores-lista [data-tirar],
.aluno #cores-lista input[type=color] { display: none !important; }
.aluno #cores-lista input[type=text] { pointer-events: none; border-color: transparent; background: transparent; }

/* Exercícios com lacunas */
.lista-ex { display: grid; gap: 12px; }
.texto-exercicio { font-size: 1.2rem; line-height: 2.3; }
.lacuna { white-space: nowrap; }
.lacuna input { width: auto !important; display: inline-block; padding: 1px 6px !important; border: 0 !important; border-bottom: 2px solid var(--azul) !important;
  border-radius: 6px 6px 0 0 !important; background: var(--campo); font-size: 1.1rem; }
.lacuna input.ok { border-bottom-color: var(--verde) !important; background: var(--verde-claro); }
.lacuna input.erro { border-bottom-color: var(--vermelho) !important; background: var(--vermelho-claro); }
.lampada { border: 0; background: transparent; cursor: pointer; font-size: .95rem; padding: 0 2px; vertical-align: super; }
.resultado-ex { margin-left: 6px; }

/* Lisa */
.botao-lisa { position: fixed; left: 18px; bottom: 18px; z-index: 20; height: 60px; border-radius: 999px; border: 3px solid var(--papel);
  background: var(--turquesa); color: #053a3c; padding: 0 16px 0 2px; display: flex; align-items: center; gap: 2px; font: inherit;
  font-weight: 800; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.botao-lisa svg { width: 54px; height: 54px; }
.lisa-painel { position: fixed; left: 12px; bottom: 90px; z-index: 55; width: min(390px, calc(100vw - 24px)); max-height: 72vh; overflow: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.28); }
.lisa-topo { display: flex; gap: 10px; align-items: center; }
.lisa-avatar svg { width: 72px; height: 84px; display: block; }
.lisa-conversa { display: grid; gap: 8px; margin-top: 8px; max-height: 42vh; overflow: auto; }
.balao { background: var(--azul-claro); color: var(--tinta); border-radius: 14px 14px 14px 4px; padding: 10px 12px; }
.balao.meu { background: var(--campo); border: 1px solid var(--linha); border-radius: 14px 14px 4px 14px; justify-self: end; max-width: 85%; }
.mao { transform-box: view-box; transform-origin: 32px 112px; }
.mao.acenando { animation: acenar 1.1s ease-in-out 3; }
@keyframes acenar { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-16deg); } 70% { transform: rotate(12deg); } }
.botao-lisa .mao { animation: acenar 1.1s ease-in-out 2 1s; }
@media (max-width: 520px) { .botao-lisa span { display: none; } .botao-lisa { padding: 0 4px; } }

/* Janela de Enviar e demais janelas */
.modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { width: min(460px, 100%); max-height: 85vh; overflow: auto; }
.opcoes-envio { display: grid; gap: 8px; }
.opcoes-envio .botao { text-align: left; }

.aviso { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 18px; border-radius: 999px; z-index: 50; font-size: .95rem; max-width: 90vw; text-align: center; }
