:root {
  --bg: #0e1014;
  --card: #171a21;
  --card-2: #1f232c;
  --line: #262b36;
  --text: #eef0f4;
  --muted: #8f98a8;
  --accent: #ff6b2c;
  --accent-soft: rgba(255, 107, 44, .14);
  --ok: #2fbf71;
  --bad: #ff6b6b;
  --warn: #e0a100;
  --blue: #5aa2ff;
  --men: #3d8bfd;
  --women: #e8559b;
  --radius: 16px;
  --tabbar-h: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior-y: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, input, select, label, summary { touch-action: manipulation; }
a { color: var(--accent); }
h2 { font-size: 20px; margin: 4px 0 12px; }
h3 { font-size: 17px; margin: 0 0 6px; line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.up { color: var(--ok); }
.down { color: var(--bad); }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }

/* ---------- каркас ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 8px) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
  background: rgba(14, 16, 20, .9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; margin: 0; font-size: 19px; font-weight: 700; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icon-btn { flex: none; width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--card-2); font-size: 20px; line-height: 1;
  display: grid; place-items: center; }
.icon-btn:disabled { opacity: .3; }
main { max-width: 680px; margin: 0 auto;
  padding: 14px calc(16px + env(safe-area-inset-right)) calc(var(--tabbar-h) + 90px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }

#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(14, 16, 20, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; height: var(--tabbar-h); justify-content: center;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; }
#tabbar a span { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .55; transition: .15s; }
#tabbar a.active { color: var(--text); }
#tabbar a.active span { filter: none; opacity: 1; transform: translateY(-1px); }

#offline { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 4; background: #6e4500; color: #fff;
  font-size: 13px; text-align: center; padding: 6px 12px; }

/* ---------- общие элементы ---------- */
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  margin-bottom: 12px; color: var(--text); text-decoration: none; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head a { text-decoration: none; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; }
.empty { color: var(--muted); text-align: center; padding: 28px 16px; font-size: 15px; }
.hello { color: var(--muted); font-size: 15px; margin: 0 4px 12px; }
.hello::first-letter { text-transform: uppercase; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; min-height: 46px;
  border-radius: 12px; border: 0; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; }
.btn.secondary { background: var(--card-2); color: var(--text); }
.btn.sm { padding: 8px 14px; min-height: 38px; font-size: 15px; }
.btn.block { display: flex; width: 100%; }
.btn:active { opacity: .85; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; border: 1px solid var(--line); background: var(--card-2);
  border-radius: 999px; padding: 5px 12px; font-size: 14px; color: var(--text); text-decoration: none; }

/* вкладки внутри раздела */
.tabs { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.tabs a { flex: 1; text-align: center; padding: 9px 4px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 600; }
.tabs a.active { background: var(--card-2); color: var(--text); }

/* сегменты/чипсы выбора */
.seg { display: flex; background: var(--card-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 9px; color: var(--muted); font-size: 15px; font-weight: 500; }
.seg button.active { background: var(--accent); color: #fff; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chips button { border: 1px solid var(--line); background: var(--card-2); border-radius: 999px; padding: 7px 12px; font-size: 14px; }
.chips button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 10px; padding: 0 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll button { flex: none; }

/* списки строк */
.list { padding: 4px 0; }
.list-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 16px 4px; }
details .list-title { padding-left: 0; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 16px; border: 0; background: none; text-align: left;
  color: var(--text); text-decoration: none; border-top: 1px solid var(--line); }
.list .row:first-child, .list-title + .row { border-top: 0; }
.fname { display: block; font-weight: 500; overflow-wrap: anywhere; }
.del { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--card-2); color: var(--muted); font-size: 13px; }
.add-btn { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft);
  color: var(--accent); font-size: 20px; font-weight: 600; text-decoration: none; }

/* прогресс-бары */
.bar { margin-top: 10px; }
.bar-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.bar-top b { color: var(--text); }
.bar-track { height: 7px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .3s; }
.bar-fill.over { background: var(--bad); }
.hint { display: block; margin-top: 12px; font-size: 14px; text-decoration: none; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stats-grid b { display: block; font-size: 22px; }
.stats-grid span { color: var(--muted); font-size: 12px; line-height: 1.25; display: block; }
.wchart { width: 100%; height: 150px; margin-top: 14px; display: block; overflow: visible; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 4px; }

/* формы */
.form label, label.grams { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
.form input, .form select, label.grams input, .inline-form input, .search, .weight-quick input {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); font-size: 16px; color-scheme: dark; }
.form input:focus, .search:focus, label.grams input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { margin: 0; min-width: 0; }
.inline-form input[type=date] { flex: 1.3; }
.inline-form input[name=kg] { flex: 1; }

/* ---------- вход ---------- */
.login { max-width: 340px; margin: 10vh auto 0; text-align: center; }
.login img { border-radius: 18px; }
.login input { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  margin: 16px 0 10px; font-size: 18px; text-align: center; letter-spacing: .2em; }
.error { color: var(--bad); min-height: 20px; font-size: 14px; }

/* ---------- сегодня ---------- */
.cta { border-color: var(--accent); background: var(--accent-soft); }
.cta b { display: block; margin-bottom: 2px; }
.tile { display: flex; align-items: center; gap: 12px; }
.tile-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--card-2); display: grid; place-items: center; font-size: 22px; }
.tile b, .tile .muted.small, .tile .small { display: block; }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.plan-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.plan-row img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: #fff; }
.plan-row .grow { cursor: pointer; }
.plan-row .right { display: flex; align-items: center; gap: 8px; }
.plan-row.eaten { opacity: .55; }
.plan-row.eaten .chip { background: var(--ok); border-color: var(--ok); color: #fff; }
.weight-quick .wq { display: flex; align-items: center; gap: 10px; }
.weight-quick .grow b { display: block; font-size: 20px; }
.weight-quick .grow span { display: block; }
.weight-quick input { width: 96px; margin: 0; text-align: center; }

/* ---------- калории ---------- */
.cal-top { display: flex; align-items: center; gap: 18px; margin-bottom: 4px; }
.ring { --p: 0; --c: var(--accent); flex: none; width: 118px; height: 118px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--card-2) 0); }
.ring > div { width: 96px; height: 96px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; }
.ring b { font-size: 26px; line-height: 1.1; }
.ring span { font-size: 11px; color: var(--muted); line-height: 1.2; }
.cal-nums { display: grid; gap: 10px; flex: 1; }
.cal-nums b { display: block; font-size: 22px; }
.date-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.date-nav b { font-size: 17px; }
.meal-sec { padding: 6px 16px; }
.meal-head { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.meal-head b { flex: 1; font-size: 17px; }
.food-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.food-row .grow { border: 0; background: none; padding: 0; text-align: left; }
.food-row .kcal { flex: none; font-size: 16px; }
.empty-add { display: block; padding: 10px 0 12px; border-top: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 15px; }
.add-top { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 3; background: var(--bg); margin: -14px 0 4px; padding: 14px 0 10px; }
.add-top .search { margin: 10px 0; }
.add-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* шторка снизу */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s; }
.sheet { width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; background: var(--card); border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.sheet-total { margin: 6px 0 14px; font-size: 15px; }
.sheet-total b { font-size: 20px; color: var(--accent); }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }

/* сканер */
.scanner { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; left: 10%; right: 10%; top: 38%; height: 22%; border: 3px solid #fff; border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45); }
.scan-hint { position: relative; color: #fff; margin-bottom: 14px; font-weight: 600; }
.scanner .btn { position: relative; }

/* ---------- рацион ---------- */
.seg.week { margin-bottom: 12px; }
.seg.week button { position: relative; padding: 9px 0; }
.seg.week button.today::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.plan-kcal b { font-size: 26px; }
.macro-pills { display: flex; gap: 6px; margin: 8px 0; }
.macro-pills span { background: var(--card-2); border-radius: 8px; padding: 4px 10px; font-size: 14px; }
.meal { padding: 0; overflow: hidden; }
.meal img { width: 100%; height: 180px; object-fit: cover; display: block; background: #fff; }
.meal-body { padding: 12px 16px 14px; }
.meal-label { color: var(--muted); font-size: 14px; margin-bottom: 2px; }
.meal-label b { color: var(--accent); }
.ingr { list-style: none; padding: 0; margin: 8px 0; }
.ingr li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 6px 0; font-size: 15px; }
.ingr li b { white-space: nowrap; }
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details > summary::after { content: "⌄"; float: right; color: var(--muted); transition: transform .2s; }
details[open] > summary::after { transform: rotate(180deg); }
.how { margin: 8px 0 10px; color: var(--muted); }
.how summary { font-size: 14px; }
.how div { margin-top: 6px; }
.credit { display: block; margin-top: 8px; font-size: 11px; color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop .ingr { margin-top: 12px; }

/* ---------- диеты и продукты ---------- */
.diet.chosen { border-color: var(--accent); }
.diet-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.tag { flex: none; font-size: 12px; background: var(--accent-soft); color: var(--accent); padding: 3px 8px; border-radius: 999px; }
.stars { color: #ffc23d; letter-spacing: 2px; margin-bottom: 4px; }
.pc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 14px; }
.pc ul { padding-left: 18px; margin: 4px 0 8px; }
.rule { padding: 10px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.tips { margin: 6px 0 10px; padding-left: 20px; }
.tips li { margin-bottom: 4px; }
.mistakes li::marker { content: "✕  "; color: var(--bad); }
.food-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.food { background: var(--card-2); border-radius: 12px; overflow: hidden; }
.food img { width: 100%; height: 110px; object-fit: cover; display: block; background: #fff; }
.food-body { padding: 8px 10px 10px; display: grid; gap: 3px; }

/* ---------- вес: анализ и статистика ---------- */
.verdict { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--card-2); margin-top: 12px; }
.verdict .ico { font-size: 22px; line-height: 1.2; }
.verdict.good { background: rgba(47,191,113,.12); }
.verdict.warn { background: rgba(224,161,0,.14); }
.verdict.bad { background: rgba(255,107,107,.12); }
.big-w { font-size: 34px; font-weight: 800; line-height: 1.1; }
.big-w small { font-size: 16px; font-weight: 500; color: var(--muted); }
.w-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.w-delta { text-align: right; font-size: 14px; }
.w-delta b { display: block; font-size: 18px; }
.goal-track { height: 10px; border-radius: 999px; background: var(--card-2); overflow: hidden; margin: 8px 0 4px; }
.goal-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok)); border-radius: 999px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 15px; }
.kv span { color: var(--muted); }
.kv b { text-align: right; }
.wk { width: 100%; border-collapse: collapse; font-size: 15px; }
.wk th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 4px 0; }
.wk td { padding: 7px 0; border-top: 1px solid var(--line); }
.wk td:not(:first-child), .wk th:not(:first-child) { text-align: right; }
.day-log .row { padding: 10px 0; }
.day-log .row .grow span { display: block; }

