:root {
  --paper: #EBF0F7;
  --surface: #FFFFFF;
  --surface-2: #F3F6FB;
  --ink: #141C33;
  --ink-2: #5B6685;
  --line: #DCE3EF;
  --protein: #3B5BDB;
  --carbs: #F5A300;
  --fat: #E64980;
  --water: #15AABF;
  --danger: #E03131;
  --btn-bg: #141C33;
  --btn-fg: #FFFFFF;
  --shadow: 0 1px 2px rgba(20, 28, 51, .05), 0 8px 24px -12px rgba(20, 28, 51, .18);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0D1324;
  --surface: #162039;
  --surface-2: #1D2946;
  --ink: #EEF2FF;
  --ink-2: #9BA7C7;
  --line: #27345A;
  --protein: #7C93FF;
  --carbs: #FFB938;
  --fat: #FF7BA8;
  --water: #3BC9DB;
  --danger: #FF6B6B;
  --btn-bg: #EEF2FF;
  --btn-fg: #0D1324;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font: 400 15px/1.45 var(--body);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--protein); outline-offset: 2px; }

.root { position: fixed; inset: 0; max-width: 520px; margin: 0 auto; overflow: hidden; background: var(--paper); }
.splash { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .4s var(--ease); }
.splash.out { opacity: 0; pointer-events: none; }
.spin { animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- типографика ---------- */
.display { font-family: var(--display); font-weight: 500; letter-spacing: -.02em; }
.title { font: 500 26px/1.15 var(--display); letter-spacing: -.03em; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.num-font { font-family: var(--display); font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: 16px; font-weight: 600;
  background: var(--btn-bg); color: var(--btn-fg);
  transition: transform .18s var(--ease), opacity .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.sm { height: 38px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--line); }
.link { color: var(--ink-2); font-weight: 500; padding: 10px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--line); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea.input { height: auto; min-height: 120px; padding: 14px; resize: none; line-height: 1.45; }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.seg { display: flex; padding: 4px; background: var(--surface-2); border-radius: 14px; position: relative; }
.seg button { flex: 1; height: 38px; border-radius: 10px; font-weight: 500; color: var(--ink-2); position: relative; z-index: 1; transition: color .25s; }
.seg button.on { color: var(--ink); }
.seg .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); transition: transform .35s var(--ease), width .35s var(--ease); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500;
  box-shadow: inset 0 0 0 1.5px var(--line); transition: transform .2s var(--ease), background .2s, box-shadow .2s;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--ink); color: var(--paper); box-shadow: none; }

/* ---------- полноэкранные сцены ---------- */
.screen {
  position: absolute; inset: 0; overflow-y: auto; padding: calc(28px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  display: flex; flex-direction: column; background: var(--paper); z-index: 5;
}
.screen > .step { flex: 1; display: flex; flex-direction: column; gap: 18px; animation: stepIn .5s var(--ease) both; }
.screen > .step.leave { animation: stepOut .22s ease-in both; }
@keyframes stepIn { from { opacity: 0; transform: translateX(28px); } }
@keyframes stepOut { to { opacity: 0; transform: translateX(-28px); } }
.step .grow { flex: 1; }
.step footer { display: grid; gap: 4px; padding-top: 8px; }
.progress { display: flex; gap: 6px; }
.progress i { height: 4px; flex: 1; border-radius: 4px; background: var(--line); overflow: hidden; position: relative; }
.progress i::after { content: ""; position: absolute; inset: 0; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.progress i.on::after { transform: scaleX(1); }

.gate { align-items: flex-start; justify-content: center; gap: 22px; }
.gate .mark { margin-bottom: 4px; }
.gate .tg-box { min-height: 48px; }

/* ---------- ожидание ИИ ---------- */
.thinking { display: grid; place-items: center; gap: 22px; text-align: center; margin: auto 0; }
.orb { position: relative; width: 150px; height: 150px; }
.orb svg { width: 100%; height: 100%; overflow: visible; }
.orb .seg1, .orb .seg2, .orb .seg3 { transform-origin: 50% 50%; fill: none; stroke-width: 9; stroke-linecap: round; }
.orb .seg1 { stroke: var(--protein); animation: orbit 2.4s cubic-bezier(.6, 0, .4, 1) infinite; }
.orb .seg2 { stroke: var(--carbs); animation: orbit 2.4s cubic-bezier(.6, 0, .4, 1) -.35s infinite; }
.orb .seg3 { stroke: var(--fat); animation: orbit 2.4s cubic-bezier(.6, 0, .4, 1) -.7s infinite; }
@keyframes orbit {
  0% { transform: rotate(0); stroke-dasharray: 20 300; }
  50% { stroke-dasharray: 150 300; }
  100% { transform: rotate(360deg); stroke-dasharray: 20 300; }
}
.orb .track { fill: none; stroke: var(--line); stroke-width: 9; opacity: .6; }
.think-line { height: 26px; position: relative; width: 100%; }
.think-line span { position: absolute; inset: 0; opacity: 0; transform: translateY(8px); transition: opacity .45s, transform .45s var(--ease); font-weight: 500; }
.think-line span.on { opacity: 1; transform: none; }
.think-line span.off { opacity: 0; transform: translateY(-8px); }

.dots { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); animation: bounce 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; background: var(--ink-2); }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-6px); opacity: 1; } }

