/* Афиша · Курган — дизайн-система и разметка
   Мобильный первый экран, тёмная тема через prefers-color-scheme. */

:root {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --text: #14161b;
  --muted: #6d7480;
  --line: #e5e1d8;
  --accent: #3f4bc8;
  --accent-text: #ffffff;
  --accent-soft: #eceefb;
  --warm: #cf5340;
  --ok: #2f8f6b;
  --shadow-sm: 0 1px 2px rgba(20, 22, 27, .06), 0 2px 8px rgba(20, 22, 27, .05);
  --shadow-lg: 0 18px 50px rgba(16, 20, 30, .18), 0 4px 12px rgba(16, 20, 30, .08);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --sheet-radius: 24px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13;
    --surface: #151920;
    --surface-2: #1b2029;
    --text: #eef1f6;
    --muted: #98a2b3;
    --line: #262c37;
    --accent: #7d87f2;
    --accent-text: #0d0f13;
    --accent-soft: #1d2233;
    --warm: #e2775f;
    --ok: #4dbb8e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overscroll-behavior-y: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
}

@media (min-width: 640px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), var(--bg) 60%); }
  .app {
    height: min(900px, calc(100dvh - 32px));
    margin-top: 16px;
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
  }
}

/* ── Шапка ─────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  background: var(--bg);
  z-index: 20;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-right: auto;
  min-width: 0;
}

.brand b {
  font-size: 19px;
  letter-spacing: -.02em;
  font-weight: 750;
}

.brand span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .01em;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, background .15s ease;
}

.icon-btn:active { transform: scale(.94); }
.icon-btn[hidden] { display: none; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* Поиск */
.search-bar {
  display: none;
  padding: 0 16px 10px;
  gap: 8px;
  align-items: center;
  background: var(--bg);
  z-index: 19;
}

.search-bar.is-open { display: flex; }

.search-bar input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.search-bar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Фильтры */
.chips {
  display: flex;
  gap: 8px;
  padding: 2px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 15;
  background: var(--bg);
  /* мягкое затухание справа подсказывает, что ряд фильтров прокручивается */
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 22px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 22px), transparent 100%);
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .12s ease;
}

.chip:active { transform: scale(.96); }

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* Сортировка */
.sorts {
  display: flex;
  gap: 6px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg);
}

.sorts::-webkit-scrollbar { display: none; }

.sort {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.sort.is-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.chip .count {
  font-size: 11.5px;
  font-weight: 700;
  opacity: .65;
  font-variant-numeric: tabular-nums;
}

/* ── Контент ───────────────────────────────────────────── */

.view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.pane {
  position: absolute;
  inset: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s ease;
  display: flex;
  flex-direction: column;
}

.pane.is-active { visibility: visible; opacity: 1; }

/* Карта */
#map { flex: 1; background: var(--surface-2); }

#map .leaflet-tile-pane { filter: saturate(.94); }

/* Тёмная тема: бесплатных тёмных тайлов без ключа нет — инвертируем OSM */
#map.theme-dark .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.92) saturate(.55);
}

#map.theme-dark { background: #12151b; }

.leaflet-container { font: inherit; background: var(--surface-2); }

.leaflet-control-attribution {
  font-size: 9.5px !important;
  background: color-mix(in srgb, var(--surface) 82%, transparent) !important;
  color: var(--muted) !important;
  padding: 2px 6px !important;
  border-radius: 6px 0 0 0;
}

.leaflet-control-attribution a { color: var(--muted) !important; }

.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: var(--shadow-sm) !important; }
.leaflet-bar a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}
.leaflet-bar a:hover { background: var(--surface-2) !important; }

/* Маркер площадки */
/* Маркер площадки: контейнер Leaflet нулевого размера, «пилюля» центрируется сама */
.pin-wrap {
  width: 0 !important;
  height: 0 !important;
  overflow: visible;
}

.pin {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  background: var(--surface);
  border: 1.5px solid var(--pin-accent, var(--accent));
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(16, 20, 30, .22);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: transform .14s ease;
}

.pin:active { transform: translate(-50%, -50%) scale(.96); }

