/* me: стили части «я» второго захода (18.10.2026): экран «я» и его разделы,
   буфет «мои блюда», карточка моего блюда, первый запуск. */

.layer--me .layer__body { gap: 12px; }
/* тело экрана - колонка с прокруткой: без этого фото и буфет сжимались, а не прокручивались */
.layer--me .layer__body > * { flex-shrink: 0; }
.layer__sub.is-saved { color: var(--accent-dark); font-weight: 600; }

/* ---------- карточка человека ---------- */

.me-hero {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px; text-align: left; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.me-hero__letter {
  display: grid; place-items: center; flex: none;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-soft); border: 2px solid var(--accent); color: var(--accent-dark);
  font-family: var(--serif); font-size: 26px; line-height: 1;
}
.me-hero__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.me-hero__name { font-family: var(--serif); font-size: 22px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-hero__goal { font-size: 14px; color: var(--muted); }

/* ---------- строки разделов ---------- */

.me-list { padding: 2px 0; overflow: hidden; }
.me-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px;
  padding: 10px 12px 10px 14px; border: 0; border-top: 1px solid var(--card-2);
  background: none; text-align: left; color: var(--text);
}
.me-list > .me-row:first-child, .me-list > .me-person:first-child { border-top: 0; }
.me-row:active { background: var(--bg-soft); }
.me-row__icon {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark);
}
.me-row__icon--set { background: #f6ecd9; color: var(--sand-deep); }
.me-row__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.me-row__title { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 1.3; }
.me-row__sub {
  font-size: 13px; color: var(--muted); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.me-row__chev { flex: none; color: var(--muted); display: grid; place-items: center; }
.me-row__chev svg { width: 18px; height: 18px; }
.me-row__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sand); flex: none; }

/* ---------- поля разделов ---------- */

.me-card .card__title { margin-bottom: 4px; }
.me-field {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 54px; padding: 6px 0; border-top: 1px solid var(--card-2); margin: 0;
}
.me-card .card__title + .me-field, .me-card .card__title + .me-switch { border-top: 0; }
.me-field__label { flex: 1 1 auto; min-width: 0; font-size: 15px; color: var(--text); }
.me-field__ctl { display: flex; align-items: center; gap: 6px; flex: none; }
.me-field__unit { font-size: 14px; color: var(--muted); min-width: 26px; }
.me-field--col { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0; }
.me-num {
  width: 92px; max-width: 92px; text-align: right; font-size: 16px; padding: 10px 10px; min-height: 44px;
}
.me-text { width: 172px; max-width: 46vw; text-align: right; font-size: 16px; min-height: 44px; }
.me-select { width: 100%; min-height: 46px; font-size: 15px; }
.me-sublabel { margin: 12px 0 8px; font-size: 13px; color: var(--muted); }
.me-note { margin: 6px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.me-note--top { margin: 0 0 4px; }
.me-note--sand { color: var(--sand-deep); background: #fdf5e6; padding: 8px 10px; border-radius: 10px; }
.me-hint { margin: 4px 4px 0; font-size: 15px; line-height: 1.45; color: var(--muted); text-align: center; }

/* выбор одного из нескольких */
.me-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.me-seg__btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 44px; padding: 6px 14px; flex: 1 1 auto;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card-2);
  font-size: 14px; color: var(--text); line-height: 1.2;
}
.me-seg__btn small { font-size: 12px; color: var(--muted); }
.me-seg__btn.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.me-seg__btn.is-on small { color: var(--accent-dark); font-weight: 400; }
.me-field > .me-seg { flex: none; flex-wrap: nowrap; }
.me-field > .me-seg .me-seg__btn { flex: none; }

/* темп тремя карточками */
.me-pace { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
.me-pace__card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 78px; padding: 8px 4px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--bg-soft); color: var(--text);
}
.me-pace__name { font-size: 14px; }
.me-pace__kg { font-family: var(--serif); font-size: 20px; line-height: 1.15; }
.me-pace__wk { font-size: 12px; color: var(--muted); }
.me-pace__card.is-on { border-color: var(--accent); background: var(--accent-soft); }
.me-pace__card.is-on .me-pace__name, .me-pace__card.is-on .me-pace__kg { color: var(--accent-dark); }

