/* BODY UP — мини-ап. Спокойная wellness-система.

   Один акцент (глубокий зелёный), тёплые нейтрали, тонкие линии.
   Цвет означает состояние: зелёный — пройдено/активно, песочный — нейтрально,
   контур — закрыто. Тему Telegram не наследуем: палитра своя, схема светлая. */

@font-face {
  font-family: 'EB Garamond';
  src: url('/static/fonts/eb-garamond-variable.ttf') format('truetype');
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: 'EB Garamond';
  src: url('/static/fonts/eb-garamond-italic-variable.ttf') format('truetype');
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: #F4F1EA;
  --surface: #FFFDF8;
  --sand: #EFEADF;
  --mint: #E9EDE2;
  --line: #E9E4D8;
  --line-2: #E3DED2;
  --divider: #F2EEE5;

  --sage: #A9B49E;
  --olive: #6F7A5C;
  --green: #3E5A44;
  --deep: #2C4034;
  --deep-press: #24352B;
  --brand-line: #DCE3D3;
  --brand-soft-strong: #DFE6D5;
  --hero-start: #24352B;
  --hero-mid: #35503C;
  --hero-end: #4C6B50;
  --on-primary: #F4F1EA;
  --on-deep: #F4F1EA;
  --on-green: #F4F1EA;
  --brand-glow-rgb: 169, 180, 158;
  --brand-shadow-rgb: 62, 90, 68;
  --glass-surface: rgba(255, 253, 248, .78);
  --glass-border: rgba(255, 255, 255, .76);
  --glass-shine: rgba(255, 255, 255, .58);

  --text: #22261F;
  --soft: #55594F;
  --muted: #62675E;
  --faint: #686D63;

  --r-s: 15px;
  --r: 20px;
  --r-m: 24px;
  --r-l: 28px;

  --pad: 24px;
  --tabbar-h: 84px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --shadow: 0 1px 2px rgba(var(--brand-shadow-rgb), .03), 0 14px 34px -22px rgba(var(--brand-shadow-rgb), .16);
  --sans: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif: 'EB Garamond', Georgia, serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
#screen { width: 100%; max-width: 720px; margin: 0 auto; outline: none; }

:focus-visible {
  outline: 3px solid var(--deep);
  outline-offset: 3px;
}

h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--deep); text-decoration: none; }
a:hover { color: var(--deep); }

::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }

