:root {
  color-scheme: light dark;
  /* Палитра по дизайн-системе Stars/Starbucks */
  --green: #00754a;
  --green-dark: #006241;
  --green-house: #1e3932;
  --green-soft: #d4e9e2;
  --cream: #f2f0eb;
  --ceramic: #edebe9;
  --surface: #ffffff;
  --surface-2: #eae7df;
  --ink: rgba(0, 0, 0, 0.87);
  --muted: rgba(0, 0, 0, 0.50);
  --line: #e4e1da;
  --card: #ffffff;
  --accent: #cba258;
  --scrim: rgba(15, 35, 25, 0.42);
  --warn-bg: #fdf6e6; --warn-border: #f0e0b8; --warn-text: #8a5a00;
  /* Шкала радиусов — крупнее и «непрерывнее» (iOS 26/27) */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  /* Материал Liquid Glass — полупрозрачные плавающие слои */
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-blur: saturate(185%) brightness(1.06) blur(18px);
  /* тест: ошибка + «физическая» тень кнопки */
  --bad: #d7362a;
  --bad-soft: #fdecea;
  --bad-text: #a52a20;
  --btn-shadow: #00532f;
  /* категорийные подложки плиток-эмодзи */
  --cat-coffee: #efe3cf;
  --cat-choco: #f0dcce;
  --cat-chicory: #e7ead3;
  --cat-signature: #f4e8c8;
  --cat-frappe: #e6e1f5;
  --cat-milkshake: #f7e0e7;
  --shadow: 0 0 0.5px rgba(0, 0, 0, 0.09), 0 1px 3px rgba(0, 60, 35, 0.07);
  --shadow-lg: 0 1px 4px rgba(0, 0, 0, 0.08), 0 8px 28px rgba(0, 50, 30, 0.12);
}

/* ---- тёмная тема ---- */
:root[data-theme="dark"] {
  --green: #15a06b; --green-dark: #5fd3a3; --green-soft: rgba(21, 160, 107, 0.18);
  --green-house: #0c1f17; --cream: #000000; --ceramic: #2c2c2e;
  --surface: #1c1c1e; --surface-2: #2c2c2e;
  --ink: rgba(255, 255, 255, 0.92); --muted: rgba(255, 255, 255, 0.50);
  --line: rgba(255, 255, 255, 0.12); --card: #1c1c1e; --accent: #d8b673;
  --scrim: rgba(0, 0, 0, 0.62);
  --warn-bg: rgba(216, 182, 115, 0.12); --warn-border: rgba(216, 182, 115, 0.30); --warn-text: #e0bd7e;
  --glass: rgba(28, 28, 30, 0.66);
  --glass-strong: rgba(28, 28, 30, 0.82);
  --glass-border: rgba(255, 255, 255, 0.10);
  --bad: #ff6b5e;
  --bad-soft: rgba(255, 107, 94, 0.14);
  --bad-text: #ff9188;
  --btn-shadow: #0a5c3d;
  --cat-coffee: rgba(205, 160, 100, 0.20);
  --cat-choco: rgba(210, 140, 105, 0.20);
  --cat-chicory: rgba(170, 190, 110, 0.16);
  --cat-signature: rgba(216, 182, 115, 0.18);
  --cat-frappe: rgba(165, 150, 235, 0.20);
  --cat-milkshake: rgba(240, 130, 160, 0.18);
  --shadow: 0 0 0.5px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 2px 18px rgba(0, 0, 0, 0.66);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #15a06b; --green-dark: #5fd3a3; --green-soft: rgba(21, 160, 107, 0.18);
    --green-house: #0c1f17; --cream: #000000; --ceramic: #2c2c2e;
    --surface: #1c1c1e; --surface-2: #2c2c2e;
    --ink: rgba(255, 255, 255, 0.92); --muted: rgba(255, 255, 255, 0.50);
    --line: rgba(255, 255, 255, 0.12); --card: #1c1c1e; --accent: #d8b673;
    --scrim: rgba(0, 0, 0, 0.62);
    --warn-bg: rgba(216, 182, 115, 0.12); --warn-border: rgba(216, 182, 115, 0.30); --warn-text: #e0bd7e;
    --glass: rgba(28, 28, 30, 0.66);
    --glass-strong: rgba(28, 28, 30, 0.82);
    --glass-border: rgba(255, 255, 255, 0.10);
    --bad: #ff6b5e;
    --bad-soft: rgba(255, 107, 94, 0.14);
    --bad-text: #ff9188;
    --btn-shadow: #0a5c3d;
    --cat-coffee: rgba(205, 160, 100, 0.20);
    --cat-choco: rgba(210, 140, 105, 0.20);
    --cat-chicory: rgba(170, 190, 110, 0.16);
    --cat-signature: rgba(216, 182, 115, 0.18);
    --cat-frappe: rgba(165, 150, 235, 0.20);
    --cat-milkshake: rgba(240, 130, 160, 0.18);
    --shadow: 0 0 0.5px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 2px 18px rgba(0, 0, 0, 0.66);
  }
}

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

html {
  /* блокировка масштаба во всём приложении: гасит double-tap-zoom;
     pinch-zoom отключён через viewport (user-scalable=no).
     Размер текста регулируется встроенным А− / А+, зум браузера не нужен. */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  /* нижний отступ учитывает плавающий таб-бар */
  padding: 16px 16px calc(104px + env(safe-area-inset-bottom));
}

/* ---------- шапка ---------- */
.app-header { padding: 12px 0 20px; }
.app-header-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-star { font-size: 32px; color: var(--accent); line-height: 1; }
.brand h1 {
  margin: 0; font-size: 26px;
  letter-spacing: -0.04em; font-weight: 700;
  color: var(--green-dark); line-height: 1.1;
}
.brand-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); letter-spacing: 0; }

/* ---------- бургер + меню ---------- */
.burger {
  flex: 0 0 auto; width: 44px; height: 44px;
  border: 1px solid var(--glass-border);
  background: var(--glass); border-radius: 50%; cursor: pointer; padding: 0;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; box-shadow: var(--shadow);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.burger span {
  display: block; width: 17px; height: 1.5px; background: var(--green-dark);
  border-radius: 2px;
  /* анимация → ✕ */
  transition: transform 0.28s cubic-bezier(0.32, 0, 0.16, 1), opacity 0.2s, background 0.2s;
}
.burger:active { transform: scale(0.92); box-shadow: none; }

/* Бургер → ✕ через CSS :has() — без JS-флага на самом бургере */
:has(.menu-overlay.open) .burger span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}
:has(.menu-overlay.open) .burger span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
:has(.menu-overlay.open) .burger span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

