:root {
    --bg-main: #050000;
    --c-prime: #ff0000;
    --c-glow: #ff003c;
    --c-accent: #ffaa00;
    --c-ghost: rgba(255, 0, 0, 0.15);
    --c-glass: rgba(10, 0, 0, 0.95);
    --f-main: 'Orbitron', sans-serif;
    --f-code: 'Fira Code', monospace;
    --sidebar-w: 320px;
}

@keyframes k_pulse_red { 0%, 100% { box-shadow: 0 0 5px var(--c-prime); } 50% { box-shadow: 0 0 25px var(--c-glow); } }
@keyframes k_scan_v { 0% { top: -100%; } 100% { top: 100%; } }
@keyframes k_glitch_v { 0% { transform: translate(0); } 20% { transform: translate(-3px, 3px); } 40% { transform: translate(3px, -3px); } 60% { transform: translate(-3px, -3px); } 100% { transform: translate(0); } }
@keyframes k_float_y { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes k_border_draw { 0% { width: 0; height: 0; } 50% { width: 100%; height: 0; } 100% { width: 100%; height: 100%; } }
@keyframes k_shiver { 0% { opacity: 1; } 1% { opacity: 0.5; } 2% { opacity: 1; } }
@keyframes k_hue_rotate { 100% { filter: hue-rotate(30deg); } }
@keyframes k_data_flow { 0% { background-position: 0 0; } 100% { background-position: 40px 40px; } }
@keyframes k_text_reveal { from { width: 0; } to { width: 100%; } }
@keyframes k_terminal_blink { 50% { opacity: 0; } }
@keyframes k_portal_open { from { opacity: 0; transform: scale(0.8) rotateX(45deg); } to { opacity: 1; transform: scale(1) rotateX(0); } }
@keyframes k_progress_run { 0% { background-position: 0% 50%; } 100% { background-position: 100% 50%; } }
@keyframes k_skew_load { 0% { transform: skewX(-20deg); opacity: 0; } 100% { transform: skewX(0); opacity: 1; } }
@keyframes k_vortex { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes k_noise { 0% { transform: translate(0,0); } 10% { transform: translate(-1%,-1%); } 20% { transform: translate(1%,1%); } 100% { transform: translate(0,0); } }
@keyframes k_glow_warp { 0% { border-color: var(--c-prime); } 50% { border-color: var(--c-accent); } 100% { border-color: var(--c-prime); } }
@keyframes k_scale_up { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes k_blur_in { from { filter: blur(15px); } to { filter: blur(0); } }
@keyframes k_energy_surge { 0% { opacity: 0.2; } 50% { opacity: 0.6; } 100% { opacity: 0.2; } }
@keyframes k_bracket_expand { 0% { letter-spacing: -10px; opacity: 0; } 100% { letter-spacing: 5px; opacity: 1; } }

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-main);
    color: #fff;
    font-family: var(--f-main);
    height: 100vh;
    width: 100vw;
    display: flex;
    overflow: hidden;
    position: relative;
    animation: k_blur_in 1s ease-out;
}

.vortex-background {
    position: fixed; inset: -50%;
    background: radial-gradient(circle, #2a0000 0%, #000 70%);
    animation: k_vortex 30s linear infinite;
    z-index: -2;
}

.data-stream-overlay {
    position: fixed; inset: 0;
    background-image: linear-gradient(rgba(255, 0, 0, 0.05) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: k_data_flow 20s linear infinite;
    z-index: -1;
}

.btn-toggle {
    position: fixed; top: 15px; left: 15px; z-index: 9999;
    background: var(--c-prime);
    color: #000;
    border: none;
    padding: 12px 24px;
    font-family: var(--f-code);
    font-weight: 900;
    font-size: 0.85rem;
    cursor: pointer;
    clip-path: polygon(0 0, 100% 0, 100% 75%, 85% 100%, 0 100%);
    box-shadow: 0 0 15px var(--c-glow);
    transition: 0.3s;
}

.panel-lateral {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: var(--sidebar-w);
    background: var(--c-glass);
    backdrop-filter: blur(20px);
    border-right: 2px solid var(--c-prime);
    display: flex; flex-direction: column;
    padding-top: 80px; z-index: 5000;
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.panel-lateral.oculto { transform: translateX(-100%); }

.stats-realtime {
    margin: 10px 20px; padding: 12px;
    background: #000; border: 1px solid var(--c-prime);
    font-family: var(--f-code); font-size: 0.75rem; color: var(--c-accent);
}

.selector-archivos { flex: 1; overflow-y: auto; padding: 10px 0; }
.selector-archivos li {
    padding: 14px 25px; font-size: 0.85rem; color: #666;
    text-transform: uppercase; transition: 0.2s;
    border-bottom: 1px solid rgba(255, 0, 0, 0.05);
}

.selector-archivos li:hover { color: #fff; background: rgba(255, 0, 0, 0.1); padding-left: 35px; }
.selector-archivos li.activo { background: var(--c-prime); color: #000; font-weight: 900; padding-left: 35px; border-left: 8px solid var(--c-accent); }

.terminal-mini {
    margin: 15px; height: 100px; padding: 10px;
    background: #000; border: 1px solid var(--c-prime);
    font-family: var(--f-code); font-size: 0.7rem; color: var(--c-accent);
}

.escenario-principal {
    flex: 1; height: 100vh; width: 100vw;
    display: flex; justify-content: center; align-items: center;
    transition: margin-left 0.5s ease;
}

#portal-display { width: 95%; max-width: 1000px; height: 75%; display: flex; flex-direction: column; position: relative; }

.marco-visor {
    flex: 1; background: rgba(15, 0, 0, 0.8);
    border: 2px solid rgba(255, 0, 0, 0.2);
    position: relative; display: flex; justify-content: center; align-items: center;
    clip-path: polygon(25px 0, 100% 0, 100% calc(100% - 25px), calc(100% - 25px) 100%, 0 100%, 0 25px);
}

.marco-visor.activo { border-color: var(--c-prime); animation: k_pulse_red 4s infinite, k_shiver 5s infinite; }

.esquina-tech { position: absolute; width: 40px; height: 40px; border: 3px solid var(--c-prime); animation: k_glow_warp 3s infinite; }
.t-l { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.t-r { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
.b-l { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
.b-r { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }

.contenido-archivo h2 {
    font-size: clamp(1.4rem, 6vw, 2.8rem);
    text-shadow: 4px 4px 0px #2a0000;
    animation: k_bracket_expand 1s forwards;
}

.visualizador-datos { height: 40px; display: flex; align-items: flex-end; gap: 4px; margin: 30px 0; }
.onda-seno div { width: 8px; background: var(--c-accent); animation: k_float_y 0.8s infinite alternate; }

.boton-ignicion {
    padding: 15px 45px; border: 2px solid var(--c-prime);
    color: var(--c-prime); font-weight: 900; letter-spacing: 4px;
    text-decoration: none; transition: 0.3s;
    font-size: clamp(0.7rem, 2vw, 1.1rem);
    animation: k_pulse_red 2s infinite;
}

.boton-ignicion:hover { background: var(--c-prime); color: #000; box-shadow: 0 0 30px var(--c-prime); }

.barra-progreso-global { position: absolute; bottom: -30px; width: 100%; height: 4px; background: #111; }
.progreso-segmentado { height: 100%; background: var(--c-accent); width: 0; }

.pie-sistema {
    position: fixed; bottom: 0; left: 0; width: 100%;
    height: 45px; background: #000; border-top: 1px solid var(--c-prime);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 25px; font-family: var(--f-code); font-size: 0.7rem; z-index: 6000;
}

/* DEVICE SPECIFIC LOGIC */
.is-mobile :root { --sidebar-w: 100%; }
.is-mobile .panel-lateral { border-right: none; }
.is-mobile .terminal-mini, .is-mobile .visualizador-datos { display: none; }
.is-mobile .escenario-principal { padding: 80px 10px 60px; }
.is-mobile .marco-visor { padding: 15px; }

.is-tablet #portal-display { width: 90%; height: 60%; }

.is-desktop .panel-lateral:not(.oculto) + .escenario-principal { margin-left: var(--sidebar-w); }

@media (max-width: 1024px) {
    .panel-lateral { width: 100%; }
    .pie-sistema { flex-direction: column; height: 60px; padding: 5px; justify-content: center; }
}

@media (max-height: 500px) {
    .contenido-archivo h2 { font-size: 1.2rem; }
    .terminal-mini { display: none; }
}


/* =========================================
   NUEVOS BOTONES (GUÍA Y VISOR)
   ========================================= */

/* Animación de pulso para el color de acento (Naranja/Dorado) */
@keyframes k_pulse_accent { 
    0%, 100% { box-shadow: 0 0 5px var(--c-accent); } 
    50% { box-shadow: 0 0 20px rgba(255, 170, 0, 0.6); } 
}

/* Efecto de barrido brillante en hover */
@keyframes k_sweep_light {
    0% { transform: translateX(-100%) skewX(-15deg); }
    100% { transform: translateX(200%) skewX(-15deg); }
}

/* 1. Botón de Guía (Destaca en color Acento) */
.btn-guia-estilo {
    border-color: var(--c-accent);
    color: var(--c-accent);
    animation: k_pulse_accent 3s infinite;
    background: rgba(255, 170, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.btn-guia-estilo:hover {
    background: var(--c-accent);
    color: #000;
    box-shadow: 0 0 25px var(--c-accent);
    transform: scale(1.05); /* Efecto de crecimiento */
}

/* Brillo que cruza el botón de Guía al pasar el mouse */
.btn-guia-estilo::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 30%; height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-100%) skewX(-15deg);
    transition: 0s;
}

.btn-guia-estilo:hover::after {
    animation: k_sweep_light 0.6s ease-out;
}

/* 2. Botones Pequeños del Visor (Copiar Link y Cerrar) */
.btn-accion-visor {
    background: rgba(0, 0, 0, 0.9) !important;
    padding: 8px 18px;
    font-size: 0.75rem;
    font-family: var(--f-code);
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 2px;
    position: relative;
}

/* Copiar Link (Acento) */
.btn-copiar-estilo {
    border: 1px solid var(--c-accent);
    color: var(--c-accent);
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.2);
}

.btn-copiar-estilo:hover {
    background: var(--c-accent) !important;
    color: #000;
    box-shadow: 0 0 20px var(--c-accent);
    animation: k_glitch_v 0.3s ease; /* Reutiliza tu animación de glitch */
}

/* Cerrar Conexión (Rojo) */
.btn-cerrar-estilo {
    border: 1px solid var(--c-prime);
    color: var(--c-prime);
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.2);
}

.btn-cerrar-estilo:hover {
    background: var(--c-prime) !important;
    color: #000;
    box-shadow: 0 0 20px var(--c-prime);
    animation: k_glitch_v 0.3s ease;
}