/* Fuel. The same look as Lift (font, sizes, cards), with a green accent so the two apps are easy to tell apart. */
@font-face {
  font-family: 'Lexend';
  src: url('fonts/lexend.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #4f5d6d;
  --line: #dde3ea;
  --soft: #eef2f6;
  --accent: #0e7a52;
  --accent-ink: #ffffff;
  --accent-soft: #dcf2e7;
  --protein: #1d5fd1;
  --protein-soft: #e3ecfb;
  --good: #146c37;
  --good-soft: #e2f3e8;
  --warn: #8a4b00;
  --warn-soft: #fbefdc;
  --over: #8a6d00;
  --danger: #b42318;
  --gold: #c98a00;
  --radius: 14px;
  --tap: 52px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1017;
    --card: #151c26;
    --ink: #e8eef5;
    --muted: #a3b0bf;
    --line: #273244;
    --soft: #1c2533;
    --accent: #4fd39a;
    --accent-ink: #06140d;
    --accent-soft: #143024;
    --protein: #6aa8ff;
    --protein-soft: #1b2a42;
    --good: #6fdc95;
    --good-soft: #15291d;
    --warn: #f2bd5c;
    --warn-soft: #2c2312;
    --over: #e9c46a;
    --danger: #ff8a80;
    --gold: #f5c542;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.45 'Lexend', -apple-system, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 32px);
}
body.tabbed main { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 24px 4px 8px; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.bar { display: flex; align-items: center; gap: 8px; min-height: 56px; margin-bottom: 8px; }
.bar h1 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bar .title-sm { font-size: 20px; }
.bar h1 .today { display: block; font-size: 14px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.navbtn {
  min-height: 44px; min-width: 44px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; background: var(--soft); color: var(--ink);
  font-weight: 500; font-size: 16px; text-decoration: none;
}
.daynav { display: flex; gap: 6px; }
.daynav .navbtn { font-size: 22px; padding: 0; }
.meta { font-size: 15px; color: var(--muted); margin: -4px 4px 12px; }

/* Cards and rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 10px 16px;
  color: inherit; text-decoration: none;
  border-top: 1px solid var(--line);
}
.list > .row:first-child { border-top: 0; }
a.row:active { background: var(--soft); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.row-name { font-weight: 500; overflow-wrap: anywhere; }
.row-sub { font-size: 14px; color: var(--muted); }
.row-chev { color: var(--muted); flex: none; }
.cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cardhead h3 { font-size: 18px; font-weight: 600; }
.cardhead.out { margin: 22px 4px 8px; }
.cardhead a { min-height: 44px; display: inline-flex; align-items: center; }
.cardtitle { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); vertical-align: 2px; }
.nums { flex: none; text-align: right; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nums strong { color: var(--ink); font-weight: 600; }
.empty-line { text-align: center; color: var(--muted); padding: 16px 8px; margin: 0; }
.empty { text-align: center; padding: 28px 16px; }
.empty h2 { color: var(--ink); font-size: 22px; margin: 0 0 8px; }
.small { font-size: 14px; color: var(--muted); }
.center { text-align: center; }
.label { font-size: 15px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
.label:first-child { margin-top: 0; }
.plainlist { margin: 0 0 12px; padding-left: 20px; }
.plainlist li { margin-bottom: 6px; }
.lead { font-size: 20px; font-weight: 600; }
.warntext { color: var(--warn); }
.warntext:empty { display: none; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font-weight: 500; text-decoration: none; text-align: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.big { min-height: 64px; font-size: 20px; }
.btn.danger { color: var(--danger); margin-top: 16px; }
.btn + .btn, .btn + .note, .stack > * + * { margin-top: 8px; }
label.btn { position: relative; cursor: pointer; }
label.btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.note { border-radius: 10px; padding: 10px 12px; font-size: 15px; margin-top: 10px; background: var(--soft); }
.note.warn { background: var(--warn-soft); }
.note.alert { margin: 0 0 12px; border: 2px solid var(--warn); }
.note.alert ol { margin: 8px 0; padding-left: 22px; }
.note.alert .btn { margin-top: 8px; }

/* Choices: big buttons, one per answer */
.btn.choice { flex-direction: column; gap: 0; min-height: 64px; font-size: 18px; font-weight: 600; }
.btn.choice small { font-size: 14px; font-weight: 400; color: var(--muted); }
.btn.choice.picked { border: 2px solid var(--accent); background: var(--accent-soft); }
.q { font-size: 22px; font-weight: 600; color: var(--ink); margin: 0 0 14px; }
.steps { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: -2px 2px 14px; }
.steps span { height: 6px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--accent); }
.unitfield { flex: 1; display: flex; align-items: center; gap: 8px; }
.unitfield input {
  flex: 1; min-width: 0; height: 64px; text-align: center; font-size: 28px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-variant-numeric: tabular-nums;
}
.unitfield span { font-weight: 500; color: var(--muted); }
.pair { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.welcome p { font-size: 18px; }

/* Today */
.hero { padding: 18px 16px; }
.twonum { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.twonum > div { display: flex; flex-direction: column; }
.bignum { font-size: 40px; font-weight: 650; line-height: 1.05; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.bignum.good { color: var(--good); }
.small-nums .bignum { font-size: 28px; }
.lab { font-size: 15px; color: var(--muted); font-weight: 500; }
.meter + .meter { margin-top: 10px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.meter-top strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.track { height: 12px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.fill { height: 100%; border-radius: 6px; background: var(--accent); transition: width .3s; }
.meter.pro .fill { background: var(--protein); }
.meter.pro.over .fill { background: var(--good); }
.meter.cal.over .fill { background: var(--over); }
.kind { margin: 10px 0 0; }
.checkin-due { display: flex; flex-direction: column; gap: 2px; border: 2px solid var(--gold); text-decoration: none; color: inherit; }
.checkin-due span { color: var(--accent); font-weight: 500; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qchip {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left;
  min-height: 64px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.qchip:active { background: var(--accent-soft); }
.qname { font-weight: 600; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.qsub { font-size: 13px; color: var(--muted); }
.weigh .bodyform, .card .bodyform { display: flex; align-items: center; gap: 8px; }
.bodyform input {
  flex: 1; min-width: 0; min-height: 52px; padding: 0 12px; font-size: 20px; font-weight: 600; text-align: center;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.bodyform .unit { color: var(--muted); }
.bodyform .btn { width: auto; margin: 0; }
.bodyform .dateinput { flex: none; width: 140px; font-size: 15px; font-weight: 400; }
.weigh .small { margin: 8px 0 0; }
.weighed { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.weighed .ico { color: var(--accent); }

/* Add food */
.choice-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.choices .row { min-height: 76px; }
.choices .row-name { font-size: 18px; font-weight: 600; }
.search {
  width: 100%; min-height: var(--tap); padding: 0 16px; margin-bottom: 4px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); font-size: 18px;
}
.airesult .items { list-style: none; margin: 0 0 8px; padding: 0; }
.airesult .items li { display: flex; align-items: center; gap: 8px; min-height: 56px; border-top: 1px solid var(--line); padding: 6px 0; }
.airesult .items li:first-child { border-top: 0; }
.x { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 20px; border-radius: 10px; }
.total { font-size: 18px; margin: 14px 0; }
.total .nums { font-size: 18px; color: var(--muted); }
.viewfinder { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 4 / 3; margin-bottom: 8px; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.aim { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #ff4d4f; box-shadow: 0 0 8px #ff4d4f; }
.aim::before { content: ''; position: absolute; left: 0; right: 0; top: -50px; height: 100px; border: 2px solid rgba(255, 255, 255, .85); border-radius: 12px; }
.scanmsg { text-align: center; font-weight: 500; min-height: 48px; }
.codeform { margin-top: 12px; }

/* Amounts */
.stepper { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 8px; margin-bottom: 10px; }
.stepper button { height: 60px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); font-size: 28px; font-weight: 500; line-height: 1; }
.stepper button:active { background: var(--accent-soft); }
.amount {
  min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; text-align: center;
}
.amount small { font-size: 14px; font-weight: 500; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chips button { min-height: 44px; min-width: 56px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); font-weight: 500; }
.chips button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips.big button { min-height: 56px; min-width: 56px; font-size: 20px; font-weight: 600; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.seg.five { grid-template-columns: repeat(5, 1fr); }
.seg.two-by { grid-template-columns: 1fr 1fr; }
.seg button {
  min-height: 52px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft);
  font-weight: 600; font-size: 16px; line-height: 1.2;
}
.seg button small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.seg button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg button[aria-pressed=true] small { color: inherit; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 8px; font-size: 16px; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }

/* My foods */
.row.food { padding-right: 8px; }
.addbtn { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.addbtn:active { background: var(--accent); color: var(--accent-ink); }

/* Forms */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 500; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.field small.inline { display: inline; margin: 0 0 0 4px; }
.field input:not([type=checkbox]), .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 18px;
}
.field textarea { min-height: 104px; resize: vertical; line-height: 1.4; }
.dateinput { min-height: 52px; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }

/* Progress */
.bodyv { font-size: 34px; font-weight: 650; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.bodyv small { font-size: 15px; font-weight: 500; color: var(--muted); }
.chart { margin: 8px 0; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .wdot { fill: var(--muted); opacity: .45; }
.legend { font-size: 14px; color: var(--muted); margin: 4px 4px 0; display: flex; align-items: center; gap: 6px; }
.legend .key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; background: var(--accent); }
.legend .key.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .45; margin-left: 10px; }
.storage p { margin: 0 0 6px; }

/* Bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; max-width: 560px; margin: 0 auto;
  display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500;
}
.tab[aria-current=page] { color: var(--accent); font-weight: 600; }
.ico { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico circle { fill: currentColor; }

/* Messages */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 16px);
  width: max-content; max-width: calc(100% - 32px); z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 16px; min-height: 44px;
  background: var(--ink); color: var(--bg); border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2); font-size: 15px; font-weight: 500;
}
.toast:not(:has(button)) { padding-right: 16px; }
.toast button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--bg); color: var(--ink); font-weight: 600; }
body.tabbed .toast { bottom: calc(env(safe-area-inset-bottom) + 74px); }

/* Stars for hitting your protein */
.burst { position: fixed; z-index: 30; pointer-events: none; }
.burst span { position: absolute; left: 0; top: 0; font-size: 20px; animation: burst 1s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes burst {
  from { transform: translate(-50%, -50%) scale(.3); opacity: 1; }
  70% { opacity: 1; }
  to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