.menu-overlay {
  position: fixed; inset: 0; background: var(--scrim); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .22s;
  backdrop-filter: blur(4px) saturate(1.4);
  -webkit-backdrop-filter: blur(4px) saturate(1.4);
}
.menu-overlay.open { opacity: 1; pointer-events: auto; }

.menu-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(82%, 320px);
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: -8px 0 48px rgba(0, 20, 12, .24);
  padding: 0;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(0.32, 0, 0.16, 1);
  display: flex; flex-direction: column; gap: 7px;
  border-radius: 26px 0 0 26px;
  overflow: hidden;
}
.menu-overlay.open .menu-panel { transform: translateX(0); }

/* Шапка панели — тёмно-зелёный блок */
.menu-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--green-house);
  padding: 28px calc(16px + env(safe-area-inset-right)) 20px 20px;
  flex: 0 0 auto;
}
.menu-head span {
  font-size: 19px; font-weight: 700;
  letter-spacing: -0.03em; color: rgba(255, 255, 255, 0.95);
}
.menu-close {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 14px; color: rgba(255, 255, 255, 0.75);
  cursor: pointer; padding: 0;
  display: grid; place-items: center;
  transition: background 0.15s;
  flex: 0 0 auto;
}
.menu-close:active { background: rgba(255, 255, 255, 0.22); }

/* Ссылки меню */
.menu-link {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
  margin: 0 14px;
  transition: background 0.14s, transform 0.12s;
}
.menu-panel > a:first-of-type { margin-top: 16px; }
.menu-panel > a:last-of-type  { margin-bottom: 0; }
.menu-link:active { background: var(--green-soft); transform: scale(0.98); }
.menu-ico { font-size: 20px; }

/* Стаггер-анимация пунктов меню при открытии */
@keyframes menuItemIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
.menu-overlay.open .menu-panel > a {
  animation: menuItemIn 0.32s cubic-bezier(0.32, 0, 0.16, 1) both;
}
.menu-overlay.open .menu-panel > a:nth-of-type(1) { animation-delay: 0.07s; }
.menu-overlay.open .menu-panel > a:nth-of-type(2) { animation-delay: 0.12s; }
.menu-overlay.open .menu-panel > a:nth-of-type(3) { animation-delay: 0.17s; }
.menu-overlay.open .menu-panel > a:nth-of-type(4) { animation-delay: 0.22s; }

/* ---------- мануалы ---------- */
.manual-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.manual-tag {
  font-size: 11px; font-weight: 700; color: var(--green-dark);
  background: var(--green-soft); padding: 3px 9px; border-radius: 999px;
}
.manual-sub {
  font-size: 12px; font-weight: 700; color: var(--muted);
  margin: 14px 0 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.manual-note {
  font-size: 13px; color: var(--muted); margin: 10px 0 0;
  background: var(--surface-2); border-radius: 10px; padding: 10px 12px;
}
.manual-table { margin-top: 10px; }
.shelf-row.mcols { grid-template-columns: 1.6fr 1fr 1fr 1fr; }

/* ---------- сертификация (аккордеон) ---------- */
.cert-row {
  position: relative; padding: 12px 0 12px 28px;
  font-size: 14px; line-height: 1.5;
  border-bottom: 1px solid var(--line); color: var(--ink);
}
.cert-row::before {
  content: "✓"; position: absolute; left: 0; top: 12px;
  color: var(--green); font-weight: 700;
}
.cert-acc { border-bottom: 1px solid var(--line); }
.cert-block .cert-acc:last-child, .cert-block .cert-row:last-child { border-bottom: none; }
.cert-q {
  width: 100%; display: flex; align-items: flex-start; gap: 10px;
  justify-content: space-between; background: transparent; border: none;
  cursor: pointer; text-align: left; padding: 12px 0 12px 28px;
  font-size: 14px; font-weight: 600; color: var(--green-dark);
  position: relative; line-height: 1.45; font-family: inherit;
}
.cert-q::before {
  content: "?"; position: absolute; left: 0; top: 13px;
  width: 17px; height: 17px; background: var(--green); color: #fff;
  border-radius: 50%; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.cert-chev { flex: 0 0 auto; color: var(--muted); transition: transform .22s; font-size: 16px; line-height: 1.2; }
.cert-acc.open .cert-chev { transform: rotate(180deg); }
.cert-a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.cert-acc.open .cert-a { grid-template-rows: 1fr; }
.cert-a-inner { overflow: hidden; min-height: 0; padding-left: 28px; }
.cert-acc.open .cert-a-inner { padding-bottom: 12px; }
.cert-p { margin: 0 0 8px; font-size: 13.5px; color: var(--ink); line-height: 1.55; text-wrap: pretty; }
.cert-p:last-child { margin-bottom: 0; }
.cert-note {
  margin: 8px 0 0; font-size: 13px; color: var(--warn-text);
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-radius: 10px; padding: 9px 11px;
}
.cert-steps { margin-top: 4px; }
.cert-table { margin: 8px 0; font-size: 12.5px; }
.cert-trow { grid-template-columns: 1.4fr 1fr 1fr; }
.cert-table.cols-2 .cert-trow { grid-template-columns: 1.6fr 1fr; }

/* ---------- поиск ---------- */
.search-wrap { margin-bottom: 12px; }
.search-box { position: relative; }
.search {
  width: 100%; padding: 13px 16px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 117, 74, 0.12);
}
.search-box .search { padding-right: 44px; }
.search-clear {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: var(--surface-2); color: var(--muted); font-size: 13px;
  display: none; place-items: center; cursor: pointer; padding: 0;
}
.search-clear.show { display: grid; }
.search-box .search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.result-count { font-size: 12px; color: var(--muted); margin: 0 2px 10px; min-height: 14px; }

/* ---------- чипы категорий ---------- */
.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  /* Расширяем до краёв контейнера и добавляем fade-маску */
  padding: 2px 16px 12px;
  margin: 0 -16px;
  width: calc(100% + 32px);
  scrollbar-width: none;
  /* Плавное исчезновение на краях вместо жёсткой обрезки */
  mask-image: linear-gradient(
    to right,
    transparent 0px,
    black 16px,
    black calc(100% - 16px),
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0px,
    black 16px,
    black calc(100% - 16px),
    transparent 100%
  );
}
.chips::-webkit-scrollbar { display: none; }

