/* GABURA FINGERS - componentes */

/* ---------- moldura padrao de painel ---------- */
.modulo {
  border: var(--borda);
  border-radius: var(--raio);
  background: var(--painel);
  position: relative;
}
.modulo > .titulo-modulo {
  position: absolute;
  top: -8px; left: 10px;
  padding: 0 6px;
  background: var(--vazio);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--texto-apagado);
}

/* ---------- cronometro LCD ---------- */
.cronometro {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 9px;
}
.mostrador {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--verde);
  font-variant-numeric: tabular-nums;
  position: relative;
}
.mostrador .fantasma-lcd {
  position: absolute;
  inset: 0;
  color: var(--verde);
  opacity: 0.12;
  pointer-events: none;
}
.mostrador.alerta { color: var(--vermelho); animation: pulso 1s steps(2) infinite; }
.mostrador.infinito { letter-spacing: 0.1em; }
@keyframes pulso { 50% { opacity: 0.35; } }

.botoes-cronometro { display: flex; flex-direction: column; gap: 6px; }
.botoes-cronometro button {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  min-width: 108px;
}
.botoes-cronometro svg { width: 14px; height: 14px; flex: none; }

/* ---------- monitor de status ---------- */
.monitor {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 1px;
  background: var(--linha);
  padding: 1px;
  flex: 1 1 300px;
  max-width: 460px;
}
.leitura {
  background: var(--painel);
  padding: 12px 10px 10px;
  text-align: center;
}
.leitura .valor {
  font-size: clamp(20px, 3.2vw, 30px);
  line-height: 1.1;
  color: var(--texto);
  font-variant-numeric: tabular-nums;
}
.leitura .valor small { font-size: 0.5em; color: var(--texto-apagado); }
.leitura .rotulo {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--texto-apagado);
  margin-top: 2px;
}
.leitura.bom .valor { color: var(--verde); }
.leitura.atencao .valor { color: var(--ambar); }
.leitura.ruim .valor { color: var(--vermelho); }

/* ---------- integridade da nave ---------- */
.integridade {
  flex: 1 1 200px;
  max-width: 300px;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}
.integridade .barra {
  height: 12px;
  border: 1px solid var(--linha-forte);
  display: flex;
  gap: 2px;
  padding: 2px;
}
.integridade .celula { flex: 1; background: var(--linha); }
.integridade .celula.on { background: var(--verde); }
.integridade[data-nivel='2'] .celula.on { background: var(--ambar); }
.integridade[data-nivel='3'] .celula.on { background: var(--vermelho); }
.integridade[data-nivel='3'] { animation: piscaAlerta 1.2s steps(2) infinite; }
@keyframes piscaAlerta { 50% { background: var(--vermelho-fundo); } }
.integridade .mensagem { font-size: 11px; color: var(--texto-fraco); min-height: 2.6em; }
.integridade[data-nivel='2'] .mensagem { color: var(--ambar); }
.integridade[data-nivel='3'] .mensagem { color: var(--vermelho); }

/* ---------- area de digitacao ---------- */
.folha {
  width: 100%;
  max-width: 1040px;
  border: var(--borda);
  border-radius: var(--raio);
  background: var(--painel);
  padding: 16px 20px;
  position: relative;
  max-height: 34vh;
  overflow-y: auto;
  scrollbar-width: thin;
}
.folha.ativa { border-color: var(--linha-forte); }

#texto-alvo {
  margin: 0;
  font-size: clamp(15px, 1.35vw, 19px);
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--txt-distante);
  tab-size: 4;
}
#texto-alvo.codigo { white-space: pre; overflow-x: auto; word-break: normal; }
#texto-alvo.ascii { white-space: pre; overflow-x: auto; line-height: 1.25; letter-spacing: 0; }

#texto-alvo .ch { position: relative; }

/* Faixa clara em volta do ponto onde o aluno esta digitando.
   O resto do texto continua discreto, para quem gosta da sala escura. */
#texto-alvo .ch.proximo { color: var(--txt-proximo); }
:root[data-contraste='alto'] #texto-alvo { color: var(--txt-proximo); }
:root[data-contraste='baixo'] #texto-alvo .ch.proximo { color: var(--txt-distante); }

