:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
  color: #f7faf8;
  background: #140b20;
  --background: #140b20;
  --accent: #d8b4fe;
  --accent-hi: #f3e8ff;
  --accent-lo: #a855f7;
  --accent-ink: #1a0828;
  --muted: #c4b5d4;
  --surface: #1b102a;
  --line: rgba(176, 145, 201, .19);
  --progress-track: #2a1a40;
  --tg-viewport-stable-height: 100dvh;
  --tg-safe-area-inset-top: 0px;
  --tg-safe-area-inset-bottom: 0px;
  --tg-safe-area-inset-left: 0px;
  --tg-safe-area-inset-right: 0px;
  --tg-content-safe-area-inset-top: 0px;
  --tg-content-safe-area-inset-bottom: 0px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  --inset-top: calc(var(--safe-top) + var(--tg-content-safe-area-inset-top, 0px));
  --inset-bottom: calc(var(--safe-bottom) + var(--tg-content-safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; }
/* Keep wheel and touch scrolling, but hide browser scrollbars in every view. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  background: var(--background);
  min-height: var(--tg-viewport-stable-height, 100dvh);
}
html.tg-fullscreen,
html.tg-fullscreen body { background: var(--background); }
body {
  margin: 0;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  background: radial-gradient(circle at 50% 145px, rgba(116, 54, 179, .13), transparent 355px), var(--background);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
html.tg-fullscreen body {
  background: radial-gradient(circle at 50% 145px, rgba(116, 54, 179, .13), transparent 355px), var(--background);
}
main {
  max-width: 600px;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  margin: 0 auto;
  padding: calc(12px + var(--inset-top)) max(16px, var(--safe-right)) calc(110px + var(--inset-bottom)) max(16px, var(--safe-left));
}
small, .muted { color: var(--muted); }
.panel {
  min-width: 0; padding: 18px; margin: 13px 0; border: 1px solid var(--line);
  border-radius: 22px; background: var(--surface); box-shadow: 0 12px 25px #00000015;
}
.summary { margin-top: 0; background: linear-gradient(145deg, #211333, #1b102a 72%); }
h1,h2,h3,p { margin: 0 0 12px; }
h1 { font-size: 29px; }
h2 { font-size: 20px; letter-spacing: -.3px; }
h3 { font-size: 16px; }
.summary h1 { margin: 4px 0 0; }
.summary h1 small { font-size: 13px; font-weight: 500; }
nav {
  position: fixed; z-index: 20; left: 50%; bottom: calc(8px + var(--safe-bottom)); transform: translateX(-50%);
  width: min(calc(100% - 24px), 570px); display: flex; gap: 5px; padding: 6px;
  border: 1px solid var(--line); border-radius: 21px; background: rgba(27,16,42,.96);
  box-shadow: 0 -5px 30px #0005; backdrop-filter: blur(14px);
}
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; font: inherit; }
nav button {
  display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-width: 0; min-height: 57px; padding: 6px 2px; border: 0; border-radius: 16px;
  color: var(--muted); background: transparent; font-size: 10px; font-weight: 600;
}
nav button svg { width: 21px; height: 21px; }
nav button.active, .primary { color: var(--accent-ink); background: linear-gradient(155deg, #f3e8ff, #a855f7); }
button:not(.round):not(nav button) {
  min-height: 43px; padding: 10px 14px; border: 1px solid rgba(216,180,254,.21);
  border-radius: 13px; background: rgba(216,180,254,.11); color: var(--accent); font-weight: 650;
}
button.primary { color: var(--accent-ink)!important; background: linear-gradient(155deg, #f3e8ff, #a855f7)!important; border-color: transparent!important; }
button.danger { color: #ffb4bd!important; background: rgba(240,67,67,.12)!important; border-color: rgba(240,67,67,.22)!important; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.metric { min-width: 0; padding: 12px; border: 1px solid rgba(216,180,254,.12); border-radius: 15px; background: rgba(216,180,254,.055); }
.metric b { display: block; margin-top: 4px; font-size: 20px; }
.metric small { font-size: 12px; }
.bar { height: 8px; margin: 13px 0 16px; border-radius: 99px; background: var(--progress-track); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c084fc, #a855f7); }
input,select {
  width: 100%; min-width: 0; min-height: 45px; margin: 5px 0 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 13px; outline: none;
  color: #f7faf8; background: #140b20; font: inherit; font-size: 16px;
}
input:focus,select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(216,180,254,.12); }
input[type=file] { padding: 8px; }
label { display: block; color: var(--muted); font-size: 13px; }
.meal,.food { padding: 12px 0; border-top: 1px solid var(--line); }
.meal:first-child,.food:first-child { border-top: 0; }
.pill { padding: 5px 8px; border-radius: 99px; color: var(--accent); background: rgba(216,180,254,.1); font-size: 11px; white-space: nowrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { flex: 1; }
.note { margin-top: 12px; color: #eac9ff; font-size: 13px; line-height: 1.45; }
.empty { padding: 24px; color: var(--muted); text-align: center; }
.chart { display: flex; align-items: end; gap: 6px; height: 125px; padding: 10px 0; }
.chart > div { flex: 1; min-width: 8px; background: linear-gradient(#d8b4fe,#a855f7); border-radius: 5px 5px 0 0; }
.chart-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
@media(max-width:390px) { main { padding-inline: 12px; } .panel { padding: 15px; } .metric { padding: 10px; } .metric b { font-size: 17px; } }
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration:.01ms!important; transition-duration:.01ms!important; } }