/* Чипы внутри секций (калькулятор) — без отрицательных отступов и маски */
.calc-chips {
  margin: 0;
  width: 100%;
  padding: 0 0 8px;
  mask-image: none;
  -webkit-mask-image: none;
}

.chip {
  flex: 0 0 auto; padding: 8px 15px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s;
}
.chip.active {
  background: var(--green); color: #fff; border-color: var(--green);
  box-shadow: 0 2px 8px rgba(0, 117, 74, 0.22);
}
.chip:active { transform: scale(0.94); }

/* ---------- сетка карточек (CSS subgrid для выравнивания строк) ----------
   Каждая карточка делится на 3 строки: верх (эмодзи + код) / название / бейдж.
   В app.js makeCard() нужна плоская структура:
     .card-top → .card-name → .card-badge
   .card-badge всегда в DOM — пустой div если напиток не сезонный.
*/
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 12px;
  row-gap: 10px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  align-items: start;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
/* Fallback для браузеров без subgrid */
@supports not (grid-template-rows: subgrid) {
  .card { display: flex; flex-direction: column; gap: 8px; }
  .card-name { flex: 1; }
}
.card:active { transform: scale(0.97); box-shadow: none; }

.card-emoji {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--green-soft); display: grid; place-items: center; font-size: 24px;
}
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-name { font-weight: 600; font-size: 15px; line-height: 1.35; }
/* Слот бейджа — всегда в DOM, пустой если напиток не сезонный */
.card-badge { display: flex; align-items: flex-start; }
.card-code {
  display: inline-block; background: var(--green-soft); color: var(--green-dark);
  font-weight: 700; padding: 2px 7px; border-radius: 6px;
  width: fit-content; font-size: 11px; letter-spacing: 0.15px;
}
.empty {
  grid-column: 1 / -1; text-align: center; color: var(--muted);
  padding: 48px 0; font-size: 14px;
}

/* бейдж сезона */
.badge-season {
  display: inline-block; margin-top: 4px; font-size: 10px; font-weight: 700;
  color: #8a6d00; background: #fdf3d4; border: 1px solid #f0e0a8;
  padding: 2px 8px; border-radius: 6px; width: fit-content; line-height: 1.4;
}
.detail-badge { font-size: 12px; margin-top: 6px; }

.season-head {
  grid-column: 1 / -1; margin: 8px 0 2px;
  font-size: 14.5px; font-weight: 700; color: var(--green);
  padding-bottom: 8px; border-bottom: 2px solid var(--green-soft);
  letter-spacing: -0.01em;
}

/* ---------- футер главной ---------- */
.home-foot { margin-top: 32px; text-align: center; }
.foot-note { font-size: 12px; color: var(--muted); margin: 0 auto; max-width: 480px; }
.foot-legal {
  margin: 16px auto 0; max-width: 520px; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px; line-height: 1.6; color: var(--muted); text-align: left;
}
.foot-legal p { margin: 0 0 8px; text-wrap: pretty; }
.foot-legal p:last-child { margin-bottom: 0; }
.foot-legal a { color: var(--green-dark); font-weight: 600; text-decoration: none; }

/* ---------- нижний таб-бар (плавающий, Liquid Glass) ---------- */
.tab-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 45; display: flex; gap: 2px; padding: 6px;
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 24px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 66px; padding: 7px 8px 5px;
  /* капсула-pill, концентрично pill-бару: внутренний радиус не меньше внешнего */
  border-radius: var(--radius-pill);
  color: var(--muted); text-decoration: none;
  font-size: 10.5px; font-weight: 600; letter-spacing: -0.01em;
  transition: color .15s, background .15s, transform .12s;
}
.tab.active { color: var(--green-dark); background: var(--green-soft); }
.tab:active { transform: scale(0.93); }
.tab-ico { width: 25px; height: 25px; display: block; }
.tab-label { line-height: 1; }

/* ---------- страница «Ещё» ---------- */
.more-list { padding: 6px; }
.more-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 10px; border-radius: 12px;
  text-decoration: none; color: var(--ink);
  transition: background .14s;
}
.more-row:active { background: var(--surface-2); }
.more-ico { font-size: 22px; flex: 0 0 auto; width: 30px; text-align: center; }
.more-text { display: flex; flex-direction: column; flex: 1; gap: 2px; }
.more-label { font-size: 15px; font-weight: 600; }
.more-sub { font-size: 12.5px; color: var(--muted); }
.more-chev { color: var(--muted); font-size: 22px; font-weight: 300; }
.more-head {
  font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin: 22px 2px 8px;
}
.more-gap { margin-top: 18px; }
.more-foot { margin-top: 24px; }

/* ---------- кнопка «Наверх» ---------- */
.to-top {
  position: fixed; right: calc(16px + env(safe-area-inset-right));
  bottom: calc(78px + env(safe-area-inset-bottom));
  width: 46px; height: 46px; border-radius: 50%; z-index: 40;
  border: 1px solid var(--glass-border); background: var(--glass); color: var(--green-dark);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  font-size: 20px; line-height: 1; cursor: pointer; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:active { transform: scale(0.92); }

/* ---------- детальная страница ---------- */
.detail-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.back {
  display: inline-block; color: var(--green); text-decoration: none;
  font-weight: 600; padding: 8px 0; font-size: 15px;
}
.back.ghost { color: var(--muted); font-weight: 500; font-size: 13px; }

.detail-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.detail-emoji {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--green-soft); display: grid; place-items: center;
  font-size: 30px; flex: 0 0 auto;
}
.detail-head h2 {
  margin: 0; font-size: 23px; font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.2;
}
.detail-sub {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); margin-top: 5px;
}

.page-title {
  font-size: 22px; margin: 12px 0 16px;
  color: var(--green-dark); font-weight: 700; letter-spacing: -0.03em;
}

