/* Дизайн-система No Diet Club — по утверждённому макету главного экрана:
   светлый монохром, шрифт Manrope (файл в web/fonts, без внешних доменов),
   белые карточки с мягкой тенью, единственный акцент — чёрный. */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/manrope-cyrillic-wght-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/manrope-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Цвета */
  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --soft: #F0F0EC;                        /* фон колец, плашки, иконки */
  --accent: #14120F;                      /* весь акцент — чёрный */
  --text: #14120F;
  --text-75: rgba(20,18,15,0.75);
  --text-55: rgba(20,18,15,0.55);
  --text-50: rgba(20,18,15,0.5);
  --text-45: rgba(20,18,15,0.45);
  --text-40: rgba(20,18,15,0.4);
  --dot-empty: rgba(20,18,15,0.22);
  --photo-bg: #E9DCC8;
  --placeholder: rgba(20,18,15,0.55);     /* серый, читаемый плейсхолдер полей ввода */

  /* Интерфейс всегда светлый: без этого тёмная тема WebView может
     перекрасить нативные поля ввода (светлый текст на светлом фоне). */
  color-scheme: light;

  /* Тени и радиусы */
  --shadow-hero: 0 10px 34px rgba(20,18,15,0.07);
  --shadow-card: 0 6px 22px rgba(20,18,15,0.05);
  --shadow-soft: 0 2px 10px rgba(20,18,15,0.06);
  --radius-hero: 26px;
  --radius-card: 22px;

  /* Шрифт */
  --font: 'Manrope', system-ui, sans-serif;

  /* Нижняя панель */
  --tabbar-h: 66px;
  --tabbar-bottom: 26px;
}

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

/* Страница не должна становиться шире вьюпорта ни при каких условиях —
   иначе на iPhone страница «съезжает» вправо при фокусе на поле ввода
   (виден лишний горизонтальный скролл) и не возвращается без щипка.
   max-width:100% на html/body плюс overflow-x:hidden — последняя линия
   защиты даже если какой-то элемент где-то всё-таки вылезет за край. */
html, body { margin: 0; background: var(--bg); max-width: 100%; overflow-x: hidden; }

body {
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* iOS Safari автоматически приближает страницу при фокусе на текстовом
   поле, если его font-size меньше 16px — и после снятия фокуса
   масштаб сам не возвращается без щипка. 16px — не дизайнерский выбор,
   а минимум, при котором iOS вообще не считает нужным приближать. */
input, textarea, select { font-size: 16px; }

/* Общие значения для ВСЕХ полей ввода: явный тёмный текст на светлом фоне
   из токенов (а не наследование из темы браузера), без курсива.
   :where() даёт нулевую специфичность — стили конкретных полей на
   страницах (--soft, --surface, радиусы) по-прежнему главнее. */
:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=button]):not([type=submit]), textarea, select) {
  color: var(--text);
  -webkit-text-fill-color: currentColor;
  background-color: var(--surface);
  font-family: var(--font);
  font-style: normal;
  caret-color: var(--accent);
}
:where(input, textarea)::placeholder {
  color: var(--placeholder);
  -webkit-text-fill-color: var(--placeholder);
  opacity: 1;
  font-style: normal;
}

button { font-family: inherit; }
a { color: var(--text); }

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 54px 20px calc(130px + env(safe-area-inset-bottom)) 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.num { font-variant-numeric: lining-nums tabular-nums; }

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.section-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-50);
}

.link-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-55);
  text-decoration: none;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* Едва заметная «живая» деталь фона — тонкие размытые пятна, медленно
   дрейфующие. Никакого цвета: чёрный акцент на очень низкой прозрачности. */
