/* 🏢 EDIFICIO PRINCIPAL — ESTILOS BASE, TESELAS HD Y 3 VISTAS DE COLOR (<= 160 líneas) */
:root {
  --bg-oceano: #090d16;
  --panel-bg: rgba(10, 14, 22, 0.95);
  --panel-borde: rgba(255, 42, 133, 0.35);
  --acento-neon: #ff2a85;
  --acento-cyan: #00f0ff;
  --texto-base: #f1f5f9;
  --escala-mapa: 1;
  --filtro-mapa: invert(0.92) hue-rotate(185deg) brightness(0.96) contrast(1.22) saturate(1.35);
}

html[data-vista="atlas"] {
  --bg-oceano: #2f90b0;
  --panel-bg: rgba(11, 17, 27, 0.95);
  --panel-borde: rgba(0, 240, 255, 0.35);
  --acento-neon: #ff2a85;
  --acento-cyan: #38bdf8;
  --texto-base: #f8fafc;
  --filtro-mapa: none;
}

html[data-vista="satelite"] {
  --bg-oceano: #1c5266;
  --panel-bg: rgba(10, 20, 30, 0.95);
  --panel-borde: rgba(16, 185, 129, 0.4);
  --acento-neon: #10b981;
  --acento-cyan: #38bdf8;
  --texto-base: #ecfeff;
  --filtro-mapa: brightness(0.86) contrast(1.28) saturate(1.48) hue-rotate(-6deg);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg-oceano); color: var(--texto-base);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  user-select: none; -webkit-user-select: none;
}

#edificio-mapa {
  position: relative; width: 100vw; height: 100vh;
  overflow: hidden; background: var(--bg-oceano);
}

#escenario-mapa {
  width: 100%; height: 100%; cursor: grab;
  touch-action: none; position: relative; overflow: hidden;
  contain: layout style paint;
}
#escenario-mapa.arrastrando { cursor: grabbing; }

#lienzo-mapa {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

#capa-terreno {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1; isolation: isolate;
  filter: var(--filtro-mapa);
  transition: filter 0.25s ease;
  overflow: hidden;
}

#canvas-mapa {
  display: block;
  width: 100%; height: 100%;
  pointer-events: none;
}

#capa-regiones-etiquetas, #capa-iconos, #capa-pines {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: hidden;
}
#capa-regiones-etiquetas { z-index: 2; }
#capa-iconos { z-index: 3; }
#capa-pines { z-index: 4; }

.etiqueta-region {
  position: absolute; top: 0; left: 0;
  transform: translate(-50%, -50%);
  padding: 0.32rem 0.78rem; border-radius: 999px;
  background: rgba(9, 12, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff; font-size: 0.76rem; font-weight: 800;
  letter-spacing: 0.09em; text-transform: uppercase;
  pointer-events: auto; cursor: pointer;
  contain: layout style paint;
  transition: border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.etiqueta-region:hover {
  border-color: var(--acento-cyan);
  background: rgba(255, 42, 133, 0.9);
}

/* 🎛️ CONTROLES DEL EDIFICIO (Vistas, Zoom HD y Coordenadas) */
#controles-edificio {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}

.barra-edificio {
  display: flex; align-items: center; gap: 6px;
  padding: 6px; border-radius: 12px;
  background: var(--panel-bg); border: 1px solid var(--panel-borde);
  contain: layout style paint;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.btn-edificio {
  appearance: none; border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06); color: var(--texto-base);
  padding: 7px 11px; border-radius: 8px;
  font-size: 0.78rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn-edificio .btn-icono {
  width: 14px; height: 14px;
  display: block; flex-shrink: 0;
  stroke: currentColor;
}
.btn-edificio:hover { border-color: var(--acento-cyan); background: rgba(0, 240, 255, 0.14); }
.btn-edificio:active { transform: scale(0.96); }
.btn-edificio.activo {
  background: var(--acento-neon); color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.lectura-edificio {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.75rem; font-weight: 700; padding: 4px 8px;
  color: var(--acento-cyan);
}

@media (max-width: 640px) {
  #controles-edificio { right: 10px; bottom: 10px; }
  .btn-edificio { padding: 6px 8px; font-size: 0.72rem; gap: 4px; }
  .btn-edificio .btn-icono { width: 12px; height: 12px; }
}
