:root {
    --rojo-neon: #ff003c;
    --rojo-oscuro: #8b0000;
    --fondo-lab: #0a0b10;
    --texto: #f2f2f2;
}

body {
    margin: 0;
    background-color: var(--fondo-lab);
    color: var(--texto);
    font-family: 'VT323', monospace;
    text-align: center;
    overflow: hidden;
    user-select: none; 
    -webkit-tap-highlight-color: transparent;
    height: 100vh; /* Obliga a usar solo el alto de la pantalla */
    display: flex;
    flex-direction: column;
}

/* Efectos CRT */
.crt-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle, rgba(255,0,0,0.05) 0%, rgba(0,0,0,0.8) 100%);
    pointer-events: none; z-index: 998;
}
.scanlines {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    pointer-events: none; z-index: 999;
}

.oculto { display: none !important; }

/* Modales */
.modal {
    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: 1000;
}
.lab-box {
    border: 2px solid var(--rojo-oscuro);
    background: rgba(20, 0, 0, 0.8);
    box-shadow: 0 0 15px var(--rojo-oscuro);
    padding: 15px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-sizing: border-box;
}
.lab-box input {
    width: 90%; padding: 10px; font-size: 1.5rem;
    font-family: 'VT323', monospace; text-align: center;
    background: #000; border: 1px solid var(--rojo-neon); color: var(--rojo-neon);
    margin-bottom: 15px; outline: none;
}

/* Contenedor Principal (Para que no se descuadre) */
#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Reparte el espacio */
    padding: 10px 0;
    box-sizing: border-box;
}

/* Cabecera y Stats */
.lab-header { padding: 0 10px; }
.id-placa { font-size: 1rem; color: #777; letter-spacing: 2px; }
.neon-text {
    font-size: 2rem; margin: 5px 0; /* Letra un poco más pequeña */
    color: #fff; text-shadow: 0 0 5px #fff, 0 0 15px var(--rojo-neon);
}
.stats-bar {
    display: flex; justify-content: space-around;
    background: #111; border: 1px solid #333; border-radius: 5px; padding: 5px;
    font-size: 1.2rem;
}

/* LA CRIATURA */
main {
    flex-grow: 1; /* Ocupa el espacio libre en medio */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Evita que crezca y empuje */
}

#criatura-wrapper {
    position: relative;
    height: 35vh; /* Altura relativa al móvil para que nunca se salga */
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    filter: drop-shadow(0 0 15px rgba(255, 0, 60, 0.3));
}
#criatura-base, #criatura-respirando {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%; object-fit: contain;
}
#criatura-respirando {
    animation: respiracion-organica 3s infinite alternate ease-in-out;
}
@keyframes respiracion-organica { 0% { opacity: 0; } 100% { opacity: 1; } }

/* Chat IA */
#chat-box {
    margin-top: 10px; width: 90%; font-size: 1.1rem; min-height: 40px;
    color: var(--texto); display: flex; align-items: center; justify-content: center;
    padding: 10px;
}

/* Botones y Controles (Más compactos) */
.controles {
    display: flex; justify-content: center; gap: 5px; padding: 5px; flex-wrap: nowrap;
}
.btn-arcade {
    background: linear-gradient(180deg, #333 0%, #111 100%);
    border: 2px solid var(--rojo-oscuro); border-radius: 8px;
    color: white; padding: 10px 5px; font-family: 'VT323', monospace;
    font-size: 1.1rem; cursor: pointer; box-shadow: 0 3px 0 #000;
    flex: 1; /* Reparte el ancho entre los 3 botones equitativamente */
    max-width: 120px;
}
.btn-arcade:active { transform: translateY(3px); box-shadow: 0 0 0 #000; }

/* Panel de Comunicación */
.comunicacion-panel {
    display: flex; justify-content: center; align-items: center; gap: 5px; padding: 5px 10px 15px 10px;
}
#input-chat {
    flex-grow: 1; background: #000; border: 1px solid #555; border-radius: 5px;
    color: var(--rojo-neon); font-family: 'VT323', monospace; font-size: 1.2rem;
    padding: 8px; outline: none;
}
.btn-hablar {
    background: #222; border: 1px solid #555; border-radius: 50%; color: white;
    font-size: 1.2rem; width: 45px; height: 45px; flex-shrink: 0; /* Para que no se aplaste */
}
.grabando { background: var(--rojo-neon) !important; animation: pulso-micro 1s infinite alternate; }
@keyframes pulso-micro {
    0% { transform: scale(1); box-shadow: 0 0 5px var(--rojo-neon); }
    100% { transform: scale(1.1); box-shadow: 0 0 15px var(--rojo-neon); }
}

/* Botón Bautizar */
#btn-guardar-nombre {
    background: linear-gradient(180deg, var(--rojo-oscuro) 0%, #222 100%);
    border: 2px solid var(--rojo-neon); border-radius: 8px; color: white;
    padding: 10px; font-family: 'VT323', monospace; font-size: 1.3rem;
    width: 90%; margin-top: 10px; box-shadow: 0 4px 0 #000;
}