.screen { padding: 10px var(--pad) 36px; }
.screen.flush { padding-left: 0; padding-right: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.soft { color: var(--soft); }
.pretty { text-wrap: pretty; }

.eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.serif { font-family: var(--serif); }
.title { font-family: var(--serif); font-size: 36px; line-height: 1.12; }
.title-l { font-family: var(--serif); font-weight: 300; font-size: 42px; line-height: 1.1; }
.title-s { font-family: var(--serif); font-size: 28px; line-height: 1.16; }
.sub { font-size: 14px; color: var(--muted); line-height: 1.6; }
.quote {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 21px;
  line-height: 1.45;
  color: var(--deep);
  border-left: 1px solid var(--brand-line);
  padding-left: 20px;
}

/* ---------- загрузка ---------- */

.boot {
  /* Явные стороны вместо inset (Chrome 87+): в WebView Telegram Desktop
     (Chromium ~87) сокращение иногда не поддерживается, и без разложенных
     свойств загрузочный экран не растягивается на весь вьюпорт — путается
     с «приложение не открывается». */
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; background: var(--bg);
}
.boot-logo {
  font-family: var(--serif); font-size: 34px; letter-spacing: .04em; color: var(--deep);
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--line-2); border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.boot-note {
  max-width: 320px; margin: 0 20px; text-align: center;
  display: flex; flex-direction: column; gap: 10px;
}
.boot-note b { font-size: 16px; font-weight: 500; }
.boot-note span { font-size: 13px; color: var(--muted); word-break: break-word; }
.boot-note .step { font-size: 12.5px; color: var(--faint); }
.boot-note button {
  margin-top: 6px; padding: 14px 18px; border: 0; border-radius: var(--r);
  background: var(--deep); color: var(--on-deep); font-size: 14px; font-weight: 500; cursor: pointer;
}

/* ---------- кнопки ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 54px; padding: 14px 20px;
  border: 0; border-radius: 18px;
  background: var(--deep); color: var(--on-deep);
  font-size: 15px; font-weight: 500; letter-spacing: .01em;
  cursor: pointer;
  transition: background .25s ease, transform .12s ease, color .25s ease;
}
.btn:active { transform: scale(.985); background: var(--deep-press); }
.btn[disabled] { background: var(--sand); color: var(--faint); pointer-events: none; }
.btn.ghost { background: transparent; border: 1px solid #D8D2C4; color: var(--deep); }
.btn.ghost:active { background: var(--sand); }
.btn.plain { background: transparent; color: var(--muted); min-height: 48px; font-size: 13.5px; }
.btn.small { min-height: 44px; padding: 0 18px; width: auto; font-size: 14px; border-radius: 14px; }

.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
  transition: background .2s ease;
}
.icon-btn:active { background: var(--sand); }
.icon-btn.bare { border: 0; background: transparent; margin-left: -10px; }
.icon-btn.bare:active { background: var(--sand); }
.icon-btn svg { display: block; }

/* ---------- карточки ---------- */

.card {
  background: linear-gradient(135deg, var(--glass-shine), var(--glass-surface));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-m);
  padding: 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.card.flush { padding: 6px 20px; }
.card.plain { box-shadow: none; }
.card.mint {
  background: linear-gradient(135deg, rgba(255, 255, 255, .38), rgba(222, 232, 213, .78));
  border-color: rgba(255, 255, 255, .46); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .48);
}
.card.sand {
  background: linear-gradient(135deg, rgba(255, 255, 255, .36), rgba(239, 234, 223, .82));
  border-color: rgba(255, 255, 255, .48); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .48);
}
.card-title { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-l); background: var(--mint); padding: 24px;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -70px;
  width: 210px; height: 210px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(var(--brand-glow-rgb), .55), rgba(var(--brand-glow-rgb), 0) 70%);
}
.hero > * { position: relative; z-index: 1; }

.badge {
  font-size: 11px; letter-spacing: .06em; color: var(--olive);
  border: 1px solid var(--brand-line); border-radius: 999px; padding: 5px 11px; white-space: nowrap;
}
.badge.solid { background: var(--mint); border-color: transparent; }

/* ---------- челлендж дня ----------

   Единственный тёмный блок в приложении. Вместо заметной круглой засветки и
   бегущей полосы — несколько очень широких слоёв света внутри фона. Так зелёный
   выглядит как объёмный материал, а не как градиент с наложенным эффектом. */

.hero-green {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 24px; border-radius: var(--r-l);
  background:
    radial-gradient(135% 120% at 105% -28%, rgba(164, 190, 154, .36) 0%, rgba(123, 154, 118, .17) 37%, transparent 70%),
    radial-gradient(105% 112% at -18% 128%, rgba(17, 43, 29, .30) 0%, transparent 66%),
    linear-gradient(137deg, var(--hero-start) 0%, var(--hero-mid) 49%, var(--hero-end) 100%);
  color: var(--on-primary);
  box-shadow: 0 20px 44px -26px rgba(var(--brand-shadow-rgb), .56), inset 0 1px 0 rgba(255, 255, 255, .09);
}
.hero-green > * { position: relative; z-index: 2; }

/* Тонкий световой слой не имеет явного центра — переход остаётся естественным. */
.hero-green::before {
  content: ''; position: absolute; z-index: 1; inset: 0;
  background: linear-gradient(112deg, transparent 22%, rgba(255, 255, 255, .035) 49%, transparent 76%);
}
.hero-green::after { content: none; }

