/* Aerosol Lens: dark map, data-first UI. */

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  background: #0b0e14;
  color: #e6e9ef;
}

#map {
  position: absolute;
  inset: 0;
}

.panel {
  position: absolute;
  background: rgba(13, 17, 23, 0.88);
  border: 1px solid #2a3340;
  border-radius: 10px;
  padding: 10px 12px;
  backdrop-filter: blur(6px);
  z-index: 10;
}

#mode-toggle { top: 12px; left: 12px; display: flex; gap: 6px; }
#mode-toggle button {
  background: #1c2330;
  color: #cfd6e2;
  border: 1px solid #2a3340;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
#mode-toggle button.active { background: #2f6fed; color: #fff; border-color: #2f6fed; }

#basemap-select {
  top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(13, 17, 23, 0.88); color: #cfd6e2;
  border: 1px solid #2a3340; border-radius: 10px;
  padding: 6px 8px; cursor: pointer; z-index: 10;
  position: absolute;
}

#legend { left: 12px; bottom: 76px; width: 240px; }
#legend-title { font-weight: 600; margin-bottom: 6px; }
#legend-bar { height: 12px; border-radius: 3px; background: #333; }
#legend-labels { display: flex; justify-content: space-between; font-size: 11px; color: #9aa4b2; margin-top: 4px; }
#legend-meta { font-size: 11px; color: #9aa4b2; margin-top: 4px; }
#legend-guideline { font-size: 11px; color: #ffb86b; margin-top: 4px; }

/* Settings (gear) */
#settings-btn {
  top: 12px; right: 52px;
  font-size: 16px; padding: 6px 10px; cursor: pointer;
  color: #cfd6e2;
}
#settings { top: 52px; right: 12px; width: 280px; display: flex; flex-direction: column; gap: 8px; }
#settings.hidden { display: none; }
.settings-head { display: flex; justify-content: space-between; align-items: center; }
.settings-head button { background: none; border: none; color: #9aa4b2; cursor: pointer; font-size: 14px; }
#settings label { font-size: 12px; color: #9aa4b2; }
#settings-key {
  background: #1c2330; border: 1px solid #2a3340; border-radius: 6px;
  color: #e6e9ef; padding: 8px; width: 100%; box-sizing: border-box;
}
.settings-row { display: flex; gap: 6px; }
.settings-row button {
  background: #2f6fed; color: #fff; border: none; border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
}
#settings-clear { background: #3a4456 !important; }
.settings-note { font-size: 11px; color: #9aa4b2; margin: 0; line-height: 1.5; }
.settings-note a { color: #7aa2f7; }

/* Error banner: plain-language backend errors */
#error-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  max-width: min(560px, 90vw);
  background: rgba(80, 20, 20, 0.94); border: 1px solid #a03a3a;
  color: #ffd9d9; border-radius: 8px; padding: 10px 14px;
  font-size: 13px; z-index: 30;
}
#error-banner.hidden { display: none; }

/* Loading overlay */
#loading {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(13, 17, 23, 0.92); border: 1px solid #2a3340;
  border-radius: 10px; padding: 14px 18px; z-index: 30; font-size: 14px;
}
#loading.hidden { display: none; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid #2a3340; border-top-color: #2f6fed;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#timebar {
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, 80vw);
}
#time-slider { flex: 1; }
#play-btn {
  background: #2f6fed;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
#time-label { font-size: 12px; color: #9aa4b2; white-space: nowrap; }

#chat { right: 12px; bottom: 12px; width: 340px; display: flex; flex-direction: column; gap: 8px; }
#chat-log { max-height: 180px; overflow-y: auto; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
#chat-form { display: flex; gap: 6px; }
#chat-input {
  flex: 1;
  background: #1c2330;
  border: 1px solid #2a3340;
  border-radius: 6px;
  color: #e6e9ef;
  padding: 8px;
}
#chat-form button {
  background: #2f6fed;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}
#chat-caption { font-size: 12px; color: #9aa4b2; font-style: italic; }
