@font-face {
  font-family: "Atkinson";
  src: url("/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --papel: #f4f6f3;
  --grade: #dfe5df;
  --tinta: #1d2b53;
  --grafite: #59606b;
  --marca: #f1e05a;
  --correcao: #b4401a;
  --folha: #ffffff;
  --linha: #c9d1cb;
  --medida: 40rem;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papel: #151b26;
    --grade: #1e2533;
    --tinta: #e6ebf5;
    --grafite: #a3abb8;
    --marca: #e4d04a;
    --correcao: #f08a5d;
    --linha: #343d4e;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 1.0625rem/1.55 "Atkinson", system-ui, sans-serif;
  color: var(--tinta);
  background-color: var(--papel);
  background-image:
    linear-gradient(var(--grade) 1px, transparent 1px),
    linear-gradient(90deg, var(--grade) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
[hidden] { display: none !important; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tinta); outline-offset: 3px; box-shadow: 0 0 0 7px var(--marca); border-radius: 2px; }

.pular { position: absolute; left: -999px; top: 8px; background: var(--folha); color: #1d2b53; padding: 8px 12px; z-index: 10; }
.pular:focus { left: 8px; }

/* ---------- estrutura */
.topo, main, .rodape { width: 100%; max-width: calc(var(--medida) + 2rem); margin: 0 auto; padding: 0 1rem; }
.topo { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: 1.25rem; padding-bottom: 1.25rem; flex-wrap: wrap; }
.marca { font-weight: 700; font-size: 1.25rem; text-decoration: none; letter-spacing: -0.01em; }
.marca span { color: var(--grafite); font-weight: 400; }
.topo nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
main { flex: 1; padding-bottom: 3rem; outline: none; }
.rodape { color: var(--grafite); font-size: 0.875rem; padding-top: 1.5rem; padding-bottom: 2rem; border-top: 1px solid var(--linha); }

/* ---------- tipografia */
h1 { font-size: clamp(1.9rem, 5.5vw, 2.75rem); line-height: 1.12; letter-spacing: -0.02em; margin: 1.5rem 0 1rem; font-weight: 700; max-width: 18ch; }
h2 { font-size: 1.125rem; line-height: 1.3; margin: 2rem 0 0.5rem; }
p { margin: 0 0 1rem; }
.lead { font-size: 1.2rem; color: var(--grafite); max-width: 34rem; }
.nota { color: var(--grafite); font-size: 0.95rem; }
.texto-longo { max-width: 38rem; }
.texto-longo li { margin-bottom: 0.5rem; }

/* ---------- botões */
.botao {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0.75rem 1.5rem;
  font: inherit; font-weight: 700; font-size: 1.05rem;
  color: var(--papel); background: var(--tinta);
  border: 2px solid var(--tinta); border-radius: var(--r);
  text-decoration: none; cursor: pointer;
}
.botao:hover { background: color-mix(in srgb, var(--tinta) 88%, var(--papel)); }
.botao:disabled { opacity: 0.4; cursor: not-allowed; }
.botao-secundario { background: transparent; color: var(--tinta); }
.botao-secundario:hover { background: var(--folha); color: #1d2b53; }
.acoes { display: flex; align-items: center; gap: 1rem 1.5rem; flex-wrap: wrap; margin: 1.75rem 0; }

/* ---------- grades de figuras (matriz, opções) */
.grade { display: grid; gap: 6px; }
.grade-1 { grid-template-columns: minmax(0, 11rem); }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 7.5rem)); }
.grade-3 { grid-template-columns: repeat(3, minmax(0, 7.5rem)); }
.grade-4 { grid-template-columns: repeat(4, minmax(0, 6.5rem)); }
.celula {
  aspect-ratio: 1; background: var(--folha);
  border: 1px solid var(--linha); border-radius: 3px;
  display: grid; place-items: center; overflow: hidden;
}
.celula svg { width: 100%; height: 100%; display: block; }
.celula-alvo { border: 2px dashed var(--tinta); background: transparent; font-size: 2rem; font-weight: 700; }
.celula-modelo { position: relative; }
.rotulo { font-size: 0.85rem; color: var(--grafite); margin-top: 0.35rem; }

.sequencia { display: flex; flex-wrap: wrap; gap: 6px; }
.sequencia .celula { width: 3.75rem; font-size: 1.35rem; font-weight: 700; color: #1d2b53; }
.sequencia .celula-alvo { color: var(--tinta); }

/* ---------- amostra na página inicial */
.amostra { margin: 2rem 0 0; padding: 1.25rem; background: color-mix(in srgb, var(--folha) 70%, transparent); border: 1px solid var(--linha); border-radius: var(--r); }
.amostra figcaption { font-weight: 700; margin-bottom: 1rem; }
.amostra-corpo { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; }
.amostra .grade-3 { grid-template-columns: repeat(3, 4.75rem); }
.amostra-opcoes { display: grid; grid-template-columns: repeat(2, 4.75rem); gap: 6px; }
.amostra-retorno { margin: 1rem 0 0; min-height: 1.55em; }

/* ---------- alternativas */
.opcoes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 30rem; margin-top: 1.5rem; }
.opcoes.quatro { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 30rem; }
.opcao {
  position: relative; padding: 0; font: inherit; color: inherit;
  background: var(--folha); border: 2px solid var(--linha); border-radius: var(--r);
  aspect-ratio: 1; cursor: pointer; display: grid; place-items: center; overflow: hidden;
}
.opcao svg { width: 100%; height: 100%; display: block; }
.opcao .texto-opcao { font-size: 1.5rem; font-weight: 700; color: #1d2b53; }
.opcao .letra { position: absolute; top: 4px; left: 6px; font-size: 0.8rem; font-weight: 700; color: #59606b; }
.opcao:hover { border-color: #7d8798; }
.opcao[aria-checked="true"] { border-color: var(--tinta); box-shadow: 0 0 0 4px var(--marca); }
.amostra .opcao[aria-checked="true"].certa { box-shadow: 0 0 0 4px #9ad08f; }

/* ---------- tela do teste */
.progresso { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0 1.25rem; }
.contador { margin: 0; font-weight: 700; white-space: nowrap; }
.barra { flex: 1; height: 6px; background: var(--linha); border-radius: 3px; overflow: hidden; }
.barra-preenchida { height: 100%; width: 0; background: var(--tinta); transition: width 0.3s ease; }
.enunciado { font-size: 1.15rem; font-weight: 700; max-width: 36rem; }
.problema { margin: 1.25rem 0 0; }
.rodape-questao { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; max-width: 30rem; }
.dica { margin: 0; font-size: 0.9rem; color: var(--grafite); }
.tela-teste.carregando .problema, .tela-teste.carregando .opcoes { opacity: 0.35; transition: opacity 0.15s; }

/* ---------- formulários */
fieldset { border: 1px solid var(--linha); border-radius: var(--r); padding: 1rem 1.25rem 1.25rem; margin: 1.5rem 0; background: color-mix(in srgb, var(--folha) 60%, transparent); }
legend { font-weight: 700; padding: 0 0.35rem; }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.campos label { display: grid; gap: 0.35rem; font-size: 0.95rem; }
select { font: inherit; min-height: 2.75rem; padding: 0.4rem 0.6rem; border: 1px solid var(--grafite); border-radius: 4px; background: var(--folha); color: #1d2b53; }
.check { display: flex; gap: 0.75rem; align-items: flex-start; margin: 0.9rem 0; max-width: 36rem; }
.check input { width: 1.3rem; height: 1.3rem; margin-top: 0.15rem; flex: none; accent-color: var(--tinta); }
.regras { padding-left: 1.2rem; max-width: 36rem; }
.regras li { margin-bottom: 0.5rem; }
.erro { color: var(--correcao); font-weight: 700; min-height: 1.5em; margin: 0.75rem 0; }
.erro:empty { min-height: 0; margin: 0; }

/* ---------- página inicial */
.fatos { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1.5rem; margin-top: 1rem; }
.fatos h2 { margin-top: 1.25rem; }
.fatos p { color: var(--grafite); font-size: 0.975rem; }
.aviso { margin-top: 2rem; padding: 1rem 1.25rem; border-left: 4px solid var(--tinta); background: color-mix(in srgb, var(--folha) 75%, transparent); max-width: 38rem; }
.aviso h2 { margin-top: 0.25rem; }
.aviso p:last-child { margin-bottom: 0.25rem; }
.alerta { border-left-color: var(--correcao); }

/* ---------- resultado */
.placar { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.placar-numero { font-size: clamp(4.5rem, 16vw, 7rem); line-height: 1; font-weight: 700; letter-spacing: -0.04em; margin: 0; }
.placar-texto { font-size: 1.15rem; max-width: 24rem; margin: 0; }
.curva { margin: 1.5rem 0 0; max-width: 38rem; }
.curva svg { width: 100%; height: auto; display: block; }
.curva figcaption { font-size: 0.9rem; color: var(--grafite); margin-top: 0.35rem; }
.curva .eixo { stroke: var(--grafite); stroke-width: 1; }
.curva .forma { fill: color-mix(in srgb, var(--tinta) 8%, transparent); stroke: var(--tinta); stroke-width: 2; }
.curva .faixa { fill: var(--marca); opacity: 0.75; }
.curva .marcador { stroke: var(--tinta); stroke-width: 3; }
.curva text { fill: var(--grafite); font: 400 13px "Atkinson", sans-serif; }
.curva .rotulo-qi { fill: var(--tinta); font-weight: 700; }
.areas { width: 100%; max-width: 38rem; border-collapse: collapse; margin: 0.5rem 0 1rem; font-size: 0.975rem; }
.areas th, .areas td { text-align: left; padding: 0.55rem 0.5rem 0.55rem 0; border-bottom: 1px solid var(--linha); vertical-align: middle; }
.areas th { font-weight: 700; color: var(--grafite); font-size: 0.875rem; }
.pontos { display: inline-flex; gap: 3px; margin-right: 0.5rem; vertical-align: middle; }
.pontos i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--tinta); }
.pontos i.ok { background: var(--tinta); }

@media (max-width: 30rem) {
  .grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grade-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .opcoes.quatro { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 20rem; }
  .botao { width: 100%; }
  .rodape-questao .botao { width: 100%; }
  .acoes .nota { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- ajustes */
[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.opcoes { max-width: 24rem; }
.opcoes.quatro { max-width: 32rem; }
.opcoes.textual { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 28rem; }
.opcoes.textual .opcao { aspect-ratio: auto; min-height: 4.25rem; }
.sequencia { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 3.75rem); flex-wrap: nowrap; }
.sequencia .celula { width: auto; font-size: clamp(1rem, 4.2vw, 1.35rem); }
@media (max-width: 30rem) {
  .opcoes.textual { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
}

.beta { font-size: 0.7rem; font-weight: 700; background: var(--marca); color: #1d2b53; padding: 0.1rem 0.4rem; border-radius: 3px; vertical-align: 0.25em; letter-spacing: 0; }
