:root {
  --bg: #0c0b10;
  --surface: rgba(37, 36, 43, .68);
  --surface-strong: rgba(27, 27, 32, .92);
  --ink: #f5f5f7;
  --muted: #a5a4ad;
  --muted-2: #74737c;
  --line: rgba(255, 255, 255, .12);
  --chrome: rgba(255, 255, 255, .21);
  --lime: #28a8ea;
  --lime-ink: #ffffff;
  --orange: #ff5c8a;
  --violet: #9a8cff;
  --blue: #25d0a2;
  --danger: #ff5a59;
  --shadow: 0 24px 70px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .08);
  --safe-top: max(env(safe-area-inset-top), var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --content-safe-bottom: var(--tg-content-safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

[data-theme="dark"] {
  --bg: #0c0b10;
  --surface: rgba(37, 36, 43, .68);
  --surface-strong: rgba(27, 27, 32, .92);
  --ink: #f5f5f7;
  --muted: #a5a4ad;
  --muted-2: #74737c;
  --line: rgba(255, 255, 255, .12);
  --chrome: rgba(255, 255, 255, .21);
  --lime: #28a8ea;
  --lime-ink: #ffffff;
  --orange: #ff5c8a;
  --violet: #9a8cff;
  --blue: #25d0a2;
  --danger: #ff5a59;
  --shadow: 0 24px 70px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  overflow-x: hidden;
  background:
    radial-gradient(110% 44% at 50% -8%, rgba(112, 45, 91, .52), transparent 72%),
    radial-gradient(90% 28% at 50% 108%, rgba(82, 28, 78, .36), transparent 76%),
    linear-gradient(180deg, #120e15 0%, #0b0b0f 44%, #0a0a0d 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
button, [role="button"] { touch-action: manipulation; }
[hidden] { display: none !important; }

.splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 32%, rgba(42, 171, 238, .18), transparent 36%), linear-gradient(180deg, #17101a, #0b0b0f);
  z-index: 200;
  transition: opacity .35s ease, visibility .35s ease;
}
.splash.out { opacity: 0; visibility: hidden; }
.splash-mark { width: 52px; height: 52px; display: flex; align-items: flex-end; gap: 5px; margin: auto; }
.splash-mark span { flex: 1; background: linear-gradient(#55c8ff, #168dd2); border-radius: 999px; box-shadow: 0 0 20px rgba(42,171,238,.34); animation: pulse 1s ease-in-out infinite; }
.splash-mark span:nth-child(1) { height: 54%; animation-delay: -.2s; }
.splash-mark span:nth-child(2) { height: 100%; }
.splash-mark span:nth-child(3) { height: 72%; animation-delay: -.4s; }
.splash-word { font-weight: 760; font-size: 24px; letter-spacing: -.06em; text-align: center; }
@keyframes pulse { 0%, 100% { transform: scaleY(.7); opacity: .55; } 50% { transform: scaleY(1); opacity: 1; } }

.app { min-height: 100vh; min-height: var(--tg-viewport-stable-height, 100dvh); padding-bottom: calc(104px + var(--safe-bottom) + var(--content-safe-bottom)); }
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(72px + var(--safe-top));
  padding: calc(14px + var(--safe-top)) 20px 12px;
  background: linear-gradient(180deg, rgba(19, 14, 21, .94), rgba(15, 13, 18, .56) 72%, transparent);
  backdrop-filter: blur(28px) saturate(1.28);
}
.brand { font-size: 22px; line-height: 1; font-weight: 780; letter-spacing: -.055em; text-shadow: 0 1px 16px rgba(255,255,255,.08); }
.today-label { margin-top: 7px; color: var(--muted); font-size: 12px; font-weight: 560; text-transform: uppercase; letter-spacing: .075em; }
.avatar {
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: linear-gradient(160deg, rgba(255,255,255,.2), rgba(255,255,255,.04) 42%), linear-gradient(145deg, #2b2a30, #151519);
  color: var(--ink); font-size: 15px; font-weight: 750;
  border: 1px solid rgba(255,255,255,.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 8px 24px rgba(0,0,0,.3);
}
.main { width: 100%; max-width: 680px; margin: 0 auto; padding: 4px 16px 32px; }
.screen { animation: screen-in .24s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(5px); } }

.day-hero { padding: 14px 4px 22px; }
.ring-wrap { position: relative; width: min(72vw, 286px); aspect-ratio: 1; margin: 0 auto 18px; display: grid; place-items: center; }
.ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(#42bdf8 calc(var(--progress, 0) * 1%), rgba(255,255,255,.09) 0);
  transform: rotate(-90deg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.11), 0 0 44px rgba(42,171,238,.08);
}
.ring::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: radial-gradient(circle at 48% 38%, #27232b, #0e0d11 68%); box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.ring-core { position: relative; z-index: 1; text-align: center; max-width: 190px; }
.ring-kicker { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; }
.ring-number { margin-top: 7px; font-size: clamp(54px, 16vw, 74px); font-weight: 760; letter-spacing: -.075em; line-height: .92; font-variant-numeric: tabular-nums; }
.ring-number.over { color: var(--orange); }
.ring-unit { margin-top: 7px; color: var(--muted); font-size: 13px; font-weight: 580; }
.energy-line { display: flex; justify-content: center; gap: 7px; color: var(--muted); font-size: 13px; }
.energy-line strong { color: var(--ink); font-weight: 700; }

.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.macro {
  position: relative; overflow: hidden; min-width: 0; padding: 15px 13px 13px;
  background:
    linear-gradient(155deg, rgba(255,255,255,.105), rgba(255,255,255,.025) 45%, rgba(0,0,0,.1)) padding-box,
    linear-gradient(155deg, rgba(255,255,255,.26), rgba(255,255,255,.055) 55%, rgba(255,255,255,.12)) border-box;
  border: 1px solid transparent; border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 12px 26px rgba(0,0,0,.16);
  backdrop-filter: blur(22px) saturate(1.18);
}
.macro-top { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.macro-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--macro-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--macro-color) 18%, transparent); }
.macro-value { margin-top: 10px; font-size: 20px; font-weight: 720; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.macro-goal { color: var(--muted-2); font-size: 11px; font-weight: 570; }
.macro-bar { height: 4px; margin-top: 11px; border-radius: 999px; background: rgba(255,255,255,.09); overflow: hidden; }
.macro-bar span { display: block; width: var(--macro-progress); height: 100%; max-width: 100%; border-radius: inherit; background: var(--macro-color); }

.section-head { display: flex; align-items: end; justify-content: space-between; margin: 28px 2px 12px; }
.section-head h2, .page-title { margin: 0; font-size: 22px; line-height: 1.05; font-weight: 740; letter-spacing: -.045em; }
.page-title { font-size: 34px; padding: 12px 2px 20px; }
.section-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.section-link { padding: 2px 0; border: 0; background: transparent; color: #58c8ff; font-size: 12px; font-weight: 680; }
.weight-section-head { margin-bottom: 10px; }
.weight-card { width: 100%; min-height: 86px; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 13px; padding: 14px; border: 1px solid transparent; border-radius: 23px; text-align: left; background: linear-gradient(145deg, rgba(255,255,255,.1), rgba(255,255,255,.026) 52%, rgba(0,0,0,.1)) padding-box, linear-gradient(145deg, rgba(255,255,255,.24), rgba(76,184,238,.13) 55%, rgba(255,255,255,.08)) border-box; box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 12px 28px rgba(0,0,0,.17); backdrop-filter: blur(22px) saturate(1.2); }
.weight-orb { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 17px; background: radial-gradient(circle at 35% 26%, rgba(255,255,255,.2), transparent 35%), linear-gradient(145deg, #4bbdf6, #7768df); box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 9px 22px rgba(65,137,218,.22); }
.weight-orb span { color: white; font-size: 25px; transform: rotate(-12deg); }
.weight-copy { min-width: 0; display: grid; gap: 2px; }
.weight-copy > span { color: var(--muted); font-size: 10px; font-weight: 680; text-transform: uppercase; letter-spacing: .075em; }
.weight-copy strong { font-size: 20px; font-weight: 750; letter-spacing: -.035em; }
.weight-copy small { overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.weight-card-side { display: flex; align-items: center; gap: 7px; }
.weight-add { color: #58c8ff; font-size: 12px; font-weight: 700; }
.weight-delta { padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.055); color: var(--muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.weight-delta.down, .weight-summary strong.down { color: #57d6ae; }
.weight-delta.up, .weight-summary strong.up { color: #ff759b; }
.weight-chevron { color: var(--muted-2); font-size: 24px; line-height: 1; }
.entry-list, .food-list, .history-list { display: grid; gap: 9px; }
.entry {
  position: relative; display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px;
  min-height: 76px; padding: 12px 12px; border: 1px solid transparent; border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.095), rgba(255,255,255,.025) 48%, rgba(0,0,0,.08)) padding-box,
    linear-gradient(145deg, rgba(255,255,255,.22), rgba(255,255,255,.045) 52%, rgba(255,255,255,.1)) border-box;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.055), 0 10px 28px rgba(0,0,0,.15);
  backdrop-filter: blur(20px) saturate(1.15);
}
.food-thumb { width: 52px; height: 52px; border-radius: 15px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(145deg, #49bcf4, #147fca); color: white; font-weight: 780; box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 7px 17px rgba(17,123,185,.2); }
.food-thumb img { width: 100%; height: 100%; object-fit: cover; }
.entry-main, .food-main { min-width: 0; }
.entry-name, .food-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 680; letter-spacing: -.018em; }
.entry-sub, .food-sub { margin-top: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-energy { padding: 0; border: 0; background: transparent; color: var(--ink); text-align: right; font-size: 18px; font-weight: 740; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.entry-energy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .02em; }
.entry-delete { position: absolute; inset: 0; opacity: 0; pointer-events: none; }

.empty { padding: 38px 22px; text-align: center; border: 1px solid rgba(255,255,255,.09); border-radius: 26px; background: rgba(255,255,255,.025); backdrop-filter: blur(18px); }
.empty-mark { width: 56px; height: 56px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 18px; background: var(--surface); font-size: 25px; transform: rotate(-3deg); }
.empty h3 { margin: 0; font-size: 18px; letter-spacing: -.03em; }
.empty p { max-width: 300px; margin: 8px auto 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

.add-button {
  position: fixed; z-index: 42; left: 50%; bottom: calc(24px + var(--safe-bottom) + var(--content-safe-bottom));
  width: 62px; height: 62px; margin-left: -31px; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.34); border-radius: 50%;
  background: linear-gradient(165deg, #56c8ff 0%, #28a8ea 45%, #1383cb 100%); color: white;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.48), 0 12px 34px rgba(21,145,211,.42), 0 5px 14px rgba(0,0,0,.28);
  transition: transform .16s ease;
}
.add-button:active { transform: scale(.92); }
.add-button svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.nav {
  position: fixed; z-index: 40; left: 10px; right: 10px; bottom: calc(10px + var(--safe-bottom) + var(--content-safe-bottom));
  max-width: 660px; margin: auto; height: 76px; display: grid; grid-template-columns: 1fr 1fr 74px 1fr 1fr;
  align-items: center; padding: 7px 5px; border: 1px solid rgba(255,255,255,.2); border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(59,57,63,.72), rgba(26,25,30,.78) 48%, rgba(18,18,22,.87));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24), inset 0 -1px 0 rgba(255,255,255,.045), 0 18px 50px rgba(0,0,0,.5);
  backdrop-filter: blur(30px) saturate(1.38);
}
.nav-item { height: 58px; display: grid; justify-items: center; align-content: center; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--muted-2); }
.nav-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item span { font-size: 10px; font-weight: 650; }
.nav-item.active { color: #58c8ff; text-shadow: 0 0 18px rgba(42,171,238,.28); }
.nav-item.active svg { stroke-width: 2.25; }

.search-wrap { position: sticky; top: calc(70px + var(--safe-top)); z-index: 10; padding: 0 0 12px; background: linear-gradient(180deg, rgba(12,11,16,.95), rgba(12,11,16,.74) 70%, transparent); backdrop-filter: blur(18px); }
.search { position: relative; }
.search svg { position: absolute; left: 15px; top: 50%; width: 19px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; }
.search input {
  width: 100%; height: 50px; padding: 0 15px 0 44px; border: 1px solid var(--line); border-radius: 17px;
  outline: 0; background: rgba(255,255,255,.065); color: var(--ink); font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.search input:focus { border-color: color-mix(in srgb, var(--ink) 24%, var(--line)); }
.food-card { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 22px; background: linear-gradient(145deg, rgba(255,255,255,.085), rgba(255,255,255,.025)); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(20px); }
.food-card .food-thumb { width: 56px; height: 56px; }
.quick-plus { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.22); border-radius: 13px; background: linear-gradient(155deg, #45bcf6, #188fd2); color: white; display: grid; place-items: center; font-size: 23px; line-height: 1; box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 7px 18px rgba(23,138,202,.24); }

.history-day { border: 1px solid rgba(255,255,255,.13); border-radius: 23px; background: linear-gradient(145deg, rgba(255,255,255,.085), rgba(255,255,255,.025)); overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.055); backdrop-filter: blur(20px); }
.history-summary { width: 100%; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 16px; border: 0; background: transparent; text-align: left; }
.history-date { font-size: 15px; font-weight: 690; }
.history-count { margin-top: 4px; color: var(--muted); font-size: 11px; }
.history-kcal { font-size: 16px; font-weight: 730; font-variant-numeric: tabular-nums; }
.chevron { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s; }
.history-day.open .chevron { transform: rotate(180deg); }
.history-content { display: none; padding: 0 12px 12px; }
.history-day.open .history-content { display: grid; gap: 7px; }
.history-mini { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 11px 5px 11px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.history-mini span:last-child { font-weight: 680; font-variant-numeric: tabular-nums; }

.settings-intro { padding: 0 2px 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.settings-card { padding: 6px 16px; border: 1px solid rgba(255,255,255,.13); border-radius: 24px; background: linear-gradient(145deg, rgba(255,255,255,.085), rgba(255,255,255,.025)); box-shadow: inset 0 1px 0 rgba(255,255,255,.055); backdrop-filter: blur(20px); }
.setting-row { display: grid; grid-template-columns: 1fr minmax(100px, 42%); align-items: center; gap: 15px; min-height: 66px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-copy strong { display: block; font-size: 14px; }
.setting-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.setting-input { display: flex; align-items: baseline; justify-content: flex-end; gap: 5px; }
.setting-input input { width: 78px; padding: 7px 6px; border: 0; border-bottom: 1px solid var(--line); outline: 0; background: transparent; color: var(--ink); text-align: right; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.setting-input span { color: var(--muted); font-size: 11px; }
.save-settings { margin-top: 14px; }
.privacy-note { margin: 18px 4px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.sheet-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; border: 0; background: rgba(3, 2, 6, .62); backdrop-filter: blur(10px) saturate(.8); animation: fade-in .22s; }
.sheet {
  position: relative; width: 100%; max-width: 680px; max-height: calc(var(--tg-viewport-height, 100dvh) - 12px);
  overflow: auto; overscroll-behavior: contain; padding: 8px 18px calc(20px + var(--safe-bottom) + var(--content-safe-bottom));
  border: 1px solid rgba(255,255,255,.19); border-bottom: 0;
  border-radius: 30px 30px 0 0;
  background:
    radial-gradient(90% 36% at 50% 0%, rgba(112,45,91,.24), transparent 72%),
    linear-gradient(155deg, rgba(47,45,52,.93), rgba(20,20,25,.96) 46%, rgba(16,16,20,.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 -22px 70px rgba(0,0,0,.5);
  backdrop-filter: blur(34px) saturate(1.35);
  animation: sheet-up .3s cubic-bezier(.2,.75,.2,1); scrollbar-width: none;
}
.sheet::-webkit-scrollbar { display: none; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-grabber { width: 38px; height: 4px; margin: 2px auto 16px; border-radius: 999px; background: rgba(255,255,255,.23); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sheet-title { margin: 0; font-size: 28px; line-height: 1; font-weight: 760; letter-spacing: -.055em; }
.sheet-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.close-button { flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.14); border-radius: 13px; background: linear-gradient(155deg, rgba(255,255,255,.13), rgba(255,255,255,.035)); color: var(--muted); font-size: 22px; line-height: 1; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.sheet-options { display: grid; gap: 9px; }
.sheet-option { width: 100%; display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 13px; min-height: 78px; padding: 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 22px; background: linear-gradient(145deg, rgba(255,255,255,.085), rgba(255,255,255,.025)); box-shadow: inset 0 1px 0 rgba(255,255,255,.055); text-align: left; }
.sheet-option.primary { background: linear-gradient(145deg, rgba(47,177,241,.29), rgba(27,104,150,.2)), linear-gradient(145deg, rgba(255,255,255,.11), rgba(255,255,255,.025)); color: var(--ink); border-color: rgba(83,195,249,.38); box-shadow: inset 0 1px 0 rgba(255,255,255,.17), 0 12px 28px rgba(13,105,157,.12); }
.option-icon { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; background: linear-gradient(155deg, rgba(255,255,255,.14), rgba(255,255,255,.035)); color: var(--ink); font-size: 24px; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.primary .option-icon { background: linear-gradient(155deg, #54c5fc, #188fd3); color: white; border-color: rgba(255,255,255,.32); box-shadow: inset 0 1px 0 rgba(255,255,255,.42), 0 8px 20px rgba(20,137,202,.3); }
.option-copy strong { display: block; font-size: 15px; }
.option-copy span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.primary .option-copy span { color: rgba(225,239,247,.68); }
.option-arrow { color: var(--muted-2); font-size: 23px; }

.field { display: grid; gap: 8px; margin-top: 14px; }
.field-label { color: var(--muted); font-size: 11px; font-weight: 690; text-transform: uppercase; letter-spacing: .075em; }
.input, .textarea { width: 100%; border: 1px solid rgba(255,255,255,.13); border-radius: 17px; outline: 0; background: rgba(255,255,255,.055); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.035); }
.input { height: 50px; padding: 0 14px; }
.textarea { min-height: 92px; padding: 14px; resize: none; line-height: 1.45; }
.input:focus, .textarea:focus { border-color: color-mix(in srgb, var(--ink) 24%, var(--line)); }
.photo-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photo-tile { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px dashed rgba(255,255,255,.19); border-radius: 17px; background: linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); display: grid; place-items: center; color: var(--muted); }
.photo-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-tile .plus { font-size: 25px; font-weight: 300; }
.photo-tile .tile-label { position: absolute; left: 5px; right: 5px; bottom: 7px; overflow: hidden; color: var(--muted); font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.remove-photo { position: absolute; z-index: 2; top: 5px; right: 5px; width: 23px; height: 23px; padding: 0; border: 0; border-radius: 50%; background: rgba(10,10,8,.72); color: white; }
.source-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.source-actions.compact { margin-top: 0; }
.source-button { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; background: linear-gradient(155deg, rgba(255,255,255,.105), rgba(255,255,255,.035)); color: var(--ink); font-size: 13px; font-weight: 680; box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.source-button span { color: #58c8ff; font-size: 17px; line-height: 1; }
.source-button.gallery { border-color: rgba(73,187,242,.28); background: linear-gradient(155deg, rgba(46,169,229,.17), rgba(255,255,255,.035)); }
.barcode-upload { width: 100%; min-height: 58px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 9px 11px; border: 1px dashed rgba(255,255,255,.19); border-radius: 17px; background: linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); text-align: left; }
.barcode-icon { font-size: 21px; }
.barcode-copy strong { display: block; font-size: 13px; }
.barcode-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.barcode-preview { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 13px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 17px; background: rgba(255,255,255,.045); }
.switch-copy strong { display: block; font-size: 13px; }
.switch-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.switch { position: relative; width: 48px; height: 29px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: .2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 23px; height: 23px; border-radius: 50%; background: white; box-shadow: 0 2px 7px rgba(0,0,0,.35); transition: .2s; }
.switch input:checked + .switch-track { background: linear-gradient(160deg, #49bdf6, #168ed3); box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 0 18px rgba(42,171,238,.12); }
.switch input:checked + .switch-track::after { transform: translateX(19px); }
.button { width: 100%; min-height: 54px; padding: 0 18px; border: 1px solid rgba(255,255,255,.15); border-radius: 18px; background: linear-gradient(155deg, rgba(255,255,255,.16), rgba(255,255,255,.055)); color: var(--ink); font-weight: 720; letter-spacing: -.01em; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 10px 24px rgba(0,0,0,.18); }
.button.lime { background: linear-gradient(165deg, #54c5fc, #28a8ea 48%, #1685cc); color: white; border-color: rgba(255,255,255,.3); box-shadow: inset 0 1px 0 rgba(255,255,255,.42), 0 12px 28px rgba(18,132,194,.28); }
.button.ghost { background: rgba(255,255,255,.055); color: var(--ink); border: 1px solid rgba(255,255,255,.12); }
.button.danger { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: var(--danger); }
.button:disabled { opacity: .45; }
.button-row { display: grid; grid-template-columns: 1fr 1.7fr; gap: 9px; margin-top: 18px; }
.sheet-footer { position: sticky; bottom: calc(-20px - var(--safe-bottom)); margin: 18px -18px calc(-20px - var(--safe-bottom)); padding: 12px 18px calc(20px + var(--safe-bottom)); background: linear-gradient(transparent, rgba(18,18,22,.98) 22%); }

.analyzing { min-height: 340px; display: grid; place-content: center; justify-items: center; text-align: center; }
.analysis-orbit { position: relative; width: 118px; height: 118px; margin-bottom: 25px; }
.analysis-orbit::before, .analysis-orbit::after { content: ""; position: absolute; border-radius: 50%; }
.analysis-orbit::before { inset: 0; border: 1px solid var(--line); }
.analysis-orbit::after { width: 16px; height: 16px; top: -8px; left: 51px; background: var(--lime); box-shadow: 0 0 25px var(--lime); animation: orbit 1.4s linear infinite; transform-origin: 8px 67px; }
.analysis-core { position: absolute; inset: 25px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; background: linear-gradient(155deg, #49bff8, #1687ce); color: white; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 0 28px rgba(42,171,238,.28); font-size: 29px; }
@keyframes orbit { to { transform: rotate(360deg); } }
.analyzing h3 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.analyzing p { max-width: 250px; margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.result-top { display: grid; grid-template-columns: 76px 1fr; gap: 13px; align-items: center; margin-bottom: 14px; }
.result-photo { width: 76px; height: 76px; object-fit: cover; border-radius: 21px; background: var(--surface); }
.confidence { display: inline-flex; width: fit-content; margin-top: 6px; padding: 5px 8px; border-radius: 999px; background: color-mix(in srgb, var(--lime) 30%, var(--surface)); color: var(--ink); font-size: 9px; font-weight: 720; text-transform: uppercase; letter-spacing: .06em; }
.basis-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid rgba(255,255,255,.08); border-radius: 17px; background: rgba(0,0,0,.24); }
.basis-tab { min-height: 41px; padding: 0 6px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 680; }
.basis-tab.active { background: linear-gradient(155deg, rgba(74,192,249,.34), rgba(27,117,169,.26)); color: #dff4ff; box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 4px 12px rgba(0,0,0,.2); }
.amount-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.amount-input { position: relative; }
.amount-input input { padding-right: 64px; font-size: 21px; font-weight: 720; font-variant-numeric: tabular-nums; }
.amount-unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; }
.scaled-kcal { min-width: 90px; text-align: right; font-size: 24px; font-weight: 760; letter-spacing: -.05em; }
.scaled-kcal span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .04em; }
.nutrition-editor { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.nutrition-field { min-width: 0; padding: 10px 8px; border: 1px solid rgba(255,255,255,.11); border-radius: 15px; background: rgba(255,255,255,.045); text-align: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.035); }
.nutrition-field label { display: block; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.nutrition-field input { width: 100%; margin-top: 4px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); text-align: center; font-size: 17px; font-weight: 720; }
.ai-description { margin: 13px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.scanner { position: relative; aspect-ratio: 3/4; max-height: 54vh; overflow: hidden; border-radius: 25px; background: #070806; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; left: 8%; right: 8%; top: 39%; height: 22%; border: 2px solid var(--lime); border-radius: 20px; box-shadow: 0 0 0 999px rgba(0,0,0,.26); }
.scanner-line { position: absolute; left: 5%; right: 5%; top: 50%; height: 1px; background: var(--lime); box-shadow: 0 0 12px var(--lime); animation: scanline 1.7s ease-in-out infinite; }
@keyframes scanline { 0%,100% { transform: translateY(-28px); opacity: .55; } 50% { transform: translateY(28px); opacity: 1; } }
.scanner-hint { position: absolute; left: 15px; right: 15px; bottom: 18px; color: white; font-size: 11px; text-align: center; text-shadow: 0 1px 5px black; }
.manual-barcode { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.manual-barcode .button { width: auto; min-width: 90px; }
.lookup-state { padding: 25px 0 8px; text-align: center; }
.lookup-state .empty-mark { background: var(--bg); }

.quick-food { display: grid; grid-template-columns: 82px 1fr; gap: 15px; align-items: center; }
.quick-food .food-thumb { width: 82px; height: 82px; border-radius: 22px; }
.quick-food h3 { margin: 0; font-size: 20px; letter-spacing: -.04em; }
.quick-food p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.quick-nutrition { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 16px; }
.quick-stat { padding: 12px 6px; border: 1px solid rgba(255,255,255,.09); border-radius: 15px; background: rgba(255,255,255,.045); text-align: center; }
.quick-stat strong { display: block; font-size: 16px; }
.quick-stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; text-transform: uppercase; }

.weight-entry-card { padding: 15px; border: 1px solid rgba(255,255,255,.14); border-radius: 22px; background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.025)); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.weight-entry-date { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.weight-entry-date span { color: var(--muted); font-size: 11px; font-weight: 680; text-transform: uppercase; letter-spacing: .07em; }
.weight-entry-date strong { font-size: 13px; font-weight: 660; }
.weight-entry-controls { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.weight-input { position: relative; min-width: 0; }
.weight-input input { width: 100%; height: 54px; padding: 0 52px 0 15px; border: 1px solid rgba(255,255,255,.15); border-radius: 17px; outline: 0; background: rgba(0,0,0,.18); color: var(--ink); font-size: 24px; font-weight: 760; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.weight-input input:focus { border-color: rgba(73,190,247,.48); box-shadow: 0 0 0 3px rgba(42,171,238,.08); }
.weight-input span { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; font-weight: 650; }
.weight-save { min-width: 104px; padding: 0 15px; border: 1px solid rgba(255,255,255,.3); border-radius: 17px; background: linear-gradient(165deg, #54c5fc, #28a8ea 48%, #1685cc); color: white; font-size: 13px; font-weight: 720; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 9px 22px rgba(18,132,194,.22); }
.weight-save:disabled { opacity: .52; }
.weight-range { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 15px; padding: 4px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: rgba(0,0,0,.2); }
.weight-range button { min-width: 0; min-height: 39px; padding: 0 3px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 690; }
.weight-range button.active { background: linear-gradient(155deg, rgba(74,192,249,.36), rgba(69,83,168,.3)); color: #e1f5ff; box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 5px 13px rgba(0,0,0,.18); }
.weight-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 13px; }
.weight-summary > div { min-width: 0; padding: 11px 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; background: rgba(255,255,255,.035); }
.weight-summary span { display: block; color: var(--muted); font-size: 9px; font-weight: 650; text-transform: uppercase; letter-spacing: .045em; }
.weight-summary strong { display: block; margin-top: 5px; overflow: hidden; font-size: 15px; font-weight: 740; letter-spacing: -.025em; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.weight-chart { min-height: 230px; margin-top: 10px; padding: 4px 2px 0; border: 1px solid rgba(255,255,255,.08); border-radius: 22px; background: radial-gradient(90% 80% at 50% 0%, rgba(50,157,221,.08), transparent 72%), rgba(0,0,0,.13); overflow: hidden; }
.weight-chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.weight-grid line { stroke: rgba(255,255,255,.075); stroke-width: 1; }
.weight-grid text { fill: var(--muted-2); font-size: 9px; font-family: inherit; }
.weight-area { fill: url(#weight-area); }
.weight-line { fill: none; stroke: url(#weight-line); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 5px 8px rgba(42,171,238,.24)); }
.weight-dot { fill: #171820; stroke: #5ccaff; stroke-width: 2; }
.weight-latest-halo { fill: rgba(66,189,248,.18); }
.weight-latest { fill: #61ccff; stroke: white; stroke-width: 1.5; }
.weight-chart-empty { min-height: 228px; display: grid; place-content: center; justify-items: center; padding: 25px; text-align: center; }
.weight-chart-empty > span { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 17px; background: linear-gradient(145deg, rgba(75,189,246,.2), rgba(119,104,223,.15)); color: #62cbff; font-size: 28px; }
.weight-chart-empty strong { margin-top: 14px; font-size: 16px; }
.weight-chart-empty small { max-width: 230px; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.weight-recent { margin-top: 17px; }
.weight-recent .field-label { margin: 0 3px 7px; }
.weight-recent-row { display: flex; align-items: center; justify-content: space-between; min-height: 43px; padding: 0 4px; border-bottom: 1px solid rgba(255,255,255,.07); }
.weight-recent-row:last-child { border-bottom: 0; }
.weight-recent-row span { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.weight-recent-row strong { font-size: 13px; font-variant-numeric: tabular-nums; }

.toast { position: fixed; z-index: 300; left: 50%; bottom: calc(104px + var(--safe-bottom)); max-width: calc(100% - 32px); transform: translateX(-50%); padding: 11px 15px; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: rgba(37,36,43,.9); color: var(--ink); box-shadow: var(--shadow); backdrop-filter: blur(24px); font-size: 12px; font-weight: 630; animation: toast-in .22s; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (min-width: 680px) {
  .sheet { border-radius: 30px; margin-bottom: 12px; max-height: calc(100vh - 24px); }
  .sheet-layer { align-items: center; padding: 12px; }
  .main { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 374px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .app-header { padding-left: 16px; padding-right: 16px; }
  .macro { padding-left: 10px; padding-right: 10px; }
  .macro-value { font-size: 18px; }
  .nav { left: 6px; right: 6px; }
  .sheet { padding-left: 14px; padding-right: 14px; }
  .nutrition-editor { gap: 4px; }
  .nutrition-field { padding-left: 4px; padding-right: 4px; }
}
