* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0c1118;
  color: #e8edf3;
}

#map { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }

#loading {
  position: absolute;
  inset: 0;
  background: rgba(12, 17, 24, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.4s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: #4ea1ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { margin-top: 16px; color: #8a9aae; font-size: 14px; }

#controls {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 460px;
  max-width: calc(100% - 32px);
  background: rgba(20, 26, 36, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  z-index: 10;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.controls-header strong { color: #fff; font-size: 14px; }
.meta { color: #6f7e92; font-size: 11px; }

.time-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
#play-btn {
  width: 36px; height: 36px;
  background: #4ea1ff;
  border: none; border-radius: 50%;
  color: white; cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
#play-btn:hover { background: #66b2ff; }
#play-btn:active { transform: scale(0.95); }
#time-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
}
#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: #4ea1ff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(78,161,255,0.5);
}
#time-label {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: #b9c4d4;
  min-width: 50px;
  text-align: right;
}

.speed-row, .layers-row, .style-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.speed-row label, .layers-row label, .style-row > label { color: #8a9aae; }
.speed-btn, .style-btn {
  background: rgba(255,255,255,0.06);
  color: #b9c4d4;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s;
}
.speed-btn:hover, .style-btn:hover { background: rgba(255,255,255,0.1); }
.speed-btn.active, .style-btn.active {
  background: #4ea1ff;
  color: white;
  border-color: #4ea1ff;
}
.layers-row label {
  color: #b9c4d4;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}

#legend { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.06); }
.legend-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  color: #8a9aae;
  margin-bottom: 4px;
}
.legend-label { width: 110px; }
.legend-gradient {
  flex: 1;
  height: 8px;
  border-radius: 2px;
}
.depth-gradient {
  background: linear-gradient(90deg, #bbdefb, #64b5f6, #1e88e5, #1565c0, #0d47a1);
}
.velocity-gradient {
  background: linear-gradient(90deg, #f2eef8, #cbc1de, #9c8dc6, #6a51a3, #3f007d);
}
.legend-min, .legend-max {
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}
.legend-min { text-align: right; }

/* === Painel de Aparencia === */
.tweaks-panel {
  margin-top: 8px;
  padding: 0;
  background: rgba(20, 25, 35, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}
.tweaks-panel summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  color: #b8c5d6;
  user-select: none;
}
.tweaks-panel summary:hover { color: #fff; }
.tweaks-panel[open] summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tweak-group {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.tweak-group:last-child { border-bottom: none; }
.tweak-title {
  font-size: 11px;
  font-weight: 600;
  color: #6f8aa8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.tweak-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #8a9aae;
  margin-bottom: 4px;
}
.tweak-row input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}
.tweak-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px; height: 12px;
  background: #4a90e2;
  border-radius: 50%;
  cursor: pointer;
}
.tweak-val {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: #b8c5d6;
  min-width: 36px;
  text-align: right;
}
.reset-btn {
  width: 100%;
  padding: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #b8c5d6;
  cursor: pointer;
  font-size: 11px;
}
.reset-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
