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

:root {
  --navy: #2d3455;
  --navy-2: #232946;
  --azul: #3f8efc;
  --azul-claro: #74b9ff;
  --amarelo: #ffce3d;
  --verde: #2ecc71;
  --vermelho: #ff5e57;
  --roxo: #6c5ce7;
  --fundo: #564bd8;
  --cinza: #7a839e;
  --cinza-claro: #eef1f8;
}

html, body { height: 100%; }

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background-color: var(--fundo);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.08' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M28 44 q16 -28 32 0 t32 0'/%3E%3Ccircle cx='190' cy='42' r='13'/%3E%3Cpath d='M52 152 h26 M65 139 v26'/%3E%3Cpath d='M196 130 l7 14 15 2 -11 11 3 15 -14 -7 -14 7 3 -15 -11 -11 15 -2 z'/%3E%3Cpath d='M120 200 l18 -30 18 30 z'/%3E%3Cpath d='M30 210 q10 -12 20 0 q10 12 20 0'/%3E%3Ccircle cx='120' cy='96' r='5'/%3E%3C/g%3E%3C/svg%3E");
  min-height: 100vh;
  color: var(--navy);
  font-weight: 700;
}

.oculto { display: none !important; }

.tela {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 10px 0 rgba(35, 41, 70, .28), 0 24px 60px rgba(35, 41, 70, .35);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  text-align: center;
}

/* ============ botões (linguagem de jogo: chunky, borda navy, sombra 3D) ============ */

.btn, .btn-perfil, .btn-amarelo,
#opcoes-palavras button, #btn-som {
  font-family: inherit;
  font-weight: 900;
  border: 3px solid var(--navy);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--navy);
  cursor: pointer;
  transition: transform .06s, filter .12s, box-shadow .06s;
  letter-spacing: .5px;
}
.btn:hover, .btn-perfil:hover,
#opcoes-palavras button:hover { filter: brightness(1.06); }
.btn:active, .btn-perfil:active,
#opcoes-palavras button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }

.btn {
  display: block;
  width: 100%;
  padding: 13px;
  font-size: 17px;
  margin-bottom: 12px;
}

.btn-primario { background: var(--amarelo); color: var(--navy); }
.btn-secundario { background: var(--azul); color: #fff; }
.btn:disabled {
  background: var(--cinza-claro);
  color: var(--cinza);
  border-color: #c3cadf;
  box-shadow: 0 4px 0 #c3cadf;
  cursor: default;
  filter: none;
}
.btn:disabled:active { transform: none; box-shadow: 0 4px 0 #c3cadf; }

.pontinhos i {
  font-style: normal;
  opacity: .15;
  animation: pontinho 1.3s infinite;
}
.pontinhos i:nth-child(2) { animation-delay: .2s; }
.pontinhos i:nth-child(3) { animation-delay: .4s; }
@keyframes pontinho {
  0%, 60%, 100% { opacity: .15; }
  30% { opacity: 1; }
}
.btn-link {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--cinza);
  font-weight: 700;
  font-size: 14px;
  text-decoration: underline;
}
.btn-link:active { transform: none; }

input[type="text"] {
  font-family: inherit;
  font-weight: 800;
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--navy);
  border: 3px solid #dfe4f2;
  border-radius: 14px;
  margin-bottom: 12px;
  text-align: center;
  outline: none;
  transition: border-color .15s;
}
input[type="text"]:focus { border-color: var(--azul); }
input::placeholder { color: #aab3cc; font-weight: 700; }

select {
  font-family: inherit;
  font-weight: 800;
  color: var(--navy);
  padding: 9px 12px;
  border-radius: 12px;
  border: 3px solid #dfe4f2;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}
select:focus { border-color: var(--azul); }
select:disabled { opacity: .55; cursor: default; }

/* ============ tela inicial ============ */

.inicio-wrap { width: 100%; max-width: 700px; text-align: center; }

.logo {
  margin: 0 0 6px;
  line-height: 0;
}
.logo-img {
  width: min(340px, 78vw);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 5px 0 rgba(35, 41, 70, .28));
}
.tagline {
  color: var(--amarelo);
  font-weight: 900;
  letter-spacing: 5px;
  font-size: 14px;
  text-shadow: 0 2px 0 rgba(35, 41, 70, .5);
  margin-bottom: 18px;
}

#lang-select {
  font-family: inherit;
  font-weight: 900;
  font-size: 15px;
  color: var(--navy);
  background: #fff;
  border: 3px solid var(--navy);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--navy);
  padding: 12px 10px;
  cursor: pointer;
  height: 100%;
}

