/*
 * Crivo — folha de estilo única.
 *
 * Registro visual: caderno de laboratório impresso. Tipografia serifada para o texto,
 * monoespaçada para tudo que é dado (hashes, contagens, rótulos de seção), fios finos
 * no lugar de caixas, e a malha da peneira como textura de fundo — crivo, afinal.
 *
 * Sem dependência externa: a política de segurança da aplicação é default-src 'self',
 * então nada de fontes ou scripts de CDN. As famílias abaixo são pilhas locais.
 */

:root {
    color-scheme: light dark;

    --papel: #f7f4ec;
    --papel-fundo: #efebe0;
    --tinta: #15181a;
    --tinta-suave: #585a52;
    --fio: #d8d2c2;
    --fio-forte: #b9b2a0;

    /* Verdete: o lado do método. Sépia: o lado de quem participa. */
    --verdete: #1e5c4b;
    --verdete-claro: #2d7a64;
    --sepia: #8a5424;

    --medida: 34rem;
    --serifada: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
        "URW Palladio L", Georgia, "Times New Roman", serif;
    --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono",
        "DejaVu Sans Mono", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --papel: #121417;
        --papel-fundo: #0d0f11;
        --tinta: #e8e4da;
        --tinta-suave: #9d9a90;
        --fio: #2a2d31;
        --fio-forte: #3d4147;
        --verdete: #71bda6;
        --verdete-claro: #8fd3bd;
        --sepia: #c99465;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

body {
    margin: 0;
    background-color: var(--papel);
    /* A malha da peneira: pontos finos, quase imperceptíveis, que densificam no topo. */
    background-image:
        radial-gradient(circle at center, var(--fio) 0.6px, transparent 0.7px),
        linear-gradient(var(--papel-fundo), var(--papel) 60rem);
    background-size: 14px 14px, 100% 100%;
    color: var(--tinta);
    font-family: var(--serifada);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* ---------- estrutura ---------- */

.pular {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--tinta);
    color: var(--papel);
    padding: 0.6rem 1rem;
    z-index: 10;
}

.pular:focus {
    left: 0.5rem;
    top: 0.5rem;
}

.faixa {
    max-width: 62rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (max-width: 40rem) {
    .faixa {
        padding: 0 1rem;
    }
}

section {
    padding: 3.5rem 0;
    border-top: 1px solid var(--fio);
}

.rotulo {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--tinta-suave);
    margin: 0 0 0.75rem;
}

h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.15;
    text-wrap: balance;
}

h2 {
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
    margin: 0 0 1.25rem;
}

h3 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

p {
    max-width: var(--medida);
}

a {
    color: inherit;
    text-decoration-color: var(--verdete);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
    transition: color 160ms ease;
}

a:hover {
    color: var(--verdete);
}

a:focus-visible {
    outline: 2px solid var(--verdete);
    outline-offset: 3px;
    border-radius: 2px;
}

code,
.mono {
    font-family: var(--mono);
    font-size: 0.85em;
}

/* ---------- cabeçalho ---------- */

.topo {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--fio);
    flex-wrap: wrap;
}

.marca {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.marca span {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tinta-suave);
    margin-left: 0.6rem;
}

