/* RESET */
body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #1f1f2e, #2e2e3e);
  margin: 0;
  padding: 0;
  color: #f0f0f0;
}

.hidden {
  display: none !important;
}

/* LAYOUT PRINCIPAL */
#jogo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

#topo-acoes {
  text-align: center;
  padding: 20px;
  background-color: #2c2c3e;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#tela-jogo {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px;
}

/* CARTAS E FORMULÁRIO */
#painel-cartas, #painel-log {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#cartas {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.categoria-cartas {
  background: #2e2e3e;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.categoria-cartas h4 {
  text-align: center;
  font-size: 18px;
  margin-bottom: 10px;
  color: #ffffff;
}

.carta {
  display: inline-block;
  padding: 8px 12px;
  background: #3e3e4e;
  border: 1px solid #666;
  border-radius: 6px;
  margin: 4px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  color: #fff;
}

/* ANOTAÇÕES DE CARTAS - alinhadas horizontalmente */
.anotacao-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  justify-content: space-between;
}

.anotacao-item input[type="checkbox"] {
  transform: scale(1.2);
  margin-left: 2px;
  margin-right: 4px;
}

.anotacao-item label {
  flex: 0 0 130px;
  color: #f0f0f0;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.anotacao-item input[type="text"] {
  flex: 1;
  padding: 6px 10px;
  border-radius: 5px;
  background: #1c1c2c;
  color: white;
  border: 1px solid #444;
  min-width: 100px;
}

/* TABULEIRO */
#painel-tabuleiro {
  flex-grow: 1;
  display: flex;
  justify-content: center;
}

#tabuleiro-container {
  position: relative;
  width: 600px;
  height: 800px;
  border: 2px solid #555;
  border-radius: 12px;
  overflow: hidden;
}

#tabuleiro {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

#peoes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* LOG */
#log {
  height: 300px;
  overflow-y: auto;
  background: #2e2e3e;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #444;
  font-size: 14px;
  color: #ccc;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* BOTÕES E FORMULÁRIOS */
button, input, select {
  font-size: 16px;
  padding: 8px 12px;
  margin: 4px;
  border-radius: 5px;
  border: none;
}

button {
  background-color: #007bff;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

button:hover {
  background-color: #0056b3;
}

input, select {
  background: #1c1c2c;
  color: white;
  border: 1px solid #444;
}

/* PEÕES */
.peao {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  background-color: red;
  color: white;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  box-shadow: 0 0 4px #000;
}

.peao:active {
  cursor: grabbing;
}

/* Vez do jogador */
#vez-jogador {
  font-size: 20px;
  font-weight: bold;
  color: #f39c12;
}

/* ENTRADA */
#tela-nome {
  text-align: center;
  padding: 60px 20px;
  background: #2c2c3e;
  border-radius: 12px;
  max-width: 400px;
  margin: 60px auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ALERTA DE CARTA */
#alerta-carta {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.caixa-alerta {
  background: white;
  color: black;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
  max-width: 90%;
}

.caixa-alerta img {
  max-width: 200px;
  margin-bottom: 10px;
}

.caixa-alerta p {
  color: black;
  font-size: 16px;
  margin-bottom: 10px;
}

/* POPUP DE PALPITE FINAL */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.popup-overlay .caixa-alerta {
  background: #2e2e3e;
  border: 1px solid #444;
  border-radius: 12px;
  padding: 20px;
  width: 95%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  font-family: 'Segoe UI', sans-serif;
  color: #f0f0f0;
}

.popup-overlay h3 {
  font-size: 22px;
  margin-bottom: 20px;
  text-align: center;
  color: #f0f0f0;
}

.popup-overlay h4 {
  font-size: 18px;
  margin: 20px 0 10px;
  border-bottom: 1px solid #555;
  padding-bottom: 4px;
  color: #f39c12;
}

.popup-overlay label {
  display: inline-block;
  margin: 8px 12px;
  cursor: pointer;
  font-size: 15px;
}

.popup-overlay input[type="radio"] {
  margin-right: 6px;
  transform: scale(1.2);
  accent-color: #007bff;
}

.popup-overlay button {
  margin: 10px 10px 0;
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  background-color: #007bff;
  color: white;
  transition: background-color 0.2s ease-in-out;
}

.popup-overlay button:hover {
  background-color: #0056b3;
}

/* MOBILE */
@media (max-width: 768px) {
  #tela-jogo {
    flex-direction: column;
    align-items: center;
  }

  #painel-cartas,
  #painel-log {
    width: 95%;
    max-width: 100%;
  }

  #painel-tabuleiro {
    width: 100%;
    justify-content: center;
  }

  #tabuleiro-container {
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
  }

  #tabuleiro {
    width: 100%;
    height: auto;
  }

  .carta {
    margin: 4px 6px;
    font-size: 14px;
  }

  #topo-acoes {
    padding: 10px;
  }

  #acoes button {
    display: block;
    width: 100%;
    margin: 8px 0;
  }

  #mostrar-carta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  #mostrar-carta select,
  #mostrar-carta button {
    width: 100%;
    margin: 4px 0;
  }

  #log {
    height: auto;
    max-height: 200px;
  }

  #jogadores p {
    font-size: 14px;
  }
}

#dados {
  font-size: 32px;
  font-weight: bold;
  transition: transform 0.6s ease-in-out;
}

#dados.animando {
  animation: girar-dado 0.6s ease-in-out;
}

@keyframes girar-dado {
  0% { transform: rotate(0deg) scale(1); opacity: 0.3; }
  50% { transform: rotate(360deg) scale(1.5); opacity: 1; }
  100% { transform: rotate(720deg) scale(1); opacity: 1; }
}

#cubo-dado {
  position: absolute;
  width: 60px;
  height: 60px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  perspective: 600px;
  z-index: 10;
  pointer-events: none;
}

.cubo {
  width: 60px;
  height: 60px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0deg) rotateY(0deg);
  transition: transform 1s ease;
}

.face {
  position: absolute;
  width: 60px;
  height: 60px;
  background: #fff;
  color: #000;
  font-size: 32px;
  font-weight: bold;
  border: 1px solid #222;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  backface-visibility: hidden;
  /* opcional para realismo */
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

/* ✅ translateZ deve ser metade do cubo: 30px */
.face1 { transform: rotateY(0deg)    translateZ(30px); }    /* Frente  -> 1 */
.face2 { transform: rotateY(180deg)  translateZ(30px); }    /* Verso   -> 2 */
.face3 { transform: rotateY(90deg)   translateZ(30px); }    /* Direita -> 3 */
.face4 { transform: rotateY(-90deg)  translateZ(30px); }    /* Esquerda-> 4 */
.face5 { transform: rotateX(90deg)   translateZ(30px); }    /* Topo    -> 5 */
.face6 { transform: rotateX(-90deg)  translateZ(30px); }    /* Fundo   -> 6 */

@keyframes girar-cubo {
  0%   { transform: rotateX(0deg) rotateY(0deg); }
  100% { transform: rotateX(720deg) rotateY(720deg); }
}

#cubo-jogador-nome {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
  z-index: 11;
}