.hero-title {
  font-family: var(--serif); font-size: 27px; line-height: 1.18; margin-bottom: 10px;
}
.hero-text { font-size: 14px; line-height: 1.6; color: var(--on-primary); opacity: .84; }

.eyebrow.on-dark { color: var(--on-primary); opacity: .68; }
.badge.on-dark {
  color: var(--on-primary); border-color: currentColor;
  background: rgba(255, 255, 255, .1); font-weight: 500;
}

.btn.on-green { background: var(--bg); color: var(--deep); }
.btn.on-green:active { background: #E7E2D7; }
.btn.ghost-green {
  background: transparent; border: 1px solid currentColor; color: var(--on-primary);
}
.btn.ghost-green:active { background: rgba(244, 241, 234, .12); }

/* ---------- списки ---------- */

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 17px 0; border: 0; border-bottom: 1px solid var(--divider);
  background: transparent; text-align: left; cursor: pointer;
}
.list-item:last-child { border-bottom: 0; }
.list-item[data-static] { cursor: default; }
.list-item .k { flex: 1; font-size: 14px; }
.list-item .v { flex: none; font-size: 13.5px; color: var(--muted); }
.list-item .chev { flex: none; color: #C2C4BB; }
.list-item:not([data-static]):active { background: #FAF7F0; }

.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
/* Отступы заданы самой строке, а не группе: одиночная строка вне .rows раньше
   оставалась вовсе без внутренних полей, и текст лип к рамке. */
.nav-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 18px 20px; border: 0; border-bottom: 1px solid var(--divider);
  background: transparent; text-align: left; cursor: pointer;
}
.rows .nav-row:last-child { border-bottom: 0; }
.nav-row:active { background: #FAF7F0; }
.nav-row .t { flex: 1; min-width: 0; }
.nav-row .t b { display: block; font-size: 14.5px; font-weight: 500; }
.nav-row .t span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.nav-row .chev { flex: none; display: grid; place-items: center; color: var(--faint); }
.nav-ico {
  flex: none; width: 38px; height: 38px; border-radius: 12px;
  background: var(--mint); color: var(--olive); display: grid; place-items: center;
}

/* Строка-правило: то же оформление, что у ссылок, но без нажатия. */
.nav-row[data-static] { cursor: default; align-items: flex-start; }
.nav-row[data-static]:active { background: transparent; }
.nav-row[data-static] .nav-ico { margin-top: 2px; }
.nav-row[data-static] .t span { line-height: 1.5; }

.photo-example { width: 100%; border-radius: var(--r-m); display: block; }

/* Задание дня: светлая карточка с мягким зелёным отливом от угла. */
.day-task {
  position: relative; overflow: hidden;
  padding: 24px; border-radius: var(--r-l);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.day-task::before {
  content: ''; position: absolute; right: -80px; top: -90px;
  width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(var(--brand-glow-rgb), .3), rgba(var(--brand-glow-rgb), 0) 70%);
}
.day-task > * { position: relative; z-index: 1; }

/* ---------- прогресс ---------- */

.bar { height: 4px; border-radius: 999px; background: #EBE6DA; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--green); transition: width .8s cubic-bezier(.22, .61, .36, 1); }

/* Единственный календарь: 14 дней марафона одной лентой с прокруткой вбок.
   Буква дня недели сверху, номер дня марафона крупно — одна ячейка отвечает
   сразу на «какое сегодня число» и «какой это день марафона».

   Лента, а не сетка: экран открывается на сегодняшнем дне, соседние дни рядом,
   а прошлое и будущее не занимают половину первого экрана. */
.cal {
  display: flex; gap: 8px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Вылезаем за поля экрана, чтобы лента уходила под края, а не обрывалась. */
  padding: 2px var(--pad); margin: 0 calc(-1 * var(--pad));
}
.cal::-webkit-scrollbar { display: none; }
.cal-day {
  flex: 0 0 54px; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 11px 0 13px; border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .7);
  background: linear-gradient(135deg, rgba(255, 255, 255, .86), rgba(255, 253, 248, .66));
  cursor: pointer; transition: transform .16s ease, background .2s ease;
}
.cal-day:active { transform: scale(.95); }
.cal-day .w { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.cal-day .n { font-size: 15px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }

.cal-day.done { background: var(--brand-line); border-color: transparent; }
.cal-day.done .w { color: var(--olive); }
.cal-day.done .n { color: var(--deep); }

.cal-day.perfect { background: var(--deep); border-color: transparent; }
.cal-day.perfect .w { color: var(--on-deep); opacity: .78; }
.cal-day.perfect .n { color: var(--on-deep); }

/* Сегодня — единственная ячейка с кольцом: её видно, не считая по порядку. */
.cal-day.today {
  background: var(--green); border-color: transparent;
  box-shadow: 0 0 0 3px rgba(var(--brand-shadow-rgb), .16);
}
.cal-day.today .w { color: var(--on-green); opacity: .82; }
.cal-day.today .n { color: var(--on-green); }

.cal-day.missed { border-style: dashed; border-color: var(--line-2); background: transparent; }
.cal-day.missed .n { color: var(--muted); }

.cal-day.locked { background: transparent; border-color: var(--divider); cursor: default; }
.cal-day.locked .w, .cal-day.locked .n { color: var(--faint); }
.cal-day.locked:active { transform: none; }

/* Счёт в шапке главного экрана. */
.score {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 11px;
  border: 1px solid var(--glass-border); border-radius: 999px;
  background: linear-gradient(135deg, var(--glass-shine), var(--glass-surface));
  box-shadow: 0 8px 22px -18px rgba(var(--brand-shadow-rgb), .52), inset 0 1px 0 rgba(255, 255, 255, .54);
}
.score .v { font-family: var(--serif); font-size: 26px; line-height: 1; }
.score .k { font-size: 11.5px; color: var(--muted); }
.home-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Серия: огонёк и цепочка дней до следующей награды. */
.flame {
  flex: none; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--sand); color: var(--faint);
}
/* Серия жива — огонёк «зажигается»: тёплый акцент вместо серого. */
.flame.on { background: #F3E6D2; color: #B96F35; }
.flame svg { display: block; }

.chain { display: flex; gap: 5px; }
.chain .link {
  flex: 1; height: 6px; border-radius: 999px; background: var(--sand);
  transition: background .3s ease;
}
.chain .link.on { background: var(--green); }

/* ---------- отчёт ---------- */

.lesson-top { display: flex; align-items: center; gap: 14px; padding: 10px var(--pad) 0; }
.lesson-q { font-family: var(--serif); font-size: 34px; line-height: 1.2; text-wrap: pretty; }

.answer {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px;
  padding: 0 22px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: transparent; text-align: left; cursor: pointer;
  transition: background .2s ease, transform .12s ease;
}
.answer:active { transform: scale(.99); }
.answer .t { flex: 1; font-size: 15px; font-weight: 500; }
.answer .pts { flex: none; font-size: 13px; color: var(--olive); font-variant-numeric: tabular-nums; }
.answer.yes { background: var(--mint); border-color: var(--brand-line); }
.answer.yes:active { background: var(--brand-soft-strong); }
.answer.selected { box-shadow: 0 0 0 2px var(--green); }
.report-shell { min-height: 100vh; display: flex; flex-direction: column; }
.report-review-row .k { font-size: 13.5px; }
.answer.no .t { color: var(--soft); }
.answer.no:active { background: var(--sand); }

.mark {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid #D8D2C4; background: transparent;
}
.mark.on { border-color: var(--green); background: var(--green); }

.seal {
  width: 56px; height: 56px; border-radius: 50%; background: var(--mint);
  display: grid; place-items: center;
}

/* ---------- питание ---------- */

.meal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.pill {
  width: 100%; min-width: 0; height: 44px; border-radius: var(--r-s);
  border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(255, 255, 255, .86), rgba(255, 253, 248, .66)); color: var(--soft);
  font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: transform .16s ease;
}
.pill:active { transform: scale(.95); }
.pill.on {
  background: linear-gradient(135deg, #4F7157, var(--green)); border-color: rgba(255, 255, 255, .18);
  color: var(--on-green); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 10px 20px -16px rgba(var(--brand-shadow-rgb), .9);
}
.pill[disabled] { color: var(--faint); pointer-events: none; }

.dish {
  display: block; width: 100%; padding: 0; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); overflow: hidden; cursor: pointer;
  transition: transform .18s ease;
}
.dish:active { transform: scale(.995); }
.dish-body { padding: 18px 20px 20px; }
.dish-body .name { font-size: 17px; font-weight: 500; line-height: 1.3; margin-bottom: 10px; }

.ph {
  position: relative;
  background: repeating-linear-gradient(135deg, #EFEADF 0 10px, #EAE4D7 10px 20px);
  display: grid; place-items: center;
}
.ph .label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; color: var(--olive); text-align: center; padding: 0 12px; }
/* Без aspect-ratio (Chrome 88+) блок высотой не задан — на старом движке
   схлопывается в ноль и фото/плейсхолдер пропадают из макета. Запасная
   высота держит блок видимым, пока настоящее соотношение сторон недоступно. */
.ph.cover { aspect-ratio: 16 / 10; min-height: 220px; }
.ph.wide { aspect-ratio: 16 / 9; min-height: 200px; }
.ph.tall { aspect-ratio: 4 / 3; min-height: 280px; }
@supports (aspect-ratio: 1) {
  .ph.cover, .ph.wide, .ph.tall { min-height: 0; }
}
.ph img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
/* Загруженное фото блюда: полоска-плейсхолдер уступает место картинке. */
.ph.loaded {
  background-repeat: no-repeat; background-size: cover; background-position: center;
  animation: photo-in .4s ease both;
}
@keyframes photo-in { from { opacity: .35; } to { opacity: 1; } }

.kbju { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px 6px; }
.kbju > div { text-align: center; border-right: 1px solid var(--divider); }
.kbju > div:last-child { border-right: 0; }
.kbju .v { font-family: var(--serif); font-size: 23px; line-height: 1; }
.kbju .k { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 7px; }

.steps { display: flex; flex-direction: column; gap: 18px; }
.step-row { display: flex; gap: 14px; }
.step-row .n {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--brand-line); display: grid; place-items: center;
  font-size: 12px; color: var(--olive);
}
.step-row p { flex: 1; font-size: 14.5px; line-height: 1.6; color: var(--soft); text-wrap: pretty; }

/* ---------- тренировка ---------- */

.play {
  width: 58px; height: 58px; border-radius: 50%; background: rgba(244, 241, 234, .92);
  display: grid; place-items: center; box-shadow: 0 10px 26px -14px rgba(var(--brand-shadow-rgb), .5);
}
.wo-meta { font-size: 13px; color: var(--muted); }

/* ---------- замеры ---------- */

.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stage { border-radius: 18px; padding: 14px 10px; text-align: center; background: var(--surface); border: 1px solid var(--line); }
.stage.filled { background: var(--mint); border-color: transparent; }
.stage.open { border-color: var(--sage); }
.stage .l { font-size: 13px; font-weight: 500; }
.stage .d { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.m-row { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--divider); }
.m-row:last-child { border-bottom: 0; }
.m-row .s { flex: 1; font-size: 14px; }
.m-row .c { flex: none; font-size: 13.5px; color: var(--soft); font-variant-numeric: tabular-nums; }
.m-row .d { flex: none; min-width: 62px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.m-row .d.down { color: var(--deep); }

.field { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; }
.field .t { flex: 1; min-width: 0; }
.field .t b { display: block; font-size: 14px; font-weight: 500; }
.field .t span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.field .unit { flex: none; width: 22px; font-size: 13px; color: var(--muted); }
.field-err { font-size: 12.5px; color: #A05A4A; padding: 6px 4px 0; }

.input {
  width: 100%; height: 56px; padding: 0 20px;
  border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface);
  font-family: var(--sans); font-size: 16px; color: var(--text);
  transition: border-color .2s ease;
}
.input:focus { outline: none; border-color: var(--sage); }
.input::placeholder { color: #B4B7AE; }
.input.compact { width: 82px; height: 46px; padding: 0; text-align: center; border-radius: 14px; background: #F8F6F0; font-size: 15px; font-weight: 500; }
.input.err { border-color: #C98A7A; }
.hint-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.dialog-close { width: min(100%, 320px); background: var(--surface); color: var(--deep); }

/* ---------- профиль ---------- */

.avatar {
  flex: none; width: 66px; height: 66px; border-radius: 50%; background: var(--mint);
  display: grid; place-items: center; font-family: var(--serif); font-size: 27px; color: var(--deep);
}
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 22px 8px; }
.stats3 > div { text-align: center; border-right: 1px solid var(--divider); }
.stats3 > div:last-child { border-right: 0; }
.stats3 .v { font-family: var(--serif); font-size: 30px; line-height: 1; }
.stats3 .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }

/* ---------- лидерборд ---------- */

.lb-row { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--divider); }
.lb-row:last-child { border-bottom: 0; }
.lb-place { flex: none; width: 26px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-place.top { color: var(--deep); font-weight: 500; }
.lb-name { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-pts { flex: none; font-size: 13.5px; color: var(--soft); }
.lb-row.me { margin: 0 -20px; padding: 15px 20px; background: var(--mint); border-bottom-color: transparent; }
.lb-row.me .lb-name { font-weight: 500; }
.lb-row.me .lb-place { color: var(--deep); }

.zone { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.zone::before, .zone::after { content: ''; flex: 1; height: 1px; background: var(--brand-line); }
.zone span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--olive); }
.zone.secondary span { color: var(--muted); }

.lb-mini { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--divider); }
.lb-mini:last-child { border-bottom: 0; }
.lb-mini .p { flex: none; width: 20px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-mini .n { flex: 1; min-width: 0; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-mini .v { flex: none; font-size: 13px; color: var(--soft); font-variant-numeric: tabular-nums; }
.lb-mini.me .n { font-weight: 500; }

/* ---------- путь ---------- */

.path { position: relative; }
.path .rail { position: absolute; left: 19px; top: 30px; bottom: 20px; width: 1px; background: var(--line-2); }
.node {
  position: relative; display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 11px 0; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.node .dot { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg); display: grid; place-items: center; }
.node .dot.done { background: var(--brand-line); border-color: var(--brand-line); }
.node .dot.perfect { background: var(--deep); border-color: var(--deep); }
.node .dot.perfect i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--sage); }
.node .dot.today { background: var(--green); border-color: var(--green); color: var(--on-green); font-size: 13px; font-weight: 500; }
.node .t { flex: 1; min-width: 0; }
.node .t b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .t span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.node.locked .t b { color: var(--faint); }
.node .r { flex: none; font-size: 13px; color: var(--olive); font-variant-numeric: tabular-nums; }
.halo { position: relative; }
.halo::before {
  content: ''; position: absolute; top: -5px; right: -5px; bottom: -5px; left: -5px;
  border-radius: 50%;
  background: var(--sage); animation: breathe 4.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .5; }
  50% { transform: scale(1.12); opacity: .18; }
}

/* ---------- онбординг ---------- */

.onb { min-height: calc(100vh - 20px); display: flex; flex-direction: column; padding: 10px var(--pad) 32px; }
.onb.fill { height: calc(100vh - 20px); }
.onb-top { display: flex; align-items: center; gap: 14px; margin-bottom: 38px; }
.onb-body { flex: 1; min-height: 0; }
.onb-options { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-bottom: 8px; }
.option {
  flex: none; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px;
  padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); text-align: left; cursor: pointer;
  transition: background .2s ease, transform .12s ease;
}
.option:active { transform: scale(.99); }
.option.on { background: var(--mint); border-color: var(--brand-line); }
.option .t { flex: 1; min-width: 0; }
.option .t b { display: block; font-size: 15px; font-weight: 500; }
.option .t span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.orb {
  width: 100%; aspect-ratio: 1; min-height: 220px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--brand-line), var(--mint) 55%, var(--bg) 78%);
}
@supports (aspect-ratio: 1) { .orb { min-height: 0; } }

