body, html {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: #111;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Contenedor Dark Minimalista Ultra-Compacto */
#layer-menu-container {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1100;
    width: 210px;
    max-height: calc(100vh - 60px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(38, 44, 49, 0.95); /* Gris pizarra compatible #262c31 */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#layer-menu-container.collapsed {
    transform: translateX(-280px);
    opacity: 0;
}

/* Encabezado Minimalista */
.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.menu-title-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-grow: 1;
}

.header-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    color: #2ca9bc;
}

.header-tool-btn:hover {
    background: rgba(44, 169, 188, 0.2);
    border-color: #2ca9bc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    color: #fff;
}

.close-menu-btn {
    cursor: pointer;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6); /* Más claro */
    transition: all 0.2s;
}

.close-menu-btn:hover { color: #fff; }

/* ... (resto del código) ... */

.master-button {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #ffffff; /* Blanco puro para legibilidad */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.master-button:hover { background: rgba(255, 255, 255, 0.05); }

.master-button:after {
    content: '+';
    font-family: monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5); /* Más claro */
}

.master-layer-group.is-open .master-button:after {
    content: '−';
    color: #2ca9bc; /* Cian del logo */
}

/* Sub-menú Compacto */
.sub-layer-menu {
    display: none;
    padding: 0px 12px 6px 12px;
    background: rgba(0, 0, 0, 0.15);
}

.master-layer-group.is-open .sub-layer-menu { display: block; }

.sub-layer-menu label {
    display: flex;
    align-items: center;
    padding: 3px 0;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8); /* Texto de subcapas más claro */
    font-size: 11px;
    transition: all 0.2s;
}

.sub-layer-menu label:hover { color: #2ca9bc; }

.sub-layer-menu input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border: 1px solid rgba(255,255,255,0.4); /* Borde más visible */
    border-radius: 2px;
    margin-right: 8px;
    cursor: pointer;
    position: relative;
}

.sub-layer-menu input[type="checkbox"]:checked {
    background: #2ca9bc; /* Cian del logo */
    border-color: #2ca9bc;
}

.sub-layer-menu input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 9px;
    left: 1px;
    top: -2px;
}

/* Marcadores "TV STYLE" - Limpios y de alta visibilidad */
.map-data-tooltip {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: white;
    font-weight: 800;
    font-size: 14px; /* Dinámico via JS */
    text-align: center;
    text-shadow: 
        -1.5px -1.5px 0 #000,  
        1.5px -1.5px 0 #000,
        -1.5px 1.5px 0 #000,
        1.5px 1.5px 0 #000,
        0 2px 4px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.map-data-tooltip.cold-value {
    text-shadow: 
        -1.5px -1.5px 0 #fff,  
        1.5px -1.5px 0 #fff,
        -1.5px 1.5px 0 #fff,
        1.5px 1.5px 0 #fff,
        0 2px 4px rgba(0,0,0,0.3);
    color: #000;
}

/* Botón Hamburguesa Dark */
#menu-toggle-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1200;
    width: 36px;
    height: 36px;
    background: #1a1a1a;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    color: white;
    font-size: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#menu-toggle-btn:hover {
    background: #252525;
    border-color: rgba(255,255,255,0.2);
}

#menu-toggle-btn.hidden {
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Grupos Compactos */
/* Leyenda Dinámica Minimalista */
#dynamic-legend-container {
    position: absolute;
    bottom: 30px;
    right: 15px;
    z-index: 1000;
    background: rgba(38, 44, 49, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    display: none; /* Se activa por JS */
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    pointer-events: none;
    color: #fff;
}

.legend-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    margin-bottom: 2px;
}

.legend-bar {
    height: 8px;
    width: 100%;
    border-radius: 4px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: rgba(255,255,255,0.8);
    font-weight: 700;
}

.legend-image {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* Leyenda Dinámica ... */
#dynamic-legend-container {
    /* ... (estilos existentes) ... */
}

/* Timeline Player Moderno */
#timeline-player {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    background: rgba(38, 44, 49, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 8px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    display: none; /* Se activa via JS */
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    color: white;
}

.timeline-btn {
    cursor: pointer;
    font-size: 20px;
    opacity: 0.7;
    transition: 0.2s;
    user-select: none;
    color: #2ca9bc;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.timeline-btn:hover { 
    opacity: 1; 
    background: rgba(44, 169, 188, 0.2);
    transform: scale(1.1); 
}

.timeline-label {
    font-size: 12px;
    font-weight: 600;
    min-width: 140px;
    text-align: center;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.9);
}

@media (max-width: 600px) {
    #layer-menu-container { width: 190px; left: 10px; top: 10px; }
    #menu-toggle-btn { top: 10px; left: 10px; }
}