/* home = coluna única num painel roxo escuro translúcido sobre o fundo */
.card-inicio {
  max-width: 460px;
  margin: 0 auto;
  background: rgba(30, 26, 74, .38);
  border: 2px solid rgba(255, 255, 255, .08);
  border-radius: 24px;
  box-shadow: 0 12px 34px rgba(20, 16, 55, .35);
  padding: 22px 20px 20px;
}
.card-inicio .btn:last-of-type { margin-bottom: 0; }

.nick-row { display: flex; gap: 10px; margin-bottom: 16px; }
.nick-row input[type="text"] { flex: 1; min-width: 0; margin: 0; font-size: 20px; padding: 16px 18px; }
.nick-row #lang-switch { flex-shrink: 0; }

.avatar-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}
.avatar-wrap { position: relative; cursor: pointer; }

.avatar-grande {
  font-size: 58px;
  width: 104px;
  height: 104px;
  line-height: 94px;
  flex-shrink: 0;
  background: radial-gradient(circle at 30% 25%, #ffe9a3, #ffd35c);
  border: 4px solid var(--navy);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--navy);
  transition: transform .1s;
}
.avatar-wrap:hover .avatar-grande { transform: scale(1.05) rotate(-4deg); }

/* selo de "editável" na quina do avatar (fundo branco pro lápis aparecer) */
.avatar-edit {
  position: absolute;
  bottom: -4px;
  right: -6px;
  width: 40px;
  height: 40px;
  line-height: 34px;
  text-align: center;
  font-size: 20px;
  background: #fff;
  border: 3px solid var(--navy);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--navy);
  pointer-events: none;
}

.avatar-dica {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  opacity: .95;
}

/* botão aleatório dentro do popup de avatar */
#modal-avatar #av-random { margin-top: 14px; }

/* JOGAR = botão grande, verde e destacado (estilo skribbl) */
.btn-jogar {
  background: var(--verde);
  color: #fff;
  font-size: 25px;
  padding: 16px;
  letter-spacing: 1px;
}
/* pulso de expansão só no JOGAR da home (convida o clique, como nos quizzes) */
#btn-publico { animation: pulsa-jogar 1.3s ease-in-out infinite; }
#btn-publico:active { animation: none; }
@keyframes pulsa-jogar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}
.card-inicio .btn-secundario { font-size: 18px; padding: 15px; }

.btn-howto {
  background: rgba(30, 26, 74, .38);
  border: 3px solid var(--navy);
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(45, 52, 85, .55);
  font-family: inherit;
  font-weight: 900;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  margin-top: 18px;
  padding: 12px 28px;
}
.btn-howto:hover { background: rgba(30, 26, 74, .55); }
.btn-howto:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(45, 52, 85, .55); }

.modo-convite #btn-publico,
.modo-convite #btn-criar,
.modo-convite #lang-switch { display: none; }
/* convidado pode nunca ter jogado → mostra 'como funciona' abaixo do Entrar */

.howto-passos {
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.5;
  margin: 10px 0 16px;
}
.howto-passos div {
  padding: 8px 0;
  border-bottom: 2px dashed var(--cinza-claro);
}
.howto-passos div:last-child { border-bottom: none; }

.convite {
  background: #fff6d8;
  border: 3px dashed var(--amarelo);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 800;
}

.erro { color: var(--vermelho); font-size: 14px; margin-top: 8px; font-weight: 800; }

/* mensagem de status do convidado ("aguardando o anfitrião") — grande, ⏳ girando, pulsante */
.aviso {
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  margin: 2px 0 20px;
  animation: pulsa-aviso 1.5s ease-in-out infinite;
}
.aviso:empty { display: none; animation: none; }
@keyframes pulsa-aviso { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
.aviso-spin { display: inline-block; animation: girar 1.4s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ============ tela CONFIGURAR ============ */

.card-config {
  position: relative;
  max-width: 480px;
  margin: 26px auto 0;
  padding-top: 40px;
  background: rgba(30, 26, 74, .38);
  border: 2px solid rgba(255, 255, 255, .08);
  border-radius: 24px;
  box-shadow: 0 12px 34px rgba(20, 16, 55, .35);
}

.cfg-voltar {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 40px;
  height: 40px;
  font-size: 16px;
  background: var(--amarelo);
  border: 3px solid var(--navy);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--navy);
  cursor: pointer;
  font-weight: 900;
  color: var(--navy);
}
.cfg-voltar:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }

