﻿:root {
  --fundo: #07142f;
  --fundo-2: #0d2150;
  --superficie: #f6f8fc;
  --superficie-2: #e8eef9;
  --texto: #10204a;
  --texto-suave: #4b5a7c;
  --claro: #eaf2ff;
  --neon: #4fb3ff;
  --pergunta: #1e8e3e;
  --evento: #d93025;
  --sinapse: #1a56db;
  --impulso: #f4b400;
  --ok: #1e8e3e;
  --nao: #d93025;
  --raio: 16px;
  --sombra: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--claro);
  background:
    radial-gradient(circle at 15% 10%, rgba(79, 179, 255, .18), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(140, 92, 255, .18), transparent 45%),
    var(--fundo);
  min-height: 100vh;
}
h1, h2, h3, .marca, .btn, .sobretitulo { font-family: 'Baloo 2', 'Nunito', sans-serif; }
[hidden] { display: none !important; }

/* ---------- Topo ---------- */
.topo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid rgba(79, 179, 255, .25);
  background: rgba(7, 20, 47, .85); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px);
}
.marca { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.6rem; line-height: 1; }
.marca em { color: var(--neon); font-style: italic; font-weight: 800; }
.marca-icone { font-size: 1.8rem; }
.topo nav { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Botões ---------- */
.btn {
  font-size: 1.05rem; font-weight: 800; border: 0; border-radius: 12px; padding: 10px 18px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .1s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primario { background: linear-gradient(180deg, #4fb3ff, #1a56db); color: #fff; box-shadow: 0 4px 0 #0e3a9e; }
.btn-primario:hover:not(:disabled) { filter: brightness(1.1); }
.btn-ghost { background: rgba(79, 179, 255, .12); color: var(--claro); border: 1px solid rgba(79, 179, 255, .35); }
.btn-ghost:hover { background: rgba(79, 179, 255, .22); }
.btn-som { font-size: 1.15rem; padding: 8px 12px; }
.btn-som.desligado { opacity: .4; text-decoration: line-through; }
.btn-grande { font-size: 1.25rem; padding: 14px 22px; flex: 1; }

/* ---------- Telas ---------- */
.tela { max-width: 1200px; margin: 0 auto; padding: 20px 16px 40px; }
.cartao {
  background: rgba(13, 33, 80, .75); border: 1px solid rgba(79, 179, 255, .25);
  border-radius: var(--raio); padding: 18px; box-shadow: var(--sombra);
}
.cartao h3 { margin: 0 0 10px; font-size: 1.2rem; color: var(--neon); }
.sobretitulo { margin: 0; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; color: var(--neon); }

.inicio { max-width: 720px; margin: 10px auto 24px; padding: 28px; }
.inicio h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.1; margin: 8px 0 10px; }
.destaque { color: var(--neon); }
.lead { color: #c3d4f3; margin: 0 0 20px; }

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 700; }
.campo-linha { flex-direction: row; align-items: center; gap: 10px; }
input, select {
  font: inherit; font-size: 1.05rem; padding: 11px 14px; border-radius: 10px; width: 100%;
  border: 1px solid rgba(79, 179, 255, .35); background: #fff; color: var(--texto);
}
select { width: auto; }
input:focus, select:focus { outline: 3px solid rgba(79, 179, 255, .6); outline-offset: 1px; }

.lista-jogadores { display: grid; gap: 10px; }
.linha-jogador { display: flex; align-items: center; gap: 10px; }
.btn-remover {
  background: transparent; color: #9fb3d9; border: 0; font-size: 1.2rem; cursor: pointer; padding: 6px 8px;
}
.btn-remover:hover { color: #fff; }
.acoes-form { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.erro { color: #ff8b82; font-weight: 700; min-height: 1.2em; margin: 10px 0 0; }

.cores { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; max-width: 1000px; margin: 0 auto; }
.cor { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 2px solid var(--c); }
.cor b {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: #fff; font-size: 1.5rem;
}
.cor div { display: flex; flex-direction: column; }
.cor span { color: #c3d4f3; font-size: .92rem; }
.cor-pergunta { --c: var(--pergunta); }
.cor-evento { --c: var(--evento); }
.cor-sinapse { --c: var(--sinapse); }
.cor-impulso { --c: var(--impulso); }
.cor b svg { width: 24px; fill: currentColor; }

/* ---------- Peões ---------- */
.pawn {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--c); color: #111; font-size: .72rem; font-weight: 800;
  border: 2px solid #07142f; box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(0, 0, 0, .5);
}
.pawn.ativo { animation: pulso 1s infinite; }
@keyframes pulso { 50% { transform: scale(1.2); box-shadow: 0 0 0 3px #fff, 0 0 14px 4px var(--c); } }

/* ---------- Partida ---------- */
#tela-jogo { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.area-tabuleiro { display: flex; flex-direction: column; gap: 10px; }
.ponta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; border-radius: 14px; font-size: 1.1rem;
}
.ponta-inicio { background: linear-gradient(90deg, #ff8fa3, #c2185b); color: #fff; align-self: flex-start; }
.ponta-fim { background: linear-gradient(90deg, #d93025, #8e1b12); color: #fff; align-self: flex-start; }
.ponta .pawns { display: flex; gap: 4px; min-height: 22px; }

.tabuleiro {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; padding: 12px;
  border-radius: 20px; background: rgba(255, 255, 255, .95); box-shadow: var(--sombra), 0 0 0 4px rgba(79, 179, 255, .4);
}
.casa {
  aspect-ratio: 1; border-radius: 10px; position: relative; display: grid; place-items: center;
  color: #fff; background: var(--c); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2); min-width: 0;
}
.casa-pergunta { --c: var(--pergunta); }
.casa-evento { --c: var(--evento); }
.casa-sinapse { --c: var(--sinapse); }
.casa-impulso { --c: var(--impulso); }
.casa.destino { outline: 4px solid #fff; outline-offset: -2px; box-shadow: 0 0 0 3px var(--neon), 0 0 18px var(--neon); z-index: 1; }
.casa-num { position: absolute; top: 3px; left: 6px; font-size: .7rem; font-weight: 800; opacity: .85; }
.casa-icone { font-size: clamp(1rem, 2.6vw, 2rem); font-weight: 800; line-height: 1; text-shadow: 0 2px 2px rgba(0, 0, 0, .25); }
.casa-icone svg, .modal-icone svg { width: clamp(1.1rem, 2.6vw, 2rem); fill: currentColor; stroke: currentColor; }
.casa .pawns { position: absolute; bottom: 3px; left: 3px; right: 3px; display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
.casa .pawn { width: 18px; height: 18px; font-size: .62rem; }

.painel { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 76px; }
.vez h2 { margin: 2px 0 12px; font-size: 1.8rem; line-height: 1.1; color: #fff; text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 4px; text-underline-offset: 6px; word-break: break-word; }
.dado-linha { display: flex; gap: 12px; align-items: center; }
.dado { font-size: 3.4rem; line-height: 1; width: 64px; text-align: center; color: #fff; }
.dado.rolando { animation: girar .12s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.relogio-partida { margin: 12px 0 0; color: #c3d4f3; }

.placar { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.placar li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.placar li.ativo { background: rgba(79, 179, 255, .2); outline: 1px solid var(--neon); }
.placar-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.placar-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.placar-info small { color: #b4c6ea; }
.placar-tempo { font-variant-numeric: tabular-nums; font-weight: 800; }

.historico { list-style: none; margin: 0; padding: 0; font-size: .92rem; color: #c3d4f3; max-height: 220px; overflow: auto; display: grid; gap: 4px; }
.historico li:first-child { color: #fff; }

/* ---------- Modal ---------- */
.modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  border: 0; border-radius: 20px; padding: 0; background: var(--superficie); color: var(--texto);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.modal::backdrop { background: rgba(3, 10, 28, .75); backdrop-filter: blur(3px); }
.modal-topo { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--c); color: #fff; }
.modal-topo h2 { margin: 0; font-size: 1.5rem; line-height: 1.1; }
.modal-icone { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .25); font-size: 1.6rem; font-weight: 800; flex: none; }
.modal-pergunta { --c: var(--pergunta); }
.modal-evento { --c: var(--evento); }
.modal-sinapse { --c: var(--sinapse); }
.modal-impulso { --c: #d99a00; }
.modal-corpo { padding: 18px 20px 22px; }
.quem { margin: 0; font-weight: 800; color: var(--texto-suave); }
.tema { display: inline-block; margin: 6px 0 0; padding: 2px 10px; border-radius: 99px; background: var(--superficie-2); font-size: .85rem; font-weight: 800; }
.enunciado { font-size: 1.25rem; font-weight: 800; margin: 10px 0 14px; }
.opcoes { display: grid; gap: 8px; }
.opcoes-ordem { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.opcao {
  font: inherit; font-weight: 700; text-align: left; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: #fff; color: var(--texto); border: 2px solid #cbd6ec;
}
.opcao b { color: var(--sinapse); margin-right: 6px; }
.opcao:hover:not(:disabled) { border-color: var(--sinapse); }
.opcao:disabled { cursor: default; opacity: .55; }
.opcao.certa { border-color: var(--ok); background: #e3f5e8; opacity: 1; }
.opcao.errada { border-color: var(--nao); background: #fde6e4; opacity: 1; }
.feedback { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.escolha { flex-direction: row; flex-wrap: wrap; }
.resultado { font-size: 1.15rem; font-weight: 800; margin: 0; }
.resultado.ok { color: var(--ok); }
.resultado.nao { color: var(--nao); }
.explicacao { margin: 0; color: var(--texto-suave); }
.status-salvo { color: var(--texto-suave); font-size: .9rem; }

.cronometro { position: relative; height: 26px; border-radius: 99px; background: var(--superficie-2); overflow: hidden; margin-bottom: 12px; }
.cronometro-barra { height: 100%; width: 100%; background: var(--sinapse); transition: width .1s linear; }
.cronometro.urgente .cronometro-barra { background: var(--nao); }
.cronometro-num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.montagem, .gabarito { margin: 0 0 10px; padding-left: 26px; font-weight: 800; min-height: 1.4em; }
.montagem li, .gabarito li { padding: 2px 0; }
.gabarito { color: var(--ok); }
.dica { margin: 0 0 8px; font-size: .9rem; color: var(--texto-suave); }
.btn-limpar { margin-top: 8px; color: var(--texto); }

.tabela-rolagem { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .95rem; }
.tabela th, .tabela td { padding: 7px 8px; text-align: left; border-bottom: 1px solid #dbe3f2; white-space: nowrap; }
.tabela th { font-size: .8rem; text-transform: uppercase; color: var(--texto-suave); }
.tabela td:nth-child(2) { font-weight: 800; white-space: normal; }
.modal .btn-ghost { color: var(--texto); }
.modal .campo span { color: var(--texto); }

.regras ol { padding-left: 22px; }
.regras-cores { list-style: none; padding: 0; display: grid; gap: 8px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--c); color: #fff; font-weight: 800; margin-right: 6px; }
.rodape-regras { font-size: .88rem; color: var(--texto-suave); }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  #tela-jogo { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
  .painel { display: contents; }
  .topo { position: static; }
  .vez { order: -1; position: sticky; top: 0; z-index: 3; padding: 12px 16px; }
  .vez h2 { font-size: 1.4rem; margin-bottom: 8px; }
  .dado { font-size: 2.6rem; width: 48px; }
  .historico { max-height: 140px; }
}
@media (max-width: 560px) {
  .tabuleiro { gap: 3px; padding: 6px; border-radius: 14px; }
  .casa { border-radius: 6px; }
  .casa-num { font-size: .55rem; left: 3px; top: 1px; }
  .casa .pawn { width: 13px; height: 13px; font-size: .5rem; box-shadow: 0 0 0 1px #fff; border-width: 1px; }
  .inicio { padding: 20px; }
  .marca { font-size: 1.3rem; }
  .topo { padding: 10px 16px; }
  .topo nav { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr) auto auto; gap: 6px; }
  .topo nav .btn { font-size: .8rem; padding: 8px 2px; white-space: nowrap; }
  .topo nav .btn-som { padding: 8px 8px; }
  .acoes-form .btn { flex: 1 1 100%; }
}

/* ---------- Online ---------- */
.chamada-online {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin: 4px 0 6px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(37, 211, 102, .22), rgba(79, 179, 255, .18)); border: 1px solid rgba(37, 211, 102, .6);
  color: #fff; text-decoration: none; font-size: 1.1rem; transition: filter .15s;
}
.chamada-online:hover { filter: brightness(1.15); }
.chamada-online > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.chamada-online small { color: #c3d4f3; font-size: .9rem; }
.chamada-online-icone { font-size: 1.8rem; }
.divisor { display: flex; align-items: center; gap: 10px; color: #9fb3d9; font-size: .9rem; margin: 16px 0; }
.divisor::before, .divisor::after { content: ''; flex: 1; height: 1px; background: rgba(79, 179, 255, .3); }

.conexao { position: sticky; top: 0; z-index: 20; text-align: center; padding: 8px 16px; background: #f4b400; color: #10204a; font-weight: 800; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: calc(100vw - 32px);
  padding: 12px 20px; border-radius: 12px; background: #1e8e3e; color: #fff; font-weight: 800; box-shadow: var(--sombra);
}

.lobby { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.convite { text-align: center; }
.convite h3 { margin-top: 18px; }
.codigo-sala { font: 800 clamp(2.6rem, 9vw, 3.6rem)/1 'Baloo 2', sans-serif; letter-spacing: .18em; margin: 6px 0 2px; color: #fff; }
.turma-sala { margin: 0 0 10px; color: #c3d4f3; }
.qr-sala { display: inline-block; padding: 10px; background: #fff; border-radius: 14px; line-height: 0; }
.qr-sala img, .qr-sala canvas { width: 168px; height: 168px; }
.link-sala { font-weight: 800; color: var(--neon); word-break: break-all; margin: 8px 0 0; }
.form-whats { display: flex; gap: 8px; }
.form-whats input { flex: 1; min-width: 0; }
.btn-whats { background: #25d366; color: #073b1c; box-shadow: 0 4px 0 #128c4a; white-space: nowrap; }
.btn-whats:hover { filter: brightness(1.08); }
.acoes-convite { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.acoes-convite .btn { font-size: .95rem; }
.convites { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; color: #c3d4f3; font-size: .9rem; text-align: left; }

.sala-jogadores { display: flex; flex-direction: column; gap: 12px; }
.sala-jogadores h3 { display: flex; justify-content: space-between; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.slot { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); min-height: 52px; }
.slot-nome { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.slot-nome em, .placar-info em { font-weight: 400; color: #9fb3d9; }
.slot-vazio { border: 2px dashed rgba(79, 179, 255, .3); background: transparent; }
.pawn-vazio { width: 22px; height: 22px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .35); flex: none; }
.aguardando, .aguardando-host { color: #9fb3d9; }
.modal .aguardando-host { color: var(--texto-suave); margin: 0; }
.dica-lobby { margin: 8px 0 0; color: #c3d4f3; font-size: .92rem; }
#lobby-acao .btn-grande { width: 100%; }
.reticencias::after { content: ''; animation: reticencias 1.4s steps(4) infinite; }
@keyframes reticencias { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; vertical-align: middle; }
.dot.on { background: #25d366; box-shadow: 0 0 6px #25d366; }
.dot.off { background: #7a869e; }
.btn.pulsar { animation: pulsar-btn 1.2s infinite; }
@keyframes pulsar-btn { 50% { box-shadow: 0 4px 0 #0e3a9e, 0 0 0 6px rgba(79, 179, 255, .35); } }
.nav-online { display: flex; gap: 6px; }

@media (max-width: 860px) {
  .lobby { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topo .nav-online { grid-template-columns: 1fr 1fr auto auto; }
  .form-whats { flex-direction: column; }
}
