/* Tópicos de Matemática Elementar I e II. Folha de estilos comum aos dois websites.
   Parte da de Álgebra Linear (mesma paleta, letra e componentes). */

/* Fórmulas como na sebenta: símbolos em Fira Math (só os glifos usados, licença OFL),
   letras e algarismos em Futura Medium, ou Jost onde a Futura não está instalada. */
@font-face {
  font-family: "Fira Math TME";
  src: url(fira-math-tme.woff) format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0028-0029, U+002B, U+002C, U+002E, U+002F, U+003C-003E, U+005B-005D, U+007B-007D,
    U+00B0, U+00B1, U+00B7, U+00D7, U+00F7, U+0394, U+03A3, U+03B1-03C9, U+2026, U+2032, U+2115,
    U+211A, U+211D, U+2124, U+2192, U+21D2, U+21D4, U+2205, U+2208, U+2209, U+2211, U+2212,
    U+221A, U+221E, U+2227-222A, U+2248, U+2260, U+2264, U+2265, U+2282, U+22C5, U+22EF, U+27FA;
}

/* Layout: página única com cabeçalho fixo. O topo repete a capa da sebenta (filetes,
   título a negrito em azul-mar) e cada secção abre como os slides (título, subtítulo, filete). */
:root {
  /* Paleta dos slides e das animações (determinantes.py) */
  --fundo: #EBF1F4;
  --fundo-2: #E1E9EE;
  --papel: #FFFFFF;
  --tinta: #1A1A1A;
  --tinta-2: #3D4A52;
  --morto: #57646C;
  --mar: #1F4E6B;
  --mar-forte: #163A50;
  --alerta: #9B3B1F;
  --mata: #4A7C59;
  --realce: #D6E6EF;
  --realce-b: #F7DFD4;
  --linha: #D2DDE4;
  --filete: rgb(31 78 107 / 0.4);
  --sobre-cor: #FFFFFF;
  --vidro: rgb(255 255 255 / 0.86);
  --sombra: 0 1px 2px rgb(22 36 46 / 0.06), 0 14px 32px -16px rgb(22 36 46 / 0.32);
  --sombra-leve: 0 1px 2px rgb(22 36 46 / 0.05), 0 6px 18px -10px rgb(22 36 46 / 0.22);
  --fundo-video: #FFFFFF;
  --mata-suave: #E3EFE6;
  --alerta-suave: #F7E3DC;
  --roxo: #6A4C9C;
  --claro: block;
  --escuro: none;

  /* Futura nos materiais; a Jost é a versão livre mais próxima */
  --f-texto: "Jost", Futura, "Futura PT", "Century Gothic", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-mat: "Fira Math TME", Futura, "Futura PT", "Jost", "Century Gothic", "Avenir Next", sans-serif;
  --t-0: 0.8125rem;
  --t-1: 0.9375rem;
  --t-2: 1.0625rem;
  --t-3: 1.3125rem;
  --t-4: clamp(1.75rem, 1.2rem + 1.8vw, 2.375rem);
  --t-5: clamp(2.9rem, 1.4rem + 5.6vw, 5.25rem);

  --raio: 10px;
  --largura: 1160px;
  --margem: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #0E1920;
    --fundo-2: #0A1319;
    --papel: #1A2A35;
    --tinta: #EFEEE8;
    --tinta-2: #C6CFD3;
    --morto: #93A3AC;
    --mar: #7CC0E2;
    --mar-forte: #A3D4EC;
    --alerta: #EB9070;
    --mata: #7CC79A;
    --realce: #2C5162;
    --realce-b: #6E4032;
    --linha: #283A46;
    --filete: rgb(124 192 226 / 0.4);
    --sobre-cor: #16242E;
    --vidro: rgb(26 42 53 / 0.86);
    --sombra: 0 1px 2px rgb(0 0 0 / 0.35), 0 14px 32px -14px rgb(0 0 0 / 0.7);
    --sombra-leve: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 20px -10px rgb(0 0 0 / 0.6);
    --fundo-video: #16242E;
    --mata-suave: #1E3529;
    --alerta-suave: #3C2520;
    --roxo: #B6A4E8;
    --claro: none;
    --escuro: block;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --fundo: #0E1920;
  --fundo-2: #0A1319;
  --papel: #1A2A35;
  --tinta: #EFEEE8;
  --tinta-2: #C6CFD3;
  --morto: #93A3AC;
  --mar: #7CC0E2;
  --mar-forte: #A3D4EC;
  --alerta: #EB9070;
  --mata: #7CC79A;
  --realce: #2C5162;
  --realce-b: #6E4032;
  --linha: #283A46;
  --filete: rgb(124 192 226 / 0.4);
  --sobre-cor: #16242E;
  --vidro: rgb(26 42 53 / 0.86);
  --sombra: 0 1px 2px rgb(0 0 0 / 0.35), 0 14px 32px -14px rgb(0 0 0 / 0.7);
  --sombra-leve: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 20px -10px rgb(0 0 0 / 0.6);
  --fundo-video: #16242E;
  --mata-suave: #1E3529;
  --alerta-suave: #3C2520;
  --roxo: #B6A4E8;
  --claro: none;
  --escuro: block;
  color-scheme: dark;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--tinta);
  font-family: var(--f-texto);
  font-size: var(--t-2);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main { overflow-x: clip; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; text-wrap: balance; }
p { margin: 0; }
a { color: var(--mar); text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
i.var { font-style: italic; }

.limpo {
  appearance: none; background: none; border: 0; margin: 0; padding: 0;
  font: inherit; color: inherit; text-align: inherit; cursor: pointer;
}
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.icone {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.so-claro { display: var(--claro); }
.so-escuro { display: var(--escuro); }

.contentor { max-width: var(--largura); margin-inline: auto; padding-inline: var(--margem); }

.saltar {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--mar); color: var(--sobre-cor); padding: 10px 16px; border-radius: 8px;
  font-weight: 600; text-decoration: none;
}
.saltar:focus { top: 12px; }

/* ── Cabeçalho fixo ── */
.topo {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--vidro);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--linha);
}
.topo-in { display: flex; align-items: center; gap: 8px 20px; min-height: 64px; }
.marca {
  display: flex; align-items: center; gap: 10px; flex: none;
  font-weight: 700; font-size: 1.1875rem; color: var(--mar); text-decoration: none;
}
.marca svg { width: 32px; height: 32px; }
.marca-curta { display: none; }
@media (max-width: 1020px) {
  .topo .marca-longa { display: none; }
  .topo .marca-curta { display: inline; }
}
.logo-area { fill: var(--realce); }
.logo-tracos { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.logo-u { stroke: var(--mar); }
.logo-v { stroke: var(--alerta); }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 13px; border-radius: 999px; white-space: nowrap;
  color: var(--tinta-2); text-decoration: none; font-weight: 500; font-size: var(--t-1);
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { color: var(--mar); background: var(--realce); }
.nav a[aria-current="true"] { color: var(--mar); background: var(--realce); }
.icone-botao {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--linha); background: var(--papel); color: var(--tinta-2);
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.icone-botao:hover:not(:disabled) { border-color: var(--mar); color: var(--mar); }
.icone-botao:disabled { opacity: 0.35; cursor: default; }
.icone-botao .icone { width: 20px; height: 20px; }

@media (max-width: 760px) {
  .topo-in { flex-wrap: wrap; padding-block: 8px 0; }
  .topo-in .icone-botao { margin-left: auto; }
  .nav { order: 3; width: 100%; margin-left: 0; padding-bottom: 8px; }
}

/* ── Abertura: a capa ── */
.abertura { padding-block: clamp(36px, 6vw, 76px) clamp(16px, 3vw, 36px); }
.abertura .contentor {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 68px); align-items: center;
}
@media (max-width: 900px) { .abertura .contentor { grid-template-columns: minmax(0, 1fr); } }
.capa { border-block: 2px solid var(--filete); padding-block: 20px 22px; margin-block: 0 24px; }
.capa h1 { font-size: clamp(2.35rem, 1.1rem + 4.3vw, 4.25rem); color: var(--mar); line-height: 1.02; letter-spacing: -0.012em; }
.capa-sub {
  margin-top: 12px; padding-left: 0.18em;
  font-size: clamp(1.15rem, 0.95rem + 0.8vw, 1.55rem); font-weight: 400; color: var(--tinta-2);
}
.entrada { font-size: 1.1875rem; line-height: 1.55; color: var(--tinta-2); max-width: 40ch; }
.atalhos {
  list-style: none; margin: 28px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr)); gap: 10px; max-width: 560px;
}
.atalhos a {
  display: flex; align-items: center; gap: 12px; height: 100%;
  padding: 12px 14px; border: 1px solid var(--linha); border-radius: var(--raio);
  background: var(--papel); color: var(--tinta); text-decoration: none; box-shadow: var(--sombra-leve);
  transition: border-color 0.15s, transform 0.15s;
}
.atalhos a:hover { border-color: var(--mar); transform: translateY(-1px); }
.atalhos .icone { width: 28px; height: 28px; color: var(--mar); stroke-width: 1.6; }
.atalhos strong { display: block; font-weight: 600; line-height: 1.25; }
.atalhos small { display: block; font-size: var(--t-0); color: var(--morto); line-height: 1.35; }

/* ── Figura: transformação linear do plano ── */
.figura { margin: 0; min-width: 0; }
.figura-tela {
  position: relative; width: 100%; max-width: 100%; aspect-ratio: 54 / 46;
  border: 1px solid var(--linha); border-radius: 14px; background: var(--papel); overflow: hidden;
  box-shadow: var(--sombra-leve);
}
.figura canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.figura-pausa { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; }
.figura-pausa .icone { width: 16px; height: 16px; }
.leitura {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px 4px 0; font-size: 1.25rem; font-variant-numeric: tabular-nums;
}
/* As duas equações na mesma linha; cada parte é centrada na vertical, e o resultado fica à altura dos sinais de igual */
.equacoes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 30px; }
.eq { display: flex; align-items: center; gap: 10px; }
.equacoes output { min-width: 3ch; font-weight: 600; color: var(--mata); }
.leitura-nota { font-size: var(--t-1); color: var(--morto); min-height: 1.6em; }
.leitura { min-height: 8.4rem; }
.leitura .resultado { gap: 14px; flex-wrap: wrap; }
.leitura output.classe { min-width: 0; font-size: 0.8em; font-family: var(--f-texto, inherit); }
.leitura .m .c-a, .leitura .m .c-b, .leitura .m .c-v { font-weight: 600; }
/* Escolha da animação: um ponto por animação, no fundo da figura */
.figura canvas { transition: opacity 0.18s ease; }
.figura canvas.a-trocar { opacity: 0; }
.figura-cenas {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: flex; gap: 2px; padding: 2px 6px; border-radius: 999px;
  background: var(--vidro); border: 1px solid var(--linha);
}
.figura-cena { position: relative; width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; transition: width 0.2s; }
.figura-cena::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 999px;
  transform: translate(-50%, -50%); background: var(--morto); opacity: 0.5;
  transition: width 0.2s, opacity 0.2s, background-color 0.2s;
}
.figura-cena:hover::before { opacity: 0.85; }
.figura-cena[aria-pressed="true"] { width: 32px; }
.figura-cena[aria-pressed="true"]::before { width: 22px; background: var(--mar); opacity: 1; }
.figura-cena:focus-visible { outline: 2px solid var(--mar); outline-offset: 1px; border-radius: 999px; }

/* ── Secções ── */
.seccao { padding-block: clamp(52px, 7vw, 92px); }
.faixa { background: var(--fundo-2); border-block: 1px solid var(--linha); }
.cabecalho {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 16px; margin-bottom: clamp(26px, 4vw, 42px);
  border-bottom: 2px solid var(--filete);
}
.cab-icone {
  display: grid; place-items: center; flex: none;
  width: 52px; height: 52px; border-radius: 14px; background: var(--realce); color: var(--mar);
}
.cab-icone .icone { width: 28px; height: 28px; stroke-width: 1.6; }
.cabecalho h2 { font-size: var(--t-4); color: var(--mar); }
.cabecalho p { margin-top: 4px; font-size: var(--t-1); color: var(--morto); }

.rotulo {
  font-size: var(--t-0); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--morto);
}

/* Botões */
.botao {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--mar);
  background: var(--papel); color: var(--mar); cursor: pointer;
  font-size: var(--t-1); font-weight: 600; line-height: 1.2; text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.botao:hover { background: var(--realce); }
.botao .icone { width: 18px; height: 18px; }
.botao-cheio { background: var(--mar); color: var(--sobre-cor); }
.botao-cheio:hover { background: var(--mar-forte); border-color: var(--mar-forte); }
.botao:disabled { opacity: 0.45; pointer-events: none; }

/* Descarga dos PDF: rótulo e um botão por versão, com amostra da cor de fundo */
.descarregar { display: flex; flex-direction: column; gap: 10px; }
.descarregar-botoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; max-width: 400px; }
.descarregar .botao { justify-content: center; }
.amostra {
  width: 13px; height: 13px; border-radius: 3px; flex: none; margin-left: 2px;
  box-shadow: inset 0 0 0 1px rgb(120 135 145 / 0.6);
}
.amostra-claro { background: #FFFFFF; }
.amostra-escuro { background: #16242E; }

/* Indicação de que a capa abre o documento, só ao passar o rato ou com foco */
.abrir-selo {
  position: absolute; left: 50%; top: 50%; z-index: 1; pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px;
  background: var(--mar); color: var(--sobre-cor); font-size: var(--t-1); font-weight: 600;
  box-shadow: var(--sombra); opacity: 0; transform: translate(-50%, -40%);
  transition: opacity 0.2s, transform 0.2s;
}
.abrir-selo .icone { width: 18px; height: 18px; }
:is(.pilha, .deck-capa):is(:hover, :focus-visible) .abrir-selo { opacity: 1; transform: translate(-50%, -50%); }

/* ── Documentos (sebenta e fichas) ── */
.doc { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
@media (max-width: 780px) { .doc { grid-template-columns: minmax(0, 1fr); } }
.doc-lado { display: flex; flex-direction: column; gap: 30px; }
.pilha { position: relative; display: block; width: min(100% - 56px, 250px); aspect-ratio: 560 / 792; margin: 6px 0 4px 6px; }
.pilha img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  border-radius: 3px; border: 1px solid var(--linha); box-shadow: var(--sombra); background: var(--papel);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.pilha .tras { transform: translate(42px, 10px) rotate(5.5deg); }
.pilha .frente { transform: rotate(-1.5deg); }
.pilha:hover .tras, .pilha:focus-visible .tras { transform: translate(52px, 2px) rotate(8deg); }
.pilha:hover .frente, .pilha:focus-visible .frente { transform: translate(-4px, -4px) rotate(-2.5deg); }

/* Índice num painel, para se destacar do fundo */
.doc-painel {
  min-width: 0; padding: 20px 24px 22px; border-radius: 14px;
  background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra-leve);
}
.doc-painel .indice > li:last-child { border-bottom: 0; }
@media (max-width: 520px) { .doc-painel { padding: 14px 14px 16px; } }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 14px; color: var(--morto); font-size: var(--t-1); }
.doc-meta b { color: var(--tinta); font-weight: 600; }
.doc-nota { margin-top: 18px; font-size: var(--t-1); color: var(--morto); max-width: 62ch; }

.indice { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--linha); }
.indice > li { border-bottom: 1px solid var(--linha); }
.item-linha {
  display: grid; grid-template-columns: 5.2em minmax(0, 1fr) auto 36px;
  align-items: center; gap: 4px 16px; padding: 12px 0;
}
.codigo {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 4px 8px; border-radius: 6px; background: var(--realce); color: var(--mar);
  font-size: var(--t-0); font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.codigo .icone { width: 15px; height: 15px; stroke-width: 2; }
.item-prep .codigo { background: var(--realce-b); color: var(--alerta); }
.item-abrir { display: block; min-width: 0; padding: 4px 0; }
.item-titulo { display: block; font-weight: 500; line-height: 1.35; }
.item-abrir:hover .item-titulo { color: var(--mar); text-decoration: underline; text-decoration-thickness: 1px; }
.item-extra { display: block; margin-top: 2px; font-size: var(--t-0); color: var(--morto); }
.pag { color: var(--morto); font-size: var(--t-1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-mais {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; color: var(--morto);
}
.item-mais:hover { background: var(--realce); color: var(--mar); }
.item-mais .icone { width: 18px; height: 18px; transition: transform 0.2s; }
.item-mais[aria-expanded="true"] .icone { transform: rotate(180deg); }
.sub { list-style: none; margin: 0 0 14px calc(5.2em + 16px); padding: 0; }
.sub button {
  display: flex; justify-content: space-between; gap: 16px; width: 100%;
  padding: 5px 0; font-size: var(--t-1); color: var(--tinta-2); border-bottom: 1px dotted var(--linha);
}
.sub button:hover span:first-child { color: var(--mar); text-decoration: underline; }
.sub .pag { font-size: var(--t-0); }
@media (max-width: 520px) {
  .item-linha { grid-template-columns: auto minmax(0, 1fr) 36px; }
  .item-linha .pag { display: none; }
  .sub { margin-left: 0; }
}

/* ── Slides ── */
.decks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 40px 36px; }
.deck { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.deck-capa {
  position: relative; display: block; width: 100%; max-width: 100%; aspect-ratio: 16 / 9;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--linha); box-shadow: var(--sombra);
  background: var(--papel);
}
.deck-capa img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.deck-capa:hover img { transform: scale(1.025); }
.selo {
  position: absolute; right: 10px; bottom: 10px; padding: 3px 10px; border-radius: 999px;
  background: var(--vidro); color: var(--tinta-2); font-size: var(--t-0); font-weight: 500;
  border: 1px solid var(--linha);
}
.deck-corpo { display: flex; flex-direction: column; gap: 12px; }
.deck h3 { font-size: var(--t-3); }

/* ── Vídeos ── */
.serie + .serie { margin-top: 56px; }
.serie-cab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-bottom: 22px; }
.serie-cab h3 { font-size: var(--t-3); }
.serie-cab p { color: var(--morto); font-size: var(--t-1); }
.videos {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 28px 22px;
}
.video { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.video-poster {
  position: relative; display: block; width: 100%; max-width: 100%; aspect-ratio: 16 / 9;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--linha); background: var(--papel);
  box-shadow: var(--sombra-leve);
}
.video-poster img { width: 100%; height: 100%; object-fit: cover; }
.video-play { position: absolute; left: 8px; bottom: 8px; }
.video-play span {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--mar); color: var(--sobre-cor); box-shadow: var(--sombra);
  transition: transform 0.2s;
}
.video-play .icone { width: 14px; height: 14px; margin-left: 2px; fill: currentColor; stroke: none; }
.video:hover .video-play span, .video:focus-visible .video-play span { transform: scale(1.12); }
.video-dur {
  position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 4px;
  background: rgb(10 18 24 / 0.7); color: #FFFFFF; font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.video-texto { display: flex; gap: 12px; align-items: flex-start; }
.video-num {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--mar); color: var(--mar); font-size: var(--t-0); font-weight: 700;
  font-variant-numeric: tabular-nums; margin-top: 1px;
}
.video-titulo { display: block; font-weight: 600; line-height: 1.3; }
.video:hover .video-titulo { color: var(--mar); }
.video-sub { display: block; margin-top: 3px; font-size: var(--t-0); color: var(--morto); line-height: 1.4; }