.cfg-secao {
  background: rgba(255, 255, 255, .06);
  border: 2px solid rgba(255, 255, 255, .08);
  border-radius: 18px;
  padding: 18px 16px;
  margin-bottom: 16px;
  text-align: left;
}
.cfg-secao .col-titulo { text-align: left; margin-bottom: 12px; color: #fff; opacity: .8; }

.cfg-linhas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
}
.cfg-linha {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}

.cfg-nota { font-size: 13px; color: rgba(255, 255, 255, .7); font-weight: 700; margin-top: 12px; }

.cfg-toggle { cursor: pointer; }
.cfg-toggle input { display: none; }
.switch {
  width: 48px;
  height: 27px;
  background: #dfe4f2;
  border-radius: 999px;
  border: 2.5px solid var(--navy);
  position: relative;
  display: inline-block;
  transition: background .15s;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--navy);
  transition: left .15s;
}
.cfg-toggle input:checked + .switch { background: var(--verde); }
.cfg-toggle input:checked + .switch::after { left: 23px; }


/* ---------- compartilhar ---------- */

.share-icone {
  font-size: 52px;
  width: 116px;
  height: 116px;
  line-height: 108px;
  margin: 10px auto 14px;
  background: radial-gradient(circle at 30% 25%, #ffe9a3, #ffd35c);
  border: 4px solid var(--navy);
  border-radius: 50%;
}
#modal-compartilhar input { font-size: 13px; color: var(--cinza); }
.btn-perfil.btn-whats-modal, .btn-whats-modal {
  background: #25d366;
  color: #fff;
  text-decoration: none;
  display: block;
}

/* ============ lobby ============ */

.lobby-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin: 10px 0 16px;
}
.chip {
  background: rgba(255, 255, 255, .14);
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
}

.card-lobby {
  background: rgba(30, 26, 74, .38);
  border: 2px solid rgba(255, 255, 255, .08);
  box-shadow: 0 12px 34px rgba(20, 16, 55, .35);
}

/* dica + pulso pra destacar o Convidar amigos — SÓ pro host (ação-chave dele: puxar amigos).
   convidado não vê animação (ele está esperando o host, não é a ação dele). */
.convidar-dica {
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  margin-bottom: 8px;
}
#tela-lobby.sou-host .convidar-dica { animation: bounce-dica 1s ease-in-out infinite; }
@keyframes bounce-dica {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}
#tela-lobby.sou-host #btn-convidar { animation: pulsa-convidar 1.4s ease-in-out infinite; }
#btn-convidar:active { animation: none; }
@keyframes pulsa-convidar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}
.card-lobby h2 { margin-bottom: 4px; font-weight: 900; font-size: 26px; color: #fff; }
#lobby-code {
  color: var(--amarelo);
  background: var(--navy);
  border-radius: 12px;
  padding: 3px 14px;
  letter-spacing: 5px;
  display: inline-block;
}

.link-box {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  background: #f7f8fd;
  border-radius: 16px;
  padding: 8px;
}
.link-box input {
  flex: 1;
  margin: 0;
  font-size: 12px;
  text-align: left;
  padding: 8px 10px;
  border-width: 2px;
  border-radius: 10px;
  color: var(--cinza);
}

.lobby-players {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
  min-height: 86px;
}

.lobby-player {
  width: 88px;
  padding: 10px 4px 8px;
  background: rgba(255, 255, 255, .1);
  border: 2px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.lobby-player .em {
  font-size: 30px;
  width: 52px;
  height: 52px;
  line-height: 48px;
  margin: 0 auto 4px;
  background: #fff;
  border: 3px solid var(--navy);
  border-radius: 50%;
}
.lobby-player .nk { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-player.off { opacity: .4; }

.config-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--cinza);
  font-weight: 900;
  letter-spacing: .5px;
}
.config-row label { display: flex; align-items: center; gap: 6px; }

/* ============ jogo ============ */

#tela-jogo {
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  padding: 10px;
  gap: 10px;
  max-width: 1280px;
  margin: 0 auto;
}

#jogo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 5px 0 rgba(35, 41, 70, .25);
  padding: 10px 14px;
  gap: 12px;
}

#hdr-rodada {
  color: #fff;
  background: var(--azul);
  border: 2.5px solid var(--navy);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.palavra-mask {
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 5px;
  text-align: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap; /* NUNCA quebra em duas linhas — o JS auto-encolhe pra caber */
  color: var(--navy);
}

