/* Топливо — дневник калорий. Тёмная бирюза + кислотный лайм, крупный чёткий текст. */
:root {
  --bg: #061215;
  --card: rgb(14 36 42 / .74);
  --card-hi: rgb(22 52 60 / .86);
  --line: rgb(170 255 225 / .12);
  --line-hi: rgb(170 255 225 / .24);
  --ink: #effff8;
  --dim: #9cbcb3;
  --faint: #5e7f78;
  --lime: #c6ff4f;
  --mint: #5cffc9;
  --red: #ff6b5e;
  /* цвета БЖУ в баке: тройки для rgb(var(--c) / a) */
  --protein: 80 220 255;
  --fat: 255 190 80;
  --carbs: 198 255 79;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 500 17px/1.45 var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* фон: сетка приборной панели + мягкое свечение */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
body::before {
  background:
    radial-gradient(90% 55% at 15% -5%, rgb(40 150 125 / .30), transparent 65%),
    radial-gradient(70% 45% at 105% 35%, rgb(150 220 60 / .10), transparent 60%),
    radial-gradient(80% 50% at 50% 110%, rgb(30 120 140 / .22), transparent 60%);
}
body::after {
  background-image:
    linear-gradient(rgb(170 255 225 / .05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(170 255 225 / .05) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 25%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 25%, #000 10%, transparent 75%);
}
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dim { color: var(--dim); }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px 16px;
  background: linear-gradient(var(--bg) 55%, rgb(6 18 21 / 0));
}
.brand { display: flex; align-items: center; gap: 9px; font: 700 14px/1 var(--display); letter-spacing: .1em; }
.mark {
  width: 14px; height: 22px; border-radius: 5px; border: 1.5px solid var(--lime); position: relative; overflow: hidden;
  box-shadow: 0 0 12px rgb(198 255 79 / .35);
}
.mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 55%; background: var(--lime); animation: fill 3.2s ease-in-out infinite; }
@keyframes fill { 50% { height: 75%; } }
.locked .mark { border-color: var(--red); box-shadow: 0 0 12px rgb(255 107 94 / .35); }
.locked .mark::after { background: var(--red); height: 20%; animation: none; }

.daynav { display: flex; align-items: center; }
.daynav button { height: 44px; display: grid; place-items: center; color: var(--dim); border-radius: 12px; transition: color .2s, background .2s; }
.daynav #prev, .daynav #next { width: 40px; }
.daynav button:hover:not(:disabled) { color: var(--ink); background: rgb(170 255 225 / .06); }
.daynav button:disabled { opacity: .25; cursor: default; }
.dayname { min-width: 104px; padding: 0 6px; white-space: nowrap; font: 600 13px/1 var(--display) !important; letter-spacing: .08em; text-transform: uppercase; color: var(--ink) !important; }
.gear { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--dim); transition: color .2s, background .2s; }
.gear:hover, .gear.on { color: var(--lime); background: rgb(198 255 79 / .08); }
.locked .daynav, .locked .gear { visibility: hidden; }

/* ---------- Основа ---------- */
.wrap {
  position: relative; z-index: 10;
  max-width: 620px; margin: 0 auto;
  padding: 4px 16px calc(env(safe-area-inset-bottom) + 120px);
}

.hero {
  display: grid; grid-template-columns: minmax(88px, 28%) 1fr; gap: clamp(22px, 7vw, 40px);
  height: clamp(330px, 50dvh, 470px);
}