/* ── Provas modelo ── */
.provas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 18px; }
.prova {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; align-items: start;
  padding: 18px; border: 1px solid var(--linha); border-radius: 14px; background: var(--papel); box-shadow: var(--sombra-leve);
}
.prova-capa {
  position: relative; display: block; width: 100%; max-width: 100%; aspect-ratio: 560 / 792;
  border-radius: 3px; overflow: hidden; border: 1px solid var(--linha); box-shadow: var(--sombra-leve);
}
.prova-capa img { width: 100%; height: 100%; object-fit: cover; }
.prova-capa .abrir-selo { gap: 6px; padding: 6px 12px; font-size: var(--t-0); }
.prova-capa .abrir-selo .icone { width: 15px; height: 15px; }
.prova-corpo { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.prova h3 { font-size: var(--t-3); }
.prova-meta { margin-top: -4px; font-size: var(--t-1); color: var(--morto); }
.prova .descarregar { width: 100%; margin-top: 4px; }

/* Secção ainda sem conteúdo */
.vazio {
  display: flex; align-items: center; gap: 20px; padding: 26px 28px;
  border: 1.5px dashed var(--filete); border-radius: 14px;
}
.vazio-icone {
  display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 14px;
  background: var(--papel); color: var(--morto); box-shadow: var(--sombra-leve);
}
.vazio-icone .icone { width: 28px; height: 28px; stroke-width: 1.6; }
.vazio-titulo { font-weight: 600; }
.vazio-titulo + p { margin-top: 2px; font-size: var(--t-1); color: var(--morto); }

/* ── Notação matemática (legendas da figura) ── */
.m, .leitura { font-family: var(--f-mat); font-weight: 500; }
.m { font-variant-numeric: tabular-nums; white-space: nowrap; }
.m.mp { white-space: normal; }
.mn { white-space: nowrap; }
.m i { font-style: italic; }
.m sub, .m sup { font-size: 0.72em; line-height: 0; }
.mop { font-style: normal; }
.m .c-a { color: var(--mar); font-weight: 700; }
.m .c-b { color: var(--alerta); font-weight: 700; }
.m .c-v { color: var(--mata); font-weight: 700; }
.m .c-g { color: var(--morto); }
/* Fração empilhada, com o traço à altura do sinal de igual */
.fr {
  display: inline-flex; flex-direction: column; align-items: stretch; text-align: center; vertical-align: middle;
  margin: 0 0.12em; font-size: 0.86em; line-height: 1.12;
}
.fr > span { padding: 0 0.2em; }
.fr > span + span { border-top: 1.5px solid currentColor; padding-top: 0.08em; }
/* Raiz quadrada com o traço por cima do radicando */
.raiz { display: inline-flex; align-items: stretch; position: relative; }
.raiz-r { border-top: 1.5px solid currentColor; padding: 0.06em 0.1em 0 0.06em; margin-left: -0.04em; }
/* O índice fica fora do alinhamento da caixa, senão a linha de base passava a ser a do índice e
   o radical descia no meio do texto */
.raiz:has(> .raiz-i) { padding-left: 0.36em; }
.m .raiz-i { position: absolute; left: 0.02em; top: -0.12em; font-size: 0.62em; line-height: 1; }
.mbarra { text-decoration: overline; text-decoration-thickness: 1.5px; }

/* ── Glossário: lista à esquerda, ficha do termo à direita ── */
.glossario { display: flex; flex-direction: column; gap: 16px; }
.gl-controlos { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.gl-pesquisa { position: relative; display: flex; align-items: center; flex: 1 1 260px; max-width: 400px; }
.gl-pesquisa .icone { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--morto); pointer-events: none; }
.gl-pesquisa input {
  width: 100%; padding: 11px 16px 11px 42px; border-radius: 999px; border: 1.5px solid var(--linha);
  background: var(--papel); color: var(--tinta); font: inherit; font-size: var(--t-1); box-shadow: var(--sombra-leve);
}
.gl-pesquisa input:focus { outline: none; border-color: var(--mar); }
.gl-temas { display: flex; flex-wrap: wrap; gap: 6px; }
.gl-tema {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linha); background: var(--papel);
  font-size: var(--t-0); color: var(--tinta-2); transition: border-color 0.15s;
}
.gl-tema:hover { border-color: var(--mar); }
.gl-tema b { margin-right: 3px; color: var(--mar); font-variant-numeric: tabular-nums; }
.gl-tema[aria-pressed="true"] { background: var(--mar); border-color: var(--mar); color: var(--sobre-cor); }
.gl-tema[aria-pressed="true"] b { color: inherit; }
.gl-corpo { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
.gl-lista {
  list-style: none; margin: 0; padding: 8px; max-height: 620px; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 14px; background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra-leve);
}
.gl-letra { padding: 10px 10px 4px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; color: var(--mar); }
.gl-termo {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%;
  padding: 6px 10px; border-radius: 8px; font-size: var(--t-1); line-height: 1.35;
}
.gl-termo small { flex: none; font-size: 0.72rem; color: var(--morto); font-variant-numeric: tabular-nums; }
.gl-termo:hover { background: var(--fundo-2); color: var(--mar); }
.gl-termo[aria-pressed="true"] { background: var(--realce); color: var(--mar); font-weight: 600; }
.gl-vazio { padding: 14px 10px; font-size: var(--t-1); color: var(--morto); }
.gl-ficha {
  min-width: 0; min-height: 320px; padding: 24px 28px 26px; scroll-margin-top: 12px;
  border-radius: 14px; background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra-leve);
}
.gl-ficha h3 { margin: 6px 0 4px; font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem); color: var(--mar); }
.gl-sin { font-size: var(--t-1); color: var(--morto); }
.gl-sin em { font-style: italic; color: var(--tinta-2); }
.gl-def { margin-top: 12px; max-width: 68ch; font-size: var(--t-2); line-height: 1.65; }
.gl-ex { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--fundo-2); border: 1px solid var(--linha); }
.gl-ex .rotulo { margin-bottom: 6px; }
.gl-ex > div { line-height: 1.6; }
.gl-ex p { margin: 6px 0; }
/* Contas dos exemplos, uma por linha, com a nota à direita (por baixo, no telemóvel) */
.gl-contas { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 7px 24px; margin: 10px 0 12px 0.6em; }
.gl-cf { min-width: 0; }
.gl-cn { font-size: var(--t-0); color: var(--morto); line-height: 1.45; }
.gl-ex > div > :first-child { margin-top: 0; }
.gl-ex > div > :last-child { margin-bottom: 0; }
@media (max-width: 560px) {
  .gl-contas { grid-template-columns: minmax(0, 1fr); gap: 3px; margin-left: 0; }
  .gl-cn:empty { display: none; }
  .gl-cn { margin: 0 0 6px 1.2em; }
}
/* Fórmula destacada numa definição */
.gl-def .gl-dmat { display: block; margin: 10px 0 10px 1.2em; }
/* Ligações para outros termos, dentro da definição */
.gl-lig { color: var(--mar); text-decoration: underline dotted; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.gl-lig:hover { text-decoration-style: solid; }
.gl-voltar { display: inline-flex; align-items: center; gap: 4px; margin: -4px 0 10px -4px; padding: 3px 10px 3px 4px; border-radius: 999px; font-size: var(--t-0); font-weight: 600; color: var(--mar); }
.gl-voltar:hover { background: var(--realce); }
.gl-voltar .icone { width: 16px; height: 16px; }
.gl-fig { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 22px; margin: 12px 0 6px; }
.gl-fig.tres { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px 14px; max-width: 420px; }
.gl-fig figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.gl-fig svg { display: block; width: 100%; max-width: 120px; height: auto; overflow: visible; }
.gl-fig svg.largo { max-width: 290px; }
.gl-fig svg.medio { max-width: 180px; }
.gl-fig svg.grande { max-width: 260px; }
.gl-fig figcaption { font-size: var(--t-0); color: var(--tinta-2); text-align: center; line-height: 1.35; }
.gl-fig .l-a, .gl-fig .l-b, .gl-fig .l-v, .gl-fig .l-g { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.gl-fig .l-a { stroke: var(--mar); }
.gl-fig .l-b { stroke: var(--alerta); }
.gl-fig .l-v { stroke: var(--mata); }
.gl-fig .l-g { stroke: var(--morto); stroke-width: 1.3; opacity: 0.7; }
.gl-fig .tr { stroke-dasharray: 5 5; }
.gl-fig .fino { stroke-width: 1.4; }
.gl-fig .diag { stroke-width: 2.2; opacity: 0.5; }
.gl-fig .f-a { fill: var(--mar); }
.gl-fig .f-v { fill: var(--mata); }
.gl-fig .f-t { fill: var(--tinta); }
.gl-fig .barra { stroke: var(--tinta); stroke-width: 1.4; }
.gl-fig text { font-family: var(--f-mat); font-weight: 500; font-size: 17px; fill: var(--tinta); text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: var(--fundo-2); stroke-width: 7px; stroke-linejoin: round; }
.gl-fig text.g { fill: var(--morto); }
/* Preenchimentos e rótulos coloridos das figuras de TME, e tabelas pequenas nos exemplos */
.gl-fig .f-r { fill: var(--realce); }
.gl-fig .f-rb { fill: var(--realce-b); }
.gl-fig .f-b { fill: var(--alerta); }
.gl-fig .f-p { fill: var(--papel); }
.gl-fig .l-t { fill: none; stroke: var(--tinta); stroke-linecap: round; stroke-linejoin: round; }
.gl-fig .l-t:not(.fino) { stroke-width: 2.4; }
.gl-fig text.a { fill: var(--mar); font-weight: 600; }
.gl-fig text.b { fill: var(--alerta); font-weight: 600; }
.gl-fig text.v { fill: var(--mata); font-weight: 600; }
.gl-tabela { border-collapse: collapse; margin: 4px 0 10px; font-size: var(--t-1); font-variant-numeric: tabular-nums; }
.gl-tabela th, .gl-tabela td { padding: 4px 12px; text-align: center; border-bottom: 1px solid var(--linha); white-space: nowrap; }
.gl-tabela th { font-weight: 600; color: var(--tinta-2); white-space: normal; }
@media (max-width: 520px) {
  .gl-tabela { font-size: var(--t-0); }
  .gl-tabela th, .gl-tabela td { padding: 4px 7px; }
}
.gl-tabela td:first-child, .gl-tabela th:first-child { text-align: left; }
/* Regra de Ruffini: traço vertical depois do número a, traço horizontal antes da última linha */
.gl-ruffini td { border: 0; padding: 3px 12px; text-align: right; }
.gl-ruffini td.vert { border-right: 1.5px solid var(--tinta-2); color: var(--mar); font-weight: 700; }
.gl-ruffini tr.soma td { border-top: 1.5px solid var(--tinta-2); }
.gl-ruffini td.resto { color: var(--alerta); font-weight: 700; box-shadow: inset 1.5px 0 0 var(--tinta-2); }
.gl-rodape { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px 24px; margin-top: 22px; }
.gl-nota { font-size: var(--t-0); color: var(--morto); align-self: center; }
.gl-ver { display: flex; flex-direction: column; gap: 6px; }
.gl-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.gl-chip {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--linha); background: var(--papel);
  font-size: var(--t-0); color: var(--mar); transition: border-color 0.15s;
}
.gl-chip:hover { border-color: var(--mar); }
@media (max-width: 760px) {
  .gl-corpo { grid-template-columns: minmax(0, 1fr); }
  .gl-lista { max-height: 280px; }
  .gl-ficha { padding: 18px 16px 20px; min-height: 0; }
}

/* ── Cartões de estudo: um separador por tópico, por ordem crescente; na frente o nome do conceito,
   numa cor; no verso as propriedades, com realces e um gráfico quando ajuda. Carregar vira o cartão ── */
.est-topicos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.est-top {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linha); background: var(--papel);
  font-size: var(--t-0); font-weight: 600; color: var(--tinta-2); white-space: nowrap; transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
/* no telemóvel, os separadores ficam numa faixa que desliza */
@media (max-width: 640px) {
  .est-topicos { position: relative; flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--margem)); padding: 2px var(--margem) 6px; scrollbar-width: none; }
}
.est-top:hover { border-color: var(--mar); }
.est-top[aria-pressed="true"] { background: var(--mar); border-color: var(--mar); color: var(--sobre-cor); }
.est-cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.est-cab-botoes { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.est-nome { flex: 1 1 260px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; font-size: var(--t-3); line-height: 1.3; color: var(--mar); }
.est-nome small { font-size: var(--t-0); font-weight: 500; color: var(--morto); }
.est-cab .icone-botao:disabled { opacity: 0.35; }
.est-modo button { padding: 6px 13px; }
.est-grelha { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); grid-auto-flow: dense; gap: 18px; }
/* tamanhos: largo ocupa duas colunas e inteiro a linha toda; com uma só coluna, todos ocupam a linha */
.est-cartao.est-largo { grid-column: span 2; }
.est-cartao.est-inteiro { grid-column: 1 / -1; }
.est-corpo { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); align-items: center; gap: 8px 22px; }
.est-col-g .est-graf { max-width: 300px; }
.est-linhas.est-duas { display: block; columns: 2; column-gap: 26px; }
.est-linhas.est-duas > li { break-inside: avoid; margin-bottom: 10px; }
.est-inteiro .est-titulo, .est-largo .est-titulo { font-size: clamp(1.3rem, 1.15rem + 0.5vw, 1.55rem); }
@media (max-width: 680px) {
  .est-cartao.est-largo { grid-column: auto; }
  .est-corpo { display: block; }
  .est-corpo .est-col-g { margin-bottom: 10px; }
  .est-corpo-t > .est-linhas + .est-linhas { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--linha); }
  .est-linhas.est-duas { columns: 1; }
}
.est-cartao { perspective: 1200px; cursor: pointer; border-radius: 14px; outline: none; scroll-margin-top: 110px; }
.est-dentro { display: grid; height: 100%; transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(.3, 0, .2, 1); }
.est-cartao.virado .est-dentro { transform: rotateY(180deg); }
.est-face {
  grid-area: 1 / 1; display: flex; flex-direction: column; min-width: 0; min-height: 210px; padding: 16px 18px;
  border-radius: 14px; border: 1px solid var(--linha); background: var(--papel); box-shadow: var(--sombra-leve);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: border-color 0.2s, box-shadow 0.2s;
}
.est-cartao:focus-visible .est-face { box-shadow: 0 0 0 3px var(--realce), var(--sombra-leve); }
/* frente: o nome do conceito, num tom pastel da cor do tema do Programa */
.est-cartao { --est-cor: var(--mar); }
.est-cartao[data-tema="02"] { --est-cor: var(--mata); }
.est-cartao[data-tema="03"] { --est-cor: var(--alerta); }
.est-cartao[data-tema="04"] { --est-cor: var(--roxo); }
.est-cartao[data-tema="05"] { --est-cor: color-mix(in srgb, var(--mata) 55%, var(--mar)); }
.est-frente {
  align-items: flex-start; border-color: color-mix(in srgb, var(--est-cor) 18%, var(--papel)); color: var(--est-cor);
  background: linear-gradient(155deg, color-mix(in srgb, var(--est-cor) 25%, var(--papel)), color-mix(in srgb, var(--est-cor) 13%, var(--papel)));
}
.est-frente .codigo { background: var(--papel); color: var(--est-cor); }
.est-cartao:hover .est-frente { border-color: color-mix(in srgb, var(--est-cor) 45%, var(--papel)); box-shadow: var(--sombra); }
.est-titulo { margin: auto 0; align-self: stretch; text-align: center; font-size: var(--t-3); font-weight: 700; line-height: 1.3; color: var(--est-cor); text-wrap: balance; }
.est-virar { align-self: flex-end; display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-0); font-weight: 600; color: var(--est-cor); opacity: 0.85; }
.est-virar .icone { width: 26px; height: 26px; stroke-width: 2; }
/* verso: as propriedades */
.est-verso { transform: rotateY(180deg); }
.est-cartao:hover .est-verso { border-color: var(--filete); }
.est-titulo-verso { margin-bottom: 10px; font-size: var(--t-0); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--est-cor); }
.est-linhas { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.est-linhas li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.est-f { font-size: 1.1rem; color: var(--tinta); }
.est-f .m { white-space: normal; }
.est-n { font-size: var(--t-0); line-height: 1.45; color: var(--morto); }
.est-linhas li.est-frase { display: block; font-size: var(--t-1); line-height: 1.5; color: var(--tinta-2); }
.est-linhas li.est-passo { flex-direction: row; align-items: baseline; gap: 10px; font-size: var(--t-1); line-height: 1.45; color: var(--tinta-2); }
.est-num { flex: none; display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--mar); color: var(--sobre-cor); font-size: var(--t-0); font-weight: 700; transform: translateY(-1px); }
.est-num[data-n="2"] { background: var(--mata); }
.est-num[data-n="3"] { background: var(--alerta); }
.est-num[data-n="4"] { background: var(--roxo); }
.est-linhas li.est-passo .est-f { font-size: 1.05rem; }
/* o conteúdo do verso fica ao meio da altura que sobra, e não todo em cima */
.est-verso > .est-linhas, .est-verso > .est-corpo { margin-block: auto; }
.est-corpo.est-corpo-t { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
/* tabelas pequenas, como as da proporcionalidade */
.est-tab-bloco { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.est-tab td { min-width: 2.4em; }
.est-tab-tit { font-size: var(--t-1); color: var(--tinta-2); }
.est-tab { border-collapse: collapse; font-family: var(--f-mat); font-size: 1rem; font-weight: 500; }
.est-tab th, .est-tab td { padding: 3px 9px; border: 1px solid var(--linha); text-align: center; }
.est-tab th { font-family: var(--f-texto); font-style: italic; font-weight: 500; color: var(--morto); background: var(--fundo); }
.est-tab-n { font-size: var(--t-0); color: var(--morto); }
.est-a { color: var(--mar); font-weight: 700; }
.est-b { color: var(--alerta); font-weight: 700; }
.est-v { color: var(--mata); font-weight: 700; }
/* regras em destaque: um bloco por regra, com a fórmula em grande, num fundo leve da cor do tema */
.est-linhas li.est-regra { gap: 4px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--est-cor) 8%, var(--papel)); }
.est-regra .est-f { font-size: 1.32rem; }
.est-linhas.est-regras { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 10px 12px; }
/* critérios de divisibilidade: dois grupos, cada divisor numa bolinha, com um exemplo */
.est-linhas li.est-h { display: block; }
.est-crit { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px 26px; }
.est-crit-tit { margin-bottom: 8px; font-size: var(--t-0); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--morto); }
.est-crit-linha { display: grid; grid-template-columns: 2.3em 3.6em minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--linha); }
.est-crit-n { display: grid; place-items: center; width: 2.1em; height: 2.1em; border-radius: 50%; background: var(--est-cor); color: var(--sobre-cor); font-family: var(--f-mat); font-weight: 700; }
.est-crit-ex { font-family: var(--f-mat); font-size: 1.25rem; font-weight: 500; color: var(--tinta); letter-spacing: 0.02em; }
.est-crit-ex b { color: var(--alerta); font-weight: 700; }
.est-crit-r { font-size: var(--t-0); line-height: 1.4; color: var(--tinta-2); }
.est-graf .est-esbatido { opacity: 0.45; }
/* gráficos */
.est-linhas li.est-g { display: block; }
.est-graf { display: block; width: 100%; max-width: 250px; height: auto; margin: 0 auto 2px; overflow: visible; }
.est-graf text { font-family: var(--f-mat); font-weight: 500; stroke: none; }
.est-graf .est-it { font-family: var(--f-texto); font-style: italic; }
.est-graf .est-exp { font-size: 0.66em; }
.est-graf .est-forte { font-weight: 700; }
.est-eixo { stroke: var(--morto); stroke-width: 1.3; }
.est-traco { stroke-width: 1.6; }
.est-seg { stroke-width: 4.5; stroke-linecap: round; }
.est-seg2 { stroke-width: 2.6; stroke-linecap: round; fill: none; }
.est-sem-fundo { fill: none; }
.est-ponta { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.est-vazia { fill: var(--papel); stroke-width: 2; }
.est-cruz { stroke-width: 1.8; stroke-linecap: round; }
.est-tracejado { stroke: var(--morto); stroke-width: 1.3; stroke-dasharray: 4 3; }
.est-tracejado.est-v { stroke: var(--mata); stroke-width: 1.8; }
.est-anel-b { fill: none; stroke: var(--alerta); stroke-width: 2; }
.est-f-a { fill: var(--realce); stroke: var(--mar); stroke-width: 1.3; }
.est-f-b { fill: var(--alerta-suave); stroke: var(--alerta); stroke-width: 1.3; }
.est-f-v { fill: var(--mata-suave); stroke: var(--mata); stroke-width: 1.3; }
.est-f-g { fill: var(--fundo); stroke: var(--filete); stroke-width: 1.1; }
.est-venn-a { fill: var(--realce); fill-opacity: 0.75; stroke: var(--mar); stroke-width: 2; }
.est-venn-b { fill: var(--alerta-suave); fill-opacity: 0.6; stroke: var(--alerta); stroke-width: 2; }
@media (prefers-reduced-motion: reduce) { .est-dentro { transition: none; } }

/* ── Animações: cartões com o desenho, a conta, a frase e os controlos ── */
/* Numa faixa com scroll horizontal, como os slides e os quizzes de Álgebra Linear. A margem negativa
   com o mesmo padding dá espaço às sombras sem desalinhar os cartões do cabeçalho */
.animacoes {
  display: grid; grid-auto-flow: column; grid-auto-columns: 480px; gap: 26px; align-items: start;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  margin: -6px -12px -22px; padding: 6px 12px 22px; scroll-padding-inline: 12px;
  scrollbar-width: thin; scrollbar-color: var(--filete) transparent;
}
.anim-temas { margin-bottom: 18px; }
.animacoes.mais-dir { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.animacoes.mais-esq { mask-image: linear-gradient(to right, transparent, #000 40px); }
.animacoes.mais-esq.mais-dir { mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.setas { display: flex; gap: 8px; margin-left: auto; }
@media (hover: none), (max-width: 640px) { .setas { display: none; } }
@media (max-width: 640px) {
  /* no telemóvel a faixa vai até às bordas do ecrã, desliza-se com o dedo e dispensa o esbatimento */
  .animacoes {
    grid-auto-columns: min(calc(100% - 22px), 440px); gap: 12px; margin-inline: calc(-1 * var(--margem));
    padding-inline: var(--margem); scroll-padding-inline: var(--margem); mask-image: none !important;
  }
}
.anim {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 20px 22px 16px; scroll-margin-top: 90px; scroll-snap-align: start;
  border-radius: 14px; background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra-leve);
}
.anim-cab h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: var(--t-3); color: var(--mar); }
.anim-cab p { margin-top: 3px; font-size: var(--t-1); color: var(--morto); }
.anim-palco svg { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; }
/* Capa: um desenho próprio de cada cartão, sem frase; no lugar da frase, ao centro, a pastilha para
   reproduzir. Carregar em qualquer ponto do desenho também começa */
.anim-palco { position: relative; }
.anim-capa { position: absolute; inset: -4px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.anim:not(.com-capa) .anim-capa { display: none; }
.anim-capa-ler { display: none; align-self: center; margin: auto 0; padding: 0; border: 0; background: none; cursor: pointer; }
.anim.com-capa .anim-capa-ler { display: block; }
.anim.com-capa .anim-conta, .anim.com-capa .anim-texto { display: none; }
.anim.com-capa .anim-leitura { justify-content: center; }
.anim-capa-pilula {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px 10px 14px; border-radius: 999px;
  background: var(--mar); color: var(--sobre-cor); font-size: var(--t-1); font-weight: 600; box-shadow: var(--sombra);
  transition: transform 0.2s, background-color 0.2s;
}
.anim-capa-pilula .icone { width: 17px; height: 17px; fill: currentColor; }
.anim-capa-ler:hover .anim-capa-pilula, .anim:has(.anim-capa:hover) .anim-capa-pilula, .anim-capa-ler:focus-visible .anim-capa-pilula { transform: scale(1.05); background: var(--mar-forte); }
.anim-capa-ler:focus-visible { outline: none; }
.anim-capa-ler:focus-visible .anim-capa-pilula { box-shadow: 0 0 0 3px var(--realce), var(--sombra); }
.anim-leitura { display: flex; flex-direction: column; justify-content: flex-start; gap: 8px; }
.anim-conta { min-height: 2.6em; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; text-align: center; }
.anim-texto { font-size: var(--t-1); line-height: 1.55; color: var(--tinta-2); text-align: center; max-width: 52ch; margin: 0 auto; }
.anim-texto strong { display: block; margin-top: 6px; color: var(--mar); font-weight: 600; }
.anim-controlos { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 8px; padding-top: 12px; border-top: 1px solid var(--linha); }
.anim-controlos .icone-botao { width: 38px; height: 38px; }
.anim-controlos .icone-botao .icone { width: 18px; height: 18px; }
.anim-tocar { background: var(--mar); border-color: var(--mar); color: var(--sobre-cor); }
.anim-tocar:hover:not(:disabled) { background: var(--mar-forte); border-color: var(--mar-forte); color: var(--sobre-cor); }
.anim-pontos { display: flex; gap: 2px; margin-left: 6px; }
.anim-ponto { width: 15px; height: 18px; display: grid; place-items: center; border-radius: 50%; }
.anim-ponto::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--linha); transition: background-color 0.2s, transform 0.2s; }
.anim-ponto.feito::before { background: var(--mar); opacity: 0.45; }
.anim-ponto.atual::before { background: var(--mar); transform: scale(1.3); }
.anim-passo { margin-left: auto; font-size: var(--t-0); color: var(--morto); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Na faixa estreita do telemóvel os pontos não cabem com nove passos; fica o «Passo 1 de 9» */
@media (max-width: 640px) { .anim-pontos { display: none; } }
@media (max-width: 420px) { .anim { padding: 16px 14px 14px; } }
/* Peças dos desenhos */
.anim-palco text { font-family: var(--f-mat); font-weight: 500; dominant-baseline: auto; stroke: none; }
.anim-conta:empty { display: none; }
.anim-palco .an-rotulo { font-family: var(--f-texto); font-weight: 400; letter-spacing: 0.02em; }
.anim-palco .an-it { font-family: var(--f-texto); font-style: italic; }
.an-traco { stroke-width: 2; stroke-linecap: round; }
.an-risco { stroke-width: 2.2; stroke-linecap: round; }
.an-s-v { stroke: var(--mata); }
.an-s-t { stroke: var(--tinta); }
.an-s-g { stroke: var(--morto); }
.an-realce { fill: var(--realce); }
.an-realce-b { fill: var(--realce-b); }
.an-realce-v { fill: var(--mata-suave); stroke: var(--mata); stroke-width: 1.5; }
.an-c-a { fill: var(--mar); stroke: var(--mar); }
.an-c-b { fill: var(--alerta); stroke: var(--alerta); }
.an-c-v { fill: var(--mata); stroke: var(--mata); }
.an-c-t { fill: var(--tinta); stroke: var(--tinta); }
.an-c-g { fill: var(--morto); stroke: none; }
.an-c-p { fill: var(--papel); stroke: none; font-weight: 700; }
.anim-palco g text { stroke: none; }
.anim-palco g line { stroke-width: 2; }
.an-f-a { fill: var(--mar); fill-opacity: 0.85; }
.an-f-b { fill: var(--alerta); fill-opacity: 0.85; }
.an-f-v { fill: var(--mata); fill-opacity: 0.9; }
.an-peca { stroke: var(--tinta); stroke-width: 1.4; }
.an-contorno { fill: none; stroke: var(--tinta); stroke-width: 2.2; }
.an-div { stroke: var(--tinta); stroke-width: 1.4; }
.an-chave { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.an-s-a { stroke: var(--mar); }
.an-s-b { stroke: var(--alerta); }

/* ── Demos: uma por separador; entrada à esquerda, palco da resolução à direita (como em Álgebra Linear) ── */
.demo {
  padding: clamp(16px, 3vw, 28px); border-radius: 16px;
  background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra-leve);
}
.demo-abas { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.demo-aba {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 7px; border-radius: 12px;
  border: 1.5px solid var(--linha); background: var(--papel); color: var(--tinta-2); cursor: pointer;
  font-size: var(--t-2); font-weight: 600; text-align: left; transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.demo-aba:hover { border-color: var(--mar); color: var(--mar); }
.demo-aba[aria-selected="true"] { border-color: var(--mar); background: var(--realce); color: var(--mar); }
.demo-aba[aria-selected="true"] .codigo { background: var(--papel); }
.demo-aba .codigo { white-space: nowrap; }
.demo-grelha {
  display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); grid-template-rows: auto 1fr;
  grid-template-areas: "entrada palco" "entrada passos"; gap: 14px clamp(18px, 3vw, 30px); align-items: start;
}
.demo-entrada { grid-area: entrada; display: flex; flex-direction: column; gap: 10px; }
.demo-palco { grid-area: palco; }
.demo-passos { grid-area: passos; font-size: var(--t-0); color: var(--morto); }
.demo-passos summary { width: max-content; padding: 2px 0; font-weight: 600; cursor: pointer; }
.demo-passos summary:hover { color: var(--mar); }
.demo-passos[open] summary { margin-bottom: 10px; }
@media (max-width: 920px) {
  .demo-grelha { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "entrada" "palco" "passos"; }
}
.demo-rotulo { font-size: var(--t-0); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--morto); }
.demo-rotulo:not(:first-child) { margin-top: 6px; }
/* Campos que o aluno pode alterar: fundo branco, contorno visível e um lápis no canto, como nas demos
   de Álgebra Linear */
.demo-campo { position: relative; }
.demo-campo > input, .demo-campo > textarea, .es-classe-campo input {
  display: block; width: 100%; padding: 10px 36px 10px 12px; font-family: var(--f-mat); font-size: 1.125rem; font-weight: 500; color: var(--tinta);
  border-radius: 10px; border: 1.5px solid var(--filete); background: var(--papel); cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.demo-campo > input:hover, .demo-campo > textarea:hover, .es-classe-campo input:hover { border-color: var(--mar); }
.demo-campo > input:focus-visible, .demo-campo > textarea:focus-visible, .es-classe-campo input:focus-visible { outline: none; border-color: var(--mar); box-shadow: 0 0 0 3px var(--realce); }
.demo-campo > input::placeholder, .demo-campo > textarea::placeholder, .es-classe-campo input::placeholder { color: var(--morto); opacity: 0.65; }
.demo-lapis { position: absolute; top: 12px; right: 11px; width: 18px; height: 18px; color: var(--mar); pointer-events: none; transition: opacity 0.15s; }
.demo-campo > input ~ .demo-lapis { top: 50%; transform: translateY(-50%); }
.demo-campo:focus-within .demo-lapis { opacity: 0; }
.demo-teclas { display: flex; flex-wrap: wrap; gap: 5px; }
.demo-tecla {
  min-width: 2.3em; height: 2.1em; padding: 0 6px; border-radius: 8px; border: 1px solid var(--linha); background: var(--papel);
  font-family: var(--f-mat); font-size: 1rem; font-weight: 500; color: var(--tinta-2); cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.demo-tecla:hover { border-color: var(--mar); color: var(--mar); }
.demo-dica { font-size: var(--t-0); line-height: 1.5; color: var(--morto); }
.demo-aviso:empty { display: none; }
.demo-aviso { padding: 8px 10px; border-radius: 8px; background: var(--alerta-suave); color: var(--alerta); font-size: var(--t-0); font-weight: 600; line-height: 1.5; }
.demo-resolver { align-self: flex-start; }
.demo-exemplos { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-exemplo {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--linha); background: var(--papel);
  font-size: var(--t-0); font-weight: 600; color: var(--tinta-2); cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.demo-exemplo:hover { border-color: var(--mar); color: var(--mar); }
.demo-exemplo[aria-pressed="true"] { background: var(--realce); border-color: var(--realce); color: var(--mar); }
.desatualizada .demo-palco { opacity: 0.5; transition: opacity 0.2s; }

/* Demo «Fatorizar a parábola»: cursores, gráfico e cartões que mudam em tempo real */
.pa-modos { display: flex; flex-wrap: wrap; gap: 6px; }
.pa-grupo { display: flex; flex-direction: column; gap: 10px; }
.pa-grupo[hidden] { display: none; }
.pa-forma { font-size: 1.15rem; color: var(--tinta); }
.pa-cursor { display: grid; grid-template-columns: 2em minmax(0, 1fr) 2.6em; align-items: center; gap: 10px; }
.pa-cursor label { font-family: var(--f-mat); font-style: italic; font-size: 1.15rem; font-weight: 600; color: var(--tinta); }
/* cursor desenhado à mão, igual em todos os navegadores; --p é a parte já percorrida, a azul */
.pa-cursor input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.pa-cursor input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--mar) var(--p, 50%), var(--linha) var(--p, 50%)); }
.pa-cursor input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--mar) var(--p, 50%), var(--linha) var(--p, 50%)); }
.pa-cursor input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--papel); border: 2.5px solid var(--mar); box-shadow: var(--sombra-leve); }
.pa-cursor input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--papel); border: 2.5px solid var(--mar); box-shadow: var(--sombra-leve); }
.pa-cursor input[type="range"]:focus { outline: none; }
.pa-cursor input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--realce); }
.pa-cursor input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--realce); }
.pa-cursor output { text-align: right; font-family: var(--f-mat); font-size: 1.15rem; font-weight: 600; color: var(--mar); font-variant-numeric: tabular-nums; }
.pa-palco { padding-bottom: clamp(14px, 2.4vw, 22px); }
/* o gráfico ocupa a largura do palco e desloca-se arrastando-o */
.pa-graf { position: relative; }
.eq-graf.pa-graf svg { max-width: none; touch-action: none; cursor: grab; }
.pa-graf svg.pa-movendo { cursor: grabbing; }
.pa-graf svg:focus { outline: none; }
.pa-graf svg:focus-visible { outline: 2px solid var(--mar); outline-offset: 3px; border-radius: 6px; }
.pa-graf .pa-fina { opacity: 0.45; }
.pa-ferramentas { position: absolute; top: 16px; right: 16px; display: flex; align-items: center; gap: 6px; }
.pa-ferramentas .icone-botao { width: 34px; height: 34px; }
.pa-ferramentas .icone-botao .icone { width: 18px; height: 18px; }
.pa-centrar { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: var(--t-0); background: var(--papel); }
.pa-centrar[hidden] { display: none; }
/* os números do gráfico ficam legíveis por cima da curva e da grelha */
.pa-graf svg text { paint-order: stroke; stroke: var(--papel); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.pa-simetria { stroke: var(--morto); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: 0.7; }
.pa-c { fill: var(--papel); stroke: var(--mar); stroke-width: 2; }
.pa-v { fill: var(--tinta-2); }
.pa-alvo { fill: transparent; }
.pa-zero.arrasta { cursor: grab; touch-action: none; }
.pa-zero.arrasta:active { cursor: grabbing; }
.pa-zero.arrasta .gf-ponto { stroke: var(--mata); stroke-width: 2; filter: drop-shadow(0 0 3px var(--mata-suave)); }
.pa-cartoes { display: grid; gap: 10px; }
.pa-cartao { padding: 10px 14px 12px; border-radius: 12px; background: var(--papel); border: 1px solid var(--linha); }
.pa-cartao .dm-fase { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; }
.pa-f { font-size: clamp(1.02rem, 0.96rem + 0.35vw, 1.18rem); line-height: 1.75; color: var(--tinta); }
.pa-f .m { white-space: normal; }
.pa-linha + .pa-linha { margin-top: 4px; }
.pa-destaque { color: var(--mar); font-weight: 600; }
.pa-nota { font-size: var(--t-1); line-height: 1.55; color: var(--tinta-2); }
.pa-coef { display: block; font-size: var(--t-1); color: var(--tinta-2); }
.pa-chip { padding: 2px 10px; border-radius: 999px; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: none; }
.pa-chip.mais { background: var(--mata-suave); color: var(--mata); }
.pa-chip.zero { background: var(--realce); color: var(--mar); }
.pa-chip.menos { background: var(--alerta-suave); color: var(--alerta); }

/* Demo «Regra de Ruffini»: a tabela da sebenta, que se enche coluna a coluna, e o resultado */
.rf-campos { display: flex; flex-direction: column; gap: 10px; }
.rf-campo { display: flex; flex-direction: column; gap: 6px; }
.rf-cod { padding: 0 4px; border-radius: 4px; background: color-mix(in srgb, var(--tinta) 9%, transparent); font-family: var(--f-mat); font-size: 0.95em; color: var(--tinta-2); white-space: nowrap; }
.rf-cena { display: flex; flex-direction: column; align-items: center; gap: 18px; min-width: 0; }
.rf-caixa { max-width: 100%; overflow-x: auto; padding: 4px 2px; }
.rf-tab { border-collapse: separate; border-spacing: 0; font-family: var(--f-mat); font-weight: 500; font-variant-numeric: tabular-nums; }
.rf-tab td { padding: 4px 8px; text-align: center; white-space: nowrap; }
.rf-c td, .rf-m td, .rf-b td { font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); color: var(--tinta); }
.rf-c td.rf-v, .rf-m td.rf-v, .rf-b td.rf-v { border-right: 1.5px solid var(--tinta-2); }
.rf-b td { border-top: 1.5px solid var(--tinta-2); }
.rf-b td.rf-resto { box-shadow: inset 1.5px 0 0 var(--tinta-2); }
.rf-tab td { transition: border-color 0.6s ease, box-shadow 0.6s ease; }
.rf-sem td { border-color: transparent !important; box-shadow: none !important; }
.rf-n { display: inline-block; min-width: 1.6em; padding: 2px 6px; border-radius: 8px; text-align: center; visibility: hidden; transition: background-color 0.5s ease, color 0.5s ease; }
.rf-tab td.ver .rf-n { visibility: visible; }
.rf-a .rf-n { color: var(--mar); font-weight: 700; }
/* os graus por cima dos coeficientes e, no fim, os do quociente por baixo */
.rf-graus td, .rf-qg td { padding-block: 0; font-size: 0.82rem; color: var(--morto); visibility: hidden; }
.rf-graus.ver td, .rf-qg.ver td { visibility: visible; }
.rf-qg td { color: var(--mar); font-weight: 600; }
.rf-qg td.rf-rr { color: var(--alerta); }
.rf-tab td.rf-par .rf-n { background: var(--realce); color: var(--mar); }
.rf-tab td.rf-novo .rf-n { background: var(--mata-suave); color: var(--mata); font-weight: 700; }
.rf-tab td.rf-zero .rf-n { background: var(--alerta-suave); color: var(--alerta); font-weight: 700; }
.rf-fim .rf-b td.rf-q .rf-n { color: var(--mar); font-weight: 700; }
.rf-fim .rf-b td.rf-resto .rf-n { background: var(--alerta-suave); color: var(--alerta); font-weight: 700; }
.rf-res { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 10px; width: 100%; }
.rf-s { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem); font-weight: 600; line-height: 1.5; }
.rf-s .m, .rf-l .m { white-space: normal; }
.rf-sq { color: var(--mar); }
.rf-sr { color: var(--alerta); }
.rf-l { font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem); line-height: 1.6; color: var(--tinta); }
.rf-ok { color: var(--mata); font-weight: 700; }
.rf-nota { margin-top: 4px; font-size: var(--t-0); line-height: 1.5; color: var(--tinta-2); }
/* polinómios compridos partem-se nos sinais, no telemóvel */
.rf-res .mn { white-space: normal; }
/* a tabela só encolhe quando não cabe (a demo mede-a e escolhe o aperto) */
.rf-aperta .rf-tab td { padding: 3px 4px; }
.rf-aperta .rf-n { min-width: 0; padding: 1px 4px; }
.rf-aperta .rf-c td, .rf-aperta .rf-m td, .rf-aperta .rf-b td { font-size: 1.1rem; }
.rf-aperta-mais .rf-tab td { padding: 2px 1px; }
.rf-aperta-mais .rf-n { padding: 1px 2px; }
.rf-aperta-mais .rf-c td, .rf-aperta-mais .rf-m td, .rf-aperta-mais .rf-b td { font-size: 0.95rem; }
.rf-aperta-mais .rf-graus td, .rf-aperta-mais .rf-qg td { font-size: 0.72rem; }
/* Demo «Divisão de polinómios»: a chaveta da sebenta, com o dividendo à esquerda, cada termo na
   coluna do seu grau, e o divisor e o quociente à direita do traço vertical */
