:root {
    --negro: #000000;
    --blanco: #ffffff;
    --verde: #00FF00;
    --gris-oscuro: rgba(20, 20, 20, 0.95);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* --- ESTRUCTURA PRINCIPAL (FLEXBOX FIX) --- */
body, html {
    width: 100%; 
    /* Usamos 'dvh' para móviles modernos */
    height: 100dvh; 
    font-family: 'Segoe UI', Roboto, sans-serif;
    background-color: var(--negro);
    overflow: hidden;

    /* LA CLAVE: Columna flexible */
    display: flex;
    flex-direction: column; 
}

/* --- 1. LOADER DE CARGA --- */
#loader {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: var(--negro);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000;
    transition: opacity 0.8s ease, visibility 0.8s;
}
.loader-content { text-align: center; width: 300px; }
.pulse-logo { width: 100px; margin-bottom: 30px; animation: pulse 2s infinite ease-in-out; }
.progress-container { width: 100%; height: 2px; background: rgba(255, 255, 255, 0.1); margin-bottom: 15px; border-radius: 10px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: var(--verde); box-shadow: 0 0 10px var(--verde); transition: width 0.4s ease; }
#loader p { color: var(--verde); font-size: 0.65rem; letter-spacing: 4px; text-transform: uppercase; }
.loader-hidden { opacity: 0; visibility: hidden; }

@keyframes pulse { 
    0% { transform: scale(0.95); opacity: 0.7; } 
    50% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 15px var(--verde)); } 
    100% { transform: scale(0.95); opacity: 0.7; } 
}

/* --- 2. HUD HEADER (BARRA SUPERIOR) --- */
.nodosmall-hud {
    position: relative; 
    width: 100%; 
    height: 70px;
    /* Esto evita que la barra se aplaste */
    flex-shrink: 0; 
    
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px;
    background: var(--gris-oscuro);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--verde);
    z-index: 1000;
}

/* Distribución Flex */
.header-left, .header-right { flex: 1; display: flex; align-items: center; }
.header-right { justify-content: flex-end; gap: 15px; }
.header-center { flex: 2; display: flex; justify-content: center; }

/* Logos */
.logo-img { height: 32px; width: auto; transition: filter 0.3s; }
.logo-link:hover .logo-img { filter: drop-shadow(0 0 8px var(--verde)); }
.mobile-only { display: none; }

/* Buscador */
.search-container { position: relative; width: 100%; max-width: 450px; }
#searchInput { 
    width: 100%; padding: 10px 20px; 
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 25px; 
    color: var(--blanco); 
    text-align: center; 
    transition: all 0.3s;
}
#searchInput:focus { text-align: left; border-color: var(--verde); outline: none; background: rgba(0,0,0,0.5); }

/* Sugerencias (Resultados) */
.suggestions { 
    position: absolute; top: 45px; width: 100%; 
    background: var(--gris-oscuro); 
    border: 1px solid var(--verde); 
    border-radius: 10px; 
    max-height: 250px; overflow-y: auto; 
    z-index: 1100; 
}
.suggestions a { display: block; padding: 12px 20px; color: var(--blanco); text-decoration: none; font-size: 0.85rem; text-align: left;}
.suggestions a:hover { background: var(--verde); color: var(--negro); }

/* Botones y Links */
.nav-links { display: flex; align-items: center; gap: 20px; }
.text-link { color: rgba(255, 255, 255, 0.6); text-decoration: none; font-size: 0.8rem; text-transform: uppercase; }

.icon-btn {
    background: transparent; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--verde); transition: transform 0.2s;
    padding: 5px;
}
.icon-btn img, .icon-btn svg { height: 24px; width: auto; }
.icon-btn:hover { transform: scale(1.1); filter: drop-shadow(0 0 5px var(--verde)); }

.btn-main {
    background: var(--verde); color: var(--negro); padding: 8px 20px;
    border-radius: 5px; text-decoration: none; font-weight: bold; font-size: 0.8rem;
    white-space: nowrap;
}
.btn-main:hover { box-shadow: 0 0 15px var(--verde); transform: scale(1.05); }

/* Tooltips */
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute; top: 120%; right: 0;
    background: var(--gris-oscuro); color: var(--verde);
    padding: 5px 10px; font-size: 0.7rem; border: 1px solid var(--verde);
    white-space: nowrap; pointer-events: none;
}

/* --- 3. VIEWPORT 360 (AQUÍ ESTÁ EL ARREGLO) --- */
.viewport-360 { 
    width: 100%; 
    /* Ocupa todo el espacio restante */
    flex-grow: 1; 
    /* Límite para el iframe absoluto */
    position: relative;
    overflow: hidden;
}

.viewport-360 iframe { 
    /* Obligamos al iframe a llenar el hueco */
    position: absolute; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    border: none; 
    display: block; 
}

/* --- 4. OPTIMIZACIÓN MÓVIL --- */
@media (max-width: 768px) {
    .nodosmall-hud { padding: 0 10px; height: 60px; }
    
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }
    
    .logo-mobile-img { 
        height: 35px; width: auto; 
        max-width: 35px; 
        object-fit: contain;
    }

    .header-left { flex: 0 0 auto; margin-right: 8px; }
    .header-center { flex: 1; margin: 0 5px; }
    .header-right { flex: 0 0 auto; display: flex; gap: 8px; }

    #searchInput { padding: 8px 10px; font-size: 0.8rem; width: 100%; }
    
    .text-link, .btn-main { display: none !important; } 
    
    .nav-links { gap: 10px; }
    .icon-btn { padding: 5px; }
    .icon-btn img, .icon-btn svg { height: 20px; width: 20px; }
    
    [data-tooltip]:hover::after { display: none; }
}

/* --- 5. FIX DEL TECLADO MÓVIL --- */
#searchOverlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: transparent;
    z-index: 999;
    display: none; 
}
#searchOverlay.activo { display: block; }