/* Алкоголикам.ру — минималистичный мобильный дизайн в духе приложений Магнита и Пятёрочки */
:root {
  --bg: #fff;
  --tile: #f2f2f4;
  --text: #1a1a1a;
  --muted: #8b8b90;
  --line: #ededf0;
  --chip: #f1f1f3;
  --accent: #e4002b;
  --magnit: #e30613;
  --magnit-bg: #ffe5e7;
  --five: #1a1a1a;
  --five-bg: #ffdc00;
  --five-net: #16a34a;
  --lenta: #0d3a8f;
  --lenta-bg: #e4ecfb;
  --kb: #8b1538;
  --kb-bg: #f8e4eb;
  --low: #6d36d6;
  --low-bg: #efe8ff;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 60px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); }
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
sup { font-size: .55em; vertical-align: .75em; line-height: 0; margin-left: 1px; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
.btn--ghost { background: var(--chip); color: var(--text); }
.btn[hidden] { display: none; }
.btn--block { display: flex; width: 100%; }

/* ---------- шапка ---------- */
.top { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(10px); }
.top__in { display: flex; align-items: center; gap: 10px; max-width: 1120px; margin: 0 auto; padding: 8px 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 17px; flex: none; }
.has-tabbar .brand span { display: none; }
.top__back { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px; flex: none; }
.search { position: relative; flex: 1; min-width: 0; }
.search__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search__input { width: 100%; height: 44px; padding: 0 12px 0 40px; border: 0; border-radius: 14px; background: var(--chip); outline: none; -webkit-appearance: none; appearance: none; }
.search__input::placeholder { color: var(--muted); }
.search__input:focus { box-shadow: inset 0 0 0 2px var(--text); background: #fff; }
.search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; background: #fff; border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .14); overflow: hidden auto; max-height: 70vh; }
.suggest a { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; }
.suggest a.is-active, .suggest a:hover { background: var(--tile); }
.suggest img { width: 44px; height: 44px; object-fit: contain; mix-blend-mode: multiply; }
.suggest small { display: block; color: var(--muted); font-size: 12px; }
.suggest b { white-space: nowrap; }
.suggest__all { display: block !important; text-align: center; font-weight: 600; color: var(--accent); }
.topnav { display: none; }
.favcount[hidden] { display: none !important; }
.favcount { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
@media (min-width: 900px) {
  .has-tabbar .brand span { display: inline; }
  .topnav { display: flex; align-items: center; gap: 4px; flex: none; }
  .topnav a { display: inline-flex; align-items: center; gap: 4px; padding: 10px 12px; border-radius: 12px; font-weight: 600; color: var(--muted); }
  .topnav a:hover, .topnav a.is-active { color: var(--text); }
  .topnav__city { background: var(--chip); color: var(--text) !important; }
  .topnav__city svg { width: 18px; height: 18px; }
  .search { max-width: 520px; }
}

/* ---------- нижняя панель (как в приложениях) ---------- */
.tabbar { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 500; min-width: 0; }
.tabbar a span { max-width: 100%; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar a.is-active { color: var(--text); }
.tabbar .favcount { position: absolute; top: 5px; left: calc(50% + 6px); }
@media (min-width: 900px) {
  .tabbar { display: none; }
  body.has-tabbar { padding-bottom: 0; }
}

/* ---------- заголовок, вкладки, чипсы ---------- */
.head { padding: 6px 0 12px; }
.head h1 { font-size: 20px; font-weight: 800; }
@media (min-width: 900px) { .head h1 { font-size: 24px; } }
.head p { margin: 4px 0 0; font-size: 13px; }
.tabs { display: flex; gap: 22px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { position: relative; padding: 6px 0 10px; font-weight: 600; color: var(--muted); }
.tabs a.is-active { color: var(--text); }
.tabs a.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px; background: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 20px; background: var(--chip);
  font-weight: 500; white-space: nowrap; }
.chip.is-active { background: var(--text); color: #fff; }
.chip--static { cursor: default; }
@media (min-width: 900px) { .chips { flex-wrap: wrap; margin: 0; padding: 0 0 4px; } }

/* ---------- сортировка и фильтры ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0 12px; }
.sort { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }
.sort select { border: 0; background: none; padding: 8px 0; font-weight: 600; -webkit-appearance: none; appearance: none; cursor: pointer; min-width: 0; text-overflow: ellipsis; }
.filterbtn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 8px 0; font-weight: 600; cursor: pointer; flex: none; }
.filterbtn__n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; }

/* ---------- сетка карточек ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 16px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.card { position: relative; display: flex; flex-direction: column; min-width: 0; }
.card__img { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius); background: var(--tile); overflow: hidden; }
.card__img img, .pp__img img { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; mix-blend-mode: multiply; }
.net { position: absolute; top: 8px; left: 8px; padding: 2px 7px; border-radius: 8px; background: #fff; font-size: 11px; font-weight: 700; }
.net--magnit { color: var(--magnit); }
.net--5ka { color: var(--five-net); }
.net--lenta { color: var(--lenta); }
.net--kb { color: var(--kb); }
.card__badges { position: absolute; left: 8px; bottom: 8px; right: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 12px; font-weight: 700; font-size: 14px; line-height: 1.25; }
.pill--magnit { background: var(--magnit-bg); color: var(--magnit); }
.pill--5ka { background: var(--five-bg); color: var(--five); }
.pill--lenta { background: var(--lenta-bg); color: var(--lenta); }
.pill--kb { background: var(--kb-bg); color: var(--kb); }
.lowbadge { display: inline-block; padding: 2px 8px; border-radius: 10px; background: var(--low-bg); color: var(--low); font-size: 11px; font-weight: 700; }
.newbadge { display: none; padding: 2px 8px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.card.is-new .newbadge { display: inline-block; }
.fav { position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: #1a1a1a; }
.fav svg { fill: none; stroke: currentColor; stroke-width: 1.8; }
.fav[aria-pressed="true"] { color: var(--accent); }
.fav[aria-pressed="true"] svg { fill: currentColor; }
.card__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; margin-top: 10px; }
.card__price b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.card__price s, .pp__price s { color: var(--muted); font-size: 14px; }
.card__name { margin-top: 4px; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__unit { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.card__shop { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 12px; min-width: 0; }
.card__shop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__shop small { flex: none; font-size: 12px; }
/* баннеры (partials/promo): картинка 2:3 на всю карточку — без обрезки, ниже соседей ряда на пару строк;
   card--ad — квадратная картинка + текст как у товара */
.card--banner { display: block; align-self: start; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden; background: var(--tile); }
.card--banner img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card__img--ad img { inset: 0; width: 100%; height: 100%; object-fit: cover; mix-blend-mode: normal; }
.pill--ad { background: var(--magnit-bg); color: var(--accent); }
.loadmore { display: flex; justify-content: center; padding: 24px 0 8px; }
.loadmore .btn { min-width: 200px; }
.loadmore .is-loading { opacity: .5; pointer-events: none; }
.empty { padding: 48px 16px; text-align: center; }
.empty a { color: var(--accent); font-weight: 600; }

/* ---------- шторка фильтров ---------- */
.sheet { width: 100%; max-width: 560px; max-height: 88vh; margin: auto auto 0; padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  border: 0; border-radius: 20px 20px 0 0; background: #fff; color: var(--text); }
.sheet::backdrop { background: rgba(0, 0, 0, .4); }
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 0 6px; font-size: 18px; }
.sheet__close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--chip); font-size: 22px; line-height: 1; cursor: pointer; }
.sheet__label { margin: 16px 0 8px; font-weight: 600; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radios label { position: relative; }
.radios input, .switch input { position: absolute; opacity: 0; pointer-events: none; }
.radios span { display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 19px; background: var(--chip); cursor: pointer; }
.radios input:checked + span { background: var(--text); color: #fff; }
.range { display: flex; gap: 8px; }
.range input { width: 50%; height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--chip); }
.switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; cursor: pointer; }
.switch::after { content: ""; flex: none; width: 46px; height: 28px; border-radius: 14px; background-color: #dcdce0;
  background-image: radial-gradient(circle 11px at 14px 50%, #fff 98%, transparent 100%); transition: background .15s; }
.switch:has(input:checked)::after { background-color: var(--text); background-image: radial-gradient(circle 11px at 32px 50%, #fff 98%, transparent 100%); }
.sheet__btns { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 24px; }

/* ---------- товар ---------- */
.pp { max-width: 1120px; margin: 0 auto; }
.pp__img { position: relative; aspect-ratio: 1; max-height: 62vh; width: 100%; background: var(--tile); overflow: hidden; }
.pp__img .net { top: 12px; left: 16px; }
.pp__img .fav { top: 6px; right: 10px; }
.pp__img .card__badges { left: 16px; bottom: 14px; }
.pp__body { padding: 16px; }
.pp__price { display: flex; align-items: baseline; gap: 10px; }
.pp__price b { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.pp__price s { font-size: 17px; }
.pp__hint { margin: 2px 0 0; font-size: 13px; }
.pp__none { margin: 0; font-weight: 600; color: var(--muted); }
.pp h1 { margin-top: 14px; font-size: 22px; font-weight: 800; }
.pp__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.facts { margin: 0 0 14px; padding: 4px 16px; border-radius: var(--radius); background: var(--tile); }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #e3e3e7; font-size: 14px; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.sect { margin-top: 28px; }
.sect h2 { font-size: 19px; font-weight: 800; }
.sect__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sect__filter { width: 46%; height: 38px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--chip); }
.shoplist { list-style: none; margin: 8px 0 12px; padding: 0; }
.shoplist li { display: grid; grid-template-columns: 1fr auto 20px; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.shoplist__addr { min-width: 0; }
.shoplist small { display: block; color: var(--muted); font-size: 12px; }
.shoplist b { white-space: nowrap; }
.shoplist li.is-best b { color: var(--five-net); }
.shoplist a { color: var(--muted); font-size: 22px; line-height: 1; }
.shoplist.is-collapsed li:nth-child(n+21) { display: none; }
.chart { position: relative; height: 230px; margin-top: 10px; }
@media (min-width: 900px) {
  .pp { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 16px; }
  .pp__img { border-radius: 20px; max-height: none; align-self: start; position: sticky; top: 76px; }
  .pp__body { padding: 0; }
}

/* ---------- главная ---------- */
.home { max-width: 640px; padding-top: 12px; padding-bottom: 24px; }
.home h1 { font-size: 26px; font-weight: 800; }
.home > p { margin: 8px 0 16px; }
.home__search { display: flex; gap: 8px; position: sticky; top: 60px; z-index: 5; background: #fff; padding: 4px 0 8px; }
.home__search input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--chip); outline: none; }
.home__search .btn { min-height: 48px; padding: 0 14px; }
.citylist { list-style: none; margin: 0; padding: 0; }
.citylist a { display: flex; justify-content: space-between; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line); font-size: 17px; }
.citylist a::after { content: "›"; color: var(--muted); font-size: 22px; line-height: 1; }

/* ---------- карта ---------- */
.page-map .foot { display: none; }
.mapbar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; max-width: 1120px; margin: 0 auto; }
.mapbar select { flex: none; height: 40px; padding: 0 30px 0 14px; border: 0; border-radius: 20px; background: var(--chip) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23333' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none; appearance: none; font-weight: 500; }
.map { height: calc(100dvh - 60px - 54px - var(--tabbar-h) - 30px); min-height: 360px; background: var(--tile); }
@media (min-width: 900px) { .map { height: calc(100dvh - 60px - 54px - 30px); } }
.mapinfo { margin: 0; padding: 6px 16px; font-size: 12px; color: var(--muted); text-align: center; }
.balloon { width: min(76vw, 320px); font: 14px/1.35 var(--font); color: #1a1a1a; }
.balloon__head { display: grid; gap: 2px; margin-bottom: 8px; }
.balloon__head .net { position: static; justify-self: start; padding: 0; }
.balloon__head small { color: #8b8b90; }
.balloon__list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.balloon__list li { display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; padding: 8px 0; border-top: 1px solid #eee; }
.balloon__list img { grid-row: span 2; width: 44px; height: 44px; object-fit: contain; }
.balloon__list a { font-size: 13px; }
.balloon .pill { font-size: 12px; padding: 1px 6px; }

/* ---------- подвал, 18+, ошибки ---------- */
.foot { max-width: 1120px; margin: 32px auto 0; padding: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.foot p { margin: 2px 0; }
.foot a { text-decoration: underline; }
.age { width: min(360px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 20px; text-align: center; }
.age::backdrop { background: rgba(0, 0, 0, .55); }
.age p { margin: 0 0 6px; }
.age .btn { margin-top: 10px; }
.age__icon { width: 64px; height: 64px; margin: 0 auto 12px !important; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 20px; }
.errorpage { text-align: center; padding: 60px 0; }
.errorpage__code { font-size: 64px; font-weight: 800; color: var(--accent); line-height: 1; }
.errorpage .btn { margin-top: 12px; }

/* ---------- админка ---------- */
.block { margin-top: 20px; padding: 16px; border-radius: var(--radius); background: var(--tile); }
.block h2 { font-size: 18px; margin-bottom: 8px; }
.others { list-style: none; margin: 0; padding: 0; columns: 2 220px; }
.others li { display: flex; gap: 8px; padding: 4px 0; }
.others li span { flex: 1; }