/* Капсула-бак: жидкость рисуется на canvas слоями по приёмам пищи */
.tank {
  position: relative; border-radius: 30px; overflow: hidden; cursor: pointer; outline: none;
  background:
    radial-gradient(120% 40% at 50% 105%, rgb(198 255 79 / .16), transparent 70%),
    linear-gradient(180deg, rgb(18 44 50 / .9), rgb(7 22 26 / .95));
  border: 1px solid var(--line-hi);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), inset 0 -40px 60px rgb(0 0 0 / .35), 0 24px 60px rgb(0 0 0 / .45);
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .35s;
}
.tank:active { transform: scale(.98); }
.tank:focus-visible { box-shadow: 0 0 0 3px rgb(198 255 79 / .5), 0 24px 60px rgb(0 0 0 / .45); }
.tank canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* стеклянный блик поверх жидкости */
.tank::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, rgb(255 255 255 / .11) 0, rgb(255 255 255 / .03) 14%, transparent 30%, transparent 80%, rgb(255 255 255 / .06) 100%);
}
.goal-tag {
  position: absolute; right: 8px; z-index: 2; transform: translateY(-50%);
  font: 600 10px/1 var(--display); letter-spacing: .06em; white-space: nowrap;
  padding: 5px 7px; border-radius: 8px; color: var(--ink);
  background: rgb(6 18 21 / .85); border: 1px solid rgb(255 255 255 / .22);
  transition: top 1.2s cubic-bezier(.2, .8, .2, 1);
}
.locked .goal-tag { display: none; }
.locked .tank { background: radial-gradient(120% 40% at 50% 105%, rgb(255 107 94 / .2), transparent 70%), linear-gradient(180deg, rgb(18 44 50 / .9), rgb(7 22 26 / .95)); cursor: default; }
.listening .tank { box-shadow: 0 0 0 2px var(--mint), 0 0 46px rgb(92 255 201 / .35), inset 0 -40px 60px rgb(0 0 0 / .35); }
@keyframes ping { from { box-shadow: 0 0 0 0 rgb(92 255 201 / .6); } to { box-shadow: 0 0 0 18px rgb(92 255 201 / 0); } }

/* Цифры справа */
.stats { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.label { font: 600 12px/1.1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.big {
  font: 700 clamp(40px, 12.2vw, 68px)/1 var(--display); letter-spacing: -.03em; margin: 10px 0 6px;
  white-space: nowrap; color: var(--ink); text-shadow: 0 0 32px rgb(198 255 79 / .22);
}
.of { font: 600 17px/1.3 var(--body); color: var(--dim); }
.of b { color: var(--ink); font-weight: 700; }
.left { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line-hi); display: flex; flex-direction: column; gap: 10px; }
.left b { font: 700 30px/1 var(--display); color: var(--lime); letter-spacing: -.02em; white-space: nowrap; text-shadow: 0 0 24px rgb(198 255 79 / .25); }
.left b small { font: 600 15px var(--body); color: var(--dim); letter-spacing: 0; margin-left: 5px; text-shadow: none; }
.macros { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 10px; margin-top: 26px; }
.mac { min-width: 0; }
.mac span { display: flex; align-items: center; gap: 6px; font: 700 13px/1 var(--body); color: var(--dim); }
.mac span::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: rgb(var(--c)); box-shadow: 0 0 8px rgb(var(--c) / .7); }
.mac.protein { --c: var(--protein); }
.mac.fat { --c: var(--fat); }
.mac.carbs { --c: var(--carbs); }
.mac b { display: block; margin-top: 8px; font: 800 19px/1 var(--body); white-space: nowrap; }
.locked .left, .locked .macros { opacity: .35; }

/* Ответ ИИ */
.voice { display: flex; gap: 12px; align-items: flex-start; margin: 22px 2px 14px; min-height: 3.2em; }
.eq { width: 20px; height: 22px; flex: none; display: flex; align-items: flex-end; gap: 3px; margin-top: 3px; }
.eq i { flex: 1; height: 35%; border-radius: 2px; background: var(--lime); box-shadow: 0 0 8px rgb(198 255 79 / .6); transition: height .3s; }
.eq i:nth-child(2) { height: 65%; }
.speaking .eq i { animation: eq .5s ease-in-out infinite alternate; }
.speaking .eq i:nth-child(2) { animation-delay: -.2s; }
.speaking .eq i:nth-child(3) { animation-delay: -.35s; }
@keyframes eq { from { height: 20%; } to { height: 100%; } }
.locked .eq i { background: var(--red); box-shadow: 0 0 8px rgb(255 107 94 / .6); }
.shot { position: relative; flex: none; width: 76px; height: 76px; margin: 0; border-radius: 18px; overflow: hidden; border: 1.5px solid rgb(198 255 79 / .5); box-shadow: 0 0 24px rgb(198 255 79 / .15); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .scan { position: absolute; left: 0; right: 0; top: 0; height: 30%; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgb(198 255 79 / .55) 85%, var(--lime)); }
.shot.scanning .scan { opacity: 1; animation: scanv 1.2s ease-in-out infinite alternate; }
.shot.scanning img { filter: saturate(.6) brightness(.85); }
@keyframes scanv { from { transform: translateY(-100%); } to { transform: translateY(340%); } }
.voice:has(.shot:not([hidden])) .eq { display: none; }
#say { margin: 0; font: 600 19px/1.42 var(--body); color: var(--ink); }
#say em { font-style: normal; color: var(--lime); font-weight: 800; white-space: nowrap; }
#say .caret { display: inline-block; width: .45em; height: 1em; vertical-align: -.12em; margin-left: 3px; background: var(--lime); border-radius: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.locked .meals, .locked .week { display: none; }