.pin__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--pin-accent, var(--accent));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Площадка без собранной афиши: пунктирная рамка и приглушённый текст */
.pin--empty {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.pin--empty .pin__dot {
  width: 12px;
  height: 12px;
  margin: 0 3px;
  font-size: 0;
  color: transparent;
  background: color-mix(in srgb, var(--muted) 70%, transparent);
}

.pin--empty .pin__name { color: var(--muted); font-weight: 550; }

/* На обзорном масштабе подписи перекрываются — показываем только счётчик */
.map-compact .pin { padding: 3px; gap: 0; }
.map-compact .pin__name { display: none; }
.map-compact .pin__dot {
  width: 30px;
  height: 30px;
  font-size: 12.5px;
}

/* Площадка без событий — маленькое кольцо, а не пустая «пилюля» */
.map-compact .pin--empty { padding: 0; }
.map-compact .pin--empty .pin__dot {
  width: 14px;
  height: 14px;
  margin: 0;
  font-size: 0;
  color: transparent;
  background: var(--surface);
  border: 3px solid var(--pin-accent, var(--muted));
  box-shadow: 0 1px 6px rgba(16, 20, 30, .25);
}

.user-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2f7cf6;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(47, 124, 246, .25);
}

/* Кнопка «рядом со мной» поверх карты */
.map-float {
  position: absolute;
  right: 14px;
  bottom: 18px;
  z-index: 500;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  color: var(--text);
}

.map-float svg { width: 20px; height: 20px; }
.map-float.is-busy svg { animation: pulse 1s infinite; }

/* Переключатель «Площадки / События» */
.map-float--mode {
  width: auto;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
  bottom: 18px;
  right: 70px;
}

.map-float--mode[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* Подсказка о приближении карты */
.map-hint {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 500;
  max-width: 260px;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 11.5px;
  line-height: 1.25;
  text-align: center;
  color: var(--muted);
}

.map-hint[hidden] { display: none; }

/* Метка события на карте */
.ev-pin-wrap { width: max-content; }

.ev-pin {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 160px;
  padding: 4px 8px 4px 7px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--c) 55%, var(--line));
  box-shadow: 0 4px 12px rgba(20, 22, 40, .18);
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
}

.ev-pin b {
  color: var(--c);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.ev-pin--dot {
  padding: 3px 6px;
  border-radius: 8px;
  background: var(--surface);
}

.ev-pin--dot b { font-size: 10.5px; }

.ev-pin span {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 108px;
  font-weight: 550;
}

/* Разделитель между фильтрами и метками */
.chips__sep {
  flex: 0 0 auto;
  width: 1px;
  align-self: stretch;
  margin: 4px 2px;
  background: var(--line);
}

/* Метки событий отдельной строкой */
.tags {
  display: flex;
  gap: 6px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg);
}

.tags::-webkit-scrollbar { display: none; }
.tags:empty { display: none; }

.chip--tag {
  padding: 6px 10px;
  font-size: 12.5px;
  gap: 5px;
}

/* Подборки */
.collections {
  display: flex;
  gap: 10px;
  padding: 0 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg);
}

.collections::-webkit-scrollbar { display: none; }
.collections[hidden] { display: none; }

/* атрибут hidden должен побеждать display:flex у строк фильтров */
.chips[hidden],
.sorts[hidden],
.tags[hidden],
.collections[hidden] { display: none !important; }

.collection {
  position: relative;
  flex: 0 0 auto;
  width: 166px;
  min-height: 96px;
  padding: 12px 13px;
  border-radius: 16px;
  text-align: left;
  color: #fff;
  background: linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 40%, #10131f));
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: transform .12s ease;
}

.collection:active { transform: scale(.975); }

.collection__count { font-size: 11px; font-weight: 750; opacity: .85; }
.collection__title { font-size: 15.5px; font-weight: 760; line-height: 1.2; letter-spacing: -.01em; }
.collection__hint { margin-top: auto; font-size: 11px; opacity: .78; }

