:root { 
    --p1-color: #00f2ff; 
    --p2-color: #ffaa00; 
    --red: #ff3131; 
    --bg: #05080a; 
}

body { 
    background: var(--bg); 
    color: #fff; 
    font-family: 'Courier New', monospace; 
    margin: 0; 
    padding: 0;
    overflow: hidden; 
    height: 100vh;
    width: 100vw;
}

/* CONTENEDOR PRINCIPAL */
.main-wrapper { 
    display: flex;
    flex-direction: column;
    height: 100vh; 
    padding: 10px; 
    box-sizing: border-box;
    gap: 8px;
}

/* HEADER COMPACTO */
.compact-header { 
    height: 30px; /* Altura fija para el header */
    padding: 0 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Evita que el header se aplaste */
}

/* ÁREA DE JUEGO */
.dual-screen { 
    display: flex; 
    gap: 10px; 
    flex-grow: 1; /* Ocupa todo el espacio restante */
    min-height: 0; /* TRUCO CLAVE: Permite que el contenido interno se encoja */
}

.player-section { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.01);
    min-height: 0; /* Permite que la sección se encoja */
}

#board-JUGADOR-1-parent { border: 2px solid var(--p1-color); }
#board-JUGADOR-2-parent { border: 2px solid var(--p2-color); }

.player-header { 
    text-align: center; 
    font-weight: bold; 
    padding: 4px; 
    font-size: 0.85rem; 
    text-transform: uppercase;
    flex-shrink: 0;
}

.p1-header { background: var(--p1-color); color: #000; }
.p2-header { background: var(--p2-color); color: #000; }

/* GRID AUTO-AJUSTABLE */
.grid-terminal { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    grid-template-rows: repeat(4, 1fr); 
    gap: 6px; 
    padding: 8px; 
    height: 100%; /* Ocupa el 100% de la sección del jugador */
    box-sizing: border-box;
    min-height: 0; /* Permite que el grid se adapte al tamaño del monitor */
}

.char-card { 
    background: rgba(0, 0, 0, 0.5); 
    border: 1px solid rgba(255,255,255,0.05);
    padding: 4px; 
    display: flex; 
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    border-radius: 4px;
    overflow: hidden; /* Evita que el contenido se salga si el monitor es chico */
}

.img-container {
    width: 100%;
    height: 75%; /* Reducimos un poco para dar aire al nombre en monitores chicos */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.img-container img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.name { 
    font-size: 0.65rem; /* Fuente más pequeña para seguridad */
    font-weight: bold; 
    color: rgba(255,255,255,0.9);
    text-transform: uppercase;
    text-align: center;
    width: 100%;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Pone "..." si el nombre es muy largo */
}

/* ESTADOS */
.char-card.eliminated { opacity: 0.08; filter: grayscale(1); }
.char-card.eliminated::after {
    content: "X";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: var(--red);
    opacity: 0.4;
}

/* OVERLAY VICTORIA */
#victory-overlay { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); 
    z-index: 5000; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    text-align: center;
}

.blink { animation: b 1.5s infinite; }
@keyframes b { 50% { opacity: 0; } }

.scanline { 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.1) 50%);
    z-index: 6000;
    background-size: 100% 3px;
    pointer-events: none;
    opacity: 0.1;
}