/* Em ecrãs largos o resultado fica ao lado da chaveta, para o palco não crescer tanto */
.dv-cena { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 18px 22px; min-width: 0; }
.dv-caixa { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow-x: auto; padding: 4px 2px; }
.dv-res.rf-res { flex: 1 1 220px; width: auto; max-width: 380px; grid-template-columns: 1fr; }
.dv-tab { border-collapse: separate; border-spacing: 0; font-family: var(--f-mat); font-weight: 500; }
.dv-tab td { padding: 3px 6px; text-align: center; white-space: nowrap; font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem); color: var(--tinta); border-bottom: 1.5px solid transparent; transition: border-color 0.6s ease; }
.dv-tab td.dv-d { padding-left: 12px; text-align: left; border-left: 1.5px solid var(--tinta-2); }
.dv-tab td.dv-div { border-bottom-color: var(--tinta-2); }
.dv-tab tr.linha td.dv-sob { border-bottom-color: var(--tinta-2); }
.dv-n { display: inline-block; padding: 2px 5px; border-radius: 8px; text-align: center; visibility: hidden; transition: background-color 0.5s ease, color 0.5s ease; }
.dv-tab tr.ver .dv-n, .dv-tab td.dv-d .dv-n { visibility: visible; }
.dv-tab td.dv-par .dv-n { background: var(--realce); color: var(--mar); }
.dv-tab td.dv-novo .dv-n { background: var(--mata-suave); color: var(--mata); }
/* os 0x^n dos termos em falta do dividendo, destacados no primeiro quadro */
.dv-tab td.dv-zero .dv-n { background: var(--alerta-suave); color: var(--alerta); }
.dv-fim td.dv-quoc .dv-n { color: var(--mar); font-weight: 700; }
.dv-fim tr.dv-ult td.dv-t .dv-n { background: var(--alerta-suave); color: var(--alerta); font-weight: 700; }
.dv-fim tr.dv-ult td.dv-t .dv-n:empty { background: none; }
.dv-aperta .dv-tab td { padding: 2px 3px; font-size: 1rem; }
.dv-aperta .dv-tab td.dv-d { padding-left: 8px; }
.dv-aperta .dv-n { padding: 1px 3px; }
.dv-aperta-mais .dv-tab td { padding: 1px 1px; font-size: 0.86rem; }
.dv-aperta-mais .dv-tab td.dv-d { padding-left: 5px; }
.dv-aperta-mais .dv-n { padding: 1px 2px; }
/* último recurso, no telemóvel: o quociente pode partir a linha entre dois termos */
.dv-quebra .dv-tab td.dv-d, .dv-quebra .dv-tab td.dv-d .m { white-space: normal; }

