:root {
  --azul: #2BB8EE;
  --azul-escuro: #0A5C86;
  --azul-medio: #1289BE;
  --azul-suave: #E8F7FD;
  --azul-linha: #8ED8F5;
  --preto: #0E0E0E;
  --tinta: #161616;
  --mutado: #3D3D3D;
  --branco: #ffffff;
  --fonte: #4A4A4A;
  --linha: #D8EEF8;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-texto: "Literata", "Iowan Old Style", Georgia, serif;
  --font-ui: "Bricolage Grotesque", "Trebuchet MS", "Segoe UI", sans-serif;
  --pad: 22px;
  --max: 1080px;
  --qmax: 800px;
  --touch: 48px;
  --topo: 76px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  color: var(--preto);
  background: var(--branco);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 30;
  background: var(--preto);
  color: var(--branco);
  padding: 8px 14px;
}
.skip:focus { top: 12px; }

/* ——— Cabeçalho azul ——— */
.topo {
  background: var(--azul);
  color: var(--preto);
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--preto);
  padding-top: env(safe-area-inset-top);
}
.topo::before,
.topo::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 16px solid rgba(10, 92, 134, 0.16);
  pointer-events: none;
}
.topo::before {
  width: 260px;
  height: 260px;
  right: -70px;
  top: -140px;
}
.topo::after {
  width: 160px;
  height: 160px;
  right: 90px;
  bottom: -110px;
  border-width: 12px;
}
.topo-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px var(--pad);
  min-height: var(--topo);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}
body[data-view="viewer"] .topo-inner,
body[data-view="viewer"] .folha,
body[data-view="viewer"] .viewer {
  max-width: var(--qmax);
}
body[data-view="anos"] .topo-inner,
body[data-view="anos"] .folha { max-width: 960px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--preto);
  min-width: 0;
}
.mascote {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.06));
}
.nome {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: -0.05em;
  line-height: 1;
  padding-bottom: 2px;
}
.tag {
  margin-left: auto;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--preto);
  white-space: nowrap;
}
.topo-acoes {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ——— Botões ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 8px 16px;
  border: 2px solid var(--azul-escuro);
  background: var(--branco);
  color: var(--azul-escuro);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--azul-suave); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible,
select:focus-visible,
.num:focus-visible,
.item-vest:focus-visible,
.item-ano:focus-visible,
.brand:focus-visible {
  outline: 3px solid var(--preto);
  outline-offset: 2px;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--preto);
  font-weight: 700;
}
.btn-ghost:hover { background: rgba(14,14,14,0.06); border-color: transparent; }
.btn-azul {
  background: var(--azul-escuro);
  color: var(--branco);
  border-color: var(--azul-escuro);
}
.btn-azul:hover { background: #084866; border-color: #084866; color: var(--branco); }
.btn-gab.ligado {
  background: var(--azul-escuro);
  color: var(--branco);
  border-color: var(--azul-escuro);
}
.btn[disabled] { opacity: 0.35; cursor: default; pointer-events: none; }
.btn, .item-ano, .item-vest, .num { border-radius: 0; }

/* ——— Páginas ——— */
.folha {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--pad) 80px;
}
.voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--azul-escuro);
  font-weight: 700;
  text-decoration: none;
  margin: 0 0 22px;
  font-size: 15px;
}
.voltar:hover { color: var(--preto); text-decoration: underline; text-underline-offset: 3px; }

.estado {
  max-width: 520px;
  margin: 10vh auto;
  padding: 0 var(--pad);
  text-align: left;
  color: var(--tinta);
}
.estado h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 10px;
}

/* ——— Início ——— */
.hero { padding: 8px 0 36px; max-width: 26em; }
.hero .eyebrow {
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--azul-escuro);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  letter-spacing: -0.06em;
  line-height: 0.95;
  margin: 0 0 18px;
  color: var(--preto);
}
.hero p {
  margin: 0;
  font-family: var(--font-texto);
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--tinta);
  max-width: 24em;
}

.secao-provas { margin-top: 8px; }
.secao-provas .rotulo-sec {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--azul-escuro);
  margin: 0 0 0;
  padding: 0 0 10px;
  border-bottom: 3px solid var(--preto);
}

