/* --- Estética general 80s --- */
body {
    color: #ff00ff;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    
    background-color: #000;
    background-image: 
        linear-gradient(rgba(255, 0, 255, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 255, 0.2) 1px, transparent 1px),
        url('../img/room.webp');
        
    background-size: 50px 50px, 50px 50px, cover;
    background-position: center;
    background-repeat: repeat, repeat, no-repeat;
    background-attachment: fixed;
}

/* --- ESTILO DE TÍTULO ARCADE 3D --- */
h1 {
    font-size: 6.5vh; 
    font-family: 'Impact', 'Arial Black', sans-serif; 
    font-style: italic; 
    color: #ffffff; 
    letter-spacing: 8px;
    margin: 2vh 0;
    text-transform: uppercase;
    text-shadow: 
        2px 2px 0px #ff00ff,   
        4px 4px 0px #cc00cc,   
        6px 6px 0px #800080,   
        0 0 20px #00ffff,      
        0 0 40px #00ffff,      
        0 0 80px #00ffff;      
    animation: arcade-title-flicker 4s infinite alternate;
}

/* --- CONTROLES SUPERIORES (SUBIR ROM) --- */
#selector-container {
    margin-bottom: 2vh;
    padding: 1.5vh 3vh;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #00ffff;
    border-radius: 12px;
    box-shadow: 0 0 15px #00ffff;
    z-index: 100;
    animation: border-flicker 2s infinite alternate;
}

.upload-btn {
    display: inline-block;
    background: #ff00ff;
    color: white;
    padding: 1vh 2vh;
    font-size: 1.5vh;
    font-weight: bold;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px #ff00ff;
    transition: 0.3s;
}

.upload-btn:hover {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 20px #00ffff;
}

/* --- MAQUETACIÓN: ÁREA PRINCIPAL --- */
#main-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%; 
    margin: 0;
}

/* --- LAYOUT MAESTRO (FLEXBOX ESCALABLE) --- */
#arcade-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 4vh; /* Separación relativa a la pantalla */
    width: 100%;
    max-width: 1800px; 
    margin-bottom: 2vh; 
}

/* CONTENEDOR MAESTRO DE LA TV */
#tv-container {
    position: relative;
    height: 65vh; 
    aspect-ratio: 1024 / 728;
    flex-shrink: 0; /* Evita que la TV se encoja */
    margin: 0;
}

/* LA IMAGEN TV.PNG (CAPA SUPERIOR) */
#tv-frame {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url('../img/tv.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 50; 
    pointer-events: none; 
}

/* EL JUEGO (CAPA INFERIOR) */
#game {
    position: absolute;
    top: 17.5%;     
    left: 11.2%;  
    width: 59.5%;   
    height: 61.5%;  
    background: #000;
    z-index: 10; 
    border-radius: 20px;
    overflow: hidden;
}

/* --- ESTILO DE LA FIRMA BOTÓN --- */
.signature {
    color: #00ffff;
    font-size: 1.3vh; 
    font-weight: bold;
    text-shadow: 0 0 8px #00ffff; 
    margin-top: 0.5vh;
    margin-bottom: 2vh;
    padding: 0.6vh 1.6vh; 
    background: rgba(0, 0, 0, 0.85); 
    border: 2px solid #00ffff; 
    border-radius: 8px; 
    box-shadow: 0 0 10px #00ffff; 
    z-index: 100;
    text-transform: uppercase;
    letter-spacing: 2px; 
    animation: border-flicker 3s infinite alternate; 
}

.signature:hover {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 20px #00ffff;
    transform: scale(1.05);
}

/* --- ESTILOS DEL PANEL LATERAL DE CONTROLES (DERECHA) --- */
#controls-panel {
    position: relative; 
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #ff00ff;
    border-radius: 12px;
    box-shadow: 0 0 15px #ff00ff;
    padding: 2vh;
    color: #00ffff;
    text-align: left;
    width: 35vh; /* Ancho dinámico con más espacio */
    min-width: 35vh; 
    flex-shrink: 0; /* Indestructible al aplastamiento */
    animation: border-flicker-pink 2s infinite alternate;
}

#controls-panel h2 {
    margin-top: 0;
    text-align: center;
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
    border-bottom: 2px dashed #00ffff;
    padding-bottom: 1vh;
    font-size: 2vh;
}

