:root {
  --bg: #f4efe6;
  --surface: #fffaf3;
  --surface-2: #efe6d8;
  --ink: #2a221b;
  --ink-soft: #6b5d50;
  --line: #e3d7c5;
  --accent: #e2552b;
  --accent-ink: #fff;
  --accent-soft: #fbe1d6;
  --herb: #3f7d4e;
  --herb-soft: #dcebdc;
  --gold: #f2b134;
  --shadow: 0 1px 2px rgb(60 40 20 / .06), 0 8px 24px rgb(60 40 20 / .08);
  --radius: 20px;
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1714;
    --surface: #24201c;
    --surface-2: #2e2924;
    --ink: #f1e9de;
    --ink-soft: #b4a594;
    --line: #3a332c;
    --accent: #ff7247;
    --accent-ink: #1a1714;
    --accent-soft: #4a2a1e;
    --herb: #7cc08b;
    --herb-soft: #23362a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.01em; }

/* ── Верхняя панель ───────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 18px; white-space: nowrap; }
.logo-mark { font-size: 26px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.tabs a { text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 16px; }
  .logo { justify-content: center; }
  .tabs { justify-content: space-between; }
  .tabs a { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; }
}

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; outline: none; }
.foot { text-align: center; color: var(--ink-soft); font-size: 13px; padding: 24px 16px 32px; }

/* ── Общие элементы ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 10px 18px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.on { background: var(--gold); border-color: var(--gold); color: #2a221b; }
.btn.small { padding: 6px 12px; font-size: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  user-select: none;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.meta-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.section-title { font-size: 24px; margin-bottom: 6px; }
.section-sub { color: var(--ink-soft); margin: 0 0 20px; }
.empty { text-align: center; padding: 48px 16px; color: var(--ink-soft); background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty .big { font-size: 44px; display: block; margin-bottom: 8px; }

/* ── Экран «Крутить» ──────────────────────── */
.hero { text-align: center; margin: 8px 0 20px; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); }
.hero p { color: var(--ink-soft); margin: 8px 0 0; }

.mode { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; }

.filters { display: grid; gap: 10px; margin-bottom: 20px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-label { flex: none; align-self: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); width: 72px; }
@media (min-width: 721px) { .filter-row { flex-wrap: wrap; overflow: visible; } }

.spin-btn { display: flex; justify-content: center; margin-bottom: 8px; }
.spin-btn .btn { font-family: var(--font-display); font-size: 20px; padding: 16px 40px; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent); }
.pool-note { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 0 0 28px; }

