/* Палитра по умолчанию — «черничный йогурт». Цвета только через токены
   ниже: остальные темы (client/theme.ts) переопределяют их на <html>, а
   стили не знают, какая тема сейчас. Значения здесь должны совпадать с
   BLUEBERRY в theme.ts — это проверяет тест. */

/* Nunito лежит у нас (OFL, fonts/OFL.txt): CSP 'self', и шрифт не ждёт
   Google Fonts. Адреса с отпечатком подставляет сервер (webapp.ts) */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/static/nunito-cyrillic.733aee5e.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/static/nunito-latin.85deb3a5.woff2") format("woff2");
  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 {
  --bg: #ece4f8;
  --surface: #ffffff;
  --shelf: #f1ecfa;
  --line: #dccef1;
  --berry: #6b4fa8;
  --berry-deep: #4b347f;
  --lavender: #c9b6f0;
  --text: #2b2140;
  --muted: #605476;
  --nav-idle: #6f6487;
  --faint: #8f84a6;
  /* Текст и значки на заливке --berry */
  --on-berry: #ffffff;
  --line-strong: #cdbde8;
  --zone: #f4effb;
  --panel: #f7f4fc;
  --soft: #f6f1fc;
  --soft-line: #efe8fa;
  /* Плашки поверх фото рецепта */
  --glass: rgba(255, 255, 255, 0.92);
  --toast: #4b347f;
  --on-toast: #ffffff;
  --toast-alt: rgba(255, 255, 255, 0.16);
  /* Табличка под иконками продуктов: они нарисованы тёмной обводкой, и в
     тёмной теме табличка остаётся светлой */
  --plate: #ffffff;
  /* Тени и затемнение — тройкой RGB, чтобы прозрачность задавать на месте */
  --shade: 75 52 127;
  --glow: 107 79 168;
  --scrim: 43 33 64;

  /* Свежесть: приглушённые, чтобы не спорить с фиолетовым */
  --ok: #5fb98a;
  --soon: #f2b84b;
  --bad: #e5677d;
  --ice: #6fa8dc;
  --late: #b3aac4;
  --ok-ink: #2f7a52;
  --ok-soft: #e4f4ea;
  --soon-ink: #8a5a00;
  --soon-soft: #fff4d6;
  --soon-line: #f7de9c;
  --soon-deep: #6b4600;
  --soon-mid: #7a5a1e;
  --bad-ink: #b23a52;
  --bad-soft: #fde6ea;
  --danger-soft: #fdecef;
  --danger-line: #f6c9d2;
  --danger-deep: #9e2f45;
  --ice-ink: #2f6699;
  --ice-soft: #e3f0fb;
  --ice-line: #cfe3f5;
  --late-ink: #5f566f;
  --late-soft: #eeebf3;

  /* Хранилища: зелёные ящики холодильника, дерево бакалеи, лёд морозилки */
  --drawer-line: #cdebd5;
  --drawer-bg: #eef8f0;
  --drawer-ink: #2f6b45;
  --wood-line: #ead7b5;
  --wood-shadow: #dcc5a0;
  --wood-bg: #fcf7ee;
  --wood-ink: #6b4600;
  --frost-shadow: #b9d4ee;
  --frost-bg: #eef5fc;
  --frost-ink: #2f4f7a;
  --pets-line: #f3d2c1;
  --pets-shadow: #e5b9a3;
  --pets-bg: #fff4ee;
  --pets-ink: #8a4b2e;
  --pets-soft: #fff0e8;
  --home-line: #c9e6dc;
  --home-shadow: #a9d3c4;
  --home-bg: #eef8f4;
  --home-ink: #2f6b58;
  --home-soft: #e3f3ed;
  --kids-line: #f6d6e4;
  --kids-shadow: #ebb9cf;
  --kids-bg: #fff1f7;
  --kids-ink: #93406a;
  --kids-soft: #fde7f1;
  --produce-line: #d9e8bf;
  --produce-shadow: #bfd59b;
  --produce-bg: #f5f9ec;
  --produce-ink: #4d6b1f;
  --produce-soft: #ecf4dc;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 0 rgb(var(--shade) / 0.08);

  /* Отступы снизу: системная полоса iPhone и то, что сообщает Telegram */
  /* --safe-area-inset-* ставит Capacitor в Android-приложении; в Telegram
     их нет, и они ноль */
  --safe-bottom: max(
    env(safe-area-inset-bottom),
    var(--tg-safe-area-inset-bottom, 0px),
    var(--safe-area-inset-bottom, 0px)
  );
  --safe-top: calc(
    var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) +
      var(--safe-area-inset-top, 0px)
  );

  color-scheme: light;
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.45 "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    sans-serif;
}

body.locked {
  overflow: hidden;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom));
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  color: var(--berry-deep);
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 17px;
  font-weight: 850;
}

p {
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.lead {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spread {
  justify-content: space-between;
}

.grid-2,
.grid-3 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── шапка ─────────────────────────────────────────────────────────── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.logo {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--berry);
  color: var(--on-berry);
  font-size: 22px;
  box-shadow: 0 3px 0 var(--berry-deep);
}

.logo svg {
  width: 26px;
  height: 26px;
}

.logo.big {
  width: 72px;
  height: 72px;
  border-radius: 24px;
}

.logo.big svg {
  width: 46px;
  height: 46px;
}

.brand {
  font-size: 24px;
  font-weight: 900;
  color: var(--berry-deep);
  letter-spacing: -0.01em;
}

.avatar {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--berry-deep);
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 2px 0 var(--line);
  cursor: pointer;
}

.page-title {
  font-size: 22px;
}

/* ── оболочка и нижнее меню ───────────────────────────────────────── */
.shell {
  padding-bottom: calc(96px + var(--safe-bottom));
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  padding: 8px max(8px, calc((100% - 560px) / 2)) calc(10px + var(--safe-bottom));
  background: var(--surface);
  border-top: 2px solid var(--line);
}

body.typing .nav {
  display: none;
}

.nav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 48px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--nav-idle);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.nav-btn.on {
  color: var(--berry);
}

.nav-badge {
  position: absolute;
  top: -4px;
  left: 50%;
  margin-left: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 14px;
  text-align: center;
}

.nav-add-cell {
  display: flex;
  justify-content: center;
}

.nav-add {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-top: -26px;
  border: 4px solid var(--surface);
  border-radius: 22px;
  background: var(--berry);
  color: var(--on-berry);
  box-shadow: 0 4px 0 var(--berry-deep), 0 8px 18px rgb(var(--glow) / 0.35);
  cursor: pointer;
}

.nav-add:active {
  transform: translateY(2px);
}

/* ── переключатель ─────────────────────────────────────────────────── */
.segmented {
  display: grid;
  gap: 4px;
  padding: 4px;
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 2px 0 var(--line);
}

.segmented button {
  padding: 9px 4px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--berry-deep);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.segmented button.on {
  background: var(--berry);
  color: var(--on-berry);
}

/* ── мини-карта хранилищ ──────────────────────────────────────────── */
.storage-map {
  display: grid;
  gap: 8px;
}

.storage-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 10px 9px;
  border: 2px solid var(--surface);
  border-radius: 18px;
  background: var(--surface);
  color: var(--berry-deep);
  box-shadow: 0 3px 0 var(--line);
  text-align: left;
  cursor: pointer;
}

.storage-tile.on {
  border-color: var(--berry);
  background: var(--berry);
  color: var(--on-berry);
  box-shadow: 0 3px 0 var(--berry-deep);
}

.storage-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 20px;
}

.urgent {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bad-soft);
  color: var(--bad-ink);
  font-size: 11px;
  font-weight: 800;
}

.storage-tile-count {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.storage-tile-title {
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── «Надо доесть» ────────────────────────────────────────────────── */
.eat-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--soon-line);
  border-radius: 16px;
  background: var(--soon-soft);
  color: var(--soon-ink);
  text-align: left;
  cursor: pointer;
}

.eat-banner-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--soon);
  color: #fff;
}

.eat-banner-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.eat-banner-text b {
  color: var(--soon-deep);
  font-size: 14px;
  font-weight: 900;
}

.eat-banner-text span {
  color: var(--soon-mid);
  font-size: 12px;
  font-weight: 650;
}

.hint {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  box-shadow: 0 2px 0 var(--line);
}

.hint b {
  color: var(--berry-deep);
}

/* ── корпус хранилища ─────────────────────────────────────────────── */
.storage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 3px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--line-strong);
}

