/* Paleta: azul claro, cinza, branco, verde suave */
:root {
  --primary-bg: #f6fbff;
  --secondary-bg: #e3eaf2;
  --card-bg: #ffffffcc;
  --accent: #6ec1e4;
  --accent-dark: #3a8bb7;
  --success: #7ed957;
  --danger: #ff6b6b;
  --text-main: #222;
  --text-light: #fff;
  --shadow: 0 4px 24px #0001;
  --border-radius: 16px;
  --transition: 0.25s cubic-bezier(.4,2,.6,1);
}

body {
  background: var(--primary-bg);
  color: var(--text-main);
  font-family: 'Nunito', 'Inter', Arial, sans-serif;
  text-align: center;
  margin: 0;
  padding-bottom: 200px; /* Aumentado para dar espaço ao footer */
  min-height: 100vh;
  transition: background var(--transition);
}

.hero-section {
  margin: 20px 0 30px 0;
}

.hero-description {
  font-size: 1.2em;
  color: var(--accent-dark);
  margin: 16px 0;
  font-weight: 500;
}

#game-area {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  margin-top: 30px;
  margin-bottom: 20px;
  width: 100%;
  transition: gap var(--transition);
}

#timers {
  margin-bottom: 16px;
  text-align: center;
  font-size: 1.1em;
  font-weight: bold;
  background: var(--secondary-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 10px 0;
}

#chessboard {
  margin: 0 auto;
  width: min(90vw, 90vh);
  max-width: 600px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  background: var(--card-bg);
  transition: box-shadow var(--transition);
}

#status {
  margin: 20px;
  font-size: 1.2em;
  color: var(--accent-dark);
  font-weight: 600;
  letter-spacing: 0.5px;
}

button, input[type="text"] {
  padding: 12px 18px;
  font-size: 1.1em;
  border-radius: 8px;
  margin: 4px 0;
  box-sizing: border-box;
  border: none;
  outline: none;
  background: var(--accent);
  color: var(--text-light);
  box-shadow: 0 2px 8px #0001;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}
button:hover, input[type="text"]:focus {
  background: var(--accent-dark);
  box-shadow: 0 4px 16px #0002;
  transform: translateY(-2px) scale(1.03);
}
button:active {
  background: var(--accent-dark);
  transform: scale(0.98);
}

#private-room-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}
#private-room-controls input[type="text"] {
  min-width: 110px;
  max-width: 220px;
  width: 100%;
  background: var(--secondary-bg);
  color: var(--text-main);
  border: 1px solid #b0c4d4;
  box-sizing: border-box;
  font-size: 1em;
  padding: 8px 10px;
  margin: 0 6px;
}
#roomCodeDisplay {
  color: var(--success);
  font-weight: bold;
  font-size: 1.1em;
}
#history, #stats, #chat {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 18px 12px 12px 12px;
  text-align: left;
  transition: box-shadow var(--transition);
}
#history h3, #stats h3, #chat h3 {
  margin-top: 0;
  color: var(--accent-dark);

  font-size: 1.1em;
}
#move-list {
  padding-left: 18px;
  font-size: 1.05em;
  max-height: 120px;
  overflow-y: auto;
}
#chat {
  margin-top: 30px;
  background: var(--card-bg);
  padding: 12px 8px 8px 8px;
}
#chat-messages {
}
#chat-form {
  display: flex;
  gap: 6px;
}
#chat-input {
  flex: 1 1 0;
  min-width: 60px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #b0c4d4;
  background: #f6fbff;
  color: var(--text-main);
  font-size: 1em;
}
#chat-form button {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 1em;
  border-radius: 8px;
}
#victory-overlay, #exportModal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  animation: fadeIn 0.7s;
}
#victory-overlay img {
  width: 220px;
  max-width: 80vw;
  animation: bounce 1.2s infinite alternate;
}
#victory-overlay div {
  color: #fff;
  font-size: 2.2em;
  font-weight: bold;
  margin-top: 30px;
  text-shadow: 2px 2px 8px #000;
}
#exportContent {
  background: var(--card-bg);
  padding: 24px 16px;
  border-radius: var(--border-radius);
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  text-align: left;
  color: var(--text-main);
  background: var(--card-bg);
  padding: 24px 16px;
  border-radius: var(--border-radius);
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  text-align: left;
  color: var(--text-main);
}
footer {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  background: var(--accent-dark);
  color: var(--text-light);
  z-index: 100;
  box-shadow: 0 -2px 8px #0002;
  transition: background var(--transition);
  max-height: 160px; /* Reduzido altura máxima */
  overflow-y: auto; /* Permitir scroll se necessário */
}

.footer-content {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 14px 16px 10px 16px; /* Reduzido padding ainda mais */
  max-width: 1200px;
  margin: 0 auto;
  gap: 24px; /* Reduzido gap */
}

.footer-section {
  flex: 1;
  min-width: 200px;
}