.ndc-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.ndc-bg span { position: absolute; border-radius: 50%; background: var(--accent); opacity: .05; filter: blur(60px); }
.ndc-bg span:nth-child(1) { width: 320px; height: 320px; top: -80px; left: -100px; animation: ndc-drift-a 24s ease-in-out infinite; }
.ndc-bg span:nth-child(2) { width: 260px; height: 260px; bottom: 60px; right: -80px; opacity: .04; animation: ndc-drift-b 28s ease-in-out infinite; }
@keyframes ndc-drift-a { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(28px, 36px) scale(1.08); } }
@keyframes ndc-drift-b { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-22px, -28px) scale(1.05); } }

/* Переход между экранами (нижняя панель и любая навигация через NDC.navTo) —
   лёгкое затухание вместо мгновенной смены. */
.page { position: relative; z-index: 1; transition: opacity .16s ease, transform .16s ease; }
.page.ndc-leaving { opacity: 0; transform: translateY(6px) scale(0.99); }

/* Тактильный отклик на нажатие — лёгкий «пульс» вместо простой смены цвета. */
.btn, .tool, .row, .meal, .tab, .tab-add, .sheet-option, .avatar, .link-more {
  transition: transform .15s cubic-bezier(.2,.7,.2,1);
}
.btn:active, .tool:active, .row:active, .meal:active, .tab:active, .tab-add:active,
.sheet-option:active, .avatar:active, .link-more:active {
  transform: scale(0.95);
}

/* Появление блоков при открытии — как в макете */
@keyframes ndcRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ndcSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes ndcFade { from { opacity: 0; } to { opacity: 1; } }
.ndc-r { animation: ndcRise .8s cubic-bezier(.2,.7,.2,1) both; }
.ndc-d1 { animation-delay: .04s; }
.ndc-d2 { animation-delay: .14s; }
.ndc-d3 { animation-delay: .26s; }
.ndc-d4 { animation-delay: .38s; }
.ndc-d5 { animation-delay: .5s; }
.ndc-d6 { animation-delay: .62s; }