.storage-pantry {
  border-color: var(--wood-line);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--wood-shadow);
}

.storage-freezer {
  border-color: var(--ice-line);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--frost-shadow);
}

.storage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.storage-name {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.storage-note {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ice-soft);
  color: var(--ice-ink);
  font-size: 11px;
  font-weight: 800;
}

.storage-pantry .storage-note {
  background: var(--soon-soft);
  color: var(--soon-mid);
}

.storage-grid {
  display: grid;
  gap: 8px;
}

.storage-grid.with-door {
  grid-template-columns: minmax(0, 1fr) 88px;
}

.storage-inside {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Полка и ящик. Цвета — по хранилищу: сиреневые полки холодильника,
   деревянные бакалеи, ледяные ящики морозилки */
.zone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 8px 9px;
  border-radius: 14px;
  background: var(--zone);
  border-bottom: 3px solid var(--line);
}

.zone-drawer {
  border: 2px solid var(--drawer-line);
  border-radius: 16px;
  background: var(--drawer-bg);
}

.storage-pantry .zone {
  border-radius: 12px;
  background: var(--wood-bg);
  border-bottom: 4px solid var(--wood-line);
}

.storage-pantry .zone-drawer {
  border: 2px solid var(--wood-line);
}

.storage-freezer .zone,
.storage-freezer .zone-drawer {
  border: 2px solid var(--ice-line);
  border-radius: 16px;
  background: var(--frost-bg);
}

.zone-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}

.zone-title {
  color: var(--berry-deep);
  font-size: 12px;
  font-weight: 900;
}

.zone-drawer .zone-title {
  color: var(--drawer-ink);
}

.storage-pantry .zone-title {
  color: var(--wood-ink);
}

.storage-freezer .zone-title {
  color: var(--frost-ink);
}

.zone-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.zone-handle {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--drawer-line);
}

.storage-freezer .zone-handle {
  background: var(--ice-line);
}

.storage-pantry .zone-handle {
  background: var(--wood-line);
}

/* Не влезло в ряд — ложится рядом ниже на той же полке, а не уезжает
   вбок за край, где его не видно (просьба пользователя 19.10) */
.zone-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 4px;
  min-height: 82px;
}

.zone-empty {
  align-self: center;
  padding: 0 4px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

/* Дверь холодильника: узкая колонка справа, стикеры столбиком */
.storage-door {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.door-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.door-zone .zone-title {
  font-size: 11px;
  text-align: center;
}

.door-rail {
  width: 70%;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
}

/* ── стикер продукта ──────────────────────────────────────────────── */
.tone-ok {
  --ring: var(--ok);
  --ink: var(--ok-ink);
  --pill: var(--ok-soft);
}

.tone-soon {
  --ring: var(--soon);
  --ink: var(--soon-ink);
  --pill: var(--soon-soft);
}

.tone-bad {
  --ring: var(--bad);
  --ink: var(--bad-ink);
  --pill: var(--bad-soft);
}

.tone-ice {
  --ring: var(--ice);
  --ink: var(--ice-ink);
  --pill: var(--ice-soft);
}

.tone-level {
  --ring: var(--lavender);
  --ink: var(--berry-deep);
  --pill: var(--shelf);
}

.tone-late {
  --ring: var(--late);
  --ink: var(--late-ink);
  --pill: var(--late-soft);
}

.sticker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: none;
  width: 60px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  /* Долгое нажатие — выделение, а не меню «Сохранить картинку» */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Выделен для действий пачкой: обводка цветом темы и галочка в углу */
.sticker.selected .sticker-face {
  outline: 3px solid var(--berry);
  outline-offset: 2px;
}

.sticker.selected::after {
  content: "✓";
  position: absolute;
  top: -6px;
  right: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--berry);
  color: var(--on-berry);
  font-size: 12px;
  font-weight: 900;
}

.sticker-face {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 3px solid var(--ring);
  border-radius: 16px;
  background: var(--plate);
  box-shadow: 0 2px 0 rgb(var(--shade) / 0.1);
}

.sticker-face img {
  width: 32px;
  height: 32px;
}

.sticker:active .sticker-face {
  transform: scale(0.94);
}

.sticker-label {
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

/* Две строки, длинное слово — с переносом. Высота — всегда на две строки,
   чтобы ряд стикеров не прыгал */
.sticker-name {
  display: -webkit-box;
  width: 100%;
  min-height: 2.2em;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.item-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border: 3px solid var(--ring);
  border-radius: 15px;
  background: var(--plate);
}

.item-icon img {
  width: 30px;
  height: 30px;
}

.item-icon.lg {
  width: 76px;
  height: 76px;
  border-width: 4px;
  border-radius: 22px;
  box-shadow: 0 3px 0 var(--line);
}

.item-icon.lg img {
  width: 50px;
  height: 50px;
}

.item-icon.plus {
  color: var(--berry);
  font-size: 22px;
  font-weight: 900;
}

.pill {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.ok {
  background: var(--ok);
}

.dot.soon {
  background: var(--soon);
}

.dot.bad {
  background: var(--bad);
}

.dot.ice {
  background: var(--ice);
}

/* ── карточки и списки ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card.tinted {
  background: var(--shelf);
}

.list-card {
  display: flex;
  flex-direction: column;
  padding: 6px 12px;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 2px 0 var(--line);
}

.list-card.flat {
  padding: 2px 10px;
  box-shadow: none;
  border: 2px solid var(--shelf);
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--shelf);
  background: none;
  text-align: left;
  cursor: pointer;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row .pill {
  align-self: center;
  white-space: nowrap;
}

.list-row-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.list-row-text b {
  font-size: 15px;
  font-weight: 800;
}

.list-row-text span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.empty-card,
.soft-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 2px 0 var(--line);
}

.empty-card b,
.soft-card b {
  color: var(--berry-deep);
  font-size: 16px;
  font-weight: 900;
}

.soft-card {
  background: var(--shelf);
  box-shadow: none;
}

/* ── покупки ──────────────────────────────────────────────────────── */
.add-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-row .field {
  flex: 1;
  min-width: 0;
}

.unit {
  color: var(--muted);
  font-weight: 800;
}

.shop-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 2px 0 var(--line);
}

.shop-group-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 7px 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.checkbox {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--lavender);
  border-radius: 9px;
  background: var(--surface);
  color: #fff;
}

.shop-row.done .checkbox {
  border-color: var(--ok);
  background: var(--ok);
}

/* Фото пачки рядом с пунктом: в магазине видно, какую брать */
.item-icon.shop-pic {
  --ring: var(--line);
  width: 44px;
  height: 44px;
  border-width: 2px;
  border-radius: 13px;
}

.item-icon.shop-pic img {
  width: 28px;
  height: 28px;
}

.item-icon.shop-pic img.photo {
  border-radius: 11px;
}

.shop-row.done .shop-pic {
  opacity: 0.5;
}

.shop-row-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.shop-row-text b {
  font-weight: 800;
}

.shop-row-text span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.shop-row.done b {
  color: var(--muted);
  text-decoration: line-through;
}

.shop-price {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ── деньги: плашки в «Покупках» и лист «Расходы» ─────────────────── */
.money-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.money-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 2px 0 var(--line);
  text-align: left;
}

.money-tile.open {
  cursor: pointer;
}

.money-tile-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.money-tile b {
  color: var(--berry-deep);
  font-size: 22px;
  font-weight: 900;
}

.money-tile-sub {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.money-tile-sub svg {
  margin-left: auto;
  color: var(--berry);
}

.money-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.money-nav b {
  color: var(--berry-deep);
  font-size: 17px;
  font-weight: 850;
}

.money-nav-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  background: var(--shelf);
  color: var(--berry);
  cursor: pointer;
}

.money-nav-btn.back svg {
  transform: scaleX(-1);
}

.money-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.money-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
}

.money-hero b {
  color: var(--berry-deep);
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.money-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.money-section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.money-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.money-bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
}

.money-bar-head .muted {
  margin-left: 4px;
  font-size: 12px;
}

.money-sum {
  flex: none;
  color: var(--text);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

/* Полоска тонкая и одного цвета: сумма написана рядом, полоска только
   помогает сравнить строки на глаз */
.money-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--shelf);
}

.money-bar-fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--berry);
}

/* Чек ждёт ФНС: сумма известна, на что — нет */
.money-bar-fill.waiting {
  background: var(--late);
}

.money-top .money-sum {
  font-size: 14px;
}

/* ── кнопки ────────────────────────────────────────────────────────── */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 800;
  background: var(--berry);
  color: var(--on-berry);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 3px 0 var(--berry-deep);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--berry-deep);
}