.lista-vest { display: flex; flex-direction: column; }
.item-vest {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 4px 22px 0;
  border-bottom: 2px solid var(--preto);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
.item-vest:hover { background: var(--azul-suave); }
.logo-vest {
  width: 132px;
  height: 76px;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
  display: block;
  background: var(--branco);
}
.item-vest .info { min-width: 0; flex: 1; }
.item-vest h2 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.item-vest .sub { margin: 0; color: var(--mutado); font-weight: 600; font-size: 15px; }
.item-vest .meta {
  margin: 8px 0 0;
  font-weight: 700;
  color: var(--azul-escuro);
  font-size: 15px;
}
.item-vest .ir {
  margin-left: auto;
  font-weight: 800;
  color: var(--preto);
  white-space: nowrap;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.item-vest:hover .ir { color: var(--azul-escuro); }

/* ——— Anos ——— */
.masthead {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 4px 0 20px;
  margin-bottom: 0;
  border-bottom: 0;
}
.masthead .logo-vest {
  width: 140px;
  height: 80px;
}
.masthead h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.95;
  margin: 0 0 6px;
}
.masthead p { margin: 0; font-weight: 600; color: var(--mutado); }

.grade-anos {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border-top: 3px solid var(--preto);
  border-left: 2px solid var(--preto);
  margin-top: 0;
}
.item-ano {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  min-height: 124px;
  padding: 16px 16px 14px;
  border-right: 2px solid var(--preto);
  border-bottom: 2px solid var(--preto);
  text-decoration: none;
  color: inherit;
  background: var(--branco);
  transition: background 0.15s ease, color 0.15s ease;
}
.item-ano:hover {
  background: var(--azul);
  color: var(--preto);
}
.item-ano .ano {
  font-family: var(--font-display);
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.9;
}
.item-ano .qtd { font-size: 13px; font-weight: 650; color: var(--azul-escuro); }
.item-ano:hover .qtd { color: var(--preto); }

/* ——— Visualizador ——— */
.viewer { max-width: var(--qmax); margin: 0 auto; padding: 18px var(--pad) 72px; }
.ctx {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  min-width: 0;
}
.ctx .logo-mini {
  width: 72px;
  height: 40px;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
}
.ctx .ctx-txt { min-width: 0; }
.ctx .ctx-nome {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.ctx .ctx-ano { color: var(--azul-escuro); font-weight: 700; font-size: 14px; }

.viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 0 0 12px;
}
.viewer-toolbar .filtro {
  min-height: var(--touch);
  padding: 0 12px;
  border: 2px solid var(--preto);
  background: var(--branco);
  min-width: min(100%, 220px);
  flex: 1 1 200px;
  max-width: 300px;
  font-weight: 600;
  border-radius: 0;
}
.nav-q {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}
.nav-q .btn { white-space: nowrap; }
.nav-q .pos {
  font-size: 14px;
  font-weight: 700;
  color: var(--tinta);
  min-width: 8em;
  text-align: center;
}

.nums-wrap { margin: 0 0 20px; }
.nums-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.nums-cab .rot {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--azul-escuro);
}
.nums {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 0;
  border-top: 2px solid var(--preto);
  border-left: 2px solid var(--preto);
}
.num {
  appearance: none;
  border: 0;
  border-right: 2px solid var(--preto);
  border-bottom: 2px solid var(--preto);
  background: var(--branco);
  color: var(--preto);
  min-width: 0;
  height: 40px;
  padding: 0;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.03em;
  line-height: 1;
  font-family: var(--font-display);
}
.num:hover { background: var(--azul-suave); }
.num.ativo {
  background: var(--azul-escuro);
  color: var(--branco);
}

/* ——— Questão ——— */
.q { padding: 6px 0 8px; overflow-wrap: break-word; }
.q-cab {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--preto);
}
.q-num {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.q-num .placa {
  display: grid;
  place-items: center;
  min-width: 64px;
  height: 64px;
  padding: 0 10px;
  background: var(--azul);
  color: var(--preto);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.85rem;
  letter-spacing: -0.05em;
  line-height: 1;
  border: 3px solid var(--preto);
}
.q-cab h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 0;
  color: var(--azul-escuro);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--azul);
}
.chip.inter {
  color: var(--mutado);
  border-bottom-color: var(--preto);
  font-weight: 700;
}

.secao { margin-top: 22px; }
.secao:first-of-type { margin-top: 0; }
.rotulo {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--azul-escuro);
  margin: 0 0 8px;
}

.texto {
  font-family: var(--font-texto);
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--tinta);
}
.texto p { margin: 0 0 0.85em; }
.texto p:last-child { margin-bottom: 0; }
.texto p.verso { text-align: left; }
.texto p.disp { text-align: center; margin: 0.7em 0 1em; }
.texto.enun { font-weight: 600; font-size: 1.16rem; }

.fonte {
  font-family: var(--font-ui);
  font-size: 0.84rem;
  font-style: italic;
  font-weight: 500;
  color: var(--fonte);
  line-height: 1.45;
  margin: 0;
}