/* ---------- таб-бар ---------- */

.tabbar {
  position: fixed; left: 50%; bottom: 0; z-index: 40;
  width: 100%; max-width: 720px; transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 10px 18px calc(18px + var(--safe-b));
  background: linear-gradient(135deg, rgba(255, 253, 248, .86), rgba(244, 241, 234, .78));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -10px 32px -28px rgba(var(--brand-shadow-rgb), .34), inset 0 1px 0 rgba(255, 255, 255, .48);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  min-height: 52px; padding: 6px 0; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; transition: color .25s ease;
}
.tab span { font-size: 10.5px; letter-spacing: .04em; }
.tab.on { color: var(--deep); }
.tab svg { display: block; }

/* Единственный реальный blur — у фиксированной навигации. На старых WebView
   остаётся обычный полупрозрачный слой, без просадки FPS. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar { background: var(--bg); }
}

/* ---------- служебное ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + var(--safe-b));
  transform: translateX(-50%); z-index: 70;
  max-width: 320px; padding: 14px 18px; border-radius: 16px;
  background: var(--deep); color: var(--on-deep); font-size: 13.5px; text-align: center;
  box-shadow: 0 18px 40px -20px rgba(var(--brand-shadow-rgb), .6);
}
.toast.err { background: #6E4139; }

.empty { padding: 46px 10px; text-align: center; }
.empty .t { font-family: var(--serif); font-size: 26px; margin-bottom: 8px; }
.empty .s { font-size: 13.5px; color: var(--muted); line-height: 1.6; }

.skeleton { border-radius: var(--r-m); background: linear-gradient(100deg, var(--sand) 30%, #F5F1E8 45%, var(--sand) 60%); background-size: 300% 100%; animation: shine 1.5s ease-in-out infinite; }
.sk-hero { height: 190px; }
.sk-card { height: 110px; }
.sk-line { height: 46px; }
@keyframes shine { to { background-position: -200% 0; } }

.fade-in { animation: fadeUp .4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.soft-in { animation: softIn .3s ease both; }
@keyframes softIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .fade-in, .soft-in, .halo::before, .skeleton { animation: none; }
}

@media (min-width: 760px) {
  :root { --pad: 32px; }
  #screen { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .screen { padding-top: 24px; padding-bottom: 48px; }
  .tabbar { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

@media (max-width: 380px) {
  :root { --pad: 18px; }
  .field { gap: 9px; padding: 12px; }
  .input.compact { width: 68px; }
  .lesson-q { font-size: 30px; }
}

@media (max-width: 260px) {
  :root { --pad: 18px; }
  .stages { grid-template-columns: 1fr; }
  .m-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
  .m-row .s { grid-column: 1 / -1; }
  .m-row .c { min-width: 0; overflow-wrap: anywhere; }
  .m-row .d { min-width: 0; }
  .field { display: grid; grid-template-columns: 1fr auto auto; }
  .field .t { grid-column: 1 / -1; }
  .input.compact { width: 100%; min-width: 0; }
  .tab { gap: 4px; }
  .tab span { font-size: 9px; letter-spacing: 0; }
  .home-greeting { align-items: flex-start; flex-direction: column; }
  .home-greeting .score { align-self: flex-end; }
  .home-shortcuts { grid-template-columns: 1fr; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .btn { width: 100% !important; }
  .row-between { flex-wrap: wrap; }
}