/* ── Карточка блюда ───────────────────────── */
.dish { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.dish-top { display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 820px) { .dish-top { grid-template-columns: 1fr; } }
.dish-photo { position: relative; min-height: 280px; background: var(--surface-2); }
.dish-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dish-photo .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 80px; }
.dish-head { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.dish-cuisine { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.dish-head h2 { font-size: clamp(24px, 4vw, 34px); }
.dish-orig { color: var(--ink-soft); font-size: 14px; margin-top: -8px; }
.dish-desc { margin: 0; color: var(--ink-soft); }
.dish-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.dish-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

.nutri { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nutri div { background: var(--surface-2); border-radius: 14px; padding: 10px; text-align: center; }
.nutri b { display: block; font-family: var(--font-display); font-size: 18px; }
.nutri span { font-size: 12px; color: var(--ink-soft); }

.dish-body { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0; border-top: 1px solid var(--line); }
@media (max-width: 820px) { .dish-body { grid-template-columns: 1fr; } }
.dish-body > section { padding: 24px 28px 28px; }
.dish-body > section + section { border-left: 1px solid var(--line); }
@media (max-width: 820px) { .dish-body > section + section { border-left: 0; border-top: 1px solid var(--line); } }
.dish-body h3 { font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.servings { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 3px; font-family: var(--font-body); font-size: 14px; font-weight: 600; }
.servings button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--surface); cursor: pointer; font-size: 18px; line-height: 1; }
.servings span { min-width: 64px; text-align: center; }

.ings { list-style: none; margin: 0; padding: 0; }
.ings li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.ings li:last-child { border-bottom: 0; }
.ings input { accent-color: var(--herb); flex: none; transform: translateY(2px); }
.ings .ing-name { flex: 1; }
.ings .ing-note { color: var(--ink-soft); font-size: 13px; }
.ings .ing-amt { font-weight: 700; white-space: nowrap; }
.ings li.got .ing-name, .ings li.got .ing-amt { text-decoration: line-through; opacity: .5; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 4px 0 18px 48px; cursor: pointer; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-family: var(--font-display); font-weight: 700; font-size: 15px;
}
.steps li.done { opacity: .45; }
.steps li.done::before { content: "✓"; background: var(--herb-soft); color: var(--herb); }

/* ── Сетка блюд ───────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.search { flex: 1; min-width: 200px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 10px 18px; outline: none; }
.search:focus { border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { position: relative; background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); text-decoration: none; display: flex; flex-direction: column; transition: transform .15s ease; }
.card:hover { transform: translateY(-3px); }
.card-img { aspect-ratio: 4 / 3; background: var(--surface-2); position: relative; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 48px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-weight: 700; line-height: 1.25; }
.card-meta { font-size: 13px; color: var(--ink-soft); margin-top: auto; }
.card-fav { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .9); cursor: pointer; font-size: 17px; display: grid; place-items: center; box-shadow: var(--shadow); }
.card-fav.on { background: var(--gold); }

/* ── «Наше» ───────────────────────────────── */
.add-own { display: flex; gap: 8px; flex-wrap: wrap; background: var(--surface); padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.add-own input { flex: 1; min-width: 200px; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 10px 16px; outline: none; }
.add-own input:focus { border-color: var(--accent); }
.own-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.own-item { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 14px; font-weight: 600; }
.own-item button { border: 0; background: transparent; cursor: pointer; width: 26px; height: 26px; border-radius: 50%; color: var(--ink-soft); }
.own-item button:hover { background: var(--surface-2); }
.own-card { padding: 32px 28px; text-align: center; }
.own-card .big { font-size: 64px; }

/* ── История ──────────────────────────────── */
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hist li { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); }
.hist img, .hist .ph { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 28px; }
.hist .h-name { font-weight: 700; text-decoration: none; }
.hist .h-date { font-size: 13px; color: var(--ink-soft); }
.hist .h-main { flex: 1; min-width: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s ease; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
#result { scroll-margin-top: 90px; }
.photo-credit { position: absolute; right: 8px; bottom: 8px; background: rgb(0 0 0 / .55); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 999px; text-decoration: none; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Сегодня: три варианта ────────────────── */
.mode { flex-wrap: wrap; }
.filters[hidden] { display: none; }
.sugg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
@media (max-width: 760px) { .sugg-grid { grid-template-columns: 1fr; } }
.sugg {
  display: flex; flex-direction: column; text-align: left; padding: 0; border: 2px solid transparent;
  background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; animation: rise .4s ease backwards; transition: transform .15s ease, border-color .15s ease;
}
.sugg:hover { transform: translateY(-3px); }
.sugg.picked { border-color: var(--accent); }
.sugg-img { aspect-ratio: 4 / 3; position: relative; background: var(--surface-2); }
.sugg-img img { width: 100%; height: 100%; object-fit: cover; }
.sugg-img .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 56px; }
.sugg-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sugg-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1.2; }
.sugg-garnish { color: var(--ink-soft); font-size: 14px; }
.sugg-meta { color: var(--ink-soft); font-size: 13px; }
.sugg-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sugg-reasons span { background: var(--herb-soft); color: var(--herb); font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; }
@media (max-width: 760px) {
  .sugg { flex-direction: row; }
  .sugg-img { aspect-ratio: auto; width: 116px; flex: none; }
  .sugg-img img { position: absolute; inset: 0; }
}
.today-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.today-actions .btn.primary { font-family: var(--font-display); font-size: 17px; padding: 14px 28px; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ── Барабан-лента ────────────────────────── */
.reel {
  position: relative; overflow: hidden; margin: 8px -16px 24px; padding: 18px 0 22px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.reel[hidden] { display: none; }
.reel-track { display: flex; gap: 14px; width: max-content; padding: 0 50%; will-change: transform; }
.tile { width: 190px; flex: none; background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); transition: transform .4s ease, opacity .4s ease; }
.tile-img { aspect-ratio: 1; position: relative; background: var(--surface-2); }
.tile-img img { width: 100%; height: 100%; object-fit: cover; }
.tile-img .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 56px; }
.tile-name { padding: 10px 12px 12px; font-weight: 700; font-size: 14px; line-height: 1.25; height: 3.6em; overflow: hidden; }
.reel-marker { position: absolute; top: 4px; bottom: 6px; left: 50%; width: 204px; transform: translateX(-50%); border: 3px solid var(--accent); border-radius: 22px; pointer-events: none; }
.reel-marker::before { content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%); border: 9px solid transparent; border-top-color: var(--accent); }
.reel.done .tile:not(.win) { opacity: .35; }
.reel.done .tile.win { transform: scale(1.08); }
@media (max-width: 520px) { .tile { width: 150px; } .reel-marker { width: 164px; } }

/* ── Карточка: гарнир, к столу, заметки ───── */
.extras { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 28px; border-top: 1px solid var(--line); }
.extras a.chip { text-decoration: none; }
.extras-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); width: 72px; }
.note { background: var(--accent-soft); border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.nutri-note { font-size: 12px; color: var(--ink-soft); margin-top: -8px; }
.sub { font-family: var(--font-display); font-size: 15px; margin: 20px 0 10px; color: var(--accent); }
.h-sec { font-size: 18px; margin: 28px 0 12px; }

/* ── Неделя ───────────────────────────────── */
.week { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.week li { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); border: 2px solid transparent; }
.week li.today { border-color: var(--accent); }
.week li.done { opacity: .55; }
.week img, .week .ph { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 30px; }
.w-day { width: 40px; text-align: center; flex: none; }
.w-day b { display: block; font-family: var(--font-display); font-size: 15px; }
.w-day span { font-size: 13px; color: var(--ink-soft); }
.w-main { flex: 1; min-width: 0; }
.w-name { font-weight: 700; text-decoration: none; }
.w-sub { font-size: 13px; color: var(--ink-soft); }
.w-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 520px) { .week img, .week .ph { width: 52px; height: 52px; } .week li { gap: 10px; } }
.shop { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); margin-top: 16px; }
.shop summary { cursor: pointer; font-weight: 700; }
.shop .ings { margin: 12px 0; }

