@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;700&display=swap');

:root {
  --laranja: #ff8a3d;
  --azul-ceu: #a5d8ff;
  --verde: #2ecc71;
  --vermelho: #ff7675;
  --roxo: #a29bfe;
  --azul-escuro: #2196f3;
  --cor-j1: #e74c3c;
  --cor-j2: #2c3e50;
  --cor-tabuleiro-claro: #f0d9b5;
  --cor-tabuleiro-escuro: #b58863;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Fredoka', sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

@supports (min-height: 100svh) {
  body {
    min-height: 100svh;
  }
}

.texto-bolha {
  text-shadow: 0px 4px 0px rgba(0, 0, 0, 0.1), 0px 8px 0px rgba(0, 0, 0, 0.05);
  font-weight: 900;
  letter-spacing: 1px;
}

/* O CSS do sol foi removido daqui */

/* OVERLAY */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 15px;
  box-sizing: border-box;
  background: rgba(165, 216, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
}

.card-info {
  background: white;
  border-radius: 40px;
  padding: 22px;
  max-width: 520px;
  width: min(95%, 520px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), inset 0 -6px 0 rgba(0, 0, 0, 0.05);
  animation: entrada 0.35s ease-out;
  box-sizing: border-box;
  position: relative;
  margin: auto;
}

.card-info::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 30px;
  width: 70px;
  height: 70px;
  background: white;
  border-radius: 50%;
  z-index: -1;
}

.card-info::after {
  content: "";
  position: absolute;
  top: -30px;
  right: 40px;
  width: 90px;
  height: 90px;
  background: white;
  border-radius: 50%;
  z-index: -1;
}

@keyframes entrada {
  from {
    transform: scale(0.92) translateY(20px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.regras-rapidas {
  background: #fff9f0;
  border-radius: 25px;
  padding: 15px;
  margin-bottom: 18px;
  font-size: 0.95rem;
  text-align: left;
  color: #666;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.05);
}

.regras-rapidas h3 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  color: var(--laranja);
  text-align: center;
}

.regra-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: bold;
}

.btn-modo,
.btn-acao {
  font-family: 'Fredoka';
  border-radius: 30px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-modo {
  background: white;
  border: 4px solid var(--roxo);
  color: var(--roxo);
  padding: 14px;
  margin-bottom: 12px;
  font-size: 1.15rem;
  box-shadow: 0 6px 0 rgba(162, 155, 254, 0.2);
}

.btn-modo:hover {
  background: var(--roxo);
  color: white;
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 10px 20px rgba(162, 155, 254, 0.3), 0 4px 0 rgba(162, 155, 254, 0.6);
}

.btn-modo:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 2px 0 rgba(162, 155, 254, 0.6);
}

.btn-acao {
  background: var(--verde);
  color: white;
  border: none;
  padding: 16px;
  font-size: 1.2rem;
  margin: 8px 0;
  box-shadow: 0 6px 0 #27ae60;
}

.btn-acao:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #27ae60;
}

.btn-acao:disabled {
  background: #ccc;
  box-shadow: 0 6px 0 #999;
  cursor: not-allowed;
  transform: none;
}

.btn-online {
  border-color: var(--azul-escuro);
  color: var(--azul-escuro);
  box-shadow: 0 6px 0 rgba(33, 150, 243, 0.2);
}

.btn-online:hover,
.btn-online:active {
  background: var(--azul-escuro);
  color: white;
  box-shadow: 0 3px 0 rgba(33, 150, 243, 0.2);
}

.codigo-sala {
  font-size: 1.5rem;
  letter-spacing: 2px;
  color: var(--roxo);
  font-weight: bold;
  background: #f1f5f9;
  padding: 10px;
  border-radius: 15px;
  margin-bottom: 15px;
  user-select: all;
  display: inline-block;
}

.input-nome {
  width: min(88%, 360px);
  padding: 14px;
  border: none;
  background: #f1f5f9;
  border-radius: 20px;
  font-family: 'Fredoka';
  font-size: 1.1rem;
  margin-bottom: 8px;
  text-align: center;
  box-sizing: border-box;
  color: #333;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.05);
}

.select-dificuldade {
  appearance: none;
  cursor: pointer;
  background: #f1f5f9;
  font-weight: bold;
}