/* A marca do Crivo e, ao lado, quem o mantém: a PsiGama, com o logo ψγ. */
.marcas {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

.por-psigama {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: var(--tinta-suave);
    text-decoration: none;
}

.por-psigama:hover,
.por-psigama:focus-visible {
    color: var(--verdete);
}

.logo-psigama {
    width: 1.2rem;
    height: 1.2rem;
    flex: none;
}

.logo-psigama .c {
    stroke: #3b3f8f;
}

.logo-psigama .g {
    stroke: #a07a2c;
}

@media (prefers-color-scheme: dark) {
    .logo-psigama .c {
        stroke: #9ea2ec;
    }

    .logo-psigama .g {
        stroke: #d8b25e;
    }
}

.navegacao {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

/* ---------- abertura ---------- */

.abertura {
    padding: 4.5rem 0 3.5rem;
    border-top: none;
}

.abertura h1 {
    font-size: clamp(2.6rem, 1.6rem + 4.4vw, 4.4rem);
    margin: 0 0 0.5rem;
}

.chamada {
    font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
    color: var(--tinta-suave);
    max-width: 30rem;
    margin: 0 0 2rem;
}

.tese {
    font-size: 1.1rem;
    max-width: 36rem;
}

.tese strong {
    font-weight: 600;
    box-shadow: inset 0 -0.45em 0 color-mix(in srgb, var(--verdete) 16%, transparent);
}

.epigrafe {
    margin: 2.5rem 0 0;
    padding-left: 1.25rem;
    border-left: 2px solid var(--verdete);
    font-style: italic;
    color: var(--tinta-suave);
    max-width: 28rem;
}

.acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2.5rem;
}

.botao {
    display: inline-block;
    padding: 0.7rem 1.3rem;
    border: 1px solid var(--tinta);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.botao-cheio {
    background: var(--tinta);
    color: var(--papel);
}

.botao-cheio:hover {
    background: var(--verdete);
    border-color: var(--verdete);
    color: #fff;
}

.botao-vazio:hover {
    border-color: var(--verdete);
    color: var(--verdete);
}

/* ---------- aparecer ---------- */

.aparece {
    animation: subir 620ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.aparece:nth-child(2) { animation-delay: 70ms; }
.aparece:nth-child(3) { animation-delay: 140ms; }
.aparece:nth-child(4) { animation-delay: 210ms; }
.aparece:nth-child(5) { animation-delay: 280ms; }

@keyframes subir {
    from {
        opacity: 0;
        transform: translateY(0.6rem);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- problema e resposta ---------- */

.confronto {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2.5rem;
    border-top: 1px solid var(--fio);
    margin-top: 2rem;
}

.confronto > div {
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--fio);
}

.confronto .hoje {
    color: var(--tinta-suave);
}

.confronto .hoje::before {
    content: "hoje";
    display: block;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fio-forte);
    margin-bottom: 0.3rem;
}

.confronto .crivo::before {
    content: "no Crivo";
    display: block;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--verdete);
    margin-bottom: 0.3rem;
}

.confronto p {
    margin: 0;
    max-width: none;
}

@media (max-width: 44rem) {
    .confronto {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .confronto .hoje {
        border-bottom: none;
        padding-bottom: 0.4rem;
    }
}

/* ---------- a corrente do protocolo ---------- */

.corrente {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
    counter-reset: etapa;
}

.corrente li {
    position: relative;
    padding: 0 0 1.9rem 3.25rem;
    counter-increment: etapa;
}

.corrente li::before {
    content: counter(etapa, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0.1rem;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border: 1px solid var(--fio-forte);
    border-radius: 50%;
    background: var(--papel);
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--verdete);
}

/* O elo: cada etapa aponta para a anterior, como a trilha de auditoria. */
.corrente li::after {
    content: "";
    position: absolute;
    left: 1rem;
    top: 2.2rem;
    bottom: 0.3rem;
    width: 1px;
    background: repeating-linear-gradient(
        var(--fio-forte) 0 4px,
        transparent 4px 8px
    );
}

.corrente li:last-child::after {
    display: none;
}

.corrente h3 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}

.corrente p {
    margin: 0;
    color: var(--tinta-suave);
}

.corrente .selo {
    display: inline-block;
    margin-top: 0.4rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: var(--verdete);
    border: 1px dashed color-mix(in srgb, var(--verdete) 45%, transparent);
    padding: 0.1rem 0.45rem;
}

/* ---------- dois públicos ---------- */

.publicos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.publico {
    border-top: 3px solid var(--verdete);
    padding-top: 1.1rem;
}

.publico.espiritual {
    border-top-color: var(--sepia);
}

.publico h3 {
    font-size: 1.2rem;
}

.publico p,
.publico li {
    color: var(--tinta-suave);
    max-width: none;
}

.publico ul {
    margin: 0.75rem 0 0;
    padding-left: 1.1rem;
}

.publico li {
    margin-bottom: 0.4rem;
}

/* ---------- garantias ---------- */

.garantias {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1px;
    background: var(--fio);
    border: 1px solid var(--fio);
    margin-top: 2rem;
}

.garantia {
    background: var(--papel);
    padding: 1.4rem 1.25rem;
}

.garantia h3 {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--verdete);
    margin-bottom: 0.5rem;
}

.garantia p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--tinta-suave);
    max-width: none;
}

