/* =====================================================================
   QUIZ ESCOTEIRO · visual arcade retrô com acampamento em pixel art
   ===================================================================== */

@font-face {
  font-family: 'Press Start 2P';
  src: url('../assets/fonts/PressStart2P-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'VT323';
  src: url('../assets/fonts/VT323-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --fundo: #060316;
  --painel: rgba(12, 6, 34, 0.88);
  --borda: #3b2a6b;
  --texto: #f4f1ff;
  --suave: #c4bce3;
  --amarelo: #ffd23f;
  --rosa: #ff4fd8;
  --ciano: #39e6ff;
  --verde: #3ddc84;
  --vermelho: #ff4d4d;
  --cinza: #9aa0b5;
  --pixel: 'Press Start 2P', 'Courier New', monospace;
  --leitura: 'VT323', 'Courier New', monospace;
  --sombra: 4px 4px 0 #000;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--leitura);
  font-size: 22px;
  line-height: 1.25;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.sprite { image-rendering: pixelated; flex-shrink: 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 3px dashed #fff; outline-offset: 3px; }

/* =========================== CENÁRIO =========================== */
.cena {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(#05021a 0%, #120838 40%, #2b0f55 72%, #5a1e62 100%);
}
.estrela {
  position: absolute; background: #fff; box-shadow: 0 0 4px #fff;
  animation: piscar-estrela 3s steps(2) infinite;
}
@keyframes piscar-estrela { 50% { opacity: 0.25; } }
.estrela-cadente {
  position: absolute; top: 8%; left: -10%; width: 60px; height: 2px;
  background: linear-gradient(90deg, transparent, #fff);
  transform: rotate(18deg);
  animation: cadente 11s linear infinite;
  opacity: 0;
}
@keyframes cadente {
  0%, 82% { left: -10%; top: 6%; opacity: 0; }
  84% { opacity: 1; }
  92% { left: 70%; top: 26%; opacity: 0; }
  100% { opacity: 0; }
}
.lua { position: absolute; top: 7%; right: 9%; filter: drop-shadow(0 0 18px rgba(255, 246, 216, 0.55)); }
.lua svg { width: clamp(48px, 7vw, 88px); height: auto; }
.montanhas { position: absolute; left: 0; width: 100%; }
.montanhas.longe { bottom: 10vh; height: 38vh; }
.montanhas.perto { bottom: 10vh; height: 22vh; }
.chao {
  position: absolute; left: 0; right: 0; bottom: 0; height: 10.5vh;
  background:
    repeating-linear-gradient(90deg, #1c6b3e 0 8px, #145a32 8px 16px) top / 100% 6px no-repeat,
    linear-gradient(#0e2a1c, #07150e);
}
.arvores { position: absolute; left: 0; right: 0; bottom: 10vh; height: 0; }
.arvore { position: absolute; bottom: 0; transform: translateX(-50%); }
.arvore svg { height: auto; }
.acampamento { position: absolute; left: 50%; bottom: 9.5vh; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 4vw; }
.barraca svg { width: clamp(70px, 10vw, 130px); height: auto; }
.fogueira { position: relative; }
.fogueira svg { width: clamp(40px, 5vw, 66px); height: auto; position: relative; animation: chama 0.45s steps(2) infinite; transform-origin: bottom center; }
.fogueira .brilho {
  position: absolute; left: 50%; bottom: -20%; width: 260%; aspect-ratio: 1; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 159, 28, 0.45), rgba(255, 77, 77, 0.12) 45%, transparent 70%);
  animation: brilho 1.2s steps(3) infinite alternate;
}
@keyframes chama { 50% { transform: scaleY(1.08) scaleX(0.94); filter: hue-rotate(-12deg) brightness(1.15); } }
@keyframes brilho { to { opacity: 0.6; transform: translateX(-50%) scale(1.08); } }

/* Efeito de monitor CRT */
.crt {
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background:
    repeating-linear-gradient(rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, 0.55) 100%);
  animation: flicker 6s steps(1) infinite;
}
@keyframes flicker { 0%, 100% { opacity: 1; } 97% { opacity: 0.92; } }

/* ============================ LAYOUT ============================ */
#app {
  position: relative; z-index: 10;
  max-width: 980px; margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(12vh + 16px);
}
.tela { display: none; }
.tela.ativa { display: flex; flex-direction: column; gap: 18px; animation: entrar 0.3s steps(4); }
@keyframes entrar { from { opacity: 0; transform: scale(0.97); } }

.painel {
  background: var(--painel);
  border: 3px solid var(--borda);
  box-shadow: 0 0 0 3px #000, var(--sombra), inset 0 0 24px rgba(57, 230, 255, 0.06);
  padding: 18px;
}

/* ============================ BOTÕES ============================ */
.btn {
  --c: var(--amarelo);
  font-family: var(--pixel); font-size: 13px; line-height: 1.4; letter-spacing: 1px;
  color: var(--c); background: #150b33;
  border: 3px solid var(--c); box-shadow: var(--sombra), 0 0 12px color-mix(in srgb, var(--c) 35%, transparent);
  padding: 14px 18px; cursor: pointer; text-transform: uppercase;
  transition: transform 0.08s steps(2), box-shadow 0.08s steps(2), background 0.08s;
  min-height: 48px;
}
.btn:hover:not(:disabled), .btn:focus-visible { background: color-mix(in srgb, var(--c) 18%, #150b33); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 #000, 0 0 18px color-mix(in srgb, var(--c) 55%, transparent); }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 #000; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-amarelo { --c: var(--amarelo); }
.btn-rosa { --c: var(--rosa); }
.btn-ciano { --c: var(--ciano); }
.btn-verde { --c: var(--verde); }
.btn-cinza { --c: var(--cinza); }
.btn-vermelho { --c: var(--vermelho); }
.btn-peq { font-size: 10px; padding: 10px 12px; min-height: 40px; }

.btn-mini {
  font-family: var(--pixel); font-size: 10px; color: var(--suave);
  background: rgba(0, 0, 0, 0.45); border: 2px solid var(--borda); padding: 10px 12px; cursor: pointer; min-height: 40px;
}
.btn-mini:hover, .btn-mini:focus-visible { color: #fff; border-color: var(--ciano); }

.acoes { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.acoes-coluna { flex-direction: column; align-items: stretch; }
.linha-acoes { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }

/* ========================= TELA INICIAL ========================= */
#tela-inicio { align-items: center; text-align: center; padding-top: 2vh; }
.hiscore { font-family: var(--pixel); font-size: 12px; color: var(--vermelho); letter-spacing: 2px; }
.hiscore span { color: #fff; }
.logo svg { width: clamp(72px, 14vw, 112px); height: auto; filter: drop-shadow(0 0 14px rgba(255, 210, 63, 0.6)); animation: flutuar 2.4s steps(6) infinite alternate; }
@keyframes flutuar { to { transform: translateY(-8px); } }
.titulo-jogo {
  margin: 0; font-family: var(--pixel); font-weight: normal; line-height: 1.15;
  font-size: clamp(30px, 7vw, 58px); color: var(--ciano);
  text-shadow: 3px 3px 0 #b8336a, 6px 6px 0 #2a0b4a, 0 0 22px rgba(57, 230, 255, 0.6);
}
.titulo-jogo span {
  display: block; font-size: 0.72em; color: var(--amarelo);
  text-shadow: 3px 3px 0 #c2410c, 6px 6px 0 #2a0b4a, 0 0 22px rgba(255, 210, 63, 0.55);
}
.subtitulo { margin: 0; font-family: var(--pixel); font-size: 12px; color: var(--verde); letter-spacing: 3px; }
.menu { display: flex; flex-direction: column; gap: 14px; width: min(100%, 400px); margin-top: 6px; }
.menu .btn { width: 100%; }
.pisca { margin: 4px 0 0; font-family: var(--pixel); font-size: 11px; color: var(--amarelo); animation: pisca 1s steps(1) infinite; }
@keyframes pisca { 50% { opacity: 0; } }
.rodape-inicio { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ======================= TÍTULOS E TEXTOS ======================= */
.titulo-tela {
  margin: 0; text-align: center; font-family: var(--pixel); font-weight: normal;
  font-size: clamp(16px, 3.4vw, 24px); color: var(--amarelo);
  text-shadow: 3px 3px 0 #000, 0 0 16px rgba(255, 210, 63, 0.45);
}
.titulo-grande { font-size: clamp(22px, 5vw, 40px); }
.cor-verde { color: var(--verde); text-shadow: 3px 3px 0 #000, 0 0 18px rgba(61, 220, 132, 0.6); }
.cor-vermelho { color: var(--vermelho); text-shadow: 3px 3px 0 #000, 0 0 18px rgba(255, 77, 77, 0.6); }
.cor-amarelo { color: var(--amarelo); }
.info { margin: 0; color: var(--suave); }
.aviso { color: var(--amarelo); }
.erro { color: #ff8a8a; margin: 6px 0; }
.ok { color: var(--verde); margin: 6px 0; }
.destaque { font-family: var(--pixel); font-size: 12px; color: var(--amarelo); margin: 0; line-height: 1.6; }

/* ===================== CONFIGURAÇÃO DA PARTIDA ===================== */
.bloco { border: 3px solid var(--borda); background: var(--painel); padding: 14px; margin: 0; box-shadow: 0 0 0 3px #000; }
.bloco legend { font-family: var(--pixel); font-size: 11px; color: var(--ciano); padding: 0 8px; }
.grade-temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.card-tema {
  --cor: var(--amarelo);
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  background: #120a2c; color: var(--texto); border: 3px solid #2d2152; padding: 12px 8px; cursor: pointer;
  font-family: var(--leitura); font-size: 20px; min-height: 120px;
}
.card-tema svg { width: 40px; height: auto; }
.card-nome { font-family: var(--pixel); font-size: 10px; line-height: 1.5; color: var(--cor); }
.card-desc { font-size: 17px; color: var(--suave); }
.card-tema:hover, .card-tema:focus-visible { border-color: var(--cor); }
.card-tema[aria-pressed="true"] {
  border-color: var(--cor); background: color-mix(in srgb, var(--cor) 16%, #120a2c);
  box-shadow: 0 0 16px color-mix(in srgb, var(--cor) 50%, transparent), inset 0 0 0 2px #000;
}
.card-tema[aria-pressed="true"]::before { content: '▶ SELECIONADO'; font-family: var(--pixel); font-size: 8px; color: var(--cor); }

.grade-opcoes { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  --cor: var(--ciano);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-family: var(--pixel); font-size: 11px; color: var(--cor);
  background: #120a2c; border: 3px solid #2d2152; padding: 12px 14px; cursor: pointer; min-width: 64px; min-height: 48px;
}
.chip small { font-family: var(--leitura); font-size: 17px; color: var(--suave); }
.chip:hover, .chip:focus-visible { border-color: var(--cor); }
.chip[aria-pressed="true"] { border-color: var(--cor); background: color-mix(in srgb, var(--cor) 18%, #120a2c); box-shadow: 0 0 14px color-mix(in srgb, var(--cor) 45%, transparent); }

.nomes { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vs-mini { font-family: var(--pixel); font-size: 14px; color: var(--amarelo); }

/* ============================ CAMPOS ============================ */
.campo { display: flex; flex-direction: column; gap: 6px; font-family: var(--pixel); font-size: 9px; color: var(--ciano); line-height: 1.6; flex: 1; min-width: 150px; }
.campo-linha { flex-direction: row; align-items: center; gap: 10px; flex: none; }
.campo-1p { color: var(--ciano); }
.campo-2p { color: var(--rosa); }
input[type="text"], input[type="search"], input[type="password"], select, textarea {
  font-family: var(--leitura); font-size: 22px; color: var(--texto);
  background: #0b0620; border: 3px solid #3b2a6b; padding: 8px 10px; width: 100%; border-radius: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--ciano); outline: none; box-shadow: 0 0 10px rgba(57, 230, 255, 0.45); }
textarea { resize: vertical; }
input[type="color"] { width: 64px; height: 40px; border: 3px solid #3b2a6b; background: #0b0620; padding: 2px; cursor: pointer; }
input[type="file"] { font-family: var(--leitura); font-size: 18px; color: var(--suave); }
input[type="radio"], input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--verde); }
.check { display: flex; align-items: center; gap: 8px; font-size: 20px; color: var(--suave); }

/* ============================== JOGO ============================== */
.topo-jogo { display: flex; align-items: stretch; gap: 10px; }
.hud {
  flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.6); border: 3px solid var(--borda); padding: 10px 14px; box-shadow: 0 0 0 3px #000;
}
.hud-bloco { display: flex; flex-direction: column; gap: 6px; }
.hud-rotulo { font-family: var(--pixel); font-size: 9px; color: var(--suave); letter-spacing: 1px; }
.hud-valor { font-family: var(--pixel); font-size: clamp(14px, 2.6vw, 20px); color: #fff; text-shadow: 0 0 10px rgba(255, 255, 255, 0.4); }
.hud-combo { color: var(--amarelo); }
.hud-vidas { display: flex; gap: 4px; }
.hud-versus { flex-wrap: nowrap; }
.hud-jogador {
  --cor: var(--ciano);
  flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 6px 10px; border: 3px solid transparent; opacity: 0.55;
}
.hud-jogador .hud-rotulo { color: var(--cor); }
.hud-jogador.ativo { opacity: 1; border-color: var(--cor); box-shadow: 0 0 14px color-mix(in srgb, var(--cor) 50%, transparent); }
.hud-jogador:last-child { text-align: right; }
.hud-mini { font-size: 17px; color: var(--suave); }
.hud-vs { font-family: var(--pixel); font-size: 14px; color: var(--amarelo); align-self: center; }
.btn-pausa { min-width: 48px; font-size: 12px; display: inline-grid; place-items: center; }
.btn-pausa[data-icone][aria-pressed="false"] { opacity: 0.6; }
.popup-tempo {
  position: absolute; right: 56px; top: -6px; font-family: var(--pixel); font-size: 14px;
  text-shadow: 2px 2px 0 #000; animation: subir 1.3s steps(8) forwards; pointer-events: none;
}
.popup-tempo.ganhou { color: var(--verde); }
.popup-tempo.perdeu { color: var(--vermelho); }
.aviso-ranking { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 2px dashed var(--amarelo); padding: 10px 12px; margin: 12px 0; }
.aviso-ranking p { flex: 1; min-width: 220px; }

.barra-tempo { position: relative; height: 22px; background: #0b0620; border: 3px solid #fff; box-shadow: 0 0 0 3px #000; }
.tempo-fill { height: 100%; width: 100%; background: repeating-linear-gradient(90deg, var(--verde) 0 10px, #2fbf71 10px 14px); }
.tempo-fill.alerta { background: repeating-linear-gradient(90deg, var(--vermelho) 0 10px, #c62828 10px 14px); animation: pisca 0.5s steps(1) infinite; }
.tempo-num { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-family: var(--pixel); font-size: 10px; color: #fff; text-shadow: 2px 2px 0 #000; }

.painel-pergunta { display: flex; flex-direction: column; gap: 12px; }
.meta-pergunta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag {
  --cor: var(--amarelo);
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--pixel); font-size: 9px; line-height: 1.4; color: var(--cor);
  border: 2px solid var(--cor); padding: 5px 8px; background: rgba(0, 0, 0, 0.4);
}
.contador { margin-left: auto; font-family: var(--pixel); font-size: 9px; color: var(--suave); }
.pergunta { margin: 0; font-family: var(--leitura); font-weight: normal; font-size: clamp(26px, 3.6vw, 34px); line-height: 1.2; color: #fff; }

.opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opcao {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left;
  font-family: var(--leitura); font-size: 24px; line-height: 1.15; color: var(--texto);
  background: var(--painel); border: 3px solid #4b3a85; box-shadow: var(--sombra);
  padding: 12px 14px; cursor: pointer; min-height: 72px;
  transition: transform 0.08s steps(2);
}
.opcao .letra {
  flex-shrink: 0; display: grid; place-items: center; width: 40px; height: 40px;
  font-family: var(--pixel); font-size: 14px; color: #000; background: var(--amarelo); box-shadow: 3px 3px 0 #000;
}
.opcao:nth-child(2) .letra { background: var(--ciano); }
.opcao:nth-child(3) .letra { background: var(--rosa); }
.opcao:nth-child(4) .letra { background: var(--verde); }
.opcao:hover:not(:disabled), .opcao:focus-visible { border-color: var(--amarelo); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 #000; }
.opcao:disabled { cursor: default; }
.opcao.certa { border-color: var(--verde); background: rgba(61, 220, 132, 0.25); box-shadow: 0 0 20px rgba(61, 220, 132, 0.6); animation: piscar-certo 0.3s steps(2) 3; }
.opcao.errada { border-color: var(--vermelho); background: rgba(255, 77, 77, 0.25); }
.opcao.apagada { opacity: 0.4; }
@keyframes piscar-certo { 50% { background: rgba(61, 220, 132, 0.5); } }
.popup-pontos {
  position: absolute; right: 12px; top: -6px; font-family: var(--pixel); font-size: 14px; color: var(--amarelo);
  text-shadow: 2px 2px 0 #000; animation: subir 1.2s steps(8) forwards; pointer-events: none;
}
@keyframes subir { to { transform: translateY(-46px); opacity: 0; } }

.tremer { animation: tremer 0.35s steps(4); }
@keyframes tremer {
  25% { transform: translate(-6px, 2px); }
  50% { transform: translate(6px, -2px); }
  75% { transform: translate(-4px, 0); }
}

.feedback {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  background: var(--painel); border: 3px solid var(--verde); box-shadow: 0 0 0 3px #000, var(--sombra); padding: 16px;
}
.feedback.erro { border-color: var(--vermelho); }
.fb-titulo { margin: 0; font-family: var(--pixel); font-size: clamp(18px, 3.6vw, 26px); }
.feedback.ok .fb-titulo { color: var(--verde); text-shadow: 0 0 14px rgba(61, 220, 132, 0.7); }
.feedback.erro .fb-titulo { color: var(--vermelho); text-shadow: 0 0 14px rgba(255, 77, 77, 0.7); }
.fb-pontos { margin: 0; font-family: var(--pixel); font-size: 11px; color: var(--amarelo); line-height: 1.6; }
.fb-pontos:empty, .fb-correta:empty { display: none; }
.fb-correta { margin: 0; font-size: 24px; }
.fb-correta strong { color: var(--verde); font-weight: normal; }
.fb-explicacao { margin: 0; font-size: 22px; color: var(--suave); max-width: 720px; }
.fb-explicacao::before { content: '★ '; color: var(--amarelo); }

.banner-vez {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(5, 2, 20, 0.82); animation: entrar 0.25s steps(3);
}
.vez-rotulo { font-family: var(--pixel); font-size: 16px; color: #fff; }
.vez-nome {
  --cor: var(--ciano);
  font-family: var(--pixel); font-size: clamp(22px, 6vw, 44px); color: var(--cor); text-align: center; padding: 0 12px;
  text-shadow: 4px 4px 0 #000, 0 0 24px var(--cor); animation: pisca 0.4s steps(1) 3;
}

/* =========================== RESULTADO =========================== */
.placar-final { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.placar-grande { font-family: var(--pixel); font-size: clamp(26px, 6vw, 44px); color: #fff; text-shadow: 4px 4px 0 #b8336a, 0 0 20px rgba(255, 255, 255, 0.4); }
.estatisticas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 18px 0 0; }
.estatisticas div { border: 2px solid var(--borda); padding: 10px; text-align: center; background: rgba(0, 0, 0, 0.35); }
.estatisticas dt { font-family: var(--pixel); font-size: 8px; color: var(--ciano); margin-bottom: 6px; line-height: 1.5; }
.estatisticas dd { margin: 0; font-size: 26px; }
.duelo-final { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.duelo-jogador {
  --cor: var(--ciano);
  flex: 1; min-width: 220px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  border: 3px solid var(--cor); padding: 14px; background: rgba(0, 0, 0, 0.35); opacity: 0.8;
}
.duelo-jogador .hud-rotulo { color: var(--cor); }
.duelo-jogador.vencedor { opacity: 1; box-shadow: 0 0 24px color-mix(in srgb, var(--cor) 60%, transparent); }
.form-recorde { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.input-recorde {
  width: min(100%, 380px) !important; text-align: center; text-transform: uppercase; letter-spacing: 0.08em;
  font-family: var(--pixel) !important; font-size: 18px !important; color: var(--amarelo) !important; padding: 12px 8px !important;
}

/* ========================== HALL DA FAMA ========================== */
.tabela-ranking { width: 100%; border-collapse: collapse; margin-top: 14px; }
.tabela-ranking th { font-family: var(--pixel); font-size: 9px; color: var(--ciano); text-align: left; padding: 8px 6px; border-bottom: 3px solid var(--borda); }
.tabela-ranking td { padding: 8px 6px; font-size: 22px; border-bottom: 1px dashed #2d2152; }
.tabela-ranking td:nth-child(2), .tabela-ranking td:nth-child(3) { font-family: var(--pixel); font-size: 12px; }
.tabela-ranking .col-nome { overflow-wrap: anywhere; line-height: 1.5; }
.tabela-scroll { overflow-x: auto; }
.tabela-ranking tr.top1 td { color: var(--amarelo); }
.tabela-ranking tr.top2 td { color: #e0e0f0; }
.tabela-ranking tr.top3 td { color: #ffa36b; }

/* =========================== DISTINTIVOS =========================== */
#distintivos-resumo { text-align: center; }
.grade-distintivos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.distintivo {
  --cor: var(--amarelo);
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  background: var(--painel); border: 3px solid #2d2152; padding: 16px 12px; box-shadow: 0 0 0 3px #000;
}
.distintivo strong { font-family: var(--pixel); font-size: 10px; line-height: 1.5; font-weight: normal; color: var(--cor); }
.distintivo span { font-size: 19px; color: var(--suave); }
.distintivo small { font-family: var(--pixel); font-size: 7px; color: var(--suave); line-height: 1.6; }
.distintivo.ganho { border-color: var(--cor); box-shadow: 0 0 0 3px #000, 0 0 18px color-mix(in srgb, var(--cor) 45%, transparent); }
.distintivo.bloqueado strong { color: #6b5f8c; }
.distintivo.bloqueado svg { opacity: 0.6; }

/* ======================= BANCO DE PERGUNTAS ======================= */
.topo-tela { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.abas { display: flex; flex-wrap: wrap; gap: 6px; }
.aba {
  font-family: var(--pixel); font-size: 10px; color: var(--suave); background: rgba(0, 0, 0, 0.55);
  border: 3px solid var(--borda); padding: 12px 14px; cursor: pointer; min-height: 44px;
}
.aba.ativa { color: #000; background: var(--amarelo); border-color: var(--amarelo); }
.aba-painel { display: flex; flex-direction: column; gap: 14px; }
.filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.campo-busca { flex: 2; }
.lista { display: flex; flex-direction: column; gap: 12px; }
.item-pergunta, .item-tema { border: 2px solid #2d2152; background: rgba(0, 0, 0, 0.35); padding: 12px 14px; }
.item-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.item-texto { margin: 10px 0 6px; font-size: 24px; color: #fff; }
.item-opcoes { margin: 0 0 8px; padding-left: 34px; color: var(--suave); }
.item-opcoes li.correta { color: var(--verde); }
.item-explicacao { margin: 0 0 8px; font-size: 19px; color: var(--suave); }
.item-explicacao::before { content: '★ '; color: var(--amarelo); }
.item-acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.item-tema { --cor: var(--amarelo); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-left: 6px solid var(--cor); }
.item-tema-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.item-tema-info strong { font-family: var(--pixel); font-size: 11px; font-weight: normal; color: var(--cor); line-height: 1.6; }
.item-tema-info span, .item-tema-info small { color: var(--suave); font-size: 19px; }
.subtitulo-painel { margin: 8px 0 0; font-family: var(--pixel); font-size: 12px; font-weight: normal; color: var(--ciano); }
.codigo { margin: 0; padding: 10px; background: #000; border: 2px solid var(--borda); color: var(--verde); font-family: var(--leitura); font-size: 20px; overflow-x: auto; }
.ajuda-lista { margin: 0; padding-left: 22px; color: var(--suave); display: flex; flex-direction: column; gap: 6px; }
.ajuda-lista strong { color: #fff; font-weight: normal; }
.importar { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 12px; border: 2px dashed var(--borda); }
.resultado details ul { margin: 6px 0 0; color: #ffb0b0; font-size: 19px; }
.resultado summary { cursor: pointer; }
.form-ajustes { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; max-width: 460px; }
.item-ranking { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 2px solid #2d2152; background: rgba(0, 0, 0, 0.35); padding: 8px 10px; }
.item-ranking-pos, .item-ranking-pontos { font-family: var(--pixel); font-size: 11px; color: var(--amarelo); }
.item-ranking-pos { min-width: 3ch; }
.item-ranking .input-ranking { flex: 1; min-width: 180px; width: auto; text-transform: uppercase; }
.form-ajustes .campo { width: 100%; }

/* ============================ DIÁLOGOS ============================ */
.dialogo {
  width: min(94vw, 520px); max-height: 92vh; overflow: auto;
  background: #0d0726; color: var(--texto); border: 3px solid var(--amarelo); padding: 20px;
  box-shadow: 0 0 0 4px #000, 0 0 40px rgba(255, 210, 63, 0.35);
}
.dialogo-largo { width: min(96vw, 760px); }
.dialogo::backdrop { background: rgba(3, 1, 12, 0.78); }
.dialogo form { display: flex; flex-direction: column; gap: 14px; }
.dialogo .acoes { margin-top: 6px; }
.dialogo-msg { margin: 0 0 16px; font-size: 24px; text-align: center; }
.linha-campos { display: flex; gap: 12px; flex-wrap: wrap; }
.bloco-opcoes #fp-opcoes { display: flex; flex-direction: column; gap: 10px; }
.linha-opcao { display: flex; align-items: center; gap: 10px; }
.linha-opcao .letra { font-family: var(--pixel); font-size: 12px; color: var(--amarelo); cursor: pointer; }
.grade-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-tema {
  --cor: var(--amarelo);
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 44px;
  font-size: 20px; color: var(--texto); background: #0b0620; border: 3px solid #2d2152; padding: 6px 10px;
}
.check-tema span { display: inline-flex; align-items: center; gap: 6px; }
.check-tema:has(input:checked) { border-color: var(--cor); background: color-mix(in srgb, var(--cor) 16%, #0b0620); }
.check-tema:has(input:focus-visible) { outline: 3px dashed #fff; outline-offset: 2px; }
.grade-sprites { display: flex; flex-wrap: wrap; gap: 8px; }
.opcao-sprite input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opcao-sprite span { display: grid; place-items: center; width: 52px; height: 52px; border: 3px solid #2d2152; background: #0b0620; cursor: pointer; }
.opcao-sprite input:checked + span { border-color: var(--amarelo); box-shadow: 0 0 12px rgba(255, 210, 63, 0.6); }
.opcao-sprite input:focus-visible + span { outline: 3px dashed #fff; outline-offset: 2px; }
.input-pin { font-family: var(--pixel) !important; font-size: 22px !important; letter-spacing: 0.4em; text-align: center; }

/* ============================== TOAST ============================== */
/* No computador fica embaixo (sobre o chão do cenário) para não cobrir o HUD */
.toast {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200;
  display: flex; align-items: center; gap: 12px; max-width: min(92vw, 520px);
  background: #0d0726; border: 3px solid var(--ciano); box-shadow: 0 0 0 3px #000, var(--sombra);
  padding: 12px 16px; font-size: 22px; animation: toast-entrar 0.25s steps(3);
}
@keyframes toast-entrar { from { opacity: 0; transform: translate(-50%, 12px); } }
.toast div { display: flex; flex-direction: column; gap: 4px; }
.toast small { font-family: var(--pixel); font-size: 8px; color: var(--amarelo); }
.toast strong { font-family: var(--pixel); font-size: 12px; font-weight: normal; color: #fff; line-height: 1.5; }
.toast-conquista { border-color: var(--amarelo); box-shadow: 0 0 0 3px #000, 0 0 24px rgba(255, 210, 63, 0.5); }
.toast-erro { border-color: var(--vermelho); }
.toast-ok { border-color: var(--verde); }

/* ============ v2: CONFIGURAÇÃO, HALL DA FAMA, RODAPÉ E /perguntas ============ */

/* Modo de jogo e nível lado a lado (empilhados em telas estreitas) */
.linha-config { display: grid; gap: 18px; }
.sub-bloco { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 2px dashed var(--borda); }
.rotulo-mini { font-family: var(--pixel); font-size: 9px; color: var(--rosa); }
@media (min-width: 860px) {
  .linha-config { grid-template-columns: 1fr 1fr; align-items: start; }
  .grade-niveis .chip { flex: 1 1 calc(50% - 5px); }
}

/* Temas: até 3. Com 3 escolhidos, os demais ficam apagados (clicar neles avisa do limite). */
.grade-temas[data-cheio="1"] .card-tema[aria-pressed="false"]:not([data-tema="todos"]) { opacity: 0.5; }

/* Formulário do recorde: apelido, UEL e estado */
.campo-recorde {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: min(100%, 380px); font-family: var(--pixel); font-size: 9px; line-height: 1.6; color: var(--ciano);
}
.linha-recorde { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: flex-end; width: min(100%, 560px); }
.linha-recorde .campo-recorde { flex: 1 1 230px; width: auto; }
.linha-recorde .campo-uf { flex: 0 0 140px; }
.input-uel { font-size: 15px !important; }
select.input-recorde { cursor: pointer; }

/* Hall da Fama: UEL e estado abaixo do apelido */
.col-uel { display: block; margin-top: 2px; font-family: var(--leitura); font-size: 17px; color: var(--suave); line-height: 1.1; }
.filtros .campo-linha select { min-width: 140px; }
.item-ranking-uel { font-size: 17px; color: var(--suave); }
.nota-distintivos { text-align: center; }

/* Rodapé: ano, autor e versão. Some durante a partida e na configuração para não atrapalhar. */
.rodape-app {
  position: fixed; left: 0; right: 0; bottom: 4px; z-index: 20;
  padding: 0 8px; text-align: center; pointer-events: none;
  font-family: var(--pixel); font-size: 9px; line-height: 1.6; letter-spacing: 1px;
  color: var(--suave); opacity: 0.8; text-shadow: 1px 1px 0 #000;
}
body[data-tela="tela-jogo"] .rodape-app,
body[data-tela="tela-config"] .rodape-app { display: none; }

/* Página /perguntas */
body.pagina-admin .rodape-app { position: static; margin: 28px 0 14px; pointer-events: auto; }
body.pagina-admin .tela-larga { width: 100%; }

/* ========================== RESPONSIVO ========================== */
@media (max-width: 640px) {
  body { font-size: 20px; }
  #app { padding-left: 10px; padding-right: 10px; }
  .opcoes { grid-template-columns: 1fr; }
  .opcao { min-height: 60px; font-size: 22px; }
  .grade-temas { grid-template-columns: repeat(2, 1fr); }
  .card-tema { min-height: 104px; }
  .hud { padding: 8px 10px; }
  .hud-mini { display: none; }
  .tabela-ranking th:nth-child(5), .tabela-ranking td:nth-child(5) { display: none; }
  .tabela-ranking td:nth-child(2), .tabela-ranking td:nth-child(3) { font-size: 10px; }
  .input-recorde { font-size: 15px !important; }
  .painel { padding: 14px; }
  .btn { font-size: 11px; padding: 12px 14px; }
  /* No celular fica em cima para não cobrir o botão CONTINUAR */
  .toast { bottom: auto; top: max(10px, env(safe-area-inset-top)); }
}

/* ============== TELAS BAIXAS E CELULARES (menos rolagem) ==============
   Em notebooks (principalmente com ampliação de 125% ou 150% no Windows) e em celulares
   a altura útil é pequena. Aqui os espaços diminuem e, na configuração da partida,
   os botões VOLTAR e START ficam sempre à vista, mesmo com a página rolada. */

#tela-config .acoes {
  position: sticky; bottom: 0; z-index: 5;
  padding: 12px 0 max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(6, 3, 22, 0.96) 62%, rgba(6, 3, 22, 0));
}
/* A barra fixa já ocupa o rodapé, então a folga reservada ao cenário não é necessária aqui */
#app:has(#tela-config.ativa) { padding-bottom: 12px; }

/* Botões pequenos do rodapé: fundo mais firme para o cenário não aparecer através do texto */
.btn-mini { background: rgba(6, 3, 22, 0.84); }

@media (max-height: 820px) {
  #app { padding-bottom: calc(5vh + 12px); }
  .tela.ativa { gap: 12px; }
  #tela-inicio { padding-top: 0; gap: 10px; }
  .logo svg { width: clamp(56px, 10vw, 80px); }
  .titulo-jogo { font-size: clamp(26px, 5.2vw, 44px); }
  .menu { gap: 10px; margin-top: 2px; }
  .menu .btn { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  .titulo-tela { font-size: clamp(14px, 2.6vw, 20px); }
  .bloco { padding: 10px 12px; }
  .grade-temas, .grade-opcoes { gap: 8px; }
  .card-tema { min-height: 92px; padding: 8px 6px; gap: 4px; }
  .card-tema svg { width: 32px; }
  .card-desc { font-size: 15px; line-height: 1.1; }
  .chip { padding: 8px 12px; }
  .painel { padding: 14px; }
}

@media (max-height: 700px) {
  #app { padding-bottom: 12px; }
}

@media (max-width: 640px) {
  .tela.ativa { gap: 12px; }
  .bloco { padding: 10px; }
  .card-tema { min-height: 84px; }
  /* No celular a descrição aparece só no tema selecionado */
  .card-tema:not([aria-pressed="true"]) .card-desc { display: none; }
}

/* Acessibilidade: reduz animações para quem prefere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