.btn.soft {
  background: var(--shelf);
  color: var(--berry-deep);
  box-shadow: 0 3px 0 var(--line);
}

.btn.outline {
  background: var(--surface);
  color: var(--berry-deep);
  border: 2px solid var(--line);
  box-shadow: none;
}

.btn.outline.pressed {
  border-color: var(--berry);
  background: var(--shelf);
}

.btn.outline.ice {
  border-color: var(--ice-line);
  color: var(--ice-ink);
}

.btn.danger {
  background: var(--danger-soft);
  color: var(--bad-ink);
  box-shadow: 0 3px 0 var(--danger-line);
}

.btn.small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 11px;
}

.btn.wide {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
}

.link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--berry);
  font-weight: 800;
  cursor: pointer;
}

.danger-text {
  color: var(--bad-ink);
}

/* «Понимаю, что вернуть нельзя» перед «Стереть всё» */
.erase-sure {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.erase-sure input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--danger-deep);
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--shelf);
  color: var(--berry-deep);
  cursor: pointer;
}

.icon-btn:disabled {
  opacity: 0.35;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  min-height: 36px;
  padding: 6px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--berry-deep);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.chip.on {
  border-color: var(--berry);
  background: var(--berry);
  color: var(--on-berry);
}

.chip:disabled:not(.on) {
  opacity: 0.5;
}

/* ── лист снизу ───────────────────────────────────────────────────── */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgb(var(--scrim) / 0.38);
  animation: fade 0.18s ease;
}

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  max-height: calc(var(--tg-viewport-stable-height, 100vh) - 24px);
  margin: 0 auto;
  padding: 10px 16px calc(24px + var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  animation: rise 0.22s ease;
}

.sheet-grip {
  align-self: center;
  flex: none;
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
}

.sheet-title {
  font-size: 20px;
  font-weight: 900;
}

@keyframes rise {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet-backdrop,
  .toast {
    animation: none;
  }
}

/* Лист продукта */
.item-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.item-head-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.qty {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qty-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
}

.qty-head b,
.qty-head .link {
  color: var(--berry-deep);
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--shelf);
}

.bar div {
  height: 100%;
  border-radius: 999px;
  background: var(--berry);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
}

.panel-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-title {
  color: var(--berry-deep);
  font-size: 13px;
  font-weight: 900;
}

.item-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--shelf);
}

.item-foot .link {
  flex: none;
  white-space: nowrap;
}

/* Добавление */
.big-action {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 0;
  border-radius: 20px;
  background: var(--shelf);
  color: var(--berry-deep);
  box-shadow: 0 4px 0 var(--line);
  text-align: left;
  cursor: pointer;
}

.big-action.primary {
  background: var(--berry);
  color: var(--on-berry);
  box-shadow: 0 4px 0 var(--berry-deep);
}

.big-action b {
  font-size: 16px;
  font-weight: 900;
}

.big-action.wide {
  width: 100%;
}

.big-action span {
  font-size: 12px;
  font-weight: 650;
  opacity: 0.9;
}

.big-action:disabled {
  opacity: 0.55;
  cursor: default;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  outline: 0;
  background: none;
}

.search:focus-within {
  border-color: var(--berry);
}

.section-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  border: 2px solid var(--soft-line);
  border-radius: 16px;
  background: var(--soft);
  color: var(--berry-deep);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.quick img {
  width: 36px;
  height: 36px;
}

.quick:active {
  transform: scale(0.95);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-field > span:first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

/* ── тост ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 32px);
  max-width: 528px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--toast);
  color: var(--on-toast);
  box-shadow: 0 8px 24px rgb(var(--scrim) / 0.25);
  transform: translateX(-50%);
  animation: rise 0.2s ease;
  /* Смахивание обрабатываем сами (ui.tsx), браузер не должен прокручивать.
     Смещение идёт через translate, чтобы не ломать translateX(-50%) */
  touch-action: none;
  user-select: none;
  cursor: pointer;
}

.toast.error {
  background: var(--danger-deep);
}

.toast-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.toast-text b {
  font-weight: 900;
}

.toast-text span {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
}

.toast-action {
  flex: none;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--on-toast);
  color: var(--toast);
  font-weight: 900;
  cursor: pointer;
}

/* ── настройки ─────────────────────────────────────────────────────── */
.zone-editor {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 6px;
}

.zone-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--berry-deep);
}

.zone-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--shelf);
}

/* Строку тащат за ручку: на ней прокрутка не нужна, жест — сразу её */
.sort-handle {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--faint);
  font-size: 22px;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.zone-row.sorting {
  position: relative;
  z-index: 1;
  border-radius: 12px;
  background: var(--soft);
  box-shadow: 0 6px 16px rgb(var(--shade) / 0.18);
}

.zone-row.sorting .sort-handle {
  color: var(--berry);
}

.zone-row-main.static {
  cursor: default;
}

.zone-row-main .with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.zone-row-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 6px 0;
  border: 0;
  background: none;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.zone-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel);
}

.add-zone {
  align-self: flex-start;
}

.with-icon {
  gap: 8px;
}

/* ── разделы на будущее ───────────────────────────────────────────── */
.soon {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 3px 0 var(--line);
}

.soon-glyph {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--shelf);
  color: var(--berry);
}

.soon ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.soon .badge {
  align-self: flex-start;
}

/* ── заставка ──────────────────────────────────────────────────────── */
.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 70vh;
  text-align: center;
}

.splash-error {
  max-width: 320px;
  color: var(--berry-deep);
  font-weight: 700;
}

/* ── без семьи: создать, войти по приглашению, свой ID ─────────────── */
.shell.welcome {
  padding-top: 8px;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.welcome-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.id-value {
  color: var(--berry-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.code-field {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

/* ── семья в настройках ───────────────────────────────────────────── */
.member {
  border-top: 1px solid var(--line);
}

.member:first-child {
  border-top: 0;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.member-row:disabled {
  cursor: default;
}

.member-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.member-actions {
  padding-bottom: 10px;
}

.invite-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--shelf);
}

.invite-box .id-value {
  font-size: 20px;
  letter-spacing: 0.08em;
}

/* ── общее для обеих страниц ──────────────────────────────────────── */
.list {
  display: flex;
  flex-direction: column;
}

.list > .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.list > .item:first-child {
  border-top: 0;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--shelf);
  color: var(--berry-deep);
  font-size: 12px;
  font-weight: 700;
}

.error {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger-deep);
}

.field {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  font: inherit;
  color: var(--text);
}

.field:focus {
  outline: 0;
  border-color: var(--berry);
}

.field.date {
  width: auto;
  min-height: 36px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

/* ── проверка камеры ───────────────────────────────────────────────── */
.viewfinder {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #1d1530;
  aspect-ratio: 3 / 4;
}

.viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.viewfinder .frame {
  position: absolute;
  inset: 28% 12%;
  border: 3px solid var(--lavender);
  border-radius: 16px;
  box-shadow: 0 0 0 999px rgba(29, 21, 48, 0.35);
}

.viewfinder .hit {
  border-color: var(--ok);
}

.diag {
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
}

.scan {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--shelf);
}

.scan b {
  color: var(--berry-deep);
}

.ok-text {
  color: var(--ok-ink);
}

.bad-text {
  color: var(--bad-ink);
}

input[type="file"] {
  display: none;
}

.field.engine {
  max-width: 140px;
  padding: 9px 10px;
}

/* ── фото упаковки ─────────────────────────────────────────────────── */
/* Фото из интернета рядом с плоскими иконками не спорят, если сидят в
   скруглённой рамке на белом: так и задумано в макете */
.sticker-face {
  position: relative;
  overflow: hidden;
}

.sticker-face img.photo,
.item-icon img.photo,
.toast-picture img.photo {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.item-icon {
  overflow: hidden;
}

.item-icon.lg img.photo {
  border-radius: 17px;
}

/* Открытое — маленькая метка в углу: видно с первого взгляда, что
   пачку уже начали */
.sticker-mark {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--berry);
}

/* Только что положили или вернули */
.sticker.fresh .sticker-face {
  animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1), glow 2.4s ease-out;
}