/* ── «На сегодня» ─────────────────────────── */
.btn.cooking { background: var(--herb); border-color: var(--herb); color: #fff; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 2px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.shop.open { margin-top: 20px; }
.shop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.shop-head h3 { font-size: 18px; }
.shop-progress { color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.progress span { display: block; height: 100%; background: var(--herb); transition: width .3s ease; }
.to-taste { color: var(--ink-soft); font-size: 14px; margin: 4px 0 14px; }
@media (max-width: 720px) {
  .tabs { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; padding: 8px 11px; }
}
.source { font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; }
.source:hover { text-decoration: underline; }

/* ── Выбор гарнира ────────────────────────── */
.g-picker { padding: 20px 28px 22px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.g-picker h3 { font-size: 18px; margin-bottom: 12px; }
.g-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.g-opt { display: flex; flex-direction: column; text-align: left; padding: 0; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; transition: border-color .15s ease, transform .12s ease; }
.g-opt:active { transform: scale(.97); }
.g-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.g-img { aspect-ratio: 4 / 3; position: relative; background: var(--surface-2); display: block; }
.g-img img { width: 100%; height: 100%; object-fit: cover; }
.g-img .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; }
.g-name { font-weight: 700; font-size: 14px; padding: 8px 10px 0; line-height: 1.25; }
.g-kcal { font-size: 12px; color: var(--ink-soft); padding: 2px 10px 10px; }
.g-hint { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; }
@media (max-width: 520px) { .g-picker { padding: 16px; } .g-options { grid-template-columns: repeat(2, 1fr); } }
.g-mini { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.g-mini .chip { padding: 4px 10px; font-size: 13px; }
.g-note { font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-left: 6px; }
.g-picker + .g-picker { border-top: 1px dashed var(--line); }
.sub.first { margin-top: 0; }
.more-btn { margin: 12px 0 0; background: none; border: 1px dashed var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.more-btn:hover { background: var(--surface); color: var(--ink); }
.more-btn + .g-options { margin-top: 12px; }

/* Картинки всегда строго в своей рамке, независимо от пропорций исходника */
.g-img img, .card-img img, .tile-img img, .sugg-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-img, .tile-img { position: relative; overflow: hidden; }
.g-img { overflow: hidden; }
.g-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(2 * 1.25em + 8px); }
.g-opt { height: 100%; }

/* Фото блюда — всегда одной пропорции, а не по высоте текста рядом */
.dish-top { align-items: start; }
.dish-photo { min-height: 0; aspect-ratio: 4 / 3; overflow: hidden; }
@media (min-width: 821px) { .dish-photo { position: sticky; top: 80px; } }
@media (max-width: 760px) {
  .sugg { align-items: center; }
  .sugg-img { width: 112px; height: 112px; align-self: center; margin-left: 10px; border-radius: 14px; overflow: hidden; }
}

/* ── Большие салаты на выходных ───────────── */
.big-strip { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin: 6px 0 12px; }
.big-strip-title { font-weight: 700; margin-bottom: 10px; }
.big-strip-row { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.big-strip-row::-webkit-scrollbar { display: none; }
.big-chip { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; background: var(--bg); }
.big-chip:hover { border-color: var(--accent); }
.big-chip-img { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; position: relative; flex: none; background: var(--surface-2); }
.big-chip-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.big-chip-img .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.more-row { display: flex; justify-content: center; margin-top: 12px; }
.more-row .more-btn { margin: 0; }

/* ── Порции × дни, «доедаем» ──────────────── */
.qty { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 12px; }
.qty-x { color: var(--ink-soft); font-weight: 700; }
.qty .servings span { min-width: 70px; }
.qty-note { font-size: 13px; color: var(--herb); font-weight: 600; margin: -4px 0 12px; }
.leftover { display: flex; align-items: center; gap: 14px; background: var(--herb-soft); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; flex-wrap: wrap; }
.leftover-img { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; position: relative; flex: none; background: var(--surface-2); }
.leftover-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.leftover-main { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.leftover-main span { font-size: 13px; color: var(--ink-soft); }
.leftover-actions { display: flex; gap: 8px; }
.week li.leftover-row { background: color-mix(in srgb, var(--herb-soft) 55%, var(--surface)); box-shadow: none; }
.week li.leftover-row img, .week li.leftover-row .ph { opacity: .6; }
.w-days { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.w-days b { color: var(--ink); font-weight: 700; }
.mini { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; line-height: 1; padding: 0; }
.w-lunch { font-size: 13px; color: var(--herb); font-weight: 600; margin-bottom: 2px; }

/* ══ Мобильная версия ═══════════════════════ */
.tabs .ti { display: none; }
.tabs a { position: relative; }
.hist-btn { display: none; }
.badge[hidden] { display: none; }

@media (max-width: 720px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

  /* Шапка — только логотип и история */
  .topbar { flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .logo { justify-content: flex-start; font-size: 17px; }
  .logo-mark { font-size: 22px; }
  .hist-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); text-decoration: none; font-size: 18px; }

  /* Нижняя панель вкладок */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-radius: 0;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); overflow: visible;
  }
  .tabs a { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px; font-size: 11px; font-weight: 600; }
  .tabs a.active { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
  .tabs .ti { display: block; font-size: 20px; line-height: 1; }
  .tabs .tl { white-space: nowrap; }
  .tabs .tab-history { display: none; }
  .tabs .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }

  main { padding: 16px 14px 28px; }
  .foot { padding: 8px 16px 20px; font-size: 12px; }

  /* Подбор */
  .hero { margin: 0 0 14px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14px; }
  .mode { gap: 6px; }
  .filters { gap: 8px; margin-bottom: 14px; }
  .filter-label { width: 54px; font-size: 12px; }
  .chip { padding: 6px 11px; font-size: 13px; }
  .sugg-grid { gap: 10px; }
  .sugg-img { width: 96px; height: 96px; }
  .sugg-title { font-size: 15px; }
  .sugg-body { padding: 10px 12px; }
  .sugg-reasons span { font-size: 11px; padding: 3px 8px; }
  .today-actions { flex-wrap: nowrap; }
  .today-actions .btn { flex: 1; padding: 12px 10px; font-size: 14px; }
  .today-actions .btn.primary { font-size: 15px; padding: 13px 10px; }
  .pool-note { font-size: 12px; margin-bottom: 18px; }
  .leftover { padding: 10px 12px; gap: 10px; }
  .leftover-actions { width: 100%; }
  .leftover-actions .btn { flex: 1; }

  /* Карточка блюда */
  .dish { border-radius: 18px; }
  .dish-head { padding: 18px 16px; gap: 12px; }
  .dish-head h2 { font-size: 24px; }
  .dish-desc { font-size: 15px; }
  .nutri { gap: 6px; }
  .nutri div { padding: 8px 4px; border-radius: 12px; }
  .nutri b { font-size: 16px; }
  .nutri span { font-size: 11px; }
  .dish-actions .btn { flex: 1; }
  .dish-body > section { padding: 18px 16px 20px; }
  .steps li { padding-left: 42px; }

  /* Гарнир и салат — лента плиток, листается пальцем */
  .g-picker { padding: 16px 0 16px 16px; }
  .g-picker h3 { font-size: 17px; padding-right: 16px; }
  .g-options { display: flex; grid-template-columns: none; overflow-x: auto; gap: 10px; padding: 2px 16px 6px 0; scroll-snap-type: x proximity; scrollbar-width: none; }
  .g-options::-webkit-scrollbar { display: none; }
  .g-opt { flex: none; width: 128px; height: auto; scroll-snap-align: start; }
  .g-hint { padding-right: 16px; font-size: 12px; }
  .more-row { padding-right: 16px; }

  /* Порции × дни — в одну строку */
  .qty { gap: 6px; flex-wrap: nowrap; }
  .qty .servings { padding: 2px; font-size: 13px; }
  .qty .servings button { width: 28px; height: 28px; }
  .qty .servings span { min-width: 0; padding: 0 4px; }

  /* Списки */
  .week li { padding: 8px; gap: 10px; }
  .w-actions { flex-direction: column; gap: 4px; }
  .w-name { font-size: 15px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-body { padding: 10px 10px 12px; }
  .card-title { font-size: 14px; }
  .card-meta { font-size: 12px; }
  .card-fav { width: 32px; height: 32px; top: 6px; right: 6px; font-size: 15px; }
  .section-title { font-size: 22px; }
  .add-own { padding: 12px; }
  .add-own .btn { width: 100%; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) {
  /* backdrop-filter у шапки делает её «контейнером» для fixed-панели — на телефоне без него */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
}

/* ── Неделя: карточки дней ────────────────── */
.wk-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.wk { background: var(--surface); border-radius: 18px; padding: 12px 14px 14px; box-shadow: var(--shadow); border: 2px solid transparent; display: grid; gap: 8px; }
.wk.today { border-color: var(--accent); }
.wk.done { opacity: .55; }
.wk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wk-day { font-size: 14px; color: var(--ink-soft); }
.wk-day b { font-family: var(--font-display); font-size: 16px; color: var(--ink); margin-right: 4px; }
.wk-day em { font-style: normal; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.wk-actions { display: flex; gap: 6px; flex: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; font-size: 15px; padding: 0; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.on { background: var(--gold); border-color: var(--gold); }
.wk-lunch { font-size: 13px; font-weight: 600; color: var(--herb); background: var(--herb-soft); padding: 6px 10px; border-radius: 10px; }
.wk-lunch.free { color: var(--ink-soft); background: var(--surface-2); font-weight: 500; }
.wk-dinner { display: flex; align-items: center; gap: 12px; }
.wk-dinner > img, .wk-dinner > .ph { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 30px; }
.wk-info { min-width: 0; flex: 1; }
.wk-info .w-name { font-weight: 700; text-decoration: none; display: block; line-height: 1.25; }
.wk-days { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); }
.wk-days .servings { font-size: 13px; padding: 2px; }
.wk-days .servings button { width: 28px; height: 28px; }
.wk-days .servings span { min-width: 56px; }
.wk-hint { color: var(--herb); font-weight: 600; }

/* ── Шторка выбора блюда ──────────────────── */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .4); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet-panel { position: relative; width: min(560px, calc(100% - 32px)); max-height: min(720px, 86vh); background: var(--bg); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgb(0 0 0 / .3); animation: rise .25s ease; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head b { font-family: var(--font-display); font-size: 17px; }
.pick-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 6px; -webkit-overflow-scrolling: touch; }
.pick-sep { font-size: 12px; font-weight: 700; color: var(--ink-soft); padding: 8px 4px 2px; text-transform: uppercase; letter-spacing: .04em; }
.pick-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 6px; background: var(--surface); border: 2px solid transparent; border-radius: 14px; cursor: pointer; text-align: left; }
.pick-item:hover { border-color: var(--line); }
.pick-item.on { border-color: var(--accent); }
.pick-img { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; position: relative; flex: none; background: var(--surface-2); }
.pick-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pick-img .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; }
.pick-text { display: flex; flex-direction: column; min-width: 0; }
.pick-text b { font-size: 15px; line-height: 1.25; }
.pick-text span { font-size: 12px; color: var(--ink-soft); }
@media (max-width: 720px) {
  .sheet { align-items: flex-end; }
  .sheet-panel { width: 100%; max-height: 88vh; border-radius: 22px 22px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); animation: slideup .25s ease; }
  @keyframes slideup { from { transform: translateY(40px); opacity: 0; } }
  .wk { padding: 10px 12px 12px; }
  .wk-dinner > img, .wk-dinner > .ph { width: 60px; height: 60px; }
  .icon-btn { width: 34px; height: 34px; font-size: 14px; }
}
@media (max-width: 720px) {
  .cm-cuisine { display: none; }
  .hist-btn.active { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }
  .add-own input { font-size: 16px; } /* iOS не зумит поле при фокусе */
}