/* ESTILOS DE AVATAR */
.secao-jogador {
  background: #fffdf5;
  padding: 12px;
  border-radius: 20px;
  margin-bottom: 15px;
  border: 2px dashed #fcd5ce;
}

.lbl-jogador {
  font-weight: bold;
  color: var(--laranja);
  margin-bottom: 5px;
  font-size: 1.1rem;
}

.box-avatares {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.btn-avatar {
  font-size: 1.6rem;
  background: white;
  border: 3px solid transparent;
  border-radius: 15px;
  padding: 5px;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-avatar.ativo {
  border-color: var(--roxo);
  transform: scale(1.15);
  box-shadow: 0 6px 12px rgba(162, 155, 254, 0.3);
  background: #f4f2ff;
}

/* BOTOES TOPO */
.topo {
  width: 100%;
  padding: 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  z-index: 50;
  position: sticky;
  top: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.botoes-topo-esq {
  position: absolute;
  left: 15px;
  display: flex;
  gap: 10px;
}

.btn-topo {
  font-family: 'Fredoka', sans-serif;
  text-decoration: none;
  color: white;
  padding: 12px 20px;
  border-radius: 50px;
  font-weight: bold;
  font-size: 1.1rem;
  border: none;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-topo-sair {
  background: var(--vermelho);
  box-shadow: 0 4px 0 #d63031;
}

.btn-topo-sair:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d63031;
}

.btn-topo-menu {
  background: var(--azul-escuro);
  box-shadow: 0 4px 0 #1976d2;
}

.btn-topo-menu:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1976d2;
}

.btn-topo-sobre {
  background: var(--laranja);
  box-shadow: 0 4px 0 #d35400;
}

.btn-topo-sobre:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d35400;
}

/* PLACAR SUPERIOR */
.placar-geral {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50px;
  padding: 8px 15px;
  gap: 15px;
  box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.5);
}

.ponto-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 20px 6px 8px;
  border-radius: 40px;
  background: white;
  min-width: 140px;
  transition: all 0.3s ease;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.ponto-box.invertido {
  padding: 6px 8px 6px 20px;
}

.avatar-placar {
  font-size: 2.2rem;
  background: #f1f5f9;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.05);
  line-height: 1;
  margin-top: -2px;
}

.info-placar {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.ponto-box span {
  font-size: 0.85rem;
  font-weight: bold;
  color: #888;
  text-transform: uppercase;
  white-space: nowrap;
  margin-bottom: -2px;
}

.ponto-box b {
  font-size: 2.2rem;
  color: #555;
  line-height: 1;
}

.placar-vs {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--roxo);
  text-shadow: 0 2px 0 rgba(162, 155, 254, 0.3);
}

@keyframes placarAtivoFloat {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 8px 20px rgba(255, 138, 61, 0.4);
  }
  50% {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(255, 138, 61, 0.6);
  }
}

@keyframes avatarBop {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.12) rotate(8deg); }
}

.ponto-box.ativo {
  background: var(--laranja);
  color: white;
  box-shadow: 0 8px 20px rgba(255, 138, 61, 0.4);
  animation: placarAtivoFloat 2s ease-in-out infinite;
}

.ponto-box.ativo span,
.ponto-box.ativo b {
  color: white;
}

.ponto-box.ativo .avatar-placar {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: none;
  animation: avatarBop 2s ease-in-out infinite;
}

.ponto-box:not(.ativo) {
  opacity: 0.6;
}

/* PAINEL PRINCIPAL */
.painel-jogo {
  background: white;
  border-radius: 50px;
  padding: 20px 25px 30px 25px;
  margin: 30px 15px 90px 15px;
  position: relative;
  z-index: 20;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), inset 0 -10px 0 rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.painel-jogo::before {
  content: "";
  position: absolute;
  top: -35px;
  left: 30px;
  width: 100px;
  height: 100px;
  background: white;
  border-radius: 50%;
  z-index: -1;
}

.painel-jogo::after {
  content: "";
  position: absolute;
  top: -45px;
  right: 40px;
  width: 130px;
  height: 130px;
  background: white;
  border-radius: 50%;
  z-index: -1;
}

.painel-jogo-extra {
  content: "";
  position: absolute;
  bottom: -20px;
  left: 50px;
  width: 90px;
  height: 90px;
  background: white;
  border-radius: 50%;
  z-index: -1;
}

