/* Tabuleiro: briefing de entrada.
   Preto e branco, cantos retos (casas de tabuleiro), uma pergunta por tela.
   Primeiro o celular; o computador só ganha largura e tipo maior. */

:root {
  --preto: #111111;
  --branco: #ffffff;
  --claro: #f4f4f4;
  --cinza: #888888;
  --texto2: #5e5e5e;   /* texto secundário: mais escuro que #888 para dar leitura no sol */
  --linha: #d8d8d8;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --corpo: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --lado-e: max(20px, env(safe-area-inset-left, 0px));
  --lado-d: max(20px, env(safe-area-inset-right, 0px));
  --coluna: 600px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--branco);
  color: var(--preto);
  font-family: var(--corpo);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

.sr-so, .sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.mono { font-family: var(--mono); font-size: 0.82rem; }

/* ---------- estrutura ---------- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topo, .corpo, .rodape-in { width: 100%; max-width: var(--coluna); margin-inline: auto; }

.topo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--lado-d) 12px var(--lado-e);
}
.marca { display: flex; align-items: center; gap: 9px; }
.marca svg { width: 24px; height: 24px; fill: currentColor; }
.marca span { font-family: var(--display); font-weight: 600; font-size: 0.74rem; letter-spacing: 0.3em; }

.corpo {
  flex: 1; display: flex; flex-direction: column; gap: 20px;
  padding: 8px var(--lado-d) 28px var(--lado-e);
}

/* progresso: uma fileira de oito casas */
.fileira { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.casa { position: relative; height: 6px; padding: 0; border: 0; background: var(--linha); overflow: hidden; }
.casa::after { content: ""; position: absolute; inset: 0; width: var(--cheio, 0%); background: var(--preto); transition: width 0.25s ease; }
button.casa { height: 6px; }
button.casa::before { content: ""; position: absolute; inset: -14px 0; } /* área de toque maior que o traço */
.linha-bloco { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bloco-nome { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--texto2); }
.estado { font-family: var(--mono); font-size: 0.72rem; color: var(--texto2); min-height: 1em; }

.titulo { font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; outline: none; }
.dica { color: var(--texto2); font-size: 0.95rem; margin-top: -8px; }
.campos { display: flex; flex-direction: column; gap: 22px; }
.campo { display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 0; padding: 0; margin: 0; }
.rotulo { font-weight: 600; font-size: 0.95rem; padding: 0; }
.rotulo .op { font-weight: 400; color: var(--texto2); }

.entrada {
  width: 100%; min-height: 54px; padding: 14px; border: 1px solid var(--preto); border-radius: 0;
  background: var(--branco); font-size: 17px; appearance: none; -webkit-appearance: none;
}
.entrada::placeholder { color: var(--cinza); }
.entrada:disabled { background: var(--claro); border-color: var(--linha); color: var(--cinza); }
.area { min-height: 130px; resize: vertical; line-height: 1.45; }
:focus-visible { outline: 3px solid var(--preto); outline-offset: 2px; }
.entrada:focus-visible { outline-offset: 0; }

.erro { display: flex; align-items: flex-start; gap: 8px; font-size: 0.92rem; font-weight: 600; }
.erro::before { content: "!"; flex: none; width: 20px; height: 20px; background: var(--preto); color: var(--branco); font-family: var(--mono); font-size: 0.8rem; display: grid; place-items: center; }

/* ---------- alternativas ---------- */
.opcoes { display: flex; flex-direction: column; gap: 8px; }
.opcao {
  display: flex; flex-direction: column; gap: 2px; justify-content: center;
  min-height: 54px; padding: 12px 14px; border: 1px solid var(--preto); background: var(--branco);
  font-weight: 500; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s;
}
.opcao-d { font-weight: 400; font-size: 0.86rem; color: var(--texto2); }
.sr:checked + .opcao { background: var(--preto); color: var(--branco); }
.sr:checked + .opcao .opcao-d { color: #c9c9c9; }
.sr:focus-visible + .opcao { outline: 3px solid var(--preto); outline-offset: 2px; }
@media (hover: hover) { .opcao:hover { background: var(--claro); } .sr:checked + .opcao:hover { background: var(--preto); } }

.opcoes.chips { flex-direction: row; flex-wrap: wrap; }
.opcoes.chips .opcao { min-height: 46px; padding: 9px 14px; font-size: 0.95rem; }

.alt { align-self: flex-start; }
.chip {
  min-height: 44px; padding: 8px 14px; border: 1px solid var(--preto); background: var(--branco); border-radius: 0;
  font-size: 0.92rem; font-weight: 500;
}
.chip[aria-pressed="true"] { background: var(--preto); color: var(--branco); }

/* matriz: item + três estados */
.matriz { display: flex; flex-direction: column; }
.item { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-top: 1px solid var(--linha); border-inline: 0; border-bottom: 0; margin: 0; min-width: 0; }
.item:first-child { border-top: 0; padding-top: 0; }
.item legend { padding: 0; font-weight: 600; float: left; width: 100%; }
.item .opcao-d { clear: both; }
.tres { clear: both; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tres .opcao { min-height: 44px; padding: 8px 6px; align-items: center; text-align: center; font-size: 0.9rem; }

/* ---------- voz ---------- */
.abas { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--preto); }
.aba { min-height: 46px; border: 0; background: var(--branco); font-weight: 500; font-size: 0.95rem; border-radius: 0; }
.aba[aria-selected="true"] { background: var(--preto); color: var(--branco); }
.painel { display: flex; flex-direction: column; gap: 12px; }
.gravador { background: var(--claro); padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.btn-gravar {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 60px;
  border: 0; background: var(--preto); color: var(--branco); font-weight: 600; font-size: 1.02rem; border-radius: 0;
}
.btn-gravar svg, .btn svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.gravando { display: flex; align-items: center; gap: 12px; }
.ponto { width: 14px; height: 14px; border-radius: 50%; background: var(--preto); flex: none; }
.ponto.vivo { animation: pulsa 1.1s ease-in-out infinite; }
@keyframes pulsa { 50% { opacity: 0.25; } }
.tempo { font-family: var(--mono); font-size: 1.15rem; font-variant-numeric: tabular-nums; min-width: 3.2em; }
.limite { font-family: var(--mono); font-size: 0.72rem; color: var(--texto2); }
.barras { flex: 1; display: flex; align-items: center; gap: 3px; height: 30px; min-width: 0; overflow: hidden; }
.barras i { width: 3px; height: 4px; background: var(--preto); flex: none; }
.linha-acoes { display: flex; flex-wrap: wrap; gap: 8px; }
.linha-acoes .btn { flex: 1 1 130px; }
.audio-pronto { display: flex; flex-direction: column; gap: 10px; }
.audio-pronto audio { width: 100%; height: 44px; }
.selo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.95rem; }
.selo svg { width: 20px; height: 20px; flex: none; background: var(--preto); color: var(--branco); padding: 2px; }
.link-btn { background: none; border: 0; padding: 10px 0; text-decoration: underline; text-underline-offset: 3px; font-size: 0.92rem; align-self: flex-start; color: var(--preto); }
.barra-envio { height: 4px; background: var(--linha); }
.barra-envio i { display: block; height: 100%; width: var(--p, 0%); background: var(--preto); transition: width 0.2s; }

/* ---------- arquivos ---------- */
.solta {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 110px; padding: 18px;
  border: 1px dashed var(--preto); background: var(--branco); text-align: center; cursor: pointer; border-radius: 0; width: 100%;
}
.solta.sobre { background: var(--claro); border-style: solid; }
.solta svg { width: 26px; height: 26px; fill: currentColor; }
.solta strong { font-weight: 600; }
.solta span { font-size: 0.85rem; color: var(--texto2); }
.lista-arq { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.arq { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.arq-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 0.95rem; }
.arq-info { font-family: var(--mono); font-size: 0.72rem; color: var(--texto2); grid-column: 1; }
.arq .barra-envio { grid-column: 1 / -1; }
.arq-x { grid-row: 1 / span 2; grid-column: 2; width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; }
.arq-x svg { width: 18px; height: 18px; }
.arq.falhou .arq-info { color: var(--preto); font-weight: 600; }

/* ---------- botões e rodapé ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 12px 18px;
  border: 1px solid var(--preto); background: var(--branco); color: var(--preto); font-weight: 600; text-decoration: none; border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-cheio { background: var(--preto); color: var(--branco); }
.btn-texto { border-color: transparent; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.btn:disabled { background: var(--claro); border-color: var(--linha); color: var(--cinza); cursor: default; }
.btn-p { min-height: 44px; padding: 8px 14px; font-size: 0.92rem; }

.rodape {
  position: sticky; bottom: 0; background: var(--branco); border-top: 1px solid var(--linha);
  padding: 12px var(--lado-d) calc(12px + env(safe-area-inset-bottom, 0px)) var(--lado-e);
}
.rodape-in { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.rodape-in .btn-voltar { width: 54px; padding: 0; }
.rodape-in.um { grid-template-columns: 1fr; }
.atalho { display: none; font-family: var(--mono); font-size: 0.72rem; color: var(--texto2); grid-column: 1 / -1; text-align: right; }

.entra { animation: entra 0.22s ease both; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .entra, .ponto.vivo { animation: none; }
  .casa::after, .opcao, .barra-envio i { transition: none; }
}

/* ---------- telas em preto: boas-vindas e final ---------- */
.neg { background: var(--preto); color: var(--branco); flex: 1; display: flex; flex-direction: column; }
.neg .topo { color: var(--branco); }
.neg-corpo {
  flex: 1; width: 100%; max-width: var(--coluna); margin-inline: auto; display: flex; flex-direction: column; justify-content: center; gap: 22px;
  padding: 24px var(--lado-d) 24px var(--lado-e);
}
.neg-corpo > svg { width: 84px; height: 84px; fill: currentColor; }
.neg h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2.1rem, 9vw, 3.2rem); line-height: 1.04; letter-spacing: -0.02em; text-wrap: balance; }
.neg p { color: #d6d6d6; max-width: 34em; }
.neg ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; color: #d6d6d6; }
.neg li { display: flex; gap: 10px; align-items: baseline; }
.neg li::before { content: ""; width: 7px; height: 7px; background: var(--branco); flex: none; transform: translateY(-1px); }
.neg-pe {
  width: 100%; max-width: var(--coluna); margin-inline: auto; display: flex; flex-direction: column; gap: 12px;
  padding: 0 var(--lado-d) calc(22px + env(safe-area-inset-bottom, 0px)) var(--lado-e);
}
.neg .btn { border-color: var(--branco); background: var(--preto); color: var(--branco); }
.neg .btn-cheio { background: var(--branco); color: var(--preto); }
.neg .btn-texto { border-color: transparent; }
.neg :focus-visible { outline-color: var(--branco); }
.neg .miudo { font-size: 0.8rem; color: #b9b9b9; }
.neg .miudo button { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.protocolo { font-family: var(--mono); font-size: 1.05rem; letter-spacing: 0.08em; border: 1px solid #555; padding: 12px 14px; align-self: flex-start; color: var(--branco); }
.neg .erro::before { background: var(--branco); color: var(--preto); }

/* ---------- revisão ---------- */
.rev-bloco { border-top: 1px solid var(--preto); padding-top: 14px; display: flex; flex-direction: column; }
.rev-bloco h2 { font-family: var(--display); font-weight: 600; font-size: 1.05rem; margin-bottom: 4px; }
.rev-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--linha); align-items: start; }
.rev-item:last-child { border-bottom: 0; }
.rev-p { font-size: 0.86rem; color: var(--texto2); }
.rev-r { grid-column: 1; font-weight: 500; overflow-wrap: anywhere; white-space: pre-line; }
.rev-r.falta { font-weight: 600; }
.rev-ed { grid-row: 1 / span 2; grid-column: 2; }

/* ---------- diálogos ---------- */
.dlg { border: 1px solid var(--preto); padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); color: var(--preto); background: var(--branco); border-radius: 0; }
.dlg::backdrop { background: rgba(17, 17, 17, 0.6); }
.dlg-corpo { padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { font-family: var(--display); font-weight: 700; font-size: 1.35rem; }
.priv { margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.95rem; }
.priv dt { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--texto2); margin-top: 10px; }
.priv dd { margin: 0; }
.dlg-acoes { display: flex; flex-direction: column; gap: 8px; }

.sem-js { padding: 40px 24px; max-width: 520px; margin: auto; display: flex; flex-direction: column; gap: 12px; }

/* ---------- computador ---------- */
@media (min-width: 760px) {
  body { font-size: 18px; }
  .topo { padding-top: 28px; }
  .corpo { padding-top: 24px; gap: 24px; flex: none; }  /* os botões ficam logo abaixo da pergunta */
  .titulo { font-size: 2rem; }
  .rodape { position: static; border-top: 0; padding-top: 4px; padding-bottom: 40px; }
  /* mesma largura útil da coluna de perguntas, para os botões alinharem com o texto */
  .rodape-in { max-width: calc(var(--coluna) - var(--lado-e) - var(--lado-d)); grid-template-columns: auto auto 1fr; align-items: center; }
  .rodape-in .btn-cheio { min-width: 220px; }
  .rodape-in.um { grid-template-columns: auto 1fr; }
  .atalho { display: block; grid-column: auto; text-align: left; padding-left: 8px; }
  .opcoes:not(.chips) .opcao { min-height: 58px; }
  .neg-corpo { gap: 26px; }
}

/* legend não entra no gap do flex: o respiro vem por margem */
fieldset.campo > legend.rotulo { margin-bottom: 8px; }

/* sem estilo inline no HTML: a política de segurança da página (CSP) bloqueia */
.sprite { position: absolute; }
a.marca { text-decoration: none; color: inherit; }
.link-btn.em-linha { padding: 0; display: inline; }