/* числа шагом */
.me-step { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.me-step__btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--card);
  font-size: 22px; line-height: 1; color: var(--accent-dark);
}
.me-step__btn:disabled { opacity: .35; }
.me-step__val { min-width: 76px; text-align: center; font-family: var(--serif); font-size: 17px; white-space: nowrap; }

/* живой итог под целью */
.me-live { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--accent-soft); }
.me-live__main { margin: 0; font-size: 15px; line-height: 1.4; }
.me-live__main b { font-family: var(--serif); font-size: 20px; font-weight: 400; color: var(--accent-dark); }

/* переключатель с подписью */
.me-switch {
  display: flex; align-items: flex-start; gap: 12px; min-height: 58px;
  padding: 12px 0; border-top: 1px solid var(--card-2); cursor: pointer;
}
.me-switch__icon {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: var(--card-2); color: var(--accent-dark);
}
.me-switch__body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.me-switch__name { font-size: 16px; line-height: 1.3; }
.me-switch__note { font-size: 13px; line-height: 1.35; color: var(--muted); }
.me-switch__box {
  -webkit-appearance: none; appearance: none; position: relative; flex: none;
  width: 50px; height: 30px; margin: 4px 0 0; border-radius: 999px;
  background: #d8d1c1; transition: background .18s; cursor: pointer;
}
.me-switch__box::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(47, 43, 37, .25); transition: transform .18s;
}
.me-switch__box:checked { background: var(--accent); }
.me-switch__box:checked::before { transform: translateX(20px); }
.me-switch__box:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }

/* пары полей и кнопки */
.me-pair { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-top: 10px; }
.me-pair--add { grid-template-columns: 1fr auto; }
.me-pair .input { min-height: 44px; font-size: 16px; }
.me-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.me-btns .btn { flex: 1 1 auto; min-height: 44px; }
.me-btn-sand { background: transparent; border-color: var(--sand); color: var(--sand-deep); font-weight: 600; min-height: 46px; }
.me-more { margin: 12px 0 0; min-height: 46px; }

.me-checks { list-style: none; margin: 8px 0 0; padding: 0; }
.me-checks li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; border-top: 1px solid var(--card-2); }
.me-checks li .muted { margin: 0; font-size: 13px; }
.me-checks__del { color: var(--muted); font-size: 20px; }