/* ---------- Приёмы пищи ---------- */
.meals { margin-top: 30px; display: grid; gap: 30px; }
.meal { --c: 170 255 225; }
.meals.anim .meal, .meals.anim .empty { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
.meal-head { display: flex; align-items: baseline; gap: 10px; padding: 0 2px 12px; border-bottom: 1px solid var(--line-hi); }
.meal-head h4 { margin: 0; flex: 1; font: 600 13px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.meal-head .mk { font: 700 17px/1 var(--display); color: var(--ink); white-space: nowrap; }
.meal-head .mk small { font: 600 13px var(--body); color: var(--dim); margin-left: 3px; }

.item { margin: 0 -12px; padding: 14px 14px; border-radius: 16px; cursor: pointer; transition: background .2s; }

.item:hover, .item.open { background: rgb(170 255 225 / .05); }
.i-row { display: flex; gap: 12px; align-items: baseline; }
.i-name { flex: 1; min-width: 0; font: 700 18px/1.3 var(--body); }
.i-kcal { font: 600 17px/1 var(--display); white-space: nowrap; }
.i-sub { margin-top: 4px; font: 600 14px/1.4 var(--body); color: var(--dim); }
.i-sub b { color: var(--ink); font-weight: 700; }

.empty {
  padding: 22px 18px; border-radius: 22px; border: 1px dashed var(--line-hi);
  font: 600 17px/1.5 var(--body); color: var(--dim);
}
.empty b { color: var(--ink); }

.edit { display: grid; gap: 10px; margin-top: 14px; cursor: default; animation: rise .3s cubic-bezier(.2, .8, .2, 1) both; }
.edit label { display: grid; gap: 6px; font: 700 12px/1 var(--body); color: var(--dim); letter-spacing: .04em; text-transform: uppercase; }
.edit input {
  width: 100%; min-width: 0; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line-hi);
  background: rgb(4 14 17 / .7); outline: none; font: 700 17px var(--body); text-transform: none; letter-spacing: 0;
}
.edit input:focus { border-color: rgb(var(--c) / .7); box-shadow: 0 0 0 3px rgb(var(--c) / .15); }
.edit .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.edit .kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.edit .kinds button { padding: 11px 0; border-radius: 12px; border: 1px solid var(--line); font: 700 13px var(--body); color: var(--dim); }
.edit .kinds button.on { color: var(--ink); border-color: rgb(198 255 79 / .7); background: rgb(198 255 79 / .1); }
.edit .acts { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.edit .save { font: 700 14px/1 var(--display); letter-spacing: .06em; padding: 14px 20px; border-radius: 14px; color: #0b1a02; background: var(--lime); }
.edit .del { font: 700 15px/1 var(--body); color: var(--red); padding: 14px 4px; }

/* ---------- Неделя ---------- */
.week { margin-top: 34px; }
.week h3, .settings h3 {
  display: flex; align-items: center; gap: 12px; margin: 0 0 16px;
  font: 700 12px/1 var(--display); letter-spacing: .22em; color: var(--dim);
}
.week h3 i, .settings h3 i { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-hi), transparent); }
.wplot { position: relative; height: 150px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.wcol { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; cursor: pointer; }
.wcol .v { font: 700 12px/1 var(--body); color: var(--dim); white-space: nowrap; }
.wcol .col {
  width: 100%; min-height: 4px; border-radius: 10px 10px 5px 5px;
  background: linear-gradient(180deg, rgb(92 255 201 / .55), rgb(92 255 201 / .12));
  transform-origin: bottom; animation: grow .8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 45ms);
}
.wcol.hit .col { background: linear-gradient(180deg, var(--lime), rgb(198 255 79 / .2)); box-shadow: 0 0 18px rgb(198 255 79 / .3); }
.wcol.hit .v { color: var(--lime); }
.wcol.sel .col { outline: 2px solid var(--ink); outline-offset: 2px; }
.wcol.zero .col { background: rgb(170 255 225 / .1); }
@keyframes grow { from { transform: scaleY(0); } }
.wgoal { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px dashed rgb(198 255 79 / .55); pointer-events: none; }
.wgoal span { position: absolute; right: 0; bottom: 4px; font: 700 11px/1 var(--body); color: var(--lime); background: var(--bg); padding: 0 0 0 6px; }
.wdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 8px; }
.wdays span { text-align: center; font: 600 12px/1 var(--display); text-transform: uppercase; color: var(--dim); }
.wdays span.sel { color: var(--ink); }