#hdr-timer {
  background: var(--amarelo);
  border: 3px solid var(--navy);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
  min-width: 76px;
  text-align: center;
}
#hdr-timer:empty { visibility: hidden; }
#hdr-timer.urgente {
  background: var(--vermelho);
  color: #fff;
  animation: pulsa .5s infinite alternate;
}
@keyframes pulsa {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

#btn-som, #btn-sair-header {
  background: #fff;
  font-size: 16px;
  padding: 4px 10px;
  box-shadow: 0 3px 0 var(--navy);
}
#btn-sair-header {
  border: 3px solid var(--navy);
  border-radius: 999px;
  font-weight: 900;
  color: var(--vermelho);
  cursor: pointer;
  font-family: inherit;
}
#btn-sair-header:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }

#jogo-main {
  display: flex;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

#painel-jogadores {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pj {
  background: #fff;
  border: 3px solid transparent;
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(35, 41, 70, .2);
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: transform .08s, border-color .12s;
}
.pj:hover { transform: translateX(2px); border-color: var(--azul-claro); }
.pj.off { opacity: .45; }
.pj.acertou { background: #dcf9e7; border-color: var(--verde); }
.pj .em {
  font-size: 20px;
  width: 36px;
  height: 36px;
  line-height: 32px;
  text-align: center;
  background: var(--cinza-claro);
  border: 2.5px solid var(--navy);
  border-radius: 50%;
  flex-shrink: 0;
}
.pj .info { flex: 1; min-width: 0; }
.pj .nk { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj .pt { color: var(--cinza); font-size: 12px; font-weight: 800; }
.pj .badge { font-size: 16px; }

#area-desenho {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#canvas-wrap {
  position: relative;
  background: #fff;
  border: 4px solid var(--navy);
  border-radius: 20px;
  box-shadow: 0 6px 0 rgba(35, 41, 70, .3);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

#canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ---------- modais sobre o canvas ---------- */

.modal {
  position: absolute;
  inset: 0;
  background: rgba(35, 41, 70, .9);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  text-align: center;
}
.modal h3 { font-size: 21px; font-weight: 900; }

#opcoes-palavras { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
#opcoes-palavras button {
  padding: 13px 26px;
  font-size: 19px;
  background: var(--amarelo);
  color: var(--navy);
}

.btn-passar {
  background: none;
  border: none;
  color: #cdd3ea;
  text-decoration: underline;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.btn-passar:hover { color: #fff; }

/* ---------- telas interstitiais ---------- */

.tela-inter { background: #fff; color: var(--navy); gap: 8px; }

.inter-titulo {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--amarelo);
  text-shadow:
    -2px -2px 0 var(--navy), 2px -2px 0 var(--navy),
    -2px 2px 0 var(--navy), 2px 2px 0 var(--navy),
    0 5px 0 var(--navy);
}

.inter-sub { color: var(--cinza); font-size: 17px; font-weight: 800; }

.inter-arte {
  font-size: clamp(56px, 14vh, 110px);
  line-height: 1.2;
  margin: 6px 0;
  filter: drop-shadow(0 6px 0 rgba(35, 41, 70, .15));
}

.inter-info { font-size: 19px; color: var(--cinza); font-weight: 800; }
.inter-info b { color: var(--navy); font-size: 26px; display: inline-block; font-weight: 900; }

.inter-barra {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: var(--navy);
}
.inter-barra > div {
  height: 100%;
  width: 100%;
  background: var(--azul-claro);
  border-radius: 0 6px 6px 0;
}

/* ---------- pódio ---------- */

#podio-palco {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 28px;
  margin: 12px 0 6px;
}

.podio-slot { text-align: center; position: relative; }
.podio-slot.campeao { margin-bottom: 28px; }

.podio-av {
  font-size: 46px;
  width: 80px;
  height: 80px;
  line-height: 72px;
  background: var(--cinza-claro);
  border: 4px solid var(--navy);
  border-radius: 50%;
  display: inline-block;
}
.campeao .podio-av {
  font-size: 58px;
  width: 98px;
  height: 98px;
  line-height: 88px;
  background: radial-gradient(circle at 30% 25%, #fff3c4, #ffd35c);
  border-color: var(--navy);
}

.podio-louros { display: flex; align-items: center; gap: 3px; font-size: 32px; }

.podio-medal {
  width: 28px;
  height: 28px;
  line-height: 24px;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  margin: -15px auto 5px;
  position: relative;
  border: 3px solid #fff;
  box-shadow: 0 2px 0 rgba(35, 41, 70, .3);
}
.podio-medal.ouro { background: var(--amarelo); color: var(--navy); }
.podio-medal.prata { background: #b2bec3; }
.podio-medal.bronze { background: #e17055; }

.podio-nome {
  font-weight: 900;
  font-size: 15px;
  max-width: 116px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#podio-resto { color: var(--cinza); font-size: 14px; line-height: 1.6; font-weight: 800; }
#modal-podio .btn { width: auto; padding: 10px 28px; margin-top: 8px; }

/* ---------- ferramentas ---------- */

#barra-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 5px 0 rgba(35, 41, 70, .25);
  padding: 10px 14px;
  flex-wrap: wrap;
}

#cores { display: flex; gap: 6px; flex-wrap: wrap; }
.cor {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--navy);
  cursor: pointer;
  transition: transform .08s;
}
.cor:hover { transform: scale(1.15); }
.cor.ativa {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--azul);
}

#tamanhos { display: flex; gap: 7px; align-items: center; }
.tam {
  border-radius: 50%;
  background: var(--navy);
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .08s;
}
.tam:hover { transform: scale(1.15); }
.tam.ativa { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--azul); }

.tool {
  font-size: 20px;
  background: var(--cinza-claro);
  border: 2.5px solid var(--navy);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--navy);
  padding: 4px 9px;
  cursor: pointer;
  transition: transform .06s, box-shadow .06s;
}
.tool:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.tool.ativa { background: #ffe9a3; }

/* ---------- chat ---------- */

#coluna-chat {
  width: 270px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 5px 0 rgba(35, 41, 70, .25);
  overflow: hidden;
}

#chat-tabs { display: flex; border-bottom: 3px solid var(--cinza-claro); }
.chat-tab {
  flex: 1;
  border: none;
  background: var(--cinza-claro);
  padding: 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--cinza);
  cursor: pointer;
}
.chat-tab.ativa { background: #fff; color: var(--navy); box-shadow: inset 0 -3px 0 var(--azul); }

#chat-msgs, #chat-regs {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  font-size: 13px;
  line-height: 1.55;
  min-height: 120px;
  max-height: 60vh;
  font-weight: 700;
}
#chat-regs { color: var(--azul); font-size: 12px; }
.msg-registro { margin-bottom: 3px; }