/* Palco: fase, frase do passo, conta auxiliar, a cena da demo e os controlos */
.demo-palco {
  container-type: inline-size; position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: clamp(14px, 2.4vw, 22px) clamp(14px, 2.4vw, 22px) 0; border-radius: 14px; background: var(--fundo); border: 1px solid var(--linha);
}
.demo-palco:focus { outline: none; }
.dm-fase { font-size: var(--t-0); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mar); }
.dm-texto { position: relative; display: flex; align-items: center; justify-content: center; }
/* O texto do passo é o que se lê primeiro, mas nunca maior do que o título da demo no separador */
.dm-texto p { max-width: 60ch; text-align: center; font-size: clamp(1rem, 0.94rem + 0.25vw, var(--t-2)); font-weight: 500; line-height: 1.55; color: var(--tinta); }
.dm-texto .fr { font-size: 0.7em; }
.dm-op { position: relative; display: grid; place-items: center; text-align: center; font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.25rem); color: var(--mar); }
.dm-op .m { white-space: normal; }
.dm-op:empty { min-height: 0; }

/* Controlos presos ao fundo do ecrã enquanto o palco está à vista */
.dm-controlos {
  position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  margin-inline: calc(-1 * clamp(14px, 2.4vw, 22px)); padding: 16px clamp(14px, 2.4vw, 22px) 12px;
  border-radius: 0 0 14px 14px; background: var(--fundo);
}
/* Barra de passos: um segmento por passo, com a largura dos seus quadros; leva a qualquer passo */
.dm-trilho { position: absolute; left: 0; right: 0; top: -6px; display: flex; gap: 2px; padding-inline: clamp(14px, 2.4vw, 22px); }
.dm-seg { flex: 1 1 0; min-width: 4px; height: 14px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.dm-seg::before {
  content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 4px; border-radius: 2px;
  background: var(--linha); transition: background-color 0.25s, height 0.15s, top 0.15s;
}
.dm-seg.feito::before { background: color-mix(in srgb, var(--mar) 45%, var(--linha)); }
.dm-seg.atual::before { background: var(--mar); }
.dm-seg:hover::before { top: 4px; height: 6px; }
.dm-botoes { display: flex; align-items: center; gap: 8px; }
.dm-tocar { min-width: 9.2em; justify-content: center; }
/* Nos palcos estreitos o botão de reproduzir encolhe, para os quatro botões caberem */
@container (max-width: 330px) { .dm-botoes { gap: 6px; } .dm-tocar { min-width: 0; padding-inline: 12px; } }
/* e, nos mais estreitos, sai o botão de voltar ao início, porque a barra de passos também lá leva */
@container (max-width: 280px) { .dm-botoes [data-dm="inicio"] { display: none; } }
.dm-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dm-vel {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linha);
  background: var(--papel); font-size: var(--t-0); font-weight: 600; color: var(--tinta-2); cursor: pointer;
}
.dm-vel .icone { width: 16px; height: 16px; }
.dm-vel:hover:not(:disabled) { border-color: var(--mar); color: var(--mar); }
.dm-vel:disabled { opacity: 0.45; cursor: default; }
.dm-registo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; margin: 0; padding: 0; list-style: none; }
.dm-registo li { display: flex; align-items: center; gap: 4px; }
.dm-registo li + li::before { content: "→"; font-size: 0.8em; color: var(--morto); }
.dm-elo {
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--linha); background: var(--papel);
  font-size: var(--t-0); font-weight: 600; color: var(--tinta-2); cursor: pointer;
  transition: opacity 0.2s, background-color 0.2s, color 0.2s, border-color 0.2s;
}
.dm-elo:hover { border-color: var(--mar); }
.dm-elo.futuro { opacity: 0.55; }
.dm-elo.atual { background: var(--mar); border-color: var(--mar); color: var(--sobre-cor); }

