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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--tg-theme-bg-color, #fff);
  color: var(--tg-theme-text-color, #222);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#filters {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  background: var(--tg-theme-secondary-bg-color, #f0f0f0);
  flex-shrink: 0;
}

.chip {
  border: none;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  background: var(--tg-theme-bg-color, #fff);
  color: var(--tg-theme-text-color, #333);
  transition: background 0.2s, color 0.2s;
}

.chip.active {
  background: var(--tg-theme-button-color, #7b2fbe);
  color: var(--tg-theme-button-text-color, #fff);
}

.chip.locked {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--tg-theme-bg-color, #fff);
  color: var(--tg-theme-hint-color, #999);
}

#map {
  flex: 1;
  min-height: 0;
}

#top-panel {
  background: var(--tg-theme-secondary-bg-color, #f5f5f5);
  padding: 10px 14px;
  max-height: 30vh;
  overflow-y: auto;
  flex-shrink: 0;
}

#top-panel h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

#top-list {
  list-style: none;
}

#top-list li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--tg-theme-hint-color, #ccc);
}

#top-list li:last-child {
  border-bottom: none;
}

.kef-badge {
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 13px;
}

#legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--tg-theme-secondary-bg-color, #f0f0f0);
  font-size: 12px;
  flex-shrink: 0;
}

#legend .gradient {
  width: 120px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, rgba(200,180,255,0.25), rgba(80,20,200,0.8));
}