/* сегменты температуры — стиль iOS */
.seg {
  display: flex; gap: 0; background: var(--surface-2);
  padding: 3px; border-radius: 13px; margin-bottom: 12px;
  /* обводка, чтобы «дорожка» читалась в светлой теме (surface-2 ≈ фон страницы) */
  border: 1px solid var(--line);
}
.seg-btn {
  flex: 1; padding: 9px; border: none; background: transparent;
  border-radius: 9px; font-size: 14px; font-weight: 590;
  color: var(--ink); cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg-btn.active {
  background: var(--surface); color: var(--green-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .04);
}
.seg-static {
  flex: 1; text-align: center; padding: 9px;
  font-weight: 600; color: var(--green-dark);
}

/* выбор объёма */
.vol-row { display: flex; gap: 8px; margin-bottom: 16px; }
.vol-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 6px; border: 1.5px solid var(--line);
  background: var(--surface); border-radius: 16px; cursor: pointer;
  transition: border-color .14s, background .14s, box-shadow .14s, transform .12s;
}
.vol-btn.active {
  border-color: var(--green); background: var(--green-soft);
  box-shadow: var(--shadow);
}
.vol-btn:active { transform: scale(0.95); }
.vol-label { font-size: 13px; font-weight: 600; color: var(--green-dark); }
.vol-ml { font-size: 12px; color: var(--muted); }
.vol-btn.active .vol-ml { color: var(--green); opacity: 0.75; }
.vol-single {
  flex: 1; padding: 12px; background: var(--green-soft); border-radius: 16px;
  font-size: 13px; color: var(--green-dark); text-align: center;
}

/* статы — единый ряд одинаковых плиток (иконка сверху) */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px; margin-bottom: 16px;
}
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 15px; padding: 12px 8px;
  box-shadow: var(--shadow);
}
.stat-icon { font-size: 22px; }
.stat-label {
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; font-weight: 600;
}
.stat-value { font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.3; }

/* секции */
.section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.section h3 {
  margin: 0 0 14px; font-size: 16px; font-weight: 700;
  color: var(--green-dark); letter-spacing: -0.02em;
}

/* таблица ингредиентов */
.ing-table { display: flex; flex-direction: column; }
.ing-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); align-items: start;
}
.ing-row:last-child { border-bottom: none; }
.ing-head {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; font-weight: 600; padding-top: 0;
}
.ing-name { font-weight: 600; font-size: 14px; line-height: 1.4; }
.ing-row.optional .ing-name { font-weight: 500; color: var(--muted); }
.ing-note { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 3px; line-height: 1.4; }
.ing-dose {
  font-size: 14px; font-weight: 700; color: var(--green-dark);
  text-align: right; word-break: break-word;
}
.ing-head .ing-dose { font-weight: 600; color: var(--muted); }
.tag-opt {
  display: inline-block; white-space: nowrap; vertical-align: middle;
  font-size: 10px; font-weight: 600; padding: 1px 7px; margin-left: 6px;
  border-radius: 6px; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line);
}

/* шаги */
.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; }
.steps li {
  position: relative; padding: 0 0 16px 40px;
  counter-increment: step; font-size: 15px; line-height: 1.5;
  text-wrap: pretty;
}
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 13px; top: 27px; bottom: 4px;
  width: 1.5px; background: var(--line);
}

/* украшение */
.deco { margin: 0; padding-left: 20px; }
.deco li { font-size: 14px; margin-bottom: 7px; line-height: 1.45; }

/* КБЖУ */
.kbzhu-wrap { margin-bottom: 16px; }
.kbzhu {
  display: flex; flex-wrap: wrap; gap: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 15px; padding: 10px 6px; overflow: hidden;
}
.kbzhu-item {
  flex: 1 1 0; min-width: 64px; text-align: center;
  display: flex; flex-direction: column; gap: 3px; padding: 4px 6px;
}
.kbzhu-item + .kbzhu-item { border-left: 1px solid var(--line); }
.kbzhu-k {
  font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.02em; font-weight: 600;
}
.kbzhu-v {
  font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em;
}
.kbzhu-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* справочные примечания */
.ref-note { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.6; text-wrap: pretty; }
.ref-note:last-child { margin: 12px 0 0; }

/* сроки годности */
.shelf-search { margin-bottom: 12px; }
.shelf-empty { padding: 20px 0; text-align: center; color: var(--muted); font-size: 13px; }
.shelf-table { display: flex; flex-direction: column; font-size: 13px; }
.shelf-row {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.shelf-row.two { grid-template-columns: 1.4fr 1fr; }
.shelf-row:last-child { border-bottom: none; }
.shelf-head {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; font-weight: 600;
}
.shelf-row > div:first-child { font-weight: 600; }
.shelf-row > div:not(:first-child) { color: var(--muted); }

/* ---------- safe-area под статус-бар ---------- */
.app { padding-top: calc(16px + env(safe-area-inset-top)); }

/* поиск — нативный iOS */
.search { font-size: 17px; }
.search::placeholder { color: var(--muted); }

/* настройки в меню */
.menu-settings { margin-top: auto; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.size-ctrl { display: flex; align-items: center; gap: 10px; }
.size-btn {
  flex: 0 0 auto; min-width: 52px; padding: 9px 0;
  border: 1.5px solid var(--line); background: var(--surface);
  color: var(--green-dark); border-radius: 10px;
  font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: transform 0.12s;
}
.size-btn:active { transform: scale(0.93); }
.size-val { flex: 1; text-align: center; font-size: 14px; font-weight: 600; color: var(--ink); }

.theme-row { padding-top: 2px; }
.theme-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin: 0 0 8px 2px;
}
.theme-seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: 3px; gap: 0; }
.theme-seg button {
  flex: 1; border: none; background: transparent; cursor: pointer;
  font-family: inherit; padding: 9px 6px; border-radius: 9px;
  font-size: 13px; font-weight: 590; color: var(--ink);
  transition: background .15s, color .15s;
}
.theme-seg button.active {
  background: var(--surface); color: var(--green-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .04);
}

/* эмодзи-плашки */
.card-emoji, .detail-emoji { background: var(--green-soft); }

/* уважение к «Уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- калькулятор ---------- */
.calc-input {
  display: block; width: 100%; min-width: 0; max-width: 100%;
  padding: 12px 14px; font-size: 17px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.calc-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 117, 74, 0.12);
}
input[type="date"].calc-input::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="date"].calc-input::-webkit-calendar-picker-indicator { margin: 0 0 0 auto; }
.calc-custom { margin-top: 10px; }
.calc-field-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin: 16px 0 8px 2px;
}
.calc-result {
  margin-top: 16px; text-align: center;
  background: var(--green-soft); border-radius: 15px; padding: 16px 12px;
}
.calc-result-label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); font-weight: 600;
}
.calc-result-date {
  font-size: 21px; font-weight: 700; color: var(--green-dark);
  margin: 5px 0 3px; letter-spacing: -0.03em;
}
.calc-result-term { font-size: 12px; color: var(--muted); }