/* Resultado: o conjunto solução num cartão verde (vermelho se é vazio) e a classificação num azul */
.dm-bloco {
  min-width: 0; padding: 12px 16px 14px; border-radius: 12px;
  visibility: hidden; opacity: 0; transform: translateY(8px); transition: opacity 0.4s, transform 0.4s, visibility 0s 0.4s;
}
.dm-bloco.ver { visibility: visible; opacity: 1; transform: none; transition: opacity 0.4s, transform 0.4s; }
.dm-parte { visibility: hidden; opacity: 0; transition: opacity 0.4s, visibility 0s 0.4s; }
.dm-parte.ver { visibility: visible; opacity: 1; transition: opacity 0.4s; }
.dm-bloco-tit { margin-bottom: 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--morto); }
.dm-bloco.dm-sol { background: var(--mata-suave); }
.dm-sol .dm-bloco-tit { color: var(--mata); }
.dm-s { color: var(--mata); font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.55rem); font-weight: 600; line-height: 1.4; white-space: normal; }
.dm-s .fr { font-size: 0.72em; }
.dm-bloco.dm-sol-vazio { background: var(--alerta-suave); }
.dm-sol-vazio .dm-bloco-tit, .dm-sol-vazio .dm-s { color: var(--alerta); }
.dm-bloco.dm-class { background: var(--realce); }
.dm-class .dm-bloco-tit { color: var(--mar); }
.dm-veredicto { font-size: var(--t-2); font-weight: 700; color: var(--mata); }
.dm-veredicto.dm-impossivel { color: var(--alerta); }