/* ---------- painel desta instalação ---------- */

.painel {
    border: 1px solid var(--fio-forte);
    padding: 1.5rem;
    margin-top: 2rem;
    background: color-mix(in srgb, var(--papel) 70%, transparent);
}

/* Fichas de dados: cada par rótulo e valor fica no próprio cartão, para que um rótulo nunca
   apareça ao lado do valor de outro. Hashes e códigos longos ocupam a linha inteira (.largo). */
.leituras {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 1rem;
    margin: 0;
}

.leituras > div {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
    padding: 0.9rem 1rem 1rem;
    border: 1px solid var(--fio);
}

.leituras > div.largo {
    grid-column: 1 / -1;
}

.leituras dt {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tinta-suave);
}

.leituras dd {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.leituras dd .hash {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Variante em linhas, para perguntas e respostas e para textos longos: o rótulo à esquerda e o
   valor à direita, um par por linha; no celular, um embaixo do outro. */
.leituras.lista {
    display: block;
    border-top: 1px solid var(--fio);
}

.leituras.lista > div {
    display: grid;
    grid-template-columns: minmax(9rem, 15rem) 1fr;
    gap: 1.5rem;
    padding: 0.8rem 0;
    border: 0;
    border-bottom: 1px solid var(--fio);
}

.leituras.lista dt {
    padding-top: 0.25rem;
}

.leituras.lista dd {
    font-size: 1.05rem;
    line-height: 1.5;
}

@media (max-width: 40rem) {
    .leituras.lista > div {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
}

.cadeia {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--fio);
}

.cadeia dt {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tinta-suave);
    margin-bottom: 0.4rem;
}

.cadeia dd {
    margin: 0;
}

.cadeia code {
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.5;
    color: var(--verdete);
}

.comando {
    display: block;
    margin-top: 0.6rem;
    padding: 0.55rem 0.8rem;
    background: color-mix(in srgb, var(--tinta) 6%, transparent);
    border-left: 2px solid var(--verdete);
    font-family: var(--mono);
    font-size: 0.8rem;
    overflow-x: auto;
}

/* ---------- participação ---------- */

.caminhos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    counter-reset: caminho;
}

.caminho h3 {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.caminho h3::before {
    counter-increment: caminho;
    content: counter(caminho);
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--verdete);
    border-bottom: 1px solid var(--verdete);
}

.caminho p {
    color: var(--tinta-suave);
    max-width: none;
}

.definicao {
    margin: 1.75rem 0;
    padding: 1.25rem 1.5rem;
    border-left: 3px solid var(--verdete);
    background: color-mix(in srgb, var(--verdete) 7%, transparent);
    max-width: 44rem;
}

.definicao p {
    margin: 0;
    max-width: none;
}

.definicao .rotulo {
    margin-bottom: 0.5rem;
}

.definicao-papel {
    border-left-color: var(--sepia);
    background: color-mix(in srgb, var(--sepia) 8%, transparent);
}

#o-que-e h3 {
    margin-top: 2.25rem;
    font-size: 1.1rem;
}

.atestado {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.atestado h3 {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--verdete);
}

.atestado .nao h3 {
    border-bottom-color: var(--sepia);
}

.atestado ul {
    margin: 0.9rem 0 0;
    padding-left: 1.1rem;
    color: var(--tinta-suave);
}

.atestado li {
    margin-bottom: 0.45rem;
}

/* ---------- linha do tempo ---------- */

.linha-tempo {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
}

