/* ═══════════════════════════════════════════════════════════════════════════
   BIOLUDO - ESTILOS GLOBAIS E RESPONSIVIDADE
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@700;900&family=Inter:wght@400;500;600;800&display=swap');

:root {
  --ludo-red: #E63946;
  --ludo-blue: #457B9D;
  --ludo-green: #2A9D8F;
  --ludo-yellow: #F4A261;
  --ludo-dark: #1D3557;
  --ludo-light: #F1FAEE;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
  overflow-x: hidden;
  height: 100vh;
  width: 100vw;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL (RESPONSIVO)
   ═══════════════════════════════════════════════════════════════════════════ */

#screen-game {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
  padding: 1rem;
  gap: 1rem;
  background-color: #f1f5f9;
}

/* Ajuste para Tablets e Celulares */
@media (max-width: 1024px) {
  #screen-game {
    flex-direction: column;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .players-panel {
    order: 2;
    width: 100% !important;
    height: auto !important;
    min-height: 120px;
    flex-direction: row !important;
    overflow-x: auto;
    overflow-y: hidden;
  }
  
  .players-list {
    flex-direction: row !important;
    width: 100%;
  }

  .players-list > div {
    min-width: 180px;
    flex: 0 0 auto;
  }

  .game-center {
    order: 1;
    width: 100%;
    flex: none !important;
    padding: 0.5rem 0;
  }

  .control-panel {
    order: 3;
    width: 100% !important;
    height: auto !important;
    flex: none !important;
  }

  .board-wrapper {
    width: 95vw !important;
    height: 95vw !important;
    max-width: 500px !important;
    max-height: 500px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABULEIRO (GRID DINÂMICO)
   ═══════════════════════════════════════════════════════════════════════════ */

.board-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  width: min(82vh, 82vw);
  height: min(82vh, 82vw);
  background-color: white;
  border: 8px solid white;
  border-radius: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.board-bg-image {
  position: absolute;
  inset: 0;
  background-image: url('tabuleiro.png');
  background-size: 100% 100%;
  background-position: center;
  z-index: 0;
}

#pawns-container {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PEÕES (ESTILIZAÇÃO)
   ═══════════════════════════════════════════════════════════════════════════ */

.pawn {
  position: absolute;
  width: 6.5%; /* Baseado no grid 15x15 */
  height: 6.5%;
  min-width: 20px;
  min-height: 20px;
  max-width: 32px;
  max-height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  pointer-events: auto;
  z-index: 30;
  transform: translate(-50%, -50%); /* Garante alinhamento central constante */
}

.pawn:hover {
  transform: translate(-50%, -60%) scale(1.2) !important;
  z-index: 100;
  filter: brightness(1.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DADO 3D (ANIMAÇÃO)
   ═══════════════════════════════════════════════════════════════════════════ */

.dice-section {
  perspective: 1000px;
}

.dice-cube {
  width: 60px;
  height: 60px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.face {
  position: absolute;
  width: 60px;
  height: 60px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 900;
  color: #1e293b;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

.front  { transform: rotateY(0deg) translateZ(30px); }
.back   { transform: rotateY(180deg) translateZ(30px); }
.right  { transform: rotateY(90deg) translateZ(30px); }
.left   { transform: rotateY(-90deg) translateZ(30px); }
.top    { transform: rotateX(90deg) translateZ(30px); }
.bottom { transform: rotateX(-90deg) translateZ(30px); }

.rolling {
  animation: dice-roll 0.8s infinite linear;
}

@keyframes dice-roll {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAIS E UTILITÁRIOS
   ═══════════════════════════════════════════════════════════════════════════ */

.custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }

.btn-option {
  width: 100%;
  padding: 1rem;
  text-align: left;
  background-color: #f8fafc;
  border: 2px solid #f1f5f9;
  border-radius: 1rem;
  font-weight: 700;
  color: #475569;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.order-item {
  padding: 0.75rem;
  background-color: white;
  border: 2px solid #f1f5f9;
  border-radius: 0.75rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.5rem;
  cursor: default;
}

.modal-overlay {
  backdrop-filter: blur(4px);
}

/* Esconder elementos desnecessários no mobile */
@media (max-width: 640px) {
  .players-panel h3, .players-panel i {
    display: none;
  }
  
  .current-player-card {
    padding: 0.75rem !important;
  }
  
  .player-name {
    font-size: 1.25rem !important;
  }
}