/* Equações: as linhas da resolução, como no papel, com ⟺ à esquerda */
.eq-cena { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.eq-linhas { display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow-x: auto; padding: 2px 2px 4px; font-size: clamp(1.15rem, 1.02rem + 0.55vw, 1.4rem); }
.eq-linha { position: relative; display: grid; grid-template-columns: 1.9em minmax(max-content, 1fr); align-items: center; visibility: hidden; transition: opacity 0.35s; }
.eq-linha.ver { visibility: visible; }
.eq-linha.antiga { opacity: 0.5; }
.eq-linha.com-mult { padding-top: 0.95em; }
.eq-equiv { color: var(--morto); font-family: var(--f-mat); }
.eq-f { display: block; position: relative; }
.eq-f .fr { font-size: 0.8em; }
.eq-mult { position: relative; display: inline-block; }
.eq-fator {
  position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); padding-bottom: 0.2em;
  font-size: 0.6em; font-weight: 600; line-height: 1; color: var(--mar); white-space: nowrap;
}
.eq-res { display: flex; flex-direction: column; gap: 12px; }
.eq-res:empty { display: none; }
/* Gráfico: os dois membros como retas, a azul e a vermelho, e a solução a verde */
.eq-graf { margin: 0; padding: 10px 12px 12px; border-radius: 12px; background: var(--papel); border: 1px solid var(--linha); }
.eq-graf[hidden] { display: none; }
.eq-graf svg { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; overflow: visible; }
.eq-graf-nota { max-width: 60ch; margin: 8px auto 0; text-align: center; font-size: var(--t-0); line-height: 1.5; color: var(--morto); }
.gf-t { font-family: var(--f-mat); font-size: 14px; fill: var(--morto); }
.gf-te { fill: var(--mar); font-weight: 600; }
.gf-td { fill: var(--alerta); font-weight: 600; }
.gf-tv { fill: var(--mata); font-weight: 700; font-size: 15px; }
.gf-nome { font-style: italic; font-size: 15px; fill: var(--tinta-2); }
.gf-grelha { stroke: var(--linha); stroke-width: 1; }
.gf-eixo { stroke: var(--tinta-2); stroke-width: 1.3; }
.gf-e { fill: none; stroke: var(--mar); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.gf-d { fill: none; stroke: var(--alerta); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.gf-guia { stroke: var(--mata); stroke-width: 1.5; stroke-dasharray: 4 3; }
.gf-ponto { fill: var(--mata); stroke: var(--papel); stroke-width: 1.5; }
.gf-sol { stroke: var(--mata); stroke-width: 5; stroke-linecap: round; opacity: 0.85; }
.gf-bola { stroke: var(--mata); stroke-width: 2.4; }
.gf-bola.cheia { fill: var(--mata); }
.gf-bola.vazia { fill: var(--papel); }
.eq-graf-botao[aria-pressed="true"] { background: var(--realce); border-color: var(--mar); color: var(--mar); }
/* Módulo com barras que acompanham a altura do que está dentro, e as ligações ∧ e ∨ */
.eq-abs { display: inline-block; padding: 0 0.16em; margin: 0 0.08em; border-inline: 1.6px solid currentColor; line-height: 1.15; vertical-align: middle; }
.eq-con { display: inline-block; margin: 0 0.25em; color: var(--mar); font-weight: 600; }
.eq-f .mn { white-space: nowrap; }
/* Uma linha com várias condições parte-se antes de ∧ ou ∨ quando não cabe; cada condição fica inteira */
.eq-linha:has(.eq-con) { grid-template-columns: 1.9em minmax(0, 1fr); }
.eq-linha .eq-f { white-space: normal; }
.eq-linha .eq-f .eq-con { margin-inline: 0.2em; }
/* Exemplos agrupados (equações, inequações, módulos) */
.demo-grupo { display: flex; flex-direction: column; gap: 5px; }
.demo-grupo-tit { font-size: 0.75rem; font-weight: 600; color: var(--morto); }
/* Reta numérica do conjunto solução de uma inequação */
.dm-reta { position: relative; max-width: 360px; margin-top: 8px; padding-bottom: 1.4em; }
.dm-reta.com-valor { padding-top: 1.7em; }
.dm-reta svg { display: block; width: 100%; height: auto; overflow: visible; }
.rt-eixo, .rt-marca { stroke: var(--tinta-2); stroke-width: 1.4; }
.rt-seta { fill: none; stroke: var(--tinta-2); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.rt-int { stroke: var(--mata); stroke-width: 5; stroke-linecap: round; }
.rt-bola { stroke: var(--mata); stroke-width: 2.6; }
.rt-bola.cheia { fill: var(--mata); }
.rt-bola.vazia { fill: var(--mata-suave); }
.rt-n { position: absolute; bottom: 0; transform: translateX(-50%); font-family: var(--f-mat); font-size: 0.8rem; color: var(--tinta-2); }
.rt-v { position: absolute; top: 0; transform: translateX(-50%); font-size: 0.95rem; color: var(--mata); font-weight: 700; }
.rt-v .fr { font-size: 0.75em; }
/* Reta com várias condições, cada uma na sua altura, e o conjunto solução no eixo */
.dm-reta-c { padding-bottom: 1.5em; }
.rt-guia { stroke: var(--morto); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; }
.rt-int.rt-ca { stroke: var(--mar); stroke-width: 4; }
.rt-int.rt-cb { stroke: var(--alerta); stroke-width: 4; }
.rt-int.rt-cg { stroke: var(--morto); stroke-width: 4; }
.rt-bola.rt-ca { stroke: var(--mar); stroke-width: 2.2; }
.rt-bola.rt-cb { stroke: var(--alerta); stroke-width: 2.2; }
.rt-bola.rt-cg { stroke: var(--morto); stroke-width: 2.2; }
.rt-bola.cheia.rt-ca { fill: var(--mar); }
.rt-bola.cheia.rt-cb { fill: var(--alerta); }
.rt-bola.cheia.rt-cg { fill: var(--morto); }
.dm-reta-c .rt-n { font-size: 0.85rem; }
.dm-reta-c .rt-n .fr { font-size: 0.72em; }
.dm-sol-vazio .rt-bola.vazia { fill: var(--alerta-suave); }

/* Estatística: os dados em fila (fichas que se ordenam), a tabela de frequências e o gráfico de barras */
.demo-modos { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-campo > textarea { min-height: 4.6em; resize: vertical; line-height: 1.5; }
/* Classes dos dados agrupados: amplitude e início, lado a lado */
.es-classes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.es-classes[hidden] { display: none; }
.es-classe-campo { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-0); font-weight: 600; color: var(--morto); }
.es-classe-campo input { padding: 7px 10px; font-size: 1rem; }
/* Fichas com classes: cada classe com a sua cor, e um espaço entre classes */
.es-dados.com-classes .es-ficha { border-bottom-width: 4px; }
.es-dados.com-classes .es-ficha[data-k="0"], .es-dados.com-classes .es-ficha[data-k="4"], .es-dados.com-classes .es-ficha[data-k="8"] { border-bottom-color: var(--mar); }
.es-dados.com-classes .es-ficha[data-k="1"], .es-dados.com-classes .es-ficha[data-k="5"], .es-dados.com-classes .es-ficha[data-k="9"] { border-bottom-color: var(--alerta); }
.es-dados.com-classes .es-ficha[data-k="2"], .es-dados.com-classes .es-ficha[data-k="6"], .es-dados.com-classes .es-ficha[data-k="10"] { border-bottom-color: var(--mata); }
.es-dados.com-classes .es-ficha[data-k="3"], .es-dados.com-classes .es-ficha[data-k="7"], .es-dados.com-classes .es-ficha[data-k="11"] { border-bottom-color: var(--morto); }
/* Tabela agrupada: a frequência de cada classe só aparece quando se conta */
.es-tabela.agrupada tbody tr.por-contar td[data-c] { visibility: hidden; }
.es-barras.histograma .es-barra rect { stroke-width: 1.2; }
.es-cena { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.es-dados { display: flex; flex-wrap: wrap; gap: 20px 6px; padding-bottom: 14px; font-family: var(--f-mat); font-weight: 500; font-variant-numeric: tabular-nums; }
.es-dados[hidden] { display: none; }
.es-ficha {
  position: relative; min-width: 2.2em; padding: 4px 8px; border-radius: 8px; text-align: center;
  border: 1.5px solid var(--linha); background: var(--papel); color: var(--tinta); font-size: 1.05rem;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}
.es-dados.muitos .es-ficha { min-width: 1.9em; padding: 2px 6px; font-size: 0.95rem; }
.es-ficha.es-fora { opacity: 0.28; transform: scale(0.86); }
.es-ficha.es-marca { border-color: var(--mar); background: var(--realce); color: var(--mar); font-weight: 700; }
.es-ficha.es-centro { border-color: var(--mata); background: var(--mata-suave); color: var(--mata); font-weight: 700; }
/* com as posições à vista, cada ficha mostra a sua posição nos dados ordenados, por baixo */
.es-dados.posicoes .es-ficha::after {
  content: attr(data-p); position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px;
  font-size: 0.68rem; font-weight: 500; color: var(--morto);
}
.es-dados.posicoes .es-ficha.es-centro::after { color: var(--mata); font-weight: 700; }
.es-meio { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 20px; visibility: hidden; }
.es-meio.ver { visibility: visible; }
.es-tabela-caixa { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow-x: auto; }
.es-tabela { border-collapse: collapse; font-family: var(--f-mat); font-weight: 500; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.es-tabela th { padding: 4px 6px 6px; font-family: var(--f-texto); font-size: 0.72rem; font-weight: 600; line-height: 1.25; color: var(--morto); text-align: center; border-bottom: 1.5px solid var(--tinta-2); }
.es-tabela td { padding: 4px 6px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--linha); }
.es-tabela td:first-child { font-weight: 700; }
.es-tabela tfoot td { border-top: 1.5px solid var(--tinta-2); border-bottom: 0; font-weight: 700; }
.es-tabela small { font-size: 0.78em; color: var(--morto); }
/* Cada coluna aparece no seu passo; nas linhas, só nas que já foram contadas; o total, quando se soma */
.es-tabela [data-c], .es-tabela tbody tr:not(.ver) td, .es-tabela tfoot td { visibility: hidden; }
.es-tabela.com-abs thead [data-c="abs"], .es-tabela.com-abs tbody tr.ver [data-c="abs"],
.es-tabela.com-rel thead [data-c="rel"], .es-tabela.com-rel tbody tr.ver [data-c="rel"],
.es-tabela.com-acum thead [data-c="acum"], .es-tabela.com-acum tbody tr.ver [data-c="acum"],
.es-tabela.com-pm thead [data-c="pm"], .es-tabela.com-pm tbody tr.ver [data-c="pm"],
.es-tabela.com-racum thead [data-c="racum"], .es-tabela.com-racum tbody tr.ver [data-c="racum"],
.es-tabela.com-prod thead [data-c="prod"], .es-tabela.com-prod tbody tr.ver [data-c="prod"] { visibility: visible; }
.es-tabela.tot-abs tfoot td:first-child,
.es-tabela.tot-abs tfoot [data-c="abs"],
.es-tabela.tot-rel tfoot [data-c="rel"],
.es-tabela.tot-prod tfoot [data-c="prod"] { visibility: visible; }
.es-tabela tbody tr { transition: background-color 0.3s; }
.es-tabela tbody tr.es-marca { background: var(--realce); }
.es-tabela tbody tr.es-marca td { color: var(--mar); }
.es-barras { flex: 1 1 200px; max-width: 400px; margin: 0 auto; visibility: hidden; }
.es-barras.ver { visibility: visible; }
.es-barras svg { display: block; width: 100%; max-width: 380px; height: auto; margin: 0 auto; overflow: visible; }
.es-graf-tit { margin-bottom: 4px; text-align: center; font-size: var(--t-1); font-weight: 600; color: var(--tinta); }
.es-t { font-family: var(--f-mat); font-size: 12.5px; fill: var(--morto); }
.es-tv { font-size: 13px; fill: var(--tinta-2); font-weight: 600; }
.es-nome { font-family: var(--f-texto); font-size: 12.5px; font-weight: 500; }
.es-linha { fill: none; stroke: var(--mar); stroke-width: 2.4; stroke-linejoin: round; }
.es-ponto { fill: var(--papel); stroke: var(--mar); stroke-width: 2.2; }
.es-barra.es-marca .es-ponto, .es-ponto.es-barra.es-marca { fill: var(--mata); stroke: var(--mata); }
.es-fantasma { fill: var(--realce); opacity: 0.45; stroke: none; }
.es-pontos circle { fill: var(--mar); }
.es-pontos.es-marca circle { fill: var(--mata); }
.es-sector path, .es-sector circle { stroke: var(--papel); stroke-width: 1.5; transition: fill 0.3s; }
.es-s0 path, .es-s0 circle { fill: color-mix(in srgb, var(--mar) 85%, var(--papel)); }
.es-s1 path, .es-s1 circle { fill: color-mix(in srgb, var(--alerta) 80%, var(--papel)); }
.es-s2 path, .es-s2 circle { fill: color-mix(in srgb, var(--mata) 85%, var(--papel)); }
.es-s3 path, .es-s3 circle { fill: color-mix(in srgb, var(--morto) 75%, var(--papel)); }
.es-s4 path, .es-s4 circle { fill: color-mix(in srgb, var(--mar) 45%, var(--papel)); }
.es-s5 path, .es-s5 circle { fill: color-mix(in srgb, var(--alerta) 45%, var(--papel)); }
.es-sector-t { fill: var(--sobre-cor); font-weight: 700; font-size: 13px; }
.es-sector-t.fora { fill: var(--tinta-2); }
.es-sector.es-marca path, .es-sector.es-marca circle { stroke: var(--tinta); stroke-width: 3; }
.es-caule { font-size: 16px; font-weight: 700; fill: var(--tinta); }
.es-folha { font-size: 16px; fill: var(--tinta-2); }
.es-folha.es-marca { fill: var(--mata); font-weight: 700; }
/* Moda: a linha que desce; mediana dos agrupados: o marcador e a construção na ogiva */
.es-nivel { stroke: var(--mata); stroke-width: 2; stroke-dasharray: 6 4; visibility: hidden; }
.es-nivel.ver { visibility: visible; }
.es-marcador { visibility: hidden; }
.es-marcador.ver { visibility: visible; }
.es-construcao { stroke: var(--mata); stroke-width: 2; stroke-dasharray: 5 4; }
.es-marcador-t { fill: var(--mata); font-weight: 700; font-size: 13px; }
.es-fundo-t { paint-order: stroke; stroke: var(--fundo); stroke-width: 4px; stroke-linejoin: round; }
.es-tf { font-family: var(--f-mat); font-size: 12px; font-weight: 700; fill: var(--mar); }
.es-grelha { stroke: var(--linha); stroke-width: 1; }
.es-eixo { stroke: var(--tinta-2); stroke-width: 1.3; }
.es-barra rect { fill: var(--realce); stroke: var(--mar); stroke-width: 1.4; transform-box: fill-box; transform-origin: 50% 100%; transition: fill 0.3s, stroke 0.3s; }
.es-barra.es-marca rect { fill: var(--mata-suave); stroke: var(--mata); stroke-width: 2.2; }
.es-barra.es-marca .es-tf { fill: var(--mata); }
.es-res { display: flex; flex-direction: column; gap: 12px; }
.es-res:empty { display: none; }
.es-medidas { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px 18px; margin-top: 4px; }
.es-medidas > div > span { display: block; font-size: 0.75rem; font-weight: 600; color: var(--morto); }
.es-medidas b { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem); font-weight: 600; color: var(--mata); white-space: nowrap; }

/* Algoritmo de Euclides: a tabela das divisões sucessivas (quocientes por cima, números ao meio, restos
   por baixo) e o retângulo, que se enche de quadrados divisão a divisão */
.eu-cena { display: flex; flex-direction: column; align-items: center; gap: 18px; min-width: 0; }
.eu-tabela-caixa { max-width: 100%; overflow-x: auto; padding: 2px; }
.eu-tabela { border-collapse: separate; border-spacing: 0; font-family: var(--f-mat); font-weight: 500; }
.eu-tabela td { min-width: 2.6em; padding: 3px 12px; text-align: center; visibility: hidden; transition: background-color 0.3s, color 0.3s; }
.eu-tabela td.ver { visibility: visible; }
.eu-q td { font-size: 1rem; font-weight: 700; color: var(--mata); }
.eu-m td { font-size: 1.35rem; color: var(--tinta); border-block: 1.5px solid var(--filete); }
.eu-m td + td { border-left: 1.5px solid var(--filete); }
.eu-m td:first-child { border-left: 1.5px solid transparent; }
.eu-m td.eu-par { background: var(--realce); }
.eu-m td.eu-mdc { background: var(--mata-suave); color: var(--mata); font-weight: 700; }
.eu-r td { font-size: 1.05rem; font-weight: 700; color: var(--alerta); }
.eu-figura { width: 100%; max-width: 520px; margin: 0; }
.eu-ret { display: block; width: 100%; height: auto; }
.eu-ret text { font-family: var(--f-mat); font-size: 14px; font-weight: 600; text-anchor: middle; stroke: none; }
.eu-ret .eu-lado { fill: var(--morto); font-size: 16px; font-weight: 500; }
.eu-contorno { fill: none; stroke: var(--tinta-2); stroke-width: 1.5; }
.eu-g { opacity: 0; transition: opacity 0.3s; }
.eu-g.ver { opacity: 1; }
.eu-g rect { stroke-width: 1.2; transition: fill 0.4s, stroke 0.4s; }
.eu-c0 rect { fill: var(--realce); stroke: var(--mar); } .eu-c0 text { fill: var(--mar); }
.eu-c1 rect { fill: var(--alerta-suave); stroke: var(--alerta); } .eu-c1 text { fill: var(--alerta); }
.eu-c2 rect { fill: color-mix(in srgb, var(--roxo) 16%, var(--papel)); stroke: var(--roxo); } .eu-c2 text { fill: var(--roxo); }
.eu-c3 rect { fill: var(--fundo-2); stroke: var(--tinta-2); } .eu-c3 text { fill: var(--tinta-2); }
.eu-cf rect { fill: var(--fundo-2); stroke: var(--tinta-2); } .eu-cf text { fill: var(--tinta-2); }
.eu-fim .eu-cf rect { fill: var(--mata-suave); stroke: var(--mata); } .eu-fim .eu-cf text { fill: var(--mata); }
.eu-res { align-self: stretch; display: flex; flex-direction: column; gap: 12px; }
.eu-nota { margin-top: 6px; font-size: var(--t-1); line-height: 1.5; color: var(--tinta-2); }
.eu-nota.eu-porque { font-size: var(--t-0); color: var(--morto); }

/* Contagem: o enunciado com os números em campos, os grupos de elementos (com nome, depois pontos
   iguais e baralhados) e as caixas, com o nome de cada lugar */
.ct-enunciado { font-size: var(--t-1); line-height: 2.2; color: var(--tinta); }
.ct-campo-n { display: inline-block; vertical-align: baseline; }
.ct-campo-n > input { display: inline-block; width: 3.4em; padding: 1px 22px 1px 8px; font-size: 1rem; text-align: center; }
.ct-campo-n .demo-lapis { right: 6px; width: 13px; height: 13px; }
.ct-botoes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ct-cena { display: flex; flex-direction: column; align-items: center; gap: 18px; min-width: 0; }
.ct-grupos { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 14px 28px; }
.ct-grupo { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 100%; }
.ct-grupo-tit { font-size: var(--t-0); font-weight: 600; color: var(--morto); }
.ct-pontos { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 340px; }
.ct-p {
  display: grid; place-items: center; min-width: 2.1em; height: 2.1em; padding: 0 6px; border-radius: 8px;
  border: 1.5px solid var(--linha); background: var(--papel); font-family: var(--f-mat); font-size: 1rem; font-weight: 500; color: var(--tinta);
  transition: min-width 0.5s, height 0.5s, padding 0.5s, border-radius 0.5s, background-color 0.4s, border-color 0.4s, opacity 0.4s, transform 0.4s, box-shadow 0.4s;
}
.ct-rot { transition: opacity 0.3s; }
/* os elementos passam a pontos iguais; os da caixa a preencher acendem-se e os já usados saem */
.abstratos .ct-p { min-width: 1.2em; width: 1.2em; height: 1.2em; padding: 0; border-radius: 50%; background: var(--mar); border-color: var(--mar); opacity: 0.45; }
.abstratos .ct-rot { opacity: 0; font-size: 0; }
.abstratos .ct-p.aceso { opacity: 1; transform: scale(1.15); box-shadow: 0 0 0 3px var(--realce); }
.abstratos .ct-p.tirado { opacity: 0.1; transform: scale(0.55); box-shadow: none; }
.ct-caixas { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 10px 6px; visibility: hidden; }
.ct-caixas.ver { visibility: visible; }
.ct-caixa { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ct-num {
  display: grid; place-items: center; width: 56px; height: 56px; border: 2px solid var(--tinta-2); border-radius: 8px; background: var(--papel);
  font-family: var(--f-mat); font-size: 1.4rem; font-weight: 600; color: transparent; transition: color 0.3s, border-color 0.3s;
}
.ct-caixa.cheia .ct-num { color: var(--mar); border-color: var(--mar); }
.ct-token { width: 14px; height: 14px; border-radius: 50%; visibility: hidden; transition: background-color 0.3s; }
.ct-caixa.cheia .ct-token { visibility: visible; }
.ct-cor-a { background: var(--mar); }
.ct-cor-b { background: var(--alerta); }
.ct-cor-v { background: var(--mata); }
.ct-cor-t { background: var(--tinta); }
.ct-nome { max-width: 80px; font-size: 0.78rem; line-height: 1.3; text-align: center; color: var(--morto); }
.ct-vezes { margin-top: 16px; font-family: var(--f-mat); font-size: 1.2rem; color: var(--tinta-2); opacity: 0; transition: opacity 0.4s; }
.ct-vezes.ver { opacity: 1; }
@container (max-width: 420px) {
  .ct-num { width: 46px; height: 46px; font-size: 1.15rem; }
  .ct-vezes { margin-top: 11px; }
}
.ct-ordem { min-height: 1.5em; font-size: var(--t-0); font-weight: 600; color: var(--mar); }
.ct-cena:not(.com-ordem) .ct-ordem { display: none; }
.ct-res { align-self: stretch; display: flex; flex-direction: column; gap: 12px; }
.ct-tecnica { margin-top: 2px; font-weight: 600; color: var(--mata); }
.ct-pre { margin-right: 1px; }
.es-medidas b .fr { font-size: 0.7em; }
/* No telemóvel, a tabela fica só com os números: sem as contas pequenas nem as percentagens */
@container (max-width: 520px) {
  .es-tabela small { display: none; }
  .es-tabela { font-size: 0.88rem; }
  .es-tabela th, .es-tabela td { padding-inline: 3px; }
  .es-tabela th { font-size: 0.64rem; }
  .es-ficha { min-width: 1.9em; padding: 2px 6px; font-size: 0.95rem; }
  .es-dados { gap: 18px 5px; }
}
.es-nota { margin-top: 10px; font-size: var(--t-0); line-height: 1.5; color: var(--tinta-2); }

/* Comparação à parte, por baixo da demo: os dois gráficos na mesma escala e as medidas */
.es-comparar { margin-top: 18px; border-radius: 14px; background: var(--fundo); border: 1px solid var(--linha); transition: opacity 0.2s; }
.es-comparar > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px clamp(14px, 2.4vw, 22px); list-style: none; cursor: pointer;
  font-size: var(--t-2); font-weight: 600; color: var(--mar); border-radius: 14px;
}
.es-comparar > summary::-webkit-details-marker { display: none; }
.es-comparar > summary:hover { background: var(--realce); }
.es-comparar > summary .icone { width: 20px; height: 20px; flex: none; }
.es-comparar > summary span { flex: 1; }
.es-cmp-seta { transition: transform 0.2s; }
.es-comparar[open] .es-cmp-seta { transform: rotate(180deg); }
.es-comparar[open] > summary { border-radius: 14px 14px 0 0; }
.es-cmp-dentro { padding: 0 clamp(14px, 2.4vw, 22px) clamp(14px, 2.4vw, 22px); }
@media (max-width: 520px) { .es-comparar > summary { font-size: var(--t-1); } }
.es-comparar.desatualizada { opacity: 0.5; }
.es-cmp-dentro > .demo-dica { margin: 2px 0 12px; }
.es-cmp-grelha { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px 24px; }
.es-cmp-col { min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--papel); border: 1px solid var(--linha); }
.es-cmp-tit { font-weight: 700; color: var(--tinta); }
.es-cmp-tit small { font-weight: 500; color: var(--morto); }
.es-cmp-graf { margin: 6px 0 4px; }
.es-cmp-graf svg { display: block; width: 100%; max-width: 340px; height: auto; margin: 0 auto; overflow: visible; }
.es-cmp-graf figcaption { text-align: center; font-size: var(--t-0); color: var(--morto); }
.es-cmp-barra { stroke-width: 1.2; }
.es-cmp-barra.es-cmp-nao { fill: var(--realce); stroke: var(--mar); }
.es-cmp-barra.es-cmp-agr { fill: var(--realce-b); stroke: var(--alerta); }
.es-cmp-ponto { display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 3px; vertical-align: 1px; }
.es-cmp-tit.es-cmp-nao .es-cmp-ponto { background: var(--mar); }
.es-cmp-tit.es-cmp-agr .es-cmp-ponto { background: var(--alerta); }
/* As três medidas em destaque, no topo da comparação */
.es-cmp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin-bottom: 16px; }
.es-cmp-tile { padding: 12px 14px 12px; border-radius: 12px; background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra-leve); }
.es-cmp-tile-tit { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--morto); }
.es-cmp-par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.es-cmp-v span { display: block; font-size: 0.72rem; font-weight: 600; color: var(--morto); }
.es-cmp-v b { display: block; font-size: clamp(1.4rem, 1.15rem + 0.9vw, 1.8rem); font-weight: 700; line-height: 1.2; white-space: nowrap; }
.es-cmp-v b.longo { font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem); white-space: normal; }
.es-cmp-nao b { color: var(--mar); }
.es-cmp-agr b { color: var(--alerta); }
.es-cmp-dif { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--linha); font-size: var(--t-0); font-weight: 600; color: var(--tinta-2); }
.es-cmp-mediana { stroke: var(--mar); stroke-width: 2.2; stroke-dasharray: 5 4; }
.es-cmp-media { fill: var(--mata); }
.es-cmp-legenda { margin-top: 10px; font-size: var(--t-0); color: var(--morto); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.es-leg-media { display: inline-block; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--mata); }
.es-leg-mediana { display: inline-block; width: 18px; border-top: 2.2px dashed var(--mar); }