.linha-tempo > li {
    position: relative;
    padding: 0 0 2.25rem 8.5rem;
}

.linha-tempo > li::before {
    content: "";
    position: absolute;
    left: 7.1rem;
    top: 0.55rem;
    width: 9px;
    height: 9px;
    border: 1px solid var(--verdete);
    border-radius: 50%;
    background: var(--papel);
}

/* O fio que liga as entradas: a mesma ideia da corrente do protocolo. */
.linha-tempo > li::after {
    content: "";
    position: absolute;
    left: 7.5rem;
    top: 1.4rem;
    bottom: 0;
    width: 1px;
    background: var(--fio-forte);
}

.linha-tempo > li:last-child::after {
    display: none;
}

.linha-tempo .ano {
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 6.6rem;
    margin: 0;
    text-align: right;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--tinta-suave);
}

.linha-tempo h3 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
}

.linha-tempo p {
    margin: 0 0 0.5rem;
}

.linha-tempo .licao {
    display: block;
    margin-top: 0.6rem;
    padding-left: 0.9rem;
    border-left: 2px solid var(--sepia);
    font-size: 0.95rem;
    color: var(--tinta-suave);
    max-width: 40rem;
}

.niveis {
    margin: 0.75rem 0 0.75rem 0;
    padding-left: 1.2rem;
    max-width: 42rem;
}

.niveis li {
    margin-bottom: 0.3rem;
    color: var(--tinta-suave);
}

@media (max-width: 44rem) {
    .linha-tempo > li {
        padding-left: 1.5rem;
    }

    .linha-tempo > li::before {
        left: 0;
    }

    .linha-tempo > li::after {
        left: 0.4rem;
    }

    .linha-tempo .ano {
        position: static;
        width: auto;
        text-align: left;
        margin-bottom: 0.2rem;
        color: var(--verdete);
    }
}

/* ---------- bibliografia ---------- */

.bibliografia {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
    counter-reset: fonte;
}

.bibliografia > li {
    position: relative;
    padding: 0 0 1.75rem 3rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--fio);
    counter-increment: fonte;
}

.bibliografia > li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.bibliografia > li::before {
    content: "[" counter(fonte) "]";
    position: absolute;
    left: 0;
    top: 0.15rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--verdete);
}

.citacao {
    margin: 0 0 0.6rem;
    max-width: 44rem;
}

.citacao a {
    font-family: var(--mono);
    font-size: 0.78em;
    white-space: nowrap;
}

.informa {
    margin: 0;
    max-width: 44rem;
    color: var(--tinta-suave);
    font-size: 0.97rem;
    padding-left: 0.9rem;
    border-left: 2px solid var(--fio);
}

.informa::before {
    content: "Informa no Crivo: ";
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--verdete);
}

/* ---------- repositório ---------- */

.repositorio {
    margin: 1.5rem 0 0;
    font-size: clamp(1.1rem, 0.95rem + 0.8vw, 1.6rem);
    font-family: var(--mono);
    max-width: none;
}

.passos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 2.5rem;
    margin-top: 2.5rem;
}

.passos article > p:last-child {
    margin-bottom: 0;
}

.passos .comando {
    margin-top: 0.4rem;
}

/* ---------- formulário de entrada ---------- */

.formulario {
    margin: 2rem 0 0;
    max-width: 22rem;
    display: grid;
    gap: 0.35rem;
}

.formulario label {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tinta-suave);
    margin-top: 0.75rem;
}

.formulario input {
    font-family: var(--mono);
    font-size: 0.95rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--fio-forte);
    background: var(--papel);
    color: var(--tinta);
}

.formulario input:focus-visible {
    outline: 2px solid var(--verdete);
    outline-offset: 1px;
    border-color: var(--verdete);
}

.formulario button {
    margin-top: 1.25rem;
    justify-self: start;
    cursor: pointer;
    font-family: var(--mono);
}

.erro,
.aviso {
    margin: 0;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    border-left: 3px solid var(--sepia);
    background: color-mix(in srgb, var(--sepia) 10%, transparent);
}

