/* =====================================================================
   STYLE.CSS — ENQUETE + LABIRINTO + INTRUSO/COFRE + MEMÓRIA + ENQUETE 2 + 10 CÁLCULOS
   ===================================================================== */

:root,
html[data-tema="verde"] {
  --bg:        #050608;
  --card:      #0b0d12;
  --borda:     #191e28;
  --borda-hi:  #2a3344;
  --txt:       #e6e8ec;
  --txt-dim:   #7c8599;
  --ok:        #2ee59d;
  --warn:      #f5b942;
  --crit:      #ff4d5e;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

html[data-tema="ambar"] {
  --bg:        #080604;
  --card:      #110d08;
  --borda:     #291f12;
  --borda-hi:  #42311b;
  --txt:       #f2e6d5;
  --txt-dim:   #998468;
  --ok:        #ffb02e;
  --warn:      #ff7a2e;
  --crit:      #ff3b3b;
}

html[data-tema="vermelho"] {
  --bg:        #080405;
  --card:      #12080a;
  --borda:     #2b1317;
  --borda-hi:  #451d23;
  --txt:       #f5e1e4;
  --txt-dim:   #9c7379;
  --ok:        #ff4d5e;
  --warn:      #ff9f43;
  --crit:      #ff1e38;
}

html[data-tema="ciano"] {
  --bg:        #04080b;
  --card:      #081017;
  --borda:     #132433;
  --borda-hi:  #1e3952;
  --txt:       #e0f0fa;
  --txt-dim:   #6d8ca3;
  --ok:        #38d9ff;
  --warn:      #f5b942;
  --crit:      #ff4d6d;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

body.estado-escuro {
  background: #000000;
  overflow: hidden;
}

/* ================= TELA PRETA INICIAL ================= */
.tela-preta {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.9s ease;
}
.tela-preta.apagando {
  opacity: 0;
  pointer-events: none;
}

.gatilho-inicio {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  cursor: pointer;
  padding: 30px;
}

.orbe-pulso {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 24px var(--ok), 0 0 60px var(--ok);
  animation: respirar 2.4s ease-in-out infinite;
}

@keyframes respirar {
  0%, 100% { transform: scale(0.85); opacity: 0.35; }
  50%      { transform: scale(1.25); opacity: 1; }
}

.texto-gatilho {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.25em;
  color: #555e6e;
  transition: color 0.3s;
}
.gatilho-inicio:hover .texto-gatilho {
  color: var(--ok);
}

/* ================= CABEÇALHO MINIMALISTA ================= */
.topo {
  max-width: 880px;
  margin: 0 auto;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--borda);
}
.topo[hidden] { display: none; }

.topo-barra {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--txt-dim);
}

.ao-vivo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ok);
  font-weight: 800;
  letter-spacing: 0.1em;
}

.led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: piscar 2s infinite;
}

@keyframes piscar {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

.topo-direita {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.visitantes {
  font-size: 11px;
  color: var(--txt-dim);
  font-variant-numeric: tabular-nums;
}

.btn-som {
  background: var(--card);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--ok);
  cursor: pointer;
  font-size: 12px;
}

.tema-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border: 1px solid var(--borda-hi);
  border-radius: 999px;
  background: var(--card);
}

