:root {
  --fundo: #fbf6ee;
  --superficie: #ffffff;
  --texto: #221d17;
  --apagado: #6f665b;
  --linha: #eadfce;
  --marca: #f5a524;
  --marca-texto: #2a1d05;
  --ok: #1f9d55;
  --erro: #d93f3f;
  --sombra: 0 1px 2px rgb(60 40 10 / .06), 0 4px 16px rgb(60 40 10 / .06);
  --cor: var(--marca);
  --raio: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #16131b;
    --superficie: #221e29;
    --texto: #f5efe6;
    --apagado: #a69d92;
    --linha: #353040;
    --sombra: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fundo: #16131b;
  --superficie: #221e29;
  --texto: #f5efe6;
  --apagado: #a69d92;
  --linha: #353040;
  --sombra: none;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--fundo);
  color: var(--texto);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }

main {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.tela { display: flex; flex-direction: column; gap: 16px; flex: 1; }

h1 { font-size: 3rem; line-height: 1; letter-spacing: -.02em; }
h2 { font-size: 1.5rem; line-height: 1.2; }
h3 { font-size: 1.05rem; }

/* ---------- Botões ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 700;
  transition: transform .08s, background-color .2s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.grande { min-height: 64px; font-size: 1.2rem; width: 100%; }
.btn.primario { background: var(--marca); color: var(--marca-texto); }
.btn.secundario { background: var(--superficie); border: 2px solid var(--linha); }
.btn.claro { background: #fff; color: #1d1a16; }
.btn.link { min-height: 44px; color: var(--apagado); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }

.icone {
  width: 44px; height: 44px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  font-size: 1.4rem; font-weight: 700;
}
.icone:active { background: rgb(127 127 127 / .15); }
.icone.pequeno { width: 36px; height: 36px; font-size: 1.2rem; color: var(--apagado); }

.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--marca);
  color: var(--marca-texto);
  font-weight: 700;
}

.acoes { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Topo ---------- */

.topo { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.topo h2 { flex: 1; font-size: 1.25rem; }
.topo .selo { flex: 1; }
.selo { font-weight: 700; font-size: .95rem; opacity: .9; }

/* ---------- Início ---------- */

.inicio { justify-content: center; align-items: center; text-align: center; gap: 12px; }
.inicio .logo { width: 128px; height: 128px; border-radius: 28px; box-shadow: var(--sombra); }
.inicio .sub { color: var(--apagado); font-size: 1.1rem; margin-bottom: 24px; }
.inicio .acoes { width: 100%; max-width: 360px; }

/* ---------- Configuração ---------- */

.cartao {
  background: var(--superficie);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--sombra);
}

.jogadores { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.jogadores li { display: flex; align-items: center; gap: 8px; }
.jogadores input {
  flex: 1; min-width: 0;
  height: 48px; padding: 0 14px;
  border: 2px solid var(--linha); border-radius: 12px;
  background: var(--fundo);
}
.jogadores input:focus, .campo-palavra input:focus { outline: none; border-color: var(--marca); }

.chip-time {
  flex: none;
  min-width: 92px; height: 40px; padding: 0 12px;
  border-radius: 999px;
  background: var(--cor); color: #fff;
  font-weight: 700; font-size: .9rem;
}

.segmentado { display: flex; background: var(--fundo); border: 2px solid var(--linha); border-radius: 14px; padding: 3px; gap: 2px; }
.segmentado button { flex: 1; min-height: 42px; border-radius: 10px; font-weight: 700; color: var(--apagado); }
.segmentado button.ativo { background: var(--marca); color: var(--marca-texto); }

.resumo-times { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: .95rem; }
.resumo-times li { display: flex; gap: 8px; align-items: baseline; }
.resumo-times i, .placar-mini i, .placar i {
  display: inline-block; width: 10px; height: 10px; flex: none;
  border-radius: 50%; background: var(--cor);
}
.resumo-times em { color: var(--apagado); }

.dica { color: var(--apagado); font-size: .9rem; }

.linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.linha.coluna { flex-direction: column; align-items: stretch; }
.passo { display: flex; align-items: center; gap: 4px; }
.passo b { min-width: 2.2ch; text-align: center; font-size: 1.3rem; }
.passo button {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--fundo); border: 2px solid var(--linha);
  font-size: 1.4rem; font-weight: 700;
}

.alternador { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 4px 0; }
.alternador input { position: absolute; opacity: 0; pointer-events: none; }
.alternador .texto { flex: 1; display: flex; flex-direction: column; }
.alternador small { color: var(--apagado); font-size: .85rem; }
.alternador .trilho {
  flex: none; position: relative;
  width: 52px; height: 32px; border-radius: 999px;
  background: var(--linha); transition: background .2s;
}
.alternador .trilho::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25);
  transition: transform .2s;
}
.alternador input:checked ~ .trilho { background: var(--ok); }
.alternador input:checked ~ .trilho::after { transform: translateX(20px); }
.alternador input:focus-visible ~ .trilho { outline: 3px solid var(--marca); outline-offset: 2px; }