.aviso {
    border-left-color: var(--verdete);
    background: color-mix(in srgb, var(--verdete) 10%, transparent);
}

.credencial {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--fio);
    max-width: 40rem;
}

/* ---------- avisos e rodapé ---------- */

.nota {
    font-size: 0.9rem;
    color: var(--tinta-suave);
}

.nota-espacada {
    margin-top: 1.5rem;
}

.ressalva {
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--sepia);
    background: color-mix(in srgb, var(--sepia) 7%, transparent);
    font-size: 0.95rem;
}

.ressalva p {
    margin: 0;
    max-width: none;
}

.rodape {
    border-top: 1px solid var(--fio);
    padding: 2.5rem 0 3.5rem;
    font-size: 0.9rem;
    color: var(--tinta-suave);
}

.rodape p {
    max-width: 40rem;
}

.rodape ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 0;
    margin: 0 0 1.25rem;
    font-family: var(--mono);
    font-size: 0.78rem;
}

/* ---------- texto corrido das páginas internas ---------- */

.leitura h2 {
    margin-top: 2.5rem;
}

.leitura ol,
.leitura ul {
    max-width: var(--medida);
}

.leitura li {
    margin-bottom: 0.5rem;
}

.vocabulario {
    border-top: 1px solid var(--fio);
    margin-top: 1.5rem;
}

.vocabulario div {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 1.5rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--fio);
}

.vocabulario dt {
    font-weight: 600;
}

.vocabulario dd {
    margin: 0;
    color: var(--tinta-suave);
}

@media (max-width: 40rem) {
    .vocabulario div {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
    }

    .topo,
    .acoes,
    .pular {
        display: none;
    }
}

/* --- Secao de testes (protocolos P3 e P4) --------------------------------- */

.protocolos {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
    display: grid;
    gap: 1.5rem;
}

.protocolos > li {
    border: 1px solid var(--fio-forte);
    border-radius: 14px;
    padding: 1.5rem 1.5rem 1.25rem;
    background: var(--bg-alto, transparent);
}

.protocolos h3 {
    margin: 0.35rem 0 0.75rem;
    font-size: 1.35rem;
}

.protocolos h3 a {
    text-decoration: none;
}

.protocolos h3 a:hover {
    text-decoration: underline;
}

.portas {
    list-style: none;
    margin: 2rem 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 1rem;
}

.porta {
    width: 100%;
    aspect-ratio: 3 / 4;
    font: inherit;
    font-size: 2.5rem;
    font-variant-numeric: tabular-nums;
    color: var(--tinta);
    background: transparent;
    border: 2px solid var(--fio-forte);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 120ms ease, transform 120ms ease;
}

.porta:hover,
.porta:focus-visible {
    border-color: var(--verdete);
    transform: translateY(-2px);
}

.progresso-barra {
    margin: 1.5rem 0;
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--verdete);
    background: rgba(127, 127, 127, 0.07);
    font-size: 0.95rem;
}

.figuras {
    list-style: none;
    margin: 2rem 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1.25rem;
}

.figuras img {
    width: 100%;
    height: auto;
    border: 1px solid var(--fio-forte);
    border-radius: 10px;
    display: block;
}

.ordenacao {
    list-style: none;
    margin: 1.5rem 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.ordenacao > li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ordenacao label {
    min-width: 6rem;
    font-weight: 600;
}

.tentativas {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.tentativas th,
.tentativas td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--fio-forte);
}

.tentativas th {
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.78rem;
}

.tentativas td {
    font-variant-numeric: tabular-nums;
}

select,
textarea {
    font: inherit;
    color: var(--tinta);
    background: var(--bg);
    border: 1px solid var(--fio-forte);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    max-width: 100%;
}

textarea {
    width: 100%;
    resize: vertical;
}

label {
    display: inline-block;
    margin-bottom: 0.35rem;
}

/* --- Verificador de alvos (pagina de resultado) --------------------------- */