#texto-alvo .ch.ok { color: var(--txt-correto); }

#texto-alvo .ch.erro {
  color: var(--txt-errado);
  background: var(--fundo-erro);
  border-bottom: 2px solid var(--txt-errado);
  border-radius: 2px 2px 0 0;
  font-weight: 700;
}

/* Cursor em bloco, no estilo terminal. Foi feito so com cor de fundo
   de proposito: um pseudo-elemento aqui obrigaria o navegador a refazer
   o layout do texto inteiro a cada tecla, e textos longos travavam. */
#texto-alvo .ch.cursor {
  border-radius: 2px;
  animation: cursorPisca 1.05s steps(1, end) infinite;
}
@keyframes cursorPisca {
  0%, 55% { background-color: var(--txt-cursor); color: var(--sobre-cursor); }
  56%, 100% { background-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  #texto-alvo .ch.cursor { background-color: var(--txt-cursor); color: var(--sobre-cursor); }
}

#texto-alvo .ch.fantasma { box-shadow: inset 0 -2px 0 var(--ciano); }
#texto-alvo .ch.nl::before { content: '\21B5'; color: var(--txt-distante); opacity: 0.55; }
#texto-alvo .ch.esp-visivel::before {
  content: '\00B7';
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  color: currentColor;
  opacity: 0.4;
  pointer-events: none;
}
#texto-alvo .ch.esp-visivel.ok::before { opacity: 0.55; }
#texto-alvo .ch.cursor.esp-visivel::before { opacity: 0; }

#captura {
  position: fixed;
  top: 50%; left: 0;
  opacity: 0;
  width: 1px; height: 1px;
  border: 0; padding: 0; margin: 0;
  resize: none;
  pointer-events: none;
}

.aviso-foco {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  color: var(--verde);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--raio);
}
:root[data-tema='claro'] .aviso-foco { background: rgba(255, 255, 255, 0.82); }

/* ---------- teclado virtual ---------- */
.caixa-teclado svg, .caixa-maos svg { width: 100%; height: auto; display: block; }
.tecla rect { fill: var(--painel-alto); stroke: var(--linha-forte); stroke-width: 1; }
.tecla text { fill: var(--metal-claro); font-family: var(--pilha-mono); }
.tecla .rotulo-sec { fill: var(--texto-apagado); }
.tecla.ativa rect { fill: var(--verde-fundo); stroke: var(--verde); stroke-width: 2; }
.tecla.ativa text { fill: var(--verde); }
.tecla.passo1 rect { stroke: var(--ambar); stroke-width: 2; stroke-dasharray: 4 3; }
.tecla.passo1 text { fill: var(--ambar); }
.tecla.aux rect { fill: var(--verde-fundo); stroke: var(--verde); stroke-dasharray: 4 3; }
.tecla.quente rect { fill: var(--vermelho-fundo); stroke: var(--vermelho); }
.selo-passo { fill: var(--vazio); font-size: 9px; }
.dedo-marca { stroke: none; }

/* As maos nunca podem ficar mais altas que o teclado, senao a tela
   passa a rolar em notebook e tablet. */
.maos {
  overflow: visible;
  width: 100%;
  height: auto;
  max-height: 168px;
}
@media (max-height: 820px) { .maos { max-height: 148px; } }
@media (max-width: 620px) { .maos { max-height: 132px; } }
.maos .traco-maos { fill: var(--metal); }

.maos .marca-dedo { opacity: 0; transition: opacity 0.1s linear; }
.maos .marca-dedo.ativo { opacity: 1; }
.maos .marca-dedo .halo { fill: var(--cor-dedo); opacity: 0.18; }
.maos .marca-dedo .anel { fill: none; stroke: var(--cor-dedo); stroke-width: 6; }
.maos .marca-dedo .ponto { fill: var(--cor-dedo); }
.maos .marca-dedo.ativo .halo { animation: pulsoDedo 1.4s ease-out infinite; transform-origin: center; }
@keyframes pulsoDedo {
  0% { opacity: 0.30; }
  70% { opacity: 0.06; }
  100% { opacity: 0.30; }
}
@media (prefers-reduced-motion: reduce) {
  .maos .marca-dedo.ativo .halo { animation: none; }
}