.btn-tema {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0;
  cursor: pointer;
}
.btn-tema[data-tema-btn="verde"]    { background: #2ee59d; }
.btn-tema[data-tema-btn="ambar"]    { background: #ffb02e; }
.btn-tema[data-tema-btn="vermelho"] { background: #ff4d5e; }
.btn-tema[data-tema-btn="ciano"]    { background: #38d9ff; }
.btn-tema.ativo { transform: scale(1.25); box-shadow: 0 0 6px #fff; }

.sismografo {
  width: 100%;
  height: 22px;
  margin-top: 10px;
}
.sismografo svg { width: 100%; height: 100%; display: block; }
.sismografo .base { stroke: var(--borda); stroke-width: 1; }
.sismografo polyline {
  fill: none;
  stroke: var(--ok);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

/* ================= MAIN & PAINÉIS ================= */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 44px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
main[hidden] { display: none; }

.painel-etapa {
  position: relative;
  background: var(--card);
  border: 1px solid var(--borda);
  border-top: 2px solid var(--ok);
  border-radius: 4px;
  padding: 22px;
  animation: surgir 0.45s ease-out;
}
.painel-etapa[hidden] { display: none; }

@keyframes surgir {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.etapa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--borda);
}

.etapa-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ok);
}

.hud-direita {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-chave,
.badge-erros,
.lab-timer,
.prova-social-badge,
.badge-rank {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  color: var(--txt);
  font-variant-numeric: tabular-nums;
}

.badge-chave.obtida {
  border-color: var(--warn);
  color: var(--warn);
  box-shadow: 0 0 10px color-mix(in srgb, var(--warn) 30%, transparent);
}

.badge-erros.perigo,
.timer-critico {
  border-color: var(--crit);
  color: var(--crit);
  font-weight: 800;
}

.etapa-desc {
  margin: 0 0 16px;
  color: var(--txt-dim);
  font-size: 13px;
}

/* ================= ENQUETES ================= */
.enquete1-acoes {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.enquete1-acoes[hidden] { display: none; }

/* ================= JOGO 1: LABIRINTO ================= */
.lab-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--txt-dim);
}

.btn-sonar {
  background: var(--bg);
  border: 1px solid var(--ok);
  color: var(--ok);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
}
.btn-sonar:hover:not(:disabled) {
  background: var(--ok);
  color: var(--bg);
}
.btn-sonar:disabled { opacity: 0.35; cursor: not-allowed; }

.lab-canvas-wrap {
  position: relative;
  width: 100%;
  background: #010203;
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  overflow: hidden;
  touch-action: none;
}

#canvas-labirinto {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

.lab-controles-mobile {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  background: var(--bg);
  border-top: 1px solid var(--borda);
}
@media (max-width: 768px) { .lab-controles-mobile { display: flex; } }
.lab-controles-linha { display: flex; gap: 12px; }
.lab-controles-mobile button {
  width: 44px;
  height: 44px;
  background: var(--card);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  color: var(--ok);
  font-size: 16px;
}

/* ================= JOGO 2: INTRUSO + COFRE + SUBLIMINAR ================= */
.pista-conexao {
  font-size: 11px;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--borda));
  padding: 9px 12px;
  border-radius: 3px;
  margin-bottom: 16px;
}

.grade-intruso {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 440px;
  margin: 0 auto;
}

.btn-carta-selo {
  aspect-ratio: 1 / 0.85;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  color: var(--txt);
  font-size: 32px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulsarSelo 1.1s infinite alternate;
}
.btn-carta-selo:hover {
  border-color: var(--ok);
  color: var(--ok);
}

@keyframes pulsarSelo {
  from { opacity: 0.72; }
  to   { opacity: 1; }
}

.cofre-visor-alvo {
  text-align: center;
  font-size: 13px;
  color: var(--txt-dim);
  margin-bottom: 10px;
}
.cofre-visor-alvo strong {
  font-size: 26px;
  color: var(--warn);
  letter-spacing: 0.2em;
  margin-left: 8px;
  animation: piscarCodigo 0.75s infinite alternate;
}

@keyframes piscarCodigo {
  from { opacity: 0.35; }
  to   { opacity: 1; }
}

.cofre-visor-digitado {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.28em;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  color: var(--ok);
  max-width: 340px;
  margin: 0 auto 16px;
}

.teclado-cofre {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 340px;
  margin: 0 auto;
}

.btn-num-cofre {
  padding: 15px 0;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  color: var(--txt);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}
.btn-num-cofre:hover {
  border-color: var(--ok);
  color: var(--ok);
}
.btn-num-cofre:active {
  transform: scale(0.95);
}
.btn-num-zero {
  grid-column: 2;
}

.flash-subliminar {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(5, 6, 8, 0.96);
  border: 1px solid var(--crit);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  pointer-events: none;
  animation: glitchFlash 0.14s infinite;
}
.flash-subliminar[hidden] { display: none; }

.flash-ruido {
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--crit);
  margin-bottom: 10px;
}

.flash-texto {
  font-size: clamp(22px, 4.5vw, 34px);
  font-weight: 800;
  color: var(--warn);
  letter-spacing: 0.08em;
  text-shadow: 0 0 18px rgba(255, 77, 94, 0.65);
}

@keyframes glitchFlash {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2px, 1px); }
  50%  { transform: translate(2px, -1px); }
  75%  { transform: translate(-1px, -1px); }
  100% { transform: translate(0, 0); }
}

/* ================= JOGO 3: MEMÓRIA REVERSA ================= */
.visor-sequencia {
  text-align: center;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.2em;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  color: var(--warn);
  margin-bottom: 16px;
  min-height: 92px;
}

