:root {
  --bg:      #14161a;
  --card:    #1c2027;
  --card-2:  #232833;
  --text:    #e8eaed;
  --muted:   #8b929e;
  --line:    #2b313c;
  --accent:  #d98324;
  --good:    #4caf72;
  --mid:     #d4a53a;
  --bad:     #c9524a;
  --pad: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 96px;
}

.muted { color: var(--muted); }

/* ---------- шапка ---------- */

.top {
  position: sticky; top: 0; z-index: 5;
  background: rgba(20,22,26,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px var(--pad);
}

.stats { display: flex; gap: 18px; }
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat b { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- сетка ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: var(--pad);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .12s, border-color .12s;
}
.card:active { transform: scale(.975); }
.card.picked { border-color: var(--accent); }

.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--card-2);
  display: grid; place-items: center;
}
/* Картинка кладётся абсолютно по углам блока, а не растягивается процентами.
   Процентная высота считается от блока, чей размер сам берётся из
   aspect-ratio, и на части телефонов не разрешается: вертикальная картинка
   (у Muassel 591×710, у остальных квадрат) тогда вырастает выше квадрата и
   наезжает на текст.
   contain, а не cover: обрезка съедает название на этикетке, по которому
   банка и опознаётся. */
.thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}
.thumb .noimg { color: var(--muted); font-size: 26px; }

.rate {
  position: absolute; left: 6px; top: 6px;
  padding: 2px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 650;
  background: rgba(0,0,0,.66); backdrop-filter: blur(4px);
}
.rate.good { color: #7ee2a8; }
.rate.mid  { color: #f0cf7a; }
.rate.bad  { color: #f09b93; }

.pick {
  position: absolute; right: 6px; top: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #12141a;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}

.info { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.brand { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
         white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name  { font-size: 14px; font-weight: 600; line-height: 1.25; }
.line  { font-size: 11px; color: var(--muted); }

.left { margin-top: auto; padding-top: 8px; }
.barline { height: 4px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.barline i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.grams { margin-top: 5px; font-size: 12px; color: var(--muted); }
.grams b { color: var(--text); font-weight: 600; }

/* ---------- нижняя панель ---------- */

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, transparent);
  display: flex; gap: 8px;
}
.bar.hidden { display: none; }

button {
  font: inherit; border: 0; border-radius: 12px; padding: 13px 16px;
  background: var(--card-2); color: var(--text); cursor: pointer;
}
button:active { opacity: .8; }
button.primary { background: var(--accent); color: #17191d; font-weight: 650; flex: 1; }
button.ghost   { background: transparent; border: 1px solid var(--line); }
button.danger  { background: transparent; border: 1px solid #5a2b2b; color: #f09b93; }
button:disabled { opacity: .45; }

/* ---------- шторка ---------- */

.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; }
/* display у класса перебивает браузерное [hidden]{display:none} —
   без этой строки шторка висит поверх витрины всегда. */
.sheet[hidden] { display: none; }
.sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet-body {
  position: relative; width: 100%;
  max-height: 88vh; overflow-y: auto;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 16px var(--pad) calc(20px + env(safe-area-inset-bottom));
  animation: up .2s ease;
}
@keyframes up { from { transform: translateY(18px); opacity: .6 } }

.sheet h2 { margin: 0 0 2px; font-size: 19px; letter-spacing: -.01em; }
.sheet .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

.hero { display: flex; gap: 13px; margin-bottom: 14px; }
.hero img { width: 92px; height: 92px; border-radius: 12px; object-fit: cover; background: var(--card-2); }
.facts { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.chip { font-size: 12px; padding: 4px 9px; border-radius: 999px;
        background: var(--card-2); color: var(--muted); }

.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.actions button { width: 100%; }

/* Колонки равной ширины: при flex пять звёзд не влезали и пятая обрезалась. */
.opts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 10px 0; }
.opts button { padding-left: 4px; padding-right: 4px; white-space: nowrap; }
.opts button.on { background: var(--accent); color: #17191d; font-weight: 650; }

.row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.row:last-child { border: 0; }

a { color: var(--accent); }

.empty { padding: 60px var(--pad); text-align: center; }
.empty p { margin: 6px 0; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--card-2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; font-size: 14px;
  z-index: 30; animation: up .2s ease;
}

/* ---------- разделы ---------- */

.tabs { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; }
.tab {
  padding: 7px 13px; border-radius: 999px; font-size: 13px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.tab.on { background: var(--card-2); border-color: var(--card-2); color: var(--text); font-weight: 600; }

.sect {
  grid-column: 1 / -1;
  margin: 8px 0 0; font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}

/* ---------- списки: чеки и чаши ---------- */

.list { display: flex; flex-direction: column; gap: 9px; padding: var(--pad); }

.item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 13px; padding: 12px 13px;
}
.item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.item-top b { font-size: 15px; }
.item-top span { font-size: 14px; white-space: nowrap; }

.small { font-size: 12.5px; line-height: 1.45; }
.mt { margin-top: 7px; }

/* ---------- отзыв ---------- */

/* Отзыв приходит вместе со вкусом, поэтому показываем его прямо в карточке:
   ради «что за вкус» открывать сайт не нужно. */
.review {
  margin: 14px 0 4px; padding: 11px 12px;
  background: var(--card-2); border-radius: 11px;
}
.review-head { font-size: 13px; margin-bottom: 6px; color: #f0cf7a; }
.review-head .muted { color: var(--muted); font-size: 12px; margin-left: 6px; }
.review-text { font-size: 13.5px; line-height: 1.5; color: #cfd4dc; }

button.wide { width: 100%; }

input { font: inherit; background: var(--card-2); color: var(--text); border: 1px solid var(--line);
        border-radius: 9px; padding: 7px 10px; width: 92px; }
.row input { text-align: right; }

.item.tap { transition: transform .12s; }
.item.tap:active { transform: scale(.985); }

/* ---------- фильтры поиска ---------- */

.filters { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.sect-wide { grid-column: 1 / -1; }

.filters select {
  font: inherit; width: 100%;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px;
}

.frow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flabel {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; width: 100%;
}

.chip-btn {
  padding: 7px 12px; border-radius: 999px; font-size: 13px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
}
.chip-btn.on { background: var(--accent); border-color: var(--accent);
               color: #17191d; font-weight: 650; }