.verificador {
    border: 1px solid var(--fio-forte);
    border-radius: 14px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.verificador h3 {
    margin-top: 0;
    font-size: 1.15rem;
}

.verificador textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

.verificador input[type="number"] {
    font: inherit;
    color: var(--tinta);
    background: var(--bg);
    border: 1px solid var(--fio-forte);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    width: 8rem;
}

.resumo-verificacao {
    margin: 1rem 0 0;
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--verdete);
    background: rgba(127, 127, 127, 0.07);
}

.tentativas td.nao-confere {
    color: #b3261e;
    font-weight: 700;
}

@media (prefers-color-scheme: dark) {
    .tentativas td.nao-confere {
        color: #f2b8b5;
    }
}

.resumo-verificacao.falhou {
    border-left-color: #b3261e;
    color: #b3261e;
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    .resumo-verificacao.falhou {
        border-left-color: #f2b8b5;
        color: #f2b8b5;
    }
}

/* ---------- navegação: página atual ---------- */

.navegacao a[aria-current="page"],
.submenu.atual > summary {
    color: var(--verdete);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.35em;
}

/* ---------- navegação: o submenu Biblioteca (SPEC 0.21, seção 1.3) ----------
 * Um <details>, sem script: abre e fecha pelo próprio navegador, com teclado inclusive, e passa
 * pela CSP default-src 'self' sem exceção nenhuma. */

.submenu {
    position: relative;
}

.submenu > summary {
    cursor: pointer;
    list-style: none;
    text-decoration: underline;
    text-decoration-color: var(--verdete);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
}

.submenu > summary::-webkit-details-marker {
    display: none;
}

.submenu > summary::after {
    content: " ▾";
}

.submenu[open] > summary::after {
    content: " ▴";
}

.submenu > summary:hover {
    color: var(--verdete);
}

.submenu > summary:focus-visible {
    outline: 2px solid var(--verdete);
    outline-offset: 3px;
    border-radius: 2px;
}

.submenu-itens {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 11rem;
    padding: 0.85rem 1rem;
    background: var(--papel);
    border: 1px solid var(--fio-forte);
}

@media (max-width: 44rem) {
    .submenu-itens {
        position: static;
        min-width: 0;
        padding: 0.6rem 0 0 0.9rem;
        background: none;
        border: none;
        border-left: 1px solid var(--fio);
    }
}

/* ---------- sessões: progresso, teclado, envio ---------- */

.progresso-sessao {
    display: block;
    width: 100%;
    max-width: var(--medida);
    height: 0.4rem;
    margin: 0.25rem 0 1.25rem;
    appearance: none;
    border: none;
    border-radius: 999px;
    background: var(--fio);
    overflow: hidden;
}

.progresso-sessao::-webkit-progress-bar {
    background: var(--fio);
    border-radius: 999px;
}

.progresso-sessao::-webkit-progress-value {
    background: var(--verdete);
    border-radius: 999px;
}

.progresso-sessao::-moz-progress-bar {
    background: var(--verdete);
    border-radius: 999px;
}

kbd {
    font-family: var(--mono);
    font-size: 0.85em;
    padding: 0.05em 0.4em;
    border: 1px solid var(--fio-forte);
    border-bottom-width: 2px;
    border-radius: 4px;
}

form.enviando button {
    opacity: 0.55;
    cursor: progress;
    transform: none;
}

.enviando-aviso {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--tinta-suave);
}

.ordenacao option:disabled {
    color: var(--tinta-suave);
}

/* ---------- resultado: copiar ---------- */

.copiar {
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--tinta-suave);
    background: transparent;
    border: 1px solid var(--fio-forte);
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
}

.copiar:hover,
.copiar:focus-visible {
    color: var(--verdete);
    border-color: var(--verdete);
}

/* ---------- protocolo em destaque, contas e painéis (P1, SPEC E13) ---------- */

.protocolos > li.destaque {
    border: 2px solid var(--verdete);
    background: color-mix(in srgb, var(--verdete) 6%, transparent);
}