.rotulo-dedo {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--texto-fraco);
  margin-top: 6px;
  min-height: 1.4em;
}
.rotulo-dedo b { color: var(--verde); font-weight: 400; }

/* ---------- dialogos ---------- */
dialog {
  border: 1px solid var(--linha-forte);
  border-radius: var(--raio);
  background: var(--casco);
  color: var(--texto);
  padding: 0;
  max-width: min(860px, 94vw);
  width: 100%;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.78); }
:root[data-tema='claro'] dialog::backdrop { background: rgba(255, 255, 255, 0.82); }

.cabecalho-dialogo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: var(--borda);
  background: var(--painel);
}
.cabecalho-dialogo .luzes { display: flex; gap: 5px; }
.cabecalho-dialogo .luzes i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--linha-forte); display: block;
}
.cabecalho-dialogo .luzes i:last-child { background: var(--verde); }
.cabecalho-dialogo h2 { flex: 1; font-size: 12px; color: var(--texto-fraco); }
.corpo-dialogo { padding: 16px 18px; max-height: 74vh; overflow-y: auto; }
.rodape-dialogo {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  padding: 10px 14px; border-top: var(--borda); background: var(--painel);
}

.secao-ajuste { border-top: 1px dashed var(--linha); padding: 12px 0; }
.secao-ajuste:first-child { border-top: 0; padding-top: 0; }
.secao-ajuste h3 { color: var(--verde); margin-bottom: 8px; }
.linha-ajuste {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 5px 0; font-size: 13px;
}
.grade-cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.grade-cores label { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.grade-cores input[type='color'] { width: 30px; height: 24px; padding: 1px; }

/* ---------- relatorio ---------- */
.grade-resultado {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px; background: var(--linha); border: var(--borda); margin-bottom: 14px;
}
.patente {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--verde); background: var(--verde-fundo);
  padding: 12px 14px; margin-bottom: 14px;
}
.patente svg { width: 42px; height: 42px; flex: none; }
.patente .nome { font-size: 18px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--verde); }
.patente .desc { font-size: 11px; color: var(--texto-fraco); }

.insignias { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.insignia {
  display: flex; align-items: center; gap: 7px;
  border: var(--borda); padding: 6px 10px; font-size: 11px;
}
.insignia svg { width: 16px; height: 16px; flex: none; }

.lista-erros { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.lista-erros li {
  border: 1px solid var(--vermelho); color: var(--vermelho);
  padding: 3px 8px; font-size: 12px;
}
.lista-erros li b { color: var(--texto); font-weight: 400; }

/* ---------- boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 60;
  background: var(--vazio);
  color: var(--verde);
  padding: 8vh 6vw;
  font-size: 13px;
  line-height: 1.75;
  overflow: hidden;
}
#boot .linha-log { white-space: pre-wrap; }
#boot .ok { color: var(--metal-claro); }
#boot .pular {
  position: absolute; right: 16px; bottom: 16px;
  font-size: 11px; letter-spacing: 0.12em;
}

/* ---------- aviso de dispositivo movel ---------- */
#aviso-movel {
  position: fixed; inset: 0; z-index: 70;
  background: var(--vazio);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; padding: 24px; text-align: center;
}
#aviso-movel svg { width: 64px; height: 64px; }
#aviso-movel p { max-width: 46ch; font-size: 13px; color: var(--texto-fraco); line-height: 1.7; }

.faixa-atividade {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--texto-apagado);
  padding: 0 16px 6px;
}
.faixa-atividade .titulo-atual { color: var(--verde); }

.selo-volta {
  position: fixed; left: 50%; top: 22%;
  transform: translateX(-50%);
  border: 1px solid var(--verde); background: var(--vazio);
  color: var(--verde); padding: 14px 26px;
  font-size: 15px; letter-spacing: 0.16em; text-transform: uppercase;
  z-index: 40; pointer-events: none;
}