/* ── Programa ── */
.temas {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 18px;
}
.tema {
  display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 18px;
  position: relative;
  padding: 22px 22px 22px 18px; border: 1px solid var(--linha); border-radius: 12px; background: var(--papel);
  box-shadow: var(--sombra-leve);
}
.tema:has(.menu[open]) { z-index: 4; }
.picto { width: 60px; height: 60px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.picto .fino { stroke-width: 1.75; }
.picto .tenue { opacity: 0.5; }
.picto .p-cheio-mar { fill: var(--mar); stroke: none; }
.picto .p-cheio-alerta { fill: var(--alerta); stroke: none; }
.picto .p-cheio-tinta { fill: var(--tinta-2); stroke: none; }
.picto .p-mar { stroke: var(--mar); }
.picto .p-alerta { stroke: var(--alerta); }
.picto .p-tinta { stroke: var(--tinta-2); }
.picto .p-morto { stroke: var(--morto); }
.picto .p-fundo { fill: var(--realce); }
.picto .p-fundo-b { fill: var(--realce-b); }
.picto .p-ponto { fill: var(--mata); }
.picto .p-mata { stroke: var(--mata); }
.picto .p-papel { fill: var(--papel); }
.tema-corpo { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tema h3 { font-size: 1.1875rem; }
.tema-resumo { font-size: var(--t-1); color: var(--tinta-2); line-height: 1.5; }
.tema-vazio { margin-top: auto; padding-top: 6px; font-size: var(--t-0); color: var(--morto); }

/* Submenu de materiais: botão sempre no fundo do cartão, painel por cima dos cartões seguintes */
.menu { margin-top: auto; padding-top: 6px; }
.menu > summary { list-style: none; width: fit-content; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-botao { gap: 7px; padding: 7px 12px 7px 14px; font-size: var(--t-0); }
.menu-botao .icone { width: 16px; height: 16px; }
.menu[open] > .menu-botao { background: var(--realce); }
.menu-n {
  display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--realce); color: var(--mar); font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.menu[open] .menu-n { background: var(--papel); }
.menu-seta { transition: transform 0.2s; }
.menu[open] .menu-seta { transform: rotate(180deg); }
.menu-painel {
  position: absolute; left: 12px; right: 12px; top: calc(100% - 12px); z-index: 5;
  max-height: min(60vh, 440px); overflow-y: auto; padding: 6px 8px 8px;
  border-radius: 12px; background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra);
}
.menu-grupo {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 4px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--morto);
}
.menu-grupo .icone { width: 15px; height: 15px; color: var(--mar); }
.menu-painel ul { list-style: none; margin: 0; padding: 0; }
.menu-item {
  display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 8px;
  color: var(--tinta); text-decoration: none; font-size: var(--t-1); line-height: 1.35;
}
.menu-item:hover { background: var(--realce); color: var(--mar); }
.menu-item b { flex: none; min-width: 4.6em; font-size: var(--t-0); font-weight: 700; color: var(--mar); }

.avaliacao { margin-top: clamp(44px, 6vw, 64px); }
.avaliacao h3 { font-size: var(--t-3); margin-bottom: 18px; }
.datas {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px;
}
.data {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 16px; border-radius: 12px; background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra-leve);
}
.data time {
  display: grid; place-items: center; align-content: center; height: 70px;
  border-radius: 10px; background: var(--realce); color: var(--mar); line-height: 1;
}
.data-dia { font-size: 1.65rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.data-mes { margin-top: 5px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.data-nome { font-weight: 600; line-height: 1.3; }
.data-quando { font-size: var(--t-0); color: var(--morto); margin-top: 2px; }
.data-falta { margin-top: 8px; font-size: var(--t-0); font-weight: 600; color: var(--mata); }
.data.passada { opacity: 0.6; }
.data.passada .data-falta { color: var(--morto); }

/* ── Rodapé ── */
.rodape { border-top: 1px solid var(--linha); padding-block: 36px 52px; color: var(--morto); font-size: var(--t-1); }
.rodape .contentor { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px 32px; }
.rodape .marca { font-size: 1.0625rem; }
.rodape p { line-height: 1.5; }
.rodape a { font-weight: 500; }

/* ── Diálogos ── */
dialog { padding: 0; border: 0; color: var(--tinta); background: var(--papel); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5); }
dialog::backdrop { background: rgb(8 16 22 / 0.74); }

.leitor {
  width: min(100vw - 24px, 1080px); height: min(100dvh - 24px, 1400px);
  max-width: none; max-height: none; border-radius: 14px; overflow: hidden;
  flex-direction: column;
}
.leitor[open] { display: flex; }
.barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--linha); background: var(--papel);
}
.barra-titulo { flex: 1 1 160px; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-grupo { display: flex; align-items: center; gap: 6px; }
.leitor-pagina { display: flex; align-items: center; gap: 6px; font-size: var(--t-1); color: var(--morto); font-variant-numeric: tabular-nums; }
.leitor-pagina input {
  width: 3.6em; padding: 6px 4px; text-align: center; border-radius: 8px;
  border: 1px solid var(--linha); background: var(--fundo); color: var(--tinta);
  font-variant-numeric: tabular-nums;
}
.segmentado { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--linha); background: var(--fundo); }
.segmentado button {
  padding: 5px 12px; border-radius: 999px; border: 0; background: none; cursor: pointer;
  font-size: var(--t-0); font-weight: 600; color: var(--morto);
}
.segmentado button[aria-pressed="true"] { background: var(--mar); color: var(--sobre-cor); }
.barra .botao { padding: 7px 14px; }
.folhas {
  position: relative; flex: 1; overflow: auto; overscroll-behavior: contain;
  padding: 16px; background: var(--fundo-2);
}
.folhas:focus { outline: none; }
.folha {
  margin: 0 auto 16px; background: var(--papel); box-shadow: var(--sombra);
  border-radius: 2px; overflow: hidden;
}
.folha canvas { display: block; width: 100%; height: 100%; }
.estado {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px;
  padding: 24px; text-align: center; color: var(--morto); background: var(--fundo-2);
}
.leitor-corpo { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
@media (max-width: 640px) {
  .leitor { width: 100vw; height: 100dvh; border-radius: 0; }
  .barra-titulo { flex-basis: calc(100% - 60px); order: -1; }
  .barra [data-fechar] { order: -1; }
  .folhas { padding: 10px; }
}

.cinema { width: min(100vw - 24px, 1120px); max-width: none; max-height: calc(100dvh - 24px); border-radius: 14px; overflow: auto; }
.cinema video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--fundo-video); }
.cinema-rodape { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 16px 18px; }
.cinema-info h3 { font-size: var(--t-3); color: var(--mar); }
.cinema-info p { margin-top: 2px; color: var(--morto); font-size: var(--t-1); }
@media (max-width: 640px) { .cinema { width: 100vw; border-radius: 0; } }

/* ── Quizzes: um cartão por tópico, numa faixa com scroll horizontal, como em Álgebra Linear ── */
/* A margem negativa com o mesmo padding dá espaço às sombras sem desalinhar os cartões do cabeçalho */
.quizzes {
  display: grid; grid-auto-flow: column; grid-auto-columns: 220px; gap: 14px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  margin: -6px -12px -22px; padding: 6px 12px 22px; scroll-padding-inline: 12px;
  scrollbar-width: thin; scrollbar-color: var(--filete) transparent;
}
.quizzes.mais-dir { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.quizzes.mais-esq { mask-image: linear-gradient(to right, transparent, #000 40px); }
.quizzes.mais-esq.mais-dir { mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
@media (max-width: 640px) {
  /* no telemóvel a faixa vai até às bordas do ecrã, desliza-se com o dedo e dispensa o esbatimento */
  .quizzes {
    grid-auto-columns: min(78%, 280px); margin-inline: calc(-1 * var(--margem));
    padding-inline: var(--margem); scroll-padding-inline: var(--margem); mask-image: none !important;
  }
}
.quiz-cartao {
  scroll-snap-align: start; scroll-margin-top: 90px;
  display: flex; flex-direction: column; gap: 10px; padding: 18px;
  border-radius: 14px; background: var(--papel); border: 1px solid var(--linha); box-shadow: var(--sombra-leve);
}
.quiz-cartao h3 { font-size: 1.0625rem; line-height: 1.3; }
.quiz-cartao-meta { font-size: var(--t-0); color: var(--morto); }
.quiz-cartao .botao { margin-top: auto; align-self: flex-start; }
.quiz-cartao.inativo { background: transparent; box-shadow: none; border: 1.5px dashed var(--filete); }
.quiz-cartao.inativo h3 { color: var(--tinta-2); font-weight: 600; }
.quiz-melhor { font-size: var(--t-0); font-weight: 600; color: var(--mata); }

/* ── Quizzes: notação própria (fórmulas destacadas e marcas de verificação) ── */
.mbloco {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 8px 0; padding: 3px 0; max-width: 100%;
  overflow-x: auto; overflow-y: hidden; font-family: var(--f-mat); font-weight: 500;
}
.mok { color: var(--mata); font-weight: 700; }
/* Linhas de uma resolução, umas por baixo das outras, numeradas */
.mlinhas { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-family: var(--f-mat); font-weight: 500; }
.mlinhas b { display: inline-block; min-width: 1.6em; color: var(--mar); }
/* Gráfico em V das funções com módulo, com a reta horizontal e a zona sombreada */
.qgraf { display: block; max-width: 100%; height: auto; }
.qgraf .grelha { stroke: var(--linha); stroke-width: 1; }
.qgraf .eixo { stroke: var(--morto); stroke-width: 1.4; }
.qgraf text { fill: var(--tinta-2); font: 500 11px var(--f-mat); text-anchor: middle; stroke: var(--papel); stroke-width: 3px; paint-order: stroke; stroke-linejoin: round; }
.qgraf text.ey { text-anchor: end; }
.qgraf .funcao { fill: none; stroke: var(--mar); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.qgraf .horiz { stroke: var(--alerta); stroke-width: 2; }
.qgraf .ponto { fill: var(--papel); stroke: var(--tinta); stroke-width: 2; }
.qgraf .zona { fill: var(--realce); opacity: 0.8; }
.qgraf .barra { fill: var(--realce); stroke: var(--mar); stroke-width: 1.2; }
.qgraf.qmini text { font-size: 10px; font-style: italic; }
/* Caixas do método das caixas, na contagem */
.mcaixa { display: inline-flex; justify-content: center; min-width: 1.9em; padding: 2px 6px; margin-right: 4px; border: 1.5px solid var(--tinta-2); border-radius: 3px; font-family: var(--f-mat); font-weight: 500; }
/* Tabelas pequenas das perguntas, com a grandeza na primeira coluna, como na sebenta */
.qtab-caixa { max-width: 100%; overflow-x: auto; margin: 4px 0; }
.qtab { border-collapse: collapse; font-family: var(--f-mat); font-weight: 500; font-variant-numeric: tabular-nums; }
.qtab th, .qtab td { padding: 4px 10px; border: 1px solid var(--linha); text-align: center; white-space: nowrap; }
.qtab th { font-family: var(--f-texto); font-weight: 500; color: var(--tinta-2); background: var(--fundo); text-align: left; white-space: normal; line-height: 1.25; min-width: 4.5em; }
@media (max-width: 420px) {
  .qtab th { max-width: 6.5em; font-size: 0.85em; padding: 3px 6px; }
  .qtab td { padding: 3px 5px; }
}
/* Disposição da regra de Ruffini, como na sebenta */
.qruffini { border-collapse: collapse; margin: 6px 0; font-family: var(--f-mat); font-weight: 500; font-variant-numeric: tabular-nums; }
.qruffini td { border: 0; padding: 3px 12px; text-align: right; white-space: nowrap; }
.qruffini td.vert { border-right: 1.5px solid var(--tinta-2); color: var(--mar); font-weight: 700; }
.qruffini tr.soma td { border-top: 1.5px solid var(--tinta-2); }
.qruffini td.resto { color: var(--alerta); font-weight: 700; box-shadow: inset 1.5px 0 0 var(--tinta-2); }
@media (max-width: 420px) { .qruffini td { padding: 3px 7px; } }
/* Reta numérica dos intervalos, como na sebenta */
.qreta { display: block; max-width: 100%; height: auto; }
.qreta .eixo, .qreta .marca { stroke: var(--morto); stroke-width: 1.2; }
.qreta text { fill: var(--tinta-2); font: 500 12px var(--f-mat); text-anchor: middle; }
.qreta .seg { stroke-width: 3.5; stroke-linecap: round; }
.qreta .c0 { stroke: var(--mar); fill: var(--mar); }
.qreta .c1 { stroke: var(--alerta); fill: var(--alerta); }
.qreta circle { stroke-width: 2; }
.qreta circle.aberta { fill: var(--papel); }
/* Barra dividida em partes iguais, como na sebenta, com as partes pintadas em tom pastel */
.qbarra { display: block; max-width: 100%; height: auto; }
.qbarra rect { fill: var(--papel); stroke: var(--mar); stroke-width: 1.5; }
.qbarra rect.p { fill: color-mix(in srgb, var(--mar) 30%, var(--papel)); }
.mnok { color: var(--alerta); font-weight: 700; }

/* ── Quizzes: janela ── */
.quiz {
  width: min(100vw - 24px, 880px); height: min(100dvh - 24px, 1000px);
  max-width: none; max-height: none; border-radius: 14px; overflow: hidden; flex-direction: column;
}
.quiz[open] { display: flex; }
.quiz-contador { font-size: var(--t-0); color: var(--morto); font-variant-numeric: tabular-nums; white-space: nowrap; }
.quiz-progresso { display: flex; gap: 3px; padding: 10px 16px 0; }
.quiz-progresso:empty { display: none; }
.quiz-progresso span { flex: 1; height: 6px; border-radius: 3px; background: var(--linha); }
.quiz-progresso .atual { background: var(--mar); opacity: 0.45; }
.quiz-progresso .certa { background: var(--mata); }
.quiz-progresso .errada { background: var(--alerta); }
.quiz-corpo { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 22px clamp(16px, 4vw, 36px) 30px; }
.quiz-rodape {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--linha); background: var(--papel);
}
.quiz-dica { font-size: var(--t-0); color: var(--morto); }
.quiz-seccao { margin-bottom: 10px; color: var(--mar); }
.quiz-enunciado { font-size: 1.125rem; line-height: 1.6; }
.quiz-opcoes {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 10px;
}
.quiz-opcao {
  display: flex; align-items: center; gap: 14px; width: 100%; height: 100%; min-width: 0;
  padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--linha); background: var(--papel);
  text-align: left; transition: border-color 0.15s, background-color 0.15s;
}
.quiz-opcao:hover:not(:disabled) { border-color: var(--mar); }
.quiz-opcao:disabled { cursor: default; }
.quiz-letra {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--mar); color: var(--mar); font-size: var(--t-0); font-weight: 700;
}
/* As frações empilhadas passam a linha por pouco: um espaço por cima e por baixo evita a barra vertical */
.quiz-texto { min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-block: 3px; line-height: 1.5; }
.quiz-opcao.certa { border-color: var(--mata); background: var(--mata-suave); }
.quiz-opcao.certa .quiz-letra { background: var(--mata); border-color: var(--mata); color: var(--sobre-cor); }
.quiz-opcao.errada { border-color: var(--alerta); background: var(--alerta-suave); }
.quiz-opcao.errada .quiz-letra { background: var(--alerta); border-color: var(--alerta); color: var(--sobre-cor); }
.quiz-opcao.apagada { opacity: 0.55; }
.quiz-retorno { margin-top: 18px; }
.quiz-veredito { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.quiz-veredito .icone { width: 20px; height: 20px; stroke-width: 2.2; }
.quiz-veredito.certo { color: var(--mata); }
.quiz-veredito.errado { color: var(--alerta); }
.quiz-resolucao, .revisao { margin-top: 12px; border: 1px solid var(--linha); border-radius: 12px; background: var(--fundo-2); }
.quiz-resolucao > summary, .revisao > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--mar);
}
.quiz-resolucao > summary::-webkit-details-marker, .revisao > summary::-webkit-details-marker { display: none; }
.quiz-resolucao > summary::before, .revisao > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.2s;
}
.quiz-resolucao[open] > summary::before, .revisao[open] > summary::before { transform: rotate(45deg); }
.passos { margin: 0; padding: 2px 20px 16px 42px; display: grid; gap: 12px; line-height: 1.6; }
.passos li::marker { color: var(--mar); font-weight: 700; }
.passos > li, .quiz-opcoes > li { min-width: 0; }

/* Entrada de cada quiz: cabeçalho do tópico, números, secções, como funciona, melhor resultado e
   ligações para rever. Tons pastel e contornos neutros, sem faixas de cor */