.protocolos > li.destaque .selo::before {
    content: "em destaque · ";
    color: var(--verdete);
}

.formulario textarea,
.formulario select {
    font-family: var(--mono);
    font-size: 0.95rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--fio-forte);
    background: var(--papel);
    color: var(--tinta);
}

.formulario fieldset {
    margin: 0.75rem 0 0;
    padding: 0.75rem 1rem 1rem;
    border: 1px solid var(--fio-forte);
    display: grid;
    gap: 0.6rem;
}

.formulario legend {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tinta-suave);
    padding: 0 0.35rem;
}

.formulario .opcao {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.6rem;
    align-items: start;
    font-family: var(--serifada);
    font-size: 0.98rem;
    letter-spacing: normal;
    text-transform: none;
    color: var(--tinta);
    margin: 0;
}

.formulario .opcao input {
    margin-top: 0.3rem;
}

.formulario .opcao small {
    display: block;
    color: var(--tinta-suave);
    font-size: 0.88rem;
}

.formulario-largo {
    max-width: 34rem;
}

.perfis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.perfil {
    border: 1px solid var(--fio-forte);
    border-radius: 14px;
    padding: 1.25rem 1.25rem 1rem;
}

.perfil h3 {
    margin-top: 0;
}

.perfil ul {
    padding-left: 1.1rem;
    margin: 0.5rem 0 0;
}

.perfil li {
    margin-bottom: 0.45rem;
}

.perfil li strong {
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

.etapas {
    list-style: none;
    counter-reset: etapa;
    padding: 0;
    margin: 2rem 0 0;
    display: grid;
    gap: 1rem;
}

.etapas > li {
    counter-increment: etapa;
    display: grid;
    grid-template-columns: 2.25rem 1fr;
    gap: 0.75rem;
    align-items: baseline;
}

.etapas > li::before {
    content: counter(etapa);
    font-family: var(--mono);
    color: var(--verdete);
    border: 1px solid var(--verdete);
    border-radius: 50%;
    width: 1.9rem;
    height: 1.9rem;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
}

.etapas h3 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
}

.etapas p {
    margin: 0;
    color: var(--tinta-suave);
}

.contagens {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 0;
}

.contagens div {
    border: 1px solid var(--fio);
    padding: 0.9rem 1rem;
}

.contagens dt {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tinta-suave);
}

.contagens dd {
    margin: 0.3rem 0 0;
    font-family: var(--mono);
    font-size: 1.6rem;
    font-variant-numeric: tabular-nums;
}

.avisos {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
    border-top: 1px solid var(--fio);
}

.avisos li {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--fio);
    font-size: 0.95rem;
}

/* ---------- P1, fase D: devolutiva e relatório ---------- */

.tabela {
    overflow-x: auto;
}

.comparacao tbody th {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.95rem;
    color: var(--tinta);
    font-weight: 500;
}

.comparacao tr.coincide td:last-child {
    color: var(--verdete);
    font-weight: 600;
}

/* ---------- P1: o que o experimento não é ---------- */

.esclarecimento {
    margin: 1.75rem 0;
}

.esclarecimento p + p {
    margin-top: 0.75rem;
}

/* ---------- P1, fase C: pedidos ao médium e estudo ---------- */

.pedidos {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
    display: grid;
    gap: 1rem;
}

.pedidos > li {
    border: 1px solid var(--fio-forte);
    border-radius: 14px;
    padding: 1rem 1.25rem;
}

.pedidos .prazo {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--tinta-suave);
}

.pedidos ol {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: grid;
    gap: 0.6rem;
}

.pedidos ol li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.pedidos .nome {
    font-size: 1.3rem;
}

.documento {
    max-height: 28rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--mono);
    font-size: 0.78rem;
    border: 1px solid var(--fio);
    padding: 1rem;
}

.hash {
    font-family: var(--mono);
    font-size: 0.8rem;
    word-break: break-all;
}

.avisos time,
.avisos code {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--tinta-suave);
}

@media (max-width: 40rem) {
    .avisos li {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}