.estimativa { text-align: center; color: var(--apagado); }
.erros { list-style: none; background: color-mix(in srgb, var(--erro) 12%, transparent); color: var(--erro); border-radius: 12px; padding: 12px 16px; font-weight: 600; }

/* ---------- Portões (passar o celular) ---------- */

.portao {
  background: var(--cor);
  color: #fff;
  margin: calc(-1 * max(16px, env(safe-area-inset-top))) -16px calc(-1 * max(20px, env(safe-area-inset-bottom)));
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  min-height: 100dvh;
}
.portao .centro { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 8px; font-size: 1.15rem; }
.nome-grande { font-size: clamp(2.6rem, 14vw, 4.2rem); font-weight: 800; line-height: 1.05; overflow-wrap: anywhere; }
.portao .regra { margin-top: 16px; background: rgb(0 0 0 / .18); padding: 12px 16px; border-radius: 14px; font-weight: 600; }
.portao .info { opacity: .9; font-size: 1rem; }
.portao .destaque { background: #fff; color: #1d1a16; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 1rem; margin-bottom: 16px; }
.contagem { text-align: center; font-size: 5rem; font-weight: 800; min-height: 64px; line-height: 1; animation: pulsar .8s ease-out infinite; }
@keyframes pulsar { from { transform: scale(1.3); opacity: .4; } }

.placar-mini { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.placar-mini span { display: inline-flex; align-items: center; gap: 6px; background: rgb(255 255 255 / .92); color: #1d1a16; padding: 4px 12px; border-radius: 999px; font-size: .9rem; }

/* ---------- Escrita ---------- */

.contador { font-weight: 800; font-size: 1.2rem; background: var(--superficie); border: 2px solid var(--linha); padding: 2px 12px; border-radius: 999px; }
.contador.cheio { background: var(--ok); border-color: var(--ok); color: #fff; }
.campo-palavra { display: flex; gap: 8px; }
.campo-palavra input {
  flex: 1; min-width: 0; height: 56px; padding: 0 16px;
  border: 2px solid var(--linha); border-radius: 14px;
  background: var(--superficie); font-size: 1.15rem;
}
.ajuda:empty { display: none; }
.ajuda .aviso { color: var(--erro); font-weight: 600; }
.ajuda .quis-dizer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ajuda .ideia { color: var(--apagado); }
.confirmar {
  background: var(--superficie); border: 2px solid var(--marca); border-radius: var(--raio);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; text-align: center;
}
.confirmar .opcoes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.confirmar .opcoes .btn { min-height: 48px; }
.feito { background: color-mix(in srgb, var(--ok) 14%, transparent); padding: 12px 16px; border-radius: 14px; }
.minhas { list-style: none; counter-reset: n; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.minhas li {
  counter-increment: n;
  display: flex; align-items: center; gap: 10px;
  background: var(--superficie); border: 1px solid var(--linha); border-radius: 12px;
  padding: 4px 4px 4px 12px;
}
.minhas li::before { content: counter(n); color: var(--apagado); font-weight: 700; min-width: 1.5ch; }
.minhas li span { flex: 1; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Vez ---------- */

.vez {
  background: var(--cor);
  color: #fff;
  margin: calc(-1 * max(16px, env(safe-area-inset-top))) -16px calc(-1 * max(20px, env(safe-area-inset-bottom)));
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  user-select: none;
}
.relogio { display: flex; align-items: center; gap: 12px; }
.relogio .barra { flex: 1; height: 12px; border-radius: 999px; background: rgb(0 0 0 / .2); overflow: hidden; }
.relogio .barra span { display: block; height: 100%; background: #fff; border-radius: inherit; transition: width .1s linear; }
.segundos { font-size: 2.6rem; font-weight: 800; min-width: 2.2ch; text-align: right; font-variant-numeric: tabular-nums; line-height: 1; }
main.acabando .segundos { animation: piscar .5s steps(2) infinite; }
@keyframes piscar { 50% { opacity: .35; } }

.cartao-palavra {
  flex: 1;
  background: #fff; color: #1d1a16;
  border-radius: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px 16px;
  text-align: center;
  box-shadow: 0 8px 30px rgb(0 0 0 / .18);
}
.cartao-palavra small { color: #6f665b; }
.palavra { font-size: clamp(2.2rem, 12vw, 3.8rem); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; hyphens: auto; animation: entrar .18s ease-out; }
.palavra.longa { font-size: clamp(1.7rem, 8.5vw, 2.8rem); }
@keyframes entrar { from { transform: translateY(8px) scale(.96); opacity: 0; } }
.pausa { display: flex; flex-direction: column; gap: 16px; align-items: center; width: 100%; }
.pausa p { font-size: 2rem; font-weight: 800; }

.botoes-vez { display: flex; flex-direction: column; gap: 10px; }
.botoes-vez .lado { display: flex; gap: 10px; }
.botoes-vez .lado .btn { flex: 1; min-height: 60px; background: rgb(0 0 0 / .22); color: #fff; font-size: 1.1rem; }
.btn.acertou { min-height: 96px; background: #fff; color: var(--ok); font-size: 1.7rem; font-weight: 800; border-radius: 20px; }

/* ---------- Revisão ---------- */

.revisao h2 { font-size: 2rem; }
.revisao .quem { color: var(--apagado); font-weight: 600; margin-top: -8px; }
.lista-revisao { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.lista-revisao button {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--superficie); border: 2px solid var(--linha); border-radius: 14px;
  padding: 12px 14px; min-height: 56px;
}
.lista-revisao .marca {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  background: var(--linha); color: var(--apagado);
}
.lista-revisao button.ok { border-color: var(--ok); }
.lista-revisao button.ok .marca { background: var(--ok); color: #fff; }
.lista-revisao button.apito:not(.ok) { border-color: var(--marca); border-style: dashed; }
.lista-revisao .txt { display: flex; flex-direction: column; font-weight: 700; font-size: 1.1rem; }
.lista-revisao small { font-weight: 500; font-size: .85rem; color: var(--apagado); }
.pontos-vez { text-align: center; font-size: 1.3rem; font-weight: 800; color: var(--cor); margin-top: auto; }

/* ---------- Placar e fim ---------- */

.placar { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); }
.placar th, .placar td { padding: 10px 8px; text-align: center; font-variant-numeric: tabular-nums; }
.placar th { font-size: .9rem; color: var(--apagado); border-bottom: 1px solid var(--linha); }
.placar td:first-child, .placar th:first-child { text-align: left; padding-left: 14px; }
.placar .nome-time { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.placar tr:not(:last-child) td { border-bottom: 1px solid var(--linha); }
.placar b { font-size: 1.2rem; }

.fim-rodada h2, .fim h2 { text-align: center; }
.proxima { text-align: center; background: var(--superficie); border: 2px solid var(--marca); border-radius: var(--raio); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.proxima h3 { font-size: 1.4rem; }
.proxima .regra { font-weight: 700; }
.fim-rodada .info { text-align: center; }
.fim-rodada .btn.grande, .fim .acoes { margin-top: auto; }

.trofeu { font-size: 4.5rem; text-align: center; animation: pular 1s ease-in-out infinite alternate; }
@keyframes pular { to { transform: translateY(-8px) rotate(-4deg); } }
.fim h2 { color: var(--cor); font-size: 1.8rem; }
.curiosidades { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.curiosidades li { display: flex; gap: 10px; background: var(--superficie); border: 1px solid var(--linha); border-radius: 14px; padding: 12px 14px; }

/* ---------- Camada (menu, regras) ---------- */

#camada {
  position: fixed; inset: 0; z-index: 10;
  background: rgb(0 0 0 / .5);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
}
#camada[hidden] { display: none; }
.janela {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto;
  background: var(--fundo); border-radius: 24px; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  animation: subir .2s ease-out;
}
@keyframes subir { from { transform: translateY(30px); opacity: 0; } }
.lista-regras { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Rodada secreta ---------- */

.convite h2 { text-align: center; }
.segredo {
  text-align: center;
  background: linear-gradient(135deg, #2b1f45, #4a2a6b);
  color: #fff;
  border-radius: var(--raio);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.segredo .cadeado { font-size: 3rem; line-height: 1; animation: pular 1s ease-in-out infinite alternate; }
.segredo h3 { font-size: 1.35rem; }
.segredo .regra { background: rgb(255 255 255 / .14); padding: 10px 14px; border-radius: 12px; font-weight: 700; }
.convite .acoes { margin-top: auto; }

/* ---------- Quem está em cada time ---------- */

.lista-times { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.lista-times li {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  background: var(--superficie); color: var(--texto);
  border-radius: 12px; padding: 8px 12px;
}
.lista-times i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--cor); flex: none; }
.portao .adivinham { line-height: 1.3; }
.portao .adivinham b { font-size: 1.25rem; }
.portao .adivinham small { opacity: .85; }