.teclado-cripto {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.btn-cripto {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  color: var(--txt);
  font-size: 22px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.btn-cripto:hover:not(:disabled) {
  border-color: var(--ok);
  color: var(--ok);
}
.btn-cripto:active { transform: scale(0.96); }
.btn-cripto:disabled { opacity: 0.35; cursor: not-allowed; }

.mem-input-display {
  margin-top: 14px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--ok);
  min-height: 24px;
}

/* ================= JOGO 4: 10 CÁLCULOS MATEMÁTICOS ================= */
.math-visor {
  text-align: center;
  font-size: clamp(24px, 4.5vw, 38px);
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 26px 16px;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  color: var(--ok);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.math-form {
  display: flex;
  gap: 10px;
  max-width: 460px;
  margin: 0 auto;
}

.math-form input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  padding: 12px 14px;
  color: var(--txt);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  outline: none;
}
.math-form input:focus {
  border-color: var(--ok);
}

.btn-travar-nucleo {
  padding: 12px 22px;
  background: var(--bg);
  border: 1px solid var(--ok);
  border-radius: 4px;
  color: var(--ok);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.btn-travar-nucleo:hover {
  background: var(--ok);
  color: var(--bg);
}

.math-feedback {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  min-height: 18px;
  color: var(--crit);
}

/* ================= INTERRUPTOR 2030 ================= */
.interruptor-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 10px 0;
}

.switch-tatico {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 6px;
  cursor: pointer;
  color: var(--txt);
  font-family: var(--mono);
}
.switch-tatico.ligado {
  border-color: var(--crit);
  box-shadow: 0 0 24px color-mix(in srgb, var(--crit) 25%, transparent);
}

.switch-trilho {
  position: relative;
  width: 56px;
  height: 28px;
  background: #161a24;
  border: 1px solid var(--borda-hi);
  border-radius: 999px;
}
.switch-tatico.ligado .switch-trilho {
  background: color-mix(in srgb, var(--crit) 30%, #161a24);
  border-color: var(--crit);
}

.switch-pino {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--txt-dim);
  transition: transform 0.25s ease;
}
.switch-tatico.ligado .switch-pino {
  transform: translateX(28px);
  background: var(--crit);
}

.switch-label { font-size: 12px; font-weight: 800; }

.contador-2030-box {
  width: 100%;
  text-align: center;
  padding: 24px 16px;
  background: var(--bg);
  border: 1px solid var(--crit);
  border-radius: 4px;
}
.contador-2030-box[hidden] { display: none; }

.rotulo-2030 {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--warn);
  margin-bottom: 10px;
}

.numero-2030 {
  font-size: clamp(28px, 5.5vw, 52px);
  font-weight: 800;
  color: var(--crit);
  font-variant-numeric: tabular-nums;
}

.unidade-2030 {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--txt-dim);
}

/* ================= ETAPA FINAL: TRIAGEM + ENQUETE ================= */
.triagem-botoes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 600px) { .triagem-botoes { grid-template-columns: 1fr; } }

.btn-triagem {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  color: var(--txt);
  font-family: var(--mono);
  text-align: left;
  cursor: pointer;
}
.btn-inscrito:hover { border-color: var(--ok); }
.btn-nao-inscrito:hover { border-color: var(--crit); }
.btn-titulo { font-size: 14px; font-weight: 800; }
.btn-inscrito .btn-titulo { color: var(--ok); }
.btn-nao-inscrito .btn-titulo { color: var(--crit); }
.btn-sub { font-size: 11px; color: var(--txt-dim); }

.bloqueio-inscricao {
  margin-top: 18px;
  padding: 20px;
  background: color-mix(in srgb, var(--crit) 10%, var(--bg));
  border: 1px solid var(--crit);
  border-radius: 4px;
  text-align: center;
}
.bloqueio-inscricao[hidden] { display: none; }
.bloqueio-icone { font-size: 24px; margin-bottom: 6px; }
.bloqueio-inscricao h3 { margin: 0 0 8px; font-size: 14px; color: var(--crit); }
.bloqueio-inscricao p { margin: 0 0 16px; font-size: 12px; color: var(--txt-dim); }

.btn-forcar-inscricao {
  display: inline-block;
  padding: 12px 18px;
  background: var(--crit);
  color: #ffffff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  border-radius: 4px;
}

.enquete-pergunta {
  margin: 0 0 16px;
  font-size: clamp(16px, 2.4vw, 20px);
  font-weight: 800;
}

.enquete-opcoes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.opcao-voto {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--borda-hi);
  border-radius: 4px;
  padding: 14px 16px;
  color: var(--txt);
  font-family: var(--mono);
  text-align: left;
  cursor: pointer;
}
.opcao-voto:hover,
.opcao-voto.votado { border-color: var(--ok); }

.opcao-topo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.opcao-num { font-size: 11px; color: var(--ok); font-weight: 800; }
.opcao-titulo { flex: 1; font-size: 13px; font-weight: 700; }
.opcao-pct { font-size: 12px; font-weight: 800; color: var(--ok); }

.opcao-barra {
  width: 100%;
  height: 6px;
  background: var(--card);
  border-radius: 3px;
  overflow: hidden;
}
.opcao-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--ok);
  transition: width 0.6s ease;
}

.enquete-rodape-info {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--txt-dim);
}

/* ================= RODAPÉ (APENAS NO FINAL) ================= */
.rodape {
  max-width: 880px;
  margin: 0 auto;
  padding: 22px 20px 36px;
  border-top: 1px solid var(--borda);
}
.rodape[hidden] { display: none; }

.rodape-conteudo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.status-concluido { font-size: 11px; color: var(--ok); letter-spacing: 0.08em; }
.autoria-final { font-size: 13px; font-weight: 800; }
.autoria-final a {
  color: var(--ok);
  text-decoration: none;
  border-bottom: 1px solid var(--ok);
}
