:root {
  --papel: #fffdf5;
  --pauta: #b9d3ee;
  --tinta: #23303f;
  --fraco: #6b7a8c;
  --azul: #2f6fb3;
  --azul-claro: #e7f1fb;
  --vermelho: #d23b3b;
  --verde: #1f8a3b;
  --borda: #c9d6e4;
  --linha: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  background: var(--papel);
  color: var(--tinta);
  font-size: 18px;
  line-height: 1.35;
  overscroll-behavior: none;
  user-select: none;
}
button, input, textarea, select { font: inherit; color: inherit; }

#tela {
  height: 100dvh;
  overflow-y: auto;
  max-width: 560px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.canto {
  position: fixed; top: max(8px, env(safe-area-inset-top)); right: 8px; z-index: 20;
  width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--borda);
  background: #fff; font-size: 22px; line-height: 1; opacity: .75;
}

h1 { font-size: 30px; padding-right: 56px; }
h2 { font-size: 22px; padding-right: 56px; }
.fraco { color: var(--fraco); font-size: 15px; }
.centro { text-align: center; }
.espaco { flex: 1; }
.linha-botoes { display: flex; gap: 10px; }
.linha-botoes > * { flex: 1; }

.botao {
  min-height: 56px; border: 0; border-radius: 16px; padding: 12px 16px;
  background: var(--azul); color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
}
.botao:active { transform: scale(.98); }
.botao[disabled] { opacity: .4; }
.botao.claro { background: #fff; color: var(--azul); border: 2px solid var(--azul); }
.botao.vermelho { background: var(--vermelho); }
.botao.verde { background: var(--verde); }
.botao.pequeno { min-height: 44px; font-size: 16px; width: auto; padding: 8px 14px; }

.opcao {
  min-height: 56px; border: 2px solid var(--borda); border-radius: 14px; background: #fff;
  padding: 10px 14px; display: flex; justify-content: space-between; align-items: center;
  gap: 10px; width: 100%; text-align: left; font-weight: 600;
}
.opcao.marcada { border-color: var(--azul); background: var(--azul-claro); }
.opcao[disabled] { opacity: .45; }
.opcao .qtd { color: var(--fraco); font-weight: 400; }
.lista-opcoes { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1 1 0; min-height: 120px; padding-bottom: 4px; }
.lista-opcoes > * { flex-shrink: 0; }

.aviso { background: #fff4d6; border: 2px solid #f0c860; border-radius: 12px; padding: 10px 12px; font-size: 16px; }

/* Caderno pautado */
.caderno {
  background-image: repeating-linear-gradient(var(--papel) 0 calc(var(--linha) - 2px), var(--pauta) calc(var(--linha) - 2px) var(--linha));
  border-left: 3px solid #f2b8b8; padding-left: 12px; flex: 1;
}
.caderno .linha {
  height: var(--linha); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 26px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.caderno button.linha { width: 100%; background: none; border: 0; text-align: left; }
.caderno .num { color: var(--fraco); font-weight: 400; margin-right: 6px; }
.riscada { text-decoration: line-through; text-decoration-color: var(--vermelho); text-decoration-thickness: 3px; }
.certa-cor { color: var(--verde); }
.errada-cor { color: var(--vermelho); }
.corrigida { color: var(--vermelho); margin-left: 10px; }
.oculta { visibility: hidden; }

/* Ditar */
.alto-falante { font-size: 96px; text-align: center; line-height: 1.1; }
.barra { height: 16px; border-radius: 8px; background: #dfe7ef; overflow: hidden; }
.barra > i { display: block; height: 100%; background: #f0a030; width: 100%; transition: width .2s linear; }
.pontos { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pontos b { width: 14px; height: 14px; border-radius: 50%; background: #dfe7ef; }
.pontos b.feito { background: var(--azul); }
.pontos b.atual { background: #f0a030; }

.cartao-cheio {
  position: fixed; inset: 0; z-index: 30; background: rgba(255, 253, 245, .97);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center;
}
.cartao-cheio .grande { font-size: 26px; font-weight: 700; }

/* Foto */
.moldura {
  flex: 1; min-height: 200px; border: 3px dashed #9fb2c6; border-radius: 16px; background: #f3f6fa;
  display: flex; align-items: center; justify-content: center; text-align: center; color: var(--fraco); overflow: hidden;
}
.moldura img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lapis { font-size: 72px; display: inline-block; animation: escreve 1s ease-in-out infinite alternate; }
@keyframes escreve { from { transform: rotate(-12deg) translateX(-8px); } to { transform: rotate(8deg) translateX(8px); } }

/* Resultado */
.nota {
  border: 5px solid var(--vermelho); color: var(--vermelho); border-radius: 50%;
  width: 130px; height: 130px; display: flex; align-items: center; justify-content: center;
  font-size: 50px; font-weight: 700; transform: rotate(-8deg); margin: 6px auto;
}
.copia { border: 2px solid var(--borda); border-radius: 14px; background: #fff; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-size: 24px; font-weight: 700; letter-spacing: .04em; }
.caixas { display: flex; gap: 8px; }
.caixas button { width: 40px; height: 40px; border-radius: 8px; border: 3px solid var(--tinta); background: #fff; font-size: 24px; line-height: 1; color: var(--verde); font-weight: 700; }

.sobre-foto { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; align-items: center; justify-content: center; overflow: auto; }
.sobre-foto img { max-width: 100%; max-height: 100%; }
.sobre-foto.zoom img { max-width: none; max-height: none; width: 220%; }

/* Área do pai */
.pai { user-select: text; font-size: 16px; }
.abas { display: flex; gap: 6px; overflow-x: auto; }
.abas button { flex: 1; min-height: 44px; border-radius: 10px; border: 2px solid var(--borda); background: #fff; font-weight: 700; font-size: 14px; padding: 4px 8px; white-space: nowrap; }
.abas button.marcada { background: var(--azul); color: #fff; border-color: var(--azul); }
.bloco { border: 2px solid var(--borda); border-radius: 14px; background: #fff; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.campo input, .campo textarea, .campo select { border: 2px solid var(--borda); border-radius: 10px; padding: 10px; background: #fff; font-size: 17px; width: 100%; }
.campo textarea { min-height: 150px; }
.item-conf { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--borda); padding-top: 8px; }
.item-conf .cabeca { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item-conf .palavra { font-weight: 700; font-size: 20px; letter-spacing: .04em; }
.selo { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 10px; color: #fff; }
.selo.certa { background: var(--verde); } .selo.errada { background: var(--vermelho); } .selo.pendente { background: #c08a1a; }
.foto-conf { width: 100%; border-radius: 10px; border: 2px solid var(--borda); }
.senha-campo { font-size: 34px !important; text-align: center; letter-spacing: .4em; }
.versao { font-size: 12px; color: var(--fraco); text-align: center; }