.footer-section h4 {
  margin: 0 0 8px 0; /* Reduzido margin */
  font-size: 1em; /* Reduzido tamanho da fonte */
  color: var(--text-light);
}

.footer-section p {
  margin: 6px 0; /* Reduzido margin */
  font-size: 0.85em; /* Reduzido tamanho da fonte */
  line-height: 1.3; /* Reduzido line-height */
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 6px 0; /* Reduzido margin */
}

.footer-section li {
  margin: 3px 0; /* Reduzido margin */
  font-size: 0.85em; /* Reduzido tamanho da fonte */
  line-height: 1.3; /* Reduzido line-height */
}

.footer-section a {
  color: var(--text-light);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-section a:hover {
  color: var(--accent);
  text-decoration: underline;
}


.game-board-container {
  /* min-width: 220px; Removido, o min-width será tratado pelo tabuleiro */
  max-width: 600px; /* Ajustado para o max-width do tabuleiro */
  width: 100%; /* Garantir que ocupe a largura disponível */
}

@media (max-width: 700px) {
  .game-board-container {
    max-width: 98vw; /* Ajuste para telas pequenas */
  }
}

.game-sidebar {
  min-width: 220px;
  max-width: 300px;
  width: 100%; /* Garantir que ocupe a largura disponível */
}

@media (max-width: 700px) {
  .game-sidebar {
    min-width: unset; /* Permitir que a largura seja automática em telas pequenas */
    max-width: 98vw; /* Ajuste para telas pequenas */
  }
}
#resignBtn {
 background: var(--danger);
 color: var(--text-light);
}
#resignBtn:hover {
 background: #c0392b; /* Um tone mais escuro para o hover */
}
select {
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid #b0c4d4;
  background: #f6fbff;
  color: var(--text-main);
  margin-left: 6px;
}

#privacy-banner {
  background: var(--accent-dark);
  color: var(--text-light);
  padding: 12px 0;
  font-size: 1.1em;
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 2px 8px #0001;
}
/* Animações customizadas */
@keyframes bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-30px); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsividade */
@media (max-width: 700px) {
  #game-area { 
    flex-direction: column; 
    align-items: center; 
    gap: 0; 
    margin-bottom: 30px;
  }
  #chessboard { width: 98vw; max-width: 98vw; }
  #timers { font-size: 1em; }
  #history, #stats, #chat { max-width: 98vw; min-width: unset; }
  #chat-messages { height: 80px; font-size: 0.95em; }
  body { padding-bottom: 250px; /* Aumentado para telas menores */ }
  .footer-content { 
    flex-direction: column; 
    gap: 16px; /* Reduzido gap */
    padding: 12px; /* Reduzido padding */
  }
  .footer-section { 
    min-width: unset; 
    text-align: center; 
  }
  footer {
    max-height: 180px; /* Reduzido para telas menores */
  }
}

/* Para telas muito pequenas */
@media (max-width: 480px) {
  #game-area { margin-bottom: 40px; }
  body { padding-bottom: 280px; /* Aumentado para telas muito pequenas */ }
  .footer-content { 
    padding: 10px; /* Reduzido ainda mais */
    gap: 12px; /* Reduzido gap */
  }
  .footer-section h4 { 
    font-size: 0.95em; /* Reduzido tamanho da fonte */
  }
  .footer-section p, .footer-section li { 
    font-size: 0.8em; /* Reduzido tamanho da fonte */
  }
  footer {
    max-height: 200px; /* Reduzido para telas muito pequenas */
  }
}

#chat-messages {
  background: #f6fbff !important;
  color: #222 !important;
  border: 1px solid #e3eaf2;
  min-height: 60px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px 6px 8px 10px;
  border-radius: 10px;
  font-size: 1em;
}

/* Estilos para mensagens do chat */
.chat-message {
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  font-size: 1em;
  display: flex;
  align-items: center;
  background: #f6fbff;
  color: #222;
  box-shadow: 0 1px 4px #0001;
  word-break: break-word;
}
.chat-message.player1 {
  background: #e3f2fd;
  color: #1565c0;
  font-weight: 600;
}
.chat-message.player2 {
  background: #e8f5e9;
  color: #388e3c;
  font-weight: 600;
}
.chat-message.spectator {
  background: #f5f5f5;
  color: #757575;
  font-style: italic;
}
.chat-message .star {
  margin-right: 6px;
  font-size: 1.1em;
  color: #ffb300;
  filter: drop-shadow(0 1px 2px #fff8);
}

/* Classes utilitárias para Animate.css */
.animated { animation-duration: 0.7s; animation-fill-mode: both; }
.animate__fadeIn { animation-name: fadeIn; }
.animate__bounce { animation-name: bounce; }
.move-highlight {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, #6ec1e4cc 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  position: absolute;
  left: 0; top: 0;
  z-index: 10;
  opacity: 0.7;
} 

#downloadExportBtn {
  margin-left: 8px;
}

.export-modal-buttons button {
  font-size: 1em;
}

.export-modal-buttons {
  margin-top: 16px;
}