/* Buenos Aires Topographic Data Landscape — synthwave dashboard */

@font-face {
  font-family: "JetBrainsMono";
  src: local("JetBrains Mono"), local("Menlo"), local("Consolas");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

button {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

html, body, #root {
  height: 100%;
  overflow: hidden;
  background: #0a0e2a;
  color: #E8EFFF;
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-feature-settings: "ss01", "ss02";
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ========================================================
   HUD
   ======================================================== */
.hud {
  position: absolute;
  z-index: 10;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

.hud-top {
  top: 0;
  left: 0;
  right: 380px; /* leave room for side panel */
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.brandline {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  letter-spacing: 0.12em;
  font-size: 11px;
  text-transform: uppercase;
}
.brand-mark {
  font-size: 18px;
  color: #FDC23A;
  text-shadow: 0 0 12px rgba(253, 194, 58, 0.7);
  letter-spacing: -0.2em;
  line-height: 1;
  padding-top: 2px;
}
.brand-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.2;
}
.brand-text {
  color: #E8EFFF;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.brand-subtitle {
  color: #FDC23A;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: none;
  font-style: italic;
  text-shadow: 0 0 8px rgba(253, 194, 58, 0.35);
}
.brand-sub {
  color: #5C7CFF;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.hud-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.pill {
  background: rgba(20, 26, 60, 0.7);
  border: 1px solid rgba(92, 124, 255, 0.35);
  backdrop-filter: blur(8px);
  color: #E8EFFF;
  padding: 7px 12px;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.16em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.pill:hover { border-color: rgba(92, 124, 255, 0.7); }
.pill.active {
  background: rgba(253, 194, 58, 0.15);
  border-color: rgba(253, 194, 58, 0.7);
  color: #FFEB7A;
  box-shadow: 0 0 16px rgba(253, 194, 58, 0.25);
}
.pill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* ========================================================
   Bottom HUD: time scrubber
   ======================================================== */
.hud-bottom {
  bottom: 0;
  left: 0;
  right: 380px;
  padding: 18px 24px 22px;
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.play-btn {
  width: 54px; height: 54px;
  flex-shrink: 0;
  background: rgba(253, 194, 58, 0.12);
  border: 1px solid rgba(253, 194, 58, 0.55);
  color: #FFEB7A;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.15s;
  box-shadow: 0 0 16px rgba(253, 194, 58, 0.18);
}
.play-btn:hover {
  background: rgba(253, 194, 58, 0.22);
  box-shadow: 0 0 24px rgba(253, 194, 58, 0.4);
}

.time-block {
  flex: 1;
  background: rgba(13, 18, 48, 0.78);
  border: 1px solid rgba(92, 124, 255, 0.35);
  backdrop-filter: blur(10px);
  padding: 10px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.time-display {
  display: flex;
  align-items: baseline;
  gap: 16px;
  justify-content: space-between;
}
.time-clock {
  font-size: 32px;
  font-weight: 700;
  color: #FFEB7A;
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(253, 194, 58, 0.45);
  line-height: 1;
}
.time-colon { animation: blink 1.6s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.time-meta {
  display: flex;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.time-period { color: #FF6B9D; font-weight: 700; }
.time-divider { color: #5C7CFF; }
.time-layer { color: #8FB4FF; }

.scrubber {
  position: relative;
}
.scrubber-track {
  position: relative;
  height: 22px;
}
.scrubber-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: rgba(92, 124, 255, 0.3);
  transform: translateY(-50%);
}
.scrubber-fill {
  position: absolute;
  left: 0; top: 50%;
  height: 1.5px;
  background: linear-gradient(90deg, #5C7CFF, #FDC23A);
  transform: translateY(-50%);
  pointer-events: none;
  box-shadow: 0 0 8px rgba(253, 194, 58, 0.4);
}
.scrubber-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  transform: translateX(-50%);
  cursor: pointer;
  display: grid; place-items: center;
}
.scrubber-tick::after {
  content: "";
  width: 1px;
  height: 6px;
  background: rgba(143, 180, 255, 0.4);
  transition: all 0.15s;
}
.scrubber-tick.major::after { height: 12px; background: rgba(143, 180, 255, 0.7); }
.scrubber-tick:hover::after { background: #FFEB7A; height: 14px; }
.scrubber-tick.active::after { background: #FFEB7A; height: 16px; box-shadow: 0 0 8px #FFEB7A; }

.scrubber-thumb {
  position: absolute;
  top: 50%;
  width: 10px; height: 10px;
  background: #FFEB7A;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px #FDC23A, 0 0 24px rgba(253, 194, 58, 0.4);
  pointer-events: none;
}

.scrubber-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 9px;
  color: #5C7CFF;
  letter-spacing: 0.18em;
}

/* ========================================================
   Side panel
   ======================================================== */
.panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  background: rgba(8, 11, 32, 0.88);
  backdrop-filter: blur(14px);
  border-left: 1px solid rgba(92, 124, 255, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 11;
  overflow-y: auto;
  overflow-x: hidden;
}

.panel-header {
  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(92, 124, 255, 0.18);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: #FFEB7A;
}
.panel-bullet {
  width: 8px; height: 8px;
  background: #FDC23A;
  border-radius: 50%;
  box-shadow: 0 0 10px #FDC23A;
}
.panel-sub {
  font-size: 10px;
  color: #5C7CFF;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 6px;
}

.layers {
  padding: 8px 12px;
  overflow: visible;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(92, 124, 255, 0.18);
}

.layer {
  margin-bottom: 6px;
}

.layer-card {
  border: 1px solid transparent;
  background: transparent;
  transition: all 0.12s;
}

.layer-card:hover {
  background: rgba(92, 124, 255, 0.08);
  border-color: rgba(92, 124, 255, 0.2);
}

.layer.active .layer-card {
  background: rgba(253, 194, 58, 0.06);
  border-color: rgba(253, 194, 58, 0.3);
}

.layer-row {
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 24px 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: all 0.12s;
}

.layer-glyph {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 1px solid;
  font-size: 12px;
  transition: all 0.15s;
}
.layer.active .layer-glyph {
  box-shadow: 0 0 8px currentColor;
}
.layer-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.layer-name {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #E8EFFF;
}
.layer.active .layer-name { color: #FFEB7A; }
.layer-bar {
  height: 2px;
  background: rgba(92, 124, 255, 0.2);
  position: relative;
  overflow: hidden;
}
.layer-bar-fill {
  height: 100%;
  transition: width 0.4s ease;
  box-shadow: 0 0 6px currentColor;
}
.layer-short {
  font-size: 9px;
  color: #5C7CFF;
  letter-spacing: 0.16em;
}
.layer-tick {
  font-size: 14px;
  color: #5C7CFF;
}
.layer-tick.on {
  color: #FDC23A;
  text-shadow: 0 0 8px #FDC23A;
}
.layer-real {
  font-size: 8px;
  letter-spacing: 0.18em;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.5);
  padding: 2px 5px;
  border-radius: 2px;
  text-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

.layer-weight-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 128px;
}

.layer-weight-inline input[type=range] {
  width: 90px;
  -webkit-appearance: none;
  height: 2px;
  background: rgba(92, 124, 255, 0.5);
  outline: none;
}

.layer-weight-inline input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #FFEB7A;
  box-shadow: 0 0 8px rgba(253, 194, 58, 0.7);
}

.layer-weight-inline input[type=range]::-moz-range-thumb {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: none;
  background: #FFEB7A;
  box-shadow: 0 0 8px rgba(253, 194, 58, 0.7);
}

.layer-weight {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 10px 44px;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: #8FB4FF;
}
.weight-label { width: 50px; }
.weight-val { width: 32px; text-align: right; color: #FFEB7A; }
.layer-weight input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  height: 2px;
  background: rgba(92, 124, 255, 0.3);
  outline: none;
}
.layer-weight input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px; height: 10px;
  background: #FDC23A;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px #FDC23A;
}
.layer-weight input[type=range]::-moz-range-thumb {
  width: 10px; height: 10px;
  background: #FDC23A;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 8px #FDC23A;
}

/* ========================================================
   Stats / detail
   ======================================================== */
.stats {
  flex: 0 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stats-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #FF6B9D;
  font-weight: 700;
}
.close-btn {
  background: none;
  border: 1px solid rgba(255, 107, 157, 0.4);
  color: #FF6B9D;
  width: 22px; height: 22px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  display: grid; place-items: center;
}
.close-btn:hover { background: rgba(255, 107, 157, 0.15); }

.barrio-detail { display: flex; flex-direction: column; gap: 12px; }
.barrio-name {
  font-size: 22px;
  color: #FFEB7A;
  letter-spacing: 0.02em;
  font-weight: 700;
  text-shadow: 0 0 14px rgba(253, 194, 58, 0.4);
}
.barrio-comuna {
  font-size: 10px;
  color: #5C7CFF;
  letter-spacing: 0.22em;
}
.barrio-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(92, 124, 255, 0.18);
  padding-top: 12px;
}
.barrio-row {
  display: grid;
  grid-template-columns: 18px 1fr 60px 76px;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}
.barrio-row-icon {
  text-shadow: 0 0 6px currentColor;
}
.barrio-row-name {
  color: #E8EFFF;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.barrio-row-bar {
  height: 4px;
  background: rgba(92, 124, 255, 0.18);
  position: relative;
}
.barrio-row-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  transition: width 0.4s ease;
  box-shadow: 0 0 4px currentColor;
}
.barrio-row-val {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: #FFEB7A;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summary-title {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: #5C7CFF;
}
.summary-list {
  display: flex; flex-direction: column; gap: 4px;
}
.summary-row {
  display: grid;
  grid-template-columns: 28px 1fr 72px 30px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(92, 124, 255, 0.08);
}
.rank {
  color: #FDC23A;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.rank-name {
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.rank-bar {
  height: 4px;
  background: rgba(92, 124, 255, 0.18);
  position: relative;
}
.rank-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #5C7CFF, #FDC23A);
  box-shadow: 0 0 6px rgba(253, 194, 58, 0.5);
  transition: width 0.4s ease;
}
.rank-val {
  font-variant-numeric: tabular-nums;
  color: #FFEB7A;
  text-align: right;
}
.summary-row.valley .rank { color: #5C7CFF; }
.summary-row.valley .rank-bar-fill {
  background: linear-gradient(90deg, #2D3460, #5C7CFF);
  box-shadow: 0 0 4px rgba(92, 124, 255, 0.3);
}

.compare-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.compare-toggle {
  background: rgba(20, 26, 60, 0.5);
  border: 1px solid rgba(92, 124, 255, 0.3);
  color: #5C7CFF;
  padding: 5px 10px;
  font: inherit;
  font-size: 9px;
  letter-spacing: 0.18em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.compare-toggle.on {
  background: rgba(255, 107, 157, 0.15);
  border-color: rgba(255, 107, 157, 0.6);
  color: #FF6B9D;
  box-shadow: 0 0 12px rgba(255, 107, 157, 0.25);
}
.compare-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.compare-select {
  flex: 1;
  background: rgba(20, 26, 60, 0.5);
  border: 1px solid rgba(255, 107, 157, 0.4);
  color: #FF6B9D;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 5px 6px;
  outline: none;
  cursor: pointer;
}

.dim { color: #5C7CFF; }

/* ========================================================
   Settings (inline in side panel)
   ======================================================== */
.settings-block {
  border-top: 1px solid rgba(92, 124, 255, 0.18);
  padding: 16px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: #FDC23A;
}
.settings-bullet {
  width: 8px; height: 8px;
  background: #FDC23A;
  border-radius: 50%;
  box-shadow: 0 0 10px #FDC23A;
}
.settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setting {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 10px;
}
.setting-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #5C7CFF;
}
.setting-control { min-width: 0; }

/* Segmented buttons */
.seg {
  display: flex;
  gap: 4px;
  background: rgba(13, 26, 80, 0.5);
  padding: 3px;
  border-radius: 4px;
  border: 1px solid rgba(92, 124, 255, 0.18);
}
.seg-btn {
  flex: 1;
  padding: 6px 4px;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #7A8AC4;
  border-radius: 3px;
  transition: all 120ms ease;
}
.seg-btn:hover { color: #C8D5FF; }
.seg-btn.active {
  background: rgba(253, 194, 58, 0.16);
  color: #FDC23A;
  box-shadow: inset 0 0 0 1px rgba(253, 194, 58, 0.4);
}

/* Slider row */
.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.slider-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: rgba(92, 124, 255, 0.25);
  border-radius: 2px;
  outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px; height: 12px;
  background: #FDC23A;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(253, 194, 58, 0.7);
  cursor: pointer;
}
.slider-row input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  background: #FDC23A;
  border: none;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(253, 194, 58, 0.7);
  cursor: pointer;
}
.slider-val {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #FFEB7A;
  min-width: 32px;
  text-align: right;
}

/* Toggle pills */
.settings-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-top: 4px;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px 5px 6px;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #7A8AC4;
  background: rgba(13, 26, 80, 0.4);
  border: 1px solid rgba(92, 124, 255, 0.18);
  border-radius: 3px;
  transition: all 120ms ease;
}
.toggle:hover { color: #C8D5FF; }
.toggle .toggle-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(122, 138, 196, 0.3);
  transition: all 120ms ease;
}
.toggle.on {
  color: #FDC23A;
  border-color: rgba(253, 194, 58, 0.4);
  background: rgba(253, 194, 58, 0.08);
}
.toggle.on .toggle-pip {
  background: #FDC23A;
  box-shadow: 0 0 6px #FDC23A;
}

.panel-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(92, 124, 255, 0.18);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-line {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 0.16em;
}

/* ========================================================
   Tooltip
   ======================================================== */
.tooltip {
  position: absolute;
  background: rgba(8, 11, 32, 0.95);
  border: 1px solid rgba(253, 194, 58, 0.5);
  padding: 10px 14px;
  z-index: 20;
  pointer-events: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px rgba(253, 194, 58, 0.2);
  min-width: 160px;
}
.tt-name {
  font-size: 13px;
  color: #FFEB7A;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.tt-comuna {
  font-size: 9px;
  color: #5C7CFF;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
}
.tt-rows {
  display: flex; flex-direction: column; gap: 4px;
  border-top: 1px solid rgba(92, 124, 255, 0.2);
  padding-top: 6px;
}
.tt-row {
  display: flex; gap: 10px;
  font-size: 11px;
  align-items: baseline;
}

/* ========================================================
   Responsive — collapse panel on narrow
   ======================================================== */
@media (max-width: 900px) {
  .panel { width: 100%; height: 50vh; top: auto; bottom: 0; border-left: none; border-top: 1px solid rgba(92, 124, 255, 0.25); }
  .hud-top, .hud-bottom { right: 0; }
  .hud-bottom { bottom: 50vh; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(92, 124, 255, 0.05); }
::-webkit-scrollbar-thumb { background: rgba(92, 124, 255, 0.3); }
::-webkit-scrollbar-thumb:hover { background: rgba(253, 194, 58, 0.5); }
