/* ==========================================================================
   EL ALTILLO 8-BITS — CRT & VINTAGE TV MONITOR STYLES
   ========================================================================== */

/* Contenedor del Mueble TV / Monitor Vintage */
.tv-cabinet {
    position: relative;
    background: #3e2723;
    border: 8px solid #27160c;
    border-radius: 16px;
    box-shadow: 
        inset 0 0 15px rgba(0, 0, 0, 0.8),
        0 10px 25px rgba(0, 0, 0, 0.7),
        0 0 0 4px #5d4037;
    padding: 18px 22px 22px 22px;
    margin: 0 auto;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: 
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0px, rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 4px),
        linear-gradient(to bottom, #4e342e 0%, #3e2723 100%);
}

.tv-header-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 4px 10px;
    background: #1c100b;
    border-radius: 4px;
    border: 2px solid #5d4037;
    font-size: 10px;
    color: #ffd54f;
    text-shadow: 1px 1px #000;
}

.tv-brand {
    font-weight: bold;
    letter-spacing: 1px;
    color: #ffca28;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tv-system-badge {
    background: #e65100;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    text-transform: uppercase;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.4);
}

/* Marco exterior de la pantalla CRT */
.crt-bezel {
    position: relative;
    background: #1a1a1a;
    border-radius: 24px;
    padding: 14px;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.9),
        inset 0 0 5px rgba(255, 255, 255, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.6);
    border: 4px solid #111;
    width: 100%;
    box-sizing: border-box;
}

/* Área activa de la pantalla */
.crt-screen-wrapper {
    position: relative;
    background: #000;
    border-radius: 18px;
    overflow: hidden;
    width: 100%;
    min-height: 440px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.95);
}

/* Capa de scanlines y efecto tubo */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    border-radius: 18px;
    transition: opacity 0.3s ease;
}

.crt-active .crt-overlay {
    background: 
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.4) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 4px 100%;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7);
}

/* Reflejo de cristal curvado CRT */
.crt-glass-reflection {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 51;
    border-radius: 18px;
}

/* Contenedor del elemento EmulatorJS */
#emulator-container {
    width: 100%;
    height: 100%;
    min-height: 440px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

#emulator-container iframe,
#emulator-container canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

/* Pantalla de espera / standby del CRT cuando no hay juego */
.crt-standby-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #4caf50;
    font-family: 'pressstart2p', monospace;
    padding: 20px;
    gap: 15px;
    background: radial-gradient(circle, #051405 0%, #000000 90%);
    width: 100%;
    height: 440px;
}

.crt-standby-logo {
    font-size: 16px;
    color: #76ff03;
    text-shadow: 0 0 8px rgba(118, 255, 3, 0.8);
    letter-spacing: 2px;
}

.crt-standby-msg {
    font-size: 10px;
    color: #aed581;
    line-height: 1.8;
}

/* Barra de Controles Inferiores de la TV */
.tv-controls-bar {
    width: 100%;
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #27160c;
    border: 3px solid #1a0e07;
    border-radius: 8px;
    padding: 8px 14px;
    box-sizing: border-box;
}

.tv-speakers-grill {
    display: flex;
    gap: 4px;
}

.tv-speaker-slot {
    width: 4px;
    height: 24px;
    background: #110904;
    border-radius: 2px;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.1);
}

.tv-buttons-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botón rotativo / pulsador de TV */
.tv-knob-btn {
    background: linear-gradient(145deg, #444, #222);
    border: 2px solid #111;
    border-radius: 4px;
    color: #ddd;
    font-family: 'pressstart2p', monospace;
    font-size: 9px;
    padding: 6px 10px;
    cursor: pointer;
    box-shadow: 0 3px 0 #111;
    transition: all 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tv-knob-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #111;
}

.tv-knob-btn.active {
    background: linear-gradient(145deg, #2e7d32, #1b5e20);
    color: #fff;
    border-color: #0d3810;
}

/* Led indicador de encendido */
.tv-power-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    color: #bbb;
}

.power-led {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff1744;
    box-shadow: 0 0 8px #ff1744;
    border: 1px solid #b71c1c;
    transition: all 0.3s ease;
}

.power-led.on {
    background: #00e676;
    box-shadow: 0 0 10px #00e676;
    border-color: #00b0ff;
}

.power-led.saving {
    background: #ffea00;
    box-shadow: 0 0 12px #ffea00;
    animation: blink-fast 0.3s infinite;
}

@keyframes blink-fast {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* Responsividad del CRT */
@media (max-width: 768px) {
    .tv-cabinet {
        padding: 10px;
        max-width: 100%;
    }
    
    .crt-screen-wrapper,
    .crt-standby-screen {
        min-height: 300px;
    }
    
    .tv-controls-bar {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
}
