:root {
    --bg-color: #0a0a12;
    --text-color: #e0e0ff;
    --neon-blue: #00f3ff;
    --neon-pink: #ff00ff;
    --neon-gold: #ffd700;
    --neon-green: #39ff14;
    --neon-red: #ff3131;
    --glass-panel: rgba(20, 20, 35, 0.85);
    --border-glow: 0 0 10px rgba(0, 243, 255, 0.3);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Roboto Mono', monospace; /* Fuente secundaria para textos */
    overflow: hidden; /* Evitar scroll en el body principal */
    height: 100vh;
}

h1, h2, h3, .btn-neon {
    font-family: 'Orbitron', sans-serif; /* Fuente principal neón */
    text-transform: uppercase;
}

.oculto { display: none !important; }

/* --- Setup Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex; justify-content: center; align-items: center; z-index: 100;
}
.setup-box {
    background: var(--glass-panel);
    border: 2px solid var(--neon-blue);
    padding: 30px; border-radius: 15px; box-shadow: var(--border-glow);
    text-align: center; max-width: 500px; width: 90%;
}
.setup-box h1 { color: var(--neon-blue); margin-bottom: 5px; font-size: 2.5rem; }
.setup-box .subtitle { color: var(--neon-pink); font-size: 1.2rem; display: block;}
.setup-section { margin: 20px 0; font-size: 1.2rem; }
#num-jugadores { padding: 5px 10px; font-size: 1.1rem; background: #222; color: white; border: 1px solid var(--neon-blue); }
.input-nombre-row { margin: 10px 0; display: flex; align-items: center; justify-content: center; gap: 10px; }
.color-preview { width: 20px; height: 20px; border-radius: 50%; border: 2px solid white; }
.input-nombre-row input { padding: 8px; background: #333; border: 1px solid #555; color: white; font-family: 'Roboto Mono'; }

/* Botones Neón */
.btn-neon {
    background: transparent; color: var(--neon-blue); border: 2px solid var(--neon-blue);
    padding: 10px 25px; font-size: 1rem; cursor: pointer; transition: 0.3s;
    box-shadow: 0 0 5px var(--neon-blue); margin-top: 15px;
}
.btn-neon:hover:not(:disabled) { background: var(--neon-blue); color: #000; box-shadow: 0 0 20px var(--neon-blue); }
.btn-neon:disabled { opacity: 0.5; cursor: not-allowed; }
.big-btn { font-size: 1.3rem; padding: 15px 40px; border-color: var(--neon-green); color: var(--neon-green); }
.big-btn:hover { background: var(--neon-green); box-shadow: 0 0 20px var(--neon-green); }


/* --- Layout Principal del Juego --- */
#juego-main {
    display: flex;
    height: 100vh;
}

/* Panel Lateral */
.panel-lateral {
    width: 300px;
    background: var(--glass-panel);
    border-right: 2px solid var(--neon-blue);
    padding: 20px;
    display: flex; flex-direction: column;
    box-shadow: 5px 0 20px rgba(0,0,0,0.5);
    z-index: 10;
}
.info-turno h2 { color: var(--neon-gold); text-align: center; margin-top: 0;}
#turno-nombre { color: white; text-shadow: 0 0 5px white; }

.lista-jugadores-scroll {
    flex-grow: 1; overflow-y: auto; margin: 20px 0; border-top: 1px solid #333; border-bottom: 1px solid #333; padding: 10px 0;
}
.jugador-item {
    background: rgba(255,255,255,0.05); border: 1px solid #444;
    padding: 10px; margin-bottom: 8px; border-radius: 8px;
    display: flex; justify-content: space-between; align-items: center;
}
.jugador-item.turno-activo { border-color: var(--neon-gold); box-shadow: 0 0 10px var(--neon-gold) inset; }
.j-nombre { font-weight: bold; display: flex; align-items: center; gap: 5px;}
.j-dinero { color: var(--neon-green); font-family: 'Roboto Mono'; }
#mensaje-sistema {
    min-height: 60px; background: rgba(0,0,0,0.3); padding: 10px; border: 1px solid var(--neon-blue); color: var(--neon-blue); font-size: 0.9rem; text-align: center;
}


/* --- TABLERO CUADRADO (Grid System) --- */
.tablero-wrapper {
    flex-grow: 1;
    display: flex; justify-content: center; align-items: center;
    padding: 20px; background: radial-gradient(circle at center, #1a1a2e 0%, #000 70%);
    overflow: auto; /* Permitir scroll si el tablero es muy grande */
}

#tablero-grid {
    display: grid;
    /* Definimos un grid de 7x7: Corner + 5 propiedades + Corner */
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 4px;
    width: 90vmin; /* El tablero será cuadrado, basado en la dimensión más pequeña de la pantalla */
    height: 90vmin;
    max-width: 800px; max-height: 800px;
    position: relative;
    border: 3px solid var(--neon-blue); box-shadow: 0 0 30px var(--neon-blue); padding: 5px; background: #000;
}

