:root {
  --bg: var(--tg-theme-bg-color, #1c1c1e);
  --fg: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --card: var(--tg-theme-secondary-bg-color, #2c2c2e);
  --accent: var(--tg-theme-button-color, #ff6a00);
  --accent-fg: var(--tg-theme-button-text-color, #ffffff);
  --event: #ffae00;
  --spot: #4ea8ff;
  --place: #4ea8ff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%; width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

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

#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0));
  color: #fff;
  pointer-events: none;
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

#counter { font-weight: 400; opacity: 0.9; }

#filters, #kinds {
  position: absolute; left: 0; right: 0;
  z-index: 500;
  display: flex; gap: 8px;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
#filters { top: 48px; }
#kinds   { top: 88px; }
#filters::-webkit-scrollbar, #kinds::-webkit-scrollbar { display: none; }

.kind {
  flex: 0 0 auto;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  opacity: 0.55;
}
.kind.active {
  opacity: 1;
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}

.chip, #me-btn {
  flex: 0 0 auto;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}
.chip.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}
#me-btn {
  margin-left: auto;
  padding: 6px 10px;
  font-size: 14px;
}

.card {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 600;
  background: var(--card);
  color: var(--fg);
  border-radius: 16px;
  padding: 16px 16px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  max-height: 60vh;
  overflow-y: auto;
  transform: translateY(0);
  transition: transform 0.2s ease;
}
.card.hidden {
  transform: translateY(120%);
  pointer-events: none;
}
#card-close {
  position: absolute; top: 8px; right: 10px;
  background: transparent; color: var(--hint);
  border: none; font-size: 18px; cursor: pointer;
  padding: 6px 10px;
}
.card h2 {
  margin: 0 0 8px; font-size: 17px; line-height: 1.25;
  padding-right: 30px;
}
.card .meta { color: var(--hint); font-size: 13px; margin-bottom: 8px; }
.card .meta span { margin-right: 10px; }
.card p { margin: 6px 0; font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
.card p a {
  color: var(--tg-theme-link-color, #6ab4ff);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--tg-theme-link-color, #6ab4ff) 40%, transparent);
}
.card p a:active { opacity: 0.7; }
.card .actions {
  display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.card .actions a, .card .actions button {
  background: var(--accent); color: var(--accent-fg);
  border: none; border-radius: 10px;
  padding: 10px 14px; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.card .actions a.secondary, .card .actions button.secondary {
  background: transparent; color: var(--fg);
  border: 1px solid var(--hint);
}

/* Пин с эмодзи в кружке, цвет рамки по типу */
.pin {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 3px solid var(--event);
  border-radius: 50% 50% 50% 6px;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transform: rotate(-45deg);
}
.pin > span { display: inline-block; transform: rotate(45deg); }
.pin.spot { border-color: var(--spot); }
.pin.place { border-color: var(--place); }

/* «Я здесь» — синяя пульсирующая точка */
.me-pulse {
  width: 18px; height: 18px;
  background: #4ea8ff;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(78, 168, 255, 0.6);
  animation: mepulse 2s infinite;
}
@keyframes mepulse {
  0%   { box-shadow: 0 0 0 0 rgba(78, 168, 255, 0.6); }
  70%  { box-shadow: 0 0 0 16px rgba(78, 168, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(78, 168, 255, 0); }
}