img.fig {
  display: block;
  max-width: 100%;
  max-height: min(520px, 62vh);
  width: auto;
  margin: 12px auto;
  border: 2px solid var(--preto);
  background: #fff;
  cursor: zoom-in;
}
img.formula {
  display: inline;
  vertical-align: middle;
  width: auto;
  max-width: 100%;
  margin: 0 0.08em;
  background: transparent;
  cursor: default;
}

.alts { display: flex; flex-direction: column; gap: 8px; }
.alt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 12px 12px 10px;
  border: 2px solid #cfeaf6;
  background: var(--branco);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.alt .letra {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--azul-suave);
  color: var(--azul-escuro);
  font-weight: 800;
  font-size: 15px;
  text-transform: uppercase;
  font-family: var(--font-display);
  border: 2px solid var(--azul-escuro);
}
.alt .conteudo { flex: 1; min-width: 0; padding-top: 6px; }
.alt .tx {
  font-family: var(--font-texto);
  font-size: 1.06rem;
  line-height: 1.55;
  color: var(--tinta);
}
.alt .moldura {
  margin-top: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--linha);
}
.alt .moldura img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  cursor: zoom-in;
  margin: 0 auto;
}
.alt.so-form .tx { font-size: 1.2rem; }
.alt .selo {
  display: none;
  margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--azul-escuro);
}

body.revelado .alt.correta {
  border-color: var(--azul-escuro);
  background: var(--azul-suave);
}
body.revelado .alt.correta .letra {
  background: var(--azul-escuro);
  color: var(--branco);
  border-color: var(--azul-escuro);
}
body.revelado .alt.correta .selo { display: inline-block; }

#zoom {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 28, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  cursor: zoom-out;
  padding: 16px;
}
#zoom.aberto { display: flex; }
#zoom img {
  max-width: 94vw;
  max-height: 94vh;
  background: #fff;
}

.link-pdf-mob { display: none; }
.btn-nums { display: none; }

@keyframes entrar {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
.entra { animation: entrar 0.28s ease; }

/* ——— Responsivo ——— */
@media (max-width: 819px) {
  :root { --pad: 16px; --topo: 64px; }
  .mascote { width: 44px; height: 44px; }
  .nome { font-size: 1.45rem; }
  .tag { display: none; }
  .topo::before { width: 180px; height: 180px; }
  .topo::after { display: none; }

  .folha { padding: 18px var(--pad) 64px; }
  .hero { padding-bottom: 28px; }
  .hero p { font-size: 1.05rem; }

  .item-vest { gap: 14px; padding: 16px 0; }
  .logo-vest { width: 92px; height: 56px; }
  .item-vest h2 { font-size: 1.45rem; }
  .item-vest .ir { display: none; }

  .masthead { gap: 14px; }
  .masthead .logo-vest { width: 100px; height: 58px; }

  .grade-anos { grid-template-columns: repeat(2, 1fr); }
  .item-ano { min-height: 100px; padding: 14px; }
  .item-ano .ano { font-size: 1.85rem; }

  .viewer { padding-bottom: 48px; }
  .q-num .placa { min-width: 54px; height: 54px; font-size: 1.5rem; }
  .q-cab h1 { font-size: 1.3rem; }
  .texto { font-size: 1.05rem; text-align: left; }
  .texto.enun { font-size: 1.08rem; }
  img.fig { max-height: min(300px, 42vh); }

  .nums:not(.aberto) {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0;
    border-right: 2px solid var(--preto);
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .nums:not(.aberto) .num {
    flex: 0 0 44px;
    height: 44px;
    scroll-snap-align: center;
  }
  .btn-nums { display: inline-flex; min-height: 40px; padding: 6px 10px; font-size: 13px; }
  .link-pdf-mob { display: inline-flex; min-height: 40px; padding: 6px 10px; font-size: 13px; }

  .viewer-toolbar { flex-direction: column; align-items: stretch; }
  .viewer-toolbar .filtro { max-width: none; width: 100%; flex: 1 1 auto; }
  .viewer-toolbar .nav-q { width: 100%; }
  .viewer-toolbar .nav-q .btn { flex: 1; }
  .viewer-toolbar .nav-q .pos { min-width: 0; flex: 0 0 auto; padding: 0 4px; font-size: 13px; }

  .topo-inner { padding: 8px var(--pad); gap: 10px; }
  .topo .btn-pdf { display: none; }
  .topo .btn-gab { padding: 8px 12px; font-size: 13.5px; }
}

@media (min-width: 820px) {
  .texto { text-align: justify; hyphens: auto; }
  .hero { padding-top: 18px; padding-bottom: 48px; }
  .nums { grid-template-columns: repeat(12, 1fr); }
}

@media (max-width: 420px) {
  .item-vest { align-items: flex-start; }
}

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