/* CONTADOR DE CAPTURADAS */
.capturadas-wrap {
  display: none !important; /* Escondido a pedido do usuário */
  gap: 20px;
  margin-bottom: 10px;
}

.cap-box {
  background: #f1f5f9;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 1rem;
  font-weight: bold;
  color: #555;
}

/* TABULEIRO DE DAMAS */
.tabuleiro-container {
  border-radius: 16px;
  overflow: hidden;
  width: var(--board-size);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.3), 0 0 0 2px #8d5524, 0 0 0 10px #5c3a21, 0 0 0 16px #3e2723;
}

.tabuleiro {
  display: grid;
  grid-template-columns: repeat(8, 12.5%);
  grid-template-rows: repeat(8, 12.5%);
  width: var(--board-size);
  height: var(--board-size);
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.celula {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  position: relative;
  transition: background 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.celula.clara {
  background: radial-gradient(circle, var(--cor-tabuleiro-claro) 0%, #e8d0af 100%);
}

.celula.escura {
  background: radial-gradient(circle, var(--cor-tabuleiro-escuro) 0%, #9e7352 100%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.15);
}

.celula.escura.jogavel {
  cursor: pointer;
}

.celula.selecionada {
  background: #7fc97f !important;
  box-shadow: inset 0 0 0 3px rgba(0, 180, 0, 0.5);
}

.celula.movimento-valido {
  cursor: pointer;
}

.celula.movimento-valido::after {
  content: '';
  display: block;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: rgba(80, 220, 80, 0.55);
  border: 3px solid rgba(40, 160, 40, 0.5);
  transition: transform 0.15s;
}

.celula.movimento-valido:hover::after {
  transform: scale(1.2);
  background: rgba(80, 220, 80, 0.75);
}

.celula.captura-obrigatoria {
  animation: piscarCaptura 0.7s infinite alternate;
}

@keyframes piscarCaptura {
  from {
    background: var(--cor-tabuleiro-escuro);
  }

  to {
    background: rgba(231, 76, 60, 0.45);
  }
}

/* PEÇAS */
.peca {
  width: 76%;
  height: 76%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  will-change: transform;
  transform: translateZ(0);
}

.peca.j1 {
  background: radial-gradient(circle at 35% 35%, #ffffff, #e0e0e0 60%, #bdc3c7);
  box-shadow: 0 4px 0 #95a5a6, 0 8px 15px rgba(0, 0, 0, 0.3), inset 0 4px 6px rgba(255, 255, 255, 0.8), inset 0 -4px 6px rgba(0, 0, 0, 0.1);
  color: #2c3e50;
}

.peca.j2 {
  background: radial-gradient(circle at 35% 35%, #444, #1a1a1a 60%, #000);
  box-shadow: 0 4px 0 #000, 0 8px 15px rgba(0, 0, 0, 0.5), inset 0 4px 6px rgba(255, 255, 255, 0.2), inset 0 -4px 6px rgba(0, 0, 0, 0.6);
  color: white;
}

.peca:active {
  transform: scale(0.9);
}

.peca.selecionada-peca {
  transform: scale(1.12);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 0 4px #2ecc71, 0 0 20px rgba(46, 204, 113, 0.6) !important;
}

/* Animação de entrada da peça */
@keyframes pecaEntrada {
  from {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }

  to {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.peca.nova {
  animation: pecaEntrada 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Animação de captura */
@keyframes capturaAnim {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.4);
    opacity: 0.5;
  }

  100% {
    transform: scale(0);
    opacity: 0;
  }
}

.peca.capturada {
  animation: capturaAnim 0.3s ease-out forwards;
}

/* BOTÕES INFERIORES */
.controles-inferiores {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
}

.btn-circular {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--verde);
  color: white;
  font-size: 1.6rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), inset 0 -4px 0 rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
  cursor: pointer;
}

.btn-circular:active {
  transform: translateY(4px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.btn-circular.inativo {
  background: #b9c1c8;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), inset 0 -4px 0 rgba(0, 0, 0, 0.05);
}

/* EFEITOS */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
  overflow: hidden;
}

.sparkle {
  position: fixed;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 15px white, 0 0 25px gold;
  opacity: 0;
  animation: sparkle 0.6s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes sparkle {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(0.1) translateY(-30px);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 12px;
  height: 16px;
  border-radius: 4px;
  opacity: 0.98;
  animation: confettiFall var(--dur) ease-out forwards;
  will-change: transform, opacity;
}

@keyframes confettiFall {
  to {
    transform: translate(var(--dx), calc(110vh + 40px)) rotate(var(--rot));
    opacity: 0;
  }
}

/* BARRA EMOJIS ONLINE */
.barra-emojis {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 15px;
  border-radius: 30px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.btn-reacao {
  font-size: 1.6rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: 0.2s;
  user-select: none;
}

.btn-reacao:active {
  transform: scale(0.7);
}

.emoji-pop {
  position: fixed;
  font-size: 3.5rem;
  pointer-events: none;
  z-index: 300;
  animation: floatUp 1.5s ease-out forwards;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 40px) scale(0.5);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.2) rotate(-10deg);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -150px) scale(1) rotate(10deg);
  }
}

/* RESPONSIVIDADE */
@media (max-width: 600px) {
  .btn-topo {
    padding: 12px;
    font-size: 1.4rem;
    gap: 0;
  }

  .btn-topo span {
    display: none;
  }

  .ponto-box {
    min-width: 110px;
    padding: 4px 12px 4px 4px;
    gap: 6px;
  }

  .ponto-box.invertido {
    padding: 4px 4px 4px 12px;
  }

  .avatar-placar {
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
  }

  .ponto-box b {
    font-size: 1.8rem;
  }

  .placar-vs {
    font-size: 1rem;
  }

  #tela-sobre .card-info {
    padding: 18px;
    width: 95%;
    max-height: 90vh;
  }

  .painel-jogo {
    margin: 15px 8px 80px 8px;
    padding: 15px 12px;
    border-radius: 35px;
  }
}

@media (max-height: 820px) {
  .painel-jogo {
    margin-top: 15px;
    margin-bottom: 70px;
    padding: 12px 15px 20px 15px;
  }

  .card-info {
    padding: 15px;
    max-width: 480px;
  }

  .topo {
    padding: 10px 0;
  }

  /* Altera apenas a variável — todos os elementos sincronizam automaticamente */
  .tabuleiro-coord-wrap {
    --board-size: min(88vw, 52vh, 440px);
  }

  .ponto-box b {
    font-size: 1.8rem;
  }

  .avatar-placar {
    width: 44px;
    height: 44px;
    font-size: 1.8rem;
  }

  .placar-geral {
    padding: 6px 12px;
  }

  h2.texto-bolha {
    font-size: 1.8rem !important;
    margin-bottom: 12px !important;
  }

  .secao-jogador {
    padding: 8px;
    margin-bottom: 10px;
  }

  .btn-avatar {
    font-size: 1.4rem;
    padding: 4px;
  }

  .input-nome {
    padding: 10px;
    font-size: 1rem;
    margin-bottom: 5px;
  }

  .btn-acao {
    padding: 12px;
    font-size: 1.1rem;
    margin: 5px 0;
  }

  .btn-modo {
    padding: 12px;
    font-size: 1.05rem;
    margin-bottom: 8px;
  }

  .lbl-jogador {
    font-size: 1rem;
    margin-bottom: 4px;
  }

  .codigo-sala {
    font-size: 1.3rem;
    padding: 8px;
    margin-bottom: 10px;
  }

  /* OTIMIZAÇÃO GPU PARA CELULARES FRACOS */
  .peca.j1 {
    box-shadow: 0 4px 0 #bdc3c7, 0 4px 8px rgba(0, 0, 0, 0.3);
  }
  .peca.j2 {
    box-shadow: 0 4px 0 #000, 0 4px 8px rgba(0, 0, 0, 0.4);
  }
}

@media (max-height: 720px) {
  .painel-jogo {
    margin-top: 5px;
    margin-bottom: 60px;
    padding: 8px 10px 12px 10px;
  }
  .topo {
    padding: 5px 0;
  }
  /* Altera apenas a variável — todos os elementos sincronizam automaticamente */
  .tabuleiro-coord-wrap {
    --board-size: min(85vw, 46vh, 360px);
  }
  .btn-dicas-xadrez {
    margin-top: 8px;
    padding: 6px 15px;
    font-size: 0.85rem;
  }
  .barra-emojis {
    margin-top: 6px;
    padding: 5px 10px;
  }
  .btn-reacao {
    font-size: 1.3rem;
  }
  .coord-rows {
    height: min(85vw, 46vh, 360px);
  }
  .coord-cols {
    width: min(85vw, 46vh, 360px);
  }
  .ponto-box b {
    font-size: 1.5rem;
  }
  .avatar-placar {
    width: 38px;
    height: 38px;
    font-size: 1.5rem;
  }
}

/* ========== REI EM XEQUE ========== */
@keyframes xequeAlerta {
  0%, 100% { background: rgba(231, 76, 60, 0.45); box-shadow: inset 0 0 0 3px rgba(231, 76, 60, 0.8); }
  50%       { background: rgba(231, 76, 60, 0.80); box-shadow: inset 0 0 0 4px rgba(255, 50, 50, 1), 0 0 15px rgba(231,76,60,0.6); }
}
.celula.rei-em-xeque {
  animation: xequeAlerta 0.55s ease-in-out infinite !important;
}

/* ========== BARRA DE EMPATE ========== */
.barra-empate-wrap {
  width: 100%;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: #f8f8f8;
  border-radius: 16px;
  box-sizing: border-box;
}
.barra-empate-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #888;
  margin-bottom: 4px;
}
.barra-empate-track {
  height: 8px;
  background: #e8e8e8;
  border-radius: 20px;
  overflow: hidden;
}
.barra-empate-progresso {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2ecc71 0%, #f39c12 60%, #e74c3c 100%);
  border-radius: 20px;
  transition: width 0.5s ease;
}

/* ========== COORDENADAS DO TABULEIRO ========== */
.tabuleiro-coord-wrap {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  --board-size: min(88vw, 55vh, 480px); /* FONTE Única DE VERDADE do tamanho do tabuleiro */
}
.coord-rows {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: var(--board-size);
  padding: 1px 0;
  box-sizing: border-box;
}
.coord-rows span {
  font-size: clamp(0.55rem, 1.2vw, 0.75rem);
  font-weight: 700;
  color: #8d6e4f;
  text-align: center;
  line-height: 1;
  width: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tabuleiro-col-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.coord-cols {
  display: flex;
  justify-content: space-around;
  width: var(--board-size);
  padding: 0 1px;
}
.coord-cols span {
  font-size: clamp(0.55rem, 1.2vw, 0.75rem);
  font-weight: 700;
  color: #8d6e4f;
  text-align: center;
  line-height: 1;
  flex: 1;
}

/* ========== LEGENDA DAS PEÇAS ========== */
.legenda-pecas {
  width: 100%;
  margin-top: 14px;
  border-radius: 20px;
  background: #fffdf5;
  border: 2px dashed #fcd5ce;
  overflow: hidden;
}
.legenda-pecas summary {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--laranja);
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.legenda-pecas summary::-webkit-details-marker { display: none; }
.legenda-pecas[open] summary { border-bottom: 1px solid #fcd5ce; }
.legenda-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 12px;
}
.legenda-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.legenda-item span {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  color: #2c3e50;
}
.legenda-item b {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.9rem;
  color: var(--azul-escuro);
  display: block;
}
.legenda-item small {
  font-size: 0.72rem;
  color: #888;
  line-height: 1.2;
}

/* ========== BOTÃO DICAS ========== */
.btn-dicas-xadrez {
  font-family: 'Fredoka', sans-serif;
  background: var(--azul-escuro);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 8px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  box-shadow: 0 4px 0 #1565c0;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.3px;
}
.btn-dicas-xadrez:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #1565c0;
}
.btn-dicas-xadrez:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1565c0;
}

/* ========== MODAL DICAS ========== */
.modal-dicas-overlay {
  z-index: 250;
}
.modal-dicas-card {
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
  scrollbar-width: thin;
}
.modal-dicas-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-dicas-fechar {
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  color: #888;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-dicas-fechar:hover { background: #fcd5ce; color: #e74c3c; }
.modal-dicas-titulo {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  color: var(--azul-escuro);
  margin: 14px 0 8px 0;
  padding-left: 4px;
  border-left: 4px solid var(--laranja);
  padding-left: 10px;
}
.dica-box {
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #444;
  margin-bottom: 4px;
}
.dica-box p { margin: 0 0 8px 0; }
.dica-box-azul {
  background: #e8f4fd;
  border: 2px solid #a5d8ff;
}
.dicas-lista {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.dica-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f8f9fa;
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 0.88rem;
  color: #444;
  line-height: 1.4;
}
.dica-item b { color: #2c3e50; }