/* CarPlace — мир «Карта-путеводитель»: плоская доля «суши» держит каждый экран,
   капсулы несут действие и состояние, фото обрезаются по доле, цифры табличные.
   Тема (светлая/тёмная) берётся из Telegram: атрибут data-theme на <html>. */

@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/static/vendor/onest/onest-cyrillic-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/static/vendor/onest/onest-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --water: #f5f1e4;      /* фон */
  --paper: #fffcf3;      /* поля, острова */
  --land: #8ed462;       /* доли, главное действие */
  --ink: #2c2e2a;        /* текст */
  --ink-2: #55584f;      /* вторичный текст */
  --line: #ddd6c1;
  --on-color: #2c2e2a;   /* текст на цветных капсулах в обеих темах */
  --sun: #ffd23f;
  --coral: #ff6b5a;
  --coral-text: #b3261e;
  --pond: #4fa6e3;
  --lilac: #ebc1ff;
  --shadow: 0 6px 18px rgba(44, 46, 42, .10);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-over: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --water: #1c1e1a;
  --paper: #262922;
  --land: #7bc152;
  --ink: #f2eedf;
  --ink-2: #b9b6a8;
  --line: #3a3d35;
  --coral-text: #ff8a7d;
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  background: var(--water);
  color: var(--ink);
  font: 16px/1.45 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  caret-color: var(--ink);
}
::selection { background: var(--land); color: var(--on-color); }
#app { max-width: 760px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 22px; letter-spacing: -0.02em; }
h2 { font-size: 20px; letter-spacing: -0.02em; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--ink); text-underline-offset: 3px; }
.display { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; line-height: .95; }
.hint { color: var(--ink-2); font-size: 13px; line-height: 1.35; }
.small { font-size: 14px; line-height: 1.35; }
.pre { white-space: pre-wrap; word-break: break-word; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
.center { text-align: center; }
.page { padding: 18px 20px 8px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Иконки ---------- */
.ic { width: 20px; height: 20px; flex: none; display: block; fill: currentColor; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 22px; height: 22px; }

/* ---------- Доля-заголовок ---------- */
.hero {
  --paper: #fffcf3; --ink: #2c2e2a; --ink-2: #55584f; --line: rgba(44, 46, 42, .16);
  background: var(--land);
  color: #2c2e2a;
  padding: 18px 20px 6px;
  display: flex; flex-direction: column; gap: 12px;
}
.hero h1 { text-wrap: balance; font-size: 40px; font-weight: 700; letter-spacing: -0.04em; line-height: .95; }
/* Доля уходит за края экрана и на широких экранах: заливка продолжается за пределы колонки. */
.hero, .listing-land { box-shadow: 0 0 0 100vmax var(--land); clip-path: inset(0 -100vmax); }
.coast { display: block; width: 100vw; margin-left: calc(50% - 50vw); height: 40px; margin-top: -1px; fill: var(--land); }
@media (min-width: 700px) {
  .hero h1 { font-size: 64px; }
  .coast { height: 56px; }
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand-mark { width: 40px; height: 36px; flex: none; }

/* ---------- Нижняя навигация ---------- */
.tabs {
  position: fixed; z-index: 50; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 736px; margin: 0 auto; height: 72px; padding: 0 6px;
  display: flex; align-items: center; justify-content: space-around;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.tab {
  flex: 1 1 0; border: 0; background: none; cursor: pointer; padding: 4px 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font: 600 12px/14px 'Onest', sans-serif; color: var(--ink-2);
}
.tab .tab-icon {
  position: relative; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .25s var(--ease-out), transform .4s var(--ease-over);
}
.tab.active { color: var(--ink); }
.tab.active .tab-icon { background: var(--land); color: var(--on-color); transform: scale(1.04); }
.tab:focus-visible { outline: none; }
.tab:focus-visible .tab-icon { box-shadow: 0 0 0 3px var(--ink); }
.dot { position: absolute; top: 7px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); border: 2px solid var(--paper); }

/* ---------- Переключатели ---------- */
.segmented {
  display: flex; gap: 4px; padding: 4px; min-height: 48px;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 999px;
}
.segmented button {
  flex: 1; border: 0; background: transparent; border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font: 700 15px/20px 'Onest', sans-serif; color: var(--ink-2); padding: 8px 10px;
  transition: background-color .2s var(--ease-out), color .2s var(--ease-out);
}
.segmented button.active { background: var(--ink); color: var(--water); }
.hero .segmented button.active { color: #fffcf3; }
.segmented button:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
.segmented.chips { background: none; border: 0; padding: 0 20px; margin: 0 -20px; overflow-x: auto; scrollbar-width: none; min-height: 0; }
.segmented.chips::-webkit-scrollbar { display: none; }
.segmented.chips button { flex: none; background: var(--paper); color: var(--ink); min-height: 36px; padding: 0 14px; font-size: 14px; }
.segmented.chips button.active { background: var(--ink); color: #fffcf3; }

/* ---------- Строки списков (бывшие карточки) ---------- */
.card { padding: 16px 0; border-bottom: 1.5px solid var(--line); }
.card:last-child { border-bottom: 0; }
.card.clickable { cursor: pointer; transition: opacity .15s; }
.card.clickable:active { opacity: .7; }
.card.panel { background: var(--paper); border: 0; border-radius: 24px; padding: 20px; }
.section-title { margin: 14px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.empty { text-align: center; color: var(--ink-2); padding: 32px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.count-line { display: flex; justify-content: space-between; color: var(--ink-2); font-size: 14px; }

.listing-card { display: flex; gap: 14px; align-items: center; }
.listing-card .thumb {
  flex: 0 0 92px; height: 76px; clip-path: url(#lobe-a); background: color-mix(in srgb, var(--land) 30%, var(--paper));
  display: flex; align-items: center; justify-content: center; color: var(--on-color);
}
.listing-card .thumb.b { clip-path: url(#lobe-b); }
:root[data-theme="dark"] .listing-card .thumb { color: var(--ink); background: color-mix(in srgb, var(--land) 22%, var(--paper)); }
.listing-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-card .title { font-weight: 700; font-size: 17px; line-height: 21px; }
.listing-card .meta { color: var(--ink-2); font-size: 14px; line-height: 1.35; }
.listing-card .meta b { color: var(--ink); }
.price { font-weight: 700; font-size: 19px; line-height: 22px; letter-spacing: -0.01em; white-space: nowrap; text-align: right; }
.price .unit { display: block; font-weight: 400; font-size: 13px; color: var(--ink-2); letter-spacing: 0; }

/* ---------- Статусы ---------- */
.badge {
  display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--on-color); background: var(--paper);
}
.badge.sun { background: var(--sun); }
.badge.land { background: var(--land); }
.badge.coral { background: var(--coral); }
.badge.pond { background: var(--pond); }
.badge.lilac { background: var(--lilac); }
.badge.outline { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }

/* ---------- Блоки ---------- */
.notice { padding-top: 14px; border-top: 1.5px solid var(--line); }
.notice .row-between { align-items: baseline; }
.notice strong { font-size: 30px; letter-spacing: -0.03em; }
.notice.danger { color: var(--coral-text); }
.directions { background: var(--paper); border-radius: 20px; padding: 14px 16px; }
.directions .head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.locked { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 20px; border: 1.5px dashed var(--ink-2); }
.info { background: var(--paper); border-radius: 16px; padding: 10px 14px; font-size: 14px; }
.info.danger { color: var(--coral-text); }

/* ---------- Формы ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
input, select, textarea {
  width: 100%; min-width: 0; font: 400 16px/1.4 'Onest', sans-serif; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 13px 16px; min-height: 52px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
input:disabled, select:disabled { opacity: .5; }
select {
  appearance: none; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%2355584f' d='M216.49 104.49l-80 80a12 12 0 0 1-17 0l-80-80a12 12 0 0 1 17-17L128 159l71.51-71.52a12 12 0 0 1 17 17Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 18px;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
input[type="checkbox"] {
  appearance: none; width: 24px; height: 24px; min-height: 0; flex: 0 0 24px; margin: 0; padding: 0;
  border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); cursor: pointer;
  transition: background-color .2s var(--ease-out);
}
input[type="checkbox"]:checked {
  background: var(--land) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%232c2e2a' d='M232.49 80.49l-128 128a12 12 0 0 1-17 0l-56-56a12 12 0 1 1 17-17L96 183 215.51 63.51a12 12 0 0 1 17 17Z'/%3E%3C/svg%3E") center / 16px no-repeat;
  border-color: var(--on-color);
}
input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 35%, transparent); }
.checkbox { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 15px; }
.checkbox > span { padding-top: 2px; }
.two-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
/* Поле даты: кнопка в виде поля ввода, по нажатию — своё окно выбора (см. dateTimeInput в app.js). */
.dt-input {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 52px; padding: 12px 14px;
  font: 400 15px/1.3 'Onest', sans-serif; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px;
}
.dt-input .ic { flex: none; color: var(--ink-2); }
.dt-input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.dt-month { flex: 1; text-align: center; font-size: 17px; }
.dt-weekdays, .dt-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.dt-weekdays span { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.dt-day {
  aspect-ratio: 1; max-height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--ink);
  font: 500 15px/1 'Onest', sans-serif; cursor: pointer;
}
.dt-day.today { box-shadow: inset 0 0 0 1.5px var(--line); }
.dt-day.selected { background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: none; }
.dt-day:disabled { opacity: .3; cursor: default; }
.dt-time { display: flex; align-items: center; gap: 8px; }
.dt-time select { flex: 1; }
.icon-action.flip svg { transform: scaleX(-1); }
@media (max-width: 440px) { .two-cols.dates { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 380px) { .two-cols { grid-template-columns: minmax(0, 1fr); } }
.counter { text-align: right; font-size: 13px; color: var(--ink-2); font-weight: 400; }
.counter.over { color: var(--coral-text); }
.pill-field { position: relative; }
.pill-field > .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #2c2e2a; pointer-events: none; z-index: 1; }
.pill-field input { border-radius: 999px; border: 0; padding-left: 46px; min-height: 48px; background: #fffcf3; color: #2c2e2a; font-weight: 600; }
.pill-field input::placeholder { color: #2c2e2a; font-weight: 600; }
.hero input:focus { box-shadow: 0 0 0 2px #2c2e2a; }
.period-box { background: rgba(255, 252, 243, .55); border-radius: 24px; padding: 12px; }

/* ---------- Кнопки-капсулы ---------- */
button.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 48px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  font: 700 15px/20px 'Onest', sans-serif; color: var(--on-color); background: var(--land);
  transition: transform .15s var(--ease-out), background-color .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
button.btn:active { transform: scale(.98); }
button.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
button.btn.has-chip { justify-content: space-between; padding: 0 6px 0 20px; }
button.btn .chip {
  width: 36px; height: 36px; border-radius: 50%; flex: none; background: #2c2e2a; color: #fffcf3;
  display: flex; align-items: center; justify-content: center;
  transition: transform .4s var(--ease-over);
}
/* Пока идёт запрос, чип переходит к началу капсулы — видимая обратная связь. */
button.btn.has-chip:disabled { flex-direction: row-reverse; padding: 0 20px 0 6px; opacity: .8; }
button.btn.has-chip:disabled .chip { animation: chip-cross .45s var(--ease-over); }
@keyframes chip-cross { from { transform: translateX(16px) scale(.8); } to { transform: none; } }
button.btn.sun { background: var(--sun); }
button.btn.ink { background: #2c2e2a; color: #fffcf3; }
button.btn.ink .chip { background: var(--land); color: #2c2e2a; }
:root[data-theme="dark"] button.btn.ink:not(.hero *) { background: var(--ink); color: var(--water); }
button.btn.secondary { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
button.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
button.btn.danger { background: var(--coral); color: var(--on-color); }
button.btn.danger-ghost { background: transparent; color: var(--coral-text); box-shadow: inset 0 0 0 2px var(--coral); }
button.btn.inline { width: auto; min-height: 36px; padding: 0 14px; font-size: 14px; gap: 6px; }
button.btn.inline.has-chip { padding: 0 4px 0 14px; }
button.btn.inline .chip { width: 28px; height: 28px; }
button.btn:disabled { opacity: .45; cursor: default; transform: none; }
button.link {
  border: 0; background: none; padding: 0; cursor: pointer; text-align: left;
  font: 600 14px/1.35 'Onest', sans-serif; color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
}
button.link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.icon-btn {
  border: 0; background: var(--paper); color: var(--ink); width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 44px;
}
.icon-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions > .btn:not(.inline) { flex: 1 1 140px; width: auto; }

/* ---------- Выпадающий список с поиском ---------- */
.picker { position: relative; }
.picker-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); max-height: 260px; overflow-y: auto;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  margin: 0; padding: 6px; list-style: none; color: var(--ink);
}
.picker-list li { padding: 10px 12px; cursor: pointer; border-radius: 12px; }
.picker-list li:hover, .picker-list li.active { background: color-mix(in srgb, var(--land) 22%, transparent); }

/* ---------- Изображения: кадры по форме доли ---------- */
.listing-hero { position: relative; margin: 0 -20px; }
.listing-hero .shot { width: 100%; aspect-ratio: 390 / 280; clip-path: url(#lobe-hero); overflow: hidden; }
.listing-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entry-tag {
  position: absolute; right: 20px; bottom: 2px; display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 999px; background: var(--sun); color: #2c2e2a;
  font-weight: 700; letter-spacing: .06em; box-shadow: var(--shadow);
}
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.gallery figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.gallery .frame {
  aspect-ratio: 108 / 86; clip-path: url(#lobe-a); background: color-mix(in srgb, var(--ink) 8%, var(--paper));
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px 12px;
}
.gallery figure:nth-child(2) .frame { clip-path: url(#lobe-b); }
/* С фото ЖК кадров четыре — сеткой 2 × 2, чтобы на телефоне они не стали мелкими. */
.gallery.four { grid-template-columns: repeat(2, 1fr); }
.gallery.four figure:nth-child(3) .frame { clip-path: url(#lobe-b); }
.gallery img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.gallery .frame:has(img) { padding: 0; }
.gallery .placeholder { font-size: 11px; line-height: 1.25; color: var(--ink-2); }
.gallery figcaption { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.file-preview { display: flex; gap: 12px; align-items: center; }
.file-preview img { width: 72px; height: 60px; object-fit: cover; clip-path: url(#lobe-a); }
.full-image { width: 100%; max-height: 75vh; object-fit: contain; border-radius: 16px; background: #000; }
.availability { height: 14px; border-radius: 7px; background: var(--line); position: relative; overflow: hidden; }
.availability .fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: 6px; min-width: 28px; background: var(--land); }
.availability-legend { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }
.availability-legend .chosen { color: var(--ink); font-weight: 700; }

/* ---------- Карточка места: отдельный экран со своей долей ---------- */
.listing-land {
  --paper: #fffcf3; --ink: #2c2e2a; --ink-2: #55584f;
  background: var(--land); color: #2c2e2a; margin: 0 -20px; padding: 0 20px 4px;
  display: flex; flex-direction: column; gap: 12px;
}
.listing-land .display { font-size: 48px; }
.listing-land + .coast { margin-top: -15px; }
.listing-hero .shot.empty-shot { display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, #fffcf3 55%, var(--land)); text-align: center; padding: 0 40px; }

/* ---------- Слоты изображений в справочнике ---------- */
.slot { display: flex; align-items: center; gap: 12px; }
.slot-thumb {
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 16px; overflow: hidden;
  background: color-mix(in srgb, var(--land) 30%, var(--paper)); color: var(--on-color);
  display: flex; align-items: center; justify-content: center;
}
:root[data-theme="dark"] .slot-thumb { color: var(--ink); background: color-mix(in srgb, var(--land) 22%, var(--paper)); }
.slot-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.slot-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.icon-action {
  flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line);
  transition: transform .15s var(--ease-out);
}
.icon-action:active { transform: scale(.94); }
.icon-action:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.icon-action.primary { background: var(--land); color: var(--on-color); box-shadow: none; }
.icon-action.danger { color: var(--coral-text); box-shadow: inset 0 0 0 1.5px var(--coral); }
.icon-action:disabled { opacity: .45; cursor: default; }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.sub-card { background: var(--paper); border-radius: 20px; padding: 14px 16px; }

/* ---------- Карта ---------- */
.map { height: 320px; border-radius: 24px; overflow: hidden; z-index: 0; }
.map.tall { height: 58vh; min-height: 320px; }
.leaflet-container { font: inherit; background: var(--water); }
.leaflet-tile-pane { filter: saturate(.3) contrast(.9) brightness(1.04) sepia(.12); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) saturate(.25) brightness(.78); }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-popup-content-wrapper { border-radius: 20px; background: var(--paper); color: var(--ink); }
.leaflet-popup-tip { background: var(--paper); }
.map-popup { display: flex; flex-direction: column; gap: 8px; min-width: 170px; font-family: 'Onest', sans-serif; }
.zhk-marker { position: relative; width: 0; height: 0; }
.zhk-marker .count {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--land); border: 2.5px solid #2c2e2a; color: #2c2e2a;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.zhk-marker .label {
  position: absolute; top: 0; left: calc(var(--r) + 6px); transform: translateY(-50%); white-space: nowrap;
  background: #fffcf3; color: #2c2e2a; border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: 13px;
  box-shadow: inset 0 0 0 1.5px #2c2e2a;
}
.zhk-marker.left .label { left: auto; right: calc(var(--r) + 6px); }
.zhk-marker.top .label { left: 0; top: auto; bottom: calc(var(--r) + 4px); transform: translateX(-50%); }
.zhk-marker.bottom .label { left: 0; top: calc(var(--r) + 4px); transform: translateX(-50%); }

/* ---------- Модальные окна ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: rgba(28, 30, 26, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in .2s var(--ease-out);
}
.modal {
  background: var(--water); width: 100%; max-width: 760px; max-height: 94vh; overflow-y: auto;
  border-radius: 28px 28px 0 0; padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-in .35s var(--ease-out);
}
@media (min-width: 700px) {
  .modal-backdrop:not(.full) { align-items: center; }
  .modal:not(.full) { border-radius: 28px; max-height: 90vh; }
}
.modal-backdrop.full { background: var(--water); align-items: stretch; }
.modal.full {
  max-width: none; max-height: none; height: 100%; border-radius: 0; overflow-x: hidden;
  padding: 0 20px calc(24px + env(safe-area-inset-bottom)); animation: page-in .3s var(--ease-out);
}
.modal.full > .stack { max-width: 720px; margin: 0 auto; }
.modal-header.floating { position: sticky; top: 0; z-index: 5; height: 0; margin: 0 auto; max-width: 720px; overflow: visible; justify-content: flex-start; align-items: flex-start; }
.modal-header.floating .icon-btn { margin-top: calc(24px + env(safe-area-inset-top)); box-shadow: var(--shadow); }
@keyframes page-in { from { transform: translateX(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-header h2 { font-size: 24px; letter-spacing: -0.03em; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Уведомления и cookie ---------- */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #2c2e2a; color: #fffcf3; padding: 12px 18px; border-radius: 999px; max-width: 520px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: sheet-in .3s var(--ease-out); }
.cookie-banner {
  position: fixed; z-index: 1500; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 736px; margin: 0 auto; background: var(--paper); border: 1.5px solid var(--line); border-radius: 24px;
  padding: 12px 12px 12px 16px; box-shadow: var(--shadow);
}
.has-nav .cookie-banner { bottom: calc(96px + env(safe-area-inset-bottom)); }
.cookie-banner .inner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cookie-banner .inner > p { flex: 1 1 220px; }
.cookie-banner .actions { flex: none; }

.screen-center { min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--land); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.footer-docs { padding: 28px 20px 8px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.footer-docs button.link { font-weight: 400; color: var(--ink-2); font-size: 13px; text-align: center; max-width: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