.skeleton { border-radius: 12px; background: linear-gradient(100deg, var(--surface-2) 30%, var(--line) 50%, var(--surface-2) 70%); background-size: 250% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- приложение ---------- */
.app { position: absolute; inset: 0; display: flex; flex-direction: column; }
.views { flex: 1; position: relative; min-height: 0; }
.view { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: calc(18px + var(--safe-t)) 18px calc(104px + var(--safe-b)); opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .3s var(--ease), transform .4s var(--ease); scrollbar-width: none; }
.view::-webkit-scrollbar { display: none; }
.view.active { opacity: 1; pointer-events: auto; transform: none; }
.view.chat-view { padding: calc(14px + var(--safe-t)) 0 0; display: flex; flex-direction: column; overflow: hidden; }

.tabbar {
  position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  display: flex; padding: 5px; gap: 2px; border-radius: 22px; z-index: 4;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line); transition: transform .35s var(--ease), opacity .25s;
}
body.typing .tabbar { transform: translate(-50%, 140%); opacity: 0; pointer-events: none; }
.tab { position: relative; z-index: 1; display: grid; justify-items: center; gap: 2px; width: 92px; padding: 8px 0 7px; color: var(--ink-2); font-size: 12px; font-weight: 500; transition: color .25s; }
.tab svg { width: 24px; height: 24px; transition: transform .4s var(--spring); }
.tab.active { color: var(--btn-fg); }
.tab.active svg { transform: translateY(-1px) scale(1.08); }
.tab-pill { position: absolute; top: 5px; bottom: 5px; left: 5px; width: 92px; border-radius: 17px; background: var(--btn-bg); transition: transform .45s var(--ease); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.top .hello { font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; font: 500 15px var(--display); overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.days { display: flex; gap: 4px; margin: 0 -18px 16px; padding: 2px 18px 6px; overflow-x: auto; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 1; min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 8px 0; border-radius: 16px; color: var(--ink-2); transition: background .3s var(--ease), color .3s, transform .3s var(--spring); }
.day b { font: 500 16px var(--display); color: var(--ink); transition: color .3s; }
.day span { font-size: 12px; }
.day.sel { background: var(--btn-bg); color: color-mix(in srgb, var(--btn-fg) 70%, transparent); transform: translateY(-2px); }
.day.sel b { color: var(--btn-fg); }
.day.today:not(.sel) b { text-decoration: underline; text-decoration-color: var(--fat); text-decoration-thickness: 3px; text-underline-offset: 4px; }

.card { background: var(--surface); border-radius: 24px; padding: 18px; box-shadow: var(--shadow); }
.section { margin-top: 14px; }
.section > h2 { font: 500 16px var(--display); letter-spacing: -.02em; margin: 22px 2px 10px; }

.ring-card { display: grid; justify-items: center; gap: 18px; padding: 22px 18px 18px; }
.ring { position: relative; width: 236px; height: 236px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 20; }
.ring .track { stroke: var(--surface-2); }
.ring .arc { stroke-linecap: butt; transition: stroke-dasharray 1.1s var(--ease), stroke-dashoffset 1.1s var(--ease), stroke .4s; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
.ring-center .big { font: 500 44px/1 var(--display); letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.ring-center .big.over { color: var(--danger); }
.ring-center .cap { font-size: 13px; color: var(--ink-2); }
.ring-foot { display: flex; gap: 28px; font-size: 13px; color: var(--ink-2); }
.ring-foot b { display: block; font: 500 17px var(--display); color: var(--ink); letter-spacing: -.03em; }

.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; }
.macro .name { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.macro .name i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.macro .val { font: 500 16px var(--display); letter-spacing: -.03em; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.macro .val small { font: 400 12px var(--body); color: var(--ink-2); letter-spacing: 0; }
.bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: var(--c); width: 100%; transform: scaleX(0); transform-origin: left; transition: transform 1s var(--ease); }

.water { display: flex; align-items: center; gap: 14px; }
.water .info { flex: 1; min-width: 0; }
.water .info b { font: 500 18px var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.water .tube { height: 10px; border-radius: 10px; background: var(--surface-2); margin-top: 10px; overflow: hidden; position: relative; }
.water .tube i { position: absolute; inset: 0; border-radius: 10px; background: var(--water); transform: scaleX(0); transform-origin: left; transition: transform .9s var(--ease); }
.round { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; line-height: 1; box-shadow: inset 0 0 0 1.5px var(--line); transition: transform .2s var(--spring), background .2s; flex: none; }
.round:active { transform: scale(.88); }
.round.fill { background: var(--water); color: #fff; box-shadow: none; }

.meal { margin-top: 10px; padding: 6px 4px 6px 16px; }
.meal-head { display: flex; align-items: center; padding: 10px 0 4px; }
.meal-head h3 { font-weight: 600; flex: 1; }
.meal-head .sum { color: var(--ink-2); font-size: 13px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.add-mini { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 26px; color: var(--ink); background: none; outline: none; transition: transform .2s var(--spring); }
.add-mini:active { transform: scale(.88); }
.entry { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); max-height: 80px; overflow: hidden; animation: pop .5s var(--spring) both; transition: max-height .35s var(--ease), opacity .25s, padding .35s var(--ease); }
.entry.out { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; border-color: transparent; }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(-6px); } }
.entry .t { flex: 1; min-width: 0; }
.entry .t b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .t span { font-size: 12px; color: var(--ink-2); }
.entry .k { font: 500 15px var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.entry .x { width: 34px; height: 34px; border-radius: 10px; color: var(--ink-2); font-size: 20px; }
.empty-meal { padding: 4px 0 12px; font-size: 13px; color: var(--ink-2); }

.week { display: flex; align-items: flex-end; gap: 8px; height: 132px; position: relative; padding-top: 6px; }
.wbar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.wbar .col { width: 100%; flex: 1; display: flex; align-items: flex-end; }
.wbar .col i { display: block; width: 100%; border-radius: 8px 8px 4px 4px; background: var(--line); height: 0; transition: height .9s var(--ease); }
.wbar.sel .col i { background: var(--ink); }
.wbar.sel { color: var(--ink); font-weight: 600; }
.week .goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--ink-2); opacity: .5; pointer-events: none; }
.week-note { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; color: var(--ink-2); }

/* ---------- шторка ---------- */
.backdrop { position: absolute; inset: 0; background: rgba(8, 12, 24, .5); opacity: 0; transition: opacity .35s; z-index: 20; }
.backdrop.on { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 92%; overflow-y: auto;
  background: var(--paper); border-radius: 28px 28px 0 0; padding: 10px 20px calc(22px + var(--safe-b));
  transform: translateY(105%); transition: transform .5s var(--ease); display: grid; gap: 14px;
}
.sheet.on { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 4px; }
.sheet h2 { font: 500 20px var(--display); letter-spacing: -.03em; }
.est-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--surface); animation: pop .45s var(--spring) both; }
.est-item .t { flex: 1; min-width: 0; }
.est-item .t span { display: block; font-size: 12px; color: var(--ink-2); }
.est-item .k { font: 500 15px var(--display); letter-spacing: -.03em; }
.est-total { display: flex; justify-content: space-between; font-weight: 600; padding: 0 4px; }
.panes > div[hidden] { display: none; }
.err { color: var(--danger); font-size: 14px; }

/* ---------- чат ---------- */
.chat-head { padding: 0 18px 10px; display: flex; align-items: center; gap: 12px; }
.chat-head .who { flex: 1; }
.chat-head .who b { display: block; font: 500 18px var(--display); letter-spacing: -.03em; }
.chat-head .who span { font-size: 13px; color: var(--ink-2); }
.ai-badge { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; }
.ai-badge svg { width: 26px; height: 26px; }
.ai-badge.busy svg { animation: spin 1.4s linear infinite; }
.msgs { flex: 1; overflow-y: auto; padding: 8px 18px 12px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none; }
.msgs::-webkit-scrollbar { display: none; }
.msg { max-width: 86%; animation: msgIn .45s var(--ease) both; }
.msg.user { align-self: flex-end; }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.bubble { padding: 11px 15px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--btn-bg); color: var(--btn-fg); border-bottom-right-radius: 6px; box-shadow: none; }
.msg.bot .bubble { border-bottom-left-radius: 6px; }
.bubble p + p, .bubble ul { margin-top: 8px; }
.bubble ul { padding-left: 18px; margin-bottom: 0; }
.bubble.streaming::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: var(--ink-2); vertical-align: middle; animation: blink 1s ease-in-out infinite; }
.bubble.waiting { padding: 14px 16px; }
@keyframes blink { 50% { opacity: .2; transform: scale(.7); } }
.tool-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 7px 12px; border-radius: 12px; font-size: 13px; background: color-mix(in srgb, var(--water) 16%, var(--surface)); color: var(--ink); animation: pop .5s var(--spring) both; }
.tool-chip::before { content: "✓"; font-weight: 700; color: var(--water); }
.suggest { display: flex; gap: 8px; padding: 0 18px 10px; overflow-x: auto; scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }
.suggest .chip { white-space: nowrap; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 8px 14px calc(104px + var(--safe-b)); transition: padding .3s var(--ease); background: linear-gradient(to top, var(--paper) 70%, transparent); }
body.typing .composer { padding-bottom: calc(12px + var(--safe-b)); }
.composer textarea { flex: 1; min-height: 48px; max-height: 120px; resize: none; padding: 13px 16px; border-radius: 24px; border: 1.5px solid var(--line); background: var(--surface); outline: none; line-height: 1.35; }
.composer textarea:focus { border-color: var(--ink); }
.send { width: 48px; height: 48px; border-radius: 50%; background: var(--btn-bg); color: var(--btn-fg); display: grid; place-items: center; flex: none; transition: transform .2s var(--spring), opacity .2s; }
.send:active { transform: scale(.88); }
.send[disabled] { opacity: .3; }
.send svg { width: 22px; height: 22px; }