/* встроенный вопрос перед необратимым */
.me-ask { margin-top: 10px; padding: 12px; border: 1px solid var(--sand); border-radius: 12px; background: #fdf5e6; }
.me-ask__text { margin: 0 0 10px; font-size: 15px; line-height: 1.4; color: #6d4b14; }
.me-ask__btns { display: flex; gap: 8px; }
.me-ask__btns .btn { flex: 1 1 0; min-height: 46px; }

/* люди */
.me-person { padding: 8px 12px 8px 14px; border-top: 1px solid var(--card-2); }
.me-person__row { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.me-person__letter {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--card-2); color: var(--accent-dark); font-weight: 700; font-size: 16px;
}
.me-person__letter.is-active { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.me-person__btn { flex: none; min-height: 44px; padding: 8px 14px; border-radius: 999px; color: var(--accent-dark); font-weight: 600; }
.me-person__del { color: var(--muted); }
.me-person__del svg { width: 18px; height: 18px; }

.me-about__ver { margin: 0; font-family: var(--serif); font-size: 18px; }

/* меню «⋯» */
.memenu { display: flex; flex-direction: column; gap: 8px; }
.memenu__row {
  min-height: 52px; padding: 12px 14px; text-align: left; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text);
}

/* ---------- буфет ---------- */

.buffet { position: relative; width: 100%; max-width: 420px; margin: 2px auto 0; }
.buffet__box svg { display: block; width: 100%; height: auto; }
.buffet__shelf, .buffet__drawer {
  position: absolute; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  padding: 0 0 0 14px; border: 0; border-radius: 8px; background: none; text-align: left; color: #3f3527;
}
/* тарелки на полке: снимок блюда кругом в белом ободке, без снимка цветной кружок */
.buffet__plates {
  position: absolute; right: 8px; bottom: 3px; display: flex; gap: 4px; pointer-events: none;
}
.buffet__plate {
  display: block; width: 40px; height: 40px; padding: 3px; border-radius: 50%;
  background: #fffdf7; box-shadow: 0 0 0 1px #ddd0b8, 0 1px 3px rgba(47, 43, 37, .12);
}
.buffet__food {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: center / cover no-repeat #efe9dd;
}
.buffet__food.is-nophoto { background: radial-gradient(circle closest-side, var(--tint) 0 66%, #fffdf7 69%); }
.buffet__shelf:active, .buffet__drawer:active { background: rgba(255, 253, 247, .35); }
.buffet__shelf:focus-visible, .buffet__drawer:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: -2px; }
.buffet__label { max-width: 58%; font-size: 15px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.buffet__n { font-weight: 400; color: #6b5a45; }
.buffet__shelf.is-empty { padding-left: 22px; }
.buffet__shelf.is-empty .buffet__label { max-width: none; color: #5e5040; }
.buffet__empty { font-size: 13px; color: #6f5f49; line-height: 1.25; }
.buffet__drawer .buffet__label { color: #3f3527; }
.buffet__drawer .buffet__n { color: #6b5a45; }

/* часто ешь */
.often__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px; }
.often__item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 44px;
  padding: 0; border: 0; background: none; color: var(--text);
}
.often__ph {
  display: block; width: 72px; height: 72px; border-radius: 50%; overflow: hidden;
  border: 2px solid #fffdf7; box-shadow: 0 0 0 1px var(--line), var(--shadow-soft); background: var(--card-2);
}
.often__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.often__name {
  font-size: 13px; line-height: 1.3; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mydish__nophoto { display: grid; place-items: center; width: 100%; height: 100%; background: var(--card-2); }
.mydish__nophoto svg { width: 62%; height: 62%; }

/* полка сеткой */
.me-search { position: relative; display: block; }
.me-search__icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; }
.me-search__icon svg { width: 20px; height: 20px; }
.me-search__input { padding-left: 40px; min-height: 46px; font-size: 16px; }
.mygrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mygrid__none { grid-column: 1 / -1; text-align: center; }
.mytile {
  display: flex; flex-direction: column; align-items: stretch; padding: 0 0 10px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; color: var(--text);
  box-shadow: var(--shadow-soft);
}
.mytile__ph { display: block; aspect-ratio: 4 / 3; background: var(--card-2); overflow: hidden; }
.mytile__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mytile__name {
  padding: 8px 10px 0; font-size: 15px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mytile__meta { padding: 3px 10px 0; font-size: 12.5px; color: var(--muted); }

.me-empty { text-align: center; }
.me-empty__plate svg { width: 64px; height: 64px; }
.me-empty__title { margin: 6px 0 0; font-family: var(--serif); font-size: 18px; }

/* карточка моего блюда */
.mydish__photo { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; max-height: 300px; background: var(--card-2); }
.mydish__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mydish__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mydish__name {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; text-align: left;
  font-family: var(--serif); font-size: 24px; line-height: 1.2; color: var(--text);
}
.mydish__kcal { margin: 2px 0 0; flex: none; white-space: nowrap; }
.mydish__kcal b { font-family: var(--serif); font-size: 24px; font-weight: 400; color: var(--accent-dark); }
.mydish__kcal span { font-size: 13px; color: var(--muted); }
.mydish__portion { margin: -6px 0 0; font-size: 14px; color: var(--muted); }
.mydish__tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mydish__tile {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 8px 9px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.mydish__tile-label { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mydish__tile-val { font-family: var(--serif); font-size: 18px; }
.mydish__stat { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--muted); }
.mydish__stat-icon { display: grid; flex: none; color: var(--accent-dark); }
.mydish__stat-icon svg { width: 20px; height: 20px; }
.mydish__list { list-style: none; margin: 0; padding: 0; }
.mydish__list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--card-2); font-size: 15px; }
.mydish__list li:first-child { border-top: 0; }
.mydish__list li .muted { margin: 0; white-space: nowrap; }

/* главная кнопка внизу экрана: под большим пальцем, не уезжает с прокруткой */
.me-cta {
  position: sticky; bottom: -32px; z-index: 2;
  margin-top: auto; padding: 14px 0 28px;
  background: linear-gradient(to bottom, rgba(247, 244, 236, 0), var(--bg) 26%);
}
.me-cta__btn { display: block; width: 100%; min-height: 52px; border-radius: 999px; font-size: 16px; }
.me-cta__note { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- первый запуск ---------- */

/* Слой во весь экран поверх шапки и меню: три шага без прокрутки на 375 × 812.
   Прокрутка внутри остаётся запасной на случай открытой клавиатуры. */
.onb {
  position: fixed; inset: 0; z-index: 30;
  display: flex; justify-content: center;
  background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.onb__in {
  display: flex; flex-direction: column; width: 100%; max-width: 480px; min-height: 100%;
  padding: calc(env(safe-area-inset-top) + 18px) 18px calc(env(safe-area-inset-bottom) + 14px);
}
.onb__dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; }
.onb__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--line); transition: width .2s, background .2s; }
.onb__dot.is-done { background: #9fcaa9; }
.onb__dot.is-on { width: 26px; background: var(--accent); }
.onb__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.15; color: var(--text); }
.onb__sub { margin: 6px 0 0; font-size: 15px; line-height: 1.4; color: var(--muted); }
.onb__body { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.onb__field { display: flex; flex-direction: column; gap: 7px; }
.onb__label { font-size: 13px; color: var(--muted); }
.onb__label--row { font-size: 15px; color: var(--text); }
.onb__input { min-height: 50px; font-size: 18px; }
.onb__trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.onb__numbox { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.onb__numrow { display: flex; align-items: center; gap: 6px; }
.onb__num { min-height: 50px; font-family: var(--serif); font-size: 21px; text-align: center; padding: 8px 4px; min-width: 0; }
.onb__unit { flex: none; font-size: 14px; color: var(--muted); }
.onb__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.onb__row .onb__numbox { flex: none; width: 128px; }
.onb__err { margin: 0; padding: 8px 10px; border-radius: 10px; background: #fdf5e6; color: var(--sand-deep); font-size: 14px; }
.onb__body .me-seg__btn { flex: 1 1 0; min-height: 48px; font-size: 15px; }
.onb__body .me-seg { flex-wrap: nowrap; }
.onb__text { margin: 0; font-size: 15px; line-height: 1.45; }
.onb__text--muted { color: var(--muted); font-size: 14px; }

/* живой итог: числа рядом с подписями, крупно */
.onb__live { padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); }
.onb__live-cap { margin: 0 0 6px; font-size: 13px; color: var(--accent-dark); }
.onb__cells { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.onb__cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.onb__cell-val { font-family: var(--serif); font-size: 22px; line-height: 1.15; color: var(--accent-dark); white-space: nowrap; }
.onb__cell-label { font-size: 12.5px; color: var(--muted); }
.onb__live-note { margin: 8px 0 0; font-size: 13.5px; line-height: 1.35; color: var(--text); }
.onb__live-note--sand { color: var(--sand-deep); }

.onb__tracks { display: flex; flex-direction: column; }
.onb__tracks .me-switch:first-child { border-top: 0; }

.onb__foot { display: flex; gap: 10px; margin-top: auto; padding-top: 18px; }
.onb__foot .btn { min-height: 52px; border-radius: 999px; font-size: 16px; }
.onb__back { flex: 0 0 auto; padding-left: 22px; padding-right: 22px; background: var(--card); border-color: var(--line); color: var(--accent-dark); font-weight: 600; }
.onb__next { flex: 1 1 auto; }
.me-seg--fill { flex-wrap: nowrap; }
.me-seg--fill .me-seg__btn { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; text-align: center; }
.me-field--col > .me-seg--fill .me-seg__btn { flex: 1 1 0; }
.me-card .btn--block { margin: 12px 0 0; min-height: 48px; }
.me-card .me-ask[hidden] + * { margin-top: 0; }
.onb__act .me-pace__card { min-height: 60px; }
.onb__act .me-pace__name { font-size: 15px; }
.onb__dots { align-items: center; }
.onb__steptext { margin-left: 6px; font-size: 13px; color: var(--muted); }