/* Иконка пустого состояния: чёрный контур на светлом квадрате (NDC.stateIcon). */
.state-icon {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  border-radius: 16px;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.state-icon svg { width: 36px; height: 36px; fill: none; stroke: var(--accent); stroke-width: 1.3px; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Экраны вкладок: заголовок, строки, статистика ---------- */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.page-title { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.page-sub { margin-top: 6px; font-size: 13px; font-weight: 500; color: var(--text-55); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 14px; min-width: 0; }
.stat-value { font-size: 24px; font-weight: 300; letter-spacing: -0.03em; line-height: 1.05; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-55); line-height: 1.3; }

.list { overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
}
.row + .row { border-top: 1px solid rgba(20,18,15,0.06); }
.row-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-icon svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 1.6px; stroke-linecap: round; stroke-linejoin: round; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 700; }
.row-sub { font-size: 12px; font-weight: 500; color: var(--text-55); margin-top: 2px; }
.row-value { font-size: 13px; font-weight: 600; color: var(--text-55); white-space: nowrap; }
.chev { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--text-40); stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 12px;
  font-weight: 600;
}
.pill.dark { background: var(--accent); color: #FFFFFF; }

/* ---------- Карточка приёма пищи (главная и «Дневник») ---------- */

  .meal { display: flex; gap: 14px; padding: 10px; cursor: pointer; }
  .meal-media { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
  .meal-icon, .meal-photo {
    width: 84px;
    height: 84px;
    border-radius: 16px;
    background: var(--soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  .meal-photo { background: var(--photo-bg); }
  .meal-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .meal-icon svg { width: 36px; height: 36px; fill: none; stroke: var(--accent); stroke-width: 1.3px; stroke-linecap: round; stroke-linejoin: round; }
  .meal-method {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: var(--accent);
    border: 2px solid #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .meal-method svg { width: 12px; height: 12px; fill: none; stroke: #FFFFFF; stroke-width: 2.2px; stroke-linecap: round; stroke-linejoin: round; }
  .meal-body { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
  .meal-top { display: flex; justify-content: space-between; gap: 8px; }
  .meal-name {
    font-size: 15px;
    font-weight: 700;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .meal-time { font-size: 12px; color: var(--text-45); flex-shrink: 0; }
  .meal-kcal { font-size: 16px; font-weight: 600; }
  .meal-macros { font-size: 12px; font-weight: 500; color: var(--text-55); }

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

.tabbar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-bottom) + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: 448px;
  height: var(--tabbar-h);
  margin: 0 auto;
  border-radius: 33px;
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(20,18,15,0.1);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  padding: 0 6px;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 52px;
  margin: 0 2px;
  border: none;
  border-radius: 26px;
  background: transparent;
  color: var(--text-45);
  cursor: pointer;
  min-width: 0;
}
.tab.active { background: var(--soft); color: var(--text); }
.tab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7px; stroke-linecap: round; stroke-linejoin: round; }
.tab span {
  font-size: 10px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab-add-wrap { display: flex; justify-content: center; }
.tab-add {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  border: none;
  background: var(--accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(20,18,15,0.25);
}
.tab-add svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2px; stroke-linecap: round; }

/* Узкие телефоны: подписи вкладок мельче, чтобы не обрезались. */
@media (max-width: 360px) {
  .tabbar { left: 12px; right: 12px; padding: 0 4px; }
  .tab { margin: 0 1px; }
  .tab span { font-size: 8.5px; letter-spacing: -0.01em; }
}

/* ---------- Панель «Добавить еду» ---------- */

.sheet-wrap { display: none; }
.sheet-open .sheet-wrap { display: block; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20,18,15,0.3);
  animation: ndcFade .3s ease both;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 20px calc(40px + env(safe-area-inset-bottom)) 20px;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: ndcSheet .45s cubic-bezier(.2,.8,.2,1) both;
}
.sheet-grip {
  align-self: center;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(20,18,15,0.15);
}
.sheet h3 { margin: 0; font-size: 22px; font-weight: 800; }
.sheet-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding-bottom: 12px; }
.sheet-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 6px 22px;
  border-radius: 22px;
  border: none;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
}
.sheet-option.primary { background: var(--accent); color: #FFFFFF; }
.sheet-option svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6px; stroke-linecap: round; stroke-linejoin: round; }
.sheet-option span { font-size: 13px; font-weight: 700; }

.hidden { display: none !important; }

/* ---------- Формы и пошаговые экраны (онбординг, согласие) ---------- */

.btn:disabled { opacity: .35; cursor: default; }
.btn.secondary { background: var(--soft); color: var(--text); }
.btn.cta { width: 100%; padding: 16px; font-size: 15px; }

.option-list { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border: 1.5px solid transparent;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
}
.option small { display: block; margin-top: 4px; font-size: 12.5px; font-weight: 500; color: var(--text-55); }
.option.selected { border-color: var(--accent); }
.option[aria-disabled="true"] { opacity: .4; cursor: default; }

.field {
  width: 100%;
  padding: 18px 20px;
  border: 1.5px solid transparent;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-size: 22px;
  font-weight: 600;
  outline: none;
}
.field:focus { border-color: var(--accent); }
.field-unit { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--text-55); }

.note {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--soft);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-75);
}
.disclaimer { font-size: 12.5px; line-height: 1.5; color: var(--text-55); }
.error-text { min-height: 18px; font-size: 13px; font-weight: 600; color: var(--text-75); }

.progress { height: 4px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--accent); transition: width .3s ease; }

.step-head { display: flex; align-items: center; gap: 12px; }
.step-head .progress { flex: 1; }
.back {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.back svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; }
.back[hidden] { visibility: hidden; display: flex; }