@keyframes pop {
  0% {
    transform: scale(0.6);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes glow {
  0%,
  60% {
    box-shadow: 0 0 0 5px rgb(var(--glow) / 0.35);
  }
  100% {
    box-shadow: 0 2px 0 rgb(var(--shade) / 0.1);
  }
}

/* ── тост с картинкой и кнопками ──────────────────────────────────── */
.toast {
  flex-wrap: wrap;
}

.toast-picture {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}

.toast-picture img {
  width: 28px;
  height: 28px;
}

.toast-text {
  flex-basis: 140px;
}

.toast-action + .toast-action {
  margin-left: -4px;
  background: var(--toast-alt);
  color: var(--on-toast);
}

/* ── сканер ────────────────────────────────────────────────────────── */
.viewfinder.live {
  aspect-ratio: 4 / 3;
}

.viewfinder.live .frame {
  inset: 22% 10%;
  transition: border-color 0.15s ease;
}

.viewfinder-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.torch {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(29, 21, 48, 0.55);
  color: #fff;
  cursor: pointer;
}

.torch.on {
  background: var(--soon);
  color: #3d2a00;
}

.scan-wait {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--shelf);
  border-top-color: var(--berry);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.scan-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.scan-card-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.scan-card-text b {
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.2;
}

.scan-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scan-facts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--shelf);
  color: var(--berry-deep);
  font-size: 13px;
  font-weight: 800;
}

.scan-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* Что сейчас отсканировалось. Высота постоянная, чтобы кнопки под ней не
   прыгали на каждом товаре */
.scan-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 8px 12px;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 0 var(--line);
  animation: pop-in 0.22s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.scan-notice.idle {
  justify-content: center;
  text-align: center;
  background: none;
  box-shadow: none;
  animation: none;
}

.scan-notice.ok {
  background: var(--ok-soft);
}

.scan-notice.soon {
  background: var(--soon-soft);
}

.scan-notice.bad {
  color: var(--bad-ink);
  font-size: 14px;
  font-weight: 800;
}

.scan-notice .spinner {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

.scan-notice .btn {
  flex: none;
  min-height: 40px;
  padding: 8px 12px;
}

@keyframes pop-in {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
}

/* Строка списка с кнопкой «убрать» справа: сама строка открывает продукт */
.list-row-main {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.list-row-text .doubt {
  color: var(--soon-ink);
  font-weight: 800;
}

.btn.big {
  min-height: 54px;
  font-size: 17px;
}

label.btn {
  position: relative;
}

/* ── питомцы ───────────────────────────────────────────────────────── */
.storage-pets {
  border-color: var(--pets-line);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--pets-shadow);
}

.storage-pets .zone {
  border-radius: 14px;
  background: var(--pets-bg);
  border-bottom: 3px solid var(--pets-line);
}

.storage-pets .zone-title {
  color: var(--pets-ink);
}

.storage-pets .storage-note {
  background: var(--pets-soft);
  color: var(--pets-ink);
}

/* ── овощи и фрукты: корзина на кухне ──────────────────────────────── */
.storage-produce {
  border-color: var(--produce-line);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--produce-shadow);
}

.storage-produce .zone {
  border-radius: 14px;
  background: var(--produce-bg);
  border-bottom: 3px solid var(--produce-line);
}

.storage-produce .zone-title,
.storage-produce .storage-note {
  color: var(--produce-ink);
}

.storage-produce .storage-note {
  background: var(--produce-soft);
}

/* ── для дома и детское ────────────────────────────────────────────── */
.storage-home {
  border-color: var(--home-line);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--home-shadow);
}

.storage-home .zone {
  border-radius: 14px;
  background: var(--home-bg);
  border-bottom: 3px solid var(--home-line);
}

.storage-home .zone-title,
.storage-home .storage-note {
  color: var(--home-ink);
}

.storage-home .storage-note {
  background: var(--home-soft);
}

.storage-kids {
  border-color: var(--kids-line);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--kids-shadow);
}

.storage-kids .zone {
  border-radius: 14px;
  background: var(--kids-bg);
  border-bottom: 3px solid var(--kids-line);
}

.storage-kids .zone-title,
.storage-kids .storage-note {
  color: var(--kids-ink);
}

.storage-kids .storage-note {
  background: var(--kids-soft);
}

/* Четыре хранилища — плитки в строку: значок, число, название */
.storage-map.many .storage-tile {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
}

.storage-map.many .storage-tile-top {
  display: contents;
}

.storage-map.many .storage-tile-top .urgent {
  order: 4;
}

.storage-map.many .storage-tile-count {
  order: 2;
  font-size: 19px;
}

.storage-map.many .storage-tile-title {
  order: 3;
}

/* ── рецепты ───────────────────────────────────────────────────────── */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.recipe-picture {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--shelf);
  color: var(--lavender);
}

.recipe-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-picture.big {
  height: 150px;
}

.recipe-picture.small {
  height: 84px;
  border-radius: 14px;
}

.recipe-picture.row {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.recipe-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 3px 0 var(--line);
  text-align: left;
  cursor: pointer;
}

.recipe-card-photo {
  position: relative;
}

.recipe-badge {
  position: absolute;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.recipe-badge.saves {
  top: 10px;
  right: 10px;
  max-width: 70%;
  overflow: hidden;
  background: var(--soon-soft);
  color: var(--soon-deep);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-badge.fav {
  top: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  padding: 5px;
  background: var(--glass);
  color: var(--bad);
}

.recipe-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.recipe-card-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.recipe-card-title b {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
}

.recipe-card-title .muted {
  flex: none;
  white-space: nowrap;
}

.chips.small {
  gap: 5px;
}

.chips.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips.scroll .chip {
  flex: none;
}

.ingredient-chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--shelf);
  color: var(--berry-deep);
  font-size: 12px;
  font-weight: 800;
}

.ingredient-chip.saves {
  background: var(--soon-soft);
  color: var(--soon-deep);
}

.ingredient-chip.missing {
  background: var(--bad-soft);
  color: var(--bad-ink);
}

.buy-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 3px 0 var(--line);
}

.buy-card-open {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.buy-card-open b {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}

.buy-card .missing {
  color: var(--bad-ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

.recipe-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--shelf);
  background: none;
  color: var(--bad);
  text-align: left;
  cursor: pointer;
}

.recipe-row:last-child {
  border-bottom: 0;
}

.recipe-row .list-row-text b {
  color: var(--text);
}

/* «Из этого можно приготовить» под списком «Доесть» */
.rescue-title {
  margin: 0;
  font-size: 18px;
}

.rescue-card {
  padding-top: 4px;
  padding-bottom: 4px;
}

/* Лист рецепта */
.recipe-hero {
  overflow: hidden;
  flex: none;
  height: 200px;
  margin: -2px -4px 0;
  border-radius: 20px;
  background: var(--shelf);
}

.recipe-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.fav {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--line);
  cursor: pointer;
}

.fav.on {
  border-color: var(--bad-soft);
  background: var(--bad-soft);
  color: var(--bad);
}

.recipe-description {
  color: var(--muted);
  font-size: 14px;
}

.recipe-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recipe-block > b,
.recipe-block-head b {
  color: var(--berry-deep);
  font-size: 16px;
  font-weight: 900;
}

.recipe-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.recipe-line {
  border-bottom: 1px solid var(--shelf);
}

.recipe-line-main {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.recipe-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.state-have .recipe-dot {
  background: var(--ok);
}

.state-saves .recipe-dot {
  background: var(--soon);
}

/* Вода, соль, перец не в запасах: не «нет», а «не считаем» — кольцо */
.state-always .recipe-dot {
  background: none;
  box-shadow: inset 0 0 0 2px var(--ok);
}

.state-missing .recipe-dot {
  background: var(--bad);
}

/* Есть, но мало: наполовину «есть», наполовину «докупить» */
.state-little .recipe-dot {
  background: linear-gradient(90deg, var(--ok) 50%, var(--bad) 50%);
}

.recipe-line-name {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  font-weight: 800;
}

.recipe-line-name small,
.recipe-line-amount small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.state-missing .recipe-line-name small,
.state-little .recipe-line-name small {
  color: var(--bad-ink);
}

.state-saves .recipe-line-name small {
  color: var(--soon-ink);
}

.recipe-line-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: none;
  max-width: 45%;
  color: var(--berry-deep);
  font-weight: 800;
  text-align: right;
}

.recipe-line.disliked .recipe-line-name {
  color: var(--muted);
  text-decoration: line-through;
}

.recipe-line-actions {
  padding: 0 0 10px 20px;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 0;
  padding-left: 22px;
}

.steps li::marker {
  color: var(--berry);
  font-weight: 900;
}

/* ── лента «Фото» ──────────────────────────────────────────────────── */
.match-button {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  /* Длинная подпись слева не должна ломать кнопку на две строки */
  flex-shrink: 0;
  white-space: nowrap;
  cursor: pointer;
}