/* ---------- экран блокировки (PIN) ---------- */
.lock {
  position: fixed; inset: 0; z-index: 100;
  background: var(--cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(40px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  /* при нехватке высоты — прокрутка, чтобы дисклеймер не обрезался */
  overflow-y: auto;
  animation: lockIn .3s ease both;
  /* запрет double-tap-zoom на всём экране входа */
  touch-action: manipulation;
}
.lock.unlocked { animation: lockOut .26s ease forwards; }
@keyframes lockIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes lockOut { to { opacity: 0; transform: scale(1.03); } }

.lock-body {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 320px;
}
.lock-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lock-brand .brand-star { font-size: 36px; }
.lock-brand h1 {
  margin: 0; font-size: 30px; font-weight: 700;
  letter-spacing: -0.04em; color: var(--green-dark);
}
.lock-desc {
  margin: 0 0 16px; text-align: center; font-size: 14px;
  color: var(--muted); line-height: 1.5; max-width: 280px;
}
.lock-badge {
  margin: 0 0 16px; padding: 4px 12px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-dark);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.lock-hint {
  margin: 0 0 28px; text-align: center; font-size: 13.5px;
  font-weight: 600; color: var(--ink);
}
.lock-dots { display: flex; gap: 14px; margin-bottom: 34px; height: 14px; }
.lock-dot {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid var(--green); background: transparent;
  transition: background .15s, transform .15s;
}
.lock-dot.filled { background: var(--green); transform: scale(1.05); }

.pinpad {
  display: grid; grid-template-columns: repeat(3, 72px);
  gap: 18px; justify-content: center;
}
.pin-spacer { width: 72px; height: 72px; }
.pin-key {
  width: 72px; height: 72px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font-family: inherit; font-size: 28px; font-weight: 500;
  cursor: pointer; box-shadow: var(--shadow);
  transition: transform .1s, background .15s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.pin-key:active { transform: scale(0.92); background: var(--green-soft); }
.pin-del {
  border: none; background: transparent; box-shadow: none;
  font-size: 24px; color: var(--muted);
}
.pin-del:active { background: transparent; }

.lock-legal {
  margin: 36px 0 0; text-align: center; font-size: 10px; line-height: 1.55;
  color: var(--muted); max-width: 340px; flex: 0 0 auto;
}
.lock-legal a { color: var(--green-dark); text-decoration: none; }

/* тряска при неверном PIN */
.lock.shake .lock-body { animation: shake .4s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* ==================== тест по сертификации ==================== */
/* Механики Duolingo (прогресс, физическая кнопка, пружинная анимация)
   на палитре приложения. Фидбек всегда цвет + текст, не только цвет. */
body.quiz-active .tab-bar,
body.quiz-active .to-top { display: none; }

/* CTA на странице сертификации */
.quiz-cta {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px; margin-bottom: 14px;
  background: var(--green); color: #fff;
  border-radius: 16px; text-decoration: none;
  box-shadow: 0 4px 0 var(--btn-shadow);
  transition: transform .08s, box-shadow .08s;
}
.quiz-cta:active { transform: translateY(4px); box-shadow: 0 0 0 var(--btn-shadow); }
.quiz-cta-ico { font-size: 24px; }
.quiz-cta-text { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.quiz-cta-t { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.quiz-cta-s { font-size: 12px; opacity: .85; }
.quiz-cta-chev { font-size: 22px; font-weight: 300; opacity: .7; }

/* выбор режима */
.quiz-modes { display: flex; flex-direction: column; gap: 10px; }
.quiz-mode {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--radius);
  font-family: inherit; box-shadow: 0 2px 0 var(--line);
  transition: transform .08s, box-shadow .08s, border-color .15s;
}
.quiz-mode:active { transform: translateY(2px); box-shadow: none; border-color: var(--green); }
.quiz-mode-ico { font-size: 26px; }
.quiz-mode-text { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.quiz-mode-t { font-size: 16px; font-weight: 700; }
.quiz-mode-s { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* верхняя шкала прогресса с маркерами разделов */
.quiz-top { display: flex; align-items: center; gap: 12px; margin: 4px 0 20px; }
.quiz-x {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--surface-2); color: var(--muted);
  font-size: 14px; cursor: pointer; font-family: inherit;
  transition: transform .1s;
}
.quiz-x:active { transform: scale(0.9); }
.quiz-track {
  position: relative; flex: 1; height: 14px;
  border-radius: 999px; background: var(--surface-2); overflow: hidden;
}
.quiz-fill {
  height: 100%; border-radius: 999px; background: var(--green);
  transition: width .5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-mark {
  position: absolute; top: 50%; width: 4px; height: 4px; border-radius: 50%;
  background: var(--muted); opacity: .55; transform: translate(-50%, -50%);
}
.quiz-count { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--muted); }

/* карточка вопроса */
.quiz-card { animation: quizIn .32s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes quizIn { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
.quiz-section {
  margin: 0 0 6px; font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: var(--green);
}
.quiz-card h2 { margin: 0 0 18px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.quiz-hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

/* главная кнопка — «физическая», как в Duolingo */
.quiz-actions { margin-top: 20px; }
.quiz-actions-col { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.quiz-btn {
  display: block; width: 100%; padding: 15px;
  border: none; border-radius: 16px;
  background: var(--green); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 800; letter-spacing: .01em;
  cursor: pointer; box-shadow: 0 4px 0 var(--btn-shadow);
  transition: transform .08s, box-shadow .08s, opacity .15s;
}
.quiz-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--btn-shadow); }
.quiz-btn:disabled { opacity: .35; box-shadow: none; cursor: default; }
.quiz-btn-danger { background: var(--bad); box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.quiz-btn-secondary {
  background: var(--surface); color: var(--green-dark);
  border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line);
}
.quiz-btn-secondary:active:not(:disabled) { box-shadow: 0 0 0 var(--line); }
.quiz-ghost {
  display: block; width: 100%; padding: 13px; text-align: center;
  background: transparent; border: none; border-radius: 16px;
  color: var(--green-dark); font-family: inherit; font-size: 15px; font-weight: 700;
  text-decoration: none; cursor: pointer;
}

/* поля ввода слов */
.quiz-input {
  display: block; width: 100%; padding: 14px 16px; margin-bottom: 10px;
  font-family: inherit; font-size: 17px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .02em;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); outline: none;
  transition: border-color .2s, background .2s;
  -webkit-appearance: none; appearance: none;
}
.quiz-input:focus { border-color: var(--green); }
.quiz-input.ok {
  border-color: var(--green); background: var(--green-soft); color: var(--green-dark);
  animation: quizPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-input.bad { border-color: var(--bad); background: var(--bad-soft); animation: quizShake .4s; }

/* варианты ответа (choice) */
.quiz-opt {
  display: block; width: 100%; margin-bottom: 10px; padding: 14px 16px;
  text-align: left; font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.4;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
  transition: transform .08s, box-shadow .08s, border-color .15s, background .2s;
}
.quiz-opt:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.quiz-opt.sel { border-color: var(--green); box-shadow: 0 2px 0 var(--green); }
.quiz-opt.ok {
  border-color: var(--green); background: var(--green-soft); color: var(--green-dark);
  box-shadow: none; animation: quizPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-opt.bad { border-color: var(--bad); background: var(--bad-soft); box-shadow: none; animation: quizShake .4s; }
.quiz-opt:disabled { cursor: default; }

/* чипы (мульти-выбор и банк порядка) */
.quiz-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.quiz-chip {
  padding: 10px 15px; font-family: inherit; font-size: 14px; font-weight: 600;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
  transition: transform .08s, box-shadow .08s, border-color .15s, background .2s;
}
.quiz-chip:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.quiz-chip.sel { border-color: var(--green); color: var(--green-dark); background: var(--green-soft); }
.quiz-chip.ok {
  border-color: var(--green); background: var(--green-soft); color: var(--green-dark);
  box-shadow: none; animation: quizPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-chip.bad { border-color: var(--bad); background: var(--bad-soft); box-shadow: none; animation: quizShake .4s; }
.quiz-chip.hint { border-color: var(--green); border-style: dashed; color: var(--green-dark); }
.quiz-chip:disabled { cursor: default; }
.quiz-picked { color: var(--green-dark); font-weight: 800; }

/* порядок: собранный список */
.quiz-order-list { margin-bottom: 14px; min-height: 44px; }
.quiz-slot {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin-bottom: 8px; padding: 11px 14px; text-align: left;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.35;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: border-color .15s, background .2s;
  animation: quizPop .25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-slot-num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  background: var(--green-soft); color: var(--green-dark);
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.quiz-slot.ok { border-color: var(--green); background: var(--green-soft); }
.quiz-slot.bad { border-color: var(--bad); background: var(--bad-soft); animation: quizShake .4s; }

/* соответствие: две колонки */
.quiz-match { display: flex; gap: 8px; }
.quiz-mcol { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.quiz-mbtn {
  flex: 1; min-height: 56px; padding: 10px;
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.3;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
  transition: transform .08s, box-shadow .08s, border-color .15s, background .2s, opacity .2s;
}
.quiz-mbtn:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.quiz-mbtn.sel { border-color: var(--green); background: var(--green-soft); }
.quiz-mbtn.ok {
  border-color: var(--green); background: var(--green-soft); color: var(--green-dark);
  opacity: .55; box-shadow: none; animation: quizPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-mbtn.bad { border-color: var(--bad); background: var(--bad-soft); box-shadow: none; animation: quizShake .4s; }
.quiz-mbtn:disabled { cursor: default; }

/* фидбек: всегда текст + цвет */
.quiz-feedback {
  margin-top: 16px; padding: 14px 16px; border-radius: 16px;
  animation: quizPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-feedback.good { background: var(--green-soft); border: 1.5px solid var(--green); }
.quiz-feedback.bad { background: var(--bad-soft); border: 1.5px solid var(--bad); }
.quiz-feedback-t { margin: 0; font-size: 15px; font-weight: 800; }
.quiz-feedback.good .quiz-feedback-t { color: var(--green-dark); }
.quiz-feedback.bad .quiz-feedback-t { color: var(--bad-text); }
.quiz-feedback-s { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink); }

/* подтверждение выхода */
.quiz-veil {
  position: fixed; inset: 0; z-index: 90; background: var(--scrim);
  display: grid; place-items: center; padding: 24px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.quiz-dialog {
  width: 100%; max-width: 320px; padding: 20px;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 10px;
  animation: quizPop .25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-dialog-t { margin: 0; font-size: 17px; font-weight: 800; text-align: center; }
.quiz-dialog-s { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); text-align: center; }

/* итог */
.quiz-result-head { text-align: center; margin: 24px 0 8px; }
.quiz-result-emoji { font-size: 56px; animation: quizPop .45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.quiz-result-head .page-title { margin: 10px 0 4px; }
.quiz-score { margin: 0 0 18px; font-size: 15px; color: var(--muted); font-weight: 600; }
.quiz-score-big { font-size: 40px; font-weight: 800; color: var(--green-dark); letter-spacing: -0.03em; }
.quiz-result-track { margin-bottom: 20px; }
.quiz-sec-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.quiz-sec-row:last-child { border-bottom: none; }
.quiz-sec-row.weak .quiz-sec-name { font-weight: 700; }
.quiz-sec-ico { flex: 0 0 auto; }
.quiz-sec-name { flex: 1; }
.quiz-sec-score { font-weight: 700; color: var(--muted); }

@keyframes quizPop {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes quizShake {
  10%, 90% { transform: translateX(-2px); }
  25%, 75% { transform: translateX(4px); }
  40%, 60% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
}

/* ==================== UI-апгрейд (аудит дизайна) ==================== */

/* --- категорийные подложки плиток-эмодзи (чай/сезонное — мятная по умолчанию) --- */
.card-emoji.cat-coffee, .detail-emoji.cat-coffee { background: var(--cat-coffee); }
.card-emoji.cat-choco, .detail-emoji.cat-choco { background: var(--cat-choco); }
.card-emoji.cat-chicory, .detail-emoji.cat-chicory { background: var(--cat-chicory); }
.card-emoji.cat-signature, .detail-emoji.cat-signature { background: var(--cat-signature); }
.card-emoji.cat-frappe, .detail-emoji.cat-frappe { background: var(--cat-frappe); }
.card-emoji.cat-milkshake, .detail-emoji.cat-milkshake { background: var(--cat-milkshake); }

/* --- закреплённая glass-шапка главной (scroll-edge, iOS 27) --- */
.home-head {
  position: sticky; top: 0; z-index: 30;
  margin: calc(-16px - env(safe-area-inset-top)) -16px 0;
  padding: calc(12px + env(safe-area-inset-top)) 16px 2px;
  border-radius: 0 0 22px 22px;
  transition: background .25s, box-shadow .25s;
}
.home-head.scrolled {
  background: var(--glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 1px 0 var(--glass-border), 0 8px 24px rgba(0, 30, 18, 0.10);
}
body.no-sticky .home-head { position: static; }
body.no-sticky .home-head.scrolled { background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* --- пустое состояние поиска --- */
.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 44px 20px;
  animation: quizPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.empty-ico { font-size: 42px; margin-bottom: 10px; opacity: .8; }
.empty-t { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.empty-s { margin: 0 0 16px; font-size: 13.5px; color: var(--muted); }
.empty-reset {
  padding: 11px 20px; border: none; border-radius: 999px;
  background: var(--green); color: #fff;
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 0 var(--btn-shadow);
  transition: transform .08s, box-shadow .08s;
}
.empty-reset:active { transform: translateY(3px); box-shadow: 0 0 0 var(--btn-shadow); }

/* --- сворачиваемая секция (сроки годности на карточке напитка) --- */
.collap-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; background: none; border: none; padding: 0;
  cursor: pointer; text-align: left; font-family: inherit;
}
.collap-head h3 { margin: 0; }
.collap .cert-chev { transition: transform .22s; }
.collap.open .cert-chev { transform: rotate(180deg); }
.collap-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.collap.open .collap-body { grid-template-rows: 1fr; }
.collap-inner { overflow: hidden; min-height: 0; }
.collap.open .collap-inner { padding-top: 12px; }

/* --- стаггер-появление карточек сетки --- */
.card-in { animation: cardIn .3s ease both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --- сплэш при загрузке: пока #app пуст, показываем пульсирующую звезду
     (спасает от «белого экрана», когда JS ещё грузится) --- */
.app:empty { min-height: 70vh; position: relative; }
.app:empty::before {
  content: "★"; position: absolute; inset: 0;
  display: grid; place-items: center; padding-bottom: 48px;
  font-size: 54px; color: var(--accent);
  animation: splashPulse 1.15s ease-in-out infinite;
}
.app:empty::after {
  content: "StarBarista"; position: absolute; inset: 0;
  display: grid; place-items: center; padding-top: 64px;
  font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: .02em;
}
@keyframes splashPulse {
  0%, 100% { opacity: .35; transform: scale(.94); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* --- iOS-переключатель (Ещё → Интерфейс) --- */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0;
}
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-label { font-size: 14.5px; font-weight: 600; }
.switch {
  flex: 0 0 auto; width: 51px; height: 31px; border-radius: 999px;
  border: none; background: var(--surface-2); cursor: pointer; padding: 2px;
  display: flex; align-items: center;
  transition: background .2s;
}
.switch-knob {
  width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.switch.on { background: var(--green); }
.switch.on .switch-knob { transform: translateX(20px); }

/* --- усиленный отклик нажатий (отключается в «Ещё») --- */
body:not(.no-pressfx) .card:active {
  transform: scale(0.94); filter: brightness(0.96);
  transition: transform .06s, filter .06s, box-shadow .06s;
}
body:not(.no-pressfx) .chip:active { transform: scale(0.88); }
body:not(.no-pressfx) .vol-btn:active { transform: scale(0.9); }
body:not(.no-pressfx) .tab:active { transform: scale(0.82); }
body:not(.no-pressfx) .more-row:active { transform: scale(0.96); background: var(--surface-2); }
body:not(.no-pressfx) .cert-q:active { opacity: .55; }
body:not(.no-pressfx) .quiz-opt:active:not(:disabled) { transform: translateY(2px) scale(0.98); }

/* --- выразительнее главный CTA (тест) --- */
.quiz-cta { background: linear-gradient(180deg, var(--green) 0%, var(--btn-shadow) 160%); }

/* ==================== Liquid Glass (техника reactbits GlassSurface) ====================
   Фрост-фолбэк (краевые блики + насыщенный blur) виден на всех платформах,
   включая iOS Safari. Настоящее преломление фона через SVG-фильтр
   (#glass-distortion) включается классом body.glass-fx только там, где
   backdrop-filter: url() реально работает (Chromium) — см. app.js. */
.glass-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }

/* краевой блик стекла — тонкая светлая кромка сверху + обводка */
.tab-bar::after, .to-top::after, .home-head.scrolled::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; z-index: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.14),
    inset 0 -6px 12px -8px rgba(255, 255, 255, 0.22);
}
/* блик над иконками таб-бара не перехватывает тап */
.tab-bar { position: fixed; }
.tab-bar > .tab { position: relative; z-index: 2; }

:root[data-theme="dark"] .tab-bar::after,
:root[data-theme="dark"] .to-top::after,
:root[data-theme="dark"] .home-head.scrolled::after {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tab-bar::after,
  :root:not([data-theme="light"]) .to-top::after,
  :root:not([data-theme="light"]) .home-head.scrolled::after {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.20),
      inset 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  }
}

/* настоящее преломление фона (Chromium) — заменяет обычный blur */
body.glass-fx .tab-bar,
body.glass-fx .to-top,
body.glass-fx .home-head.scrolled,
body.glass-fx .menu-panel {
  /* --gf = per-element фильтр (задаётся из app.js), иначе общий запасной */
  backdrop-filter: var(--gf, url(#glass-distortion)) blur(2px) saturate(1.7) brightness(1.05);
  -webkit-backdrop-filter: var(--gf, url(#glass-distortion)) blur(2px) saturate(1.7) brightness(1.05);
}
/* при включённом преломлении делаем подложку чуть прозрачнее — эффект виднее */
body.glass-fx .tab-bar { background: color-mix(in srgb, var(--glass-strong) 78%, transparent); }
body.glass-fx .to-top { background: color-mix(in srgb, var(--glass) 82%, transparent); }

/* ==================== экран «Установить приложение» ==================== */
/* пока показан экран установки — прячем плавающий chrome и сплэш-заставку */
body.install-open .tab-bar,
body.install-open .to-top { display: none; }
body.install-open .app::before,
body.install-open .app::after { content: none; }

.install {
  position: fixed; inset: 0; z-index: 120;
  background: var(--cream); color: var(--ink);
  display: flex; flex-direction: column; align-items: center;
  padding: calc(28px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: installIn .32s cubic-bezier(0.32, 0, 0.16, 1);
}
.install.closing { animation: installOut .22s ease forwards; }
@keyframes installIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes installOut { to { opacity: 0; } }

.install-brand { display: flex; align-items: center; gap: 9px; margin-bottom: auto; }
.install-brand .brand-star { font-size: 22px; }
.install-brand-name { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; color: var(--green-dark); }

.install-inner {
  width: 100%; max-width: 400px;
  margin: auto 0; display: flex; flex-direction: column; gap: 24px;
}
.install-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.install-emoji { font-size: 46px; line-height: 1; margin-bottom: 2px; }
.install-title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.install-desc { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); max-width: 32ch; }
.install-hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

/* QR */
.install-qr-card {
  margin-top: 8px; padding: 16px; background: #fff; border-radius: 20px;
  box-shadow: var(--shadow-lg); display: inline-flex;
}
.install-qr { width: 216px; height: 216px; display: block; image-rendering: pixelated; }
.install-url { font-size: 15px; font-weight: 700; color: var(--green-dark); word-break: break-all; max-width: 216px; }

/* iOS-инструкция */
.install-steps { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 6px; text-align: left; }
.install-step {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.install-step-num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  background: var(--green-soft); color: var(--green-dark);
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.install-step-txt { font-size: 14px; font-weight: 600; }
.install-inline { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; color: var(--green-dark); }
.install-share { width: 17px; height: 17px; vertical-align: -3px; }

/* кнопки */
.install-actions { display: flex; flex-direction: column; gap: 4px; }
.install-btn {
  display: block; width: 100%; padding: 15px; border: none; border-radius: 16px;
  background: var(--green); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 800; letter-spacing: .01em;
  cursor: pointer; box-shadow: 0 4px 0 var(--btn-shadow);
  transition: transform .08s, box-shadow .08s;
}
.install-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--btn-shadow); }
.install-ghost {
  display: block; width: 100%; padding: 13px; text-align: center;
  background: transparent; border: none; border-radius: 16px;
  color: var(--muted); font-family: inherit; font-size: 14.5px; font-weight: 700;
  cursor: pointer;
}
.install-ghost:active { color: var(--ink); }

/* ==================== ежедневный баннер «портфолио» ==================== */
body.notice-open .tab-bar,
body.notice-open .to-top { display: none; }
body.notice-open .app::before,
body.notice-open .app::after { content: none; }

.notice {
  position: fixed; inset: 0; z-index: 120;
  background: var(--cream); color: var(--ink);
  display: flex; flex-direction: column; align-items: center;
  /* нижний отступ по гайдлайну Apple: 20pt над safe-area (home indicator) */
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: installIn .32s cubic-bezier(0.32, 0, 0.16, 1);
}
.notice.closing { animation: installOut .22s ease forwards; }
/* контент центрируется в свободном пространстве, кнопка живёт у нижнего края */
.notice-copy {
  flex: 1; width: 100%; max-width: 420px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 18px;
}
/* SVG прозрачный и сам круглый — без теней (в iOS Safari drop-shadow на
   внешнем SVG рисуется по прямоугольнику картинки, а не по форме) */
.notice-img-wrap {
  width: min(62vw, 236px); height: min(62vw, 236px);
  animation: quizPop .45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.notice-img { width: 100%; height: 100%; display: block; }
.notice-title {
  margin: 4px 0 0; font-size: 23px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2;
  text-wrap: balance;
}
.notice-text {
  margin: 0; max-width: 34ch; text-align: center;
  font-size: 15px; line-height: 1.6; letter-spacing: 0;
  color: rgba(0, 0, 0, 0.66);
  text-wrap: balance; /* ровные строки — центрированный текст так читается легче */
}
:root[data-theme="dark"] .notice-text { color: rgba(255, 255, 255, 0.70); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .notice-text { color: rgba(255, 255, 255, 0.70); }
}
.notice-actions {
  width: 100%; max-width: 420px; flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 10px; margin-top: 20px;
}
.notice-btn {
  display: block; width: 100%; padding: 15px; border: none; border-radius: 16px;
  background: var(--green); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 800; letter-spacing: .01em;
  cursor: pointer; box-shadow: 0 4px 0 var(--btn-shadow);
  transition: transform .08s, box-shadow .08s;
}
.notice-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--btn-shadow); }
/* архивная заглушка: закрыть нельзя — фон под ней не прокручивается */
body.app-archived { overflow: hidden; }

/* «выключенный» экран после кнопки «Поплакать».
   Чёрный слой ждёт ПОД заглушкой (z-index ниже) — когда та схлопывается,
   под ней открывается чернота, как у гаснущего экрана. */
.shutdown {
  position: fixed; inset: 0; z-index: 119;
  /* чистый чёрный: не зависит от темы, на OLED пиксели гаснут полностью */
  background: #000000;
  display: grid; place-items: center; text-align: center; padding: 24px;
}
.shutdown-inner { opacity: 0; transition: opacity .5s ease .15s; }
.shutdown.on .shutdown-inner { opacity: 1; }
.shutdown-title { margin: 0 0 5px; font-size: 16px; font-weight: 700; color: rgba(255, 255, 255, 0.74); }
.shutdown-sub { margin: 0; font-size: 13px; color: rgba(255, 255, 255, 0.40); }
.shutdown-hint {
  position: absolute; left: 0; right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  margin: 0; font-size: 12px; color: rgba(255, 255, 255, 0.22);
  opacity: 0; transition: opacity .6s ease 1.6s; /* подсказка приходит позже прощания */
}
.shutdown.on .shutdown-hint { opacity: 1; }

/* гашение «как у ЭЛТ»: схлопывание в полоску → в точку, с вспышкой */
.notice.crt-off {
  transform-origin: center center; overflow: hidden;
  animation: crtOff 540ms cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
@keyframes crtOff {
  0%   { transform: scale(1, 1);        filter: brightness(1); }
  8%   { transform: scale(1.006, 1.01); filter: brightness(1.25); }
  55%  { transform: scale(1, 0.006);    filter: brightness(2.6); }
  70%  { transform: scale(1, 0.006);    filter: brightness(2.9); }
  100% { transform: scale(0, 0.006);    filter: brightness(3.4); }
}
/* запасной вариант: обычное затухание (reduced-motion или CRT_SHUTDOWN=false) */
.notice.fade-off { animation: installOut .42s ease forwards; }

/* скрытый вход по коду на архивной заглушке */
.notice-unlock {
  display: flex; gap: 8px; width: 100%; max-width: 300px; margin-top: 4px;
  animation: quizPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.notice-unlock.shake { animation: shake .42s; }
.notice-key {
  flex: 1; min-width: 0; padding: 12px 14px;
  font-family: inherit; font-size: 15px; text-align: center;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); outline: none;
  -webkit-appearance: none; appearance: none;
}
.notice-key:focus { border-color: var(--green); }
.notice-key-btn {
  flex: 0 0 auto; width: 46px; border: none; border-radius: 14px;
  background: var(--green); color: #fff;
  font-family: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
  transition: transform .08s;
}
.notice-key-btn:active { transform: scale(0.94); }