/* ---------- курс ---------- */
.plan-hero { background: var(--btn-bg); color: var(--btn-fg); border-radius: 28px; padding: 22px; display: grid; gap: 10px; }
.plan-hero .title { font-size: 24px; }
.plan-hero p { opacity: .78; }
.targets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.target { background: var(--surface); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.target span { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.target span i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink)); }
.target b { display: block; margin-top: 4px; font: 500 22px var(--display); letter-spacing: -.04em; }
.target b small { font: 400 13px var(--body); color: var(--ink-2); letter-spacing: 0; }
.phases { list-style: none; margin: 0; padding: 0; display: grid; }
.phase { display: grid; grid-template-columns: 28px 1fr; gap: 12px; position: relative; padding-bottom: 18px; }
.phase:last-child { padding-bottom: 0; }
.phase::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.phase:last-child::before { display: none; }
.phase .n { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font: 500 12px var(--display); }
.phase b { display: block; }
.phase .w { font-size: 12px; color: var(--ink-2); margin-bottom: 2px; }
.lists { display: grid; gap: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { padding: 6px 11px; border-radius: 999px; font-size: 13px; background: var(--surface-2); }
.tag.no { text-decoration: line-through; text-decoration-color: var(--fat); color: var(--ink-2); }
.tips { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.stagger > * { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.big-num { font: 500 64px/1 var(--display); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }

/* ---------- уведомления ---------- */
.toasts { position: absolute; left: 0; right: 0; top: calc(12px + var(--safe-t)); display: grid; justify-items: center; gap: 8px; z-index: 40; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--btn-bg); color: var(--btn-fg); box-shadow: var(--shadow); font-weight: 500; animation: toastIn .5s var(--spring) both; max-width: calc(100% - 32px); }
.toast.out { animation: toastOut .3s ease-in both; }
.toast button { color: inherit; opacity: .8; font-weight: 600; text-decoration: underline; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.92); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .spin, .orb *, .dots i { animation: none !important; }
}
.target.wide { grid-column: 1 / -1; }

/* ---------- шторка воды ---------- */
.water-sheet { overflow: hidden; gap: 18px; }
.water-sheet > :not(.wlayer) { position: relative; z-index: 1; }
.wlayer { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; z-index: 0; color: color-mix(in srgb, var(--water) 34%, transparent); pointer-events: none; transition: height .55s var(--ease); }
.wlayer .wbody { position: absolute; inset: 0; background: currentColor; }
.wlayer .wave { position: absolute; left: 0; top: -17px; width: 200%; height: 18px; fill: currentColor; animation: waveX 7s linear infinite; }
.wlayer .wave.w2 { top: -22px; opacity: .6; animation-duration: 11s; animation-direction: reverse; }
@keyframes waveX { to { transform: translateX(-50%); } }
.w-amount { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 6px 0 2px; }
.w-amount b { font: 500 72px/1 var(--display); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.w-amount span { font: 500 20px var(--display); color: var(--ink-2); }
.w-slider { padding: 6px 4px 0; }
.w-scale { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
#wRange { --p: 20%; -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; cursor: pointer; touch-action: pan-y; }
#wRange::-webkit-slider-runnable-track { height: 12px; border-radius: 12px; background: linear-gradient(to right, var(--water) var(--p), color-mix(in srgb, var(--ink) 12%, transparent) var(--p)); }
#wRange::-moz-range-track { height: 12px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 12%, transparent); }
#wRange::-moz-range-progress { height: 12px; border-radius: 12px; background: var(--water); }
#wRange::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -11px; border-radius: 50%; background: #fff; border: 4px solid var(--water); box-shadow: 0 4px 14px rgba(20, 28, 51, .25); transition: transform .2s var(--spring); }
#wRange::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 4px solid var(--water); box-shadow: 0 4px 14px rgba(20, 28, 51, .25); }
#wRange:active::-webkit-slider-thumb { transform: scale(1.18); }
#wRange:focus-visible { outline: none; }
#wRange:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--protein); outline-offset: 2px; }

/* ---------- экран входа ---------- */
.gate .btn svg { flex: none; }
.gate-mark { animation: gateIn .9s var(--ease) both; }
@keyframes gateIn { from { opacity: 0; transform: rotate(-70deg) scale(.7); } }
.gate .btn, .gate .muted { max-width: 420px; }