/* Улетевшая вправо карточка не должна растягивать страницу вбок: режем
   по краям экрана (поля #app — внутри), а не по краям стопки, иначе
   карточку обрезало бы ещё в руке. hidden — для старых WebView без clip */
.feed-screen {
  margin: 0 -16px;
  padding: 0 16px;
  overflow-x: hidden;
  overflow-x: clip;
}

.feed-stack {
  position: relative;
  height: min(480px, calc(var(--tg-viewport-stable-height, 100vh) - 300px));
  min-height: 360px;
}

/* Пружинка с лёгким перелётом: недотянутая карточка возвращается на
   место, следующая выезжает вперёд */
.feed-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 6px 0 var(--line-strong), 0 14px 30px rgb(var(--shade) / 0.18);
  transition: transform 0.45s cubic-bezier(0.22, 1.25, 0.36, 1), opacity 0.3s ease;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.feed-card[data-depth="0"] {
  z-index: 3;
  will-change: transform;
}

/* Сдвиг, масштаб и прозрачность — те же, что BEHIND_* в feed.tsx */
.feed-card[data-depth="1"] {
  z-index: 2;
  transform: translate3d(0, 20px, 0) scale(0.94);
  opacity: 0.75;
  box-shadow: 0 4px 0 var(--line-strong);
  pointer-events: none;
}

/* Третья не видна, но уже лежит с фото — выезжает без мигания */
.feed-card[data-depth="2"] {
  z-index: 1;
  transform: translate3d(0, 40px, 0) scale(0.88);
  opacity: 0;
  pointer-events: none;
}

.feed-card.flying {
  z-index: 4;
  transition: none;
  pointer-events: none;
  will-change: transform;
}

/* Пока тянут, карточки идут за пальцем без задержки */
.feed-stack.dragging .feed-card,
.feed-stack.dragging .stamp {
  transition: none;
}

.feed-card.done {
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  cursor: default;
}

.feed-card.done b {
  color: var(--berry-deep);
  font-size: 20px;
  font-weight: 900;
}

.feed-photo {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 150px;
  overflow: hidden;
  background: var(--shelf);
  color: var(--lavender);
}

/* Фото — поверх блока, а не внутри потока: height: 100% в grid считается
   от самой картинки, и вертикальное фото вылезало вниз, закрывая название
   и ингредиенты (отзыв Кати 17.10 — «обрезает текст») */
.feed-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.feed-badge {
  position: absolute;
  top: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--glass);
  color: var(--berry-deep);
  font-size: 12px;
  font-weight: 900;
}

.feed-badge.left {
  left: 14px;
}

.feed-badge.right {
  right: 14px;
}

.feed-badge.full {
  background: var(--ok-soft);
  color: var(--ok-ink);
}

/* Спасает продукт из «Доесть» — внизу фото, цветом «скоро пропадёт» */
.feed-badge.saves {
  top: auto;
  bottom: 14px;
  left: 14px;
  max-width: calc(100% - 28px);
  overflow: hidden;
  background: var(--soon-soft);
  color: var(--soon-deep);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stamp {
  position: absolute;
  top: 64px;
  padding: 2px 12px;
  border: 4px solid;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 26px;
  font-weight: 900;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.stamp.like {
  left: 20px;
  color: #2f7a52;
  transform: rotate(-14deg);
}

.stamp.nope {
  right: 20px;
  color: #b23a52;
  transform: rotate(14deg);
}

.stamp.cook {
  top: 38%;
  left: 50%;
  color: #a86a12;
  transform: translateX(-50%) rotate(-8deg);
}

.feed-info {
  position: relative;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}

/* Карточка фиксированной высоты: длинное название и список ингредиентов
   выдавливали фото и сами уходили за край. Теперь текст режется по
   строкам с многоточием, а целиком всё — в рецепте по тапу */
.feed-info b {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.15;
}

.feed-info span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.feed-info .feed-missing,
.feed-info .feed-have {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.3;
}

.feed-info .feed-missing {
  color: var(--bad-ink);
  font-weight: 800;
}

.feed-info .fan {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bad-soft);
  color: var(--bad-ink);
  font-size: 12px;
  font-weight: 900;
}

.feed-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

.round {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--line);
  transition: transform 0.15s cubic-bezier(0.22, 1.25, 0.36, 1);
  cursor: pointer;
}

.round.nope {
  color: var(--bad);
}

.round.cook {
  width: 52px;
  height: 52px;
  color: #e0a22e;
}

.round.like {
  background: var(--berry);
  color: #fff;
  box-shadow: 0 4px 0 var(--berry-deep);
}

.round:active {
  transform: translateY(2px) scale(0.92);
}

/* ── «Новинки» ─────────────────────────────────────────────────────── */
.season {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 3px 0 var(--line);
}

.season-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.season-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--berry-deep);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.season-item img {
  width: 34px;
  height: 34px;
}

.news-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--shelf);
  background: none;
  text-align: left;
  cursor: pointer;
}

.news-row:last-child {
  border-bottom: 0;
}

.news-row:disabled {
  cursor: default;
}

.news-row b {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.news-kind {
  color: var(--berry);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.news-kind.match {
  color: var(--bad-ink);
}

.news-kind.base {
  color: var(--ok-ink);
}

.chip-icon {
  width: 18px;
  height: 18px;
  vertical-align: -4px;
}

/* Срок из прошлого: «это дата изготовления?» */
.past-date {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--soon-soft);
  color: var(--soon-deep);
  font-size: 13px;
  font-weight: 700;
}

/* ── ачивки ───────────────────────────────────────────────────────── */
/* Рамка значка — цвет уровня, как медали в играх */
:root {
  --bronze: #d08b4e;
  --silver: #b4bacb;
  --gold: #f2c94c;
}

.trophy {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--berry-deep);
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 2px 0 var(--line);
  cursor: pointer;
}

.trophy svg {
  color: #c99a1c;
}

.trophy-dot {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bad);
  border: 2px solid var(--surface);
}

.ach-head .row {
  justify-content: space-between;
}

.ach-count {
  color: var(--berry);
  font-size: 15px;
  font-weight: 900;
}

.ach-head .muted {
  margin-top: 8px;
}

.ach-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ach-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 12px 6px 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.ach-cell:active {
  transform: translateY(1px);
}

.ach-title {
  color: var(--berry-deep);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.ach-cell.locked .ach-title {
  color: var(--muted);
}

.ach-badge {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid var(--tier, var(--line));
  background: var(--shelf);
  box-shadow: 0 3px 0 rgb(var(--shade) / 0.15);
}

.ach-badge img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.ach-badge.sm {
  width: 52px;
  height: 52px;
  border-width: 3px;
}

.ach-badge.lg {
  width: 148px;
  height: 148px;
  border-width: 6px;
}

.tier-bronze {
  --tier: var(--bronze);
}

.tier-silver {
  --tier: var(--silver);
}

.tier-gold {
  --tier: var(--gold);
}

/* Неоткрытая — серый силуэт: видно, кто на картинке, но не в цвете */
.ach-badge.tier-locked img {
  filter: grayscale(1) contrast(0.7) brightness(1.15);
  opacity: 0.45;
}

.ach-secret {
  color: var(--lavender);
  font-size: 30px;
  font-weight: 1000;
}

.ach-badge.lg .ach-secret {
  font-size: 64px;
}

.ach-level {
  position: absolute;
  bottom: -8px;
  min-width: 26px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--tier, var(--line));
  color: var(--berry-deep);
  font-size: 11px;
  font-weight: 1000;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 2px 0 rgb(var(--shade) / 0.18);
}

.ach-badge.lg .ach-level {
  bottom: -12px;
  padding: 2px 10px;
  font-size: 15px;
}

.ach-bar {
  display: block;
  width: 100%;
  max-width: 76px;
  height: 6px;
  border-radius: 999px;
  background: var(--shelf);
  overflow: hidden;
}

.ach-bar.big {
  max-width: none;
  height: 10px;
  margin-top: 10px;
}

.ach-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lavender), var(--berry));
}

.ach-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 4px 0 14px;
}

.ach-quip {
  color: var(--muted);
  font-style: italic;
  font-weight: 700;
  text-align: center;
}

.ach-levels {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.ach-levels li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--shelf);
  color: var(--muted);
}

.ach-levels li.done {
  color: var(--text);
}

.ach-goal {
  flex: 1;
  font-weight: 700;
}