/* ---------- профиль ---------- */
.norm .big { font-size: 40px; font-weight: 800; margin: 2px 0 10px; }
.norm .big span { font-size: 16px; font-weight: 500; color: var(--muted); }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.macros div { background: var(--card-2); border-radius: 10px; padding: 8px; }
.macros b { display: block; font-size: 20px; }
.macros span { font-size: 12px; color: var(--muted); }

/* ---------- тренировки ---------- */
.next { display: flex; flex-direction: column; gap: 4px; border-color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--card) 70%); }
.next .btn { align-self: flex-start; margin-top: 8px; }
.gender { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gender a { border-radius: var(--radius); padding: 20px 16px; color: #fff; text-decoration: none; min-height: 130px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.gender .men { background: linear-gradient(150deg, #2b5fc4, #16305f); }
.gender .women { background: linear-gradient(150deg, #c93d7f, #5e1b3c); }
.gender .fatloss { grid-column: 1 / -1; min-height: 100px; background: linear-gradient(150deg, #e2671f, #6b2a0c); }
.gender b { font-size: 21px; }
.gender span { opacity: .85; font-size: 14px; }
.day-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line);
  background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; color: var(--text); }
.day-btn .num { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; background: var(--card-2); }
.day-btn.men .num { color: var(--men); } .day-btn.women .num { color: var(--women); } .day-btn.fatloss .num { color: var(--accent); }
.date-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.date-row input { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color-scheme: dark; }
.ex { padding: 0; overflow: hidden; }
.ex-head { display: flex; gap: 12px; padding: 12px; align-items: center; width: 100%; border: 0; background: none; text-align: left; }
.ex-head .thumb { flex: none; width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: #fff; }
.ex-head .done { color: var(--ok); font-weight: 700; }
.ex-body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.anim { position: relative; margin: 12px 0; border-radius: 12px; overflow: hidden; background: #fff; aspect-ratio: 4/3; }
.anim img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .35s; }
.anim .badge { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 999px; }
.note { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 8px; font-size: 14px; margin: 8px 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.links a { color: var(--text); text-decoration: none; }
.user-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0; }
.user-media .m { position: relative; }
.user-media video, .user-media img { width: 100%; border-radius: 10px; background: #000; display: block; max-height: 260px; object-fit: cover; }
.user-media .del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.65); color: #fff; }
.sets { width: 100%; border-collapse: collapse; margin-top: 8px; }
.sets th { font-weight: 500; color: var(--muted); font-size: 13px; text-align: left; padding: 4px; }
.sets td { padding: 4px; }
.sets input { width: 100%; padding: 11px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); text-align: center; font-size: 17px; }
.sets tr.saved input { border-color: var(--ok); }
.sets tr.pending input { border-color: var(--warn); }
.sets .n { width: 30px; color: var(--muted); text-align: center; }
.sets .go { width: 52px; }
.sets .go button { width: 48px; height: 46px; border-radius: 10px; border: 0; background: var(--card-2); font-size: 18px; }
.sets tr.saved .go button { background: var(--ok); color: #fff; }
.sets tr.pending .go button { background: var(--warn); color: #fff; }
.prev { font-size: 13px; color: var(--muted); margin-top: 6px; }
.set-pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* таймер отдыха — над нижним меню */
#timer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; align-items: center; gap: 10px; background: var(--accent); color: #fff; padding: 8px 10px 8px 16px; border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); white-space: nowrap; }
#timer b { font-size: 20px; font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; }
#timer .chip { background: rgba(255,255,255,.2); border: 0; color: #fff; }
#timer.done { background: var(--ok); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 70px + env(safe-area-inset-bottom)); z-index: 50;
  background: #2a2f3a; padding: 10px 16px; border-radius: 12px; max-width: 90vw; box-shadow: 0 6px 24px rgba(0,0,0,.4); animation: up .2s; }
.toast.bad { background: #5a1f24; }

/* ---------- маленькие экраны (iPhone SE) ---------- */
@media (max-width: 370px) {
  main { padding-left: 12px; padding-right: 12px; }
  .card { padding: 13px; }
  .ring { width: 100px; height: 100px; } .ring > div { width: 80px; height: 80px; } .ring b { font-size: 21px; }
  .cal-top { gap: 12px; }
  .tabs a, .seg button { font-size: 13px; }
  .gender a { min-height: 110px; padding: 16px 12px; } .gender b { font-size: 18px; }
  .ex-head .thumb { width: 58px; height: 58px; }
  .stats-grid b, .macros b { font-size: 18px; }
  .norm .big { font-size: 34px; }
  .big-w { font-size: 28px; }
  .pc { grid-template-columns: 1fr; }
  #timer { gap: 6px; padding: 6px 8px 6px 12px; }
  .meal img { height: 150px; }
  .weight-quick input { width: 80px; }
}
@media (min-width: 700px) {
  .meal { display: grid; grid-template-columns: 240px 1fr; }
  .meal img { height: 100%; min-height: 220px; }
}