.collection--poster { background: linear-gradient(150deg, #1d2444, #3b2c60); }

.collection--route { background: linear-gradient(150deg, #17453f, #0f2b2a); }

/* Мастер «Маршрут на вечер» */
.wizard__group { margin-bottom: 16px; }

.wizard__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.wizard__options { display: flex; flex-wrap: wrap; gap: 7px; }

.wizard__options .chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* Итог маршрута */
.route { display: flex; flex-direction: column; gap: 6px; }

.route__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.route__row time {
  font-size: 15px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 52px;
}

.route__row div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.route__row b { font-size: 14px; font-weight: 650; line-height: 1.25; }
.route__row span { font-size: 12.5px; color: var(--muted); }
.route__row .btn { width: 42px; height: 42px; padding: 0; }

.route__hop {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 12px 2px 22px;
  font-size: 12px;
  color: var(--muted);
}

.route__hop svg { width: 15px; height: 15px; }

.collection__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .08em;
  background: rgba(255, 255, 255, .18);
  padding: 2px 6px;
  border-radius: 6px;
}

.poster-preview {
  display: block;
  width: 100%;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

/* Календарь месяца */
.cal { padding: 8px 16px 24px; }

.cal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 12px;
}

.cal__title { flex: 1; text-align: center; }
.cal__title b { display: block; font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.cal__title span { font-size: 12px; color: var(--muted); }

.cal__nav {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.cal__nav:active { transform: scale(.96); }

.cal__dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.cal__dow span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  text-transform: uppercase;
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal__day {
  position: relative;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cal__day--empty { background: transparent; border-color: transparent; }

.cal__day.has-events { border-color: var(--line); box-shadow: var(--shadow-sm); }

.cal__day.is-today {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.cal__day:disabled { color: var(--muted); opacity: .55; background: transparent; box-shadow: none; }

.cal__dots { display: flex; gap: 3px; height: 6px; align-items: center; }
.cal__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.cal__dots b { font-size: 9px; font-weight: 700; color: var(--muted); }
.cal__day.is-today .cal__dots i { background: rgba(255, 255, 255, .9); }

.cal__legend {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* на календарной вкладке нижнее меню не должно перекрывать сетку */
#pane-calendar .list-scroll { padding-bottom: 90px; }

/* Личный кабинет */
#pane-profile .list-scroll { padding: 8px 16px 100px; }

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 14px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 750;
  color: var(--accent-text);
  background: linear-gradient(150deg, var(--accent), #2a2f6b);
}

.profile-id { flex: 1; min-width: 0; display: grid; gap: 2px; }
.profile-id b { font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.profile-id span { font-size: 11.5px; color: var(--muted); }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.profile-stats div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.profile-stats b { display: block; font-size: 20px; font-weight: 760; }
.profile-stats span { font-size: 11px; color: var(--muted); }

.psection { margin-bottom: 18px; }

.psection h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 720;
}

.psection h2 span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.plist { display: grid; gap: 8px; }

.pitem {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pitem__main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 11px 12px;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
}

.pitem__main b { font-size: 13.5px; font-weight: 650; line-height: 1.25; }
.pitem__main span { font-size: 11.5px; color: var(--muted); }

.pitem__x {
  width: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.pitem__x:active { color: #b03060; }

.pempty { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.profile-actions { display: grid; gap: 8px; margin-bottom: 8px; }
.profile-actions .btn { width: 100%; }

.sync-code {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
}

.sync-code span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sync-code b { font-size: 20px; font-weight: 780; letter-spacing: .12em; color: var(--accent); }

@keyframes pulse { 50% { opacity: .35; } }

/* Список */
.list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2px 16px calc(20px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
}

.day-group { margin-bottom: 22px; }

.day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 2px 10px;
  position: sticky;
  top: 0;
  background: linear-gradient(var(--bg) 78%, transparent);
  z-index: 2;
}

.day-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 720;
  letter-spacing: -.015em;
}

.day-head span { font-size: 12.5px; color: var(--muted); max-width: 46%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.day-head em {
  margin-left: auto;
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Карточка события */
.card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .12s ease, box-shadow .15s ease;
}

.card:active { transform: scale(.985); border-color: var(--accent); box-shadow: var(--shadow-md, var(--shadow-sm)); }

.thumb {
  position: relative;
  width: 88px;
  height: 104px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(150deg, #2b3358, #151a2c);
  isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  color: rgba(255, 255, 255, .92);
  letter-spacing: .01em;
}

/* если картинка загрузилась — подпись-заглушка не нужна */
.thumb:has(img) .thumb__fallback { display: none; }

.card__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title title"
    "meta price"
    "desc desc"
    "tags tags";
  align-content: center;
  gap: 6px 12px;
  min-width: 0;
}

.card__desc {
  grid-area: desc;
  font-size: 12px;
  line-height: 1.34;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__title { grid-area: title; }
.card__meta { grid-area: meta; }
.card__body > .price { grid-area: price; align-self: center; }
.card__body > .tagline { grid-area: tags; }

.card__title {
  font-size: 15px;
  font-weight: 660;
  line-height: 1.26;
  letter-spacing: -.012em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.card__meta b { font-weight: 650; color: var(--text); }



.venue-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--accent));
  margin-right: 5px;
  vertical-align: 1px;
}

.card__bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.price {
  font-size: 15px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.price--free { color: var(--ok); }

.price--unknown {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.tagline { display: flex; gap: 5px; flex-wrap: nowrap; overflow: hidden; }

.tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.tag--warm { background: color-mix(in srgb, var(--warm) 14%, transparent); color: var(--warm); }
.tag--ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }

/* Пустое состояние */
.empty {
  padding: 44px 22px;
  text-align: center;
  color: var(--muted);
}

.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty p { margin: 0; font-size: 14px; line-height: 1.5; }

/* ── Нижняя навигация ──────────────────────────────────── */

.tabbar {
  display: flex;
  gap: 4px;
  padding: 8px 16px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 20;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 0 5px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .15s ease, background .15s ease;
}

.tab svg { width: 21px; height: 21px; }
.tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); }

/* ── Шторка (bottom sheet) ─────────────────────────────── */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, .45);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
  /* выше панелей Leaflet (у них z-index до 800) */
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.backdrop.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  background: var(--surface);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  transform: translateY(102%);
  transition: transform .28s cubic-bezier(.22, .8, .3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .22);
  touch-action: pan-y;
}

.backdrop.is-open .sheet { transform: translateY(0); }

@media (min-width: 640px) {
  .backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: var(--sheet-radius); max-height: min(820px, 90dvh); }
  .backdrop:not(.is-open) .sheet { transform: translateY(24px) scale(.98); }
}

.sheet__grab {
  padding: 10px 0 4px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  cursor: grab;
}

.sheet__grab i {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
}

.sheet__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 calc(16px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
}

.sheet__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(12, 14, 20, .55);
  color: #fff;
  backdrop-filter: blur(6px);
  z-index: 3;
}

.sheet__close svg { width: 16px; height: 16px; }

/* Герой карточки события */
.hero {
  position: relative;
  height: 250px;
  background: linear-gradient(150deg, #2b3358, #10131f);
  overflow: hidden;
}

.hero img { width: 100%; height: 100%; object-fit: cover; }

.hero__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 8, 14, .38) 0%, rgba(6, 8, 14, .12) 38%, rgba(6, 8, 14, .86) 100%);
}

.hero__top {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 2;
}

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 12, 18, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hero__bottom {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  z-index: 2;
}

.hero__title {
  margin: 0;
  color: #fff;
  font-size: 21.5px;
  font-weight: 760;
  line-height: 1.2;
  letter-spacing: -.015em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .5);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sheet__body { padding: 16px 18px 0; }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 16px;
}

.meta-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.meta-item span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 3px;
}