.ach-pip {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tier, var(--line));
  color: var(--berry-deep);
  font-size: 12px;
  font-weight: 1000;
}

.ach-pip.tier-locked {
  background: var(--line);
  color: var(--muted);
}

.ach-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.ach-holders {
  margin-bottom: 8px;
  font-weight: 700;
}

/* Праздник: карточка выпрыгивает, сверху сыплется конфетти */
.ach-pop-wrap {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(var(--scrim) / 0.55);
  animation: ach-fade 0.2s ease;
}

.ach-pop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 22px 18px 18px;
  border-radius: 26px;
  background: var(--surface);
  text-align: center;
  box-shadow: 0 6px 0 var(--berry-deep);
  animation: ach-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.ach-pop h2 {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 900;
}

.ach-pop .ach-goal {
  flex: none;
  color: var(--text);
}

.ach-pop .btn {
  width: 100%;
  margin-top: 4px;
}

.ach-kicker {
  color: var(--berry);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ach-pop .ach-badge.lg {
  animation: ach-wiggle 1.2s ease 0.4s;
}

.ach-pop-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 8px;
  width: 100%;
}

.ach-pop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.ach-pop-item b {
  margin-top: 6px;
  color: var(--berry-deep);
  font-size: 12px;
  line-height: 1.2;
}

.ach-pop-item .muted {
  font-size: 11px;
}

.ach-pop-list > p {
  grid-column: 1 / -1;
}

/* Конфетти — без скрипта: место, цвет и темп задают nth-child */
.ach-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ach-confetti i {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  background: var(--gold);
  animation: ach-fall 2.6s ease-in forwards;
}

.ach-confetti i:nth-child(4n + 1) {
  background: var(--bad);
}

.ach-confetti i:nth-child(4n + 2) {
  background: var(--lavender);
}

.ach-confetti i:nth-child(4n + 3) {
  background: var(--ok);
}

.ach-confetti i:nth-child(3n) {
  width: 6px;
  animation-duration: 2.1s;
}

.ach-confetti i:nth-child(2n) {
  animation-delay: 0.35s;
}

.ach-confetti i:nth-child(5n) {
  animation-duration: 3s;
  animation-delay: 0.2s;
}

.ach-confetti i:nth-child(1) {
  left: 3%;
}
.ach-confetti i:nth-child(2) {
  left: 8%;
}
.ach-confetti i:nth-child(3) {
  left: 13%;
}
.ach-confetti i:nth-child(4) {
  left: 18%;
}
.ach-confetti i:nth-child(5) {
  left: 23%;
}
.ach-confetti i:nth-child(6) {
  left: 27%;
}
.ach-confetti i:nth-child(7) {
  left: 32%;
}
.ach-confetti i:nth-child(8) {
  left: 37%;
}
.ach-confetti i:nth-child(9) {
  left: 41%;
}
.ach-confetti i:nth-child(10) {
  left: 46%;
}
.ach-confetti i:nth-child(11) {
  left: 50%;
}
.ach-confetti i:nth-child(12) {
  left: 55%;
}
.ach-confetti i:nth-child(13) {
  left: 59%;
}
.ach-confetti i:nth-child(14) {
  left: 64%;
}
.ach-confetti i:nth-child(15) {
  left: 68%;
}
.ach-confetti i:nth-child(16) {
  left: 73%;
}
.ach-confetti i:nth-child(17) {
  left: 77%;
}
.ach-confetti i:nth-child(18) {
  left: 82%;
}
.ach-confetti i:nth-child(19) {
  left: 86%;
}
.ach-confetti i:nth-child(20) {
  left: 90%;
}
.ach-confetti i:nth-child(21) {
  left: 94%;
}
.ach-confetti i:nth-child(22) {
  left: 98%;
}

@keyframes ach-fade {
  from {
    opacity: 0;
  }
}

@keyframes ach-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

@keyframes ach-wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  20% {
    transform: rotate(-8deg) scale(1.06);
  }
  40% {
    transform: rotate(7deg) scale(1.06);
  }
  60% {
    transform: rotate(-4deg);
  }
  80% {
    transform: rotate(2deg);
  }
}

@keyframes ach-fall {
  0% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ach-pop,
  .ach-pop .ach-badge.lg,
  .ach-confetti i {
    animation: none;
  }

  .ach-confetti {
    display: none;
  }
}

/* В сетке 2×2 красный счётчик «надо доесть» уходит в угол плитки — иначе
   «Холодильник» не помещается */
.storage-map.many .storage-tile {
  position: relative;
}

.storage-map.many .storage-tile-top .urgent {
  position: absolute;
  top: -6px;
  right: -6px;
  border: 2px solid var(--surface);
}

/* ── чек ───────────────────────────────────────────────────────────── */
.receipt-icon {
  color: var(--berry);
}

.receipt-line {
  border-bottom: 1px solid var(--shelf);
}

.receipt-line:last-child {
  border-bottom: 0;
}

.receipt-line-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Галочка — своя кнопка с большим полем: по ней попадают на ходу, а тап по
   строке раскрывает правку */
.receipt-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  min-height: 56px;
  margin-left: -8px;
  border: 0;
  background: none;
  cursor: pointer;
}

.receipt-check[aria-pressed="true"] .checkbox {
  border-color: var(--ok);
  background: var(--ok);
}

.receipt-line-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.receipt-line.off .receipt-line-main {
  opacity: 0.45;
}

.receipt-line.off .list-row-text b {
  text-decoration: line-through;
}

.receipt-raw {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Кнопка прилипает к низу листа поверх строк */
.receipt-apply {
  position: sticky;
  bottom: 0;
  margin: 0 -16px calc(-24px - var(--safe-bottom));
  padding: 10px 16px calc(14px + var(--safe-bottom));
  background: linear-gradient(to bottom, transparent, var(--surface) 22%);
}

.receipt-sum {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: var(--berry-deep);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.receipt-sum .pill {
  align-self: flex-end;
  font-size: 11px;
}

.receipt-editor {
  padding: 4px 0 14px 36px;
}

/* ── техника в рецепте ─────────────────────────────────────────────── */
.recipe-equipment {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* ── редактор своего рецепта ───────────────────────────────────────── */
.editor-photo {
  position: relative;
  display: grid;
  place-items: center;
  height: 180px;
  overflow: hidden;
  border-radius: 20px;
  background: var(--shelf);
  color: var(--lavender);
  cursor: pointer;
}

.editor-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-photo .btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
}

/* Своё фото обложки продукта — в «Исправить», над названием */
.cover-photo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.editor-photo.cover {
  height: 160px;
}

.editor-photo.cover .item-icon {
  transform: scale(1.4);
}

.cover-photo .muted {
  font-size: 12.5px;
  line-height: 1.35;
}

textarea.field {
  resize: vertical;
  line-height: 1.4;
}

/* ── опечатки: слой с чертами под прозрачной textarea ──────────────── */
.spell {
  position: relative;
}

/* Тот же шрифт, отступы, рамка и место под полосу прокрутки, что у поля:
   иначе строки перенесутся в другом месте, и черта уедет со слова */
.spell-back,
.spell-input {
  scrollbar-gutter: stable;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.spell-back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  white-space: pre-wrap;
  color: transparent;
  pointer-events: none;
}

.spell-input {
  position: relative;
  display: block;
  background: transparent;
}

/* Название: растёт вниз вместе с текстом, своей прокрутки и ручки нет.
   Два класса — чтобы перебить resize у textarea.field */
.spell .spell-single {
  resize: none;
  overflow: hidden;
}

.spell-back .typo {
  background: none;
  color: transparent;
  text-decoration: underline wavy var(--bad);
  text-decoration-thickness: 1px;
  text-decoration-skip-ink: none;
  text-underline-offset: 3px;
}

.spell-fixes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: -4px;
  font-size: 13px;
}

.spell-fix {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--bad-soft);
  color: var(--bad-ink);
  font-weight: 700;
}