.qi { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.qi-cab { display: flex; align-items: center; gap: 18px; }
.qi-icone { flex: none; display: grid; place-items: center; width: 68px; height: 68px; border-radius: 20px; background: var(--realce); color: var(--mar); }
.qi-icone .icone { width: 36px; height: 36px; stroke-width: 1.5; }
.qi-tema { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--t-0); color: var(--morto); }
.qi-cab h3 { margin: 4px 0 4px; font-size: var(--t-4); line-height: 1.15; color: var(--mar); }
.qi-sub { color: var(--tinta-2); font-size: var(--t-1); }
.qi-numeros { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.qi-numeros li {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--mar) 8%, var(--papel)); border: 1px solid var(--linha);
}
.qi-numeros strong { font-size: 1.85rem; line-height: 1; font-weight: 700; color: var(--mar); font-variant-numeric: tabular-nums; }
.qi-numeros span { font-size: var(--t-0); color: var(--tinta-2); }
.qi-melhor {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 14px 18px; border-radius: 14px;
  background: var(--mata-suave); border: 1px solid color-mix(in srgb, var(--mata) 25%, var(--linha));
}
.qi-melhor-txt { display: flex; flex-direction: column; gap: 2px; }
.qi-melhor .rotulo { margin: 0; color: var(--mata); }
.qi-melhor-txt p { color: var(--tinta-2); }
.qi-melhor-txt strong { font-size: 1.5rem; color: var(--mata); font-variant-numeric: tabular-nums; }
.qi-melhor-txt small { color: var(--morto); font-size: var(--t-0); }
.qi-barra { flex: 1 1 220px; display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 3px; }
.qi-barra span { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--mata) 18%, var(--papel)); }
.qi-barra span.cheio { background: var(--mata); }
.qi-bloco h4 { margin-bottom: 10px; font-size: var(--t-0); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--morto); }
.qi-seccoes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.qi-seccoes li { padding: 6px 12px; border-radius: 999px; background: var(--realce); color: var(--mar); font-size: var(--t-0); font-weight: 600; }
.qi-passos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.qi-passos li { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--linha); background: var(--papel); }
.qi-n {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--mar); color: var(--sobre-cor); font-size: var(--t-0); font-weight: 700;
}
.qi-passos p { font-size: var(--t-0); line-height: 1.45; color: var(--tinta-2); }
.qi-passos strong { display: block; margin-bottom: 2px; font-size: var(--t-1); color: var(--tinta); }
.qi-rever { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) {
  .qi { gap: 20px; }
  .qi-cab { align-items: flex-start; gap: 14px; }
  .qi-icone { width: 52px; height: 52px; border-radius: 16px; }
  .qi-icone .icone { width: 28px; height: 28px; }
  .qi-cab h3 { font-size: var(--t-3); }
  .qi-numeros li { padding: 12px; }
  .qi-numeros strong { font-size: 1.45rem; }
  .qi-passos { grid-template-columns: 1fr; }
}

.resultado-topo { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 34px; }
.resultado-nota { font-size: 1.5rem; font-weight: 600; color: var(--morto); font-variant-numeric: tabular-nums; }
.resultado-nota span { font-size: 4.2rem; font-weight: 700; line-height: 1; color: var(--mar); }
.resultado-nivel { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.resultado-nome { font-size: var(--t-3); font-weight: 700; }
.escala { list-style: none; margin: 22px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.escala li { display: flex; flex-direction: column; padding: 8px 4px 0; border-top: 5px solid var(--linha); font-size: var(--t-0); color: var(--morto); line-height: 1.3; }
.escala li.atual { border-top-color: var(--mar); color: var(--tinta); font-weight: 600; }
.escala small { font-weight: 400; font-variant-numeric: tabular-nums; }
.resultado h3 { margin: 28px 0 10px; font-size: 1.0625rem; }
.resultado-seccoes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--linha); }
.resultado-seccoes li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 6px 14px;
  padding: 10px 2px; border-bottom: 1px solid var(--linha); font-size: var(--t-1);
}
.sec-marca { display: grid; place-items: center; }
.sec-marca .icone { width: 18px; height: 18px; stroke-width: 2.2; }
.resultado-seccoes li.ok .sec-marca { color: var(--mata); }
.resultado-seccoes li.rever .sec-marca { color: var(--alerta); }
.sec-conta { color: var(--morto); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sec-rever { color: var(--mar); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.revisao ol { list-style: none; margin: 0; padding: 4px 14px 14px; display: grid; gap: 12px; }
.revisao li { padding: 14px 16px; border: 1px solid var(--linha); border-radius: 12px; background: var(--papel); }
.rev-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.rev-n {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--mar); color: var(--mar); font-size: var(--t-0); font-weight: 700; flex: none;
}
.rev-icone { width: 18px; height: 18px; margin-left: auto; stroke-width: 2.2; }
.revisao li.ok .rev-icone { color: var(--mata); }
.revisao li.rever .rev-icone { color: var(--alerta); }
.rev-resposta { margin-top: 8px; font-size: var(--t-1); color: var(--tinta-2); }
.revisao .quiz-enunciado { font-size: var(--t-2); }
@media (max-width: 640px) {
  .quiz { width: 100vw; height: 100dvh; border-radius: 0; }
  .quiz-enunciado { font-size: var(--t-2); }
  .resultado-seccoes li { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .resultado-seccoes .sec-rever { grid-column: 2 / -1; justify-self: start; }
  .passos { padding-left: 34px; padding-right: 14px; }
}
/* Telemóveis muito estreitos: menos margem e fórmulas um pouco menores, para caberem sem deslizar */
@media (max-width: 360px) {
  .quiz-corpo { padding-inline: 12px; }
  .passos { padding-left: 28px; padding-right: 8px; }
  .mbloco { font-size: 0.9em; gap: 6px 10px; }
  .quiz-opcao { padding: 10px; gap: 10px; }
}

/* ── A Incógnita (xis.js), o x com olhos que aparece de vez em quando, feita a partir da
   Escadinha de Álgebra Linear. Cores próprias, porque com as do tema ficava um negativo ── */
.xs-boneco { --xs-corpo: #FFFFFF; --xs-contorno: #1F4E6B; --xs-tinta: #1F4E6B; --xs-pupila: #1A1A1A; --xs-bochecha: rgb(155 59 31 / 0.28); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .xs-boneco { --xs-corpo: #F1F5F8; --xs-contorno: #7CC0E2; --xs-pupila: #16242E; --xs-bochecha: rgb(214 96 64 / 0.38); }
}
:root[data-theme="dark"] .xs-boneco { --xs-corpo: #F1F5F8; --xs-contorno: #7CC0E2; --xs-pupila: #16242E; --xs-bochecha: rgb(214 96 64 / 0.38); }
.xs-boneco {
  position: fixed; left: 0; top: 0; z-index: 45; padding: 0; border: 0; background: none;
  cursor: pointer; transform-origin: 50% 100%; -webkit-tap-highlight-color: transparent;
}
.xs-boneco svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 4px rgb(0 0 0 / 0.18)); }
.xs-boneco:focus-visible { outline: 2.5px solid var(--mar); outline-offset: 4px; border-radius: 10px; }
.xs-traco { fill: none; stroke: var(--xs-contorno); stroke-width: 8.5; stroke-linecap: round; }
.xs-mao { fill: var(--xs-contorno); }
.xs-cabeca { fill: var(--xs-corpo); stroke: var(--xs-contorno); stroke-width: 3; }
.xs-olho { fill: #FFFFFF; stroke: var(--xs-tinta); stroke-width: 2; }
.xs-pupilas { fill: var(--xs-pupila); transition: transform 0.18s ease-out; }
.xs-brilho { fill: #FFFFFF; }
.xs-boca { fill: none; stroke: var(--xs-tinta); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.xs-boneco[data-cara="feliz"] .xs-boca, .xs-boneco[data-cara="surpresa"] .xs-boca { fill: var(--xs-tinta); stroke-width: 2; }
.xs-bochecha { fill: var(--xs-bochecha); }
.xs-pe { fill: var(--xs-contorno); }
.xs-olhos { transform-origin: 32px 31px; transition: transform 0.07s; }
.xs-piscar .xs-olhos { transform: scaleY(0.1); }
/* A andar: os pés alternam e o corpo baloiça; sentada: os pés balançam */
@keyframes xs-passo { to { transform: translateY(-3.5px); } }
@keyframes xs-baloico { from { transform: translateY(0) rotate(-2.5deg); } to { transform: translateY(-2.5px) rotate(2.5deg); } }
@keyframes xs-balanca { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
.xs-corpo { transform-origin: 32px 72px; }
.xs-andar .xs-corpo { animation: xs-baloico 0.3s ease-in-out infinite alternate; }
.xs-andar .xs-pe-e { animation: xs-passo 0.3s ease-in-out infinite alternate; }
.xs-andar .xs-pe-d { animation: xs-passo 0.3s ease-in-out infinite alternate-reverse; }
.xs-pe-e, .xs-pe-d { transform-origin: 32px 37px; }
@keyframes xs-acenar-e { to { transform: rotate(-16deg); } }
@keyframes xs-acenar-d { to { transform: rotate(16deg); } }
.xs-braco { transform-origin: 32px 35px; }
.xs-boneco[data-cara="feliz"] .xs-braco-e { animation: xs-acenar-e 0.32s ease-in-out infinite alternate; }
.xs-boneco[data-cara="feliz"] .xs-braco-d { animation: xs-acenar-d 0.32s ease-in-out infinite alternate; }
.xs-com-paraquedas .xs-braco { animation: none !important; }
.xs-sentada .xs-pe-e { animation: xs-balanca 0.9s ease-in-out infinite alternate; }
.xs-sentada .xs-pe-d { animation: xs-balanca 0.9s ease-in-out infinite alternate-reverse; }
/* Paraquedas, fio e soneca (só aparecem nessas cenas) */
.xs-extra { display: none; }
.xs-com-paraquedas .xs-paraquedas, .xs-no-fio .xs-fio { display: inline; }
.xs-fio { stroke: var(--morto); stroke-width: 1.3; }
.xs-cordas { fill: none; stroke: var(--morto); stroke-width: 1; }
.xs-boneco { --xs-gomo-a: var(--alerta); --xs-gomo-b: var(--xs-corpo); }
.xs-gomo { stroke: var(--xs-gomo-a); stroke-width: 1.5; stroke-linejoin: round; }
.xs-gomo-a { fill: var(--xs-gomo-a); }
.xs-gomo-b { fill: var(--xs-gomo-b); }
.xs-paraquedas { transform-origin: 32px 8px; transition: transform 0.8s cubic-bezier(0.5, 0, 0.75, 0.45), opacity 0.8s; }
.xs-recolher .xs-paraquedas { transform: translate(calc(var(--lado, 1) * 30px), 46px) rotate(calc(var(--lado, 1) * 80deg)) scale(0.6, 0.3); opacity: 0; }
/* Épocas: Halloween (chapéu de bruxa, vassoura) e Natal (gorro, trenó) */
.xs-boneco[data-epoca="halloween"] { --xs-gomo-a: #F28C28; --xs-gomo-b: #3A2A4E; }
.xs-boneco[data-epoca="natal"] { --xs-gomo-a: #C8372D; --xs-gomo-b: #FBFBFB; }
.xs-boneco[data-epoca="halloween"] .xs-chapeu, .xs-boneco[data-epoca="natal"] .xs-gorro,
.xs-de-vassoura .xs-vassoura, .xs-de-treno .xs-treno { display: inline; }
.xs-chapeu-aba, .xs-chapeu-cone { fill: #3A2A4E; stroke: #7A62A0; stroke-width: 1.2; stroke-linejoin: round; }
.xs-chapeu-fita { fill: #F28C28; }
.xs-gorro-pano { fill: #C8372D; stroke: #A32A21; stroke-width: 1; stroke-linejoin: round; }
.xs-gorro-pelo { fill: #FBFBFB; stroke: #D3DAE0; stroke-width: 1; }
.xs-cabo { fill: none; stroke: #7A4E2A; stroke-width: 3.2; stroke-linecap: round; }
.xs-palha { fill: #D9A441; stroke: #A87A22; stroke-width: 1.2; stroke-linejoin: round; }
.xs-atilho { stroke: #7A4E2A; stroke-width: 2.4; stroke-linecap: round; }
.xs-treno-caixa { fill: #C8372D; stroke: #A32A21; stroke-width: 1.2; }
.xs-treno-friso { stroke: #F4D06F; stroke-width: 1.6; stroke-linecap: round; }
.xs-treno-patim { fill: none; stroke: #6B4A2F; stroke-width: 2.6; stroke-linecap: round; }
/* A vassoura e o trenó apontam para onde ela vai; no trenó, os pés ficam lá dentro */
.xs-vassoura, .xs-treno { transform-origin: 32px 0; }
.xs-esq .xs-vassoura, .xs-esq .xs-treno { transform: scaleX(-1); }
.xs-de-treno .xs-pes { display: none; }
.xs-neve {
  position: fixed; z-index: 44; border-radius: 50%; pointer-events: none;
  background: #FFFFFF; box-shadow: 0 0 0 1px rgb(31 78 107 / 0.18);
}
@keyframes xs-respirar { 50% { transform: scale(1.035, 0.965); } }
.xs-dormir .xs-corpo { animation: xs-respirar 2.4s ease-in-out infinite; }
.xs-dormir .xs-olhos { transform: scaleY(0.1); transition-duration: 0.6s; }
.xs-bocejo .xs-olhos { transform: scaleY(0.45); transition-duration: 0.3s; }
@keyframes xs-z {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(22px, -48px) scale(1.15); }
}
.xs-z {
  position: absolute; left: 60%; top: 16%; pointer-events: none;
  font-family: var(--f-mat); font-style: italic; font-weight: 600; line-height: 1; color: var(--mar);
  animation: xs-z 2.4s ease-out forwards;
}
.xs-balao {
  position: absolute; left: 50%; bottom: calc(100% + 10px); padding: 6px 11px; border-radius: 12px;
  border: 1.5px solid var(--mar); background: var(--papel); color: var(--mar);
  font-family: var(--f-texto); font-size: 0.85rem; font-weight: 600; pointer-events: none;
  width: max-content; max-width: min(78vw, 290px); text-align: center; line-height: 1.35;
  opacity: 0; transform: translate(calc(-50% + var(--desvio, 0px)), 6px) scale(0.9); transition: opacity 0.2s, transform 0.2s;
}
.xs-balao::after {
  content: ""; position: absolute; left: calc(50% - var(--desvio, 0px)); top: 100%; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-right: 1.5px solid var(--mar); border-bottom: 1.5px solid var(--mar); background: var(--papel); transform: rotate(45deg);
}
.xs-fala .xs-balao { opacity: 1; transform: translate(calc(-50% + var(--desvio, 0px)), 0); }
.xs-aviso {
  position: fixed; left: 50%; bottom: 22px; z-index: 46; display: grid; gap: 2px; width: max-content; max-width: min(92vw, 430px);
  padding: 12px 18px; border-radius: 14px; border: 1px solid var(--linha); background: var(--papel); box-shadow: var(--sombra);
  font-size: var(--t-1); line-height: 1.45; color: var(--tinta-2); text-align: center;
  opacity: 0; transform: translate(-50%, 14px); transition: opacity 0.35s, transform 0.35s; pointer-events: none;
}
.xs-aviso strong { color: var(--mar); }
.xs-aviso.ver { opacity: 1; transform: translate(-50%, 0); }


/* ── Foco e movimento ── */
:is(a, button, input, [tabindex]):focus-visible { outline: 2.5px solid var(--mar); outline-offset: 3px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Novidades ── */
.novo {
  display: inline-block; margin-left: 4px; padding: 1px 8px 2px; border-radius: 999px;
  background: var(--alerta); color: var(--papel); font-family: var(--f-texto); font-size: 0.72rem;
  font-weight: 600; font-style: normal; letter-spacing: 0.02em; line-height: 1.45; text-transform: none;
  vertical-align: 0.15em; white-space: nowrap;
}
h2 .novo { font-size: 0.8rem; vertical-align: 0.5em; }
.nav a.tem-novo { position: relative; }
.nav a.tem-novo::after {
  content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--alerta);
}
.novidades { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.novidades .rotulo { margin: 0; color: var(--alerta); }
.novidades ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.novidades a {
  display: inline-block; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--linha);
  background: var(--papel); color: var(--tinta-2); text-decoration: none; font-size: var(--t-0);
}
.novidades a:hover { border-color: var(--alerta); color: var(--alerta); }

/* ── Cor de acento: terracota, como na página pessoal (paulohcrocha.com) ──
   Os rótulos pequenos em maiúsculas e as etiquetas «Novo» ficam a terracota. */
:root { --acento: #B04A22; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --acento: #F0A07A; } }
:root[data-theme="dark"] { --acento: #F0A07A; }
:is(.rotulo, .demo-rotulo, .es-cmp-tile-tit) { color: var(--acento); }
.novo { background: var(--acento); }