/* El Centro Grande */
.tablero-centro {
    grid-column: 2 / span 5;
    grid-row: 2 / span 5;
    background: rgba(0,0,0,0.5);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    border: 3px solid var(--neon-pink); box-shadow: 0 0 30px var(--neon-pink) inset;
}
.tablero-centro h1 { font-size: 4vmin; color: var(--neon-pink); text-shadow: 0 0 15px var(--neon-pink); margin: 0; }
.tablero-centro p { font-family: 'Orbitron'; letter-spacing: 5px; color: var(--neon-blue); font-size: 1.5vmin; }

/* Estilos de Casilla Genérica */
.casilla {
    background: #111; color: #fff; border: 1px solid #444;
    display: flex; flex-direction: column; position: relative;
    font-size: 0.75rem; overflow: hidden; transition: 0.3s;
}
.casilla:hover { z-index: 5; transform: scale(1.05); box-shadow: 0 0 15px rgba(255,255,255,0.3); }

/* Header de color de la propiedad */
.propiedad-header { height: 25%; border-bottom: 1px solid #222; }
.casilla-content { padding: 5px; text-align: center; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }
.c-nombre { font-weight: bold; }
.c-precio { color: var(--neon-green); }
.c-propietario { font-size: 0.65rem; color: #888; margin-top: 2px; }
.c-renta-base { font-size: 0.6rem; color: #aaa; display: none; } /* Oculto por ahora para limpiar */

/* Casillas de Esquina */
.casilla.esquina { background: #222; justify-content: center; align-items: center; text-align: center; font-weight: bold; border: 2px solid var(--text-color); font-family: 'Orbitron'; }

/* Contenedor de Fichas en la casilla */
.fichas-container {
    position: absolute; bottom: 2px; left: 0; width: 100%;
    display: flex; justify-content: center; flex-wrap: wrap; gap: 2px; pointer-events: none;
}
.ficha-tablero {
    width: 14px; height: 14px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 5px black;
}

/* ================= DADO 3D ================= */
.dice-container { display: flex; flex-direction: column; align-items: center; margin: 20px 0; }
#resultado-dado { font-family: 'Orbitron'; color: var(--neon-gold); font-size: 1.2rem; margin-top: 10px; min-height: 1.4em;}

.scene { width: 80px; height: 80px; perspective: 400px; margin-bottom: 10px; }
.cube { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transform: translateZ(-40px); transition: transform 1s ease-out; }
.cube__face { position: absolute; width: 80px; height: 80px; border: 2px solid var(--neon-blue); line-height: 80px; font-size: 40px; font-weight: bold; color: var(--neon-blue); text-align: center; background: rgba(0, 243, 255, 0.1); box-shadow: 0 0 15px var(--neon-blue) inset; font-family: 'Orbitron'; }
.cube__face--1 { transform: rotateY(  0deg) translateZ(40px); }
.cube__face--2 { transform: rotateY( 90deg) translateZ(40px); }
.cube__face--3 { transform: rotateY(180deg) translateZ(40px); }
.cube__face--4 { transform: rotateY(-90deg) translateZ(40px); }
.cube__face--5 { transform: rotateX( 90deg) translateZ(40px); }
.cube__face--6 { transform: rotateX(-90deg) translateZ(40px); }

/* Animación de giro rápido antes de mostrar el resultado */
.rolling { animation: spinCube 0.6s linear infinite; }
@keyframes spinCube {
    0% { transform: translateZ(-40px) rotateX(0deg) rotateY(0deg); }
    100% { transform: translateZ(-40px) rotateX(360deg) rotateY(360deg); }
}

/* Responsive Básico */
@media (max-width: 768px) {
    #juego-main { flex-direction: column; }
    .panel-lateral { width: 100%; height: 250px; flex-direction: row; flex-wrap: wrap; padding: 10px; border-right: none; border-bottom: 2px solid var(--neon-blue); }
    .info-turno, .dice-container, #mensaje-sistema { flex: 1 1 30%; text-align: center; margin: 5px; }
    .lista-jugadores-scroll { display: none; } /* Ocultar lista detallada en móvil para ahorrar espacio */
    .scene { width: 50px; height: 50px; }
    .cube__face { width: 50px; height: 50px; line-height: 50px; font-size: 25px; transform: translateZ(-25px); }
    .cube__face--1 { transform: rotateY(  0deg) translateZ(25px); }
    .cube__face--2 { transform: rotateY( 90deg) translateZ(25px); }
    .cube__face--3 { transform: rotateY(180deg) translateZ(25px); }
    .cube__face--4 { transform: rotateY(-90deg) translateZ(25px); }
    .cube__face--5 { transform: rotateX( 90deg) translateZ(25px); }
    .cube__face--6 { transform: rotateX(-90deg) translateZ(25px); }
    .tablero-wrapper { padding: 5px; align-items: flex-start; }
     #tablero-grid { width: 98vmin; height: 98vmin; max-width: none; max-height: none; }
}