.spell-fix-main {
  padding: 5px 4px 5px 10px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

.spell-fix-main s {
  opacity: 0.7;
}

.spell-fix-skip {
  min-width: 30px;
  padding: 5px 10px 5px 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  opacity: 0.7;
}

.editor-preview {
  display: flex;
  flex-direction: column;
  margin-top: -6px;
  padding: 4px 12px 10px;
  border-radius: 14px;
  background: var(--shelf);
}

.editor-preview .state-unknown .recipe-dot,
.editor-preview .state-unknown.recipe-line-main .recipe-dot {
  background: var(--soon);
}

.editor-preview .recipe-line-main {
  min-height: 36px;
  cursor: default;
}

.editor-preview > .muted {
  padding-top: 6px;
  font-size: 13px;
}

.danger-link {
  align-self: center;
  color: var(--bad-ink);
}

/* ── выбор темы ────────────────────────────────────────────────────── */
/* Карточка несёт токены своей темы в style — превью рисуется её цветами */
.theme-strip {
  display: flex;
  gap: 10px;
  margin: 0 -4px;
  padding: 2px 4px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.theme-card {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 2px;
  width: 132px;
  padding: 8px 8px 10px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.theme-card.on {
  border-color: var(--berry);
  box-shadow: 0 3px 0 var(--berry-deep);
}

.theme-card b {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 900;
}

.theme-card > span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.theme-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: var(--bg);
}

.theme-bar {
  height: 8px;
  width: 60%;
  border-radius: 999px;
  background: var(--berry-deep);
}

.theme-shelf {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: var(--shelf);
}

.theme-pill {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--berry);
  color: var(--on-berry);
  font-size: 11px;
  font-weight: 800;
}

/* ── выделение и действия пачкой ───────────────────────────────────── */
.nav.hidden {
  display: none;
}

/* Плашка поверх шапки: видно, сколько выбрано, где бы ни была прокрутка */
.select-top {
  position: fixed;
  top: calc(8px + var(--safe-top));
  left: max(12px, calc((100% - 560px) / 2));
  right: max(12px, calc((100% - 560px) / 2));
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 3px 0 var(--line);
}

.select-top b {
  font-size: 16px;
  font-weight: 900;
}

.select-top .muted {
  margin-left: auto;
  font-size: 12px;
}

.select-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px max(6px, calc((100% - 560px) / 2)) calc(10px + var(--safe-bottom));
  background: var(--surface);
  border-top: 2px solid var(--line);
}

.select-bar button {
  min-height: 52px;
  padding: 4px 0;
  border: 0;
  border-radius: 14px;
  background: var(--shelf);
  color: var(--berry-deep);
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
  /* Слово целиком: «Переложит-ь» на две строки читается хуже, чем узко */
  white-space: nowrap;
  cursor: pointer;
}

.select-bar button.danger {
  background: var(--bad-soft);
  color: var(--bad-ink);
}

.select-bar button:disabled {
  opacity: 0.5;
}

/* ── перетаскивание ────────────────────────────────────────────────── */
/* Приподнятый стикер: «взяли в руку» — отпустить значит выделить,
   повести — перенести */
.sticker.lifted .sticker-face {
  transform: scale(1.12);
  box-shadow: 0 8px 18px rgb(var(--shade) / 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sticker.dragged {
  opacity: 0.4;
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  width: 64px;
  height: 64px;
  padding: 6px;
  border: 3px solid var(--berry);
  border-radius: 18px;
  background: var(--plate);
  box-shadow: 0 12px 26px rgb(var(--shade) / 0.35);
  object-fit: contain;
  pointer-events: none;
}

.drag-count {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 41;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--berry);
  color: var(--on-berry);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
}

/* Полоса хранилищ сверху: бросить в хранилище целиком или подержать —
   и оно откроется, чтобы бросить на полку */
.drag-strip,
.drag-dock {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  padding: 8px max(8px, calc((100% - 560px) / 2));
  background: var(--surface);
  box-shadow: 0 3px 0 var(--line);
}

/* Посреди переноса полосу не прокрутишь — все хранилища видны сразу,
   по три в ряд */
.drag-strip {
  top: var(--safe-top);
  flex-wrap: wrap;
}

.drag-strip .drag-target {
  flex: 1 1 30%;
  min-width: 0;
  padding: 0 6px;
}

.drag-dock {
  bottom: 0;
  padding-bottom: calc(10px + var(--safe-bottom));
  border-top: 2px solid var(--line);
  box-shadow: none;
}

.drag-target {
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 12px;
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--shelf);
  color: var(--berry-deep);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.drag-target.on {
  border-style: solid;
  border-color: var(--berry);
}

.drag-target.bad {
  border-color: var(--danger-line);
  background: var(--bad-soft);
  color: var(--bad-ink);
}

/* Под пальцем — куда ляжет. Красное — сюда нельзя (порошок в морозилку) */
.drop-over {
  outline: 3px solid var(--berry);
  outline-offset: -3px;
  background-color: var(--soft);
}

.drag-target.drop-over {
  background: var(--berry);
  color: var(--on-berry);
}

.drop-bad {
  outline: 3px solid var(--bad);
  outline-offset: -3px;
  background-color: var(--bad-soft);
}

.drop-confirm {
  position: fixed;
  left: max(12px, calc((100% - 560px) / 2));
  right: max(12px, calc((100% - 560px) / 2));
  bottom: calc(96px + var(--safe-bottom));
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--line), 0 14px 30px rgb(var(--shade) / 0.25);
}

.drop-confirm > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drop-confirm b {
  font-size: 17px;
  font-weight: 900;
}

/* ── правка раскладки на холодильнике ──────────────────────────────── */
.storage-edit {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--berry-deep);
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.storage-edit.on {
  background: var(--berry);
  color: var(--on-berry);
  font-size: 13px;
}

.storage-edit-hint {
  margin: -2px 4px 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* В режиме правки продукты не трогаем — только полки */
.storage.editing .sticker {
  pointer-events: none;
  opacity: 0.55;
}

.zone-head .sort-handle {
  width: 36px;
  height: 30px;
  margin: -4px -4px -4px 0;
  font-size: 20px;
}

.door-zone .sort-handle {
  width: 100%;
  height: 26px;
  font-size: 18px;
}

.zone.sorting,
.door-zone.sorting {
  position: relative;
  z-index: 2;
  outline: 3px solid var(--berry);
  outline-offset: 1px;
  box-shadow: 0 10px 22px rgb(var(--shade) / 0.25);
}

.door-zone.sorting {
  border-radius: 12px;
  background: var(--surface);
}

.storage-map.editing .storage-tile {
  border-style: dashed;
  border-color: var(--line-strong);
  touch-action: none;
  cursor: grab;
}

.storage-map.editing .storage-tile.on {
  border-style: solid;
  border-color: var(--berry);
}

.storage-tile.sorting {
  transform: scale(1.06);
  box-shadow: 0 10px 22px rgb(var(--shade) / 0.3);
}

/* ── обучение ─────────────────────────────────────────────────────────
   Как в играх: всё затемнено, кроме одного места, рядом — реплика Обжоры.
   Затемнение — тень подсветки во весь экран: дырка в нём ездит за местом
   плавно, без масок и canvas */
.tour {
  position: fixed;
  inset: 0;
  z-index: 45;
  touch-action: none;
  cursor: pointer;
}

.tour-dim,
.tour-spot {
  position: fixed;
  pointer-events: none;
}

.tour-dim {
  inset: 0;
  background: rgb(var(--scrim) / 0.8);
}

/* Проявляется только в начале: между шагами затемнение сменяет подсветку,
   и повторное проявление мигало бы светлым */
.tour-dim.enter {
  animation: fade 0.2s ease;
}

/* Перелёт — только между шагами (tour.tsx, glide): за прокруткой и
   выезжающим листом подсветка едет вплотную, без опоздания */
.tour-spot {
  box-shadow: 0 0 0 200vmax rgb(var(--scrim) / 0.8);
}

.tour-spot.glide {
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
}

.tour-spot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 3px solid var(--lavender);
  border-radius: inherit;
  animation: tour-pulse 1.4s ease-in-out infinite;
}

.tour-bubble {
  position: fixed;
  left: 16px;
  right: 16px;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px 12px;
  border: 3px solid var(--lavender);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 5px 0 var(--berry-deep), 0 16px 40px rgb(var(--shade) / 0.35);
  cursor: default;
  animation: tour-in 0.25s ease;
}

/* Хвостик смотрит на подсвеченное: --tail считает tour.tsx */
.tour-bubble.below::before,
.tour-bubble.above::before {
  content: "";
  position: absolute;
  left: calc(var(--tail, 50%) - 9px);
  width: 14px;
  height: 14px;
  background: var(--surface);
  border: 3px solid var(--lavender);
  transform: rotate(45deg);
}

.tour-bubble.below::before {
  top: -10px;
  border-right: 0;
  border-bottom: 0;
}

.tour-bubble.above::before {
  bottom: -10px;
  border-left: 0;
  border-top: 0;
}

.tour-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tour-row .tour-say {
  flex: 1;
  min-width: 0;
}