/* ---------- Строка ввода ---------- */
.cmd {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  width: min(620px, calc(100% - 20px));
  display: flex; align-items: flex-end; gap: 8px; padding: 7px;
  border-radius: 24px; background: rgb(9 26 30 / .88); border: 1px solid var(--line-hi);
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 16px 50px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .05);
  overflow: hidden; transition: border-color .3s;
}
.cmd:focus-within { border-color: rgb(198 255 79 / .45); }
.cmd::after {
  content: ""; position: absolute; left: 0; top: 0; width: 45%; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--lime), transparent); opacity: 0; transition: opacity .3s;
}
.cmd.thinking::after { opacity: 1; animation: scan 1s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateX(-60%); } to { transform: translateX(185%); } }
.field { position: relative; flex: 1; min-width: 0; }
.field textarea, .field input {
  display: block; width: 100%; border: 0; outline: none; background: none; resize: none;
  font: 600 17px/1.35 var(--body); padding: 12px 6px; caret-color: var(--lime);
}
.field textarea { height: 47px; max-height: 38dvh; overflow-y: auto; }
.field input::placeholder { color: var(--faint); }
.field #pw, .locked .field textarea, .locked .ph { display: none; }
.locked .field #pw { display: block; }
.ph {
  position: absolute; left: 6px; top: 24px; transform: translateY(-50%); pointer-events: none;
  color: var(--faint); font: 600 17px var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 6px);
  transition: opacity .35s;
}
.ph.swap { opacity: 0; }
.field.has .ph { display: none; }
.cam, .mic, .send { width: 48px; height: 48px; flex: none; border-radius: 17px; display: grid; place-items: center; transition: color .2s, background .2s, transform .12s, box-shadow .2s; }
.mic { color: var(--lime); border: 1.5px solid rgb(198 255 79 / .35); }
.cam { color: var(--ink); background: rgb(170 255 225 / .07); }
.cam:active { transform: scale(.92); }
.cmd:not(.nomic):not(.has) .send, .cmd.live .send, .cmd.has:not(.live) .mic { display: none; }
.mic.live { color: var(--bg); background: var(--mint); border-color: var(--mint); animation: ping 1.3s ease-out infinite; }
.send { color: #0b1a02; background: var(--lime); box-shadow: 0 0 20px rgb(198 255 79 / .25); }
.send svg { stroke-width: 2.4; }
.send:active, .mic:active, .cam:active { transform: scale(.92); }
.send.ready { animation: ready 1.3s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 0 0 6px rgb(198 255 79 / .2), 0 0 30px rgb(198 255 79 / .55); } }

/* ---------- Настройки ---------- */
.settings {
  position: fixed; z-index: 45; top: calc(env(safe-area-inset-top) + 58px); right: 12px; width: min(340px, calc(100% - 24px));
  padding: 18px; border-radius: 22px; background: rgb(10 28 33 / .95); border: 1px solid var(--line-hi);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 24px 60px rgb(0 0 0 / .55);
  animation: rise .3s cubic-bezier(.2, .8, .2, 1) both;
}
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 14px 2px; border-top: 1px solid var(--line); font: 700 17px var(--body); text-align: left; }
.set-row:first-of-type { border-top: 0; }
.set-goal { display: flex; align-items: baseline; gap: 6px; color: var(--dim); font-size: 15px; }
.set-goal input { width: 78px; text-align: right; border: 0; border-bottom: 1.5px solid var(--line-hi); background: none; outline: none; font: 700 19px var(--display); color: var(--lime); padding: 2px 0; }
.set-row.danger { color: var(--red); }

@media (max-width: 370px) {
  .brand-word { display: none; }
  .left b { font-size: 25px; }
  .mac b { font-size: 17px; }
}
@media (min-width: 700px) {
  .hero { grid-template-columns: 170px 1fr; gap: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; }
}
