/* ============================================================
   ДЕшевлє — «стекло и пастель»
   Тёплый кремовый фон с размытыми пастельными пятнами,
   поверх него матовые стеклянные карточки (backdrop-filter).
   ============================================================ */
:root {
  color-scheme: light;

  /* Фон и пастельные пятна за стеклом */
  --bg: #efe9e2;
  /* Как в тёмной теме: сверху светлее и теплее (персиковый крем), снизу темнее и холоднее (серо-бежевый) */
  --bg-top: #fbede1;
  --bg-mid: #ede7e0;
  --bg-bottom: #d6d3ce;
  --glow: rgba(255, 255, 255, .9);   /* мягкий свет сверху, как от окна */
  /* Цвет самого верха экрана. iPhone красит полоску статуса (время, батарея) в цвет фона
     страницы, поэтому верх градиента ровный и ровно этого цвета. */
  --bar: #fcf1e8;
  --bar-0: rgba(252, 241, 232, 0);

  /* Текст */
  --ink: #2b2926;
  --muted: #8b847b;

  /* Стекло */
  --glass: rgba(255, 255, 255, .42);
  --glass-strong: rgba(255, 255, 255, .62);
  --glass-hover: rgba(255, 255, 255, .78);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-shadow: 0 10px 30px rgba(92, 70, 48, .10), inset 0 1px 0 rgba(255, 255, 255, .85);
  --blur: blur(22px) saturate(1.6);

  /* Пастельные оценки цены */
  --cheap: #5d7d60;
  --cheap-bg: rgba(160, 190, 155, .30);
  --cheap-dot: #94b38f;
  --mid: #93703f;
  --mid-bg: rgba(236, 196, 146, .34);
  --mid-dot: #e3b27c;
  --pricey: #a15f58;
  --pricey-bg: rgba(226, 164, 152, .32);
  --pricey-dot: #db8e82;

  --accent: #2b2926;        /* графитовые кнопки-«таблетки» */
  --accent-ink: #f6f1ea;
  --fav: #e0955c;

  --radius: 24px;
  --tabbar-space: calc(env(safe-area-inset-bottom) + 92px);
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }
html { background: var(--bar); }

body {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bar);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* Размытые пастельные пятна — именно их «видно» сквозь стекло */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--bar) 0, var(--bar) 40px, var(--bar-0) 200px),
    radial-gradient(90% 55% at 50% -12%, var(--glow), transparent 70%),
    linear-gradient(160deg, var(--bg-top) 0%, var(--bg-mid) 50%, var(--bg-bottom) 100%);
}
body > * { position: relative; z-index: 1; }

button, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Общий рецепт стекла */
.glass,
.card, .hero, .seg, .radius select, .install-banner, .notice, .skeleton,
.icon-btn, .act, .map-btn, .tabbar, .fuel-badge,
.maplibregl-popup-content {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* ---------- Шапка: крупный заголовок, как в iOS ---------- */
/* Шапка и подсказка плавают поверх контента: карта и список уходят под стекло */
.top-chrome {
  position: fixed;
  z-index: 1100;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 0;
  pointer-events: none; /* сквозь пустые места можно двигать карту */
}
.top-chrome > * { pointer-events: auto; }
.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0 12px;
  padding: 12px 12px 12px 18px;
  border-radius: 28px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.title { display: flex; align-items: center; gap: 10px; }
.title h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.fuel-badge {
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.status {
  grid-column: 1 / -1;
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  transition: background .2s;
}
.icon-btn:active { background: var(--glass-hover); }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
.top-actions { display: flex; gap: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Подсказка про установку ---------- */
.install-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--glass-strong);
  font-size: 14px;
}
.install-banner[hidden] { display: none; }
.install-banner p { margin: 0; flex: 1; }
.install-banner .btn { flex: none; }
.install-banner .close { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px; }

/* ---------- Основная область ---------- */
main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view { display: none; }
.view.active { display: block; }
#view-list.active, #view-fav.active { padding-top: var(--top-space, 110px); padding-bottom: var(--tabbar-space); }
#view-map.active { position: absolute; inset: 0; }

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 12px 4px;
}
.seg { display: inline-flex; padding: 4px; border-radius: 999px; }
.seg button {
  border: 0;
  border-radius: 999px;
  background: none;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: background .2s, color .2s;
}
.seg button.active { background: var(--accent); color: var(--accent-ink); }
.radius { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.radius select {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  -webkit-appearance: none;
  appearance: none;
}

/* ---------- Карточка «Дешевле всего рядом» ---------- */
.hero {
  padding: 18px 20px 18px;
  border-radius: 28px;
  cursor: pointer;
}

.hero-label { font-size: 14px; color: var(--muted); }
.hero-price {
  margin: 2px 0 4px;
  font-size: 56px;
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.hero-price sup { font-size: .5em; }
.hero-price .eur { font-size: .4em; margin-left: 4px; color: var(--muted); }
.hero-meta { font-size: 15px; }
.hero-meta b { font-weight: 650; }
.hero-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }


/* ---------- Карточки заправок ---------- */
.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 12px 16px;
}
.card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
}
.card.closed { opacity: .55; }
.price {
  padding: 10px 2px;
  border-radius: 16px;
  background: var(--glass);
  font-size: 21px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.price sup { font-size: .58em; margin-left: 1px; }
.price .eur { font-size: .62em; font-weight: 500; margin-left: 2px; opacity: .7; }
.price .na { color: var(--muted); }
.cheap { color: var(--cheap); background: var(--cheap-bg); }
.mid { color: var(--mid); background: var(--mid-bg); }
.pricey { color: var(--pricey); background: var(--pricey-bg); }

.info { min-width: 0; cursor: pointer; }
.brand { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr, .meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .open { color: var(--cheap); }
.meta .shut { color: var(--pricey); }

.actions { display: flex; flex-direction: column; gap: 6px; }
.act {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--muted);
  text-decoration: none;
  transition: background .2s, color .2s;
}
.act:active { background: var(--glass-hover); }
.act.fav.on { color: var(--fav); }
.act.fav.on svg path { fill: currentColor; }

.empty {
  max-width: 420px;
  margin: 32px auto;
  padding: 0 16px;
  text-align: center;
  color: var(--muted);
}
.empty h2 { margin: 0 0 6px; font-size: 20px; font-weight: 650; color: var(--ink); }
.empty p { margin: 0 0 18px; }
.empty .buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.btn {
  padding: 11px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 15px;
}
.btn.secondary {
  background: var(--glass);
  color: var(--ink);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.notice { padding: 12px 14px; border-radius: 18px; font-size: 14px; }

.skeleton { height: 82px; border-radius: var(--radius); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.attribution { max-width: 640px; margin: 0 auto; padding: 4px 16px 16px; font-size: 12px; color: var(--muted); text-align: center; }
.attribution a { color: inherit; }

/* ---------- Карта ---------- */
#map { position: absolute; inset: 0; background: var(--bar); }
.maplibregl-ctrl-bottom-right { bottom: var(--tabbar-space); }
.maplibregl-ctrl.maplibregl-ctrl-attrib {
  margin: 0 10px 6px 0;
  border-radius: 999px;
  font-size: 10px;
  background: var(--glass-strong);
  color: var(--muted);
}
.maplibregl-ctrl-attrib a { color: inherit; }

/* Я здесь: синяя точка с мягким пульсирующим ореолом */
.me-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6f8fcf;
  border: 3px solid #fff;
  box-shadow: 0 0 0 0 rgba(111, 143, 207, .45), 0 2px 8px rgba(0, 0, 0, .2);
  animation: me-pulse 2.4s ease-out infinite;
}
@keyframes me-pulse { 70% { box-shadow: 0 0 0 16px rgba(111, 143, 207, 0), 0 2px 8px rgba(0, 0, 0, .2); } }

.map-btn { position: absolute; z-index: 1000; color: var(--ink); background: var(--glass-strong); }
.search-here {
  top: calc(var(--top-space, 110px) + 10px);
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}
.map-btn.round {
  right: 14px;
  bottom: calc(var(--tabbar-space) + 28px);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.pin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 66px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .95);
  color: #2b2926;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(70, 50, 30, .18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.pin i { width: 8px; height: 8px; border-radius: 50%; background: #b9b2a9; flex: none; }
.pin.cheap i { background: var(--cheap-dot); }
.pin.mid i { background: var(--mid-dot); }
.pin.pricey i { background: var(--pricey-dot); }
.pin.closed { opacity: .65; }
.pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: rgba(255, 255, 255, .9);
  border-bottom: 0;
}

.maplibregl-popup-content {
  padding: 14px 16px;
  border-radius: 22px;
  background: var(--glass-strong);
  color: var(--ink);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button {
  top: 8px;
  right: 10px;
  border-radius: 50%;
  font-size: 20px;
  color: var(--muted);
}
.maplibregl-popup-close-button:hover { background: none; }
.popup { padding-right: 18px; }
.popup .brand { font-size: 17px; }
.popup .addr { white-space: normal; }
.popup .row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.popup .price { font-size: 19px; padding: 7px 12px; }

/* ---------- Плавающая стеклянная панель вкладок ---------- */
.tabbar {
  position: fixed;
  z-index: 1100;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  width: min(calc(100% - 32px), 380px);
  padding: 6px;
  border-radius: 32px;
  background: var(--glass-strong);
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 0 6px;
  border: 0;
  border-radius: 26px;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: background .25s, color .25s;
}
.tabbar button.active { background: var(--glass-hover); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6); }

/* Если браузер не умеет размывать фон — делаем стекло плотнее, чтобы текст читался */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: rgba(255, 255, 255, .78); --glass-strong: rgba(255, 255, 255, .9); }
  
}