.meta-item b { font-size: 14px; font-weight: 650; line-height: 1.3; }

.desc {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--text);
  margin: 0 0 16px;
  white-space: pre-line;
}

.desc:empty { display: none; }

.rows { border-top: 1px solid var(--line); margin: 0 0 16px; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.row svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.row span { color: var(--muted); }
.row b { margin-left: auto; font-weight: 600; text-align: right; }
.row--link b { color: var(--accent); }
.row--link:hover b { text-decoration: underline; }

.source-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 16px;
}

.source-note a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }

/* Нижняя панель действий шторки — отдельный элемент, контент под ней не прячется */
.sheet__footer {
  flex: 0 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.sheet__footer[hidden] { display: none; }

.cta-row {
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(12px + var(--safe-b));
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  transition: transform .12s ease, filter .15s ease;
}

.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }

.btn--primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn--ghost { flex: 0 0 auto; width: 54px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.btn--ghost svg { color: var(--text); }

.btn--ghost-wide {
  width: auto;
  padding: 15px 14px;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 650;
}

/* Площадка в шторке */
.venue-head { padding: 6px 18px 0; }

.venue-head--compact { padding: 2px 18px 0; }

.venue-head--compact .venue-top { padding-right: 52px; }

.venue-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.venue-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.venue-kind {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--accent);
}

.venue-title {
  margin: 4px 0 3px;
  font-size: 22px;
  line-height: 1.16;
  font-weight: 760;
  letter-spacing: -.02em;
}

.venue-addr { font-size: 13.5px; color: var(--muted); }

.venue-note {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--warm, #9a5b1e);
}

.venue-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 2px;
}

.venue-contacts a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 6px 11px;
  border-radius: 999px;
}

