:root {
  --azul-esc: #071c4d;
  --azul: #0d3b9c;
  --azul-claro: #2a7de1;
  --roxo: #6a3cc4;
  --verde: #2e8b2e;
  --verde-btn: #43b048;
  --amarelo: #ffc928;
  --vermelho: #d93535;
  --texto: #1b2440;
  --cinza: #6b7590;
  --B: #2fa84f; --I: #e03a3a; --N: #8a3fc9; --G: #1f6fe0; --O: #f2a20c;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  color: var(--texto);
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, #1f5fd6 0%, #0b2a7a 45%, var(--azul-esc) 100%) fixed;
}
button { font-family: inherit; cursor: pointer; }
.tela { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }
[hidden] { display: none !important; }

/* ---------- Logo ---------- */
.logo { text-align: center; padding: 18px 0 6px; color: #fff; }
.logo h1 {
  font-size: 64px; margin: 6px 0 0; font-weight: 900; letter-spacing: 2px; line-height: 1;
  color: var(--amarelo); text-shadow: 0 4px 0 #a86a00, 0 8px 18px rgba(0,0,0,.45);
}
.logo h1 span { display: block; font-size: 56px; color: #eaf2ff; text-shadow: 0 4px 0 #6d8fc9, 0 8px 18px rgba(0,0,0,.45); }
.logo-bolas { display: flex; justify-content: center; gap: 4px; }
.slogan { font-weight: 700; font-size: 18px; margin: 12px 0 18px; }

/* ---------- Cartões do menu ---------- */
.menu-card {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  background: #fff; border: 0; border-radius: 18px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,.25); transition: transform .1s;
}
.menu-card:active { transform: scale(.98); }
.menu-card .ico { width: 76px; height: 76px; flex: none; border-radius: 16px; display: grid; place-items: center; font-size: 42px; }
.ico-roxo { background: linear-gradient(135deg, #7d4ae0, #4b22a0); }
.ico-azul { background: linear-gradient(135deg, #2c8cff, #1046b8); }
.ico-verde { background: linear-gradient(135deg, #66c93b, #2c8a1e); }
.menu-card .txt { flex: 1; }
.menu-card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.menu-card p { margin: 0; font-size: 15px; color: #333; }
.seta { font-size: 44px; font-weight: 300; }
.roxo { color: var(--roxo); } .azul { color: #2f4fc0; } .verde { color: var(--verde); }

.retomar { background: #fff8d6; border: 2px solid var(--amarelo); border-radius: 14px; padding: 12px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.retomar p { margin: 0; flex: 1; font-size: 14px; }

/* ---------- Topo das telas ---------- */
.topo { display: flex; align-items: center; justify-content: space-between; color: #fff; margin-bottom: 10px; }
.topo h2 { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: .5px; text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voltar, .btn-voz { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 28px; line-height: 1; }
.btn-voz { font-size: 20px; }
.btn-voz.off { opacity: .45; }
.topo > span { width: 44px; }
.subtitulo { color: #fff; text-align: center; font-weight: 700; font-size: 18px; margin: 4px 0 14px; }

/* ---------- Caixas ---------- */
.caixa { background: #f6f8ff; border-radius: 18px; padding: 14px; margin-bottom: 12px; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
.caixa h3 { margin: 0 0 10px; font-size: 15px; color: var(--azul); font-weight: 900; }
details.caixa summary { font-weight: 800; color: var(--azul); cursor: pointer; }
details.caixa .painel75 { margin-top: 10px; }
.form { display: flex; flex-direction: column; gap: 8px; }
.rotulo { font-weight: 900; color: var(--azul); font-size: 14px; margin-top: 6px; }
.campo { width: 100%; font-size: 18px; padding: 12px 14px; border: 2px solid #c9d4ee; border-radius: 12px; background: #fff; outline: none; }
.campo:focus { border-color: var(--azul); }
.campo-id { font-size: 26px; letter-spacing: 6px; text-align: center; font-weight: 800; }
.linha-id { display: flex; flex-direction: column; gap: 8px; }
.opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opcao input { display: none; }
.opcao span { display: block; height: 100%; padding: 12px; border: 2px solid #d5ddf0; border-radius: 14px; background: #fff; text-align: center; color: var(--cinza); }
.opcao b { display: block; font-size: 15px; margin-bottom: 4px; }
.opcao small { font-size: 12px; }
.opcao input:checked + span { border-color: var(--azul); color: var(--azul); background: #eaf0ff; box-shadow: 0 0 0 2px rgba(13,59,156,.15); }
.info { background: #e3ebfa; border-radius: 14px; padding: 12px 14px; font-size: 14px; color: #24345e; }
.info p { margin: 6px 0 0; }
.caixa + .info, .tela > .info { margin-bottom: 12px; }

/* ---------- Botões ---------- */
.btn { border: 0; border-radius: 14px; padding: 12px 16px; font-size: 16px; font-weight: 800; color: #fff; width: 100%; box-shadow: 0 4px 0 rgba(0,0,0,.2); transition: transform .08s; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.btn:disabled { opacity: .5; }
.btn-grande { font-size: 24px; padding: 18px; }
.btn-mini { font-size: 13px; padding: 8px 10px; width: auto; }
.btn-verde { background: var(--verde-btn); }
.btn-azul { background: var(--azul-claro); }
.btn-amarelo { background: var(--amarelo); color: #4a3200; }
.btn-vermelho { background: var(--vermelho); margin-top: 8px; }
.btn-claro { background: #8aa5d2; margin-bottom: 4px; }
.btn-gritar {
  background: linear-gradient(180deg, #ffd23f, #f29a00); color: #5a2a00; font-size: 26px; padding: 18px;
  margin: 12px 0; text-shadow: 0 1px 0 rgba(255,255,255,.5); box-shadow: 0 6px 0 #a35f00, 0 10px 20px rgba(0,0,0,.3);
  animation: pulsar 1.8s infinite;
}
@keyframes pulsar { 50% { transform: scale(1.03); } }
.acoes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.linha-auto { display: flex; gap: 8px; }
.sel { border-radius: 14px; border: 0; padding: 0 12px; font-size: 16px; font-weight: 700; }

/* ---------- Bolas ---------- */
.bola {
  --c: #999; width: 52px; height: 52px; font-size: 19px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.75) 0, rgba(255,255,255,0) 32%), var(--c);
  box-shadow: inset -4px -6px 10px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3);
}
.bola .in { width: 66%; height: 66%; background: #fff; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: .95; font-weight: 900; color: #1a1f33; }
.bola .l { font-size: .5em; }
.bola .n { font-size: 1em; }
.bola.grande { width: 150px; height: 150px; font-size: 54px; }
.bola.media { width: 104px; height: 104px; font-size: 38px; }
.bola.mini { width: 38px; height: 38px; font-size: 14px; }
.bola.vazia { --c: #8b9bbf; }
.b-B { --c: var(--B); } .b-I { --c: var(--I); } .b-N { --c: var(--N); } .b-G { --c: var(--G); } .b-O { --c: var(--O); }
.entra { animation: entra .55s cubic-bezier(.2,1.6,.4,1); }
@keyframes entra { from { transform: scale(.2) rotate(-200deg); opacity: 0; } to { transform: none; opacity: 1; } }

.painel-bola { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 20px; padding: 16px; margin-bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: #fff; }
.painel-bola.compacto { flex-direction: row; padding: 12px; }
.painel-bola .lado { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.recentes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 38px; }
.compacto .recentes { justify-content: flex-start; }
.contador { font-weight: 800; font-size: 15px; opacity: .9; }

/* ---------- Painel 75 ---------- */
.painel75 { display: grid; grid-template-columns: 26px repeat(15, 1fr); gap: 3px; }
.pl-letra { border-radius: 6px; color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 13px; background: var(--c); }
.pl-n { aspect-ratio: 1; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #a8b2c9; background: #fff; border-radius: 50%; }
.pl-n.on { background: var(--azul); color: #fff; }
.pl-n.ult { background: var(--amarelo); color: #4a3200; transform: scale(1.2); box-shadow: 0 0 0 2px #fff; }

/* ---------- Cartela ---------- */
.cartela-box { background: #fff; border-radius: 20px; padding: 12px; box-shadow: 0 8px 20px rgba(0,0,0,.3); }
.cartela { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cab { color: #fff; font-weight: 900; font-size: 26px; text-align: center; border-radius: 10px; padding: 4px 0; background: var(--c); }
.casa {
  position: relative; aspect-ratio: 1; border: 2px solid #dfe5f3; border-radius: 12px; background: #f9fbff;
  font-size: clamp(20px, 7vw, 32px); font-weight: 900; color: var(--texto); display: grid; place-items: center; padding: 0;
}
.casa.livre { background: #fff4c7; border-color: var(--amarelo); color: #e0a400; font-size: 30px; }
.casa.marcada::after {
  content: ""; position: absolute; inset: 9%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55) 0, rgba(255,255,255,0) 35%), rgba(224, 40, 60, .78);
  box-shadow: inset -3px -4px 6px rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.3);
  animation: pedra .25s ease-out;
}
@keyframes pedra { from { transform: scale(1.6); opacity: 0; } }
.casa.marcada { color: #fff; }
.casa.marcada span { position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.casa.erro { animation: tremer .35s; border-color: var(--vermelho); }
@keyframes tremer { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.dica { text-align: center; color: var(--cinza); font-size: 13px; margin: 10px 0 0; }
.jog-info { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.jog-info span { background: rgba(255,255,255,.15); color: #fff; padding: 5px 10px; border-radius: 20px; font-size: 13px; font-weight: 700; }
.espera { text-align: center; }
.ampulheta { font-size: 50px; animation: girar 2s infinite linear; display: inline-block; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Anfitrião ---------- */
.codigo-sala { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.codigo-sala small { color: var(--cinza); font-weight: 800; }
.codigo { font-size: 34px; font-weight: 900; letter-spacing: 4px; color: var(--azul); }
.compartilhar { display: flex; flex-direction: column; gap: 6px; }
.selos { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.selo { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 10px; background: #e3ebfa; color: var(--azul); }
.avisos { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.aviso { padding: 9px 12px; border-radius: 10px; font-size: 14px; background: #fff; border-left: 5px solid #9fb0d6; }
.aviso.armado { border-color: var(--O); background: #fff6e2; }
.aviso.completou { border-color: var(--I); background: #ffe9e9; font-weight: 700; }
.aviso.grito { border-color: var(--B); background: #e6f8e8; font-weight: 800; }
.aviso.gritoInvalido { border-color: #999; }
.aviso.pedido { border-color: var(--N); background: #f3ebff; }
.aviso time { float: right; color: var(--cinza); font-size: 11px; }
.vazio { color: var(--cinza); font-size: 14px; margin: 0; }
.jogador { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #e2e7f3; }
.jogador:last-child { border-bottom: 0; }
.jogador .ponto { width: 10px; height: 10px; border-radius: 50%; background: #bbb; flex: none; }
.jogador .ponto.on { background: #3cc24a; }
.jogador .dados { flex: 1; min-width: 0; }
.jogador .dados b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jogador .dados small { color: var(--cinza); }
.jogador .dados a { color: var(--azul-claro); }
.etiqueta { font-size: 11px; font-weight: 900; padding: 3px 8px; border-radius: 10px; color: #fff; white-space: nowrap; }
.etiqueta.armado { background: var(--O); }
.etiqueta.completou { background: var(--I); }
.jogador .btn-mini { box-shadow: none; }

/* ---------- Lista de salas ---------- */
.cab-lista { display: flex; justify-content: space-between; align-items: center; }
.girando { width: 16px; height: 16px; border: 3px solid #c6d3f0; border-top-color: var(--azul); border-radius: 50%; animation: girar .8s linear infinite; }
.sala-item { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: #fff; border: 2px solid #dbe3f5; border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.sala-item .ic { font-size: 30px; }
.sala-item .d { flex: 1; }
.sala-item b { display: block; font-size: 17px; color: var(--azul); }
.sala-item small { color: var(--cinza); }
.sala-item .entrar { color: var(--verde); font-weight: 900; }
.sem-salas { text-align: center; padding: 18px 6px; color: var(--cinza); }
.sem-salas b { display: block; color: var(--texto); margin: 6px 0; }

/* ---------- Modal e toasts ---------- */
.modal { position: fixed; inset: 0; background: rgba(4, 12, 40, .7); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-caixa { background: #fff; border-radius: 22px; padding: 22px; max-width: 420px; width: 100%; text-align: center; animation: entra .4s; }
.modal-caixa h2 { margin: 6px 0; color: var(--azul); }
.modal-caixa .grande { font-size: 60px; }
.modal-botoes { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.toasts { position: fixed; left: 0; right: 0; bottom: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; padding: 0 16px; }
.toast { background: #17213f; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: opacity .4s, transform .4s; max-width: 520px; }
.toast.erro { background: var(--vermelho); }
.toast.ok { background: var(--verde); }
.toast.sai { opacity: 0; transform: translateY(10px); }
.conexao { position: fixed; top: 0; left: 0; right: 0; background: var(--vermelho); color: #fff; text-align: center; font-weight: 800; padding: 6px; z-index: 70; }

@media (max-width: 380px) {
  .logo h1 { font-size: 52px; } .logo h1 span { font-size: 44px; }
  .bola.grande { width: 124px; height: 124px; font-size: 44px; }
  .menu-card .ico { width: 62px; height: 62px; font-size: 34px; }
  .menu-card h2 { font-size: 19px; }
}