.msg { margin-bottom: 5px; word-wrap: break-word; }
.msg .nk { font-weight: 900; }
.msg-sistema { color: var(--cinza); font-style: italic; }
.msg-acerto { color: #27ae60; font-weight: 900; }
.msg-quase { color: #e67e22; font-weight: 900; }
.msg-time { color: #16a085; }

#chat-form { border-top: 3px solid var(--cinza-claro); }
#chat-input {
  border: none;
  border-radius: 0;
  margin: 0;
  text-align: left;
  padding: 13px;
}
#chat-input:focus { border: none; }
#chat-input:disabled { background: var(--cinza-claro); cursor: default; }


/* ---------- modais fixos (perfil, avatar, sair, afk) ---------- */

.modal-fixo, #modal-perfil, #modal-afk {
  position: fixed;
  inset: 0;
  background: rgba(35, 41, 70, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 45;
  padding: 20px;
}
#modal-afk { z-index: 50; }

.perfil-card, .afk-card {
  position: relative;
  background: #fff;
  border-radius: 24px;
  padding: 40px 28px 22px;
  text-align: center;
  width: 320px;
  box-shadow: 0 8px 0 rgba(35, 41, 70, .3), 0 24px 60px rgba(0, 0, 0, .4);
}
.afk-card { padding-top: 34px; }

.perfil-ribbon {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--azul);
  color: var(--amarelo);
  font-weight: 900;
  letter-spacing: 4px;
  padding: 9px 38px;
  border-radius: 14px;
  border: 3px solid var(--navy);
  box-shadow: 0 4px 0 var(--navy);
  text-shadow: 0 2px 0 var(--navy);
  white-space: nowrap;
}

.fechar-x, #perfil-fechar {
  position: absolute;
  top: 12px;
  right: 15px;
  border: none;
  background: none;
  font-size: 20px;
  color: #b7bed6;
  cursor: pointer;
  font-weight: 900;
}
.fechar-x:hover, #perfil-fechar:hover { color: var(--navy); }

.perfil-av {
  font-size: 62px;
  width: 112px;
  height: 112px;
  line-height: 102px;
  margin: 8px auto 10px;
  background: radial-gradient(circle at 30% 25%, #ffe9a3, #ffd35c);
  border: 4px solid var(--navy);
  border-radius: 50%;
}

.perfil-nick { color: var(--azul); font-weight: 900; font-size: 20px; margin-bottom: 18px; }

.btn-perfil {
  display: block;
  width: 100%;
  background: var(--amarelo);
  padding: 12px;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--navy);
  margin-bottom: 10px;
}
.btn-perfil:disabled { opacity: .55; cursor: default; transform: none; }
.btn-perfil.ativo { background: var(--cinza-claro); }
.btn-perfil.azul { background: var(--azul-claro); }

#avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  margin-top: 10px;
}
#avatar-grid button {
  font-size: 28px;
  background: var(--cinza-claro);
  border: 3px solid transparent;
  border-radius: 14px;
  padding: 6px 2px;
  cursor: pointer;
  transition: transform .08s;
}
#avatar-grid button:hover { transform: scale(1.12); background: #ffe9a3; }
#avatar-grid button.ativo { border-color: var(--navy); background: var(--amarelo); box-shadow: 0 3px 0 var(--navy); }

.afk-arte { font-size: 64px; margin: 12px 0; filter: drop-shadow(0 4px 0 rgba(35,41,70,.15)); }
.afk-card p, .sair-texto { color: var(--cinza); margin-bottom: 16px; font-weight: 800; }
.sair-botoes { display: flex; gap: 10px; }
.sair-botoes .btn-perfil { margin-bottom: 0; }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  border: 3px solid var(--amarelo);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  z-index: 99;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

/* ---------- mobile ---------- */

@media (max-width: 860px) {
  /* layout gartic/skribbl mobile: canvas em cima, jogadores | chat lado a lado,
     input de palpite fixo no rodapé da tela */
  #tela-jogo { padding-bottom: 74px; }

  #jogo-main { flex-direction: row; flex-wrap: wrap; gap: 8px; align-content: flex-start; } /* sem stretch: canvas não ganha vão embaixo */

  #area-desenho { order: 1; flex: 0 0 100%; }

  #painel-jogadores {
    order: 2;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    flex-direction: column;
    gap: 6px;
    height: 36vh;
    overflow-y: auto;
  }
  .pj { min-width: 0; padding: 6px 7px; font-size: 12px; }
  .pj .em { width: 30px; height: 30px; line-height: 26px; font-size: 16px; }

  #coluna-chat {
    order: 3;
    flex: 1.5 1 0;
    min-width: 0;
    width: auto;
    height: 36vh;
  }
  /* padding-bottom = altura do input fixo, senão as últimas mensagens ficam atrás dele */
  #chat-msgs, #chat-regs { max-height: none; min-height: 0; padding-bottom: 66px; }

  #chat-form {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 30;
    background: #fff;
    border: 3px solid var(--navy);
    border-radius: 999px;
    box-shadow: 0 4px 0 var(--navy), 0 10px 30px rgba(35, 41, 70, .35);
    overflow: hidden;
  }
  #chat-input { padding: 12px 18px; }

  /* header mobile: pills na 1ª linha, a PALAVRA sozinha na 2ª linha (largura total) */
  #jogo-header { flex-wrap: wrap; justify-content: center; row-gap: 8px; padding: 8px 12px; }
  #hdr-rodada { order: 1; }
  #hdr-timer { order: 2; }
  #btn-som { order: 3; }
  #btn-sair-header { order: 4; }
  .palavra-mask {
    order: 5;
    flex: 0 0 100%;
    width: 100%;
    font-size: 22px;
    letter-spacing: 4px;
  }
  .logo-img { width: min(300px, 80vw); }

  .nick-row { flex-wrap: wrap; }
}

/* ---------- soft-landing: convite morto vira porta pra sala ativa ---------- */
.dead-panel { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.dead-titulo {
  font-weight: 900;
  font-size: 19px;
  text-align: center;
  padding: 10px 12px;
  background: rgba(255, 107, 107, .14);
  border: 2px dashed rgba(255, 107, 107, .55);
  border-radius: 14px;
}
.modo-morto #btn-entrar-convite, .modo-morto #convite { display: none !important; }

/* ---------- rabisco livre no lobby (espera nunca é tela morta) ---------- */
.rabisco-box { margin: 6px 0 2px; }
.rabisco-label { font-weight: 800; font-size: 13px; opacity: .75; margin-bottom: 5px; text-align: center; }
#rabisco-canvas {
  display: block;
  width: 100%;
  height: 150px;
  background: #fff;
  border: 3px solid var(--navy);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(45, 52, 85, .55);
  cursor: crosshair;
  touch-action: none;
}

/* fantasma no lobby: desconectado em grace mostra que não está de fato aqui */
.recon-label { font-size: 10px; opacity: .65; font-style: italic; }