.consent-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.consent-row input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex-shrink: 0;
  border-radius: 7px;
  border: 1.5px solid var(--text-40);
  background: transparent;
  cursor: pointer;
}
.consent-row input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.consent-row input[type=checkbox]:checked::after {
  content: '';
  position: absolute;
  left: 6.5px;
  top: 2.5px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.consent-row span { font-size: 14px; line-height: 1.45; color: var(--text-75); }
.body-text { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-75); }
.bullets { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.7; color: var(--text-75); }
.policy-link { font-size: 13.5px; color: var(--text-55); text-decoration: underline; text-underline-offset: 2px; }
.screen-pad { min-height: 100vh; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.grow { flex: 1; }
.big-number { font-size: 56px; font-weight: 300; letter-spacing: -0.04em; line-height: 1; }

/* ---------- Дневник: дата, окна с формами, избранное, «Отменить» ---------- */

.date-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.date-label { flex: 1; min-width: 0; text-align: center; }
.back:disabled { opacity: .3; cursor: default; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions .btn { padding: 14px 12px; }

.sheet-wrap.open { display: block; }
#dlg .sheet { gap: 14px; }
.sheet { max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.field.sm { padding: 13px 14px; border-radius: 14px; font-size: 16px; font-weight: 600; }
.flabel { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-55); }
.sheet .field.sm { background: var(--soft); box-shadow: none; }
.frow { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 10px; }
.frow3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.frow > div, .frow3 > div { min-width: 0; }
.sheet .field { min-width: 0; max-width: 100%; box-sizing: border-box; }
/* iOS: у поля времени своя минимальная ширина, без этого оно выходит за край колонки */
.sheet input[type="time"].field { display: block; -webkit-appearance: none; appearance: none; text-align: left; line-height: 1.2; }
.sheet input[type="time"].field::-webkit-date-and-time-value { text-align: left; min-width: 0; }


.fav-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -2px 4px; -webkit-overflow-scrolling: touch; }
.chip.fav { flex-shrink: 0; display: inline-flex; align-items: center; border-radius: 999px; background: var(--soft); }
.chip.fav button { border: none; background: transparent; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.fav .fav-use { padding: 9px 4px 9px 14px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.chip.fav .fav-del { padding: 9px 12px 9px 6px; color: var(--text-55); font-size: 16px; line-height: 1; }

.copy-list { display: flex; flex-direction: column; gap: 12px; max-height: 40vh; overflow-y: auto; }
.copy-row span b { font-weight: 700; white-space: nowrap; }

.snack {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-bottom) + var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
  z-index: 70;
  max-width: 448px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(20,18,15,0.28);
}
.snack button { border: none; background: transparent; color: #FFFFFF; font-size: 13px; font-weight: 800; text-decoration: underline; cursor: pointer; }

/* ---------- Распознавание: запись голоса, поле описания ---------- */

textarea.field.sm { width: 100%; resize: none; line-height: 1.45; }
.rec-time { text-align: center; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.sheet .btn.cta { flex-shrink: 0; }
.sheet .note { margin: 0; }

/* ---------- Вода и вес ---------- */

.tracker { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.tracker-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tracker-value { font-size: 34px; font-weight: 300; letter-spacing: -0.03em; line-height: 1.05; }
.tracker-value small { font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--text-55); margin-left: 4px; }
.tracker-actions { display: grid; grid-template-columns: 52px repeat(3, minmax(0, 1fr)); gap: 8px; }
.btn.sm { padding: 11px 14px; font-size: 14px; }
.btn.secondary:disabled { opacity: .35; }
.tracker-link { cursor: pointer; flex-direction: row; align-items: center; justify-content: space-between; }

.chart { width: 100%; height: auto; display: block; }
.chart polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart circle { fill: var(--accent); }
.chart text { fill: var(--text-55); font-size: 10px; font-family: var(--font); }
.chart line { stroke: rgba(20,18,15,0.08); stroke-width: 1; }
.entry-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.entry-row + .entry-row { border-top: 1px solid rgba(20,18,15,0.06); }
.entry-row .row-body { min-width: 0; }
.entry-del { border: none; background: transparent; color: var(--text-55); font-size: 20px; line-height: 1; padding: 6px 8px; cursor: pointer; }

/* ---------- Профиль ---------- */

.block { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill.pick { border: none; cursor: pointer; color: var(--text); font-family: inherit; }
.pill.pick.dark { color: #FFFFFF; }
.links { display: flex; flex-direction: column; gap: 12px; }
.block .btn { width: 100%; }
.block .btn.sm { align-self: flex-start; width: auto; }
.block small.page-sub { font-size: 14px; }

/* ---------- Главная: бренд, кольца, баланс недели (как в мини-аппе) ---------- */
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; letter-spacing: -0.06em; }
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: -0.04em; }
.brand-name span { font-weight: 300; color: var(--text-45); }
.avatar-btn { width: 40px; height: 40px; border-radius: 20px; border: none; background: var(--surface); box-shadow: var(--shadow-soft); color: var(--text); font-size: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; }
/* ---------- Кольцо (общее с главной) и вкладка «Вода» ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 20px 24px; border-radius: var(--radius-hero); background: var(--surface); box-shadow: var(--shadow-hero); }
.ring { position: relative; width: 210px; height: 210px; }
.ring svg { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.ring-value { transition: stroke-dashoffset .6s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.ring-kcal { font-size: 52px; font-weight: 300; letter-spacing: -0.04em; line-height: 1; }
.ring-of { font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-50); }
.reserve { padding: 7px 14px; border-radius: 999px; background: var(--soft); font-size: 13px; font-weight: 600; text-align: center; }
.macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.macro { display: flex; flex-direction: column; gap: 12px; padding: 16px 14px; min-width: 0; }
.macro-head { display: flex; flex-direction: column; gap: 2px; }
.macro-value { display: flex; align-items: baseline; gap: 1px; white-space: nowrap; }
.macro-value b { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.macro-value span { font-size: 12px; font-weight: 600; color: var(--text-40); }
.macro-label { font-size: 12px; font-weight: 500; color: var(--text-55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.macro-ring { position: relative; width: 62px; height: 62px; align-self: center; }
.macro-ring svg { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.macro-ring circle.v { transition: stroke-dashoffset .6s ease; }
.macro-letter { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--accent); }
.week { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.week-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.week-count { font-size: 13px; font-weight: 600; color: var(--text-75); white-space: nowrap; }
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 6px; border: 1.5px solid var(--dot-empty); }
.dot.on { background: var(--accent); border-color: var(--accent); }
.day.today .dot { box-shadow: 0 0 0 4px #FFFFFF, 0 0 0 5.5px var(--accent); }
.day-label { font-size: 11px; font-weight: 600; color: var(--text-45); }
.day.today .day-label { color: var(--text); }
.empty-meals { display: flex; align-items: center; gap: 14px; padding: 10px; }
.empty-meals p { margin: 0; font-size: 13px; font-weight: 500; color: var(--text-55); line-height: 1.45; }
/* ---------- Дневник: серии, график, список дней (как в мини-аппе) ---------- */
.stat2 { display: flex; flex-direction: column; gap: 6px; padding: 16px 14px; min-width: 0; }
.stat2-value { font-size: 30px; font-weight: 300; letter-spacing: -0.03em; line-height: 1.05; }
.stat2-label { font-size: 12.5px; font-weight: 500; color: var(--text-55); line-height: 1.3; }
.chart { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart-legend { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-55); }
.chart-legend .dash { width: 18px; border-top: 1.5px dashed var(--text-55); }
.chart-plot { position: relative; height: 150px; }
.chart-plot .cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; }
.chart-plot .col { display: flex; flex-direction: column; align-items: center; }
.chart-plot .barbox { height: 128px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-plot .bar { display: block; width: 62%; max-width: 22px; border-radius: 5px 5px 2px 2px; background: #D9D9D6; }
.chart-plot .tick { display: block; width: 1px; height: 5px; background: var(--dot-empty); margin-bottom: 0; }
.chart-plot .xl { height: 22px; line-height: 22px; font-size: 12px; font-weight: 500; color: var(--text-45); }
.chart-plot .col.today .xl { color: var(--text); font-weight: 700; }
.chart-plot .goalline { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--text-55); z-index: 1; pointer-events: none; }
.daycard { padding: 0; overflow: hidden; }
.dayhead { display: flex; align-items: center; gap: 16px; width: 100%; padding: 18px 20px; border: none; background: transparent; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.daymeta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dayname { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.daykcal { font-size: 14px; color: var(--text-45); }
.daykcal b { font-size: 24px; font-weight: 400; color: var(--text); letter-spacing: -0.02em; }
.daymacros { font-size: 13px; font-weight: 500; color: var(--text-55); }
.dayhead .chev svg { width: 20px; height: 20px; fill: none; stroke: var(--text-45); stroke-width: 1.8px; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.daycard.open .chev svg { transform: rotate(180deg); }
.daybody { display: none; flex-direction: column; gap: 10px; padding: 0 12px 14px; }
.daycard.open .daybody { display: flex; }
.daycard .meal { background: var(--bg); box-shadow: none; }
/* ---------- Профиль (как в мини-аппе) ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-avatar { width: 58px; height: 58px; border-radius: 29px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 600; flex-shrink: 0; }
.profile-avatar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7px; stroke-linecap: round; stroke-linejoin: round; }
.goal-kcal { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.goal-kcal-num { font-size: 56px; font-weight: 300; letter-spacing: -0.04em; line-height: 1; }
.goal-kcal-unit { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-50); }
.goal-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.goal-tile { background: var(--soft); border-radius: 16px; padding: 14px 12px; min-width: 0; }
.goal-tile-value { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.goal-tile-label { margin-top: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-55); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch { position: relative; flex-shrink: 0; width: 52px; height: 32px; border-radius: 16px; border: none; background: var(--soft); cursor: pointer; transition: background .2s ease; }
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 4px rgba(20,18,15,.25); transition: transform .2s ease; }
.switch.on { background: var(--accent); }
.switch.on i { transform: translateX(20px); }
/* ---------- Барабаны онбординга: дата рождения, рост, вес ---------- */
.wheel-card { position: relative; background: var(--surface); box-shadow: var(--shadow-card); border-radius: var(--radius-card); padding: 20px 8px 10px; }
.wheel-display { text-align: center; font-size: 16.5px; font-weight: 700; color: var(--text); margin-bottom: 14px; padding: 0 10px; }
.wheel-display .wheel-unit { font-size: 15px; font-weight: 700; color: var(--text-45); margin-left: 5px; }
.wheel-row { position: relative; display: flex; height: 176px; }
.wheel-highlight { position: absolute; left: 6px; right: 6px; top: 50%; height: 40px; transform: translateY(-50%); background: var(--soft); border-radius: 12px; pointer-events: none; z-index: 0; }
.wheel-col { flex: 1; height: 176px; overflow-y: scroll; overflow-x: hidden; scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; scrollbar-width: none; position: relative; z-index: 1; padding: 68px 0; box-sizing: border-box; }
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-item { height: 40px; line-height: 40px; text-align: center; font-size: 16px; font-weight: 600; color: var(--text); scroll-snap-align: center; user-select: none; }

/* ---------- Онбординг: демо «фото / голос» и экран расчёта (порт из мини-аппа) ---------- */
/* ---- живая демонстрация на первом экране: карточка-«телефон», порт
   эталона (welcome-demo-prototype.html) — раскладка, тайминги, иконки
   еды и геометрия маскота оттуда; тексты и цвета — наши. Два сценария
   по кругу: Фото, Голос (в эталоне их тоже два, не три). ---- */
.demo-wrap { position: relative; width: 290px; max-width: 100%; margin: 6px auto 4px; text-align: left; }
.demo-chips { display: flex; gap: 6px; margin: 0 0 10px; }
.demo-chip { display: inline-block; padding: 6px 12px; border-radius: 16px; font-size: 12px; font-weight: 700; border: .5px solid #C9C7BD; background: transparent; color: #5F5E5A; transition: all .25s; }
.demo-chip.on { border-color: #141412; background: #141412; color: #F2F1EC; }
.demo-hint { font-size: 15px; font-weight: 600; color: #141412; margin: 0 0 16px; transition: opacity .25s; }
.demo-stage { position: relative; height: 300px; }
.demo-mascot { position: absolute; left: 0; top: 50%; width: 84px; height: 84px; transform: translateY(-50%); }
.demo-mock { position: absolute; left: 104px; top: 0; width: 172px; height: 300px; border-radius: 26px; border: 5px solid #141412; background: #141412; overflow: hidden; opacity: 0; box-shadow: 0 12px 28px rgba(20,20,18,.25); }
.demo-mock-inner { position: absolute; inset: 0; border-radius: 20px; overflow: hidden; background: #2A2926; }
.demo-cam { position: absolute; inset: 0; background: #2A2926; transition: opacity .35s; }
.demo-plate { position: absolute; left: 31px; top: 68px; width: 100px; height: 100px; border-radius: 50%; background: #EDEBE4; opacity: 0; }
.demo-plate i { position: absolute; border-radius: 50%; display: block; }
.demo-brk { position: absolute; left: 21px; top: 58px; width: 120px; height: 120px; opacity: 0; }
.demo-brk i { position: absolute; width: 18px; height: 18px; border: 2px solid #fff; }
.demo-shutter { position: absolute; left: 59px; top: 212px; width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; }
.demo-shutter i { position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; display: block; }
.demo-flash { position: absolute; inset: 0; background: #fff; opacity: 0; }
.demo-voice { position: absolute; inset: 0; background: #F2F1EC; opacity: 0; transition: opacity .35s; }
.demo-rg { position: absolute; left: 52px; top: 0; width: 58px; height: 58px; border-radius: 50%; border: 2px solid #141412; opacity: 0; }
@keyframes demo-ring { 0% { transform: scale(.85); opacity: .45; } 100% { transform: scale(2); opacity: 0; } }
.demo-voice.on .demo-rg { animation: demo-ring 1.6s ease-out infinite; }
.demo-mic-btn { position: absolute; left: 52px; top: 0; width: 58px; height: 58px; border-radius: 50%; background: #141412; }
.demo-mic-btn svg { position: absolute; left: 16px; top: 16px; }
.demo-bars { position: absolute; left: 0; right: 0; top: 150px; display: flex; gap: 3px; align-items: center; justify-content: center; height: 36px; }
.demo-bars i { display: block; width: 4px; height: 6px; background: #141412; border-radius: 2px; }
@keyframes demo-bar { 0%, 100% { height: 6px; } 50% { height: 32px; } }
.demo-voice.on .demo-bars i { animation: demo-bar .7s ease-in-out infinite; }
.demo-typed { position: absolute; left: 0; right: 0; top: 198px; text-align: center; font-size: 14px; font-weight: 600; height: 20px; color: #141412; }
.demo-result-card { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 84px; background: #fff; border-radius: 16px; padding: 10px 12px; box-sizing: border-box; transform: translateY(130%); transition: transform .45s cubic-bezier(.2,.9,.3,1.1); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.demo-result-card .cn { font-size: 12px; color: #5F5E5A; }
.demo-result-card .ck-row { display: flex; align-items: baseline; gap: 4px; margin-top: 2px; }
.demo-result-card .ck { font-size: 22px; font-weight: 700; color: #141412; }
.demo-result-card .ck-unit { font-size: 12px; color: #141412; }
.demo-result-card .cm { font-size: 11px; color: #5F5E5A; margin-top: 2px; }
.demo-result-check { position: absolute; right: 12px; top: 10px; }
.demo-fly { position: absolute; z-index: 5; }
@media (prefers-reduced-motion: reduce) {
  .demo-voice.on .demo-rg, .demo-voice.on .demo-bars i { animation: none; }
}
.calc-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.calc-belt { position: relative; width: 100%; max-width: 320px; height: 100px; }
.calc-mascot { position: absolute; left: 0; top: 2px; width: 96px; height: 96px; z-index: 2; }
/* left задаётся в JS (см. runCalcScreen) — граница «съедания» должна
   стоять внутри пасти маскота, а не правее её. */
.calc-track { position: absolute; left: 61px; right: 0; top: 0; bottom: 0; overflow: hidden; }
.calc-food-item { position: absolute; z-index: 1; }
.calc-pct { font-size: 44px; font-weight: 300; letter-spacing: -0.02em; }
.calc-caption { font-size: 14px; font-weight: 600; color: var(--text-55); min-height: 18px; transition: opacity .25s ease; }
.calc-bar { width: 100%; max-width: 320px; height: 4px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.calc-bar-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width .3s linear; }
.calc-checklist { width: 100%; padding: 6px 18px; display: flex; flex-direction: column; }
.calc-check-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 13.5px; font-weight: 600; color: var(--text-40); transition: color .25s ease; }
.calc-check-row + .calc-check-row { border-top: 1px solid rgba(20,18,15,0.06); }
.calc-check-row.done { color: var(--text); }
.calc-check-mark { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--text-40); flex-shrink: 0; position: relative; transition: background .2s ease, border-color .2s ease; }
.calc-check-row.done .calc-check-mark { background: var(--accent); border-color: var(--accent); }
.calc-check-mark::after { content: ''; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #fff; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); opacity: 0; transition: opacity .15s ease; }
.calc-check-row.done .calc-check-mark::after { opacity: 1; }
/* ---------- Панель «+»: строка «Как вчера» и «Мои блюда» ---------- */
.sheet-pills { display: flex; gap: 10px; margin-top: 12px; }
.sheet-pill { flex: 1; min-width: 0; padding: 12px 10px; border: none; border-radius: 999px; background: var(--soft); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-pill:active { transform: scale(.97); }

/* ---------- Итог дня ---------- */
.sum-table { padding: 8px 18px; display: flex; flex-direction: column; }
.sum-head, .sum-row { display: grid; grid-template-columns: 1.1fr 1.5fr .9fr; gap: 8px; align-items: baseline; padding: 11px 0; }
.sum-head { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-45); padding-bottom: 6px; }
.sum-head div:nth-child(n+2), .sum-left { text-align: right; }
.sum-row + .sum-row { border-top: 1px solid rgba(20,18,15,0.06); }
.sum-name { font-size: 14px; font-weight: 600; }
.sum-val { font-size: 14.5px; font-weight: 600; text-align: right; }
.sum-val span { color: var(--text-45); font-weight: 500; }
.sum-left { font-size: 14.5px; font-weight: 700; }

/* ---------- Только Android ----------
   Класс is-android ставит app.js по user agent; на iPhone этих правил нет.
   Андроидный WebView увеличивает текст по системному размеру шрифта и сам даёт кнопкам
   отступы 6px по бокам: подписи нижнего меню обрезались многоточием, цифры на барабанах
   съезжали вниз (высота строки в px росла вместе со шрифтом, а высота ячейки нет). */
html.is-android { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.is-android .tab { padding: 0; }
.is-android .tab span { font-size: 9.5px; letter-spacing: -0.01em; text-overflow: clip; }
@media (max-width: 360px) { .is-android .tab span { font-size: 8.5px; } }
.is-android .wheel-item { display: flex; align-items: center; justify-content: center; line-height: 1; }