/* Обжора выглядывает из-за края реплики */
.tour-row .tour-mascot {
  flex: none;
  width: 54px;
  margin-top: -30px;
}

.tour-say b {
  display: block;
  margin-bottom: 4px;
  color: var(--berry-deep);
  font-size: 17px;
  font-weight: 900;
}

.tour-say p {
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.4;
}

.tour-foot {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* На узком телефоне точки обрежутся, а не выдавят кнопку за край */
.tour-dots {
  display: flex;
  flex: 1;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.tour-dots i {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  transition: width 0.2s ease;
}

.tour-dots i.done {
  background: var(--lavender);
}

.tour-dots i.on {
  width: 16px;
  background: var(--berry);
}

.tour-skip {
  color: var(--muted);
  font-size: 13px;
}

/* Знакомство: Обжора крупно посреди экрана, реплика под ним */
.tour-center {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
}

.tour-center .tour-bubble {
  position: relative;
  left: auto;
  right: auto;
  width: 100%;
}

.tour-hero {
  display: grid;
  place-items: center;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--glow) / 0.6), transparent 68%);
}

.tour-hero .tour-mascot {
  width: 116px;
}

.tour-mascot {
  display: block;
  height: auto;
  animation: tour-hop 0.5s ease;
}

/* Рот открывается несколько раз — Обжора «говорит» новую реплику */
.tour-mouth {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: tour-talk 0.16s ease-in-out 6 alternate;
}

@keyframes tour-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

@keyframes tour-hop {
  40% {
    transform: translateY(-7px);
  }
}

@keyframes tour-talk {
  to {
    transform: scaleY(0.55);
  }
}

@keyframes tour-pulse {
  50% {
    opacity: 0.35;
    transform: scale(1.03);
  }
}

/* «Сделать»: тапы проходят в подсвеченное место насквозь, а мимо него
   их ловят прозрачные заслонки (tour.tsx, Blockers) */
.tour.doing {
  pointer-events: none;
  cursor: default;
}

.tour.doing .tour-bubble,
.tour.doing .tour-block {
  pointer-events: auto;
}

.tour-block {
  position: fixed;
}

/* Места ещё нет — лист грузится: реплика ждёт внизу, над меню */
.tour-bubble.floating {
  bottom: calc(96px + var(--safe-bottom));
}

.tour-answers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tour-answers .btn {
  font-size: 20px;
  font-weight: 900;
}

.tour-count {
  display: block;
  color: var(--berry);
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Блюда веером: те самые, что собираются из запасов */
.tour-fan {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 150px;
  margin-bottom: 8px;
}

.tour-fan img {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 104px;
  height: 128px;
  margin-left: -52px;
  border: 3px solid var(--surface);
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgb(var(--shade) / 0.35);
  transform: translateX(calc(var(--i) * 52px)) rotate(calc(var(--i) * 8deg));
  transform-origin: 50% 120%;
  animation: tour-deal 0.5s ease backwards;
  animation-delay: calc((var(--i) + 2) * 70ms);
}

@keyframes tour-deal {
  from {
    transform: translateY(40px) rotate(0deg);
    opacity: 0;
  }
}

/* Учебную кухню легко принять за настоящую — плашка поверх всего, даже
   поверх обучения: выйти можно в любой момент */
.sandbox-bar {
  position: sticky;
  top: 0;
  z-index: 46;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -16px 8px;
  padding: 8px 16px;
  background: var(--berry);
  color: var(--on-berry);
  font-size: 13px;
}

.sandbox-bar .link {
  color: var(--on-berry);
  font-weight: 800;
  text-decoration: underline;
}

/* «Докупи одно — откроется больше» в подборе */
.unlock-row {
  width: 100%;
}

.unlock-row .list-row-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unlock-plus {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--shelf);
  color: var(--berry);
  font-size: 22px;
  font-weight: 900;
}

/* Мостик «Что у тебя дома?» — последний шаг обучения. Сверху — место под
   плашку учебной кухни, иначе она закрывает заголовок карточки */
.tour.bridge {
  display: grid;
  place-items: center;
  padding: 72px 16px 16px;
  cursor: default;
}

.bridge-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 88px);
  overflow-y: auto;
  padding: 16px;
  border: 3px solid var(--lavender);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 5px 0 var(--berry-deep), 0 16px 40px rgb(var(--shade) / 0.35);
  animation: tour-in 0.25s ease;
}

.bridge-card .tour-mascot {
  flex: none;
  width: 54px;
}

.bridge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.bridge-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.bridge-chip img {
  width: 34px;
  height: 34px;
  padding: 3px;
  border-radius: 10px;
  background: var(--plate);
}

.bridge-chip.on {
  border-color: var(--berry);
  background: var(--shelf);
  color: var(--berry-deep);
}

.bridge-count {
  margin: 0;
  color: var(--berry-deep);
  font-size: 17px;
  font-weight: 900;
  text-align: center;
}

.bridge-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .tour-dim.enter,
  .tour-spot.glide,
  .tour-spot::after,
  .tour-bubble,
  .tour-fan img,
  .bridge-card,
  .tour-mascot,
  .tour-mouth {
    animation: none;
    transition: none;
  }
}

/* «Не люблю» с выбором: строка продукта и пометка в рецепте */
.dislike-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dislike-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dislike-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.dislike-remove {
  min-width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.dislike-mark {
  color: var(--berry-deep);
  font-weight: 700;
}

/* ── Сообщить об ошибке (настройки) ─────────────────────────────────── */
.report-attach {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.report-attach input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.report-shot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.report-shot img {
  max-width: 60%;
  max-height: 160px;
  border-radius: 12px;
  object-fit: contain;
}

/* ── штуки с весом, две даты, списание по рецепту ─────────────────── */
/* Единица — узкий выпадающий список рядом с числом: «5 [шт▾] по 10 [г▾]» */
.field.unit-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 64px;
  padding-right: 6px;
  font-weight: 800;
}

.add-row .field.unit-select {
  flex: 0 0 auto;
}

.piece-row > .muted,
.spend-row > .muted,
.pack-term > .muted {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
}

.piece-row {
  margin-top: 8px;
}

/* В правке остатка строки и так разделены промежутком стопки */
.stack > .piece-row {
  margin-top: 0;
}

.spend-row .btn {
  flex: 0 0 auto;
  padding-inline: 14px;
}

.pack-dates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* В форме дата — полноценное поле, а не маленький чип, как было у срока */
.pack-dates .field.date {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 15px;
}

.pack-term .field:not(.unit-select) {
  max-width: 90px;
}

.take {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
}

.take-line {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.take-line-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}

/* Галочка, название и количество — одной строкой: строк в рецепте бывает
   десяток, и столбиком список не помещается даже на два экрана */
.take-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface);
}

.take-row .take-check {
  flex: 1;
  min-width: 0;
}

.take-row .add-row {
  flex: 0 0 auto;
  gap: 4px;
}

.take-row .add-row .field:not(.unit-select) {
  flex: 0 0 auto;
  width: 68px;
  padding-inline: 8px;
  text-align: right;
}

.grid-2.gone {
  display: none;
}

.take-row.off {
  opacity: 0.55;
}

.take-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.take-check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--berry);
}

.take-product {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.take-product .muted {
  font-size: 13px;
}

/* ── полка списком ─────────────────────────────────────────────────── */
/* Заголовок полки — кнопка, но выглядит как раньше, только со стрелкой */
button.zone-open {
  width: 100%;
  min-height: 28px;
  margin: -4px 0;
  padding: 4px 2px;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.door-zone button.zone-open {
  text-align: center;
}

.zone-more {
  margin-left: 4px;
  opacity: 0.6;
}

.zone-sheet-empty {
  margin: 0;
  color: var(--muted);
}

.zone-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  background: var(--panel);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.zone-row-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.zone-row-text .muted {
  font-size: 13px;
}

.zone-row .pill {
  flex: 0 0 auto;
}

/* ── поиск по запасам ──────────────────────────────────────────────── */
.stock-search {
  position: relative;
}

.stock-search .field {
  padding-right: 44px;
  border-radius: 999px;
}

/* Свой крестик вместо браузерного: в WebView Telegram тот крошечный */
.stock-search .field::-webkit-search-cancel-button {
  display: none;
}

.stock-search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--shelf);
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  transform: translateY(-50%);
  cursor: pointer;
}

.search-summary {
  padding: 0 4px;
  font-weight: 700;
}

.search-empty b {
  font-size: 17px;
}