/* ---------- tamanho de pincel estilo skribbl: botão com a bolinha atual + popup vertical ---------- */
#tamanho-wrap { position: relative; display: inline-flex; }
#tam-atual { display: inline-flex; align-items: center; justify-content: center; background: #fff; }
#tam-dot { display: block; border-radius: 50%; background: #2d3455; }
#tam-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse; /* menor embaixo, maior em cima (perto do dedo o mais comum) */
  gap: 4px;
  background: #fff;
  border: 3px solid var(--navy);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(45, 52, 85, .55);
  padding: 8px;
  z-index: 30;
}
#tam-popup.oculto { display: none; }
.tam-op {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tam-op span { display: block; border-radius: 50%; background: #2d3455; }
.tam-op.ativa { background: var(--amarelo); }
.tam-op:hover { background: rgba(63, 142, 252, .25); }

/* convite dentro do jogo: aparece depois do acerto (mãos abanando = chama mais gente) */
#chat-form { display: flex; gap: 6px; align-items: center; }
#chat-form #chat-input { flex: 1; }
#btn-convidar-jogo {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  font-size: 20px;
  background: var(--verde);
  border: 3px solid var(--navy);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--navy);
  cursor: pointer;
  animation: pulsa-jogar 1.3s ease-in-out infinite;
}
#btn-convidar-jogo:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }

/* ---------- mobile: header compacto + interstitial nunca corta a palavra (Andre 07-17) ---------- */
.tela-inter { padding-bottom: 18px; } /* a palavra revelada nunca fica atrás da barra de tempo */

@media (max-width: 860px) {
  /* header enxuto: pills e paddings mínimos, palavra menor (o JS já auto-encolhe pra caber) */
  #jogo-header { padding: 4px 8px; row-gap: 3px; gap: 6px; border-radius: 12px; }
  #hdr-rodada { padding: 2px 9px; font-size: 11px; border-width: 2px; }
  #hdr-timer { padding: 2px 9px; font-size: 14px; min-width: 56px; border-width: 2px; }
  #btn-som, #btn-sair-header { font-size: 13px; padding: 2px 8px; }
  .palavra-mask { font-size: 18px; letter-spacing: 3px; }

  /* interstitial: a PALAVRA é o que importa — arte encolhe pra ela sempre aparecer inteira */
  .inter-titulo { font-size: clamp(20px, 4vh, 30px); letter-spacing: 1px; }
  .inter-sub { font-size: 13px; }
  .inter-arte { font-size: clamp(30px, 7vh, 60px); margin: 2px 0; }
  .inter-info { font-size: 15px; padding: 0 8px; }
  .inter-info b { font-size: 21px; }
}

/* ---------- mobile DENSO (referência gartic/skribbl): borda a borda, moldura zero ---------- */
@media (max-width: 860px) {
  /* mata a moldura roxa: conteúdo cola nas bordas da tela */
  #tela-jogo { padding: 0 0 64px; }

  /* header GARTIC: flutua POR CIMA do canvas — custo vertical ZERO, canvas no topo da tela */
  #tela-jogo { position: relative; }
  #jogo-header {
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    z-index: 6;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    gap: 4px;
    flex-wrap: nowrap;
    row-gap: 0;
    pointer-events: none; /* não bloqueia o desenho; só os controles clicam */
  }
  #jogo-header > * { pointer-events: auto; }
  .palavra-mask {
    order: 0; flex: 1 1 auto; width: auto;
    font-size: 15px; letter-spacing: 2px;
    background: rgba(255, 255, 255, .9);
    border: 2px solid var(--navy);
    border-radius: 999px;
    padding: 2px 10px;
  }
  .palavra-mask:empty { visibility: hidden; }
  #hdr-rodada { order: 0; padding: 2px 8px; font-size: 10px; opacity: .92; }
  #hdr-timer { order: 0; padding: 2px 8px; font-size: 13px; min-width: 46px; }
  #btn-som { order: 0; font-size: 12px; padding: 2px 7px; }
  #btn-sair-header { order: 0; font-size: 12px; padding: 2px 7px; }

  /* canvas de borda a borda, sem card */
  #canvas-wrap {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top-width: 2px;
    border-bottom-width: 2px;
    box-shadow: none;
  }
  #area-desenho { gap: 4px; }
  #jogo-main { gap: 5px; }
  #painel-jogadores, #coluna-chat { border-radius: 8px; box-shadow: none; }
}

/* mobile: lista de jogadores estilo gartic — TABELA quadrada, sem card por jogador */
@media (max-width: 860px) {
  #painel-jogadores {
    gap: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
  }
  .pj {
    border-radius: 0;
    border: none;
    border-bottom: 1.5px solid var(--cinza-claro);
    box-shadow: none;
    padding: 5px 8px;
  }
  .pj:last-child { border-bottom: none; }
  /* destaque de estado sem depender de borda colorida: filete lateral */
  .pj.acertou { background: rgba(46, 204, 113, .14); }
  .pj .em { width: 30px; height: 30px; line-height: 26px; font-size: 17px; border-width: 2px; }
}

