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

:root {
    --bg-color: #1a1a1a;
    --panel-bg: #2d2d2d;
    --text-color: #f0f0f0;
    --accent: #4da6ff;
    --accent-hover: #338cdb;
    --danger: #ff4d4d;
    --success: #4dffa6;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Sistema de Pantallas */
.screen {
    display: none;
    width: 100%;
    height: 100vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* LOBBY */
.lobby-container {
    background-color: var(--panel-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 500px;
    margin: auto;
    text-align: center;
}

.lobby-container h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.form-group {
    margin: 1.5rem 0;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #444;
    border-radius: 6px;
    background: #111;
    color: white;
}

.color-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.selected {
    border-color: white;
    box-shadow: 0 0 15px currentColor;
}

.blue { background-color: #3498db; color: #3498db; }
.red { background-color: #e74c3c; color: #e74c3c; }
.green { background-color: #2ecc71; color: #2ecc71; }
.yellow { background-color: #f1c40f; color: #f1c40f; }

.main-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    transition: background-color 0.3s;
}

.main-btn:hover:not(:disabled) {
    background-color: var(--accent-hover);
}

.main-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

#players-list {
    margin-top: 2rem;
    text-align: left;
    background: #1a1a1a;
    padding: 1rem;
    border-radius: 8px;
}

#ul-players {
    list-style: none;
    margin-top: 1rem;
}

#ul-players li {
    padding: 0.5rem;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* ESTILOS DEL JUEGO */
.top-bar {
    background-color: var(--panel-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 10;
}

#turn-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
}

.boards-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

.board {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.5s;
    background-size: 100% 100%; /* Forzar para que el mapeo sea exacto */
    background-position: center;
    background-repeat: no-repeat;
    background-color: #000;
}

#board-main { background-image: url('assets/tablero_principal.jpg'); }
#board-factory { background-image: url('assets/fabrica.jpg'); }
#board-robo { background-image: url('assets/fabrica-robo.jpg'); }
#board-repuesto { background-image: url('assets/fabrica-repuesto.jpg'); }
#board-cambiar { background-image: url('assets/fabrica-cambiar_posicion.jpg'); }


.factory-paths {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.path-row {
    position: static;
}

.path-label {
    display: none; 
}

@keyframes pulseLime {
    0% { transform: scale(1); box-shadow: 0 0 10px lime; background-color: rgba(0, 255, 0, 0.4); border-color: lime; }
    50% { transform: scale(1.3); box-shadow: 0 0 25px lime; background-color: rgba(0, 255, 0, 0.8); border-color: white; }
    100% { transform: scale(1); box-shadow: 0 0 10px lime; background-color: rgba(0, 255, 0, 0.4); border-color: lime; }
}

.valid-move {
    animation: pulseLime 1s infinite;
    z-index: 50; /* Por si solapa */
}

#player-hud {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 25%;
    max-width: 300px;
    z-index: 100;
}

.squares-container {
    display: block;
    position: static;
}

.square {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: transparent;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 20;
    transition: border-color 0.2s, background 0.2s;
}

.square:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.player-token {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
    position: absolute;
    z-index: 10;
    transition: all 0.3s ease;
}

.board.hidden {
    display: none !important;
    pointer-events: none;
}

.board.active {
    display: block;
    pointer-events: all;
}

.board-title {
    position: absolute;
    top: 20px;
    background: rgba(0,0,0,0.8);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    letter-spacing: 2px;
    border: 1px solid var(--accent);
}

.controls-bar {
    background-color: var(--panel-bg);
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.3);
    z-index: 10;
}

#roll-dice-btn {
    width: auto;
}

#dice-result {
    font-size: 2rem;
    font-weight: bold;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    border-radius: 8px;
    border: 2px solid #555;
}

@keyframes pulse-gold {
    0% { box-shadow: 0 0 5px gold; transform: scale(1); }
    50% { box-shadow: 0 0 25px gold; transform: scale(1.2); }
    100% { box-shadow: 0 0 5px gold; transform: scale(1); }
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 5px red; transform: scale(1); border: 2px solid red; }
    50% { box-shadow: 0 0 30px red; transform: scale(1.3); border: 4px solid white; }
    100% { box-shadow: 0 0 5px red; transform: scale(1); border: 2px solid red; }
}