.venue-contacts svg { width: 14px; height: 14px; color: var(--muted); }

.sheet__body--venue { padding-top: 14px; }

.venue-day { margin-bottom: 16px; }

/* заголовок дня внутри шторки — на фоне шторки, без серой полосы */
.sheet .day-head { background: linear-gradient(var(--surface) 78%, transparent); }

.venue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ev-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .12s ease;
}

.ev-card:active { transform: scale(.985); border-color: var(--accent); }

.ev-card__poster {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  background: linear-gradient(150deg, #2b3358, #151a2c);
  overflow: hidden;
}

.ev-card__poster img { width: 100%; height: 100%; object-fit: cover; }

.ev-card__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  color: rgba(255, 255, 255, .92);
}

.ev-card__poster:has(img) .ev-card__fallback { display: none; }

.ev-card__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 9px 10px;
}

.ev-card__time {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.ev-card__title {
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.26;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ev-card__price { font-size: 11.5px; color: var(--muted); }

.venue-empty { color: var(--muted); }

.mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: 8px;
  font-size: 14px;
}

.mini-card time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  min-width: 52px;
}

.mini-card b { font-weight: 600; line-height: 1.3; }

.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 10px;
}

/* Тост */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + var(--safe-b));
  transform: translate(-50%, 18px);
  padding: 11px 16px;
  border-radius: 12px;
  background: #1b1f28;
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 90;
  max-width: min(480px, calc(100vw - 40px));
  text-align: center;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Офлайн-плашка */
.offline-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: color-mix(in srgb, var(--warm) 12%, var(--bg));
  color: var(--warm);
  font-size: 12.5px;
  font-weight: 600;
}

.offline-bar.is-visible { display: flex; }
.offline-bar svg { width: 15px; height: 15px; }

/* Скелетон / загрузка */
.skeleton {
  height: 128px;
  border-radius: var(--r-md);
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%);
  background-size: 240% 100%;
  animation: shimmer 1.3s infinite linear;
  margin-bottom: 10px;
}

@keyframes shimmer { to { background-position: -140% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Кластер площадок: круг с суммой событий */
.pin--cluster { padding: 3px; border-width: 2px; }
.pin--cluster .pin__dot {
  width: 42px;
  height: 42px;
  font-size: 13.5px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* Площадки без афиши на обзорном масштабе — только точкой, без подписи */
.map-quiet .pin--empty { padding: 0; }
.map-quiet .pin--empty .pin__name { display: none; }
.map-quiet .pin--empty .pin__dot {
  width: 15px;
  height: 15px;
  font-size: 0;
  color: transparent;
  background: var(--surface);
  border: 3px solid var(--pin-accent, var(--muted));
  box-shadow: 0 1px 6px rgba(16, 20, 30, .25);
}

.pitem__who { font-style: normal; color: var(--accent); }

/* Радиус поиска «Рядом» */
.radius-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.radius-row[hidden] { display: none !important; }
.radius-row::-webkit-scrollbar { display: none; }
.radius-label { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }

.chip--small {
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
}

.chip--small.is-on {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

/* Дополнительные фильтры: дата, площадка, цена */
.chip--extra { background: var(--surface-2); }
.chip--extra.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.xf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.xf-row label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.xf-row input { font: inherit; font-size: 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); width: 100%; }

.xf-search { width: 100%; font: inherit; font-size: 14px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 10px; }

.xf-list { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; margin-bottom: 12px; }

.xf-venue { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13.5px; }
.xf-venue input { width: 18px; height: 18px; accent-color: var(--accent); }
.xf-venue span { flex: 1; min-width: 0; }
.xf-venue em { font-style: normal; font-size: 12px; color: var(--muted); }

.xf-presets { margin-bottom: 12px; }

/* Поля в окнах фильтров */
.xf-field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.xf-field input { font: inherit; font-size: 15px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }

.xf-radius-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.xf-radius-list .chip { min-width: 86px; justify-content: center; }

/* Крестик выключения фильтра */
.chip-x {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .12);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

.sort.is-active .chip-x, .chip[aria-pressed="true"] .chip-x { background: rgba(0, 0, 0, .18); }
.chip-x:active { background: rgba(0, 0, 0, .3); }

.xf-quick { flex-wrap: wrap; }

.venue-hours { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.venue-office { margin: 2px 0 0; font-size: 12px; color: var(--muted); opacity: .85; line-height: 1.4; }