/* mobile: painéis QUADRADOS colados nas bordas (gartic) — radius/sombra custam espaço à toa */
@media (max-width: 860px) {
  #painel-jogadores, #coluna-chat {
    border-radius: 0;
    box-shadow: none;
  }
}

/* mobile: barra de desenho compacta e QUADRADA (gartic) — 2 linhas magras: cores | ferramentas */
@media (max-width: 860px) {
  #barra-tools {
    border-radius: 0;
    box-shadow: none;
    padding: 4px 6px;
    gap: 5px;
    flex-wrap: wrap;
    row-gap: 4px;
  }
  #cores {
    gap: 4px;
    flex-wrap: nowrap;
    flex: 0 0 100%;
    justify-content: space-between;
  }
  .cor { width: 24px; height: 24px; border-width: 2px; }
  .tool { font-size: 15px; padding: 3px 7px; border-radius: 8px; box-shadow: 0 2px 0 var(--navy); }
}

/* mobile: modais do jogo (escolha/interstitial/pódio) em TELA CHEIA — dentro do canvas 4:3 não cabe */
@media (max-width: 860px) {
  /* SÓ o pódio vira tela cheia (conteúdo alto não cabe no canvas 4:3);
     transições e escolha de palavra ficam sobre o canvas — header/players/chat continuam visíveis (Andre 07-18) */
  #modal-podio {
    position: fixed;
    inset: 0;
    z-index: 60;
    border-radius: 0;
    justify-content: center;
    padding: 16px 12px 26px;
  }
}

/* mobile: painéis esticam até o input — fim da faixa roxa morta (grid: canvas em cima, players|chat preenchem) */
@media (max-width: 860px) {
  #jogo-main {
    display: grid;
    grid-template-columns: 2fr 3fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 5px;
    height: calc(100dvh - 68px);
  }
  #area-desenho { grid-area: 1 / 1 / 2 / 3; }
  #painel-jogadores { grid-area: 2 / 1 / 3 / 2; width: auto; overflow-y: auto; align-content: start; }
  #coluna-chat { grid-area: 2 / 2 / 3 / 3; width: auto; min-height: 0; }
}

/* mobile: solta o 36vh antigo — o grid é quem manda na altura dos painéis */
@media (max-width: 860px) {
  #painel-jogadores, #coluna-chat { height: auto; }
}

/* mobile: home ancorada no TOPO (centralização vertical jogava o logo pra baixo e estourava a tela) */
@media (max-width: 860px) {
  #tela-inicio { align-items: flex-start; padding-top: 50px; }
  .logo-img { width: min(320px, 58vw); }
  .tagline { font-size: 11px; letter-spacing: 3px; margin-bottom: 10px; }
  .card-inicio { padding: 14px 14px 12px; }
  .nick-row { margin-bottom: 10px; }
  .nick-row input[type="text"] { font-size: 18px; padding: 13px 14px; }
  .avatar-picker { margin-bottom: 12px; }
  .avatar-grande { width: 84px; height: 84px; line-height: 76px; font-size: 46px; }
  .avatar-dica { margin-top: 8px; font-size: 12px; }
  .btn-jogar { font-size: 21px; padding: 13px; }
  .card-inicio .btn-secundario { font-size: 16px; padding: 12px; }
  .btn-howto { margin-top: 10px; padding: 9px 20px; font-size: 15px; }
}

/* mobile: popups mais largos — 320px fixos espremiam o conteúdo (Andre 07-17) */
@media (max-width: 860px) {
  .perfil-card, .afk-card {
    width: min(94vw, 400px);
    padding: 34px 18px 18px;
  }
}

/* pós-acerto: a mensagem de convite é CTA, não sussurro */
#chat-input.acertou-ph::placeholder { color: var(--verde); opacity: 1; font-weight: 900; }
#chat-input.acertou-ph { border-color: var(--verde); }

/* progressão (retenção) — discreto: linha na home some pra novato, resumo só no pódio */
.prog-home { text-align: center; margin: -4px 0 14px; font-size: 13px; font-weight: 800; color: rgba(255, 255, 255, .5); letter-spacing: .3px; }
#podio-xp { text-align: center; margin: 4px 0 10px; line-height: 1.4; }
#podio-xp:empty { display: none; }
#podio-xp .xp-ganho { font-size: 16px; font-weight: 900; color: var(--amarelo); }
#podio-xp .xp-nivel { display: block; font-size: 15px; font-weight: 900; color: var(--verde); margin-top: 2px; }
#podio-xp .xp-streak { display: block; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .72); margin-top: 5px; }
