/* Fuel Snap — Fuel Planner token set, Apple Watch rings. Dark only. */
:root {
  color-scheme: dark;
  --bg: #050607;
  --card: #111216;
  --line: #1f2127;          /* assumed: 1px card borders */
  --text: #f3f4f6;          /* assumed */
  --dim: #8b9099;           /* assumed */
  --signal: #ff3b30;        /* assumed: signal red, the only CTA colour */
  --signal-glow: rgba(255, 59, 48, .55);
  --cal: #ffd60a;           /* assumed: calories yellow */
  --pro: #ff3b30;           /* protein red */
  --pro-floor: #ff9f0a;     /* amber at floor */
  --pro-goal: #30d158;      /* green at goal */
  --fat: #ff9500;           /* fat orange */
  --r-card: 20px;
  --r-hero: 28px;
  --grid: 54px;
  --display: 'Helvetica Neue', 'Avenir Next', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease-enter: cubic-bezier(0.22, 1, 0.36, 1);
  --spring-snappy: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1);
  --spring-smooth: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001);
  --spring-bouncy: linear(0, 0.004, 0.016, 0.035, 0.063, 0.098, 0.141 13.6%, 0.25, 0.391, 0.562, 0.765, 1 31.8%, 1.098 34.8%, 1.161 37.9%, 1.2 41%, 1.213 44.2%, 1.2 47.3%, 1.164 50.5%, 1.111 53.7%, 1.05 57%, 1 60.3%, 0.967 63.5%, 0.945 66.8%, 0.934 70.1%, 0.933 73.3%, 0.944 76.6%, 0.966 79.9%, 1 83.2%, 1.011 86.5%, 1.017 89.8%, 1.017 93.1%, 1.012 96.4%, 1);
  --bar-h: 116px;
}
@supports not (animation-timing-function: linear(0, 1)) {
  :root {
    --spring-snappy: cubic-bezier(.2, .9, .3, 1.2);
    --spring-smooth: cubic-bezier(.22, 1, .36, 1);
    --spring-bouncy: cubic-bezier(.34, 1.56, .64, 1);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / var(--grid) var(--grid),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / var(--grid) var(--grid),
    var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  caret-color: var(--signal);
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
}
::selection { background: rgba(255, 59, 48, .38); color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 6px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
input { font: inherit; color: inherit; -webkit-appearance: none; appearance: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
[hidden] { display: none !important; }

#app { width: 100%; max-width: 480px; margin: 0 auto; padding: 0 16px; padding-top: env(safe-area-inset-top); }
.screen { will-change: auto; }

/* ---- micro-labels: mono, uppercase, wide tracking, red glowing dot ---- */
.micro {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-weight: 800; font-size: 9.5px; line-height: 1;
  letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
  white-space: nowrap;
}
.micro::before {
  content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%;
  background: var(--signal); box-shadow: 0 0 8px 1px var(--signal-glow);
}
.num {
  font-family: var(--display); font-weight: 400; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; line-height: 1;
}

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; gap: 6px; height: 60px; padding-top: 6px; }
.datebtn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 44px; justify-content: center; }
.datefull { font-size: 17px; letter-spacing: -.02em; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  color: var(--dim); border: 1px solid transparent;
  transition: transform .5s var(--spring-snappy), color .2s, border-color .2s, background-color .2s;
}
.iconbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn:active { transform: scale(.9); color: var(--text); }
.iconbtn:disabled { opacity: .4; pointer-events: none; }

/* ---- cards ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.hero-card { border-radius: var(--r-hero); position: relative; overflow: hidden; padding: 20px 18px 18px; margin-top: 4px; }
.brandring {
  position: absolute; top: -96px; right: -96px; width: 210px; height: 210px; border-radius: 50%;
  border: 26px solid var(--signal);
  filter: drop-shadow(0 0 18px var(--signal-glow));
  pointer-events: none;
}
.rings-wrap { position: relative; width: 224px; height: 224px; margin: 36px 0 6px; }
.rings { width: 100%; height: 100%; overflow: visible; transform-origin: 50% 50%; }
.rings circle { fill: none; stroke-width: 20; stroke-linecap: round; }
.rings .track { opacity: .14; }
.rings .glow { opacity: .45; filter: url(#neon); }
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  pointer-events: none;
}
.hero-num { font-size: 44px; }
.hero-num.over { color: var(--signal); }
.ring-center .micro { font-size: 8px; letter-spacing: .12em; max-width: 92px; overflow: hidden; }
.ring-center .micro.goal::before { background: var(--pro-goal); box-shadow: 0 0 8px 1px rgba(48, 209, 88, .7); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stat-num { font-size: 38px; }
#statCal { color: var(--cal); }
#statPro { color: var(--pro); }
#statPro.floor { color: var(--pro-floor); }
#statPro.goal { color: var(--pro-goal); }
#statFat { color: var(--fat); }
#statCal.over, #statFat.over { color: var(--signal); }
.stat-of { font-size: 12px; color: var(--dim); letter-spacing: -.01em; }
.carbs-line { display: flex; align-items: baseline; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.carbs-num { font-size: 22px; }
.carbs-line .stat-of { margin-left: -4px; }

/* ---- pantry ---- */
.pantry { margin-top: 18px; }
.linkbtn { color: var(--signal); font-size: 10px; }
.linkbtn::before { display: none; }
.pantry-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pantry-strip::-webkit-scrollbar { display: none; }
.pchip {
  flex: none; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  min-width: 150px; max-width: 220px; padding: 12px 14px 11px; border-radius: 16px; text-align: left;
  background: var(--card); border: 1px solid var(--line);
  transition: transform .5s var(--spring-snappy), border-color .2s;
}
.pchip:active { transform: scale(.96); }
.pchip-name { font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pchip-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.pchip.low { border-color: rgba(255,159,10,.5); }
.pchip.low .pchip-sub { color: var(--pro-floor); }
.pchip.add { border-style: dashed; color: var(--dim); justify-content: center; align-items: center; min-width: 140px; }
.pchip.add svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
.pfields { padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.pfields .item-macros { margin-top: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grams { padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.grams-wrap { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.grams-input { width: 60%; max-width: 220px; text-align: right; background: none; border: 0; border-bottom: 1px solid var(--line); font-size: 64px; padding: 0 0 6px; color: var(--text); }
.grams-input:focus { border-bottom-color: var(--signal); }
.grams-input::placeholder { color: var(--line); }
.grams-unit { font-size: 22px; color: var(--dim); }
.grams .meal-sum { margin-top: 2px; }
.pantry-manage { display: flex; gap: 14px; margin-top: 6px; }

/* ---- notice / toast ---- */
.notice { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(17,18,22,.8); color: var(--dim); font-size: 14px; }
.notice b { color: var(--text); font-weight: 500; }
.notice a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.notice-actions { margin-top: 12px; }
.notice-actions .pill { min-height: 48px; width: 100%; font-size: 15px; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--bar-h) + 10px + var(--kb, 0px) + env(safe-area-inset-bottom));
  width: max-content; max-width: calc(100% - 32px); margin: 0 auto;
  padding: 12px 18px; border-radius: 18px; text-align: center; line-height: 1.35;
  background: #16181d; border: 1px solid var(--line); color: var(--text); font-size: 14px; white-space: normal;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 30;
}

/* ---- ledger ---- */
.ledger { margin-top: 18px; }
.ledger-head { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 6px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { position: relative; border-bottom: 1px solid var(--line); }
.row-main { width: 100%; display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: start; padding: 14px 0 13px; text-align: left; min-height: 64px; }
.row-time { font-family: var(--mono); font-size: 11px; color: var(--dim); letter-spacing: .04em; padding-top: 4px; }
.row-body { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.row-label { font-size: 16px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; gap: 10px; align-items: center; min-width: 0; }
.row-meta .micro { flex: none; }
.row-macros { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); letter-spacing: .02em; white-space: nowrap; transition: opacity .2s; }
.row.armed .row-macros { opacity: 0; }
.row-del {
  position: absolute; right: 0; top: 50%; translate: 0 -50%; color: var(--signal); border-color: var(--line); background: var(--card);
  opacity: 0; transform: scale(.8); pointer-events: none;
  transition: opacity .2s, transform .5s var(--spring-snappy);
}
.row.armed .row-del { opacity: 1; transform: scale(1); pointer-events: auto; }
.tag {
  font-family: var(--mono); font-weight: 800; font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--signal); border: 1px solid rgba(255,59,48,.45); border-radius: 999px; padding: 4px 7px 3px; line-height: 1;
}
.tag.amber { color: var(--pro-floor); border-color: rgba(255,159,10,.45); }
.empty { color: var(--dim); font-size: 15px; padding: 26px 2px; margin: 0; }
.spacer { height: 12px; }

/* ---- action bar ---- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 20;
  padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(5,6,7,0));
}
.actionbar > * { max-width: 448px; margin-left: auto; margin-right: auto; }
.actions { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; padding: 0 30px; border-radius: 999px; font-size: 17px; font-weight: 500; letter-spacing: -.01em;
  transition: transform .55s var(--spring-snappy), box-shadow .3s, opacity .2s;
}
.pill.primary {
  color: #fff; background: var(--signal);
  box-shadow: 0 8px 28px rgba(255,59,48,.38), 0 2px 10px rgba(255,59,48,.28);
}
.pill.primary:active { transform: scale(.95); }
.pill:disabled { opacity: .55; pointer-events: none; }
.pill svg, .ghost svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.pill.wide, .ghost.wide { width: 100%; }
.ghost {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 60px; padding: 8px 6px; border-radius: 18px; color: var(--dim); font-size: 12px; letter-spacing: -.01em;
  border: 1px solid var(--line); background: var(--card);
  transition: transform .5s var(--spring-snappy), color .2s, border-color .2s;
}
.ghost:active { transform: scale(.95); color: var(--text); }
.ghost.wide { flex-direction: row; gap: 10px; font-size: 16px; }
.typebar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 18px;
}
.typebar input { flex: 1; min-width: 0; background: none; border: 0; font-size: 17px; height: 44px; color: var(--text); }
.typebar input::placeholder { color: var(--dim); }
.typebar .go { color: #fff; background: var(--signal); box-shadow: 0 4px 16px rgba(255,59,48,.35); }
.typebar .mic.listening { color: var(--signal); border-color: rgba(255,59,48,.5); }

/* ---- analyzing ---- */
.analyzing { display: flex; flex-direction: column; align-items: center; gap: 22px; padding-top: 24px; }
.shot { position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; border-radius: var(--r-hero); }
.shot img { width: 100%; height: 100%; object-fit: cover; opacity: .72; }
.scanline {
  position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--signal);
  box-shadow: 0 0 14px 2px var(--signal-glow); animation: scan 1.8s cubic-bezier(.45,0,.55,1) infinite alternate;
}
@keyframes scan { from { transform: translateY(0); } to { transform: translateY(calc(100vw - 34px)); } }
@media (min-width: 480px) { @keyframes scan { from { transform: translateY(0); } to { transform: translateY(446px); } } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* ---- confirm ---- */
.confirm-shot { width: 100%; aspect-ratio: 16 / 7; overflow: hidden; margin-bottom: 14px; }
.confirm-shot img { width: 100%; height: 100%; object-fit: cover; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item { position: relative; padding: 16px 16px 14px; }
.item.needs { border-color: rgba(255,159,10,.5); }
.item-top { display: flex; align-items: center; gap: 10px; padding-right: 40px; }
.item .name { flex: 1; min-width: 0; background: none; border: 0; border-bottom: 1px solid transparent; font-size: 17px; letter-spacing: -.01em; padding: 2px 0 6px; }
.item .name:focus { border-bottom-color: var(--line); }
.item .name::placeholder { color: var(--dim); }
.item .conf { font-size: 8.5px; }
.item .conf::before { display: none; }
.item-remove { position: absolute; top: 8px; right: 6px; width: 40px; height: 40px; }
.item-macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.item-macros label { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.item .macro {
  width: 100%; text-align: center; background: none; border: 0; border-bottom: 1px solid var(--line);
  font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; padding: 4px 0 6px;
  transition: border-color .2s;
}
.item .macro:focus { border-bottom-color: var(--signal); }
.item .macro::placeholder { color: var(--line); }
.item-macros .micro { font-size: 8px; }
.item-macros .micro::before { display: none; }
.flag { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--dim); }
.addline {
  display: flex; align-items: center; gap: 10px; margin: 12px 2px 0; padding: 10px 4px; color: var(--dim); font-size: 14px;
}
.addline svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
.slotcard { margin-top: 14px; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono); font-weight: 800; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 11px 14px 10px; min-height: 36px; line-height: 1;
  transition: transform .5s var(--spring-snappy), color .2s, border-color .2s, background-color .2s;
}
.chip:active { transform: scale(.94); }
.chip[aria-checked="true"] { color: var(--text); border-color: var(--signal); background: rgba(255,59,48,.08); }
.meal-sum { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; padding: 0 2px; }
.meal-sum .line { font-family: var(--display); font-size: 20px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.meal-sum .line span { color: var(--dim); font-size: 13px; letter-spacing: 0; margin: 0 6px 0 2px; }

/* ---- setup ---- */
.setup { padding: 22px 18px; display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.lede { margin: 0; font-size: 17px; color: var(--text); letter-spacing: -.01em; line-height: 1.4; }
.field { display: flex; flex-direction: column; gap: 10px; }
.field input { height: 48px; padding: 0 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 16px; transition: border-color .2s; }
.field input:focus { border-color: var(--signal); }
.formerr { margin: 0; color: var(--signal); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .scanline, .pulse { animation: none; }
  .iconbtn, .pill, .ghost, .chip { transition-duration: .01s; }
}