#controls-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#controls-panel li {
    margin-bottom: 1.2vh;
    font-size: 1.5vh; /* Fuente dinámica */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- TECLAS CONTROLES (ESTILO NEÓN HUECO) --- */
.key {
    background: rgba(0, 0, 0, 0.8);
    color: #00ffff; 
    border: 2px solid #ff00ff; 
    padding: 0.4vh 1vh;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 0 5px #ff00ff, inset 0 0 5px #ff00ff; 
    text-shadow: 0 0 5px #00ffff; 
    text-transform: uppercase;
}

/* --- ESTILOS DEL PANEL DE ACCIONES / INFO (IZQUIERDA) CON EFECTO 3D --- */
#actions-panel-wrapper {
    position: relative; 
    width: 35vh; /* Igualado al derecho */
    min-width: 35vh; /* Límite mínimo para que no rompa el texto */
    flex-shrink: 0; /* Indestructible al aplastamiento */
    perspective: 1000px; 
    z-index: 100;
    transition: height 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
}

#actions-panel-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d; 
}

#actions-panel-inner.flipped {
    transform: rotateY(180deg);
}

.panel-face {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    backface-visibility: hidden; 
    -webkit-backface-visibility: hidden;
    
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #00ffff; 
    border-radius: 12px;
    box-shadow: 0 0 15px #00ffff;
    padding: 2vh;
    box-sizing: border-box;
    color: #ff00ff;
    text-align: center;
    animation: border-flicker 2s infinite alternate; 
}

.panel-face h2 {
    margin-top: 0;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    border-bottom: 2px dashed #ff00ff;
    padding-bottom: 1vh;
    font-size: 2vh;
}

/* Cara Frontal (Botones) */
.panel-face.front {
    z-index: 2;
}

.action-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 1.5vh; 
    margin-top: 2vh;
}

/* Cara Trasera (Información) */
.panel-face.back {
    transform: rotateY(180deg); 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.info-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-text {
    color: #ffffff;
    font-size: 1.3vh;
    text-align: left;
    line-height: 1.5;
    text-shadow: 0 0 3px #ff00ff;
    margin-bottom: 1.5vh;
}

.info-note {
    color: #00ffff;
    font-size: 1.1vh;
    text-align: left;
    font-style: italic;
    margin-bottom: 1.5vh;
}

/* Estilo para los botones */
.action-btn {
    display: block;
    width: 100%;
    background: transparent;
    color: #00ffff;
    padding: 1.2vh 1vh;
    font-size: 1.5vh; /* Fuente dinámica */
    font-weight: bold;
    font-family: 'Courier New', Courier, monospace;
    cursor: pointer;
    border: 2px solid #00ffff;
    border-radius: 6px;
    box-shadow: inset 0 0 5px #00ffff, 0 0 5px #00ffff;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #00ffff;
    color: #000;
    box-shadow: inset 0 0 10px #00ffff, 0 0 20px #00ffff;
    transform: scale(1.05); 
}

/* --- EFECTOS Y ANIMACIONES --- */
@keyframes arcade-title-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 
            2px 2px 0px #ff00ff, 
            4px 4px 0px #cc00cc, 
            6px 6px 0px #800080,
            0 0 20px #00ffff, 
            0 0 40px #00ffff, 
            0 0 80px #00ffff;
        color: #ffffff;
    }
    20%, 24%, 55% {
        text-shadow: none;
        color: #333333; 
    }
}

@keyframes border-flicker {
    0%, 100% { box-shadow: 0 0 15px #00ffff; }
    50% { box-shadow: 0 0 5px #00ffff, inset 0 0 5px #00ffff; }
}

@keyframes border-flicker-pink {
    0%, 100% { box-shadow: 0 0 15px #ff00ff; }
    50% { box-shadow: 0 0 5px #ff00ff, inset 0 0 5px #ff00ff; }
}

@keyframes encendido-crt {
    0% { transform: scale(1, 0.001); filter: brightness(10); background: #ffffff; }
    40% { transform: scale(1, 0.001); filter: brightness(10); background: #ffffff; }
    70% { transform: scale(1, 1); filter: brightness(2); background: #ffffff; }
    100% { transform: scale(1, 1); filter: brightness(1); background: #000000; }
}

.efecto-encendido {
    animation: encendido-crt 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}