:root {
  --primary: #0056b3;
  --primary-hover: #004494;
  --secondary: #ff8c00;
  --bg-color: #f4f7f6;
  --text-color: #333;
  --panel-bg: #fff;
  --border-radius: 12px;
  /* Colores semi-transparentes para las casillas */
  --goose-color: rgba(227, 242, 253, 0.4);
  --luck-color: rgba(255, 243, 224, 0.4);
  --destiny-color: rgba(252, 228, 236, 0.4);
  --danger-color: rgba(255, 235, 238, 0.4);
  --special-color: rgba(232, 245, 233, 0.4);
  
  --p1-color: #e74c3c;
  --p2-color: #3498db;
  --p3-color: #2ecc71;
  --p4-color: #f1c40f;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Tipografía grande para TV */
h1 { font-size: 3rem; margin-bottom: 1rem; color: var(--primary); }
h2 { font-size: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
p { font-size: 1.2rem; }

/* Botones */
.btn {
  padding: 10px 20px;
  font-size: 1.2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: bold;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary { background-color: var(--primary); color: white; }
.btn-secondary { background-color: #6c757d; color: white; }
.btn-large { padding: 15px 30px; font-size: 1.5rem; }
.btn-huge { padding: 20px 40px; font-size: 2rem; border-radius: 12px; }
.btn-small { padding: 8px 15px; font-size: 1rem; }

/* Screens */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  flex: 1;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* Intro/Config/Student Screens */
#intro-screen, #config-screen, #student-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
}
.intro-content {
  background: var(--panel-bg);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  max-width: 800px;
  width: 90%;
  margin: auto;
}
.intro-content h1 span { font-size: 2rem; color: var(--secondary); display: block; margin-top: 10px; }
.settings-group { margin: 30px 0; background: #f8f9fa; padding: 20px; border-radius: 8px; }
.btn-group { display: flex; justify-content: center; gap: 15px; margin-bottom: 10px; }
.mode-btn { background-color: #e9ecef; color: #495057; border: 2px solid transparent; }
.mode-btn.active { background-color: var(--primary); color: white; border-color: var(--primary-hover); }
.input-big { font-size: 1.5rem; padding: 10px; width: 100px; text-align: center; border-radius: 8px; border: 1px solid #ccc; margin-bottom: 20px; }

.player-inputs-container { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
.player-input-row { display: flex; align-items: center; gap: 10px; background: white; padding: 10px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.player-input-row input[type="text"] { font-size: 1.2rem; padding: 8px; border: 1px solid #ddd; border-radius: 4px; }
.player-input-row input[type="color"] { width: 40px; height: 40px; border: none; cursor: pointer; border-radius: 4px; }

/* Game Screen */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: var(--panel-bg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 10;
}
.turn-indicator { font-size: 2rem; font-weight: bold; }
#current-player-name { color: var(--primary); padding: 5px 15px; border-radius: 8px; background: #e9ecef; }
.game-controls { display: flex; gap: 10px; }

.game-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 20px;
  gap: 20px;
}

/* Board */
.board-container {
  flex: 3;
  position: relative;
  background: transparent;
  /* Placeholder para imagen de fondo del tablero */
  background-image: url('assets/tablero-bg.png');
  background-size: 100% 100%; /* Ajusta el fondo para que siempre cubra todo sin importar la pantalla */
  background-position: center;
  background-repeat: no-repeat;
  border-radius: var(--border-radius);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  padding: 10px;
  overflow: auto;
}
.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 15px; /* Aumentado para dar efecto de camino */
  width: 100%;
  height: 100%;
  min-height: 600px; /* Para asegurar buena altura en TV */
  background: transparent; /* Quitamos la capa blanca transparente */
  border-radius: 8px;
  padding: 10px;
}
.cell {
  border: 2px solid #bdc3c7;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  text-align: center;
  padding: 5px;
  background: rgba(255, 255, 255, 0.15); /* Casillas muy transparentes */
  transition: transform 0.2s;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.cell-id { 
  position: absolute; 
  top: 2px; 
  left: 5px; 
  font-weight: bold; 
  font-size: 1.2rem; 
  color: #333; 
  text-shadow: 0px 0px 4px rgba(255,255,255,0.9); 
}
.cell-name { 
  font-size: 0.9rem; 
  font-weight: bold; 
  text-shadow: 0px 0px 4px rgba(255,255,255,0.9);
  color: #111;
}

/* Estilos de casillas */
.cell.goose { background: var(--goose-color); border-color: #64b5f6; }
.cell.luck { background: var(--luck-color); border-color: #ffb74d; }
.cell.destiny { background: var(--destiny-color); border-color: #f06292; }
.cell.bridge { background: var(--special-color); border-color: #81c784; }
.cell.dice { background: rgba(209, 196, 233, 0.4); border-color: #7e57c2; } /* Morado para los dados */
.cell.inn, .cell.well, .cell.maze, .cell.prison { background: var(--danger-color); border-color: #e57373; }
.cell.death { background: rgba(66, 66, 66, 0.5); color: white; border-color: #212121; }
.cell.death .cell-name, .cell.death .cell-id { text-shadow: 0px 0px 4px rgba(0,0,0,0.9); color: white; }
.cell.end { background: rgba(255, 215, 0, 0.5); border-color: #f39c12; }
.cell.start { background: rgba(165, 214, 167, 0.5); }

/* Fichas */
.tokens-layer {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  pointer-events: none;
}
.token {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  position: absolute;
  transition: all 0.5s ease-in-out;
  border: 3px solid white;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 100;
  transform: translate(-50%, -50%);
}

/* Sidebar */
.sidebar {
  flex: 1;
  min-width: 300px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.dice-section {
  background: var(--panel-bg);
  padding: 20px;
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.dice-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}
.die {
  width: 80px;
  height: 80px;
  background: white;
  border: 2px solid #333;
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3rem;
  font-weight: bold;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.2);
}
.roll-result { font-size: 2rem; font-weight: bold; color: var(--primary); margin-top: 10px; min-height: 40px; }

.players-status, .history-section {
  background: var(--panel-bg);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.players-list { display: flex; flex-direction: column; gap: 10px; }
.player-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 1.2rem;
}
.player-color-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #ccc; }
.player-stat.active { border: 2px solid var(--primary); background: #e3f2fd; }

.history-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  margin-top: 10px;
  font-size: 1.1rem;
}
.history-list li {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

/* Modales */
.modal {
  border: none;
  border-radius: var(--border-radius);
  padding: 0;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  margin: auto;
  max-width: 600px;
  width: 90%;
  backdrop-filter: blur(10px);
}
.modal::backdrop {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
}
.modal-content, .card-content {
  padding: 50px;
  text-align: center;
  background: rgba(255,255,255,0.95);
}
.card-content { border: 10px solid var(--primary); border-radius: var(--border-radius); }
.card-content.luck-theme { border-color: #f39c12; background: #fffdf7; }
.card-content.destiny-theme { border-color: #e74c3c; background: #fff5f5; }
.card-title, #special-title { font-size: 2.5rem; margin-bottom: 25px; }
.card-desc, #special-desc { font-size: 1.5rem; margin-bottom: 40px; font-style: italic; line-height: 1.4; }
.card-effect { font-size: 1.8rem; font-weight: bold; margin-bottom: 30px; color: var(--primary); }

.victory-content h1 { font-size: 4rem; color: #f1c40f; text-shadow: 2px 2px 4px rgba(0,0,0,0.2); }
.winner-name { font-size: 3rem; margin: 20px 0; color: var(--primary); }
.victory-actions { display: flex; justify-content: center; gap: 20px; margin-top: 40px; }

/* Overlay de dados */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.dice-animation-container { display: flex; gap: 40px; }
.big-die {
  width: 150px;
  height: 150px;
  background: white;
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 5rem;
  font-weight: bold;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}
.big-die.rolling {
  animation: roll 0.5s infinite;
}
@keyframes roll {
  0% { transform: rotateX(0) rotateY(0) rotateZ(0); }
  100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); }
}

@keyframes secretOscillate1 {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-80px); }
  75% { transform: translateY(80px); }
}
@keyframes secretOscillate2 {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(80px); }
  75% { transform: translateY(-80px); }
}
.big-die.secret-6 {
  animation: secretOscillate1 0.6s infinite ease-in-out;
}
.big-die.secret-7 {
  animation: secretOscillate2 0.6s infinite ease-in-out;
}

@media (max-width: 1024px) {
  .game-layout { flex-direction: column; }
  .board { min-height: 400px; }
  .sidebar { max-width: none; flex-direction: row; flex-wrap: wrap; }
  .dice-section, .players-status, .history-section { flex: 1; min-width: 250px; }
}
